LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I calculate the slope of an isometric torque curve with a trigger and time increments of 0-30ms, 0-50ms, 0-100ms etc....

I am analyzing isometric muscle contractions of the quadriceps and want to calculate the rate of force development (not just peak torque) for the torque-time curve.  I want to set a trigger so that the slope of the torque curve is calculated when 7 newton-meters is reached.  From there I'm trying to calculate the slope in time increments of 0-30ms, 0-50ms, 0-100ms, etc....My data is sampled at 2000 Hz and written in text files.  Below is a copy of the VI I have developed so far.  I am very new to programming with LabVIEW but can definitely see its potential!  Any advice would be greatly appreciated. 

0 Kudos
Message 1 of 7
(3,525 Views)

Hi Fiddler918,

 

I can provide some assistance with your application, but I'm going to need a bit more information from you.  If I understand correctly, you are reading in the torque curve data from a spreadsheet file.  Once your curve passes the 7 Nm threshold, you want to take slope measurements over various increments starting at that point.  What is the format of your spreadsheet data?  Are there time stamps or is it just known that every point is 0.5 ms apart (2000Hz sampling rate)?  Once I understand the data file, I can give you some pointers on implementing your desired code.

 

Regards,

Jared R.
Precision DC Product Support Engineer
National Instruments
0 Kudos
Message 2 of 7
(3,509 Views)

Yes, you have described exactly what I'm trying to do.  I'm not sure if the file is time stamped.  I have attached an example of one of the files I'm trying to analyze.  The third column represents torque.  All values are in microvolts and were then converted to newton-meters using a regression equation.  Thank you very much for the assistance.    

0 Kudos
Message 3 of 7
(3,503 Views)

Fiddler918,

 

When trying to implement something like this in LabVIEW, it is often helpful to think about how you would program this function in a traditional text-based language.  Try and break the problem down.  You need to locate the data point in your array that is 7 Nm or greater.  At this point, you will need to grab the data points that are 60 indices (for the 30ms gap, assuming your points are equally spaced 0.5 ms apart), 100 indices (for the 50 ms gap), and 200 indices (for the 100ms gap) ahead of this point in your data file, and calculate the slope using pairs of data points.  

 

Here is a general description of a possible implementation of this code:

You can wire the appropriate column of the data array into a For Loop on the block diagram and have it auto index through the points.  If you right click on the Use the Greater or Equal? function to generate a Boolean that will be true when you want to exit the For Loop.  Right-click on the border of the For Loop and select Conditional Terminal.  This will cause a small stop sign to appear.  If you wire the Boolean to the conditional terminal, the loop will stop at the value that is greater than or equal to 7 Nm.  If you wire the Loop Iteration terminal out of the For Loop to the right, this will give you the index of the value in the column that you’re interested in.  Having this value, you can then use the Array functions to grab the specific data points you need, and numeric functions to perform the necessary math.

 

If any of this didn't make sense, the LabVIEW help files are a great resource to use.

 

Here is a link to some video tutorials of the LabVIEW programming environment.  They may help you in the development of your code.

http://www.ni.com/academic/students/learnlabview/

 

Regards,

Jared R.
Precision DC Product Support Engineer
National Instruments
0 Kudos
Message 4 of 7
(3,483 Views)

Thank you so much for the help, I think I can figure it out from here.  I have not had a chance to work on it yet, really busy with teaching and research and wrapping up another semester.  I just wanted to say thank you for your help.  Thanks again.

0 Kudos
Message 5 of 7
(3,463 Views)

I am still having trouble understanding what steps to take next.  The second waveform graph stops at 7 nm, so I've got that part however, I don't know what to do next.  Could you take a look at what I have so far on this VI and point me in the right direction?

Download All
0 Kudos
Message 6 of 7
(3,434 Views)

Fiddler918,

 

It looks like you're on the right track.  To start calculating the slope you need to get the correct index out of your for loop.  Right now, the iteration terminal is outputting an array of every number that it outputs during the for loop's execution.  Right click on the small square coming from the iteration terminal on the right edge of the for loop and select "Disable Indexing."  This will cause it to only output the value that the iteration terminal is outputting when the for loop is stopped.  This index corresponds to one of the points that you'll be measuring slope from.  With a combination of array and numeric functions, you should be able to calculate various slope values for the data.

 

 

Regards,

Jared R.
Precision DC Product Support Engineer
National Instruments
0 Kudos
Message 7 of 7
(3,421 Views)