Merged Arndt's changes from trunk
version 20100114, deployed on Wombat Today, provides independent tolerance control for control loop one and two. AM r2869 | ffr | 2010-01-15 09:48:17 +1100 (Fri, 15 Jan 2010) | 4 lines
This commit is contained in:
committed by
Douglas Clowes
parent
5e2cfbad44
commit
59101a7d4d
@@ -58,7 +58,8 @@ namespace eval ::scobj::ls3xx {
|
|||||||
# Variables that are identical to node names but are needed internally as well
|
# Variables that are identical to node names but are needed internally as well
|
||||||
# temperature difference between setpoint and actual temperature at which the
|
# temperature difference between setpoint and actual temperature at which the
|
||||||
# heater changes from idle to driving
|
# heater changes from idle to driving
|
||||||
set ls3xx_driveTolerance 2
|
set ls3xx_driveTolerance1 2
|
||||||
|
set ls3xx_driveTolerance2 2
|
||||||
# Next 2 parameters are supported by LS model 340 only
|
# Next 2 parameters are supported by LS model 340 only
|
||||||
# ctrl loop 1 settle parameter, threshold=allowable band around setpoint (0,..,100)
|
# ctrl loop 1 settle parameter, threshold=allowable band around setpoint (0,..,100)
|
||||||
set ls340_settleThr 30
|
set ls340_settleThr 30
|
||||||
@@ -182,7 +183,8 @@ proc ls3xx_init {sct_controller tc_root} {
|
|||||||
puts "Make sure INTERFACE : SERIAL : TERMINATOR is set correctly"
|
puts "Make sure INTERFACE : SERIAL : TERMINATOR is set correctly"
|
||||||
}
|
}
|
||||||
# Set the default tolerances for the setpoint temperatures
|
# Set the default tolerances for the setpoint temperatures
|
||||||
hset $tc_root/control/tolerance $::scobj::ls3xx::ls3xx_driveTolerance
|
hset $tc_root/control/tolerance1 $::scobj::ls3xx::ls3xx_driveTolerance1
|
||||||
|
hset $tc_root/control/tolerance2 $::scobj::ls3xx::ls3xx_driveTolerance2
|
||||||
} message ] {
|
} message ] {
|
||||||
return -code error "in ls3xx_init: $message"
|
return -code error "in ls3xx_init: $message"
|
||||||
}
|
}
|
||||||
@@ -696,7 +698,7 @@ proc inTolerance {CtrlLoopIdx} {
|
|||||||
# set iSensor [hval $nodename]
|
# set iSensor [hval $nodename]
|
||||||
# set iSensor [string range $iSensor 0 0]
|
# set iSensor [string range $iSensor 0 0]
|
||||||
set iSensor [getCorrespondingInputSensor $CtrlLoopIdx]
|
set iSensor [getCorrespondingInputSensor $CtrlLoopIdx]
|
||||||
#puts "inTolerance 2 $::scobj::ls3xx::ls3xx_sct_obj_name CtrlLoopIdx:$CtrlLoopIdx data:$data, iSensor:$iSensor"
|
# puts "inTolerance 2 $::scobj::ls3xx::ls3xx_sct_obj_name CtrlLoopIdx:$CtrlLoopIdx data:$data, iSensor:$iSensor"
|
||||||
#puts {set intol [checktol $tc_root [sct readtime] [sct timecheck] $CtrlLoopIdx $iSensor]}
|
#puts {set intol [checktol $tc_root [sct readtime] [sct timecheck] $CtrlLoopIdx $iSensor]}
|
||||||
if {[string length $iSensor] == 1} {
|
if {[string length $iSensor] == 1} {
|
||||||
set intol [checktol $tc_root [sct readtime] [sct timecheck] $CtrlLoopIdx $iSensor]
|
set intol [checktol $tc_root [sct readtime] [sct timecheck] $CtrlLoopIdx $iSensor]
|
||||||
@@ -705,10 +707,15 @@ proc inTolerance {CtrlLoopIdx} {
|
|||||||
set setpt [hval $nodename]
|
set setpt [hval $nodename]
|
||||||
set nodename $tc_root/sensor/sensorValue$iSensor
|
set nodename $tc_root/sensor/sensorValue$iSensor
|
||||||
set temp [hval $nodename]
|
set temp [hval $nodename]
|
||||||
# puts "inTolerance(): comparing sensor/setpoint$CtrlLoopIdx=$setpt with actual sensorValue$iSensor=$temp"
|
# puts "inTolerance(): comparing sensor/setpoint$CtrlLoopIdx=$setpt with actual sensorValue$iSensor=$temp"
|
||||||
set diff [expr abs($setpt - $temp)]
|
set diff [expr abs($setpt - $temp)]
|
||||||
# $::scobj::ls3xx::ls3xx_driveTolerance = 0.2 Kelvin
|
# $::scobj::ls3xx::ls3xx_driveTolerance = 0.2 Kelvin
|
||||||
if {$diff > $::scobj::ls3xx::ls3xx_driveTolerance} {
|
set tol $::scobj::ls3xx::ls3xx_driveTolerance1
|
||||||
|
if {$CtrlLoopIdx == 2} {
|
||||||
|
set tol $::scobj::ls3xx::ls3xx_driveTolerance2
|
||||||
|
}
|
||||||
|
# puts "inTolerance(): diff=$diff tol=$tol"
|
||||||
|
if {$diff > $tol} {
|
||||||
set nodename $tc_root/emon/monMode_Lp$CtrlLoopIdx
|
set nodename $tc_root/emon/monMode_Lp$CtrlLoopIdx
|
||||||
hset $nodename "drive"
|
hset $nodename "drive"
|
||||||
if {$CtrlLoopIdx == 1} {
|
if {$CtrlLoopIdx == 1} {
|
||||||
@@ -729,6 +736,7 @@ proc inTolerance {CtrlLoopIdx} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
# puts "inTolerance(): uuppss - should not go here"
|
||||||
hset $tc_root/emon/monMode_Lp1 "idle"
|
hset $tc_root/emon/monMode_Lp1 "idle"
|
||||||
hset $tc_root/emon/monMode_Lp2 "idle"
|
hset $tc_root/emon/monMode_Lp2 "idle"
|
||||||
hset $tc_root/emon/isInTolerance_Lp1 "inTolerance"
|
hset $tc_root/emon/isInTolerance_Lp1 "inTolerance"
|
||||||
@@ -1052,10 +1060,13 @@ proc checktol {tc_root currtime timecheck iLoop iSensor} {
|
|||||||
set temp [hval $sensorValue]
|
set temp [hval $sensorValue]
|
||||||
set isetp $tc_root/sensor/setpoint$iLoop
|
set isetp $tc_root/sensor/setpoint$iLoop
|
||||||
set setpt [hval $isetp]
|
set setpt [hval $isetp]
|
||||||
set tol [hval $tc_root/control/tolerance]
|
set tol [hval $tc_root/control/tolerance1]
|
||||||
|
if {$iLoop == 2 } {
|
||||||
|
set tol [hval $tc_root/control/tolerance2]
|
||||||
|
}
|
||||||
set lotemp [expr $setpt - $tol]
|
set lotemp [expr $setpt - $tol]
|
||||||
set hitemp [expr $setpt + $tol]
|
set hitemp [expr $setpt + $tol]
|
||||||
# puts "checktol: lotemp=$lotemp, temp=$temp, hitemp=$hitemp, tol=$tol"
|
# puts "checktol: setpt=$setpt lotemp=$lotemp, temp=$temp, hitemp=$hitemp, tol=$tol, iLoop=$iLoop"
|
||||||
if { $temp < $lotemp || $temp > $hitemp} {
|
if { $temp < $lotemp || $temp > $hitemp} {
|
||||||
hset $tc_root/emon/isInTolerance_Lp$iLoop "outsideTolerance"
|
hset $tc_root/emon/isInTolerance_Lp$iLoop "outsideTolerance"
|
||||||
set retVal 0
|
set retVal 0
|
||||||
@@ -1696,9 +1707,10 @@ proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable\
|
|||||||
# @param tempobj short name for the temperature controller scriptcontext object (typ. tc1 or tc2)
|
# @param tempobj short name for the temperature controller scriptcontext object (typ. tc1 or tc2)
|
||||||
# @param tol temperature tolerance in Kelvin (typ. 1)
|
# @param tol temperature tolerance in Kelvin (typ. 1)
|
||||||
# @return nothing (well, the sct object)
|
# @return nothing (well, the sct object)
|
||||||
proc mk_sct_lakeshore_3xx {sct_controller klass tempobj tol LSmodel} {
|
proc mk_sct_lakeshore_3xx {sct_controller klass tempobj tol1 tol2 LSmodel} {
|
||||||
if [ catch {
|
if [ catch {
|
||||||
set ::scobj::ls3xx::ls3xx_driveTolerance $tol
|
set ::scobj::ls3xx::ls3xx_driveTolerance1 $tol1
|
||||||
|
set ::scobj::ls3xx::ls3xx_driveTolerance2 $tol2
|
||||||
set ::scobj::ls3xx::ls3xx_LSmodel $LSmodel
|
set ::scobj::ls3xx::ls3xx_LSmodel $LSmodel
|
||||||
set ns ::scobj::ls3xx
|
set ns ::scobj::ls3xx
|
||||||
set ::scobj::ls3xx::ls3xx_sct_obj_name $tempobj
|
set ::scobj::ls3xx::ls3xx_sct_obj_name $tempobj
|
||||||
@@ -1886,11 +1898,16 @@ proc mk_sct_lakeshore_3xx {sct_controller klass tempobj tol LSmodel} {
|
|||||||
hset $scobj_hpath/control/apply_tolerance 1
|
hset $scobj_hpath/control/apply_tolerance 1
|
||||||
helpNotes4user $scobj_hpath "control" "apply_tolerance"
|
helpNotes4user $scobj_hpath "control" "apply_tolerance"
|
||||||
|
|
||||||
hfactory $scobj_hpath/control/tolerance plain user float
|
hfactory $scobj_hpath/control/tolerance1 plain user float
|
||||||
hsetprop $scobj_hpath/control/tolerance units $::scobj::ls3xx::ls3xx_tempUnits
|
hsetprop $scobj_hpath/control/tolerance1 units $::scobj::ls3xx::ls3xx_tempUnits
|
||||||
# hsetprop $scobj_hpath/control/tolerance units "K"
|
# hsetprop $scobj_hpath/control/tolerance units "K"
|
||||||
hset $scobj_hpath/control/tolerance $tol
|
hset $scobj_hpath/control/tolerance1 $tol1
|
||||||
helpNotes4user $scobj_hpath "control" "tolerance"
|
helpNotes4user $scobj_hpath "control" "tolerance1"
|
||||||
|
|
||||||
|
hfactory $scobj_hpath/control/tolerance2 plain user float
|
||||||
|
hsetprop $scobj_hpath/control/tolerance2 units $::scobj::ls3xx::ls3xx_tempUnits
|
||||||
|
hset $scobj_hpath/control/tolerance2 $tol2
|
||||||
|
helpNotes4user $scobj_hpath "control" "tolerance2"
|
||||||
|
|
||||||
#hfactory $scobj_hpath/lowerlimit plain mugger float
|
#hfactory $scobj_hpath/lowerlimit plain mugger float
|
||||||
#hsetprop $scobj_hpath/lowerlimit units $::scobj::ls3xx::ls3xx_tempUnits
|
#hsetprop $scobj_hpath/lowerlimit units $::scobj::ls3xx::ls3xx_tempUnits
|
||||||
@@ -2027,7 +2044,7 @@ proc mk_sct_lakeshore_3xx {sct_controller klass tempobj tol LSmodel} {
|
|||||||
# @param port port number on the moxabox (typ. 4001, 4002, 4003, or 4004)
|
# @param port port number on the moxabox (typ. 4001, 4002, 4003, or 4004)
|
||||||
# @param tol temperature tolerance in Kelvin (typ. 1)
|
# @param tol temperature tolerance in Kelvin (typ. 1)
|
||||||
# @return nothing (well, the sct object)
|
# @return nothing (well, the sct object)
|
||||||
proc add_ls3xx {name IP port terminator {_tol 1.0} {_ls3xx_LSmodel 340} } {
|
proc add_ls3xx {name IP port terminator {_tol1 1.0} {_tol2 1.0} {_ls3xx_LSmodel 340} } {
|
||||||
# ffr 2009-11-09, Don't create a temperature controller for the script validator, this causes the
|
# ffr 2009-11-09, Don't create a temperature controller for the script validator, this causes the
|
||||||
# lakeshore to lock up.
|
# lakeshore to lock up.
|
||||||
# NOTE: I put this outside the catch block because "return" raises an exception
|
# NOTE: I put this outside the catch block because "return" raises an exception
|
||||||
@@ -2037,7 +2054,7 @@ proc add_ls3xx {name IP port terminator {_tol 1.0} {_ls3xx_LSmodel 340} } {
|
|||||||
if [ catch {
|
if [ catch {
|
||||||
puts "\nadd_ls3xx: makesctcontroller $name std ${IP}:$port for Lakeshore model $_ls3xx_LSmodel"
|
puts "\nadd_ls3xx: makesctcontroller $name std ${IP}:$port for Lakeshore model $_ls3xx_LSmodel"
|
||||||
makesctcontroller sct_ls3xx_$name std ${IP}:$port $terminator
|
makesctcontroller sct_ls3xx_$name std ${IP}:$port $terminator
|
||||||
mk_sct_lakeshore_3xx sct_ls3xx_$name environment $name $_tol $_ls3xx_LSmodel
|
mk_sct_lakeshore_3xx sct_ls3xx_$name environment $name $_tol1 $_tol2 $_ls3xx_LSmodel
|
||||||
makesctemon $name /sics/$name/emon/monMode_Lp1 /sics/$name/emon/isInTolerance_Lp1 /sics/$name/emon/errhandler
|
makesctemon $name /sics/$name/emon/monMode_Lp1 /sics/$name/emon/isInTolerance_Lp1 /sics/$name/emon/errhandler
|
||||||
# set m2 "_2"
|
# set m2 "_2"
|
||||||
# makesctemon $name$m2 /sics/$name/emon/monMode_Lp2 /sics/$name/emon/isInTolerance_Lp2 /sics/$name/emon/errhandler
|
# makesctemon $name$m2 /sics/$name/emon/monMode_Lp2 /sics/$name/emon/isInTolerance_Lp2 /sics/$name/emon/errhandler
|
||||||
|
|||||||
Reference in New Issue
Block a user