03-05-2013 10:06 AM
Hi all,
Wondering if someone could help me here, i'm still quite a Labview novice... Basically I have a sub vi which I created that is feeding in analogue sensor values into my main vi in parallel with another sub vi, which is feeding in gps location in a combined latitude and longitude string. What I am looking to do is to record the locations in a visible array on the front panel when the acceleration is over a set amount (1g).
The issue I have is that I only wish to take down one location string for each time the acceleration is exceeded, so I would like to implement some sort of delay so that when the acceleration increases beyond 1g, the location is recorded and then the program waits for a given time before taking the next location (I only want one location recorded per event). But I cannot work out how to do this. The only way I can think of achieving it will give me several position values each time the acceleration passes the limit.
Any help would be greatly appreciated.
Thanks
Solved! Go to Solution.
03-05-2013 10:10 AM
03-05-2013 10:24 AM
Ok, sorry about that. I have attached the vi and hopefully you will understand what is going on. Essentially the while loop to the right hand side is what I have been given and the part I have worked on is in the left hand while loop. So I have the latitude and longitude string which is called "concatenated string" and my accelerometer readings come from the sub vi called Accelerometer. I currently have boolean greater than set for if>1.
The really hard part that I am struggling with is getting the latitude and longitude string to write accross to the array on the right hand while loop called "Marker location array" as a new indexed value and to do this only when the acceleration is above my set value.
Thanks again for any help and hopefully I have uploaded it properly!
03-05-2013 01:56 PM
03-16-2013 06:05 PM
Thank you for your help, I am still struggling with the shift register part but am almost there!
03-16-2013 08:34 PM
Rather than using a delay between updates of the locations, you can monitor the transitions from below the acceleration threshold to above. Then you only get one update each time the acceleration increases to greater than 1, no matter how long it remains high. This can be done with a shift rgister and the boolean Implies function.
Also, a queue is the preferred way to transfer data between parallel loops. Look at the Producer/Consumer Design Pattern for more information.
Here is a partial modification of your VI showing these concepts.
Lynn
03-17-2013 05:51 AM
Thanks for your help and some really useful advice. It is now working with one location in the array at a time, however when I press refresh it seems to overwrite the first location with the new location (or empty if currently below the threshold), whereas I would like it to add the new location as a new index in the array. Do you know how I could acheive this please? I aim to get rid of the refresh button also and make this loop automatically run and update.
Regards,
Will
(latest vi attached, I need to update some code to subvi's as you suggested later)
03-17-2013 11:04 AM
Will,
1. You need a shift regsiter. This will retain data from one iteration to the next.
2. If you want to get rid of the Refresh button, just change the Refresh event case to the Timeout case and set the timeout value to the period at which you want to update the displays. In this case you really do not need the event structure at all. Replace the Flush Queue with Dequeue. Set the timeout on Dequeue to the maximum time you want to wait for it to respond to the System Stop Button. Then the Dequeue will update the displays immediately every time the acceleration threshold is crossed.
Lynn