rcognita.simulator.Simulator
- class rcognita.simulator.Simulator(system, state_init, sys_type='diff_eqn', disturb_init=None, action_init=None, time_start=0, time_final=1, sampling_time=0.01, max_step=0.005, first_step=1e-06, atol=1e-05, rtol=0.001, is_disturb=0, is_dynamic_controller=0, ode_backend='SciPy')
Class for simulating closed loops (system-controllers).
- sys_type
Type of system by description:
diff_eqn: differential equation \(\mathcal D state = f(state, u, q)\)discr_fnc: difference equation \(state^+ = f(state, u, q)\)discr_prob: by probability distribution \(X^+ \sim P_X(state^+| state, u, q)\)- Type
: string
- where
- \(state\) : state\(u\) : input\(q\) : disturbance
- compute_closed_loop_rhs
Right-hand side description of the closed-loop system. Say, if you instantiated a concrete system (i.e., as an instance of a subclass of
systemclass with concretecompute_closed_loop_rhsmethod) assystem, this could be justsystem.compute_closed_loop_rhs.- Type
: function
- sys_out
System output function. Same as above, this could be, say,
system.out.- Type
: function
- is_dynamic_controller
If 1, the controller (a.k.a. agent) is considered as a part of the full state vector.
- Type
: 0 or 1
- state_init, disturb_init, action_init
Initial values of the (open-loop) system state, disturbance and input.
- Type
: vectors
- time_start, time_final, sampling_time
Initial, final times and time step size
- Type
: numbers
- max_step, first_step, atol, rtol
Parameters for an ODE solver (used if
sys_typeisdiff_eqn).- Type
: numbers
See also
systemsmodule- __init__(system, state_init, sys_type='diff_eqn', disturb_init=None, action_init=None, time_start=0, time_final=1, sampling_time=0.01, max_step=0.005, first_step=1e-06, atol=1e-05, rtol=0.001, is_disturb=0, is_dynamic_controller=0, ode_backend='SciPy')
- Parameters
sys_type (: string) –
Type of system by description:
diff_eqn: differential equation \(\mathcal D state = f(state, u, q)\)discr_fnc: difference equation \(state^+ = f(state, u, q)\)discr_prob: by probability distribution \(X^+ \sim P_X(state^+| state, u, q)\)where –
\(state\) : state\(u\) : input\(q\) : disturbancecompute_closed_loop_rhs (: function) – Right-hand side description of the closed-loop system. Say, if you instantiated a concrete system (i.e., as an instance of a subclass of
Systemclass with concretecompute_closed_loop_rhsmethod) assystem, this could be justsystem.compute_closed_loop_rhs.sys_out (: function) – System output function. Same as above, this could be, say,
system.out.is_dynamic_controller (: 0 or 1) – If 1, the controller (a.k.a. agent) is considered as a part of the full state vector.
state_init (: vectors) – Initial values of the (open-loop) system state, disturbance and input.
disturb_init (: vectors) – Initial values of the (open-loop) system state, disturbance and input.
action_init (: vectors) – Initial values of the (open-loop) system state, disturbance and input.
time_start (: numbers) – Initial, final times and time step size
time_final (: numbers) – Initial, final times and time step size
sampling_time (: numbers) – Initial, final times and time step size
max_step (: numbers) – Parameters for an ODE solver (used if
sys_typeisdiff_eqn).first_step (: numbers) – Parameters for an ODE solver (used if
sys_typeisdiff_eqn).atol (: numbers) – Parameters for an ODE solver (used if
sys_typeisdiff_eqn).rtol (: numbers) – Parameters for an ODE solver (used if
sys_typeisdiff_eqn).
Methods
__init__(system, state_init[, sys_type, …])- param sys_type
Type of system by description:
do_sim_step(*args, **kwargs)get_sim_step_data()Collect current simulation data: time, system state and output, and, for completeness, full closed-loop state.
initialize_ODE_solver()reset()