-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d1ec139
commit 48db825
Showing
6 changed files
with
8,511 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/** @file TestLFMFPolarizationHorizontal.cpp | ||
* Implements the google tests from ITS.Propagation.LFMF. | ||
*/ | ||
|
||
#include "LFMFGTest.h" | ||
|
||
/****************************************************************************** | ||
* | ||
* Description: The purpose of this is to ensure that the LFMF model | ||
* executes the same results as matlab code. | ||
* Test Data are from https://github.com/eeveetza/LFMFSmoothEarth. | ||
* | ||
*****************************************************************************/ | ||
class TestLFMFPolarizationHorizontal: public ::testing::Test { | ||
protected: | ||
void SetUp() override { | ||
// Load test data from CSV | ||
testData = ReadLFMFInputsAndResult(fileName); | ||
} | ||
|
||
// Vector to hold test data | ||
std::vector<LFMFInputsAndResult> testData; | ||
|
||
std::string fileName = "ValidationPolarizationHorizontal.csv"; | ||
}; | ||
|
||
/****************************************************************************** | ||
* | ||
* Description: Test case to verify LFMF Flat earth curve method results are correct | ||
* | ||
*****************************************************************************/ | ||
TEST_F(TestLFMFPolarizationHorizontal, FlatEarthCurveMethodEquivalentToMatLAB) { | ||
// Ensure test data was loaded | ||
EXPECT_NE(static_cast<int>(testData.size()), 0); | ||
int i = 0; | ||
for (const auto &data : testData) { | ||
if (data.expectedResult.method == METHOD__FLAT_EARTH_CURVE) { | ||
i++; | ||
Result result; | ||
if (i % 100 == 0) { | ||
std::cout << " Test instance: " << i << std::endl; | ||
} | ||
int rtn = LFMF( | ||
data.h_tx__meter, | ||
data.h_rx__meter, | ||
data.f__mhz, | ||
data.P_tx__watt, | ||
data.N_s, | ||
data.d__km, | ||
data.epsilon, | ||
data.sigma, | ||
data.pol, | ||
&result | ||
); | ||
|
||
EXPECT_EQ(rtn, SUCCESS); | ||
compareDouble(data.expectedResult.A_btl__db, result.A_btl__db); | ||
compareDouble(data.expectedResult.E_dBuVm, result.E_dBuVm); | ||
compareDouble(data.expectedResult.P_rx__dbm, result.P_rx__dbm); | ||
EXPECT_EQ(result.method, data.expectedResult.method); | ||
} | ||
} | ||
}; | ||
|
||
/****************************************************************************** | ||
* | ||
* Description: Test case to verify LFMF Residue series method results are correct | ||
* | ||
*****************************************************************************/ | ||
TEST_F(TestLFMFPolarizationHorizontal, ResidueSeriesMethodEquivalentToMatLAB) { | ||
// Ensure test data was loaded | ||
EXPECT_NE(static_cast<int>(testData.size()), 0); | ||
int i = 0; | ||
for (const auto &data : testData) { | ||
if (data.expectedResult.method == METHOD__RESIDUE_SERIES) { | ||
i++; | ||
Result result; | ||
if (i % 100 == 0) { | ||
std::cout << " Test instance: " << i << std::endl; | ||
} | ||
int rtn = LFMF( | ||
data.h_tx__meter, | ||
data.h_rx__meter, | ||
data.f__mhz, | ||
data.P_tx__watt, | ||
data.N_s, | ||
data.d__km, | ||
data.epsilon, | ||
data.sigma, | ||
data.pol, | ||
&result | ||
); | ||
|
||
EXPECT_EQ(rtn, SUCCESS); | ||
compareDouble(data.expectedResult.A_btl__db, result.A_btl__db); | ||
compareDouble(data.expectedResult.E_dBuVm, result.E_dBuVm); | ||
compareDouble(data.expectedResult.P_rx__dbm, result.P_rx__dbm); | ||
EXPECT_EQ(result.method, data.expectedResult.method); | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.