3. System simulation

The module casiopeia.sim contains the class used for system simulation.

class casiopeia.sim.Simulation(system, pdata, qdata=None)[source]

The class casiopeia.sim.Simulation is used to simulate dynamic systems defined with the casiopeia.system.System class. It is supposed that the system containsa number of time-constant parameters \(p\).

Parameters:
  • system (casiopeia.system.System) – system considered for simulation, specified using the casiopeia.system.System class
  • pdata (numpy.ndarray, casadi.DMatrix) – values of the time-constant parameters \(p \in \mathbb{R}^{\text{n}_\text{p}}\)
  • qdata (numpy.ndarray, casadi.DMatrix) – optional, values of the time-constant controls \(q \in \mathbb{R}^{\text{n}_\text{q}}\); if no values are given, 0 will be used
run_system_simulation(x0, time_points, udata=None, integrator_options={}, print_status=True)[source]
Parameters:
  • x0 (numpy.ndarray, casadi.DMatrix, list) – state values \(x_0 \in \mathbb{R}^{\text{n}_\text{x}}\) at the first time point \(t_0\)
  • time_points (numpy.ndarray, casadi.DMatrix, list) – switching time points for the controls \(t_\text{N} \in \mathbb{R}^\text{N}\)
  • udata (numpy.ndarray, casadi.DMatrix) – optional, values for the time-varying controls at the first \(N-1\) switching time points \(u_\text{N} \in \mathbb{R}^{\text{n}_\text{u} \times \text{N}-1}\); if no values are given, 0 will be used
  • integrator_options (dict) – optional, options to be passed to the CasADi integrator (see the CasADi documentation for a list of all possible options)
  • print_status (bool) – optional, set to True (default) or False to enable or disable console printing.

This function will run a system simulation for the specified initial state values and control data from \(t_0\) to \(t_\text{N}\).

If you receive integrator-related error messages during the simulation, please check the corresponding parts of the CasADi documentation.

After the simulation has finished, the simulation results \(x_\text{N}\) can be accessed via the class attribute Simulation.simulation_results.