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 SESubstanceManager;
13 class SEDataRequest;
15 class SEGasCompartment;
20 #include "properties/SEScalar.h"
21 
22 enum class CompartmentUpdate {None,
23  InFlow, OutFlow,
24  HeatTransferRateIn, HeatTransferRateOut,
25  Volume,Pressure,
26  Heat, Temperature,
27  VolumeFraction,
28  Mass, Concentration,
29  pH, Molarity,
30  PartialPressure, Saturation};
31 enum class TrackMode { CSV, Dynamic };
33 {
34  friend class SEEngineTracker;
36 protected:
38  {
39  Heading.clear();
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 SetScalar(const SEScalar* s, SEDataRequest& dr);// SEScalar* in order to internnally throw error if the Track cannot find the requested property, it will pass in nullptr if it cannot find it
51 
52  std::string Heading;
53 
54  // Compartment related variables
55  CompartmentUpdate UpdateProperty;
61  // Tissue cmpts don't have children and they don't have computed data that changes on call (like flow)
62 };
63 
64 class CDM_DECL SEEngineTracker : public Loggable
65 {
66 public:
68  virtual ~SEEngineTracker();
69 
70  void Clear();// Remove all requests and close the results file
71 
72  DataTrack& GetDataTrack();
73  SEDataRequestManager& GetDataRequestManager() { return *m_DataRequestMgr; }
74 
75  void ResetFile();// Close file, so next Track Data will re hook up everything and make a new file
76 
77  bool ConnectRequest(SEDataRequest& dr, SEDataRequestScalar& ds);
78 
79  virtual void SetupRequests();
80  virtual void TrackData(double currentTime_s=0);
81  virtual void PullData();
82  virtual bool TrackRequest(SEDataRequest& dr);
83  virtual void ForceConnection() { m_ForceConnection = true; }
84 
85  void SetTrackMode(TrackMode m) { m_Mode = m; }
86  TrackMode GetTrackMode() { return m_Mode; }
87 
88  double GetValue(const SEDataRequest& dr) const;
89 
90 protected:
91  const SEDataRequestScalar* GetScalar(const SEDataRequest& dr) const;
92 
93  TrackMode m_Mode= TrackMode::CSV;
96 
97  std::stringstream m_ss;
98  std::ofstream m_ResultsStream;
100 
104 
106  std::vector<SESystem*> m_PhysiologySystems;
110  std::map<const SEDataRequest*, SEDataRequestScalar*> m_Request2Scalar;
111 };
Definition: SESubstanceManager.h:8
Definition: DataTrack.h:24
SEPatient & m_Patient
Definition: SEEngineTracker.h:101
std::map< const SEDataRequest *, SEDataRequestScalar * > m_Request2Scalar
Definition: SEEngineTracker.h:110
void SetTrackMode(TrackMode m)
Definition: SEEngineTracker.h:85
SESystem * m_Inhaler
Definition: SEEngineTracker.h:109
Definition: SEScalar.h:18
SELiquidCompartment * LiquidCmpt
Definition: SEEngineTracker.h:58
Definition: SEPatient.h:12
Definition: SEGasCompartment.h:12
std::vector< SESystem * > m_PhysiologySystems
Definition: SEEngineTracker.h:106
Definition: Logger.h:61
TrackMode GetTrackMode()
Definition: SEEngineTracker.h:86
Definition: SEEngineTracker.h:64
std::stringstream m_ss
Definition: SEEngineTracker.h:97
If you want to querry what a scalar is and don&#39;t know what scalar type you have...
Definition: SEScalar.h:201
DataTrack * m_DataTrack
Definition: SEEngineTracker.h:95
SESystem * m_ECG
Definition: SEEngineTracker.h:108
Definition: SELiquidSubstanceQuantity.h:11
SEDataRequestManager * m_DataRequestMgr
Definition: SEEngineTracker.h:99
SEThermalCompartment * ThermalCmpt
Definition: SEEngineTracker.h:60
Definition: Logger.h:11
Definition: SELiquidCompartment.h:10
Definition: SECompartmentManager.h:24
std::ofstream m_ResultsStream
Definition: SEEngineTracker.h:98
bool m_ForceConnection
Definition: SEEngineTracker.h:94
Definition: SESystem.h:7
SEGasCompartment * GasCmpt
Definition: SEEngineTracker.h:56
Definition: SEDataRequestManager.h:9
Definition: PhysiologyEngine.h:51
SELiquidSubstanceQuantity * LiquidSubstance
Definition: SEEngineTracker.h:59
SEDataRequestManager & GetDataRequestManager()
Definition: SEEngineTracker.h:73
SECompartmentManager & m_CmptMgr
Definition: SEEngineTracker.h:103
virtual void ForceConnection()
Definition: SEEngineTracker.h:83
CompartmentUpdate UpdateProperty
Definition: SEEngineTracker.h:55
SEEnvironment * m_Environment
Definition: SEEngineTracker.h:105
Definition: SEEnvironment.h:12
SESubstanceManager & m_SubMgr
Definition: SEEngineTracker.h:102
SEDataRequestScalar(Logger *logger)
Definition: SEEngineTracker.h:37
Definition: SEDataRequest.h:17
Definition: SEEngineTracker.h:32
Definition: SEDynamicStabilizationPropertyConvergence.h:8
SESystem * m_AnesthesiaMachine
Definition: SEEngineTracker.h:107
Definition: SEGasSubstanceQuantity.h:9
Definition: SEThermalCompartment.h:10
std::string Heading
Definition: SEEngineTracker.h:52
SEGasSubstanceQuantity * GasSubstance
Definition: SEEngineTracker.h:57

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.