LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to determine the execution order of event structure

Solved!
Go to solution

Hi everyone,

 

I have an event structure were it contains four events. All the four events has separate buttons to execute. Here, three events will generate numeric output, remaining one event (Finder) should find the order of those three events. For example, Three events namely A, B and C. I execute the events in the order of B, C and A. The finder event should find the order of previously executed events(B, C and A). 

 

 

Thanks in advance.

0 Kudos
Message 1 of 17
(5,320 Views)

Hi Vij at y,

 

you need a shift register where you store/append information on each executed event case (of A, B, and C).

In your "Finder" event you just read the data from that shift register. Simple like that…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 17
(5,319 Views)

If you want a list of sequences since the VI started running, make sure this event passes the shift register through un-altered.  If you want to know the sequence since previous "Finder" event was run, then make sure to clear it after it's read (pass an empty constant to the shift register).  

 

Alternatively, you can do both (two shift registers) using the same event. 

 

As far as the contents of the shift register, you could easily use an array, using the Build Array Function, or you could use a string constant, using Concatenate String to build the contents. 

Message 3 of 17
(5,296 Views)

Use an array of three number is a shift register and initiaize it with NaN values. In each event case, substitute the relevant element with the actual value. before the event structure, use a case structure that goes true when all elements of the array are no longer NaN and do the recalculation there, for example.

 

There are many other ways to do this.

 

Can A, B or C change again later? My code would simply recalculate whenever all three values have been changed at least once.

Message 4 of 17
(5,294 Views)

As mentioned, there are numerous ways to do something like this in LabVIEW.  Can you tell us about the application you need this functionality for?  

 

If it's a school assignment please post the code you have attempted and we can help you work through it.  

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 5 of 17
(5,273 Views)

Hi everyone,

 

I am happy for all your replies and these are more effective solutions. Actually I forgot to add some information in my query. Kindly refer the attached VI. (This is not the actually VI that I am working with. Its just an idea of original VI).

 

From the suggested solution, I have a new problems.

- There is a timeout event at the start up and it will keep on execute in a while loop. If I connect an array in shift register and It will produce a zero value at the finder event.

- Once I read the order of sequence in the Finder event, It should reset the all the sequence values inorder to store for next different sets of sequence.

 

0 Kudos
Message 6 of 17
(5,221 Views)

Vij@y wrote:

 Kindly refer the attached VI. 


I don't see it!

0 Kudos
Message 7 of 17
(5,219 Views)

@altenbach wrote:

Vij@y wrote:

 Kindly refer the attached VI. 


I don't see it!


Well now u can !

0 Kudos
Message 8 of 17
(5,212 Views)

Why are you constantly firing the timeout event?

This VI seems quite unrelated to the originally discussed problem.

0 Kudos
Message 9 of 17
(5,202 Views)

Hello Vij@y,

 

I could not look in to your VI because I dont have LabVIEW 2013 (I have 2010) but i tried to understand the situation you are explaining.

Please find attached image of front panel I made for your reference.

 

Here I generated two events sequently, no 3 first followed by no 1 and the same is displayed in sequence array. now you can use the build array function to actually add each event to this array as explained by many people in this forum.

 

regarding the timeout event, either you can display the sequencer array in that event or you can display it in finder event and then you can reset the sequencer in finder event (I used reset button click event to reset sequencer back to zero value)

 

regarding getting zero when you press finder/reset button before triggring any other event:- Is it not correct to have empty array when you have not trigger any event?

 

I hope I put it well and may help you to find solution. 

With Regards

Miraz
Kudos is better option to thank somebody on this forum
------------------------------------------------------------------------------
Message 10 of 17
(5,179 Views)