Updates will be applied on October 27th between 12pm - 12:45pm EDT (UTC-0400). Gitlab may be slow during the maintenance window.

Commit 7ddc9b1b authored by Aaron Bray's avatar Aaron Bray
Browse files

More architectural refactoring for custom engines, including the initial...

More architectural refactoring for custom engines, including the initial multiplex ventilation engine
parent 4beff391
......@@ -8,9 +8,11 @@ src/schema/schema_last_built
/src/csharp/pulse/bind
/src/java/com
/src/java/pulse/cdm/bind
/src/java/pulse/engine/bind
/src/java/pulse/cpm/bind
/src/java/pulse/impl/bind
/src/python/pulse/cdm/bind
/src/python/pulse/engine/bind
/src/python/pulse/cpm/bind
/src/python/pulse/impl/bind
/src/python/google
# Eclipse Build Directory
......
......@@ -3,4 +3,6 @@ add_subdirectory(cdm)
add_subdirectory(cpm)
add_subdirectory(scenario_driver)
add_subdirectory(howto)
add_subdirectory(test)
\ No newline at end of file
add_subdirectory(test)
add_subdirectory(impl/multiplex_ventilation)
\ No newline at end of file
......@@ -33,12 +33,14 @@ add_library_ex(DataModelBindings
"${CDM_PACKAGE}/SubstanceQuantity.pb.h"
"${CDM_PACKAGE}/TestReport.pb.h"
# cpm bindings
"${ENGINE_PACKAGE}/Pulse.pb.h"
"${ENGINE_PACKAGE}/PulseConfiguration.pb.h"
"${ENGINE_PACKAGE}/PulseEnvironment.pb.h"
"${ENGINE_PACKAGE}/PulseEquipment.pb.h"
"${ENGINE_PACKAGE}/PulsePhysiology.pb.h"
"${ENGINE_PACKAGE}/PulseState.pb.h"
"${CPM_PACKAGE}/Pulse.pb.h"
"${CPM_PACKAGE}/PulseConfiguration.pb.h"
"${CPM_PACKAGE}/PulseEnvironment.pb.h"
"${CPM_PACKAGE}/PulseEquipment.pb.h"
"${CPM_PACKAGE}/PulsePhysiology.pb.h"
"${CPM_PACKAGE}/PulseState.pb.h"
# impl bindings
"${IMPL_PACKAGE}/MultiplexVentilator.pb.h"
CPP_FILES
# cdm bindings
"${CDM_PACKAGE}/Actions.pb.cc"
......@@ -71,12 +73,14 @@ add_library_ex(DataModelBindings
"${CDM_PACKAGE}/SubstanceQuantity.pb.cc"
"${CDM_PACKAGE}/TestReport.pb.cc"
# cpm bindings
"${ENGINE_PACKAGE}/Pulse.pb.cc"
"${ENGINE_PACKAGE}/PulseConfiguration.pb.cc"
"${ENGINE_PACKAGE}/PulseEnvironment.pb.cc"
"${ENGINE_PACKAGE}/PulseEquipment.pb.cc"
"${ENGINE_PACKAGE}/PulsePhysiology.pb.cc"
"${ENGINE_PACKAGE}/PulseState.pb.cc"
"${CPM_PACKAGE}/Pulse.pb.cc"
"${CPM_PACKAGE}/PulseConfiguration.pb.cc"
"${CPM_PACKAGE}/PulseEnvironment.pb.cc"
"${CPM_PACKAGE}/PulseEquipment.pb.cc"
"${CPM_PACKAGE}/PulsePhysiology.pb.cc"
"${CPM_PACKAGE}/PulseState.pb.cc"
# impl bindings
"${IMPL_PACKAGE}/MultiplexVentilator.pb.cc"
PRIVATE_DEPENDS
protobuf::libprotobuf
LIB_INSTALL_ONLY
......
......@@ -13,7 +13,7 @@ public:
bool OnForStabilization() { return m_OnStabilization; }
virtual void SetStabilizationCallback(bool b){ m_OnStabilization = b; }
virtual void OnAdvance(double time_s, const PhysiologyEngine& engine)=0;
virtual void OnAdvance(double time_s)=0;
protected:
bool m_OnStabilization;// Tell the engine to call this handler during stabilization
......
......@@ -10,7 +10,7 @@ class SEDataRequestManager;
enum class eDataRequest_Category {
Patient = 0, Physiology, Environment, GasCompartment,
LiquidCompartment, ThermalCompartment, TissueCompartment, Substance,
AnesthesiaMachine, ECG, Inhaler
AnesthesiaMachine, ECG, Inhaler, MechanicalVentilator
};
extern const std::string& eDataRequest_Category_Name(eDataRequest_Category m);
......
......@@ -437,35 +437,32 @@ SEDataRequest* SEDataRequestManager::FindSubstanceDataRequest(const SESubstance&
return nullptr;
}
SEDataRequest& SEDataRequestManager::CreateAnesthesiaMachineDataRequest(const std::string& cmptName, const std::string& property, const SEDecimalFormat* dfault)
SEDataRequest& SEDataRequestManager::CreateAnesthesiaMachineDataRequest(const std::string& property, const SEDecimalFormat* dfault)
{
SEDataRequest* dr = FindAnesthesiaMachineDataRequest(cmptName, property);
SEDataRequest* dr = FindAnesthesiaMachineDataRequest(property);
if (dr != nullptr)
return *dr;
dr = new SEDataRequest(eDataRequest_Category::AnesthesiaMachine, dfault);
m_Requests.push_back(dr);
dr->SetCompartmentName(cmptName);
dr->SetPropertyName(property);
return *dr;
}
SEDataRequest& SEDataRequestManager::CreateAnesthesiaMachineDataRequest(const std::string& cmptName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault)
SEDataRequest& SEDataRequestManager::CreateAnesthesiaMachineDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault)
{
SEDataRequest* dr = FindAnesthesiaMachineDataRequest(cmptName, property);
SEDataRequest* dr = FindAnesthesiaMachineDataRequest(property);
if (dr != nullptr)
return *dr;
dr = new SEDataRequest(eDataRequest_Category::AnesthesiaMachine, dfault);
m_Requests.push_back(dr);
dr->SetCompartmentName(cmptName);
dr->SetPropertyName(property);
dr->SetUnit(unit);
return *dr;
}
SEDataRequest* SEDataRequestManager::FindAnesthesiaMachineDataRequest(const std::string& cmptName, const std::string& property)
SEDataRequest* SEDataRequestManager::FindAnesthesiaMachineDataRequest(const std::string& property)
{
for (SEDataRequest* dr : m_Requests)
{
if (dr->GetCategory() == eDataRequest_Category::AnesthesiaMachine &&
dr->GetCompartmentName() == cmptName &&
if (dr->GetCategory() == eDataRequest_Category::AnesthesiaMachine &&
dr->GetPropertyName() == property)
return dr;
}
......@@ -503,37 +500,66 @@ SEDataRequest* SEDataRequestManager::FindECGDataRequest(const std::string& prope
return nullptr;
}
SEDataRequest& SEDataRequestManager::CreateInhalerDataRequest(const std::string& cmptName, const std::string& property, const SEDecimalFormat* dfault)
SEDataRequest& SEDataRequestManager::CreateInhalerDataRequest(const std::string& property, const SEDecimalFormat* dfault)
{
SEDataRequest* dr = FindInhalerDataRequest(cmptName, property);
SEDataRequest* dr = FindInhalerDataRequest(property);
if (dr != nullptr)
return *dr;
dr = new SEDataRequest(eDataRequest_Category::Inhaler, dfault);
m_Requests.push_back(dr);
dr->SetCompartmentName(cmptName);
dr->SetPropertyName(property);
return *dr;
}
SEDataRequest& SEDataRequestManager::CreateInhalerDataRequest(const std::string& cmptName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault)
SEDataRequest& SEDataRequestManager::CreateInhalerDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault)
{
SEDataRequest* dr = FindInhalerDataRequest(cmptName, property);
SEDataRequest* dr = FindInhalerDataRequest(property);
if (dr != nullptr)
return *dr;
dr = new SEDataRequest(eDataRequest_Category::Inhaler, dfault);
m_Requests.push_back(dr);
dr->SetCompartmentName(cmptName);
dr->SetPropertyName(property);
dr->SetUnit(unit);
return *dr;
}
SEDataRequest* SEDataRequestManager::FindInhalerDataRequest(const std::string& cmptName, const std::string& property)
SEDataRequest* SEDataRequestManager::FindInhalerDataRequest(const std::string& property)
{
for (SEDataRequest* dr : m_Requests)
{
if (dr->GetCategory() == eDataRequest_Category::Inhaler &&
dr->GetCompartmentName() == cmptName &&
if (dr->GetCategory() == eDataRequest_Category::Inhaler &&
dr->GetPropertyName() == property)
return dr;
}
return nullptr;
}
SEDataRequest& SEDataRequestManager::CreateMechanicalVentilatorDataRequest(const std::string& property, const SEDecimalFormat* dfault)
{
SEDataRequest* dr = FindMechanicalVentilatorDataRequest(property);
if (dr != nullptr)
return *dr;
dr = new SEDataRequest(eDataRequest_Category::MechanicalVentilator, dfault);
m_Requests.push_back(dr);
dr->SetPropertyName(property);
return *dr;
}
SEDataRequest& SEDataRequestManager::CreateMechanicalVentilatorDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault)
{
SEDataRequest* dr = FindMechanicalVentilatorDataRequest(property);
if (dr != nullptr)
return *dr;
dr = new SEDataRequest(eDataRequest_Category::MechanicalVentilator, dfault);
m_Requests.push_back(dr);
dr->SetPropertyName(property);
dr->SetUnit(unit);
return *dr;
}
SEDataRequest* SEDataRequestManager::FindMechanicalVentilatorDataRequest(const std::string& property)
{
for (SEDataRequest* dr : m_Requests)
{
if (dr->GetCategory() == eDataRequest_Category::MechanicalVentilator &&
dr->GetPropertyName() == property)
return dr;
}
return nullptr;
}
......@@ -70,15 +70,18 @@ public:
SEDataRequest& CreateSubstanceDataRequest(const SESubstance& sub, const std::string& property, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateSubstanceDataRequest(const SESubstance& sub, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateAnesthesiaMachineDataRequest(const std::string& cmptName, const std::string& property, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateAnesthesiaMachineDataRequest(const std::string& cmptName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateAnesthesiaMachineDataRequest(const std::string& property, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateAnesthesiaMachineDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateECGDataRequest(const std::string& property, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateECGDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateInhalerDataRequest(const std::string& cmptName, const std::string& property, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateInhalerDataRequest(const std::string& cmptName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateInhalerDataRequest(const std::string& property, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateInhalerDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateMechanicalVentilatorDataRequest(const std::string& property, const SEDecimalFormat* dfault = nullptr);
SEDataRequest& CreateMechanicalVentilatorDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
protected:
// Methods to find data requests so we don't keep making the same one
SEDataRequest* FindPatientDataRequest(const std::string& property);
......@@ -91,9 +94,10 @@ protected:
SEDataRequest* FindThermalCompartmentDataRequest(const std::string& cmptName, const std::string& property);
SEDataRequest* FindTissueCompartmentDataRequest(const std::string& cmptName, const std::string& property);
SEDataRequest* FindSubstanceDataRequest(const SESubstance& sub, const std::string& property);
SEDataRequest* FindAnesthesiaMachineDataRequest(const std::string& cmptName, const std::string& property);
SEDataRequest* FindAnesthesiaMachineDataRequest(const std::string& property);
SEDataRequest* FindECGDataRequest(const std::string& property);
SEDataRequest* FindInhalerDataRequest(const std::string& cmptName, const std::string& property);
SEDataRequest* FindInhalerDataRequest(const std::string& property);
SEDataRequest* FindMechanicalVentilatorDataRequest(const std::string& property);
std::string m_ResultsFilename;
double m_SamplesPerSecond;
......
......@@ -2,7 +2,6 @@
See accompanying NOTICE file for details.*/
#include "stdafx.h"
#include "PhysiologyEngine.h"
#include "engine/SEDynamicStabilization.h"
#include "engine/SEDynamicStabilizationLedger.h"
#include "engine/SEDynamicStabilizationEngineConvergence.h"
......@@ -123,19 +122,19 @@ const std::map<std::string, SEDynamicStabilizationEngineConvergence*>& SEDynamic
return m_ConditionConvergence;
}
bool SEDynamicStabilization::StabilizeRestingState(PhysiologyEngine& engine)
bool SEDynamicStabilization::StabilizeRestingState(Controller& engine)
{
Info("Converging to a steady state");
return Stabilize(engine, *m_RestingConvergence);
}
bool SEDynamicStabilization::StabilizeFeedbackState(PhysiologyEngine& engine)
bool SEDynamicStabilization::StabilizeFeedbackState(Controller& engine)
{
if (!HasFeedbackConvergence())
return true;
Info("Converging feedback to a steady state");
return Stabilize(engine, *m_FeedbackConvergence);
}
bool SEDynamicStabilization::StabilizeConditions(PhysiologyEngine& engine, const SEConditionManager& conditions)
bool SEDynamicStabilization::StabilizeConditions(Controller& engine, const SEConditionManager& conditions)
{
if (conditions.IsEmpty())
return true;
......@@ -173,7 +172,7 @@ bool SEDynamicStabilization::StabilizeConditions(PhysiologyEngine& engine, const
}
}
bool SEDynamicStabilization::Stabilize(PhysiologyEngine& engine, const SEDynamicStabilizationEngineConvergence& Convergence)
bool SEDynamicStabilization::Stabilize(Controller& engine, const SEDynamicStabilizationEngineConvergence& Convergence)
{
const std::vector<SEDynamicStabilizationPropertyConvergence*>& properties = Convergence.GetPropertyConvergence();
if (properties.empty())
......@@ -225,7 +224,7 @@ bool SEDynamicStabilization::Stabilize(PhysiologyEngine& engine, const SEDynamic
if (ledger.HasExceededTime())
break;
engine.AdvanceModelTime();
engine.AdvanceTime();
if (m_currentTime_s == 0)
tracker->SetupRequests();
stablizationTime_s += dT_s;
......
......@@ -19,9 +19,9 @@ public:
bool SerializeFromString(const std::string& src, SerializationFormat m);
bool SerializeFromFile(const std::string& filename, SerializationFormat m);
virtual bool StabilizeRestingState(PhysiologyEngine& engine);
virtual bool StabilizeFeedbackState(PhysiologyEngine& engine);
virtual bool StabilizeConditions(PhysiologyEngine& engine, const SEConditionManager& conditions);
virtual bool StabilizeRestingState(Controller& engine);
virtual bool StabilizeFeedbackState(Controller& engine);
virtual bool StabilizeConditions(Controller& engine, const SEConditionManager& conditions);
virtual SEDynamicStabilizationEngineConvergence& GetRestingConvergence();
virtual const SEDynamicStabilizationEngineConvergence& GetRestingConvergence() const;
......@@ -38,7 +38,7 @@ public:
protected:
virtual bool Stabilize(PhysiologyEngine& engine, const SEDynamicStabilizationEngineConvergence& criteria);
virtual bool Stabilize(Controller& engine, const SEDynamicStabilizationEngineConvergence& criteria);
SEDynamicStabilizationEngineConvergence* m_RestingConvergence;
SEDynamicStabilizationEngineConvergence* m_FeedbackConvergence;
......
......@@ -4,13 +4,19 @@
#pragma once
class SECondition;
class SEConditionManager;
class SEEngineTrack;
class PhysiologyEngine;
class SEEngineTracker;
class SEEngineConfiguration;
class CDM_DECL SEEngineStabilization : public Loggable
{
public:
class Controller
{
public:
virtual void AdvanceTime() = 0;
virtual SEEngineTracker* GetEngineTracker() = 0;
virtual double GetTimeStep(const TimeUnit& unit) = 0;
};
SEEngineStabilization(Logger* logger);
virtual ~SEEngineStabilization();
......@@ -21,9 +27,9 @@ public:
virtual bool SerializeFromString(const std::string& src, SerializationFormat) = 0;
virtual bool SerializeFromFile(const std::string& filename, SerializationFormat) = 0;
virtual bool StabilizeRestingState(PhysiologyEngine& engine)=0;
virtual bool StabilizeFeedbackState(PhysiologyEngine& engine) = 0;
virtual bool StabilizeConditions(PhysiologyEngine& engine, const SEConditionManager& conditions)=0;
virtual bool StabilizeRestingState(Controller& engine)=0;
virtual bool StabilizeFeedbackState(Controller& engine) = 0;
virtual bool StabilizeConditions(Controller& engine, const SEConditionManager& conditions)=0;
virtual void LogProgress(bool b);
......
......@@ -43,10 +43,11 @@
#include "system/physiology/SERenalSystem.h"
#include "system/physiology/SERespiratorySystem.h"
#include "system/physiology/SETissueSystem.h"
#include "system/environment/SEEnvironment.h"
#include "system/equipment/anesthesia_machine/SEAnesthesiaMachine.h"
#include "system/equipment/electrocardiogram/SEElectroCardioGram.h"
#include "system/equipment/inhaler/SEInhaler.h"
#include "system/environment/SEEnvironment.h"
#include "system/equipment/mechanical_ventilator/SEMechanicalVentilator.h"
// Scalars
#include "properties/SEScalarPressure.h"
#include "properties/SEScalarVolume.h"
......@@ -69,51 +70,11 @@ std::string Space2Underscore(const std::string& str)
return s;
}
SEEngineTracker::SEEngineTracker(PhysiologyEngine& engine) : Loggable(engine.GetLogger()),
m_DataRequestMgr(),
m_Patient((SEPatient&)engine.GetPatient()),
m_SubMgr((SESubstanceManager&)engine.GetSubstanceManager()),
m_CmptMgr((SECompartmentManager&)engine.GetCompartments())
{
m_DataTrack = new DataTrack(engine.GetLogger());
m_DataRequestMgr = new SEDataRequestManager(engine.GetLogger());
// TODO We are not handling nullptr well here...
SEBloodChemistrySystem* bchem = (SEBloodChemistrySystem*)engine.GetBloodChemistrySystem();
if(bchem != nullptr)
m_PhysiologySystems.push_back(bchem);
SECardiovascularSystem* cv = (SECardiovascularSystem*)engine.GetCardiovascularSystem();
if (cv != nullptr)
m_PhysiologySystems.push_back(cv);
SEEndocrineSystem* endo = (SEEndocrineSystem*)engine.GetEndocrineSystem();
if (endo != nullptr)
m_PhysiologySystems.push_back(endo);
SEEnergySystem* energy = (SEEnergySystem*)engine.GetEnergySystem();
if (energy != nullptr)
m_PhysiologySystems.push_back(energy);
SERenalSystem* renal = (SERenalSystem*)engine.GetRenalSystem();
if (renal != nullptr)
m_PhysiologySystems.push_back(renal);
SEGastrointestinalSystem* gi = (SEGastrointestinalSystem*)engine.GetGastrointestinalSystem();
if (gi != nullptr)
m_PhysiologySystems.push_back(gi);
SERespiratorySystem* resp = (SERespiratorySystem*)engine.GetRespiratorySystem();
if (resp != nullptr)
m_PhysiologySystems.push_back(resp);
SEDrugSystem* drug = (SEDrugSystem*)engine.GetDrugSystem();
if (drug != nullptr)
m_PhysiologySystems.push_back(drug);
SETissueSystem* tissue = (SETissueSystem*)engine.GetTissueSystem();
if (tissue != nullptr)
m_PhysiologySystems.push_back(tissue);
SENervousSystem* nervous = (SENervousSystem*)engine.GetNervousSystem();
if (nervous != nullptr)
m_PhysiologySystems.push_back(nervous);
m_Environment = (SEEnvironment*)engine.GetEnvironment();
m_AnesthesiaMachine = (SEAnesthesiaMachine*)engine.GetAnesthesiaMachine();
m_ECG = (SEElectroCardioGram*)engine.GetElectroCardioGram();
m_Inhaler = (SEInhaler*)engine.GetInhaler();
SEEngineTracker::SEEngineTracker(SEPatient& p, SESubstanceManager& s, SECompartmentManager& c, Logger* logger) : Loggable(logger),
m_Patient(p), m_SubMgr(s), m_CmptMgr(c)
{
m_DataTrack = new DataTrack(logger);
m_DataRequestMgr = new SEDataRequestManager(logger);
m_ForceConnection = false;
}
......@@ -132,6 +93,37 @@ void SEEngineTracker::Clear()
m_DataRequestMgr->Clear();
}
void SEEngineTracker::AddSystem(SESystem& sys)
{
if (dynamic_cast<SEEnvironment*>(&sys) != nullptr)
{
m_Environment = dynamic_cast<SEEnvironment*>(&sys);
return;
}
if (dynamic_cast<SEAnesthesiaMachine*>(&sys) != nullptr)
{
m_AnesthesiaMachine = dynamic_cast<SEAnesthesiaMachine*>(&sys);
return;
}
if (dynamic_cast<SEElectroCardioGram*>(&sys) != nullptr)
{
m_ECG = dynamic_cast<SEElectroCardioGram*>(&sys);
return;
}
if (dynamic_cast<SEInhaler*>(&sys) != nullptr)
{
m_Inhaler = dynamic_cast<SEInhaler*>(&sys);
return;
}
if (dynamic_cast<SEMechanicalVentilator*>(&sys) != nullptr)
{
m_MechanicalVentilator = dynamic_cast<SEMechanicalVentilator*>(&sys);
return;
}
// Not equipment or environment, so it must be a physiology system
m_PhysiologySystems.push_back(&sys);
}
void SEEngineTracker::ResetFile()
{
if (m_ResultsStream.is_open())
......@@ -341,41 +333,59 @@ bool SEEngineTracker::TrackRequest(SEDataRequest& dr)
bool SEEngineTracker::ConnectRequest(SEDataRequest& dr, SEDataRequestScalar& ds)
{
const SEScalar* s = nullptr;
std::string propertyName = dr.GetPropertyName();
switch (dr.GetCategory())
{
case eDataRequest_Category::Patient:
{
// casting of the const to modify the patient
ds.SetScalar(m_Patient.GetScalar(propertyName), dr);
return true;
s = m_Patient.GetScalar(propertyName);
break;
}
case eDataRequest_Category::Physiology:
{
// Make sure we mapped something
ds.SetScalar(SESystem::GetScalar(propertyName, &m_PhysiologySystems), dr);
return true;
s = SESystem::GetScalar(propertyName, &m_PhysiologySystems);
break;
}
case eDataRequest_Category::Environment:
{
// Make sure we mapped something
ds.SetScalar(m_Environment->GetScalar(propertyName), dr);
return true;
if (m_Environment != nullptr)
s = m_Environment->GetScalar(propertyName);
else
Error("Cannot track environment data as no environment was provide");
break;
}
case eDataRequest_Category::AnesthesiaMachine:
{
ds.SetScalar(m_AnesthesiaMachine->GetScalar(propertyName), dr);
return true;
if (m_AnesthesiaMachine != nullptr)
s = m_AnesthesiaMachine->GetScalar(propertyName);
else
Error("Cannot track anesthesia machine data as no anesthesia machine was provide");
break;
}
case eDataRequest_Category::ECG:
{
ds.SetScalar(m_ECG->GetScalar(propertyName), dr);
return true;
if (m_ECG != nullptr)
s = m_ECG->GetScalar(propertyName);
else
Error("Cannot track ECG data as no ECG was provide");
break;
}
case eDataRequest_Category::Inhaler:
{
ds.SetScalar(m_Inhaler->GetScalar(propertyName), dr);
return true;
if (m_Inhaler != nullptr)
s = m_Inhaler->GetScalar(propertyName);
else
Error("Cannot track inhaler data as no inhaler was provide");
break;
}
case eDataRequest_Category::MechanicalVentilator:
{
if (m_MechanicalVentilator != nullptr)
s = m_MechanicalVentilator->GetScalar(propertyName);
else
Error("Cannot track mechanical ventilator data as no mechanical ventilator was provide");
break;
}
case eDataRequest_Category::GasCompartment:
{
......@@ -401,7 +411,7 @@ bool SEEngineTracker::ConnectRequest(SEDataRequest& dr, SEDataRequestScalar& ds)
ds.UpdateProperty = CompartmentUpdate::PartialPressure;
ds.GasSubstance = gasCmpt->GetSubstanceQuantity(*sub);
}
ds.SetScalar(gasCmpt->GetSubstanceQuantity(*sub)->GetScalar(propertyName), dr);
s = gasCmpt->GetSubstanceQuantity(*sub)->GetScalar(propertyName);
}
else
{
......@@ -420,9 +430,9 @@ bool SEEngineTracker::ConnectRequest(SEDataRequest& dr, SEDataRequestScalar& ds)
ds.UpdateProperty = CompartmentUpdate::OutFlow;
}
ds.GasCmpt = gasCmpt;
ds.SetScalar(gasCmpt->GetScalar(propertyName), dr);
s = gasCmpt->GetScalar(propertyName);
}
return true;
break;
}
case eDataRequest_Category::LiquidCompartment:
{
......@@ -453,7 +463,7 @@ bool SEEngineTracker::ConnectRequest(SEDataRequest& dr, SEDataRequestScalar& ds)
ds.UpdateProperty = CompartmentUpdate::Saturation;
ds.LiquidSubstance = liquidCmpt->GetSubstanceQuantity(*sub);
}
ds.SetScalar(liquidCmpt->GetSubstanceQuantity(*sub)->GetScalar(propertyName), dr);
s = liquidCmpt->GetSubstanceQuantity(*sub)->GetScalar(propertyName);
}
else
{
......@@ -465,16 +475,16 @@ bool SEEngineTracker::ConnectRequest(SEDataRequest& dr, SEDataRequestScalar& ds)
ds.UpdateProperty = CompartmentUpdate::Pressure;
}
{// Always Update these
{// Always Update these
if (propertyName == "InFlow")
ds.UpdateProperty = CompartmentUpdate::InFlow;
else if (propertyName == "OutFlow")
ds.UpdateProperty = CompartmentUpdate::OutFlow;
}
ds.LiquidCmpt = liquidCmpt;
ds.SetScalar(liquidCmpt->GetScalar(propertyName), dr);
s = liquidCmpt->GetScalar(propertyName);
}
return true;
break;
}
case eDataRequest_Category::ThermalCompartment:
{
......@@ -501,8 +511,8 @@ bool SEEngineTracker::ConnectRequest(SEDataRequest& dr, SEDataRequestScalar& ds)
ds.UpdateProperty = CompartmentUpdate::HeatTransferRateOut;
}
ds.ThermalCmpt = thermalCmpt;
ds.SetScalar(thermalCmpt->GetScalar(propertyName), dr);
return true;
s = thermalCmpt->GetScalar(propertyName);
break;
}
case eDataRequest_Category::TissueCompartment:
{
......@@ -513,8 +523,8 @@ bool SEEngineTracker::ConnectRequest(SEDataRequest& dr, SEDataRequestScalar& ds)