Esempio n. 1
0
from hg import hg
from sympy import *


# Create a linear object
sys = hg()

# Define global parameters
m_1, m, Y, A, l_1, l_2, l_3, l_4, l_5, r, k_f, L_k, rho_o, rho_e, g, I, l_1_, theta_ = sys.parameters("m_1 m Y A l_1 l_2 l_3 l_4 l_5 r k_f L_k rho_o rho_e 9.8 I l_1_ theta_")

# Define the sizes of the state and the input
x = sys.state(3)
u = sys.input(2)

# Define global functions that can be defined in an explicit way, i.e.
# y = f(x_1,x_2,...x_n) \forall n \in N and x_i \notequal y
def L(beta_1, beta_2, theta):
    return L_k + 2 * r * (beta_1 + 1/tan(beta_1) + beta_2 + 1/tan(beta_2)) + (1/sin(beta_1) + 1/sin(beta_2)) * (l_4 - l_1_ * sin(theta + theta_))

def T(rho):
    return Y * A * (rho_o /rho - 1)

def rho(L,M):
    return M /(A * L)

# Define functions that can't be defined as functions above, i.e.
# f(y,x_1,x_2,x_3,...,x_n) = g(y,x_1,x_2,x_3,...,x_n)
# The method receive the name of the function, the f(y,x_1,x_2,...,x_n) 
# function, the g(y,x_1,x_2,...,x_n) function, and a list with tuples 
# representing the args that call the function (this is a hack, 
# because the actual matching system is not as good as i want).
Esempio n. 2
0
File: app.py Progetto: lukw00heck/hg
def main():
    HG = hg(10)
    HG.run()