Commit 2792c903 authored by Aaron Bray's avatar Aaron Bray
Browse files

Serialization is working

At least I can load the StandardMale0s state, run for 2 mins, and I match BasicStandard
parent a3486c34
......@@ -272,10 +272,10 @@ void SEBloodChemistrySystem::Serialize(const SEBloodChemistrySystem& src, cdm::B
dst.set_allocated_pulmonaryarterialcarbondioxidepressure(SEScalarPressure::Unload(*src.m_PulmonaryArterialCarbonDioxidePressure));
if (src.HasPulmonaryArterialOxygenPressure())
dst.set_allocated_pulmonaryarterialoxygenpressure(SEScalarPressure::Unload(*src.m_PulmonaryArterialOxygenPressure));
if (src.HasPulmonaryVenousOxygenPressure())
dst.set_allocated_pulmonaryvenouscarbondioxidepressure(SEScalarPressure::Unload(*src.m_PulmonaryVenousOxygenPressure));
if (src.HasPulmonaryVenousCarbonDioxidePressure())
dst.set_allocated_pulmonaryvenousoxygenpressure(SEScalarPressure::Unload(*src.m_PulmonaryVenousCarbonDioxidePressure));
dst.set_allocated_pulmonaryvenouscarbondioxidepressure(SEScalarPressure::Unload(*src.m_PulmonaryVenousCarbonDioxidePressure));
if (src.HasPulmonaryVenousOxygenPressure())
dst.set_allocated_pulmonaryvenousoxygenpressure(SEScalarPressure::Unload(*src.m_PulmonaryVenousOxygenPressure));
if (src.HasVenousCarbonDioxidePressure())
dst.set_allocated_venouscarbondioxidepressure(SEScalarPressure::Unload(*src.m_VenousCarbonDioxidePressure));
if (src.HasVenousOxygenPressure())
......
......@@ -497,13 +497,18 @@ bool PulseEngine::ProcessAction(const SEAction& action)
if (serialize->GetType() == cdm::SerializeStateData_eSerializationType_Save)
{
if (serialize->HasFilename())
{
SaveState(serialize->GetFilename());
}
else
{
std::stringstream ss;
MKDIR("./states");
ss << "./states/" << m_Patient->GetName() << "@" << GetSimulationTime(TimeUnit::s) << "s.pba";
SaveState(ss.str());
// Debug code to make sure things are consistent
//LoadStateFile(ss.str());
//SaveState("./states/AfterSave.pba");
}
}
else
......
......@@ -1582,7 +1582,7 @@ void Cardiovascular::TuneCircuit()
m_circuitCalculator.Process(*m_CirculatoryCircuit, m_dT_s);
CalculateVitalSigns();
m_circuitCalculator.PostProcess(*m_CirculatoryCircuit);
return; //Skip stabelization for debugging
//return; //Skip stabelization for debugging
map_mmHg = GetMeanArterialPressure(PressureUnit::mmHg);
systolic_mmHg = GetSystolicArterialPressure(PressureUnit::mmHg);
......
......@@ -99,6 +99,9 @@ void Gastrointestinal::Initialize()
m_InitialSubstanceMasses_ug[m_SmallIntestineChymeCalcium] = m_SmallIntestineChymeCalcium->GetMass(MassUnit::ug);
m_InitialSubstanceMasses_ug[m_SmallIntestineChymeSodium] = m_SmallIntestineChymeSodium->GetMass(MassUnit::ug);
m_InitialSubstanceMasses_ug[m_SmallIntestineChymeUrea] = m_SmallIntestineChymeUrea->GetMass(MassUnit::ug);
m_ConsumeRate = false;
m_DecrementNutrients = false;
}
void Gastrointestinal::Load(const pulse::GastrointestinalSystemData& src, Gastrointestinal& dst)
......@@ -126,16 +129,13 @@ void Gastrointestinal::Serialize(const Gastrointestinal& src, pulse::Gastrointes
void Gastrointestinal::SetUp()
{
m_ConsumeRate = false;
m_DecrementNutrients = false;
m_WaterDigestionRate.SetValue(m_data.GetConfiguration().GetWaterDigestionRate(VolumePerTimeUnit::mL_Per_s), VolumePerTimeUnit::mL_Per_s);
m_CalciumDigestionRate.SetValue(m_data.GetConfiguration().GetCalciumDigestionRate(MassPerTimeUnit::g_Per_s), MassPerTimeUnit::g_Per_s);
m_GItoCVPath = m_data.GetCircuits().GetActiveCardiovascularCircuit().GetPath(pulse::ChymePath::SmallIntestineC1ToSmallIntestine1);
m_GutT1ToGroundPath = m_data.GetCircuits().GetActiveCardiovascularCircuit().GetPath(pulse::ChymePath::GutT1ToGround);
m_GItoCVPath = m_data.GetCircuits().GetActiveCardiovascularCircuit().GetPath(pulse::ChymePath::SmallIntestineC1ToSmallIntestine1);
m_GutT1ToGroundPath = m_data.GetCircuits().GetActiveCardiovascularCircuit().GetPath(pulse::ChymePath::GutT1ToGround);
m_SmallIntestineChyme = m_data.GetCompartments().GetLiquidCompartment(pulse::ChymeCompartment::SmallIntestine);
m_SmallIntestineChyme = m_data.GetCompartments().GetLiquidCompartment(pulse::ChymeCompartment::SmallIntestine);
m_SmallIntestineChymeGlucose = m_SmallIntestineChyme->GetSubstanceQuantity(m_data.GetSubstances().GetGlucose());
m_SmallIntestineChymeTristearin = m_SmallIntestineChyme->GetSubstanceQuantity(m_data.GetSubstances().GetTristearin());
m_SmallIntestineChymeCalcium = m_SmallIntestineChyme->GetSubstanceQuantity(m_data.GetSubstances().GetCalcium());
......
......@@ -64,6 +64,10 @@ void Nervous::Initialize()
GetLeftEyePupillaryResponse().GetReactivityModifier().SetValue(0);
GetRightEyePupillaryResponse().GetSizeModifier().SetValue(0);
GetRightEyePupillaryResponse().GetReactivityModifier().SetValue(0);
// Set when feedback is turned on
m_ArterialOxygenSetPoint_mmHg = 0;
m_ArterialCarbonDioxideSetPoint_mmHg = 0;
}
void Nervous::Load(const pulse::NervousSystemData& src, Nervous& dst)
......@@ -112,10 +116,6 @@ void Nervous::SetUp()
m_normalizedAlphaCompliance = m_data.GetConfiguration().GetNormalizedComplianceParasympatheticSlope();
m_normalizedAlphaResistance = m_data.GetConfiguration().GetNormalizedResistanceSympatheticSlope();
m_normalizedBetaHeartRate = m_data.GetConfiguration().GetNormalizedHeartRateParasympatheticSlope();
// Set when feedback is turned on
m_ArterialOxygenSetPoint_mmHg = 0;
m_ArterialCarbonDioxideSetPoint_mmHg = 0;
}
void Nervous::AtSteadyState()
......
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