/// <summary>
        /// Set initial conditions
        /// </summary>
        public void SetInitialConditions()
        {
            d = new DifferentialMeanings();
            S = new IntegralMeanings();
            F = new Forses();
            M = new Moments();
            C = new Coefficient();
            c = new LinearizedCoefficient();
            N = new Overload();
            del = new Controls();
            s = new Statics();

            SetInitialValues();

            if (stForm == null)
            { stForm = new StaticsForm(this, s); }
            else if (stForm != null)
            {
                stForm.Close();
                stForm = new StaticsForm(this, s);
            }

            if (fpForm == null)
            { fpForm = new FlyParamForm(this); }
            else if (fpForm != null)
            {
                fpForm.Close();
                fpForm = new FlyParamForm(this);
            }

            if (glForm == null)
            { glForm = new GraphicsListForm(this); }
            else if (glForm != null)
            {
                glForm.Close();
                glForm = new GraphicsListForm(this);
            }

            if (dgForm == null)
            { dgForm = new DataGridForm(this); }
            else if (dgForm != null)
            {
                dgForm.Close();
                dgForm = new DataGridForm(this);
            }

            if (avForm == null)
            { avForm = new AviatingForm(this); }
            else if (avForm != null)
            {
                avForm.Close();
                avForm = new AviatingForm(this);
            }

            if (pvForm == null)
            { pvForm = new PlaneVisualisationForm(this.toolStripButton6_Visualisation, S); }
            else if (pvForm != null)
            {
                pvForm.Close();
                pvForm = new PlaneVisualisationForm(this.toolStripButton6_Visualisation, S);
            }

            if (auForm == null)
            { auForm = new AutopilotForm(this); }
            else if (auForm != null)
            {
                auForm.Close();
                auForm = new AutopilotForm(this);
            }

            if (scrForm == null)
            { scrForm = new ScriptingAutopilotForm(this); }
            else if (scrForm != null)
            {
                scrForm.Close();
                scrForm = new ScriptingAutopilotForm(this);
            }
        }
        public void setRealParamValuesFromIncrements(IntegralMeanings S, DifferentialMeanings d, Controls del)
        {
            S.V = S.V_BAL + S.V_DEL;

            S.Wx = S.Wx_BAL + S.Wx_DEL;
            S.Wy = S.Wy_BAL + S.Wy_DEL;
            S.Wz = S.Wz_BAL + S.Wz_DEL;

            S.Xg = S.Xg_BAL + S.Xg_DEL;
            S.Yg = S.Yg_BAL + S.Yg_DEL;
            S.Zg = S.Zg_BAL + S.Zg_DEL;

            S.GAMA = S.GAMA_BAL + S.GAMA_DEL;
            S.PSI = S.PSI_BAL + S.PSI_DEL;

            S.THETA = S.THETA_BAL + S.THETA_DEL;
            S.THETA_PATH = S.THETA_PATH_BAL + S.THETA_PATH_DEL;

            S.ALPHA = S.ALPHA_BAL + S.ALPHA_DEL;
            S.BETA = S.BETA_BAL + S.BETA_DEL;

            d.Wx = d.Wx_DEL;
            d.Wy = d.Wy_DEL;
            d.Wz = d.Wz_DEL;

            d.Xg = d.Xg_DEL;
            d.Yg = d.Yg_DEL;
            d.Zg = d.Zg_DEL;

            d.GAMA = d.GAMA_DEL;
            d.PSI = d.PSI_DEL;

            d.THETA = d.THETA_DEL;
            d.THETA_PATH = d.THETA_PATH_DEL;

            d.ALPHA = d.ALPHA_DEL;
            d.BETA = d.BETA_DEL;

            del.e = del.e_DEL + del.e_BAL;
            del.n = del.n_DEL + del.n_BAL;
            del.e_rv = del.e_rv_DEL + del.e_rv_BAL;
            del.Tr = del.Tr_DEL + del.Tr_BAL;
        }
        public void takeOff(DifferentialMeanings d, IntegralMeanings S, Forses F, Moments M, Controls del, Statics s)
        {
            d.Vx = (1 / s.m) * F.x;
            d.BETA = (1 / (s.m * S.Vx)) * F.z + S.Wy;
            d.Wy = 1 / s.Iyy * M.y;
            d.X = S.Vx * cos(S.BETA);
            d.Z = -S.Vx * sin(S.BETA);

            S.Y = s.Cyo * S.q * s.S;
            S.Q = s.Cxo * S.q * s.S;

            F.x = 20 * del.Tr - S.Q - (s.G - S.Y) * (s.froll + s.fslip * (s.InhibitionL + s.InhibitionR));
            F.z = F.zBETA * S.BETA + F.zDELn * del.n + F.zt;

            F.zBETA = s.Cz_BETA * s.S * S.q;
            F.zDELn = s.Cz_del_n * s.S * S.q;
            F.zt = (s.G - S.Y) * s.Czk_BETA * (S.BETA + s.fW * del.fW);

            M.y = M.yz + M.yWy + M.yp + M.yt;

            M.yz = s.my_BETA * S.q * s.S * s.L * S.BETA + s.my_DELn * del.n;
            M.yWy = s.my_Wy * S.q * s.S * s.L * d.Wy;
            M.yp = 0; // = (P1 - P2) * s.Zengine
            M.yt = (s.fW * s.XfrontWheel * del.fW + s.fslip * (s.G - S.Y) * (s.InhibitionL + s.InhibitionR) * (s.Zchassis / 2));

            S.q = (s.PO_h * S.Vx * S.Vx / 2);

            d.Xg = S.Vx * cos(S.BETA);
        }
        public void dynLinear(DifferentialMeanings d, IntegralMeanings S, LinearizedCoefficient c, Controls del, Statics s)
        {
            d.THETA_DEL = S.Wz_DEL;
            d.Wz_DEL = -c.c1 * d.THETA_DEL - c.c2 * S.ALPHA_DEL - c.c5 * d.ALPHA_DEL - c.c3 * del.e_rv_DEL;
            d.THETA_PATH_DEL = c.c4 * S.ALPHA_DEL + c.c9 * del.e_rv_DEL;
            d.ALPHA_DEL = d.THETA_DEL - d.THETA_PATH_DEL;
            d.Yg_DEL = c.c6 * S.THETA_PATH_DEL;

            d.GAMA_DEL = S.Wx_DEL;
            d.Wy_DEL = -c.a1 * S.Wy_DEL - c.b6 * S.Wx_DEL - c.a2 * S.BETA_DEL - c.a3 * del.n_DEL - c.b5 * del.e_DEL;
            d.PSI_DEL = S.Wy_DEL;
            d.Wx_DEL = -c.a6 * S.Wy_DEL - c.b1 * S.Wx_DEL - c.b2 * S.BETA_DEL - c.a5 * del.n_DEL - c.b3 * del.e_DEL;
            d.BETA_DEL = S.Wy_DEL + c.b7 * S.Wx_DEL - c.b4 * S.PSI_DEL - c.a4 * S.BETA_DEL - c.a7 * del.n_DEL;
        }
        public void dynFullDiff(DifferentialMeanings d, IntegralMeanings S, LinearizedCoefficient c, Controls del, Statics s)
        {
            S.q = (s.PO_h * S.V * S.V) / 2;

            d.THETA = S.Wz;
            d.THETA_PATH = c.c4 * S.ALPHA + c.c9 * del.e_rv;
            d.Wz = -c.c1 * S.Wz - c.c2 * S.ALPHA - c.c3 * del.e_rv - c.c5 * d.ALPHA;
            d.ALPHA = d.THETA - d.THETA_PATH;

            d.GAMA = S.Wx;
            d.Wy = -c.a1 * S.Wy - c.b6 * S.Wx - c.a2 * S.BETA - c.a3 * del.n - c.b5 * del.e;
            d.PSI = S.Wy;
            d.Wx = -c.a6 * S.Wy - c.b1 * S.Wx - c.b2 * S.BETA - c.a5 * del.n - c.b3 * del.e;
            d.BETA = S.Wy + c.b7 * S.Wx - c.b4 * S.PSI - c.a4 * S.BETA - c.a7 * del.n;
        }
        public void calcLinearCoef(IntegralMeanings S, Controls del, LinearizedCoefficient c, Statics s)
        {
            S.q = (s.PO_h * S.V * S.V) / 2;

            c.c1 = -(s.mz_w1z / s.Izz) * s.S * s.bA * s.bA * ((s.PO_h * S.V) / 2);
            c.c2 = -(s.mz_ALPHA / s.Izz) * s.S * s.bA * S.q;
            c.c3 = -(s.mz_del_e_rv / s.Izz) * s.S * s.bA * S.q;
            c.c4 = ((s.Cy_ALPHA + s.Cx) / s.m) * s.S * ((s.PO_h * S.V) / 2);
            c.c5 = -(s.mz_ALPHA1 / s.Izz) * s.S * s.bA * s.bA * ((s.PO_h * S.V) / 2);
            c.c6 = 0.01745 * S.V;
            c.c9 = (s.Cy_del_e_rv / s.m) * s.S * ((s.PO_h * S.V) / 2);

            c.a1 = -(s.my_w1y / s.Iyy) * s.S * s.L * s.L * ((s.PO_h * S.V) / 4);
            c.a2 = -(s.my_BETA / s.Iyy) * s.S * s.L * S.q;
            c.a3 = -(s.my_del_n / s.Iyy) * s.S * s.L * S.q;
            c.a4 = -(s.Cz_BETA / s.m) * s.S * S.q;
            c.a5 = -(s.mx_del_n / s.Ixx) * s.S * S.q;
            c.a6 = -(s.mx_w1y / s.Ixx) * s.S * s.L * s.L * ((s.PO_h * S.V) / 4);
            c.a7 = -(s.Cz_del_n / s.m) * s.S * S.q;

            c.b1 = -(s.mx_w1x / s.Ixx) * s.S * s.L * s.L * ((s.PO_h * S.V) / 4);
            c.b2 = -(s.mx_BETA / s.Ixx) * s.S * s.L * S.q;
            c.b3 = -(s.mx_del_e / s.Ixx) * s.S * s.L * S.q;
            c.b4 = s.g / S.V * cos(S.ALPHA);
            c.b5 = -(s.my_del_e / s.Iyy) * s.S * s.L * S.q;
            c.b6 = -(s.my_w1x / s.Iyy) * s.S * s.L * s.L * ((s.PO_h * S.V) / 4);
            c.b7 = sin(S.ALPHA);
        }
 public void bal(IntegralMeanings S, Coefficient C, Controls del, Statics s)
 {
     S.V_BAL = s.Vo;
     S.Yg_BAL = s.Ho;
     del.Tr_BAL = s.Tro;
     C.y = (2 * s.G) / (s.S * s.PO_h * S.V_BAL * S.V_BAL);
     S.ALPHA_BAL = i.ALPHA(C.y);
     S.THETA_BAL = S.ALPHA_BAL;
     del.e_rv_BAL = s.mzo + i.mz(S.ALPHA_BAL) * S.ALPHA_BAL;
 }
 public AutopilotForm(MainForm MainForm)
 {
     mForm = MainForm;
     S = mForm.S;
     s = mForm.s;
     c = mForm.c;
     del = mForm.del;
     scoe = mForm.s;
     InitializeComponent();
 }