LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Producer/consumer where the producer is only active under a condition

Hi Guys,

 

I am using the producer/consumer architecture that is currently acquiring an analog input (producer) and then performing some signal filtering and peak detection (consumer), then finally saving the data. The data is from a photodiode measuring laser intensity and is attached as photodiode_thickness.vi.

 

I have another separate vi that is controlling a motor in another part of my process attached as Spin-coater.vi. This allows me to supply a rpm profile and run the vi to supply an analog output to my servo to spin the motor. In addition to the analog signal my motor also takes a digital enable, which is true when the rpm profile is not equal to zero, and false when it is. (This is necessary as otherwise due to the motors control you end up with back and fourth oscillation when supplying an rpm of 0).

 

Both of these vi's work as I need them to separately, however, ideally I would like to be able to run the Spin-coater.vi and have my other producer/consumer photodiode_thickness.vi start/stop the data acquisition according to the digital enable of the motor. So that when my motor's rpm > 0 it is acquiring data and when its rpm = 0 it is not. I have tried two approaches so far:

  • Putting the two block diagrams into one vi and wiring the boolean directly to the stop of my producer loop. I realised this will not work because the Boolean value originates in a for loop and thus does not execute.
  • Putting both vi's in a project and using a shared variable. I can't seem to get this to work either, however, I am not so experienced with this approach.

Essentially my question is how to I get my producer loop to 'listen' to a boolean value to decide when it starts and stops my data acquisition.

 

NOTE: A typical rpm profile will look like 0s 0rpm, 5s 0rpm, 6.5s 1500rpm, 12.5s 1500rpm, 14s 0rpm and so I'd like my producer active between 5s and 14s.

Download All
0 Kudos
Message 1 of 2
(823 Views)

You need to keep reading from the DAQ or you will get buffer overrun errors.  But that does not mean you have to process the data.  So add a case structure around the Enqueue Element calls so you don't pass the data on to the consumer.  You will need to add a little more to make sure you stop all of your loops properly when you need to regardless of the rpm value.



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 2 of 2
(797 Views)