soft4pes.sim.simulation#
Simulation environment for power electronic systems.
Classes#
A class used to print the progress of the simulation process. |
|
Simulation environment. |
Module Contents#
- class soft4pes.sim.simulation.ProgressPrinter(total_steps)[source]#
A class used to print the progress of the simulation process.
- Parameters:
total_steps (int) – The total number of steps in the process.
- class soft4pes.sim.simulation.Simulation(sys, ctr, Ts_sim, disc_method='forward_euler')[source]#
Simulation environment.
- Parameters:
sys (system object) – System model.
ctr (controller object) – Control system.
Ts_sim (float) – Simulation sampling interval [s].
- simulate(t_stop)[source]#
Simulate the system.
- Parameters:
t_stop (float) – Simulation length [s]. Simulation start time is always 0 s, i.e. kTs = 0.
- save_data(filename='sim_data.mat', path='')[source]#
Save the simulation data to a .mat file.
- Parameters:
filename (str, optional) – Name of the file to save the data to. The default filename is ‘sim_data.mat’.
path (str, optional) – Directory path to save the file to. The path can be absolute or relative to the current directory. The default saving directory is the current directory.
- process_simulation_data(data)[source]#
Recursively convert lists of arrays in a SimpleNamespace to NumPy arrays.
- Parameters:
data (SimpleNamespace or list of ndarray) – The data to be converted. Can be a SimpleNamespace or a list of arrays.
- Returns:
A SimpleNamespace with lists of arrays converted to NumPy arrays, or a NumPy array if the input is a list of arrays.
- Return type:
SimpleNamespace or ndarray