05-13-2020 07:53 AM
I normally use histograms to make an overview how much torque is applied during various tests.
In these tests the speeds are stable, so the number of applied forces to each gear teeth can be easily calculated with the standard histogram function.
Now i do a number of tests with variating speeds, so i can not just count the number samples per bin (what the histogram basically does).
Problem is that for each sample the speed is different and for that the number of loaded teeth in different. Is there a way to automate this? Or do i need to make a new "advance" histogram function where i can add a calculate a value to add in the histogram in stead of always counting one up?
Solved! Go to Solution.
05-22-2020 03:02 PM
Hi ServieBaart,
What measurements are you making directly? Are you using the speed measurements to calculate the torque, or do you have a sensor that returns the instantaneous torque?
Are you wanting to graph the resultant torque on the Y axis vs. the elapsed time on the X axis? Can you post a data set for us to look at?
Brad Turpin
Senior Technical Support Engineer
National Instruments
05-25-2020 04:50 AM
Hi Brad,
Many thanks for the reply!
In this case we are measuring the torque and speed via HBM sensors on the output of a differential.
Result I want to have is:
On the X axis I normally have bins defined in ranges of 5 to 25 Nm.
On the Y axis the amount of times that torque occurred on a gear (number of rotations), but this is variable in time so a simple histogram will not work.
This is the torque and speed of one cycle: (data in attachment)
Best regards,
Servie Baart
Test Engineer
05-27-2020 11:31 AM
Hi Servie Baart,
Would it help to cast the graph you posted to one with the X axis being Angle (Theta) instead of Time? Then your histogram would show the instances by angle increments instead of instances by time increments? This is similar to an order analysis where the instantaneous speed is taken into account.
Brad Turpin
Senior Technical Support Engineer
National Instruments
02-02-2021 04:50 AM
Sorry for the late reply,
I eventually did it slightly different but your comment on using the angle realy helpen.
I made my own "function" by checking each sample apart and repeat it until i did a complete log file.
The speed [rpm] is divided by (60 * sample rate) to come to say "revs / sample". (so not angle to prevent another change of metric)
Then i check in what bin the torque is during that sample and add the number of revelations during that sample to that bin.
Eventually the Binned values are stored in te signal "BinTorqueResults" and that i use to make eventually a nice histogram.
At first i though that the script would take ages to run 1 file, but it runs fast in my opinion.
(A file with a length of 1.200.000 sample is checked under 5 seconds.)
Code looks like this:
For RowCounter = 1 To Data.Root.ChannelGroups(1).Channels("DiffTorque").Properties("length").Value
TorqueValue = Data.Root.ChannelGroups(1).Channels("DiffTorque").Values (RowCounter)
SpeedValue = Data.Root.ChannelGroups(1).Channels("DiffSpeed").Values (RowCounter)
SpeedValue = SpeedValue / (60 * 1000)
If (TorqueValue > 2850) Then
Bin1 = Bin1 + SpeedValue
elseIf (TorqueValue > 2650) Then
Bin2 = Bin2 + SpeedValue
elseIf (TorqueValue > 2450) Then
Bin3 = Bin3 + SpeedValue
elseIf (TorqueValue > 2250) Then
Bin4 = Bin4 + SpeedValue
elseIf (TorqueValue > 2050) Then
Bin5 = Bin5 + SpeedValue
elseIf (TorqueValue > 1850) Then
Bin6 = Bin6 + SpeedValue
elseIf (TorqueValue > 1650) Then
Bin7 = Bin7 + SpeedValue
elseIf (TorqueValue > 1450) Then
Bin8 = Bin8 + SpeedValue
elseIf (TorqueValue > 1250) Then
Bin9 = Bin9 + SpeedValue
elseIf (TorqueValue > 1050) Then
Bin10 = Bin10 + SpeedValue
elseIf (TorqueValue > 850) Then
Bin11 = Bin11 + SpeedValue
elseIf (TorqueValue > 650) Then
Bin12 = Bin12 + SpeedValue
elseIf (TorqueValue > 450) Then
Bin13 = Bin13 + SpeedValue
elseIf (TorqueValue > 250) Then
Bin14 = Bin14 + SpeedValue
elseIf (TorqueValue > 0) Then
Bin15 = Bin15 + SpeedValue
' else
' BinRest = BinRest + SpeedValue 'For checking if all revelations are processed
End If
Next
Call Data.Root.ChannelGroups(1).Channels.Add("BinTorqueResults",DataTypeFloat64,1)
Data.Root.ChannelGroups(1).Channels("BinTorqueResults").Values (1) = Bin1
Data.Root.ChannelGroups(1).Channels("BinTorqueResults").Values (2) = Bin2
Data.Root.ChannelGroups(1).Channels("BinTorqueResults").Values (3) = Bin3
Data.Root.ChannelGroups(1).Channels("BinTorqueResults").Values (4) = Bin4
Data.Root.ChannelGroups(1).Channels("BinTorqueResults").Values (5) = Bin5
Data.Root.ChannelGroups(1).Channels("BinTorqueResults").Values (6) = Bin6
Data.Root.ChannelGroups(1).Channels("BinTorqueResults").Values (7) = Bin7
Data.Root.ChannelGroups(1).Channels("BinTorqueResults").Values (8) = Bin8
Data.Root.ChannelGroups(1).Channels("BinTorqueResults").Values (9) = Bin9
Data.Root.ChannelGroups(1).Channels("BinTorqueResults").Values (10) = Bin10
Data.Root.ChannelGroups(1).Channels("BinTorqueResults").Values (11) = Bin11
Data.Root.ChannelGroups(1).Channels("BinTorqueResults").Values (12) = Bin12
Data.Root.ChannelGroups(1).Channels("BinTorqueResults").Values (13) = Bin13
Data.Root.ChannelGroups(1).Channels("BinTorqueResults").Values (14) = Bin14
Data.Root.ChannelGroups(1).Channels("BinTorqueResults").Values (15) = Bin15