motulator_export.native#
Native simulation of motulator systems.
Simulation simulates a system built in motulator in C, with the interface and the results of the simulation of motulator.
Classes#
Native simulation. |
Package Contents#
- class motulator_export.native.Simulation(mdl, ctrl, show_progress=True, cfg=None, t_start=None)[source]#
Native simulation.
Simulates the system model and the control system built in motulator in C, with the interface and the results of motulator.common.model.Simulation. As in motulator, the results are also stored in the time series of mdl and ctrl, and the states of mdl are updated. The control system runs in C from its initial state, so the states of ctrl are not used or updated.
The parameters are read at the first call of simulate, and the references and the load torque at each call. They can be constants, StepSignal objects (fastest), or functions of time.
- Parameters:
mdl (Model) – Continuous-time system model.
ctrl (ControlSystem) – Discrete-time control system.
show_progress (bool, optional) – Show progress during simulation, defaults to True.
cfg (SolverCfg, optional) – Solver configuration parameters. Only the method “RK45” is supported.
t_start (float, optional) – First sampling instant (s) of the control system, defaults to the initial time of the model.
- simulate(t_stop=1.0, N_eval=0)[source]#
Simulate the system.
The simulation runs until the first sampling instant after t_stop. A subsequent call continues the simulation.
- Parameters:
t_stop (float, optional) – Simulation stop time, defaults to 1.
N_eval (int, optional) – Number of evenly spaced data points to be returned by the solver for each integration interval, i.e., for each interval between the sampling and switching instants. Defaults to 0, in which case the number and spacing of points is selected by the solver.
- Return type:
motulator.common.model._simulation.SimulationResults