LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PID controller to control temperature

Hello everyone, my step input here will be current and based on how much value the current is.... the thermometer will either gain or lose heat and the temperature will be reflected in the indicator structure. However, I am unsure of which PID to use and since my LabVIEW version is 2024, is it possible for me to put XY graph without including the CD construct transfer function? 

plssendhelp1506_0-1717465631479.png

 

0 Kudos
Message 1 of 18
(817 Views)

Hi everyone, just wondering am i doing something wrong here ? 😖 current supposed to affect the temperature but it doesn't implies that temperature and current needs to be added up so that total will be 200......

plssendhelp1506_0-1717468672410.png

 

0 Kudos
Message 2 of 18
(800 Views)

I would start with creating a real toplevel loop with defined timing.

 

Currently you seem to be running it in "continuous run" mode (a mode that should be called "restart from scratch when done" instead!). If you look inside the code of the PID subVI, there is a "first call?" that initializes the internal code when called for the first time. If you use "continuous run", this is always true.

 

LabVIEW ships with a nice example, so study that first. Open the example finder and look for "General PID simulator".

 

altenbach_0-1717475511897.png

 

Message 3 of 18
(776 Views)

Hello altenbatch, 

 

thanks for always helping me out. I will try that out and let you know. 

 

With regards,

Emma 

0 Kudos
Message 4 of 18
(761 Views)

Hi Emma,

 


@plssendhelp1506 wrote:

Hi everyone, just wondering am i doing something wrong here ?


It seems you don't understand how a PID controller actually works…

 


@plssendhelp1506 wrote:

current supposed to affect the temperature but it doesn't implies that temperature and current needs to be added up so that total will be 200......


Christian already gave advice, but I would like to add:

You set an output range of ±200 and the pv is (much) smaller than the sp so the PID controller will output a value to minimize the error, depending on your PID gains. This is expected operation of the PID!

 

Btw.:

  • To understand PID function it would help to use the default control/indicator labels (setpoint, current value, output value)!
  • Why do you expect a "temperature" output value from PID?
  • What is your intention about using (default?) PID gains?
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 18
(741 Views)

Hello GerdW, 

 

I am using a PID controller here to control the current and the amount of current being drawn will determine how effectively that heater gains heat...So sorry, for my mistake the PID controller should be used to control the current since the step input that i am looking into is current...after looking into the example, am i right to say that SP is the value that we set while PV will increase itself to sort of match the value in SP? If I were to change the SP indicator from 0-100 to 0-4 does that mean I also have to change the value for MV? I was told that I must include transfer function inside so that I will be able to run this entire thing inside a PLC...just to check Is it possible to include formula inside even if my LabVIEW is 2024 version ? 

 

With regards,

Emma

 

plssendhelp1506_0-1717488342784.png

 

0 Kudos
Message 6 of 18
(731 Views)

Hi Emma,

 


@plssendhelp1506 wrote:

after looking into the example, am i right to say that SP is the value that we set while PV will increase itself to sort of match the value in SP? If I were to change the SP indicator from 0-100 to 0-4 does that mean I also have to change the value for MV?


You know how a PID control actually works?

  • SP: setpoint defines the required state of your system (aka plant in the example VI)
  • PV: measurement value describing the current state of the system
  • MV: PID output to drive/influence the system by changing an actuator

You "don't have to change MV", the PID will calculate the MV value…

 


@plssendhelp1506 wrote:

I was told that I must include transfer function inside so that I will be able to run this entire thing inside a PLC...


"Transfer function" of which part of the control loop?

Why develop LabVIEW code when the PID control should be done by a PLC?

What is the intended goal of your task?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 18
(724 Views)

Hello GerdW, 

 

Thanks for the explanation. I'm so sorry, I wanted to replace the plant model with a transfer function. I am using LabVIEW code to develop PLC now since the PLC I ordered from the supplier has yet to be delivered and I am running out of time. It gives me a gauge of how the system will work. Just to check, I do not need to include formulas inside PID controller, right? 

 

With regards,

Emma 

0 Kudos
Message 8 of 18
(716 Views)

Hi Emma,

 


@plssendhelp1506 wrote:

I wanted to replace the plant model with a transfer function.


I don't have experience with this approach as I almost always used real hardware systems with PID control…

 


@plssendhelp1506 wrote:

Just to check, I do not need to include formulas inside PID controller, right? 


Depends…

  • The PID function is "like it is", implementing a pure PID controller/algorithm. No need to change this (when you are happy with the behaviour of NI's PID when changing gains).
  • I changed (a copy of) the PID so it doesn't reset its internal state when I change the PID gains. That allowed me easy gain scheduling…
  • When you need to put the PID into a more complicated control algorithm (gain scheduling, feed forward, etc.) you may add "formulas" (aka more code) to your controller…

@plssendhelp1506 wrote:

I am using LabVIEW code to develop PLC now since the PLC I ordered from the supplier has yet to be delivered and I am running out of time. It gives me a gauge of how the system will work.


Which kind of PLC do you intend to use?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 18
(710 Views)

Hello GerdW, 

 

I see, but still thanks for all the useful advice and explanation ! It really helps me to understand things better. The PLC that I am intending to use is PLC from Panasonic. Thanks for hearing me out !

 

Warm regards,

Emma

0 Kudos
Message 10 of 18
(705 Views)