LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to add a state to an existing state machine?

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?

 

 

Greetings Johannes
Using LabVIEW 7.1 and 2009 recently
0 Kudos
Message 1 of 8
(4,463 Views)

If you make your enum a TypeDef, you update the TypeDef file, and the control updates automatically everywhere else it is used.

--
Tim Elsey
Certified LabVIEW Architect
Message 2 of 8
(4,458 Views)

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.

Message 3 of 8
(4,454 Views)

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?

Greetings Johannes
Using LabVIEW 7.1 and 2009 recently
0 Kudos
Message 4 of 8
(4,431 Views)

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.

Message 5 of 8
(4,426 Views)

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

Message 6 of 8
(4,424 Views)

First, make sure you've actually made the control a typedef. 

19087i05F6EABA1141806D

 

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.

--
Tim Elsey
Certified LabVIEW Architect
Message 7 of 8
(4,422 Views)

@all:

 

Thank you very mcuh! It works now 🙂

Greetings Johannes
Using LabVIEW 7.1 and 2009 recently
0 Kudos
Message 8 of 8
(4,404 Views)