10 #include <det/Detector.h>
11 #include <atm/AerosolDB.h>
12 #include <atm/AerosolZone.h>
13 #include <atm/AttSlice.h>
14 #include <atm/PFSlice.h>
15 #include <atm/MolecularZone.h>
16 #include <atm/ProfileResult.h>
18 #include <atm/RadiosondeDBProfileModel.h>
20 #include <fwk/CentralConfig.h>
22 #include <utl/TimeStamp.h>
23 #include <utl/ErrorLogger.h>
25 #include <cppunit/extensions/HelperMacros.h>
26 #include <tst/Verify.h>
42 CPPUNIT_TEST(testHasData);
45 CPPUNIT_TEST(testEvaluateDepthVsHeight);
46 CPPUNIT_TEST(testEvaluateHeightVsDepth);
47 CPPUNIT_TEST(testEvaluateTemperatureVsHeight);
48 CPPUNIT_TEST(testEvaluateDensityVsHeight);
49 CPPUNIT_TEST(testEvaluateRefractionIndexVsHeight);
50 CPPUNIT_TEST(testNoDataMultipleCalls);
52 CPPUNIT_TEST_SUITE_END();
60 CentralConfig::GetInstance(BOOTSTRAPFILE);
69 Detector::GetInstance().Update(
TimeStamp());
71 modelWithoutData.
Init();
72 CPPUNIT_ASSERT(Verify<Equal>(modelWithoutData.
HasData(),
false));
74 Detector::GetInstance().Update(
TimeStamp(1111112));
77 CPPUNIT_ASSERT(Verify<Equal>(modelWithData.
HasData(),
true));
83 Detector::GetInstance().Update(
TimeStamp(1111112));
84 const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
87 CPPUNIT_ASSERT(Verify<CloseTo>( depthVsHeight.
Y(500.*
meter), 973.732*
gram/
cm/
cm, 1e-3));
90 CPPUNIT_ASSERT(Verify<CloseTo>( depthVsHeight.
Y(11000.*
meter), 230.918*
gram/
cm/
cm, 1e-3));
93 CPPUNIT_ASSERT(Verify<CloseTo>( depthVsHeight.
Y(26500.*
meter), 20.3484*
gram/
cm/
cm, 1e-3));
96 CPPUNIT_ASSERT(Verify<CloseTo>( depthVsHeight.
Y(0.), 1033.93*
gram/
cm/
cm, 1e-3));
100 CPPUNIT_ASSERT(Verify<CloseTo>( depthVsHeight.
Y(500.*
meter),
104 CPPUNIT_ASSERT(Verify<CloseTo>( depthVsHeight.
MaxX(), heightVsDepth.
Y(heightVsDepth.
MinX()) ));
105 CPPUNIT_ASSERT(Verify<CloseTo>( depthVsHeight.
MinX(), heightVsDepth.
Y(heightVsDepth.
MaxX()) ));
111 Detector::GetInstance().Update(
TimeStamp(1111112));
112 const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
116 CPPUNIT_ASSERT(Verify<CloseTo>( heightVsDepth.
Y(20.3484*
gram/
cm/
cm), 26500.*
meter, 1e-3));
120 CPPUNIT_ASSERT(Verify<CloseTo>( heightVsDepth.
Y(973.732*
gram/
cm/
cm), 500.*
meter, 1e-3));
124 CPPUNIT_ASSERT(Verify<CloseTo>( heightVsDepth.
Y(230.918*
gram/
cm/
cm), 11000.*
meter, 1e-3));
133 Detector::GetInstance().Update(
TimeStamp(1111112));
134 const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
137 CPPUNIT_ASSERT(Verify<CloseTo>( temperatureVsHeight.
Y(0.), 288.15*
kelvin, 1e-3));
140 CPPUNIT_ASSERT(Verify<CloseTo>( temperatureVsHeight.
Y(11500.), 216.65*
kelvin, 1e-3));
143 CPPUNIT_ASSERT(Verify<CloseTo>( temperatureVsHeight.
Y(29500.), 226.15*
kelvin, 1e-3));
150 Detector::GetInstance().Update(
TimeStamp(1111112));
151 const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
154 CPPUNIT_ASSERT(Verify<CloseTo>( densityVsHeight.
Y(0.), 1.23e-3*
g/
cm/
cm/
cm));
157 CPPUNIT_ASSERT(Verify<CloseTo>( densityVsHeight.
Y(11500.*
meter), 3.36458e-4*
g/
cm/
cm/
cm));
160 CPPUNIT_ASSERT(Verify<CloseTo>( densityVsHeight.
Y(29000.*
meter), 2.10e-5*
g/
cm/
cm/
cm));
167 Detector::GetInstance().Update(
TimeStamp(1111112));
168 const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
171 CPPUNIT_ASSERT(Verify<CloseTo>( riVsHeight.
Y(0.), 1.00029, 1e-3));
175 const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
181 const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
184 int numExceptions = 0;
185 for (
int i=0 ; i<5 ; i++) {
192 CPPUNIT_ASSERT(Verify<Equal>(numExceptions, 5));
void testEvaluateHeightVsDepth()
void testEvaluateDepthVsHeight()
Top of the interface to Atmosphere information.
void testEvaluateTemperatureVsHeight()
void testEvaluateRefractionIndexVsHeight()
void testNoDataMultipleCalls()
Molecular profile taken from radiosonde database.
const atm::ProfileResult & EvaluateDensityVsHeight() const
Tabulated function giving Y=density as a function of X=height.
void testEvaluateDensityVsHeight()
void testNoDataForTimeStamp()
bool HasData() const
True if a data source is for the given model.
CPPUNIT_TEST_SUITE_REGISTRATION(testAiresShowerFile)
double Y(const double x) const
Get the Y value (coordinate) for given X (ordinate)
A TimeStamp holds GPS second and nanosecond for some event.
Class describing the Atmospheric profile.
const atm::ProfileResult & EvaluateDepthVsHeight() const
Tabulated function giving Y=depth as a function of X=height.
double MinX() const
Return the minimum value for X (ordinate) stored in the profile.
const atm::ProfileResult & EvaluateHeightVsDepth() const
Tabulated function giving Y=height as a function of X=depth.
const atm::ProfileResult & EvaluateRefractionIndexVsHeight() const
Tabulated function giving Y=refraction index as a function of X=height.
const atm::ProfileResult & EvaluateTemperatureVsHeight() const
Tabulated function giving Y=temperature as a function of X=height.
double MaxX() const
Return the maximum value for X (ordinate) stored in the profile.