Ejemplo n.º 1
0
        public static void apply_patient_assessment_request(BioGearsEngine engine)
        {
            var CompleteBloodCount               = new SEPatientAssessmentRequest();
            var ComprehensiveMetabolicPanel      = new SEPatientAssessmentRequest();
            var PulmonaryFunctionTest            = new SEPatientAssessmentRequest();
            var SequentialOrganFailureAssessment = new SEPatientAssessmentRequest();
            var Urinalysis = new SEPatientAssessmentRequest();

            //!
            //! AssessmentRequest produces an XML format of CDM::PatientAssessment
            //!
            //! Use PhysiologyEngine::GetPatientAssessment to populate a SEPatientAssessment*
            //! For Programatic Use
            //!
            CompleteBloodCount.SetPatientAssessmentType(CDM.enumPatientAssessment.value.CompleteBloodCount);
            ComprehensiveMetabolicPanel.SetPatientAssessmentType(CDM.enumPatientAssessment.value.ComprehensiveMetabolicPanel);
            PulmonaryFunctionTest.SetPatientAssessmentType(CDM.enumPatientAssessment.value.PulmonaryFunctionTest);
            SequentialOrganFailureAssessment.SetPatientAssessmentType(CDM.enumPatientAssessment.value.SequentialOrganFailureAssessment);
            Urinalysis.SetPatientAssessmentType(CDM.enumPatientAssessment.value.Urinalysis);

            engine.ProcessAction(CompleteBloodCount);
            engine.AdvanceModelTimeBy(1, TimeUnit.s);

            engine.ProcessAction(ComprehensiveMetabolicPanel);
            engine.AdvanceModelTimeBy(1, TimeUnit.s);

            engine.ProcessAction(PulmonaryFunctionTest);
            engine.AdvanceModelTimeBy(1, TimeUnit.s);

            engine.ProcessAction(SequentialOrganFailureAssessment);
            engine.AdvanceModelTimeBy(1, TimeUnit.s);

            engine.ProcessAction(Urinalysis);
            engine.AdvanceModelTimeBy(1, TimeUnit.s);
        }
Ejemplo n.º 2
0
 public static void apply_exercise(BioGearsEngine engine)
 {
     apply_cycling_exercise(engine);
     apply_generic_exercise(engine);
     apply_cycling_exercise(engine);
     apply_strength_exercise(engine);
 }
