07-11-2016 08:33 AM
Hello,
I have written a VI that collects data continuously into a circular buffer and is supposed to record all of the points in the buffer to an excel file at an impact trigger. I am currently using the waveform limit scalar comparison VI to execute the trigger (using the boolean output), but upon testing the project, the trigger will not register for some reason.
Is this because the comparison VI does not register the failure fast enough? Also, can anyone reccommend an alternative that would respond faster to use in its place?
Thanks,
Guy
Solved! Go to Solution.
07-11-2016 08:45 AM
07-11-2016 08:49 AM
My mistake, I completely forgot to attach my VI.
I'm recording data at 10kHz. I have no typical data yet because there was no system to do this kind of collection implemented before I started this VI, but the accelerometer will stay hovering around zero until an impact (a physical tank will be dropped onto a concrete surface), which should show a few data points around 20gs.
I hope that helps!
07-11-2016 09:33 AM
Thanks for posting the code. It shows fairly clearly the source of the problem.
I, personally, like the Event Driven State Machine model that you are using, but you need to remember that a State Machine can only be in one State at a time. In particular, if any State takes an appreciable amount of time (both User State 1 and Wait for Event take at least 0.1 sec, a "long time" in data-acquisition-speak), you can miss things.
What you want/need is parallel Loops, a.k.a. the Producer/Consumer Design Pattern. We had a similar situation involving a trigger, a "pre-event buffer", and wanting to save data. Here's how we handled it:
Note -- it's been 4-5 years since I developed this system, and realize I'm missing some details. I think we needed to fire the Notifier after Get a Sample, passing information about whether we were in a "No Trigger Yet" State, a "First Trigger" state, or a "Waiting for Godot" (meaning processing as much Post-Event data as required) State. I'm also forgetting how we handled filling up the "Pre-Event" buffer -- did we ignore Triggers if we didn't have sufficient "Before" data? I don't recall.
But, again, the trick is that saving the data into a Queue (the Producer) runs in a different loop than the process of emptying the Queue (the Consumer), so that the Emptying process doesn't interfere with the Acquiring process.
Bob Schor
07-11-2016 10:19 AM
Thank you for your thorough answer.
Your explanation makes sense to me. I will implement it to the best of my ability and then mark your answer as a solution. The issue of the pre-event buffer not being filled shouldn't affect the test I am running, since the VI wil lrun for several minutes before triggering.
Thanks again!
Guy
07-12-2016 02:09 PM
Quick question:
I have the VI built (and attached), but I am a little stuck on one part. The signal that changes the recording from the pre- event buffer to the post-event buffer does not stay true long enough, since it is dependent on the event trigger (which turns false before the record time is up). I want, essentially, a true signal wired to the case statement labeled 'A' that remains true until the final frame of the sequence structure (only there to force the sequence of recording to excel) has completed, at which point ideally it would change to false. I can use a property node at the end of the third frame to force the false value, but I don't know how to keep the case statement at the true case until then.
Thank you!