6 #include <biogears/circuit_test_exports.h>
8 #include <biogears/cdm/CommonDataModel.h>
9 #include <biogears/cdm/circuit/SECircuitManager.h>
10 #include <biogears/cdm/circuit/fluid/SEFluidCircuit.h>
11 #include <biogears/cdm/circuit/fluid/SEFluidCircuitCalculator.h>
12 #include <biogears/cdm/compartment/fluid/SEFluidCompartment.h>
13 #include <biogears/cdm/compartment/fluid/SELiquidCompartmentGraph.h>
14 #include <biogears/cdm/compartment/substances/SEGasSubstanceQuantity.h>
15 #include <biogears/cdm/compartment/thermal/SEThermalCompartment.h>
16 #include <biogears/cdm/compartment/fluid/SELiquidCompartment.h>
17 #include <biogears/cdm/utils/testing/SETestCase.h>
18 #include <biogears/cdm/utils/testing/SETestSuite.h>
21 class SECompartmentManager;
34 bool RunTest(
const std::string& testName,
35 const std::string& sOutputDirectory);
36 void FillFunctionMap();
45 typedef std::map<std::string, testFunction>
testMap;
53 void BasicCircuitTest(
const std::string& sOutputDirectory);
55 void SeriesRCDCTest(
const std::string& sOutputDirectory);
56 void SeriesRCSINTest(
const std::string& sOutputDirectory);
57 void SeriesRCPULSETest(
const std::string& sOutputDirectory);
59 void SeriesRDCTest(
const std::string& sOutputDirectory);
60 void SeriesRSINTest(
const std::string& sOutputDirectory);
61 void SeriesRPULSETest(
const std::string& sOutputDirectory);
63 void SeriesRLDCTest(
const std::string& sOutputDirectory);
64 void SeriesRLSINTest(
const std::string& sOutputDirectory);
65 void SeriesRLPULSETest(
const std::string& sOutputDirectory);
67 void ParallelRDCTest(
const std::string& sOutputDirectory);
68 void ParallelRSINTest(
const std::string& sOutputDirectory);
69 void ParallelRPULSETest(
const std::string& sOutputDirectory);
71 void ParallelRCDCTest(
const std::string& sOutputDirectory);
72 void ParallelRCSINTest(
const std::string& sOutputDirectory);
73 void ParallelRCPULSETest(
const std::string& sOutputDirectory);
75 void ParallelRLDCTest(
const std::string& sOutputDirectory);
76 void ParallelRLSINTest(
const std::string& sOutputDirectory);
77 void ParallelRLPULSETest(
const std::string& sOutputDirectory);
78 void ParallelRLSINCenteredTest(
const std::string& sOutputDirectory);
80 void SeriesRLCDCTest(
const std::string& sOutputDirectory);
81 void SeriesRLCSINTest(
const std::string& sOutputDirectory);
82 void SeriesRLCPULSETest(
const std::string& sOutputDirectory);
84 void ParallelRLCDCTest(
const std::string& sOutputDirectory);
85 void ParallelRLCSINTest(
const std::string& sOutputDirectory);
86 void ParallelRLCPULSETest(
const std::string& sOutputDirectory);
88 void SwitchRCDCTest(
const std::string& sOutputDirectory);
89 void SwitchRCSINTest(
const std::string& sOutputDirectory);
90 void SwitchRCPULSETest(
const std::string& sOutputDirectory);
92 void Comprehensive1DCTest(
const std::string& sOutputDirectory);
93 void Comprehensive1SINTest(
const std::string& sOutputDirectory);
94 void Comprehensive1PULSETest(
const std::string& sOutputDirectory);
96 void SimpleDiodeDCTest(
const std::string& sOutputDirectory);
97 void SimpleDiodeSINTest(
const std::string& sOutputDirectory);
98 void SimpleDiodePULSETest(
const std::string& sOutputDirectory);
100 void SeriesRCDCCurrentTest(
const std::string& sOutputDirectory);
101 void SeriesRCSINCurrentTest(
const std::string& sOutputDirectory);
102 void SeriesRCPULSECurrentTest(
const std::string& sOutputDirectory);
104 void ParallelRCDCCurrentTest(
const std::string& sOutputDirectory);
105 void ParallelRCSINCurrentTest(
const std::string& sOutputDirectory);
106 void ParallelRCPULSECurrentTest(
const std::string& sOutputDirectory);
108 void SeriesCapDCTest(
const std::string& sOutputDirectory);
109 void SeriesCapSINTest(
const std::string& sOutputDirectory);
110 void SeriesCapPULSETest(
const std::string& sOutputDirectory);
112 void ParallelRDCCurrentTest(
const std::string& sOutputDirectory);
113 void ParallelRSINCurrentTest(
const std::string& sOutputDirectory);
114 void ParallelRPULSECurrentTest(
const std::string& sOutputDirectory);
116 void CurrentCompDCTest(
const std::string& sOutputDirectory);
117 void CurrentCompSINTest(
const std::string& sOutputDirectory);
118 void CurrentCompPULSETest(
const std::string& sOutputDirectory);
120 void SeriesRLDCCurrentTest(
const std::string& sOutputDirectory);
121 void SeriesRLSINCurrentTest(
const std::string& sOutputDirectory);
122 void SeriesRLPULSECurrentTest(
const std::string& sOutputDirectory);
124 void ParallelRLDCCurrentTest(
const std::string& sOutputDirectory);
125 void ParallelRLSINCurrentTest(
const std::string& sOutputDirectory);
126 void ParallelRLPULSECurrentTest(
const std::string& sOutputDirectory);
128 void BasicDiodeDCCurrentTest(
const std::string& sOutputDirectory);
129 void BasicDiodeSINCurrentTest(
const std::string& sOutputDirectory);
130 void BasicDiodePULSECurrentTest(
const std::string& sOutputDirectory);
134 void SwitchRCDCCurrentTest(
const std::string& sOutputDirectory);
135 void SwitchRCSINCurrentTest(
const std::string& sOutputDirectory);
136 void SwitchRCPULSECurrentTest(
const std::string& sOutputDirectory);
138 void SeriesRLCDCCurrentTest(
const std::string& sOutputDirectory);
139 void SeriesRLCSINCurrentTest(
const std::string& sOutputDirectory);
140 void SeriesRLCPULSECurrentTest(
const std::string& sOutputDirectory);
142 void ParallelRLCDCCurrentTest(
const std::string& sOutputDirectory);
143 void ParallelRLCSINCurrentTest(
const std::string& sOutputDirectory);
144 void ParallelRLCPULSECurrentTest(
const std::string& sOutputDirectory);
146 void SeriesPressureSourceAdditionDCTest(
const std::string& sOutputDirectory);
147 void SeriesPressureSourceAdditionSINTest(
const std::string& sOutputDirectory);
149 SeriesPressureSourceAdditionPULSETest(
const std::string& sOutputDirectory);
153 void SeriesCurrentSourceAdditionDCTest(
const std::string& sOutputDirectory);
154 void SeriesCurrentSourceAdditionSINTest(
const std::string& sOutputDirectory);
156 SeriesCurrentSourceAdditionPULSETest(
const std::string& sOutputDirectory);
159 ParallelPressureSourceAdditionDCTest(
const std::string& sOutputDirectory);
161 ParallelPressureSourceAdditionSINTest(
const std::string& sOutputDirectory);
163 ParallelPressureSourceAdditionPULSETest(
const std::string& sOutputDirectory);
165 void ParallelCurrentSourceAdditionDCTest(
const std::string& sOutputDirectory);
167 ParallelCurrentSourceAdditionSINTest(
const std::string& sOutputDirectory);
169 ParallelCurrentSourceAdditionPULSETest(
const std::string& sOutputDirectory);
171 void SeriesCapDCCurrentTest(
const std::string& sOutputDirectory);
172 void SeriesCapSINCurrentTest(
const std::string& sOutputDirectory);
173 void SeriesCapPULSECurrentTest(
const std::string& sOutputDirectory);
175 void ParallelCapDCTest(
const std::string& sOutputDirectory);
176 void ParallelCapSINTest(
const std::string& sOutputDirectory);
177 void ParallelCapPULSETest(
const std::string& sOutputDirectory);
179 void ParallelCapDCCurrentTest(
const std::string& sOutputDirectory);
180 void ParallelCapSINCurrentTest(
const std::string& sOutputDirectory);
181 void ParallelCapPULSECurrentTest(
const std::string& sOutputDirectory);
183 void SeriesIndDCTest(
const std::string& sOutputDirectory);
184 void SeriesIndSINTest(
const std::string& sOutputDirectory);
185 void SeriesIndPULSETest(
const std::string& sOutputDirectory);
187 void SeriesIndDCCurrentTest(
const std::string& sOutputDirectory);
188 void SeriesIndSINCurrentTest(
const std::string& sOutputDirectory);
189 void SeriesIndPULSECurrentTest(
const std::string& sOutputDirectory);
191 void ParallelIndDCTest(
const std::string& sOutputDirectory);
192 void ParallelIndSINTest(
const std::string& sOutputDirectory);
193 void ParallelIndPULSETest(
const std::string& sOutputDirectory);
195 void ParallelIndDCCurrentTest(
const std::string& sOutputDirectory);
196 void ParallelIndSINCurrentTest(
const std::string& sOutputDirectory);
197 void ParallelIndPULSECurrentTest(
const std::string& sOutputDirectory);
200 void BadDiodeDCTest(
const std::string& sOutputDirectory);
201 void BadDiodeSINTest(
const std::string& sOutputDirectory);
202 void BadDiodePULSETest(
const std::string& sOutputDirectory);
204 void ValidationComprehensive1DCTest(
const std::string& sOutputDirectory);
205 void ValidationComprehensive1SINTest(
const std::string& sOutputDirectory);
206 void ValidationComprehensive1PULSETest(
const std::string& sOutputDirectory);
208 ValidationComprehensive1SINCenteredTest(
const std::string& sOutputDirectory);
210 void ValidationComprehensive2DCTest(
const std::string& sOutputDirectory);
211 void ValidationComprehensive2SINTest(
const std::string& sOutputDirectory);
212 void ValidationComprehensive2PULSETest(
const std::string& sOutputDirectory);
214 ValidationComprehensive2SINCenteredTest(
const std::string& sOutputDirectory);
217 void ElectricalCircuitTest(
const std::string& sOutputDirectory);
218 void FluidCircuitTest(
const std::string& sOutputDirectory);
219 void ThermalCircuitTest(
const std::string& sOutputDirectory);
220 void CombinedCircuitTest(
const std::string& sOutputDirectory);
221 void InterCircuitComparisonTest(
const std::string& sOutputDirectory);
222 void InterCircuitIndividualTest(
223 const std::string& sOutputDirectory);
224 void CircuitErrorTest(
225 const std::string& sOutputDirectory);
226 void DynamicallyChangingCircuitTest(
227 const std::string& sOutputDirectory);
228 void NonZeroReferencePositive(
const std::string& sOutputDirectory);
229 void NonZeroReferenceNegative(
const std::string& sOutputDirectory);
230 void PolarizedCapacitorTest(
const std::string& sOutputDirectory);
231 void PreChargeComplianceZeroVolume(
const std::string& sOutputDirectory);
232 void PreChargeComplianceNonZeroVolume(
const std::string& sOutputDirectory);
233 void CircuitLockingTest(
const std::string& sOutputDirectory);
237 void RunTest(
const std::string& sOutputDirectory,
const std::string& testName,
241 void TestSetup7SeriesRCDC();
242 void TestSetup7SeriesRCSIN();
243 void TestSetup7SeriesRCPULSE();
244 void TestSetup8SeriesRDC();
245 void TestSetup8SeriesRSIN();
246 void TestSetup8SeriesRPULSE();
247 void TestSetup9SeriesRLDC();
248 void TestSetup9SeriesRLSIN();
249 void TestSetup9SeriesRLPULSE();
250 void TestSetup10ParallelRDC();
251 void TestSetup10ParallelRSIN();
252 void TestSetup10ParallelRPULSE();
253 void TestSetup11ParallelRCDC();
254 void TestSetup11ParallelRCSIN();
255 void TestSetup11ParallelRCPULSE();
256 void TestSetup12ParallelRLDC();
257 void TestSetup12ParallelRLSIN();
258 void TestSetup12ParallelRLPULSE();
259 void TestSetup12ParallelRLSINCentered();
260 void TestSetup13SeriesRLCDC();
261 void TestSetup13SeriesRLCSIN();
262 void TestSetup13SeriesRLCPULSE();
263 void TestSetup14ParallelRLCDC();
264 void TestSetup14ParallelRLCSIN();
265 void TestSetup14ParallelRLCPULSE();
266 void TestSetup15SwitchRCDC();
267 void TestSetup15SwitchRCSIN();
268 void TestSetup15SwitchRCPULSE();
269 void TestSetup16Comprehensive1DC();
270 void TestSetup16Comprehensive1SIN();
271 void TestSetup16Comprehensive1PULSE();
272 void TestSetup17BasicDiodeDC();
273 void TestSetup17BasicDiodeSIN();
274 void TestSetup17BasicDiodePULSE();
275 void TestSetup18RCSeriesDCCurrent();
276 void TestSetup18RCSeriesSINCurrent();
277 void TestSetup18RCSeriesPulseCurrent();
278 void TestSetup19RCParallelDCCurrent();
279 void TestSetup19RCParallelSINCurrent();
280 void TestSetup19RCParallelPulseCurrent();
281 void TestSetup20SeriesCapDC();
282 void TestSetup20SeriesCapSIN();
283 void TestSetup20SeriesCapPulse();
284 void TestSetup21ParallelRDCCurrent();
285 void TestSetup21ParallelRSINCurrent();
286 void TestSetup21ParallelRPulseCurrent();
287 void TestSetup22CurrentCompDC();
288 void TestSetup22CurrentCompSIN();
289 void TestSetup22CurrentCompPulse();
290 void TestSetup23SeriesRLDCCurrent();
291 void TestSetup23SeriesRLSINCurrent();
292 void TestSetup23SeriesRLPULSECurrent();
293 void TestSetup24ParallelRLDCCurrent();
294 void TestSetup24ParallelRLSINCurrent();
295 void TestSetup24ParallelRLPULSECurrent();
296 void TestSetup25BasicDiodeDCCurrent();
297 void TestSetup25BasicDiodeSINCurrent();
298 void TestSetup25BasicDiodePULSECurrent();
299 void TestSetup26SwitchRCDCCurrent();
300 void TestSetup26SwitchRCSINCurrent();
301 void TestSetup26SwitchRCPULSECurrent();
302 void TestSetup27SeriesRLCDCCurrent();
303 void TestSetup27SeriesRLCSINCurrent();
304 void TestSetup27SeriesRLCPULSECurrent();
305 void TestSetup28ParallelRLCDCCurrent();
306 void TestSetup28ParallelRLCSINCurrent();
307 void TestSetup28ParallelRLCPULSECurrent();
308 void TestSetup29SeriesPressureSourceAdditionDC();
309 void TestSetup29SeriesPressureSourceAdditionSIN();
310 void TestSetup29SeriesPressureSourceAdditionPULSE();
311 void TestSetup30SeriesCurrentSourceAdditionDC();
312 void TestSetup30SeriesCurrentSourceAdditionSIN();
313 void TestSetup30SeriesCurrentSourceAdditionPULSE();
314 void TestSetup31ParallelPressureSourceAdditionDC();
315 void TestSetup31ParallelPressureSourceAdditionSIN();
316 void TestSetup31ParallelPressureSourceAdditionPULSE();
317 void TestSetup32ParallelCurrentSourceAdditionDC();
318 void TestSetup32ParallelCurrentSourceAdditionSIN();
319 void TestSetup32ParallelCurrrentSourceAdditionPULSE();
320 void TestSetup33SeriesCapDCCurrent();
321 void TestSetup33SeriesCapSINCurrent();
322 void TestSetup33SeriesCapPulseCurrent();
323 void TestSetup34ParallelCapDC();
324 void TestSetup34ParallelCapSIN();
325 void TestSetup34ParallelCapPulse();
326 void TestSetup35ParallelCapDCCurrent();
327 void TestSetup35ParallelCapSINCurrent();
328 void TestSetup35ParallelCapPulseCurrent();
329 void TestSetup36SeriesIndDC();
330 void TestSetup36SeriesIndSIN();
331 void TestSetup36SeriesIndPulse();
332 void TestSetup37SeriesIndDCCurrent();
333 void TestSetup37SeriesIndSINCurrent();
334 void TestSetup37SeriesIndPulseCurrent();
335 void TestSetup38ParallelIndDC();
336 void TestSetup38ParallelIndSIN();
337 void TestSetup38ParallelIndPulse();
338 void TestSetup39ParallelIndDCCurrent();
339 void TestSetup39ParallelIndSINCurrent();
340 void TestSetup39ParallelIndPulseCurrent();
341 void TestSetup40BadDiodeDC();
342 void TestSetup40BadDiodeSIN();
343 void TestSetup40BadDiodePulse();
344 void TestSetup41ValidationComprehensive1DC();
345 void TestSetup41ValidationComprehensive1SIN();
346 void TestSetup41ValidationComprehensive1Pulse();
347 void TestSetup41ValidationComprehensive1SINCentered();
348 void TestSetup42ValidationComprehensive2DC();
349 void TestSetup42ValidationComprehensive2SIN();
350 void TestSetup42ValidationComprehensive2Pulse();
351 void TestSetup42ValidationComprehensive2SINCentered();
353 void TestPreProcess1(
double dT,
int i);
354 void TestPreProcess2(
double dT,
int i);
355 void TestPreProcess3(
double dT,
int i);
356 void TestPreProcess4(
double dT,
int i);
357 void BasicCircuitPreProcess(
double dT);
360 void TestCircuitSerialization(
const std::string& fileName);
368 void GasCompartmentTest(
const std::string& sOutputDirectory);
369 void LiquidCompartmentTest(
const std::string& sOutputDirectory);
370 void ThermalCompartmentTest(
const std::string& sOutputDirectory);
371 void TissueCompartmentTest(
372 const std::string& sOutputDirectory);
376 const std::string& fileName);
382 double inflow_mL_Per_s,
double outflow_mL_Per_s);
384 void TestGasCircuitVolumesPressuresAndFlows(
SETestSuite& testSuite,
389 double totalSubVolume_mL,
390 double totalVolume_mL);
394 void TestLiquidHierarchyFlows(
SETestSuite& testSuite,
397 double inflow_mL_Per_s,
double outflow_mL_Per_s);
399 void TestLiquidCircuitVolumesPressuresAndFlows(
SETestSuite& testSuite,
401 void TestLiquidHierarchySaturation(
SETestSuite& testSuite,
403 void CheckLiquidPressureAndVolume(
SETestCase& testCase,
405 void TestLiquidSubstanceQuantity(
SETestCase& testCase,
408 double totalMass_mg,
double totalVolume_mL);
413 void TestThermalFlowHierarchy(
SETestSuite& testSuite,
416 double inflow_kcal_Per_s,
double outflow_kcal_Per_s);
418 void TestCircuitHeatTemperatureAndFlows(
SETestSuite& testSuite,
420 void CheckTemperatureAndHeat(
SETestCase& testCase,
427 void LargeFlowTransportTest(
const std::string& sOutputDirectory);
428 void LiquidTransportTest(
const std::string& sOutputDirectory);
429 void GasTransportTest(
const std::string& sOutputDirectory);
435 void ReadPatientDirectory(
const std::string& sOutputDirectory);
436 void ReadScenarios(
const std::string& sOutputDirectory);
437 void ReadSubstanceDirectory(
const std::string& sOutputDirectory);
443 void ScalarTest(
const std::string& sOutputDirectory);
444 void UnitsTest(
const std::string& sOutputDirectory);
447 void ConvertList(std::vector<std::string> stringList);
double m_PercentTolerance
Definition: CommonDataModelTest.h:40
Definition: CommonDataModelTest.h:24
Definition: CommonDataModelTest.h:28
std::map< std::string, testFunction > testMap
Definition: CommonDataModelTest.h:45
Definition: SEThermalCompartment.h:26
Definition: SECompartmentManager.h:32
bool myLogger
Definition: CommonDataModelTest.h:39
Definition: SELiquidSubstanceQuantity.h:28
Definition: CommonDataModelTest.h:26
Definition: SELiquidCompartment.h:27
Definition: CommonDataModelTest.h:25
Definition: SEFluidCircuit.h:20
std::string m_OutDirectory
Definition: CommonDataModelTest.h:41
SECircuitManager m_Circuits
Definition: CommonDataModelTest.h:362
Definition: CommonDataModelTest.h:23
Definition: SEGasSubstanceQuantity.h:20
Definition: SETestCase.h:21
testMap cdmMap
Definition: CommonDataModelTest.h:46
Definition: SETestSuite.h:20
enumCDMTestSourceType
Definition: CommonDataModelTest.h:23
Definition: SESubstanceManager.h:23
std::stringstream m_ss
Definition: CommonDataModelTest.h:42
Definition: SEElectricalCircuit.h:18
Definition: SECircuitManager.h:53
Definition: SEGasCompartment.h:24