LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Design own cycle

Hello all, I would like to build an application where the user can choose from a list of steps to build their own cycle. Does anyone have any advice or examples on how to approach this. Any help is greatly appreciated.
 
Thanks
Mike
0 Kudos
Message 1 of 11
(3,790 Views)

What you need is a state machine. Search the example finder and this site for examples and tutorials.

There are several ways in which you can allow the users to select the steps they want. For example, you can populate a ring or a listbox by using a property node with the Strings[] property and do this as many times as needed, each time with the appropiate options.


___________________
Try to take over the world!
0 Kudos
Message 2 of 11
(3,775 Views)

First think of your data flow:

Is every step independent? How to handle instrument setups without reinitialisation on every step?

What data do they share in common?

What data do they pass to the next step?

My suggestion is a also a state machine (producer/consumer).

Can each cycle step be realized into one vi (with subvis)?

Use the vi-server to run each step after the other .

You can place all cycle-step-vis into one or more subdirectories (structures) and create your selection list dynamically. So it's easy to add new steps by simply copy the vis into a (network) folder. And you don't need the LV development system on every application.

Data can be passed around with queues (current data to the GUI) or the terminals in typed vi-server calls (data hand over) or ...

Try to avoid globals, they might be good for a global shutdown but can slow down systems.

(I use LV2-style globals to pass current data if only one task is writing and one or multiple readers exist with different 'scan'-rates, but this is historical and with LV8 there are new (better?) approaches )  

You can even start background tasks in the beginning (temperature monitor?) that run independent. However keep track of your (sub)processes and data flow.       

Just my thoughts .. HAPPY NEW YEAR Smiley Very HappySmiley Very Happy
Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 3 of 11
(3,760 Views)
Hello,
 
Yep, something like a state machine can hold one case (to use labview terminology) for each possible choice in defining a cycle.  One implementaion would be to have an array of enums, where the defining enum would hold all possible states.  Then, you could have your program run, launch a prompt to define the array of rings (where each element of the array and subsequent choice for that ring would define a step in the cycle), and then use that array to auto-index a for loop, inside of which is a case structure which will execute the cases for the chosen enum values as the for loop iterates.  Ok, that explanation perhaps is a bit verbose... attached is an example which illustrates the idea I described above, just run top level.vi, it calls popup.vi (whose subVI node setup within top level.vi has been set to open the front panel when called and close if originally closed... so you can leave popup.vi closed)... when popup.vi runs you'll see the front panel... define 3 or 4 entries in the left array of enums, and then click Done.  top level.vi will cycle through cases as you defined then in the noted array (I use a dialog pop up with a relavent message to illustrate that).  The benefits of using an enum with case structures include 1. "add case for every value"  2. it's numeric underneath while showing text in the case structure for self-documenting code - easy readability.
 
I hope this helps!
 
Best Regards,
 
JLS 
 
PS - VIs built in version 7.1
Best,
JLS
Sixclear
Download All
0 Kudos
Message 4 of 11
(3,745 Views)
I was just wondering what you think the better alternative is for LV2 style globals are for LV8.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 5 of 11
(3,727 Views)


@Jhoskins wrote:
I was just wondering what you think the better alternative is for LV2 style globals are for LV8.

Shared Variable?
 
(... and I think the "better" had a question mark after it :D)
 
The shared variable has quite a few very nice features and I use it. However, I still often also use LV2 style globals, simply because they can contain much more intelligence and functionality if needed.

Message Edited by altenbach on 12-30-2005 01:50 PM

Message 6 of 11
(3,714 Views)

Christian wrote

"

However, I still often also use LV2 style globals, simply because they can contain much more intelligence and functionality if needed.

"

And therein we find the beauty of the beast. You can flip it over and make it do special tricks. Smiley Wink
 
Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 7 of 11
(3,701 Views)
Yes, the shared variable was the thing I had in mind, but I haven't played around with it since my LV8 is still in progress to go into a netinstall version...
    
I personally prefer the LV2-Global, maybe because I'm used to it and I have a picture* of what I understood the way it's handled by the Runtime.
 
But I'm not the pope and always expect the spanish inquisition Smiley Tongue
 
 
*Maybe my picture is just a shadow in a cave? If I don't know if I understand Platon, will I be able to understand LabVIEW?
 

Message Edited by Henrik Volkers on 01-02-2006 10:04 AM

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 8 of 11
(3,682 Views)

"Maybe my picture is just a shadow in a cave? If I don't know if I understand Platon, will I be able to understand LabVIEW? "

You do not have to understand Plato to LabVIEW. This is good because so few actually grapsed what Socrates was getting at, particuallrly here in the US (Just look at how hard someone has to work to become president). Smiley Mad

That is one of the things I like about the Exchange. It is a nice little shadow cave where I can believe I am doing the world good while waiting for the benign dicatator. (Is that a sufficiently abstract reply?).

Bonus question!

Aconding to Plato's Republic, what form of government follows democracy?

Correct answers get 5-stars! (yes that applies to CC and tst) Smiley Wink

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 9 of 11
(3,664 Views)

I should correct myself. I wrote "waiting for the benign dicatator" that should hae been "waiting for the benevolent dicatator".

Ben

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 10 of 11
(3,638 Views)