LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Implementing a lead compensator on DC motor control using NI myRIO and LabVIEW

Hi everyone,

 

I am currently working on a university project that involves using the NI myRIO to interface with real hardware, and I need some assistance with implementing a lead compensator ( PID controller would be fine too but a lead compensator is preferred). I have already derived the transfer function for the lead compensator, but I am not entirely sure how to implement it. While I am familiar with the Control and Simulation Toolkit, my supervisor has instructed me to use either a Formula Node or a MathScript Node instead. Any examples on how to correctly implement the compensator on the actual hardware would be greatly appreciated.

 

Thank you.

0 Kudos
Message 1 of 6
(264 Views)

Try doing a Web search using the terms "myRIO" and "Lead compensator".  Speaking for myself, I prefer using LabVIEW functions to "scripting".

 

Bob Schor

0 Kudos
Message 2 of 6
(235 Views)

Hey Bob,

 

Thank you for your response.

 

I tried searching online but there was nothing I could find regarding this. Would you have any links/examples for me to refer?

 

Thank you.

0 Kudos
Message 3 of 6
(185 Views)

Hi Mind,

 


@The_Mastermind wrote:

I tried searching online but there was nothing I could find regarding this. Would you have any links/examples for me to refer?


I also searched for "lead compensator implementation" and found links using Google. (They described code for other programming environments, but that should be NO problem.)

 

I guess you need to search better…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 6
(183 Views)

If you reverse the order of the Search terms (start with Lead Compensator), it should lead you to the LabVIEW Forums 8 years ago.

2025-10-28_18-08-53.png

Bob Schor

0 Kudos
Message 5 of 6
(156 Views)

Hey everyone,

 

I finally figured out how to implement a lead compensator and wanted to share the process for anyone who needs it.

 

Here’s how I did it:

 

  1. I used the Control and Simulation Loop along with the Transfer Function block (Control and Simulation > Continuous Linear Systems > Transfer Function) to implement the lead compensator (alternatively Zero-Pole-Gain block can also be used).

  2. The angle difference was used as the input to the lead compensator, and the output gives the corresponding duty cycle.

  3. I then used the Numeric palette to scale the duty cycle appropriately (typically between 0 and 1, depending on how your PWM works)

Hope this helps!

 

Thank you Bob_Schor and GerdW for your assistance.

0 Kudos
Message 6 of 6
(103 Views)