diff --git a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_336.tcl b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_336.tcl index 12b94151..ad814667 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_336.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_336.tcl @@ -711,8 +711,13 @@ proc inTolerance {CtrlLoopIdx} { } if {$cmpIdString == 0 } { set wrStatus [ hgetpropval $tc_root/sensor/setpoint$CtrlLoopIdx writestatus ] - if {$wrStatus == "start"} { - continue + switch $wrStatus { + "start" { continue } + "commandsent" { + sct utime timecheck + sct utime timecheck2 + hsetprop $tc_root/sensor/setpoint$CtrlLoopIdx writestatus "ws_monitor" + } } # set nodename $tc_root/control/config_Loop_$CtrlLoopIdx # set iSensor [hval $nodename] @@ -1082,8 +1087,7 @@ proc getCorrespondingInputSensor {CtrlLoopIdx} { # @param iSensor indicates the corresponding input sensor (A,B,C or D) # @return retVal returns 1 if in tolerance, 0 else. proc checktol {tc_root currtime timecheck iLoop iSensor} { - if {[ catch { - set retVal 0 + set catch_status [ catch { set sensorValue $tc_root/sensor/sensorValue$iSensor set temp [hval $sensorValue] set isetp $tc_root/sensor/setpoint$iLoop @@ -1107,7 +1111,7 @@ proc checktol {tc_root currtime timecheck iLoop iSensor} { if {$::scobj::ls336::ls336_verbose==1} {puts "hset $tc_root/emon/isInTolerance_Lp$iLoop outsideTolerance"} if {$iLoop==1} { sct utime timecheck } if {$iLoop==2} { sct utime timecheck2 } - set retVal 0 + return 0 } else { set timeout $::scobj::ls336::ls340_settleTime if { $::scobj::ls336::ls336_LSmodel == 340 } { @@ -1120,20 +1124,18 @@ proc checktol {tc_root currtime timecheck iLoop iSensor} { if {$::scobj::ls336::ls336_verbose==1} { puts "hset $tc_root/emon/isInTolerance_Lp$iLoop inTolerance (elapsedTime=$elapsedTime greater than settleTime=$timeout)" } - set retVal 1 + return 1 } else { # Temperature has not been within tolerance for enough time - (overshoots, oscillations,..) hset $tc_root/emon/isInTolerance_Lp$iLoop "outsideTolerance" if {$::scobj::ls336::ls336_verbose==1} { puts "hset $tc_root/emon/isInTolerance_Lp$iLoop outsideTolerance (elapsedTime=$elapsedTime less than settleTime=$timeout)" } - set retVal 0 + return 0 } } - } message ]} { - return -code error "in checktol: $message. Last query command: $::scobj::ls336::ls336_lastQueryCmd" - } - return $retVal + } message ] + handle_exception $catch_status $message "Last query command: $::scobj::ls336::ls336_lastQueryCmd" } diff --git a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_340.tcl b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_340.tcl index a5440afa..c1a44276 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_340.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_340.tcl @@ -711,8 +711,13 @@ proc inTolerance {CtrlLoopIdx} { } if {$cmpIdString == 0 } { set wrStatus [ hgetpropval $tc_root/sensor/setpoint$CtrlLoopIdx writestatus ] - if {$wrStatus == "start"} { - continue + switch $wrStatus { + "start" { continue } + "commandsent" { + sct utime timecheck + sct utime timecheck2 + hsetprop $tc_root/sensor/setpoint$CtrlLoopIdx writestatus "ws_monitor" + } } # set nodename $tc_root/control/config_Loop_$CtrlLoopIdx # set iSensor [hval $nodename] @@ -1082,8 +1087,7 @@ proc getCorrespondingInputSensor {CtrlLoopIdx} { # @param iSensor indicates the corresponding input sensor (A,B,C or D) # @return retVal returns 1 if in tolerance, 0 else. proc checktol {tc_root currtime timecheck iLoop iSensor} { - if {[ catch { - set retVal 0 + set catch_status [ catch { set sensorValue $tc_root/sensor/sensorValue$iSensor set temp [hval $sensorValue] set isetp $tc_root/sensor/setpoint$iLoop @@ -1107,7 +1111,7 @@ proc checktol {tc_root currtime timecheck iLoop iSensor} { if {$::scobj::ls340::ls340_verbose==1} {puts "hset $tc_root/emon/isInTolerance_Lp$iLoop outsideTolerance"} if {$iLoop==1} { sct utime timecheck } if {$iLoop==2} { sct utime timecheck2 } - set retVal 0 + return 0 } else { set timeout $::scobj::ls340::ls340_settleTime if { $::scobj::ls340::ls340_LSmodel == 340 } { @@ -1120,20 +1124,18 @@ proc checktol {tc_root currtime timecheck iLoop iSensor} { if {$::scobj::ls340::ls340_verbose==1} { puts "hset $tc_root/emon/isInTolerance_Lp$iLoop inTolerance (elapsedTime=$elapsedTime greater than settleTime=$timeout)" } - set retVal 1 + return 1 } else { # Temperature has not been within tolerance for enough time - (overshoots, oscillations,..) hset $tc_root/emon/isInTolerance_Lp$iLoop "outsideTolerance" if {$::scobj::ls340::ls340_verbose==1} { puts "hset $tc_root/emon/isInTolerance_Lp$iLoop outsideTolerance (elapsedTime=$elapsedTime less than settleTime=$timeout)" } - set retVal 0 + return 0 } } - } message ]} { - return -code error "in checktol: $message. Last query command: $::scobj::ls340::ls340_lastQueryCmd" - } - return $retVal + } message ] + handle_exception $catch_status $message "Last query command: $::scobj::ls340::ls340_lastQueryCmd" }