Exemplo n.º 1
0
        public void DialyzerWorks_Simulation()
        {
            var specification = new DialyzerTestEnvironment();

            var simulator          = new Simulator(specification);    //Important: Call after all objects have been created
            var dialyzerAfterStep0 = (Dialyzer)simulator.Model.Roots.OfType <Dialyzer>().First();
            var patientAfterStep0  =
                (DialyzerTestEnvironmentPatient)
                simulator.Model.Roots.OfType <DialyzerTestEnvironmentPatient>().First();

            Console.Out.WriteLine("Initial");
            patientAfterStep0.ArteryFlow.Outgoing.Forward.PrintBloodValues("outgoing Blood");
            patientAfterStep0.VeinFlow.Incoming.Forward.PrintBloodValues("incoming Blood");
            patientAfterStep0.PrintBloodValues("");
            Console.Out.WriteLine("Step 1");
            simulator.SimulateStep();
            var dialyzerAfterStep1 = (Dialyzer)simulator.Model.Roots.OfType <Dialyzer>().First();
            var patientAfterStep1  =
                (DialyzerTestEnvironmentPatient)
                simulator.Model.Roots.OfType <DialyzerTestEnvironmentPatient>().First();

            patientAfterStep1.ArteryFlow.Outgoing.Forward.PrintBloodValues("outgoing Blood");
            patientAfterStep1.VeinFlow.Incoming.Forward.PrintBloodValues("incoming Blood");
            patientAfterStep1.PrintBloodValues("");
            Console.Out.WriteLine("Step 2");
            simulator.SimulateStep();
            var dialyzerAfterStep2 = (Dialyzer)simulator.Model.Roots.OfType <Dialyzer>().First();
            var patientAfterStep2  =
                (DialyzerTestEnvironmentPatient)
                simulator.Model.Roots.OfType <DialyzerTestEnvironmentPatient>().First();

            patientAfterStep2.ArteryFlow.Outgoing.Forward.PrintBloodValues("outgoing Blood");
            patientAfterStep2.VeinFlow.Incoming.Forward.PrintBloodValues("incoming Blood");
            patientAfterStep2.PrintBloodValues("");
            Console.Out.WriteLine("Step 3");
            simulator.SimulateStep();
            var dialyzerAfterStep3 = (Dialyzer)simulator.Model.Roots.OfType <Dialyzer>().First();
            var patientAfterStep3  =
                (DialyzerTestEnvironmentPatient)
                simulator.Model.Roots.OfType <DialyzerTestEnvironmentPatient>().First();

            patientAfterStep3.ArteryFlow.Outgoing.Forward.PrintBloodValues("outgoing Blood");
            patientAfterStep3.VeinFlow.Incoming.Forward.PrintBloodValues("incoming Blood");
            patientAfterStep3.PrintBloodValues("");
            Console.Out.WriteLine("Step 4");
            simulator.SimulateStep();
            var dialyzerAfterStep4 = (Dialyzer)simulator.Model.Roots.OfType <Dialyzer>().First();
            var patientAfterStep4  =
                (DialyzerTestEnvironmentPatient)
                simulator.Model.Roots.OfType <DialyzerTestEnvironmentPatient>().First();

            patientAfterStep4.ArteryFlow.Outgoing.Forward.PrintBloodValues("outgoing Blood");
            patientAfterStep4.VeinFlow.Incoming.Forward.PrintBloodValues("incoming Blood");
            patientAfterStep4.PrintBloodValues("");

            //dialyzerAfterStep1.Should().Be(1);
            patientAfterStep4.BigWasteProducts.Should().Be(0);
            patientAfterStep4.SmallWasteProducts.Should().Be(2);
        }
Exemplo n.º 2
0
        public void DialyzerWorks_ModelChecking()
        {
            var specification = new DialyzerTestEnvironment();
            var analysis      = new SafetyAnalysis();

            var result = analysis.ComputeMinimalCriticalSets(specification, specification.Dialyzer.MembraneIntact == false);

            result.SaveCounterExamples("counter examples/hdmachine");

            Console.WriteLine(result);
        }
