From: Benjamin Linnik Date: Wed, 25 Feb 2015 17:03:08 +0000 (+0100) Subject: bot: updated bot software X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=557ce39b1c36867900c81c607ba1a85243b8221a;p=radhard.git bot: updated bot software --- diff --git a/bot/Chips/I2C_control_Mim32.au3 b/bot/Chips/I2C_control_Mim32.au3 index 3c9cd82..96dd3a7 100755 --- a/bot/Chips/I2C_control_Mim32.au3 +++ b/bot/Chips/I2C_control_Mim32.au3 @@ -3,7 +3,7 @@ Global $chipsoftware[2] = ["I2C control Software for Mimosa32", "TPageControl1"] Global $system = "USB" Global $hWnd Global $hCounter -$savedir = "F:\Mi32" +$savedir = "O:\Mi34" Global $vref = 650 ; Initial vref, will be adjusted during runtime $temperaturebefore = -10000 @@ -90,3 +90,7 @@ Func TestSystem() WinWaitClose("Debug", 1000) Return 0 EndFunc + +Func GetAverage() + Return ControlGetText($hWnd, "", "[TEXT:DispAvg;CLASS:TEdit]") +EndFunc diff --git a/bot/Chips/daq_mi32a_v32(Host).vi.au3 b/bot/Chips/daq_mi32a_v32(Host).vi.au3 index 41093df..920d589 100755 --- a/bot/Chips/daq_mi32a_v32(Host).vi.au3 +++ b/bot/Chips/daq_mi32a_v32(Host).vi.au3 @@ -3,7 +3,7 @@ Global $chipsoftware[1] = ["daq_mi32a_v32(Host).vi"] Global $vi Global $system = "PXI" $savedir = "C:\data\currentrun" -$storedir = "K:\Mi32" +$storedir = "H:\Mi34" Global $vref = 1000 ; Initial vref, will be adjusted during runtime $temperaturebefore = -10000 @@ -30,6 +30,7 @@ Func ProgramMi() $vi.SetControlValue("Auto update", "1") Sleep(1000) $vi.SetControlValue(" Load conf file" & @LF & "Upd clk shift", "1") + Sleep(1000) EndFunc ;==>ProgramMi Func SetMiParameter($matrix, $vref) @@ -48,7 +49,11 @@ EndFunc ;==>GetCounter Func StopRun() $vi.SetControlValue("Stop Run DUT", "1") - Sleep(100) + Sleep(200) + $vi.SetControlValue("Stop Run DUT", "0") + Sleep(1000) + $vi.SetControlValue("Stop Run DUT", "1") + Sleep(200) $vi.SetControlValue("Stop Run DUT", "0") EndFunc diff --git a/bot/Functions/Header.au3 b/bot/Functions/Header.au3 index 3d9361c..5ad6aec 100755 --- a/bot/Functions/Header.au3 +++ b/bot/Functions/Header.au3 @@ -14,6 +14,7 @@ $programversion = "1.0" $excelLineBegin = "1100" ; Change this to the range of cells you want to be processed $excelLineEnd = "4000" Global $completelog = "" +Global $comment = "" $lastexcelcell = "Q" $CellRange = "A" & $excelLineBegin & ":" & $lastexcelcell & $excelLineEnd diff --git a/bot/Functions/MoveFolder.au3 b/bot/Functions/MoveFolder.au3 index 9ac589a..9e79621 100755 --- a/bot/Functions/MoveFolder.au3 +++ b/bot/Functions/MoveFolder.au3 @@ -4,7 +4,7 @@ If ($CmdLine[0] = 2) Then $returnval = MoveFolder($CmdLine[1], $CmdLine[2]) ElseIf ($CmdLine[0] = 3) Then $returnval = MoveFolders($CmdLine[1], $CmdLine[2], $CmdLine[3]) -EndIf + EndIf ConsoleWrite($returnval) ;### Debug Console Exit $returnval @@ -19,9 +19,8 @@ EndFunc ;==>MoveFolder Func MoveFolders($src, $dst, $runnumber) For $i = 0 To 2 - DirCopy ( $src & $runnumber-$i, $dst & $runnumber-$i ) - FileDelete($src & $runnumber-$i & "\*") - DirRemove( $src & $runnumber-$i ) + DirCopy ( $src & "\" & $runnumber-$i, $dst & "\" & $runnumber-$i ) + DirRemove( $src & "\" & $runnumber-$i "\", 1) Next Return 0 EndFunc ;==>MoveFolder \ No newline at end of file diff --git a/bot/Functions/SaveToSQL.au3 b/bot/Functions/SaveToSQL.au3 index 10626fd..381fe40 100755 --- a/bot/Functions/SaveToSQL.au3 +++ b/bot/Functions/SaveToSQL.au3 @@ -4,11 +4,17 @@ $calchours = Round($calcsec / 3600, 2) If $temperaturechipstart = 100000 Then $temperaturechipstart = "NULL" If $temperaturechipend = 100000 Then $temperaturechipstart = "NULL" $datetime = @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC -if (IsDeclared($storedir)) Then - $path = $storedir & "\\" & $runnumber +if (IsDeclared("storedir")) Then + $path = StringReplace ( $storedir, "\", "\\") & "\\" & $runnumber Else - $path = $savedir & "\\" & $runnumber + $path = StringReplace ( $savedir, "\", "\\") & "\\" & $runnumber +EndIf +$path = StringReplace ( $path, "/", "//") +If StringLen($comment) > 0 Then + UpdateDBwithErrorRun($runid, $datetime, $temperaturechipstart, $temperaturechipend, $vref, $calcsec, $programversion, $path, $comment) + $comment = "" +Else + UpdateDBwithRun($runid, $datetime, $temperaturechipstart, $temperaturechipend, $vref, $calcsec, $programversion, $path) EndIf -UpdateDBwithRun($runid, $datetime, $temperaturechipstart, $temperaturechipend, $vref, $calcsec, $programversion, $path) diff --git a/bot/Functions/SendNtfctn.au3 b/bot/Functions/SendNtfctn.au3 index 400c3cc..8f5d9e8 100755 --- a/bot/Functions/SendNtfctn.au3 +++ b/bot/Functions/SendNtfctn.au3 @@ -31,7 +31,7 @@ Func SendNtfctn($text, $system) EndIf If $notifyDennis Then - $oHTTP.Open("GET", "http://autoremotejoaomgcd.appspot.com/sendmessage?key=APA91bHCZjLkmISyt3lHjn-ym1Md9SymV5hKq05gxuPKXSMVm6e1rphU55sjiQNfQOIUpzoNqCU8kGXLwDJTRksMBRgk62dW5N_Go69dchFvfYqNIKKrvG26FGBPjKea06PU6IPxLPm0WWSM53k7QIQj0EZtMSNxpg&message=RadHard:%20System-" & $system & ":%20" & $text & "&password=mimosa") + $oHTTP.Open("GET", "http://autoremotejoaomgcd.appspot.com/sendmessage?key=APA91bE1HCR2s8feQdqsd627pLSiuEAYdDd6iqJdopTdGm06cs45P5f6_Z6lh_ody3zUmm9saW77jUwXLNTwlpEQHT3oUyh-vHfZmKptg3wdBMtYUr4kWqXhRbs3g0i36Y33-m4LFZb_toVrOn90J0Dkes5eMUTXaHu9Ko1pIUZgsqQ48whM3dY&message=RadHard:%20System-" & $system & ":%20" & $text & "&password=Mimosasasa") $oHTTP.Send() EndIf diff --git a/bot/Functions/TemperatureControl.au3 b/bot/Functions/TemperatureControl.au3 index f882ae8..7f82355 100755 --- a/bot/Functions/TemperatureControl.au3 +++ b/bot/Functions/TemperatureControl.au3 @@ -21,7 +21,8 @@ Func GetTemperatureCooling($system) WITH $oHTTP Switch $system Case "USB" - .Open("GET", "http://cerberus.x-matter.uni-frankfurt.de:8700/tools/cooling/cooling.pl?/dev/USBCooling") + ;.Open("GET", "http://cerberus.x-matter.uni-frankfurt.de:8700/tools/cooling/cooling.pl?/dev/USBCooling") + .Open("GET", "http://cerberus.x-matter.uni-frankfurt.de:8700/tools/cooling/cooling.pl?/dev/PXICooling") Case "PXI" .Open("GET", "http://cerberus.x-matter.uni-frankfurt.de:8700/tools/cooling/cooling.pl?/dev/PXICooling") EndSwitch @@ -87,7 +88,8 @@ Func SetTemperature($system, $temperature) WITH $oHTTP Switch $system Case "USB" - .Open("GET", "http://cerberus.x-matter.uni-frankfurt.de:8700/tools/cooling/cooling.pl?/dev/USBCooling&" & $command) + ;.Open("GET", "http://cerberus.x-matter.uni-frankfurt.de:8700/tools/cooling/cooling.pl?/dev/USBCooling&" & $command) + .Open("GET", "http://cerberus.x-matter.uni-frankfurt.de:8700/tools/cooling/cooling.pl?/dev/PXICooling&" & $command) Case "PXI" .Open("GET", "http://cerberus.x-matter.uni-frankfurt.de:8700/tools/cooling/cooling.pl?/dev/PXICooling&" & $command) EndSwitch diff --git a/bot/Functions/WaitForTemperature.au3 b/bot/Functions/WaitForTemperature.au3 index f3f7b89..8bc911f 100755 --- a/bot/Functions/WaitForTemperature.au3 +++ b/bot/Functions/WaitForTemperature.au3 @@ -6,6 +6,7 @@ EndIf $tempwaiti = 0 ; set the 5 minutes wait counter to zero if it reaches 6 -> 30 minutes passed While Not $tempcorrent $currenttemp = GetTemperatureForSure($system) + ;$currenttemp = 100000 ; delete me TODO If $currenttemp == 100000 Then RefreshGUISendNtfct("Could not get temperature. Will assume it is set correctly. Please check manually later.") $tempcorrent = True @@ -43,4 +44,5 @@ If $TempWaitFor > 0 Then Sleep($TempWaitFor * 60 * 1000) ; wait for user specified minutes EndIf $temperaturebefore = $TempCooling ; if next run has the same needed temperature as this run, dont check for cooling water temperature, see the first lines of this file for details -$temperaturechipstart = GetTemperatureForSure("Chip" & $system) \ No newline at end of file +$temperaturechipstart = GetTemperatureForSure("Chip" & $system) +$temperaturechipend = $temperaturechipstart \ No newline at end of file diff --git a/bot/Functions/Watchrun.au3 b/bot/Functions/Watchrun.au3 index 66c091f..3c39d01 100755 --- a/bot/Functions/Watchrun.au3 +++ b/bot/Functions/Watchrun.au3 @@ -24,14 +24,20 @@ Do EndIf Sleep(10000) If ($oldcounter == GetCounter()) Then - StopRun() - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\SendNtfctn.au3" "' & $system & '" "Skipped run ' & $runnumber & ', event counter froze."', @ScriptDir) - Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(48, ''Warning'', ''Skipped run ' & $runnumber & ', event counter froze.'')"') - $completelog &= _NowCalc() & " Skipped run " & $runnumber & ", event counter froze." & @CRLF - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUI.au3" "' & $completelog & '"') - FileDelete($savedir & "\" & $runnumber & "\*") - DirRemove($savedir & "\" & $runnumber) - ContinueLoop 2 + Sleep(10000) + If ($oldcounter == GetCounter()) Then + StopRun() + Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\SendNtfctn.au3" "' & $system & '" "Skipped run ' & $runnumber & ', event counter froze."', @ScriptDir) + Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(48, ''Warning'', ''Skipped run ' & $runnumber & ', event counter froze.'')"') + $completelog &= _NowCalc() & " Skipped run " & $runnumber & ", event counter froze." & @CRLF + Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUI.au3" "' & $completelog & '"') + $comment = "Event counter froze" + #include "SaveToSQL.au3" +;~ UpdateDBwithErrorRun($runid, $datetime, $temperaturechipstart, $temperaturechipend, $vref, $calcsec, $programversion, $path, "Event counter froze") +;~ FileDelete($savedir & "\" & $runnumber & "\*") +;~ DirRemove($savedir & "\" & $runnumber) + ContinueLoop 2 + EndIf EndIf $i = $i + 1 Until (GetCounter() > $events) diff --git a/bot/Functions/mysql_functions.au3 b/bot/Functions/mysql_functions.au3 index 8eeafbf..08d996a 100755 --- a/bot/Functions/mysql_functions.au3 +++ b/bot/Functions/mysql_functions.au3 @@ -43,6 +43,26 @@ Func UpdateDBwithRun($id, $datetime, $temperaturechipstart, $temperaturechipend, _MySQLEnd($sql) EndFunc +Func UpdateDBwithErrorRun($id, $datetime, $temperaturechipstart, $temperaturechipend, $vref, $calcsec, $programversion, $path, $comment) + $sql = GetSQLConnection() + + $sqlstring = "UPDATE labbook SET " & _ + "datetime='" & $datetime & "', " & _ + "TempChipStart=" & $temperaturechipstart & ", " & _ + "TempChipEnd=" & $temperaturechipend & ", " & _ + "VRef=" & $vref & ", " & _ + "Runtime=" & $calcsec & ", " & _ + "MABSV='" & $programversion & "', " & _ + "StorePath='" & $path & "', " & _ + "MABS_comment='" & $comment & "' " & _ + "WHERE id=" & $id + + ConsoleWrite($sqlstring) + _Query($sql, $sqlstring) + + _MySQLEnd($sql) +EndFunc + Func ReturnNumSuitRuns($ChipGen, $ChipNum, $ChipRadiation, $RadiationSource, $System, $Clock=0) $sql = GetSQLConnection() @@ -50,8 +70,8 @@ Func ReturnNumSuitRuns($ChipGen, $ChipNum, $ChipRadiation, $RadiationSource, $Sy $sqlstring = "ChipGen='" & $ChipGen & "' AND " & _ "ChipNum='" & $ChipNum & "' AND " & _ "RadiationSource='" & $RadiationSource & "' AND " & _ - "ChipRadiation=" & $ChipRadiation & " AND " & _ "System='" & $System & "' AND " & _ + "MABS_comment IS NULL AND " & _ "(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 @@ -59,6 +79,7 @@ Func ReturnNumSuitRuns($ChipGen, $ChipNum, $ChipRadiation, $RadiationSource, $Sy _MySQLEnd($sql) ConsoleWrite("ReturnNumSuitRuns: " & $number & @CRLF) Return $number +; "'ChipRadiation Ion'=" & $ChipRadiation & " AND " & _ EndFunc @@ -70,8 +91,9 @@ Func ReturnSuitRun($ChipGen, $ChipNum, $ChipRadiation, $RadiationSource, $System $sqlstring = $sqlstring & "ChipGen='" & $ChipGen & "' AND " $sqlstring = $sqlstring & "ChipNum='" & $ChipNum & "' AND " $sqlstring = $sqlstring & "RadiationSource='" & $RadiationSource & "' AND " - $sqlstring = $sqlstring & "ChipRadiation=" & $ChipRadiation & " AND " + ;$sqlstring = $sqlstring & "'ChipRadiation Ion'=" & $ChipRadiation & " AND " $sqlstring = $sqlstring & "System='" & $System & "' AND " + $sqlstring = $sqlstring & "MABS_comment IS NULL AND " $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" diff --git a/bot/MABS.lnk b/bot/MABS.lnk index 776d90a..96f43e7 100755 Binary files a/bot/MABS.lnk and b/bot/MABS.lnk differ diff --git a/bot/Mimosa_Autorun_PXI.au3 b/bot/Mimosa_Autorun_PXI.au3 index b83eb6b..9084ef1 100755 --- a/bot/Mimosa_Autorun_PXI.au3 +++ b/bot/Mimosa_Autorun_PXI.au3 @@ -46,7 +46,6 @@ If (Not @error) Then ; Check again if everything went well #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) @@ -80,7 +79,7 @@ If (Not @error) Then ; Check again if everything went well Case Else $vref = $vref + SGN($diff) * 5 EndSelect - If ($vref > 1500 Or $vref < 300) Then + If ($vref > 1500 Or $vref < 0) 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!'')"') diff --git a/bot/Mimosa_Autorun_USB.au3 b/bot/Mimosa_Autorun_USB.au3 index 4a841bb..e9e14c5 100755 --- a/bot/Mimosa_Autorun_USB.au3 +++ b/bot/Mimosa_Autorun_USB.au3 @@ -61,14 +61,14 @@ EndFunc ;==>_ProgramMi Func _TestSystem() If $chipversion <> "Mi29" Then TestSystem() - Else ; mimosa 20 ausnahme + Else ; mimosa 29 ausnahme Call($chipversion & "_TestSystem") EndIf EndFunc ;==>_TestSystem Func _GetAverage($hWnd) If $chipversion <> "Mi29" Then - Return GetAverage($hWnd) - Else ; mimosa 20 ausnahme + Return GetAverage() + Else ; mimosa 29 ausnahme Return Call($chipversion & "_GetAverage", $hWnd) EndIf EndFunc ;==>_GetAverage @@ -116,7 +116,13 @@ If (Not @error) Then ; Check again if everything went well ProgramMi() _GUICtrlTab_SetCurFocus($hTab, 2) ; Go to "Run parameter" tab Sleep(200) - $savedir = ControlGetText($hWnd, "", "TEdit24") ; get directorys to save file to + ;$savedir = ControlGetText($hWnd, "", "TEdit24") ; get directorys to save file to + ;GUICtrlSetState($hWnd, "", "TCheckBox6", "") + ControlSetText($hWnd, "", "TEdit24", "") + Sleep(100) + ControlFocus($hWnd, "", "TEdit24") + ControlSend($hWnd, "", "TEdit24", $savedir) + Sleep(100) ControlSetText($hWnd, "", "TEdit23", "") Sleep(100) ControlFocus($hWnd, "", "TEdit23") @@ -134,6 +140,8 @@ If (Not @error) Then ; Check again if everything went well Sleep(1000) If (WinExists("Avertissement")) Then RefreshGUISendNtfct("Skipped run " & $runnumber & " could overwrite data.") + $comment = "Skipped: Could overwrite data." + #include "Functions/SaveToSQL.au3" Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(48, ''Warning'', ''Skipped run ' & $runnumber & ', could overwrite data!'')"') ControlClick("Avertissement", "", "TButton1") ContinueLoop diff --git a/bot/config_PXI.ini b/bot/config_PXI.ini index 936fa7d..36d77a0 100755 --- a/bot/config_PXI.ini +++ b/bot/config_PXI.ini @@ -1,9 +1,9 @@ [experimental setup] ChipVersion = Mi34 -ChipInstalled = 3 +ChipInstalled = 5 ExcelPath = H:\dennis doering\Arbeitsprogramme\Mimosa34\LaborbuchMi34 - Neu2.xls RadSource = Fe55 -Radiated = 3 +Radiated = 0 [various] -Notify = 3 +Notify = 1 NotifyCustom = (Optional) diff --git a/bot/config_USB.ini b/bot/config_USB.ini index 214239f..7d8e388 100755 --- a/bot/config_USB.ini +++ b/bot/config_USB.ini @@ -1,9 +1,9 @@ [experimental setup] -ChipVersion = Mi32Ter -ChipInstalled = 5d +ChipVersion = Mi34 +ChipInstalled = 23 ExcelPath = H:\dennis doering\Arbeitsprogramme\Mimosa34\LaborbuchMi34 - Neu.xls -RadSource = none -Radiated = 0 +RadSource = Sr90 +Radiated = [various] Notify = 3 -NotifyCustom = (Optional) +NotifyCustom = doering@physik.uni-frankfurt.de