#include <assert.h>
#include <stdio.h>
-const float THIRD = (1.0/3.0);
-const float f_0 = 47.7; // 47.7 MHz from [Alg 1.1], to convert frequency into wavenumber and vica versa
+const double THIRD = (1.0/3.0);
+const double f_0 = 47.7; // 47.7 MHz from [Alg 1.1], to convert frequency into wavenumber and vica versa
using namespace std;
return 0.0;
}
-#define set_warn(txt, err) printf("%s:%d %s\n", __func__, __LINE__, txt);
-
+//#define set_warn(txt, err) printf("%s:%d %s\n", __func__, __LINE__, txt);
+#define set_warn(txt, err) 1;
// :13: single-knife attenuation, page 6
/*
kdv = propv.mdvar;
no_situation_variability = kdv >= 20;
if (no_situation_variability)
- no_situation_variability -= 20;
+ kdv -= 20;
no_location_variability = kdv >= 10;
if (no_location_variability)
n = 10 * ka - 5;
kb = n - ka + 1;
sn = n - 1;
- assert((s = new double[n+2]) != 0);
+ s = new double[n+2];
s[0] = sn;
s[1] = 1.0;
xb = (xb - xa) / sn;
double rel, // 0.01 .. .99, Fractions of time
double &dbloss,
char *strmode,
+ int &p_mode, // propagation mode selector
+ double (&horizons)[2], // horizon distances
int &errnum)
{
// radio_climate: 1-Equatorial, 2-Continental Subtropical, 3-Maritime Tropical,
fs = 32.45 + 20.0 * log10(frq_mhz) + 20.0 * log10(prop.d / 1000.0);
q = prop.d - prop.d_L;
+ horizons[0] = 0.0;
+ horizons[1] = 0.0;
if (int(q) < 0.0) {
strcpy(strmode, "Line-Of-Sight Mode");
+ p_mode = 0;
} else {
- if (int(q) == 0.0)
+ if (int(q) == 0.0) {
strcpy(strmode, "Single Horizon");
+ horizons[0] = prop.d_Lj[0];
+ p_mode = 1;
+ }
- else
- if (int(q) > 0.0)
+ else {
+ if (int(q) > 0.0) {
strcpy(strmode, "Double Horizon");
+ horizons[0] = prop.d_Lj[0];
+ horizons[1] = prop.d_Lj[1];
+ p_mode = 1;
+ }
+ }
- if (prop.d <= prop.d_Ls || prop.d <= prop.dx)
+ if (prop.d <= prop.d_Ls || prop.d <= prop.dx) {
strcat(strmode, ", Diffraction Dominant");
+ p_mode = 1;
+ }
- else
- if (prop.d > prop.dx)
- strcat(strmode, ", Troposcatter Dominant");
+ else {
+ if (prop.d > prop.dx) {
+ strcat(strmode, ", Troposcatter Dominant");
+ p_mode = 2;
+ }
+ }
}
dbloss = avar(zr, 0.0, zc, prop, propv) + fs;