08-05-2023 03:23 AM
I have designed an impact attenuation device which generates both vertical and horizontal impact velocities. Both axes have repeatable features which I identify through the algorithm I have developed to analyse the data. There are several output results from the analysis which require the same time stamps to set the boundary conditions. My VI is complex and its becoming more difficult to keep it tidy whilst applying these time index to all the parameters. I have seen on other forums that local variables are not recommended. Does anyone have a suggestion of how to apply a constant time index derived from the waveform features across different sub-VI's?
Thanks in advance for any suggestions.
08-05-2023 06:46 AM
Local variables don't even work across subvis. What is a time index? (Just t0?). How many are there? What are parameters? How are the y values organized?
Once you are a bit more specific, we can give more specific advice. Can you share some code?
08-05-2023 06:59 AM - edited 08-05-2023 07:00 AM
With limited general information we can only offer general advice about how to approach the problem.
From reading your post I can offer the following tips:
You say you have waveforms. There is a Waveform Datatype. You should be using those rather than arrays of scalar data since they contain timing information right on the same wire. That makes things much easier when dT changes
Another under-used waveform component that you could benefit from is "Attributes." In essence an Attribute is something interesting about the Data. I'll bet you money, marbles or ice-cream AT ANY ODDS YOU NAME that every local variable you are using and every interesting thing you discover analyzing the waveform Data could be Attributes of those waveforms and hence, passed along with the measurement data without risking any race conditions.
08-05-2023 07:29 AM
I've removed most of the other code to keep it simple but effectively I want to establish 7 time stamps which reflect:
Ice cream with a flake sounds like a good deal if you can help 🙂
08-05-2023 08:46 AM - edited 08-05-2023 08:52 AM
You don't have waveforms, but just a single plain 2D array where the first column appears to be time.
Then you juggle that between dynamic data and arrays back and forth and back and forth, but I don't see where you take the time column and really deal with it in conjunction with the rest of the data. Virtually all of your subVIs are missing and most seem to take dynamic data.
Maybe all your subVIs could just take the original 2D array and output the relevant timestamp. No need to constantly slice and dice.
Can't really help unless you provide more context, but all you probably need is a 1D array of seven times in a shift register where you replace each element with the relevant timestamp as it becomes available and a state machine with each analysis step as a state. Should fit on a postcard! Don't use dynamic data at all!
Currently, you re-read the same file millions of times per second until the button is pressed. Once is probably enough, right? Once the switch is changed, you re-do the same calculation, including reading the file, again as fast as the computer allows. Again, once is enough!
08-05-2023 09:45 AM - edited 08-05-2023 09:47 AM
So here's a quick draft of what I would do. Each data column can be analyzed by just knowing t0 and dt (both are 0.0001), because this can be used to convert array index to time and back. (would have been easier if the first time is zero instead of 0.0001, but no big deal!).
See if you can take it from here. Should not take more than half a postcard of code.... 😄
08-05-2023 10:58 AM
@Max2796 wrote:
I've removed most of the other code to keep it simple but effectively I want to establish 7 time stamps which reflect:
- Start of the interaction - when horizontal velocity is initated
- Release of the impactor on the vertical axis
- Point of contact - Vertcial force > 55N
- End of the interaction - when the carriage gets to the end of the gantry
- Begining of the sliding phase - impactor must be in constant conatct with the surface for the sliding phase so work back from End of the Interaction and find when vertical force crosses the x-axis.
- Additional data analysis also looks the Impact Zone - boundary limits are horizontal force [ 0N => Peak => 0N]
Ice cream with a flake sounds like a good deal if you can help 🙂
OK, so we have two X and Z traces each with different multipliers or gains (because one sometimes saturates). What do the T1, T2, T3 traces signify? Is the upward drift real data or an artifact? What are the units for the various traces? How do we calculate N from the value and gain?
Can you explain in better words how the seven mentioned parameters manifest themselves in the various traces? Maybe also show a little sketch?