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 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;
        }
        /// <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 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 AutopilotForm(MainForm MainForm)
 {
     mForm = MainForm;
     S = mForm.S;
     s = mForm.s;
     c = mForm.c;
     del = mForm.del;
     scoe = mForm.s;
     InitializeComponent();
 }