LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

what's the best way to do it ?

Hi everybody!

My application should look like this:
- one thread to start some VI at scheduled moments in time (a loop with different delays)
- one thread to monitor different measurements (temperature) (a loop with different delays)
- a main front panel to show temperature settings vs temperature measurements
My idea is to have a main VI running 2 subVIs in parallel (in one frame sequence) that exchange data with the one for monitoring (via globals or queues) in order to display it on a transparent graph (on top of another graph showing the profile - settings). Is it good enough?

Any better idea will be highly appreciated.

Thx,
Ela
0 Kudos
Message 1 of 10
(3,896 Views)
I think I uderstand what you are trying to do. Your ideas seem to be good. Just make sure that you have your timing correct between the two loops. Can't you just use one graph with two plots on it though?

If you have any troubles getting it to work feel free to post your question.

Brian
Message 2 of 10
(3,896 Views)
Thank you, for opinion Brian,
Actually you touched the most sensitive parts. Thus, my two main concerns are:
1. I'm not sure how accurate is a Wait.VI in parallel (for example in the same frame) with one test related VI (e.g. if the WAIT is set for 2 hours and my test VI is less then that, is the whole elapsed time exactly 2 hours?)
2. I don't know how labview store the data for graphs - I thought that drawing the profile on one graph and put the log data on top of it, I'm saving some memory space necessary to store profile values (in case that I want to draw both on the same graph). The problem is that I have to update those plots many times and I think that is way to much memory wasted for this purpose (I'm trying to save memory for dynamically executed tes
t VIs). Is the Picture Control a solution?
0 Kudos
Message 3 of 10
(3,896 Views)
I don't think I really understand your first concern. I can say that accuracy of your wait delay depends on how you set if up. If you could elaborate a little more, or attach an example it may help.

As for the graphs, the data for a waveform graph is typically stored in the form of a 2D array. Where each row in the array is a plot. I don't think that you'll waste more memory doing it this way.

Could you attach an example of what you are trying to do? I'm having trouble visualizing it.
0 Kudos
Message 4 of 10
(3,896 Views)
I attached a simulation of what I'm trying to do. Explanations and questions are located inside the block diagram of master.VI.
Again, thank you very much for your help.
0 Kudos
Message 5 of 10
(3,896 Views)
I've looked at your simulation quickly. First realize that you never be able to guarantee exact delays, because the OS may give other operations priority over your's. That is unless you are using LabVIEW RT, or something like that. However you with the long delays that you are suggesting you shouldn't have a problem.

Instead of using the Wait function to time your delay I would suggest using the Tick Counter or Date/Time in Secs (I like using the Date/Time because you don't have to worry about the counter rolling over). Basically put a small delay in your loop and use these functions to test when a certain amount of time has elapsed. This way you can stop the loop with the stop boolean without having to wait for the
whole delay to occur (imagine having to wait a couple hours for the delay before the loop stops). You should be able to guarantee a constant delay between operations within 10-20 ms using this method.

I wouldn't be too worried about memory usage unless you have alot of data that you are collecing, or a really old computer.

The best way to make sure that the loops start at the same time is to use the rendezvous vis. Create a rendezvous refnum and place the a Wait at Rendezvous function outside of each loop and wire them to the loop.

I will try to make a modified version of your vi when I have time and post it for you to look at.

Hope this helps you out somewhat.

Brian
0 Kudos
Message 6 of 10
(3,896 Views)
Thanks a lot Brian. Don’t waste your time to modify that VI, especially because it will look different in the final version. As long as I found out how to deal with those delays and synchronization, everything is perfect.
0 Kudos
Message 7 of 10
(3,896 Views)
Hi Ella,

I've read thru the message thread, and thought I'd through in my two cents
worth

First, how accurate do you need to be for the timming of getting your data.
As mentioned the OS will cause an unpredictable response. I beleive windows
has a resolution of 55ms. Threfore your Wait function will be +/- that
value. Additionally, if you are running windows, execution of you're code
can be stopped at anytime in order to service some other thread/process. So
even if your Wait function is very precise, you still might not achieve the
timming your looking for. If this doesn't make sense, let me know and I'll
try and explain it better.

The first question is, do you really need to be 'very' precise? If you can
tolerate a second of variance in your measurement timm
ing, then your
sollution should be fine. If you really do need 'very' precise, a hardware
solution might be better suited. I can try and give you more info on this
if you think this would be helpfull.

The next thing I thought I should mention is State Machines. I'm not sure
how much you've used LV, but this would be the prefered methode of building
your code. I won't go into details, assuming you already know this. But
once again, if you don't know what this is, I can give you an example.

Anyway, I hope this has been somewhat useful...

Denis
0 Kudos
Message 8 of 10
(3,896 Views)
Hi Denis,

First of all, thanks for your answer.
Regarding the accuracy required by this application, it seems that I have to explain it a little bit more. Thus, it's somehow like real time - it doesn't always mean fast. In my case, it's about a long running application (let's say 5 days for example). A master.VI launches different test Vis as scheduled at the beginning (for example, I have to launch one test after 10 hours, another after 24 hours, another after 26 hours and 3 minutes, and so on - all relative to the start point). Calculating delays between each two consecutive tests, I'm thinking to use Wait.VI to do the job. My concern is not an error of milliseconds between two consecutive tests, but the accumulation of errors. For example, having exactly
5 days between the first one and the last one, I need both start test times to show the same second). Also, I have to mention that the computer running this application is not doing something else, so the operating system (Win9x) is not too busy (except a screen saver (blank) and a stupid antivirus 🙂 ).
Regarding State Machines, I have an idea how to use them but I cannot see how to fit them in this kind of application. So, any suggestion will be appreciated.
0 Kudos
Message 9 of 10
(3,896 Views)
Ack, don't use waits. Read the millisecond timer at program start and
compute all your times relative to this. You then have a single absolute
measure of time rather than multiple spans with unknown delays between each
span.

As for state machines; one frame for each test- or to launch each test
sub-VI, and one "housekeeping" frame that determines if the correct amount
of time has elapsed to start a given test, check for the stop button being
pressed, for errors etc. Simple.

Ela wrote in message
news:50650000000500000013470000-1002247793000@exchange.ni.com...

> to the start point). Calculating delays between each two consecutive
> tests, I'm thinking to use Wait.VI to do the job. My concern is not an
> error of milliseconds betw
een two consecutive tests, but the
> accumulation of errors. For example, having exactly 5 days between the
> first one and the last one, I need both start test times to show the
0 Kudos
Message 10 of 10
(3,896 Views)