From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

I ask for a suggestion to experts

I have a laser which performs measures at an high rate (order of magnitude 1 Khz). 

I want to read and collect data at a lower rate from time to time. 

So I must leave the laser doing its job, but I need to pick up just some of its data (actually the last data, when I am going to read inside it) loosing all the remaining data (and I really want to loose them). I hope I was able to properly explain myself. 

In an ideal vi I MUST have an initialization part of the instrument at the beginning (just to be read once) and a closure part at the end (just to be read once) and a reading part of the laser in the middle to be read several times while the vi is running.

 

My question is the following. Have I to adopt the master-slave architecture with notifiers, or you can suggest me something else?

Thank you in advance.

0 Kudos
Message 1 of 3
(2,283 Views)

I would actually suggest using the producer-consumer architecture, as it's better suited for something like this. The producer part would be the part that collects the data from the laser and places it into a queue. The consumer part would pull the data off as it needs it. You would need to size the queue so that it's large enough to handle the different rates you will have. You can have the consumer part be a state machine so that it has an initialization state and a close state, and the other states would be whatever you need. One state would be the state that processes the data.

Message 2 of 3
(2,263 Views)

My two cents worth.  I agree with producer-consumer.  It is built for that purpose.  However, I would put the initialization code before the producer-consumer even starts, then put the shutdown code afterwards.  Since both will only be called once, there is no need to complicate the consumer loop with a state machine.  It would also make the code more readable.  The Error In and Error Out wires can direct the execution flow to make this happen.

- tbob

Inventor of the WORM Global
Message 3 of 3
(2,218 Views)