LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RT - PID Gains - where and when to use them

1. Where and when to use PID Gains?

Answer: Whereever and whenever you want to use a PID controller.

 

e.g. Since you want your temperature to be under PID control, your temperature controller needs a set of PID gains. However, since your fan is under on/off control (not PID control), your fan controller won't have a set of PID gains.

 

2. Is what the NI applications engineers told be wrong or correct?

(Not enough information) What did the NI applications engineers tell you?

 

When I asked the NI app engineers "do I need to add PID Gains every time I add a controlled device" they said yes. So to questions "1" and "3", is this where and when I add PID Gains? Each time controlled device? is added -OR- to the process variable/parameter? In the case of the Temperature Chamber Control project, it appears the process variable/parameter isTemperature in the initialize.vi and chamber control.vi.

 

3. As I expand on the concept of this example, does each controlled device get a PID Gain as the app engineers suggested or just each variable/parameter?

Devices, variables and parameters do not get PID gains. PID gains are parameters that you give to your PID controller(s), in order to optimize their performance.

 

To carry the discussion further, please answer this question: What do you want your PID controller(s) to do? If the above assumptions, the uploaded example, and based on the theory in the videos below, the PID controller is optimizing temperature. But let's take it a step further. Let's say the temperature is a function of the fan and the lamp (the lamp is not an interference). Let's also say devices X, Y, and Z are added to control temperature in "the plant" and are automated to respond to temperature. So now fan, lamp, X, Y, Z are controlling temperature. Do fan, X, Y, Z now get their own PID gains? That's what the NI app engineers said "yes" to.

 

http://www.youtube.com/watch?v=UR0hOmjaHp0

 

http://www.youtube.com/watch?v=XfAt6hNV8XM

0 Kudos
Message 11 of 23
(1,531 Views)

I think you need to take a step back and look at what the PID gains actually are.

 

They are input to the PID controller, weighing the different parts of the PID controller (P, I and D). So each PID controller needs a set of PID Gain parameters.

 

If you create a new instance of the PID controller then yes, you will need to add PID gains to that controller.

 

The more complex question is, what numbers do you want to put into the parameters? Using the same parameters as input to several PID controllers is most often a bad idea. You should calculate gain parameters for each controller indiviudally.

 

I understand if you dont want to plow through all available information on PID controllers, but at the same time PID control is a rather complex topic and unless your system is simple or very common then it might be hard to find even a starting point on how to build your control system and what parameters (PID gains) to use.

 

Like others in the thread have said, its not a yes or no answer. And you are kind of asking the wrong question.

 

In your answer to 3. you ask if fan, X, Y and Z should get PID gains. The answer is No. The PID controller (or controllers) that controls the fan, X, Y and Z must have PID gain parameters. And if the fan is an on/off device then a PID controller is a bit wasted since its just an on/off-controller (temp over/under setpoint sets on/off).

 

An example (simplified): If you control a quad-copter then you have 4 motors that you control. And the motors control the behaviour of the copter. But the motors dont get PID gains. However you might have one controller each for pitch/roll/yaw that is combined into control signals for the motors. And each of those controllers will have PID gains.

 

0 Kudos
Message 12 of 23
(1,522 Views)

4. When I asked the NI app engineers "do I need to add PID Gains every time I add a controlled device" they said yes.

That is correct.

 

 

5. So to questions "1" and "3", is this where and when I add PID Gains? Each time controlled device? is added -OR- to the process variable/parameter? In the case of the Temperature Chamber Control project, it appears the process variable/parameter isTemperature in the initialize.vi and chamber control.vi.

Please explain, in your own words:

  • What is the relationship between a "device" and a "variable"/"parameter"?
  • What is the relationship between a "PID controller" and a "device"?

(Your answer to these question will influence the answer your original question)

 

 

6. Let's say the temperature is a function of the fan and the lamp (the lamp is not an interference). Let's also say devices X, Y, and Z are added to control temperature in "the plant" and are automated to respond to temperature. So now fan, lamp, X, Y, Z are controlling temperature.

There are many possible ways to do this. Please explain: How do you want each device to affect temperature? (Your answer to this question will determine where/when you use PID gains)

 

 

7. Do fan, X, Y, Z now get their own PID gains? That's what the NI app engineers said "yes" to.

