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

Update Java with new respiratory properties

Fix testing for new patient setup
parent 83f48363
......@@ -21,11 +21,14 @@ public class SERespiratorySystem extends SEPhysiologySystem implements SESystem
protected SEScalar0To1 endTidalOxygenFraction;
protected SEScalarPressure endTidalOxygenPressure;
protected SEScalarVolumePerTime expiratoryFlow;
protected SEScalarPressureTimePerVolume expiratoryPulmonaryResistance;
protected SEScalarPower imposedPowerOfBreathing;
protected SEScalarEnergy imposedWorkOfBreathing;
protected SEScalar inspiratoryExpiratoryRatio;
protected SEScalarVolumePerTime inspiratoryFlow;
protected SEScalarPressureTimePerVolume inspiratoryPulmonaryResistance;
protected SEScalarPressure intrapleuralPressure;
protected SEScalarPressure intrapulmonaryPressure;
protected SEScalarVolumePerPressure lungCompliance;
protected SEScalarPressure maximalInspiratoryPressure;
protected SEScalarPower patientPowerOfBreathing;
......@@ -35,7 +38,6 @@ public class SERespiratorySystem extends SEPhysiologySystem implements SESystem
protected SEScalarPressure positiveEndExpiratoryPressure;
protected SEScalarVolumePerPressure pulmonaryCompliance;
protected SEScalarPressurePerVolume pulmonaryElastance;
protected SEScalarPressureTimePerVolume pulmonaryResistance;
protected SEScalarEnergy resistiveExpiratoryWorkOfBreathing;
protected SEScalarEnergy resistiveInspiratoryWorkOfBreathing;
protected SEScalarFrequency respirationRate;
......@@ -52,6 +54,7 @@ public class SERespiratorySystem extends SEPhysiologySystem implements SESystem
protected SEScalarPressure transairwayPressure;
protected SEScalarPressure transalveolarPressure;
protected SEScalarPressure transChestWallPressure;
protected SEScalarPressure transMusclePressure;
protected SEScalarPressure transpulmonaryPressure;
protected SEScalarPressure transrespiratoryPressure;
protected SEScalarPressure transthoracicPressure;
......@@ -70,11 +73,14 @@ public class SERespiratorySystem extends SEPhysiologySystem implements SESystem
endTidalOxygenFraction = null;
endTidalOxygenPressure = null;
expiratoryFlow = null;
expiratoryPulmonaryResistance = null;
imposedPowerOfBreathing = null;
imposedWorkOfBreathing = null;
inspiratoryExpiratoryRatio = null;
inspiratoryFlow = null;
inspiratoryPulmonaryResistance = null;
intrapleuralPressure = null;
intrapulmonaryPressure = null;
lungCompliance = null;
maximalInspiratoryPressure = null;
patientPowerOfBreathing = null;
......@@ -84,7 +90,6 @@ public class SERespiratorySystem extends SEPhysiologySystem implements SESystem
positiveEndExpiratoryPressure = null;
pulmonaryCompliance = null;
pulmonaryElastance = null;
pulmonaryResistance = null;
resistiveExpiratoryWorkOfBreathing = null;
resistiveInspiratoryWorkOfBreathing = null;
respirationRate = null;
......@@ -101,6 +106,7 @@ public class SERespiratorySystem extends SEPhysiologySystem implements SESystem
transairwayPressure = null;
transalveolarPressure = null;
transChestWallPressure = null;
transMusclePressure = null;
transpulmonaryPressure = null;
transrespiratoryPressure = null;
transthoracicPressure = null;
......@@ -130,6 +136,8 @@ public class SERespiratorySystem extends SEPhysiologySystem implements SESystem
endTidalOxygenPressure.invalidate();
if (expiratoryFlow != null)
expiratoryFlow.invalidate();
if (expiratoryPulmonaryResistance != null)
expiratoryPulmonaryResistance.invalidate();
if (imposedPowerOfBreathing != null)
imposedPowerOfBreathing.invalidate();
if (imposedWorkOfBreathing != null)
......@@ -138,8 +146,12 @@ public class SERespiratorySystem extends SEPhysiologySystem implements SESystem
inspiratoryExpiratoryRatio.invalidate();
if (inspiratoryFlow != null)
inspiratoryFlow.invalidate();
if (inspiratoryPulmonaryResistance != null)
inspiratoryPulmonaryResistance.invalidate();
if (intrapleuralPressure != null)
intrapleuralPressure.invalidate();
if (intrapulmonaryPressure != null)
intrapulmonaryPressure.invalidate();
if (lungCompliance != null)
lungCompliance.invalidate();
if (maximalInspiratoryPressure != null)
......@@ -158,8 +170,6 @@ public class SERespiratorySystem extends SEPhysiologySystem implements SESystem
pulmonaryCompliance.invalidate();
if (pulmonaryElastance != null)
pulmonaryElastance.invalidate();
if (pulmonaryResistance != null)
pulmonaryResistance.invalidate();
if (resistiveExpiratoryWorkOfBreathing != null)
resistiveExpiratoryWorkOfBreathing.invalidate();
if (resistiveInspiratoryWorkOfBreathing != null)
......@@ -192,6 +202,8 @@ public class SERespiratorySystem extends SEPhysiologySystem implements SESystem
transalveolarPressure.invalidate();
if (transChestWallPressure != null)
transChestWallPressure.invalidate();
if (transMusclePressure != null)
transMusclePressure.invalidate();
if (transpulmonaryPressure != null)
transpulmonaryPressure.invalidate();
if (transrespiratoryPressure != null)
......@@ -224,6 +236,8 @@ public class SERespiratorySystem extends SEPhysiologySystem implements SESystem
SEScalarPressure.load(src.getEndTidalOxygenPressure(),dst.getEndTidalOxygenPressure());
if (src.hasExpiratoryFlow())
SEScalarVolumePerTime.load(src.getExpiratoryFlow(),dst.getExpiratoryFlow());
if (src.hasExpiratoryPulmonaryResistance())
SEScalarPressureTimePerVolume.load(src.getExpiratoryPulmonaryResistance(),dst.getExpiratoryPulmonaryResistance());
if (src.hasImposedPowerOfBreathing())
SEScalarPower.load(src.getImposedPowerOfBreathing(),dst.getImposedPowerOfBreathing());
if (src.hasImposedWorkOfBreathing())
......@@ -232,8 +246,12 @@ public class SERespiratorySystem extends SEPhysiologySystem implements SESystem
SEScalar.load(src.getInspiratoryExpiratoryRatio(),dst.getInspiratoryExpiratoryRatio());
if (src.hasInspiratoryFlow())
SEScalarVolumePerTime.load(src.getInspiratoryFlow(),dst.getInspiratoryFlow());
if (src.hasInspiratoryPulmonaryResistance())
SEScalarPressureTimePerVolume.load(src.getInspiratoryPulmonaryResistance(),dst.getInspiratoryPulmonaryResistance());
if (src.hasIntrapleuralPressure())
SEScalarPressure.load(src.getIntrapleuralPressure(),dst.getIntrapleuralPressure());
SEScalarPressure.load(src.getIntrapleuralPressure(),dst.getIntrapleuralPressure());
if (src.hasIntrapulmonaryPressure())
SEScalarPressure.load(src.getIntrapulmonaryPressure(),dst.getIntrapulmonaryPressure());
if (src.hasLungCompliance())
SEScalarVolumePerPressure.load(src.getLungCompliance(),dst.getLungCompliance());
if (src.hasMaximalInspiratoryPressure())
......@@ -252,8 +270,6 @@ public class SERespiratorySystem extends SEPhysiologySystem implements SESystem
SEScalarVolumePerPressure.load(src.getPulmonaryCompliance(),dst.getPulmonaryCompliance());
if (src.hasPulmonaryElastance())
SEScalarPressurePerVolume.load(src.getPulmonaryElastance(),dst.getPulmonaryElastance());
if (src.hasPulmonaryResistance())
SEScalarPressureTimePerVolume.load(src.getPulmonaryResistance(),dst.getPulmonaryResistance());
if (src.hasResistiveExpiratoryWorkOfBreathing())
SEScalarEnergy.load(src.getResistiveExpiratoryWorkOfBreathing(),dst.getResistiveExpiratoryWorkOfBreathing());
if (src.hasResistiveInspiratoryWorkOfBreathing())
......@@ -286,6 +302,8 @@ public class SERespiratorySystem extends SEPhysiologySystem implements SESystem
SEScalarPressure.load(src.getTransalveolarPressure(),dst.getTransalveolarPressure());
if (src.hasTransChestWallPressure())
SEScalarPressure.load(src.getTransChestWallPressure(),dst.getTransChestWallPressure());
if (src.hasTransMusclePressure())
SEScalarPressure.load(src.getTransMusclePressure(),dst.getTransMusclePressure());
if (src.hasTranspulmonaryPressure())
SEScalarPressure.load(src.getTranspulmonaryPressure(),dst.getTranspulmonaryPressure());
if (src.hasTransrespiratoryPressure())
......@@ -325,6 +343,8 @@ public class SERespiratorySystem extends SEPhysiologySystem implements SESystem
dst.setEndTidalOxygenPressure(SEScalarPressure.unload(src.getEndTidalOxygenPressure()));
if (src.hasExpiratoryFlow())
dst.setExpiratoryFlow(SEScalarVolumePerTime.unload(src.getExpiratoryFlow()));
if (src.hasExpiratoryPulmonaryResistance())
dst.setExpiratoryPulmonaryResistance(SEScalarPressureTimePerVolume.unload(src.getExpiratoryPulmonaryResistance()));
if (src.hasImposedPowerOfBreathing())
dst.setImposedPowerOfBreathing(SEScalarPower.unload(src.getImposedPowerOfBreathing()));
if (src.hasImposedWorkOfBreathing())
......@@ -333,8 +353,12 @@ public class SERespiratorySystem extends SEPhysiologySystem implements SESystem
dst.setInspiratoryExpiratoryRatio(SEScalar.unload(src.getInspiratoryExpiratoryRatio()));
if (src.hasInspiratoryFlow())
dst.setInspiratoryFlow(SEScalarVolumePerTime.unload(src.getInspiratoryFlow()));
if (src.hasInspiratoryPulmonaryResistance())
dst.setInspiratoryPulmonaryResistance(SEScalarPressureTimePerVolume.unload(src.getInspiratoryPulmonaryResistance()));
if (src.hasIntrapleuralPressure())
dst.setIntrapleuralPressure(SEScalarPressure.unload(src.getIntrapleuralPressure()));
if (src.hasIntrapulmonaryPressure())
dst.setIntrapulmonaryPressure(SEScalarPressure.unload(src.getIntrapulmonaryPressure()));
if (src.hasLungCompliance())
dst.setLungCompliance(SEScalarVolumePerPressure.unload(src.getLungCompliance()));
if (src.hasMaximalInspiratoryPressure())
......@@ -353,8 +377,6 @@ public class SERespiratorySystem extends SEPhysiologySystem implements SESystem
dst.setPulmonaryCompliance(SEScalarVolumePerPressure.unload(src.getPulmonaryCompliance()));
if (src.hasPulmonaryElastance())
dst.setPulmonaryElastance(SEScalarPressurePerVolume.unload(src.getPulmonaryElastance()));
if (src.hasPulmonaryResistance())
dst.setPulmonaryResistance(SEScalarPressureTimePerVolume.unload(src.getPulmonaryResistance()));
if (src.hasResistiveExpiratoryWorkOfBreathing())
dst.setResistiveExpiratoryWorkOfBreathing(SEScalarEnergy.unload(src.getResistiveExpiratoryWorkOfBreathing()));
if (src.hasResistiveInspiratoryWorkOfBreathing())
......@@ -387,6 +409,8 @@ public class SERespiratorySystem extends SEPhysiologySystem implements SESystem
dst.setTransalveolarPressure(SEScalarPressure.unload(src.getTransalveolarPressure()));
if (src.hasTransChestWallPressure())
dst.setTransChestWallPressure(SEScalarPressure.unload(src.getTransChestWallPressure()));
if (src.hasTransMusclePressure())
dst.setTransMusclePressure(SEScalarPressure.unload(src.getTransMusclePressure()));
if (src.hasTranspulmonaryPressure())
dst.setTranspulmonaryPressure(SEScalarPressure.unload(src.getTranspulmonaryPressure()));
if (src.hasTransrespiratoryPressure())
......@@ -516,6 +540,18 @@ public class SERespiratorySystem extends SEPhysiologySystem implements SESystem
return expiratoryFlow;
}
public boolean hasExpiratoryPulmonaryResistance()
{
return expiratoryPulmonaryResistance == null ? false : expiratoryPulmonaryResistance.isValid();
}
public SEScalarPressureTimePerVolume getExpiratoryPulmonaryResistance()
{
if (expiratoryPulmonaryResistance == null)
expiratoryPulmonaryResistance = new SEScalarPressureTimePerVolume();
return expiratoryPulmonaryResistance;
}
public boolean hasImposedPowerOfBreathing()
{
return imposedPowerOfBreathing == null ? false : imposedPowerOfBreathing.isValid();
......@@ -560,6 +596,17 @@ public class SERespiratorySystem extends SEPhysiologySystem implements SESystem
return inspiratoryFlow;
}
public boolean hasInspiratoryPulmonaryResistance()
{
return inspiratoryPulmonaryResistance == null ? false : inspiratoryPulmonaryResistance.isValid();
}
public SEScalarPressureTimePerVolume getInspiratoryPulmonaryResistance()
{
if (inspiratoryPulmonaryResistance == null)
inspiratoryPulmonaryResistance = new SEScalarPressureTimePerVolume();
return inspiratoryPulmonaryResistance;
}
public boolean hasIntrapleuralPressure()
{
return intrapleuralPressure == null ? false : intrapleuralPressure.isValid();
......@@ -571,6 +618,17 @@ public class SERespiratorySystem extends SEPhysiologySystem implements SESystem
return intrapleuralPressure;
}
public boolean hasIntrapulmonaryPressure()
{
return intrapulmonaryPressure == null ? false : intrapulmonaryPressure.isValid();
}
public SEScalarPressure getIntrapulmonaryPressure()
{
if (intrapulmonaryPressure == null)
intrapulmonaryPressure = new SEScalarPressure();
return intrapulmonaryPressure;
}
public boolean hasLungCompliance()
{
return lungCompliance == null ? false : lungCompliance.isValid();
......@@ -661,7 +719,7 @@ public class SERespiratorySystem extends SEPhysiologySystem implements SESystem
public boolean hasPulmonaryElastance()
{
return pulmonaryElastance == null ? false : pulmonaryResistance.isValid();
return pulmonaryElastance == null ? false : pulmonaryElastance.isValid();
}
public SEScalarPressurePerVolume getPulmonaryElastance()
{
......@@ -669,17 +727,6 @@ public class SERespiratorySystem extends SEPhysiologySystem implements SESystem
pulmonaryElastance = new SEScalarPressurePerVolume();
return pulmonaryElastance;
}
public boolean hasPulmonaryResistance()
{
return pulmonaryResistance == null ? false : pulmonaryResistance.isValid();
}
public SEScalarPressureTimePerVolume getPulmonaryResistance()
{
if (pulmonaryResistance == null)
pulmonaryResistance = new SEScalarPressureTimePerVolume();
return pulmonaryResistance;
}
public boolean hasResistiveExpiratoryWorkOfBreathing()
{
......@@ -857,6 +904,17 @@ public class SERespiratorySystem extends SEPhysiologySystem implements SESystem
return transChestWallPressure;
}
public boolean hasTransMusclePressure()
{
return transMusclePressure == null ? false : transMusclePressure.isValid();
}
public SEScalarPressure getTransMusclePressure()
{
if (transMusclePressure == null)
transMusclePressure = new SEScalarPressure();
return transMusclePressure;
}
public boolean hasTranspulmonaryPressure()
{
return transpulmonaryPressure == null ? false : transpulmonaryPressure.isValid();
......
......@@ -148,11 +148,11 @@ DataTrack& PulseController::GetDataTrack()
return *m_DataTrack;
}
bool PulseController::Initialize(const PulseConfiguration* config)
bool PulseController::Initialize(const PulseConfiguration* config, SEPatient const& patient)
{
m_State = EngineState::NotReady;
Info("Configuring patient");
if (!SetupPatient())
if (!SetupPatient(patient))
return false;
Info("Resetting Substances");
......@@ -286,10 +286,12 @@ void PulseController::SetIntubation(eSwitch s)
}
eSwitch PulseController::GetIntubation() { return m_Intubation; }
bool PulseController::SetupPatient()
bool PulseController::SetupPatient(SEPatient const& patient)
{
bool err = false;
std::stringstream ss;
m_InitialPatient->Copy(patient);
//Sex is the only thing we absolutely need to be defined, the CDM assumes male if not provided
......
......@@ -131,8 +131,8 @@ protected:
void SetupExternalTemperature();
void SetupInternalTemperature();
bool Initialize(const PulseConfiguration* config);
bool SetupPatient();
bool Initialize(const PulseConfiguration* config, const SEPatient& patient);
bool SetupPatient(const SEPatient& patient);
// Notify systems that steady state has been achieved
virtual void AtSteadyState(EngineState state);
......
......@@ -122,22 +122,6 @@ bool PulseEngine::InitializeEngine(const std::string& patient_configuration, Ser
bool PulseEngine::InitializeEngine(const SEPatientConfiguration& patient_configuration, const SEEngineConfiguration* config)
{
if (patient_configuration.HasPatient())
m_InitialPatient->Copy(*patient_configuration.GetPatient());
else if (patient_configuration.HasPatientFile())
{
std::string pFile = patient_configuration.GetPatientFile();
if (pFile.find("/patients") == std::string::npos)
{// Prepend the patient directory if it's not there
pFile = "./patients/";
pFile += patient_configuration.GetPatientFile();
}
if (!m_InitialPatient->SerializeFromFile(pFile, JSON))// TODO Support all serialization formats
return false;
}
else
return false;
const PulseConfiguration* pConfig = nullptr;
if (config != nullptr)
{
......@@ -150,7 +134,26 @@ bool PulseEngine::InitializeEngine(const SEPatientConfiguration& patient_configu
}
m_EngineTrack->ResetFile();
m_State = EngineState::Initialization;
if (!PulseController::Initialize(pConfig))
if (patient_configuration.HasPatient())
{
if (!PulseController::Initialize(pConfig, *patient_configuration.GetPatient()))
return false;
}
else if (patient_configuration.HasPatientFile())
{
SEPatient patient(m_Logger);
std::string pFile = patient_configuration.GetPatientFile();
if (pFile.find("/patients") == std::string::npos)
{// Prepend the patient directory if it's not there
pFile = "./patients/";
pFile += patient_configuration.GetPatientFile();
}
if (!patient.SerializeFromFile(pFile, JSON))// TODO Support all serialization formats
return false;
if (!PulseController::Initialize(pConfig, patient))
return false;
}
else
return false;
// We don't capture events during initialization
......
......@@ -260,8 +260,9 @@ void PulseEngineTest::DepositionFractionTest(SETestSuite& suite, SESubstance& su
tc.SetName(substance.GetName()+"DepositionFraction");
PulseController pc(m_Logger);
pc.GetPatient().SerializeFromFile("./patients/StandardMale.json",JSON);
pc.SetupPatient();
SEPatient patient(pc.GetLogger());
patient.SerializeFromFile("./patients/StandardMale.json", JSON);
pc.SetupPatient(patient);
pc.m_Config->EnableRenal(eSwitch::Off);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......
......@@ -50,8 +50,9 @@ void PulseEngineTest::AnesthesiaMachineCircuitAndTransportTest(RespiratoryConfig
std::ofstream fileGraph;
PulseController pc(sTestDirectory + "/AnesthesiaMachineCircuitAndTransportTest.log");
pc.GetPatient().SerializeFromFile("./patients/StandardMale.json",JSON);
pc.SetupPatient();
SEPatient patient(pc.GetLogger());
patient.SerializeFromFile("./patients/StandardMale.json", JSON);
pc.SetupPatient(patient);
pc.m_Config->EnableRenal(eSwitch::Off);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......
......@@ -131,10 +131,9 @@ void PulseEngineTest::TuneCardiovascularCircuitTest(SETestSuite& testSuite, cons
timer.Start("TestCase");
PulseController pc(testSuite.GetLogger());
testSuite.GetLogger()->Info("Running " + sTestName);
pc.GetPatient().Copy(patient);
pc.m_Config->EnableRenal(eSwitch::On);
pc.m_Config->EnableTissue(eSwitch::On);
pc.SetupPatient();
pc.SetupPatient(patient);
pc.CreateCircuitsAndCompartments();
SETestCase& testCase = testSuite.CreateTestCase();
......@@ -195,13 +194,14 @@ void PulseEngineTest::CardiovascularCircuitAndTransportTest(CardiovascularDriver
double binding_s = 0;
PulseController pc(sTestDirectory + "/" + tName.str() + "CircuitAndTransportTest.log");
pc.GetLogger()->Info("Running " + tName.str());
pc.GetPatient().SerializeFromFile("./patients/StandardMale.json",JSON);
pc.SetupPatient();
SEPatient patient(pc.GetLogger());
patient.SerializeFromFile("./patients/StandardMale.json", JSON);
pc.SetupPatient(patient);
if (heartRate_bpm <= 0)
heartRate_bpm = pc.GetPatient().GetHeartRateBaseline().GetValue(FrequencyUnit::Per_min);
heartRate_bpm = pc.GetCurrentPatient().GetHeartRateBaseline(FrequencyUnit::Per_min);
else
{
pc.GetPatient().GetHeartRateBaseline().SetValue(heartRate_bpm, FrequencyUnit::Per_min);
pc.GetCurrentPatient().GetHeartRateBaseline().SetValue(heartRate_bpm, FrequencyUnit::Per_min);
}
pc.m_Config->EnableRenal(connectRenal ? eSwitch::On : eSwitch::Off);
......
......@@ -85,8 +85,9 @@ void PulseEngineTest::FourCompartmentTest(bool usingAcidBase, bool usingProducti
SEFluidCircuitCalculator calc(VolumePerPressureUnit::mL_Per_mmHg, VolumePerTimeUnit::mL_Per_s, PressureTimeSquaredPerVolumeUnit::mmHg_s2_Per_mL, PressureUnit::mmHg, VolumeUnit::mL, PressureTimePerVolumeUnit::mmHg_s_Per_mL, m_Logger);
PulseController pc(m_Logger);
Tissue& tsu = (Tissue&)pc.GetTissue();
pc.GetPatient().SerializeFromFile("./patients/StandardMale.json",JSON);
pc.SetupPatient();
SEPatient patient(pc.GetLogger());
patient.SerializeFromFile("./patients/StandardMale.json", JSON);
pc.SetupPatient(patient);
pc.m_Config->EnableRenal(eSwitch::Off);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......
......@@ -66,8 +66,9 @@ void PulseEngineTest::BrainInjuryTest(const std::string& sTestDirectory)
PulseController pc(sTestDirectory + "/" + tName + ".log");
pc.GetLogger()->Info("Running " + tName);
pc.GetPatient().SerializeFromFile("./patients/StandardMale.json",JSON);
pc.SetupPatient();
SEPatient patient(pc.GetLogger());
patient.SerializeFromFile("./patients/StandardMale.json", JSON);
pc.SetupPatient(patient);
//Renal and Tissue are on
pc.m_Config->EnableRenal(eSwitch::On);
......
......@@ -48,8 +48,9 @@ void PulseEngineTest::RenalCircuitAndTransportTest(const std::string& sTestDirec
std::ofstream graphFile;
PulseController pc(sTestDirectory + "/RenalCircuitAndTransportTest.log");
pc.GetPatient().SerializeFromFile("./patients/StandardMale.json",JSON);
pc.SetupPatient();
SEPatient patient(pc.GetLogger());
patient.SerializeFromFile("./patients/StandardMale.json",JSON);
pc.SetupPatient(patient);
pc.m_Config->EnableRenal(eSwitch::On);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......@@ -174,8 +175,9 @@ void PulseEngineTest::RenalFeedbackTest(RenalFeedback feedback, const std::strin
TimingProfile tmr;
tmr.Start("Test");
PulseController pc(sTestDirectory + "/RenalFeedbackTest.log");
pc.GetPatient().SerializeFromFile("./patients/StandardMale.json",JSON);
pc.SetupPatient();
SEPatient patient(pc.GetLogger());
patient.SerializeFromFile("./patients/StandardMale.json", JSON);
pc.SetupPatient(patient);
pc.m_Config->EnableRenal(eSwitch::On);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......@@ -189,7 +191,6 @@ void PulseEngineTest::RenalFeedbackTest(RenalFeedback feedback, const std::strin
pc.GetCompartments().CreateLiquidCompartment(pulse::ExtravascularCompartment::RightKidneyIntracellular);
pc.m_Config->EnableTissue(eSwitch::On);// This needs to be on for making the tissue to extravascular mapping
pc.GetCompartments().StateChange();
SEPatient* patient = (SEPatient*)&pc.GetPatient();
SEFluidCircuit& rCircuit = pc.GetCircuits().GetRenalCircuit();
SELiquidCompartmentGraph& rGraph = pc.GetCompartments().GetRenalGraph();
......@@ -489,8 +490,9 @@ void PulseEngineTest::RenalSystemTest(RenalSystems systemtest, const std::string
TimingProfile tmr;
tmr.Start("Test");
PulseController pc(sTestDirectory + "/RenalSystemTest.log");
pc.GetPatient().SerializeFromFile("./patients/StandardMale.json",JSON);
pc.SetupPatient();
SEPatient patient(pc.GetLogger());
patient.SerializeFromFile("./patients/StandardMale.json", JSON);
pc.SetupPatient(patient);
pc.m_Config->EnableRenal(eSwitch::On);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......@@ -504,7 +506,6 @@ void PulseEngineTest::RenalSystemTest(RenalSystems systemtest, const std::string
pc.GetCompartments().CreateLiquidCompartment(pulse::ExtravascularCompartment::RightKidneyIntracellular);
pc.m_Config->EnableTissue(eSwitch::On);// This needs to be on for making the tissue to extravascular mapping
pc.GetCompartments().StateChange();
SEPatient* patient = (SEPatient*)&pc.GetPatient();
SESubstance& potassium = pc.GetSubstances().GetPotassium();
// Renal needs these present for Gluconeogenesis
......
......@@ -45,8 +45,9 @@ void PulseEngineTest::RespiratoryCircuitAndTransportTest(RespiratoryConfiguratio
std::ofstream fAerosolGraph;
PulseController pc(sTestDirectory + "/RespiratoryCircuitAndTransportTest.log");
pc.GetPatient().SerializeFromFile("./patients/StandardMale.json",JSON);
pc.SetupPatient();
SEPatient patient(pc.GetLogger());
patient.SerializeFromFile("./patients/StandardMale.json", JSON);
pc.SetupPatient(patient);
pc.m_Config->EnableRenal(eSwitch::Off);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......@@ -206,8 +207,9 @@ void PulseEngineTest::RespiratoryDriverTest(const std::string& sTestDirectory)
TimingProfile tmr;
tmr.Start("Test");
PulseController pc(sTestDirectory + "/RespiratoryDriverTest.log");
pc.GetPatient().SerializeFromFile("./patients/StandardMale.json",JSON);
pc.SetupPatient();
SEPatient patient(pc.GetLogger());
patient.SerializeFromFile("./patients/StandardMale.json", JSON);
pc.SetupPatient(patient);
pc.m_Config->EnableRenal(eSwitch::Off);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......@@ -276,7 +278,7 @@ void PulseEngineTest::RespiratoryDriverTest(const std::string& sTestDirectory)
//Check to see if the circuit has stabilized
if (std::abs(TotalVolume_L - PreviousTotalVolume_L) < 1e-10)
{
if (!bRVReached && TotalVolume_L <= pc.GetPatient().GetResidualVolume(VolumeUnit::L))
if (!bRVReached && TotalVolume_L <= pc.GetCurrentPatient().GetResidualVolume(VolumeUnit::L))
{
bRVReached = true;
}
......@@ -316,7 +318,7 @@ void PulseEngineTest::RespiratoryDriverTest(const std::string& sTestDirectory)
bSettled = false;
//Check to see if we've gone all the way to the max volume
if (TotalVolume_L >= pc.GetPatient().GetTotalLungCapacity(VolumeUnit::L))
if (TotalVolume_L >= pc.GetCurrentPatient().GetTotalLungCapacity(VolumeUnit::L))
{
bIRVReached = true;
}
......
......@@ -45,8 +45,9 @@ void PulseEngineTest::SolverSpeedTest(const std::string& rptDirectory)
bool showAllOutput = true; //toggle this to show all Info outputs for all circuits, which will show first-pass solve times and fail rates
PulseController pc(tsSolverSpeed.GetLogger());
pc.GetPatient().SerializeFromFile("./patients/StandardMale.json",JSON);
pc.SetupPatient();
SEPatient patient(pc.GetLogger());
patient.SerializeFromFile("./patients/StandardMale.json", JSON);
pc.SetupPatient(patient);
pc.m_Config->EnableRenal(eSwitch::On);
pc.m_Config->EnableTissue(eSwitch::On);
pc.CreateCircuitsAndCompartments();
......
......@@ -37,8 +37,9 @@
void PulseEngineTest::InternalTemperatureVariableBMRCircuitTest(const std::string& sTestDirectory)
{
PulseController pc(sTestDirectory + "/InternalTemperatureVariableBMRCircuitTest.log");
pc.GetPatient().SerializeFromFile("./patients/StandardMale.json",JSON);
pc.SetupPatient();
SEPatient patient(pc.GetLogger());
patient.SerializeFromFile("./patients/StandardMale.json", JSON);
pc.SetupPatient(patient);
pc.m_Config->EnableRenal(eSwitch::Off);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......@@ -111,8 +112,9 @@ void PulseEngineTest::InternalTemperatureVariableBMRCircuitTest(const std::strin
void PulseEngineTest::InternalTemperatureVariableSkinCircuitTest(const std::string& sTestDirectory)
{
PulseController pc(sTestDirectory + "/InternalTemperatureVariableSkinCircuitTest.log");
pc.GetPatient().SerializeFromFile("./patients/StandardMale.json",JSON);
pc.SetupPatient();
SEPatient patient(pc.GetLogger());
patient.SerializeFromFile("./patients/StandardMale.json", JSON);
pc.SetupPatient(patient);
pc.m_Config->EnableRenal(eSwitch::Off);
pc.m_Config->EnableTissue(eSwitch::Off);
pc.CreateCircuitsAndCompartments();
......@@ -208,8 +210,9 @@ void PulseEngineTest::InternalTemperatureVariableSkinCircuitTest(const std::stri
void PulseEngineTest::InternalTemperatureVariableCoreCircuitTest(const std::string& sTestDirectory)
{
PulseController pc(sTestDirectory + "/InternalTemperatureVariableCoreCircuitTest.log");
pc.GetPatient().SerializeFromFile("./patients/StandardMale.json",JSON);
pc.SetupPatient();
SEPatient patient(pc.GetLogger());
patient.SerializeFromFile("./patients/StandardMale.json", JSON);