<
The Pulse Team is excited to announce the Pulse Physiology Engine 4.1.0 release. Upgrade now to get the best in dynamic simulation.
×
SEEngineTracker.h
1 /* Distributed under the Apache License, Version 2.0.
2  See accompanying NOTICE file for details.*/
3 
4 #pragma once
5 
6 class DataTrack;
7 class SESystem;
8 class SEPatient;
9 class SEEnvironment;
10 class PhysiologyEngine;
11 class SEActionManager;
12 class SESubstanceManager;
14 class SEDataRequest;
16 class SEGasCompartment;
21 #include "cdm/properties/SEScalar.h"
22 
23 enum class CompartmentUpdate {None,
24  InFlow, OutFlow,
25  HeatTransferRateIn, HeatTransferRateOut,
26  Volume,Pressure,
27  Heat, Temperature,
28  VolumeFraction,
29  Mass, Concentration,
30  pH, Molarity,
31  PartialPressure, Saturation};
32 enum class TrackMode { CSV, Dynamic };
34 {
35  friend class SEEngineTracker;
37 
38 protected:
40  {
41  UpdateProperty = CompartmentUpdate::None;
42  GasCmpt = nullptr;
43  GasSubstance = nullptr;
44  LiquidCmpt = nullptr;
45  LiquidSubstance = nullptr;
46  ThermalCmpt = nullptr;
47  }
48 
49  void UpdateScalar();
50  void SetScalarRequest(const SEScalar& s, SEDataRequest& dr);
51 
52  size_t idx;
53  std::string Heading;
54 
55  // Compartment related variables
56  CompartmentUpdate UpdateProperty;
62  // Tissue cmpts don't have children and they don't have computed data that changes on call (like flow)
63 };
64 
65 class CDM_DECL SEEngineTracker : public Loggable
66 {
67 public:
69  virtual ~SEEngineTracker();
70 
71  void Clear();// Remove all requests and close the results file
72 
73  DataTrack& GetDataTrack();
74  SEActionManager& GetActionManager() { return m_ActionMgr; }
75  SESubstanceManager& GetSubstanceManager() { return m_SubMgr; }
76  SEDataRequestManager& GetDataRequestManager() { return *m_DataRequestMgr; }
77 
78  // Add a system to look for data in
79  void AddSystem(SESystem& system);
80 
81  void ResetFile();// Close file, so next Track Data will re hook up everything and make a new file
82 
83  bool ConnectRequest(SEDataRequest& dr, SEDataRequestScalar& ds);
84 
85  virtual void SetupRequests();
86  // Set to false if you have already pulled the latest values
87  virtual void LogRequestedValues(bool pullData=true);
88  virtual void TrackData(double currentTime_s=0);
89  virtual void PullData();
90  virtual bool TrackRequest(SEDataRequest& dr);
91  virtual void ForceConnection() { m_ForceConnection = true; }
92 
93  void SetTrackMode(TrackMode m) { m_Mode = m; }
94  TrackMode GetTrackMode() { return m_Mode; }
95 
96 
97  double GetValue(const SEDataRequest& dr) const;
98 
99 
100 protected:
101  const SEDataRequestScalar* GetScalar(const SEDataRequest& dr) const;
102 
103  TrackMode m_Mode= TrackMode::CSV;
106 
107  std::stringstream m_ss;
108  std::ofstream m_ResultsStream;
110 
115 
116  SEEnvironment* m_Environment = nullptr;
117  std::vector<SESystem*> m_PhysiologySystems;
118  SESystem* m_AnesthesiaMachine = nullptr;
119  SESystem* m_ECG = nullptr;
120  SESystem* m_Inhaler = nullptr;
121  SESystem* m_MechanicalVentilator = nullptr;
122  std::map<const SEDataRequest*, SEDataRequestScalar*> m_Request2Scalar;
123 };
Definition: SESubstanceManager.h:8
Definition: DataTrack.h:16
SEPatient & m_Patient
Definition: SEEngineTracker.h:111
std::map< const SEDataRequest *, SEDataRequestScalar * > m_Request2Scalar
Definition: SEEngineTracker.h:122
void SetTrackMode(TrackMode m)
Definition: SEEngineTracker.h:93
Definition: SEScalar.h:18
SELiquidCompartment * LiquidCmpt
Definition: SEEngineTracker.h:59
Definition: SEPatient.h:12
Definition: SEGasCompartment.h:13
std::vector< SESystem * > m_PhysiologySystems
Definition: SEEngineTracker.h:117
Definition: Logger.h:66
size_t idx
Definition: SEEngineTracker.h:52
TrackMode GetTrackMode()
Definition: SEEngineTracker.h:94
Definition: SEEngineTracker.h:65
SEActionManager & GetActionManager()
Definition: SEEngineTracker.h:74
std::stringstream m_ss
Definition: SEEngineTracker.h:107
If you want to querry what a scalar is and don&#39;t know what scalar type you have...
Definition: SEScalar.h:280
DataTrack * m_DataTrack
Definition: SEEngineTracker.h:105
Definition: SELiquidSubstanceQuantity.h:11
SEActionManager & m_ActionMgr
Definition: SEEngineTracker.h:112
Definition: SEActionManager.h:11
SEDataRequestManager * m_DataRequestMgr
Definition: SEEngineTracker.h:109
SEThermalCompartment * ThermalCmpt
Definition: SEEngineTracker.h:61
Definition: Logger.h:18
Definition: SELiquidCompartment.h:11
Definition: SECompartmentManager.h:24
std::ofstream m_ResultsStream
Definition: SEEngineTracker.h:108
bool m_ForceConnection
Definition: SEEngineTracker.h:104
Definition: SESystem.h:7
SEGasCompartment * GasCmpt
Definition: SEEngineTracker.h:57
Utility class to read a CSV file.
Definition: CSV.h:11
Definition: SEDataRequestManager.h:9
Definition: PhysiologyEngine.h:56
SESubstanceManager & GetSubstanceManager()
Definition: SEEngineTracker.h:75
SELiquidSubstanceQuantity * LiquidSubstance
Definition: SEEngineTracker.h:60
SEDataRequestManager & GetDataRequestManager()
Definition: SEEngineTracker.h:76
SECompartmentManager & m_CmptMgr
Definition: SEEngineTracker.h:114
virtual void ForceConnection()
Definition: SEEngineTracker.h:91
CompartmentUpdate UpdateProperty
Definition: SEEngineTracker.h:56
Definition: SEEnvironment.h:12
SESubstanceManager & m_SubMgr
Definition: SEEngineTracker.h:113
SEDataRequestScalar(Logger *logger)
Definition: SEEngineTracker.h:39
Definition: SEDataRequest.h:17
Definition: SEEngineTracker.h:33
Definition: SEDynamicStabilizationPropertyConvergence.h:8
Definition: SEGasSubstanceQuantity.h:9
Definition: SEThermalCompartment.h:11
std::string Heading
Definition: SEEngineTracker.h:53
SEGasSubstanceQuantity * GasSubstance
Definition: SEEngineTracker.h:58

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.