03-03-2010 06:11 AM
Hello,
when performing a multibody simulation with a fix step size I recieve in the output data some additional values smaller than the normal increment or the values are duplicated. The time-channel looks like:
0
0.0002738
0.001
0.002
0.002
0.003
0.004
....
I think with a simple script I can delete the additional valuues (here 0.0002738, 0.002).
E suggest this code, but It doesn't work:
The problem is that sometimes the variable dif recieves the value 0.001 but anyway the value at this position is deleted. I don't know why.
I addedthe script and simulation data.
Thanks for help
Gabriel
Solved! Go to Solution.
03-03-2010 08:47 AM
Hello fischerg,
I think there is a more efficient way to do this. What version of DIAdem are you using ?
Or better, what is the oldest version of DIAdem this script should work with?
Andreas
03-03-2010 09:18 AM
Hello,
I use DIAdem 11.0. Sometimes I use 10.0, but it's not necessary that your solution works with this.
I'm curious what you suggest.
Gabriel
03-03-2010 09:51 AM
Hello Fischerg,
let me know how this works:
Option Explicit
Dim timechannel,CLength,CNumber,dBase,Epsilon,Limit,K,CurrValue,Delta
timechannel = "[1]/TIME"
CLength = Val(ChnPropGet(timechannel, "length"))
CNumber = CNo(timechannel)
Epsilon = 0.00001
Limit = 0.001 - Epsilon
dBase = CHDx(1,CNumber)
For K = 2 To CLength
CurrValue = CHDx(K,CNumber)
Delta = CurrValue-dBase
' Compare using Epsilon value. Comparing float numbers
' with "=" doesn't always work
If ( Delta < Limit ) Then
CHDx(K,CNumber) = NULL
Else
' Set new base
dBase = CurrValue
End If
Next
Call ChnCharacter(timechannel)
' remove tagged values. If there are more channels in parallel to the "TIME" channel,
' those can be adjusted with the same call. See ChnNovHandle online help for details
Call ChnNovHandle(timechannel,"","Delete","X",1,1,0)
03-03-2010 10:31 AM
Hello Andreas,
Thank you, it works very well.
Gabriel