fb0962ff95
This commit re-implements several critical physiological feedback loops that were lost, enhancing the realism of the simulation.
The following systems have been added:
1. **Full Digestive Loop:**
- The Gallbladder now has a `releaseBile` method, triggered by chyme in the intestines.
- The Pancreas has a `releaseEnzymes` method, also triggered by chyme.
- The Intestines' digestion logic has been updated to be more effective when bile and enzymes are present.
2. **Autonomic Nervous System Control:**
- The Brain now monitors blood gas (O2/CO2) and blood pressure levels.
- It dynamically adjusts the respiration rate of the Lungs via a new `setRespirationRate` method in response to blood gas changes.
- It controls the heart rate via a new `setHeartRate` method in response to blood pressure changes, simulating the baroreceptor reflex.
- The previous hardcoded rate control logic in the Lungs and Heart has been removed.
3. **Kidney Blood Pressure Regulation (RAAS):**
- A simplified Renin-Angiotensin-Aldosterone System has been implemented.
- The Kidneys now secrete renin in response to low blood pressure.
- The Liver produces a constant supply of angiotensinogen.
- A new `angiotensin_au` value in the Blood struct is calculated in the main patient update loop.
- This hormone now acts as a vasoconstrictor, directly affecting the blood pressure calculation in the Heart.
These changes significantly increase the complexity and fidelity of the medical simulation by modeling the interconnectedness of the major organ systems.
73 lines
2.1 KiB
C++
73 lines
2.1 KiB
C++
#pragma once
|
|
|
|
#include "Organ.h"
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
/**
|
|
* @brief Represents a functional unit of the liver.
|
|
*/
|
|
struct HepaticLobule {
|
|
std::string id;
|
|
double metabolicActivity; // A factor from 0.0 to 1.0+
|
|
bool isDamaged;
|
|
};
|
|
|
|
/**
|
|
* @brief Represents the Liver organ with a more detailed physiological model.
|
|
*/
|
|
class MEDICAL_LIB_API Liver : public Organ {
|
|
public:
|
|
/**
|
|
* @brief Constructor for the Liver class.
|
|
* @param id The ID of the organ.
|
|
*/
|
|
Liver(int id);
|
|
|
|
/**
|
|
* @brief Updates the liver's state over a time interval.
|
|
* @param patient A reference to the patient object.
|
|
* @param deltaTime_s The time elapsed in seconds.
|
|
*/
|
|
void update(Patient& patient, double deltaTime_s) override;
|
|
|
|
/**
|
|
* @brief Gets a string summary of the liver's vitals.
|
|
* @return A string containing the liver's vital signs.
|
|
*/
|
|
std::string getSummary() const override;
|
|
|
|
// --- Getters for Key Metabolic Vitals ---
|
|
|
|
/** @brief Gets the rate of bile production in mL/min. */
|
|
double getBileProductionRate() const;
|
|
|
|
/** @brief Gets the rate of glucose production (gluconeogenesis) in g/min. */
|
|
double getGlucoseProductionRate() const;
|
|
|
|
/** @brief Gets the Alanine Aminotransferase (ALT) level in U/L. */
|
|
double getAltLevel() const;
|
|
|
|
/** @brief Gets the Aspartate Aminotransferase (AST) level in U/L. */
|
|
double getAstLevel() const;
|
|
|
|
/** @brief Gets the total bilirubin level in mg/dL. */
|
|
double getBilirubinLevel() const;
|
|
|
|
/** @brief Gets the production rate of angiotensinogen. */
|
|
double getAngiotensinogenRate() const;
|
|
|
|
private:
|
|
// --- Physiological Parameters ---
|
|
double angiotensinogen_production_rate; // In arbitrary units/s
|
|
double bileProductionRate_ml_per_s;
|
|
double glucoseProductionRate_g_per_s;
|
|
double alt_U_per_L; ///< Alanine Aminotransferase
|
|
double ast_U_per_L; ///< Aspartate Aminotransferase
|
|
double bilirubin_mg_per_dL; ///< Total bilirubin
|
|
|
|
// --- Anatomical Components ---
|
|
std::vector<HepaticLobule> lobules;
|
|
double totalMetabolicCapacity;
|
|
};
|