LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Master and Slave Loops

I'm having problems with my Master and slave loop combination.  I would like to be able to start and stop acquiring data from individual thermocouples. Please help.
 


Message Edited by nicholas03 on 04-13-2008 03:22 PM
0 Kudos
Message 1 of 14
(5,625 Views)
Sorry, just by looking at it, your code makes very little sense. All I see is potential for race conditions and deadlocks.
  • Why do you trap the dataflow inside an inner loop?
  • Once OK is pressed, your queue will grow forever because you keep adding elements in the upper loop, but never dequeue again, ever. Right?
  • Why do you use a queue without any real data?
  • What's the purpose of the lower outer loop structure?
  • What is the purpose of the lower inner loop. Since the data comes from outside the loop, all it will do is spin as fast as it can consuming ~100% of the CPU, while never changing any displays to anything new. Ever!

Do you really have 8 CPUs or could you do the reading in a loop with 8 iterations? In this case you could just add a boolean array with 8 elements, autoindex at the loop boundary, and, at each iteration either take a reading or output a NaN.

Please attach some code.

 



Message Edited by altenbach on 04-13-2008 01:39 PM
0 Kudos
Message 2 of 14
(5,620 Views)
Dear Nicholas,
 
My first advise would be to check the examples on master-slave patterns, and run them step by step, looking at what the data does...
In a master-slave system, you use the queue to pass data from the master to the slave.   You're not passing data in the queue... in stead, you're passing data using local variables, which you should NOT do...  
 
In the top loops, you should attach the temp array to the enqueue element.   In the bottom loop, you should remove the temp local, and instead get your data from the dequeue vi.
 
Also, you have to create a queue with the proper variable.   You can create a queue from any variable type, but it has to know beforehand, and the init vi.  
Assuming you want to queue the temp array, you're basic structure should look like this:
 
 
It does help if you add your own code, so we can easier edit it for you...  Otherwise we need to use photoshop on your design...


Message Edited by Anthony de Vries on 04-14-2008 11:30 AM
0 Kudos
Message 3 of 14
(5,588 Views)
What do you mean by adding my own code?

Message Edited by nicholas03 on 04-14-2008 08:22 PM
0 Kudos
Message 4 of 14
(5,537 Views)


nicholas03 wrote:
What do you mean by adding my own code?

Attach your actual program (*.vi) instead of an image of your code.
0 Kudos
Message 5 of 14
(5,524 Views)
I would like to add a button to the front panel that starts and stops the slave loop whilerecording time and temp. Eventually I would like the loop to stop when the temp drops one degree. I do not know how to do it. I have tried to put a case structure but it did not work.


Message Edited by nicholas03 on 04-15-2008 08:53 PM
0 Kudos
Message 6 of 14
(5,480 Views)
Code cleanup.Smiley Wink
0 Kudos
Message 7 of 14
(5,475 Views)
OK, can you explain once more the purpose of the lower loop and the queue? (and the entire multiloop master/slave design for this)?
 
Why can't you just place everything in one loop?
 
Here's functionally the same thing, except the loop also stops if the value is below 1.
 
What am I missing???
 
 


Message Edited by altenbach on 04-15-2008 08:04 PM
0 Kudos
Message 8 of 14
(5,467 Views)
Well I want to be able to start each thermocouple individually. I want a clock to start when one of the temperature reaches above a certain temp. That is why I am trying to biuld a slave loop. I want the time to be kept in the slave loop when the clock starts.

Message Edited by nicholas03 on 04-16-2008 05:06 PM
0 Kudos
Message 9 of 14
(5,434 Views)
Altenbach, I built the vi you proposed and it did not do what I wanted to do. The graph that I originally built had all eight thermocouples being plotted as time progresses. I want this and also eight buttons that start and stop each individual data collecting. I want to be able to run as many thermocouples being collected at once as well. I am having trouble even getting one to start and stop on command.
0 Kudos
Message 10 of 14
(5,419 Views)