public void CalculateDcca() { var model = new ExampleModelBase(); var analysis = new SafetySharpSafetyAnalysis { Backend = SafetyAnalysisBackend.FaultOptimizedOnTheFly, Heuristics = { new MaximalSafeSetHeuristic(model.Faults) } }; var result = analysis.ComputeMinimalCriticalSets(model, model.ModelComponent.HazardActive); //result.SaveCounterExamples("counter examples/height control/dcca/collision/original"); var orderResult = SafetySharpOrderAnalysis.ComputeOrderRelationships(result); Console.WriteLine(orderResult); }
public void FalseAlarmOriginalDesign( [Values(SafetyAnalysisBackend.FaultOptimizedStateGraph, SafetyAnalysisBackend.FaultOptimizedOnTheFly)] SafetyAnalysisBackend backend) { var model = Model.CreateOriginal(); var analysis = new SafetySharpSafetyAnalysis { Backend = backend, Heuristics = { new MaximalSafeSetHeuristic(model.Faults) } }; var result = analysis.ComputeMinimalCriticalSets(model, model.FalseAlarm); result.SaveCounterExamples("counter examples/height control/dcca/false alarm/original"); var orderResult = SafetySharpOrderAnalysis.ComputeOrderRelationships(result); Console.WriteLine(orderResult); }
public void CalculateDcca() { var model = new SimpleBayesianExampleModel(); var analysis = new SafetySharpSafetyAnalysis { Backend = SafetyAnalysisBackend.FaultOptimizedOnTheFly, Heuristics = { new MaximalSafeSetHeuristic(model.Faults) } }; var result = analysis.ComputeMinimalCriticalSets(model, model.Component.Hazard); var orderResult = SafetySharpOrderAnalysis.ComputeOrderRelationships(result); Console.WriteLine(orderResult); }
protected OrderAnalysisResults <SafetySharpRuntimeModel> AnalyzeOrder(Formula hazard, params IComponent[] components) { var configuration = AnalysisConfiguration.Default; configuration.ModelCapacity = ModelCapacityByMemorySize.Tiny; configuration.GenerateCounterExample = !SuppressCounterExampleGeneration; configuration.ProgressReportsOnly = true; configuration.DefaultTraceOutput = Output.TextWriterAdapter(); var analysis = new SafetySharpOrderAnalysis(DccaWithMaxCardinality(hazard, Int32.MaxValue, components), configuration); var result = analysis.ComputeOrderRelationships(); Output.Log("{0}", result); return(result); }
public void DialysisFinishedAndBloodNotCleaned_ModelChecking( [Values(SafetyAnalysisBackend.FaultOptimizedStateGraph, SafetyAnalysisBackend.FaultOptimizedOnTheFly)] SafetyAnalysisBackend backend) { var specification = new Model(); var analysis = new SafetySharpSafetyAnalysis { Backend = backend, Configuration = { ModelCapacity = new ModelCapacityByModelDensity(1310720, ModelDensityLimit.Medium) } }; var result = analysis.ComputeMinimalCriticalSets(specification, specification.BloodNotCleanedAndDialyzingFinished); result.SaveCounterExamples("counter examples/hdmachine_unsuccessful"); var orderResult = SafetySharpOrderAnalysis.ComputeOrderRelationships(result); Console.WriteLine(orderResult); }
public void IncomingBloodIsContaminated_ModelChecking( [Values(SafetyAnalysisBackend.FaultOptimizedStateGraph, SafetyAnalysisBackend.FaultOptimizedOnTheFly)] SafetyAnalysisBackend backend) { var specification = new Model(); var analysis = new SafetySharpSafetyAnalysis { Backend = backend, Heuristics = { new MaximalSafeSetHeuristic(specification.Faults) }, Configuration = { ModelCapacity = new ModelCapacityByModelDensity(1310720, ModelDensityLimit.Medium) } }; var result = analysis.ComputeMinimalCriticalSets(specification, specification.IncomingBloodWasNotOk); result.SaveCounterExamples("counter examples/hdmachine_contamination"); var orderResult = SafetySharpOrderAnalysis.ComputeOrderRelationships(result); Console.WriteLine(orderResult); }
public void CollisionOriginalDesign( [Values(SafetyAnalysisBackend.FaultOptimizedStateGraph, SafetyAnalysisBackend.FaultOptimizedOnTheFly)] SafetyAnalysisBackend backend) { var model = Model.CreateOriginal(); // As collisions cannot occur without any overheight vehicles driving on the left lane, we // force the activation of the LeftOHV fault to improve safety analysis times significantly model.VehicleSet.LeftOHV.Activation = Activation.Forced; var analysis = new SafetySharpSafetyAnalysis { Backend = backend, Heuristics = { new MaximalSafeSetHeuristic(model.Faults) } }; var result = analysis.ComputeMinimalCriticalSets(model, model.Collision); result.SaveCounterExamples("counter examples/height control/dcca/collision/original"); var orderResult = SafetySharpOrderAnalysis.ComputeOrderRelationships(result); Console.WriteLine(orderResult); }
public void TankRupture() { var model = new Model(); var result = SafetySharpSafetyAnalysis.AnalyzeHazard(model, model.Tank.IsRuptured); result.SaveCounterExamples("counter examples/pressure tank/dcca/tank rupture"); var orderResult = SafetySharpOrderAnalysis.ComputeOrderRelationships(result); Console.WriteLine(orderResult); result.IsComplete.Should().BeTrue(); result.MinimalCriticalSets.ShouldAllBeEquivalentTo(new[] { // The tank rupture hazard has only one single minimial critical set consisting of the following to faults new[] { model.Sensor.SuppressIsFull, model.Timer.SuppressTimeout } }); orderResult.OrderRelationships[result.MinimalCriticalSets.Single()].Single().FirstFault.Should().Be(model.Sensor.SuppressIsFull); orderResult.OrderRelationships[result.MinimalCriticalSets.Single()].Single().SecondFault.Should().Be(model.Timer.SuppressTimeout); }
public void Collision( [Values(SafetyAnalysisBackend.FaultOptimizedStateGraph, SafetyAnalysisBackend.FaultOptimizedOnTheFly)] SafetyAnalysisBackend backend) { var model = new Model(); var result = SafetySharpSafetyAnalysis.AnalyzeHazard(model, model.PossibleCollision, backend: backend); result.SaveCounterExamples("counter examples/railroad crossing/dcca/collision"); var orderResult = SafetySharpOrderAnalysis.ComputeOrderRelationships(result); Console.WriteLine(orderResult); result.IsComplete.Should().BeTrue(); result.MinimalCriticalSets.ShouldAllBeEquivalentTo(new[] { new[] { model.TrainController.Odometer.OdometerPositionOffset }, new[] { model.TrainController.Odometer.OdometerSpeedOffset }, new[] { model.CrossingController.Sensor.BarrierSensorFailure }, new[] { model.CrossingController.TrainSensor.ErroneousTrainDetection }, new[] { model.CrossingController.Motor.BarrierMotorStuck, model.TrainController.Brakes.BrakesFailure }, new[] { model.Channel.MessageDropped, model.TrainController.Brakes.BrakesFailure } }); }