Current PI
Continuous PI current regulator with back-calculation anti-windup.
- signal
- Gradara equations
- 2 ports
- 4 parameters
currentPILibraryControlDescription
A continuous PI controller with a symmetric output limit and back-calculation anti-windup. The input is the current error; the output is a voltage command.
In the field-oriented control example, one instance regulates the d-axis current and another the q-axis current.
Example
PMSM · Field-oriented control 1500 rpm speed command with cascaded d/q current control. A 48 V averaged inverter drives a surface PMSM and a mechanical load that increases at 0.45 s. Ideal current and rotor-position feedback; continuous controllers; no PWM ripple or sensor noise.
Also in this example:SumSubtractConstantLimited integratorClarke transformPark transformInverse transformsThree-phase inverterPMSMMechanical loadStepGainSaturation
Ports
Inputs 1
-
e
uControl error, typically current reference minus measured current, in amperes.
Outputs 1
-
v
yVoltage command, in volts, limited to ±limit.
Parameters
-
Proportional gain
kp2Proportional gain, in volts per unit of error.
-
Integral gain
ki700Integral gain: the integral state rises at ki · u per second.
-
Anti-windup gain
kaw350 1/s≥ 0
Anti-windup gain, in 1/s, 0 or more. How fast the integral state is pulled back while the output is limited. 0 disables anti-windup.
-
Voltage limit
limit27 V≥ 0.1
Output limit, in volts, at least 0.1. The output is clamped to ±limit.
Equations
raw = kp · u + x y = max(−limit, min(limit, raw)) dx/dt = ki · u + kaw · (y − raw), x(0) = 0
Implementation
Real x(start=0, fixed=true); Real raw; raw = kp*u + x; y = max(-limit, min(limit, raw)); der(x) = ki*u + kaw*(y-raw);
Assumptions and limitations
- Continuous time: no sampling, computation delay, or quantization.
- The limit is symmetric and fixed. It does not track the available DC-bus voltage.
- The integral state is not clamped directly; it is held back only through the kaw term.
Tips
- While y is within ±limit, y − raw = 0 and the block is a plain PI. Once the output limits, the kaw term drives x toward the value that just brings raw back to the limit.
- A starting point for kaw is ki/kp, which is the default ratio (700/2 = 350).
Used in
These larger examples use it too. Open them from Examples in the app.
- PMSM · Field-oriented control
See also
Select a block in Gradara and press F1 to open its page offline.