LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Instability in Closed-Loop PID Control Between LabVIEW and Simulink via UDP

Hi everyone,

I’m new to LabVIEW and currently working on setting up a closed-loop PID control between LabVIEW and Simulink.

I have successfully set up a bidirectional UDP (also tried with TCP/IP but I ran into the same problem) connection between LabVIEW and Simulink, and data transmission works fine in both directions. However, I am facing instability when implementing a closed-loop PID controller in LabVIEW for a transfer function running in Simulink.

What Works:

If I replicate the transfer function in LabVIEW, transmit the PID output from LabVIEW and feed it to the same transfer function in Simulink: the system response is consistent in both software.

Problem:

When I attempt to close the loop, where:

  • The PID controller runs in LabVIEW,
  • Its output is sent to Simulink’s transfer function,
  • The output of the transfer function is sent back to LabVIEW as feedback,

the system becomes unstable.

Possible Causes I’m Considering:

🔹 Timing mismatch between LabVIEW and Simulink.
🔹 Data transmission delays affecting the control loop.
🔹 Synchronization issues between the two software.

I made sure to match the sampling time in both environments by setting a fixed time step in Simulink and the same step as the control loop period in LabVIEW. I also tried using a "Wait until Next ms Multiple" function in the LabVIEW while loop to make sure the execution time is a multiple of the Simulink sampling time.

Has anyone encountered a similar issue? I would really appreciate any insights on how to solve this.

Thanks in advance!

0 Kudos
Message 1 of 2
(81 Views)

UDP is non-deterministic by nature. You should consider passing data between LabVIEW and Simulink model directly. See Use Simulink Model for Windows Target With LabVIEW Model Interface Toolkit

-------------------------------------------------------
Applications Engineer | TME Systems
0 Kudos
Message 2 of 2
(22 Views)