LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure states in state machine


@Ben wrote:

@spastichawk wrote:

@ML927 wrote:

Hi Ravik,

 

You just need to make your state enum a type definition.

 

http://zone.ni.com/reference/en-XX/help/371361J-01/lvhowto/creating_type_defs/

 

Any time you need to add or delete a state, modify your type definition, apply the modifications and it will update all your enums at once 😉


While this works for adding states it seems to break the case structure when deleting or renaming a state. I have tried combinations of just deleating the state in the typedef or typedef and case structure but each time I get a coersion dot and all the state names are blank in the case structure. Is there a prober way of deleating a state without polluting with 'dummy' unused states?


I can only speculate but I think ...

 

1) at least one of the cosntants in your diagram is not an instance o the type-def

 

OR

 

2) You did not apply changes and do a "save All" after editing the type def.

 

Ben


BEm,

 

1) I have checked all constants and they are all an instance of the typedef

2) I did a save all and updated what I can (deleting a case does not present a "add case for every instance" option when right clicking the case structure).

0 Kudos
Message 11 of 14
(861 Views)

@crossrulz wrote:

@spastichawk wrote:

While this works for adding states it seems to break the case structure when deleting or renaming a state. I have tried combinations of just deleating the state in the typedef or typedef and case structure but each time I get a coersion dot and all the state names are blank in the case structure. Is there a prober way of deleating a state without polluting with 'dummy' unused states?


If the enum is wired directly to the case structure, then the case selector should show the enum names.  So if you have a case for A and you delete A from the enum, you should have a broken VI because you have to fix something.  Likewise, if you add values to the enum, your VI should be broken because you need to add more cases to handle the new values.  I have never seen a coersion dot on a case structure do to changing enum values.  Could you post an example of this?


Unfortunately I cannot upload data (company policy). Adding values is not a problem, it only becomes a problem when renaming or removing.

0 Kudos
Message 12 of 14
(860 Views)

Posting a stripped down version of the case structure plus enum would cut-out a lot of guessing.

 

Another thing that you can try is to find a plce where you get the corecion dot AND where there is no corecion dot. Switch on the hlep window and select the wiring tool and the float over the wires coming from the constants (both with and witoug coecion dots). Carefully compare what the help windows saya about the data in the wire.

 

Another check is show to VI hiearchy and make sure the type defs are shown in the display. doulbe check that there is only one type def.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 13 of 14
(858 Views)

@Ben wrote:

 

Another check is show to VI hiearchy and make sure the type defs are shown in the display. doulbe check that there is only one type def.

 

Ben


Thats what the 8-ball said when I asked itSmiley Very Happy

 

Of Course the easy way is to open the type def, View>>Browse Relationships>>Unopened Type Defs.  There's your culprit!


"Should be" isn't "Is" -Jay
Message 14 of 14
(851 Views)