Control System Framework#
Main Control Loop#
A protocol for discrete-time control systems is available in motulator.common.control.ControlSystem class. The main control loop has the following steps:
Get the measurement signals
measfrom the outputs of the continuous-time system modelmdl.Get the feedback signals
fbkfor the controllers. The feedback signalsfbkmay contain the raw measurement signalsmeas. If the control system has an observer (or phase-locked loop etc.), the feedback signalsfbkcontain the observer output signal.Compute the reference signals
refbased on the feedback signalsfbk.Save the feedback signals
fbkand the reference signalsrefso they can be accessed after the simulation.Update the states of the control system for the next sampling instant.
Return the sampling period
T_sand the duty ratiosd_abcfor the carrier comparison.
Using this protocol is not compulsory, but it may simplify the implementation of new control systems.
Data Flow and Storage#
Figure 1 illustrates the structure and data flow in a typical simulation model. Figure 2 exemplifies an internal structure of a typical control system. The text in italics refers to the default object names used in the software.
In discrete-time control systems, the signals are collected into these key objects during the simulation:
measContains raw measured signals from sensors (e.g.,
meas.u_dcfor measured DC-bus voltage).fbkContains signals used by controllers, including both measured quantities (
fbk.u_dc) and estimated values (such asfbk.psi_sfor stator flux linkage). Thefbkobject is saved at each controller time step.refContains reference signals, both external references (such as
ref.w_mfor speed reference) and internally generated control outputs (such asref.d_abcfor converter duty ratios). Therefobject is saved at each controller time step.
The objects fbk and ref may propagate through multiple control blocks (implemented as classes), with each block potentially adding or modifying signals.
The states and inputs of the continuous-time system model are saved at every solver time step.
Figure 1: Block diagram illustrating the structure and data flow in a typical simulation model. The lower part of the figure illustrates how the data is saved. The post-processing is automatically done after the simulation. The internal structure of a typical control system is exemplified in the figure below.#
Figure 1: Block diagram illustrating the structure and data flow in a typical simulation model. The lower part of the figure illustrates how the data is saved. The post-processing is automatically done after the simulation. The internal structure of a typical control system is exemplified in the figure below.#
Figure 2: Block diagram exemplifying the internal structure of a typical cascade control system. The object ref at the control system output should contain the sampling period T_s and the converter duty ratios d_abc for the carrier comparison. The observer does not necessarily exist in all control systems (or it can be replaced with, e.g., a phase-locked loop).#
Figure 2: Block diagram exemplifying the internal structure of a typical cascade control system. The object ref at the control system output should contain the sampling period T_s and the converter duty ratios d_abc for the carrier comparison. The observer does not necessarily exist in all control systems (or it can be replaced with, e.g., a phase-locked loop).#
Accessing the Data#
Time series of simulation results are available as NumPy arrays in the motulator.common.model.SimulationResults object, named res in the following:
Feedback signals:
res.ctrl.fbkReference signals:
res.ctrl.refSystem model signals:
res.mdl
The Drives and Grid Converters example scripts demonstrate how to access and visualize the data.