Endocrine.h
1 /**************************************************************************************
2 Copyright 2015 Applied Research Associates, Inc.
3 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4 this file except in compliance with the License. You may obtain a copy of the License
5 at:
6 http://www.apache.org/licenses/LICENSE-2.0
7 Unless required by applicable law or agreed to in writing, software distributed under
8 the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
9 CONDITIONS OF ANY KIND, either express or implied. See the License for the
10 specific language governing permissions and limitations under the License.
11 **************************************************************************************/
12 
13 #pragma once
14 #include <biogears/cdm/CommonDataModel.h>
15 #include <biogears/exports.h>
16 
17 #include <biogears/cdm/properties/SEScalarMass.h>
18 #include <biogears/cdm/system/physiology/SEEndocrineSystem.h>
19 #include <biogears/engine/Controller/BioGearsSystem.h>
20 #include <biogears/schema/biogears/BioGearsPhysiology.hxx>
21 
22 namespace biogears {
23 class SELiquidSubstanceQuantity;
24 class BioGears;
32 class BIOGEARS_API Endocrine : public SEEndocrineSystem, public BioGearsSystem {
33  friend class BioGears;
34  friend class BioGearsEngineTest;
35 
36 protected:
37  static auto make_unique(BioGears& bg) -> std::unique_ptr<Endocrine>;
38  Endocrine(BioGears& bg);
40 
41 public:
42  virtual ~Endocrine() override;
43 
44  static size_t TypeHash() { return reinterpret_cast<size_t>(&TypeHash); }
45  static constexpr char const * const TypeTag() { return "Endocrine"; }
46  const char* classname() const override { return TypeTag(); }
47  size_t hash_code() const override { return TypeHash(); }
48 
49  void Clear() override;
50 
51  // Set members to a stable homeostatic state
52  void Initialize() override;
53 
54  // Load a state
55  virtual bool Load(const CDM::BioGearsEndocrineSystemData& in);
56  virtual CDM::BioGearsEndocrineSystemData* Unload() const override;
57 
58 protected:
59  virtual void Unload(CDM::BioGearsEndocrineSystemData& data) const;
60 
61  // Set pointers and other member variables common to both homeostatic initialization and loading a state
62  void SetUp() override;
63 
64 public:
65  void AtSteadyState() override;
66  void PreProcess() override;
67  void Process() override;
68  void PostProcess() override;
69 
70 private:
71  void SynthesizeInsulin();
72  void SynthesizeGlucagon();
73  void ReleaseEpinephrine();
74 
75 protected:
76  //Override
77  void ProcessOverride();
78  void OverrideControlLoop();
79 
80 private:
81  // Serializable member variables (Set in Initialize and in schema)
82 
83  // Stateless member variable (Set in SetUp())
84  double m_dt_s;
88  SELiquidSubstanceQuantity* m_AortaGlucose = nullptr;
89  SELiquidSubstanceQuantity* m_AortaEpinephrine = nullptr;
90  SELiquidSubstanceQuantity* m_rKidneyEpinephrine = nullptr;
91  SELiquidSubstanceQuantity* m_lKidneyEpinephrine = nullptr;
92  SELiquidSubstanceQuantity* m_SplanchnicInsulin = nullptr;
93  SELiquidSubstanceQuantity* m_SplanchnicGlucagon = nullptr;
94 };
95 }
double m_AverageBiologicalDebt
Definition: Endocrine.h:86
Definition: SEEndocrineSystem.h:32
double m_dt_s
Definition: Endocrine.h:84
double m_InsulinMolarMass_g_Per_mol
Definition: Endocrine.h:85
Definition: SELiquidSubstanceQuantity.h:28
Class corresponding to the BioGearsEndocrineSystemData schema type.
Definition: BioGearsPhysiology.hxx:3515
Definition: Endocrine.h:32
Definition: BioGearsEngineTest.h:24
size_t hash_code() const override
Definition: Endocrine.h:47
double m_GlucagonMolarMass_g_Per_mol
Definition: Endocrine.h:87
static size_t TypeHash()
Definition: Endocrine.h:44
static constexpr char const *const TypeTag()
Definition: Endocrine.h:45
Manages and controls execution of all data/systems in BioGears.
Definition: BioGears.h:86
const char * classname() const override
Definition: Endocrine.h:46
BioGears & m_data
Definition: Endocrine.h:39
Generic class for handling the BioGears stabilization methodology.
Definition: BioGearsSystem.h:23
Definition: SEElectricalCircuit.h:18