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>
17 #include <atm/MonthlyAvgDBProfileModel.h>
19 #include <atm/RadiosondeDBProfileModel.h>
21 #include <fwk/CentralConfig.h>
23 #include <utl/TimeStamp.h>
24 #include <utl/UTCDateTime.h>
25 #include <utl/ErrorLogger.h>
27 #include <cppunit/extensions/HelperMacros.h>
28 #include <tst/Verify.h>
44 CPPUNIT_TEST(testCheckUpdates);
45 CPPUNIT_TEST(testHasData);
51 CPPUNIT_TEST(testEvaluateDepthVsHeight);
52 CPPUNIT_TEST(testEvaluateHeightVsDepth);
53 CPPUNIT_TEST(testEvaluateTemperatureVsHeight);
54 CPPUNIT_TEST(testEvaluateDensityVsHeight);
55 CPPUNIT_TEST(testEvaluateRefractionIndexVsHeight);
57 CPPUNIT_TEST_SUITE_END();
65 CentralConfig::GetInstance(BOOTSTRAPFILE);
75 Detector::GetInstance().Update(
TimeStamp());
77 modelWithoutData.
Init();
78 CPPUNIT_ASSERT(Verify<Equal>(modelWithoutData.
HasData(),
false));
80 Detector::GetInstance().Update(
UTCDateTime(2005, 1, 1).GetTimeStamp());
83 CPPUNIT_ASSERT(Verify<Equal>(modelWithData.
HasData(),
true));
88 Detector::GetInstance().Update(
TimeStamp(1111112));
89 const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
92 CPPUNIT_ASSERT(Verify<CloseTo>(prof.
Y(0.5*
km), 973.732*
g/
cm2, 1e-3));
94 CPPUNIT_ASSERT(Verify<CloseTo>(prof.
Y(11.*
km), 230.918*
g/
cm2, 1e-3));
96 CPPUNIT_ASSERT(Verify<CloseTo>(prof.
Y(26.5*
km), 20.3484*
g/
cm2, 1e-3));
98 CPPUNIT_ASSERT(Verify<CloseTo>(prof.
Y(0.), 1033.93*
g/
cm2, 1e-3));
100 CPPUNIT_ASSERT(Verify<CloseTo>(prof.
MinX(), 0.0*
m));
104 CPPUNIT_ASSERT(Verify<CloseTo>(prof.
MaxX(), 100.*
km));
109 CPPUNIT_ASSERT(Verify<CloseTo>(prof.
Y(100.*
km), 0.001*
g/
cm2));
114 Detector::GetInstance().Update(
TimeStamp(1111112));
115 const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
118 CPPUNIT_ASSERT(Verify<CloseTo>(heightVsDepth.
Y(20.3484*
g/
cm2), 26.5*
km, 1e-3));
120 CPPUNIT_ASSERT(Verify<CloseTo>(heightVsDepth.
Y(973.732*
g/
cm2), 0.5*
km, 1e-3));
122 CPPUNIT_ASSERT(Verify<CloseTo>(heightVsDepth.
Y(230.918*
g/
cm2), 11.*
km, 1e-3));
125 CPPUNIT_ASSERT(Verify<CloseTo>(
126 depthVsHeight.
MaxX(), heightVsDepth.
Y(heightVsDepth.
MinX())
128 CPPUNIT_ASSERT(Verify<CloseTo>(
129 depthVsHeight.
MinX(), heightVsDepth.
Y(heightVsDepth.
MaxX())
135 CPPUNIT_ASSERT(Verify<CloseTo>(heightVsDepth.
Y(0.001*
g/
cm2), 100.*
km));
140 Detector::GetInstance().Update(
TimeStamp(1111112));
141 const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
144 CPPUNIT_ASSERT(Verify<CloseTo>(tempVsHeight.
Y(0.), 288.15*
kelvin, 1e-3));
146 CPPUNIT_ASSERT(Verify<CloseTo>(tempVsHeight.
Y(11.5*
km), 216.65*
kelvin, 1e-3));
148 CPPUNIT_ASSERT(Verify<CloseTo>( tempVsHeight.
Y(29.5*
km), 226.15*
kelvin, 1e-3));
153 Detector::GetInstance().Update(
TimeStamp(1111112));
154 const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
157 CPPUNIT_ASSERT(Verify<CloseTo>(densityVsHeight.
Y(0.), 1.23*
kg/
m3));
159 CPPUNIT_ASSERT(Verify<CloseTo>(densityVsHeight.
Y(11.5*
km), 0.336458*
kg/
m3));
161 CPPUNIT_ASSERT(Verify<CloseTo>(densityVsHeight.
Y(29.*
km), 0.021*
kg/
m3));
166 Detector::GetInstance().Update(
TimeStamp(1111112));
167 const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
170 CPPUNIT_ASSERT(Verify<CloseTo>(refracVsHeight.
Y(0.), 1.00029, 1.e-3));
177 const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
180 CPPUNIT_ASSERT(Verify<CloseTo>(
183 Detector::GetInstance().Update(
UTCDateTime(2005, 4, 2, 0, 0, 0).GetTimeStamp());
184 CPPUNIT_ASSERT(Verify<CloseTo>(
190 const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
197 const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
202 heightVsDepth.
Y(0.*
g/
cm2);
207 const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
212 depthVsHeight.
Y(500.*
km);
217 const Atmosphere& theAtm = Detector::GetInstance().GetAtmosphere();
222 temperatureVsHeight.
Y(500.*
km);
Molecular profile information from database monthly averages.
Top of the interface to Atmosphere information.
const atm::ProfileResult & EvaluateDensityVsHeight() const
Tabulated function giving Y=density as a function of X=height.
void testOutOfBoundsTemperatureVsHeight()
virtual bool HasData() const override
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.
Exception for reporting variable out of valid range.
void testOutOfBoundsHeightVsDepth()
void testNoDataForTimeStamp()
void testEvaluateHeightVsDepth()
Class describing the Atmospheric profile.
void testOutOfBoundsDepthVsHeight()
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.
void testEvaluateRefractionIndexVsHeight()
const atm::ProfileResult & EvaluateHeightVsDepth() const
Tabulated function giving Y=height as a function of X=depth.
void testEvaluateDensityVsHeight()
const atm::ProfileResult & EvaluateRefractionIndexVsHeight() const
Tabulated function giving Y=refraction index as a function of X=height.
void testEvaluateTemperatureVsHeight()
void testEvaluateDepthVsHeight()
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.