Hard Limits, Ramp Limits and Non-Windup PI Controllers #101
Unanswered
rodrigomha
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
@jd-lara @duncancallaway @m-bossart @ciaranrob
Hello, this discussion post serves as a starting point for our discussion on implementing limits on models in a general form.
Hard Limits
First of all, I want to mention that a hard limit is implemented directly in Julia using the
clamp
function. The clamp function is theclip
function typically used in Python. That is a block of the form:Can be implemented directly in Julia as:
y = clamp(x, x_min, x_max)
Ramp Limits
Second, it is common to find the following block that includes both hard limits and ramp limits in a low-pass filter block:
The first thing to note is that both options can be implemented using two clamp functions. First thing to remember is that a low-pass filter without limits is modeled as follows:
It is not clear for me yet, what is the standard implementation of this block including limits, but I have seen the following two implementations:
The only difference between two options is if the time constant is considered for the ramp limits. The implementation for option A and B is as follows:
We can implement a wrapper function that returns both the derivative and the saturated output:
An inconvenience of this implementation, is that if the user wants to plot
y
after the simulation is over, it will return the non-saturated value.Non-Windup PI Controller
Finally, the Non-Windup PI controller, is usually find in the following form:
The standard implementation (that can lead to trajectory deadlock) is the following:
Note that in this block the code is as follows:
Again we can wrap the PI block in a function as follows:
A discussion of implementing the solution proposed by Hiskens in the paper is an alternative also, but requires augmenting the states of the model.
Finally, this is the proposed implementation for doing it directly in the model function. The callback implementation requires a different approach to design the affects and conditions (although will be similar at the code presented here).
Beta Was this translation helpful? Give feedback.
All reactions