DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

CHNSMOOTH problems with 9.1

I've been given a script that works under 8.X but not under 9.1.  The script is to return the line number that contains the ChnValMin.  Here is the problem area:
 
Call CHNSMOOTH(2, 2, 30)
L10=0
R10=CHNVALMIN(2)
L10=Find("Ch(2)=R10" , L10+1)
msgbox chnname(2) & vblf & "ChanMin: " & R10 & vblf & "Line at: " & L10
 
The problem seems to lie in the CHNSmooth function, where it returns the value 1.03E-304!.  If I remove the smoothing function, the proper line number if found in the FIND funciton:
'Call CHNSMOOTH(2, 2, 30)
L10=0
R10=CHNVALMIN(2)
L10=Find("Ch(2)=R10" , L10+1)
msgbox chnname(2) & vblf & "ChanMin: " & R10 & vblf & "Line at: " & L10
 
I've done a comparison with different data files, as well as between 8.X and 9.10.2345 with SP2b; script engine 5.6.0.7426.
Is there something wrong here with the way the channels are calculated in the memory/Temp memory (as I overwrite the original channel with the smoothed data)?
 
Any help would be greatly appreciated.
 
Thanks in advance, Jeff
 
0 Kudos
Message 1 of 5
(3,184 Views)
Hi Jeff_B,

The problem seems to be not to calculate the channel chracteristics MIN/MAX in case of the command chnsmooth if the result will be stored in the original channel. You can solve that problem with command CHNCHARACTER(chnName) or by using a new result channel.

Using your syntax it can look like:

call datadelall
call DataFileLoad("Example.TDM")

Call CHNSMOOTH(2, 2, 30)
Call CHNCHARACTER(2)
L10=0
R10=CHNVALMIN(2)
L10=Find("Ch(2)=R10" , L10+1)

msgbox chnname(2) & vblf & "ChanMin: " & R10 & vblf & "Line at: " & L10


In DIAdem 9.1 that can look like:

call datadelall
call DataFileLoad("Example.TDM")

call CHNSMOOTH("[1]/Speed", "[1]/Speed_2", 30)
dChnMin = val(ChnPropGet("[1]/Speed_2", "minimum"))
iMyLineNo = pno("[1]/Speed_2", dChnMin)

msgbox chnname(2) & vblf & "ChanMin: " & dChnMin & vblf & "Line at: " & iMyLineNo

Greetings
Walter
0 Kudos
Message 2 of 5
(3,179 Views)

Thanks for the fast reply Walter.  I have one other question then:

Since this sequence has to run on both DIAdem 8.X and 9.X, is there a command to find the DIAdem version number ?

Again, thanks for all your help.

 

Jeff

0 Kudos
Message 3 of 5
(3,176 Views)
Hi Jeff_B,

Yes, the following variables will help you:

ProgramVersion, ProgramRevision, ProgramBuild

Greetings
Walter
0 Kudos
Message 4 of 5
(3,172 Views)
But in this particular case "ChnCharacter()" also would work in DIAdem 8.1
0 Kudos
Message 5 of 5
(3,166 Views)