From 07dedef969f10af03d3df683f854b13d9301239f Mon Sep 17 00:00:00 2001 From: Cloud-RF Date: Wed, 15 Jan 2014 20:33:51 +0000 Subject: [PATCH] v1.3.8 Added Free Space Path Loss model (ITU-R P.525) --- fspl.cpp | 33 +++++++++++++++++++++++++++++++++ main.cpp | 15 +++++++++++---- 2 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 fspl.cpp diff --git a/fspl.cpp b/fspl.cpp new file mode 100644 index 0000000..acfd3f5 --- /dev/null +++ b/fspl.cpp @@ -0,0 +1,33 @@ +/***************************************************************************** +* ITU-R P.525 Free Space Path Loss model for Signal Server by Alex Farrant * +* 15 January 2014 * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU General Public License as published by the * +* Free Software Foundation; either version 2 of the License or any later * +* version. * +* * +* This program is distributed in the hope that it will useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * +* for more details. * +* */ + +#include +#include +#include + +using namespace std; + +double FsplLinkdB(float f, float d){ +/* +Free Space Path Loss model +Frequency: Any +Distance: Any +*/ + //MHz to GHz + f = f / 1000; + + double dbloss = (20 * log10(d)) + (20 * log10(f)) + 92.45; + + return dbloss; +} diff --git a/main.cpp b/main.cpp index 6c65f4f..cf08c85 100644 --- a/main.cpp +++ b/main.cpp @@ -1,5 +1,5 @@ /****************************************************************************\ -* Signal Server 1.3.7: Server optimised SPLAT! by Alex Farrant * +* Signal Server 1.3.8: Server optimised SPLAT! by Alex Farrant * ****************************************************************************** * SPLAT! Project started in 1997 by John A. Magliacane, KD2BD * * * @@ -19,7 +19,7 @@ * for more details. * * * ****************************************************************************** -* g++ -Wall -O3 -s -lm -fomit-frame-pointer itm.cpp cost.cpp hata.cpp main.cpp -o ss * +* g++ -Wall -O3 -s -lm -fomit-frame-pointer itm.cpp hata.cpp cost.cpp fspl.cpp main.cpp -o ss * \****************************************************************************/ #include @@ -122,6 +122,8 @@ double HataLinkdB(float f,float h_B, float h_M, float d, int mode); double CostHataLinkdB(float f,float h_B, float h_M, float d); +double FsplLinkdB(float f, float d); + double ked(double freq, double elev[], double rxh, double dkm); double arccos(double x, double y) @@ -1788,6 +1790,11 @@ void PlotPropPath(struct site source, struct site destination, unsigned char mas // COST231-HATA loss=CostHataLinkdB(LR.frq_mhz,txelev,path.elevation[y]+(destination.alt*METERS_PER_FOOT),dkm); break; + case 7: + // ITU-R P.525 Free space path loss + loss=FsplLinkdB(LR.frq_mhz,dkm); + //fprintf(stdout,"MHz: %1f KM: %1f = %1fdB",LR.frq_mhz,dkm,loss); + break; default: point_to_point(elev,source.alt*METERS_PER_FOOT, @@ -3803,7 +3810,7 @@ int main(int argc, char *argv[]) - strncpy(ss_version,"1.3.7\0",6); + strncpy(ss_version,"1.3.8\0",6); strncpy(ss_name,"Signal Server\0",14); if (argc==1) @@ -3830,7 +3837,7 @@ int main(int argc, char *argv[]) fprintf(stdout," -R Radius (miles/kilometers)\n"); fprintf(stdout," -res Pixels per degree. 300/600/1200(default)/3600 (optional)\n"); fprintf(stdout," -t Terrain background\n"); - fprintf(stdout," -pm Propagation model. 1: ITM (Default), 2: LOS, 3-5: Hata\n"); + fprintf(stdout," -pm Propagation model. 1: ITM (Default), 2: LOS, 3-5: Hata, 6: COST231, 7: ITU525\n"); fprintf(stdout," -ked Knife edge diffraction (Default for ITM)\n"); fprintf(stdout," -wf Win32 SDF tile names ('=' not ':')\n"); fprintf(stdout," -dbg Debug mode\n\n");