Ejemplo n.º 1
0
		/// <summary>
		///   Initializes a new instance.
		/// </summary>
		/// <param name="results">The result of the safety analysis the order analysis should be conducted for.</param>
		/// <param name="configuration">The model checker's configuration that determines certain model checker settings.</param>
		internal OrderAnalysis(SafetyAnalysisResults results, AnalysisConfiguration configuration)
		{
			Requires.NotNull(results, nameof(results));

			_results = results;
			_backend.InitializeModel(configuration, results.Model, results.Hazard);
		}
Ejemplo n.º 2
0
        /// <summary>
        ///   Initializes a new instance.
        /// </summary>
        /// <param name="createModel">Creates model that should be checked.</param>
        /// <param name="output">The callback that should be used to output messages.</param>
        /// <param name="configuration">The analysis configuration that should be used.</param>
        internal InvariantChecker(Func <RuntimeModel> createModel, Action <string> output, AnalysisConfiguration configuration)
        {
            Requires.NotNull(createModel, nameof(createModel));
            Requires.NotNull(output, nameof(output));

            _progressOnly = configuration.ProgressReportsOnly;
            _output       = output;
            _workers      = new Worker[configuration.CpuCount];

            var tasks  = new Task[configuration.CpuCount];
            var stacks = new StateStack[configuration.CpuCount];

            _loadBalancer = new LoadBalancer(stacks);

            for (var i = 0; i < configuration.CpuCount; ++i)
            {
                var index = i;
                tasks[i] = Task.Factory.StartNew(() =>
                {
                    stacks[index]   = new StateStack(configuration.StackCapacity);
                    _workers[index] = new Worker(index, this, stacks[index], createModel, configuration.SuccessorCapacity);
                });
            }

            Task.WaitAll(tasks);

            _states = new StateStorage(_workers[0].StateVectorLayout, configuration.StateCapacity);

#if false
            Console.WriteLine(_workers[0].StateVectorLayout);
#endif
        }
Ejemplo n.º 3
0
		/// <summary>
		///   Computes the order relationships for all minimal critical fault sets contained in the
		///   <paramref name="safetyAnalysisResults" />.
		/// </summary>
		/// <param name="safetyAnalysisResults">The results of the safety analysis the order relationships should be computed for.</param>
		/// <param name="configuration">The configuration settings of the model checker that should be used.</param>
		public static OrderAnalysisResults ComputeOrderRelationships(SafetyAnalysisResults safetyAnalysisResults,
																	 AnalysisConfiguration configuration)
		{
			var analysis = new OrderAnalysis(safetyAnalysisResults, configuration);
			return analysis.ComputeOrderRelationships();
		}
Ejemplo n.º 4
0
 static SafetySharpModelChecker()
 {
     TraversalConfiguration = AnalysisConfiguration.Default;
     TraversalConfiguration.EnableEarlyTermination = true;
 }