Pulse adds COVID-19 Simulation Support
×

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

#include <Controller.h>

Inherits PulseData.

Public Member Functions

 PulseController (Logger *logger=nullptr)
 
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 void AdvanceModelTime ()
 
virtual void 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
 PulseData (Logger *logger=nullptr)
 
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 SEBloodChemistrySystemGetBloodChemistry () const
 
virtual SECardiovascularSystemGetCardiovascular () const
 
virtual SEDrugSystemGetDrugs () const
 
virtual SEEndocrineSystemGetEndocrine () const
 
virtual SEEnergySystemGetEnergy () const
 
virtual SEGastrointestinalSystemGetGastrointestinal () const
 
virtual SEHepaticSystemGetHepatic () const
 
virtual SENervousSystemGetNervous () const
 
virtual SERenalSystemGetRenal () const
 
virtual SERespiratorySystemGetRespiratory () const
 
virtual SETissueSystemGetTissue () const
 
virtual SEEnvironmentGetEnvironment () const
 
virtual SEAnesthesiaMachineGetAnesthesiaMachine () const
 
virtual SEElectroCardioGramGetECG () const
 
virtual SEInhalerGetInhaler () const
 
virtual SEMechanicalVentilatorGetMechanicalVentilator () const
 
virtual SEActionManagerGetActions () const
 
virtual SEConditionManagerGetConditions () const
 
virtual SEEventManagerGetEvents () const
 
virtual PulseCircuitsGetCircuits () const
 
virtual PulseCompartmentsGetCompartments () const
 
virtual const PulseConfigurationGetConfiguration () const
 
virtual const SEScalarTimeGetTimeStep () const
 
virtual const SEScalarTimeGetEngineTime () const
 
virtual const SEScalarTimeGetSimulationTime () const
 
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
 
std::string to_string (int i)
 
std::string to_string (unsigned int i)
 
std::string to_string (size_t t)
 
std::string to_string (float f)
 
std::string to_string (double d)
 

Protected Member Functions

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 AtSteadyState (EngineState state)
 
virtual void PreProcess ()
 
virtual void Process ()
 
virtual void PostProcess ()
 
virtual void ForwardFatal (const std::string &msg, const std::string &origin)
 

Protected Attributes

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

Friends

class PulseEngine
 
class PulseEngineTest
 
class PulseScenarioExec
 
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)

◆ ~PulseController()

PulseController::~PulseController ( )
virtual

Member Function Documentation

◆ AdvanceModelTime() [1/2]

void PulseController::AdvanceModelTime ( )
virtual

◆ AdvanceModelTime() [2/2]

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

◆ AtSteadyState()

void PulseController::AtSteadyState ( EngineState  state)
protectedvirtual

◆ CreateCircuitsAndCompartments()

bool PulseController::CreateCircuitsAndCompartments ( )
virtual

◆ ForwardFatal()

void PulseController::ForwardFatal ( const std::string &  msg,
const std::string &  origin 
)
protectedvirtual

◆ 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

◆ 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

◆ PulseScenarioExec

friend class PulseScenarioExec
friend

Member Data Documentation

◆ m_ConfigOverride

PulseConfiguration const* PulseController::m_ConfigOverride
protected

◆ m_Stabilizer

PulseStabilizationController* PulseController::m_Stabilizer
protected

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.