]> jspc29.x-matter.uni-frankfurt.de Git - radhard.git/commitdiff
Bugfixes, added more stable temperature control
authorBenjamin Linnik <blinnik@jspc28.x-matter.uni-frankfurt.de>
Mon, 26 Aug 2013 17:00:54 +0000 (19:00 +0200)
committerBenjamin Linnik <blinnik@jspc28.x-matter.uni-frankfurt.de>
Mon, 26 Aug 2013 17:00:54 +0000 (19:00 +0200)
bot/Functions/BinaryIntegerConvert.au3 [changed mode: 0644->0755]
bot/Functions/RefreshGUI.au3 [changed mode: 0644->0755]
bot/Functions/SendNtfctn.au3 [changed mode: 0644->0755]
bot/Functions/TemperatureControl.au3
bot/Mimosa_Autorun.au3 [changed mode: 0644->0755]
bot/config.ini

old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index 7bce0ef59d9792a525f063c2b6fa5e0d0e9da18d..177f7966e4fdb6a8014590870a2e23236beecdce 100755 (executable)
@@ -3,10 +3,13 @@ AutoItSetOption("TrayIconHide", 1)
 $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Install a custom error handler
 
 If ($CmdLine[0] > 0) Then
-       SetTemperature($CmdLine[1])
+       $returnval = SetTemperature(Int($CmdLine[1]))
 Else
-       GetTemperature()
+       $returnval = GetTemperature() * 100
 EndIf
+ConsoleWrite($returnval) ;### Debug Console
+Exit $returnval
+
 
 Func GetTemperature()
        ;ConsoleWrite('@@ (6) :(' & @MIN & ':' & @SEC & ') GetTemperature()' & @CR) ;### Function Trace
@@ -28,6 +31,7 @@ Func GetTemperature()
                EndIf
        EndIf
        $oHTTP = 0
+       Return 1000
 EndFunc   ;==>GetTemperature
 
 Func SetTemperature($temperature)
@@ -49,13 +53,14 @@ Func SetTemperature($temperature)
                If $HTMLSource <> "" Then
                        $sucess = StringRegExp ( $HTMLSource, "okay")
                        If  $sucess Then
-                               MsgBox(0, "ok", "Yes!")
-                               Return 1
+                               Return 0
                        EndIf
                EndIf
                $oHTTP = 0
-       EndIf
-EndFunc   ;==>SetTemperature
+        EndIf
+     Return 100000
+ EndFunc   ;==>SetTemperature
+
 
 
 ; This is my custom error handler
old mode 100644 (file)
new mode 100755 (executable)
index f0c283e..93d6acc
 #include "Chips/Mimosa34.au3"
 #include "Functions/BinaryIntegerConvert.au3"
 #include "Functions/EpochConvert.au3"
-#include "Functions/TemperatureControl.au3"
-$programversion = "0.95"
+$programversion = "0.96"
 
-$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
+$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 = "46" ; Change this to the range of cells you want to be processed
-$excelLineEnd = "1000"
+$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 = ""
 
@@ -120,12 +119,16 @@ If (Not @error) And IsObj($oExcelDoc) Then ; Check again if everything went well
                        $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
@@ -146,21 +149,43 @@ If (Not @error) And IsObj($oExcelDoc) Then ; Check again if everything went well
                        $oDocument = $oExcelDoc.Worksheets(1) ; We use the 'Default' worksheet
                        $currentline = $oDocument.range($currentrange).value
 
-                       ;TODO
-                       $tempcorrent = False
-                       While Not $tempcorrent
-                               $currenttemp = GetTemperature()
-                               If ($currentline[4][0] < $currenttemp + 0.5 And $currentline[4][0] > $currenttemp - 0.5) Then
-                                       $tempcorrent = True
-                               Else
-                                       If Not SetTemperature($currentline[4][0]) Then
-                                               Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\SendNtfctn.au3" "Could not set temperature to "' & $currentline[4][0] & '". Will try again in 10 minutes."', @ScriptDir)
+                       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
-                                       Sleep(1000 * 60 * 10)
-                               EndIf
-                       WEnd
-
-                       If ($tempcorrent And $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
+                               WEnd
                                $clock = $currentline[11][0] ; save needed clock
                                If $clock == "" Then
                                        $clock = "100"
@@ -221,7 +246,7 @@ If (Not @error) And IsObj($oExcelDoc) Then ; Check again if everything went well
                                        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 & "/*")
+                                       ;FileDelete($savedir & "/" & $runnum & "/*")
                                        ContinueLoop
                                EndIf
                                ;_GUICtrlTab_SetCurFocus($hTab, 4) ; Go to "Local monitoring" tab ; not needed
@@ -245,7 +270,7 @@ If (Not @error) And IsObj($oExcelDoc) Then ; Check again if everything went well
                                                                $vref = $vref + SGN($diff) * 50
                                                EndSelect
                                                If ($vref > 1000 Or $vref < 300) Then
-                                                       Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Fuctions\SendNtfctn.au3" "Skipped run ' & $runnum & ', vref value could not be set properly. Frequency: ' & $clock & '"', @ScriptDir)
+                                                       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!'')"')
@@ -285,7 +310,7 @@ If (Not @error) And IsObj($oExcelDoc) Then ; Check again if everything went well
                                        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)
+                                               $calcmin = Int($calcsecestimate / 60)
                                                $calcsecestimate = Int($calcsecestimate)
                                                $timeend = _Epoch_encrypt(_NowCalc()) + $calcsecestimate
                                                $timeend = _Epoch_decrypt($timeend)
@@ -338,7 +363,7 @@ If (Not @error) And IsObj($oExcelDoc) Then ; Check again if everything went well
                $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
+               $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)
index e652d7e685d1daa20e31bb2f69efad9b0124bb5d..04a881b324844cb21d6832cb424d56c61fb8b196 100755 (executable)
@@ -1,9 +1,8 @@
 [experimental setup]
 ChipVersion = Mi34
-ChipInstalled = 14
+ChipInstalled = 5
 ExcelPath = H:\dennis doering\Arbeitsprogramme\Mimosa34\LaborbuchMi34.xls
-SystemTemperature = 20
-RadSource = Fe55
+RadSource = none
 Radiated = 0
 [various]
 Notify = 7