Manages and controls execution of all data/systems in Pulse. More...

#include <Controller.h>

Inherits PulseData.

Public Member Functions

virtual ~PulseController ()
 
virtual PulseDataGetData ()
 
virtual const PulseDataGetData () const
 
virtual bool SerializeFromFile (const std::string &file)
 
virtual bool SerializeToFile (const std::string &file) const
 
virtual bool SerializeFromString (const std::string &state, SerializationFormat m)
 
virtual bool SerializeToString (std::string &state, SerializationFormat m) const
 
virtual bool InitializeEngine (const std::string &patient_configuration, SerializationFormat m)
 
virtual bool InitializeEngine (const SEPatientConfiguration &patient_configuration)
 
virtual bool IsReady () const
 
virtual bool SetConfigurationOverride (const SEEngineConfiguration *config)
 
virtual void SetSimulationTime (const SEScalarTime &time)
 
virtual bool AdvanceModelTime ()
 
virtual bool AdvanceModelTime (double time, const TimeUnit &unit)
 
virtual bool ProcessAction (const SEAction &action)
 
virtual bool GetPatientAssessment (SEPatientAssessment &assessment) const
 
virtual bool CreateCircuitsAndCompartments ()
 
virtual bool OverrideCircuits ()
 
- Public Member Functions inherited from PulseData
virtual ~PulseData ()
 
virtual std::string GetDataRoot () const
 
virtual void SetDataRoot (const std::string &dir)
 
virtual void AdvanceCallback (double time_s)
 
virtual EngineState GetState () const
 
virtual SEEngineTrackerGetEngineTracker () const
 
virtual DataTrackGetDataTrack () const
 
virtual SaturationCalculatorGetSaturationCalculator () const
 
virtual PulseSubstancesGetSubstances () const
 
virtual const SEPatientGetInitialPatient () const
 
virtual SEPatientGetCurrentPatient () const
 
virtual bool HasBloodChemistry () const
 
virtual SEBloodChemistrySystemGetBloodChemistry () const
 
virtual bool HasCardiovascular () const
 
virtual SECardiovascularSystemGetCardiovascular () const
 
virtual bool HasDrugs () const
 
virtual SEDrugSystemGetDrugs () const
 
virtual bool HasEndocrine () const
 
virtual SEEndocrineSystemGetEndocrine () const
 
virtual bool HasEnergy () const
 
virtual SEEnergySystemGetEnergy () const
 
virtual bool HasGastrointestinal () const
 
virtual SEGastrointestinalSystemGetGastrointestinal () const
 
virtual bool HasHepatic () const
 
virtual SEHepaticSystemGetHepatic () const
 
virtual bool HasNervous () const
 
virtual SENervousSystemGetNervous () const
 
virtual bool HasRenal () const
 
virtual SERenalSystemGetRenal () const
 
virtual bool HasRespiratory () const
 
virtual SERespiratorySystemGetRespiratory () const
 
virtual bool HasTissue () const
 
virtual SETissueSystemGetTissue () const
 
virtual bool HasEnvironment () const
 
virtual SEEnvironmentGetEnvironment () const
 
virtual bool HasAnesthesiaMachine () const
 
virtual SEAnesthesiaMachineGetAnesthesiaMachine () const
 
virtual bool HasECG () const
 
virtual SEElectroCardioGramGetECG () const
 
virtual bool HasInhaler () const
 
virtual SEInhalerGetInhaler () const
 
virtual bool HasMechanicalVentilator () const
 
virtual SEMechanicalVentilatorGetMechanicalVentilator () const
 
virtual SEActionManagerGetActions () const
 
virtual SEConditionManagerGetConditions () const
 
virtual SEEventManagerGetEvents () const
 
virtual PulseCircuitsGetCircuits () const
 
virtual PulseCompartmentsGetCompartments () const
 
virtual PulseBlackBoxesGetBlackBoxes () const
 
