from HG import HG, calcular_H from sympy import * # Create a linear object sys = HG() # Define global parameters m_1, m_2, Y, A, l_1, l_2, l_3, l_4, r, k_f, L_k, rho_o, rho_e, g, I = sys.parameters("m_1 m_2 Y A l_1 l_2 l_3 l_4 r k_f L_k rho_o rho_e g I") # 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)) 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).
from HG import HG, calcular_H from sympy import * # Create a linear object sys = HG() # Define global parameters M_p, Y, A, l, r, k_f, L_k, rho_o, rho_e, g = sys.parameters("M_p Y A l r k_f L_k rho_o rho_e g") # 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): return L_k + 4 * r * ( beta - tan(beta)) + l / cos(beta) def T(rho): return Y * A * (rho_o /rho - 1) def rho(L,M): return M /(A * L) L = Function("L") T = Function("T") rho = Function("rho") # Define the sizes of the state and the input x = sys.state(3) u = sys.input(2) # Define functions that can't be defined as functions above, i.e.