diff --git a/site_ansto/instrument/config/environment/temperature/sct_oxford_itc.tcl b/site_ansto/instrument/config/environment/temperature/sct_oxford_itc.tcl index c21edf2e..629d2580 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_oxford_itc.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_oxford_itc.tcl @@ -75,6 +75,9 @@ debug_log "rdValue $tc_root ITC503-a result=$data" set rslt [scan $data %f data] debug_log "rdValue $tc_root ITC503-b result=$data" } + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } if {$data != [sct oldval]} { sct oldval $data sct update $data @@ -235,48 +238,48 @@ debug_log "rdState $tc_root status($rslt)= X$the_x A$the_a C$the_c S[format %02d hsetprop $tc_root/itc500_state my_state "STATE_X" } if { $nextState == "" } { - set my_status "[SplitReply [hgetprop $tc_root/itc500_state my_status]]" + set my_status "[SplitReply [hgetprop $tc_root/itc500_state my_status]]" debug_log "rdState my_status=$my_status" - set rslt [scan $my_status "X%dA%dC%dS%dH%dL%d" the_x the_a the_c the_s the_h the_l] + set rslt [scan $my_status "X%dA%dC%dS%dH%dL%d" the_x the_a the_c the_s the_h the_l] debug_log "rdState $tc_root status($rslt)= X$the_x A$the_a C$the_c S[format %02d $the_s] H$the_h L$the_l" - set my_driving [SplitReply [hgetprop $tc_root/setpoint driving]] + set my_driving [SplitReply [hgetprop $tc_root/setpoint driving]] debug_log "rdState $tc_root: driving=$my_driving" - if {[ catch { - set val "[hval $tc_root/setpoint]" - } message ]} { - set val 0 + if {[ catch { + set val "[hval $tc_root/setpoint]" + } message ]} { + set val 0 debug_log "rdState $tc_root: setpoint=failure" - } + } debug_log "rdState $tc_root: setpoint=$val" - if {[hpropexists $tc_root/setpoint target]} { - set tgt [SplitReply [hgetprop $tc_root/setpoint target]] + if {[hpropexists $tc_root/setpoint target]} { + set tgt [SplitReply [hgetprop $tc_root/setpoint target]] debug_log "rdState $tc_root: target=$tgt" - } else { - hsetprop $tc_root/setpoint target $val - set tgt [SplitReply [hgetprop $tc_root/setpoint target]] + } else { + hsetprop $tc_root/setpoint target $val + set tgt [SplitReply [hgetprop $tc_root/setpoint target]] debug_log "rdState $tc_root: initialised target to: target=$tgt" - } - if {$my_driving > 0} { - if {[hval $tc_root/control_sensor] == "3"} { - set temp [hval $tc_root/sensor3/value] - } elseif {[hval $tc_root/control_sensor] == "2"} { - set temp [hval $tc_root/sensor2/value] - } else { - set temp [hval $tc_root/sensor/value] } - set tol [hval $tc_root/tolerance] - set lotemp [expr {$tgt - $tol}] - set hitemp [expr {$tgt + $tol}] + if {$my_driving > 0} { + if {[hval $tc_root/control_sensor] == "3"} { + set temp [hval $tc_root/sensor3/value] + } elseif {[hval $tc_root/control_sensor] == "2"} { + set temp [hval $tc_root/sensor2/value] + } else { + set temp [hval $tc_root/sensor/value] + } + set tol [hval $tc_root/tolerance] + set lotemp [expr {$tgt - $tol}] + set hitemp [expr {$tgt + $tol}] debug_log "rdState driving $tc_root until $temp in ($lotemp, $hitemp)" - if {$temp < $lotemp} { - } elseif {$temp > $hitemp} { - } else { - hset $tc_root/status "idle" - hsetprop $tc_root/setpoint driving 0 + if {$temp < $lotemp} { + } elseif {$temp > $hitemp} { + } else { + hset $tc_root/status "idle" + hsetprop $tc_root/setpoint driving 0 debug_log "rdState driving $tc_root finished at $temp in ($lotemp, $hitemp)" + } } - } - set nextState idle + set nextState idle } } catch_message ]} { debug_log "rdState error: $catch_message"