05-27-2014 02:06 AM
Hi
I am working on a control system where a motor (bi-directional) will rotate for a specific data. When it starts rotating, motor should do this for a while and would not change it's rotation even if the data for opposite rotation comes. In that case, after starting rotation, controller has to skip out the next data for a while.
I have made a very simple program to explain the things. Please find the attached file. In loop#01 some random number will generate. In the loop#02, a comparison will be done. When A is true and B is false the output should be 5 and for opposite condition output is -5. When output is 5, this output should stay for a while (e.g 5sec) as 5. In this interval next upcoming 10 data will be skiped out (Since a wait VI is set in loop#01 and wait time is 500ms). I could not figure out how to do this. Could anybody plz help me out?
FYKI: you may find the output is -2 when both A and B are true. It may be happened because of converting the boolean into integer. I dont think it is something should be worried about.
Thanks at advance-
Taslim
Solved! Go to Solution.
05-27-2014 04:32 AM - edited 05-27-2014 04:48 AM
Hi Taslim,
If i well understood your issue, i think your architecture is wrong.
Try out an Event architecture ; while loop with event loop inside.
When your event happen, skip your data into the event loop. Shift registers can be useful !
Another way to think about your problem (which can be combined) is to see that as states machine. (Rototion trigo +, Rotation trigo -, initialization(where you rotate only one direction), Stop)
Hope this help.
BR,
Vincent
05-27-2014 07:01 AM
From what I've seen, you will be much better off using a State Machine. One of your states should be to read the data. You will also have a wait state where you should look for UI events (event structure). Another state for setting the output control.
05-28-2014 09:05 AM
Thanks Vincent. 🙂
05-28-2014 09:06 AM
I tried State Machine and it worked nicely. Thanks a lot crossrulz.