Ejemplo n.º 3
0
        public static void apply_chest_compression(BioGearsEngine engine)
        {
            var on  = new SEChestCompression();
            var off = new SEChestCompression();

            //Nothing to do
            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 4
0
        public static void apply_cardiac_arrest(BioGearsEngine engine)
        {
            var on  = new SECardiacArrest();
            var off = new SECardiacArrest();

            on.SetActive(true);
            off.SetActive(false);

            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 5
0
        public static void apply_breath_hold(BioGearsEngine engine)
        {
            var on  = new SEConsciousRespiration();
            var off = new SEConsciousRespiration();

            on.AddBreathHold().GetPeriod().SetValue(2, TimeUnit.s);
            off.AddBreathHold().GetPeriod().SetValue(0.0, TimeUnit.s);

            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 6
0
        public static void apply_intubation(BioGearsEngine engine)
        {
            var on  = new SEIntubation();
            var off = new SEIntubation();

            on.SetIntubationType(CDM.enumIntubationType.value.Tracheal);
            off.SetIntubationType(CDM.enumIntubationType.value.Off);

            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 7
0
        public static void apply_bronchoconstriction(BioGearsEngine engine)
        {
            var on  = new SEBronchoconstriction();
            var off = new SEBronchoconstriction();

            on.GetSeverity().SetValue(0.5);
            off.GetSeverity().SetValue(0.0);

            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 8
0
        public static void apply_asthma_attack(BioGearsEngine engine)
        {
            var on  = new SEAsthmaAttack();
            var off = new SEAsthmaAttack();

            on.GetSeverity().SetValue(0.5);
            off.GetSeverity().SetValue(0.0);

            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 9
0
        public static void apply_chest_compression_force(BioGearsEngine engine)
        {
            var on  = new SEChestCompressionForce();
            var off = new SEChestCompressionForce();

            on.GetForce().SetValue(0.5, ForceUnit.N);
            off.GetForce().SetValue(0.0, ForceUnit.N);

            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 10
0
        public static void apply_acute_stress(BioGearsEngine engine)
        {
            var on  = new SEAcuteStress();
            var off = new SEAcuteStress();

            on.GetSeverity().SetValue(0.5);
            off.GetSeverity().SetValue(0.0);

            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 11
0
        public static void apply_airway_obstruction(BioGearsEngine engine)
        {
            var on  = new SEAirwayObstruction();
            var off = new SEAirwayObstruction();

            on.GetSeverity().SetValue(0.5);
            off.GetSeverity().SetValue(0.0);

            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 12
0
        public static void apply_sleep(BioGearsEngine engine)
        {
            var on  = new SESleep();
            var off = new SESleep();

            on.SetSleepState(CDM.enumOnOff.value.On);
            off.SetSleepState(CDM.enumOnOff.value.Off);

            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 13
0
        public static void apply_pulmonary_shunt(BioGearsEngine engine)
        {
            var on  = new SEPulmonaryShunt();
            var off = new SEPulmonaryShunt();

            on.GetFlowRateScale().SetValue(0.5);
            off.GetFlowRateScale().SetValue(0.0);

            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 14
0
        public static void apply_pericadial_effusion(BioGearsEngine engine)
        {
            var on  = new SEPericardialEffusion();
            var off = new SEPericardialEffusion();

            on.GetEffusionRate().SetValue(0.5, VolumePerTimeUnit.mL_Per_s);
            off.GetEffusionRate().SetValue(0.0, VolumePerTimeUnit.mL_Per_s);
            //1.0 milliliters per second
            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 15
0
        public static void apply_needle_decompression(BioGearsEngine engine)
        {
            var on  = new SENeedleDecompression();
            var off = new SENeedleDecompression();

            on.SetSide(CDM.enumSide.value.Left);
            on.SetActive(true);
            off.SetSide(CDM.enumSide.value.Left);
            off.SetActive(false);

            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 16
0
        public static void apply_override(BioGearsEngine engine)
        {
            var on  = new SEOverride();
            var off = new SEOverride();

            on.SetOverrideState(CDM.enumOnOff.value.On);
            on.GetHeartRateOverride().SetValue(72, FrequencyUnit.Per_min);
            off.SetOverrideState(CDM.enumOnOff.value.Off);


            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 17
0
        public static void apply_pain_stimulus(BioGearsEngine engine)
        {
            var on  = new SEPainStimulus();
            var off = new SEPainStimulus();

            on.SetLocation("Neck");
            on.GetSeverity().SetValue(0.5);
            off.SetLocation("Neck");
            off.GetSeverity().SetValue(0.0);

            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 18
0
        public static void apply_brain_injury(BioGearsEngine engine)
        {
            var on  = new SEBrainInjury();
            var off = new SEBrainInjury();

            on.GetSeverity().SetValue(0.5);
            on.SetBrainInjuryType(CDM.enumBrainInjuryType.value.LeftFocal);
            off.GetSeverity().SetValue(0.0);
            off.SetBrainInjuryType(CDM.enumBrainInjuryType.value.LeftFocal);

            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 19
0
        public static void apply_hemorrhage(BioGearsEngine engine)
        {
            var on  = new SEHemorrhage();
            var off = new SEHemorrhage();

            on.GetInitialRate().SetValue(0.5);
            on.SetCompartment("RightLeg");
            off.GetInitialRate().SetValue(0.0);
            off.SetCompartment("RightLeg");

            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 20
0
        public static void apply_consume_nutrients(BioGearsEngine engine)
        {
            var on  = new SEConsumeNutrients();
            var off = new SEConsumeNutrients();

            on.GetNutrition().GetCalcium().SetValue(5, MassUnit.g);
            on.GetNutrition().GetCarbohydrate().SetValue(5, MassUnit.g);
            on.GetNutrition().GetFat().SetValue(5, MassUnit.g);
            on.GetNutrition().GetProtein().SetValue(5, MassUnit.g);
            on.GetNutrition().GetWater().SetValue(100, VolumeUnit.mL);

            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 21
0
        public static void apply_chest_occlusive_dressing(BioGearsEngine engine)
        {
            var on  = new SEChestOcclusiveDressing();
            var off = new SEChestOcclusiveDressing();

            on.SetSide(CDM.enumSide.value.Left);
            off.SetSide(CDM.enumSide.value.Left);

            on.SetActive(true);
            off.SetActive(false);

            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 22
0
        public static void apply_strength_exercise(BioGearsEngine engine)
        {
            var on  = new SEExercise();
            var off = new SEExercise();

            var strength = new SEExercise.SEStrengthTraining();

            strength.RepsStrength.SetValue(5);
            strength.WeightStrength.SetValue(0.2, MassUnit.kg);

            on.SetStrengthExercise(strength);

            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 23
0
        public static void apply_cycling_exercise(BioGearsEngine engine)
        {
            var on  = new SEExercise();
            var off = new SEExercise();

            var cycling = new SEExercise.SECycling();

            cycling.AddedWeight.SetValue(5, MassUnit.lb);
            cycling.PowerCycle.SetValue(20, PowerUnit.W);
            cycling.CadenceCycle.SetValue(50, FrequencyUnit.Hz);
            on.SetCyclingExercise(cycling);

            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 24
0
        public static void apply_infection(BioGearsEngine engine)
        {
            var on  = new SEInfection();
            var off = new SEInfection();

            on.SetLocation("Liver");
            on.SetSeverity(CDM.enumInfectionSeverity.value.Moderate);
            on.GetMinimumInhibitoryConcentration().SetValue(.5, MassPerVolumeUnit.g_Per_cm3);
            off.SetLocation("Liver");
            off.SetSeverity(CDM.enumInfectionSeverity.value.Eliminated);
            off.GetMinimumInhibitoryConcentration().SetValue(.0, MassPerVolumeUnit.g_Per_cm3);

            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 25
0
        public static void apply_running_exercise(BioGearsEngine engine)
        {
            var on  = new SEExercise();
            var off = new SEExercise();

            var running = new SEExercise.SERunning();

            running.AddedWeight.SetValue(5, MassUnit.kg);
            running.InclineRun.SetValue(0.2);
            running.SpeedRun.SetValue(5, LengthPerTimeUnit.ft_Per_min);


            on.SetRunningExercise(running);

            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 26
0
        public static void apply_burn_wound(BioGearsEngine engine)
        {
            var on  = new SEBurnWound();
            var off = new SEBurnWound();

            on.SetCompartment("Chest");
            on.SetInflammation(false);
            on.GetTotalBodySurfaceArea().SetValue(0.5);

            //Removing a BurnWound is a really bad idea
            //It causes issues with the inflamation model
            off.SetCompartment("Chest");
            off.SetInflammation(false);
            off.GetTotalBodySurfaceArea().SetValue(0.0);

            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 27
0
        public static void apply_generic_exercise(BioGearsEngine engine)
        {
            var on  = new SEExercise();
            var off = new SEExercise();

            var generic = new SEExercise.SEGeneric();

            generic.DesiredWorkRate.SetValue(5, PowerUnit.W);
            try {
                generic.Intensity.SetValue(0.8);
            } catch (global::System.Exception /*ex*/) {
                engine.GetLogger().Error("Intensity is an SEScalar0To1 which throws a CDMException if the set value is greater then 1.0");
            }

            on.SetGenericExercise(generic);

            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 28
0
        public static void apply_mechanical_ventilation(BioGearsEngine engine)
        {
            var oxygen = engine.GetSubstanceManager().GetSubstance("Oxygen");

            var on  = new SEMechanicalVentilation();
            var off = new SEMechanicalVentilation();

            on.SetState(CDM.enumOnOff.value.On);
            on.GetFlow().SetValue(30, VolumePerTimeUnit.L_Per_day);

            //Only access gas fractiosn this way to avoid memory management issues
            var oxygenFraction = on.GetGasFraction(oxygen);

            oxygenFraction.GetFractionAmount().SetValue(.5);

            on.GetPressure().SetValue(5, PressureUnit.mmHg);

            off.SetState(CDM.enumOnOff.value.Off);


            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 29
0
        public static void apply_conscious_respiration(BioGearsEngine engine)
        {
            var on       = new SEConsciousRespiration();
            var off      = new SEConsciousRespiration();
            var inhale_1 = on.AddForcedInhale();

            inhale_1.GetPeriod().SetValue(.125, TimeUnit.s);
            inhale_1.GetInspiratoryCapacityFraction().SetValue(.5);
            var exhale_1 = on.AddForcedExhale();

            exhale_1.GetPeriod().SetValue(.125, TimeUnit.s);
            exhale_1.GetExpiratoryReserveVolumeFraction().SetValue(.5);
            var inhale_2 = on.AddForcedInhale();

            inhale_2.GetPeriod().SetValue(.125, TimeUnit.s);
            inhale_2.GetInspiratoryCapacityFraction().SetValue(.5);
            var exhale_2 = on.AddForcedExhale();

            exhale_2.GetPeriod().SetValue(.125, TimeUnit.s);
            exhale_2.GetExpiratoryReserveVolumeFraction().SetValue(.5);

            apply_and_cancel_patient_action(engine, on, off);
        }
Ejemplo n.º 30
0
        //!
        //! Very Terse testing of the SWIG_Bindings
        //!
        //! We will simply test the ability
        //!   1. Create a logger and log to a file
        //!   2. Initialize a BioGearsEngine
        //!   3. Advance Model Time
        //!   4. Apply Actions to an exsiting BioGearsEngine
        //!   5. Create and Apply all BioGears Actions

        static void Main(string[] args)
        {
            var logger = new Logger("");

            logger.Warning("Perfect Now lets Try to compliate things with two modules!");

            var percent = new SEScalar0To1();

            percent.SetValue(0.1);

            logger.Info(String.Format("{0}", percent.GetValue()));

            var time = new SEScalarTime();

            time.SetValue(4, TimeUnit.s);
            logger.Info(String.Format("{0}", time.GetValue()));


            var engine = new BioGearsEngine(logger);

            engine.InitializeEngine("StandardMale.xml");
            engine.AdvanceModelTime();
            engine.AdvanceModelTimeBy(2.0, TimeUnit.s);

            var eh = new BioGearsEventHandler();

            engine.SetEventHandler(eh);

            var acuteStress = new SEAcuteStress();

            acuteStress.GetSeverity().SetValue(.75);

            logger.Warning(String.Format("AcuteStress @ Severity {0}", acuteStress.GetSeverity().GetValue()));
            engine.ProcessAction(acuteStress);

            engine.AdvanceModelTimeBy(2.0, TimeUnit.s);

            var severity = acuteStress.GetSeverity();

            severity.SetValue(0.5);

            engine.AdvanceModelTimeBy(2.0, TimeUnit.s);

            SEBurnWound m_burnWound = new SEBurnWound();

            m_burnWound.GetTotalBodySurfaceArea().SetValue(50.0 / 100.0);
            engine.ProcessAction(m_burnWound);
            engine.AdvanceModelTimeBy(2.0, TimeUnit.s);

            var m_substances = engine.GetSubstanceManager();
            var m_albumine   = m_substances.GetSubstance("Albumin");
            var m_saline     = m_substances.GetCompound("Saline");

            try {
                var m_SubstanceBolus     = new SESubstanceBolus(m_albumine);
                var m_SubstanceInfusion  = new SESubstanceInfusion(m_albumine);
                var m_SubstanceNasalDose = new SESubstanceNasalDose(m_albumine);
                var m_SubstanceOralDose  = new SESubstanceOralDose(m_albumine);
            } catch (global::System.Exception /*ex*/) {
                logger.Error("Definition of Albumin is missing.  Unable to test Substance Actions");
            }

            try {
                var m_SubstanceCompoundInfusion = new SESubstanceCompoundInfusion(m_saline);
            } catch (global::System.Exception /*ex*/) {
                logger.Error("Definition of Saline is missing.  Unable to test SubstanceCompound  Actions");
            }

            var m_TensionPneumothorax = new SETensionPneumothorax();
            var m_Tourniquet          = new SETourniquet();
            var m_Urinate             = new SEUrinate();
            var m_UseInhaler          = new SEUseInhaler();

            var  patient        = engine.GetPatient();
            bool isTacycardia   = patient.IsEventActive(CDM.enumPatientEvent.value.Tachycardia);
            bool isAlive        = patient.IsEventActive(CDM.enumPatientEvent.value.IrreversibleState);
            bool isKetoacidosis = patient.IsEventActive(CDM.enumPatientEvent.value.Ketoacidosis);

            logger.Warning(String.Format("AcuteStress @ Severity {0}", acuteStress.GetSeverity().GetValue()));

            //!
            //! Very Quick Example of how to use Data Tracks to Poll data
            //! Performance wise this should really only be used for non PhysiologyDataRequest
            //!
            var HeartRateRequest = engine.GetEngineTrack().GetDataRequestManager().CreatePhysiologyDataRequest(); HeartRateRequest.Set("HeartRate", FrequencyUnit.Per_min);
            var SystolicArterialPressureRequest  = engine.GetEngineTrack().GetDataRequestManager().CreatePhysiologyDataRequest(); SystolicArterialPressureRequest.Set("SystolicArterialPressure", PressureUnit.mmHg);
            var DiastolicArterialPressureRequest = engine.GetEngineTrack().GetDataRequestManager().CreatePhysiologyDataRequest(); DiastolicArterialPressureRequest.Set("DiastolicArterialPressure", PressureUnit.mmHg);
            var RespirationRateRequest           = engine.GetEngineTrack().GetDataRequestManager().CreatePhysiologyDataRequest(); RespirationRateRequest.Set("RespirationRate", FrequencyUnit.Per_min);
            var TidalVolumeRequest      = engine.GetEngineTrack().GetDataRequestManager().CreatePhysiologyDataRequest(); TidalVolumeRequest.Set("TidalVolume", VolumeUnit.mL);
            var TotalLungVolumeRequest  = engine.GetEngineTrack().GetDataRequestManager().CreatePhysiologyDataRequest(); TotalLungVolumeRequest.Set("TotalLungVolume", VolumeUnit.mL);
            var OxygenSaturationRequest = engine.GetEngineTrack().GetDataRequestManager().CreatePhysiologyDataRequest(); OxygenSaturationRequest.Set("OxygenSaturation");

            //TODO: Get Substance and GetSubstanceCompound need better exception handeling
            var oxygen        = engine.GetSubstanceManager().GetSubstance("Oxygen");
            var carbonDioxide = engine.GetSubstanceManager().GetSubstance("CarbonDioxide");

            //Final exonicus data requests
            var ecg = engine.GetEngineTrack().GetDataRequestManager().CreateEquipmentDataRequest(); ecg.SetDataRequestType("ECG"); ecg.Set("Lead3ElectricPotential", ElectricPotentialUnit.mV);
            var MeanUrineRequest        = engine.GetEngineTrack().GetDataRequestManager().CreatePhysiologyDataRequest(); MeanUrineRequest.Set("MeanUrineOutput", VolumePerTimeUnit.mL_Per_hr);
            var BrainVasculatureRequest = engine.GetEngineTrack().GetDataRequestManager().CreateLiquidCompartmentDataRequest(); BrainVasculatureRequest.Set("BrainVasculature", oxygen, "PartialPressure", PressureUnit.mmHg);
            var TracheaPartialPressure  = engine.GetEngineTrack().GetDataRequestManager().CreateGasCompartmentDataRequest(); TracheaPartialPressure.Set("Trachea", carbonDioxide, "PartialPressure", PressureUnit.mmHg);

            engine.GetEngineTrack().SetupRequests();

            var HeartRate = engine.GetEngineTrack().GetScalar(HeartRateRequest);
            var SystolicArterialPressure  = engine.GetEngineTrack().GetScalar(HeartRateRequest);
            var DiastolicArterialPressure = engine.GetEngineTrack().GetScalar(DiastolicArterialPressureRequest);
            var RespirationRate           = engine.GetEngineTrack().GetScalar(RespirationRateRequest);
            var TidalVolume        = engine.GetEngineTrack().GetScalar(TidalVolumeRequest);
            var TotalLungVolume    = engine.GetEngineTrack().GetScalar(TotalLungVolumeRequest);
            var OxygenSaturation   = engine.GetEngineTrack().GetScalar(OxygenSaturationRequest);
            var PartialPressure    = engine.GetEngineTrack().GetScalar(BrainVasculatureRequest);
            var CO2PartialPressure = engine.GetEngineTrack().GetScalar(TracheaPartialPressure);
            var Urine   = engine.GetEngineTrack().GetScalar(MeanUrineRequest);
            var ecgData = engine.GetEngineTrack().GetScalar(ecg);


            apply_acute_respiratory_distress(engine);

            engine.GetEngineTrack().PullData();
            logger.Info(HeartRate.ToString());
            logger.Info(SystolicArterialPressure.ToString());
            logger.Info(DiastolicArterialPressure.ToString());
            logger.Info(RespirationRate.ToString());
            logger.Info(TidalVolume.ToString());
            logger.Info(TotalLungVolume.ToString());
            logger.Info(OxygenSaturation.ToString());
            logger.Info(PartialPressure.ToString());
            logger.Info(CO2PartialPressure.ToString());
            logger.Info(Urine.ToString());
            logger.Info("ecg: \n");
            logger.Info(ecgData.ToString());



            //!
            //!  Just to test most actions we will apply and unapply every action in 2 second sperts
            //!
            apply_acute_stress(engine);
            engine.GetEngineTrack().PullData();
            apply_airway_obstruction(engine);
            engine.GetEngineTrack().PullData();
            apply_apnea(engine);
            engine.GetEngineTrack().PullData();
            apply_asthma_attack(engine);
            engine.GetEngineTrack().PullData();
            apply_brain_injury(engine);
            engine.GetEngineTrack().PullData();
            apply_breath_hold(engine);
            engine.GetEngineTrack().PullData();
            apply_bronchoconstriction(engine);
            engine.GetEngineTrack().PullData();
            apply_burn_wound(engine);
            engine.GetEngineTrack().PullData();
            apply_cardiac_arrest(engine);
            engine.GetEngineTrack().PullData();

            logger.Info(HeartRate.ToString());
            logger.Info(SystolicArterialPressure.ToString());
            logger.Info(DiastolicArterialPressure.ToString());
            logger.Info(RespirationRate.ToString());
            logger.Info(TidalVolume.ToString());
            logger.Info(TotalLungVolume.ToString());
            logger.Info(OxygenSaturation.ToString());

            apply_chest_compression(engine);
            engine.GetEngineTrack().PullData();
            apply_chest_compression_force(engine);
            engine.GetEngineTrack().PullData();
            apply_chest_compression_force_scale(engine);
            engine.GetEngineTrack().PullData();
            apply_chest_occlusive_dressing(engine);
            engine.GetEngineTrack().PullData();
            apply_conscious_respiration(engine);
            engine.GetEngineTrack().PullData();
            apply_consume_nutrients(engine);
            engine.GetEngineTrack().PullData();
            apply_exercise(engine);
            engine.GetEngineTrack().PullData();
            apply_cycling_exercise(engine);
            engine.GetEngineTrack().PullData();
            apply_generic_exercise(engine);
            engine.GetEngineTrack().PullData();
            apply_running_exercise(engine);
            engine.GetEngineTrack().PullData();
            apply_strength_exercise(engine);
            engine.GetEngineTrack().PullData();
            apply_hemorrhage(engine);
            engine.GetEngineTrack().PullData();
            apply_infection(engine);
            engine.GetEngineTrack().PullData();
            apply_intubation(engine);
            engine.GetEngineTrack().PullData();
            apply_mechanical_ventilation(engine);
            engine.GetEngineTrack().PullData();
            apply_needle_decompression(engine);
            engine.GetEngineTrack().PullData();
            apply_override(engine);
            engine.GetEngineTrack().PullData();
            apply_pain_stimulus(engine);
            engine.GetEngineTrack().PullData();
            apply_patient_assessment_request(engine);
            engine.GetEngineTrack().PullData();
            apply_pericadial_effusion(engine);
            engine.GetEngineTrack().PullData();

            logger.Info(HeartRate.ToString());
            logger.Info(SystolicArterialPressure.ToString());
            logger.Info(DiastolicArterialPressure.ToString());
            logger.Info(RespirationRate.ToString());
            logger.Info(TidalVolume.ToString());
            logger.Info(TotalLungVolume.ToString());
            logger.Info(OxygenSaturation.ToString());

            apply_pulmonary_shunt(engine);
            engine.GetEngineTrack().PullData();
            apply_sleep(engine);

            engine.GetEngineTrack().PullData();
            logger.Info(HeartRate.ToString());
            logger.Info(SystolicArterialPressure.ToString());
            logger.Info(DiastolicArterialPressure.ToString());
            logger.Info(RespirationRate.ToString());
            logger.Info(TidalVolume.ToString());
            logger.Info(TotalLungVolume.ToString());
            logger.Info(OxygenSaturation.ToString());

            var AMConfig = new SEAnesthesiaMachineConfiguration(engine.GetSubstanceManager());
            var config   = AMConfig.GetConfiguration();

            config.SetConnection(CDM.enumAnesthesiaMachineConnection.value.Mask);
            config.GetInletFlow().SetValue(2.0, VolumePerTimeUnit.L_Per_min);
            config.GetInspiratoryExpiratoryRatio().SetValue(.5);
            config.GetOxygenFraction().SetValue(.5);
            config.SetOxygenSource(CDM.enumAnesthesiaMachineOxygenSource.value.Wall);
            config.GetPositiveEndExpiredPressure().SetValue(0.0, PressureUnit.cmH2O);
            config.SetPrimaryGas(CDM.enumAnesthesiaMachinePrimaryGas.value.Nitrogen);
            config.GetReliefValvePressure().SetValue(20.0, PressureUnit.cmH2O);
            config.GetRespiratoryRate().SetValue(12, FrequencyUnit.Per_min);
            config.GetVentilatorPressure().SetValue(0.0, PressureUnit.cmH2O);
            config.GetOxygenBottleOne().GetVolume().SetValue(660.0, VolumeUnit.L);
            config.GetOxygenBottleTwo().GetVolume().SetValue(660.0, VolumeUnit.L);
            engine.ProcessAction(AMConfig);

            engine.AdvanceModelTimeBy(2.0, TimeUnit.s);
            config.GetInletFlow().SetValue(5.0, VolumePerTimeUnit.L_Per_min);
            config.GetPositiveEndExpiredPressure().SetValue(3.0, PressureUnit.cmH2O);
            config.GetVentilatorPressure().SetValue(22.0, PressureUnit.cmH2O);
            engine.ProcessAction(AMConfig);

            engine.AdvanceModelTimeBy(2.0, TimeUnit.s);
            config.GetInspiratoryExpiratoryRatio().SetValue(1.0);
            config.GetPositiveEndExpiredPressure().SetValue(1.0, PressureUnit.cmH2O);
            config.GetRespiratoryRate().SetValue(18.0, FrequencyUnit.Per_min);
            config.GetVentilatorPressure().SetValue(10.0, PressureUnit.cmH2O);
            engine.ProcessAction(AMConfig);

            engine.AdvanceModelTimeBy(2.0, TimeUnit.s);
            var AMleak = new SEMaskLeak();

            AMleak.GetSeverity().SetValue(0.5);
            engine.ProcessAction(AMleak);
            engine.GetLogger().Info("Removing the mask leak.");

            engine.AdvanceModelTimeBy(2.0, TimeUnit.s);
            var AMpressureloss = new SEOxygenWallPortPressureLoss();

            AMpressureloss.SetActive(true);
            engine.ProcessAction(AMpressureloss);
            engine.GetLogger().Info("Testing the oxygen pressure loss failure mode. The oxygen pressure from the wall source is dropping.");

            AMpressureloss.SetActive(false);
            engine.ProcessAction(AMpressureloss);
            engine.GetLogger().Info("Removing the wall oxygen pressure loss action.");
            engine.AdvanceModelTimeBy(2, TimeUnit.s);

            engine.SaveStateToFile("*****@*****.**");

            Console.Write("Simulation Finished Press any key to continue");
            var testString = Console.ReadLine();
        }