code cleanup

r2960 | dcl | 2010-06-25 15:06:37 +1000 (Fri, 25 Jun 2010) | 2 lines
This commit is contained in:
Douglas Clowes
2010-06-25 15:06:37 +10:00
parent 687ed01c01
commit cebd4d5600
3 changed files with 24 additions and 23 deletions

View File

@@ -69,7 +69,7 @@ debug_log "checktol $tc_root $currtime $timecheck"
return 0
} else {
set timeout [hval $tc_root/tolerance/settletime]
if {[expr $currtime - $timecheck] > $timeout} {
if { ($currtime - $timecheck) > $timeout } {
hset $tc_root/emon/isintol 1
}
return 1
@@ -103,8 +103,8 @@ debug_log "rdState $tc_root: result=$data"
if {$my_driving > 0} {
set temp [hval $tc_root/sensor/value]
set tol [hval $tc_root/tolerance]
set lotemp [expr $tgt - $tol]
set hitemp [expr $tgt + $tol]
set lotemp [expr {$tgt - $tol}]
set hitemp [expr {$tgt + $tol}]
debug_log "rdState driving $tc_root until $data in ($lotemp, $hitemp)"
if {$data < $lotemp} {
} elseif {$data > $hitemp} {
@@ -138,7 +138,7 @@ debug_log "rdState driving $tc_root until $data in ($lotemp, $hitemp)"
# NOTE: The drive adapter initially sets the writestatus to "start" and will
# only call this when writestatus!="start"
proc drivestatus {tc_root} {
if [sct driving] {
if {[sct driving]} {
return busy
} else {
return idle
@@ -153,7 +153,7 @@ debug_log "halt $tc_root"
}
proc mk_sct_eurotherm_et2000 {sct_controller klass tempobj dev_id tol} {
if [ catch {
if {[ catch {
set ns ::scobj::et2000
MakeSICSObj $tempobj SCT_OBJECT
@@ -321,7 +321,7 @@ debug_log "halt $tc_root"
if {[SplitReply [environment_simulation]]=="false"} {
ansto_makesctdrive ${tempobj}_driveable $scobj_hpath/setpoint $scobj_hpath/sensor/value $sct_controller
}
} message ] {
} message ]} {
return -code error $message
}
}

View File

@@ -20,10 +20,10 @@ namespace eval ::scobj::lh45 {
proc setPoint {tc_root nextState cmd} {
set par [sct target]
if [hval $tc_root/apply_tolerance] {
if {[hval $tc_root/apply_tolerance]} {
set tol [hval $tc_root/tolerance]
hset $tc_root/subtemp_warnlimit [expr $par - $tol]
hset $tc_root/overtemp_warnlimit [expr $par + $tol]
hset $tc_root/subtemp_warnlimit [expr {$par - $tol}]
hset $tc_root/overtemp_warnlimit [expr {$par + $tol}]
}
hset $tc_root/power 1
hset $tc_root/status "busy"
@@ -84,7 +84,7 @@ namespace eval ::scobj::lh45 {
if {$intol==0} { sct utime timecheck }
set setpt [hval $tc_root/setpoint]
set temp [hval $tc_root/sensor/value]
if {[expr abs($setpt - $temp)] > 0.2} {
if { abs($setpt - $temp) > 0.2} {
hset $tc_root/emon/monmode "drive"
hset $tc_root/status "busy"
} else {
@@ -104,11 +104,11 @@ namespace eval ::scobj::lh45 {
proc getState {tc_root nextState cmd} {
# Apply tolerance
if [hval $tc_root/apply_tolerance] {
if {[hval $tc_root/apply_tolerance]} {
set tol [hval $tc_root/tolerance]
set setpt [hval $tc_root/setpoint]
hset $tc_root/subtemp_warnlimit [expr $setpt - $tol]
hset $tc_root/overtemp_warnlimit [expr $setpt + $tol]
hset $tc_root/subtemp_warnlimit [expr {$setpt - $tol}]
hset $tc_root/overtemp_warnlimit [expr {$setpt + $tol}]
}
sct send $cmd
return $nextState
@@ -123,7 +123,7 @@ namespace eval ::scobj::lh45 {
return 0
} else {
set timeout [hval $tc_root/tolerance/settletime]
if {[expr $currtime - $timecheck] > $timeout} {
if { ($currtime - $timecheck) > $timeout} {
hset $tc_root/emon/isintol 1
}
return 1
@@ -184,7 +184,7 @@ namespace eval ::scobj::lh45 {
# NOTE: The drive adapter initially sets the writestatus to "start" and will
# only call this when writestatus!="start"
proc drivestatus {tc_root} {
if [sct driving] {
if {[sct driving]} {
return busy
} else {
return idle
@@ -198,7 +198,7 @@ namespace eval ::scobj::lh45 {
}
proc mk_sct_julabo_lh45 {sct_controller klass tempobj tol} {
if [ catch {
if {[ catch {
set ns ::scobj::lh45
MakeSICSObj $tempobj SCT_OBJECT
@@ -332,7 +332,7 @@ namespace eval ::scobj::lh45 {
if {[SplitReply [environment_simulation]]=="false"} {
ansto_makesctdrive ${tempobj}_driveable $scobj_hpath/setpoint $scobj_hpath/sensor/value $sct_controller
}
} message ] {
} message ]} {
return -code error $message
}
}

View File

@@ -20,9 +20,9 @@ namespace eval ::scobj::qlink {
proc rdValue {tc_root} {
set data [sct result]
if [ catch {
if {[ catch {
debug_log "rdValue $tc_root [sct] result=$data"
} message ] {
} message ]} {
debug_log "rdValue $tc_root failure"
}
switch -glob -- $data {
@@ -34,7 +34,7 @@ debug_log "rdValue $tc_root failure"
sct oldval $data
sct update $data
sct utime readtime
debug_log "rdValue new data for $tc_root [sct] $my_model result=$data"
debug_log "rdValue new data for $tc_root [sct] result=$data"
}
}
}
@@ -48,7 +48,7 @@ debug_log "rdValue new data for $tc_root [sct] $my_model result=$data"
}
proc mk_sct_qlink {sct_controller klass tempobj tol} {
if [ catch {
if {[ catch {
set ns ::scobj::qlink
MakeSICSObj $tempobj SCT_OBJECT
@@ -99,7 +99,8 @@ debug_log "rdValue new data for $tc_root [sct] $my_model result=$data"
hsetprop $scobj_hpath/$snsr/value sdsinfo ::nexus::scobj::sdsinfo
}
hsetprop $scobj_hpath privilege spy
} message ] {
# ::scobj::hinitprops $tempobj setpoint
} message ]} {
return -code error $message
}
}
@@ -132,4 +133,4 @@ close $fd
namespace import ::scobj::qlink::*
#add_qlink qlink 137.157.201.213 502 5
add_qlink qlink localhost 30508 5
#add_qlink qlink localhost 30508 5