annuler
Affichage des résultats de 
Rechercher plutôt 
Vouliez-vous dire : 

LabVIEW PID controlled PWM output

Résolu !
Accéder à la solution

Dear All,

 

I need to control the heater with set temperature. My idea is to use PID control which can output duty cycle percentage and in-turn generate the PWM signal to control the SSR using single board RIO with 1 KHz frequency.

 

I have searched the forum for previous post. But unfortunate to find right one, most of them uses DAQ to generate variable duty cycle PWM output. Hence am using RIO digital I/O line in RT, am not familiar on how to proceed.

 

I would be happy to see the replies.

0 Compliments
Message 1 sur 18
9 769 Visites

Hi,

 

you can use attached vi and link the output to Digital Output port of RT. The vi has two inputs: "PID output (%)" which you connect to your PID controller and "PWM period (sec)" which specifies the lenght of PWM period. For heater I ussualy set something between 3 to 10sec. For better resolution I usually use heater  with more heating elements and split PWM into more parts.

 

BR, Jan  

Message 2 sur 18
9 737 Visites

Hi,

 


@JanBarton wrote:

Hi,

 

you can use attached vi and link the output to Digital Output port of RT. The vi has two inputs: "PID output (%)" which you connect to your PID controller and "PWM period (sec)" which specifies the lenght of PWM period. For heater I ussualy set something between 3 to 10sec. For better resolution I usually use heater  with more heating elements and split PWM into more parts.

 

BR, Jan  


 

Thanks for reply. Attached vi is protected, if don't mind can you share the password.

 

0 Compliments
Message 3 sur 18
9 732 Visites
Solution
Accepté par l'auteur du sujet lv_user_bs

Sorry, my fault 🙂

 

Here you are

 

BR,Jan

Message 4 sur 18
9 703 Visites

Hi JanBarton,

 

Thanks for your time. Can you please help me out to understand the logic because am new to this.

0 Compliments
Message 5 sur 18
9 694 Visites

Hi,

 

it is easy. A simple sawtooth  signal is built representing a value from 0-100 of period time. This signal is compared to wanted output value. If the value is  higher than the current value of sawtooth signal the output is high. See fig.2 on this webpage  https://en.wikipedia.org/wiki/Pulse-width_modulation  

 

BR,

 

Jan

0 Compliments
Message 6 sur 18
9 603 Visites

hello sir

Can you make a screenshot of the code ?

because i have labview 2015.

thank you

0 Compliments
Message 7 sur 18
8 272 Visites

Hi nad,

 

Can you make a screenshot of the code ?

I took the liberty to simplify the VI a little bit:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Compliments
Message 8 sur 18
8 264 Visites

Thank you !

Another question : In tick counter, why do use ms like counter units ?

I think it's good  if you use ticks  unit.

and why do you multiply the result of substraction by 0.001 ?

 

0 Compliments
Message 9 sur 18
8 241 Visites

Hi nad,

 

In tick counter, why do use ms like counter units ?

The OP decided to use that VI (most probably) on a RT target, with using a millisecond tick counter…

 

I think it's good if you use ticks unit.

Depends on the target you want to run that code on…

 

and why do you multiply the result of substraction by 0.001 ?

Because the control is named "PWM period (sec)" and your tick counter gives ms: there's a conversion factor of 1000 between both units…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Compliments
Message 10 sur 18
8 236 Visites