03-21-2012 04:40 AM
Hi everyone
I have test steps typed in a txt file. I want to use those steps to change the state of my state machine in other words I don't want to use 'enum constant' because I want to be able to control my program just by changing some lines in my txt file. I've tried to store them in an array then use this array to change the states but it didn't works. Any suggestions?
Thanks.
03-21-2012 04:56 AM
could you post a screenshot of the block diagram?
possibly case of the string going into the case statement. Check what is being passed into the case statement matches each state exactly
hope it helps
03-21-2012 05:12 AM
The same I have done before. Use a Type Defined Enum that contains the commands you want to write in the text file (This is to restrict the use of commands that are defined).
Read the text file and use the Format from Vi function to convert the string to Enum and wire the Enum to the case selector.
Now depending on the commands you write in the file your state machine will execute.
03-21-2012 05:13 AM - edited 03-21-2012 05:14 AM
The same I have done before. Use a Type Defined Enum that contains the commands you want to write in the text file (This is to restrict the use of commands that are defined).
Read the text file and use the Scan from string function to convert the string to Enum and wire the Enum to the case selector.
Now depending on the commands you write in the file your state machine will execute.
Sorry Post duplicated.
03-21-2012 05:13 AM
Hi Akiel,
Thank you for your reply.
I've attached a screenshot of my block diagram.
The problem is that there is cases that don't have a selector value, the enum constant solve the problem but I want to avoid using it.
03-21-2012 05:28 AM
Hi Andad,
What you have suggested sounds interesting, but how can I exactly convert the string to Enum 'Sorry I know it's a silly question '
03-21-2012 05:45 AM
Am attaching a sample of the state machine you can develop based on that.
Good luck.
03-21-2012 07:55 AM
Hi again,
In the picture that you have attached, the enumerated type connected to 'default 1' must contain the name of all the states?
03-21-2012 09:29 AM
Yes Exactly.
03-21-2012 09:49 AM
I like the idea of deleting from the string array and I am going to use it. But since the operator don't know how to use Labview and he don't want to modify the block diagram, he want just to modify the txt file, and since the states are stored in a Enum constant, if he changes a line in the txt file the VI won't work.