LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What should you use instead of sequences to control execution?

OK. Avoid sequences because I will probably abuse them anyway and shouldn’t start relying on them as a crutch.

 

As for my application; use a state machine that has one state that enters the concentration and starts the data collection. Connect these two vis using error codes to force the execution. Then have another state that collects the data and when finished checks to see if there is more concentrations to collect for, if not I exit out of the machine. If there is, I go back to the enter concentration state.

 

I hope that’s correct.

 

Thanks for the assistance and the discussion on the use of sequences.

 

Eric

0 Kudos
Message 11 of 19
(1,371 Views)
You can always post your code. 
 
The error cluster is not to force execution but to help in provided the desired dataflow.  Remember, Labview uses a dataflow model, so it will execute as soon as all values are available, thus you can have parallelism.  The wire is actually your variable which routes the data.
 
R
 
0 Kudos
Message 12 of 19
(1,351 Views)

I was busy trying to create a state machine and finding out what a pain it is without a type def. Started reading up on creating a type def when I ran out of time. Here is the code.

Thanks

0 Kudos
Message 13 of 19
(1,346 Views)
You do not have to use an enum for the states definition. You can also use a queue of strings. Smiley Wink
0 Kudos
Message 14 of 19
(1,341 Views)
OK, I did not look at your latest incarnation, but here's a quick refactoring of your old version using error clusters.
 
  • First of all, since you know the number of iterations before the loop starts, you need a FOR loop.
  • There is a lof of code that does not make much sense, so I am assuming you are still working on this. For example the second FOR loop makes no sense.
  • Your subVIs need errorIN and errorOUT
  • You don't need a hidden control and an indicator to display a numer in the subVI. Use the control, hide the increment buttons, and disable it so it cannot be operated.
  • Use correct representations, e.g. the number of datapoints must be an integer, not a DBL.
 
Also, your start subVI has a greedy loop, consuming all CPU while not doing anything useful. Use an event structure without a loop.


Message Edited by altenbach on 07-11-2008 12:31 PM
Message 15 of 19
(1,338 Views)
bunch of comments here...

Well, I was going to offer up some comments on the code, but as usual, altenbach was quick on the draw. Smiley Very Happy
0 Kudos
Message 16 of 19
(1,333 Views)

Altenbach,

This is much more than I asked for,Thanks!

You did away with all sequences and made the program flat. Also showed that a statemachine wasn't what I needed for this application. Good discussion anyways. Smercurio_fc thanks for pointing out that I don't need to create a type def for enum. I don't know how to implement a queue of strings but I will try and figure that out when I need to actually create a statemachine. I didn't know that you could disable a control effectively making it an indicator. Also using a while loop to control iterations is basically what the for loop does (no brainer.) I found the code to automatically expand the graph legend, but your right, half the code isn't needed for what I'm doing. I'm still trying to get used to the index capabilities for structures, thanks for pointing that out. The second for loop is used for multiple channels that could be calibrated at the same time. I just defaulted the inputs to this vi so it would run. The initial error condition, even though it says error out, is basically an initial condition to feed to the error condition, Correct?

I think thats everything!

Thanks to Altenbach for cleaning my garbage code and to everyone concerning sequences.

Eric

Message 17 of 19
(1,298 Views)


Knoebel wrote:

The initial error condition, even though it says error out, is basically an initial condition to feed to the error condition, Correct?


Yes, you need to initilize the shift register with a "no error" value at the start of the program. If you don't initialize the shift register will remember its last value from the previous run. If the previous run resulted in an error, you would start with an error. 😉

Your hardware VIs will not do much if they receive an error on the input, probably a good thing. 😄
0 Kudos
Message 18 of 19
(1,292 Views)

Just jumping in here after granting lots of stars in this thread.  Special kudos to Knoebel.  It's rare and extremely refreshing when a pretty new poster works the thread just perfectly.  Specific questions, relevant follow-ups, code posted to show effort and initiative...  And in return, many acknowledged experts were happy to provide valuable help.

Really, just a model thread all the way around.  Great signal-to-noise -- at least until my little pat-on-the-back post here.

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 19 of 19
(1,275 Views)