diff --git a/CHANGELOG b/CHANGELOG index cd0a5b2..693010f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,11 @@ SIGNAL SERVER CHANGELOG +2.82 - 15 July 2016 +Fixed bug in SUI model which was making it over optimistic. + +2.81 - 01 July 2016 +Added Rx gain value for PPA report only and tweaked text report to show ERP/EIRP with and without Rx gain + 2.8 - 08 June 2016 Widened scope of LIDAR / ASCII Grid input to include sub-meter accurate tiles. (ac000) Optimised memory usage (ac000) diff --git a/inputs.cc b/inputs.cc index 6fd6b16..922fc18 100644 --- a/inputs.cc +++ b/inputs.cc @@ -81,7 +81,6 @@ void readLIDAR(FILE *fd, int hoffset, int voffset, int h, int w, int indx, while (pch != NULL && x > -1) { if (atoi(pch) < -999) pch = "0"; - dem[indx].data[y][x] = atoi(pch); dem[indx].signal[x][y] = 0; dem[indx].mask[x][y] = 0; @@ -147,19 +146,20 @@ int loadLIDAR(char *filenames) fd = fopen(files[indx], "rb"); if (fd != NULL) { - if (debug) { - fprintf(stdout, "Loading \"%s\" into page %d...\n", files[indx], indx); - fflush(stdout); - } + if (fgets(line, 19, fd) != NULL) { pch = strtok (line," "); pch = strtok (NULL, " "); width = atoi(pch); + if (debug) { + fprintf(stdout, "Loading \"%s\" into page %d with width %d...\n", files[indx], indx, width); + fflush(stdout); + } + if (!dem_alloced) { IPPD = width; ARRAYSIZE = (MAXPAGES * IPPD) + 10; - do_allocs(); dem_alloced = 1; } @@ -247,8 +247,7 @@ int loadLIDAR(char *filenames) if (debug) fprintf(stdout, "readLIDAR(fd,%d,%d,%d,%d,%d,%.4f,%.4f,%.4f,%.4f)\n", 0, 0, height, width, indx, yur, xur, yll, xll); - readLIDAR(fd, 0, 0, height, width, indx, yur, xur, yll, - xll); + readLIDAR(fd, 0, 0, height, width, indx, yur, xur, yll, xll); //rewind fseek(fd, pos, SEEK_SET); @@ -260,8 +259,7 @@ int loadLIDAR(char *filenames) if (debug) fprintf(stdout, "readLIDAR(fd,%d,%d,%d,%d,%d,%.4f,%.4f,%.4f,%.4f)\n", width / 2, 0, height, width, indx, yur, xur, yll, xll); - readLIDAR(fd, width / 2, 0, height, width, - indx, yur, xur, yll, xll); + readLIDAR(fd, width / 2, 0, height, width, indx, yur, xur, yll, xll); } //rewind fseek(fd, pos, SEEK_SET); @@ -274,8 +272,7 @@ int loadLIDAR(char *filenames) if (debug) fprintf(stdout, "readLIDAR(fd,%d,%d,%d,%d,%d,%.4f,%.4f,%.4f,%.4f)\n", 0, height / 2, height, width, indx, yur, xur, yll, xll); - readLIDAR(fd, 0, height / 2, height, width, - indx, yur, xur, yll, xll); + readLIDAR(fd, 0, height / 2, height, width, indx, yur, xur, yll, xll); } //rewind fseek(fd, pos, SEEK_SET); @@ -288,9 +285,7 @@ int loadLIDAR(char *filenames) if (debug) fprintf(stdout, "readLIDAR(fd,%d,%d,%d,%d,%d,%.4f,%.4f,%.4f,%.4f)\n", width / 2, height / 2, height, width, indx, yur, xur, yll, xll); - readLIDAR(fd, width / 2, height / 2, height, - width, indx, yur, xur, yll, - xll); + readLIDAR(fd, width / 2, height / 2, height, width, indx, yur, xur, yll, xll); } fclose(fd); if (debug) diff --git a/main.cc b/main.cc index 6e7567d..4c83952 100644 --- a/main.cc +++ b/main.cc @@ -1,4 +1,4 @@ -double version = 2.8; +double version = 2.82; /****************************************************************************\ * Signal Server: Radio propagation simulator by Alex Farrant QCVS, 2E0TDW * ****************************************************************************** @@ -35,7 +35,7 @@ double version = 2.8; #include "models/los.hh" int MAXPAGES = 64; -int ARRAYSIZE = 76810; +int ARRAYSIZE = 76810;//76810; int IPPD = 1200; char string[255], sdf_path[255], udt_file[255], opened = 0, gpsav = @@ -44,7 +44,7 @@ char string[255], sdf_path[255], udt_file[255], opened = 0, gpsav = double earthradius, max_range = 0.0, forced_erp, dpp, ppd, yppd, fzone_clearance = 0.6, forced_freq, clutter, lat, lon, txh, tercon, terdic, 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; + min_north = 90, max_north = -90, min_west = 360, max_west = -1, westoffset=-180, eastoffset=180, delta=0, rxGain=0; int ippd, mpi, max_elevation = -32768, min_elevation = 32768, bzerror, contour_threshold, @@ -1048,8 +1048,9 @@ int main(int argc, char *argv[]) fprintf(stdout, " -rla (Optional) Rx Latitude for PPA (decimal degrees) -70/+70\n"); fprintf(stdout, " -rlo (Optional) Rx Longitude for PPA (decimal degrees) -180/+180\n"); fprintf(stdout, " -f Tx Frequency (MHz) 20MHz to 100GHz (LOS after 20GHz)\n"); - fprintf(stdout, " -erp Tx Effective Radiated Power (Watts)\n"); + fprintf(stdout, " -erp Tx Effective Radiated Power (Watts) including Tx+Rx gain\n"); fprintf(stdout, " -rxh Rx Height(s) (optional. Default=0.1)\n"); + fprintf(stdout, " -rxg Rx gain dBi (optional for text report)\n"); fprintf(stdout, " -hp Horizontal Polarisation (default=vertical)\n"); fprintf(stdout, " -gc Ground clutter (feet/meters)\n"); fprintf(stdout, " -m Metric units of measurement\n"); @@ -1295,6 +1296,14 @@ int main(int argc, char *argv[]) } } + if (strcmp(argv[x], "-rxg") == 0) { + z = x + 1; + + if (z <= y && argv[z][0] && argv[z][0] != '-') { + sscanf(argv[z], "%lf", &rxGain); + } + } + if (strcmp(argv[x], "-f") == 0) { z = x + 1; @@ -1750,7 +1759,7 @@ int main(int argc, char *argv[]) strncpy(tx_site[1].name, "Rx", 3); PlotPath(tx_site[0], tx_site[1], 1); PathReport(tx_site[0], tx_site[1], tx_site[0].filename, 0, - propmodel, pmenv); + propmodel, pmenv, rxGain); SeriesData(tx_site[1], tx_site[0], tx_site[0].filename, 1, normalise); } diff --git a/models/sui.cc b/models/sui.cc index db0eaf5..113962c 100644 --- a/models/sui.cc +++ b/models/sui.cc @@ -43,7 +43,7 @@ double SUIpathLoss(float f, float TxH, float RxH, float d, int mode) double A = 20 * log10((4 * M_PI * d0) / (300 / f)); double y = a - (b * TxH) + (c / TxH); double Xf = 6 * log10(f / 2000); - double Xh = XhCF * log10(RxH / 20); + double Xh = XhCF * log10(RxH / 2000); return A + (10 * y) * (log10(d / d0)) + Xf + Xh + s; } diff --git a/outputs.cc b/outputs.cc index 3e47859..187a0c6 100644 --- a/outputs.cc +++ b/outputs.cc @@ -965,7 +965,7 @@ void DoLOS(char *filename, unsigned char geo, unsigned char kml, } void PathReport(struct site source, struct site destination, char *name, - char graph_it, int propmodel, int pmenv) + char graph_it, int propmodel, int pmenv, double rxGain) { /* This function writes a PPA Path Report (name.txt) to the filesystem. If (graph_it == 1), then gnuplot is invoked @@ -1142,7 +1142,7 @@ void PathReport(struct site source, struct site destination, char *name, } if (LR.frq_mhz > 0.0) { - fprintf(fd2, "\nPropagation model: "); + fprintf(fd2, "\n\nPropagation model: "); switch (propmodel) { case 1: @@ -1243,7 +1243,9 @@ void PathReport(struct site source, struct site destination, char *name, fprintf(fd2, "Fraction of Time: %.1lf%c\n", LR.rel * 100.0, 37); if (LR.erp != 0.0) { - fprintf(fd2, "Transmitter ERP: "); + fprintf(fd2, "\nReceiver gain: %.2f dBd\n", rxGain); + fprintf(fd2, "Receiver gain: %.2f dBi\n", rxGain+2.14); + fprintf(fd2, "Transmitter ERP plus Receiver gain: "); if (LR.erp < 1.0) fprintf(fd2, "%.1lf milliwatts", @@ -1260,10 +1262,11 @@ void PathReport(struct site source, struct site destination, char *name, dBm = 10.0 * (log10(LR.erp * 1000.0)); fprintf(fd2, " (%+.2f dBm)\n", dBm); + fprintf(fd2, "Transmitter ERP minus Receiver gain: %.2f dBm\n", dBm-rxGain); /* EIRP = ERP + 2.14 dB */ - fprintf(fd2, "Transmitter EIRP: "); + fprintf(fd2, "Transmitter EIRP plus Receiver gain: "); eirp = LR.erp * 1.636816521; @@ -1281,6 +1284,9 @@ void PathReport(struct site source, struct site destination, char *name, dBm = 10.0 * (log10(eirp * 1000.0)); fprintf(fd2, " (%+.2f dBm)\n", dBm); + + // Rx gain + fprintf(fd2, "Transmitter EIRP minus Receiver gain: %.2f dBm\n", dBm-rxGain); } fprintf(fd2, "\nSummary for the link between %s and %s:\n\n", diff --git a/outputs.hh b/outputs.hh index f0bda3c..ac334e4 100644 --- a/outputs.hh +++ b/outputs.hh @@ -10,7 +10,7 @@ void DoRxdPwr(char *filename, unsigned char geo, unsigned char kml, void DoLOS(char *filename, unsigned char geo, unsigned char kml, unsigned char ngs, struct site *xmtr, unsigned char txsites); void PathReport(struct site source, struct site destination, char *name, - char graph_it, int propmodel, int pmenv); + char graph_it, int propmodel, int pmenv, double rxGain); void SeriesData(struct site source, struct site destination, char *name, unsigned char fresnel_plot, unsigned char normalised);