From 45a735319726dd806f33da11a9005f8daaf5b794 Mon Sep 17 00:00:00 2001 From: Benjamin Linnik Date: Tue, 24 Sep 2013 18:21:31 +0200 Subject: [PATCH] bot: Added more stable temperature control, optimized and cleaned up code, PXI system support --- bot/Chips/I2C_control_Mim32.au3 | 50 ++++ bot/Functions/SendNtfctn.au3 | 49 +++- bot/Functions/TemperatureControl.au3 | 61 ++++- bot/GUI/MABS.au3 | 58 ++-- bot/Mimosa_Autorun.au3 | 383 --------------------------- bot/config.ini | 9 - 6 files changed, 179 insertions(+), 431 deletions(-) delete mode 100755 bot/Mimosa_Autorun.au3 delete mode 100755 bot/config.ini diff --git a/bot/Chips/I2C_control_Mim32.au3 b/bot/Chips/I2C_control_Mim32.au3 index ea67e8f..3c9cd82 100755 --- a/bot/Chips/I2C_control_Mim32.au3 +++ b/bot/Chips/I2C_control_Mim32.au3 @@ -1,5 +1,11 @@ #include-once Global $chipsoftware[2] = ["I2C control Software for Mimosa32", "TPageControl1"] +Global $system = "USB" +Global $hWnd +Global $hCounter +$savedir = "F:\Mi32" +Global $vref = 650 ; Initial vref, will be adjusted during runtime +$temperaturebefore = -10000 Func CheckWindowExist() ; Check if Mimosa window exists If WinExists($chipsoftware[0]) = False Then @@ -40,3 +46,47 @@ Func ProgramMi() Sleep(1000) EndFunc ;==>ProgramMi +Func GetCounter() + Return ControlGetText($hWnd, "", $hCounter) +EndFunc ;==>GetCounter + +Func StopRun() + ControlClick($hWnd, "", "[TEXT:Stop Run;CLASS:TButton]") +EndFunc + +Func StartRun() + ControlClick($hWnd, "", "[TEXT:Start Run;CLASS:TButton]") +EndFunc + +Func TestSystem() + WinWait("Debug") + ControlClick("Debug", "", "[TEXT:Messages Clear]") + Sleep(100) + ControlClick("Debug", "", "[TEXT:Board Testing]") + Sleep(2000) + $i = 0 + Do + $text = WinGetText("[CLASS:TDebugFrm]", "") + $texthex = _StringToHex($text) + If ($texthex == "4D657373616765730A5072696E7420426F6172647320526567730A0D0A3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D0D0A426F6172642049643D302074657374207374617274696E67202E2E2E0D0A3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D0D0A0D0A53746F70206163717569736974696F6E202E2E2E0D0A41445220434F554E54455220412074657374696E67202E2E2E0D0A41445220434F554E54455220412030204572726F72730D0A52414D20412074657374696E67202E2E2E0D0A52414D20412030204572726F72730D0A52414D20422074657374696E67202E2E2E0D0A52414D20422030204572726F72730D0A52414D20432074657374696E67202E2E2E0D0A52414D20432030204572726F72730D0A52414D20442074657374696E67202E2E2E0D0A52414D20442030204572726F72730D0A0D0A3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D0D0A426F6172642049643D312074657374207374617274696E67202E2E2E0D0A3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D0D0A0D0A53746F70206163717569736974696F6E202E2E2E0D0A41445220434F554E54455220412074657374696E67202E2E2E0D0A41445220434F554E54455220412030204572726F72730D0A52414D20412074657374696E67202E2E2E0D0A52414D20412030204572726F72730D0A52414D20422074657374696E67202E2E2E0D0A52414D20422030204572726F72730D0A52414D20432074657374696E67202E2E2E0D0A52414D20432030204572726F72730D0A52414D20442074657374696E67202E2E2E0D0A52414D20442030204572726F72730D0A0A555342322042616E647769647468204D65617375726D656E740A426F6172642054657374696E670A536F66747761726520496E697469616C697A6174696F6E0A4D6573736167657320436C6561720A") Then + ExitLoop + EndIf + Sleep(500) + $i = $i + 1 + If ($i > 20) Then + RefreshGUISendNtfct("USB Boards could be not OK! Please turn them on and off.") + ;Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUISendNtfct.au3" "' & $system & '" "' & $completelog & '" "USB Boards could be not OK! Please turn them on and off."') + MsgBox(16, "Message", "USB Boards could be not OK! Please check the Debug output.") + Return 1 + EndIf + Until 0 + If StringRegExp($text, "[1-9]+ Errors") Then ; double check, will remove it later + RefreshGUISendNtfct("USB Boards could be not OK! Please turn them on and off.") + ;Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUISendNtfct.au3" "' & $system & '" "' & $completelog & '" "USB Boards could be not OK! Please turn them on and off."') + MsgBox(16, "Message", "USB Boards could be not OK! Please check the Debug output.") + Return 1 + EndIf + WinClose("Debug") + WinWaitClose("Debug", 1000) + Return 0 +EndFunc diff --git a/bot/Functions/SendNtfctn.au3 b/bot/Functions/SendNtfctn.au3 index 5831871..f019797 100755 --- a/bot/Functions/SendNtfctn.au3 +++ b/bot/Functions/SendNtfctn.au3 @@ -3,13 +3,18 @@ $notify = IniRead("config.ini", "various", "Notify", "1") ; notifycode $notifycustom = IniRead("config.ini", "various", "NotifyCustom", "") ; chip number currently mounted into the system $error = 1 -If ($CmdLine[0] > 0) Then - SendNtfctn($CmdLine[1]) +If $CmdLine[0] > 1 Then + If $CmdLine[1] == "USB" Then + SendNtfctn_USB($CmdLine[2]) $error = 0 + ElseIf $CmdLine[1] == "PXI" Then + SendNtfctn($CmdLine[2], "PXI") + $error = 0 + EndIf EndIf ConsoleWrite($error) -Func SendNtfctn($text) +Func SendNtfctn_USB($text) $notify = IniRead("config.ini", "various", "Notify", "1") ; notifycode $notifycustom = IniRead("config.ini", "various", "NotifyCustom", "") ; chip number currently mounted into the system @@ -21,18 +26,50 @@ Func SendNtfctn($text) $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") If $notifyBenny Then - $oHTTP.Open("GET", "http://autoremotejoaomgcd.appspot.com/sendmessage?key=APA91bEejQPoLUIipcNpfeDvNoa5Bd48AASVBHRphY4ySu8U2FSfuDym2iHdkC_YJ2zyhhbVXVB0oRacd_QmDFsrNRATF0rT4b7pqIHj8EeUrOdq0s_gQq7BE0ERaUfHHikhet06D8ff8BUXe8uVZ5RqoI2ygWc48Q&message=RadHard:%20" & $text & "&password=TannenbaumSaftSchorle") + $oHTTP.Open("GET", "http://autoremotejoaomgcd.appspot.com/sendmessage?key=APA91bEejQPoLUIipcNpfeDvNoa5Bd48AASVBHRphY4ySu8U2FSfuDym2iHdkC_YJ2zyhhbVXVB0oRacd_QmDFsrNRATF0rT4b7pqIHj8EeUrOdq0s_gQq7BE0ERaUfHHikhet06D8ff8BUXe8uVZ5RqoI2ygWc48Q&message=RadHard:%20System-USB:%20" & $text & "&password=TannenbaumSaftSchorle") + $oHTTP.Send() + EndIf + + If $notifyDennis Then + $oHTTP.Open("GET", "http://autoremotejoaomgcd.appspot.com/sendmessage?key=APA91bHCZjLkmISyt3lHjn-ym1Md9SymV5hKq05gxuPKXSMVm6e1rphU55sjiQNfQOIUpzoNqCU8kGXLwDJTRksMBRgk62dW5N_Go69dchFvfYqNIKKrvG26FGBPjKea06PU6IPxLPm0WWSM53k7QIQj0EZtMSNxpg&message=RadHard:%20System-USB:%20" & $text & "&password=mimosa") + $oHTTP.Send() + EndIf + + If $notifyStefan Then + If Not StringInStr ( $text, "Percent%20done" ) Then + $oHTTP.Open("GET", "http://autoremotejoaomgcd.appspot.com/sendmessage?key=APA91bEejQPoLUIipcNpfeDvNoa5Bd48AASVBHRphY4ySu8U2FSfuDym2iHdkC_YJ2zyhhbVXVB0oRacd_QmDFsrNRATF0rT4b7pqIHj8EeUrOdq0s_gQq7BE0ERaUfHHikhet06D8ff8BUXe8uVZ5RqoI2ygWc48Q&message=RadHardSMS015787957348:%20System-USB:%20" & $text & "&password=TannenbaumSaftSchorle") + $oHTTP.Send() + EndIf + EndIf + + $oHTTP = 0 + +EndFunc ;==>SendNtfctn + +Func SendNtfctn($text, $system) + $notify = IniRead("config_" & $system & ".ini", "various", "Notify", "1") ; notifycode + $notifycustom = IniRead("config_" & $system & ".ini", "various", "NotifyCustom", "") ; chip number currently mounted into the system + + $notifyBenny =BitAND($notify, 1) + $notifyDennis=BitAND($notify, 2) + $notifyStefan=BitAND($notify, 4) + + $text = urlencode($text) + $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") + + If $notifyBenny Then + $oHTTP.Open("GET", "http://autoremotejoaomgcd.appspot.com/sendmessage?key=APA91bEejQPoLUIipcNpfeDvNoa5Bd48AASVBHRphY4ySu8U2FSfuDym2iHdkC_YJ2zyhhbVXVB0oRacd_QmDFsrNRATF0rT4b7pqIHj8EeUrOdq0s_gQq7BE0ERaUfHHikhet06D8ff8BUXe8uVZ5RqoI2ygWc48Q&message=RadHard:%20System-" & $system & ":%20" & $text & "&password=TannenbaumSaftSchorle") $oHTTP.Send() EndIf If $notifyDennis Then - $oHTTP.Open("GET", "http://autoremotejoaomgcd.appspot.com/sendmessage?key=APA91bHCZjLkmISyt3lHjn-ym1Md9SymV5hKq05gxuPKXSMVm6e1rphU55sjiQNfQOIUpzoNqCU8kGXLwDJTRksMBRgk62dW5N_Go69dchFvfYqNIKKrvG26FGBPjKea06PU6IPxLPm0WWSM53k7QIQj0EZtMSNxpg&message=RadHard:%20" & $text & "&password=mimosa") + $oHTTP.Open("GET", "http://autoremotejoaomgcd.appspot.com/sendmessage?key=APA91bHCZjLkmISyt3lHjn-ym1Md9SymV5hKq05gxuPKXSMVm6e1rphU55sjiQNfQOIUpzoNqCU8kGXLwDJTRksMBRgk62dW5N_Go69dchFvfYqNIKKrvG26FGBPjKea06PU6IPxLPm0WWSM53k7QIQj0EZtMSNxpg&message=RadHard:%20System-" & $system & ":%20" & $text & "&password=mimosa") $oHTTP.Send() EndIf If $notifyStefan Then If Not StringInStr ( $text, "Percent%20done" ) Then - $oHTTP.Open("GET", "http://autoremotejoaomgcd.appspot.com/sendmessage?key=APA91bEejQPoLUIipcNpfeDvNoa5Bd48AASVBHRphY4ySu8U2FSfuDym2iHdkC_YJ2zyhhbVXVB0oRacd_QmDFsrNRATF0rT4b7pqIHj8EeUrOdq0s_gQq7BE0ERaUfHHikhet06D8ff8BUXe8uVZ5RqoI2ygWc48Q&message=RadHardSMS015787957348:%20" & $text & "&password=TannenbaumSaftSchorle") + $oHTTP.Open("GET", "http://autoremotejoaomgcd.appspot.com/sendmessage?key=APA91bEejQPoLUIipcNpfeDvNoa5Bd48AASVBHRphY4ySu8U2FSfuDym2iHdkC_YJ2zyhhbVXVB0oRacd_QmDFsrNRATF0rT4b7pqIHj8EeUrOdq0s_gQq7BE0ERaUfHHikhet06D8ff8BUXe8uVZ5RqoI2ygWc48Q&message=RadHardSMS015787957348:%20System-" & $system & ":%20" & $text & "&password=TannenbaumSaftSchorle") $oHTTP.Send() EndIf EndIf diff --git a/bot/Functions/TemperatureControl.au3 b/bot/Functions/TemperatureControl.au3 index 177f796..97a5aaa 100755 --- a/bot/Functions/TemperatureControl.au3 +++ b/bot/Functions/TemperatureControl.au3 @@ -2,20 +2,29 @@ AutoItSetOption("TrayIconHide", 1) $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Install a custom error handler -If ($CmdLine[0] > 0) Then - $returnval = SetTemperature(Int($CmdLine[1])) +If ($CmdLine[0] > 1) Then + $returnval = SetTemperature($CmdLine[1], Int($CmdLine[2])) Else - $returnval = GetTemperature() * 100 + If StringInStr($CmdLine[1], "Chip") Then + $parameter = StringRegExpReplace ($CmdLine[1], "Chip", "") + $returnval = GetTemperatureChip($parameter) * 100 + Else + $returnval = GetTemperatureCooling($CmdLine[1]) * 100 + EndIf EndIf ConsoleWrite($returnval) ;### Debug Console Exit $returnval - -Func GetTemperature() +Func GetTemperatureCooling($system) ;ConsoleWrite('@@ (6) :(' & @MIN & ':' & @SEC & ') GetTemperature()' & @CR) ;### Function Trace $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") WITH $oHTTP - .Open("GET", "http://cerberus.x-matter.uni-frankfurt.de:8700/tools/cooling/cooling.pl?/dev/ttyUSB1") + Switch $system + Case "USB" + .Open("GET", "http://cerberus.x-matter.uni-frankfurt.de:8700/tools/cooling/cooling.pl?/dev/USBCooling") + Case "PXI" + .Open("GET", "http://cerberus.x-matter.uni-frankfurt.de:8700/tools/cooling/cooling.pl?/dev/PXICooling") + EndSwitch .Send() $HTMLSource = .Responsetext ENDWITH @@ -34,7 +43,36 @@ Func GetTemperature() Return 1000 EndFunc ;==>GetTemperature -Func SetTemperature($temperature) + +Func GetTemperatureChip($system) + ;ConsoleWrite('@@ (6) :(' & @MIN & ':' & @SEC & ') GetTemperature()' & @CR) ;### Function Trace + $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") + WITH $oHTTP + .Open("GET", "http://cerberus.x-matter.uni-frankfurt.de:8700/tools/onewire/voltage_readout.pl") + .Send() + $HTMLSource = .Responsetext + ENDWITH + If $HTMLSource <> "" Then + Switch $system + Case "USB" + $curtemperaturmatch = StringRegExp ( $HTMLSource, "Sensor USB-System => (-)?[0-9]+\.[0-9]+", 2) + Case "PXI" + $curtemperaturmatch = StringRegExp ( $HTMLSource, "Sensor PXI-System => (-)?[0-9]+\.[0-9]+", 2) + EndSwitch + If IsArray($curtemperaturmatch) Then + If $curtemperaturmatch[0] <> "" Then + $curtemperatur = StringRegExpReplace ($curtemperaturmatch[0], "Sensor .+?-System => ", "") + ;ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $curtemperatur = ' & $curtemperatur & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console + ControlSetText("MABS (Mimosa Automation Bot System)", "", "Static4", $curtemperatur) + Return $curtemperatur + EndIf + EndIf + EndIf + $oHTTP = 0 + Return 1000 +EndFunc ;==>GetTemperature + +Func SetTemperature($system, $temperature) If IsInt($temperature) Then If $temperature > 0 Then $signum = "+" @@ -46,7 +84,12 @@ Func SetTemperature($temperature) $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") WITH $oHTTP - .Open("GET", "http://cerberus.x-matter.uni-frankfurt.de:8700/tools/cooling/cooling.pl?/dev/ttyUSB1&" & $command) + Switch $system + Case "USB" + .Open("GET", "http://cerberus.x-matter.uni-frankfurt.de:8700/tools/cooling/cooling.pl?/dev/USBCooling&" & $command) + Case "PXI" + .Open("GET", "http://cerberus.x-matter.uni-frankfurt.de:8700/tools/cooling/cooling.pl?/dev/PXICooling&" & $command) + EndSwitch .Send() $HTMLSource = .Responsetext ENDWITH @@ -61,8 +104,6 @@ Func SetTemperature($temperature) Return 100000 EndFunc ;==>SetTemperature - - ; This is my custom error handler Func MyErrFunc() ConsoleWrite('@@ (27) :(' & @MIN & ':' & @SEC & ') MyErrFunc()' & @CR) ;### Function Trace diff --git a/bot/GUI/MABS.au3 b/bot/GUI/MABS.au3 index ad0c477..7162c52 100755 --- a/bot/GUI/MABS.au3 +++ b/bot/GUI/MABS.au3 @@ -7,13 +7,16 @@ #include #include "../Functions/BinaryIntegerConvert.au3" Global $programversion = "1.0" +Global $computernameUSB = "JSPC12" +Global $computernamePXI = "PXI" #include "About.au3" #Region ### START Koda GUI section ### Form=f:\eigene dateien\downloads\dropbox\new\gui\mab.kxf -$Form1_1 = GUICreate("MABS (Mimosa Automation Bot System)", 477, 412, 395, 335) +$Form1_1 = GUICreate("MABS (Mimosa Automation Bot System)", 477, 448, 275, 173) $ProgressPercent1 = GUICtrlCreateLabel("0", -40, -40, 21, 17) $ProgressPercent2 = GUICtrlCreateLabel("0", -40, -40, 21, 17) -$LogEdit = GUICtrlCreateEdit("", 155, 74, 316, 311, BitOR($GUI_SS_DEFAULT_EDIT,$ES_READONLY)) -$lblTemperatur = GUICtrlCreateLabel("-", 20, 178, 46, 17, $SS_RIGHT) +$LogEdit = GUICtrlCreateEdit("", 155, 74, 316, 343, BitOR($GUI_SS_DEFAULT_EDIT,$ES_READONLY)) +$lblTmpCooling = GUICtrlCreateLabel("-", 12, 202, 38, 17, $SS_RIGHT) +$lblTmpChip = GUICtrlCreateLabel("-", 84, 202, 38, 17, $SS_RIGHT) $MenuItem1 = GUICtrlCreateMenu("&File") $MenuItem2 = GUICtrlCreateMenuItem("&Save"&@TAB&"Ctrl+S", $MenuItem1) $MenuItem3 = GUICtrlCreateMenuItem("&Load"&@TAB&"Ctrl+L", $MenuItem1) @@ -26,27 +29,29 @@ $ChipCombo = GUICtrlCreateCombo("", 11, 74, 89, 25, BitOR($CBS_DROPDOWN,$CBS_AUT GUICtrlSetData(-1, "Mi32|Mi32Ter|Mi34", "Mi34") $ChipNumInput = GUICtrlCreateInput("1", 107, 74, 41, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) $Label2 = GUICtrlCreateLabel("Number", 107, 55, 41, 17) -;$TempInput = GUICtrlCreateInput("20", 11, 175, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_RIGHT)) -$Label3 = GUICtrlCreateLabel("Current Temperature", 11, 156, 104, 17) -$Label4 = GUICtrlCreateLabel("° C", 72, 178, 18, 17) +$Label3 = GUICtrlCreateLabel("Temperature", 11, 164, 64, 17) +$Label11 = GUICtrlCreateLabel("Cooling", 16, 184, 39, 17) +$Label4 = GUICtrlCreateLabel("° C", 56, 202, 18, 17) +$Label12 = GUICtrlCreateLabel("Chip", 96, 184, 25, 17) +$Label14 = GUICtrlCreateLabel("° C", 128, 202, 18, 17) $Label5 = GUICtrlCreateLabel("Rad source", 95, 110, 59, 17) $RadInput = GUICtrlCreateInput("none", 97, 129, 51, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_RIGHT)) $Label10 = GUICtrlCreateLabel("Chip Radiation", 11, 110, 74, 17) $RadiatedInput = GUICtrlCreateInput("", 11, 129, 76, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_RIGHT)) -$Start = GUICtrlCreateButton("Start", 10, 318, 135, 30) -$NotifyCustom = GUICtrlCreateInput("(Optional)", 11, 283, 136, 21) +$Start = GUICtrlCreateButton("Start", 10, 350, 135, 30) +$NotifyCustom = GUICtrlCreateInput("(Optional)", 11, 315, 136, 21) GUICtrlSetColor(-1, 0xC0C0C0) -$Label6 = GUICtrlCreateLabel("E-Mail or mobile phone:", 11, 262, 114, 17) -$Progress1 = GUICtrlCreateProgress(10, 355, 135, 16, $PBS_SMOOTH) +$Label6 = GUICtrlCreateLabel("E-Mail or mobile phone:", 11, 294, 114, 17) +$Progress1 = GUICtrlCreateProgress(10, 387, 135, 16, $PBS_SMOOTH) GUICtrlSetColor(-1, 0x000080) -$Progress2 = GUICtrlCreateProgress(10, 374, 135, 10, $PBS_SMOOTH) +$Progress2 = GUICtrlCreateProgress(10, 406, 135, 10, $PBS_SMOOTH) GUICtrlSetColor(-1, 0x000080) $Label7 = GUICtrlCreateLabel("Log", 160, 54, 22, 17) -$CheckboxBenny = GUICtrlCreateCheckbox("Benny", 11, 221, 52, 17) +$CheckboxBenny = GUICtrlCreateCheckbox("Benny", 11, 253, 52, 17) GUICtrlSetState(-1, $GUI_CHECKED) -$Label8 = GUICtrlCreateLabel("Notify:", 11, 204, 34, 17) -$CheckboxDennis = GUICtrlCreateCheckbox("Dennis", 81, 221, 52, 17) -$CheckboxStefan = GUICtrlCreateCheckbox("Stefan", 11, 241, 52, 17) +$Label8 = GUICtrlCreateLabel("Notify:", 11, 236, 34, 17) +$CheckboxDennis = GUICtrlCreateCheckbox("Dennis", 81, 253, 52, 17) +$CheckboxStefan = GUICtrlCreateCheckbox("Stefan", 11, 273, 52, 17) $ExcelPath = GUICtrlCreateInput("", 11, 27, 311, 21) $Label9 = GUICtrlCreateLabel("Lab book as an Excel file", 11, 9, 123, 17) $LoadExcel = GUICtrlCreateButton("Load file", 325, 25, 65, 25) @@ -58,10 +63,16 @@ $hNotifyCustom = ControlGetHandle ($Form1_1, "", $NotifyCustom) $hExcelPath = ControlGetHandle ($Form1_1, "", $ExcelPath) Global $Checkboxes[3] = [ $CheckboxStefan, $CheckboxDennis, $CheckboxBenny] -Loadini("../config.ini") AutoItSetOption("TrayIconHide", 1) GUISetState(@SW_SHOW) -Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\..\Functions\TemperatureControl.au3"') +If @ComputerName == $computernamePXI Then + $system = "PXI" +Else + $system = "USB" +EndIf +Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\..\Functions\TemperatureControl.au3" "' & $system & '"') +Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\..\Functions\TemperatureControl.au3" "Chip' & $system & '"') +Loadini("../config_" & $system & ".ini") $i = 0 While 1 @@ -76,14 +87,14 @@ While 1 Case $MenuItem4 Exit Case $Start - If (NOT SaveIni("../config.ini")) Then - Run(@AutoItExe & ' /AutoIt3ExecuteScript ../Mimosa_Autorun.au3 "' & $Form1_1 & '"', @ScriptDir) + If (NOT SaveIni("../config_" & $system & ".ini")) Then + Run(@AutoItExe & ' /AutoIt3ExecuteScript ../Mimosa_Autorun_' & $system & '.au3 "' & $Form1_1 & '"', @ScriptDir) EndIf Case $MenuItem2 - Local $file = FileSaveDialog ( "Select a location to save the configuration", "../", "Configurations (*.ini)" , "" , "config.ini") + Local $file = FileSaveDialog ( "Select a location to save the configuration", "../", "Configurations (*.ini)" , "" , "config_" & $system & ".ini") SaveIni($file) Case $MenuItem3 - Local $file = FileOpenDialog ( "Select a configuration to load", "../", "Configurations (*.ini)" , "" , "config.ini") + Local $file = FileOpenDialog ( "Select a configuration to load", "../", "Configurations (*.ini)" , "" , "config_" & $system & ".ini") If ($file) Then Loadini($file) Case $LoadExcel Local $file = FileOpenDialog ( "Select a loab book to work on", "../", "Excel file (*.xls;*.xlsx)") @@ -118,7 +129,8 @@ While 1 EndSwitch If $i >= 10000 Then $i = 0 - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\..\Functions\TemperatureControl.au3"') + Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\..\Functions\TemperatureControl.au3" "' & $system & '"') + Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\..\Functions\TemperatureControl.au3" "Chip' & $system & '"') EndIf If Mod($i, 1000) == 0 Then GUICtrlSetData($Progress1, GUICtrlRead($ProgressPercent1)) @@ -164,7 +176,7 @@ Func Loadini($file) ;~ ControlSetText($Form1_1, "", $TempInput, $ReadinArray[4][1]) ;~ ControlSetText($Form1_1, "", $RadInput, $ReadinArray[5][1]) ;~ EndIf - ControlSetText($Form1_1, "", $ExcelPath, IniRead ( $file, "experimental setup", "ExcelPath", "H:\dennis doering\Arbeitsprogramme\Mimosa34\LaborbuchMi34.xls")); current chip generation in the system$PathExcel + ControlSetText($Form1_1, "", $ExcelPath, IniRead ( $file, "experimental setup", "ExcelPath", "H:\dennis doering\Arbeitsprogramme\Mimosa34\LaborbuchMi34 - Neu.xls")); current chip generation in the system$PathExcel ControlSetText($Form1_1, "", $ChipCombo, IniRead ( $file, "experimental setup", "ChipVersion", "Mi34")); current chip generation in the system ControlSetText($Form1_1, "", $ChipNumInput, IniRead($file, "experimental setup", "ChipInstalled", "5")); chip number currently mounted into the system ; ControlSetText($Form1_1, "", $TempInput, IniRead($file, "experimental setup", "SystemTemperature", "20")) ; current temperatur of the system diff --git a/bot/Mimosa_Autorun.au3 b/bot/Mimosa_Autorun.au3 deleted file mode 100755 index 8717d0a..0000000 --- a/bot/Mimosa_Autorun.au3 +++ /dev/null @@ -1,383 +0,0 @@ -; -; AutoIt Version: 3.0 -; Language: English -; Platform: Win9x/NT -; Author: Benny Linnik (b.linnik@gsi.de) -; -; Script Function: -; Reads MAPS running data from an Excel file and - - -; set external parameters -#include -#include -#include -#include -#include -#include -#include -#include "Chips/Mimosa32.au3" -#include "Chips/Mimosa32Ter.au3" -#include "Chips/Mimosa34.au3" -#include "Functions/BinaryIntegerConvert.au3" -#include "Functions/EpochConvert.au3" -$programversion = "0.97" - -$FileName = IniRead(@ScriptDir & "\config.ini", "experimental setup", "ExcelPath", "H:\dennis doering\Arbeitsprogramme\Mimosa34\LaborbuchMi34.xls") ; read path to Excel file -$chipversion = IniRead(@ScriptDir & "\config.ini", "experimental setup", "ChipVersion", "Mi34") ; current chip generation in the system -$chipinstalled = IniRead(@ScriptDir & "\config.ini", "experimental setup", "ChipInstalled", "5") ; chip number currently mounted into the system -$radSource = IniRead(@ScriptDir & "\config.ini", "experimental setup", "RadSource", "none") ; current radioactive source of the system -$radiated = IniRead(@ScriptDir & "\config.ini", "experimental setup", "Radiated", "") ; radiated chip - -$excelLineBegin = "600" ; Change this to the range of cells you want to be processed -$excelLineEnd = "2000" -Global $vref = 650 ; Initial vref, will be adjusted during runtime -$completelog = "" - -;create virtual functions -Func GotoMiTab() - Call($chipversion & "_GotoMiTab") -EndFunc ;==>GotoMiTab -Func GetVref() - Return Call($chipversion & "_GetVref") -EndFunc ;==>GetVref -Func SetVref($vref) - Call($chipversion & "_SetVref", $vref) -EndFunc ;==>SetVref -Func SetMiParameter($matrix, $vref) - Call($chipversion & "_SetMiParameter", $matrix, $vref) -EndFunc ;==>SetMiParameter -Func SelectBoard() - Call($chipversion & "_SelectBoard") -EndFunc ;==>SelectBoard -$CellRange = "A" & $excelLineBegin & ":N" & $excelLineEnd - -; Prompt the user to run the script - use a Yes/No prompt (4 - see help file) -Local $answer = MsgBox(4, "Run script?", "Preparing to do all runs in range " & $CellRange & @CRLF & _ - "of file " & $FileName & " with " & @CRLF & _ - "Radioactive source: " & $radSource & @CRLF & _ - "Chip: " & $chipversion & " (#" & $chipinstalled & ")" & @CRLF & _ - "Radiated: " & $radiated & @CRLF & _ - "If you run this script, daq.exe will be closed and the current run aborted, proceed?") - - -; Check the user's answer to the prompt (see the help file for MsgBox return values) -; If "No" was clicked (7) then exit the script -If $answer = 7 Then - Exit -EndIf -If Not FileExists($FileName) Then ; Just a check to be sure.. - MsgBox(16, "Excel Data Test", "Error: Can't find file " & $FileName) - Exit -EndIf -$oExcelDoc = ObjGet($FileName) ; Get an Excel Object from an existing filename - -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[6][$run] == $chipinstalled And "Mi" & $aArray[2][$run] == $chipversion And $aArray[10][$run] == $radSource And $aArray[12][$run] == $radiated And $aArray[0][$run] == "") Then - $totalruns = $totalruns + 1 - EndIf - Next - Local $answer = MsgBox(4, "Total runs", "Number of suitable runs found at the moment: " & $totalruns) - If $answer = 7 Then - Exit - EndIf - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\SendNtfctn.au3" "Starting with ' & $totalruns & ' runs."', @ScriptDir) - $completelog &= _NowCalc() & " Starting with " & $totalruns & " runs" & @CRLF - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUI.au3" "' & $completelog & '"') - If ProcessExists("daq.exe") = True Then - ProcessClose("daq.exe") - ProcessWaitClose("daq.exe") - EndIf - If ProcessExists("i2c_ms_gui.exe") = True Then - ProcessClose("i2c_ms_gui.exe") - ProcessWaitClose("i2c_ms_gui.exe") - EndIf - Dim $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\") - WinWait("Debug") - ControlClick("Debug", "", "[TEXT:Messages Clear]") - Sleep(100) - ControlClick("Debug", "", "[TEXT:Board Testing]") - Sleep(2000) - $i = 0 - Do - $text = WinGetText("[CLASS:TDebugFrm]", "") - $texthex = _StringToHex($text) - If ($texthex == "4D657373616765730A5072696E7420426F6172647320526567730A0D0A3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D0D0A426F6172642049643D302074657374207374617274696E67202E2E2E0D0A3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D0D0A0D0A53746F70206163717569736974696F6E202E2E2E0D0A41445220434F554E54455220412074657374696E67202E2E2E0D0A41445220434F554E54455220412030204572726F72730D0A52414D20412074657374696E67202E2E2E0D0A52414D20412030204572726F72730D0A52414D20422074657374696E67202E2E2E0D0A52414D20422030204572726F72730D0A52414D20432074657374696E67202E2E2E0D0A52414D20432030204572726F72730D0A52414D20442074657374696E67202E2E2E0D0A52414D20442030204572726F72730D0A0D0A3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D0D0A426F6172642049643D312074657374207374617274696E67202E2E2E0D0A3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D0D0A0D0A53746F70206163717569736974696F6E202E2E2E0D0A41445220434F554E54455220412074657374696E67202E2E2E0D0A41445220434F554E54455220412030204572726F72730D0A52414D20412074657374696E67202E2E2E0D0A52414D20412030204572726F72730D0A52414D20422074657374696E67202E2E2E0D0A52414D20422030204572726F72730D0A52414D20432074657374696E67202E2E2E0D0A52414D20432030204572726F72730D0A52414D20442074657374696E67202E2E2E0D0A52414D20442030204572726F72730D0A0A555342322042616E647769647468204D65617375726D656E740A426F6172642054657374696E670A536F66747761726520496E697469616C697A6174696F6E0A4D6573736167657320436C6561720A") Then - ExitLoop - EndIf - Sleep(500) - $i = $i + 1 - If ($i > 20) Then - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\SendNtfctn.au3" "USB Boards could be not OK!"', @ScriptDir) - $completelog &= _NowCalc() & " USB Boards could be not OK! Please check the Debug output." & @CRLF - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUI.au3" "' & $completelog & '"') - MsgBox(16, "Message", "USB Boards could be not OK! Please check the Debug output.") - Exit - EndIf - Until 0 - If StringRegExp($text, "[1-9]+ Errors") Then ; double check, will remove it later - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\SendNtfctn.au3" "USB Boards could be not OK!"', @ScriptDir) - $completelog &= _NowCalc() & " USB Boards could be not OK! Please check the Debug output." & @CRLF - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUI.au3" "' & $completelog & '"') - MsgBox(16, "Message", "USB Boards could be not OK! Please check the Debug output.") - Exit - EndIf - WinClose("Debug") - WinWaitClose("Debug", 1000) - WinWait($sTitle) - $hWnd = WinGetHandle($sTitle) - $hTab = ControlGetHandle($hWnd, "", "TPageControl1") - $hCounter = ControlGetHandle($hWnd, "", "TEdit25") - $aArray = 0 - $estimate = 0 - $totalrealruns = 0 - $starttimetotal = _NowCalc() - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUI.au3" "0" "0"') - For $run = 0 To $totallexcelines - 1 - $currentrange = "A" & $excelLineBegin + $run & ":N" & $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[6][0] == $chipinstalled And "Mi" & $currentline[2][0] == $chipversion And $currentline[10][0] == $radSource And $currentline[12][0] == $radiated And $currentline[0][0] == "") Then - ;TODO - $tempcorrent = False - While Not $tempcorrent - $tempgeti = 0 - Do - If $tempgeti > 10 Then - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\SendNtfctn.au3" "Could not get temperature. Will assume it is set correctly. Please check manually later."', @ScriptDir) - $completelog &= _NowCalc() & " Could not get temperature. Will assume it is set correctly." & @CRLF - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUI.au3" "' & $completelog & '"') - ;$tempcorrent = True - ExitLoop 2 - EndIf - $currenttemp = RunWait(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\TemperatureControl.au3"', @ScriptDir) - $tempgeti = $tempgeti + 1 - Until $currenttemp < 100000 - $currenttemp = $currenttemp / 100 - If ($currentline[4][0] < $currenttemp + 0.5 And $currentline[4][0] > $currenttemp - 0.5) Then - $tempcorrent = True - Else - $completelog &= _NowCalc() & " Current temperature is " & $currenttemp & "." & @CRLF & "Will set it to " & $currentline[4][0] & " and wait for 10 minutes." & @CRLF - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUI.au3" "' & $completelog & '"') - $tempseti = 0 - Do - If $tempseti > 10 Then - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\SendNtfctn.au3" "Could not set temperature to "' & $currentline[4][0] & '". Current system temperature is "' & $currenttemp & '". Will proceed anyway."', @ScriptDir) - $completelog &= _NowCalc() & " Could not set temperature to " & $currentline[4][0] & "." & @CRLF & "Current system temperature is " & $currenttemp & ". Will proceed." & @CRLF - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUI.au3" "' & $completelog & '"') - ;$tempcorrent = True - ExitLoop 2 - EndIf - $settemp = RunWait(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\TemperatureControl.au3" "' & $currentline[4][0] & '"', @ScriptDir) - $tempseti = $tempseti + 1 - Until $settemp == 0 - Sleep(1000 * 60 * 10) - EndIf - WEnd - $clock = $currentline[11][0] ; save needed clock - If $clock == "" Then - $clock = "100" - $currentline[11][0] = "100" - EndIf - Global $runnum = $currentline[3][0] ; save runnumber, Global to pass to warning messages when run must be skipped - $matrix = $currentline[9][0] ; save matrix - $eventnum = $currentline[5][0] ; save number of events to save - If $eventnum == "" Then - $eventnum = 100000 - $currentline[5][0] = "100000" - EndIf - CheckWindowExist() - SelectBoard() - CheckIfBoardOK() - ; GotoDebugTab() ; not necessary, can check without seeing the tab, as long as text unique (extern and intern) - ControlCommand("I2C control Software for Mimosa32", "", "[TEXT:Intern]", "Check") - If ($clock <> "100") Then - ShellExecuteWait("C:\Programme\PuTTY\plink.exe", "-ssh cerberus /home/maps/bin/vxi11_cmd 192.168.10.152 'SOURce1:FREQuency:Fixed " & $clock & "Mhz'", "", "", @SW_HIDE) - Sleep(1000) - ShellExecuteWait("C:\Programme\PuTTY\plink.exe", "-ssh cerberus /home/maps/bin/vxi11_cmd 192.168.10.152 'SOURce1:VOLTage:HIGH 3.3'", "", "", @SW_HIDE) - Sleep(1000) - ShellExecuteWait("C:\Programme\PuTTY\plink.exe", "-ssh cerberus /home/maps/bin/vxi11_cmd 192.168.10.152 'SOURce1:VOLTage:LOW 0'", "", "", @SW_HIDE) - Sleep(1000) - ShellExecuteWait("C:\Programme\PuTTY\plink.exe", "-ssh cerberus /home/maps/bin/vxi11_cmd 192.168.10.152 'OUTPut1:STATe ON'", "", "", @SW_HIDE) - Sleep(1000) - ControlCommand("I2C control Software for Mimosa32", "", "[TEXT:Extern]", "Check") - ;If (Not ControlCommand("I2C control Software for Mimosa32", "", "[TEXT:Extern]", "IsChecked")) Then - ;Msgbox (16,"Message","Could not set clock to extern") - ;EndIf - 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 - $savedir = StringReplace($savedir, "\", "/") - 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() - ControlClick($hWnd, "", "[TEXT:Start Run;CLASS:TButton]") - Sleep(1000) - If (WinExists("Avertissement")) Then - ;ControlClick("Avertissement", "", "TButton2") - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\SendNtfctn.au3" "Skipped run ' & $runnum & ' could overwrite data."', @ScriptDir) - $completelog &= _NowCalc() & " Skipped run " & $runnum & ", could overwrite data!" & @CRLF - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUI.au3" "' & $completelog & '"') - 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) - - ;_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 - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\SendNtfctn.au3" "Skipped run ' & $runnum & ', vref value could not be set properly. Frequency: ' & $clock & '"', @ScriptDir) - $completelog &= _NowCalc() & " Skipped run " & $runnum & ", vref value could not be set properly. Frequency: " & $clock & @CRLF - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUI.au3" "' & $completelog & '"') - 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 - ControlClick($hWnd, "", "[TEXT:Start Run;CLASS:TButton]") - WinWait("Avertissement") - ControlClick("Avertissement", "", "TButton2") - - ;_GUICtrlTab_SetCurFocus($hTab, 4) ; Go to "Local monitoring" tab - Sleep(1000) - $avg = ControlGetText($hWnd, "", "[TEXT:DispAvg;CLASS:TEdit]") - ;_GUICtrlTab_SetCurFocus($hTab, 2) ; Go to "Run parameter" tab - Sleep(100) - $j = $j + 1 - If ($j > 7) Then - ControlClick($hWnd, "", "[TEXT:Stop Run;CLASS:TButton]") - MsgBox(0, "Message", "VRef could not be set properly") - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\SendNtfctn.au3" "VRef could not be set properly"', @ScriptDir) - $completelog &= _NowCalc() & " Skipped run " & $runnum & ", vref value could not be set properly. Frequency: " & $clock & @CRLF - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUI.au3" "' & $completelog & '"') - Exit - EndIf - Until ($avg < 2300 And $avg > 1700) - EndIf - $i = 0 - Do - $oldcounter = ControlGetText($hWnd, "", $hCounter) - $percentCurrent = Round($oldcounter / $eventnum * 100, 2) - $percentoverall = Round(($oldcounter / $eventnum / $totalruns + $totalrealruns / $totalruns) * 100, 2) - If Not $estimate And $percentoverall > 1 Then - $calcsecestimate = _DateDiff('s', $starttime, _NowCalc()) ; n for minites, s for seconds - $calcsecestimate = $calcsecestimate * 100 / $percentoverall - $calcmin = Int($calcsecestimate / 60) - $calcsecestimate = Int($calcsecestimate) - $timeend = _Epoch_encrypt(_NowCalc()) + $calcsecestimate - $timeend = _Epoch_decrypt($timeend) - $completelog &= _NowCalc() & " Estimated runtime: " & $calcmin & " minutes." & @CRLF & "Estimated endtime: " & $timeend & @CRLF - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\SendNtfctn.au3" "Estimated runtime: ' & $calcmin & ' minutes. Will end at ' & $timeend & '"', @ScriptDir) - $estimate = 1 - EndIf - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUI.au3" "' & $percentoverall & '" "' & $percentCurrent & '"') - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUI.au3" "' & $completelog & '"') - If Not Mod($i, 30) Then - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\SendNtfctn.au3" "Percent done: ' & $percentoverall & ' (' & $totalrealruns & '/' & $totalruns & ')"', @ScriptDir) - EndIf - Sleep(10000) - If ($oldcounter == ControlGetText($hWnd, "", $hCounter)) Then - ControlClick($hWnd, "", "[TEXT:Stop Run;CLASS:TButton]") - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\SendNtfctn.au3" "Skipped run ' & $runnum & ', event counter froze."', @ScriptDir) - Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(48, ''Warning'', ''Skipped run ' & $runnum & ', event counter froze.'')"') - $completelog &= _NowCalc() & " Skipped run " & $runnum & ", event counter froze." & @CRLF - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUI.au3" "' & $completelog & '"') - FileDelete($savedir & "/" & $runnum & "/*") - ContinueLoop 2 - EndIf - $i = $i + 1 - Until (ControlGetText($hWnd, "", $hCounter) > $eventnum) - _GUICtrlTab_SetCurFocus($hTab, 2) ; Go to "Run parameter" tab - Sleep(100) - ControlClick($hWnd, "", "[TEXT:Stop Run;CLASS:TButton]") - - ;If ($clock <> "100") Then - ; ShellExecuteWait("C:\Programme\PuTTY\plink.exe", "-ssh cerberus /home/maps/bin/vxi11_cmd 192.168.10.152 'OUTPut1:STATe Off'", "", "", @SW_HIDE) - ;EndIf - $currentline[0][0] = @MDAY & "." & @MON & "." & @YEAR - $currentline[8][0] = $vref - $calcmin = _DateDiff('s', $starttime, _NowCalc()) ; n for minites, s for seconds - $calcmin = Round($calcmin / 60, 2) - $currentline[13][0] = "Automated run, performed by V." & $programversion & " runtime in minutes: " & $calcmin - $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 - $oDocument.range($currentrange).value = $currentline - $oExcelDoc.Windows(1).Visible = True ; Otherwise the worksheet window will be saved 'hidden' - $oExcelDoc.Save ; Save the workbook - $oExcelDoc.saved = 1 - $totalrealruns = $totalrealruns + 1 - $completelog &= _NowCalc() & " Completed run " & $runnum & ", " & $percentoverall & "% (" & $totalrealruns & "/" & $totalruns & ")" & @CRLF - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUI.au3" "' & $completelog & '"') - EndIf - Next - 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) - $calcmin = _DateDiff('s', $starttimetotal, _NowCalc()) ; n for minites, s for seconds - $calcmin = Round($calcmin / 60, 2) - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\SendNtfctn.au3" "All runs (' & $totalrealruns & ') ended without errors in ' & $calcmin & ' minutes."', @ScriptDir) - Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(0, ''Sucess!'', ''All runs (' & $totalrealruns & ') ended without errors in ' & $calcmin & ' minutes.' & @CRLF & 'Please check the Excel sheet and the results for errors.'')"') - $completelog &= _NowCalc() & " All runs (" & $totalrealruns & ") ended without errors in " & $calcmin & " minutes (" & Round($calcmin, 2) & " hours)" & @CRLF - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUI.au3" "' & $completelog & '"') - Else - MsgBox(16, "Excel Data Test", "Error: Could not retrieve data from cell range: " & $CellRange) - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\SendNtfctn.au3" "Could not retrieve data from cell range"', @ScriptDir) - EndIf -Else - MsgBox(16, "Excel Data Test", "Error: Could not open " & $FileName & " as an Excel Object.") - Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\SendNtfctn.au3" "Could not open ' & $FileName & ' as an Excel Object."', @ScriptDir) -EndIf -$oExcelDoc = 0 -Func SGN($i) - Return ($i > 0) - ($i < 0) -EndFunc ;==>SGN -Func CheckValues($vref, $matrix, $runnum, $eventnum, $clock) - Return 0 -EndFunc ;==>CheckValues diff --git a/bot/config.ini b/bot/config.ini deleted file mode 100755 index 04a881b..0000000 --- a/bot/config.ini +++ /dev/null @@ -1,9 +0,0 @@ -[experimental setup] -ChipVersion = Mi34 -ChipInstalled = 5 -ExcelPath = H:\dennis doering\Arbeitsprogramme\Mimosa34\LaborbuchMi34.xls -RadSource = none -Radiated = 0 -[various] -Notify = 7 -NotifyCustom = (Optional) -- 2.43.0