Pulse adds COVID-19 Simulation Support
×

This is the implementation of the PhysiologyEngine interface for the this engines. More...

#include <Engine.h>

Inherits PhysiologyEngine.

Public Member Functions

 PulseEngine (Logger *logger=nullptr)
 
virtual ~PulseEngine ()
 
virtual bool SerializeFromFile (const std::string &file) override
 Reset engine and set it to the state in the provided file. The file may contain json or binary. Anything but an extension of .json will be interpreted as binary. Return value indicates engine was able to load provided state file. Engine will be in a cleared state if this method fails. More...
 
virtual bool SerializeToFile (const std::string &file) const override
 Save the current state of the engine to provided filename. Using a .json extension will save a json/ascii file. Anything else will save as binary. More...
 
virtual bool SerializeFromString (const std::string &state, SerializationFormat m) override
 Reset engine and set it to the state in the provided string. The string can contain JSON or binary. Note that a string of bytes are binary, not text; we only use the string class as a convenient container. Return value indicates engine was able to load provided state file. Engine will be in a cleared state if this method fails. More...
 
virtual bool SerializeToString (std::string &state, SerializationFormat m) const override
 Save the current state of the engine. The state can be saved as JSON or bytes in the given string. Note that the bytes are binary, not text; we only use the string class as a convenient container. More...
 
virtual bool InitializeEngine (const std::string &patient_configuration, SerializationFormat m) override
 Initialize an engine based on the engines initialization structure. More...
 
virtual bool InitializeEngine (const SEPatientConfiguration &patient_configuration) override
 This will create an engine that you can send instructions (patient,actions,conditions) to dynamically. The return value will indicate success failure of the creation of the engine. Some combinations of patients and conditions may prevent the engine from stabilizing. More...
 
virtual bool SetConfigurationOverride (const SEEngineConfiguration *config) override
 Engines can have a configuration for allowing a user to set certain internal parameters Engines with configurations will have all configuration parameters defaulted, This allow you to change one or more or those parameters. The parameters provided will be applied during SerializeFrom* and InitializeEngine methods. Use with caution! (Use nullptr to revert back to using all engine defaults) More...
 
virtual const SEConditionManagerGetConditionManager () const override
 Get the Condition Manager. Allows a user to check the state of active conditions. More...
 
virtual LoggerGetLogger () const override
 Retrieve the Logger associated with this engine. More...
 
