10-21-2025 02:26 AM
To make my question clear, I will talke about subcooling temperature only.
I'm a beginner in LabVIEW and I’d like some guidance on implementing a PID controller for my setup.
My system involves heating a refrigerant to reach a desired temperature with a specific subcooling degree. Here’s what I’m doing:
I measure the refrigerant pressure and calculate the corresponding saturated temperature.
Then I subtract the subcooling value to get the desired (target) liquid temperature.
I compare this target temperature with the actual measured liquid temperature.
If the actual temperature is lower than the target, the heater should turn ON; otherwise, it should turn OFF
Now I’d like to replace this simple ON/OFF logic with a PID control in LabVIEW to achieve smoother and more stable temperature control.
What type of PID controller (e.g., built-in “PID.vi” or other) would be suitable for this kind of thermal system and how to implement it?
My VI is attached here.
Thank you!
10-21-2025 03:02 AM - edited 10-21-2025 03:12 AM
Hi alhabeeb,
@alhabeeb wrote:
I'm a beginner in LabVIEW and I’d like some guidance on implementing a PID controller for my setup.
Now I’d like to replace this simple ON/OFF logic with a PID control in LabVIEW to achieve smoother and more stable temperature control.
What type of PID controller (e.g., built-in “PID.vi” or other) would be suitable for this kind of thermal system and how to implement it?
You're not a beginner anymore with your history of LabVIEW questions…
The main question is: which kind of control does your heater allow?
I had done your task some years ago:
10-21-2025 04:35 AM
Dear GerdW
Thank you for your reply and the helpful explanation.
In my setup, I’m using an NI-9475 module (digital output) to control the heater circuit through a solid-state relay (RST-3-4-40, 3–32 VDC control, 20 mA input).
So currently, the heater can only be switched ON or OFF — it doesn’t accept an analog input for variable power control.
Regarding your point about pressure control: in my case, using pressure as the main control parameter doesn’t help much in maintaining a stable subcooling level, since the heater only works in ON/OFF mode.
That’s why I’m considering implementing a PID controller to make the ON/OFF switching smoother and achieve a more stable subcooling temperature, as you mentioned.
Thanks
10-21-2025 05:44 AM
Hi alhabeeb,
@alhabeeb wrote:
So currently, the heater can only be switched ON or OFF — it doesn’t accept an analog input for variable power control.
Regarding your point about pressure control: in my case, using pressure as the main control parameter doesn’t help much in maintaining a stable subcooling level, since the heater only works in ON/OFF mode.
That’s why I’m considering implementing a PID controller to make the ON/OFF switching smoother and achieve a more stable subcooling temperature, as you mentioned.
From the image you seem to use a heater with a 3phase supply, so I expect heating power in the kW range.
This usually hints about higher thermal masses and temperature ramps in the lower K/s range.
Am I right about these assumptions? (Can you provide more details about specific requirements of your system?)
I also worked with an automotive testbench with an external heater in the 100kW range:
All you need is a small subVI that translates two inputs (duty cycle in %, cycle time in s) into an on/off state of the DO. It's a very simple calculation!
Your PID should be configured to output duty cycles, aka set an output range of 0%…100%. Adjust the PID gains to fit with your timing constraints!
(Are you able to measure the temperature reaction when you switch on the heater? This will help you in determining PID gains…)
10-21-2025 06:45 AM
Dear GerdW,
Yes, you’re right — the heater is a 5.5 kW, 3-phase unit. It’s used to heat a low refrigerant mass flow rate of 0.009 – 0.09 kg/s, raising the temperature from around 30 °C up to 85 °C.
I’m located in Europe, so the power supply frequency is 50 Hz.
Your explanation makes sense and seems very relevant to my setup, but to be honest, I’m not yet familiar with implementing a PWM scheme with cycle times.
As for the controller, there are several PID options in LabVIEW under the Control & Simulation . Could you please advise which specific PID VI would be most suitable for this kind of thermal system?
Thanks
10-21-2025 08:10 AM - edited 10-21-2025 08:12 AM
Hi alhabeeb,
@alhabeeb wrote:
As for the controller, there are several PID options in LabVIEW under the Control & Simulation . Could you please advise which specific PID VI would be most suitable for this kind of thermal system?
You can start with the simple PID -> PID.vi.
(I used the other stuff only for "more complicated" systems, lead-lag or GainSchedule might be helpful…)
@alhabeeb wrote:
Your explanation makes sense and seems very relevant to my setup, but to be honest, I’m not yet familiar with implementing a PWM scheme with cycle times.
Your DAQ loop should run with a fixed iteration rate, mine used to run at 10Hz (= 0.1s per iteration).
Now the duty cycle reduces to how many iterations you want to output HIGH within each 50 iterations (10iterations/s * 5s).
Example: a dutycycle of 35% means ~17 iterations HIGH and 33 iterations LOW. You can easily count iterations and the rest is simple math/comparison…
Btw. I strongly recommend some safety features purely made in hardware. I recommend not to rely only on software for such heating systems!
10-21-2025 10:03 AM
Dear GerdW
Thank you for your explanation — it really helps!
However, I’m still a bit stuck at this point 😅
My vi is attached here
10-21-2025 12:38 PM - edited 10-21-2025 12:39 PM
10-24-2025 08:30 AM - edited 10-24-2025 08:45 AM
Dear GerdW,
Thank you for your suggestion.I did it like in the attahced file. Could you please confirme my code and could you clarify how I can determine the gains?
Thanks
Baqer
10-24-2025 12:57 PM
Hi alhabeeb,
@alhabeeb wrote:
Could you please confirme my code and could you clarify how I can determine the gains?
The code looks quite ok…
On determining PID gains: there are common rules to determine them from a simple open-loop step response. Have you ever heard about Mr. Ziegler and Mr. Nichols?