-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proportional on measurement #42
Comments
Interesting. I'll give it a try, but the major problem I see with it is that there's no (P * Error) contribution. This means if you set the setpoint to 225, and the current temp is say 80, the output will be 0% which means there will be no way to get it to 225F. It is relying on the Isum to build up to drive the output, which means the Isum will ramp up to 100% until the temperature is reached which then leaves us in the same place. In the short example graphs shown on that webpage, it isn't a problem because the output is still ramping up when it reaches the setpoint. In a longer term test, say a sous video setup, their Isum (labeled I-term there) would reach 100% as well if the heatup time was a sufficient number of PID cycles in the future. This value is cumulatively reduced by the Derivative * P, and instantaneously reduced by Derivative * D which seems very redundant. I think their "PonM" graph is also wrong because when the control reaches setpoint, there will be dInput = 0 so the "P-Term" will be 0 and the graph should look just like the D-Term graph or merge them into one "sum" stacked graph. Still, it isn't difficult to make a test to try it out although I feel like there's a reason why you don't see this in commercial PID software-- because the D term is already there for this exact reason. |
The author goes into a little more detail on this page:
|
I was intrigued by this as well, and from the description sounds like it would work well. Implemented a couple variations with little success. Not sure if it was a coding problem or a tuning issue, but I ran out of patience because it takes so long to test changes on the WSM. It seemed to get wound up too easily or was too ineffective. The way it is implemented in the PonM library, the P and I terms get combined which makes it tough to observe. |
Based on concept from #42 http://brettbeauregard.com/blog/2017/06/introducing-proportional-on-measurement/ Don't tell anyone I think but this is a really silly concept!
Thanks for testing it out. I actually found a textbook reference to Proportional on Measurement that seems to confirm your findings and offers a fix for the "degraded response following a setpoint change" I can't remember which PID settings I have now, but my heatermeter usually controls my WSM close to +/- 1 degree F for hours at a time (until the coals need stirring-then oscillations start to occur) |
Ooh that's a good link, I just spent the last hour reading both chapters looking for ideas. The solution presented just adjusts the setpoint further away from the current input to accelerate the integration which I don't think will help because we've already saturated the Isum at 0% (our integral lower limit is 0) and due to the Also reading that paper, I'm not sure what the heck the Arduino PID code is doing. P on M isn't integrating! PonM should be instantaneous, He mentions it in his second article, in the second pass section but I can't figure out how it can achieve the proper output unless the input is already changing in the proper direction. P on M is supposed to guesstimate the proper output for a given setpoint so if we know ambient is 80 and our target is 225, PonM is supposed to set the output to P * (225-80). If we know it generally takes 30% power to maintain 225, we'd set Now that I've read all this, I'm definitely going to back out the changes. While PonM is a thing, having it slowly ramp to that value relying on an external contribution to actually initiate the change is not sound and then applying it in reverse to the Isum is just baffling. |
Sorry it didn't work out. It seemed like a good idea reading those posts. At least we all know a little more about PID theory now... |
Too right we do! It was educational in that I've learned some new terms, like I didn't know what we had was an "independent gains (parallel form) proportional-on-error derivative-on-measurement" PID controller. I also was able to find sort of a bug in the code in that the Isum could theoretically jump to a very large value of the temperature changes very rapidly but the controller isn't saturated yet. I'll keep that change. I'll also probably re-add PonM as an option in the more traditional sense, where it contributes just a straight P*setpoint so people can play with that if they like. I might also change the antiwindup code to operate always in the proportional band rather than on the last output? Not sure if that would make a mess of anything. |
Actually, reading over it all again, equation 2.3(24) is for PonM and DonM and it uses -C for the proportional input so I guess the Arduino PID library is correct in that it is a resisting force? I'm very confused about how that's supposed to work. If it is 80 and we're shooting for 225:
If Isum is constrained to 0-100%, the controller will only be able to run at 100-(P*temp) so the higher the temperature, the lower the max output would be. That doesn't make any sense at all. How is this simple few lines of code taking several days to consider! It even says the proportional contribution to the output is -Kc*C, is all of this for a reverse-acting controller? |
@br3ttb Any thoughts? |
Well a couple dozen hours of reading and testing and yet another implementation. I've also read some papers on 2DOF PID controllers and unsurprisingly they all use a negative sign on the control variable. I get a bit lost reading these papers when they jump right into using Because the P contribution is always negative in this configuration, the limit on the integral sum needed to be increased so the output can reach 100%. Without this, the max output would be lower the higher the setpoint is, since In bench testing, it had a pretty good setpoint response with little overshoot and a llllooooong oscillation period. The disturbance response however was not great, although it could be because I don't have optimal coefficients. In grill testing, I saw a lot of overshoot when achieving setpoint. With this system the Isum always maxes out on startup, and the P contribution is roughly constant so the controller doesn't back off quickly as it passes the setpoint. This is mitigated by a more managed approach to the setpoint due to being almost entirely controlled and limited by the In any case, I've uploaded a snapshot AVR firmware with the current code to the online repository so it can be tried out. I used P,I,D = -0.4, 0.10, 12. I am concerned with the P value being on measurement meaning that, say 400 degrees is -96%, and Isum will range from 0-196% but the D term's range is always fixed due to being on Error. |
Thanks for testing, however, you can't just invert the sign on the P value and switch to PonM. It's a whole different game and "3" is about 10x too high I think. The "I" for my test system was also 5x the PonE version, and the "D" is about 2x my normal PonE value. It definitely is strange that it cut off roughly as it would have been getting close to starting to control though. There's definitely something weird happening there, I'll have to try your values and see if I can reproduce. Something might be overflowing internally due to the larger P than expected. Maybe try it with PID= -0.3, 0.08, 10 (which would be -1/10, 10x, 2x your PonE values). |
Thanks for the reply. Makes sense based on the math that my values are off. The Android pid guy had suggested at using the same tuning values in his article, but that does not see like it will work. I will give it another go next time with more reasonable values. |
Whew, As a note, the implementation in the OP is from an early version of the library, which is very strange - it seems to want to integrate the differential term to achieve a similar effect to pure P on M (lambda =0), but I'm not sure exactly what all the extra work of integrating a differential accomplishes or if it causes any other possible problems. Additionally, the author of the library calling the effect of P on M "resistive" in either implementation is simply incorrect and a big part of my confusion. Anyway the latest implementation of that library just uses simple pure ponm as described in articles linked above. Lastly in the spirit of accumulated knowledge, and helping out newbies like me: I found the wikipedia section on proportional and derivative action on measurement demystified the terms in the paper shared a bit because the article as a whole is self-contained and defines all the terms used in the formulae: https://en.wikipedia.org/wiki/PID_controller#Basing_proportional_action_on_PV Thanks again! |
Have you considered implementing proportional on measurement from the Arduino PID library to reduce or eliminate overshoot since smoker temperature control is an integrating process? It doesn't appear to be too difficult to implement, it just adds one extra term to the PID equation.
The text was updated successfully, but these errors were encountered: