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
meas
from the outputs of the continuous-time system modelmdl
.Get the feedback signals
fbk
for the controllers. The feedback signalsfbk
may contain the raw measurement signalsmeas
. If the control system has an observer (or phase-locked loop etc.), the feedback signalsfbk
contain the observer output signal.Compute the reference signals
ref
based on the feedback signalsfbk
.Save the feedback signals
fbk
and the reference signalsref
so they can be accessed after the simulation.Update the states of the control system for the next sampling instant.
Return the sampling period
T_s
and the duty ratiosd_abc
for 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:
meas
Contains raw measured signals from sensors (e.g.,
meas.u_dc
for measured DC-bus voltage).fbk
Contains signals used by controllers, including both measured quantities (
fbk.u_dc
) and estimated values (such asfbk.psi_s
for stator flux linkage). Thefbk
object is saved at each controller time step.ref
Contains reference signals, both external references (such as
ref.w_m
for speed reference) and internally generated control outputs (such asref.d_abc
for converter duty ratios). Theref
object 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.fbk
Reference signals:
res.ctrl.ref
System model signals:
res.mdl
The Drives and Grid Converters example scripts demonstrate how to access and visualize the data.