07-15-2010 09:59 AM
Hello,
I have a state machine with 5 states. See attached vi (LabVIEW 7.1).
Now I want to add another state ("wait") between state Druck Aufbau and Druck Abbau. How can I do that?
I tried to add a state to the enum on the left and then I noticed that I would have to modify every enum in the vi and the case structure as well.
Is there an easier way?
07-15-2010 10:02 AM
If you make your enum a TypeDef, you update the TypeDef file, and the control updates automatically everywhere else it is used.
07-15-2010 10:06 AM
You should have made the enum a type def. Make it a control so that you can select Advanced/Customize and then save it. You will still have to replace each constant that you used with the type def control but the next time you want to add a state, it will be much easier.
07-15-2010 10:43 AM
Thanks for the answer.
I have never worked with typedefs before. I managed to change the enum on the left to a control and I saved it as Enum.ctl
Now with what do I have to replace all the enums?
Where do I add the state "wait"? Should I add it to the Control in Enum.ctl?
07-15-2010 10:48 AM
You have to right click on each constant and select Replace. Browse to the ctl.
After all the replacements have been made, right ckick on one and select Open Type Def. Make the change in the type def and in the file menu, select Apply Changes. Save the ctl.
07-15-2010 10:49 AM
You should replace all enums of the state machine with your type def'ed one. Thus, every change you make will be propagated throughout your state machine. When you need to add or delete states, change the typ def (so the Enum.ctl), and then all the enums will change. Thats the very reason of type definitions. In future, always use type defed enums.
Felix
07-15-2010 10:49 AM - edited 07-15-2010 10:50 AM
First, make sure you've actually made the control a typedef.
Then to replace each of the other non-typedef'd enums, just right click on them and then replace>>Select a VI... then locate your control on disk.
07-15-2010 11:13 AM
@all:
Thank you very mcuh! It works now 🙂