Hi everyone!
I would like to build a continuos integrator block in C-script with an anti-windup protection.
I need a C-script because I have time-varying saturation limits and I don’t know which library block to use.
I attached the Plecs file so you can see my work.
What I would like is to block the integration when I exceed the saturation and get out as soon as the input " discharge " the integral. (solve the wind-up problem)
Can someone help me please? Thank you so much.
Integrator anti_windup.plecs (9.85 KB)
Niklito,
The main problem: you are assigning your derivative only if the integrator isn’t locked, but you don’t set the derivative to zero if it is locked, so the derivative remains at the last value set before being locked.
To further improve the implementation:
Use two separate lock states inLowerLimit and inUpperLimitLeave the lock states if the input is negative (for inUpperLimit) or positive (for inLowerLimit)Limit the continuous state instead of just the output, otherwise you’ll end up with numeric errorsKind regards,
Oliver Schwartz