1 /* Distributed under the Apache License, Version 2.0.
2  See accompanying NOTICE file for details.*/
4 #pragma once
5 #include "controller/System.h"
6 #include "system/physiology/SETissueSystem.h"
7 class SESubstance;
11 class SEGasCompartment;
22 class PULSE_DECL Tissue : public SETissueSystem, public PulseTissueSystem, public PulseSystem
23 {
24  friend class PBPulsePhysiology;//friend the serialization class
25  friend class PulseController;
26  friend class PulseEngineTest;
27 protected:
28  Tissue(PulseController& data);
31 public:
32  virtual ~Tissue();
34  void Clear();
36 protected:
37  // Set members to a stable homeostatic state
38  void Initialize();
39  // Set pointers and other member variables common to both homeostatic initialization and loading a state
40  void SetUp();
42  void AtSteadyState();
43  void PreProcess();
44  void Process();
45  void PostProcess();
47  // Preprocess Methods
48  void ProduceAlbumin(double duration_s);
50  /*Tissue System*/
51  void CalculateMetabolicConsumptionAndProduction(double time);
52  void GlucoseLipidControl(double time);
54  /*Process Methods*/
55  void CalculateDiffusion();
56  void CalculatePulmonaryCapillarySubstanceTransfer();
57  void CalculateVitals();
59  /*Postprocess Methods*/
61  /*Diffusion Utilities*/
62  void DistributeMassbyVolumeWeighted(SELiquidCompartment& cmpt, const SESubstance& sub, double mass, const MassUnit& unit);
63  void DistributeMassbyMassWeighted(SELiquidCompartment& cmpt, const SESubstance& sub, double mass, const MassUnit& unit);
65  double PerfusionLimitedDiffusion(SETissueCompartment& tissue, SELiquidCompartment& vascular, const SESubstance& sub, double partitionCoeff, double timestep_s);
66  void AlveolarPartialPressureGradientDiffusion(SEGasCompartment& pulmonary, SELiquidCompartment& vascular, SESubstance& sub, double DiffusingCapacityO2_mL_Per_s_mmHg, double timestep_s);
68  double MoveMassByInstantDiffusion(SELiquidCompartment& source, SELiquidCompartment& target, const SESubstance& sub, double timestep_s);
69  double MoveMassBySimpleDiffusion(SELiquidCompartment& source, SELiquidCompartment& target, const SESubstance& sub, double permeabilityCofficient_mL_Per_s, double timestep_s);
70  double MoveMassByFacilitatedDiffusion(SELiquidCompartment& source, SELiquidCompartment& target, const SESubstance& sub, double combinedCoefficient_g_Per_s, double timestep_s);
71  double MoveMassByActiveTransport(SELiquidCompartment& source, SELiquidCompartment& target, const SESubstance& sub, double DiffusingCapacityO2_mL_Per_s_mmHg, double timestep_s);
73  // Serializable member variables (Set in Initialize and in schema
81  // Stateless member variable (Set in SetUp())
82  double m_Dt_s;
121  std::map<SETissueCompartment*, SELiquidCompartment*> m_TissueToVascular;
122  std::vector<SETissueCompartment*> m_ConsumptionProdutionTissues;
123 };
std::map< SETissueCompartment *, SELiquidCompartment * > m_TissueToVascular
Definition: Tissue.h:121
SELiquidCompartment * m_MuscleVascular
Definition: Tissue.h:113
SEFluidCircuitNode * m_GutT1
Definition: Tissue.h:97
SELiquidCompartment * m_RightPulmonaryCapillaries
Definition: Tissue.h:119
double m_RestingTissueGlucose_g
Definition: Tissue.h:74
double m_RestingPatientMass_kg
Definition: Tissue.h:78
SELiquidSubstanceQuantity * m_FatVascularLipid
Definition: Tissue.h:111
SETissueCompartment * m_LeftLungTissue
Definition: Tissue.h:101
Definition: SEGasCompartment.h:12
SELiquidCompartment * m_FatVascular
Definition: Tissue.h:110
SELiquidCompartment * m_FatIntracellular
Definition: Tissue.h:108
SEGasCompartment * m_LeftAlveoli
Definition: Tissue.h:116
double m_RestingBloodLipid_g_Per_L
Definition: Tissue.h:76
std::vector< SETissueCompartment * > m_ConsumptionProdutionTissues
Definition: Tissue.h:122
Manages and controls execution of all data/systems in Pulse.
Definition: Controller.h:50
SESubstance * m_Insulin
Definition: Tissue.h:95
double m_AlbuminProdutionRate_g_Per_s
Definition: Tissue.h:83
Definition: SEFluidCircuitPath.h:8
Definition: PulsePhysiologySystems.h:89
double m_RestingFluidMass_kg
Definition: Tissue.h:79
SESubstance * m_O2
Definition: Tissue.h:87
virtual void SetUp()=0
SELiquidCompartment * m_LiverIntracellular
Definition: Tissue.h:106
double m_Dt_s
Definition: Tissue.h:82
Definition: SELiquidSubstanceQuantity.h:11
SEGasCompartment * m_RightAlveoli
Definition: Tissue.h:117
SETissueCompartment * m_FatTissue
Definition: Tissue.h:107
PulseController & m_data
Definition: Tissue.h:29
SESubstance * m_CO
Definition: Tissue.h:89
SETissueCompartment * m_MuscleTissue
Definition: Tissue.h:103
Definition: SETissueSystem.h:7
double m_RestingBloodGlucose_g_Per_L
Definition: Tissue.h:75
Generic class for handling the Pulse stabilization methodology.
Definition: System.h:10
SELiquidSubstanceQuantity * m_LiverTissueAlbumin
Definition: Tissue.h:100
Definition: PBPulsePhysiology.h:18
Definition: SELiquidCompartment.h:10
This class encapsulates logic necessary to connect independent systems together.
Definition: Tissue.h:22
virtual void Initialize()
Default system values to their homeostatic values
Definition: System.h:16
Definition: SETissueCompartment.h:8
SELiquidSubstanceQuantity * m_LiverVascularGlucose
Definition: Tissue.h:112
Definition: SEFluidCircuitNode.h:7
SESubstance * m_Creatinine
Definition: Tissue.h:92
virtual void AtSteadyState()
Notify systems that steady state has been achieved.
Definition: System.h:20
SEFluidCircuitPath * m_GutT1ToGutT3
Definition: Tissue.h:98
SETissueCompartment * m_LiverTissue
Definition: Tissue.h:105
SESubstance * m_Tristearin
Definition: Tissue.h:86
SELiquidSubstanceQuantity * m_MuscleVascularGlucose
Definition: Tissue.h:114
SESubstance * m_Sodium
Definition: Tissue.h:93
virtual void PostProcess()=0
SESubstance * m_Lactate
Definition: Tissue.h:90
SELiquidCompartment * m_LeftPulmonaryCapillaries
Definition: Tissue.h:118
SESubstance * m_Glucose
Definition: Tissue.h:85
SESubstance * m_CO2
Definition: Tissue.h:88
virtual void Process()=0
SETissueCompartment * m_RightLungTissue
Definition: Tissue.h:102
double m_RestingBloodInsulin_g_Per_L
Definition: Tissue.h:77
Definition: SEScalarMass.h:7
virtual void PreProcess()=0
SESubstance * m_Calcium
Definition: Tissue.h:94
Definition: SESubstance.h:14
SESubstance * m_Acetoacetate
Definition: Tissue.h:91
SESubstance * m_Albumin
Definition: Tissue.h:84
virtual void Clear()
Definition: SETissueSystem.cpp:25
SELiquidCompartment * m_MuscleIntracellular
Definition: Tissue.h:104