virtual SEEngineTrackerGetEngineTracker () const override
 Retrieve the SEEngineTracker associated with tracking data from this engine to a file The SEEngineTracker is a class set up to pull data requested from the engine (via SEDataRequest's) and provide access to the data easily (ex. to easily write data to csv files) More...
 
virtual const SEEngineConfigurationGetConfiguration () const override
 returns the engine configuration. More...
 
virtual double GetTimeStep (const TimeUnit &unit) const override
 returns the engine time step that is used when advancing time. More...
 
virtual double GetSimulationTime (const TimeUnit &unit) const override
 returns the current time of the simulation. More...
 
virtual void SetSimulationTime (const SEScalarTime &time) override
 Set the current time of the simulation. Engine Simulation time will be advanced from this time point. More...
 
virtual void AdvanceModelTime () override
 executes one pass through the time loop of the engine at the fixed timestep More...
 
virtual void AdvanceModelTime (double time, const TimeUnit &unit) override
 executes time loop of the engine beginning at the current time and running for the duration specified in the call at the fixed timestep More...
 
virtual bool ProcessAction (const SEAction &action) override
 Execute the provided action. true will be returned if the engine supports the action false will be returned if the engine does not support the action. More...
 
virtual const SEActionManagerGetActionManager () const override
 Get the Action Manager. Allows a user to check the state of active actions. More...
 
virtual const SESubstanceManagerGetSubstanceManager () const override
 Retrieves the associated substance manager. More...
 
virtual void SetAdvanceHandler (SEAdvanceHandler *handler) override
 Add a callback object that will be called after each timestep. More...
 
virtual const SEPatientGetPatient () const override
 Returns the patient object used by the engine. More...
 
virtual const SEPatientGetInitialPatient () const override
 Returns the initial simulation patient object used by the engine. More...
 
virtual bool GetPatientAssessment (SEPatientAssessment &assessment) const override
 Determines the assessment type and fills the data object with current data. More...
 
virtual const SEEnvironmentGetEnvironment () const override
 Returns the environment object used by the engine. More...
 
virtual const SEBloodChemistrySystemGetBloodChemistrySystem () const override
 Returns the current state of the Blood Chemistry System. More...
 
virtual const SECardiovascularSystemGetCardiovascularSystem () const override
 Returns the current state of the Cardiovascular System. More...
 
virtual const SEDrugSystemGetDrugSystem () const override
 Returns the current state of the drug system. More...
 
virtual const SEEndocrineSystemGetEndocrineSystem () const override
 Returns the current state of the Endocrine System. More...
 
virtual const SEEnergySystemGetEnergySystem () const override
 Returns the current state of the Energy System. More...
 
virtual const SEGastrointestinalSystemGetGastrointestinalSystem () const override
 Returns the current state of the Gastrointestinal System. More...
 
virtual const SEHepaticSystemGetHepaticSystem () const override
 Returns the current state of the Hepatic System. More...
 
virtual const SENervousSystemGetNervousSystem () const override
 Returns the current state of the Nervous System. More...
 
virtual const SERenalSystemGetRenalSystem () const override
 Returns the current state of the Renal System. More...
 
virtual const SERespiratorySystemGetRespiratorySystem () const override
 Returns the current state of the Respiratory System. More...
 
virtual const SETissueSystemGetTissueSystem () const override
 Returns the current state of the tissue system. More...
 
virtual const SEAnesthesiaMachineGetAnesthesiaMachine () const override
 Returns the current state of the Anesthesia machine. More...
 
virtual const SEElectroCardioGramGetElectroCardioGram () const override
 Returns the current state of the Electrocardiogram machine. More...
 
virtual const SEInhalerGetInhaler () const override
 Returns the current state of the Inhaler. More...
 
virtual const SEMechanicalVentilatorGetMechanicalVentilator () const override
 Returns the current state of the Mechanical ventilator. More...
 
virtual const SECompartmentManagerGetCompartments () const override
 Retrieves the engine compartments, providing such data as: flows, pressure, volume as well as substance volumes and volume fractions. More...
 
virtual const SEEventManagerGetEventManager () const override
 Retrieves the associated event manager. More...
 
PulseControllerGetController ()
 
- Public Member Functions inherited from PhysiologyEngine
virtual ~PhysiologyEngine ()
 

Protected Attributes

PulseControllerm_PulseController
 

Detailed Description

This is the implementation of the PhysiologyEngine interface for the this engines.

It contains the necessary execution calls, patient customization calls, insult and intervention calls as well as assessment calls for obtaining the results. During engine execution a log files is generated containing information, warning and error data.

Constructor & Destructor Documentation

◆ PulseEngine()

PulseEngine::PulseEngine ( Logger logger = nullptr)

◆ ~PulseEngine()

PulseEngine::~PulseEngine ( )
virtual

Member Function Documentation

◆ AdvanceModelTime() [1/2]

void PulseEngine::AdvanceModelTime ( )
overridevirtual

executes one pass through the time loop of the engine at the fixed timestep

Events, errors, and warning as are logged to file not errors are returned through the API at this time.

Implements PhysiologyEngine.

◆ AdvanceModelTime() [2/2]

void PulseEngine::AdvanceModelTime ( double  time,
const TimeUnit unit 
)
overridevirtual

executes time loop of the engine beginning at the current time and running for the duration specified in the call at the fixed timestep

Events, errors, and warning as are logged to file not errors are returned through the API at this time.

Implements PhysiologyEngine.

◆ GetActionManager()

const SEActionManager & PulseEngine::GetActionManager ( ) const
overridevirtual

Get the Action Manager. Allows a user to check the state of active actions.

Implements PhysiologyEngine.

◆ GetAnesthesiaMachine()

const SEAnesthesiaMachine * PulseEngine::GetAnesthesiaMachine ( ) const
overridevirtual

Returns the current state of the Anesthesia machine.

Implements PhysiologyEngine.

◆ GetBloodChemistrySystem()

const SEBloodChemistrySystem * PulseEngine::GetBloodChemistrySystem ( ) const
overridevirtual

Returns the current state of the Blood Chemistry System.

Implements PhysiologyEngine.

◆ GetCardiovascularSystem()

const SECardiovascularSystem * PulseEngine::GetCardiovascularSystem ( ) const
overridevirtual

Returns the current state of the Cardiovascular System.

Implements PhysiologyEngine.

◆ GetCompartments()

const SECompartmentManager & PulseEngine::GetCompartments ( ) const
overridevirtual

Retrieves the engine compartments, providing such data as: flows, pressure, volume as well as substance volumes and volume fractions.

Implements PhysiologyEngine.

◆ GetConditionManager()

const SEConditionManager & PulseEngine::GetConditionManager ( ) const
overridevirtual

Get the Condition Manager. Allows a user to check the state of active conditions.

Implements PhysiologyEngine.

◆ GetConfiguration()

const SEEngineConfiguration * PulseEngine::GetConfiguration ( ) const
overridevirtual

returns the engine configuration.

Implements PhysiologyEngine.

◆ GetController()

PulseController* PulseEngine::GetController ( )
inline

◆ GetDrugSystem()

const SEDrugSystem * PulseEngine::GetDrugSystem ( ) const
overridevirtual

Returns the current state of the drug system.

Implements PhysiologyEngine.

◆ GetElectroCardioGram()

const SEElectroCardioGram * PulseEngine::GetElectroCardioGram ( ) const
overridevirtual

Returns the current state of the Electrocardiogram machine.

Implements PhysiologyEngine.

◆ GetEndocrineSystem()

const SEEndocrineSystem * PulseEngine::GetEndocrineSystem ( ) const
overridevirtual

Returns the current state of the Endocrine System.

Implements PhysiologyEngine.

◆ GetEnergySystem()

const SEEnergySystem * PulseEngine::GetEnergySystem ( ) const
overridevirtual

Returns the current state of the Energy System.

Implements PhysiologyEngine.

◆ GetEngineTracker()

SEEngineTracker * PulseEngine::GetEngineTracker ( ) const
overridevirtual

Retrieve the SEEngineTracker associated with tracking data from this engine to a file The SEEngineTracker is a class set up to pull data requested from the engine (via SEDataRequest's) and provide access to the data easily (ex. to easily write data to csv files)

Implements PhysiologyEngine.

◆ GetEnvironment()

const SEEnvironment * PulseEngine::GetEnvironment ( ) const
overridevirtual

Returns the environment object used by the engine.

Implements PhysiologyEngine.

◆ GetEventManager()

const SEEventManager & PulseEngine::GetEventManager ( ) const
overridevirtual

Retrieves the associated event manager.

Implements PhysiologyEngine.

◆ GetGastrointestinalSystem()

const SEGastrointestinalSystem * PulseEngine::GetGastrointestinalSystem ( ) const
overridevirtual

Returns the current state of the Gastrointestinal System.

Implements PhysiologyEngine.

◆ GetHepaticSystem()

const SEHepaticSystem * PulseEngine::GetHepaticSystem ( ) const
overridevirtual

Returns the current state of the Hepatic System.

Implements PhysiologyEngine.

◆ GetInhaler()

const SEInhaler * PulseEngine::GetInhaler ( ) const
overridevirtual

Returns the current state of the Inhaler.

Implements PhysiologyEngine.

◆ GetInitialPatient()

const SEPatient & PulseEngine::GetInitialPatient ( ) const
overridevirtual

Returns the initial simulation patient object used by the engine.

Implements PhysiologyEngine.

◆ GetLogger()

Logger * PulseEngine::GetLogger ( ) const
overridevirtual

Retrieve the Logger associated with this engine.

Implements PhysiologyEngine.

◆ GetMechanicalVentilator()

const SEMechanicalVentilator * PulseEngine::GetMechanicalVentilator ( ) const
overridevirtual

Returns the current state of the Mechanical ventilator.

Implements PhysiologyEngine.

◆ GetNervousSystem()

const SENervousSystem * PulseEngine::GetNervousSystem ( ) const
overridevirtual

Returns the current state of the Nervous System.

Implements PhysiologyEngine.

◆ GetPatient()

const SEPatient & PulseEngine::GetPatient ( ) const
overridevirtual

Returns the patient object used by the engine.

Implements PhysiologyEngine.

◆ GetPatientAssessment()

bool PulseEngine::GetPatientAssessment ( SEPatientAssessment assessment) const
overridevirtual

Determines the assessment type and fills the data object with current data.

Assessments can be queried at any point in the calculation and as many times are desired.

Implements PhysiologyEngine.

◆ GetRenalSystem()

const SERenalSystem * PulseEngine::GetRenalSystem ( ) const
overridevirtual

Returns the current state of the Renal System.

Implements PhysiologyEngine.

◆ GetRespiratorySystem()

const SERespiratorySystem * PulseEngine::GetRespiratorySystem ( ) const
overridevirtual

Returns the current state of the Respiratory System.

Implements PhysiologyEngine.

◆ GetSimulationTime()

double PulseEngine::GetSimulationTime ( const TimeUnit unit) const
overridevirtual

returns the current time of the simulation.

Implements PhysiologyEngine.

◆ GetSubstanceManager()

const SESubstanceManager & PulseEngine::GetSubstanceManager ( ) const
overridevirtual

Retrieves the associated substance manager.

Implements PhysiologyEngine.

◆ GetTimeStep()

double PulseEngine::GetTimeStep ( const TimeUnit unit) const
overridevirtual

returns the engine time step that is used when advancing time.

Implements PhysiologyEngine.

◆ GetTissueSystem()

const SETissueSystem * PulseEngine::GetTissueSystem ( ) const
overridevirtual

Returns the current state of the tissue system.

Implements PhysiologyEngine.

◆ InitializeEngine() [1/2]

bool PulseEngine::InitializeEngine ( const std::string &  patient_configuration,
SerializationFormat  m 
)
overridevirtual

Initialize an engine based on the engines initialization structure.

An initialization structure is up to every engine. It should have a SEPatientConfiguration (or derivative) But it may also have more stuctures associated with it, it's up to the engine.

Implements PhysiologyEngine.

◆ InitializeEngine() [2/2]

bool PulseEngine::InitializeEngine ( const SEPatientConfiguration patient_configuration)
overridevirtual

This will create an engine that you can send instructions (patient,actions,conditions) to dynamically. The return value will indicate success failure of the creation of the engine. Some combinations of patients and conditions may prevent the engine from stabilizing.

Implements PhysiologyEngine.

◆ ProcessAction()

bool PulseEngine::ProcessAction ( const SEAction action)
overridevirtual

Execute the provided action. true will be returned if the engine supports the action false will be returned if the engine does not support the action.

Implements PhysiologyEngine.

◆ SerializeFromFile()

bool PulseEngine::SerializeFromFile ( const std::string &  file)
overridevirtual

Reset engine and set it to the state in the provided file. The file may contain json or binary. Anything but an extension of .json will be interpreted as binary. Return value indicates engine was able to load provided state file. Engine will be in a cleared state if this method fails.

Implements PhysiologyEngine.

◆ SerializeFromString()

bool PulseEngine::SerializeFromString ( const std::string &  state,
SerializationFormat  m 
)
overridevirtual

Reset engine and set it to the state in the provided string. The string can contain JSON or binary. Note that a string of bytes are binary, not text; we only use the string class as a convenient container. Return value indicates engine was able to load provided state file. Engine will be in a cleared state if this method fails.

Implements PhysiologyEngine.

◆ SerializeToFile()

bool PulseEngine::SerializeToFile ( const std::string &  filename) const
overridevirtual

Save the current state of the engine to provided filename. Using a .json extension will save a json/ascii file. Anything else will save as binary.

Implements PhysiologyEngine.

◆ SerializeToString()

bool PulseEngine::SerializeToString ( std::string &  state,
SerializationFormat  m 
) const
overridevirtual

Save the current state of the engine. The state can be saved as JSON or bytes in the given string. Note that the bytes are binary, not text; we only use the string class as a convenient container.

Implements PhysiologyEngine.

◆ SetAdvanceHandler()

void PulseEngine::SetAdvanceHandler ( SEAdvanceHandler handler)
overridevirtual

Add a callback object that will be called after each timestep.

Implements PhysiologyEngine.

◆ SetConfigurationOverride()

bool PulseEngine::SetConfigurationOverride ( const SEEngineConfiguration config)
overridevirtual

Engines can have a configuration for allowing a user to set certain internal parameters Engines with configurations will have all configuration parameters defaulted, This allow you to change one or more or those parameters. The parameters provided will be applied during SerializeFrom* and InitializeEngine methods. Use with caution! (Use nullptr to revert back to using all engine defaults)

Implements PhysiologyEngine.

◆ SetSimulationTime()

void PulseEngine::SetSimulationTime ( const SEScalarTime time)
overridevirtual

Set the current time of the simulation. Engine Simulation time will be advanced from this time point.

Implements PhysiologyEngine.

Member Data Documentation

◆ m_PulseController

PulseController* PulseEngine::m_PulseController
protected

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.