From: Jan Michel Date: Mon, 29 Jul 2013 11:40:25 +0000 (+0200) Subject: getting line endings right for windows users X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=9dd4969afc1b3c9ca6714209de198d97ff9a4dd6;p=radhard.git getting line endings right for windows users --- diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..176a458 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto diff --git a/bot/I2C_control_Mim32.au3 b/bot/I2C_control_Mim32.au3 index 055634a..9cd5c15 100755 --- a/bot/I2C_control_Mim32.au3 +++ b/bot/I2C_control_Mim32.au3 @@ -1,49 +1,49 @@ -#include-once -Global $chipsoftware[3] = ["I2C control Software for Mimosa32", "TTabSheet1", "TPageControl1"] - -Func CheckWindowExist() ; Check if Mimosa window exists - If WinExists($chipsoftware[0]) = False Then - Run("C:\CCMOS_SCTRL\MIMOSA34\I2C_ms_gui_labo_Debug.bat", "C:\CCMOS_SCTRL\MIMOSA34\") - WinWait($chipsoftware[0]) - EndIf - WinWait("I2C control Software for Mimosa32") -EndFunc - -Func CheckIfBoardOK() - ControlClick($chipsoftware[0], "", "[TEXT:Inactive;CLASS:TButton]") ; Activate Polling - Local $i = 0 - While (ControlGetText($chipsoftware[0], "", "TEdit6") <> "Target Board OK") - If ($i > 20) Then - MsgBox(16, "Message", "Mimosa board could not be polled, please check if board is connected properly.") - Exit - EndIf - $i = $i + 1 - Sleep(500) - WEnd - ControlClick($chipsoftware[0], "", "[TEXT:Active;CLASS:TButton]") -EndFunc - -Func GotoDebugTab() - Local $i = 0 - While (ControlGetText($chipsoftware[0], "", $chipsoftware[1]) <> "Debug") - If ($i > 20) Then - MsgBox(16, "Message", "Debug tab not found in I2C Control software!") - Exit - EndIf - ControlCommand($chipsoftware[0], "", $chipsoftware[2], "TabRight") - $i = $i + 1 - Sleep(100) - WEnd -EndFunc - -Func GotoFirstTab() - For $i = 0 To 20 - ControlCommand($chipsoftware[0], "", $chipsoftware[2], "TabLeft") - Next -EndFunc - -Func ProgramMi() - ControlClick($chipsoftware[0], "", "[TEXT:Prog All Analog;CLASS:TButton]") ; Program! - Sleep(1000) -EndFunc - +#include-once +Global $chipsoftware[3] = ["I2C control Software for Mimosa32", "TTabSheet1", "TPageControl1"] + +Func CheckWindowExist() ; Check if Mimosa window exists + If WinExists($chipsoftware[0]) = False Then + Run("C:\CCMOS_SCTRL\MIMOSA34\I2C_ms_gui_labo_Debug.bat", "C:\CCMOS_SCTRL\MIMOSA34\") + WinWait($chipsoftware[0]) + EndIf + WinWait("I2C control Software for Mimosa32") +EndFunc + +Func CheckIfBoardOK() + ControlClick($chipsoftware[0], "", "[TEXT:Inactive;CLASS:TButton]") ; Activate Polling + Local $i = 0 + While (ControlGetText($chipsoftware[0], "", "TEdit6") <> "Target Board OK") + If ($i > 20) Then + MsgBox(16, "Message", "Mimosa board could not be polled, please check if board is connected properly.") + Exit + EndIf + $i = $i + 1 + Sleep(500) + WEnd + ControlClick($chipsoftware[0], "", "[TEXT:Active;CLASS:TButton]") +EndFunc + +Func GotoDebugTab() + Local $i = 0 + While (ControlGetText($chipsoftware[0], "", $chipsoftware[1]) <> "Debug") + If ($i > 20) Then + MsgBox(16, "Message", "Debug tab not found in I2C Control software!") + Exit + EndIf + ControlCommand($chipsoftware[0], "", $chipsoftware[2], "TabRight") + $i = $i + 1 + Sleep(100) + WEnd +EndFunc + +Func GotoFirstTab() + For $i = 0 To 20 + ControlCommand($chipsoftware[0], "", $chipsoftware[2], "TabLeft") + Next +EndFunc + +Func ProgramMi() + ControlClick($chipsoftware[0], "", "[TEXT:Prog All Analog;CLASS:TButton]") ; Program! + Sleep(1000) +EndFunc + diff --git a/bot/Mimosa32.au3 b/bot/Mimosa32.au3 index 35994ec..0a8d7d5 100755 --- a/bot/Mimosa32.au3 +++ b/bot/Mimosa32.au3 @@ -1,50 +1,50 @@ -#include -Global $Mi32_buttons[3] = ["Edit2", "TCSpinEdit4", "TEdit15"] - -Func Mi32_GotoMiTab() - GotoFirstTab() - $i = 0 - While (ControlGetText($chipsoftware[0], "", $chipsoftware[1]) <> "Mi32 A") - If ($i > 20) Then - MsgBox(0, "Message", "Mi32 A tab not found in I2C Control software!") - Exit - EndIf - ControlCommand($chipsoftware[0], "", $chipsoftware[2], "TabRight") - $i = $i + 1 - Sleep(100) - WEnd -EndFunc - -Func Mi32_SelectBoard() - GotoFirstTab() - ControlCommand($chipsoftware[0], "", "[TEXT:Mimosa32]", "Check") -EndFunc - -Func Mi32_GetVref() - return ControlGetText($chipsoftware[0], "", $Mi32_buttons[2]) -EndFunc - -Func Mi32_SetVref($vref) - ControlSetText($chipsoftware[0], "", $Mi32_buttons[2], $vref) -EndFunc - -Func Mi32_SetMiParameter($matrix, $vref) - ControlFocus($chipsoftware[0], "", $Mi32_buttons[0]) - ControlSetText($chipsoftware[0], "", $Mi32_buttons[0], "") - Sleep(100) - ControlSend($chipsoftware[0], "", $Mi32_buttons[0], $matrix) - Sleep(100) - ;Send($matrix) - ControlCommand($chipsoftware[0], "", "[TEXT:Clamp Enabled]", "Uncheck") - ControlCommand($chipsoftware[0], "", "[TEXT:High (Default)]", "Check") - ControlFocus($chipsoftware[0], "", $Mi32_buttons[1]) - ControlSetText($chipsoftware[0], "", $Mi32_buttons[1], "") - Sleep(100) - ControlSetText($chipsoftware[0], "", $Mi32_buttons[1], "1") - Sleep(100) - ControlFocus($chipsoftware[0], "", $Mi32_buttons[2]) - ControlSetText($chipsoftware[0], "", $Mi32_buttons[2], "") - Sleep(100) - ControlSetText($chipsoftware[0], "", $Mi32_buttons[2], $vref) - Sleep(100) -EndFunc +#include +Global $Mi32_buttons[3] = ["Edit2", "TCSpinEdit4", "TEdit15"] + +Func Mi32_GotoMiTab() + GotoFirstTab() + $i = 0 + While (ControlGetText($chipsoftware[0], "", $chipsoftware[1]) <> "Mi32 A") + If ($i > 20) Then + MsgBox(0, "Message", "Mi32 A tab not found in I2C Control software!") + Exit + EndIf + ControlCommand($chipsoftware[0], "", $chipsoftware[2], "TabRight") + $i = $i + 1 + Sleep(100) + WEnd +EndFunc + +Func Mi32_SelectBoard() + GotoFirstTab() + ControlCommand($chipsoftware[0], "", "[TEXT:Mimosa32]", "Check") +EndFunc + +Func Mi32_GetVref() + return ControlGetText($chipsoftware[0], "", $Mi32_buttons[2]) +EndFunc + +Func Mi32_SetVref($vref) + ControlSetText($chipsoftware[0], "", $Mi32_buttons[2], $vref) +EndFunc + +Func Mi32_SetMiParameter($matrix, $vref) + ControlFocus($chipsoftware[0], "", $Mi32_buttons[0]) + ControlSetText($chipsoftware[0], "", $Mi32_buttons[0], "") + Sleep(100) + ControlSend($chipsoftware[0], "", $Mi32_buttons[0], $matrix) + Sleep(100) + ;Send($matrix) + ControlCommand($chipsoftware[0], "", "[TEXT:Clamp Enabled]", "Uncheck") + ControlCommand($chipsoftware[0], "", "[TEXT:High (Default)]", "Check") + ControlFocus($chipsoftware[0], "", $Mi32_buttons[1]) + ControlSetText($chipsoftware[0], "", $Mi32_buttons[1], "") + Sleep(100) + ControlSetText($chipsoftware[0], "", $Mi32_buttons[1], "1") + Sleep(100) + ControlFocus($chipsoftware[0], "", $Mi32_buttons[2]) + ControlSetText($chipsoftware[0], "", $Mi32_buttons[2], "") + Sleep(100) + ControlSetText($chipsoftware[0], "", $Mi32_buttons[2], $vref) + Sleep(100) +EndFunc diff --git a/bot/Mimosa32Ter.au3 b/bot/Mimosa32Ter.au3 index c54861e..07197e6 100755 --- a/bot/Mimosa32Ter.au3 +++ b/bot/Mimosa32Ter.au3 @@ -1,50 +1,50 @@ -#include -Global $Mi32Ter_buttons[3] = ["Edit2", "TCSpinEdit4", "TEdit27"] - -Func Mi32Ter_GotoMiTab() - GotoFirstTab() - $i = 0 - While (ControlGetText($chipsoftware[0], "", $chipsoftware[1]) <> "Mi32 Ter A") - If ($i > 20) Then - MsgBox(0, "Message", "Mi32 A tab not found in I2C Control software!") - Exit - EndIf - ControlCommand($chipsoftware[0], "", $chipsoftware[2], "TabRight") - $i = $i + 1 - Sleep(100) - WEnd -EndFunc - -Func Mi32Ter_SelectBoard() - GotoFirstTab() - ControlCommand($chipsoftware[0], "", "[TEXT:Mimosa32Ter]", "Check") -EndFunc - -Func Mi32Ter_GetVref() - return ControlGetText($chipsoftware[0], "", $Mi32Ter_buttons[2]) -EndFunc - -Func Mi32Ter_SetVref($vref) - ControlSetText($chipsoftware[0], "", $Mi32Ter_buttons[2], $vref) -EndFunc - -Func Mi32Ter_SetMiParameter($matrix, $vref) - ControlFocus($chipsoftware[0], "", $Mi32Ter_buttons[0]) - ControlSetText($chipsoftware[0], "", $Mi32Ter_buttons[0], "") - Sleep(100) - ControlSend($chipsoftware[0], "", $Mi32Ter_buttons[0], $matrix) - Sleep(100) - ;Send($matrix) - ControlCommand($chipsoftware[0], "", "[TEXT:Clamp Enabled]", "Uncheck") - ControlCommand($chipsoftware[0], "", "[TEXT:High (Default)]", "Check") - ControlFocus($chipsoftware[0], "", $Mi32Ter_buttons[1]) - ControlSetText($chipsoftware[0], "", $Mi32Ter_buttons[1], "") - Sleep(100) - ControlSetText($chipsoftware[0], "", $Mi32Ter_buttons[1], "1") - Sleep(100) - ControlFocus($chipsoftware[0], "", $Mi32Ter_buttons[2]) - ControlSetText($chipsoftware[0], "", $Mi32Ter_buttons[2], "") - Sleep(100) - ControlSetText($chipsoftware[0], "", $Mi32Ter_buttons[2], $vref) - Sleep(100) -EndFunc +#include +Global $Mi32Ter_buttons[3] = ["Edit2", "TCSpinEdit4", "TEdit27"] + +Func Mi32Ter_GotoMiTab() + GotoFirstTab() + $i = 0 + While (ControlGetText($chipsoftware[0], "", $chipsoftware[1]) <> "Mi32 Ter A") + If ($i > 20) Then + MsgBox(0, "Message", "Mi32 A tab not found in I2C Control software!") + Exit + EndIf + ControlCommand($chipsoftware[0], "", $chipsoftware[2], "TabRight") + $i = $i + 1 + Sleep(100) + WEnd +EndFunc + +Func Mi32Ter_SelectBoard() + GotoFirstTab() + ControlCommand($chipsoftware[0], "", "[TEXT:Mimosa32Ter]", "Check") +EndFunc + +Func Mi32Ter_GetVref() + return ControlGetText($chipsoftware[0], "", $Mi32Ter_buttons[2]) +EndFunc + +Func Mi32Ter_SetVref($vref) + ControlSetText($chipsoftware[0], "", $Mi32Ter_buttons[2], $vref) +EndFunc + +Func Mi32Ter_SetMiParameter($matrix, $vref) + ControlFocus($chipsoftware[0], "", $Mi32Ter_buttons[0]) + ControlSetText($chipsoftware[0], "", $Mi32Ter_buttons[0], "") + Sleep(100) + ControlSend($chipsoftware[0], "", $Mi32Ter_buttons[0], $matrix) + Sleep(100) + ;Send($matrix) + ControlCommand($chipsoftware[0], "", "[TEXT:Clamp Enabled]", "Uncheck") + ControlCommand($chipsoftware[0], "", "[TEXT:High (Default)]", "Check") + ControlFocus($chipsoftware[0], "", $Mi32Ter_buttons[1]) + ControlSetText($chipsoftware[0], "", $Mi32Ter_buttons[1], "") + Sleep(100) + ControlSetText($chipsoftware[0], "", $Mi32Ter_buttons[1], "1") + Sleep(100) + ControlFocus($chipsoftware[0], "", $Mi32Ter_buttons[2]) + ControlSetText($chipsoftware[0], "", $Mi32Ter_buttons[2], "") + Sleep(100) + ControlSetText($chipsoftware[0], "", $Mi32Ter_buttons[2], $vref) + Sleep(100) +EndFunc diff --git a/bot/Mimosa34.au3 b/bot/Mimosa34.au3 index 8adb2ec..0fade9d 100755 --- a/bot/Mimosa34.au3 +++ b/bot/Mimosa34.au3 @@ -1,50 +1,50 @@ -#include -Global $Mi34_buttons[3] = ["Edit2", "TCSpinEdit5", "TEdit11"] - -Func Mi34_GotoMiTab() - GotoFirstTab() - $i = 0 - While (ControlGetText($chipsoftware[0], "", $chipsoftware[1]) <> "Mi34") - If ($i > 20) Then - MsgBox(0, "Message", "Mi34 tab not found in I2C Control software!") - Exit - EndIf - ControlCommand($chipsoftware[0], "", $chipsoftware[2], "TabRight") - $i = $i + 1 - Sleep(100) - WEnd -EndFunc - -Func Mi34_SelectBoard() - GotoFirstTab() - ControlCommand($chipsoftware[0], "", "[TEXT:Mimosa34]", "Check") -EndFunc - -Func Mi34_GetVref() - return ControlGetText($chipsoftware[0], "", $Mi34_buttons[2]) -EndFunc - -Func Mi34_SetVref($vref) - ControlSetText($chipsoftware[0], "", $Mi34_buttons[2], $vref) -EndFunc - -Func Mi34_SetMiParameter($matrix, $vref) - ControlFocus($chipsoftware[0], "", $Mi34_buttons[0]) - ControlSetText($chipsoftware[0], "", $Mi34_buttons[0], "") - Sleep(100) - ControlSend($chipsoftware[0], "", $Mi34_buttons[0], $matrix) - Sleep(100) - ;Send($matrix) - ;ControlCommand($chipsoftware[0], "", "[TEXT:Clamp Enabled]", "Uncheck") - ;ControlCommand($chipsoftware[0], "", "[TEXT:High (Default)]", "Check") - ControlFocus($chipsoftware[0], "", $Mi34_buttons[1]) - ControlSetText($chipsoftware[0], "", $Mi34_buttons[1], "") - Sleep(100) - ControlSetText($chipsoftware[0], "", $Mi34_buttons[1], "1") - Sleep(100) - ControlFocus($chipsoftware[0], "", $Mi34_buttons[2]) - ControlSetText($chipsoftware[0], "", $Mi34_buttons[2], "") - Sleep(100) - ControlSetText($chipsoftware[0], "", $Mi34_buttons[2], $vref) - Sleep(100) -EndFunc +#include +Global $Mi34_buttons[3] = ["Edit2", "TCSpinEdit5", "TEdit11"] + +Func Mi34_GotoMiTab() + GotoFirstTab() + $i = 0 + While (ControlGetText($chipsoftware[0], "", $chipsoftware[1]) <> "Mi34") + If ($i > 20) Then + MsgBox(0, "Message", "Mi34 tab not found in I2C Control software!") + Exit + EndIf + ControlCommand($chipsoftware[0], "", $chipsoftware[2], "TabRight") + $i = $i + 1 + Sleep(100) + WEnd +EndFunc + +Func Mi34_SelectBoard() + GotoFirstTab() + ControlCommand($chipsoftware[0], "", "[TEXT:Mimosa34]", "Check") +EndFunc + +Func Mi34_GetVref() + return ControlGetText($chipsoftware[0], "", $Mi34_buttons[2]) +EndFunc + +Func Mi34_SetVref($vref) + ControlSetText($chipsoftware[0], "", $Mi34_buttons[2], $vref) +EndFunc + +Func Mi34_SetMiParameter($matrix, $vref) + ControlFocus($chipsoftware[0], "", $Mi34_buttons[0]) + ControlSetText($chipsoftware[0], "", $Mi34_buttons[0], "") + Sleep(100) + ControlSend($chipsoftware[0], "", $Mi34_buttons[0], $matrix) + Sleep(100) + ;Send($matrix) + ;ControlCommand($chipsoftware[0], "", "[TEXT:Clamp Enabled]", "Uncheck") + ;ControlCommand($chipsoftware[0], "", "[TEXT:High (Default)]", "Check") + ControlFocus($chipsoftware[0], "", $Mi34_buttons[1]) + ControlSetText($chipsoftware[0], "", $Mi34_buttons[1], "") + Sleep(100) + ControlSetText($chipsoftware[0], "", $Mi34_buttons[1], "1") + Sleep(100) + ControlFocus($chipsoftware[0], "", $Mi34_buttons[2]) + ControlSetText($chipsoftware[0], "", $Mi34_buttons[2], "") + Sleep(100) + ControlSetText($chipsoftware[0], "", $Mi34_buttons[2], $vref) + Sleep(100) +EndFunc diff --git a/bot/Mimosa_Autorun.au3 b/bot/Mimosa_Autorun.au3 index 64d3c75..e82be55 100755 --- a/bot/Mimosa_Autorun.au3 +++ b/bot/Mimosa_Autorun.au3 @@ -1,395 +1,395 @@ -; -; 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 "Mimosa32.au3" -#include "Mimosa32Ter.au3" -#include "Mimosa34.au3" - -$programversion = "0.7" -$FileName = IniRead ( "config.ini", "experimental setup", "ExcelPath", "H:\dennis doering\Arbeitsprogramme\Mimosa34\LaborbuchMi34.xls" ) ; read path to Excel file -$systemtemp = IniRead ( "config.ini", "experimental setup", "SystemTemperature", "20" ) ; current temperatur of the system -$chipversion = IniRead ( "config.ini", "experimental setup", "ChipVersion", "Mi34" ) ; current chip generation in the system -$chipinstalled = IniRead ( "config.ini", "experimental setup", "ChipInstalled", "5" ) ; chip number currently mounted into the system -$radSource = IniRead ( "config.ini", "experimental setup", "RadSource", "none" ) ; current radioactive source of the system - -$excelLineBegin = "46" ; Change this to the range of cells you want to be processed -$excelLineEnd = "500" -Global $vref = 650 ; Initial vref, will be adjusted during runtime - -;create virtual functions -Func GotoMiTab() - Call ( $chipversion & "_GotoMiTab" ) -EndFunc - -Func GetVref() - Return Call ( $chipversion & "_GetVref" ) -EndFunc - -Func SetVref($vref) - Call ( $chipversion & "_SetVref", $vref ) -EndFunc - -Func SetMiParameter($matrix, $vref) - Call ( $chipversion & "_SetMiParameter", $matrix, $vref ) -EndFunc - -Func SelectBoard() - Call ( $chipversion & "_SelectBoard" ) -EndFunc - -$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 & _ - "Temperatur: " & $systemtemp & " °C" & @CRLF & _ - "Radioactive source: " & $radSource & @CRLF & _ - "Chip: " & $chipversion & " (" & $chipinstalled & ")"& @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 - ;Msgbox (0,"Excel Data Test","Debugging information for retrieved cells:" & @CRLF & _ - ; "Number of dimensions: " & UBound($aArray,0) & @CRLF & _ - ; "Size of first dimension: " & Ubound($aArray,1) & @CRLF & _ - ; "Size of second dimension: " & Ubound($aArray,2)) - ; "Size of second dimension: " & Ubound($aArray,2)) - - ; The next lines are just for debugging purposes, it puts all cell values into - ; a string to display in a MsgBox. - ; Note: you can't use a FOR..IN loop for a multi-dimensional array! -;~ ; debugging read data -;~ $string="" -;~ for $x=0 to ubound($aArray,1)-1 -;~ for $y=0 to ubound ($aArray,2)-1 -;~ $string=$string & "(" & $x & "," & $y & ")=" & $aArray[$x][$y] & @CRLF -;~ Next -;~ Next -;~ Msgbox(0,"Excel Data Test","Debug information: Read Cell contents: " & @CRLF & $string) - - $totallexcelines=UBound($aArray, 2) - $totalruns = 0 - For $run = 0 To UBound($aArray, 2) - 1 - If ($aArray[4][$run] == $systemtemp And $aArray[6][$run] == $chipinstalled And "Mi"&$aArray[2][$run] == $chipversion And $aArray[10][$run] == $radSource 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 - - 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 - - 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 - EndIf - Sleep(500) - $i = $i + 1 - If ($i > 20) Then - MsgBox(16, "Message", "USB Boards could be not OK! Please check the Debug output.") - Exit - EndIf - Until 1 - If StringRegExp ( $text, "[1-9]+ Errors" ) Then ; for some reasons the previous check sometimes doesn't work. - MsgBox(16, "Message", "USB Boards could be not OK! Please check the Debug output.") - Exit - EndIf - - - WinClose("Debug") - WinWaitClose("Debug", 1000) - $aArray = 0 - $totalrealruns=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[4][0] == $systemtemp And $currentline[6][0] == $chipinstalled And "Mi"&$currentline[2][0] == $chipversion And $currentline[10][0] == $radSource And $currentline[0][0] == "") Then - $clock = $currentline[11][0] ; save needed clock - If $clock == "" Then - $clock = "100" - $currentline[11][0] = "100" - EndIf - $runnum = $currentline[3][0] ; save runnumber - $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() - - If ($clock == "100") Then - ControlCommand($chipsoftware[0], "", "[TEXT:Intern]", "Check") - ;If (Not ControlCommand("I2C control Software for Mimosa32", "", "[TEXT:Intern]", "IsChecked")) Then - ;Msgbox (16,"Message","Could not set clock to intern") - ;EndIf - Else - ShellExecuteWait ("C:\Programme\PuTTY\plink.exe", "-ssh cerberus /home/maps/bin/vxi11_cmd 192.168.10.152 'SOURce1:FREQuency:Fixed " & $clock & "Mhz'", "", "", @SW_HIDE) - ShellExecuteWait ("C:\Programme\PuTTY\plink.exe", "-ssh cerberus /home/maps/bin/vxi11_cmd 192.168.10.152 'SOURce1:VOLTage:HIGH 3.3'", "", "", @SW_HIDE) - ShellExecuteWait ("C:\Programme\PuTTY\plink.exe", "-ssh cerberus /home/maps/bin/vxi11_cmd 192.168.10.152 'SOURce1:VOLTage:LOW 0'", "", "", @SW_HIDE) - ShellExecuteWait ("C:\Programme\PuTTY\plink.exe", "-ssh cerberus /home/maps/bin/vxi11_cmd 192.168.10.152 'OUTPut1:STATe ON'", "", "", @SW_HIDE) - Sleep(500) - 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() - - If WinExists("CMOS USB DAQ V3.5.10") = True Then - ;WinActivate("CMOS USB DAQ V3.5.10") - Else - Run("C:\ccmos_daq\v3.5.10\daq_v3.5.10.bat", "C:\ccmos_daq\v3.5.10\") - EndIf - WinWait("CMOS USB DAQ V3.5.10") - - For $i = 0 To 20 - ControlCommand("CMOS USB DAQ V3.5.10", "", "TPageControl1", "TabLeft") - Next - $i = 0 - While (ControlGetText("CMOS USB DAQ V3.5.10", "", "TTabSheet1") <> "Run Parameters") - If ($i > 20) Then - MsgBox(0, "Message", "CMOS USB DAQ V3.5.10 RUN tab not found in DAQ software!") - Exit - EndIf - ControlCommand("CMOS USB DAQ V3.5.10", "", "TPageControl1", "TabRight") - $i = $i + 1 - Sleep(100) - WEnd - - ControlSetText("CMOS USB DAQ V3.5.10", "", "TEdit23", "") - Sleep(100) - ControlFocus("CMOS USB DAQ V3.5.10", "", "TEdit23") - ;Send($runnum) - ControlSend("CMOS USB DAQ V3.5.10", "", "TEdit23", $runnum) - - ControlSetText("CMOS USB DAQ V3.5.10", "", "TEdit22", "") - Sleep(100) - ControlFocus("CMOS USB DAQ V3.5.10", "", "TEdit22") -;~ Send($eventnum) - ControlSend("CMOS USB DAQ V3.5.10", "", "TEdit22", $eventnum) - ControlFocus("CMOS USB DAQ V3.5.10", "", "TEdit23") - - Sleep(1000) - $starttime = _NowCalc() - - ControlClick("CMOS USB DAQ V3.5.10", "", "[TEXT:Start Run;CLASS:TButton]") - ;WinWaitActive("Avertissement") ;Force overwrite - ;ControlClick("Avertissement", "", "TButton2") - - Sleep(500) - If (WinExists("Avertissement")) Then - MsgBox(16, "Message", "Stopping. Could overwrite data!") - Exit - EndIf - - - $i = 0 - While (ControlGetText("CMOS USB DAQ V3.5.10", "", "TTabSheet1") <> "Local Monitoring") - If ($i > 20) Then - MsgBox(0, "Message", "CMOS USB DAQ V3.5.10 Local Monitoring tab not found in DAQ software!") - Exit - EndIf - ControlCommand("CMOS USB DAQ V3.5.10", "", "TPageControl1", "TabRight") - $i = $i + 1 - Sleep(100) - WEnd - - Sleep(1000) - - $avg = ControlGetText("CMOS USB DAQ V3.5.10", "", "[TEXT:DispAvg;CLASS:TEdit]") - For $i = 0 To 20 - ControlCommand("CMOS USB DAQ V3.5.10", "", "TPageControl1", "TabLeft") - Next - $i = 0 - While (ControlGetText("CMOS USB DAQ V3.5.10", "", "TTabSheet1") <> "Run Parameters") - If ($i > 20) Then - MsgBox(0, "Message", "CMOS USB DAQ V3.5.10 RUN tab not found in DAQ software!") - Exit - EndIf - ControlCommand("CMOS USB DAQ V3.5.10", "", "TPageControl1", "TabRight") - $i = $i + 1 - Sleep(100) - WEnd - $j = 0 - If ($avg > 2300 Or $avg < 1700) Then - Do - ControlClick("CMOS USB DAQ V3.5.10", "", "[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 - MsgBox(0, "Message", "Stopped, vref value needs to be too low (<300) or too high (>1000), please check manually!") - Exit - EndIf - - ;ControlSetText("I2C control Software for Mimosa32", "", "TEdit11", $vref) - ;ControlClick("I2C control Software for Mimosa32", "", "[TEXT:Prog All Analog;CLASS:TButton]") - SetVref($vref) - ProgramMi() - ;WinActivate("CMOS USB DAQ V3.5.10") - WinWait("CMOS USB DAQ V3.5.10") - Sleep(1000) - ControlClick("CMOS USB DAQ V3.5.10", "", "[TEXT:Start Run;CLASS:TButton]") - WinWait("Avertissement") - ControlClick("Avertissement", "", "TButton2") - - - $i = 0 - While (ControlGetText("CMOS USB DAQ V3.5.10", "", "TTabSheet1") <> "Local Monitoring") - If ($i > 20) Then - MsgBox(0, "Message", "CMOS USB DAQ V3.5.10 Local Monitoring tab not found in DAQ software!") - Exit - EndIf - ControlCommand("CMOS USB DAQ V3.5.10", "", "TPageControl1", "TabRight") - $i = $i + 1 - Sleep(100) - WEnd - - Sleep(1000) - - $avg = ControlGetText("CMOS USB DAQ V3.5.10", "", "[TEXT:DispAvg;CLASS:TEdit]") - For $i = 0 To 20 - ControlCommand("CMOS USB DAQ V3.5.10", "", "TPageControl1", "TabLeft") - Next - $i = 0 - While (ControlGetText("CMOS USB DAQ V3.5.10", "", "TTabSheet1") <> "Run Parameters") - If ($i > 20) Then - MsgBox(0, "Message", "CMOS USB DAQ V3.5.10 RUN tab not found in DAQ software!") - Exit - EndIf - ControlCommand("CMOS USB DAQ V3.5.10", "", "TPageControl1", "TabRight") - $i = $i + 1 - Sleep(100) - WEnd - - $j = $j + 1 - If ($j > 7) Then - ControlClick("CMOS USB DAQ V3.5.10", "", "[TEXT:Stop Run;CLASS:TButton]") - MsgBox(0, "Message", "VRef could not be set properly") - Exit - EndIf - - Until ($avg < 2300 And $avg > 1700) - EndIf - - While (ControlGetText("CMOS USB DAQ V3.5.10", "", "TEdit18") < $eventnum) - Sleep(10000) - ;If EnvGet('SESSIONNAME') <> "Console" Then - ;ShowWarning() - ;EndIf - ;WinWait("CMOS USB DAQ V3.5.10") - WEnd - WinWait("CMOS USB DAQ V3.5.10") - ControlClick("CMOS USB DAQ V3.5.10", "", "[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 - $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 - EndIf - Next - ShellExecuteWait("C:\Programme\PuTTY\plink.exe", "-ssh cerberus /home/maps/bin/vxi11_cmd 192.168.10.152 'OUTPut1:STATe Off'", "", "", @SW_HIDE) - MsgBox(0, "Sucess!", "All runs (" & $totalrealruns & ") ended without errors." & @CRLF & _ - "Please check the Excel sheet and the results for errors.") - - Else - MsgBox(0, "Excel Data Test", "Error: Could not retrieve data from cell range: " & $CellRange) - EndIf - -Else - MsgBox(0, "Excel Data Test", "Error: Could not open " & $FileName & " as an Excel Object.") -EndIf - -$oExcelDoc = 0 - - -Func SGN($i) - Return ($i>0)-($i<0) - EndFunc ;==>SGN - - Func CheckValues($vref, $matrix, $runnum, $eventnum, $clock) - Return 0 -EndFunc +; +; 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 "Mimosa32.au3" +#include "Mimosa32Ter.au3" +#include "Mimosa34.au3" + +$programversion = "0.7" +$FileName = IniRead ( "config.ini", "experimental setup", "ExcelPath", "H:\dennis doering\Arbeitsprogramme\Mimosa34\LaborbuchMi34.xls" ) ; read path to Excel file +$systemtemp = IniRead ( "config.ini", "experimental setup", "SystemTemperature", "20" ) ; current temperatur of the system +$chipversion = IniRead ( "config.ini", "experimental setup", "ChipVersion", "Mi34" ) ; current chip generation in the system +$chipinstalled = IniRead ( "config.ini", "experimental setup", "ChipInstalled", "5" ) ; chip number currently mounted into the system +$radSource = IniRead ( "config.ini", "experimental setup", "RadSource", "none" ) ; current radioactive source of the system + +$excelLineBegin = "46" ; Change this to the range of cells you want to be processed +$excelLineEnd = "500" +Global $vref = 650 ; Initial vref, will be adjusted during runtime + +;create virtual functions +Func GotoMiTab() + Call ( $chipversion & "_GotoMiTab" ) +EndFunc + +Func GetVref() + Return Call ( $chipversion & "_GetVref" ) +EndFunc + +Func SetVref($vref) + Call ( $chipversion & "_SetVref", $vref ) +EndFunc + +Func SetMiParameter($matrix, $vref) + Call ( $chipversion & "_SetMiParameter", $matrix, $vref ) +EndFunc + +Func SelectBoard() + Call ( $chipversion & "_SelectBoard" ) +EndFunc + +$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 & _ + "Temperatur: " & $systemtemp & " °C" & @CRLF & _ + "Radioactive source: " & $radSource & @CRLF & _ + "Chip: " & $chipversion & " (" & $chipinstalled & ")"& @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 + ;Msgbox (0,"Excel Data Test","Debugging information for retrieved cells:" & @CRLF & _ + ; "Number of dimensions: " & UBound($aArray,0) & @CRLF & _ + ; "Size of first dimension: " & Ubound($aArray,1) & @CRLF & _ + ; "Size of second dimension: " & Ubound($aArray,2)) + ; "Size of second dimension: " & Ubound($aArray,2)) + + ; The next lines are just for debugging purposes, it puts all cell values into + ; a string to display in a MsgBox. + ; Note: you can't use a FOR..IN loop for a multi-dimensional array! +;~ ; debugging read data +;~ $string="" +;~ for $x=0 to ubound($aArray,1)-1 +;~ for $y=0 to ubound ($aArray,2)-1 +;~ $string=$string & "(" & $x & "," & $y & ")=" & $aArray[$x][$y] & @CRLF +;~ Next +;~ Next +;~ Msgbox(0,"Excel Data Test","Debug information: Read Cell contents: " & @CRLF & $string) + + $totallexcelines=UBound($aArray, 2) + $totalruns = 0 + For $run = 0 To UBound($aArray, 2) - 1 + If ($aArray[4][$run] == $systemtemp And $aArray[6][$run] == $chipinstalled And "Mi"&$aArray[2][$run] == $chipversion And $aArray[10][$run] == $radSource 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 + + 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 + + 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 + EndIf + Sleep(500) + $i = $i + 1 + If ($i > 20) Then + MsgBox(16, "Message", "USB Boards could be not OK! Please check the Debug output.") + Exit + EndIf + Until 1 + If StringRegExp ( $text, "[1-9]+ Errors" ) Then ; for some reasons the previous check sometimes doesn't work. + MsgBox(16, "Message", "USB Boards could be not OK! Please check the Debug output.") + Exit + EndIf + + + WinClose("Debug") + WinWaitClose("Debug", 1000) + $aArray = 0 + $totalrealruns=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[4][0] == $systemtemp And $currentline[6][0] == $chipinstalled And "Mi"&$currentline[2][0] == $chipversion And $currentline[10][0] == $radSource And $currentline[0][0] == "") Then + $clock = $currentline[11][0] ; save needed clock + If $clock == "" Then + $clock = "100" + $currentline[11][0] = "100" + EndIf + $runnum = $currentline[3][0] ; save runnumber + $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() + + If ($clock == "100") Then + ControlCommand($chipsoftware[0], "", "[TEXT:Intern]", "Check") + ;If (Not ControlCommand("I2C control Software for Mimosa32", "", "[TEXT:Intern]", "IsChecked")) Then + ;Msgbox (16,"Message","Could not set clock to intern") + ;EndIf + Else + ShellExecuteWait ("C:\Programme\PuTTY\plink.exe", "-ssh cerberus /home/maps/bin/vxi11_cmd 192.168.10.152 'SOURce1:FREQuency:Fixed " & $clock & "Mhz'", "", "", @SW_HIDE) + ShellExecuteWait ("C:\Programme\PuTTY\plink.exe", "-ssh cerberus /home/maps/bin/vxi11_cmd 192.168.10.152 'SOURce1:VOLTage:HIGH 3.3'", "", "", @SW_HIDE) + ShellExecuteWait ("C:\Programme\PuTTY\plink.exe", "-ssh cerberus /home/maps/bin/vxi11_cmd 192.168.10.152 'SOURce1:VOLTage:LOW 0'", "", "", @SW_HIDE) + ShellExecuteWait ("C:\Programme\PuTTY\plink.exe", "-ssh cerberus /home/maps/bin/vxi11_cmd 192.168.10.152 'OUTPut1:STATe ON'", "", "", @SW_HIDE) + Sleep(500) + 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() + + If WinExists("CMOS USB DAQ V3.5.10") = True Then + ;WinActivate("CMOS USB DAQ V3.5.10") + Else + Run("C:\ccmos_daq\v3.5.10\daq_v3.5.10.bat", "C:\ccmos_daq\v3.5.10\") + EndIf + WinWait("CMOS USB DAQ V3.5.10") + + For $i = 0 To 20 + ControlCommand("CMOS USB DAQ V3.5.10", "", "TPageControl1", "TabLeft") + Next + $i = 0 + While (ControlGetText("CMOS USB DAQ V3.5.10", "", "TTabSheet1") <> "Run Parameters") + If ($i > 20) Then + MsgBox(0, "Message", "CMOS USB DAQ V3.5.10 RUN tab not found in DAQ software!") + Exit + EndIf + ControlCommand("CMOS USB DAQ V3.5.10", "", "TPageControl1", "TabRight") + $i = $i + 1 + Sleep(100) + WEnd + + ControlSetText("CMOS USB DAQ V3.5.10", "", "TEdit23", "") + Sleep(100) + ControlFocus("CMOS USB DAQ V3.5.10", "", "TEdit23") + ;Send($runnum) + ControlSend("CMOS USB DAQ V3.5.10", "", "TEdit23", $runnum) + + ControlSetText("CMOS USB DAQ V3.5.10", "", "TEdit22", "") + Sleep(100) + ControlFocus("CMOS USB DAQ V3.5.10", "", "TEdit22") +;~ Send($eventnum) + ControlSend("CMOS USB DAQ V3.5.10", "", "TEdit22", $eventnum) + ControlFocus("CMOS USB DAQ V3.5.10", "", "TEdit23") + + Sleep(1000) + $starttime = _NowCalc() + + ControlClick("CMOS USB DAQ V3.5.10", "", "[TEXT:Start Run;CLASS:TButton]") + ;WinWaitActive("Avertissement") ;Force overwrite + ;ControlClick("Avertissement", "", "TButton2") + + Sleep(500) + If (WinExists("Avertissement")) Then + MsgBox(16, "Message", "Stopping. Could overwrite data!") + Exit + EndIf + + + $i = 0 + While (ControlGetText("CMOS USB DAQ V3.5.10", "", "TTabSheet1") <> "Local Monitoring") + If ($i > 20) Then + MsgBox(0, "Message", "CMOS USB DAQ V3.5.10 Local Monitoring tab not found in DAQ software!") + Exit + EndIf + ControlCommand("CMOS USB DAQ V3.5.10", "", "TPageControl1", "TabRight") + $i = $i + 1 + Sleep(100) + WEnd + + Sleep(1000) + + $avg = ControlGetText("CMOS USB DAQ V3.5.10", "", "[TEXT:DispAvg;CLASS:TEdit]") + For $i = 0 To 20 + ControlCommand("CMOS USB DAQ V3.5.10", "", "TPageControl1", "TabLeft") + Next + $i = 0 + While (ControlGetText("CMOS USB DAQ V3.5.10", "", "TTabSheet1") <> "Run Parameters") + If ($i > 20) Then + MsgBox(0, "Message", "CMOS USB DAQ V3.5.10 RUN tab not found in DAQ software!") + Exit + EndIf + ControlCommand("CMOS USB DAQ V3.5.10", "", "TPageControl1", "TabRight") + $i = $i + 1 + Sleep(100) + WEnd + $j = 0 + If ($avg > 2300 Or $avg < 1700) Then + Do + ControlClick("CMOS USB DAQ V3.5.10", "", "[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 + MsgBox(0, "Message", "Stopped, vref value needs to be too low (<300) or too high (>1000), please check manually!") + Exit + EndIf + + ;ControlSetText("I2C control Software for Mimosa32", "", "TEdit11", $vref) + ;ControlClick("I2C control Software for Mimosa32", "", "[TEXT:Prog All Analog;CLASS:TButton]") + SetVref($vref) + ProgramMi() + ;WinActivate("CMOS USB DAQ V3.5.10") + WinWait("CMOS USB DAQ V3.5.10") + Sleep(1000) + ControlClick("CMOS USB DAQ V3.5.10", "", "[TEXT:Start Run;CLASS:TButton]") + WinWait("Avertissement") + ControlClick("Avertissement", "", "TButton2") + + + $i = 0 + While (ControlGetText("CMOS USB DAQ V3.5.10", "", "TTabSheet1") <> "Local Monitoring") + If ($i > 20) Then + MsgBox(0, "Message", "CMOS USB DAQ V3.5.10 Local Monitoring tab not found in DAQ software!") + Exit + EndIf + ControlCommand("CMOS USB DAQ V3.5.10", "", "TPageControl1", "TabRight") + $i = $i + 1 + Sleep(100) + WEnd + + Sleep(1000) + + $avg = ControlGetText("CMOS USB DAQ V3.5.10", "", "[TEXT:DispAvg;CLASS:TEdit]") + For $i = 0 To 20 + ControlCommand("CMOS USB DAQ V3.5.10", "", "TPageControl1", "TabLeft") + Next + $i = 0 + While (ControlGetText("CMOS USB DAQ V3.5.10", "", "TTabSheet1") <> "Run Parameters") + If ($i > 20) Then + MsgBox(0, "Message", "CMOS USB DAQ V3.5.10 RUN tab not found in DAQ software!") + Exit + EndIf + ControlCommand("CMOS USB DAQ V3.5.10", "", "TPageControl1", "TabRight") + $i = $i + 1 + Sleep(100) + WEnd + + $j = $j + 1 + If ($j > 7) Then + ControlClick("CMOS USB DAQ V3.5.10", "", "[TEXT:Stop Run;CLASS:TButton]") + MsgBox(0, "Message", "VRef could not be set properly") + Exit + EndIf + + Until ($avg < 2300 And $avg > 1700) + EndIf + + While (ControlGetText("CMOS USB DAQ V3.5.10", "", "TEdit18") < $eventnum) + Sleep(10000) + ;If EnvGet('SESSIONNAME') <> "Console" Then + ;ShowWarning() + ;EndIf + ;WinWait("CMOS USB DAQ V3.5.10") + WEnd + WinWait("CMOS USB DAQ V3.5.10") + ControlClick("CMOS USB DAQ V3.5.10", "", "[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 + $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 + EndIf + Next + ShellExecuteWait("C:\Programme\PuTTY\plink.exe", "-ssh cerberus /home/maps/bin/vxi11_cmd 192.168.10.152 'OUTPut1:STATe Off'", "", "", @SW_HIDE) + MsgBox(0, "Sucess!", "All runs (" & $totalrealruns & ") ended without errors." & @CRLF & _ + "Please check the Excel sheet and the results for errors.") + + Else + MsgBox(0, "Excel Data Test", "Error: Could not retrieve data from cell range: " & $CellRange) + EndIf + +Else + MsgBox(0, "Excel Data Test", "Error: Could not open " & $FileName & " as an Excel Object.") +EndIf + +$oExcelDoc = 0 + + +Func SGN($i) + Return ($i>0)-($i<0) + EndFunc ;==>SGN + + Func CheckValues($vref, $matrix, $runnum, $eventnum, $clock) + Return 0 +EndFunc diff --git a/bot/config.ini b/bot/config.ini index 95ed98b..43ac092 100755 --- a/bot/config.ini +++ b/bot/config.ini @@ -1,10 +1,10 @@ -[experimental setup] -ChipVersion = Mi32Ter -; Mi32, Mi32Ter or Mi34 -ChipInstalled= 4C -; chip currently mounted into the system -ExcelPath = "H:\dennis doering\Arbeitsprogramme\Mimosa34\LaborbuchMi34.xls" -SystemTemperature = 40 -; current temperatur of the system, only runs with this temepratur wiull be run -RadSource = none -; RadSource for which the runs should be performed +[experimental setup] +ChipVersion = Mi32Ter +; Mi32, Mi32Ter or Mi34 +ChipInstalled= 4C +; chip currently mounted into the system +ExcelPath = "H:\dennis doering\Arbeitsprogramme\Mimosa34\LaborbuchMi34.xls" +SystemTemperature = 40 +; current temperatur of the system, only runs with this temepratur wiull be run +RadSource = none +; RadSource for which the runs should be performed