Integrator (integrator)
Adds up its input over time, with optional output limits.
Group: Control · Kind: {"block":"integrator","kind":"control"}
When to use it
Use it for a plant model or a flux estimate. Use PI Controller for a ready controller and Angle Generator for an angle.
Pins
| Pin | Domain | Meaning |
|---|---|---|
in |
signal | Signal to add up over time |
out |
signal | Running total, kept between lo and hi |
Common parameters
k: How fast the output builds up (Default: 1)lo: Lowest value the output can reach (Default: -1e30)hi: Highest value the output can reach (Default: 1e30)x0: Initial output (Default: 0)
Parameters
| Key | Unit | Default | Typical range | Description |
|---|---|---|---|---|
k |
1/s | 1 | How fast the output builds up | |
lo |
— | -1e30 | Lowest value the output can reach | |
hi |
— | 1e30 | Highest value the output can reach | |
x0 |
— | 0 | Initial output |
Parameter descriptions are in English in both languages.
Use for: Plant models · Flux estimates · Ramps from a constant
Not for: Ready-made controllers → pi · Rotor and grid angles → angle
Formulas
| Formula | Equation | Source |
|---|---|---|
| Integrator | y = x0 + k·∫u dt | Ogata, Modern Control Engineering, 5th ed. (2010), ch. 2 |
| Output for a constant input | y = min(x0 + k·u·t, hi) | Ogata, Modern Control Engineering, 5th ed. (2010), ch. 2 |
| Time to reach hi | t = (hi - x0)/(k·u) | Ogata, Modern Control Engineering, 5th ed. (2010), ch. 2 |
Quick check
Inputs:
k: Integration gain = 1k 1/s,ku: Constant input = 500m —x0: Initial output = 0 —,x0t: Time = 2m shi: Upper limit = 10 —,hi
Outputs:
y: Output after t =min(x0 + k*u*t, hi)—thi: Time to reach hi =(hi - x0)/(k*u)s
Model logic
- Once per accepted step the stored value grows by k·h·(in + previous in)/2 (trapezoid); a step that starts on a switching edge uses the input at its end.
- The stored value itself is clamped to lo and hi after each step, so it comes off a limit as soon as the input reverses (anti-windup).
- The output starts at x0, and the defaults of -1e30 and 1e30 leave it unlimited.
- The block has no direct feedthrough, so it breaks loops; an input that is not finite stops the run and names the block.
Model
out = x0 + integral(k*in dt), held between lo and hi. The solver uses the trapezoidal rule over each accepted step. The limit is applied to the stored value itself, so the total comes off a limit as soon as the input reverses (anti-windup). The block has no direct feedthrough, so it breaks loops with no delay.
Common mistakes
- The unit of k is 1/s. A value of 100 adds up 100 units per second for each unit of input, so a time constant of 10 ms means k = 100, not 0.01.
- With the default limits, a constant offset on the input makes the output grow without bound. Set lo and hi when the Integrator is part of a controller.
- Because it has no direct feedthrough, the solver may read the signal that drives it one step late. Keep the maximum step well below the fastest time constant of the loop.
Problems rules: control.saturated
Datasheet and sources
No datasheet applies. The value of k is the inverse of your integration time, x0 is the starting value, and lo and hi follow the range of the signal the integral feeds.
Example
Open the example with the command file.openExample and the name demo:integrator.
Generated by cargo xtask reference from the usage texts and parameter specs. Do not edit by hand.