LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extreme program lag when using VISA VIs to communicate with Sorensen power supply via USB

Greetings,

 

I am trying to use the VISA VIs for the first time to interface with a dual channel Sorensen benchtop power supply (I can provide the part number in the morning if that's important). I borrowed a routine from a previous project that my retired colleague wrote since I'm not very familiar with instrument communication in LabVIEW. That VI seemed to run fine on its own, but when I put it in the main loop of my larger program, it lags significantly and is no longer feasible for real time operation. I did make some modifications to what my colleague had, but nothing that I would think would cause performance issues.

 

I've attached a VI with exactly what I wrote for communication with the power supply in my main program, just on its own to reduce clutter (when I remove this part from my main program, it runs fine. So I'm fairly sure the VISA VIs are causing the issue). I'm assuming (hoping) this is just the result of a simple error I am overlooking due this being my first time using these functions. Let me know if there's anything I can clarify, and thanks in advance for any help!

0 Kudos
Message 1 of 6
(445 Views)

A project file alone does not contain any code. Make sure to attach your source.

Message 2 of 6
(407 Views)

Apologies. See attached for the new project folder.

0 Kudos
Message 3 of 6
(377 Views)

humble_programmer_0-1734006511918.png

The main read/write VI.

0 Kudos
Message 4 of 6
(365 Views)

The project still has no idea about the locations of your VIs and if we try to add them, there are conflicts..

Your toplevel also seems to be in the subVI folder, seems confusing.

 

altenbach_0-1734017027801.png

 

Your toplevel VI is a greedy loop that cannot be stopped, just aborted. It calls a single subVI but almost nothing is connected except the resource and error. I recommend a more reasonable connector pane. You can use clusters for related controls/indicators.

 

(You seem to be using "bytes at port", which is most often incorrect, especially if there is a termination character.)

 

I am not a "hardware guy", so hopefully somebody else can help, but there is definitely code smell here.

0 Kudos
Message 5 of 6
(345 Views)

Hi humble,

 


@humble_programmer wrote:

I borrowed a routine from a previous project that my retired colleague wrote since I'm not very familiar with instrument communication in LabVIEW. That VI seemed to run fine on its own, but when I put it in the main loop of my larger program, it lags significantly and is no longer feasible for real time operation. I did make some modifications to what my colleague had, but nothing that I would think would cause performance issues.


  • Please define "lag"…
  • Which kind of "real time operation" are you talking about?
  • Which modifications did you apply?
  • Why are all the (seemingly) numeric inputs strings in the driver?
  • Why do all VIs look better when applying Autocleanup? (Even in the front panel!)
Best regards,
GerdW


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