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