Exemple #1
0
 /// <summary>
 /// Returns simulation results based on Monte Carlo method
 /// </summary>
 /// <param name="distributionInput">Represents user defined variables for
 /// probability distribution and simulation results</param>
 /// <param name="distributionType">Represents selected probability distribution</param>
 public IList <StatisticalResult> Run(DistributionInput distributionInput, DistributionType distributionType)
 {
     SimulationResult = ToggleDistribution(distributionInput, distributionType);
     if (SimulationResult.FittedValues.Count > 0)
     {
         if (_statisticalInput == null)
         {
             _statisticalInput = new StatisticalInput();
         }
         _statisticalInput.Interval    = distributionInput.Interval;
         _statisticalInput.Iteration   = distributionInput.Iteration;
         _statisticalInput.FitMinValue = SimulationResult.FittedValues.Min();
         _statisticalInput.FitMaxValue = SimulationResult.FittedValues.Max();
         _statisticalInput.MaxValue    = SimulationResult.SimulatedValues.Max();
         _statisticalInput.MinValue    = SimulationResult.SimulatedValues.Min();
         return(GetSimResult(_statisticalInput, SimulationResult.FittedValues));
     }
     throw new ArgumentException();
 }
Exemple #2
0
        private ISimulationResult ToggleDistribution(DistributionInput distributionInput, DistributionType distributionType)
        {
            ISimulationResult distributions = null;

            switch (distributionType)
            {
            case DistributionType.Uniform:
                distributions = new Uniform().GetDistribution(distributionInput.Delegate,
                                                              distributionInput.Iteration, distributionInput.UncertaintyArray);
                break;

            case DistributionType.Triangular:
                distributions = new Triangular().GetDistribution(distributionInput.Delegate,
                                                                 distributionInput.Iteration, distributionInput.UncertaintyArray);
                break;

            case DistributionType.Normal:
                break;

            case DistributionType.Log_Normal:
                break;
            }
            return(distributions);
        }
Exemple #3
0
 /// <summary>
 /// Simulator contructor
 /// </summary>
 /// <param name="distributionInput">Represents user defined variables for
 /// probability distribution and simulation results</param>
 /// <param name="distributionType">Represents selected probability distribution</param>
 public Simulator(DistributionInput distributionInput, DistributionType distributionType)
 {
     _distributionInput = distributionInput;
     _distributionType  = distributionType;
 }