Example #1
0
        public override ResultContainer Calculate(IDataContainer dataContainer)
        {
            if (!(dataContainer is ThirdDataContainer))
            {
                throw new Exception("Неверный тип контейнера");
            }
            ThirdDataContainer data = (ThirdDataContainer)dataContainer;
            double             H    = data.Time / data.TimeSteps;

            ThirdConstructor constuctor = new ThirdConstructor();

            constuctor.CreateModel(data.ModelComponents, data.Lambda, data.Mu, data.e, data.v, data.Mu1, data.Mu2, data.Mu3, data.Mu4, H);
            Pi  = constuctor.Pi;
            Pij = constuctor.Pij;
            Pji = constuctor.Pji;
            Pik = constuctor.Pik;
            Pil = constuctor.Pil;

            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 + Pik[j].CurrentValue +
                            Pil[j].CurrentValue;
                }
                error += Math.Abs(1 - Summ - Pi[Pi.Count - 1].CurrentValue);
                result.Errors.Add(error);

                CalculateNextStep();
            }
            return(result);
        }
 public abstract ResultContainer Calculate(IDataContainer dataContainer);