# The Animation.py file is kept in the parent directory, # so the parent directory path needs to be added. sys.path.append('..') from dynamics import Dynamics from animation import Animation t_start = 0.0 # Start time of simulation t_end = 60.0 # End time of simulation t_Ts = P.Ts # Simulation time step t_elapse = 0.01 # Simulation time elapsed between each iteration t_pause = 0.01 # Pause between each iteration sig_gen = Signals() # Instantiate Signals class plotGen = plotGenerator() # Instantiate plotGenerator class # 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
# The Animation.py file is kept in the parent directory, # so the parent directory path needs to be added. sys.path.append('..') from dynamics import PendulumDynamics from animation import PendulumAnimation t_start = 0.0 # Start time of simulation t_end = 20.0 # End time of simulation t_Ts = P.Ts # Simulation time step t_elapse = 0.1 # Simulation time elapsed between each iteration t_pause = 0.01 # Pause between each iteration sig_gen = Signals() # Instantiate Signals class plotGen = plotGenerator() # Instantiate plotGenerator class ctrl = controllerSS() # Instantiate controllerPD class simAnimation = PendulumAnimation() # Instantiate Animate class dynam = PendulumDynamics() # Instantiate Dynamics class t = t_start # Declare time variable to keep track of simulation time elapsed while t < t_end: # Get referenced inputs from signal generators 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: