LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

The JKI State Machine makes it’s public debut


I did use a buffered sm once. I created one VI that is very usefull. The VI
takes the states, and a new state, and two booleans. The booleans are called
"Add before?" and "Add after". The name should explain enough. The (very
simple) vi makes it very easy to add cases based on a condition. It really
clear up the diagram. Perhaps you already have something like it, but I
didn't see it in the video.

 

Hi Wiebe,

 

Here is how we handle this with the JKI State Machine:

 

 

With the JKI State Machine, appending or prepending an empty string has no effect.  So, we can use the Select function to route conditional work into the Add State(s) to Queue function.  I can see how it would be useful to encapsulate this logic (conditional) into a single function.  Perhaps we could achieve this by adding a Boolean input to the top of Add State(s) to Queue.

 

-Jim

Message Edited by Jim Kring on 10-17-2008 02:53 PM
0 Kudos
Message 11 of 39
(2,256 Views)

Update: We've recently posted another video showing how to use the JKI State Machine to refactor sequencial code:

 


Cheers,

 

-Jim

0 Kudos
Message 12 of 39
(2,242 Views)

I decided to use the JKI State Machine for one of my applications.

 

It has caused continual crashes of LV 2009 Service Pack 1.  The result has been that I have lost work.

 

Is there a solution to this problem?

0 Kudos
Message 13 of 39
(1,960 Views)

BTW I want to state that the JKI state machine is a great tool, and I think, better than enum state machines.  I will post the error codes etc from the crashes with LV 2009 SP1.

 

I also have a question:

 

How do I flush the queue?

 

I have a series of states which are appended to the queue.  At an intermediate state there is an error.  This causes the execution to proceed to the error handling state and the error is currently cleared.  The problem is the following states which are still in the queue continue to execute afterwards.

0 Kudos
Message 14 of 39
(1,926 Views)

The queue is effectively the string that is leaving the case structure, you can in case of an error just sent en empty string (or a more appropriate action) to the shift register.

 

It's quite strange you get errors, since the code in the helper VIs is basic LabVIEW

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 15 of 39
(1,906 Views)

battler. wrote:

I decided to use the JKI State Machine for one of my applications.

 

It has caused continual crashes of LV 2009 Service Pack 1.  The result has been that I have lost work.

 

Is there a solution to this problem?


 

I haven't seen this issue but would be interested to learn more and take a look at any details you have.  If the crash is reproduceable, please post a VI that demonstrates it, so that we can try to get NI to see what's wrong.

 

Thanks,

0 Kudos
Message 16 of 39
(1,896 Views)

TCPlomp wrote:

The queue is effectively the string that is leaving the case structure, you can in case of an error just sent en empty string (or a more appropriate action) to the shift register.

 

But this string may comprise several actions which are fed in succession to the case structure, not all at once.  Correct?

I have read in the JKI docs that passing an empty string to the "enqueue" does nothing.  Does it clear the queue (string)?

 

It's quite strange you get errors, since the code in the helper VIs is basic LabVIEW

 

I had several errors and have noticed strange behaviour surrounding the JKI state machine.  For example, when I add a new state (case) and adjust the case text I lose text focus.  For some reason I have avoided any more crashes by continually (after ever single change) saving.  LV made a log file of the previous crashes but I havent dug them out.  The worst thing is the crashes were unrecoverable.

0 Kudos
Message 17 of 39
(1,849 Views)

battler. wrote:

TCPlomp wrote:

The queue is effectively the string that is leaving the case structure, you can in case of an error just sent en empty string (or a more appropriate action) to the shift register.

 

But this string may comprise several actions which are fed in succession to the case structure, not all at once.  Correct?

I have read in the JKI docs that passing an empty string to the "enqueue" does nothing.  Does it clear the queue (string)?

 



Yes it clears the queue, the string contains or is  the queue. Sending an empty string is like flushing the queue.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 18 of 39
(1,816 Views)

Hi all,

I have an application consisting of 4 sub-apps and 1 main app which calls the 4 sub-apps via subpanels.  See this thread.

 

I have converted the 4 sub-apps to use JKI string-based state-machine (SM).  The main reason was because of the handy >> Argument statements.

 

I now realise (and I hope I can be proved wrong) a major disadvantage of not using a standard queued SM. 

 

I need to be able to send commands to the 4 sub-apps from the main app.  I want to enqueue commands into their queue (i.e. to get them to close, update their associated action engines etc).

 

If my sub-apps have a named queue then I can enqueue elements into their queue from the main app.  How can I modify the JKI SM to allow me to do this?

 

Your help is much appreciated.

 

Battler.

0 Kudos
Message 19 of 39
(1,729 Views)

There is no limitation at all.

 

Lots of ways to skin the proverbial cat: 

One way is to create a User Event and use dynamic events to communicate to the Event Structure (this is my preferred method).

Another way is to periodically check a State (e.g. Idle: Event Timeout Case) that polls a Traditional Queue that could read in a Command/Data.

 

 

Certified LabVIEW Architect * LabVIEW Champion
Message 20 of 39
(1,700 Views)