Building Medical Digital Twins with Pulse: Open Source Simulation Tools for Developers and Researchers
×
Systems.h
1 /* Distributed under the Apache License, Version 2.0.
2 See accompanying NOTICE file for details.*/
3 
4 #pragma once
5 
6 #include "engine/CommonDefs.h"
7 #include "engine/common/controller/Controller.h"
8 #include "cdm/system/physiology/SEBloodChemistrySystem.h"
9 #include "cdm/system/physiology/SECardiovascularSystem.h"
10 #include "cdm/system/physiology/SEDrugSystem.h"
11 #include "cdm/system/physiology/SEEndocrineSystem.h"
12 #include "cdm/system/physiology/SEEnergySystem.h"
13 #include "cdm/system/physiology/SEGastrointestinalSystem.h"
14 #include "cdm/system/physiology/SEHepaticSystem.h"
15 #include "cdm/system/physiology/SENervousSystem.h"
16 #include "cdm/system/physiology/SERenalSystem.h"
17 #include "cdm/system/physiology/SERespiratorySystem.h"
18 #include "cdm/system/physiology/SETissueSystem.h"
19 #include "cdm/system/environment/SEEnvironment.h"
20 #include "cdm/system/equipment/anesthesia_machine/SEAnesthesiaMachine.h"
21 #include "cdm/system/equipment/bag_valve_mask/SEBagValveMask.h"
22 #include "cdm/system/equipment/ecmo/SEECMO.h"
23 #include "cdm/system/equipment/electrocardiogram/SEElectroCardioGram.h"
24 #include "cdm/system/equipment/inhaler/SEInhaler.h"
25 #include "cdm/system/equipment/mechanical_ventilator/SEMechanicalVentilator.h"
26 #include "cdm/properties/SEScalarVolumePerPressure.h"
27 #include "cdm/properties/SEScalarPressureTimePerVolume.h"
28 
29 // These classes are used to expose any methodology specific data to end users
30 // This data would not belong in the cdm, and it's not a clinical assessment, nor on a compartment
31 // It is data specific to the system implementation
32 // Users only get this data if they are using the pulse engine
33 // They should only contain const pure vitrual methods
34 
35 
36 namespace pulse
37 {
38  class PULSE_DECL BloodChemistrySystem : public SEBloodChemistrySystem
39  {
40  public:
41  BloodChemistrySystem(Logger* logger=nullptr) : SEBloodChemistrySystem(logger) {}
42  virtual ~BloodChemistrySystem() = default;
43 
44  void Clear() override
45  {
47  }
48 
49  virtual const SEScalar* GetScalar(const std::string& name) override
50  {
52  if (s != nullptr)
53  return s;
54  // Check to see if this a model specific request
55  //if (name.compare("ModelParameter") == 0)
56  // return m_ModelParameter;
57  return nullptr;
58  }
59  virtual void ComputeExposedModelParameters()=0;
60  protected:
61  //SEScalar m_ModelParameter;
62  };
63 
64  class PULSE_DECL CardiovascularSystem : public SECardiovascularSystem
65  {
66  public:
67  CardiovascularSystem(Logger* logger=nullptr) : SECardiovascularSystem(logger) {}
68  virtual ~CardiovascularSystem() = default;
69 
70  void Clear() override
71  {
73  }
74 
75  virtual const SEScalar* GetScalar(const std::string & name) override
76  {
78  if (s != nullptr)
79  return s;
80  // Check to see if this a model specific request
81  //if (name.compare("ModelParameter") == 0)
82  // return m_ModelParameter;
83  return nullptr;
84  }
85  virtual void ComputeExposedModelParameters() = 0;
86  protected:
87  //SEScalar m_ModelParameter;
88  };
89 
90  class PULSE_DECL DrugSystem : public SEDrugSystem
91  {
92  public:
93  DrugSystem(Logger* logger=nullptr) : SEDrugSystem(logger) {}
94  virtual ~DrugSystem() = default;
95 
96  void Clear() override
97  {
99  }
100 
101  virtual const SEScalar* GetScalar(const std::string & name) override
102  {
103  const SEScalar* s = SEDrugSystem::GetScalar(name);
104  if (s != nullptr)
105  return s;
106  // Check to see if this a model specific request
107  //if (name.compare("ModelParameter") == 0)
108  // return m_ModelParameter;
109  return nullptr;
110  }
111  virtual void ComputeExposedModelParameters() = 0;
112  protected:
113  //SEScalar m_ModelParameter;
114  };
115 
116  class PULSE_DECL EndocrineSystem : public SEEndocrineSystem
117  {
118  public:
119  EndocrineSystem(Logger* logger=nullptr) : SEEndocrineSystem(logger) {}
120  virtual ~EndocrineSystem() = default;
121 
122  void Clear() override
123  {
125  }
126 
127  virtual const SEScalar* GetScalar(const std::string & name) override
128  {
129  const SEScalar* s = SEEndocrineSystem::GetScalar(name);
130  if (s != nullptr)
131  return s;
132  // Check to see if this a model specific request
133  //if (name.compare("ModelParameter") == 0)
134  // return m_ModelParameter;
135  return nullptr;
136  }
137  virtual void ComputeExposedModelParameters() = 0;
138  protected:
139  //SEScalar m_ModelParameter;
140  };
141 
142  class PULSE_DECL EnergySystem : public SEEnergySystem
143  {
144  public:
145  EnergySystem(Logger* logger=nullptr) : SEEnergySystem(logger) {}
146  virtual ~EnergySystem() = default;
147 
148  void Clear() override
149  {
151  }
152 
153  virtual const SEScalar* GetScalar(const std::string & name) override
154  {
155  const SEScalar* s = SEEnergySystem::GetScalar(name);
156  if (s != nullptr)
157  return s;
158  // Check to see if this a model specific request
159  //if (name.compare("ModelParameter") == 0)
160  // return m_ModelParameter;
161  return nullptr;
162  }
163  virtual void ComputeExposedModelParameters() = 0;
164  protected:
165  //SEScalar m_ModelParameter;
166  };
167 
168  class PULSE_DECL GastrointestinalSystem : public SEGastrointestinalSystem
169  {
170  public:
171  GastrointestinalSystem(Logger* logger=nullptr) : SEGastrointestinalSystem(logger) {}
172  virtual ~GastrointestinalSystem() = default;
173 
174  void Clear() override
175  {
177  }
178 
179  virtual const SEScalar* GetScalar(const std::string & name) override
180  {
182  if (s != nullptr)
183  return s;
184  // Check to see if this a model specific request
185  //if (name.compare("ModelParameter") == 0)
186  // return m_ModelParameter;
187  return nullptr;
188  }
189  virtual void ComputeExposedModelParameters() = 0;
190  protected:
191  //SEScalar m_ModelParameter;
192  };
193 
194  class PULSE_DECL HepaticSystem : public SEHepaticSystem
195  {
196  public:
197  HepaticSystem(Logger* logger=nullptr) : SEHepaticSystem(logger) {}
198  virtual ~HepaticSystem() = default;
199 
200  void Clear() override
201  {
203  }
204 
205  virtual const SEScalar* GetScalar(const std::string & name) override
206  {
207  const SEScalar* s = SEHepaticSystem::GetScalar(name);
208  if (s != nullptr)
209  return s;
210  // Check to see if this a model specific request
211  //if (name.compare("ModelParameter") == 0)
212  // return m_ModelParameter;
213  return nullptr;
214  }
215  virtual void ComputeExposedModelParameters() = 0;
216  protected:
217  //SEScalar m_ModelParameter;
218  };
219 
220  class PULSE_DECL NervousSystem : public SENervousSystem
221  {
222  public:
223  NervousSystem(Logger* logger=nullptr) : SENervousSystem(logger) {}
224  virtual ~NervousSystem() = default;
225 
226  void Clear() override
227  {
229  }
230 
231  virtual const SEScalar* GetScalar(const std::string & name) override
232  {
233  const SEScalar* s = SENervousSystem::GetScalar(name);
234  if (s != nullptr)
235  return s;
236  // Check to see if this a model specific request
237  //if (name.compare("ModelParameter") == 0)
238  // return m_ModelParameter;
239  return nullptr;
240  }
241  virtual void ComputeExposedModelParameters() = 0;
242  protected:
243  //SEScalar m_ModelParameter;
244  };
245 
246  class PULSE_DECL RenalSystem : public SERenalSystem
247  {
248  public:
249  RenalSystem(Logger* logger=nullptr) : SERenalSystem(logger) {}
250  virtual ~RenalSystem() = default;
251 
252  void Clear() override
253  {
255  }
256 
257  virtual const SEScalar* GetScalar(const std::string & name) override
258  {
259  const SEScalar* s = SERenalSystem::GetScalar(name);
260  if (s != nullptr)
261  return s;
262  // Check to see if this a model specific request
263  //if (name.compare("ModelParameter") == 0)
264  // return m_ModelParameter;
265  return nullptr;
266  }
267  virtual void ComputeExposedModelParameters() = 0;
268  protected:
269  //SEScalar m_ModelParameter;
270  };
271 
272  class PULSE_DECL RespiratorySystem : public SERespiratorySystem
273  {
274  public:
275  RespiratorySystem(Logger* logger=nullptr) : SERespiratorySystem(logger) {}
276  virtual ~RespiratorySystem() = default;
277 
278  void Clear() override
279  {
281  m_TotalRespiratoryModelCompliance.Invalidate();
282  m_TotalRespiratoryModelInspiratoryResistance.Invalidate();
283  m_TotalRespiratoryModelExpiratoryResistance.Invalidate();
284  }
285 
286  virtual const SEScalar* GetScalar(const std::string & name) override
287  {
288  const SEScalar* s = SERespiratorySystem::GetScalar(name);
289  if (s != nullptr)
290  return s;
291  // Check to see if this a model specific request
292  if (name.compare("TotalRespiratoryModelCompliance") == 0)
293  return &m_TotalRespiratoryModelCompliance;
294  if (name.compare("TotalRespiratoryModelInspiratoryResistance") == 0)
295  return &m_TotalRespiratoryModelInspiratoryResistance;
296  if (name.compare("TotalRespiratoryModelExpiratoryResistance") == 0)
297  return &m_TotalRespiratoryModelExpiratoryResistance;
298  return nullptr;
299  }
300  virtual void ComputeExposedModelParameters() = 0;
301 
302  DEFINE_UNIT_SCALAR(TotalRespiratoryModelCompliance, VolumePerPressure);
303  DEFINE_UNIT_SCALAR(TotalRespiratoryModelInspiratoryResistance, PressureTimePerVolume);
304  DEFINE_UNIT_SCALAR(TotalRespiratoryModelExpiratoryResistance, PressureTimePerVolume);
305  };
306 
307  class PULSE_DECL TissueSystem : public SETissueSystem
308  {
309  public:
310  TissueSystem(Logger* logger=nullptr) : SETissueSystem(logger) {}
311  virtual ~TissueSystem() = default;
312 
313  void Clear() override
314  {
316  }
317 
318  virtual const SEScalar* GetScalar(const std::string & name) override
319  {
320  const SEScalar* s = SETissueSystem::GetScalar(name);
321  if (s != nullptr)
322  return s;
323  // Check to see if this a model specific request
324  //if (name.compare("ModelParameter") == 0)
325  // return m_ModelParameter;
326  return nullptr;
327  }
328  virtual void ComputeExposedModelParameters() = 0;
329  protected:
330  //SEScalar m_ModelParameter;
331  };
332 
333  class PULSE_DECL EnvironmentSystem : public SEEnvironment
334  {
335  public:
336  EnvironmentSystem(Logger* logger=nullptr) : SEEnvironment(logger) {}
337  virtual ~EnvironmentSystem() = default;
338 
339  void Clear() override
340  {
342  }
343 
344  virtual const SEScalar* GetScalar(const std::string & name) override
345  {
346  const SEScalar* s = SEEnvironment::GetScalar(name);
347  if (s != nullptr)
348  return s;
349  // Check to see if this a model specific request
350  //if (name.compare("ModelParameter") == 0)
351  // return m_ModelParameter;
352  return nullptr;
353  }
354  virtual void ComputeExposedModelParameters() = 0;
355  protected:
356  //SEScalar m_ModelParameter;
357  };
358 
359  class PULSE_DECL AnesthesiaMachineSystem : public SEAnesthesiaMachine
360  {
361  public:
362  AnesthesiaMachineSystem(Logger* logger=nullptr) : SEAnesthesiaMachine(logger) {}
363  virtual ~AnesthesiaMachineSystem() = default;
364 
365  void Clear() override
366  {
368  }
369 
370  virtual const SEScalar* GetScalar(const std::string & name) override
371  {
372  const SEScalar* s = SEAnesthesiaMachine::GetScalar(name);
373  if (s != nullptr)
374  return s;
375  // Check to see if this a model specific request
376  //if (name.compare("ModelParameter") == 0)
377  // return m_ModelParameter;
378  return nullptr;
379  }
380  virtual void ComputeExposedModelParameters() = 0;
381  protected:
382  //SEScalar m_ModelParameter;
383  };
384 
385  class PULSE_DECL BagValveMaskSystem : public SEBagValveMask
386  {
387  public:
388  BagValveMaskSystem(Logger* logger = nullptr) : SEBagValveMask(logger) {}
389  virtual ~BagValveMaskSystem() = default;
390 
391  void Clear() override
392  {
394  }
395 
396  virtual const SEScalar* GetScalar(const std::string& name) override
397  {
398  const SEScalar* s = SEBagValveMask::GetScalar(name);
399  if (s != nullptr)
400  return s;
401  // Check to see if this a model specific request
402  //if (name.compare("ModelParameter") == 0)
403  // return m_ModelParameter;
404  return nullptr;
405  }
406  virtual void ComputeExposedModelParameters() = 0;
407  protected:
408  //SEScalar m_ModelParameter;
409  };
410 
411  class PULSE_DECL ECMOSystem : public SEECMO
412  {
413  public:
414  ECMOSystem(Logger* logger=nullptr) : SEECMO(logger) {}
415  virtual ~ECMOSystem() = default;
416 
417  void Clear() override
418  {
419  SEECMO::Clear();
420  }
421 
422  virtual const SEScalar* GetScalar(const std::string & name) override
423  {
424  const SEScalar* s = SEECMO::GetScalar(name);
425  if (s != nullptr)
426  return s;
427  // Check to see if this a model specific request
428  //if (name.compare("ModelParameter") == 0)
429  // return m_ModelParameter;
430  return nullptr;
431  }
432  virtual void ComputeExposedModelParameters() = 0;
433  protected:
434  //SEScalar m_ModelParameter;
435  };
436 
437  class PULSE_DECL ElectroCardioGramSystem : public SEElectroCardioGram
438  {
439  public:
440  ElectroCardioGramSystem(Logger* logger=nullptr) : SEElectroCardioGram(logger) {}
441  virtual ~ElectroCardioGramSystem() = default;
442 
443  void Clear() override
444  {
446  }
447 
448  virtual const SEScalar* GetScalar(const std::string & name) override
449  {
450  const SEScalar* s = SEElectroCardioGram::GetScalar(name);
451  if (s != nullptr)
452  return s;
453  // Check to see if this a model specific request
454  //if (name.compare("ModelParameter") == 0)
455  // return m_ModelParameter;
456  return nullptr;
457  }
458  virtual void ComputeExposedModelParameters() = 0;
459  protected:
460  //SEScalar m_ModelParameter;
461  };
462 
463  class PULSE_DECL InhalerSystem : public SEInhaler
464  {
465  public:
466  InhalerSystem(Logger* logger=nullptr) : SEInhaler(logger) {}
467  virtual ~InhalerSystem() = default;
468 
469  void Clear() override
470  {
472  }
473 
474  virtual const SEScalar* GetScalar(const std::string & name) override
475  {
476  const SEScalar* s = SEInhaler::GetScalar(name);
477  if (s != nullptr)
478  return s;
479  // Check to see if this a model specific request
480  //if (name.compare("ModelParameter") == 0)
481  // return m_ModelParameter;
482  return nullptr;
483  }
484  virtual void ComputeExposedModelParameters() = 0;
485  protected:
486  //SEScalar m_ModelParameter;
487  };
488 
489  class PULSE_DECL MechanicalVentilatorSystem : public SEMechanicalVentilator
490  {
491  public:
492  MechanicalVentilatorSystem(Logger* logger=nullptr) : SEMechanicalVentilator(logger) {}
493  virtual ~MechanicalVentilatorSystem() = default;
494 
495  void Clear() override
496  {
498  }
499 
500  virtual const SEScalar* GetScalar(const std::string & name) override
501  {
503  if (s != nullptr)
504  return s;
505  // Check to see if this a model specific request
506  //if (name.compare("ModelParameter") == 0)
507  // return m_ModelParameter;
508  return nullptr;
509  }
510  virtual void ComputeExposedModelParameters() = 0;
511  protected:
512  //SEScalar m_ModelParameter;
513  };
514 END_NAMESPACE
Definition: Logger.h:71
Definition: SEAnesthesiaMachine.h:24
const SEScalar * GetScalar(const std::string &name) override
Definition: SEAnesthesiaMachine.cpp:137
void Clear() override
Definition: SEAnesthesiaMachine.cpp:57
Definition: SEBagValveMask.h:14
const SEScalar * GetScalar(const std::string &name) override
Definition: SEBagValveMask.cpp:184
void Clear() override
Definition: SEBagValveMask.cpp:59
Definition: SEBloodChemistrySystem.h:10
const SEScalar * GetScalar(const std::string &name) override
A reflextion type call that will return the Scalar associated with the string. ex....
Definition: SEBloodChemistrySystem.cpp:143
void Clear() override
Deletes all members.
Definition: SEBloodChemistrySystem.cpp:101
Definition: SECardiovascularSystem.h:24
const SEScalar * GetScalar(const std::string &name) override
Definition: SECardiovascularSystem.cpp:152
void Clear() override
Definition: SECardiovascularSystem.cpp:108
Definition: SEDrugSystem.h:9
void Clear() override
Definition: SEDrugSystem.cpp:43
const SEScalar * GetScalar(const std::string &name) override
Definition: SEDrugSystem.cpp:60
Definition: SEECMO.h:10
void Clear() override
Definition: SEECMO.cpp:18
const SEScalar * GetScalar(const std::string &name) override
Definition: SEECMO.cpp:34
Definition: SEElectroCardioGram.h:9
const SEScalar * GetScalar(const std::string &name) override
Definition: SEElectroCardioGram.cpp:87
void Clear() override
Definition: SEElectroCardioGram.cpp:44
Definition: SEEndocrineSystem.h:8
const SEScalar * GetScalar(const std::string &name) override
Definition: SEEndocrineSystem.cpp:24
void Clear() override
Definition: SEEndocrineSystem.cpp:18
Definition: SEEnergySystem.h:8
void Clear() override
Definition: SEEnergySystem.cpp:46
const SEScalar * GetScalar(const std::string &name) override
Definition: SEEnergySystem.cpp:63
Definition: SEEnvironment.h:13
void Clear() override
Definition: SEEnvironment.cpp:53
const SEScalar * GetScalar(const std::string &name) override
Definition: SEEnvironment.cpp:75
Definition: SEGastrointestinalSystem.h:9
const SEScalar * GetScalar(const std::string &name) override
Definition: SEGastrointestinalSystem.cpp:33
void Clear() override
Definition: SEGastrointestinalSystem.cpp:24
Definition: SEHepaticSystem.h:8
const SEScalar * GetScalar(const std::string &name) override
Definition: SEHepaticSystem.cpp:23
void Clear() override
Definition: SEHepaticSystem.cpp:17
Definition: SEInhaler.h:12
const SEScalar * GetScalar(const std::string &name) override
Definition: SEInhaler.cpp:63
void Clear() override
Definition: SEInhaler.cpp:35
Definition: SEMechanicalVentilator.h:10
void Clear() override
Definition: SEMechanicalVentilator.cpp:84
const SEScalar * GetScalar(const std::string &name) override
Definition: SEMechanicalVentilator.cpp:161
Definition: SENervousSystem.h:9
void Clear() override
Definition: SENervousSystem.cpp:39
const SEScalar * GetScalar(const std::string &name) override
Definition: SENervousSystem.cpp:56
Definition: SERenalSystem.h:8
void Clear() override
Definition: SERenalSystem.cpp:146
const SEScalar * GetScalar(const std::string &name) override
Definition: SERenalSystem.cpp:210
Definition: SERespiratorySystem.h:25
void Clear() override
Definition: SERespiratorySystem.cpp:180
const SEScalar * GetScalar(const std::string &name) override
Definition: SERespiratorySystem.cpp:252
Definition: SEScalar.h:19
Definition: SETissueSystem.h:8
const SEScalar * GetScalar(const std::string &name) override
Definition: SETissueSystem.cpp:46
void Clear() override
Definition: SETissueSystem.cpp:33
Definition: Logger.h:14

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.