Commit 5ac35679 authored by Aaron Bray's avatar Aaron Bray
Browse files

Fix timed stabilization and ards condition

parent a9620357
......@@ -146,7 +146,7 @@ bool SEDynamicStabilization::StabilizeConditions(PhysiologyEngine& engine, const
{
if (!HasConditionConvergence(c->GetName()))
{
Error("Engine does not support Condition");
Error("Engine does not support Condition "+c->GetName());
return false;
}
else
......
......@@ -35,7 +35,7 @@ bool SETimedStabilization::StabilizeConditions(PhysiologyEngine& engine, const S
{
if(!HasConditionTime(c->GetName()))
{
Error("Engine does not support Condition");
Error("Engine does not support Condition "+c->GetName());
return false;
}
const SEScalarTime& time = GetConditionTime(c->GetName());
......@@ -127,6 +127,7 @@ bool SETimedStabilization::Stabilize(PhysiologyEngine& engine, const SEScalarTim
SETimedStabilization::SETimedStabilization(Logger *logger) : SEEngineStabilization(logger)
{
m_RestingStabilizationTime = nullptr;
m_FeedbackStabilizationTime = nullptr;
GetStabilizationDuration().SetValue(0, TimeUnit::s);
}
......@@ -134,13 +135,12 @@ SETimedStabilization::SETimedStabilization(Logger *logger) : SEEngineStabilizati
SETimedStabilization::~SETimedStabilization()
{
Clear();
delete m_RestingStabilizationTime;
}
void SETimedStabilization::Clear()
{
SEEngineStabilization::Clear();
m_RestingStabilizationTime->Invalidate();
SAFE_DELETE(m_RestingStabilizationTime);
SAFE_DELETE(m_FeedbackStabilizationTime);
DELETE_MAP_SECOND(m_ConditionTimes);
}
......@@ -162,12 +162,20 @@ bool SETimedStabilization::SerializeFromFile(const std::string& filename, Serial
return PBEngine::SerializeFromFile(filename, *this, m);
}
bool SETimedStabilization::HasRestingStabilizationTime() const
{
return m_FeedbackStabilizationTime == nullptr ? false : m_FeedbackStabilizationTime->IsValid();
}
SEScalarTime& SETimedStabilization::GetRestingStabilizationTime()
{
if (m_RestingStabilizationTime == nullptr)
m_RestingStabilizationTime = new SEScalarTime();
return *m_RestingStabilizationTime;
}
double SETimedStabilization::GetRestingStabilizationTime(const TimeUnit& unit) const
{
if (!HasRestingStabilizationTime())
return SEScalar::dNaN();
return m_RestingStabilizationTime->GetValue(unit);
}
......
......@@ -24,6 +24,7 @@ public:
virtual bool StabilizeFeedbackState(PhysiologyEngine& engine);
virtual bool StabilizeConditions(PhysiologyEngine& engine, const SEConditionManager& conditions);
virtual bool HasRestingStabilizationTime() const;
virtual SEScalarTime& GetRestingStabilizationTime();
virtual double GetRestingStabilizationTime(const TimeUnit& unit) const;
......
......@@ -36,13 +36,6 @@ bool SEAcuteRespiratoryDistressSyndromeExacerbation::IsValid() const
return HasSeverity() && HasLeftLungAffected() && HasRightLungAffected();
}
bool SEAcuteRespiratoryDistressSyndromeExacerbation::IsActive() const
{
if (!IsValid())
return false;
return GetSeverity() > 0;
}
bool SEAcuteRespiratoryDistressSyndromeExacerbation::HasSeverity() const
{
if (!IsValid())
return false;
......@@ -53,6 +46,11 @@ bool SEAcuteRespiratoryDistressSyndromeExacerbation::HasSeverity() const
return true;
}
bool SEAcuteRespiratoryDistressSyndromeExacerbation::HasSeverity() const
{
return m_Severity == nullptr ? false : m_Severity->IsValid();
}
SEScalar0To1& SEAcuteRespiratoryDistressSyndromeExacerbation::GetSeverity()
{
if(m_Severity==nullptr)
......
......@@ -33,8 +33,8 @@ patient/BasicStandard.json = ScenarioTest
@group Patient
patient/AirwayObstructionVaried.json = ScenarioTest
patient/AcuteStress.json = ScenarioTest
#patient/ARDSExacerbation.json = ScenarioTest
#patient/ARDSModerateBothLungs.json = ScenarioTest
patient/ARDSExacerbation.json = ScenarioTest
patient/ARDSModerateBothLungs.json = ScenarioTest
patient/AsthmaAttackModerateAcute.json = ScenarioTest
patient/AsthmaAttackSevereAcute.json = ScenarioTest
patient/AsthmaAttackLifeThreateningAcute.json = ScenarioTest
......
Markdown is supported
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