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;
31class SEECMO;
33class SEInhaler;
37class SEActionManager;
39class SEEventManager;
40
41class SEEngineTracker;
43
49{
51 : CommonDataModelException( "Physiology Engine Error" ) {}
52
53 PhysiologyEngineException(const std::string& _Message)
54 : CommonDataModelException(_Message) {}
55};
56
57class CDM_DECL PhysiologyEngine : public Loggable
58{
59public:
60 PhysiologyEngine(Logger* logger = nullptr) : Loggable(logger) {}
61 virtual ~PhysiologyEngine() {}
62
63 //--------------------------------------------------------------------------------------------------
66 //--------------------------------------------------------------------------------------------------
67 virtual std::string GetTypeName() const = 0;
68
69 //--------------------------------------------------------------------------------------------------
76 //--------------------------------------------------------------------------------------------------
77 virtual bool SerializeFromFile(const std::string& file) = 0;
78
79 //--------------------------------------------------------------------------------------------------
84 //--------------------------------------------------------------------------------------------------
85 virtual bool SerializeToFile(const std::string& filename) const = 0;
86
87 //--------------------------------------------------------------------------------------------------
94 //--------------------------------------------------------------------------------------------------
95 virtual bool SerializeFromString(const std::string& state, eSerializationFormat m) = 0;
96
97 //--------------------------------------------------------------------------------------------------
102 //--------------------------------------------------------------------------------------------------
103 virtual bool SerializeToString(std::string& state, eSerializationFormat m) const = 0;
104
105 //--------------------------------------------------------------------------------------------------
113 //--------------------------------------------------------------------------------------------------
114 virtual bool InitializeEngine(const std::string& patient_configuration, eSerializationFormat m) = 0;
115
116 //--------------------------------------------------------------------------------------------------
123 //--------------------------------------------------------------------------------------------------
124 virtual bool InitializeEngine(const SEPatientConfiguration& patient_configuration) = 0;
125
126 //--------------------------------------------------------------------------------------------------
131 //--------------------------------------------------------------------------------------------------
132 virtual void Clear() = 0;
133
134 //--------------------------------------------------------------------------------------------------
139 //--------------------------------------------------------------------------------------------------
140 virtual const SEConditionManager& GetConditionManager() const = 0;
141
142 //--------------------------------------------------------------------------------------------------
149 //--------------------------------------------------------------------------------------------------
150 virtual bool SetConfigurationOverride(const SEEngineConfiguration* config) = 0;
151
152 //--------------------------------------------------------------------------------------------------
155 //--------------------------------------------------------------------------------------------------
156 virtual const SEEngineConfiguration* GetConfiguration() const = 0;
157
158 //--------------------------------------------------------------------------------------------------
163 //--------------------------------------------------------------------------------------------------
164 virtual SEEngineTracker* GetEngineTracker() const = 0;
165
166 //--------------------------------------------------------------------------------------------------
170 //--------------------------------------------------------------------------------------------------
171 virtual double GetTimeStep(const TimeUnit& unit) const = 0;
172
173 //--------------------------------------------------------------------------------------------------
176 //--------------------------------------------------------------------------------------------------
177 virtual double GetSimulationTime(const TimeUnit& unit) const = 0;
178
179 //--------------------------------------------------------------------------------------------------
183 //--------------------------------------------------------------------------------------------------
184 virtual void SetSimulationTime(const SEScalarTime& time) = 0;
185
186 //--------------------------------------------------------------------------------------------------
193 //--------------------------------------------------------------------------------------------------
194 virtual bool AdvanceModelTime() = 0;
195
196 //--------------------------------------------------------------------------------------------------
204 //--------------------------------------------------------------------------------------------------
205 virtual bool AdvanceModelTime(double time, const TimeUnit& unit) = 0;
206
207 //--------------------------------------------------------------------------------------------------
210 //--------------------------------------------------------------------------------------------------
211 virtual void SetAdvanceHandler(SEAdvanceHandler* handler) = 0;
212
213 //--------------------------------------------------------------------------------------------------
219 //--------------------------------------------------------------------------------------------------
220 virtual bool ProcessAction(const SEAction& action) = 0;
221
222 //--------------------------------------------------------------------------------------------------
227 //--------------------------------------------------------------------------------------------------
228 virtual const SEActionManager& GetActionManager() const = 0;
229
230 //--------------------------------------------------------------------------------------------------
234 //--------------------------------------------------------------------------------------------------
235 virtual const SESubstanceManager& GetSubstanceManager() const = 0;
236
237 //--------------------------------------------------------------------------------------------------
241 //--------------------------------------------------------------------------------------------------
242 virtual const SEEventManager& GetEventManager() const = 0;
243
244 //--------------------------------------------------------------------------------------------------
248 //--------------------------------------------------------------------------------------------------
249 virtual const SEPatient& GetPatient() const = 0;
250
251 //--------------------------------------------------------------------------------------------------
255 //--------------------------------------------------------------------------------------------------
256 virtual const SEPatient& GetInitialPatient() const = 0;
257
258 //--------------------------------------------------------------------------------------------------
264 //--------------------------------------------------------------------------------------------------
265 virtual bool GetPatientAssessment(SEPatientAssessment& assessment) const = 0;
266
267 //--------------------------------------------------------------------------------------------------
271 //--------------------------------------------------------------------------------------------------
272 virtual const SEEnvironment* GetEnvironment() const = 0;
273
274 //--------------------------------------------------------------------------------------------------
278 //--------------------------------------------------------------------------------------------------
280
281 //--------------------------------------------------------------------------------------------------
285 //--------------------------------------------------------------------------------------------------
287
288 //--------------------------------------------------------------------------------------------------
292 //--------------------------------------------------------------------------------------------------
293 virtual const SEDrugSystem* GetDrugSystem() const = 0;
294
295 //--------------------------------------------------------------------------------------------------
299 //--------------------------------------------------------------------------------------------------
300 virtual const SEEndocrineSystem* GetEndocrineSystem() const = 0;
301
302 //--------------------------------------------------------------------------------------------------
306 //--------------------------------------------------------------------------------------------------
307 virtual const SEEnergySystem* GetEnergySystem() const = 0;
308
309 //--------------------------------------------------------------------------------------------------
313 //--------------------------------------------------------------------------------------------------
315
316 //--------------------------------------------------------------------------------------------------
320 //--------------------------------------------------------------------------------------------------
321 virtual const SEHepaticSystem* GetHepaticSystem() const = 0;
322
323 //--------------------------------------------------------------------------------------------------
327 //--------------------------------------------------------------------------------------------------
328 virtual const SENervousSystem* GetNervousSystem() const = 0;
329
330 //--------------------------------------------------------------------------------------------------
334 //--------------------------------------------------------------------------------------------------
335 virtual const SERenalSystem* GetRenalSystem() const = 0;
336
337 //--------------------------------------------------------------------------------------------------
341 //--------------------------------------------------------------------------------------------------
342 virtual const SERespiratorySystem* GetRespiratorySystem() const = 0;
343
344 //--------------------------------------------------------------------------------------------------
348 //--------------------------------------------------------------------------------------------------
349 virtual const SETissueSystem* GetTissueSystem() const = 0;
350
351 //--------------------------------------------------------------------------------------------------
355 //--------------------------------------------------------------------------------------------------
356 virtual const SEAnesthesiaMachine* GetAnesthesiaMachine() const = 0;
357
358 //--------------------------------------------------------------------------------------------------
362 //--------------------------------------------------------------------------------------------------
363 virtual const SEBagValveMask* GetBagValveMask() const = 0;
364
365 //--------------------------------------------------------------------------------------------------
369 //--------------------------------------------------------------------------------------------------
370 virtual const SEECMO* GetECMO() const = 0;
371
372 //--------------------------------------------------------------------------------------------------
376 //--------------------------------------------------------------------------------------------------
377 virtual const SEElectroCardioGram* GetElectroCardioGram() const = 0;
378
379 //--------------------------------------------------------------------------------------------------
383 //--------------------------------------------------------------------------------------------------
384 virtual const SEInhaler* GetInhaler() const = 0;
385
386 //--------------------------------------------------------------------------------------------------
390 //--------------------------------------------------------------------------------------------------
392
393 //--------------------------------------------------------------------------------------------------
398 //--------------------------------------------------------------------------------------------------
399 virtual const SECompartmentManager& GetCompartments() const = 0;
400
401 //--------------------------------------------------------------------------------------------------
408 //--------------------------------------------------------------------------------------------------
409 virtual SEBlackBoxManager& GetBlackBoxes() const = 0;
410};
Definition: Logger.h:23
Definition: Logger.h:71
Definition: PhysiologyEngine.h:58
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 const SEECMO * GetECMO() const =0
Returns the current state of the ECMO machine.
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 bool SerializeFromFile(const std::string &file)=0
Reset engine and set it to the state in the provided file. The file may contain json or binary....
PhysiologyEngine(Logger *logger=nullptr)
Definition: PhysiologyEngine.h:60
virtual double GetTimeStep(const TimeUnit &unit) const =0
returns the engine time step that is used when advancing time.
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 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 bool InitializeEngine(const SEPatientConfiguration &patient_configuration)=0
This will create an engine that you can send instructions (patient,actions,conditions) to dynamically...
virtual std::string GetTypeName() const =0
Returns the engine type, such as "Human Adult Whole Body".
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 SEEngineTracker * GetEngineTracker() const =0
Retrieve the SEEngineTracker associated with tracking data from this engine to a file The SEEngineTra...
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 ~PhysiologyEngine()
Definition: PhysiologyEngine.h:61
virtual const SENervousSystem * GetNervousSystem() const =0
Returns the current state of the Nervous System.
virtual const SEConditionManager & GetConditionManager() const =0
Get the Condition Manager. Allows a user to check the state of active conditions.
virtual bool SerializeFromString(const std::string &state, eSerializationFormat m)=0
Reset engine and set it to the state in the provided string. The string can contain JSON or binary....
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 InitializeEngine(const std::string &patient_configuration, eSerializationFormat m)=0
Initialize an engine based on the engines initialization structure.
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:24
Definition: SECompartmentManager.h:25
Definition: SECondition.h:8
Definition: SEConditionManager.h:25
Definition: SEDrugSystem.h:9
Definition: SEECMO.h:10
Definition: SEElectroCardioGram.h:9
Definition: SEEndocrineSystem.h:8
Definition: SEEnergySystem.h:8
Definition: SEEngineConfiguration.h:8
Definition: SEEngineTracker.h:66
Definition: SEEnvironment.h:13
Definition: SEEventManager.h:109
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:9
Definition: SEScalarTime.h:28
Definition: SESubstanceManager.h:9
Definition: SETissueSystem.h:8
Definition: SEScalarTime.h:8
Definition: CommonDefs.h:138
Base exception class that all CDM classes throw when an error occurs.
Definition: PhysiologyEngine.h:49
PhysiologyEngineException()
Definition: PhysiologyEngine.h:50
PhysiologyEngineException(const std::string &_Message)
Definition: PhysiologyEngine.h:53

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.