3.10 More tests and 360 min_west fix

This commit is contained in:
alex
2018-07-05 19:36:40 +01:00
parent 78cf7f04b3
commit e18f6b243e
11 changed files with 214 additions and 75 deletions

View File

@@ -11,6 +11,7 @@
#include "sui.hh"
#include "pel.hh"
#include "egli.hh"
#include "soil.hh"
#include <pthread.h>
#define NUM_SECTIONS 4
@@ -186,7 +187,7 @@ static double incidenceAngle(double opp, double adj)
*/
static double ked(double freq, double rxh, double dkm)
{
double obh, obd, rxobaoi = 0, d, dipheight = 25;
double obh, obd, rxobaoi = 0, d;
obh = 0; // Obstacle height
obd = 0; // Obstacle distance
@@ -199,7 +200,7 @@ static double ked(double freq, double rxh, double dkm)
d = (n - 2) * elev[1]; // no of points * delta = km
//Find dip(s)
if (elev[n] < (obh + dipheight)) {
if (elev[n] < obh) {
// Angle from Rx point to obstacle
rxobaoi =
@@ -218,9 +219,9 @@ static double ked(double freq, double rxh, double dkm)
}
if (rxobaoi >= 0) {
return rxobaoi / (300 / freq); // Diffraction angle divided by wavelength (m)
return (rxobaoi / (300 / freq))+3; // Diffraction angle divided by wavelength (m)
} else {
return 0;
return 1;
}
}
@@ -530,6 +531,12 @@ void PlotPropPath(struct site source, struct site destination,
// Egli VHF/UHF
loss = EgliPathLoss(LR.frq_mhz, source.alt * METERS_PER_FOOT, (path.elevation[y] * METERS_PER_FOOT) + (destination.alt * METERS_PER_FOOT),dkm);
break;
case 12:
// Soil
loss = SoilPathLoss(LR.frq_mhz, dkm, LR.eps_dielect);
break;
default:
point_to_point_ITM(source.alt * METERS_PER_FOOT,
destination.alt *
@@ -543,8 +550,8 @@ void PlotPropPath(struct site source, struct site destination,
}
if (knifeedge == 1) {
if (knifeedge == 1 && propmodel > 1) {
diffloss =
ked(LR.frq_mhz,
destination.alt * METERS_PER_FOOT, dkm);

33
models/soil.cc Normal file
View File

@@ -0,0 +1,33 @@
/*****************************************************************************
* Soil Path Loss model for Signal Server by Alex Farrant *
* 21 February 2018 *
* *
* 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. *
*
* Frequency: Any MHz
* Distance: Any Km
* Terrain permittivity: 1 - 15 (Bad to Good)
*/
#include <math.h>
// use call with log/ln as this may be faster
// use constant of value 20.0/log(10.0)
static __inline float _20log10f(float x)
{
return(8.685889f*logf(x));
}
double SoilPathLoss(float f, float d, float terdic)
{
float soil = (120/terdic);
return(6.4 + _20log10f(d) + _20log10f(f)+(8.69*soil));
}

6
models/soil.hh Normal file
View File

@@ -0,0 +1,6 @@
#ifndef _SOIL_HH_
#define _SOIL_HH_
double SoilPathLoss(float f, float d, float t);
#endif /* _SOIL_HH_ */

View File

@@ -2,44 +2,55 @@
#include <stdlib.h>
#include <math.h>
// use call with log/ln as this may be faster
// use constant of value 20.0/log(10.0)
static __inline float _20log10f(float x)
{
return(8.685889f*logf(x));
}
double SUIpathLoss(double f, double TxH, double RxH, double d, int mode)
{
/*
f = Frequency (MHz) 1900 to 11000
TxH = Transmitter height (m)
RxH = Receiver height (m)
d = distance (km)
mode A1 = URBAN / OBSTRUCTED
mode B2 = SUBURBAN / PARTIALLY OBSTRUCTED
mode C3 = RURAL / OPEN
http://www.cl.cam.ac.uk/research/dtg/lce-pub/public/vsa23/VTC05_Empirical.pdf
*/
d = d * 1000.0; // km to m
/*
f = Frequency (MHz) 1900 to 11000
TxH = Transmitter height (m)
RxH = Receiver height (m)
d = distance (km)
mode A1 = URBAN / OBSTRUCTED
mode B2 = SUBURBAN / PARTIALLY OBSTRUCTED
mode C3 = RURAL / OPEN
http://www.cl.cam.ac.uk/research/dtg/lce-pub/public/vsa23/VTC05_Empirical.pdf
*/
d *= 1e3; // km to m
// Urban (A1) is default
double a = 4.6;
double b = 0.0075;
double c = 12.6;
double s = 10.6; // Optional fading value. Max 10.6dB
double XhCF = -10.8;
// Urban (A1) is default
float a = 4.6;
float b = 0.0075;
float c = 12.6;
float s = 10.6; // Optional fading value. Max 10.6dB
float XhCF = -10.8;
if (mode == 2) { // Suburban
a = 4.0;
b = 0.0065;
c = 17.1;
}
if (mode == 3) { // Rural
a = 3.6;
b = 0.005;
c = 20;
XhCF = -20;
}
double d0 = 100;
double A = 20 * log10((4 * M_PI * d0) / (300.0 / f));
double y = a - (b * TxH) + (c / TxH);
//Correction factors
double Xf = 6.0 * log10(f / 2000);
double Xh = XhCF * log10(RxH / 2000);
return A + (10 * y * log10(d / d0)) + Xf + Xh + s;
if (mode == 2) { // Suburban
a = 4.0;
b = 0.0065;
c = 17.1;
XhCF = -10.8;
}
if (mode == 3) { // Rural
a = 3.6;
b = 0.005;
c = 20;
XhCF = -20;
}
float d0 = 100.0;
float A = _20log10f((4 * M_PI * d0) / (300.0 / f));
float y = a - (b * TxH) + (c / TxH);
//Correction factors
float Xf = 6.0 * log10(f / 2000.0);
float Xh = XhCF * log10(RxH / 2000.0);
Xh *=-1;
//fprintf(stdout,"A %lf y %lf Xf %lf Xh %lf\n",A,y,Xf,Xh);
return A + (10 * y * log10(d / d0)) + Xf + Xh + s;
}