Description Usage Arguments Author(s) References Examples
Given the position and orientation of two antennas, calculate the one-way free space power gain between them, taking into account distance, antenna patterns, and polarization, but not atmospheric effects.
1 | friis(ant1, ant2, waveLength = 3e+08/166380000)
|
ant1 |
first antenna (a 'proto' object of class 'antenna') |
ant2 |
second antenna (a 'proto' object of class 'antenna') |
waveLength |
in metres. Defaults to the wavelength of the telemetry band frequency 166.38 MHz |
John Brzustowski jbrzusto@REMOVE_THIS_PART_fastmail.fm
http://en.wikipedia.org/wiki/Dipole_antenna#Half-wave_dipole
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | ##
##
## simple test: 4 omnis set up at corners of 1000 metre square
## bird flies past on random path at random speed
##
## receivers: 4 vertical omni antennas at corners of 1000 metre square
## centred at (0, 0, 0)
rx = list (
makeOmni(c( -500, -500, 0), "vertical"),
makeOmni(c( -500, 500, 0), "vertical"),
makeOmni(c( 500, -500, 0), "vertical"),
makeOmni(c( 500, 500, 0), "vertical")
)
## random uniform bird path (parallel to ground at random height)
## uniform velocity (x, y) each component in range [-10, 10] m/s
## and component 0 in z direction
velocity = c(runif(2, -10, 10), 0)
## constant height
height = runif(1, 0, 2000)
## random (x, y) location at time zero, in 2000 x 2000 metre square
## centred at (0, 0, 0)
loc0 = c(runif(2, -1000, 1000), height)
## path time interval is [-100, 100] seconds; tag bursts every 5 seconds
t = seq(from = -300, to = 300, by = 5)
n = length(t)
## path: n x 3 matrix giving x, y, z at each location
path = t(t(outer(t, velocity, `*`)) + loc0)
## bird's transmitter antenna
tx = makeOmni(pos=path[1,], axis=velocity)
dB = function(x) 10*log10(x)
## calculate relative signal strength at each receiver at each point in time
tx$pos = path
rss = lapply(rx, function(x, y) dB(friis(x, y)), tx)
plot(t, rss[[1]], ylim=range(unlist(rss)))
for(i in 2:length(rx))
points(t, rss[[i]], col=i)
plot(path[,1:2], xlim=c(-2000,2000), ylim=c(-2000,2000), type="l")
arrows(path[1,1], path[1,2], path[n,1], path[n,2])
for (i in seq(along=rx))
points((t(rx[[i]]$pos[1:2])), pch=as.character(i), col=i)
## another test: each antenna oriented horizontally and perpendicular
## to displacement from origin
rx = list (
makeOmni(c( -500, -500, 0), c(1, -1, 0)),
makeOmni(c( -500, 500, 0), c(1, 1, 0)),
makeOmni(c( 500, -500, 0), c(1, 1, 0)),
makeOmni(c( 500, 500, 0), c(1, -1, 0))
)
rss = lapply(rx, function(x, y) dB(friis(x, y)), tx)
plot(t, rss[[1]], ylim=range(unlist(rss)))
for(i in 2:length(rx))
points(t, rss[[i]], col=i)
plot(path[,1:2], xlim=c(-2000,2000), ylim=c(-2000,2000), type="l")
arrows(path[1,1], path[1,2], path[n,1], path[n,2])
for (i in seq(along=rx))
points((t(rx[[i]]$pos[1:2])), pch=as.character(i), col=i)
## now a Yagi antenna pointing NE at 45 degrees upward
a = makeYagi(n=9, axis1=c(45, 45), axis2="horizontal", pos=c(0, 0, 0))
## verify that the antenna pattern in the plane containing the antenna
## matches that of the antenna in standard position.
th=rad(0:360)
## a circle in the antenna's plane, starting in the antenna's major
## direction and going counter-clockwise (the antenna's axis matrix
## has the major axis on the second row; the cross-piece axis on the
## first row)
pl = cbind(cos(th), sin(th)) %*% a$axis[2:1,]
g = a$gain(pl)
scaled.g = 30 + pmax(-30, 10*log10(g))
plot(cos(th) * scaled.g, sin(th) * scaled.g)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.