The "inTolerance" proc now updates the "timecheck" and "timecheck2" values when the setpoint command has been sent and transitions the "writestatus" to "ws_monitor". This ensures that the timeout for the settletime is reset when a new setpoint has been sent.

r3116 | ffr | 2011-04-27 15:38:29 +1000 (Wed, 27 Apr 2011) | 1 line
This commit is contained in:
Ferdi Franceschini
2011-04-27 15:38:29 +10:00
committed by Douglas Clowes
parent db80d30cc2
commit c7929ccc4e
2 changed files with 26 additions and 22 deletions

View File

@@ -711,8 +711,13 @@ proc inTolerance {CtrlLoopIdx} {
} }
if {$cmpIdString == 0 } { if {$cmpIdString == 0 } {
set wrStatus [ hgetpropval $tc_root/sensor/setpoint$CtrlLoopIdx writestatus ] set wrStatus [ hgetpropval $tc_root/sensor/setpoint$CtrlLoopIdx writestatus ]
if {$wrStatus == "start"} { switch $wrStatus {
continue "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 nodename $tc_root/control/config_Loop_$CtrlLoopIdx
# set iSensor [hval $nodename] # set iSensor [hval $nodename]
@@ -1082,8 +1087,7 @@ proc getCorrespondingInputSensor {CtrlLoopIdx} {
# @param iSensor indicates the corresponding input sensor (A,B,C or D) # @param iSensor indicates the corresponding input sensor (A,B,C or D)
# @return retVal returns 1 if in tolerance, 0 else. # @return retVal returns 1 if in tolerance, 0 else.
proc checktol {tc_root currtime timecheck iLoop iSensor} { proc checktol {tc_root currtime timecheck iLoop iSensor} {
if {[ catch { set catch_status [ catch {
set retVal 0
set sensorValue $tc_root/sensor/sensorValue$iSensor set sensorValue $tc_root/sensor/sensorValue$iSensor
set temp [hval $sensorValue] set temp [hval $sensorValue]
set isetp $tc_root/sensor/setpoint$iLoop 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 {$::scobj::ls336::ls336_verbose==1} {puts "hset $tc_root/emon/isInTolerance_Lp$iLoop outsideTolerance"}
if {$iLoop==1} { sct utime timecheck } if {$iLoop==1} { sct utime timecheck }
if {$iLoop==2} { sct utime timecheck2 } if {$iLoop==2} { sct utime timecheck2 }
set retVal 0 return 0
} else { } else {
set timeout $::scobj::ls336::ls340_settleTime set timeout $::scobj::ls336::ls340_settleTime
if { $::scobj::ls336::ls336_LSmodel == 340 } { if { $::scobj::ls336::ls336_LSmodel == 340 } {
@@ -1120,20 +1124,18 @@ proc checktol {tc_root currtime timecheck iLoop iSensor} {
if {$::scobj::ls336::ls336_verbose==1} { if {$::scobj::ls336::ls336_verbose==1} {
puts "hset $tc_root/emon/isInTolerance_Lp$iLoop inTolerance (elapsedTime=$elapsedTime greater than settleTime=$timeout)" puts "hset $tc_root/emon/isInTolerance_Lp$iLoop inTolerance (elapsedTime=$elapsedTime greater than settleTime=$timeout)"
} }
set retVal 1 return 1
} else { } else {
# Temperature has not been within tolerance for enough time - (overshoots, oscillations,..) # Temperature has not been within tolerance for enough time - (overshoots, oscillations,..)
hset $tc_root/emon/isInTolerance_Lp$iLoop "outsideTolerance" hset $tc_root/emon/isInTolerance_Lp$iLoop "outsideTolerance"
if {$::scobj::ls336::ls336_verbose==1} { if {$::scobj::ls336::ls336_verbose==1} {
puts "hset $tc_root/emon/isInTolerance_Lp$iLoop outsideTolerance (elapsedTime=$elapsedTime less than settleTime=$timeout)" puts "hset $tc_root/emon/isInTolerance_Lp$iLoop outsideTolerance (elapsedTime=$elapsedTime less than settleTime=$timeout)"
} }
set retVal 0 return 0
} }
} }
} message ]} { } message ]
return -code error "in checktol: $message. Last query command: $::scobj::ls336::ls336_lastQueryCmd" handle_exception $catch_status $message "Last query command: $::scobj::ls336::ls336_lastQueryCmd"
}
return $retVal
} }

View File

@@ -711,8 +711,13 @@ proc inTolerance {CtrlLoopIdx} {
} }
if {$cmpIdString == 0 } { if {$cmpIdString == 0 } {
set wrStatus [ hgetpropval $tc_root/sensor/setpoint$CtrlLoopIdx writestatus ] set wrStatus [ hgetpropval $tc_root/sensor/setpoint$CtrlLoopIdx writestatus ]
if {$wrStatus == "start"} { switch $wrStatus {
continue "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 nodename $tc_root/control/config_Loop_$CtrlLoopIdx
# set iSensor [hval $nodename] # set iSensor [hval $nodename]
@@ -1082,8 +1087,7 @@ proc getCorrespondingInputSensor {CtrlLoopIdx} {
# @param iSensor indicates the corresponding input sensor (A,B,C or D) # @param iSensor indicates the corresponding input sensor (A,B,C or D)
# @return retVal returns 1 if in tolerance, 0 else. # @return retVal returns 1 if in tolerance, 0 else.
proc checktol {tc_root currtime timecheck iLoop iSensor} { proc checktol {tc_root currtime timecheck iLoop iSensor} {
if {[ catch { set catch_status [ catch {
set retVal 0
set sensorValue $tc_root/sensor/sensorValue$iSensor set sensorValue $tc_root/sensor/sensorValue$iSensor
set temp [hval $sensorValue] set temp [hval $sensorValue]
set isetp $tc_root/sensor/setpoint$iLoop 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 {$::scobj::ls340::ls340_verbose==1} {puts "hset $tc_root/emon/isInTolerance_Lp$iLoop outsideTolerance"}
if {$iLoop==1} { sct utime timecheck } if {$iLoop==1} { sct utime timecheck }
if {$iLoop==2} { sct utime timecheck2 } if {$iLoop==2} { sct utime timecheck2 }
set retVal 0 return 0
} else { } else {
set timeout $::scobj::ls340::ls340_settleTime set timeout $::scobj::ls340::ls340_settleTime
if { $::scobj::ls340::ls340_LSmodel == 340 } { if { $::scobj::ls340::ls340_LSmodel == 340 } {
@@ -1120,20 +1124,18 @@ proc checktol {tc_root currtime timecheck iLoop iSensor} {
if {$::scobj::ls340::ls340_verbose==1} { if {$::scobj::ls340::ls340_verbose==1} {
puts "hset $tc_root/emon/isInTolerance_Lp$iLoop inTolerance (elapsedTime=$elapsedTime greater than settleTime=$timeout)" puts "hset $tc_root/emon/isInTolerance_Lp$iLoop inTolerance (elapsedTime=$elapsedTime greater than settleTime=$timeout)"
} }
set retVal 1 return 1
} else { } else {
# Temperature has not been within tolerance for enough time - (overshoots, oscillations,..) # Temperature has not been within tolerance for enough time - (overshoots, oscillations,..)
hset $tc_root/emon/isInTolerance_Lp$iLoop "outsideTolerance" hset $tc_root/emon/isInTolerance_Lp$iLoop "outsideTolerance"
if {$::scobj::ls340::ls340_verbose==1} { if {$::scobj::ls340::ls340_verbose==1} {
puts "hset $tc_root/emon/isInTolerance_Lp$iLoop outsideTolerance (elapsedTime=$elapsedTime less than settleTime=$timeout)" puts "hset $tc_root/emon/isInTolerance_Lp$iLoop outsideTolerance (elapsedTime=$elapsedTime less than settleTime=$timeout)"
} }
set retVal 0 return 0
} }
} }
} message ]} { } message ]
return -code error "in checktol: $message. Last query command: $::scobj::ls340::ls340_lastQueryCmd" handle_exception $catch_status $message "Last query command: $::scobj::ls340::ls340_lastQueryCmd"
}
return $retVal
} }