From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
11-01-2024 11:32 AM
Hi,
I've developed a LabVIEW program to analyze accelerometer profiles of a dropping mass. The program identifies two key points during impact:
Additionally, for both T1 and T2, the force gradient at these points must be greater than 10 kN/s.
I've implemented a For Loop
to cycle through a database of 5,000 drop tests. However, the code experiences a bottleneck when generating the force gradient profile. I've noticed in the 'Force Gradient 3' graph that the method appends all data as the loop iterates, which I suspect is causing the processing time to increase as more datasets are analyzed.
Any suggestions on optimizing this approach to improve performance would be greatly appreciated.
Max
11-01-2024 11:48 AM - edited 11-01-2024 12:14 PM
Your VI has massive problems that have nothing to do with FOR loop efficiency.
Please attach your missing subVI and a set of typical files.
11-01-2024 12:02 PM - edited 11-01-2024 12:18 PM
Just compare your code and some better alternatives: (This is just the tip of the iceberg!)
(Yes, there are even no-loop solutions!)
11-01-2024 01:09 PM
@Max2796 wrote:
Hi,
I've developed a LabVIEW program to analyze accelerometer profiles of a dropping mass. The program identifies two key points during impact:
- T1: The initial contact time, defined as the first data point where the normal load exceeds 30 N.
- T2: The end of impact, defined as the first data point after the peak normal load where it drops below 30 N.
Additionally, for both T1 and T2, the force gradient at these points must be greater than 10 kN/s.
OK, so you need to find two positions:
Your files have no timing information, so I assume you just want the array index of these two position.
How do you need to handle exceptions
11-01-2024 02:19 PM - edited 11-01-2024 05:28 PM
@altenbach wrote:
OK, so you need to find two positions:
- The first point (T1) where data is>30 AND gradient >10k
- The second (T2) where data is<30 AND gradient >10k
Your files have no timing information, so I assume you just want the array index of these two position.
Here's a very quick generic draft to do this. Most likely it would need some tweaks, for example the second loop could start with the array max position.
Of course you need to adjust the thresholds and potential filtering of the derivative according to your needs. You also need some exception handling.
Of course you don't need the cursors and graphs.
The code could be further simplified by placing the two FOR loops in a 2 iteration FOR loop and adjust the code accordingly.
11-02-2024 10:51 AM
@altenbach wrote:
, for example the second loop could start with the array max position.
Here's how that could look like: