279abdd723
This commit significantly expands the patient simulation by adding models for the full digestive and urinary systems, as well as the spleen and spinal cord. This builds on the polymorphic organ framework by adding 9 new organ classes: - Kidneys - Bladder - Stomach - Intestines - Gallbladder - Pancreas - Esophagus - Spleen - SpinalCord Each new organ has its own header, a source file with simplified simulation logic for its unique physiological properties, and is integrated into the main patient model and simulation loop. The build system and example application have been updated to include and demonstrate this new, more comprehensive set of organs.
27 lines
844 B
C++
27 lines
844 B
C++
#include "MedicalLib/Gallbladder.h"
|
|
#include <random>
|
|
#include <algorithm>
|
|
#include <sstream>
|
|
|
|
Gallbladder::Gallbladder(int id) : Organ(id, "Gallbladder"), bileStored(30.0) {}
|
|
|
|
void Gallbladder::update(double deltaTime_s) {
|
|
// A real model would be affected by liver production and digestion.
|
|
// For now, it just sits there with a small fluctuation.
|
|
static std::random_device rd;
|
|
static std::mt19937 gen(rd());
|
|
std::normal_distribution<> d(0, 0.01);
|
|
|
|
bileStored += d(gen) * deltaTime_s;
|
|
bileStored = std::clamp(bileStored, 10.0, 50.0);
|
|
}
|
|
|
|
std::string Gallbladder::getSummary() const {
|
|
std::stringstream ss;
|
|
ss << "Type: " << organType << " (ID: " << organId << ")\n"
|
|
<< " Bile Stored: " << bileStored << " ml";
|
|
return ss.str();
|
|
}
|
|
|
|
double Gallbladder::getBileStored() const { return bileStored; }
|