Is there a way to have setpoint = 460 to 480 to create a "softer" current limit where some ripple at the output would be ok?
Also, what about having the clamp set at 960, then dividing that number by 4 and feeding it to the HPWM?
Is there a way to have setpoint = 460 to 480 to create a "softer" current limit where some ripple at the output would be ok?
Also, what about having the clamp set at 960, then dividing that number by 4 and feeding it to the HPWM?
Last edited by jmgelba; - 6th March 2012 at 15:16.
Hi,
For simplicity, let's concentrate on the proportional gain alone (no Ki or Kd) to start with, OK?
Let's then assume the following:
* You have a proportional gain of 1, ie pid_Kp=$0100
* You're setpoint value is 480
* You have 2.1A flowing in your circuit resulting in an ADC value of 480
Now, when you calculate the error, pid_Error = SetPoint - ADC the error is 0 and therefor pid_Out will be 0. Since you're feeding pid_Out straight to the PWM module the dutycycle will be set to 0.
Now, because the dutycycle is 0 the current drops, rapidly. By the time you sample the current again it has dropped to 0 or close to it (I'm guessing a bit), so the ADC value is 0 and pid_Error will be 480. Because you have a proportional gain of 1 pid_Out would be 480 but it gets clamped to 240. That's where your bouncing output comes from.
If your 'idle' point requires a dutycycle of 240 then you need to set that up first. THEN you sample the current and run the error thru the PID-loop and ADD the pid_Out to the 'idle' dutycyle. For example, 240 is nominal dutycycle value, when the ADC returns 475 it means the current is on the low side, the error is 5 and pid_Out becomes 5 which you add to your 'idle' resulting in a dutycycle value of 245. If the ADC value is 490 (too much current) the error will be -10, the the pid_Out will be -10, which you add to your 'idle value' resulting in a dutycycle of 230, lowering the current.
Again, the above ilustrates what happens with a proportional gain of 1 only, when you add in the integral and derivative terms it'll act a little different.
There is no built in way to have it clamp in a soft way as you describe, you have to do that "manually" if you need.
/Henrik.
How possible is it to make (and how, any ideas) the P-I-D parameters set automatically, like auto-tune?
I have seen some chinese temp. controllers that say they can do auto-tune according to the device they control.
Ioannis
There are various ways for doing autotuning. Basicallly you step the setpoint and analyze the system response regarding risetime, overshoot, amplitude and frequency of any oscillation and so on.
I've got the question before and did some research into the matter but to be honest the math involved is beyond me. Right now I re-Googled PID Autotune and it came up with a link to a autotune library for Arduino - I may need to have a look at that!
If you're up for it, feel free to take a stab at it!
/Henrik.
Thanks Henrik.
I will look at that link, although c and similar is not my strong.
What you proposed is I think the obvious way to approach the problem. I was thinking more or less the sam.
It seems that chinese are doing it much faster though. My REV200 Siemens temp controller is fast in evaluating the room too!
Ioannis
Bookmarks