LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

statemachine ARCHITECTURE

Here is one advantage to using strings:  If you have a requirement that the next state depends on two conditions, A and B, you can concatenate strings to call the next state.  Example, condition A might be Red, Blue, Green.  Condition B might be 1, 2, 3.  If the conditions are Red and 3, you can concatenate to form a string Red3 and use it to call the next state.  Sure you can use enums, all possible combinations of conditions, and use logic to determine which enum to select from the array, but using strings is easier in this case.  However, for the most part, enums are better.  I suspect people use strings instead of enums because it is easier and faster to code at first.  I'm guilty of this in simple applications done quick and dirty.  But one typo can destroy the time savings.
- tbob

Inventor of the WORM Global
Message 11 of 40
(3,256 Views)

Excellent point tbob about the string concatenation.

I have done this and unless I find a very good reason to do so, I will not do it again!

Short war story:

Before control refernces were available (BV 2.0?) I was developing an application that really needed them along with a bunch of other things including updating the code for part of the sytem while the rest was still running. So I invented this generic architecture that implemented all of the plug-ins as "Start"-"Run"-"Exit" and left it up to the developers of the plug-in to shoe-horn the modules into that state. The preliminary tests looked good and we brought in three other developers to help code up the plug-ins.

After attempting to explain the concepts (that included the possibility of pre-empting actions and compound branching [concantenation]) I had to accept the fact that if two PHD's and a Masters in Physics could not grasp the ideas, that it was "TOO COMPLICATED!"

I eventually  threw all of that code away!

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 12 of 40
(3,253 Views)


@Ben wrote:

updating the code for part of the sytem while the rest was still running.



YIKES!  Don't try this at home, at work, or anywhere.
- tbob

Inventor of the WORM Global
Message 13 of 40
(3,235 Views)
"Ben wrote:

updating the code for part of the sytem while the rest was still running. "

That part worked fine!

THe challenge was describing a state machine where the transition posiblities were endless and required a 3-d diagram to illustrate all of the possibilities.

Regarding the "Yikes":

Stayt tuned for a future release of RT!

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 14 of 40
(3,231 Views)
Ok, time for a little summary of our conversation up to this point on state diagrams:

2D diagram represents your state chart: Use Enums
3D diagram "" "": Use Strings
11D diagram "" "": Use String Theory Smiley Very Happy

Message Edited by Jarrod S. on 01-30-2007 01:59 PM

Jarrod S.
National Instruments
Message 15 of 40
(3,227 Views)
Where are the String Theory VIs?

Lynn
Message 16 of 40
(3,231 Views)

SuperSecretPrivateStringyStuff=TRUE

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 17 of 40
(3,218 Views)


@johnsold wrote:
Where are the String Theory VIs?

Lynn


They only exist on palettes in several other dimensions and can only be realized by looking at LabVIEW through tiny slits in a piece of paper.

😉

Message 18 of 40
(3,214 Views)


@johnsold wrote:
Where are the String Theory VIs?

You already have it all. "Strings" is just another word for "Wires" and I'm sure most of your diagrams have some.
Message 19 of 40
(3,195 Views)
Actually, we have experimental string-theory versions of LabVIEW running in our labs.  We implemented it so that all the bugs exist in dimensions not used by simple earthlings.  That way, future versions of LabVIEW will be bug free. Smiley Very Happy
Message 20 of 40
(3,168 Views)