DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to using Resampling a Channel?

I want to convert the values of some channels with frequency 5 HZ and transfer them to Excel. I wrote these codes but this error happens: Invalid channel in command ChnResampleFreqBased, Parameter [1]. Can someone tell me, where is the cause of error in code.
Thank you very much.

 

Dim oExcel,oWBook,oSheet,K,L,oGroup,lCol,oChn,DisplayType,Sfile
Set oExcel = CreateObject("Excel.Application")
oExcel.Visible = True
Call oExcel.Workbooks.Open("N:\01_IMO-Light\Test\DIAdem-Test.xlsx")
Set oWBook = oExcel.Activeworkbook
' we want just one sheet !
If ( 1 < oWBook.Sheets.Count ) Then
For K = 1 To oWBook.Sheets.Count-1
Call oWBook.Sheets(1).Delete
Next
End If
Set oSheet = oWBook.Sheets(1)

oSheet.Name = "DIAdem_Export"
'Set oSheet = oWBook.Sheets.Add
lCol = 1
For K = 1 To Data.Root.ChannelGroups.Count
Set oGroup = Data.Root.ChannelGroups(K)
For L = 1 To oGroup.Channels.Count
Set oChn = oGroup.Channels(L)
if oChn.Name = "Eng_Spd" or oChn.Name = "Eng_Trq" or oChn.Name = "Eng_Trq_indicated" or oChn.Name = "InjCrv_qSetUnBal" or oChn.Name ="Veh_Spd" then
if oChn.Name = "Eng_Spd" then
Call ChnResampleFreqBased("[K]/time","[K]/Eng_Spd","[K]/Eng_Spd",5,"Automatic",0,0)

Else
end if

oSheet.Cells(1,lCol) = oChn.Name
oSheet.Cells(2,lCol) = oGroup.Name
oSheet.Cells(3,lCol) = oChn.Properties("unit_string").Value
'Call ChannelToExcelColumnBlk(oChn,oExcel,oSheet,lCol,4)
lCol = lCol + 1
else
end if
Next
Next

 

 

0 Kudos
Message 1 of 3
(214 Views)
Highlighted
Do that: Call ChnResampleFreqBased("[" & K & "]/time","[" & K & "]/Eng_Spd","[" & K & "]/Eng_Spd",5,"Automatic",0,0) ' It doesn't like you using "K" variable as part of the text parameter... It reads it literally as "K" instead of "2" or "5" or whatever the group number is
Message 2 of 3
(200 Views)

Thank you  for replay ,best regards!

0 Kudos
Message 3 of 3
(195 Views)