LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Test steps for state machine

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.

0 Kudos
Message 1 of 13
(2,405 Views)

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 

Please remember to accept any solutions and give kudos, Thanks


LV 8.6.1, LV2010,LV2011SP1, FPGA, Win7
0 Kudos
Message 2 of 13
(2,403 Views)

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.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 3 of 13
(2,395 Views)

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.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 4 of 13
(2,393 Views)

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.

 

0 Kudos
Message 5 of 13
(2,392 Views)

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 Smiley Tongue'

 

0 Kudos
Message 6 of 13
(2,374 Views)

Am attaching a sample of the state machine you can develop based on that.

 

State Machine 1.png

 

State Machine 2.png

 

Good luck.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 7 of 13
(2,365 Views)

Hi again,

In the picture that you have attached, the enumerated type connected to 'default 1' must contain the name of all the states?

0 Kudos
Message 8 of 13
(2,350 Views)

Yes Exactly.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 9 of 13
(2,336 Views)

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.

0 Kudos
Message 10 of 13
(2,328 Views)