What’s New in the Pulse Physiology Engine 4.4.0
×
PhysiologyEngine.h
1/* Distributed under the Apache License, Version 2.0.
2 See accompanying NOTICE file for details.*/
3
4#pragma once
5#include "cdm/CommonDefs.h"
6#include "cdm/utils/Logger.h"
7
9class SEPatient;
12
13class SECondition;
14class SEAction;
15
19class SEDrugSystem;
21class SEEnergySystem;
23class SEHepaticSystem;
24class SENervousSystem;
25class SERenalSystem;
27class SETissueSystem;
28class SEEnvironment;
30class SEBagValveMask;
33class SEInhaler;
37class SEActionManager;
39class SEEventManager;
40
43
45
46enum class eEngineInitializationState
47{
48 Uninitialized = 0,
49 FailedState = 1,
50 FailedPatientSetup = 2,
51 FailedStabilization = 3,
52 Initialized = 4
53};
54extern CDM_DECL const std::string& eEngineInitializationState_Name(eEngineInitializationState s);
55
61{
63 : CommonDataModelException( "Physiology Engine Error" ) {}
64
65 PhysiologyEngineException(const std::string& _Message)
66 : CommonDataModelException(_Message) {}
67};
68
69class CDM_DECL PhysiologyEngine : public Loggable
70{
71public:
72 PhysiologyEngine(Logger* logger = nullptr) : Loggable(logger) {}
73 virtual ~PhysiologyEngine() = default;
74
75 //--------------------------------------------------------------------------------------------------
78 //--------------------------------------------------------------------------------------------------
79 virtual std::string GetTypeName() const = 0;
80
81 //--------------------------------------------------------------------------------------------------
91 //--------------------------------------------------------------------------------------------------
92 virtual bool SerializeFromFile(const std::string& file, const SEDataRequestManager* drMgr=nullptr) = 0;
93
94 //--------------------------------------------------------------------------------------------------
99 //--------------------------------------------------------------------------------------------------
100 virtual bool SerializeToFile(const std::string& filename) const = 0;
101
102 //--------------------------------------------------------------------------------------------------
112 //--------------------------------------------------------------------------------------------------
113 virtual bool SerializeFromString(const std::string& state, eSerializationFormat m, const SEDataRequestManager* drMgr=nullptr) = 0;
114
115 //--------------------------------------------------------------------------------------------------
120 //--------------------------------------------------------------------------------------------------
121 virtual bool SerializeToString(std::string& state, eSerializationFormat m) const = 0;
122
123 //--------------------------------------------------------------------------------------------------
130 //--------------------------------------------------------------------------------------------------
131 virtual bool InitializeEngine(const SEPatientConfiguration& patient_configuration, const SEDataRequestManager* drMgr=nullptr) = 0;
132
133 //--------------------------------------------------------------------------------------------------
138 //--------------------------------------------------------------------------------------------------
139 virtual eEngineInitializationState GetInitializationState() const = 0;
140
141 //--------------------------------------------------------------------------------------------------
146 //--------------------------------------------------------------------------------------------------
147 virtual void Clear() = 0;
148
149 //--------------------------------------------------------------------------------------------------
154 //--------------------------------------------------------------------------------------------------
155 virtual const SEConditionManager& GetConditionManager() const = 0;
156
157 //--------------------------------------------------------------------------------------------------
164 //--------------------------------------------------------------------------------------------------
165 virtual bool SetConfigurationOverride(const SEEngineConfiguration* config) = 0;
166
167 //--------------------------------------------------------------------------------------------------
170 //--------------------------------------------------------------------------------------------------
171 virtual const SEEngineConfiguration* GetConfiguration() const = 0;
172
173 //--------------------------------------------------------------------------------------------------
178 //--------------------------------------------------------------------------------------------------
180
181 //--------------------------------------------------------------------------------------------------
185 //--------------------------------------------------------------------------------------------------
186 virtual double GetTimeStep(const TimeUnit& unit) const = 0;
187
188 //--------------------------------------------------------------------------------------------------
191 //--------------------------------------------------------------------------------------------------
192 virtual double GetSimulationTime(const TimeUnit& unit) const = 0;
193
194 //--------------------------------------------------------------------------------------------------
197 //--------------------------------------------------------------------------------------------------
198 virtual double GetStabilizationTime(const TimeUnit& unit) const = 0;
199
200 //--------------------------------------------------------------------------------------------------
204 //--------------------------------------------------------------------------------------------------
205 virtual void SetSimulationTime(const SEScalarTime& time) = 0;
206
207 //--------------------------------------------------------------------------------------------------
214 //--------------------------------------------------------------------------------------------------
215 virtual bool AdvanceModelTime() = 0;
216
217 //--------------------------------------------------------------------------------------------------
225 //--------------------------------------------------------------------------------------------------
226 virtual bool AdvanceModelTime(double time, const TimeUnit& unit) = 0;
227
228 //--------------------------------------------------------------------------------------------------
231 //--------------------------------------------------------------------------------------------------
232 virtual void SetAdvanceHandler(SEAdvanceHandler* handler) = 0;
233
234 //--------------------------------------------------------------------------------------------------
240 //--------------------------------------------------------------------------------------------------
241 virtual bool ProcessAction(const SEAction& action) = 0;
242
243 //--------------------------------------------------------------------------------------------------
248 //--------------------------------------------------------------------------------------------------
249 virtual const SEActionManager& GetActionManager() const = 0;
250
251 //--------------------------------------------------------------------------------------------------
255 //--------------------------------------------------------------------------------------------------
256 virtual const SESubstanceManager& GetSubstanceManager() const = 0;
257
258 //--------------------------------------------------------------------------------------------------
262 //--------------------------------------------------------------------------------------------------
263 virtual const SEEventManager& GetEventManager() const = 0;
264
265 //--------------------------------------------------------------------------------------------------
269 //--------------------------------------------------------------------------------------------------
270 virtual const SEPatient& GetPatient() const = 0;
271
272 //--------------------------------------------------------------------------------------------------
276 //--------------------------------------------------------------------------------------------------
277 virtual const SEPatient& GetInitialPatient() const = 0;
278
279 //--------------------------------------------------------------------------------------------------
285 //--------------------------------------------------------------------------------------------------
286 virtual bool GetPatientAssessment(SEPatientAssessment& assessment) const = 0;
287
288 //--------------------------------------------------------------------------------------------------
292 //--------------------------------------------------------------------------------------------------
293 virtual const SEEnvironment* GetEnvironment() const = 0;
294
295 //--------------------------------------------------------------------------------------------------
299 //--------------------------------------------------------------------------------------------------
301
302 //--------------------------------------------------------------------------------------------------
306 //--------------------------------------------------------------------------------------------------
308
309 //--------------------------------------------------------------------------------------------------
313 //--------------------------------------------------------------------------------------------------
314 virtual const SEDrugSystem* GetDrugSystem() const = 0;
315
316 //--------------------------------------------------------------------------------------------------
320 //--------------------------------------------------------------------------------------------------
321 virtual const SEEndocrineSystem* GetEndocrineSystem() const = 0;
322
323 //--------------------------------------------------------------------------------------------------
327 //--------------------------------------------------------------------------------------------------
328 virtual const SEEnergySystem* GetEnergySystem() const = 0;
329
330 //--------------------------------------------------------------------------------------------------
334 //--------------------------------------------------------------------------------------------------
336
337 //--------------------------------------------------------------------------------------------------
341 //--------------------------------------------------------------------------------------------------
342 virtual const SEHepaticSystem* GetHepaticSystem() const = 0;
343
344 //--------------------------------------------------------------------------------------------------
348 //--------------------------------------------------------------------------------------------------
349 virtual const SENervousSystem* GetNervousSystem() const = 0;
350
351 //--------------------------------------------------------------------------------------------------
355 //--------------------------------------------------------------------------------------------------
356 virtual const SERenalSystem* GetRenalSystem() const = 0;
357
358 //--------------------------------------------------------------------------------------------------
362 //--------------------------------------------------------------------------------------------------
363 virtual const SERespiratorySystem* GetRespiratorySystem() const = 0;
364
365 //--------------------------------------------------------------------------------------------------
369 //--------------------------------------------------------------------------------------------------
370 virtual const SETissueSystem* GetTissueSystem() const = 0;
371
372 //--------------------------------------------------------------------------------------------------
376 //--------------------------------------------------------------------------------------------------
377 virtual const SEAnesthesiaMachine* GetAnesthesiaMachine() const = 0;
378
379 //--------------------------------------------------------------------------------------------------
383 //--------------------------------------------------------------------------------------------------
384 virtual const SEBagValveMask* GetBagValveMask() const = 0;
385
386 //--------------------------------------------------------------------------------------------------
390 //--------------------------------------------------------------------------------------------------
392
393 //--------------------------------------------------------------------------------------------------
397 //--------------------------------------------------------------------------------------------------
398 virtual const SEElectroCardioGram* GetElectroCardioGram() const = 0;
399
400 //--------------------------------------------------------------------------------------------------
404 //--------------------------------------------------------------------------------------------------
405 virtual const SEInhaler* GetInhaler() const = 0;
406
407 //--------------------------------------------------------------------------------------------------
411 //--------------------------------------------------------------------------------------------------
413
414 //--------------------------------------------------------------------------------------------------
419 //--------------------------------------------------------------------------------------------------
420 virtual const SECompartmentManager& GetCompartments() const = 0;
421
422 //--------------------------------------------------------------------------------------------------
429 //--------------------------------------------------------------------------------------------------
430 virtual SEBlackBoxManager& GetBlackBoxes() const = 0;
431};
Definition: Logger.h:23
Definition: Logger.h:71
Definition: PhysiologyEngine.h:70
virtual bool SetConfigurationOverride(const SEEngineConfiguration *config)=0
Engines can have a configuration for allowing a user to set certain internal parameters Engines with ...
virtual const SEEnvironment * GetEnvironment() const =0
Returns the environment object used by the engine.
virtual const SECompartmentManager & GetCompartments() const =0
Retrieves the engine compartments, providing such data as: flows, pressure, volume as well as substan...
virtual void SetSimulationTime(const SEScalarTime &time)=0
Set the current time of the simulation. Engine Simulation time will be advanced from this time point.
virtual double GetStabilizationTime(const TimeUnit &unit) const =0
returns the stabilization time of the simulation (if stabilized)
virtual const SEExtracorporealMembraneOxygenationDevice * GetExtracorporealMembraneOxygenationDevice() const =0
Returns the current state of the ECMO device.
PhysiologyEngine(Logger *logger=nullptr)
Definition: PhysiologyEngine.h:72
virtual double GetTimeStep(const TimeUnit &unit) const =0
returns the engine time step that is used when advancing time.
virtual ~PhysiologyEngine()=default
virtual const SEEventManager & GetEventManager() const =0
Retrieves the associated event manager.
virtual const SEDrugSystem * GetDrugSystem() const =0
Returns the current state of the drug system.
virtual const SEEndocrineSystem * GetEndocrineSystem() const =0
Returns the current state of the Endocrine System.
virtual bool SerializeToString(std::string &state, eSerializationFormat m) const =0
Save the current state of the engine. The state can be saved as JSON or bytes in the given string....
virtual bool InitializeEngine(const SEPatientConfiguration &patient_configuration, const SEDataRequestManager *drMgr=nullptr)=0
This will create an engine that you can send instructions (patient,actions,conditions) to dynamically...
virtual bool SerializeFromFile(const std::string &file, const SEDataRequestManager *drMgr=nullptr)=0
Reset engine and set it to the state in the provided file. The file may contain json or binary....
virtual double GetSimulationTime(const TimeUnit &unit) const =0
returns the current time of the simulation.
virtual const SEPatient & GetPatient() const =0
Returns the patient object used by the engine.
virtual const SEMechanicalVentilator * GetMechanicalVentilator() const =0
Returns the current state of the Mechanical ventilator.
virtual const SEPatient & GetInitialPatient() const =0
Returns the initial simulation patient object used by the engine.
virtual std::string GetTypeName() const =0
Returns the engine type, such as "Human Adult Whole Body".
virtual bool SerializeFromString(const std::string &state, eSerializationFormat m, const SEDataRequestManager *drMgr=nullptr)=0
Reset engine and set it to the state in the provided string. The string can contain JSON or binary....
virtual const SEInhaler * GetInhaler() const =0
Returns the current state of the Inhaler.
virtual void SetAdvanceHandler(SEAdvanceHandler *handler)=0
Add a callback object that will be called after each timestep.
virtual bool AdvanceModelTime(double time, const TimeUnit &unit)=0
executes time loop of the engine beginning at the current time and running for the duration specified...
virtual const SERespiratorySystem * GetRespiratorySystem() const =0
Returns the current state of the Respiratory System.
virtual const SEEngineConfiguration * GetConfiguration() const =0
returns the engine configuration.
virtual const SERenalSystem * GetRenalSystem() const =0
Returns the current state of the Renal System.
virtual const SETissueSystem * GetTissueSystem() const =0
Returns the current state of the tissue system.
virtual const SEHepaticSystem * GetHepaticSystem() const =0
Returns the current state of the Hepatic System.
virtual bool ProcessAction(const SEAction &action)=0
Execute the provided action. true will be returned if the engine supports the action false will be re...
virtual const SEAnesthesiaMachine * GetAnesthesiaMachine() const =0
Returns the current state of the Anesthesia machine.
virtual const SEEnergySystem * GetEnergySystem() const =0
Returns the current state of the Energy System.
virtual const SEElectroCardioGram * GetElectroCardioGram() const =0
Returns the current state of the Electrocardiogram machine.
virtual bool AdvanceModelTime()=0
executes one pass through the time loop of the engine at the fixed timestep
virtual const SEGastrointestinalSystem * GetGastrointestinalSystem() const =0
Returns the current state of the Gastrointestinal System.
virtual void Clear()=0
Closes out any files and resets state.
virtual const SEBagValveMask * GetBagValveMask() const =0
Returns the current state of the Bag Valve Mask.
virtual const SEBloodChemistrySystem * GetBloodChemistrySystem() const =0
Returns the current state of the Blood Chemistry System.
virtual bool GetPatientAssessment(SEPatientAssessment &assessment) const =0
Determines the assessment type and fills the data object with current data.
virtual SEDataRequestTracker & GetDataRequestTracker()=0
Retrieve the SEDataRequestTracker object associated with the provided data request manager The SEData...
virtual const SENervousSystem * GetNervousSystem() const =0
Returns the current state of the Nervous System.
virtual eEngineInitializationState GetInitializationState() const =0
Get a bit more detail as to how initialization went.
virtual const SEConditionManager & GetConditionManager() const =0
Get the Condition Manager. Allows a user to check the state of active conditions.
virtual SEBlackBoxManager & GetBlackBoxes() const =0
Retrieves the engine black box manager Black boxes allow users to inject or retrieve flows,...
virtual const SEActionManager & GetActionManager() const =0
Get the Action Manager. Allows a user to check the state of active actions.
virtual bool SerializeToFile(const std::string &filename) const =0
Save the current state of the engine to provided filename. Using a .json extension will save a json/a...
virtual const SESubstanceManager & GetSubstanceManager() const =0
Retrieves the associated substance manager.
virtual const SECardiovascularSystem * GetCardiovascularSystem() const =0
Returns the current state of the Cardiovascular System.
Definition: SEAction.h:14
Definition: SEActionManager.h:12
Definition: SEAdvanceHandler.h:8
Definition: SEAnesthesiaMachine.h:24
Definition: SEBagValveMask.h:14
Definition: SEBlackBoxManager.h:11
Definition: SEBloodChemistrySystem.h:10
Definition: SECardiovascularSystem.h:27
Definition: SECompartmentManager.h:25
Definition: SECondition.h:8
Definition: SEConditionManager.h:26
Definition: SEDataRequestManager.h:10
Definition: SEDataRequestTracker.h:75
Definition: SEDrugSystem.h:9
Definition: SEElectroCardioGram.h:9
Definition: SEEndocrineSystem.h:8
Definition: SEEnergySystem.h:8
Definition: SEEngineConfiguration.h:8
Definition: SEEnvironment.h:13
Definition: SEEventManager.h:131
Definition: SEExtracorporealMembraneOxygenationDevice.h:10
Definition: SEGastrointestinalSystem.h:9
Definition: SEHepaticSystem.h:8
Definition: SEInhaler.h:12
Definition: SEMechanicalVentilator.h:10
Definition: SENervousSystem.h:9
Data formed at a level of a clinicians report. This is high level data, such as a mean or generalized...
Definition: SEPatientAssessment.h:22
Definition: SEPatientConfiguration.h:11
Definition: SEPatient.h:13
Definition: SERenalSystem.h:8
Definition: SERespiratorySystem.h:44
Definition: SEScalarTime.h:28
Definition: SESubstanceManager.h:10
Definition: SETissueSystem.h:8
Definition: SEScalarTime.h:8
Definition: CommonDefs.h:126
Base exception class that all CDM classes throw when an error occurs.
Definition: PhysiologyEngine.h:61
PhysiologyEngineException()
Definition: PhysiologyEngine.h:62
PhysiologyEngineException(const std::string &_Message)
Definition: PhysiologyEngine.h:65

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.