LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Copy and Select case structure programmatically?

I have a VI containing a case structure. Is there a way to programmatically select some cases and build a new case structure? This needs to happen at run time. I was reading about VI Scripting and I am unable to find how to copy...

 

 

0 Kudos
Message 1 of 15
(3,893 Views)

No. You cannot change the program while it is running.

 

Can you tell us more about what you are trying to accomplish functionally with the program (as opposed to how you wanted to do it)? Someone can probably suggest an alternative.

 

State mcahine?

 

Lynn

0 Kudos
Message 2 of 15
(3,889 Views)

Dynamically dispatched class VIs will also do this, especially since you can load the classes at run time.

 

To repeat Lynn's request: Please let us know what you are trying to do and we can probably find you a way to do it.

0 Kudos
Message 3 of 15
(3,828 Views)

I have built a state machine for a test sequence. Product A uses, for e.g., sequence 1 through 20, product B uses sequence 1 to 5 and 10 to 15 skipping state 13. What I would like to do is, when the product is identified (by serial number), only specific cases are loaded in the case structure of the state machine for the test. Is there a way to achieve this?

 

Thank you.

0 Kudos
Message 4 of 15
(3,811 Views)

Hi Les,

 

when you already have a state machine architecture: after you selected the test sequence you just call the states according to the test sequence…

 

Instead of directly linking state 15 to be executed after state 14 you need to include a function that determines the next state depending on your test sequence!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 15
(3,799 Views)

Since you are already using a state machine, it is easy to control which state is ran when.  So where is your problem?

 

Using a queue to hold your states works wonderfully in this instance.  Just dequeue to get which state to go to.  Enqueue all of the states you need to run before the state machine starts.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 15
(3,797 Views)

Maybe there is an easier way, I am just not seeing it.

 

I gave an example with 2 products A and B. What if I had product A through Z? The intent is to keep the FrameName of the case structure on a spec file (txt), then when the product is identified by the program, it loads the cases.

 

Thanks.

0 Kudos
Message 7 of 15
(3,787 Views)

Hi Les,

 

no, you don't load any cases (aka STATES) - you select them!

 

The test sequence determines the order of the states. That's it.

(You have to provide all needed states for all possible test sequences in your state machine, but you only execute those mentioned in the current test sequence!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 15
(3,784 Views)

Do you want to test multiple devices simultaneously with different test sequences? Or do you want to run different test squences one at a time on a variety of devices?

 

Lynn

0 Kudos
Message 9 of 15
(3,777 Views)

LesElec wrote:

I gave an example with 2 products A and B. What if I had product A through Z? The intent is to keep the FrameName of the case structure on a spec file (txt), then when the product is identified by the program, it loads the cases.


You read the spec file to get the states to run.  That's simple.  Store all of the states in an array.  From there, you can use a FOR loop to sequence your states.  Again, it is very simple.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 15
(3,769 Views)