Common#
Data Flow#
The two figures below show the structure and data flow in a typical simulation model as well as an example of the internal structure of a discrete-time 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 the following types.SimpleNamespace
objects:
The object fbk contains feedback signals for the controllers. These signals can be measured quantities (such as the measured DC-bus voltage fbk.u_dc) as well as estimated quantities (such as the estimated stator flux linkage fbk.psi_s).
The object ref contains the reference signals, both externally provided (such as ref.w_m for the angular speed reference) and internally generated (such as ref.d_c_abc for the duty ratios).
These objects fbk and ref may propagate through several blocks (implemented as classes in the software), which may add new signals or modify the existing one. At the end of their propagation chain, both objects fbk and ref are saved to the lists. Therefore, the most relevant internal signals of the control system are directly accessible after the simulation. Furthermore, the states and inputs of the continuous-time system model are also saved. In the post-processing stage, the saved data is converted to the NumPy arrays.
Main Control Loop#
A template for the main control loop is available in the base class for discrete-time control systems in motulator.common.control.ControlSystem
. The main control loop in this template has the following steps:
Get the feedback signals fbk for the controllers from the outputs of the continuous-time system model mdl. This step may contain first getting the measurements and then optionally computing the observer outputs (or otherwise manipulating the measured signals).
Get the reference signals ref and compute the controller outputs based on the feedback signals fbk. Cascade control systems may contain multiple controllers, where the output of the outer controller is the reference signal for the inner controller.
Update the states of the control system for the next sampling instant.
Save the feedback signals fbk and the reference signals ref so they can be accessed after the simulation.
Return the sampling period T_s and the duty ratios d_c_abc for the carrier comparison.
Using this template is not compulsory, but it may simplify the implementation of new control systems.
2DOF PI Controller#
Proportional-integral (PI) control is widely used in machine drives. A standard one-degree-of-freedom (1DOF) PI controller manipulates only the control error, i.e., it has single input and single output. Its two-degrees-of-freedom (2DOF) variants have two inputs (reference signal and feedback signal), which allows to design disturbance rejection and reference tracking separately [1]. The 2DOF PI controller is available in the motulator.common.control.PIController
class, which is the base class for the motulator.drive.control.SpeedController
and motulator.grid.control.DCBusVoltageController
classes.
Typical Structure#
The figure below shows a 2DOF PI controller with an optional feedforward term. Its equivalent state-space form is given by
where \(r\) is the reference signal, \(y\) is the measured (or estimated) feedback signal, \(u_\mathrm{i}\) is the the integral state, and \(u_\mathrm{ff}\) is the optional feedforward signal. Furthermore, \(k_\mathrm{t}\) is the reference-feedforward gain, \(k_\mathrm{p}\) is the proportional gain, and \(k_\mathrm{i}\) is the integral gain. Setting \(k_\mathrm{t} = k_\mathrm{p}\) and \(u_\mathrm{ff} = 0\) results in the standard PI controller. This 2DOF PI controller can also be understood as a state-feedback controller with integral action and reference feedforward [2].
Disturbance-Observer Structure#
The controller (1) can be equally represented using the disturbance-observer structure as
where \(\alpha_\mathrm{i} = k_\mathrm{i}/k_\mathrm{t}\) is the redefined integral gain and \(\hat v\) is the input-equivalent disturbance estimate. This structure is convenient to prevent the integral windup that originates from the actuator saturation [2]. The actuator output is limited in practice due to physical constraints. Consequently, the realized actuator output is
where \(\mathrm{sat}(\cdot)\) is the saturation function. If this saturation function is known, the anti-windup of the integrator can be implemented simply as
The other parts of the above controller are not affected by the saturation.
Discrete-Time Algorithm#
The discrete-time variant of the controller (2) with the anti-windup in (3) is given by
where \(T_\mathrm{s}\) is the sampling period and \(k\) is the discrete-time index. This algorithm corresponds to the actual implementation in the motulator.common.control.PIController
class.
Complex-Vector 2DOF PI Controller#
As shown in the figure below, the 2DOF PI controller presented above can be extended for the control of complex-valued space vectors in a coordinate system rotating at the angular speed \(\omega\) [3]. Depending on the control task, the controlled quantity is typically either a current vector or a flux linkage vector. In the continuous-time domain, the controller in the state-space form is given by
where \(\boldsymbol{u}\) is the output of the controller, \(\boldsymbol{r}\) is the reference signal, \(\boldsymbol{u}_\mathrm{i}\) is the the integral state, and \(\boldsymbol{u}_\mathrm{ff}\) is the optional feedforward signal. Furthermore, \(\boldsymbol{k}_\mathrm{t}\) is the reference-feedforward gain, \(\boldsymbol{k}_\mathrm{p}\) is the proportional gain, and \(\boldsymbol{k}_\mathrm{i}\) is the integral gain.
The discrete-time implementation of (5) with the anti-windup is given in the motulator.common.control.ComplexPIController
class, which is the base class for motulator.drive.control.sm.CurrentController
, motulator.drive.control.im.CurrentController
, and motulator.grid.control.CurrentController
classes. The algorithm is similar to the real-valued case given in (4).
References