virtual const PulseConfigurationGetConfiguration () const
 
virtual double GetTimeStep_s () const
 
virtual const SEScalarTimeGetTimeStep () const
 
virtual const SEScalarTimeGetEngineTime () const
 
virtual const SEScalarTimeGetSimulationTime () const
 
virtual bool IsAirwayModeSupported (eAirwayMode mode)
 
virtual eAirwayMode GetAirwayMode () const
 
virtual void SetAirwayMode (eAirwayMode mode)
 
virtual eSwitch GetIntubation () const
 
virtual void SetIntubation (eSwitch s)
 
virtual void SetAdvanceHandler (SEAdvanceHandler *handler)
 
virtual bool HasOverride () const
 
virtual const std::vector< SEScalarProperty > & GetOverrides () const
 
- Public Member Functions inherited from Loggable
 Loggable (Logger *logger=nullptr)
 
 Loggable (std::string const &logfile)
 
virtual ~Loggable ()
 
virtual LoggerGetLogger () const
 
virtual void SetLogger (Logger &logger)
 
virtual void Debug (std::string const &msg, std::string const &origin=empty) const
 
virtual void Debug (std::stringstream &msg, std::string const &origin=empty) const
 
virtual void Debug (std::ostream &msg, std::string const &origin=empty) const
 
virtual void Info (std::string const &msg, std::string const &origin=empty) const
 
virtual void Info (std::stringstream &msg, std::string const &origin=empty) const
 
virtual void Info (const std::stringstream &msg, std::string const &origin=empty) const
 
virtual void Info (std::ostream &msg, std::string const &origin=empty) const
 
virtual void Warning (std::string const &msg, std::string const &origin=empty) const
 
virtual void Warning (std::stringstream &msg, std::string const &origin=empty) const
 
virtual void Warning (std::ostream &msg, std::string const &origin=empty) const
 
virtual void Error (std::string const &msg, std::string const &origin=empty) const
 
virtual void Error (std::stringstream &msg, std::string const &origin=empty) const
 
virtual void Error (std::ostream &msg, std::string const &origin=empty) const
 
virtual void Fatal (std::string const &msg, std::string const &origin=empty) const
 
virtual void Fatal (std::stringstream &msg, std::string const &origin=empty) const
 
virtual void Fatal (std::ostream &msg, std::string const &origin=empty) const
 

Protected Member Functions

 PulseController (Logger *logger=nullptr)
 
virtual void Allocate () override
 
virtual void SetupCardiovascular ()
 
virtual void SetupRenal ()
 
virtual void SetupTissue ()
 
virtual void SetupCerebrospinalFluid ()
 
virtual void SetupGastrointestinal ()
 
virtual void SetupRespiratory ()
 
virtual void SetupAnesthesiaMachine ()
 
virtual void SetupInhaler ()
 
virtual void SetupMechanicalVentilation ()
 
virtual void SetupMechanicalVentilator ()
 
virtual void SetupNasalCannula ()
 
virtual void SetupSimpleMask ()
 
virtual void SetupNonRebreatherMask ()
 
virtual void SetupExternalTemperature ()
 
virtual void SetupInternalTemperature ()
 
virtual bool Initialize (const SEPatient &patient)
 
virtual bool SetupPatient (const SEPatient &patient)
 
virtual void InitializeSystems ()
 
virtual void AtSteadyState (EngineState state)
 
virtual void PreProcess ()
 
virtual void Process ()
 
virtual void PostProcess ()
 
- Protected Member Functions inherited from PulseData
 PulseData (Logger *logger=nullptr)
 
virtual void SetupTracker ()
 

Protected Attributes

PulseConfiguration const * m_ConfigOverride =nullptr
 
PulseStabilizationControllerm_Stabilizer =nullptr
 
- Protected Attributes inherited from PulseData
EngineState m_State
 
SEEngineTrackerm_EngineTrack
 
