10-27-2025 06:56 AM
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.
10-27-2025 07:54 AM
Try doing a Web search using the terms "myRIO" and "Lead compensator". Speaking for myself, I prefer using LabVIEW functions to "scripting".
Bob Schor
10-28-2025 08:21 AM
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.
10-28-2025 08:37 AM
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…
10-28-2025 05:13 PM
If you reverse the order of the Search terms (start with Lead Compensator), it should lead you to the LabVIEW Forums 8 years ago.
Bob Schor
11-05-2025 03:37 PM
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:
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).
The angle difference was used as the input to the lead compensator, and the output gives the corresponding duty cycle.
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.