LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simulation is not running

Solved!
Go to solution

I am a beginner in LabView. I tried implementing the following example : http://www.ni.com/tutorial/7595/en/   to learn the state machine implementation. But the simulation does not seem to work though I have followed all the steps. What could be the possible reason? I am attching the screen shots of the connection I have made.

 

 

Download All
0 Kudos
Message 1 of 15
(5,365 Views)

You should attach your VI, not screenshots if you wanna get quick help! Since you attached simple pictures, I can only guess: I see coercion dots at the Select function inputs, are you sure all the Enum constants are the same? Even if the mentioned example does not do that, I would recommend you to use (and learn what it is) Type Definied Enums ( https://zone.ni.com/reference/en-XX/help/371361L-01/lvhowto/creating_type_defs/ ).

 

What is the mechanical behaviour ("Mechanical Action", right click on the control) of your Boolean controls ("D" and "N")? You should use "Latch When Released" option, and not one of the "Switch" type, so when your VI reads the value of the controls, they will reset to their initial state.

0 Kudos
Message 2 of 15
(5,349 Views)

Hope Blokk has given enough information.

Try to make sure you are using TypeDef enum for case selector, so that you can modify the elements of enum at anypoint of time without any errors, else you will have a enum with different elements or you need to map with original enum after every change.

 

you can find actual examples

C:\Program Files (x86)\National Instruments\LabVIEW 2015\examples\Design Patterns\State Machine\State Machine Fundamentals.vi

 

Navigate to Help----> Find Examples and type state in search you will get Examples in state machine

 

Its always better to attach code instead of image.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 3 of 15
(5,341 Views)

Thank you for the reply. I have attached the vi, please help me proceed as I am not able to debug.

Download All
0 Kudos
Message 4 of 15
(5,332 Views)

You are getting closer. You have already created a TypeDef Enum, the one you have it outside of the while loop. However, you have to change ALL the enums in your VI into this typedef enum!! See the little black triangle symbol on the typedef enum icon on the Block Diagram? You should see that on ALL enums in your VI.

 

state machine_test_BD.png

Message 5 of 15
(5,325 Views)

Thanks for that. I changed all enum to type def., but there is no change, I dont see value in the money change when I press N or D . The dispense is also not happening.  

0 Kudos
Message 6 of 15
(5,318 Views)

You did not listen. You have still "Switch" mechanical action for the two Boolean controls. Change them into "Latch When Released".

0 Kudos
Message 7 of 15
(5,315 Views)

I am using LV 15 so it will be better if you can save in LabVIEW 15 and share the VI.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 8 of 15
(5,314 Views)

I am using the latch when released action for my switches from the beginning. I don't think thats the problem.

0 Kudos
Message 9 of 15
(5,309 Views)
Solution
Accepted by topic author sgthoppa

After changing the mechanical action for the "D" and "N" controls, the VI works for me...

 

edit: did you change the Enums in ALL cases of your Case structure???

edit2: I hope you use the SAME type def enum for all enums in your VI, and you did not create a SEPARATE type def for all each enums? 🙂

Edit3: Added the missing Typedef control... as a next step, you could learn about LV projects, a useful (must one) way to keep corresponding files together (and much more) 🙂

Download All
Message 10 of 15
(5,308 Views)