Exemplo n.º 3
0
		public void DialyzerWorks_ModelChecking()
		{
			var specification = new DialyzerTestEnvironment();
			var analysis = new SafetyAnalysis();

			var result = analysis.ComputeMinimalCriticalSets(specification, specification.Dialyzer.MembraneIntact==false);
			result.SaveCounterExamples("counter examples/hdmachine");

			Console.WriteLine(result);
		}
Exemplo n.º 4
0
		public void DialyzerWorks_Simulation()
		{
			var specification = new DialyzerTestEnvironment();

			var simulator = new Simulator(specification); //Important: Call after all objects have been created
			var dialyzerAfterStep0 = (Dialyzer)simulator.Model.Roots.OfType<Dialyzer>().First();
			var patientAfterStep0 =
				(DialyzerTestEnvironmentPatient)
					simulator.Model.Roots.OfType<DialyzerTestEnvironmentPatient>().First();
			Console.Out.WriteLine("Initial");
			patientAfterStep0.ArteryFlow.Outgoing.Forward.PrintBloodValues("outgoing Blood");
			patientAfterStep0.VeinFlow.Incoming.Forward.PrintBloodValues("incoming Blood");
			patientAfterStep0.PrintBloodValues("");
			Console.Out.WriteLine("Step 1");
			simulator.SimulateStep();
			var dialyzerAfterStep1 = (Dialyzer)simulator.Model.Roots.OfType<Dialyzer>().First();
			var patientAfterStep1 =
				(DialyzerTestEnvironmentPatient)
					simulator.Model.Roots.OfType<DialyzerTestEnvironmentPatient>().First();
			patientAfterStep1.ArteryFlow.Outgoing.Forward.PrintBloodValues("outgoing Blood");
			patientAfterStep1.VeinFlow.Incoming.Forward.PrintBloodValues("incoming Blood");
			patientAfterStep1.PrintBloodValues("");
			Console.Out.WriteLine("Step 2");
			simulator.SimulateStep();
			var dialyzerAfterStep2 = (Dialyzer)simulator.Model.Roots.OfType<Dialyzer>().First();
			var patientAfterStep2 =
				(DialyzerTestEnvironmentPatient)
					simulator.Model.Roots.OfType<DialyzerTestEnvironmentPatient>().First();
			patientAfterStep2.ArteryFlow.Outgoing.Forward.PrintBloodValues("outgoing Blood");
			patientAfterStep2.VeinFlow.Incoming.Forward.PrintBloodValues("incoming Blood");
			patientAfterStep2.PrintBloodValues("");
			Console.Out.WriteLine("Step 3");
			simulator.SimulateStep();
			var dialyzerAfterStep3 = (Dialyzer)simulator.Model.Roots.OfType<Dialyzer>().First();
			var patientAfterStep3 =
				(DialyzerTestEnvironmentPatient)
					simulator.Model.Roots.OfType<DialyzerTestEnvironmentPatient>().First();
			patientAfterStep3.ArteryFlow.Outgoing.Forward.PrintBloodValues("outgoing Blood");
			patientAfterStep3.VeinFlow.Incoming.Forward.PrintBloodValues("incoming Blood");
			patientAfterStep3.PrintBloodValues("");
			Console.Out.WriteLine("Step 4");
			simulator.SimulateStep();
			var dialyzerAfterStep4 = (Dialyzer)simulator.Model.Roots.OfType<Dialyzer>().First();
			var patientAfterStep4 =
				(DialyzerTestEnvironmentPatient)
					simulator.Model.Roots.OfType<DialyzerTestEnvironmentPatient>().First();
			patientAfterStep4.ArteryFlow.Outgoing.Forward.PrintBloodValues("outgoing Blood");
			patientAfterStep4.VeinFlow.Incoming.Forward.PrintBloodValues("incoming Blood");
			patientAfterStep4.PrintBloodValues("");

			//dialyzerAfterStep1.Should().Be(1);
			patientAfterStep4.BigWasteProducts.Should().Be(0);
			patientAfterStep4.SmallWasteProducts.Should().Be(2);
		}