LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simple displacement graph, programming critique wanted

I wrote a short VI and I'm wondering if I could get your expert opinions. It seems to function fine but I want to make sure that the data I'm seeing is correct.
 
I am looking to plot displacement.  I have a PCB triaxial accelerometer measuring vibration in another application. I save all of this data to a tdms file.
 
 
In the program I have here, I open the tdms file, extract the third array (Z vibration), convert the volts to m/2^, then put this data into the express VI and double integrate.  The graph prints out what looks like good data that seems to make sense from what we observed. I see movements of a few millimeters in the z direction.
 
I guess I'm just looking for someone to look this code over and give their opinion. Is it really this simple to get displacement or am I missing something?

Any advice is greatly appreciated!

Regards,
 
Jeff
 
 
Download All
0 Kudos
Message 1 of 6
(2,973 Views)


@jeff_scharpf wrote:
... Is it really this simple to get displacement or am I missing something?

Once you know a little bit of LabVIEW, YES, most things are that simple! 🙂

Unfortunately, it is difficult to judge a VI from a diagram image. What's in the "other case" of the case structure? What determines the rate of the while loop?

Message 2 of 6
(2,962 Views)
Thanks for the response. I understand it's hard to judge a picture. The case statement is only there so the operator clicks a "Start" button to initiate the file read. The "False" case is empty.
Similarily, the while loop is only there so I can open a file, display it, then open another file, without having to re-run the program. It's just always reading the settings from the user (Start data point, and total data points)
 
Once the user clicks the button, the "True" case reads the entire file, selects the third array (Z axis vibration), scales it to m/s^2, then displays it. The variables are start data point (0 to 1 million) and number of data points (0 to 1 million).
 
Each file has 1 million data points only because that's how much I saved 🙂
 
 
0 Kudos
Message 3 of 6
(2,957 Views)


@jeff_scharpf wrote:
Thanks for the response. I understand it's hard to judge a picture. The case statement is only there so the operator clicks a "Start" button to initiate the file read. The "False" case is empty.

What is the boolean action of the switch for the case structure? Does it stay on or does it reset to false after each read?

OK, place an indicator on the iteration terminal of the loop and open the task manager to see the CPU usage of your rig. Most likely you will see that you'll use 100% of your CPU spinning the loop millions of times per second until the button turns TRUE.

 In any case, your FALSE case should have a small delay (e.g. 100ms), so it only uses 0.01% of the CPU when no doing anything useful. Whithout a delay, a loop will spin as fast as the CPU allows.

An even better idea would be an event structure.

Message 4 of 6
(2,946 Views)

Thanks I understand. I will add some delays.

 

I'm more concerned that my displacement numbers are correct. I don't really care if I'm using 100% CPU as this is just a demonstration to see if I can do displacement.

 

 

0 Kudos
Message 5 of 6
(2,937 Views)
If you are concerned about data validity the other thing you can do is hook up the error clusters and make some provision for reporting errors that occur.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 6 of 6
(2,921 Views)