Global $sql= GetSQLConnection()
;~ MsgBox(0,"",$sql)
-;~ $num = ReturnNumSuitRuns("34", 5, 0, "Fe55", "PXI")
+;$num = ReturnNumSuitRuns("34", 6, 0, "Fe55", "PXI")
+; ReturnSuitRun("34", 6, 0, "Fe55", "PXI")
;~ MsgBox(0,"",$num)
;~ $var= ReturnSuitRun("34", 3, 3, "Fe55", "USB")
;~ If $var[0] = "" Then MsgBox(0, "", "Hello")
"RadiationSource='" & $RadiationSource & "' AND " & _
"ChipRadiation=" & $ChipRadiation & " AND " & _
"System='" & $System & "' AND " & _
- "datetime='1970-01-01 00:00:00' OR datetime IS NULL OR datetime='0000-00-00 00:00:00'"
+ "(datetime='1970-01-01 00:00:00' OR datetime IS NULL OR datetime='0000-00-00 00:00:00')"
If $clock <> 0 Then $sqlstring = $sqlstring & " AND Clock=" & $Clock
$number = _CountDifferentRecords($sql, "labbook", "id", $sqlstring)
$sql = GetSQLConnection()
$ChipGen = StringReplace($ChipGen, "Mi", "", 1, 0)
- $sqlstring = "SELECT id, CAST(TempCooling AS CHAR), TempWaitFor, Clock, runnumber, CAST(Matrix AS CHAR), Events FROM labbook WHERE "
+ $sqlstring = "SELECT id, TempCooling, TempWaitFor, Clock, runnumber, CAST(Matrix AS CHAR), Events FROM labbook WHERE "
$sqlstring = $sqlstring & "ChipGen='" & $ChipGen & "' AND "
$sqlstring = $sqlstring & "ChipNum='" & $ChipNum & "' AND "
$sqlstring = $sqlstring & "RadiationSource='" & $RadiationSource & "' AND "
$sqlstring = $sqlstring & "ChipRadiation=" & $ChipRadiation & " AND "
$sqlstring = $sqlstring & "System='" & $System & "' AND "
- $sqlstring = $sqlstring & "datetime='1970-01-01 00:00:00' OR datetime IS NULL OR datetime='0000-00-00 00:00:00'"
+ $sqlstring = $sqlstring & "(datetime='1970-01-01 00:00:00' OR datetime IS NULL OR datetime='0000-00-00 00:00:00')"
If $clock <> 0 Then $sqlstring = $sqlstring & " AND Clock=" & $Clock
$sqlstring = $sqlstring & " LIMIT 1"
;~ ConsoleWrite($sqlstring & @CRLF)
If NOT $var.EOF Then
With $var
$runparam[0] = .Fields("id").value
- $runparam[1] = .Fields("CAST(TempCooling AS CHAR)").value
+ $runparam[1] = .Fields("TempCooling").value
$runparam[2] = .Fields("TempWaitFor").value
$runparam[3] = .Fields("Clock").value
$runparam[4] = .Fields("runnumber").value
#include "Functions\Checkdata.au3"
Global $vref = 1000 ; Initial vref, will be adjusted during runtime
-If (Not @error) And IsObj($oExcelDoc) Then ; Check again if everything went well
- ; NOTE: $oExcelDoc is a "Workbook Object", not Excel itself!
- $oDocument = $oExcelDoc.Worksheets(1) ; We use the 'Default' worksheet
- $aArray = $oDocument.range($CellRange).value ; Retrieve the cell values from given range
- ;$oExcelDoc.Close ; Close the Excel document
- ; The data should now be in the 2-dimensional array: $aArray
- If IsArray($aArray) And UBound($aArray, 0) > 0 Then ; Check if we retrieved any data
- $totallexcelines = UBound($aArray, 2)
- $totalruns = 0
- For $run = 0 To UBound($aArray, 2) - 1
- If ($aArray[$cellChipN][$run] == $chipinstalled And "Mi" & $aArray[$cellChipV][$run] == $chipversion And $aArray[$cellRadSrc][$run] == $radSource And $aArray[$cellRad][$run] == $radiated And $aArray[$cellDate][$run] == "" And $aArray[$cellSystem][$run] == "PXI" And ($aArray[$cellClock][$run] == "100" Or $aArray[$cellClock][$run] == "")) Then
- $totalruns = $totalruns + 1
- EndIf
- Next
+
+If (Not @error) Then ; Check again if everything went well
+ $totalruns = ReturnNumSuitRuns($chipversion, $chipinstalled, $radiated, $radSource, "PXI", "100")
+ If $totalruns > 0 Then ; Check if we retrieved any data
Local $answer = MsgBox(4, "Total runs", "Number of suitable runs found at the moment: " & $totalruns)
If $answer = 7 Then
Exit
$estimate = 0
$totalrealruns = 0
$starttimetotal = _NowCalc()
- For $run = 0 To $totallexcelines - 1
- $currentrange = "A" & $excelLineBegin + $run & ":Q" & $excelLineBegin + $run
- $oExcelDoc = ObjGet($FileName) ; if doc was closed and object destroyed -> reopen it. A possibility to check if object exists would come handy here....
- $oDocument = $oExcelDoc.Worksheets(1) ; We use the 'Default' worksheet
- $currentline = $oDocument.range($currentrange).value
- If ($currentline[$cellChipN][0] == $chipinstalled And "Mi" & $currentline[$cellChipV][0] == $chipversion And $currentline[$cellRadSrc][0] == $radSource And $currentline[$cellRad][0] == $radiated And $currentline[$cellDate][0] == "" And $currentline[$cellSystem][0] == "PXI" And ($currentline[$cellClock][0] == "100" Or $currentline[$cellClock][0] == "")) Then
- #include "Functions\ReadAndSaveExcelParameters.au3"
- #include "Functions\WaitForTemperature.au3"
- SetMiParameter($matrix, $vref)
- ProgramMi()
- Sleep(200)
- $vi.SetControlValue("Run directory", $savedir) ; get directorys to save file to
- $vi.SetControlValue("Run Number", $runnum)
- $vi.SetControlValue("Events number in run", $eventnum)
- $vi.SetControlValue("Events number/ file", "20000")
- Sleep(100)
- $starttime = _NowCalc()
- StartRun()
- Sleep(1000)
- $vi.SetControlValue("Process Stat", "1")
- Sleep(2000)
- $avg = 0
- $avgarr = $vi.GetControlValue("Mean (Ch0-15)")
- For $iavg = 0 To UBound($avgarr) - 1
- $avg = $avg + $avgarr[$iavg]
- Next
- $avg = $avg / UBound($avgarr)
- $j = 0
- If ($avg > 1000 Or $avg < -1000) Then
- Do
+ $suitrun = ReturnSuitRun($chipversion, $chipinstalled, $radiated, $radSource, "PXI", "100")
+ While Not $suitrun[0] = "" ; Do runs, until no new run found
+ #include "Functions\ReadAndSaveSQLParameters.au3"
+ #include "Functions\WaitForTemperature.au3"
+ SetMiParameter($matrix, $vref)
+ ProgramMi()
+ Sleep(200)
+ $vi.SetControlValue("Run directory", $savedir) ; get directorys to save file to
+ $vi.SetControlValue("Run Number", $runnumber)
+ $vi.SetControlValue("Events number in run", $events)
+ $vi.SetControlValue("Events number/ file", "20000")
+ Sleep(100)
+ $starttime = _NowCalc()
+ StartRun()
+ Sleep(1000)
+ $vi.SetControlValue("Process Stat", "1")
+ Sleep(2000)
+ $avg = 0
+ $avgarr = $vi.GetControlValue("Mean (Ch0-15)")
+ For $iavg = 0 To UBound($avgarr) - 1
+ $avg = $avg + $avgarr[$iavg]
+ Next
+ $avg = $avg / UBound($avgarr)
+ $j = 0
+ If ($avg > 1000 Or $avg < -1000) Then
+ Do
+ StopRun()
+ Sleep(2000)
+ $vref = $vi.GetControlValue("VRef")
+ $diff = $avg
+ Select
+ Case Abs($diff) > 12000
+ $vref = $vref + SGN($diff) * 100
+ Case Abs($diff) > 6000
+ $vref = $vref + SGN($diff) * 50
+ Case Abs($diff) > 1000
+ $vref = $vref + SGN($diff) * 10
+ Case Else
+ $vref = $vref + SGN($diff) * 5
+ EndSelect
+ If ($vref > 1500 Or $vref < 300) Then
+ StopRun()
+ RefreshGUISendNtfct("Skipped run " & $runnumber & ", vref value could not be set properly. Frequency: " & $clock)
+ Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(48, ''Warning'', ''Skipped run ' & $runnumber & ', vref value needs to be too low (<300) or too high (>1500), please check manually!'')"')
+ FileDelete($savedir & "\" & $runnumber & "\*")
+ $vref = 1000
+ ContinueLoop 2
+ EndIf
+ $vi.SetControlValue("VRef", $vref)
+ ProgramMi()
+ StartRun()
+ Sleep(2000)
+ $avg = 0
+ $avgarr = $vi.GetControlValue("Mean (Ch0-15)")
+ For $iavg = 0 To UBound($avgarr) - 1
+ $avg = $avg + $avgarr[$iavg]
+ Next
+ $avg = $avg / UBound($avgarr)
+ Sleep(100)
+ $j = $j + 1
+ If ($j > 12) Then
StopRun()
- Sleep(2000)
- $vref = $vi.GetControlValue("VRef")
- $diff = $avg
- Select
- Case Abs($diff) > 12000
- $vref = $vref + SGN($diff) * 100
- Case Abs($diff) > 6000
- $vref = $vref + SGN($diff) * 50
- Case Abs($diff) > 1000
- $vref = $vref + SGN($diff) * 10
- Case Else
- $vref = $vref + SGN($diff) * 5
- EndSelect
- If ($vref > 1500 Or $vref < 300) Then
- StopRun()
- RefreshGUISendNtfct("Skipped run " & $runnum & ", vref value could not be set properly. Frequency: " & $clock )
- Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(48, ''Warning'', ''Skipped run ' & $runnum & ', vref value needs to be too low (<300) or too high (>1500), please check manually!'')"')
- FileDelete($savedir & "\" & $runnum & "\*")
- $vref = 1000
- ContinueLoop 2
- EndIf
- $vi.SetControlValue("VRef", $vref)
- ProgramMi()
- StartRun()
- Sleep(2000)
- $avg = 0
- $avgarr = $vi.GetControlValue("Mean (Ch0-15)")
- For $iavg = 0 To UBound($avgarr) - 1
- $avg = $avg + $avgarr[$iavg]
- Next
- $avg = $avg / UBound($avgarr)
- Sleep(100)
- $j = $j + 1
- If ($j > 12) Then
- StopRun()
- RefreshGUISendNtfct("Skipped run " & $runnum & ", vref value could not be set properly. Frequency: " & $clock )
- Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(48, ''Warning'', ''Skipped run ' & $runnum & ', vref value needs to be too low (<300) or too high (>1500), please check manually!'')"')
- FileDelete($savedir & "\" & $runnum & "\*")
- $vref = 1000
- ContinueLoop 2
- EndIf
- Until ($avg < 1000 And $avg > -1000)
- EndIf
- $vi.SetControlValue("Process Stat", "0")
- #include "Functions\Watchrun.au3"
- StopRun()
- Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\MoveFolder.au3" "' & $savedir & '\' & $runnum & '" "' & $storedir & '\' & $runnum & '"')
- #include "Functions\SaveToExcel.au3"
- $totalrealruns = $totalrealruns + 1
- $completelog &= _NowCalc() & " Completed run " & $runnum & ", " & $percentoverall & "% (" & $totalrealruns & "/" & $totalruns & ")" & @CRLF
- Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUI.au3" "' & $completelog & '"')
+ RefreshGUISendNtfct("Skipped run " & $runnumber & ", vref value could not be set properly. Frequency: " & $clock)
+ Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(48, ''Warning'', ''Skipped run ' & $runnumber & ', vref value needs to be too low (<300) or too high (>1500), please check manually!'')"')
+ FileDelete($savedir & "\" & $runnumber & "\*")
+ $vref = 1000
+ ContinueLoop 2
+ EndIf
+ Until ($avg < 1000 And $avg > -1000)
EndIf
- Next
+ $vi.SetControlValue("Process Stat", "0")
+ #include "Functions\Watchrun.au3"
+ StopRun()
+;~ Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\MoveFolder.au3" "' & $savedir & '\' & $runnumber & '" "' & $storedir & '\' & $runnumber & '"')
+ Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\MoveFolder.au3" "' & $savedir & '" "' & $storedir & '" "' & $runnumber & '"')
+ #include "Functions\SaveToSQL.au3"
+ $totalrealruns = $totalrealruns + 1
+ $completelog &= _NowCalc() & " Completed run " & $runnumber & ", " & $percentoverall & "% (" & $totalrealruns & "/" & $totalruns & ")" & @CRLF
+ Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUI.au3" "' & $completelog & '"')
+ $suitrun = ReturnSuitRun($chipversion, $chipinstalled, $radiated, $radSource, "PXI", "100")
+ WEnd
#include "Functions\PrintSucessMessage.au3"
Else
- MsgBox(16, "Excel Data Test", "Error: Could not retrieve data from cell range: " & $CellRange)
- Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\SendNtfctn.au3" "' & $system & '" "Could not retrieve data from cell range"', @ScriptDir)
+ MsgBox(16, "SQL Data Test", "No suitable runs found")
EndIf
Else
- MsgBox(16, "Excel Data Test", "Error: Could not open " & $FileName & " as an Excel Object.")
- Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\SendNtfctn.au3" "' & $system & '" "Could not open ' & $FileName & ' as an Excel Object."', @ScriptDir)
+ MsgBox(16, "Server fail", "Error: Could not open connection to mySQL server.")
EndIf
-$oExcelDoc = 0
Func SGN($i)
Return ($i > 0) - ($i < 0)
EndFunc ;==>SGN
; Automatically runs the USB or PXI system with data gathered from an Excel sheet
$configfile = @ScriptDir & "\config_USB.ini"
#include "Functions\Header.au3"
+#include "Chips\Mimosa29.au3"
#include "Chips\Mimosa32.au3"
#include "Chips\Mimosa32Ter.au3"
#include "Chips\Mimosa34.au3"
Func SelectBoard()
Call($chipversion & "_SelectBoard")
EndFunc ;==>SelectBoard
+Func _CheckWindowExist() ; Check if Mimosa window exists
+ If $chipversion <> "Mi29" Then
+ CheckWindowExist()
+ EndIf
+EndFunc ;==>_CheckWindowExist
+Func _CheckIfBoardOK()
+ If $chipversion <> "Mi29" Then
+ CheckIfBoardOK()
+ EndIf
+EndFunc ;==>_CheckIfBoardOK
+Func _GotoTab($tabnum)
+ If $chipversion <> "Mi29" Then
+ GotoTab($tabnum)
+ EndIf
+EndFunc ;==>_GotoTab
+Func _GotoDebugTab()
+ If $chipversion <> "Mi29" Then
+ GotoDebugTab()
+ EndIf
+EndFunc ;==>_GotoDebugTab
+Func _ProgramMi()
+ If $chipversion <> "Mi29" Then
+ ProgramMi()
+ EndIf
+EndFunc ;==>_ProgramMi
+Func _TestSystem()
+ If $chipversion <> "Mi29" Then
+ TestSystem()
+ Else ; mimosa 20 ausnahme
+ Call($chipversion & "_TestSystem")
+ EndIf
+EndFunc ;==>_TestSystem
+Func _GetAverage($hWnd)
+ If $chipversion <> "Mi29" Then
+ Return GetAverage($hWnd)
+ Else ; mimosa 20 ausnahme
+ Return Call($chipversion & "_GetAverage", $hWnd)
+ EndIf
+EndFunc ;==>_GetAverage
-If (Not @error) And IsObj($oExcelDoc) Then ; Check again if everything went well
- ; NOTE: $oExcelDoc is a "Workbook Object", not Excel itself!
- $oDocument = $oExcelDoc.Worksheets(1) ; We use the 'Default' worksheet
- $aArray = $oDocument.range($CellRange).value ; Retrieve the cell values from given range
- ;$oExcelDoc.Close ; Close the Excel document
- ; The data should now be in the 2-dimensional array: $aArray
- If IsArray($aArray) And UBound($aArray, 0) > 0 Then ; Check if we retrieved any data
- $totallexcelines = UBound($aArray, 2)
- $totalruns = 0
- For $run = 0 To UBound($aArray, 2) - 1
- If ($aArray[$cellChipN][$run] == $chipinstalled And "Mi" & $aArray[$cellChipV][$run] == $chipversion And $aArray[$cellRadSrc][$run] == $radSource And $aArray[$cellRad][$run] == $radiated And $aArray[$cellDate][$run] == "" And $aArray[$cellSystem][$run] == "USB") Then
- $totalruns = $totalruns + 1
- EndIf
- Next
+
+If (Not @error) Then ; Check again if everything went well
+ $totalruns = ReturnNumSuitRuns($chipversion, $chipinstalled, $radiated, $radSource, "USB")
+ If $totalruns > 0 Then ; Check if we retrieved any data
Local $answer = MsgBox(4, "Total runs", "Number of suitable runs found at the moment: " & $totalruns)
If $answer = 7 Then
Exit
EndIf
Local $sTitle = "CMOS USB DAQ V3.5.10"
Run("C:\ccmos_daq\v3.5.10\daq_v3.5.10.bat", "C:\ccmos_daq\v3.5.10\")
- If TestSystem() Then Exit
+ If _TestSystem() Then Exit
WinWait($sTitle)
$hWnd = WinGetHandle($sTitle)
$hTab = ControlGetHandle($hWnd, "", "TPageControl1")
$hCounter = ControlGetHandle($hWnd, "", "TEdit25")
- $aArray = 0
- $estimate = 0
- $totalrealruns = 0
$starttimetotal = _NowCalc()
- For $run = 0 To $totallexcelines - 1
- $currentrange = "A" & $excelLineBegin + $run & ":Q" & $excelLineBegin + $run
- $oExcelDoc = ObjGet($FileName) ; if doc was closed and object destroyed -> reopen it. A possibility to check if object exists would come handy here....
- $oDocument = $oExcelDoc.Worksheets(1) ; We use the 'Default' worksheet
- $currentline = $oDocument.range($currentrange).value
- If ($currentline[$cellChipN][0] == $chipinstalled And "Mi" & $currentline[$cellChipV][0] == $chipversion And $currentline[$cellRadSrc][0] == $radSource And $currentline[$cellRad][0] == $radiated And $currentline[$cellDate][0] == "" And $currentline[$cellSystem][0] == "USB") Then
- #include "Functions\ReadAndSaveExcelParameters.au3"
- #include "Functions\WaitForTemperature.au3"
- CheckWindowExist()
- SelectBoard()
- CheckIfBoardOK()
- ControlCommand("I2C control Software for Mimosa32", "", "[TEXT:Intern]", "Check")
- If ($clock <> "100") Then
- SetChipClock( $clock )
- ControlCommand("I2C control Software for Mimosa32", "", "[TEXT:Extern]", "Check")
- EndIf
- GotoMiTab()
- SetMiParameter($matrix, $vref)
- ProgramMi()
- _GUICtrlTab_SetCurFocus($hTab, 2) ; Go to "Run parameter" tab
- Sleep(200)
- $savedir = ControlGetText($hWnd, "", "TEdit24") ; get directorys to save file to
- ControlSetText($hWnd, "", "TEdit23", "")
- Sleep(100)
- ControlFocus($hWnd, "", "TEdit23")
- ControlSend($hWnd, "", "TEdit23", $runnum)
- Sleep(100)
- ControlSetText($hWnd, "", "TEdit22", "")
- Sleep(100)
- ControlFocus($hWnd, "", "TEdit22")
- ControlSend($hWnd, "", "TEdit22", $eventnum)
- Sleep(100)
- ControlFocus($hWnd, "", "TEdit23")
- Sleep(1000)
- $starttime = _NowCalc()
- StartRun()
- Sleep(1000)
- If (WinExists("Avertissement")) Then
- RefreshGUISendNtfct("Skipped run " & $runnum & " could overwrite data." )
- Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(48, ''Warning'', ''Skipped run ' & $runnum & ', could overwrite data!'')"')
- ControlClick("Avertissement", "", "TButton1")
- ;FileDelete($savedir & "/" & $runnum & "/*")
- ContinueLoop
- EndIf
- ;_GUICtrlTab_SetCurFocus($hTab, 4) ; Go to "Local monitoring" tab ; not needed
- $avg = ControlGetText($hWnd, "", "[TEXT:DispAvg;CLASS:TEdit]")
- ;MsgBox(0, "Message", $avg)
+ $suitrun = ReturnSuitRun($chipversion, $chipinstalled, $radiated, $radSource, "USB")
+ While Not $suitrun[0] = "" ; Do runs, until no new run found
+ #include "Functions\ReadAndSaveSQLParameters.au3"
+ #include "Functions\WaitForTemperature.au3"
+ _CheckWindowExist()
+ SelectBoard()
+ _CheckIfBoardOK()
+ ControlCommand("I2C control Software for Mimosa32", "", "[TEXT:Intern]", "Check")
+ If ($clock <> "100") Then
+ SetChipClock($clock)
+ ControlCommand("I2C control Software for Mimosa32", "", "[TEXT:Extern]", "Check")
+ EndIf
+ GotoMiTab()
+ SetMiParameter($matrix, $vref)
+ ProgramMi()
+ _GUICtrlTab_SetCurFocus($hTab, 2) ; Go to "Run parameter" tab
+ Sleep(200)
+ $savedir = ControlGetText($hWnd, "", "TEdit24") ; get directorys to save file to
+ ControlSetText($hWnd, "", "TEdit23", "")
+ Sleep(100)
+ ControlFocus($hWnd, "", "TEdit23")
+ ControlSend($hWnd, "", "TEdit23", $runnumber)
+ Sleep(100)
+ ControlSetText($hWnd, "", "TEdit22", "")
+ Sleep(100)
+ ControlFocus($hWnd, "", "TEdit22")
+ ControlSend($hWnd, "", "TEdit22", $events)
+ Sleep(100)
+ ControlFocus($hWnd, "", "TEdit23")
+ Sleep(1000)
+ $starttime = _NowCalc()
+ StartRun()
+ Sleep(1000)
+ If (WinExists("Avertissement")) Then
+ RefreshGUISendNtfct("Skipped run " & $runnumber & " could overwrite data.")
+ Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(48, ''Warning'', ''Skipped run ' & $runnumber & ', could overwrite data!'')"')
+ ControlClick("Avertissement", "", "TButton1")
+ ContinueLoop
+ EndIf
+ $avg = _GetAverage($hWnd)
- ;_GUICtrlTab_SetCurFocus($hTab, 2) ; Go to "Run parameter" tab
- Sleep(200)
- $j = 0
- If ($avg > 2300 Or $avg < 1700) Then
- Do
- ControlClick($hWnd, "", "[TEXT:Stop Run;CLASS:TButton]")
- ;WinActivate("I2C control Software for Mimosa32")
- $vref = GetVref()
- ;$vref = ControlGetText("I2C control Software for Mimosa32", "", "TEdit11")
- $diff = $avg - 2000
- Select
- Case Abs($diff) > 600
- $vref = $vref + SGN($diff) * 100
- Case Else
- $vref = $vref + SGN($diff) * 50
- EndSelect
- If ($vref > 1000 Or $vref < 300) Then
- StopRun()
- RefreshGUISendNtfct("Skipped run " & $runnum & ", vref value could not be set properly. Frequency: " & $clock )
- Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(48, ''Warning'', ''Skipped run ' & $runnum & ', vref value needs to be too low (<300) or too high (>1000), please check manually!'')"')
- FileDelete($savedir & "/" & $runnum & "/*")
- $vref = 650
- ContinueLoop 2
- EndIf
- SetVref($vref)
- ProgramMi()
- WinWait($hWnd)
- ;_GUICtrlTab_SetCurFocus($hTab, 2) ; Go to "Run parameter" tab
- StartRun()
- WinWait("Avertissement")
- ControlClick("Avertissement", "", "TButton2")
- Sleep(1000)
- $avg = ControlGetText($hWnd, "", "[TEXT:DispAvg;CLASS:TEdit]")
- Sleep(100)
- $j = $j + 1
- If ($j > 10) Then
- StopRun()
- RefreshGUISendNtfct("Skipped run " & $runnum & ", vref value could not be set properly. Frequency: " & $clock )
- Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(48, ''Warning'', ''Skipped run ' & $runnum & ', vref value needs to be too low (<300) or too high (>1000), please check manually!'')"')
- FileDelete($savedir & "/" & $runnum & "/*")
- $vref = 650
- ContinueLoop 2
- EndIf
- Until ($avg < 2300 And $avg > 1700)
- EndIf
- #include "Functions\Watchrun.au3"
- _GUICtrlTab_SetCurFocus($hTab, 2) ; Go to "Run parameter" tab
- Sleep(100)
- StopRun()
- #include "Functions\SaveToExcel.au3"
- $totalrealruns = $totalrealruns + 1
- $completelog &= _NowCalc() & " Completed run " & $runnum & ", " & $percentoverall & "% (" & $totalrealruns & "/" & $totalruns & ")" & @CRLF
- Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUI.au3" "' & $completelog & '"')
+ Sleep(200)
+ $j = 0
+ If ($avg > 2300 Or $avg < 1700) Then
+ Do
+ ControlClick($hWnd, "", "[TEXT:Stop Run;CLASS:TButton]")
+ $vref = GetVref()
+ $diff = $avg - 2000
+ Select
+ Case Abs($diff) > 600
+ $vref = $vref + SGN($diff) * 100
+ Case Else
+ $vref = $vref + SGN($diff) * 50
+ EndSelect
+ If ($vref > 1000 Or $vref < 300) Then
+ StopRun()
+ RefreshGUISendNtfct("Skipped run " & $runnumber & ", vref value could not be set properly. Frequency: " & $clock)
+ Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(48, ''Warning'', ''Skipped run ' & $runnumber & ', vref value needs to be too low (<300) or too high (>1000), please check manually!'')"')
+ FileDelete($savedir & "/" & $runnumber & "/*")
+ $vref = 650
+ ContinueLoop 2
+ EndIf
+ SetVref($vref)
+ _ProgramMi()
+ WinWait($hWnd)
+ ;_GUICtrlTab_SetCurFocus($hTab, 2) ; Go to "Run parameter" tab
+ StartRun()
+ WinWait("Avertissement")
+ ControlClick("Avertissement", "", "TButton2")
+ Sleep(1000)
+ $avg = ControlGetText($hWnd, "", "[TEXT:DispAvg;CLASS:TEdit]")
+ Sleep(100)
+ $j = $j + 1
+ If ($j > 10) Then
+ StopRun()
+ RefreshGUISendNtfct("Skipped run " & $runnumber & ", vref value could not be set properly. Clock: " & $clock & " Mhz")
+ Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(48, ''Warning'', ''Skipped run ' & $runnumber & ', vref value needs to be too low (<300) or too high (>1000), please check manually!'')"')
+ FileDelete($savedir & "/" & $runnumber & "/*")
+ $vref = 650
+ ContinueLoop 2
+ EndIf
+ Until ($avg < 2300 And $avg > 1700)
EndIf
- Next
+ #include "Functions\Watchrun.au3"
+ _GUICtrlTab_SetCurFocus($hTab, 2) ; Go to "Run parameter" tab
+ Sleep(100)
+ StopRun()
+ #include "Functions\SaveToSQL.au3"
+ $totalrealruns = $totalrealruns + 1
+ $completelog &= _NowCalc() & " Completed run " & $runnumber & ", " & $percentoverall & "% (" & $totalrealruns & "/" & $totalruns & ")" & @CRLF
+ Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUI.au3" "' & $completelog & '"')
+ $suitrun = ReturnSuitRun($chipversion, $chipinstalled, $radiated, $radSource, "USB")
+ ConsoleWrite($suitrun[0])
+ WEnd
ControlCommand("I2C control Software for Mimosa32", "", "[TEXT:Intern]", "Check")
ShellExecuteWait("C:\Programme\PuTTY\plink.exe", "-ssh cerberus /home/maps/bin/vxi11_cmd 192.168.10.152 'OUTPut1:STATe Off'", "", "", @SW_HIDE)
#include "Functions\PrintSucessMessage.au3"
Else
- MsgBox(16, "Excel Data Test", "Error: Could not retrieve data from cell range: " & $CellRange)
- Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\SendNtfctn.au3" "' & $system & '" "Could not retrieve data from cell range"', @ScriptDir)
+ MsgBox(16, "SQL Data Test", "No suitable runs found")
EndIf
Else
- MsgBox(16, "Excel Data Test", "Error: Could not open " & $FileName & " as an Excel Object.")
- Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\SendNtfctn.au3" "' & $system & '" "Could not open ' & $FileName & ' as an Excel Object."', @ScriptDir)
+ MsgBox(16, "Server fail", "Error: Could not open connection to mySQL server.")
EndIf
-$oExcelDoc = 0
Func SGN($i)
Return ($i > 0) - ($i < 0)
EndFunc ;==>SGN
-Func CheckValues($vref, $matrix, $runnum, $eventnum, $clock)
+Func CheckValues($vref, $matrix, $runnumber, $events, $clock)
Return 0
EndFunc ;==>CheckValues