Commit 83f48363 authored by Aaron Bray's avatar Aaron Bray
Browse files

Serialization additions for respiratory

Adding a SEPatient object for the initial patient (healthy stabilized values)
parent ffb796f6
......@@ -118,12 +118,6 @@ void SEEventManager::SetEvent(eEvent type, bool active, const SEScalarTime& time
case eEvent::MetabolicAlkalosis:
m_ss << " The patient is in a state of metabolic alkalosis";
break;
case eEvent::MildAcuteRespiratoryDistress:
m_ss << " The patient has Mild Acute Respiratory Distress";
break;
case eEvent::ModerateAcuteRespiratoryDistress:
m_ss << " The patient has Moderate Acute Respiratory Distress";
break;
case eEvent::MyocardiumOxygenDeficit:
m_ss << " The patient's heart is not receiving enough oxygen";
break;
......@@ -136,9 +130,6 @@ void SEEventManager::SetEvent(eEvent type, bool active, const SEScalarTime& time
case eEvent::RenalHypoperfusion:
m_ss << " Patient has Renal Hypoperfusion";
break;
case eEvent::SevereAcuteRespiratoryDistress:
m_ss << " The patient has Severe Acute Respiratory Distress";
break;
case eEvent::Tachycardia:
m_ss << " Patient has Tachycardia";
break;
......@@ -252,12 +243,6 @@ void SEEventManager::SetEvent(eEvent type, bool active, const SEScalarTime& time
case eEvent::MetabolicAlkalosis:
m_ss << " The patient is no longer in a state of metabolic alkalosis";
break;
case eEvent::MildAcuteRespiratoryDistress:
m_ss << " Patient no longer has a Mild Acute Respiratory Distress";
break;
case eEvent::ModerateAcuteRespiratoryDistress:
m_ss << " Patient no longer has a Moderate Acute Respiratory Distress";
break;
case eEvent::MyocardiumOxygenDeficit:
m_ss << " Patient no longer has a Myocardium Oxygen Deficit";
break;
......@@ -270,9 +255,6 @@ void SEEventManager::SetEvent(eEvent type, bool active, const SEScalarTime& time
case eEvent::RenalHypoperfusion:
m_ss << " Patient no longer has Renal Hypoperfusion";
break;
case eEvent::SevereAcuteRespiratoryDistress:
m_ss << " Patient no longer has a Severe Acute Respiratory Distress";
break;
case eEvent::Tachycardia:
m_ss << " Patient no longer has Tachycardia";
break;
......
......@@ -34,20 +34,17 @@ enum class eEvent
MaximumPulmonaryVentilationRate = 25,
MetabolicAcidosis = 26,
MetabolicAlkalosis = 27,
MildAcuteRespiratoryDistress = 28,
ModerateAcuteRespiratoryDistress = 29,
MyocardiumOxygenDeficit = 30,
Natriuresis = 31,
NutritionDepleted = 32,
RenalHypoperfusion = 33,
RespiratoryAcidosis = 34,
RespiratoryAlkalosis = 35,
StartOfCardiacCycle = 36,
StartOfExhale = 37,
StartOfInhale = 38,
SevereAcuteRespiratoryDistress = 39,
Tachycardia = 40,
Tachypnea = 41,
MyocardiumOxygenDeficit = 28,
Natriuresis = 29,
NutritionDepleted = 30,
RenalHypoperfusion = 31,
RespiratoryAcidosis = 32,
RespiratoryAlkalosis = 33,
StartOfCardiacCycle = 34,
StartOfExhale = 35,
StartOfInhale = 36,
Tachycardia = 37,
Tachypnea = 38,
// Equipment
AnesthesiaMachineOxygenBottleOneExhausted = 1000,
......
......@@ -834,6 +834,8 @@ void PBPhysiology::Serialize(const cdm::RespiratorySystemData& src, SERespirator
PBProperty::Load(src.endtidaloxygenpressure(), dst.GetEndTidalOxygenPressure());
if (src.has_expiratoryflow())
PBProperty::Load(src.expiratoryflow(), dst.GetExpiratoryFlow());
if (src.has_expiratorypulmonaryresistance())
PBProperty::Load(src.expiratorypulmonaryresistance(), dst.GetExpiratoryPulmonaryResistance());
if (src.has_imposedpowerofbreathing())
PBProperty::Load(src.imposedpowerofbreathing(), dst.GetImposedPowerOfBreathing());
if (src.has_imposedworkofbreathing())
......@@ -842,8 +844,12 @@ void PBPhysiology::Serialize(const cdm::RespiratorySystemData& src, SERespirator
PBProperty::Load(src.inspiratoryexpiratoryratio(), dst.GetInspiratoryExpiratoryRatio());
if (src.has_inspiratoryflow())
PBProperty::Load(src.inspiratoryflow(), dst.GetInspiratoryFlow());
if (src.has_inspiratorypulmonaryresistance())
PBProperty::Load(src.inspiratorypulmonaryresistance(), dst.GetInspiratoryPulmonaryResistance());
if (src.has_intrapleuralpressure())
PBProperty::Load(src.intrapleuralpressure(), dst.GetIntrapleuralPressure());
if (src.has_intrapulmonarypressure())
PBProperty::Load(src.intrapulmonarypressure(), dst.GetIntrapulmonaryPressure());
if (src.has_lungcompliance())
PBProperty::Load(src.lungcompliance(), dst.GetLungCompliance());
if (src.has_maximalinspiratorypressure())
......@@ -862,8 +868,6 @@ void PBPhysiology::Serialize(const cdm::RespiratorySystemData& src, SERespirator
PBProperty::Load(src.pulmonarycompliance(), dst.GetPulmonaryCompliance());
if (src.has_pulmonaryelastance())
PBProperty::Load(src.pulmonaryelastance(), dst.GetPulmonaryElastance());
if (src.has_pulmonaryresistance())
PBProperty::Load(src.pulmonaryresistance(), dst.GetPulmonaryResistance());
if (src.has_resistiveexpiratoryworkofbreathing())
PBProperty::Load(src.resistiveexpiratoryworkofbreathing(), dst.GetResistiveExpiratoryWorkOfBreathing());
if (src.has_resistiveinspiratoryworkofbreathing())
......@@ -896,6 +900,8 @@ void PBPhysiology::Serialize(const cdm::RespiratorySystemData& src, SERespirator
PBProperty::Load(src.transalveolarpressure(), dst.GetTransalveolarPressure());
if (src.has_transchestwallpressure())
PBProperty::Load(src.transchestwallpressure(), dst.GetTransChestWallPressure());
if (src.has_transmusclepressure())
PBProperty::Load(src.transmusclepressure(), dst.GetTransMusclePressure());
if (src.has_totalpulmonaryventilation())
PBProperty::Load(src.totalpulmonaryventilation(), dst.GetTotalPulmonaryVentilation());
if (src.has_transpulmonarypressure())
......@@ -936,6 +942,8 @@ void PBPhysiology::Serialize(const SERespiratorySystem& src, cdm::RespiratorySys
dst.set_allocated_endtidaloxygenpressure(PBProperty::Unload(*src.m_EndTidalOxygenPressure));
if (src.HasExpiratoryFlow())
dst.set_allocated_expiratoryflow(PBProperty::Unload(*src.m_ExpiratoryFlow));
if (src.HasExpiratoryPulmonaryResistance())
dst.set_allocated_expiratorypulmonaryresistance(PBProperty::Unload(*src.m_ExpiratoryPulmonaryResistance));
if (src.HasImposedPowerOfBreathing())
dst.set_allocated_imposedpowerofbreathing(PBProperty::Unload(*src.m_ImposedPowerOfBreathing));
if (src.HasImposedWorkOfBreathing())
......@@ -944,8 +952,12 @@ void PBPhysiology::Serialize(const SERespiratorySystem& src, cdm::RespiratorySys
dst.set_allocated_inspiratoryexpiratoryratio(PBProperty::Unload(*src.m_InspiratoryExpiratoryRatio));
if (src.HasInspiratoryFlow())
dst.set_allocated_inspiratoryflow(PBProperty::Unload(*src.m_InspiratoryFlow));
if (src.HasInspiratoryPulmonaryResistance())
dst.set_allocated_inspiratorypulmonaryresistance(PBProperty::Unload(*src.m_InspiratoryPulmonaryResistance));
if (src.HasIntrapleuralPressure())
dst.set_allocated_intrapleuralpressure(PBProperty::Unload(*src.m_IntrapleuralPressure));
if (src.HasIntrapulmonaryPressure())
dst.set_allocated_intrapulmonarypressure(PBProperty::Unload(*src.m_IntrapulmonaryPressure));
if (src.HasLungCompliance())
dst.set_allocated_lungcompliance(PBProperty::Unload(*src.m_LungCompliance));
if (src.HasMaximalInspiratoryPressure())
......@@ -964,8 +976,6 @@ void PBPhysiology::Serialize(const SERespiratorySystem& src, cdm::RespiratorySys
dst.set_allocated_pulmonarycompliance(PBProperty::Unload(*src.m_PulmonaryCompliance));
if (src.HasPulmonaryElastance())
dst.set_allocated_pulmonaryelastance(PBProperty::Unload(*src.m_PulmonaryElastance));
if (src.HasPulmonaryResistance())
dst.set_allocated_pulmonaryresistance(PBProperty::Unload(*src.m_PulmonaryResistance));
if (src.HasResistiveExpiratoryWorkOfBreathing())
dst.set_allocated_resistiveexpiratoryworkofbreathing(PBProperty::Unload(*src.m_ResistiveExpiratoryWorkOfBreathing));
if (src.HasResistiveInspiratoryWorkOfBreathing())
......@@ -998,6 +1008,8 @@ void PBPhysiology::Serialize(const SERespiratorySystem& src, cdm::RespiratorySys
dst.set_allocated_transalveolarpressure(PBProperty::Unload(*src.m_TransalveolarPressure));
if (src.HasTransChestWallPressure())
dst.set_allocated_transchestwallpressure(PBProperty::Unload(*src.m_TransChestWallPressure));
if (src.HasTransMusclePressure())
dst.set_allocated_transmusclepressure(PBProperty::Unload(*src.m_TransMusclePressure));
if (src.HasTranspulmonaryPressure())
dst.set_allocated_transpulmonarypressure(PBProperty::Unload(*src.m_TranspulmonaryPressure));
if (src.HasTransrespiratoryPressure())
......
......@@ -29,10 +29,12 @@ SERespiratorySystem::SERespiratorySystem(Logger* logger) : SESystem(logger)
m_EndTidalOxygenFraction = nullptr;
m_EndTidalOxygenPressure = nullptr;
m_ExpiratoryFlow = nullptr;
m_ExpiratoryPulmonaryResistance = nullptr;
m_ImposedPowerOfBreathing = nullptr;
m_ImposedWorkOfBreathing = nullptr;
m_InspiratoryExpiratoryRatio = nullptr;
m_InspiratoryFlow = nullptr;
m_InspiratoryPulmonaryResistance = nullptr;
m_IntrapleuralPressure = nullptr;
m_LungCompliance = nullptr;
m_MaximalInspiratoryPressure = nullptr;
......@@ -43,7 +45,6 @@ SERespiratorySystem::SERespiratorySystem(Logger* logger) : SESystem(logger)
m_PositiveEndExpiratoryPressure = nullptr;
m_PulmonaryCompliance = nullptr;
m_PulmonaryElastance = nullptr;
m_PulmonaryResistance = nullptr;
m_ResistiveExpiratoryWorkOfBreathing = nullptr;
m_ResistiveInspiratoryWorkOfBreathing = nullptr;
m_RespirationRate = nullptr;
......@@ -85,10 +86,12 @@ void SERespiratorySystem::Clear()
SAFE_DELETE(m_EndTidalOxygenFraction);
SAFE_DELETE(m_EndTidalOxygenPressure);
SAFE_DELETE(m_ExpiratoryFlow);
SAFE_DELETE(m_ExpiratoryPulmonaryResistance);
SAFE_DELETE(m_ImposedPowerOfBreathing);
SAFE_DELETE(m_ImposedWorkOfBreathing);
SAFE_DELETE(m_InspiratoryExpiratoryRatio);
SAFE_DELETE(m_InspiratoryFlow);
SAFE_DELETE(m_InspiratoryPulmonaryResistance);
SAFE_DELETE(m_IntrapleuralPressure);
SAFE_DELETE(m_LungCompliance);
SAFE_DELETE(m_MaximalInspiratoryPressure);
......@@ -99,7 +102,6 @@ void SERespiratorySystem::Clear()
SAFE_DELETE(m_PositiveEndExpiratoryPressure);
SAFE_DELETE(m_PulmonaryCompliance);
SAFE_DELETE(m_PulmonaryElastance);
SAFE_DELETE(m_PulmonaryResistance);
SAFE_DELETE(m_ResistiveExpiratoryWorkOfBreathing);
SAFE_DELETE(m_ResistiveInspiratoryWorkOfBreathing);
SAFE_DELETE(m_RespirationRate);
......@@ -146,6 +148,8 @@ const SEScalar* SERespiratorySystem::GetScalar(const std::string& name)
return &GetEndTidalOxygenPressure();
if (name.compare("ExpiratoryFlow") == 0)
return &GetExpiratoryFlow();
if (name.compare("ExpiratoryPulmonaryResistance") == 0)
return &GetExpiratoryPulmonaryResistance();
if (name.compare("ImposedPowerOfBreathing") == 0)
return &GetImposedPowerOfBreathing();
if (name.compare("ImposedWorkOfBreathing") == 0)
......@@ -154,6 +158,8 @@ const SEScalar* SERespiratorySystem::GetScalar(const std::string& name)
return &GetInspiratoryExpiratoryRatio();
if (name.compare("InspiratoryFlow") == 0)
return &GetInspiratoryFlow();
if (name.compare("InspiratoryPulmonaryResistance") == 0)
return &GetInspiratoryPulmonaryResistance();
if (name.compare("IntrapleuralPressure") == 0)
return &GetIntrapleuralPressure();
if (name.compare("LungCompliance") == 0)
......@@ -174,8 +180,6 @@ const SEScalar* SERespiratorySystem::GetScalar(const std::string& name)
return &GetPulmonaryCompliance();
if (name.compare("PulmonaryElastance") == 0)
return &GetPulmonaryElastance();
if (name.compare("PulmonaryResistance") == 0)
return &GetPulmonaryResistance();
if (name.compare("ResistiveExpiratoryWorkOfBreathing") == 0)
return &GetResistiveExpiratoryWorkOfBreathing();
if (name.compare("ResistiveInspiratoryWorkOfBreathing") == 0)
......@@ -404,6 +408,23 @@ double SERespiratorySystem::GetExpiratoryFlow(const VolumePerTimeUnit& unit) con
return m_ExpiratoryFlow->GetValue(unit);
}
bool SERespiratorySystem::HasExpiratoryPulmonaryResistance() const
{
return m_ExpiratoryPulmonaryResistance == nullptr ? false : m_ExpiratoryPulmonaryResistance->IsValid();
}
SEScalarPressureTimePerVolume& SERespiratorySystem::GetExpiratoryPulmonaryResistance()
{
if (m_ExpiratoryPulmonaryResistance == nullptr)
m_ExpiratoryPulmonaryResistance = new SEScalarPressureTimePerVolume();
return *m_ExpiratoryPulmonaryResistance;
}
double SERespiratorySystem::GetExpiratoryPulmonaryResistance(const PressureTimePerVolumeUnit& unit) const
{
if (m_ExpiratoryPulmonaryResistance == nullptr)
return SEScalar::dNaN();
return m_ExpiratoryPulmonaryResistance->GetValue(unit);
}
bool SERespiratorySystem::HasImposedPowerOfBreathing() const
{
return m_ImposedPowerOfBreathing == nullptr ? false : m_ImposedPowerOfBreathing->IsValid();
......@@ -472,6 +493,23 @@ double SERespiratorySystem::GetInspiratoryFlow(const VolumePerTimeUnit& unit) co
return m_InspiratoryFlow->GetValue(unit);
}
bool SERespiratorySystem::HasInspiratoryPulmonaryResistance() const
{
return m_InspiratoryPulmonaryResistance == nullptr ? false : m_InspiratoryPulmonaryResistance->IsValid();
}
SEScalarPressureTimePerVolume& SERespiratorySystem::GetInspiratoryPulmonaryResistance()
{
if (m_InspiratoryPulmonaryResistance == nullptr)
m_InspiratoryPulmonaryResistance = new SEScalarPressureTimePerVolume();
return *m_InspiratoryPulmonaryResistance;
}
double SERespiratorySystem::GetInspiratoryPulmonaryResistance(const PressureTimePerVolumeUnit& unit) const
{
if (m_InspiratoryPulmonaryResistance == nullptr)
return SEScalar::dNaN();
return m_InspiratoryPulmonaryResistance->GetValue(unit);
}
bool SERespiratorySystem::HasIntrapleuralPressure() const
{
return m_IntrapleuralPressure == nullptr ? false : m_IntrapleuralPressure->IsValid();
......@@ -489,6 +527,23 @@ double SERespiratorySystem::GetIntrapleuralPressure(const PressureUnit& unit) co
return m_IntrapleuralPressure->GetValue(unit);
}
bool SERespiratorySystem::HasIntrapulmonaryPressure() const
{
return m_IntrapulmonaryPressure == nullptr ? false : m_IntrapulmonaryPressure->IsValid();
}
SEScalarPressure& SERespiratorySystem::GetIntrapulmonaryPressure()
{
if (m_IntrapulmonaryPressure == nullptr)
m_IntrapulmonaryPressure = new SEScalarPressure();
return *m_IntrapulmonaryPressure;
}
double SERespiratorySystem::GetIntrapulmonaryPressure(const PressureUnit& unit) const
{
if (m_IntrapulmonaryPressure == nullptr)
return SEScalar::dNaN();
return m_IntrapulmonaryPressure->GetValue(unit);
}
bool SERespiratorySystem::HasLungCompliance() const
{
return m_LungCompliance == nullptr ? false : m_LungCompliance->IsValid();
......@@ -642,23 +697,6 @@ double SERespiratorySystem::GetPulmonaryElastance(const PressurePerVolumeUnit& u
return m_PulmonaryElastance->GetValue(unit);
}
bool SERespiratorySystem::HasPulmonaryResistance() const
{
return m_PulmonaryResistance == nullptr ? false : m_PulmonaryResistance->IsValid();
}
SEScalarPressureTimePerVolume& SERespiratorySystem::GetPulmonaryResistance()
{
if (m_PulmonaryResistance== nullptr)
m_PulmonaryResistance = new SEScalarPressureTimePerVolume();
return *m_PulmonaryResistance;
}
double SERespiratorySystem::GetPulmonaryResistance(const PressureTimePerVolumeUnit& unit) const
{
if (m_PulmonaryResistance == nullptr)
return SEScalar::dNaN();
return m_PulmonaryResistance->GetValue(unit);
}
bool SERespiratorySystem::HasResistiveExpiratoryWorkOfBreathing() const
{
return m_ResistiveExpiratoryWorkOfBreathing == nullptr ? false : m_ResistiveExpiratoryWorkOfBreathing->IsValid();
......@@ -932,6 +970,23 @@ double SERespiratorySystem::GetTransChestWallPressure(const PressureUnit& unit)
return m_TransChestWallPressure->GetValue(unit);
}
bool SERespiratorySystem::HasTransMusclePressure() const
{
return m_TransMusclePressure == nullptr ? false : m_TransMusclePressure->IsValid();
}
SEScalarPressure& SERespiratorySystem::GetTransMusclePressure()
{
if (m_TransMusclePressure == nullptr)
m_TransMusclePressure = new SEScalarPressure();
return *m_TransMusclePressure;
}
double SERespiratorySystem::GetTransMusclePressure(const PressureUnit& unit) const
{
if (m_TransMusclePressure == nullptr)
return SEScalar::dNaN();
return m_TransMusclePressure->GetValue(unit);
}
bool SERespiratorySystem::HasTranspulmonaryPressure() const
{
return m_TranspulmonaryPressure == nullptr ? false : m_TranspulmonaryPressure->IsValid();
......
......@@ -61,6 +61,10 @@ public:
virtual SEScalarVolumePerTime& GetExpiratoryFlow();
virtual double GetExpiratoryFlow(const VolumePerTimeUnit& unit) const;
virtual bool HasExpiratoryPulmonaryResistance() const;
virtual SEScalarPressureTimePerVolume& GetExpiratoryPulmonaryResistance();
virtual double GetExpiratoryPulmonaryResistance(const PressureTimePerVolumeUnit& unit) const;
virtual bool HasImposedPowerOfBreathing() const;
virtual SEScalarPower& GetImposedPowerOfBreathing();
virtual double GetImposedPowerOfBreathing(const PowerUnit& unit) const;
......@@ -77,10 +81,18 @@ public:
virtual SEScalarVolumePerTime& GetInspiratoryFlow();
virtual double GetInspiratoryFlow(const VolumePerTimeUnit& unit) const;
virtual bool HasInspiratoryPulmonaryResistance() const;
virtual SEScalarPressureTimePerVolume& GetInspiratoryPulmonaryResistance();
virtual double GetInspiratoryPulmonaryResistance(const PressureTimePerVolumeUnit& unit) const;
virtual bool HasIntrapleuralPressure() const;
virtual SEScalarPressure& GetIntrapleuralPressure();
virtual double GetIntrapleuralPressure(const PressureUnit& unit) const;
virtual bool HasIntrapulmonaryPressure() const;
virtual SEScalarPressure& GetIntrapulmonaryPressure();
virtual double GetIntrapulmonaryPressure(const PressureUnit& unit) const;
virtual bool HasLungCompliance() const;
virtual SEScalarVolumePerPressure& GetLungCompliance();
virtual double GetLungCompliance(const VolumePerPressureUnit& unit) const;
......@@ -117,10 +129,6 @@ public:
virtual SEScalarPressurePerVolume& GetPulmonaryElastance();
virtual double GetPulmonaryElastance(const PressurePerVolumeUnit& unit) const;
virtual bool HasPulmonaryResistance() const;
virtual SEScalarPressureTimePerVolume& GetPulmonaryResistance();
virtual double GetPulmonaryResistance(const PressureTimePerVolumeUnit& unit) const;
virtual bool HasResistiveExpiratoryWorkOfBreathing() const;
virtual SEScalarEnergy& GetResistiveExpiratoryWorkOfBreathing();
virtual double GetResistiveExpiratoryWorkOfBreathing(const EnergyUnit& unit) const;
......@@ -185,6 +193,10 @@ public:
virtual SEScalarPressure& GetTransChestWallPressure();
virtual double GetTransChestWallPressure(const PressureUnit& unit) const;
virtual bool HasTransMusclePressure() const;
virtual SEScalarPressure& GetTransMusclePressure();
virtual double GetTransMusclePressure(const PressureUnit& unit) const;
virtual bool HasTranspulmonaryPressure() const;
virtual SEScalarPressure& GetTranspulmonaryPressure();
virtual double GetTranspulmonaryPressure(const PressureUnit& unit) const;
......@@ -200,49 +212,52 @@ public:
protected:
SEScalarPressure* m_AlveolarArterialGradient;
SEScalarVolume* m_AlveolarDeadSpace;
SEScalarVolume* m_AnatomicDeadSpace;
SEScalarPressure* m_CarricoIndex;
SEScalarVolumePerPressure* m_ChestWallCompliance;
SEScalarEnergy* m_ElasticWorkOfBreathing;
SEScalar0To1* m_EndTidalCarbonDioxideFraction;
SEScalarPressure* m_EndTidalCarbonDioxidePressure;
SEScalar0To1* m_EndTidalOxygenFraction;
SEScalarPressure* m_EndTidalOxygenPressure;
SEScalarVolumePerTime* m_ExpiratoryFlow;
SEScalarPower* m_ImposedPowerOfBreathing;
SEScalarEnergy* m_ImposedWorkOfBreathing;
SEScalar* m_InspiratoryExpiratoryRatio;
SEScalarVolumePerTime* m_InspiratoryFlow;
SEScalarPressure* m_IntrapleuralPressure;
SEScalarVolumePerPressure* m_LungCompliance;
SEScalarPressure* m_MaximalInspiratoryPressure;
SEScalarPower* m_PatientPowerOfBreathing;
SEScalarEnergy* m_PatientWorkOfBreathing;
SEScalarPressure* m_PeakInspiratoryPressure;
SEScalarVolume* m_PhysiologicDeadSpace;
SEScalarPressure* m_PositiveEndExpiratoryPressure;
SEScalarVolumePerPressure* m_PulmonaryCompliance;
SEScalarPressurePerVolume* m_PulmonaryElastance;
SEScalarPressureTimePerVolume* m_PulmonaryResistance;
SEScalarEnergy* m_ResistiveExpiratoryWorkOfBreathing;
SEScalarEnergy* m_ResistiveInspiratoryWorkOfBreathing;
SEScalarFrequency* m_RespirationRate;
SEScalar0To1* m_RespiratoryMuscleFatigue;
SEScalarPressure* m_RespiratoryMusclePressure;
SEScalar* m_SpecificVentilation;
SEScalarVolume* m_TidalVolume;
SEScalarVolumePerTime* m_TotalAlveolarVentilation;
SEScalarVolumePerTime* m_TotalDeadSpaceVentilation;
SEScalarVolume* m_TotalLungVolume;
SEScalarPower* m_TotalPowerOfBreathing;
SEScalarVolumePerTime* m_TotalPulmonaryVentilation;
SEScalarEnergy* m_TotalWorkOfBreathing;
SEScalarPressure* m_TransairwayPressure;
SEScalarPressure* m_TransalveolarPressure;
SEScalarPressure* m_TransChestWallPressure;
SEScalarPressure* m_TranspulmonaryPressure;
SEScalarPressure* m_TransrespiratoryPressure;
SEScalarPressure* m_TransthoracicPressure;
SEScalarPressure* m_AlveolarArterialGradient;
SEScalarVolume* m_AlveolarDeadSpace;
SEScalarVolume* m_AnatomicDeadSpace;
SEScalarPressure* m_CarricoIndex;
SEScalarVolumePerPressure* m_ChestWallCompliance;
SEScalarEnergy* m_ElasticWorkOfBreathing;
SEScalar0To1* m_EndTidalCarbonDioxideFraction;
SEScalarPressure* m_EndTidalCarbonDioxidePressure;
SEScalar0To1* m_EndTidalOxygenFraction;
SEScalarPressure* m_EndTidalOxygenPressure;
SEScalarVolumePerTime* m_ExpiratoryFlow;
SEScalarPressureTimePerVolume* m_ExpiratoryPulmonaryResistance;
SEScalarPower* m_ImposedPowerOfBreathing;
SEScalarEnergy* m_ImposedWorkOfBreathing;
SEScalar* m_InspiratoryExpiratoryRatio;
SEScalarVolumePerTime* m_InspiratoryFlow;
SEScalarPressureTimePerVolume* m_InspiratoryPulmonaryResistance;
SEScalarPressure* m_IntrapleuralPressure;
SEScalarPressure* m_IntrapulmonaryPressure;
SEScalarVolumePerPressure* m_LungCompliance;
SEScalarPressure* m_MaximalInspiratoryPressure;
SEScalarPower* m_PatientPowerOfBreathing;
SEScalarEnergy* m_PatientWorkOfBreathing;
SEScalarPressure* m_PeakInspiratoryPressure;
SEScalarVolume* m_PhysiologicDeadSpace;
SEScalarPressure* m_PositiveEndExpiratoryPressure;
SEScalarVolumePerPressure* m_PulmonaryCompliance;
SEScalarPressurePerVolume* m_PulmonaryElastance;
SEScalarEnergy* m_ResistiveExpiratoryWorkOfBreathing;
SEScalarEnergy* m_ResistiveInspiratoryWorkOfBreathing;
SEScalarFrequency* m_RespirationRate;
SEScalar0To1* m_RespiratoryMuscleFatigue;
SEScalarPressure* m_RespiratoryMusclePressure;
SEScalar* m_SpecificVentilation;
SEScalarVolume* m_TidalVolume;
SEScalarVolumePerTime* m_TotalAlveolarVentilation;
SEScalarVolumePerTime* m_TotalDeadSpaceVentilation;
SEScalarVolume* m_TotalLungVolume;
SEScalarPower* m_TotalPowerOfBreathing;
SEScalarVolumePerTime* m_TotalPulmonaryVentilation;
SEScalarEnergy* m_TotalWorkOfBreathing;
SEScalarPressure* m_TransairwayPressure;
SEScalarPressure* m_TransalveolarPressure;
SEScalarPressure* m_TransChestWallPressure;
SEScalarPressure* m_TransMusclePressure;
SEScalarPressure* m_TranspulmonaryPressure;
SEScalarPressure* m_TransrespiratoryPressure;
SEScalarPressure* m_TransthoracicPressure;
};
\ No newline at end of file
This diff is collapsed.
......@@ -67,7 +67,8 @@ public:
PulseSubstances& GetSubstances();
SEPatient& GetPatient();
const SEPatient& GetInitialPatient();
SEPatient& GetCurrentPatient();
bool GetPatientAssessment(SEPatientAssessment& assessment) const;
SEBloodChemistrySystem& GetBloodChemistry();
......@@ -178,7 +179,8 @@ protected:
std::unique_ptr<Inhaler> m_Inhaler;
std::unique_ptr<SEPatient> m_Patient;
std::unique_ptr<SEPatient> m_InitialPatient;
std::unique_ptr<SEPatient> m_CurrentPatient;
std::unique_ptr<SEEventManager> m_EventManager;
......
......@@ -123,7 +123,7 @@ bool PulseEngine::InitializeEngine(const std::string& patient_configuration, Ser
bool PulseEngine::InitializeEngine(const SEPatientConfiguration& patient_configuration, const SEEngineConfiguration* config)
{
if (patient_configuration.HasPatient())
m_Patient->Copy(*patient_configuration.GetPatient());
m_InitialPatient->Copy(*patient_configuration.GetPatient());
else if (patient_configuration.HasPatientFile())
{
std::string pFile = patient_configuration.GetPatientFile();
......@@ -132,7 +132,7 @@ bool PulseEngine::InitializeEngine(const SEPatientConfiguration& patient_configu
pFile = "./patients/";
pFile += patient_configuration.GetPatientFile();
}
if (!m_Patient->SerializeFromFile(pFile, JSON))// TODO Support all serialization formats
if (!m_InitialPatient->SerializeFromFile(pFile, JSON))// TODO Support all serialization formats
return false;
}
else
......@@ -172,6 +172,8 @@ bool PulseEngine::InitializeEngine(const SEPatientConfiguration& patient_configu
if(patient_configuration.HasConditions())
m_Conditions->Copy(*patient_configuration.GetConditions());
AtSteadyState(EngineState::AtInitialStableState);// This will peek at conditions
// Copy any changes to the current patient to the initial patient
m_InitialPatient->Copy(*m_CurrentPatient);
m_State = EngineState::SecondaryStabilization;
// Apply conditions and anything else to the physiology
......@@ -283,7 +285,7 @@ bool PulseEngine::ProcessAction(const SEAction& action)
{
std::stringstream ss;
MakeDirectory("./states");
ss << "./states/" << m_Patient->GetName() << "@" << GetSimulationTime(TimeUnit::s) << "s.json";
ss << "./states/" << m_InitialPatient->GetName() << "@" << GetSimulationTime(TimeUnit::s) << "s.json";
Info("Saving " + ss.str());
SerializeToFile(ss.str(), JSON);
// Debug code to make sure things are consistent
......@@ -406,9 +408,9 @@ const SEEngineConfiguration* PulseEngine::GetConfiguration() const
return PulseController::m_Config.get();
}
const SEPatient& PulseEngine::GetPatient() const
const SEPatient& PulseEngine::GetPatient() const
{
return *PulseController::m_Patient.get();
return *PulseController::m_CurrentPatient.get();
}
bool PulseEngine::GetPatientAssessment(SEPatientAssessment& assessment) const
......
......@@ -222,13 +222,13 @@ void PulseSubstances::InitializeLiquidCompartmentGases()
PulseCompartments& cmpts = m_data.GetCompartments();
SEScalarMassPerVolume albuminConcentration;
SEScalar0To1 hematocrit;
SEScalar0To1 hematocrit;
SEScalarTemperature bodyTemp;
SEScalarAmountPerVolume strongIonDifference;
SEScalarAmountPerVolume phosphate;
albuminConcentration.SetValue(45.0, MassPerVolumeUnit::g_Per_L);
hematocrit.SetValue(m_data.GetPatient().GetSex() == ePatient_Sex::Male ? 0.45 : 0.40);
hematocrit.SetValue(m_data.GetCurrentPatient().GetSex() == ePatient_Sex::Male ? 0.45 : 0.40);
bodyTemp.SetValue(37.0, TemperatureUnit::C);
strongIonDifference.SetValue(40.5, AmountPerVolumeUnit::mmol_Per_L);
phosphate.SetValue(1.1, AmountPerVolumeUnit::mmol_Per_L);
......
......@@ -68,7 +68,6 @@ Environment::~Environment()
void Environment::Clear()
{
SEEnvironment::Clear();
m_Patient = nullptr;
m_AmbientGases = nullptr;
m_AmbientAerosols = nullptr;
m_EnvironmentCircuit = nullptr;
......@@ -107,17 +106,15 @@ void Environment::Initialize()
GetEvaporativeHeatTranferCoefficient().SetValue(0.0, HeatConductancePerAreaUnit::W_Per_m2_K);
GetRadiativeHeatTranferCoefficient().SetValue(0.0, HeatConductancePerAreaUnit::W_Per_m2_K);
double patientDensity_g_Per_mL = m_Patient->GetBodyDensity(MassPerVolumeUnit::g_Per_mL);
double patientMass_g = m_Patient->GetWeight(MassUnit::g);
double patientHeight_m = m_Patient->GetHeight(LengthUnit::m);
double patientDensity_g_Per_mL = m_data.GetCurrentPatient().GetBodyDensity(MassPerVolumeUnit::g_Per_mL);
double patientMass_g = m_data.GetCurrentPatient().GetWeight(MassUnit::g);
double patientHeight_m = m_data.GetCurrentPatient().GetHeight(LengthUnit::m);
double pi = 3.14159;
m_PatientEquivalentDiameter_m = pow(Convert(patientMass_g / patientDensity_g_Per_mL, VolumeUnit::mL, VolumeUnit::m3) / (pi*patientHeight_m), 0.5);
}