public void CalcAcidBaseFromTCO2(BloodCompartment bloodcomp) { // store the independent variables into local fields _tco2 = bloodcomp.tco2; _sid = bloodcomp.sid; _albumin = bloodcomp.albumin; _phosphates = bloodcomp.phosphates; _hb = bloodcomp.hemoglobin; // find the Hp concentration where the netcharge of the plasma is zero double Hp = BrentRootfinder(lefthp, righthp, brentAccuracy, maxIterations, out int iterationsUsed, out _); if (iterationsUsed < maxIterations) { bloodcomp.ph = -Math.Log10(Hp / 1000.0); // dissolved co2 bloodcomp.cco2 = co2p; // co2 bound to bicarbonate bloodcomp.hco3 = hco3p; // co2 bound to carbamate bloodcomp.co3 = co3p; // calculate the base excess bloodcomp.be = (bloodcomp.hco3 - 24.4 + (2.3 * _hb + 7.7) * (bloodcomp.ph - 7.4)) * (1.0 - 0.023 * _hb); // mmol/l -> van Slyke equation to determine the base excess // calculate the pCO2 bloodcomp.pco2 = bloodcomp.cco2 / alpha_co2p; } }
public ContractionModel(Model cm) { currentModel = cm; currentModel.modelInterface.StatusMessage = $"Initialized the contraction model."; // find a reference to the heart chamber compartments RA = currentModel.FindModelComponent <BloodCompartment>("RA"); LA = currentModel.FindModelComponent <BloodCompartment>("LA"); RV = currentModel.FindModelComponent <BloodCompartment>("RV"); LV = currentModel.FindModelComponent <BloodCompartment>("LV"); }
public AutonomicNervousSystemModel(Model cm) { currentModel = cm; currentModel.modelInterface.StatusMessage = $"Initialized the autonomic nervous system model."; // get a reference to the relevant model components AA = currentModel.FindModelComponent <BloodCompartment>("AA"); BRAIN = currentModel.FindModelComponent <BloodCompartment>("BRAIN"); AD = currentModel.FindModelComponent <BloodCompartment>("AD"); PA = currentModel.FindModelComponent <BloodCompartment>("PA"); PV = currentModel.FindModelComponent <BloodCompartment>("PV"); }
public DataCollector(Model cm) { currentModel = cm; // get the most common compartments and connectors LV = currentModel.FindModelComponent <BloodCompartment> ("LV"); LA = currentModel.FindModelComponent <BloodCompartment> ("LA"); RV = currentModel.FindModelComponent <BloodCompartment> ("RV"); RA = currentModel.FindModelComponent <BloodCompartment> ("RA"); AA = currentModel.FindModelComponent <BloodCompartment> ("AA"); AD = currentModel.FindModelComponent <BloodCompartment> ("AD"); PA = currentModel.FindModelComponent <BloodCompartment> ("PA"); IVC = currentModel.FindModelComponent <BloodCompartment> ("IVC"); SVC = currentModel.FindModelComponent <BloodCompartment> ("SVC"); LV_AA = currentModel.FindModelComponent <Valve> ("LV_AA"); LA_LV = currentModel.FindModelComponent <Valve> ("LA_LV"); RV_PA = currentModel.FindModelComponent <Valve> ("RV_PA"); RA_RV = currentModel.FindModelComponent <Valve> ("RA_RV"); IVC_RA = currentModel.FindModelComponent <BloodConnector> ("IVC_RA"); SVC_RA = currentModel.FindModelComponent <BloodConnector> ("SVC_RA"); OFO = currentModel.FindModelComponent <Shunt> ("OFO"); PDA = currentModel.FindModelComponent <Shunt> ("PDA"); VSD = currentModel.FindModelComponent <Shunt> ("VSD"); // get the most common compartments and connectors OUT = currentModel.FindModelComponent <GasCompartment> ("OUT"); NCA = currentModel.FindModelComponent <GasCompartment> ("NCA"); ALL = currentModel.FindModelComponent <GasCompartment> ("ALL"); ALR = currentModel.FindModelComponent <GasCompartment> ("ALR"); VENTIN = currentModel.FindModelComponent <GasCompartment> ("VENTIN"); TUBINGIN = currentModel.FindModelComponent <GasCompartment> ("TUBINGIN"); YPIECE = currentModel.FindModelComponent <GasCompartment> ("YPIECE"); TUBINGOUT = currentModel.FindModelComponent <GasCompartment> ("TUBINGOUT"); VENTOUT = currentModel.FindModelComponent <GasCompartment> ("VENTOUT"); CHEST_L = currentModel.FindModelComponent <Container> ("CHEST_L"); CHEST_R = currentModel.FindModelComponent <Container> ("CHEST_R"); OUT_NCA = currentModel.FindModelComponent <GasConnector> ("OUT_NCA"); NCA_ALL = currentModel.FindModelComponent <GasConnector> ("NCA_ALL"); NCA_ALR = currentModel.FindModelComponent <GasConnector> ("NCA_ALR"); VENTIN_TUBINGIN = currentModel.FindModelComponent <GasConnector> ("VENTIN_TUBINGIN"); TUBINGIN_YPIECE = currentModel.FindModelComponent <GasConnector> ("TUBINGIN_YPIECE"); YPIECE_NCA = currentModel.FindModelComponent <GasConnector> ("YPIECE_NCA"); YPIECE_TUBINGOUT = currentModel.FindModelComponent <GasConnector> ("YPIECE_TUBINGOUT"); TUBINGOUT_VENTOUT = currentModel.FindModelComponent <GasConnector> ("TUBINGOUT_VENTOUT"); StartDatarecording(); }
public void AddCompartment(BloodCompartment c) { compartments.Add(c); }