LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

state machine?

Hi bmunden,
      You can certainly implement the logic you described, the question of whether to buffer the "temporary" data in memory or on disk is up to you.  (The phrase "append data to matrix" suggests that you're building a multi-dimensional result-array?)  If data-sets are acquired quickly and any specific data-set isn't particularly important, then accumulating to (2D?) array and spitting it out in a single file-operation sounds reasonable.  If this array takes a long time to acquire and/or is difficult (or impossible) to reproduce, then maybe it's worth using the disk as your temporary storage.  Either way you'll implement it just like your pseudo-code.  The attached VI shows both methods!
 
Cheers!
 
"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 21 of 30
(1,701 Views)
The state machine's while loop will naturally defer the saving of data until it's finished executing, so I just used that.
0 Kudos
Message 22 of 30
(1,695 Views)

Hi bmunden,

      Another "natural" way to order execution is via "data dependency".

... glad you have a solution that works for you. Smiley Wink

Cheers!

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 23 of 30
(1,680 Views)

Thanks to all.  I have a statemachine in another file.  In each state, i plan to dequeue the queue that i created and use the dequeued element for the next state.

 

I do understand statemachines very well.  In my other file, i have a while loop, shift register, and case structure.  The shift register is initialized to the init state which is where i want to put the SUBVI that i am questioning about.  The dequeued element would be wired to the shift register inside each of the states.

0 Kudos
Message 24 of 30
(1,379 Views)
If you are using a queue there is no need to wire the dequeued item to a shift register. Simply dequeue the element. Either the element itself is the next state or the queued data is a cluster containing the next state. The dequeue should occur right before the case statement and the next_state data is the wired to the case selector.


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
Message 25 of 30
(1,372 Views)

glstill wrote:

Thanks to all.  I have a statemachine in another file.  In each state, i plan to dequeue the queue that i created and use the dequeued element for the next state.

 

I do understand statemachines very well.  In my other file, i have a while loop, shift register, and case structure.  The shift register is initialized to the init state which is where i want to put the SUBVI that i am questioning about.  The dequeued element would be wired to the shift register inside each of the states.


Whoops-I sent too many links- GL's OP is HERE


"Should be" isn't "Is" -Jay
0 Kudos
Message 26 of 30
(1,353 Views)

Just as a /aside, I disagree with the application of the name State Machine (as in the JKI template) in the context of LabVIEW.  That particular state machine is actually a simple subroutine execution method.  I'll go a step further and say that the built in Producer/Consumer Event template is superior and that a string based message system is very error prone.

 

But since it is already an established name and people are familiar with it, I digress.

 

What I consider a State Machine, I have renamed to State Controller to avoid confussion when talking with other LabVIEW users.  My background and understanding of "State Machine" is best defined as Synchronous and Non-synchronous Finite State Machines.  http://en.wikipedia.org/wiki/Finite-state_machine

Message Edited by Nickerbocker on 03-03-2010 12:26 PM
Message 27 of 30
(1,344 Views)
Valid point.  consider it "jargon" for LabVIEW like "Functional Global"

"Should be" isn't "Is" -Jay
0 Kudos
Message 28 of 30
(1,332 Views)

Nickerbocker wrote:

Just as a /aside, I disagree with the application of the name State Machine (as in the JKI template) in the context of LabVIEW.  That particular state machine is actually a simple subroutine execution method.  I'll go a step further and say that the built in Producer/Consumer Event template is superior and that a string based message system is very error prone.

 

But since it is already an established name and people are familiar with it, I digress.

 

What I consider a State Machine, I have renamed to State Controller to avoid confussion when talking with other LabVIEW users.  My background and understanding of "State Machine" is best defined as Synchronous and Non-synchronous Finite State Machines.  http://en.wikipedia.org/wiki/Finite-state_machine

Message Edited by Nickerbocker on 03-03-2010 12:26 PM

I very rarely use string based state machines for the reasons you mentioned. I prefer to use discrete state defintions using typedefed ENUMs.



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
Message 29 of 30
(1,327 Views)
Definitly.  Type-def'd Enums is the way to go.
Message 30 of 30
(1,318 Views)