Example #1
0
            public ResultContainer Calculate(DataContainer data)
            {
                double      H          = data.Time / data.TimeSteps;
                Constructor constuctor = new Constructor();

                constuctor.CreateModel(data.ModelComponents, data.λ, data.μ, data.e, data.v, data.μi, H);
                Pi  = constuctor.Pi;
                Pij = constuctor.Pij;
                Pji = constuctor.Pji;

                ResultContainer result = new ResultContainer();
                double          error  = 0;

                for (int i = 0; i <= data.TimeSteps; i++)
                {
                    result.Times.Add(H * i);
                    result.Values.Add(Pi[Pi.Count - 1].CurrentValue);

                    double Summ = 0;
                    for (int j = 0; j < Pij.Count; j++)
                    {
                        Summ += Pi[j].CurrentValue + Pij[j].CurrentValue + Pji[j].CurrentValue;
                    }
                    error += Math.Abs(1 - Summ - Pi[Pi.Count - 1].CurrentValue);
                    result.Errors.Add(error);

                    CalculateK1();
                    CalculateK2();
                    CalculateK3();
                    CalculateK4();
                    CalculateNextValue();
                }
                return(result);
            }