/// <summary>
        /// Set initial values
        /// </summary>
        public void SetInitialValues()
        {
            d.Clear();
            S.Clear();
            F.Clear();
            M.Clear();
            C.Clear();
            N.Clear();
            del.Clear();
            C.Clear();

            //Обнуляем массивы интегрирования
            for (int j = 0; j < modelDimention; j++)
            {
                X[j]  = 0;
                X0[j] = 0;
                Y[j]  = 0;
            }

            modeling.bal(S, C, del, s);
            modeling.setRealParamValuesFromIncrements(S, d, del);
            modeling.calcLinearCoef(S, del, c, s);
        }
Beispiel #2
0
        private void calcCoef_kH_kdH()
        {
            calcComplt   = false;
            unreacheable = false;

            modeling.calcLinearCoef(S, del, c, s);

            value = 0;
            kdH   = 0.01;

            while (!calcComplt)
            {
                kH = kdH * kdH / 4;

                a[0] = 1;
                a[1] = c.c1 + c.c4 + c.c5;
                a[2] = c.c2 + c.c1 * c.c4;
                a[3] = c.c4 * c.c6 * kdH;
                a[4] = c.c3 * c.c4 * c.c6 * kH;

                if ((a[0] < 0) || (a[1] < 0) || (a[2] < 0))
                {
                    calcComplt = true;
                    MessageBox.Show("The result is unreacheble", "Attention");
                }

                value = a[1] * a[2] * a[3] - a[0] * a[3] * a[3] - a[1] * a[1] * a[4];

                if ((a[0] > 0) && (a[1] > 0) && (a[2] > 0) && (a[3] > 0) && (a[4] > 0) &&
                    (value > botLevelStability) && (value < topLevelStability))
                {
                    //kdH = kdH;
                    kH         = kdH * kdH / 4;
                    calcComplt = true;
                }
                else
                {
                    if (value < botLevelStability)
                    {
                        kdH += calcStep;

                        if (unreacheable)
                        {
                            calcComplt = true;
                            MessageBox.Show("The result is unreacheble", "Attention");
                        }
                    }
                    else if (value > topLevelStability)
                    {
                        kdH -= calcStep;
                    }
                    else
                    {
                        //it means !(a[0] > 0) && (a[1] > 0) && (a[2] > 0) && (a[3] > 0) && (a[4] > 0) thus
                        kdH += calcStep * calcStep;
                        //if calculation jump out from this block the result is unreacheble
                        unreacheable = true;
                    }
                }
            }
        }