Skip to content

Commit 6986790

Browse files
committed
Fixes #5 with some additional information provided to user
1 parent a3020f1 commit 6986790

File tree

7 files changed

+52
-24
lines changed

7 files changed

+52
-24
lines changed

include/Enums.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@
2828

2929
// List of valid modes of propagation
3030
#define MODE__NOT_SET 0
31-
#define MODE__LINE_OF_SIGHT 1
32-
#define MODE__DIFFRACTION 2
33-
#define MODE__TROPOSCATTER 3
31+
#define MODE__LINE_OF_SIGHT 10
32+
#define MODE__DIFFRACTION_SINGLE_HORIZON 20
33+
#define MODE__DIFFRACTION_DOUBLE_HORIZON 21
34+
#define MODE__TROPOSCATTER_SINGLE_HORIZON 30
35+
#define MODE__TROPOSCATTER_DOUBLE_HORIZON 31
3436

3537
// List of modes of variability
3638
#define MDVAR__SINGLE_MESSAGE_MODE 0

src/LongleyRice.cpp

+15-8
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ int LongleyRice(double theta_hzn[2], double f__mhz, complex<double> Z_g, double
3131
double h_e__meter[2], double gamma_e, double N_s, double delta_h__meter, double h__meter[2],
3232
double d__meter, int mode, double *A_ref__db, long *warnings, int *propmode)
3333
{
34+
double d_x__meter = 0;
35+
3436
// effective earth radius
3537
double a_e__meter = 1 / gamma_e;
3638

@@ -170,7 +172,6 @@ int LongleyRice(double theta_hzn[2], double f__mhz, complex<double> Z_g, double
170172

171173
// [ERL 79-ITS 67, Eqn 3.19]
172174
*A_ref__db = A_o__db + kHat_1__db_per_meter * d__meter + kHat_2__db_per_meter * log(d__meter);
173-
*propmode = MODE__LINE_OF_SIGHT;
174175
}
175176
else // this is a trans-horizon path
176177
{
@@ -183,7 +184,7 @@ int LongleyRice(double theta_hzn[2], double f__mhz, complex<double> Z_g, double
183184
double A_6__db = TroposcatterLoss(d_6__meter, theta_hzn, d_hzn__meter, h_e__meter, a_e__meter, N_s, f__mhz, theta_los, &h0);
184185
double A_5__db = TroposcatterLoss(d_5__meter, theta_hzn, d_hzn__meter, h_e__meter, a_e__meter, N_s, f__mhz, theta_los, &h0);
185186

186-
double M_s, A_s0__db, d_x__meter;
187+
double M_s, A_s0__db;
187188

188189
// if we got a reasonable prediction value back...
189190
if (A_5__db < 1000.0)
@@ -207,15 +208,21 @@ int LongleyRice(double theta_hzn[2], double f__mhz, complex<double> Z_g, double
207208

208209
// Determine if its diffraction or troposcatter and compute the loss
209210
if (d__meter > d_x__meter)
210-
{
211211
*A_ref__db = M_s * d__meter + A_s0__db;
212-
*propmode = MODE__TROPOSCATTER;
213-
}
214212
else
215-
{
216213
*A_ref__db = M_d * d__meter + A_d0__db;
217-
*propmode = MODE__DIFFRACTION;
218-
}
214+
}
215+
216+
// set mode of propagation
217+
double delta__meter = d__meter - d_ML__meter;
218+
if (int(delta__meter) < 0)
219+
*propmode = MODE__LINE_OF_SIGHT;
220+
else
221+
{
222+
if (d__meter <= d_sML__meter || d__meter <= d_x__meter)
223+
*propmode = (int(delta__meter) == 0) ? MODE__DIFFRACTION_SINGLE_HORIZON : MODE__DIFFRACTION_DOUBLE_HORIZON;
224+
else
225+
*propmode = (int(delta__meter) == 0) ? MODE__TROPOSCATTER_SINGLE_HORIZON : MODE__TROPOSCATTER_DOUBLE_HORIZON;
219226
}
220227

221228
// Don't allow a negative loss

win32/ITMDrvr/ITMDrvr.cpp

+12-3
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,20 @@ int main(int argc, char** argv) {
167167
fprintf_s(fp, "A_ref__db %-12.1f %s\n", inter_vals.A_ref__db, UNITS__DB);
168168
fprintf_s(fp, "Mode of Propagation %-12i ", inter_vals.mode);
169169
switch (inter_vals.mode) {
170-
case 1: fprintf_s(fp, "[%s]\n", LBL__LINE_OF_SITE);
170+
case MODE__LINE_OF_SIGHT:
171+
fprintf_s(fp, "[%s]\n", LBL__LINE_OF_SITE);
171172
break;
172-
case 2: fprintf_s(fp, "[%s]\n", LBL__DIFFRACTION);
173+
case MODE__DIFFRACTION_SINGLE_HORIZON:
174+
fprintf_s(fp, "[%s]\n", LBL__DIFFRACTION_SINGLE_HORIZON);
173175
break;
174-
case 3: fprintf_s(fp, "[%s]\n", LBL__TROPOSCATTER);
176+
case MODE__DIFFRACTION_DOUBLE_HORIZON:
177+
fprintf_s(fp, "[%s]\n", LBL__DIFFRACTION_DOUBLE_HORIZON);
178+
break;
179+
case MODE__TROPOSCATTER_SINGLE_HORIZON:
180+
fprintf_s(fp, "[%s]\n", LBL__TROPOSCATTER_SINGLE_HORIZON);
181+
break;
182+
case MODE__TROPOSCATTER_DOUBLE_HORIZON:
183+
fprintf_s(fp, "[%s]\n", LBL__TROPOSCATTER_DOUBLE_HORIZON);
175184
break;
176185
}
177186
}

win32/ITMDrvr/ITMDrvr.h

+8
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ using namespace std;
2020
#define VARY_CR 1
2121
#define TIME_SIZE 26
2222

23+
// List of valid modes of propagation
24+
#define MODE__NOT_SET 0
25+
#define MODE__LINE_OF_SIGHT 10
26+
#define MODE__DIFFRACTION_SINGLE_HORIZON 20
27+
#define MODE__DIFFRACTION_DOUBLE_HORIZON 21
28+
#define MODE__TROPOSCATTER_SINGLE_HORIZON 30
29+
#define MODE__TROPOSCATTER_DOUBLE_HORIZON 31
30+
2331
//
2432
// GENERAL ERRORS AND RETURN VALUES
2533
///////////////////////////////////////////////

win32/ITMDrvr/ITMDrvr.vcxproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,26 @@
4949
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
5050
<ConfigurationType>Application</ConfigurationType>
5151
<UseDebugLibraries>true</UseDebugLibraries>
52-
<PlatformToolset>v142</PlatformToolset>
52+
<PlatformToolset>v143</PlatformToolset>
5353
<CharacterSet>Unicode</CharacterSet>
5454
</PropertyGroup>
5555
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
5656
<ConfigurationType>Application</ConfigurationType>
5757
<UseDebugLibraries>false</UseDebugLibraries>
58-
<PlatformToolset>v142</PlatformToolset>
58+
<PlatformToolset>v143</PlatformToolset>
5959
<WholeProgramOptimization>true</WholeProgramOptimization>
6060
<CharacterSet>Unicode</CharacterSet>
6161
</PropertyGroup>
6262
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
6363
<ConfigurationType>Application</ConfigurationType>
6464
<UseDebugLibraries>true</UseDebugLibraries>
65-
<PlatformToolset>v142</PlatformToolset>
65+
<PlatformToolset>v143</PlatformToolset>
6666
<CharacterSet>Unicode</CharacterSet>
6767
</PropertyGroup>
6868
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
6969
<ConfigurationType>Application</ConfigurationType>
7070
<UseDebugLibraries>false</UseDebugLibraries>
71-
<PlatformToolset>v142</PlatformToolset>
71+
<PlatformToolset>v143</PlatformToolset>
7272
<WholeProgramOptimization>true</WholeProgramOptimization>
7373
<CharacterSet>Unicode</CharacterSet>
7474
</PropertyGroup>

win32/ITMDrvr/Labels.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88

99
// Modes of propagation
1010
#define LBL__LINE_OF_SITE "Line of Sight"
11-
#define LBL__DIFFRACTION "Diffraction"
12-
#define LBL__TROPOSCATTER "Troposcatter"
11+
#define LBL__DIFFRACTION_SINGLE_HORIZON "Diffraction, Single Horizon"
12+
#define LBL__DIFFRACTION_DOUBLE_HORIZON "Diffraction, Double Horizon"
13+
#define LBL__TROPOSCATTER_SINGLE_HORIZON "Troposcatter, Single Horizon"
14+
#define LBL__TROPOSCATTER_DOUBLE_HORIZON "Troposcatter, Double Horizon"
1315

1416
// Polarization
1517
#define LBL__POLARIZATION_HORIZONTAL "Horizontal"

win32/itm/itm.vcxproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -67,26 +67,26 @@
6767
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
6868
<ConfigurationType>DynamicLibrary</ConfigurationType>
6969
<UseDebugLibraries>true</UseDebugLibraries>
70-
<PlatformToolset>v142</PlatformToolset>
70+
<PlatformToolset>v143</PlatformToolset>
7171
<CharacterSet>Unicode</CharacterSet>
7272
</PropertyGroup>
7373
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
7474
<ConfigurationType>DynamicLibrary</ConfigurationType>
7575
<UseDebugLibraries>false</UseDebugLibraries>
76-
<PlatformToolset>v142</PlatformToolset>
76+
<PlatformToolset>v143</PlatformToolset>
7777
<WholeProgramOptimization>true</WholeProgramOptimization>
7878
<CharacterSet>Unicode</CharacterSet>
7979
</PropertyGroup>
8080
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
8181
<ConfigurationType>DynamicLibrary</ConfigurationType>
8282
<UseDebugLibraries>true</UseDebugLibraries>
83-
<PlatformToolset>v142</PlatformToolset>
83+
<PlatformToolset>v143</PlatformToolset>
8484
<CharacterSet>Unicode</CharacterSet>
8585
</PropertyGroup>
8686
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
8787
<ConfigurationType>DynamicLibrary</ConfigurationType>
8888
<UseDebugLibraries>false</UseDebugLibraries>
89-
<PlatformToolset>v142</PlatformToolset>
89+
<PlatformToolset>v143</PlatformToolset>
9090
<WholeProgramOptimization>true</WholeProgramOptimization>
9191
<CharacterSet>Unicode</CharacterSet>
9292
</PropertyGroup>

0 commit comments

Comments
 (0)