Commit 7b6aa533 authored by Jeff Webb's avatar Jeff Webb
Browse files

Merge branch 'feature/respiratory_disease' of...

Merge branch 'feature/respiratory_disease' of https://gitlab.kitware.com/physiology/engine into feature/respiratory_disease
parents 65f1790a 96be43ff
......@@ -46,13 +46,20 @@ if(NOT WIN32)
string(REPLACE ";" ":" JAVA_CLASSPATH "${JAVA_CLASSPATH}")
endif()
if(TYPE STREQUAL "SystemValidation")
execute_process(COMMAND "${Java_JAVA_EXECUTABLE}" -Xmx900m -classpath "${JAVA_CLASSPATH}" com.kitware.physiology.testing.SETestDriver SystemVerification.config)
execute_process(COMMAND "${Java_JAVA_EXECUTABLE}" -Xmx900m -classpath "${JAVA_CLASSPATH}" com.kitware.physiology.testing.validation.SystemValidation )
elseif(TYPE STREQUAL "PatientValidation")
execute_process(COMMAND "${Java_JAVA_EXECUTABLE}" -Xmx900m -classpath "${JAVA_CLASSPATH}" com.kitware.physiology.testing.SETestDriver PatientVerification.config)
execute_process(COMMAND "${Java_JAVA_EXECUTABLE}" -Xmx900m -classpath "${JAVA_CLASSPATH}" com.kitware.physiology.testing.validation.PatientValidation)
if(TYPE STREQUAL "tests" OR TYPE STREQUAL "SystemValidation" OR TYPE STREQUAL "PatientValidation")
if(TYPE STREQUAL "tests")
execute_process(COMMAND "${Java_JAVA_EXECUTABLE}" -Xmx900m -classpath "${JAVA_CLASSPATH}" com.kitware.physiology.testing.SETestDriver CDMUnitTests.config)
execute_process(COMMAND "${Java_JAVA_EXECUTABLE}" -Xmx900m -classpath "${JAVA_CLASSPATH}" com.kitware.physiology.testing.SETestDriver EngineUnitTests.config)
execute_process(COMMAND "${Java_JAVA_EXECUTABLE}" -Xmx900m -classpath "${JAVA_CLASSPATH}" com.kitware.physiology.testing.SETestDriver ScenarioVerification.config)
endif()
if(TYPE STREQUAL "SystemValidation" OR TYPE STREQUAL "tests")
execute_process(COMMAND "${Java_JAVA_EXECUTABLE}" -Xmx900m -classpath "${JAVA_CLASSPATH}" com.kitware.physiology.testing.SETestDriver SystemVerification.config)
execute_process(COMMAND "${Java_JAVA_EXECUTABLE}" -Xmx900m -classpath "${JAVA_CLASSPATH}" com.kitware.physiology.testing.validation.SystemValidation )
endif()
if(TYPE STREQUAL "PatientValidation" OR TYPE STREQUAL "tests")
execute_process(COMMAND "${Java_JAVA_EXECUTABLE}" -Xmx900m -classpath "${JAVA_CLASSPATH}" com.kitware.physiology.testing.SETestDriver PatientVerification.config)
execute_process(COMMAND "${Java_JAVA_EXECUTABLE}" -Xmx900m -classpath "${JAVA_CLASSPATH}" com.kitware.physiology.testing.validation.PatientValidation)
endif()
elseif(TYPE STREQUAL "genData")
execute_process(COMMAND "${Java_JAVA_EXECUTABLE}" -Xmx900m -classpath "${JAVA_CLASSPATH}" com.kitware.physiology.pulse.dataset.DataSetReader)
elseif(TYPE STREQUAL "genStates")
......
......@@ -49,7 +49,7 @@ void SEGasCompartment::Balance(BalanceGasBy by)
else
{
subQ->GetVolumeFraction().SetValue(subQ->GetVolume(VolumeUnit::mL) / totalVolume_mL);
subQ->GetVolume().SetValue(subQ->GetVolumeFraction().GetValue() * GetVolume(VolumeUnit::mL), VolumeUnit::mL);
subQ->GetVolume().SetValue(subQ->GetVolumeFraction().GetValue() * GetVolume(VolumeUnit::mL), VolumeUnit::mL);
if(HasPressure())
GeneralMath::CalculatePartialPressureInGas(subQ->GetVolumeFraction(), GetPressure(), subQ->GetPartialPressure(), m_Logger);
}
......
......@@ -48,8 +48,18 @@ void SEGasSubstanceQuantity::Clear()
void SEGasSubstanceQuantity::SetToZero()
{
GetPartialPressure().SetValue(0, PressureUnit::mmHg);
GetVolume().SetValue(0, VolumeUnit::mL);
auto& pp = GetPartialPressure();
if (pp.HasUnit())
pp.SetValue(0, *pp.GetUnit());
else
pp.SetValue(0, PressureUnit::mmHg);
auto& vol = GetVolume();
if (vol.HasUnit())
vol.SetValue(0, *vol.GetUnit());
else
vol.SetValue(0, VolumeUnit::mL);
GetVolumeFraction().SetValue(0);
}
......
......@@ -85,16 +85,53 @@ void SELiquidSubstanceQuantity::Clear()
void SELiquidSubstanceQuantity::SetToZero()
{
GetConcentration().SetValue(0, MassPerVolumeUnit::mg_Per_mL);
GetMass().SetValue(0, MassUnit::mg);
GetMolarity().SetValue(0, AmountPerVolumeUnit::mmol_Per_mL);
auto& c = GetConcentration();
if (c.HasUnit())
c.SetValue(0, *c.GetUnit());
else
c.SetValue(0, MassPerVolumeUnit::mg_Per_mL);
auto& m = GetMass();
if (m.HasUnit())
m.SetValue(0, *m.GetUnit());
else
m.SetValue(0, MassUnit::mg);
auto& mol = GetMolarity();
if (mol.HasUnit())
mol.SetValue(0, *mol.GetUnit());
else
mol.SetValue(0, AmountPerVolumeUnit::mmol_Per_mL);
if (m_Substance.GetState() == eSubstance_State::Gas)
GetPartialPressure().SetValue(0, PressureUnit::mmHg);
{
auto& pp = GetPartialPressure();
if (pp.HasUnit())
pp.SetValue(0, *pp.GetUnit());
else
pp.SetValue(0, PressureUnit::mmHg);
}
if (m_isO2 || m_isCO || m_isCO2)
GetSaturation().SetValue(0);
GetMassCleared().SetValue(0, MassUnit::mg);
GetMassDeposited().SetValue(0, MassUnit::mg);
GetMassExcreted().SetValue(0, MassUnit::mg);
auto& mc = GetMassCleared();
if (mc.HasUnit())
mc.SetValue(0, *mc.GetUnit());
else
mc.SetValue(0, MassUnit::mg);
auto& md = GetMassDeposited();
if (md.HasUnit())
md.SetValue(0, *md.GetUnit());
else
md.SetValue(0, MassUnit::mg);
auto& me = GetMassExcreted();
if (me.HasUnit())
me.SetValue(0, *me.GetUnit());
else
me.SetValue(0, MassUnit::mg);
}
const SEScalar* SELiquidSubstanceQuantity::GetScalar(const std::string& name)
......@@ -342,7 +379,7 @@ SEScalarAmountPerVolume& SELiquidSubstanceQuantity::GetMolarity()
m_Molarity->Invalidate();
else
{
double molarity_mmol_Per_mL = GetMass(MassUnit::mg) / m_Substance.GetMolarMass(MassPerAmountUnit::mg_Per_mmol) / m_Compartment.GetVolume(VolumeUnit::mL);
double molarity_mmol_Per_mL = GetMass(MassUnit::mg) / m_Substance.GetMolarMass(MassPerAmountUnit::mg_Per_mmol) / m_Compartment.GetVolume(VolumeUnit::mL);
m_Molarity->SetValue(molarity_mmol_Per_mL, AmountPerVolumeUnit::mmol_Per_mL);
}
m_Molarity->SetReadOnly(true);
......
......@@ -408,6 +408,8 @@ const SEInitialEnvironmentConditions* SEConditionManager::GetInitialEnvironmentC
void SEConditionManager::GetAllConditions(std::vector<const SECondition*>& conditions) const
{
if (HasAcuteRespiratoryDistressSyndrome())
conditions.push_back(GetAcuteRespiratoryDistressSyndrome());
if (HasChronicAnemia())
conditions.push_back(GetChronicAnemia());
if (HasChronicObstructivePulmonaryDisease())
......@@ -424,12 +426,17 @@ void SEConditionManager::GetAllConditions(std::vector<const SECondition*>& condi
conditions.push_back(GetImpairedAlveolarExchange());
if (HasLobarPneumonia())
conditions.push_back(GetLobarPneumonia());
if (HasSepsis())
conditions.push_back(GetSepsis());
if (HasInitialEnvironmentConditions())
conditions.push_back(GetInitialEnvironmentConditions());
}
bool SEConditionManager::IsEmpty() const
{
if (HasAcuteRespiratoryDistressSyndrome())
return false;
if (HasChronicAnemia())
return false;
if (HasChronicObstructivePulmonaryDisease())
......@@ -446,6 +453,9 @@ bool SEConditionManager::IsEmpty() const
return false;
if (HasLobarPneumonia())
return false;
if (HasSepsis())
return false;
if (HasInitialEnvironmentConditions())
return false;
return true;
......
......@@ -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())
......
......@@ -36,7 +36,7 @@ SEScalar::~SEScalar()
void SEScalar::Clear()
{
SEProperty::Clear();
SEProperty::Clear();
m_readOnly = false;
Invalidate();
}
......@@ -51,7 +51,7 @@ bool SEScalar::Set(const SEScalar& s)
throw CommonDataModelException("Scalar is marked read-only");
m_value = s.m_value;
m_isnan = (std::isnan(m_value)) ? true : false;
m_isinf = (std::isinf(m_value)) ? true : false;
m_isinf = (std::isinf(m_value)) ? true : false;
return true;
}
......@@ -154,6 +154,27 @@ double SEScalar::IncrementValue(double d)
return m_value;
}
double SEScalar::Multiply(const SEScalar& s)
{
if (!s.IsValid())
Invalidate();
else
MultiplyValue(s.GetValue());
return m_value;
}
double SEScalar::MultiplyValue(double d)
{
if (!IsValid())
{
SetValue(d);
return d;
}
SetValue(m_value * d);
return m_value;
}
void SEScalar::Average(int cnt)
{
if (!IsValid() || cnt == 0)
......
......@@ -66,6 +66,9 @@ public:
double Increment(const SEScalar& s);
double IncrementValue(double d);
double Multiply(const SEScalar& s);
double MultiplyValue(double d);
void Average(int cnt);
bool Equals(const SEScalar& to) const;
......@@ -117,6 +120,7 @@ public:
virtual void SetValue(double d, const CCompoundUnit& unit) = 0;
virtual void ForceValue(double d, const CCompoundUnit& unit) = 0;
virtual double IncrementValue(double d, const CCompoundUnit& unit) = 0;
virtual double MultiplyValue(double d, const CCompoundUnit& unit) = 0;
protected:
virtual const CCompoundUnit* GetCompoundUnit(const std::string& unit) const = 0;
......@@ -145,6 +149,7 @@ protected:
virtual void SetValue(double d, const CCompoundUnit& unit);
virtual void ForceValue(double d, const CCompoundUnit& unit);
virtual double IncrementValue(double d, const CCompoundUnit& unit);
virtual double MultiplyValue(double d, const CCompoundUnit& unit);
virtual const CCompoundUnit* GetCompoundUnit(const std::string& unit) const;
......@@ -171,6 +176,12 @@ public:
double Increment(const SEScalar& s) = delete;// Must provide a unit
virtual double Increment(const SEScalarQuantity& s);
double MultiplyValue(double d) = delete;// Must provide a unit
virtual double MultiplyValue(double d, const Unit& unit);
double Multiply(const SEScalar& s) = delete;// Must provide a unit
virtual double Multiply(const SEScalarQuantity& s);
bool Equals(const SEScalar& to) const = delete;// Must provide a unit
virtual bool Equals(const SEScalarQuantity<Unit>& to) const;
......
......@@ -181,6 +181,38 @@ double SEScalarQuantity<Unit>::IncrementValue(double d, const CCompoundUnit& uni
return this->IncrementValue(d, *u);
}
template<typename Unit>
double SEScalarQuantity<Unit>::Multiply(const SEScalarQuantity<Unit>& s)
{
if (!s.IsValid())
this->Invalidate();
else
return this->MultiplyValue(s.m_value, *s.m_unit);
return m_value;
}
template<typename Unit>
double SEScalarQuantity<Unit>::MultiplyValue(double d, const Unit& unit)
{
if (!IsValid())
{
this->SetValue(d, unit);
return d;
}
this->SetValue(m_value * Convert(d, unit, *m_unit), *m_unit);
return Convert(m_value, *m_unit, unit);
}
template<typename Unit>
double SEScalarQuantity<Unit>::MultiplyValue(double d, const CCompoundUnit& unit)
{
const Unit* u = dynamic_cast<const Unit*>(&unit);
if (u == nullptr)
throw CommonDataModelException("Provided unit is not of proper quantity type");
return this->MultiplyValue(d, *u);
}
template<typename Unit>
bool SEScalarQuantity<Unit>::Equals(const SEScalarQuantity<Unit>& to) const
{
......
......@@ -15,6 +15,10 @@ bool VolumePerPressureUnit::IsValidUnit(const std::string& unit)
return true;
if (L_Per_cmH2O.GetString().compare(unit) == 0)
return true;
if (m3_Per_Pa.GetString().compare(unit) == 0)
return true;
if (mL_Per_mmHg.GetString().compare(unit) == 0)
return true;
return false;
}
......@@ -24,6 +28,10 @@ const VolumePerPressureUnit& VolumePerPressureUnit::GetCompoundUnit(const std::s
return L_Per_Pa;
if (L_Per_cmH2O.GetString().compare(unit) == 0)
return L_Per_cmH2O;
if (m3_Per_Pa.GetString().compare(unit) == 0)
return m3_Per_Pa;
if (mL_Per_mmHg.GetString().compare(unit) == 0)
return mL_Per_mmHg;
std::stringstream err;
err << unit << " is not a valid VolumePerPressure unit";
throw CommonDataModelException(err.str());
......
......@@ -29,11 +29,14 @@ 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_IntrapulmonaryPressure = nullptr;
m_LungCompliance = nullptr;
m_MaximalInspiratoryPressure = nullptr;
m_PatientPowerOfBreathing = nullptr;
......@@ -43,7 +46,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;
......@@ -60,6 +62,7 @@ SERespiratorySystem::SERespiratorySystem(Logger* logger) : SESystem(logger)
m_TransairwayPressure = nullptr;
m_TransalveolarPressure = nullptr;
m_TransChestWallPressure = nullptr;
m_TransMusclePressure = nullptr;
m_TranspulmonaryPressure = nullptr;
m_TransrespiratoryPressure = nullptr;
m_TransthoracicPressure = nullptr;
......@@ -85,11 +88,14 @@ 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_IntrapulmonaryPressure);
SAFE_DELETE(m_LungCompliance);
SAFE_DELETE(m_MaximalInspiratoryPressure);
SAFE_DELETE(m_PatientPowerOfBreathing);
......@@ -99,7 +105,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);
......@@ -116,6 +121,7 @@ void SERespiratorySystem::Clear()
SAFE_DELETE(m_TransairwayPressure);
SAFE_DELETE(m_TransalveolarPressure);
SAFE_DELETE(m_TransChestWallPressure);
SAFE_DELETE(m_TransMusclePressure);
SAFE_DELETE(m_TranspulmonaryPressure);
SAFE_DELETE(m_TransrespiratoryPressure);
SAFE_DELETE(m_TransthoracicPressure);
......@@ -146,6 +152,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 +162,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 +184,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 +412,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 +497,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);
}