LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make my different parts of my VI run in parallel

Hi

I hope you can give me a piece of advice to start from. I am developing a VI using state machines to control a peristaltic pump I built with a stepper motor. I send string commands to the serial port to the drive to execute a movement, I also control some solenoid valves (trough the driver's digital I/O) so the liquid goes from one mother vial to a dispensed vial. I am working with radioactive liquids (now with water) so I have to account for radioactivity decay (exponential function). When I withdraw liquid from the mother vial and transfer to the dispensed vial al variables related to the mother vial should be updated (radioactivity, volume, etc.). I have a time stamp within a while loop so the radioactivity in the mother vial decays with time. The user should be able to see the decay of the mother  vial and any vial I want to dispense. The problem I have is data dependency, I guess. Because the while loop does not stop, I can't pass data related to the mother vial to the vial I want to prepare, so when the user wants to dispense radioactivity from the mother vial at certain time, the VI should calculate the volume that has to be withdrawn, then this volume should be shown in the front panel as a radioactivity value (they are proportional), and all values related to vials should be updated "online". Variables related to the new created vial as volume, radioactivity, etc. should be seen and as well as the decrease in the mother vial. How can I accomplish this kind of programming? I hope you have understood my explanation. I've attached the VI I developed. Any help would be grateful.

Download All
0 Kudos
Message 1 of 3
(2,010 Views)

You have at least a couple spots where you write to a terminal, and a local variable of that terminal at the same time.  Why?  Delete the local variable.

 

The fact you are starting with a state machine architecture is a good thing.

 

Your VI doesn't really show what you are trying to execute in parallel.  Something running in parallel will be in its own loop with no wires running between them.  You can pass data to another loop by using either notifiers or queues in a producer/consumer pattern.

Message 2 of 3
(1,987 Views)

Thanks for responding. First I was trying to use shift registers and then local variables to be able to pass data between code in two states at the same time. What I need is to pass data from one state to the other at the same time in such a way that when I input data through a control (e.g. prompt user for input) in one state then an indicator in the other state varies, say in parallel. The problem I have encountered is that I am using a while loop to make variables to vary with time so the data is generated, but I realized that my code in other state do not run because the while loop is not finished. I will check notifiers and queues as you recommended as I am very novice in Labview. 

0 Kudos
Message 3 of 3
(1,966 Views)