servlog.c

Fix month in logfile name and put date in all log file names.
sct_protek_common.tcl
Catch non-numeric readings from main multimeter display
Added support for a callbank function which is called after reportVal

sct_julabo_lh45.tcl
Clear the geterror property when getting a new reading.
Don't set the overtemp and subtemp warning limits because this can cause the julabo to alarm.
Do nothing if the setpoint hasn't been updated.
Set default settletime to 60s and the default error handler to "lazy".
Added start_temperature and end_temperature which are updated by callbacks on the histogram memory control.

sct_lakeshore_340.tcl
Set the type for the setpoint nodes to drivable
r3032 | ffr | 2010-12-02 14:03:44 +1100 (Thu, 02 Dec 2010) | 15 lines
This commit is contained in:
Ferdi Franceschini
2010-12-02 14:03:44 +11:00
committed by Douglas Clowes
parent 7bf2d4d9f0
commit 202bb2869a
4 changed files with 91 additions and 55 deletions

View File

@@ -8,6 +8,9 @@ namespace eval ::scobj::lh45 {
# /tempcont/setpoint
# /tempcont/sensor/value
proc getValue {nextState cmd} {
if [hpropexists [sct] geterror] {
hdelprop [sct] geterror
}
sct send $cmd
return $nextState
}
@@ -23,11 +26,11 @@ namespace eval ::scobj::lh45 {
}
set par [sct target]
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}]
}
# 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/power 1
hset $tc_root/status "busy"
if {[sct writestatus] == "start"} {
@@ -35,6 +38,7 @@ namespace eval ::scobj::lh45 {
hsetprop $tc_root/setpoint driving 1
}
sct send "$cmd $par"
sct updated 0
return $nextState
}
@@ -49,6 +53,7 @@ namespace eval ::scobj::lh45 {
sct oldval $data
sct update $data
sct utime readtime
sct updated 1
}
}
}
@@ -83,17 +88,37 @@ namespace eval ::scobj::lh45 {
sct update $power
}
if {$power==1} {
set intol [::scobj::lh45::checktol $tc_root [sct readtime] [sct timecheck]]
if {$intol==0} { sct utime timecheck }
set setpoint_updated [hgetpropval $tc_root/setpoint updated]
if {$setpoint_updated != 1} {
return idle
}
set currtime [sct readtime]
set timecheck [sct timecheck]
set temp [hval $tc_root/sensor/value]
set setpoint [hval $tc_root/setpoint]
set tol [hval $tc_root/tolerance]
if { abs($temp - $setpoint) > $tol } {
hset $tc_root/emon/isintol 0
set intol 0
sct utime timecheck
} else {
set timeout [hval $tc_root/tolerance/settletime]
if { [expr $currtime - $timecheck] > $timeout } {
hset $tc_root/emon/isintol 1
set intol 1
} else {
set intol 0
}
}
set setpt [hval $tc_root/setpoint]
set temp [hval $tc_root/sensor/value]
if { abs($setpt - $temp) > 0.2} {
hset $tc_root/emon/monmode "drive"
hset $tc_root/status "busy"
} else {
if { $intol } {
hsetprop $tc_root/setpoint driving 0
hset $tc_root/emon/monmode "monitor"
hset $tc_root/status "idle"
hset $tc_root/emon/monmode "monitor"
hset $tc_root/status "idle"
} else {
hset $tc_root/emon/monmode "drive"
hset $tc_root/status "busy"
}
} else {
hset $tc_root/emon/monmode "idle"
@@ -106,30 +131,25 @@ namespace eval ::scobj::lh45 {
}
proc getState {tc_root nextState cmd} {
# 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}]
}
sct send $cmd
return $nextState
}
proc checktol {tc_root currtime timecheck} {
set temp [hval $tc_root/sensor/value]
set lotemp [hval $tc_root/subtemp_warnlimit]
set hitemp [hval $tc_root/overtemp_warnlimit]
if { $temp < $lotemp || $temp > $hitemp} {
set setpoint [hval $tc_root/setpoint]
set tol [hval $tc_root/tolerance]
if { abs($temp - $setpoint) > $tol } {
hset $tc_root/emon/isintol 0
return 0
} else {
set timeout [hval $tc_root/tolerance/settletime]
if { ($currtime - $timecheck) > $timeout} {
if { [expr $currtime - $timecheck] > $timeout } {
hset $tc_root/emon/isintol 1
return 1
} else {
return 0
}
return 1
}
}
@@ -218,6 +238,8 @@ namespace eval ::scobj::lh45 {
hsetprop $scobj_hpath/setpoint oldval UNKNOWN
hsetprop $scobj_hpath/setpoint driving 0
hsetprop $scobj_hpath/setpoint writestatus UNKNOWN
hsetprop $scobj_hpath/setpoint type drivable
hsetprop $scobj_hpath/setpoint updated 0
# Drive adapter interface
hsetprop $scobj_hpath/setpoint checklimits ${ns}::check $scobj_hpath
hsetprop $scobj_hpath/setpoint checkstatus ${ns}::drivestatus $scobj_hpath
@@ -225,14 +247,14 @@ namespace eval ::scobj::lh45 {
hfactory $scobj_hpath/overtemp_warnlimit plain user float
hsetprop $scobj_hpath/overtemp_warnlimit read ${ns}::getValue rdValue "in_sp_03"
hsetprop $scobj_hpath/overtemp_warnlimit write ${ns}::setValue noResponse "out_sp_03"
# hsetprop $scobj_hpath/overtemp_warnlimit write ${ns}::setValue noResponse "out_sp_03"
hsetprop $scobj_hpath/overtemp_warnlimit rdValue ${ns}::rdValue
hsetprop $scobj_hpath/overtemp_warnlimit noResponse ${ns}::noResponse
hsetprop $scobj_hpath/overtemp_warnlimit oldval UNKNOWN
hfactory $scobj_hpath/subtemp_warnlimit plain user float
hsetprop $scobj_hpath/subtemp_warnlimit read ${ns}::getValue rdValue "in_sp_04"
hsetprop $scobj_hpath/subtemp_warnlimit write ${ns}::setValue noResponse "out_sp_04"
# hsetprop $scobj_hpath/subtemp_warnlimit write ${ns}::setValue noResponse "out_sp_04"
hsetprop $scobj_hpath/subtemp_warnlimit rdValue ${ns}::rdValue
hsetprop $scobj_hpath/subtemp_warnlimit noResponse ${ns}::noResponse
hsetprop $scobj_hpath/subtemp_warnlimit oldval UNKNOWN
@@ -245,15 +267,15 @@ namespace eval ::scobj::lh45 {
hsetprop $scobj_hpath/sensor/value units "C"
hfactory $scobj_hpath/sensor/start_temperature plain user float
hfactory $scobj_hpath/sensor/end_temperature plain user float
proc ${ns}::OnFirstSave {} [subst -nocommands {
hset $scobj_hpath/sensor/start_temperature [hval $scobj_hpath/sensor/value]
hset $scobj_hpath/sensor/end_temperature [hval $scobj_hpath/sensor/value]
}]
proc ${ns}::OnLastSave {} [subst -nocommands {
hset $scobj_hpath/sensor/end_temperature [hval $scobj_hpath/sensor/value]
}]
::nexus::OnFirstSave ${ns}::OnFirstSave
::nexus::OnLastSave ${ns}::OnLastSave
# proc ${ns}::OnFirstSave {} [subst -nocommands {
# hset $scobj_hpath/sensor/start_temperature [hval $scobj_hpath/sensor/value]
# hset $scobj_hpath/sensor/end_temperature [hval $scobj_hpath/sensor/value]
# }]
# proc ${ns}::OnLastSave {} [subst -nocommands {
# hset $scobj_hpath/sensor/end_temperature [hval $scobj_hpath/sensor/value]
# }]
# ::nexus::OnFirstSave ${ns}::OnFirstSave
# ::nexus::OnLastSave ${ns}::OnLastSave
hfactory $scobj_hpath/heating_power_percent plain internal float
hsetprop $scobj_hpath/heating_power_percent read ${ns}::getValue rdValue "in_pv_01"
@@ -275,7 +297,7 @@ namespace eval ::scobj::lh45 {
hfactory $scobj_hpath/tolerance plain user float
hsetprop $scobj_hpath/tolerance units "C"
hfactory $scobj_hpath/tolerance/settletime plain user float
hset $scobj_hpath/tolerance/settletime 5.0
hset $scobj_hpath/tolerance/settletime 60.0
hsetprop $scobj_hpath/tolerance/settletime units "s"
hset $scobj_hpath/tolerance $tol
@@ -309,15 +331,15 @@ namespace eval ::scobj::lh45 {
hfactory $scobj_hpath/emon/isintol plain user int
hset $scobj_hpath/emon/isintol 1
hfactory $scobj_hpath/emon/errhandler plain user text
hset $scobj_hpath/emon/errhandler "pause"
hset $scobj_hpath/emon/errhandler "lazy"
if {[SplitReply [environment_simulation]]=="false"} {
$sct_controller poll $scobj_hpath/setpoint
$sct_controller write $scobj_hpath/setpoint
$sct_controller poll $scobj_hpath/subtemp_warnlimit
$sct_controller write $scobj_hpath/subtemp_warnlimit
# $sct_controller write $scobj_hpath/subtemp_warnlimit
$sct_controller poll $scobj_hpath/overtemp_warnlimit
$sct_controller write $scobj_hpath/overtemp_warnlimit
# $sct_controller write $scobj_hpath/overtemp_warnlimit
$sct_controller poll $scobj_hpath/heating_power_percent
$sct_controller poll $scobj_hpath/power
$sct_controller write $scobj_hpath/power
@@ -343,6 +365,8 @@ namespace eval ::scobj::lh45 {
hsetprop $scobj_hpath privilege spy
::scobj::hinitprops $tempobj setpoint sensor/start_temperature sensor/end_temperature
hsetprop $scobj_hpath/sensor/start_temperature mutable true
hsetprop $scobj_hpath/sensor/end_temperature mutable true
if {[SplitReply [environment_simulation]]=="false"} {
ansto_makesctdrive ${tempobj}_driveable $scobj_hpath/setpoint $scobj_hpath/sensor/value $sct_controller
}