LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PID with controlled ramp

Hi guys, I am setting up a furnace controller using PID autotuning. The computer is hooked up to a furnace via a DAQ card that allows interface with the furnace controls. There exists a linear relationship between input voltage and output power and this is used to control the unit. I have already set up a program that controls the power and reads the temperature but this is a basic program whose purpose is to allow me to collect the data required to calculate the PID parameters (plant gain, proportional gain, delay time etc). I am in process of building the PID program now and I have a few basic questions about the PID toolkit that I hope someone can help me with.

 

1 - Do the PID VIs output a value that is in the units of your manipulated variable? To be more specific, my plant gain is calculated by observing a change in temperature that comes from a step change in power. Therefore, my plant gain is Delta Temp/Delta Power. Does the VI use the gain, delay and integral time values provided to internally calculate an output that is a power value or do I need to implement that control function myself? In all of the PID examples, the PID's output is then fed to a Plant Simulator which, I assume, is there only because the examples aren't hooked up to actual systems that would respond to a change in inputs. Is this correct?

 

2 - Is it possible to couple the Autotuning PID with the Setpoint Profile VI to get a user controlled ramp rate? Alternatively, would it be better to couple the Autotuning VI with the Output Rate Limiter? The Output Rate Limiter sounds like it would do the job at first but, having read the help files, it seems like it requires that you specify a power rate (kW/min) rather than a temp rate (degrees/min). The Setpoint Profile looks like it would indirectly get the job done (since the user can't directly set a heating rate) but that is not a big deal. 

 

2a - Regarding the Setpoint Profile VI, I have been studying the example provided with the detailed help - Simulation - Cascade and Feedforward Surge Tank Level. I'd give you a link but the website tells you to refer to the code in your program files. The example shows that the final manipulated variable is the difference between the Setpoint VI's output and the PID VI's output. This difference is then fed to the plant simulator VI to simulate a physical system's response to the change of vairables (presumably). Part of my confusion in question 1 is due to this. Considering these two VIs from the viewpoint of my program, the Setpoint VI's output is a setpoint (temperature) while the PID VI's output is ... what exactly? If it is indeed a power value, then Setpoint Temp (in hundreds of degrees) - Power (in the range of 1-3 kW) will give a value in the hundreds. Instead, it seems like you'd use the Setpoint VI's output as the setpoint input on the PID. Atleast it seems the most logical course to me. Where am I failing to understand how these things work?

 

Thank you in advance for any insight you folks might be able to provide. I should be done with the first prototype of my program in a day or 2 so I should be able to start testing and figuring out how these things work soon enough. I'm hoping you guys can clear up these questions in advance so that this process is a little easier.

0 Kudos
Message 1 of 18
(6,561 Views)

1 - Proportional gain has units of [output units]/[input units] - that is, proportional gain is a scaling factor that determines the output change that corresponding to a particular difference in the input. If you determined the gain by measuring a change in temperature caused by a step change in power, then the PID output will be in units of power. If you had instead determined the gain by making a percentage change in output power, the gain would be different and the output units would be percentage of full power. PID is just math - fairly simple math, at that - so you can actually work out the units all the way through.

 

2- These are two different things, and they aren't the only options. If you want to specify a ramp rate yourself, and you don't want to use the setpoint profile, use the Ramp Pattern function along with your loop rate (or do the math yourself). The output rate limiter protects the system from sudden, large changes in output, in case your system cannot cope with such a change (although if used incorrectly it could cause integral wind-up). It is not designed to generate a smooth ramp in the process variable (temperature, in your case).

 

2a - this looks like a poor example to use as a starting point for your program since it's not at all analogous. If I understand correctly, you have a simple heater and a single PID loop. The example has two PID loops, cascaded, where the output of one is the setpoint for the other. Nearly all the values in the example are percentages of full-scale, so there's no direct physical meaning. I don't understand exactly what this example is trying to demonstrate - I'm not sure why the flow rate as a percentage is the setpoint for the tank level as a percentage.

0 Kudos
Message 2 of 18
(6,539 Views)

Thank you for responding! My assumption was that the PID modules would output a power value so thank you for confirming that. With regards to rate control, I will check out the Ramp pattern function and try to figure out which of the options works best for me. With regards to 2a, are there any better examples that use the setpoint profile vi?

0 Kudos
Message 3 of 18
(6,523 Views)

I don't know, I haven't looked through all the PID examples. I don't think I've used the Setpoint Profile VI, but its function seems clear based on the documentation and the code. If you don't quite understand it, you can put together a simple example yourself: drop that function inside a while loop, add a Wait (ms) timer, create a control from the setpoint profile, and wire a shift register to connect the profile complete output to the reinitialize input. Add a chart and wire the setpoint output to it. Then enter some values for the profile and you can quickly see how it works.

 

I suspect, however, that generating your own ramp will be more appropriate for what you've described. You could also try using the Output Rate Limiter, as you mentioned, but put it on the setpoint rather than the output. This, too, would be easy to test in a simple VI with a chart.

0 Kudos
Message 4 of 18
(6,511 Views)

When you say the following:

 

You could also try using the Output Rate Limiter, as you mentioned, but put it on the setpoint rather than the output. This, too, would be easy to test in a simple VI with a chart.

 

I assume you mean wire the output of the rate limiter to the setpoint of the pid right? I imagine that means I can set the rate limit input in terms of degrees/minute? I will give this a go too.

0 Kudos
Message 5 of 18
(6,497 Views)

I am in the process of implementing the Setpoint Profile VI and had a question. The PID VIs take a d(t) input as does this Setpoint Profile. Probably best to use the same value for both right? 

0 Kudos
Message 6 of 18
(6,468 Views)
Leave the dt input unwired. It's only useful if you want the VI to act as though it's running at a different rate than it actually is, for example for simulating a system at faster than actual speed. In a real system, the VI will calculate the elapsed time since the last run when you don't wire a value for dt.
0 Kudos
Message 7 of 18
(6,464 Views)

Just got done running my first test and I'm not entirely sure what happened. I had probes on the PID output the Setpoint Profile output. The latter seems to be doing it's job but the PID output never dropped below 1 kW despite having set a minimum value of 0.3 kW. Consequently, the system heated up at a lot faster rate than what was set using the Setpoint (25 C/min as opposed to the specified 10 C/min). Eventually, the autotune reached a point where the gain was infinite since, during the entire process, the change in manipulated variable was zero. 

 

Anyway, have I misunderstood how the output range works on PID with autotuning? I was under the impression that you could set either a percentage range or actual values.

0 Kudos
Message 8 of 18
(6,435 Views)

RudyB wrote:

Anyway, have I misunderstood how the output range works on PID with autotuning? I was under the impression that you could set either a percentage range or actual values.


You can - but if you use percentage, then further down the line you need to convert the percentage to output units (the PID palette has EGU to percentage, and percentage to EGU, VIs for this purpose, but it's just simple math). If you want your PID output units to be in kW, you will also need to scale from kW to volts, since that's what your DAQ card actually outputs. You mentioned that it's a linear scale, but if it's not a direct mapping (1kW = 1V) then you'll need to do the appropriate conversion.

 

I can't comment much on the autotuning - I've always done it manually since it doesn't take that long using one of the standard methods. Which of the several autotuning PID functions did you use, and with what parameters?

0 Kudos
Message 9 of 18
(6,426 Views)

Yep, already have a function to scale from kW to volts. I am currently using PID Autotuning (Temperature).vi. Regarding the output range, I specified a range of 0.3 to 2.5 which should be in kW right (since the PID output is in kW)?

 

Regarding gains; the name escapes me but I used the method where you set the power to a static value and then late the temperature reach a stable condition. Then step up the power by a fixed amount and use the subsequent increase in temperature to calculate the process gain. This was repeated for 4 steps of power (started at 1.1 kW and went to 1.5 kW). I then used the gain value that came from the temperature range that my standard operations fit in to.

 

So I had a K of 443 (~44C / 0.1kW), an intergral time of 350s and a delay time of 1s (microwave furnace; system responds very quickly to changes in power). Kc is then (0.5 * integral time) / (K * delay time). Integral time same as above, but in minutes and no derivative time was set. I'm about to try the program as is again, just to see if the PId will output a power value below 1 this time but if that doesn't work, I might turn to doing the Zeiger-Nichols tuning tomorrow and see if I get better results using that approach.

 

Edit: Do I need to make some special allocation for power reduction? i know you said the example that came with setpoint profile vi was pretty bad but it seems to have seperate gains for increase and decrease.

0 Kudos
Message 10 of 18
(6,421 Views)