SEScalarTime m_CurrentTime
 
SEScalarTime m_SimulationTime
 
double m_SpareAdvanceTime_s
 
eAirwayMode m_AirwayMode
 
eSwitch m_Intubation
 
PulseConfigurationm_Config =nullptr
 
SaturationCalculatorm_SaturationCalculator =nullptr
 
PulseSubstancesm_Substances =nullptr
 
SEActionManagerm_Actions =nullptr
 
SEConditionManagerm_Conditions =nullptr
 
PulseCircuitsm_Circuits =nullptr
 
PulseCompartmentsm_Compartments =nullptr
 
PulseBlackBoxesm_BlackBoxes =nullptr
 
Environmentm_Environment =nullptr
 
BloodChemistrym_BloodChemistrySystem =nullptr
 
Cardiovascularm_CardiovascularSystem =nullptr
 
Endocrinem_EndocrineSystem =nullptr
 
Energym_EnergySystem =nullptr
 
Gastrointestinalm_GastrointestinalSystem =nullptr
 
Hepaticm_HepaticSystem =nullptr
 
Nervousm_NervousSystem =nullptr
 
Renalm_RenalSystem =nullptr
 
Respiratorym_RespiratorySystem =nullptr
 
Drugsm_DrugSystem =nullptr
 
Tissuem_TissueSystem =nullptr
 
ECGm_ECG =nullptr
 
AnesthesiaMachinem_AnesthesiaMachine =nullptr
 
Inhalerm_Inhaler =nullptr
 
MechanicalVentilatorm_MechanicalVentilator =nullptr
 
SEPatientm_InitialPatient =nullptr
 
SEPatientm_CurrentPatient =nullptr
 
SEEventManagerm_EventManager =nullptr
 
LoggerForwardm_LogForward =nullptr
 
SEAdvanceHandlerm_AdvanceHandler =nullptr
 
std::string m_DataDir
 
std::vector< SEScalarPropertym_ScalarOverrides
 
- Protected Attributes inherited from Loggable
bool myLogger
 
Loggerm_Logger
 

Friends

class PulseEngine
 
class PulseEngineTest
 
class PBPulseState
 

Additional Inherited Members

- Public Attributes inherited from PulseData
std::stringstream m_ss
 
- Static Public Attributes inherited from Loggable
static const std::string empty
 

Detailed Description

Manages and controls execution of all data/systems in Pulse.

Constructor & Destructor Documentation

◆ PulseController()

PulseController::PulseController ( Logger logger = nullptr)
protected

◆ ~PulseController()

PulseController::~PulseController ( )
virtual

Member Function Documentation

◆ AdvanceModelTime() [1/2]

bool PulseController::AdvanceModelTime ( )
virtual

◆ AdvanceModelTime() [2/2]

bool PulseController::AdvanceModelTime ( double  time,
const TimeUnit unit 
)
virtual

◆ Allocate()

void PulseController::Allocate ( )
overrideprotectedvirtual

Reimplemented from PulseData.

◆ AtSteadyState()

void PulseController::AtSteadyState ( EngineState  state)
protectedvirtual

◆ CreateCircuitsAndCompartments()

bool PulseController::CreateCircuitsAndCompartments ( )
virtual

◆ GetData() [1/2]

virtual PulseData& PulseController::GetData ( )
inlinevirtual

◆ GetData() [2/2]

virtual const PulseData& PulseController::GetData ( ) const
inlinevirtual

◆ GetPatientAssessment()

bool PulseController::GetPatientAssessment ( SEPatientAssessment assessment) const
virtual

◆ Initialize()

bool PulseController::Initialize ( const SEPatient patient)
protectedvirtual

◆ InitializeEngine() [1/2]

bool PulseController::InitializeEngine ( const std::string &  patient_configuration,
SerializationFormat  m 
)
virtual

◆ InitializeEngine() [2/2]

