コード例 #1
0
ファイル: main.py プロジェクト: nonrevlb/ControlSystems
# simAnimation = Animation()  # Instantiate Animate class
ctrl = controllerSS()
dynam = Dynamics()  # Instantiate Dynamics class

t = t_start  # Declare time variable to keep track of simulation time elapsed

while t < t_end:

    ref_input = sig_gen.getRefInputs(t)

    # The dynamics of the model will be propagated in time by t_elapse
    # at intervals of t_Ts.
    t_temp = t + t_elapse
    while t < t_temp:

        states = dynam.States()  # Get current states
        u = ctrl.getForces(ref_input, states)  # Calculate the forces
        xhat = ctrl.getObsStates()  # Get xhat
        dynam.propagateDynamics(
            u)  # Propagate the dynamics of the model in time
        t = round(t + t_Ts, 2)  # Update time elapsed

    # plt.figure(simAnimation.fig.number) # Switch current figure to animation figure
    # simAnimation.drawSystem(          # Update animation with current user input
    #     dynam.Outputs())
    # plt.pause(0.0001)

    # Organizes the new data to be passed to plotGen
    new_data = [[ref_input[0], states[0], xhat[0][0]],
                [states[0] - xhat[0][0]], [states[2], xhat[2][0]],
                [states[2] - xhat[2][0]], [states[1], xhat[1][0]],