forked from ExternalVendorCode/Signal-Server
3.01 Image crop, SUI bugfix, txelev replaced
This commit is contained in:
2
common.h
2
common.h
@@ -106,6 +106,8 @@ extern __thread double *elev;
|
|||||||
extern double westoffset;
|
extern double westoffset;
|
||||||
extern double eastoffset;
|
extern double eastoffset;
|
||||||
extern double delta;
|
extern double delta;
|
||||||
|
extern double cropLat;
|
||||||
|
extern double cropLon;
|
||||||
|
|
||||||
extern char string[];
|
extern char string[];
|
||||||
extern char sdf_path[];
|
extern char sdf_path[];
|
||||||
|
@@ -261,7 +261,7 @@ int loadLIDAR(char *filenames)
|
|||||||
}
|
}
|
||||||
// add fudge as reprojected tiles sometimes vary by a pixel or ten
|
// add fudge as reprojected tiles sometimes vary by a pixel or ten
|
||||||
IPPD+=50;
|
IPPD+=50;
|
||||||
ARRAYSIZE = (MAXPAGES * IPPD) + 50;
|
ARRAYSIZE = (MAXPAGES * IPPD)+50;
|
||||||
do_allocs();
|
do_allocs();
|
||||||
dem_alloced = 1;
|
dem_alloced = 1;
|
||||||
}
|
}
|
||||||
|
70
main.cc
70
main.cc
@@ -1,4 +1,4 @@
|
|||||||
double version = 3.00;
|
double version = 3.01;
|
||||||
/****************************************************************************\
|
/****************************************************************************\
|
||||||
* Signal Server: Radio propagation simulator by Alex Farrant QCVS, 2E0TDW *
|
* Signal Server: Radio propagation simulator by Alex Farrant QCVS, 2E0TDW *
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
@@ -47,7 +47,8 @@ char string[255], sdf_path[255], udt_file[255], opened = 0, gpsav =
|
|||||||
double earthradius, max_range = 0.0, forced_erp, dpp, ppd, yppd,
|
double earthradius, max_range = 0.0, forced_erp, dpp, ppd, yppd,
|
||||||
fzone_clearance = 0.6, forced_freq, clutter, lat, lon, txh, tercon, terdic,
|
fzone_clearance = 0.6, forced_freq, clutter, lat, lon, txh, tercon, terdic,
|
||||||
north, east, south, west, dBm, loss, field_strength,
|
north, east, south, west, dBm, loss, field_strength,
|
||||||
min_north = 90, max_north = -90, min_west = 360, max_west = -1, westoffset=180, eastoffset=-180, delta=0, rxGain=0;
|
min_north = 90, max_north = -90, min_west = 360, max_west = -1, westoffset=180, eastoffset=-180, delta=0, rxGain=0,
|
||||||
|
cropLat=-70, cropLon=0;
|
||||||
|
|
||||||
int ippd, mpi,
|
int ippd, mpi,
|
||||||
max_elevation = -32768, min_elevation = 32768, bzerror, contour_threshold,
|
max_elevation = -32768, min_elevation = 32768, bzerror, contour_threshold,
|
||||||
@@ -351,6 +352,23 @@ int AddElevation(double lat, double lon, double height, int size)
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double dist(double lat1, double lon1, double lat2, double lon2)
|
||||||
|
{
|
||||||
|
//ENHANCED HAVERSINE FORMULA WITH RADIUS SLIDER
|
||||||
|
double dx, dy, dz;
|
||||||
|
int polarRadius=6357;
|
||||||
|
int equatorRadius=6378;
|
||||||
|
int delta = equatorRadius-polarRadius; // 21km
|
||||||
|
float earthRadius = equatorRadius - ((lat1/100) * delta);
|
||||||
|
lon1 -= lon2;
|
||||||
|
lon1 *= DEG2RAD, lat1 *= DEG2RAD, lat2 *= DEG2RAD;
|
||||||
|
|
||||||
|
dz = sin(lat1) - sin(lat2);
|
||||||
|
dx = cos(lon1) * cos(lat1) - cos(lat2);
|
||||||
|
dy = sin(lon1) * cos(lat1);
|
||||||
|
return asin(sqrt(dx * dx + dy * dy + dz * dz) / 2) * 2 * earthRadius;
|
||||||
|
}
|
||||||
|
|
||||||
double Distance(struct site site1, struct site site2)
|
double Distance(struct site site1, struct site site2)
|
||||||
{
|
{
|
||||||
/* This function returns the great circle distance
|
/* This function returns the great circle distance
|
||||||
@@ -1024,7 +1042,7 @@ int main(int argc, char *argv[])
|
|||||||
int x, y, z = 0, min_lat, min_lon, max_lat, max_lon,
|
int x, y, z = 0, min_lat, min_lon, max_lat, max_lon,
|
||||||
rxlat, rxlon, txlat, txlon, west_min, west_max,
|
rxlat, rxlon, txlat, txlon, west_min, west_max,
|
||||||
nortRxHin, nortRxHax, propmodel, knifeedge = 0, ppa =
|
nortRxHin, nortRxHax, propmodel, knifeedge = 0, ppa =
|
||||||
0, normalise = 0, haf = 0, pmenv = 1, lidar=0;
|
0, normalise = 0, haf = 0, pmenv = 1, lidar=0, cropped;
|
||||||
|
|
||||||
bool use_threads = true;
|
bool use_threads = true;
|
||||||
|
|
||||||
@@ -1799,18 +1817,25 @@ int main(int argc, char *argv[])
|
|||||||
hottest=9; // 9dB nearfield
|
hottest=9; // 9dB nearfield
|
||||||
|
|
||||||
// nearfield bugfix
|
// nearfield bugfix
|
||||||
for (lat = tx_site[0].lat - 0.001;
|
for (lat = tx_site[0].lat - 0.0005;
|
||||||
lat <= tx_site[0].lat + 0.001;
|
lat <= tx_site[0].lat + 0.0005;
|
||||||
lat = lat + 0.0001) {
|
lat = lat + 0.0005) {
|
||||||
for (lon = tx_site[0].lon - 0.001;
|
for (lon = tx_site[0].lon - 0.0005;
|
||||||
lon <= tx_site[0].lon + 0.001;
|
lon <= tx_site[0].lon + 0.0005;
|
||||||
lon = lon + 0.0001) {
|
lon = lon + 0.0005) {
|
||||||
PutSignal(lat, lon, hottest);
|
PutSignal(lat, lon, hottest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CROPPING. croplat assigned in propPathLoss()
|
||||||
|
max_north=cropLat; // MAX(path.lat[y])
|
||||||
|
max_west=cropLon; // MAX(path.lon[y])
|
||||||
|
cropLat-=tx_site[0].lat; // angle from tx to edge
|
||||||
|
cropLon-=tx_site[0].lon;
|
||||||
|
width=(int)((cropLon*ppd)*2);
|
||||||
|
height=(int)((cropLat*ppd)*2);
|
||||||
|
|
||||||
// Write bitmap
|
// Write bitmap
|
||||||
if (LR.erp == 0.0)
|
if (LR.erp == 0.0)
|
||||||
DoPathLoss(mapfile, geo, kml, ngs, tx_site,
|
DoPathLoss(mapfile, geo, kml, ngs, tx_site,
|
||||||
@@ -1827,12 +1852,27 @@ int main(int argc, char *argv[])
|
|||||||
west=westoffset;
|
west=westoffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print WGS84 bounds
|
if (tx_site[0].lon > 0.0){
|
||||||
fprintf(stderr, "|%.6f", north);
|
tx_site[0].lon *= -1;
|
||||||
fprintf(stderr, "|%.6f", east);
|
}
|
||||||
fprintf(stderr, "|%.6f", south);
|
if (tx_site[0].lon < -180.0){
|
||||||
fprintf(stderr, "|%.6f|", west);
|
tx_site[0].lon += 360;
|
||||||
|
}
|
||||||
|
if (propmodel == 2) {
|
||||||
|
// No croppping because this is LOS
|
||||||
|
fprintf(stderr, "|%.6f", max_north);
|
||||||
|
fprintf(stderr, "|%.6f", east);
|
||||||
|
fprintf(stderr, "|%.6f", min_north);
|
||||||
|
fprintf(stderr, "|%.6f|",west);
|
||||||
|
}else{
|
||||||
|
// Cropped EPSG4326 coordinates
|
||||||
|
fprintf(stderr, "|%.6f", tx_site[0].lat+cropLat);
|
||||||
|
fprintf(stderr, "|%.6f", tx_site[0].lon+cropLon);
|
||||||
|
fprintf(stderr, "|%.6f", tx_site[0].lat-cropLat);
|
||||||
|
fprintf(stderr, "|%.6f|",tx_site[0].lon-cropLon);
|
||||||
|
}
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
strncpy(tx_site[0].name, "Tx", 3);
|
strncpy(tx_site[0].name, "Tx", 3);
|
||||||
|
@@ -304,7 +304,7 @@ void PlotPropPath(struct site source, struct site destination,
|
|||||||
xmtr_alt, dest_alt, xmtr_alt2, dest_alt2,
|
xmtr_alt, dest_alt, xmtr_alt2, dest_alt2,
|
||||||
cos_rcvr_angle, cos_test_angle = 0.0, test_alt,
|
cos_rcvr_angle, cos_test_angle = 0.0, test_alt,
|
||||||
elevation = 0.0, distance = 0.0, four_thirds_earth,
|
elevation = 0.0, distance = 0.0, four_thirds_earth,
|
||||||
field_strength = 0.0, rxp, dBm, txelev, dkm, diffloss;
|
field_strength = 0.0, rxp, dBm, dkm, diffloss;
|
||||||
struct site temp;
|
struct site temp;
|
||||||
|
|
||||||
ReadPath(source, destination);
|
ReadPath(source, destination);
|
||||||
@@ -323,7 +323,6 @@ void PlotPropPath(struct site source, struct site destination,
|
|||||||
/* Copy ending points without clutter */
|
/* Copy ending points without clutter */
|
||||||
|
|
||||||
elev[2] = path.elevation[0] * METERS_PER_FOOT;
|
elev[2] = path.elevation[0] * METERS_PER_FOOT;
|
||||||
txelev = elev[2] + (source.alt * METERS_PER_FOOT);
|
|
||||||
|
|
||||||
elev[path.length + 1] =
|
elev[path.length + 1] =
|
||||||
path.elevation[path.length - 1] * METERS_PER_FOOT;
|
path.elevation[path.length - 1] * METERS_PER_FOOT;
|
||||||
@@ -446,6 +445,8 @@ void PlotPropPath(struct site source, struct site destination,
|
|||||||
dkm = (elev[1] * elev[0]) / 1000; // km
|
dkm = (elev[1] * elev[0]) / 1000; // km
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch (propmodel) {
|
switch (propmodel) {
|
||||||
case 1:
|
case 1:
|
||||||
// Longley Rice ITM
|
// Longley Rice ITM
|
||||||
@@ -462,16 +463,15 @@ void PlotPropPath(struct site source, struct site destination,
|
|||||||
case 3:
|
case 3:
|
||||||
//HATA 1, 2 & 3
|
//HATA 1, 2 & 3
|
||||||
loss =
|
loss =
|
||||||
HATApathLoss(LR.frq_mhz, txelev,
|
HATApathLoss(LR.frq_mhz, source.alt * METERS_PER_FOOT,
|
||||||
path.elevation[y] +
|
(path.elevation[y] * METERS_PER_FOOT) + (destination.alt * METERS_PER_FOOT), dkm, pmenv);
|
||||||
(destination.alt *
|
|
||||||
METERS_PER_FOOT), dkm, pmenv);
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
// ECC33
|
// ECC33
|
||||||
loss =
|
loss =
|
||||||
ECC33pathLoss(LR.frq_mhz, txelev,
|
ECC33pathLoss(LR.frq_mhz, source.alt * METERS_PER_FOOT,
|
||||||
path.elevation[y] +
|
(path.elevation[y] *
|
||||||
|
METERS_PER_FOOT) +
|
||||||
(destination.alt *
|
(destination.alt *
|
||||||
METERS_PER_FOOT), dkm,
|
METERS_PER_FOOT), dkm,
|
||||||
pmenv);
|
pmenv);
|
||||||
@@ -479,16 +479,18 @@ void PlotPropPath(struct site source, struct site destination,
|
|||||||
case 5:
|
case 5:
|
||||||
// SUI
|
// SUI
|
||||||
loss =
|
loss =
|
||||||
SUIpathLoss(LR.frq_mhz, txelev,
|
SUIpathLoss(LR.frq_mhz, source.alt * METERS_PER_FOOT,
|
||||||
path.elevation[y] +
|
(path.elevation[y] *
|
||||||
|
METERS_PER_FOOT) +
|
||||||
(destination.alt *
|
(destination.alt *
|
||||||
METERS_PER_FOOT), dkm, pmenv);
|
METERS_PER_FOOT), dkm, pmenv);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
// COST231-Hata
|
// COST231-Hata
|
||||||
loss =
|
loss =
|
||||||
COST231pathLoss(LR.frq_mhz, txelev,
|
COST231pathLoss(LR.frq_mhz, source.alt * METERS_PER_FOOT,
|
||||||
path.elevation[y] +
|
(path.elevation[y] *
|
||||||
|
METERS_PER_FOOT) +
|
||||||
(destination.alt *
|
(destination.alt *
|
||||||
METERS_PER_FOOT), dkm,
|
METERS_PER_FOOT), dkm,
|
||||||
pmenv);
|
pmenv);
|
||||||
@@ -512,8 +514,9 @@ void PlotPropPath(struct site source, struct site destination,
|
|||||||
case 9:
|
case 9:
|
||||||
// Ericsson
|
// Ericsson
|
||||||
loss =
|
loss =
|
||||||
EricssonpathLoss(LR.frq_mhz, txelev,
|
EricssonpathLoss(LR.frq_mhz, source.alt * METERS_PER_FOOT,
|
||||||
path.elevation[y] +
|
(path.elevation[y] *
|
||||||
|
METERS_PER_FOOT) +
|
||||||
(destination.alt *
|
(destination.alt *
|
||||||
METERS_PER_FOOT), dkm,
|
METERS_PER_FOOT), dkm,
|
||||||
pmenv);
|
pmenv);
|
||||||
@@ -521,7 +524,7 @@ void PlotPropPath(struct site source, struct site destination,
|
|||||||
|
|
||||||
case 10:
|
case 10:
|
||||||
// Plane earth
|
// Plane earth
|
||||||
loss = PlaneEarthLoss(dkm, txelev, path.elevation[y] + (destination.alt * METERS_PER_FOOT));
|
loss = PlaneEarthLoss(dkm, source.alt * METERS_PER_FOOT, (path.elevation[y] * METERS_PER_FOOT) + (destination.alt * METERS_PER_FOOT));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -537,6 +540,7 @@ void PlotPropPath(struct site source, struct site destination,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (knifeedge == 1) {
|
if (knifeedge == 1) {
|
||||||
diffloss =
|
diffloss =
|
||||||
ked(LR.frq_mhz,
|
ked(LR.frq_mhz,
|
||||||
@@ -677,6 +681,11 @@ void PlotPropPath(struct site source, struct site destination,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(path.lat[y]>cropLat)
|
||||||
|
cropLat=path.lat[y];
|
||||||
|
|
||||||
|
if(path.lon[y]>cropLon)
|
||||||
|
cropLon=path.lon[y];
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlotLOSMap(struct site source, double altitude, char *plo_filename,
|
void PlotLOSMap(struct site source, double altitude, char *plo_filename,
|
||||||
|
@@ -9,9 +9,9 @@ double SUIpathLoss(float f, float TxH, float RxH, float d, int mode)
|
|||||||
TxH = Transmitter height (m)
|
TxH = Transmitter height (m)
|
||||||
RxH = Receiver height (m)
|
RxH = Receiver height (m)
|
||||||
d = distance (km)
|
d = distance (km)
|
||||||
mode 1 = Hilly + trees
|
mode A1 = Hilly + trees
|
||||||
mode 2 = Flat + trees OR hilly + light foliage
|
mode B2 = Flat + trees OR hilly + light foliage
|
||||||
mode 3 = Flat + light foliage
|
mode C3 = Flat + light foliage
|
||||||
http://www.cl.cam.ac.uk/research/dtg/lce-pub/public/vsa23/VTC05_Empirical.pdf
|
http://www.cl.cam.ac.uk/research/dtg/lce-pub/public/vsa23/VTC05_Empirical.pdf
|
||||||
*/
|
*/
|
||||||
d = d * 1000; // km to m
|
d = d * 1000; // km to m
|
||||||
@@ -45,5 +45,5 @@ double SUIpathLoss(float f, float TxH, float RxH, float d, int mode)
|
|||||||
double Xf = 6 * log10(f / 2000);
|
double Xf = 6 * log10(f / 2000);
|
||||||
double Xh = XhCF * log10(RxH / 2000);
|
double Xh = XhCF * log10(RxH / 2000);
|
||||||
|
|
||||||
return A + (10 * y) * (log10(d / d0)) + Xf + Xh + s;
|
return A + (10 * y * log10(d / d0)) + Xf + Xh + s;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user