public void CalculateHazardWithoutEarlyTermination() { LustreModelChecker.TraversalConfiguration.EnableEarlyTermination = false; var result = LustreModelChecker.CalculateProbabilityToReachStateBounded(Path.Combine(AssemblyDirectory, "pressureTank.lus"), "TANK", _faults, _hazard, 25); LustreModelChecker.TraversalConfiguration.EnableEarlyTermination = true; Console.Write($"Probability of hazard: {result}"); }
public void CalculateHazardSingleCore() { LustreModelChecker.TraversalConfiguration.CpuCount = 1; LustreModelChecker.TraversalConfiguration.EnableEarlyTermination = false; LustreModelChecker.TraversalConfiguration.EnableStaticPruningOptimization = false; var result = LustreModelChecker.CalculateProbabilityToReachStateBounded(Path.Combine(AssemblyDirectory, "pressureTank.lus"), "TANK", _faults, _hazard, 25); LustreModelChecker.TraversalConfiguration.CpuCount = Int32.MaxValue; LustreModelChecker.TraversalConfiguration.EnableEarlyTermination = true; LustreModelChecker.TraversalConfiguration.EnableStaticPruningOptimization = true; Console.Write($"Probability of hazard: {result}"); }
public void Parametric() { Formula invariant = new LustrePressureBelowThreshold(); Formula hazard = new UnaryFormula(invariant, UnaryOperator.Not); LustrePressureBelowThreshold.threshold = 60; var faultK1 = new PermanentFault() { Name = "fault_k1", Identifier = 1, ProbabilityOfOccurrence = new Probability(3.0E-6) }; var faultK2 = new PermanentFault() { Name = "fault_k2", Identifier = 2, ProbabilityOfOccurrence = new Probability(3.0E-6) }; var faultSensor = new PermanentFault() { Name = "fault_sensor", Identifier = 4, ProbabilityOfOccurrence = new Probability(1.0E-5) }; var faults = new[] { faultK1, faultK2, faultSensor }; var parameter = new QuantitativeParametricAnalysisParameter { StateFormula = hazard, Bound = null, From = 3.0E-7, To = 3.0E-5, Steps = 25, }; using (var fileWriter = new StreamWriter(Path.Combine(AssemblyDirectory, "pressureTank_varyK1.csv"), append: false)) { parameter.UpdateParameterInModel = value => { faultK1.ProbabilityOfOccurrence = new Probability(value); }; var result = LustreModelChecker.ConductQuantitativeParametricAnalysis(Path.Combine(AssemblyDirectory, "pressureTank.lus"), "TANK", faults, parameter); result.ToCsv(fileWriter); } using (var fileWriter = new StreamWriter(Path.Combine(AssemblyDirectory, "pressureTank_varyK2.csv"), append: false)) { parameter.UpdateParameterInModel = value => { faultK2.ProbabilityOfOccurrence = new Probability(value); }; var result = LustreModelChecker.ConductQuantitativeParametricAnalysis(Path.Combine(AssemblyDirectory, "pressureTank.lus"), "TANK", faults, parameter); result.ToCsv(fileWriter); } using (var fileWriter = new StreamWriter(Path.Combine(AssemblyDirectory, "pressureTank_varySensor.csv"), append: false)) { parameter.UpdateParameterInModel = value => { faultSensor.ProbabilityOfOccurrence = new Probability(value); }; var result = LustreModelChecker.ConductQuantitativeParametricAnalysis(Path.Combine(AssemblyDirectory, "pressureTank.lus"), "TANK", faults, parameter); result.ToCsv(fileWriter); } }