02-18-2025 07:52 AM
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.
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.
When I attempt to close the loop, where:
the system becomes unstable.
🔹 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!
02-21-2025 02:55 PM
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