LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

State machine and parallel loops

Hi,

 

I'm new on LabVIEW and I'm trying to learn for myself.

You have been a great help, because there are many ways to do some programs, but use the most efficient manner, and know which one is that manner, is not always easy.

 

Regarding the state machines, I always used that, because I thought that's a way to organize the code, but I realized that's not always necessary. It's a good policy to do that or the program loses efficiency?

 

Regarding parallel loops, I'm trying to understand the best way to pass data between loops. From what I read in the forum, I saw that there are several forms, action engines, queues, occurrence, notifications, beyond local variables, which I had realized that shouldn't be used very much.
To accumulate the data into arrays, I'm using action engines. But when it comes to pass only one variable, for example, to stop the program, what should I use?

 

Thanks for your help

Sílvia

 

 

 

0 Kudos
Message 1 of 4
(3,189 Views)

 


@sreis wrote:

But when it comes to pass only one variable, for example, to stop the program, what should I use?


 

Often, you don't need to use much.

 

 

  • If you use queues, just destroy the queue after the UI loop and make sure the slave loop stops on error (example).
  • You could use events. Place the stop terminal in the consumer loop and use a stop event in the UI loop (example).
  • ...

 

0 Kudos
Message 2 of 4
(3,178 Views)

You talk pretty fluent about architectural issues. So better say:

I'm new on LabVIEW

Welcome. Smiley Wink

 

All the options you mentioned to communicate between parallel loops are good. In most cases there isn't an objective better way. It's more a matter of personal taste. This is the step where coding becomes an art.

 

Here a short list of recommended readings:

I guess about Action Engines, you already read Ben's über-nugget.

For shuting down both loops of a master slave architecture (queues, notifiers), check my discussion of this issue in my queue nugget.

If you need a many-to-many communication, user events are greate. Enjoy my event nugget.

A very valuable ressource on design issues is LAVA. There is a subforum concerning architectures.

And also locals are bad style, they can be very usful as duct tape.

 

Felix

0 Kudos
Message 3 of 4
(3,168 Views)

Hi,

 

Thanks for your help, I will read everything you advice. I've already read some, and found them very interesting.

But I think I will use queues.

 

Thanks,

Sílvia

 

 

0 Kudos
Message 4 of 4
(3,103 Views)