DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Warum "StatBlockCalc" nicht funktioniert

Solved!
Go to solution

Hallo zusammen,

Meine Frage ist ganz kurz. Warum StatBlockCalc Funktion in meinem Programm nicht korrekten Betrieb?

In Loop-Schleife zeigt immer gleiches Ergebnis (den maximalen/minimalen Wert der ersten Operation).

Danke


 

Option Explicit  'Erzwingt die explizite Deklaration aller Variablen in einem Script.
Dim iLoop, max_360, min_360, delta_360
iLoop = 1      
Dim I

Do

  'delta_360 = 0
  'max_360 = 0
  'min_360 = 0
  Call DataBlCopy("'evaluation_torque_CCW'",iLoop,31448/2,"[2]/360°_CCW",1)
  'Call Pause(0.5)                                        
  For I = 1 To 23
  StatSel(I) = "No"
  Next
  StatSel(4) = "Yes" ' Minimum
  StatSel(5) = "Yes" ' Maximum
  StatClipCopy     = 0
  StatClipValue    = 0
  StatFormat       = ""
  StatResChn       = 0
  Call StatBlockCalc("Channel","1-","[2]/360°_CCW") '... StatDirec,RowNoStr,ChnNoStr
  max_360=str(Data.Root.ChannelGroups(2).Channels("360°_CCW").Properties("maximum").Value)    
  min_360=str(Data.Root.ChannelGroups(2).Channels("360°_CCW").Properties("minimum").Value)      
  'max_360=str(Data.Root.ChannelGroups(2).Channels("360°_CCW").Values(100))    
  'min_360=str(Data.Root.ChannelGroups(2).Channels("360°_CCW").Values(5000))  
  max_360=val(max_360)
  min_360=val(min_360)
  delta_360=max_360-min_360
  delta_360= round (delta_360,4)
  Call DataBlInsertVal("[2]/360°_peak_CCW", 1, 1, delta_360)
  iLoop = iLoop + 500                                 'index add 1 for next loop
Loop until (iLoop >=31448/4)
0 Kudos
Message 1 of 3
(4,305 Views)
Solution
Accepted by J.Huang

Hallo J.Huang,

 

wenn ich das richtig sehe, soll in einem Kanal blockweise die Differenz zwischen Min und Max berechnet werden. Wenn das richtig ist, könnte man das so lösen:

 

Dim iLoop, iLoopRes, max_360, min_360, delta_360, oResChn, iStepWidth, iChnLen

set oResChn = Data.Root.ChannelGroups(2).Channels.Add("360°_peak_CCW", DataTypeFloat64)
iChnLen = Data.GetChannel("[1]/evaluation_torque_CCW").Size
iStepWidth = 31448/2
For iLoop = 1 To 23
  StatSel(iLoop) = "No"
Next
StatSel(4) = "Yes" ' Minimum
StatSel(5) = "Yes" ' Maximum
StatClipCopy     = 0
StatClipValue    = 0
StatFormat       = ""
StatResChn       = 0

iLoop    = 1  
iLoopRes = 1
Do
  Call StatBlockCalc("Channel", str(iLoop) & "-" & str(iLoop + iStepWidth),"[1]/evaluation_torque_CCW") 
  max_360 = val(StatTxt2(5)) 
  min_360 = val(StatTxt2(4))
  delta_360=max_360-min_360
  delta_360= round (delta_360,4)
  oResChn(iLoopRes) = delta_360
  iLoop = iLoop + 500                                 'index add 1 for next loop
  iLoopRes = iLoopRes + 1
'Loop until (iLoop >= iStepWidth / 2)        ' bis akt. Kanalposition > iStepWidth / 2
Loop until ((iLoop + iStepWidth) > iChnLen)  ' bis Kanalende

Gruß

Walter

Message 2 of 3
(4,296 Views)

Hi Walter,

 

vielen Danke! Das Problem ist gelöst.

 

Gruß

Jie

0 Kudos
Message 3 of 3
(4,290 Views)