Like I said before, this is affected by your answer to #5 and #6. The NI app engineers said "Yes", and Nimgaard said "No". Both of them can be correct, depending on how they answered #5 and #6.

Certified LabVIEW Developer
0 Kudos
Message 13 of 23
(1,507 Views)

4. When I asked the NI app engineers "do I need to add PID Gains every time I add a controlled device" they said yes.

That is correct.

 

 

5. So to questions "1" and "3", is this where and when I add PID Gains? Each time controlled device? is added -OR- to the process variable/parameter? In the case of the Temperature Chamber Control project, it appears the process variable/parameter isTemperature in the initialize.vi and chamber control.vi.

Please explain, in your own words:

  • What is the relationship between a "device" and a "variable"/"parameter"? Device (fan, lamp or motors in Nimgaard's quadcopter example). Variable/parameter (temperature in the uploaded example or pitch/yaw/roll in Nimgaard's quadcopter example)
  • What is the relationship between a "PID controller" and a "device"? In the uploaded example, if the fan was automated in lieu of it being an interference, the PID controller would control the fan and lamp to reach the desired temperature.

(Your answer to these question will influence the answer your original question)

 

 

6. Let's say the temperature is a function of the fan and the lamp (the lamp is not an interference). Let's also say devices X, Y, and Z are added to control temperature in "the plant" and are automated to respond to temperature. So now fan, lamp, X, Y, Z are controlling temperature.

There are many possible ways to do this. Please explain: How do you want each device to affect temperature? (Your answer to this question will determine where/when you use PID gains) X=VFD on second fan, Y=constant temperature lamp, Z=variable position valve for cooling water to flow in

 

 

7. Do fan, X, Y, Z now get their own PID gains? That's what the NI app engineers said "yes" to.

Like I said before, this is affected by your answer to #5 and #6. The NI app engineers said "Yes", and Nimgaard said "No". Both of them can be correct, depending on how they answered #5 and #6.

0 Kudos
Message 14 of 23
(1,498 Views)

@Russ_in_Louisville wrote:

 

  • What is the relationship between a "PID controller" and a "device"? In the uploaded example, if the fan was automated in lieu of it being an interference, the PID controller would control the fan and lamp to reach the desired temperature. 

This is a decent answer. Let's continue to the next step:

  • Ignoring the fan for now, what does a PID controller do to the lamp to reach the desired temperature?
  • Ignoring the lamp for now, what does a PID controller do to the fan to reach the desired temperature?

 

Your other answers, however, did not address my questions properly. Lists is not helpful; please explain/describe:

 

  • What is the relationship between a "device" and a "variable"/"parameter"?
  • How do you want each device to affect temperature?
Certified LabVIEW Developer
0 Kudos
Message 15 of 23
(1,487 Views)

I dont want to confuse this anymore but i think JKHS asks some very good questions. 

 

Your system model will determine how many controllers you need and thus where to use PID Gains. It is important that we use the same definition of parameters, devices and controllers because if we dont there will only be misunderstandings.

 

The number of controllers arent necessarily the same as the number of devices, and since PID gains belongs to a PID controller its important to separate devices from controllers for sake of discussion.

 

In the case of controlling temperature with only a lamp you would have one controller controlling one device and  you could say that you add one set of PID gains to the device.

 

But if you (in the case of the quad-copter example) use 3 controllers to control 4 devices then you would only use 3 sets of PID gains but have 4 devices.

 

And additionally, there are often more than one way to solve the control problem, so the ratio controllers:devices may vary.

 

Each controller needs a set of PID gains, and even if its not mandatory to actually define a set of PID gains in the code (use default values) the PID controller would still use the PID gains set as default and that will not work very well in most cases.

 

 

0 Kudos
Message 16 of 23
(1,479 Views)

This is a decent answer. Let's continue to the next step:

  • Ignoring the fan for now, what does a PID controller do to the lamp to reach the desired temperature? I beleive in the example, the lamp is analog. The PID controller would optomize the lamp to reach the desired temperature. It might be a bad idea to compare/contrast an digital lamp too in lieu of a analog one.
  • Ignoring the lamp for now, what does a PID controller do to the fan to reach the desired temperature? The fan is analog. The PID controller would optomize the lamp to reach the desired temperature.

 

