RenalModel.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/common/system/Model.h"
7#include "engine/common/system/Systems.h"
8
9class SEPatient;
10class SESubstance;
11class SEFluidCircuit;
17class SEUrinalysis;
18
19namespace pulse
20{
21 class PBPhysiology;
22 class EngineTest;
26 class PULSE_DECL RenalModel : public RenalSystem, public Model
27 {
28 friend PBPhysiology;//friend the serialization class
29 friend EngineTest;
30 public:
31 RenalModel(Data& data);
32 virtual ~RenalModel();
33
34 void Clear() override;
35
36 // Set members to a stable homeostatic state
37 void Initialize() override;
38 // Set pointers and other member varialbes common to both homeostatic initialization and loading a state
39 void SetUp() override;
40
41 void AtSteadyState() override;
42 void PreProcess() override;
43 void Process(bool solve_and_transport = true) override;
44 void PostProcess(bool solve_and_transport = true) override;
45
46 // Assessments
47 bool CalculateUrinalysis(SEUrinalysis& u) const;
48
49 protected:
50 void ComputeExposedModelParameters() override;
51
52 struct ActiveTransport
53 {
54 public:
55 double leftGlucoseReabsorptionMass_mg;
56 double rightGlucoseReabsorptionMass_mg;
57 double leftLactateExcretedMass_mg;
58 double rightLactateExcretedMass_mg;
59 };
60
61 // Initialization
62 void CalculateFilterability(SESubstance& sub);
63 //Conditions
64 void ConsumeMeal(double elapsedTime_s);
65
66 //Preprocess
67 void CalculateUltrafiltrationFeedback();
68 void CalculateColloidOsmoticPressure(SEScalarMassPerVolume& albuminConcentration, SEScalarPressure& osmoticPressure);
69 void CalculateReabsorptionFeedback();
70 void CalculateOsmoreceptorFeedback();
71 void CalculateFluidPermeability();
72 void CalculateTubuloglomerularFeedback();
73 void UpdateBladderVolume();
74 void ProcessActions();
75 void Urinate();
76
77 //Process
78 void CalculateActiveTransport();
79 void CalculateGlomerularTransport(SESubstance& sub);
80 void CalculateReabsorptionTransport(SESubstance& sub);
81 void CalculateSecretion();
82 void CalculateExcretion(SESubstance& sub);
83 void CalculateAutomaticClearance(SESubstance& sub);
84 void CalculateGluconeogenesis();
85 void CalculateVitalSigns();
86
87 // Serializable member variables (Set in Initialize and in schema)
88 bool m_Urinating;
89 //Tubuloglomerular Feedback
90 double m_leftAfferentResistance_mmHg_s_Per_mL;
91 double m_rightAfferentResistance_mmHg_s_Per_mL;
92 double m_leftSodiumFlowSetPoint_mg_Per_s;
93 double m_rightSodiumFlowSetPoint_mg_Per_s;
94 //Events
95 SERunningAverage* m_urineProductionRate_mL_Per_min_runningAvg;
96 SERunningAverage* m_urineOsmolarity_mOsm_Per_L_runningAvg;
97 SERunningAverage* m_sodiumConcentration_mg_Per_mL_runningAvg;
98 SERunningAverage* m_sodiumExcretionRate_mg_Per_min_runningAvg;
99 SERunningAverage* m_leftSodiumFlow_mg_Per_s_runningAvg;
100 SERunningAverage* m_rightSodiumFlow_mg_Per_s_runningAvg;
101 SERunningAverage* m_leftRenalArterialPressure_mmHg_runningAvg;
102 SERunningAverage* m_rightRenalArterialPressure_mmHg_runningAvg;
103
104 // Stateless member variable (Set in SetUp())
105 //Circuits
106 SEFluidCircuit* m_RenalCircuit;
107 //Nodes
108 SEFluidCircuitNode* m_leftGlomerularNode;
109 SEFluidCircuitNode* m_leftBowmansNode;
110 SEFluidCircuitNode* m_leftPeritubularNode;
111 SEFluidCircuitNode* m_leftTubulesNode;
112 SEFluidCircuitNode* m_leftRenalArteryNode;
113 SEFluidCircuitNode* m_rightGlomerularNode;
114 SEFluidCircuitNode* m_rightBowmansNode;
115 SEFluidCircuitNode* m_rightPeritubularNode;
116 SEFluidCircuitNode* m_rightTubulesNode;
117 SEFluidCircuitNode* m_rightRenalArteryNode;
118 SEFluidCircuitNode* m_bladderNode;
119 SEFluidCircuitNode* m_leftNetGlomerularCapillariesNode;
120 SEFluidCircuitNode* m_leftNetBowmansCapsulesNode;
121 SEFluidCircuitNode* m_leftNetPeritubularCapillariesNode;
122 SEFluidCircuitNode* m_leftNetTubulesNode;
123 SEFluidCircuitNode* m_rightNetGlomerularCapillariesNode;
124 SEFluidCircuitNode* m_rightNetBowmansCapsulesNode;
125 SEFluidCircuitNode* m_rightNetPeritubularCapillariesNode;
126 SEFluidCircuitNode* m_rightNetTubulesNode;
127 //Paths
128 SEFluidCircuitPath* m_leftGlomerularOsmoticSourcePath;
129 SEFluidCircuitPath* m_leftBowmansOsmoticSourcePath;
130 SEFluidCircuitPath* m_leftReabsorptionResistancePath;
131 SEFluidCircuitPath* m_leftTubulesOsmoticSourcePath;
132 SEFluidCircuitPath* m_leftPeritubularOsmoticSourcePath;
133 SEFluidCircuitPath* m_leftUreterPath;
134 SEFluidCircuitPath* m_leftGlomerularFilterResistancePath;
135 SEFluidCircuitPath* m_leftAfferentArteriolePath;
136 SEFluidCircuitPath* m_rightReabsorptionResistancePath;
137 SEFluidCircuitPath* m_rightGlomerularOsmoticSourcePath;
138 SEFluidCircuitPath* m_rightBowmansOsmoticSourcePath;
139 SEFluidCircuitPath* m_rightTubulesOsmoticSourcePath;
140 SEFluidCircuitPath* m_rightPeritubularOsmoticSourcePath;
141 SEFluidCircuitPath* m_rightUreterPath;
142 SEFluidCircuitPath* m_rightGlomerularFilterResistancePath;
143 SEFluidCircuitPath* m_rightAfferentArteriolePath;
144 SEFluidCircuitPath* m_bladderToGroundPressurePath;
145 SEFluidCircuitPath* m_urethraPath;
146 SEFluidCircuitPath* m_leftTubulesPath;
147 SEFluidCircuitPath* m_rightTubulesPath;
148 SEFluidCircuitPath* m_leftEfferentArteriolePath;
149 SEFluidCircuitPath* m_rightEfferentArteriolePath;
150
151 //Substances
152 SESubstance* m_sodium;
153 SESubstance* m_urea;
154 SESubstance* m_glucose;
155 SESubstance* m_lactate;
156 SESubstance* m_potassium;
157 //Compartments
158 SELiquidCompartment* m_aorta;
159 SELiquidCompartment* m_venaCava;
160 SELiquidCompartment* m_bladder;
161 SETissueCompartment* m_rightKidneyTissue;
162 SETissueCompartment* m_leftKidneyTissue;
163 SELiquidCompartment* m_leftUreter;
164 SELiquidCompartment* m_leftPeritubular;
165 SELiquidCompartment* m_rightUreter;
166 SELiquidCompartment* m_rightPeritubular;
167 SELiquidCompartment* m_leftGlomerular;
168 SELiquidCompartment* m_leftBowmans;
169 SELiquidCompartment* m_rightGlomerular;
170 SELiquidCompartment* m_rightBowmans;
171 SELiquidCompartment* m_leftTubules;
172 SELiquidCompartment* m_rightTubules;
173 SELiquidCompartment* m_ground;
174 // Compartment Substance Quantites
175 SELiquidSubstanceQuantity* m_aortaLactate;
176
177 SELiquidSubstanceQuantity* m_leftPeritubularGlucose;
178 SELiquidSubstanceQuantity* m_leftPeritubularPotassium;
179 SELiquidSubstanceQuantity* m_leftUreterPotassium;
180 SELiquidSubstanceQuantity* m_leftUreterLactate;
181
182 SELiquidSubstanceQuantity* m_rightPeritubularGlucose;
183 SELiquidSubstanceQuantity* m_rightPeritubularPotassium;
184 SELiquidSubstanceQuantity* m_rightUreterPotassium;
185 SELiquidSubstanceQuantity* m_rightUreterLactate;
186
187 SELiquidSubstanceQuantity* m_bladderGlucose;
188 SELiquidSubstanceQuantity* m_bladderPotassium;
189 SELiquidSubstanceQuantity* m_bladderSodium;
190 SELiquidSubstanceQuantity* m_bladderUrea;
191 SELiquidSubstanceQuantity* m_leftTubulesSodium;
192 SELiquidSubstanceQuantity* m_rightTubulesSodium;
193
194 SELiquidSubstanceQuantity* m_leftKidneyIntracellularLactate;
195 SELiquidSubstanceQuantity* m_rightKidneyIntracellularLactate;
196
197 // Configuration
198 double m_defaultOpenResistance_mmHg_s_Per_mL;
199 double m_defaultClosedResistance_mmHg_s_Per_mL;
200 // Ultrafiltration
201 double m_CVOpenResistance_mmHg_s_Per_mL;
202 // Tubuloglomerular Feedback
203 double m_maxLeftAfferentResistance_mmHg_s_Per_mL;
204 double m_minLeftAfferentResistance_mmHg_s_Per_mL;
205 double m_maxRightAfferentResistance_mmHg_s_Per_mL;
206 double m_minRightAfferentResistance_mmHg_s_Per_mL;
207 // Osmoreceptor Feedback
208 double m_leftReabsorptionPermeabilityModificationFactor;
209 double m_rightReabsorptionPermeabilityModificationFactor;
210 double m_sodiumPlasmaConcentrationSetpoint_mg_Per_mL;
211 // Secretion
212 double m_baselinePotassiumConcentration_g_Per_dL;
213 // Reabsorption
214 double m_leftReabsorptionPermeabilitySetpoint_mL_Per_s_mmHg_m2;
215 double m_rightReabsorptionPermeabilitySetpoint_mL_Per_s_mmHg_m2;
216
217 // Utility/ScratchPads
218 SEScalarMass* m_spCleared;
219 ActiveTransport m_SubstanceTransport;
220 };
221END_NAMESPACE
Definition: PBPhysiology.h:24
Definition: SEFluidCircuit.h:12
Definition: SEFluidCircuitNode.h:10
Definition: SEFluidCircuitPath.h:9
Definition: SELiquidCompartment.h:11
Definition: SELiquidSubstanceQuantity.h:12
Definition: SEPatient.h:13
Definition: SERunningAverage.h:8
Definition: SEScalarMass.h:28
Definition: SEScalarMassPerVolume.h:37
Definition: SEScalarPressure.h:29
Definition: SESubstance.h:15
Definition: SETissueCompartment.h:9
Definition: SEUrinalysis.h:37
Definition: Logger.h:14

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.