From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Run events sequentaillay - Automatically

Solved!
Go to solution

Dear All,

I am doing a project in which my boss requires to run different set of codes sequentially. I have implemented individual test using event based state machine (Triggered by a button as event). The requirement is to run a set of programs one after another. There should be selection in which we could select; Run test 2, then test 1 then test 3 and so on (of course automatically). I tried to demonstrate the requirement in the following diagram, hope you’ll understand my point. Can we create such an interface in labview?

 

11.jpg

0 Kudos
Message 1 of 5
(3,174 Views)

Hi zahid,

 

I have implemented individual test using event based state machine (Triggered by a button as event).

Then convert your implementation to a queued message handler!

This way you can either send commands into the queue from your event structure - or by sending them "automatically" to call a sequence of commands!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 5
(3,170 Views)
Solution
Accepted by topic author zahidkjatoi

Here is one way to do it.  Basically, you'll need two listboxes where you take items from one box and add them to the other.  If the same test can be run more than once, don't remove it from the available tests.  Otherwise you'll want to remove it.  You may want to have a reorder feature where you can move a test routine up or down.  Drag and Drop would also be a nice addition, as well as Double Click to move.

Example_VI.png

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 3 of 5
(3,121 Views)

Dear Aputman,

 

Thank you for the nice idea. I have implemented listbox and created string according to serial wise tests (And saved them in FGV). Now, i need to run tests according to entered sequence. Can you guide how to implement this? I was thinking to build a case structure, but seems that it will not work. Attached is my VI for your kind review.

 

Unbenannt.JPG

 

Regards,

Khan.

0 Kudos
Message 4 of 5
(3,080 Views)

First of all, you'll probably want to put all of the test VIs in their own separate directory.  And rather than populating the available tests with a static list, grab a list of the VIs in the directory and build an array using the VI name (or something similar).  That way, if you add another test, you don't need to worry about updating the selection routine manually.  

 

For the rest of the application, you really need to look into a proper state machine architecture.  I always recommend the JKI state machine because of its flexibility.  It might be a little complicated for newbies to understand at first but after using it a bit, you'll get the hang of it.  

 

After the test routine selection is done, you want to queue up the test names into your state machine and let it run.  

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 5 of 5
(3,063 Views)