feat: Add detailed simulation to remaining simple organs
This commit applies a detailed physiological model to all remaining simple organ classes, bringing them to a level of complexity consistent with the Heart, Lungs, and Brain. Updates include: - Esophagus: Simulates peristalsis and bolus movement. - Stomach: Implements a gastric state machine for digestion. - Intestines: Adds segments (duodenum, jejunum, etc.) and simulates absorption. - Pancreas: Differentiates endocrine and exocrine functions. - Gallbladder: Simulates storing, concentrating, and releasing bile. - Kidneys: Models nephrons, GFR, and electrolyte balance. - Bladder: Implements a micturition cycle with pressure dynamics. - Spleen: Models red and white pulp for blood filtering and immunity.
This commit is contained in:
@@ -1,18 +1,63 @@
|
||||
#pragma once
|
||||
|
||||
#include "Organ.h"
|
||||
#include <string>
|
||||
|
||||
/**
|
||||
* @brief Represents the Gallbladder.
|
||||
* @brief Represents the contraction state of the gallbladder.
|
||||
*/
|
||||
enum class GallbladderState {
|
||||
STORING,
|
||||
CONTRACTING
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Represents the Gallbladder, which stores and concentrates bile.
|
||||
*/
|
||||
class MEDICAL_LIB_API Gallbladder : public Organ {
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor for the Gallbladder class.
|
||||
* @param id The ID of the organ.
|
||||
*/
|
||||
Gallbladder(int id);
|
||||
|
||||
/**
|
||||
* @brief Updates the gallbladder's state over a time interval.
|
||||
* @param deltaTime_s The time elapsed in seconds.
|
||||
*/
|
||||
void update(double deltaTime_s) override;
|
||||
|
||||
/**
|
||||
* @brief Gets a string summary of the gallbladder's state.
|
||||
* @return A string containing the gallbladder's state.
|
||||
*/
|
||||
std::string getSummary() const override;
|
||||
|
||||
double getBileStored() const;
|
||||
/**
|
||||
* @brief Adds bile from the liver.
|
||||
* @param volume_mL The volume of bile to add.
|
||||
*/
|
||||
void storeBile(double volume_mL);
|
||||
|
||||
// --- Getters for Gallbladder State ---
|
||||
|
||||
/** @brief Gets the current volume of stored bile in mL. */
|
||||
double getStoredBileVolume() const;
|
||||
|
||||
/** @brief Gets the concentration factor of the stored bile. */
|
||||
double getBileConcentration() const;
|
||||
|
||||
/** @brief Gets the current state of the gallbladder. */
|
||||
GallbladderState getCurrentState() const;
|
||||
|
||||
private:
|
||||
double bileStored; // in ml
|
||||
// --- Helper to convert enum to string ---
|
||||
std::string stateToString(GallbladderState state) const;
|
||||
|
||||
// --- Physiological Parameters ---
|
||||
GallbladderState currentState;
|
||||
double storedBile_mL;
|
||||
double bileConcentrationFactor; // How concentrated the bile is (1x, 5x, etc.)
|
||||
const double capacity_mL = 50.0;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user