
# do not edit, generated by pymola

from __future__ import print_function, division
import sympy
import sympy.physics.mechanics as mech
from pymola.sympy_runtime import OdeModel
from sympy import sin, cos, tan


class Aircraft(OdeModel):

    def __init__(self):

        super(Aircraft, self).__init__()

        # states
        body__x, body__v_x, body__a_x = mech.dynamicsymbols('body.x, body.v_x, body.a_x')
        self.x = sympy.Matrix([body__x, body__v_x, body__a_x])
        self.x0 = {
            body__x : 0.0,
            body__v_x : 0.0,
            body__a_x : 0.0,
            }

        # variables
        accel__ma_x, accel__b_x__y = mech.dynamicsymbols('accel.ma_x, accel.b_x.y')
        self.v = sympy.Matrix([accel__ma_x, accel__b_x__y])

        # constants
        self.c = sympy.Matrix([])
        self.c0 = {
            }

        # parameters
        body__g, body__c, body__m, accel__b_x__b = sympy.symbols('body.g, body.c, body.m, accel.b_x.b')
        self.p = sympy.Matrix([body__g, body__c, body__m, accel__b_x__b])
        self.p0 = {
            body__g : 9.81,
            body__c : 0.9,
            body__m : 1.0,
            accel__b_x__b : 0.0,
            }

        # inputs
        body__f_x, accel__a_x, accel__b_x__u = mech.dynamicsymbols('body.f_x, accel.a_x, accel.b_x.u')
        self.u = sympy.Matrix([body__f_x, accel__a_x, accel__b_x__u])
        self.u0 = {
            body__f_x : 0.0,
            accel__a_x : 0.0,
            accel__b_x__u : 0.0,
            }

        # outputs
        body__x, body__v_x, body__a_x, accel__ma_x, accel__b_x__y = mech.dynamicsymbols('body.x, body.v_x, body.a_x, accel.ma_x, accel.b_x.y')
        self.y = sympy.Matrix([body__x, body__v_x, body__a_x, accel__ma_x, accel__b_x__y])

        # equations
        self.eqs = [
            body__a_x - (accel__a_x),
            (body__x).diff(self.t) - (body__v_x),
            (body__v_x).diff(self.t) - (body__a_x),
            body__f_x - (body__m * body__a_x),
            accel__b_x__u - (accel__a_x),
            accel__ma_x - (accel__b_x__y),
            accel__b_x__y - (accel__b_x__u + accel__b_x__b),
            ]

        self.compute_fg()