Your other answers, however, did not address my questions properly. Lists is not helpful; please explain/describe:

 

  • What is the relationship between a "device" and a "variable"/"parameter"? The device affects the parameter. i.e. Lamp affects temperature 
  • How do you want each device to affect temperature? Fan 1 affects temperature by variable speed (convection), Original lamp affects temperature in analog manner (radiant heat), Fan 2 affects temperature by variable speed (convection), Lamp 2 is constant temperature when on (radiant heat), Z=variable position valve for cooling water to flow in affects temperature by varying water flow
0 Kudos
Message 17 of 23
(1,464 Views)

 


@Russ_in_Louisville wrote:

This is a decent answer. Let's continue to the next step:

  • Ignoring the fan for now, what does a PID controller do to the lamp to reach the desired temperature? I beleive in the example, the lamp is analog. The PID controller would optomize the lamp to reach the desired temperature. It might be a bad idea to compare/contrast an digital lamp too in lieu of a analog one.
  • Ignoring the lamp for now, what does a PID controller do to the fan to reach the desired temperature? The fan is analog. The PID controller would optomize the lamp to reach the desired temperature.

I'm not sure what you mean by "analog lamp" and "digital lamp".

 

 


@Russ_in_Louisville wrote:

 

  • What is the relationship between a "device" and a "variable"/"parameter"? The device affects the parameter. i.e. Lamp affects temperature 
  • How do you want each device to affect temperature? Fan 1 affects temperature by variable speed (convection), Original lamp affects temperature in analog manner (radiant heat), Fan 2 affects temperature by variable speed (convection), Lamp 2 is constant temperature when on (radiant heat), Z=variable position valve for cooling water to flow in affects temperature by varying water flow

Great! That means:

  • Fans: Your PID controllers should output speed values.
  • Z: Your PID controller should output valve position values.

 

Next questions:

  • How does a PID controller decide whether it should increase/decrease/maintain the fan speed?
  • How do PID gains affect the output of a PID controller?
Certified LabVIEW Developer
0 Kudos
Message 18 of 23
(1,438 Views)

I don't know. Are these questions targetted to get me to think about it? I don't know and I don't do well with reading a book on how to fish. I do better if a friend pulls up a bucket right next to mine, sit down on the shore, and shows me how to fish. Going back to the uploaded example, what is the PID controller doing? Since the class was online, I was unaware the fan was an interference (i.e. activated by the user). I thought it was automatic. I just want to expand on the example idea to add more sensors and controlled devices all within the same control volume (CV). Video? Maybe

 

I've been through Core 1, 2, RT 1 and FPGA courses. I cannot pay someone to develop my code and that defeats the goal of learning anyway.

0 Kudos
Message 19 of 23
(1,418 Views)

Im not sure what your level of knowledge of PID controllers is so maybe the answer is too low tech.

 

But looking at the example you posted the PID controller calculates the lamp intensity based on the temperature set-point and actual value. This is typically what a PID do. It calculates the error (setpoint - actual) and tries to compensate for this by controlling some device, in the example its the temperature that is controlled by the lamp intensity.

 

Internally the PID controller combines three parts to compensate for the error.

 

The P-part is the proportional part so if your proportional gain is 1, this part will contribute the entire error to the output.

 

The I-part is the integral part and it contributes to the output with the integral of the error over time.

 

The D-part is the derivative part and contributes to the output by calculating the slope of the error over time.

 

The PID-gain parameters determine how much each part will contribute to the output. The output is P + I + D so if you have [1,0,0] as parameters then you have a pure P-controller. They each compensate for each other and interact to hopefully create a controller that is as fast as possible while still being stable.

 

Putting it simple, a PID-controller attempts to chase a setpoint that may change as fast as possible while being stable. The PID gain parameters are pretty much the configuration of the PID controller. If you would have a simple P-controller with 1 as gain, the controller in the example would take the error (temp setpoint - temp actual) and put that as the lamp intensity.

 

There is a very basic explanation of PID-controllers on wikipedia that probably explains this better than i do. And if you are doing any work on PID controllers then you need to understand how they work. Unless you have someone calculating the gain parameters for you, it really isnt a programming problem because setting up a PID controller with predefined values is really easy compared to designing the PID controller.

 

As you may suspect by this post, each controller needs a set of PID gain parameters. Thats when and where to use them.

0 Kudos
Message 20 of 23
(1,393 Views)