ITS.Propagation.LFMF 1.1
Part of the NTIA/ITS Propagation Library
Loading...
Searching...
No Matches
LFMF.h
Go to the documentation of this file.
1
4#pragma once
5
6#include <cfloat> // for DBL_EPSILON
7#include <complex> // for std::complex
8#include <string> // for std::string
9
10namespace ITS {
11namespace Propagation {
12namespace LFMF {
13
14// Define cross-platform DLLEXPORT
15// Export the DLL functions as "C" and not C++
16#ifndef DOXYGEN_SHOULD_SKIP
17 #ifdef _WIN32
18 #define DLLEXPORT extern "C" __declspec(dllexport)
19 #else
20 #define DLLEXPORT extern "C"
21 #endif
22#endif
23
25// Enums
26
28enum class Polarization {
29 HORIZONTAL = 0,
30 VERTICAL = 1,
31};
32
38
39
54// clang-format off
55enum class AiryKind {
56 AIRY = 1,
57 AIRYD,
58 BAIRY,
59 BAIRYD,
60 WTWO,
61 DWTWO,
62 WONE,
63 DWONE,
64};
65// clang-format on
66
67
77enum class AiryScaling {
78 HUFFORD,
79 WAIT,
80 NONE,
81};
82
83
86// clang-format off
101// clang-format on
102
104// Constants
105// clang-format off
106constexpr double PI = 3.1415926535897932384;
107constexpr double epsilon_0 = 8.854187817e-12;
108constexpr double a_0__km = 6370;
109constexpr double C = 299792458.0;
110constexpr double ETA = 119.9169832 * PI;
111// clang-format on
112
114// Data Structures
115
123
125// Public Functions
126
127DLLEXPORT ReturnCode LFMF(
128 const double h_tx__meter,
129 const double h_rx__meter,
130 const double f__mhz,
131 const double P_tx__watt,
132 const double N_s,
133 const double d__km,
134 const double epsilon,
135 const double sigma,
136 const int pol,
137 Result &result
138);
139
140DLLEXPORT char *GetReturnStatusCharArray(const int code);
141DLLEXPORT void FreeReturnStatusCharArray(char *c_msg);
142
144// Private Functions
145
147 const double h_tx__meter,
148 const double h_rx__meter,
149 const double f__mhz,
150 const double P_tx__watt,
151 const double N_s,
152 const double d__km,
153 const double epsilon,
154 const double sigma,
155 const Polarization pol,
156 Result &result
157);
158std::string GetReturnStatus(const int code);
160 const std::complex<double> delta,
161 const std::complex<double> q,
162 const double h_1__km,
163 const double h_2__km,
164 const double d,
165 const double k,
166 const double a_e__km
167);
168double ResidueSeries(
169 const double k,
170 const double h_1__km,
171 const double h_2__km,
172 const double nu,
173 const double theta,
174 const std::complex<double> q
175);
176std::complex<double> wofz(const std::complex<double> z);
177std::complex<double> Airy(
178 const std::complex<double> Z, const AiryKind kind, const AiryScaling scaling
179);
180std::complex<double> WiRoot(
181 const int i,
182 std::complex<double> &DWi,
183 const std::complex<double> q,
184 std::complex<double> &Wi,
185 const AiryKind kind,
186 const AiryScaling scaling
187);
189 const double h_tx__meter,
190 const double h_rx__meter,
191 const double f__mhz,
192 const double P_tx__watt,
193 const double N_s,
194 const double d__km,
195 const double epsilon,
196 const double sigma
197);
200 const double A, const double B, const double maxRelDiff = DBL_EPSILON
201);
202
203} // namespace LFMF
204} // namespace Propagation
205} // namespace ITS
std::complex< double > Airy(const std::complex< double > Z, const AiryKind kind, const AiryScaling scaling)
Finds the functions and their derivatives for Airy functions of the first, second,...
Definition Airy.cpp:129
double FlatEarthCurveCorrection(const std::complex< double > delta, const std::complex< double > q, const double h_1__km, const double h_2__km, const double d__km, const double k, const double a_e__km)
Calculates the groundwave field strength using the flat Earth approximation with curvature correction...
Definition FlatEarthCurveCorrection.cpp:35
ReturnCode LFMF(const double h_tx__meter, const double h_rx__meter, const double f__mhz, const double P_tx__watt, const double N_s, const double d__km, const double epsilon, const double sigma, const int pol, Result &result)
Compute the LFMF propagation prediction.
Definition LFMF.cpp:32
bool AlmostEqualRelative(const double A, const double B, const double maxRelDiff)
Relative epsilon comparisons method.
Definition LFMF.cpp:185
ReturnCode LFMF_CPP(const double h_tx__meter, const double h_rx__meter, const double f__mhz, const double P_tx__watt, const double N_s, const double d__km, const double epsilon, const double sigma, const Polarization pol, Result &result)
Compute the LFMF propagation prediction.
Definition LFMF.cpp:78
SolutionMethod
Solution method used to generate model result.
Definition LFMF.h:34
@ RESIDUE_SERIES
Residue series method.
@ FLAT_EARTH_CURVE
Flat earth curve method.
AiryScaling
Multiplicative scaling to use when dealing with Airy functions.
Definition LFMF.h:77
constexpr double PI
Approximate value of .
Definition LFMF.h:106
constexpr double epsilon_0
Vacuum permittivity (F/m)
Definition LFMF.h:107
constexpr double a_0__km
Earth radius, in km.
Definition LFMF.h:108
AiryKind
Kinds of Airy functions to specify for Airy() and WiRoot() operation.
Definition LFMF.h:55
@ AIRY
Airy function of the first kind, .
@ DWONE
Derivative of WONE, (Wait's )
@ BAIRY
Airy function of the second kind, .
@ AIRYD
Derivative of AIRY, .
@ DWTWO
Derivative of WTWO, (Wait's )
@ WTWO
Hufford's Airy function of a third kind, (Wait's )
@ WONE
Hufford's Airy function of a third kind, (Wait's )
@ BAIRYD
Derivative of BAIRY, .
ReturnCode
Return Codes defined by this software (0-127)
Definition LFMF.h:87
@ ERROR__POLARIZATION
Invalid value for polarization.
Definition LFMF.h:99
@ ERROR__PATH_DISTANCE
Path distance is out of range.
Definition LFMF.h:96
@ SUCCESS
Return Success.
Definition LFMF.h:88
@ ERROR__FREQUENCY
Frequency is out of range.
Definition LFMF.h:93
@ ERROR__SIGMA
Sigma is out of range.
Definition LFMF.h:98
@ ERROR__TX_POWER
Transmit power is out of range.
Definition LFMF.h:94
@ ERROR__EPSILON
Epsilon is out of range.
Definition LFMF.h:97
@ ERROR__RX_TERMINAL_HEIGHT
RX terminal height is out of range.
Definition LFMF.h:92
@ ERROR__SURFACE_REFRACTIVITY
Surface refractivity is out of range.
Definition LFMF.h:95
@ ERROR__TX_TERMINAL_HEIGHT
TX terminal height is out of range.
Definition LFMF.h:91
constexpr double ETA
Intrinsic impedance of free space (ohms)
Definition LFMF.h:110
Polarization
Valid RF polarizations for use of this model.
Definition LFMF.h:28
@ VERTICAL
Vertical polarization.
@ HORIZONTAL
Horizontal polarization.
constexpr double C
Speed of light (m/s)
Definition LFMF.h:109
double ResidueSeries(const double k, const double h_1__km, const double h_2__km, const double nu, const double theta__rad, const std::complex< double > q)
Calculates the groundwave field strength using the Residue Series method.
Definition ResidueSeries.cpp:25
ReturnCode ValidatePolarization(const Polarization pol)
Perform input Polarization validation.
Definition ValidateInputs.cpp:68
ReturnCode ValidateInput(const double h_tx__meter, const double h_rx__meter, const double f__mhz, const double P_tx__watt, const double N_s, const double d__km, const double epsilon, const double sigma)
Validate that model input values are within valid ranges.
Definition ValidateInputs.cpp:24
std::complex< double > WiRoot(const int i, std::complex< double > &DWi, const std::complex< double > q, std::complex< double > &Wi, const AiryKind kind, const AiryScaling scaling)
Finds the roots to the equation .
Definition WiRoot.cpp:54
void FreeReturnStatusCharArray(char *c_msg)
Free the memory allocated by GetReturnStatusCharArray.
Definition ReturnCodes.cpp:85
std::string GetReturnStatus(int code)
Get an error message string from a return code.
Definition ReturnCodes.cpp:31
char * GetReturnStatusCharArray(const int code)
Get an error message string (as C-style string) from a return code.
Definition ReturnCodes.cpp:69
Structure to hold LF/MF model outputs.
Definition LFMF.h:117
double P_rx__dbm
Received power, in dBm.
Definition LFMF.h:120
double A_btl__db
Basic transmission loss, in dB.
Definition LFMF.h:118
double E_dBuVm
Electric field strength, in dB(uV/m)
Definition LFMF.h:119
SolutionMethod method
Method used to obtain results.
Definition LFMF.h:121
std::complex< double > wofz(const std::complex< double > z)
This function computes the Faddeeva function .
Definition wofz.cpp:44
Privacy Policy FOIA Accessibility Information Quality