bool PulseController::InitializeEngine ( const SEPatientConfiguration patient_configuration)
virtual

◆ InitializeSystems()

void PulseController::InitializeSystems ( )
protectedvirtual

◆ IsReady()

bool PulseController::IsReady ( ) const
virtual

◆ OverrideCircuits()

bool PulseController::OverrideCircuits ( )
virtual

◆ PostProcess()

void PulseController::PostProcess ( )
protectedvirtual

◆ PreProcess()

void PulseController::PreProcess ( )
protectedvirtual

◆ Process()

void PulseController::Process ( )
protectedvirtual

◆ ProcessAction()

bool PulseController::ProcessAction ( const SEAction action)
virtual

◆ SerializeFromFile()

bool PulseController::SerializeFromFile ( const std::string &  file)
virtual

◆ SerializeFromString()

bool PulseController::SerializeFromString ( const std::string &  state,
SerializationFormat  m 
)
virtual

◆ SerializeToFile()

bool PulseController::SerializeToFile ( const std::string &  file) const
virtual

◆ SerializeToString()

bool PulseController::SerializeToString ( std::string &  state,
SerializationFormat  m 
) const
virtual

◆ SetConfigurationOverride()

bool PulseController::SetConfigurationOverride ( const SEEngineConfiguration config)
virtual

◆ SetSimulationTime()

void PulseController::SetSimulationTime ( const SEScalarTime time)
virtual

◆ SetupAnesthesiaMachine()

void PulseController::SetupAnesthesiaMachine ( )
protectedvirtual

◆ SetupCardiovascular()

void PulseController::SetupCardiovascular ( )
protectedvirtual
Todo:
Make these a function of the systolic and diastolic pressure by fitting a curve to the data from the variations test

◆ SetupCerebrospinalFluid()

void PulseController::SetupCerebrospinalFluid ( )
protectedvirtual

◆ SetupExternalTemperature()

void PulseController::SetupExternalTemperature ( )
protectedvirtual

◆ SetupGastrointestinal()

void PulseController::SetupGastrointestinal ( )
protectedvirtual

◆ SetupInhaler()

void PulseController::SetupInhaler ( )
protectedvirtual

◆ SetupInternalTemperature()

void PulseController::SetupInternalTemperature ( )
protectedvirtual

◆ SetupMechanicalVentilation()

void PulseController::SetupMechanicalVentilation ( )
protectedvirtual

◆ SetupMechanicalVentilator()

void PulseController::SetupMechanicalVentilator ( )
protectedvirtual

◆ SetupNasalCannula()

void PulseController::SetupNasalCannula ( )
protectedvirtual

◆ SetupNonRebreatherMask()

void PulseController::SetupNonRebreatherMask ( )
protectedvirtual

◆ SetupPatient()

bool PulseController::SetupPatient ( const SEPatient patient)
protectedvirtual

◆ SetupRenal()

void PulseController::SetupRenal ( )
protectedvirtual
Todo:
The bladder is currently not being modeled as a compliance
Todo:
Use a compliance here - make sure you remove the current handling of bladder volume in the renal system as a pressure source

◆ SetupRespiratory()

void PulseController::SetupRespiratory ( )
protectedvirtual

◆ SetupSimpleMask()

void PulseController::SetupSimpleMask ( )
protectedvirtual

◆ SetupTissue()

void PulseController::SetupTissue ( )
protectedvirtual
Todo:
Put Initial Circuit/Compartment data values into the configuration file.

Friends And Related Function Documentation

◆ PBPulseState

friend class PBPulseState
friend

◆ PulseEngine

friend class PulseEngine
friend

◆ PulseEngineTest

friend class PulseEngineTest
friend

Member Data Documentation

◆ m_ConfigOverride

PulseConfiguration const* PulseController::m_ConfigOverride =nullptr
protected

◆ m_Stabilizer

PulseStabilizationController* PulseController::m_Stabilizer =nullptr
protected

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.