11-20-2012 05:53 PM
Hello,
I am working on a piece of code where I am getting data from 6 different sources (reading temperature & pH on 6 different tanks)... I am using
1) a case structure
2) while loop
3) waveform chart
Now, I want to have it so, the User selects which graph he wants to see (tank 1, tank 2, tank 3, etc...). And then, program ONLY SHOWS the graph for THAT TANK...
So I have an Event Structure with the "Tank #" control, which is supposed to change the graph that is on display. However, right now, it is not working.
Let's say I start the program..., then I click "Tank 1"... it graphs Tank 1... then I click "Tank 2"... instead of COMPLETLY CHANGING the graph, it CONTINUES to graph the data from TANK 2 on the same graph. I.E.: it plots points 1 - 7 from TANK 1, then plots points 8 - 15 from TANK 2,.... on the same Graph.
I don't want that. I want it to change the graph. But if I put the graph in the Case Structure, it puts multiple graphs on the Front Panel... How can I do it?
NOTE: Ignore case 3. And each case should be corresponding to Tank #...
Thank your for reading--
11-20-2012 07:01 PM
the easy answer is that you should clear your waveform graph before sending new data to it...
It's as easy as writing an empty array to it's property node Value...
But..
you've got much... much more cleaning up to do. Clearing the graph is just one thing.
Your code is unreadable. Why do you have 3 While Loops?
What does the bottom one do?
Why are you complicating things with cluster going into the queue? An enumerator would do the same trick.
Is this code going into a cRIO or cFieldpoint? If not, what's up with using Shared Variables? Are you planning to send data over the network?
Debugging this code will become a nightmare. Scalability will be worse..
I would recommend refactoring the code while it is still manageable.
12-07-2012 02:33 PM
The 3 while loops is part of the "architecture" of the program. You have the Data-Engine / Data-Update, Event Manager/Handler, and Command Sender. This is part of a CompactRIO system. There are 2 other program .VI 's : Real-Time .VI, and FPGA .VI.
Hence...: the network varibles.
The bottom one sends "commands" to the Real-Time piece of code. The commands are from the Event Manager.
I cannot just use a Enumerator. I need to send a Boolean value, or a numberic value (Temperature, pH), + the Tank # corresponding.
I'm not sure if debugging this code will be a nightmare. I'm still new at LabVIEW... but now that you know its for cRIO system,... well.... feel free to comment