Revert code so that the "driving" status is set by the tcl setpoint procedure.

The "inTolerance" script only resets the "driving" flag after the setpoint has been sent, ie after "writestatus" transitions to the sent state.
The "checktol" script now compares the sensor reading against the setpoint "target" value instead of the setpoint reading from the lakeshore, this should allow the drive command to work properly if ramping has been enabled on the lakeshore
r3115 | ffr | 2011-04-27 11:11:00 +1000 (Wed, 27 Apr 2011) | 3 lines
This commit is contained in:
Ferdi Franceschini
2011-04-27 11:11:00 +10:00
committed by Douglas Clowes
parent e73eed8807
commit db80d30cc2
2 changed files with 18 additions and 14 deletions

View File

@@ -710,7 +710,8 @@ proc inTolerance {CtrlLoopIdx} {
set cmpIdString [string compare -length 13 $data "LSCI,MODEL336"]
}
if {$cmpIdString == 0 } {
if [ hgetpropval $tc_root/sensor/setpoint$CtrlLoopIdx setpoint_pending ] {
set wrStatus [ hgetpropval $tc_root/sensor/setpoint$CtrlLoopIdx writestatus ]
if {$wrStatus == "start"} {
continue
}
# set nodename $tc_root/control/config_Loop_$CtrlLoopIdx
@@ -903,12 +904,11 @@ proc setPoint {tc_root nextState cmd whichCtrlLoop} {
# Called by drive adapter
# puts "setPoint(): driving set to 1"
set nodename $tc_root/sensor/setpoint$whichCtrlLoop
hsetprop $nodename driving 1
}
#puts "setPoint(wrStatus=$wrStatus): sct send $cmd$par"
sct send "$cmd$par"
sct setpoint_pending 0
} message ]} {
hsetprop $nodename driving 0
return -code error "in setPoint: $message. Last write command: $::scobj::ls336::ls336_lastWriteCmd"
}
return $nextState
@@ -1087,7 +1087,12 @@ proc checktol {tc_root currtime timecheck iLoop iSensor} {
set sensorValue $tc_root/sensor/sensorValue$iSensor
set temp [hval $sensorValue]
set isetp $tc_root/sensor/setpoint$iLoop
set setpt [hval $isetp]
if [hpropexists $isetp "target"] {
set setpt [hgetpropval $isetp "target"]
} else {
hset $tc_root/emon/isInTolerance_Lp$iLoop "inTolerance"
return 1
}
set tol [hval $tc_root/control/tolerance1]
if {$iLoop == 2 } {
set tol [hval $tc_root/control/tolerance2]
@@ -1179,10 +1184,8 @@ proc check {tc_root whichCtrlLoop} {
}
}
} message ]} {
sct driving 0
return -code error "in check(): $message. Last write command: $::scobj::ls336::ls336_lastWriteCmd"
}
sct setpoint_pending 1
return OK
}
@@ -1734,7 +1737,6 @@ proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable p
hsetprop $nodeName checklimits ${ns}::check $scobj_hpath $idx
hsetprop $nodeName checkstatus ${ns}::drivestatus $scobj_hpath
hsetprop $nodeName halt ${ns}::halt $scobj_hpath $idx
hsetprop $nodeName setpoint_pending 0
}
} message ]} {
return -code error "in createNode $message"

View File

@@ -710,7 +710,8 @@ proc inTolerance {CtrlLoopIdx} {
set cmpIdString [string compare -length 13 $data "LSCI,MODEL336"]
}
if {$cmpIdString == 0 } {
if [ hgetpropval $tc_root/sensor/setpoint$CtrlLoopIdx setpoint_pending ] {
set wrStatus [ hgetpropval $tc_root/sensor/setpoint$CtrlLoopIdx writestatus ]
if {$wrStatus == "start"} {
continue
}
# set nodename $tc_root/control/config_Loop_$CtrlLoopIdx
@@ -903,12 +904,11 @@ proc setPoint {tc_root nextState cmd whichCtrlLoop} {
# Called by drive adapter
# puts "setPoint(): driving set to 1"
set nodename $tc_root/sensor/setpoint$whichCtrlLoop
hsetprop $nodename driving 1
}
#puts "setPoint(wrStatus=$wrStatus): sct send $cmd$par"
sct send "$cmd$par"
sct setpoint_pending 0
} message ]} {
hsetprop $nodename driving 0
return -code error "in setPoint: $message. Last write command: $::scobj::ls340::ls340_lastWriteCmd"
}
return $nextState
@@ -1087,7 +1087,12 @@ proc checktol {tc_root currtime timecheck iLoop iSensor} {
set sensorValue $tc_root/sensor/sensorValue$iSensor
set temp [hval $sensorValue]
set isetp $tc_root/sensor/setpoint$iLoop
set setpt [hval $isetp]
if [hpropexists $isetp "target"] {
set setpt [hgetpropval $isetp "target"]
} else {
hset $tc_root/emon/isInTolerance_Lp$iLoop "inTolerance"
return 1
}
set tol [hval $tc_root/control/tolerance1]
if {$iLoop == 2 } {
set tol [hval $tc_root/control/tolerance2]
@@ -1179,10 +1184,8 @@ proc check {tc_root whichCtrlLoop} {
}
}
} message ]} {
sct driving 0
return -code error "in check(): $message. Last write command: $::scobj::ls340::ls340_lastWriteCmd"
}
sct setpoint_pending 1
return OK
}
@@ -1734,7 +1737,6 @@ proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable p
hsetprop $nodeName checklimits ${ns}::check $scobj_hpath $idx
hsetprop $nodeName checkstatus ${ns}::drivestatus $scobj_hpath
hsetprop $nodeName halt ${ns}::halt $scobj_hpath $idx
hsetprop $nodeName setpoint_pending 0
}
} message ]} {
return -code error "in createNode $message"