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 modulator of the converter.
Using this protocol is not compulsory, but it may simplify the implementation of new control systems.
Gate Enable#
The control system can block the gates of the converter with set_enable, constantly or as a function of time, which is evaluated at the sampling instants. While the gates are blocked, the control loop runs as usual, but the reference signals are computed by compute_standby_output instead of compute_output, and the outer controllers (the speed controller and the DC-bus voltage controller) are not updated. The converter voltage is not measured. The grid converter control systems use the measured grid voltage in its place, which it equals once the current has decayed, so that the phase-locked loop keeps tracking the grid. The drive control systems run their observers on the open-circuit model and compute the output for zero torque. A sensorless synchronous machine drive catches the rotating machine after the release with a flying start, see motulator.drive.control.sm.VectorControlSystem. The model of the converter with blocked gates is described in Voltage-Source Converter.
The drive control systems and the grid-following and observer-based grid-forming control systems implement the standby output. A sensorless induction machine drive holds its speed estimate while the gates are blocked, and its decayed rotor flux does not allow a flying start, so a speed search, not included in this package, is needed if the speed changes. The power-synchronization controller cannot synchronize with the grid without power, so it does not support gate blocking.
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 modulator of the converter. 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 modulator of the converter. 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.