Pulse adds COVID-19 Simulation Support
×
EngineTest.h
1 /* Distributed under the Apache License, Version 2.0.
2  See accompanying NOTICE file for details.*/
3 
4 // The following tests will be exported and runnable
5 #include <math.h>
6 class PulseController;
7 #include "PulsePhysiologyEngine.h"
8 
9 #define ENGINE_TEST_DECL
10 #ifdef SHARED_ENGINE_TEST
11  #if defined (__clang__)
12  #define ENGINE_TEST_DECL
13  #elif defined(__gnu_linux__)
14  #define ENGINE_TEST_DECL __attribute__ ((visibility ("default")))
15  #else
16  #ifdef SHARED_ENGINE_TEST
17  #define ENGINE_TEST_DECL __declspec(dllexport)
18  #else
19  #define ENGINE_TEST_DECL __declspec(dllimport)
20  #endif
21  #endif
22 #endif
23 
24 class SESubstance;
25 class SETestSuite;
26 class HowToTracker;
27 
28 class ENGINE_TEST_DECL PulseEngineTest : Loggable
29 {
30 public:
32  PulseEngineTest(Logger* logger);
33  virtual ~PulseEngineTest();
34 
35  bool RunTest(const std::string& testName, const std::string& sOutputDirectory);
36  void FillFunctionMap();
37 
38 protected:
39  bool myLogger;
40  typedef void(PulseEngineTest::*testFunction)(const std::string&);
41  typedef std::map<std::string, testFunction> testMap;
42  testMap bgeMap;
43  std::stringstream m_ss;
44 
46  // Circuit Hemodynamics and Compartment Transport Tests //
47  // System Specific Functions Tests as well //
49 public:
51  // Cardiovascular //
52  void CardiovascularCircuitAndTransportTest(const std::string& sTestDirectory);
53  void CardiovascularAndRenalCircuitAndTransportTest(const std::string& sTestDirectory);
54  void CardiovascularAndTissueCircuitAndTransportTest(const std::string& sTestDirectory);
55  void CardiovascularAndCerebrospinalFluidCircuitAndTransportTest(const std::string& sTestDirectory);
56  void FullCardiovascularCircuitAndTransportTest(const std::string& sTestDirectory);
57  void CardiovascularBloodGasesTest(const std::string& sTestDirectory);// Characterize the cv circuit
58  void TuneCardiovascularCircuitTest(const std::string& sTestDirectory);
59  // Cardiovascular Utilities //
60  void CardiovascularCircuitScaleTests(const std::string& sTestDirectory);
61 protected:
62  enum CardiovascularDriver { Sinusoid = 0, Heart };
63  void SinusoidHeartDriver(double time_s, double heartRate_s, double& lHeartElastance, double& rHeartElastance);
64  void CardiovascularCircuitAndTransportTest(CardiovascularDriver driverType, double complianceScale, double resistanceScale, double volumeScale, double heartRate_bpm,
65  double sysRes, double sysComp, double aortaRes, double aortaComp, double rightHeartRes, double venaCavaComp, bool connectTissue, bool connectRenal, bool connectCSF,
66  bool balanceBloodgases, const std::string& sTestDirectory, const std::string& sTestName, bool breakOutResults);
67  void TuneCardiovascularCircuitTest(SETestSuite& testSuite, const std::string& sTestDirectory, const std::string& sTestName, SEPatient& patient);
68 
71  double m_Systolic;
72  double m_Diastolic;
73  double m_Pulse;
75 
76 public:
78  // Renal //
79  void RenalCircuitAndTransportTest(const std::string& sTestDirectory);
80  void RenalTGFFeedbackTest(const std::string& sTestDirectory);
81  void RenalTGFandUPRFeedbackTest(const std::string& sTestDirectory);
82  void RenalSecretionTest(const std::string& sTestDirectory);
83  void RenalUrinateTest(const std::string& sTestDirectory);
84 protected:
85  enum RenalFeedback { TGF, TGFandUPR };
86  void RenalFeedbackTest(RenalFeedback feedback, const std::string& sTestDirectory, const std::string& sTestName);
87  enum RenalSystems { Secretion, Urinating};
88  void RenalSystemTest(RenalSystems systemtest, const std::string& sTestDirectory, const std::string& sTestName);
89 
90 public:
92  // Respiratory //
93  void RespiratoryCircuitAndTransportTest(const std::string& sTestDirectory);
94  void RespiratoryDriverTest(const std::string& sTestDirectory);
95 protected:
96  enum RespiratoryConfiguration { RespiratorySolo, AnesthesiaMachineSolo, RespiratoryWithAnesthesiaMachine, RespiratoryWithInhaler, RespiratoryWithMechanicalVentilation, MechanicalVentilatorSolo, RespiratoryWithMechanicalVentilator
97  };
98  void RespiratoryCircuitAndTransportTest(RespiratoryConfiguration config, const std::string& sTestDirectory);
99 
100 public:
102  // Anesthesia Machine //
103  void AnesthesiaMachineCircuitAndTransportTest(const std::string& sTestDirectory);
104  void RespiratoryWithAnesthesiaMachineCircuitAndTransportTest(const std::string& sTestDirectory);
105 protected:
106  void AnesthesiaMachineCircuitAndTransportTest(RespiratoryConfiguration config, const std::string& sTestDirectory);
107 
108 public:
110  // Mechanical Ventilator //
111  void MechanicalVentilatorCircuitAndTransportTest(const std::string& sTestDirectory);
112  void RespiratoryWithMechanicalVentilatorCircuitAndTransportTest(const std::string& sTestDirectory);
113 protected:
114  void MechanicalVentilatorCircuitAndTransportTest(RespiratoryConfiguration config, const std::string& sTestDirectory);
115 
116 public:
118  // Inhaler //
119  void RespiratoryWithInhalerCircuitAndTransportTest(const std::string& sTestDirectory);
120 protected:
121 
122 public:
124  // Mechanical Ventilation //
125  void RespiratoryWithMechanicalVentilationCircuitAndTransportTest(const std::string& sTestDirectory);
126 protected:
127 
128 public:
130  // Environment and Energy //
131  void InternalTemperatureVariableBMRCircuitTest(const std::string& sTestDirectory);
132  void InternalTemperatureVariableSkinCircuitTest(const std::string& sTestDirectory);
133  void InternalTemperatureVariableCoreCircuitTest(const std::string& sTestDirectory);
134  void EnvironmentVariableTemperatureCircuitTest(const std::string& sTestDirectory);
135  void CombinedInternalAndEnvironmentVariableBMRandTemperatureCircuitTest(const std::string& sTestDirectory);
136  void CombinedInternalAndEnvironmentSkinTempDropCircuitTest(const std::string& sTestDirectory);
137  void EnvironmentISO7730ComparisonTest(const std::string& sTestDirectory);
138 protected:
139 
140 public:
142  // Tissue Tests //
143  void DiffusionClearanceExcretionTests(const std::string& rptDirectory);
144  void AlveolarCarbonDioxideDiffusionTest(const std::string& rptDirectory);
145  void AlveolarOxygenDiffusionTest(const std::string& rptDirectory);
146  void InstantPlusSimpleDiffusionTest(const std::string& rptDirectory);
147  void SimpleDiffusionTwoCompartmentTest(const std::string& rptDirectory);
148  void SimpleDiffusionFourCompartmentTest(const std::string& rptDirectory);
149  void SimpleDiffusionHierarchyTest(const std::string& rptDirectory);
150  void FacilitatedDiffusionTest(const std::string& rptDirectory);
151 protected:
152  void DistributeMass(SETestSuite& testSuite);
153  void PerfusionLimitedDiffusionTest(SETestSuite& testSuite);
154  void InstantDiffusionTest(SETestSuite& testSuite);
155  void ActiveTransportTest(SETestSuite& testSuite);
156  void GenericClearanceTest(SETestSuite& testSuite);
157  void GenericExcretionTest(SETestSuite& testSuite);
158 
159 public:
161  // Nervous Tests //
162  void BrainInjuryTest(const std::string& rptDirectory);
163 protected:
164 
165 
166 public:
168  // Acid Base Engine Tests //
169  void FourCompartmentTestSimple(const std::string& sOutputDirectory);
170  void AcidBaseFourCompartmentTest(const std::string& sOutputDirectory);
171  void FiveCompartmentTestWithDiffusion(const std::string& sOutputDirectory);
172  void AcidBaseFourCompartmentTestWithProductionConsumption(const std::string& sOutputDirectory);
173  void AcidBaseFiveCompartmentTestWithDiffusion(const std::string& sOutputDirectory);
174  void AcidBaseFiveCompartmentTestWithProductionConsumptionAndDiffusion(const std::string& sOutputDirectory);
175  protected:
176  void FourCompartmentTest(bool usingAcidBase, bool usingProductionConsumption, bool usingDiffusion, const std::string& sOutputDirectory);
180 
182  // Acid Base Tests //
184 public:
185  void AcidBaseMathTest(const std::string& sOutputDirectory);
186  void AcidBaseFeedbackTest(const std::string& sOutputDirectory);
187  void AcidBaseLimitsTest(const std::string& sOutputDirectory);
188  void AcidBaseExtremeTest(const std::string & rptDirectory);
189  void AcidBaseBloodGasTests(const std::string& sOutputDirectory);
190 protected:
191  enum bloodType { ARTERIAL, VENOUS, CAPILLARY, RESPIRATORY_ACIDOSIS, METABOLIC_ALKALOSIS, METABOLIC_ACIDOSIS, RESPIRATORY_ALKALOSIS, CUSTOM };
192  void AcidBaseBloodGasTest(PulseController& bg, bloodType compartment, SETestSuite& testSuite);
193 
195  // Aerosol Tests //
197 public:
198  void AerosolTest(const std::string& sOutputDirectory);
199 protected:
200  void SizeIndependentDepositionEfficencyCoefficientsTest(SETestSuite& suite, SESubstance& substance, double expectedMouthCoeff, double expectedCarinaCoeff, double expectedDeadSpaceCoeff, double expectedAlveoliCoeff);
201  void DepositionFractionTest(SETestSuite& suite, SESubstance& substance, double expectedMouthDepFrac, double expectedCarinaDepFrac,
202  double expectedLeftDeadSpaceDepFrac, double expectedLeftAlveoliDepFrac, double expectedRightDeadSpaceDepFrac, double expectedRightAlveoliDepFrac);
203 
204 
205 public:
207  // General Engine Tests //
208  void ConditionCombinations(const std::string& rptDirectory);
209  void MultiEngineTest(const std::string& sTestDirectory);
210  void SerializationTest(const std::string& sTestDirectory);
211  void SolverSpeedTest(const std::string& sTestDirectory);
212  void ReadScenarios(const std::string& sOutputDirectory);
213 protected:
214  void InhalerState(PhysiologyEngine* bg, HowToTracker& tracker);
215  void InjectSuccsState(PhysiologyEngine* bg, HowToTracker& tracker, const SESubstance& succs);
216 
217 
218 };
219 
Definition: SEPatient.h:12
bool myLogger
Definition: EngineTest.h:39
Definition: Logger.h:75
Definition: EngineTest.h:191
Definition: SETestSuite.h:9
Manages and controls execution of all data/systems in Pulse.
Definition: Controller.h:192
double m_CardiacOutput
Definition: EngineTest.h:74
bool usingDiffusion
Definition: EngineTest.h:179
RespiratoryConfiguration
Definition: EngineTest.h:96
std::map< std::string, testFunction > testMap
Definition: EngineTest.h:41
double m_Systolic
Definition: EngineTest.h:71
RenalFeedback
Definition: EngineTest.h:85
CardiovascularDriver
Definition: EngineTest.h:62
Definition: Logger.h:21
Definition: SerializationTest.cpp:45
bool usingAcidBase
Definition: EngineTest.h:177
double m_MeanAortaPressure
Definition: EngineTest.h:69
std::stringstream m_ss
Definition: EngineTest.h:43
double m_Diastolic
Definition: EngineTest.h:72
Definition: PhysiologyEngine.h:52
double m_MeanCVPressure
Definition: EngineTest.h:70
testMap bgeMap
Definition: EngineTest.h:42
Definition: EngineTest.h:28
RenalSystems
Definition: EngineTest.h:87
Definition: SESubstance.h:14
double m_Pulse
Definition: EngineTest.h:73
bool usingProductionConsumption
Definition: EngineTest.h:178
bloodType
Definition: EngineTest.h:191

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.