Commit e7ba5999 authored by Aaron Bray's avatar Aaron Bray
Browse files

Fix the engine unit tests

parent cb1d27d6
......@@ -23,10 +23,11 @@ ReadScenarios = EngineUnitTestDriver NoCompare Computed=./test_results/unit_test
@group Cardiovascular
CardiovascularCircuitAndTransport = EngineUnitTest Results=CardiovascularCircuitOutput,CardiovascularTransportOutput
CardiovascularAndCerebrospinalFluidCircuitAndTransport = EngineUnitTest Results=CardiovascularAndCerebrospinalFluidCircuitOutput,CardiovascularAndCerebrospinalFluidTransportOutput
#CardiovascularAndCerebrospinalFluidCircuitAndTransport = EngineUnitTest Results=CardiovascularAndCerebrospinalFluidCircuitOutput,CardiovascularAndCerebrospinalFluidTransportOutput
CardiovascularAndRenalCircuitAndTransport = EngineUnitTest Results=CardiovascularAndRenalCircuitOutput,CardiovascularAndRenalTransportOutput
CardiovascularAndTissueCircuitAndTransport = EngineUnitTest Results=CardiovascularAndTissueCircuitOutput,CardiovascularAndTissueTransportOutput
FullCardiovascularCircuitAndTransport = EngineUnitTest Results=FullCardiovascularCircuitOutput,FullCardiovascularTransportOutput
# Turn on CSF in this test when ready
CardiovascularBloodGases = EngineUnitTest Results=CardiovascularBloodGasesTestCircuitOutput,CardiovascularBloodGasesTestTransportOutput
TuneCardiovascularCircuit = EngineUnitTest NoCompare
......
67594bab991ed31835610311341e397ba802edf005183c678289294d01c82b8b62c49a09a3116337a6ed27e55c57d389df944bfff5882bbea4276c7c3b91b8b6
\ No newline at end of file
......@@ -393,7 +393,7 @@ void PulseConfiguration::Initialize(const std::string& dataDir, SESubstanceManag
GetAirSpecificHeat().SetValue(1.0035, HeatCapacitancePerMassUnit::kJ_Per_K_kg);
GetMolarMassOfDryAir().SetValue(0.028964, MassPerAmountUnit::kg_Per_mol);
GetMolarMassOfWaterVapor().SetValue(0.018016, MassPerAmountUnit::kg_Per_mol);
if (!dataDir.empty())
if (!dataDir.empty() && subMgr != nullptr)
GetInitialEnvironmentalConditions().SerializeFromFile(dataDir +"/environments/Standard.json", *subMgr);
GetWaterDensity().SetValue(1000, MassPerVolumeUnit::kg_Per_m3);
......
......@@ -485,7 +485,7 @@ void Cardiovascular::ChronicAnemia()
if (path->HasResistanceBaseline())
{
path->GetResistanceBaseline().SetValue(path->GetResistanceBaseline(PressureTimePerVolumeUnit::mmHg_s_Per_mL)*viscousModifier, PressureTimePerVolumeUnit::mmHg_s_Per_mL);
}
}
}
}
......
......@@ -267,7 +267,7 @@ void PulseEngineTest::DepositionFractionTest(SETestSuite& suite, SESubstance& su
pc.SetupPatient(patient);
pc.GetSubstances().LoadSubstanceDirectory("./");
pc.GetSaturationCalculator().Setup();
pc.m_Config->Initialize("./");
pc.m_Config->Initialize("./", &pc.GetSubstances());
pc.m_Config->EnableRenal(eSwitch::Off);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......
......@@ -57,7 +57,7 @@ void PulseEngineTest::AnesthesiaMachineCircuitAndTransportTest(RespiratoryConfig
pc.SetupPatient(patient);
pc.GetSubstances().LoadSubstanceDirectory("./");
pc.GetSaturationCalculator().Setup();
pc.m_Config->Initialize("./");
pc.m_Config->Initialize("./", &pc.GetSubstances());
pc.m_Config->EnableRenal(eSwitch::Off);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......
......@@ -60,13 +60,13 @@ void PulseEngineTest::CardiovascularAndCerebrospinalFluidCircuitAndTransportTest
}
void PulseEngineTest::FullCardiovascularCircuitAndTransportTest(const std::string& sTestDirectory)
{
CardiovascularCircuitAndTransportTest(Heart, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, true, true, true, false, sTestDirectory, "FullCardiovascular", false);
{// \todo enable csf when ready
CardiovascularCircuitAndTransportTest(Heart, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, true, true, false, false, sTestDirectory, "FullCardiovascular", false);
}
void PulseEngineTest::CardiovascularBloodGasesTest(const std::string& sTestDirectory)
{
CardiovascularCircuitAndTransportTest(Heart, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, true, true, true, true, sTestDirectory, "CardiovascularBloodGasesTest", false);
{// \todo enable csf when ready
CardiovascularCircuitAndTransportTest(Heart, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, true, true, false, true, sTestDirectory, "CardiovascularBloodGasesTest", false);
}
void PulseEngineTest::TuneCardiovascularCircuitTest(const std::string& sTestDirectory)
......@@ -207,7 +207,7 @@ void PulseEngineTest::CardiovascularCircuitAndTransportTest(CardiovascularDriver
pc.SetupPatient(patient);
pc.GetSubstances().LoadSubstanceDirectory("./");
pc.GetSaturationCalculator().Setup();
pc.m_Config->Initialize("./");
pc.m_Config->Initialize("./", &pc.GetSubstances());
if (heartRate_bpm <= 0)
heartRate_bpm = pc.GetCurrentPatient().GetHeartRateBaseline(FrequencyUnit::Per_min);
else
......
......@@ -90,7 +90,7 @@ void PulseEngineTest::FourCompartmentTest(bool usingAcidBase, bool usingProducti
pc.SetupPatient(patient);
pc.GetSubstances().LoadSubstanceDirectory("./");
pc.GetSaturationCalculator().Setup();
pc.m_Config->Initialize("./");
pc.m_Config->Initialize("./", &pc.GetSubstances());
pc.m_Config->EnableRenal(eSwitch::Off);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......
......@@ -57,7 +57,7 @@ void PulseEngineTest::MechanicalVentilatorCircuitAndTransportTest(RespiratoryCon
pc.SetupPatient(patient);
pc.GetSubstances().LoadSubstanceDirectory("./");
pc.GetSaturationCalculator().Setup();
pc.m_Config->Initialize("./");
pc.m_Config->Initialize("./", &pc.GetSubstances());
pc.m_Config->EnableRenal(eSwitch::Off);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......
......@@ -74,7 +74,7 @@ void PulseEngineTest::BrainInjuryTest(const std::string& sTestDirectory)
pc.SetupPatient(patient);
pc.GetSubstances().LoadSubstanceDirectory("./");
pc.GetSaturationCalculator().Setup();
pc.m_Config->Initialize("./");
pc.m_Config->Initialize("./", &pc.GetSubstances());
//Renal and Tissue are on
pc.m_Config->EnableRenal(eSwitch::On);
pc.m_Config->EnableTissue(eSwitch::On);
......
......@@ -55,7 +55,7 @@ void PulseEngineTest::RenalCircuitAndTransportTest(const std::string& sTestDirec
pc.SetupPatient(patient);
pc.GetSubstances().LoadSubstanceDirectory("./");
pc.GetSaturationCalculator().Setup();
pc.m_Config->Initialize("./");
pc.m_Config->Initialize("./", &pc.GetSubstances());
pc.m_Config->EnableRenal(eSwitch::On);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......@@ -186,7 +186,7 @@ void PulseEngineTest::RenalFeedbackTest(RenalFeedback feedback, const std::strin
pc.SetupPatient(patient);
pc.GetSubstances().LoadSubstanceDirectory("./");
pc.GetSaturationCalculator().Setup();
pc.m_Config->Initialize("./");
pc.m_Config->Initialize("./", &pc.GetSubstances());
pc.m_Config->EnableRenal(eSwitch::On);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......@@ -505,7 +505,7 @@ void PulseEngineTest::RenalSystemTest(RenalSystems systemtest, const std::string
pc.SetupPatient(patient);
pc.GetSubstances().LoadSubstanceDirectory("./");
pc.GetSaturationCalculator().Setup();
pc.m_Config->Initialize("./");
pc.m_Config->Initialize("./", &pc.GetSubstances());
pc.m_Config->EnableRenal(eSwitch::On);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......
......@@ -52,7 +52,7 @@ void PulseEngineTest::RespiratoryCircuitAndTransportTest(RespiratoryConfiguratio
pc.SetupPatient(patient);
pc.GetSubstances().LoadSubstanceDirectory("./");
pc.GetSaturationCalculator().Setup();
pc.m_Config->Initialize("./");
pc.m_Config->Initialize("./", &pc.GetSubstances());
pc.m_Config->EnableRenal(eSwitch::Off);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......@@ -218,7 +218,7 @@ void PulseEngineTest::RespiratoryDriverTest(const std::string& sTestDirectory)
pc.SetupPatient(patient);
pc.GetSubstances().LoadSubstanceDirectory("./");
pc.GetSaturationCalculator().Setup();
pc.m_Config->Initialize("./");
pc.m_Config->Initialize("./", &pc.GetSubstances());
pc.m_Config->EnableRenal(eSwitch::Off);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......
......@@ -53,7 +53,7 @@ void PulseEngineTest::SolverSpeedTest(const std::string& rptDirectory)
pc.SetupPatient(patient);
pc.GetSubstances().LoadSubstanceDirectory("./");
pc.GetSaturationCalculator().Setup();
pc.m_Config->Initialize("./");
pc.m_Config->Initialize("./", &pc.GetSubstances());
pc.m_Config->EnableRenal(eSwitch::On);
pc.m_Config->EnableTissue(eSwitch::On);
pc.CreateCircuitsAndCompartments();
......
......@@ -45,7 +45,7 @@ void PulseEngineTest::InternalTemperatureVariableBMRCircuitTest(const std::strin
pc.SetupPatient(patient);
pc.GetSubstances().LoadSubstanceDirectory("./");
pc.GetSaturationCalculator().Setup();
pc.m_Config->Initialize("./");
pc.m_Config->Initialize("./", &pc.GetSubstances());
pc.m_Config->EnableRenal(eSwitch::Off);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......@@ -124,7 +124,7 @@ void PulseEngineTest::InternalTemperatureVariableSkinCircuitTest(const std::stri
pc.SetupPatient(patient);
pc.GetSubstances().LoadSubstanceDirectory("./");
pc.GetSaturationCalculator().Setup();
pc.m_Config->Initialize("./");
pc.m_Config->Initialize("./", &pc.GetSubstances());
pc.m_Config->EnableRenal(eSwitch::Off);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......@@ -226,7 +226,7 @@ void PulseEngineTest::InternalTemperatureVariableCoreCircuitTest(const std::stri
pc.SetupPatient(patient);
pc.GetSubstances().LoadSubstanceDirectory("./");
pc.GetSaturationCalculator().Setup();
pc.m_Config->Initialize("./");
pc.m_Config->Initialize("./", &pc.GetSubstances());
pc.m_Config->EnableRenal(eSwitch::Off);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......@@ -327,7 +327,7 @@ void PulseEngineTest::EnvironmentVariableTemperatureCircuitTest(const std::strin
pc.SetupPatient(patient);
pc.GetSubstances().LoadSubstanceDirectory("./");
pc.GetSaturationCalculator().Setup();
pc.m_Config->Initialize("./");
pc.m_Config->Initialize("./", &pc.GetSubstances());
pc.m_Config->EnableRenal(eSwitch::Off);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......@@ -456,7 +456,7 @@ void PulseEngineTest::CombinedInternalAndEnvironmentVariableBMRandTemperatureCir
pc.SetupPatient(patient);
pc.GetSubstances().LoadSubstanceDirectory("./");
pc.GetSaturationCalculator().Setup();
pc.m_Config->Initialize("./");
pc.m_Config->Initialize("./", &pc.GetSubstances());
pc.m_Config->EnableRenal(eSwitch::Off);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......@@ -615,7 +615,7 @@ void PulseEngineTest::CombinedInternalAndEnvironmentSkinTempDropCircuitTest(cons
pc.SetupPatient(patient);
pc.GetSubstances().LoadSubstanceDirectory("./");
pc.GetSaturationCalculator().Setup();
pc.m_Config->Initialize("./");
pc.m_Config->Initialize("./", &pc.GetSubstances());
pc.m_Config->EnableRenal(eSwitch::Off);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......@@ -714,7 +714,7 @@ void PulseEngineTest::EnvironmentISO7730ComparisonTest(const std::string& sTestD
pc.SetupPatient(patient);
pc.GetSubstances().LoadSubstanceDirectory("./");
pc.GetSaturationCalculator().Setup();
pc.m_Config->Initialize("./");
pc.m_Config->Initialize("./", &pc.GetSubstances());
pc.m_Config->EnableRenal(eSwitch::Off);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......
......@@ -70,7 +70,7 @@ namespace HowTo_UseEngine
pulse.SetLogFilename("./test_results/HowTo_EngineUse.cs.log");
// You can also have pulse log to the console (std::cout)
// By default, console logging is turned off
//pulse.LogToConsole(true);
pulse.LogToConsole(true);
// It is recommended to listen and manage the log messages yourself
// With a listener, you can add messages to a log, display, or write them to console
pulse.SetLogListener(new MyLogListener());
......@@ -78,7 +78,7 @@ namespace HowTo_UseEngine
// You must provide an event listener to get events
pulse.SetEventHandler(new MyEventHandler());
InitializationType initType = InitializationType.StateString;
InitializationType initType = InitializationType.PatientObject;
switch (initType)
{
case InitializationType.StateFileName:
......
......@@ -33,8 +33,8 @@ namespace Pulse.CDM
// Expiration Cyclye (Only set one)
protected SEScalarVolumePerTime expiration_cycle_flow;
protected SEScalarPressure expiration_cycle_pressure;
protected SEScalarVolume expiration_cycle_volume;
protected SEScalarTime expiration_cycle_time;
protected SEScalarVolume expiration_cycle_volume;
protected SEScalarPressureTimePerVolume expiration_tube_resistance;
protected SEScalarPressureTimePerVolume expiration_valve_resistance;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment