LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Other events interfere with abort for state machine started by an event

Thanks for spelling that out, I'm confused on how to transition the state machine to the Stop and Exit states when one of the states after "Start" is running.  For example, in the wait state you describe, the state machine will pass either the wait state itself or the next state into the state shift register.  I can see either using several comparison functions (i.e. if queue = stop then pass stop, if queue = end then pass end) or a case structure inside the state machine.  Are either of those what you had in mind?
 
Thanks again,

Dave
 
0 Kudos
Message 11 of 18
(740 Views)
Also, with using a shift register to pass the data array around, will I need another control to keep track of the current index?  I plan on using one of the initialized arrays since I remember reading that performance is better if the array is not built element by element, but I don't see how to index the array through the shift register unless I add another control/shift register or a local variable. 
0 Kudos
Message 12 of 18
(738 Views)
This is getting really confusing.  Maybe you should just simply state what you are trying to accomplish.  Start from the beginning and explain what it is you are trying to do.  This would really help us in guiding you.
- tbob

Inventor of the WORM Global
Message 13 of 18
(727 Views)
Yes I agree this is a mess...
 
1.  I'm trying to understand what Lynn was suggesting: controlling a state machine using a Producer/Consumer architecture.  In the past I have had each state of my state machines decide between two states.  If there are "Exit" and "Stop" states then the state machine will need to respond to the Producer.  I have this implemented without using separate states but I was hoping Lynn's suggestion would require less structures/overhead.
 
2.  I have a cluster of initialized arrays that I would like to put data into (depending on what state I'm in).  If I pass that cluster around in a shift register I need a way of tracking the index as well- a cluster of integers maybe?  Alternatively I could just not initialize the arrays and always use the Insert Into Array function but this would slow things down I believe.
 
I solved my earlier problem using execution highlighting, as you suggested.  Problem existed between keyboard and chair, naturally (just learning the Queue functions).
0 Kudos
Message 14 of 18
(719 Views)
I am trying to put together an example which will answer the questions better than text.

Lynn
0 Kudos
Message 15 of 18
(719 Views)
Here is a modified version of your VI to show what I had in mind. I did not have your subVIs or hardware so this is untested. In particular the state machine may lock into a loop where the same state repeats indefinitely, but Stop or Exit should break it out of that condition.

Lynn
Download All
0 Kudos
Message 16 of 18
(706 Views)
Thanks a lot for taking the time to code your example.  Using the shift register and the queue together for the next state was where I was most confused.
 
I noticed tick has a warning about wrapping around, should that be a concern with the wait?
 
I've been planning to put the data from acquired during each state in a separate array (those in the cluster).  I'm thinking it might make more sense to just use the "insert into array" function so I don't need to keep track of the index.  Either way that is something I can figure out without property nodes.  Thanks again.
 
 
0 Kudos
Message 17 of 18
(704 Views)
The tick count will wrap after about 49 days. (~2^32 milliseconds). If the computer gets rebooted more often than that it will not be a problem. If the computer will be running continuously then a check for overflow may be in order.

Replace array subset is better in terms of memory allocation than build array or insert into array. You must know the size of the array or an upper limit on the size in advance. For small data sets it does not make much difference.

Lynn
0 Kudos
Message 18 of 18
(701 Views)