LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sequential execution of event structure?

Solved!
Go to solution

Greetings,

 

I'm at the very beginning of application development. I have a list of 10 tests (we'll just call them test 1 through test 10). I would like (ideally) for a user to have the option of selecting 1 or even all 10 tests, any combination basically (listbox was what I was thinking). Now the kicker is I would like an event structure to be linked to this list box. And execute each array index selected by the user. So if the user were to select Test 1, test 2, and test 6, I would receive an array of 0, 1, and 5 respectively. The event structure would sequentially execute accordingly. Right now I have planned that each event when triggered would execute a state machine for the actual test. So if Test 1 was a simple current draw test (just for example). The  user would select Test 1 which would trigger the corresponding event. Inside the event a state machine would execute the necessary POWER ON, TAKE CURRENT MEASUREMENT, finally POWER OFF states.

 

I tried my hand at a cluster with booleans but didn't get too far. Although I know there is a solution somewhere inside the cluster and linking it to the booleans inside for value change. But I need to allow the user the time to select all tests to be executed before launching sequential execution of the event structure.

 

I'm sorry if I have missed something, I'm still sipping on my Sunday coffee 🙂 I do not have a VI to post. I tried yesterday with no luck, and the best try I had had too many nested loops.

 

Thanks in advance for any help in this matter. I feel like I've hit a "DUH" moment in the development process. But I am finding it difficult to configure an event structure to execute multiple events in 1 user generated event.

 

-Chazzzmd

0 Kudos
Message 1 of 19
(3,515 Views)

Well, these should not really be events, but states of a state machine. The only event is a value change of a "go" button after all states have been seleted in the listbox. Do the states always execute in the order of the list entries? Should the operator be able to interrupt the process at all times?

 

Can you show us some code? What is your LabVIEW version?

0 Kudos
Message 2 of 19
(3,512 Views)

You should consider using a producer/consumer architecture. The producer will have your event structure which will see the value change of your selection list as well as events such as start/stop. Your consumer would be a state machine that would actually execute your tests. When using event structures you should avoid executing any code that takes a fair amount of time to execute. If everything is inside the event structure your UI can become unresponse while it is excuting the tests.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 3 of 19
(3,493 Views)

there are many different ways to skin a cat...this example is like the cld sprinkler solution and the last is the famous producer/consumer...TEST2.png

 

Example_VI.png 

0 Kudos
Message 4 of 19
(3,477 Views)

@apok wrote:

there are many different ways to skin a cat...this example is like the cld sprinkler solution and the last is the famous producer/consumer... 


It would be helpful to attach actual example code instead of a code picture. It is not possible to recreate the programs from your image, because too many things are hidden in other cases.

 

Who wrote this code??? Just from a casual glance, there are some really questionable constructs, starting with the "equal TRUE" in the outer FOR loop of the upper picture. The lower code does not seem applicable to the problem, because the listbox selection mode is set to "one item" instead of "1 or more items" as required here.

0 Kudos
Message 5 of 19
(3,456 Views)

Thanks in advance for everyone's responses, especially for a weekend.

 

Altenbach - I would like the events to be the items selected in the listbox (basically queue's them), not the pressing of the GO button. Sorry if I didn't describe correctly. Since the event structure (so far) is triggering events off of the selected item(s) in the listbox, yes, it would execute in order. So if I selected Test 1, Test 3, and Test 5, it (the event structure) would execute 1, 3, then 5. No, the operator should not be able to interrupt the test process.

 

I will get a rough draft of code to share, it won't be working, but maybe it will help.

 

Thanks again,

 

Chazzzmd

 

0 Kudos
Message 6 of 19
(3,436 Views)

Mark,

 

Yes, this is exactly what I want to do. For my prior producer/consumer projects they would execute 1 event off of 1 value change. I'm trying to have the Event structure smart enough to execute multiple events through user selection of a listbox (or cluster of booleans), basically an array of requested events. The trouble I'm having is getting the Event structure to execute as needed.

 

Thanks again,

 

Chazzzmd

0 Kudos
Message 7 of 19
(3,434 Views)

Apok,

 

The state machine looks applicable. How is your true case wired? I'm a little unsure for example, if I were to select Test 1 and Test 3 how the state machine would know to execute only states 1 and 3.

 

Thanks in advance for clarifying.

 

-Chazzzmd

0 Kudos
Message 8 of 19
(3,431 Views)

I believe the equal to 0? functions supplies the logic for dynamically building an array of index values for the inner for loop execution. That is IF??? the true statement we cannot see has a build array function that utilizes the outer for loops iteration.

 

chazzzmd

0 Kudos
Message 9 of 19
(3,429 Views)

Altenbach/All,

 

If we treat the Test 1 - Test 10 as states and I already have the test execution themselves as state machines (Test 1 = state machine, Test 2 = state machine, etc.) I would have nested state machines correct? I've never done that before, are there any draw backs? Is this common? Things to remember? Links to literature you recommend?

 

I'm using 2011 btw, sorry.

 

Thanks again for everyone's input/help.

 

Chazzzmd

 

 

0 Kudos
Message 10 of 19
(3,416 Views)