11-23-2016 09:31 AM
Hi all,
I have a set of radio buttons namely "charge,Discharge and wait". Each button perfoms a task and after the task of charge or discharge is complete it moves to "wait". Now, i would like to know how to schedule these tasks in advance. for example, i want to run a cycle which does "Charge>Charged>wait for 5 mins>discharge>discharged" and repeat this cycle n times.
Any help will be greatly appreciated.
Thanks & Regards,
Parth
11-23-2016 09:34 AM
Any code that you upload will be greatly appreciated. Then we can begin to help you.
11-23-2016 09:36 AM
"Charge>Charged>wait for 5 mins>discharge>discharged" and repeat this cycle n times.
This screams "State Machine".
11-23-2016 10:00 AM
Hi,
i created a small example to show my problem. now what i want is a window where i can assign a cycle of tasks and when i run the vi it keeps repeating them for previously declared times.
hope this makes more sense
thanks.
11-23-2016 11:15 AM
Hello hbeelan,
I would recommend using a state machine design pattern for this application. There are plenty of resources online explaining state machines if you are unfamiliar with them. This architecture is pretty similar to the code you provided.
It sounds like you want the user to configure which states run. You could have an array of enumerators on the front panel representing the states and their order. Then you would feed this array into the state machine. The while loop would index out each state from the array and the case structure would execute that state.
Once you get that working, you could get fancy and have a configuration menu on a subVI front panel. The configuration menu could appear when the VI first starts or when the user clicks a button. Then you could send the information from subVI to main VI using Functional Global Variables (FGVs) or some other data transfer mechanism.