From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ADS communication works slow with While Loop, fast with Event Structure.

Hello, I made a Twincat PLC/Labview Communication with .net for a machine that will work with manual and automatic conversion.

Manual control for ADS communication works fine with EVENT Structure. However, I cannot trigger with a global variable for automatic conversion.

When I use While loop instead of Event Structure for automatic loop, there is a serious delay.

 

In summary: I want to operate my valves connected to Beckhoff Industrial PC both with the help of a button and by sending 1-0 with the help of global variables. How can I do this with event structure?

0 Kudos
Message 1 of 7
(788 Views)

Sorry, I cannot find the "global variable" in your pictures (cannot open your VI in the current computer, I only have LabVIEW 2020 here).

 

Your picture with the while loop is truncated, but it seems silly to call all these nodes in parallel, irrespective if the booleans have changed or not. Can you do a "save for previous" so I can look at the VIs?

0 Kudos
Message 2 of 7
(754 Views)

Hello, thanks for your answer.

To make my question clearer, I removed the global variables from within the VI. I wanted to trigger the button that I defined for Valeu Chance in the Event Structure, not by clicking the button, but by a flat sequence.

For this reason, I tried to create a loop using the Flat Sequence Structure instead of the Event Structure, by reusing the communication for each valve I wanted. I was able to speed up the triggering of the valves, but now I'm getting ADS Not Open error after the number of cycles, I think, because the ADS communication speed could not keep up. Saved with labview 19.

0 Kudos
Message 3 of 7
(715 Views)

If you remove the 600ms wait in the While Slow i'm sure it'll go faster ...

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 7
(704 Views)

The delays there are the times that indicate how many seconds each valve will stay open. However, with the current communication, response times are slow. For example, it cannot perform the on-off function within 50mS.

 

I think I couldn't express my problem fully, if I can find a solution, I will happily share it.

0 Kudos
Message 5 of 7
(683 Views)

@HasanMeral wrote:

Saved with labview 19.


What you have attached is still in LabVIEW 2021. The down-converted code is typically in a new subfolder, so please attach that.

0 Kudos
Message 6 of 7
(635 Views)

You are doing much more work in the While loop version.

You are constantly operating on your boolean values, whether they have changed or not, this means that most of the "work" being done is useless.

The event structure, however, only executes code when the status of your controls changes. As such, it's not a fair comparison.

 

If you would at least compare the current and old values of your booleans int he While loop, you would significantly reduce the number of operations you are executing and the results may become more similar.

0 Kudos
Message 7 of 7
(615 Views)