Change puts to clientput to avoid error on stdout undefined

This commit is contained in:
Douglas Clowes
2014-06-30 13:44:14 +10:00
parent 202004766a
commit 7960cb73a0
7 changed files with 276 additions and 232 deletions

View File

@ -165,34 +165,34 @@ proc bruker_BEC1_init {sct_controller tc_root} {
set catch_status [ catch {
# set the communication protocol: terminator <CR>, bps 9600 baud, 7 data bits +
# 1 stop bit + odd parity bit
# puts "setting serial communication parameters"
# clientput "setting serial communication parameters"
# hset $tc_root/other/cfgProtocol_comm "COMM 1,5,1"
# Query the device ID
# puts "sending: $sct_controller queue $tc_root/other/deviceID_idn progress read"
# clientput "sending: $sct_controller queue $tc_root/other/deviceID_idn progress read"
# $sct_controller queue $tc_root/other/deviceID_idn progress read
# !! Not working properly yet - needs fixing
#sct send "*IDN?"
#sct data [$sct_controller result]
#puts "rdValDrct(): result is $data"
#clientput "rdValDrct(): result is $data"
#set data [hget $tc_root/other/deviceID_idn]
# puts "set deviceID_idn (hval $tc_root/other/deviceID_idn)"
# clientput "set deviceID_idn (hval $tc_root/other/deviceID_idn)"
#set data [hval $tc_root/other/deviceID_idn]
#set ::scobj::bruker_BEC1::this_sDeviceID data
# puts "sct_bruker_BEC1.tcl: connected to device $::scobj::bruker_BEC1::this_sDeviceID"
# clientput "sct_bruker_BEC1.tcl: connected to device $::scobj::bruker_BEC1::this_sDeviceID"
# reset the device to have it in a defined state
# hset $tc_root/other/reset_rst {*RST}
# Queue the Read Device Status-byte command so we can access the result in the
# corresponding node later
# puts "sending: $sct_controller queue $tc_root/other/statusByte progress read"
# clientput "sending: $sct_controller queue $tc_root/other/statusByte progress read"
# $sct_controller queue $tc_root/other/statusByte progress read
# hset $tc_root/other/cfgProtocol_comm "COMM 1,5,1"
# Was the self-test successful?
# $sct_controller queue $tc_root/other/selftest progress read
# set ::scobj::bruker_BEC1::this_selfTestResult [hval $tc_root/other/selftest]
# if {$::scobj::bruker_BEC1::this_selfTestResult == 0} {
# puts "sct_bruker_BEC1.tcl: Lakeshore $::scobj::bruker_BEC1::bruker_BEC1_LSmodel self-test ok."
# clientput "sct_bruker_BEC1.tcl: Lakeshore $::scobj::bruker_BEC1::bruker_BEC1_LSmodel self-test ok."
# } else {
# puts "sct_bruker_BEC1.tcl: The Lakeshore $::scobj::bruker_BEC1::bruker_BEC1_LSmodel failed its self-test."
# clientput "sct_bruker_BEC1.tcl: The Lakeshore $::scobj::bruker_BEC1::bruker_BEC1_LSmodel failed its self-test."
# }
# Set the default tolerances for the setpoint magentic field strength
hset $tc_root/emon/tolerance $::scobj::bruker_BEC1::bruker_BEC1_tolerance
@ -221,7 +221,7 @@ proc getValue {tc_root nextState cmd expectedLen} {
}
after $::scobj::bruker_BEC1::bruker_BEC1_MIN_TIME_BETWEEN_COMMANDS
sct send $cmd
# puts "sct send !$cmd!"
# clientput "sct send !$cmd!"
return $nextState
} message ]
handle_exception $catch_status $message "in getValue(). Last query command: $::scobj::bruker_BEC1::bruker_BEC1_lastQueryCmd"
@ -236,9 +236,9 @@ proc getValue {tc_root nextState cmd expectedLen} {
# @return idle Always returns system state idle - command sequence completed.
proc rdValue {expectedLength} {
set data [sct result]
# puts "rdValue(): result is $data"
# clientput "rdValue(): result is $data"
# broadcast rdValue "rdValue(): result is $data"
#puts "sct result !$data!"
#clientput "sct result !$data!"
set rData $data
# Do we get the answer to the question we asked?! Occasionally the BEC1 is sending info on its own.
if { 0 != [string compare -length 4 $data $::scobj::bruker_BEC1::bruker_BEC1_lastQueryCmd]} {
@ -249,7 +249,7 @@ proc getValue {tc_root nextState cmd expectedLen} {
# Continue as normal
switch -glob -- $data {
"ASCERR:*" {
puts "ASCERR in rdValue: Last query command: $::scobj::bruker_BEC1::bruker_BEC1_lastQueryCmd"
clientput "ASCERR in rdValue: Last query command: $::scobj::bruker_BEC1::bruker_BEC1_lastQueryCmd"
sct geterror $data
}
default {
@ -258,7 +258,7 @@ proc getValue {tc_root nextState cmd expectedLen} {
#ERROR: in rdValue: in analyseStatusByte(): in decodeErrByte(): syntax error in expression "0xHF": extra tokens at end of expression. errByte: HF, errList: 08 {Inrush procedure error} 01 {Current limit exceeded}
# . statusByteString: STA/0CHF/-0.0002T. Last query command: STA/
return idle
#puts "Rejected !$data! as reply to $::scobj::bruker_BEC1::bruker_BEC1_lastQueryCmd"
#clientput "Rejected !$data! as reply to $::scobj::bruker_BEC1::bruker_BEC1_lastQueryCmd"
}
set orgdata $data
set data [ExtractValue $data $::scobj::bruker_BEC1::bruker_BEC1_lastQueryCmd]
@ -285,7 +285,7 @@ proc getValue {tc_root nextState cmd expectedLen} {
# we have to extract again without stripping trailing characters that
# normally represent a physical unit like Ampere but could here be part
# of a hexadecimal value
#puts "rdValue: Interpreting status byte information: $orgdata $::scobj::bruker_BEC1::bruker_BEC1_lastQueryCmd"
#clientput "rdValue: Interpreting status byte information: $orgdata $::scobj::bruker_BEC1::bruker_BEC1_lastQueryCmd"
# Ananlyse the status bytes string containing the 4 status bytes and present the
# result in human readable form (Text instead of hex number)
analyseStatusByte $rData
@ -301,7 +301,7 @@ proc getValue {tc_root nextState cmd expectedLen} {
# of a hexadecimal value
# Beware that Bruker uses reverse notation.
set data [ExtractValue $orgdata $::scobj::bruker_BEC1::bruker_BEC1_lastQueryCmd]
#puts "rdValue: Interpreting status byte information: $::scobj::bruker_BEC1::bruker_BEC1_lastQueryCmd"
#clientput "rdValue: Interpreting status byte information: $::scobj::bruker_BEC1::bruker_BEC1_lastQueryCmd"
#pwrCtrl EthernetAddrHex 1 0 1 0 text spy {ETH/} {rdValue} {} {setValue} {}
hset $::scobj::bruker_BEC1::bruker_BEC1_path2nodes/pwrctrl/EthernetAddrDec "UNKNOWN"
}
@ -327,7 +327,7 @@ proc getValue {tc_root nextState cmd expectedLen} {
proc inTolerance {expectedLength} {
set tc_root $::scobj::bruker_BEC1::bruker_BEC1_path2nodes
set data [sct result]
# puts "inT result !$data!"
# clientput "inT result !$data!"
# Do we get the answer to the question we asked?! Occasionally the BEC1 is sending info on its own.
if { 0 != [string compare -length 4 $data $::scobj::bruker_BEC1::bruker_BEC1_lastQueryCmd]} {
# Discard if it is not the reply to our query
@ -335,10 +335,10 @@ proc inTolerance {expectedLength} {
}
set catch_status [ catch {
set oldvalue [sct oldval]
# puts "inTolerance(): data=$data oldval=$oldvalue"
# clientput "inTolerance(): data=$data oldval=$oldvalue"
switch -glob -- $data {
"ASCERR:*" {
puts "ASCERR in inTolerance: Last query command: $::scobj::bruker_BEC1::bruker_BEC1_lastQueryCmd"
clientput "ASCERR in inTolerance: Last query command: $::scobj::bruker_BEC1::bruker_BEC1_lastQueryCmd"
sct geterror $data
}
default {
@ -347,7 +347,7 @@ proc inTolerance {expectedLength} {
# Discard - this it is not the reply to our query because this is what happened:
#ERROR: in rdValue: in analyseStatusByte(): in decodeErrByte(): syntax error in expression "0xHF": extra tokens at end of expression. errByte: HF, errList: 08 {Inrush procedure error} 01 {Current limit exceeded}
# . statusByteString: STA/0CHF/-0.0002T. Last query command: STA/
#puts "Rejected !$data! as reply to $::scobj::bruker_BEC1::bruker_BEC1_lastQueryCmd"
#clientput "Rejected !$data! as reply to $::scobj::bruker_BEC1::bruker_BEC1_lastQueryCmd"
return idle
}
set data [ExtractValue $data $::scobj::bruker_BEC1::bruker_BEC1_lastQueryCmd]
@ -361,7 +361,7 @@ proc inTolerance {expectedLength} {
}
}
}
# puts "inTolerance $::scobj::bruker_BEC1::bruker_BEC1_sct_obj_name data:$data"
# clientput "inTolerance $::scobj::bruker_BEC1::bruker_BEC1_sct_obj_name data:$data"
# now update the manual nodes reporting whether the actual field strength
# is within tolerance of the corresponding setpoint
if {$data == 0 } {
@ -376,7 +376,7 @@ proc inTolerance {expectedLength} {
set setpt [hval $nodename]
set nodename $tc_root/sensor/desired_current
set nominal_outp_current [hval $nodename]
# puts "inTolerance(): comparing sensor/setpoint=$setpt with actual sensorValue=$temp"
# clientput "inTolerance(): comparing sensor/setpoint=$setpt with actual sensorValue=$temp"
set diff [expr {abs($setpt - $NominalOutpCurrent)}]
if {$diff > $::scobj::bruker_BEC1::bruker_BEC1_driveTolerance} {
# ERROR: node /sics/ma1/emon/mon_mode not found. Last query command: DCP/
@ -391,11 +391,11 @@ proc inTolerance {expectedLength} {
hset $tc_root/status "idle"
}
}
# puts "inTolerance 4 $::scobj::bruker_BEC1::bruker_BEC1_sct_obj_name data:$data"
# clientput "inTolerance 4 $::scobj::bruker_BEC1::bruker_BEC1_sct_obj_name data:$data"
return idle
} message ]
handle_exception $catch_status $message "in inTolerance(). Last query command: $::scobj::bruker_BEC1::bruker_BEC1_lastQueryCmd"
# puts "Leaving inTolerance idx:$CtrlLoopIdx"
# clientput "Leaving inTolerance idx:$CtrlLoopIdx"
}
@ -445,7 +445,7 @@ proc noResponse {} {
# @return nextState
proc setDesiredField {tc_root nextState cmd} {
set catch_status [ catch {
#puts "executing setDesiredField ($tc_root $nextState $cmd)"
#clientput "executing setDesiredField ($tc_root $nextState $cmd)"
set ns ::scobj::lh45
set par [sct target]
@ -453,11 +453,11 @@ proc setDesiredField {tc_root nextState cmd} {
set wrStatus [sct writestatus]
if {$wrStatus == "start"} {
# Called by drive adapter
# puts "setDesiredField(): driving set to 1"
# clientput "setDesiredField(): driving set to 1"
set nodename $tc_root/sensor/setpoint
hsetprop $nodename driving 1
}
#puts "setDesiredField(wrStatus=$wrStatus): sct send $cmd$par"
#clientput "setDesiredField(wrStatus=$wrStatus): sct send $cmd$par"
after $::scobj::bruker_BEC1::bruker_BEC1_MIN_TIME_BETWEEN_COMMANDS
sct send "$cmd$par"
return $nextState
@ -474,7 +474,7 @@ proc setDesiredField {tc_root nextState cmd} {
# @return nextState
proc setDesiredCurrent {tc_root nextState cmd} {
set catch_status [ catch {
# puts "executing setDesiredCurrent ($tc_root $nextState $cmd)"
# clientput "executing setDesiredCurrent ($tc_root $nextState $cmd)"
set ns ::scobj::lh45
set par [sct target]
@ -482,11 +482,11 @@ proc setDesiredCurrent {tc_root nextState cmd} {
set wrStatus [sct writestatus]
if {$wrStatus == "start"} {
# Called by drive adapter
# puts "setDesiredCurrent(): driving set to 1"
# clientput "setDesiredCurrent(): driving set to 1"
set nodename $tc_root/sensor/nominal_outp_current
hsetprop $nodename driving 1
}
#puts "setDesiredCurrent(wrStatus=$wrStatus): sct send $cmd$par"
#clientput "setDesiredCurrent(wrStatus=$wrStatus): sct send $cmd$par"
after $::scobj::bruker_BEC1::bruker_BEC1_MIN_TIME_BETWEEN_COMMANDS
sct send "$cmd$par"
return $nextState
@ -579,7 +579,7 @@ proc ExtractValue {response lastQueryCmd} {
# || $::scobj::bruker_BEC1::bruker_BEC1_polarityUnitAbsent == false} {
#}
}
#puts "ExtractValue(): response:$response, extractedValue:$extractedValue"
#clientput "ExtractValue(): response:$response, extractedValue:$extractedValue"
return $extractedValue
} message ]
handle_exception $catch_status $message "in ExtractValue(). Last device response: $response"
@ -652,18 +652,18 @@ proc ExtractValue {response lastQueryCmd} {
proc decodeErrByte {errByte errList} {
set errorText ""
set delim ", "
#puts "decodeErrByte: errByte:$errByte"
#clientput "decodeErrByte: errByte:$errByte"
set catch_status [ catch {
# convert to decimal for calculations
set hexvar "0x$errByte"
set decErrByte [expr {$hexvar}]
# puts "errByte=$errByte, hexvar=$hexvar, decErrByte=$decErrByte"
# clientput "errByte=$errByte, hexvar=$hexvar, decErrByte=$decErrByte"
foreach {hexVal errText} $errList {
#puts "errByte:$errByte hexVal:$hexVal errText:$errText"
#clientput "errByte:$errByte hexVal:$hexVal errText:$errText"
# convert to decimal for calculations
set hexvar "0x$hexVal"
set decVal [expr { $hexvar }]
#puts "decErrByte:$decErrByte decVal:$decVal errText:$errText"
#clientput "decErrByte:$decErrByte decVal:$decVal errText:$errText"
if { $decErrByte >= $decVal } {
if {[string length $errorText] > 1} {
set errorText "$errorText$delim$errText"
@ -696,7 +696,7 @@ proc extractStatusByte {statusByteString whichByte} {
# allow for an initial offset of 4 char for 'STA/'
incr offset 4
set statusByte [string range $statusByteString $offset [expr {$offset+1}]]
#puts "ExtractValue(): response:$response, extractedValue:$extractedValue"
#clientput "ExtractValue(): response:$response, extractedValue:$extractedValue"
return $statusByte
} message ]
handle_exception $catch_status $message "in extractStatusByte(). statusByteString: $statusByteString, whichByte: $whichByte"
@ -708,7 +708,7 @@ proc analyseStatusByte {statusByteString} {
# A typical argument may look like this:
# "STA/0000C100"
set catch_status [ catch {
#puts "statusByteString:$statusByteString"
#clientput "statusByteString:$statusByteString"
set LSB_ErrByteTxt "Ok"
set MSB_ErrByteTxt "Ok"
set PwrSupplyStatusByteTxt "Ok"
@ -781,10 +781,10 @@ proc analyseStatusByte {statusByteString} {
#00 {Neutral state}
set StateMachineStatusByteTxt [decodeErrByte $tmp_StateMachineStatusByte $errList]
}
#puts "LSB_ErrByte :x$tmp_LSB_ErrByte: $LSB_ErrByteTxt"
#puts "MSB_ErrByte :x$tmp_MSB_ErrByte: $MSB_ErrByteTxt"
#puts "pwr_supply_status:x$tmp_PwrSupplyStatusByte: $PwrSupplyStatusByteTxt"
#puts "StateMachine :x$tmp_StateMachineStatusByte: $StateMachineStatusTxt"
#clientput "LSB_ErrByte :x$tmp_LSB_ErrByte: $LSB_ErrByteTxt"
#clientput "MSB_ErrByte :x$tmp_MSB_ErrByte: $MSB_ErrByteTxt"
#clientput "pwr_supply_status:x$tmp_PwrSupplyStatusByte: $PwrSupplyStatusByteTxt"
#clientput "StateMachine :x$tmp_StateMachineStatusByte: $StateMachineStatusTxt"
hset $::scobj::bruker_BEC1::bruker_BEC1_path2nodes/pwrctrl/lsb_err "x$tmp_LSB_ErrByte: $LSB_ErrByteTxt"
hset $::scobj::bruker_BEC1::bruker_BEC1_path2nodes/pwrctrl/msb_err "x$tmp_MSB_ErrByte: $MSB_ErrByteTxt"
@ -804,7 +804,7 @@ proc analyseStatusByte {statusByteString} {
# @param separator String holding the separator used in $s, e.g. a coma
# @return returnval String holding the extracted element. String is empty if operation failed.
proc getValFromString {s element separator} {
#puts "getValFromString $s $element $separator"
#clientput "getValFromString $s $element $separator"
set startIdx 0
set endIdx 0
set eIdx $element
@ -829,7 +829,7 @@ proc getValFromString {s element separator} {
}
set endIdx [string first $separator $s $startIdx]
incr endIdx -1
#puts "startIdx=$startIdx endIdx=$endIdx"
#clientput "startIdx=$startIdx endIdx=$endIdx"
# endIdx points to one character before the next separator or is -1 if it is the
# last element in the string $s
if {$endIdx >= 0} {
@ -837,7 +837,7 @@ proc getValFromString {s element separator} {
} else {
set returnval [string range $s $startIdx 555]
}
#puts "getValFromString $s, $element, $separator,\n returns: $returnval"
#clientput "getValFromString $s, $element, $separator,\n returns: $returnval"
return $returnval
}
@ -920,7 +920,7 @@ proc helpNotes4user {scobj_hpath cmdGroup varName} {
set nodeName "$scobj_hpath/$varName"
}
set helptext "No help available"
#puts "helpNotes4user $scobj_hpath/$cmdGroup varName"
#clientput "helpNotes4user $scobj_hpath/$cmdGroup varName"
switch -glob $varName {
"local_remote_state*" {
set h1 {REM: «n» Query or Set local/remote state.}
@ -1057,11 +1057,11 @@ proc helpNotes4user {scobj_hpath cmdGroup varName} {
}
default {
set helptext {Sorry mate. No help available.}
puts "No help info available for node $varName"
clientput "No help info available for node $varName"
}
}
#set sLen [string bytelength $helptext]
#puts "helptext ($sLen bytes) $helptext"
#clientput "helptext ($sLen bytes) $helptext"
hsetprop $nodeName help $helptext
} message ]
handle_exception $catch_status $message "in helpNotes4user(). varName=$varName."
@ -1088,7 +1088,7 @@ proc helpNotes4user {scobj_hpath cmdGroup varName} {
# @param klasse Nexus class name (?)
# @return OK
proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable pollEnabled drivable replyLen dataType permission rdCmd rdFunc wrCmd wrFunc allowedValues klasse} {
#puts "createing node for: $scobj_hpath $cmdGroup $varName $readable $writable $pollEnabled $drivable $dataType $permission $rdCmd $rdFunc $wrCmd $wrFunc"
#clientput "createing node for: $scobj_hpath $cmdGroup $varName $readable $writable $pollEnabled $drivable $dataType $permission $rdCmd $rdFunc $wrCmd $wrFunc"
set catch_status [ catch {
set ns ::scobj::bruker_BEC1
set nodeName "$scobj_hpath/$cmdGroup/$varName"
@ -1100,7 +1100,7 @@ proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable p
hsetprop $nodeName read ${ns}::getValue $scobj_hpath $rdFunc $rdCmd $replyLen
}
if {$pollEnabled == 1} {
# puts "enabling polling for $nodeName"
# clientput "enabling polling for $nodeName"
$sct_controller poll $nodeName
}
hsetprop $nodeName $rdFunc ${ns}::$rdFunc $replyLen
@ -1330,7 +1330,7 @@ proc mk_sct_bruker_BEC1 {sct_controller klasse tempobj tol CID CTYPE} {
# initialise the device
bruker_BEC1_init $sct_controller $scobj_hpath
puts "Bruker BEC1 power supply for 1-Tesla magnet ready at /sample/$tempobj (Driver 2010-06-25)"
clientput "Bruker BEC1 power supply for 1-Tesla magnet ready at /sample/$tempobj (Driver 2010-06-25)"
} message ]
handle_exception $catch_status $message "In subroutine mk_sct_bruker_BEC1()."
}
@ -1356,7 +1356,7 @@ proc add_bruker_BEC1 {name IP port {_tol 0.1} {CID 1} {CTYPE B} } {
return
}
set catch_status [ catch {
puts "\nadd_bruker_BEC1: makesctcontroller $name astvelsel ${IP}:$port for Bruker BEC1 1-Tesla magnet power supply"
clientput "\nadd_bruker_BEC1: makesctcontroller $name astvelsel ${IP}:$port for Bruker BEC1 1-Tesla magnet power supply"
# Command terminator for Bruker unit is always carriage return without linefeed '\r'
makesctcontroller sct_bruker_BEC1_$name astvelsel ${IP}:$port "\r"
# proc mk_sct_bruker_BEC1 (sct_controller klasse tempobj tol)
@ -1383,7 +1383,7 @@ if {[ catch {
}
}
} message ]} {
puts "ERROR: $message"
clientput "ERROR: $message"
}
namespace import ::scobj::bruker_BEC1::*

View File

@ -126,7 +126,7 @@ proc MakeProtek {name IP PORT {scale 1.0} {offset 0.0} {interval 0.5} {cbFunc "r
set sctName "sct_$name"
set sobjName "$name"
set soState "so_state_$name"
puts "MakeSICSObj $sobjName SCT_OBJECT"
clientput "MakeSICSObj $sobjName SCT_OBJECT"
MakeSICSObj $soState SCT_OBJECT
MakeSICSObj $sobjName SCT_OBJECT user float
sicslist setatt $sobjName long_name $sobjName

View File

@ -135,28 +135,28 @@ proc ls336_init {sct_controller tc_root} {
# set the communication protocol: terminator <CR>, bps 9600 baud, 7 data bits +
# 1 stop bit + odd parity bit
# Query the device ID - are we talking to a Lakeshore 340 or 336?
# puts "sending: $sct_controller queue $tc_root/other/deviceID_idn progress read"
# clientput "sending: $sct_controller queue $tc_root/other/deviceID_idn progress read"
# $sct_controller queue $tc_root/other/deviceID_idn progress read
# !! Not working properly yet - needs fixing
#sct send "*IDN?"
#sct data [$sct_controller result]
#puts "rdValDrct(): result is $data"
#clientput "rdValDrct(): result is $data"
#set data [hget $tc_root/other/deviceID_idn]
# puts "set deviceID_idn (hval $tc_root/other/deviceID_idn)"
# clientput "set deviceID_idn (hval $tc_root/other/deviceID_idn)"
#set data [hval $tc_root/other/deviceID_idn]
# reset the device to have it in a defined state
# hset $tc_root/other/reset_rst {*RST}
# Queue the Read Device Status-byte command so we can access the result in the
# corresponding node later
# puts "sending: $sct_controller queue $tc_root/other/statusByte progress read"
# clientput "sending: $sct_controller queue $tc_root/other/statusByte progress read"
# $sct_controller queue $tc_root/other/statusByte progress read
# Was the self-test successful?
$sct_controller queue $tc_root/other/selftest progress read
set_param $tc_root this_selfTestResult [hval $tc_root/other/selftest]
if {[get_param $tc_root this_selfTestResult] == 0} {
puts "sct_lakeshore336.tcl: Lakeshore 336 self-test ok."
clientput "sct_lakeshore336.tcl: Lakeshore 336 self-test ok."
} else {
puts "sct_lakeshore336.tcl: The Lakeshore 336 failed its self-test."
clientput "sct_lakeshore336.tcl: The Lakeshore 336 failed its self-test."
}
# Set the default upper and lower temperature alarm limits in Kelvin
foreach iSensor [get_param $tc_root this_sensorlist] {
@ -193,7 +193,7 @@ proc getValue {tc_root nextState cmd idx} {
if { 0 == [string compare -length 7 $cmd "InpSample"] } {
# we are reading from a pseudo-node where there is no direct representation
# in the device
# puts "getValue(InpSample)"
# clientput "getValue(InpSample)"
#sct send $cmd[get_param $tc_root ls336_term]
} elseif { 0 == [string compare -length 7 $cmd "CRVHDR?"] } {
# In the case of calCurveHdr we need an extra parameter with the command sent
@ -225,7 +225,7 @@ proc getValue {tc_root nextState cmd idx} {
proc rdValue {tc_root rdCmd idx} {
if {[ catch {
set data [sct result]
# puts "rdValue(): result is $data"
# clientput "rdValue(): result is $data"
# broadcast rdValue "rdValue(): result is $data"
# Check if an invalid curveHeader was queried and set the result to 'noCurve'
@ -248,7 +248,7 @@ proc getValue {tc_root nextState cmd idx} {
# Continue as normal
switch -glob -- $data {
"ASCERR:*" {
puts "$data: in rdValue"
clientput "$data: in rdValue"
sct geterror $data
}
default {
@ -311,7 +311,7 @@ proc rdAlarmVal {tc_root rdCmd iSensor} {
set data [sct result]
switch -glob -- $data {
"ASCERR:*" {
puts "$data: in rdAlarmVal"
clientput "$data: in rdAlarmVal"
sct geterror $data
}
default {
@ -322,7 +322,7 @@ proc rdAlarmVal {tc_root rdCmd iSensor} {
# ALARM? returns «off/on», «source», «high value», «low value», «latch enable», «relay»
# idx points to the position of the last coma in the string
# 1, 1, 500.00, 0.00, 0, 0
#puts "rdAlarmVal: iSensor= $iSensor ;; data= $data "
#clientput "rdAlarmVal: iSensor= $iSensor ;; data= $data "
set separator {,}
set onOff [::scobj::ls336::getValFromString $data 0 $separator]
set hiVal [::scobj::ls336::getValFromString $data 1 $separator]
@ -331,7 +331,7 @@ proc rdAlarmVal {tc_root rdCmd iSensor} {
#set latch [::scobj::ls336::getValFromString $data 4 $separator]
#set audible [::scobj::ls336::getValFromString $data 5 $separator]
#set visible [::scobj::ls336::getValFromString $data 6 $separator]
#puts "alarm-data= $data ;; onOff= $onOff ;; source= $source ;; hiVal= $hiVal ;; loVal= $loVal ;; latch= $latch ;; relay= $relay"
#clientput "alarm-data= $data ;; onOff= $onOff ;; source= $source ;; hiVal= $hiVal ;; loVal= $loVal ;; latch= $latch ;; relay= $relay"
switch $iSensor {
"A" {
@ -376,7 +376,7 @@ proc rdAlarmVal {tc_root rdCmd iSensor} {
set data [sct result]
switch -glob -- $data {
"ASCERR:*" {
puts "$data in rdCfgValue"
clientput "$data in rdCfgValue"
sct geterror $data
}
default {
@ -418,12 +418,12 @@ proc rdAlarmVal {tc_root rdCmd iSensor} {
default {set mode ", UNKNOWN control"}
}
append ctrl_Loop_Txt $mode
# puts "rdCfgValue() idx: $idx, data: $data, output: $idx, ctrl_Loop_Txt: $ctrl_Loop_Txt"
# puts "rdCfgValue setting ls336_input4CtrlLp idx:$idx, input:$input, myInp:$myInp"
# clientput "rdCfgValue() idx: $idx, data: $data, output: $idx, ctrl_Loop_Txt: $ctrl_Loop_Txt"
# clientput "rdCfgValue setting ls336_input4CtrlLp idx:$idx, input:$input, myInp:$myInp"
set nodename $tc_root/sensor/ctrl_Loop_$idx
hset $nodename $ctrl_Loop_Txt
# Keep track of which inputs are used for the control loops
# puts "rdCfgValue() idx: $idx, data: $data, input:$input, ctrl_Loop_Txt: $ctrl_Loop_Txt"
# clientput "rdCfgValue() idx: $idx, data: $data, input:$input, ctrl_Loop_Txt: $ctrl_Loop_Txt"
switch $idx {
"1" {hsetprop $tc_root/sensor/ctrl_Loop_1 ls336_input4CtrlLp1 $input}
"2" {hsetprop $tc_root/sensor/ctrl_Loop_2 ls336_input4CtrlLp2 $input}
@ -452,7 +452,7 @@ proc rdBitValue {tc_root rdCmd iSensor} {
set data [sct result]
switch -glob -- $data {
"ASCERR:*" {
puts "$data in rdBitValue"
clientput "$data in rdBitValue"
sct geterror $data
}
default {
@ -477,7 +477,7 @@ proc rdBitValue {tc_root rdCmd iSensor} {
set data [string range $data 1 5]
}
set i $data
# puts "rdBitValue(): iSensor:$iSensor, data:$data"
# clientput "rdBitValue(): iSensor:$iSensor, data:$data"
set bitValue [expr {$i & 1}]
if {$bitValue == 1} {set sValue "Invalid reading, "}
#set i [expr $i >> 1]
@ -519,7 +519,7 @@ proc rdBitValue {tc_root rdCmd iSensor} {
set data [sct result]
switch -glob -- $data {
"ASCERR:*" {
puts "$data in rdInpValue"
clientput "$data in rdInpValue"
sct geterror $data
}
default {
@ -579,7 +579,7 @@ proc inTolerance {tc_root rdCmd CtrlLoopIdx} {
set oldvalue [sct oldval]
switch -glob -- $data {
"ASCERR:*" {
puts "$data in inTolerance"
clientput "$data in inTolerance"
sct geterror $data
}
default {
@ -621,7 +621,7 @@ proc inTolerance {tc_root rdCmd CtrlLoopIdx} {
# set iSensor [hval $nodename]
# set iSensor [string range $iSensor 0 0]
set iSensor [getCorrespondingInputSensor $tc_root $CtrlLoopIdx]
#puts {set intol [checktol $tc_root [sct readtime] [sct timecheck] $CtrlLoopIdx $iSensor]}
#clientput {set intol [checktol $tc_root [sct readtime] [sct timecheck] $CtrlLoopIdx $iSensor]}
if {[string length $iSensor] == 1} {
if {$CtrlLoopIdx == 1} {
set intol [checktol $tc_root [sct currtime] [sct timecheck] $CtrlLoopIdx $iSensor]
@ -644,10 +644,10 @@ proc inTolerance {tc_root rdCmd CtrlLoopIdx} {
hset $nodename "drive"
if {$CtrlLoopIdx == 1} {
hset $tc_root/status "busy"
if {[get_param $tc_root ls336_verbose]==1} {puts "hset $nodename drive; hset $tc_root/status busy"}
if {[get_param $tc_root ls336_verbose]==1} {clientput "hset $nodename drive; hset $tc_root/status busy"}
} else {
hset $tc_root/status_Ctrl_Lp2 "busy"
if {[get_param $tc_root ls336_verbose]==1} {puts "hset $nodename drive; hset $tc_root/status_Ctrl_Lp2 busy"}
if {[get_param $tc_root ls336_verbose]==1} {clientput "hset $nodename drive; hset $tc_root/status_Ctrl_Lp2 busy"}
}
} else {
set nodename $tc_root/sensor/setpoint$CtrlLoopIdx
@ -656,10 +656,10 @@ proc inTolerance {tc_root rdCmd CtrlLoopIdx} {
hset $nodename "monitor"
if {$CtrlLoopIdx == 1} {
hset $tc_root/status "idle"
if {[get_param $tc_root ls336_verbose]==1} {puts "hset $nodename idle; hset $tc_root/status monitor"}
if {[get_param $tc_root ls336_verbose]==1} {clientput "hset $nodename idle; hset $tc_root/status monitor"}
} else {
hset $tc_root/status_Ctrl_Lp2 "idle"
if {[get_param $tc_root ls336_verbose]==1} {puts "hset $nodename idle; hset $tc_root/status_Ctrl_Lp2 monitor"}
if {[get_param $tc_root ls336_verbose]==1} {clientput "hset $nodename idle; hset $tc_root/status_Ctrl_Lp2 monitor"}
}
}
}
@ -688,7 +688,7 @@ proc rdCrvValue {tc_root rdCmd idx} {
set data [sct result]
switch -glob -- $data {
"ASCERR:*" {
puts "$data in rdCrvValue"
clientput "$data in rdCrvValue"
sct geterror $data
}
default {
@ -701,7 +701,7 @@ proc rdCrvValue {tc_root rdCmd idx} {
set tc_root $tc_root
set nodename $tc_root/input/calCurveHdr_$idx
hset $nodename "request refresh"
#puts "hset $nodename request refresh"
#clientput "hset $nodename request refresh"
}
}
}
@ -760,7 +760,7 @@ proc setPseudoValue {tc_root nextState cmd {idx ""}} {
set par [sct target]
}
# Talking to a pseudo-node (no equivalent command in the device communication)
# puts "setPseudoValue($tc_root $nextState $cmd $idx)"
# clientput "setPseudoValue($tc_root $nextState $cmd $idx)"
#sct send "$cmd$par"
} message ]} {
return -code error "in setPseudoValue: $message."
@ -786,7 +786,7 @@ proc noResponse {} {
# @return nextState
proc setPoint {tc_root nextState cmd whichCtrlLoop} {
if {[ catch {
#puts "executing setPoint ($tc_root $nextState $cmd $whichCtrlLoop)"
#clientput "executing setPoint ($tc_root $nextState $cmd $whichCtrlLoop)"
#broadcast setPoint "executing setPoint ($tc_root $nextState $cmd $whichCtrlLoop)"
set ns "[namespace current]"
set par [sct target]
@ -795,11 +795,11 @@ proc setPoint {tc_root nextState cmd whichCtrlLoop} {
set wrStatus [sct writestatus]
if {$wrStatus == "start"} {
# Called by drive adapter
# puts "setPoint(): driving set to 1"
# clientput "setPoint(): driving set to 1"
set nodename $tc_root/sensor/setpoint$whichCtrlLoop
hsetprop $nodename driving 1
}
#puts "setPoint(wrStatus=$wrStatus): sct send $cmd$par"
#clientput "setPoint(wrStatus=$wrStatus): sct send $cmd$par"
sct send "$cmd$par;*IDN?"
} message ]} {
return -code error "in setPoint: $message."
@ -892,7 +892,7 @@ proc sendCmd {tc_root nextState cmd {idx ""}} {
# @param separator String holding the separator used in $s, e.g. a coma
# @return returnval String holding the extracted element. String is empty if operation failed.
proc getValFromString {s element separator} {
#puts "getValFromString $s $element $separator"
#clientput "getValFromString $s $element $separator"
set startIdx 0
set endIdx 0
set eIdx $element
@ -917,7 +917,7 @@ proc sendCmd {tc_root nextState cmd {idx ""}} {
}
set endIdx [string first $separator $s $startIdx]
incr endIdx -1
#puts "startIdx=$startIdx endIdx=$endIdx"
#clientput "startIdx=$startIdx endIdx=$endIdx"
# endIdx points to one character before the next separator or is -1 if it is the
# last element in the string $s
if {$endIdx >= 0} {
@ -925,7 +925,7 @@ proc sendCmd {tc_root nextState cmd {idx ""}} {
} else {
set returnval [string range $s $startIdx 555]
}
#puts "getValFromString $s, $element, $separator,\n returns: $returnval"
#clientput "getValFromString $s, $element, $separator,\n returns: $returnval"
return $returnval
}
@ -981,11 +981,11 @@ proc checktol {tc_root currtime timecheck iLoop iSensor} {
set lotemp [expr {$setpt - $tol}]
set hitemp [expr {$setpt + $tol}]
if {[get_param $tc_root ls336_verbose]==1} {
puts "checktol(): setpt $isetp=$setpt lotemp=$lotemp, current $sensorValue=$temp, hitemp=$hitemp, tol=$tol, iLoop=$iLoop, timecheck=$timecheck, currtime=$currtime"
clientput "checktol(): setpt $isetp=$setpt lotemp=$lotemp, current $sensorValue=$temp, hitemp=$hitemp, tol=$tol, iLoop=$iLoop, timecheck=$timecheck, currtime=$currtime"
}
if { $temp < $lotemp || $temp > $hitemp} {
hset $tc_root/emon/isInTolerance_Lp$iLoop "outsideTolerance"
if {[get_param $tc_root ls336_verbose]==1} {puts "hset $tc_root/emon/isInTolerance_Lp$iLoop outsideTolerance"}
if {[get_param $tc_root ls336_verbose]==1} {clientput "hset $tc_root/emon/isInTolerance_Lp$iLoop outsideTolerance"}
if {$iLoop==1} { sct utime timecheck }
if {$iLoop==2} { sct utime timecheck2 }
return 0
@ -995,14 +995,14 @@ proc checktol {tc_root currtime timecheck iLoop iSensor} {
if {$elapsedTime > $timeout} {
hset $tc_root/emon/isInTolerance_Lp$iLoop "inTolerance"
if {[get_param $tc_root ls336_verbose]==1} {
puts "hset $tc_root/emon/isInTolerance_Lp$iLoop inTolerance (elapsedTime=$elapsedTime greater than settleTime=$timeout)"
clientput "hset $tc_root/emon/isInTolerance_Lp$iLoop inTolerance (elapsedTime=$elapsedTime greater than settleTime=$timeout)"
}
return 1
} else {
# Temperature has not been within tolerance for enough time - (overshoots, oscillations,..)
hset $tc_root/emon/isInTolerance_Lp$iLoop "outsideTolerance"
if {[get_param $tc_root ls336_verbose]==1} {
puts "hset $tc_root/emon/isInTolerance_Lp$iLoop outsideTolerance (elapsedTime=$elapsedTime less than settleTime=$timeout)"
clientput "hset $tc_root/emon/isInTolerance_Lp$iLoop outsideTolerance (elapsedTime=$elapsedTime less than settleTime=$timeout)"
}
return 0
}
@ -1020,10 +1020,10 @@ proc checktol {tc_root currtime timecheck iLoop iSensor} {
proc check {tc_root whichCtrlLoop} {
if {[ catch {
set setpoint [sct target]
#puts "check(): setpoint= $setpoint"
#clientput "check(): setpoint= $setpoint"
# determine the corresponding input sensor
set whichSensor [getCorrespondingInputSensor $tc_root $whichCtrlLoop]
# puts "check(): whichCtrlLoop=$whichCtrlLoop whichSensor= $whichSensor"
# clientput "check(): whichCtrlLoop=$whichCtrlLoop whichSensor= $whichSensor"
set lolimit [get_param $tc_root alarm_Limit_LoA]
set hilimit [get_param $tc_root alarm_Limit_HiA]
set bCheckLimits [get_param $tc_root checkAlarmLimitsA]
@ -1052,7 +1052,7 @@ proc check {tc_root whichCtrlLoop} {
error "sct_ls336.tcl check(): Can't set setpoint. No valid input sensor specified for this output control loop."
}
}
# puts "check(): doCheck:$bCheckLimits lolimit=$lolimit setpoint=$setpoint hilimit=$hilimit"
# clientput "check(): doCheck:$bCheckLimits lolimit=$lolimit setpoint=$setpoint hilimit=$hilimit"
if {$bCheckLimits == 1} {
if {$setpoint < $lolimit || $setpoint > $hilimit} {
error "sct_ls336.tcl: setpoint $tc_root/sensor/sensorValue$whichSensor violates set alarm limits"
@ -1102,7 +1102,7 @@ proc helpNotes4user {scobj_hpath cmdGroup varName} {
set nodeName "$scobj_hpath/$varName"
}
set helptext "No help available"
#puts "helpNotes4user $scobj_hpath/$cmdGroup varName"
#clientput "helpNotes4user $scobj_hpath/$cmdGroup varName"
switch -glob $varName {
"sensorValue*" {
set h1 {KRDG? «input» Query Kelvin Reading for an Input}
@ -1487,11 +1487,11 @@ proc helpNotes4user {scobj_hpath cmdGroup varName} {
}
default {
set helptext {Sorry mate. No help available.}
puts "No help info available for node $varName"
clientput "No help info available for node $varName"
}
}
#set sLen [string bytelength $helptext]
#puts "helptext ($sLen bytes) $helptext"
#clientput "helptext ($sLen bytes) $helptext"
hsetprop $nodeName help $helptext
} message ]} {
return -code error "in helpNotes4user: $message"
@ -1522,7 +1522,7 @@ proc helpNotes4user {scobj_hpath cmdGroup varName} {
# @param klasse Nexus class name (?)
# @return OK
proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable pollEnabled drivable idx ls340 ls336 dataType permission rdCmd rdFunc wrCmd wrFunc allowedValues klasse} {
#puts "createing node for: $scobj_hpath $cmdGroup $varName $readable $writable $pollEnabled $drivable $idx $dataType $permission $rdCmd $rdFunc $wrCmd $wrFunc"
#clientput "createing node for: $scobj_hpath $cmdGroup $varName $readable $writable $pollEnabled $drivable $idx $dataType $permission $rdCmd $rdFunc $wrCmd $wrFunc"
# It is a command that is supported by the device
if {[ catch {
set ns "[namespace current]"
@ -1535,7 +1535,7 @@ proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable p
hsetprop $nodeName read ${ns}::getValue $scobj_hpath $rdFunc $rdCmd $idx
}
if {$pollEnabled == 1} {
# puts "enabling polling for $nodeName"
# clientput "enabling polling for $nodeName"
$sct_controller poll $nodeName
}
hsetprop $nodeName $rdFunc ${ns}::$rdFunc $scobj_hpath $rdCmd $idx
@ -1867,7 +1867,7 @@ proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable p
# initialise the device
ls336_init $sct_controller $scobj_hpath
puts "Lakeshore 336 temperature controller ready at /sample/$tempobj (Driver 2010-06-25)"
clientput "Lakeshore 336 temperature controller ready at /sample/$tempobj (Driver 2010-06-25)"
} message ]} {
return -code error "in mk_sct_lakeshore_336 $message"
}
@ -1896,10 +1896,10 @@ proc add_lakeshore_336 {name IP port {terminator \r\n} {_tol1 1.0} {_tol2 1.0} {
if {[ catch {
if {[string equal -nocase "aqadapter" "${IP}"]} {
# dcl 2013-05-27: in this case the port is the name of the AsyncQueue
puts "\add_lakeshore_336: makesctcontroller sct_ls336_$name aqadapter ${port} for Lakeshore model 336"
clientput "\add_lakeshore_336: makesctcontroller sct_ls336_$name aqadapter ${port} for Lakeshore model 336"
makesctcontroller sct_ls336_$name aqadapter ${port}
} else {
puts "\add_lakeshore_336: makesctcontroller sct_ls336_$name std ${IP}:$port $terminator for Lakeshore model 336"
clientput "\add_lakeshore_336: makesctcontroller sct_ls336_$name std ${IP}:$port $terminator for Lakeshore model 336"
makesctcontroller sct_ls336_$name std ${IP}:$port $terminator
}
::scobj::ls336::mk_sct_lakeshore_336 sct_ls336_$name environment $name $CID $CTYPE $_tol1 $_tol2 $_verbose

View File

@ -138,26 +138,26 @@ proc ls340_init {sct_controller tc_root} {
# set the communication protocol: terminator <CR>, bps 9600 baud, 7 data bits +
# 1 stop bit + odd parity bit
if { $::scobj::ls340::ls340_LSmodel == 340 } {
# puts "setting serial communication parameters"
# clientput "setting serial communication parameters"
hset $tc_root/other/cfgProtocol_comm "COMM 1,5,1"
}
# Query the device ID - are we talking to a Lakeshore 340 or 336?
# puts "sending: $sct_controller queue $tc_root/other/deviceID_idn progress read"
# clientput "sending: $sct_controller queue $tc_root/other/deviceID_idn progress read"
# $sct_controller queue $tc_root/other/deviceID_idn progress read
# !! Not working properly yet - needs fixing
#sct send "*IDN?"
#sct data [$sct_controller result]
#puts "rdValDrct(): result is $data"
#clientput "rdValDrct(): result is $data"
#set data [hget $tc_root/other/deviceID_idn]
# puts "set deviceID_idn (hval $tc_root/other/deviceID_idn)"
# clientput "set deviceID_idn (hval $tc_root/other/deviceID_idn)"
#set data [hval $tc_root/other/deviceID_idn]
#set ::scobj::ls340::this_sDeviceID data
# puts "sct_lakeshore340.tcl: connected to device $::scobj::ls340::this_sDeviceID"
# clientput "sct_lakeshore340.tcl: connected to device $::scobj::ls340::this_sDeviceID"
# reset the device to have it in a defined state
# hset $tc_root/other/reset_rst {*RST}
# Queue the Read Device Status-byte command so we can access the result in the
# corresponding node later
# puts "sending: $sct_controller queue $tc_root/other/statusByte progress read"
# clientput "sending: $sct_controller queue $tc_root/other/statusByte progress read"
# $sct_controller queue $tc_root/other/statusByte progress read
if { $::scobj::ls340::ls340_LSmodel == 340 } {
hset $tc_root/other/cfgProtocol_comm "COMM 1,5,1"
@ -166,9 +166,9 @@ proc ls340_init {sct_controller tc_root} {
$sct_controller queue $tc_root/other/selftest progress read
set ::scobj::ls340::this_selfTestResult [hval $tc_root/other/selftest]
if {$::scobj::ls340::this_selfTestResult == 0} {
puts "sct_lakeshore340.tcl: Lakeshore $::scobj::ls340::ls340_LSmodel self-test ok."
clientput "sct_lakeshore340.tcl: Lakeshore $::scobj::ls340::ls340_LSmodel self-test ok."
} else {
puts "sct_lakeshore340.tcl: The Lakeshore $::scobj::ls340::ls340_LSmodel failed its self-test."
clientput "sct_lakeshore340.tcl: The Lakeshore $::scobj::ls340::ls340_LSmodel failed its self-test."
}
# Set the default upper and lower temperature alarm limits in Kelvin
foreach iSensor $::scobj::ls340::this_sensorlist {
@ -187,7 +187,7 @@ proc ls340_init {sct_controller tc_root} {
hset $tc_root/control/settleThr_Loop_1 $::scobj::ls340::ls340_settleThr
hset $tc_root/control/settleTime_Loop_1 $::scobj::ls340::ls340_settleTime
hsetprop $tc_root/control/settleTime_Loop_1 units "s"
puts "Make sure INTERFACE : SERIAL : TERMINATOR is set correctly"
clientput "Make sure INTERFACE : SERIAL : TERMINATOR is set correctly"
}
# Set the default tolerances for the setpoint temperatures
hset $tc_root/control/tolerance1 $::scobj::ls340::ls340_driveTolerance1
@ -217,7 +217,7 @@ proc getValue {tc_root nextState cmd idx} {
if { 0 == [string compare -length 7 $cmd "InpSample"] } {
# we are reading from a pseudo-node where there is no direct representation
# in the device
# puts "getValue(InpSample)"
# clientput "getValue(InpSample)"
set ::scobj::ls340::ls340_lastQueryCmd $cmd
#sct send $cmd$::scobj::ls340::ls340_term
} elseif { 0 == [string compare -length 7 $cmd "CRVHDR?"] } {
@ -252,7 +252,7 @@ proc getValue {tc_root nextState cmd idx} {
proc rdValue {idx} {
if {[ catch {
set data [sct result]
# puts "rdValue(): result is $data"
# clientput "rdValue(): result is $data"
# broadcast rdValue "rdValue(): result is $data"
# Check if an invalid curveHeader was queried and set the result to 'noCurve'
@ -274,7 +274,7 @@ proc getValue {tc_root nextState cmd idx} {
# Continue as normal
switch -glob -- $data {
"ASCERR:*" {
puts "ASCERR in rdValue: Last query command: $::scobj::ls340::ls340_lastQueryCmd"
clientput "ASCERR in rdValue: Last query command: $::scobj::ls340::ls340_lastQueryCmd"
sct geterror $data
}
default {
@ -350,7 +350,7 @@ proc rdAlarmVal {iSensor} {
set data [sct result]
switch -glob -- $data {
"ASCERR:*" {
puts "ASCERR in rdAlarmVal: Last query command: $::scobj::ls340::ls340_lastQueryCmd"
clientput "ASCERR in rdAlarmVal: Last query command: $::scobj::ls340::ls340_lastQueryCmd"
sct geterror $data
}
default {
@ -361,7 +361,7 @@ proc rdAlarmVal {iSensor} {
# ALARM? returns «off/on», «source», «high value», «low value», «latch enable», «relay»
# idx points to the position of the last coma in the string
# 1, 1, 500.00, 0.00, 0, 0
#puts "rdAlarmVal: iSensor= $iSensor ;; data= $data "
#clientput "rdAlarmVal: iSensor= $iSensor ;; data= $data "
set separator {,}
set onOff [::scobj::ls340::getValFromString $data 0 $separator]
if { $::scobj::ls340::ls340_LSmodel == 340 } {
@ -378,7 +378,7 @@ proc rdAlarmVal {iSensor} {
#set audible [::scobj::ls340::getValFromString $data 5 $separator]
#set visible [::scobj::ls340::getValFromString $data 6 $separator]
}
#puts "alarm-data= $data ;; onOff= $onOff ;; source= $source ;; hiVal= $hiVal ;; loVal= $loVal ;; latch= $latch ;; relay= $relay"
#clientput "alarm-data= $data ;; onOff= $onOff ;; source= $source ;; hiVal= $hiVal ;; loVal= $loVal ;; latch= $latch ;; relay= $relay"
switch $iSensor {
"A" {
@ -423,13 +423,13 @@ proc rdAlarmVal {iSensor} {
set data [sct result]
switch -glob -- $data {
"ASCERR:*" {
puts "ASCERR in rdCfgValue: Last query command: $::scobj::ls340::ls340_lastQueryCmd"
clientput "ASCERR in rdCfgValue: Last query command: $::scobj::ls340::ls340_lastQueryCmd"
sct geterror $data
}
default {
set oval [sct oldval]
if { $data != [sct oldval] } {
# puts "rdCfgValue: idx:$idx Last query command: $::scobj::ls340::ls340_lastQueryCmd"
# clientput "rdCfgValue: idx:$idx Last query command: $::scobj::ls340::ls340_lastQueryCmd"
sct oldval $data
sct update $data
sct utime readtime
@ -455,7 +455,7 @@ proc rdAlarmVal {iSensor} {
default {set units "UNKNOWN units"}
}
set ctrl_Loop_Txt $ctrl_Loop_Txt$input$in$units
# puts "ls340 rdCfgValue() idx: $idx, data: $data, units: $units, ctrl_Loop_Txt: $ctrl_Loop_Txt"
# clientput "ls340 rdCfgValue() idx: $idx, data: $data, units: $units, ctrl_Loop_Txt: $ctrl_Loop_Txt"
} else {
# LS 336, device command outMode_*
set mode [::scobj::ls340::getValFromString $data 0 $separator]
@ -485,20 +485,20 @@ proc rdAlarmVal {iSensor} {
default {set mode ", UNKNOWN control"}
}
append ctrl_Loop_Txt $mode
# puts "rdCfgValue() idx: $idx, data: $data, output: $idx, ctrl_Loop_Txt: $ctrl_Loop_Txt"
# puts "rdCfgValue setting ls340_input4CtrlLp idx:$idx, input:$input, myInp:$myInp"
# clientput "rdCfgValue() idx: $idx, data: $data, output: $idx, ctrl_Loop_Txt: $ctrl_Loop_Txt"
# clientput "rdCfgValue setting ls340_input4CtrlLp idx:$idx, input:$input, myInp:$myInp"
}
set nodename $::scobj::ls340::ls340_path2nodes/sensor/ctrl_Loop_$idx
hset $nodename $ctrl_Loop_Txt
# Keep track of which inputs are used for the control loops
# puts "rdCfgValue() idx: $idx, data: $data, input:$input, ctrl_Loop_Txt: $ctrl_Loop_Txt"
# clientput "rdCfgValue() idx: $idx, data: $data, input:$input, ctrl_Loop_Txt: $ctrl_Loop_Txt"
switch $idx {
"1" {set ::scobj::ls340::ls340_input4CtrlLp1 $input}
"2" {set ::scobj::ls340::ls340_input4CtrlLp2 $input}
"3" {set ::scobj::ls340::ls340_input4CtrlLp3 $input}
"4" {set ::scobj::ls340::ls340_input4CtrlLp4 $input}
}
# puts "rdCfgValue ls340_input4CtrlLp:$::scobj::ls340::ls340_input4CtrlLp2 idx:$idx, input:$input, myInp:$myInp"
# clientput "rdCfgValue ls340_input4CtrlLp:$::scobj::ls340::ls340_input4CtrlLp2 idx:$idx, input:$input, myInp:$myInp"
}
}
}
@ -521,7 +521,7 @@ proc rdBitValue {iSensor} {
set data [sct result]
switch -glob -- $data {
"ASCERR:*" {
puts "ASCERR in rdBitValue: Last query command: $::scobj::ls340::ls340_lastQueryCmd"
clientput "ASCERR in rdBitValue: Last query command: $::scobj::ls340::ls340_lastQueryCmd"
sct geterror $data
}
default {
@ -547,7 +547,7 @@ proc rdBitValue {iSensor} {
set data [string range $data 1 5]
}
set i $data
# puts "rdBitValue(): iSensor:$iSensor, data:$data"
# clientput "rdBitValue(): iSensor:$iSensor, data:$data"
set bitValue [expr {$i & 1}]
if {$bitValue == 1} {set sValue "Invalid reading, "}
#set i [expr $i >> 1]
@ -568,7 +568,7 @@ proc rdBitValue {iSensor} {
if { [string length $sValue] < 4 } {
set sValue "ok"
}
#puts "rdBitValue(): iSensor:$iSensor, data:$data, sValue:$sValue "
#clientput "rdBitValue(): iSensor:$iSensor, data:$data, sValue:$sValue "
switch $iSensor {
"A" {set ::scobj::ls340::ls340_inputStatusA $sValue}
"B" {set ::scobj::ls340::ls340_inputStatusB $sValue}
@ -595,7 +595,7 @@ proc rdBitValue {iSensor} {
set data [sct result]
switch -glob -- $data {
"ASCERR:*" {
puts "ASCERR in rdInpValue: Last query command: $::scobj::ls340::ls340_lastQueryCmd"
clientput "ASCERR in rdInpValue: Last query command: $::scobj::ls340::ls340_lastQueryCmd"
sct geterror $data
}
default {
@ -621,7 +621,7 @@ proc rdBitValue {iSensor} {
"D" {set inpEnabled $::scobj::ls340::ls340_inpSetupD}
}
if {0 == [string compare -length 1 $inpEnabled "0"] } {
# puts "Inp$idx is DISABLED"
# clientput "Inp$idx is DISABLED"
set inputStatus "DISABLED"
} else {
# RDGST? if RDGST is NOT zero -- or else the Kelvin reading for that input.
@ -636,7 +636,7 @@ proc rdBitValue {iSensor} {
set value $data
if { [string length $inputStatus] >= 8 } {
# The status of the input channel meets an error condition - show the error message instead
# puts "rdInpValue() idx: $idx, data: $data, invalid: $inputStatus"
# clientput "rdInpValue() idx: $idx, data: $data, invalid: $inputStatus"
set value -1.0
}
if {$idx == $::scobj::ls340::ls340_sampleSensor} {
@ -677,10 +677,10 @@ proc inTolerance {CtrlLoopIdx} {
set tc_root $::scobj::ls340::ls340_path2nodes
set data [sct result]
set oldvalue [sct oldval]
# puts "inTolerance(): data=$data oldvalue=$oldvalue idx:$CtrlLoopIdx"
# clientput "inTolerance(): data=$data oldvalue=$oldvalue idx:$CtrlLoopIdx"
switch -glob -- $data {
"ASCERR:*" {
puts "ASCERR in inTolerance: Last query command: $::scobj::ls340::ls340_lastQueryCmd"
clientput "ASCERR in inTolerance: Last query command: $::scobj::ls340::ls340_lastQueryCmd"
sct geterror $data
}
default {
@ -701,7 +701,7 @@ proc inTolerance {CtrlLoopIdx} {
}
}
sct utime currtime
# puts "inTolerance $::scobj::ls340::ls340_sct_obj_name CtrlLoopIdx:$CtrlLoopIdx data:$data"
# clientput "inTolerance $::scobj::ls340::ls340_sct_obj_name CtrlLoopIdx:$CtrlLoopIdx data:$data"
# now update the manual nodes reporting whether the actual temperature
# is within tolerance of the corresponding setpoint
for {set CtrlLoopIdx 1} {$CtrlLoopIdx < 3} {incr CtrlLoopIdx 1} {
@ -723,8 +723,8 @@ proc inTolerance {CtrlLoopIdx} {
# set iSensor [hval $nodename]
# set iSensor [string range $iSensor 0 0]
set iSensor [getCorrespondingInputSensor $CtrlLoopIdx]
# puts "inTolerance 2 $::scobj::ls340::ls340_sct_obj_name CtrlLoopIdx:$CtrlLoopIdx data:$data, iSensor:$iSensor"
#puts {set intol [checktol $tc_root [sct readtime] [sct timecheck] $CtrlLoopIdx $iSensor]}
# clientput "inTolerance 2 $::scobj::ls340::ls340_sct_obj_name CtrlLoopIdx:$CtrlLoopIdx data:$data, iSensor:$iSensor"
#clientput {set intol [checktol $tc_root [sct readtime] [sct timecheck] $CtrlLoopIdx $iSensor]}
if {[string length $iSensor] == 1} {
if {$CtrlLoopIdx == 1} {
set intol [checktol $tc_root [sct currtime] [sct timecheck] $CtrlLoopIdx $iSensor]
@ -735,24 +735,24 @@ proc inTolerance {CtrlLoopIdx} {
set setpt [hval $nodename]
set nodename $tc_root/sensor/sensorValue$iSensor
set temp [hval $nodename]
# puts "inTolerance(): comparing sensor/setpoint$CtrlLoopIdx=$setpt with actual sensorValue$iSensor=$temp"
# clientput "inTolerance(): comparing sensor/setpoint$CtrlLoopIdx=$setpt with actual sensorValue$iSensor=$temp"
set diff [expr {abs($setpt - $temp)}]
# $::scobj::ls340::ls340_driveTolerance = 0.2 Kelvin
set tol [hval $tc_root/control/tolerance1]
if {$CtrlLoopIdx == 2} {
set tol [hval $tc_root/control/tolerance2]
}
# puts "inTolerance(): diff=$diff tol=$tol"
# clientput "inTolerance(): diff=$diff tol=$tol"
# if $diff > $tol
if {$intol==0} {
set nodename $tc_root/emon/monMode_Lp$CtrlLoopIdx
hset $nodename "drive"
if {$CtrlLoopIdx == 1} {
hset $tc_root/status "busy"
if {$::scobj::ls340::ls340_verbose==1} {puts "hset $nodename drive; hset $tc_root/status busy"}
if {$::scobj::ls340::ls340_verbose==1} {clientput "hset $nodename drive; hset $tc_root/status busy"}
} else {
hset $tc_root/status_Ctrl_Lp2 "busy"
if {$::scobj::ls340::ls340_verbose==1} {puts "hset $nodename drive; hset $tc_root/status_Ctrl_Lp2 busy"}
if {$::scobj::ls340::ls340_verbose==1} {clientput "hset $nodename drive; hset $tc_root/status_Ctrl_Lp2 busy"}
}
} else {
set nodename $tc_root/sensor/setpoint$CtrlLoopIdx
@ -761,15 +761,15 @@ proc inTolerance {CtrlLoopIdx} {
hset $nodename "monitor"
if {$CtrlLoopIdx == 1} {
hset $tc_root/status "idle"
if {$::scobj::ls340::ls340_verbose==1} {puts "hset $nodename idle; hset $tc_root/status monitor"}
if {$::scobj::ls340::ls340_verbose==1} {clientput "hset $nodename idle; hset $tc_root/status monitor"}
} else {
hset $tc_root/status_Ctrl_Lp2 "idle"
if {$::scobj::ls340::ls340_verbose==1} {puts "hset $nodename idle; hset $tc_root/status_Ctrl_Lp2 monitor"}
if {$::scobj::ls340::ls340_verbose==1} {clientput "hset $nodename idle; hset $tc_root/status_Ctrl_Lp2 monitor"}
}
}
}
} else {
# puts "inTolerance(): uuppss - should not go here"
# clientput "inTolerance(): uuppss - should not go here"
hset $tc_root/emon/monMode_Lp1 "idle"
hset $tc_root/emon/monMode_Lp2 "idle"
hset $tc_root/emon/isInTolerance_Lp1 "inTolerance"
@ -778,11 +778,11 @@ proc inTolerance {CtrlLoopIdx} {
hset $tc_root/status_Ctrl_Lp2 "idle"
}
}
# puts "inTolerance 4 $::scobj::ls340::ls340_sct_obj_name CtrlLoopIdx:$CtrlLoopIdx data:$data"
# clientput "inTolerance 4 $::scobj::ls340::ls340_sct_obj_name CtrlLoopIdx:$CtrlLoopIdx data:$data"
} message ]} {
return -code error "in inTolerance: $message. Last query command: $::scobj::ls340::ls340_lastQueryCmd"
}
# puts "Leaving inTolerance idx:$CtrlLoopIdx"
# clientput "Leaving inTolerance idx:$CtrlLoopIdx"
return idle
}
@ -796,7 +796,7 @@ proc rdCrvValue {idx} {
set data [sct result]
switch -glob -- $data {
"ASCERR:*" {
puts "ASCERR in rdCrvValue: Last query command: $::scobj::ls340::ls340_lastQueryCmd"
clientput "ASCERR in rdCrvValue: Last query command: $::scobj::ls340::ls340_lastQueryCmd"
sct geterror $data
}
default {
@ -809,7 +809,7 @@ proc rdCrvValue {idx} {
set tc_root $::scobj::ls340::ls340_path2nodes
set nodename $tc_root/input/calCurveHdr_$idx
hset $nodename "request refresh"
#puts "hset $nodename request refresh"
#clientput "hset $nodename request refresh"
}
}
}
@ -870,7 +870,7 @@ proc setPseudoValue {tc_root nextState cmd {idx ""}} {
}
set ::scobj::ls340::ls340_lastWriteCmd "$cmd$par"
# Talking to a pseudo-node (no equivalent command in the device communication)
# puts "setPseudoValue($tc_root $nextState $cmd $idx)"
# clientput "setPseudoValue($tc_root $nextState $cmd $idx)"
#sct send "$cmd$par"
} message ]} {
return -code error "in setPseudoValue: $message. While processing command: $::scobj::ls340::ls340_lastWriteCmd"
@ -896,7 +896,7 @@ proc noResponse {} {
# @return nextState
proc setPoint {tc_root nextState cmd whichCtrlLoop} {
if {[ catch {
#puts "executing setPoint ($tc_root $nextState $cmd $whichCtrlLoop)"
#clientput "executing setPoint ($tc_root $nextState $cmd $whichCtrlLoop)"
#broadcast setPoint "executing setPoint ($tc_root $nextState $cmd $whichCtrlLoop)"
set ns ::scobj::lh45
set par [sct target]
@ -907,11 +907,11 @@ proc setPoint {tc_root nextState cmd whichCtrlLoop} {
set wrStatus [sct writestatus]
if {$wrStatus == "start"} {
# Called by drive adapter
# puts "setPoint(): driving set to 1"
# clientput "setPoint(): driving set to 1"
set nodename $tc_root/sensor/setpoint$whichCtrlLoop
hsetprop $nodename driving 1
}
#puts "setPoint(wrStatus=$wrStatus): sct send $cmd$par"
#clientput "setPoint(wrStatus=$wrStatus): sct send $cmd$par"
sct send "$cmd$par;*IDN?"
} message ]} {
return -code error "in setPoint: $message. Last write command: $::scobj::ls340::ls340_lastWriteCmd"
@ -1005,7 +1005,7 @@ proc sendCmd {tc_root nextState cmd {idx ""}} {
# @param separator String holding the separator used in $s, e.g. a coma
# @return returnval String holding the extracted element. String is empty if operation failed.
proc getValFromString {s element separator} {
#puts "getValFromString $s $element $separator"
#clientput "getValFromString $s $element $separator"
set startIdx 0
set endIdx 0
set eIdx $element
@ -1030,7 +1030,7 @@ proc sendCmd {tc_root nextState cmd {idx ""}} {
}
set endIdx [string first $separator $s $startIdx]
incr endIdx -1
#puts "startIdx=$startIdx endIdx=$endIdx"
#clientput "startIdx=$startIdx endIdx=$endIdx"
# endIdx points to one character before the next separator or is -1 if it is the
# last element in the string $s
if {$endIdx >= 0} {
@ -1038,7 +1038,7 @@ proc sendCmd {tc_root nextState cmd {idx ""}} {
} else {
set returnval [string range $s $startIdx 555]
}
#puts "getValFromString $s, $element, $separator,\n returns: $returnval"
#clientput "getValFromString $s, $element, $separator,\n returns: $returnval"
return $returnval
}
@ -1104,11 +1104,11 @@ proc checktol {tc_root currtime timecheck iLoop iSensor} {
set lotemp [expr {$setpt - $tol}]
set hitemp [expr {$setpt + $tol}]
if {$::scobj::ls340::ls340_verbose==1} {
puts "checktol(): setpt $isetp=$setpt lotemp=$lotemp, current $sensorValue=$temp, hitemp=$hitemp, tol=$tol, iLoop=$iLoop, timecheck=$timecheck, currtime=$currtime"
clientput "checktol(): setpt $isetp=$setpt lotemp=$lotemp, current $sensorValue=$temp, hitemp=$hitemp, tol=$tol, iLoop=$iLoop, timecheck=$timecheck, currtime=$currtime"
}
if { $temp < $lotemp || $temp > $hitemp} {
hset $tc_root/emon/isInTolerance_Lp$iLoop "outsideTolerance"
if {$::scobj::ls340::ls340_verbose==1} {puts "hset $tc_root/emon/isInTolerance_Lp$iLoop outsideTolerance"}
if {$::scobj::ls340::ls340_verbose==1} {clientput "hset $tc_root/emon/isInTolerance_Lp$iLoop outsideTolerance"}
if {$iLoop==1} { sct utime timecheck }
if {$iLoop==2} { sct utime timecheck2 }
return 0
@ -1118,18 +1118,18 @@ proc checktol {tc_root currtime timecheck iLoop iSensor} {
set timeout [hval $tc_root/control/settleTime_Loop_1]
}
set elapsedTime [expr {$currtime - $timecheck}]
#puts "if (elapsedTime=$elapsedTime > timeout=$timeout) we are inTolerance"
#clientput "if (elapsedTime=$elapsedTime > timeout=$timeout) we are inTolerance"
if {$elapsedTime > $timeout} {
hset $tc_root/emon/isInTolerance_Lp$iLoop "inTolerance"
if {$::scobj::ls340::ls340_verbose==1} {
puts "hset $tc_root/emon/isInTolerance_Lp$iLoop inTolerance (elapsedTime=$elapsedTime greater than settleTime=$timeout)"
clientput "hset $tc_root/emon/isInTolerance_Lp$iLoop inTolerance (elapsedTime=$elapsedTime greater than settleTime=$timeout)"
}
return 1
} else {
# Temperature has not been within tolerance for enough time - (overshoots, oscillations,..)
hset $tc_root/emon/isInTolerance_Lp$iLoop "outsideTolerance"
if {$::scobj::ls340::ls340_verbose==1} {
puts "hset $tc_root/emon/isInTolerance_Lp$iLoop outsideTolerance (elapsedTime=$elapsedTime less than settleTime=$timeout)"
clientput "hset $tc_root/emon/isInTolerance_Lp$iLoop outsideTolerance (elapsedTime=$elapsedTime less than settleTime=$timeout)"
}
return 0
}
@ -1147,10 +1147,10 @@ proc checktol {tc_root currtime timecheck iLoop iSensor} {
proc check {tc_root whichCtrlLoop} {
if {[ catch {
set setpoint [sct target]
#puts "check(): setpoint= $setpoint"
#clientput "check(): setpoint= $setpoint"
# determine the corresponding input sensor
set whichSensor [getCorrespondingInputSensor $whichCtrlLoop]
# puts "check(): whichCtrlLoop=$whichCtrlLoop whichSensor= $whichSensor"
# clientput "check(): whichCtrlLoop=$whichCtrlLoop whichSensor= $whichSensor"
set lolimit $::scobj::ls340::alarm_Limit_LoA
set hilimit $::scobj::ls340::alarm_Limit_HiA
set bCheckLimits $::scobj::ls340::checkAlarmLimitsA
@ -1179,7 +1179,7 @@ proc check {tc_root whichCtrlLoop} {
error "sct_ls340.tcl check(): Can't set setpoint. No valid input sensor specified for this output control loop."
}
}
# puts "check(): doCheck:$bCheckLimits lolimit=$lolimit setpoint=$setpoint hilimit=$hilimit"
# clientput "check(): doCheck:$bCheckLimits lolimit=$lolimit setpoint=$setpoint hilimit=$hilimit"
if {$bCheckLimits == 1} {
if {$setpoint < $lolimit || $setpoint > $hilimit} {
error "sct_ls340.tcl: setpoint $tc_root/sensor/sensorValue$whichSensor violates set alarm limits"
@ -1229,7 +1229,7 @@ proc helpNotes4user {scobj_hpath cmdGroup varName} {
set nodeName "$scobj_hpath/$varName"
}
set helptext "No help available"
#puts "helpNotes4user $scobj_hpath/$cmdGroup varName"
#clientput "helpNotes4user $scobj_hpath/$cmdGroup varName"
switch -glob $varName {
"sensorValue*" {
set h1 {KRDG? «input» Query Kelvin Reading for an Input}
@ -1653,11 +1653,11 @@ proc helpNotes4user {scobj_hpath cmdGroup varName} {
}
default {
set helptext {Sorry mate. No help available.}
puts "No help info available for node $varName"
clientput "No help info available for node $varName"
}
}
#set sLen [string bytelength $helptext]
#puts "helptext ($sLen bytes) $helptext"
#clientput "helptext ($sLen bytes) $helptext"
hsetprop $nodeName help $helptext
} message ]} {
return -code error "in helpNotes4user: $message"
@ -1688,15 +1688,15 @@ proc helpNotes4user {scobj_hpath cmdGroup varName} {
# @param klasse Nexus class name (?)
# @return OK
proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable pollEnabled drivable idx ls340 ls336 dataType permission rdCmd rdFunc wrCmd wrFunc allowedValues klasse lsModel} {
#puts "createing node for: $scobj_hpath $cmdGroup $varName $readable $writable $pollEnabled $drivable $idx $dataType $permission $rdCmd $rdFunc $wrCmd $wrFunc"
#puts "createNode, lsModel = $lsModel, ls340=$ls340, ls336=$ls336, varName=$varName "
#clientput "createing node for: $scobj_hpath $cmdGroup $varName $readable $writable $pollEnabled $drivable $idx $dataType $permission $rdCmd $rdFunc $wrCmd $wrFunc"
#clientput "createNode, lsModel = $lsModel, ls340=$ls340, ls336=$ls336, varName=$varName "
if {$lsModel == 340 && $ls340 == 0} {
# puts "Command node $cmdGroup/$varName not supported by Lakeshore $lsModel"
# clientput "Command node $cmdGroup/$varName not supported by Lakeshore $lsModel"
return OK
}
# Nothing to do
if {$lsModel == 336 && $ls336 == 0} {
# puts "Info: Command node $cmdGroup/$varName not supported by Lakeshore $lsModel"
# clientput "Info: Command node $cmdGroup/$varName not supported by Lakeshore $lsModel"
return OK
}
# It is a command that is supported by the device
@ -1711,7 +1711,7 @@ proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable p
hsetprop $nodeName read ${ns}::getValue $scobj_hpath $rdFunc $rdCmd $idx
}
if {$pollEnabled == 1} {
# puts "enabling polling for $nodeName"
# clientput "enabling polling for $nodeName"
$sct_controller poll $nodeName
}
hsetprop $nodeName $rdFunc ${ns}::$rdFunc $idx
@ -2071,7 +2071,7 @@ proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable p
# initialise the device
ls340_init $sct_controller $scobj_hpath
puts "Lakeshore $::scobj::ls340::ls340_LSmodel temperature controller ready at /sample/$tempobj (Driver 2010-06-25)"
clientput "Lakeshore $::scobj::ls340::ls340_LSmodel temperature controller ready at /sample/$tempobj (Driver 2010-06-25)"
} message ]} {
return -code error "in mk_sct_lakeshore_340 $message"
}
@ -2100,10 +2100,10 @@ proc add_lakeshore_340 {name IP port {terminator \r\n} {_tol1 1.0} {_tol2 1.0} {
if {[ catch {
set _ls340_LSmodel 340
if {[string equal -nocase "aqadapter" "${IP}"]} {
puts "\add_lakeshore_340: makesctcontroller sct_ls340_$name aqadapter ${port} for Lakeshore model 340"
clientput "\add_lakeshore_340: makesctcontroller sct_ls340_$name aqadapter ${port} for Lakeshore model 340"
makesctcontroller sct_ls340_$name aqadapter ${port}
} else {
puts "\add_lakeshore_340: makesctcontroller sct_ls340_$name std ${IP}:$port $terminator for Lakeshore model 340"
clientput "\add_lakeshore_340: makesctcontroller sct_ls340_$name std ${IP}:$port $terminator for Lakeshore model 340"
makesctcontroller sct_ls340_$name std ${IP}:$port $terminator
}
::scobj::ls340::mk_sct_lakeshore_340 sct_ls340_$name environment $name $CID $CTYPE $_ls340_LSmodel $_tol1 $_tol2 $_verbose

View File

@ -38,15 +38,15 @@ set device "370"
namespace eval ::scobj::[set vendor]_[set device] {
# All of this takes place in a namespace based on the vendor and device
# Debug prints and vendor/device save
puts "Namespace: [namespace current]"
puts "Vendor:[set vendor]"
puts "Device:[set device]"
clientput "Namespace: [namespace current]"
clientput "Vendor:[set vendor]"
clientput "Device:[set device]"
set [namespace current]::vendor [set ::vendor]
set [namespace current]::device [set ::device]
set [namespace current]::ven_dev "[set ::vendor]_[set ::device]"
puts "[namespace current]::vendor [set [namespace current]::vendor]"
puts "[namespace current]::device [set [namespace current]::device]"
puts "[namespace current]::ven_dev [set [namespace current]::ven_dev]"
clientput "[namespace current]::vendor [set [namespace current]::vendor]"
clientput "[namespace current]::device [set [namespace current]::device]"
clientput "[namespace current]::ven_dev [set [namespace current]::ven_dev]"
proc debug_log {debug_level arg_string} {
# write a timestamped string message to a log file for debugging
@ -897,22 +897,22 @@ namespace eval ::scobj::[set vendor]_[set device] {
}
proc add_[set vendor]_[set device] {name IP port {_tol 5.0} {terminator "\r\n"} } {
###puts "Namespace: [ns]"
###puts "::vendor $::vendor"
###puts "::device $::device"
###puts "[ns]::vendor [set [ns]::vendor]"
###puts "[ns]::device [set [ns]::device]"
###puts "[ns]::ven_dev [set [ns]::ven_dev]"
###clientput "Namespace: [ns]"
###clientput "::vendor $::vendor"
###clientput "::device $::device"
###clientput "[ns]::vendor [set [ns]::vendor]"
###clientput "[ns]::device [set [ns]::device]"
###clientput "[ns]::ven_dev [set [ns]::ven_dev]"
set [ns]::log_file "../log/[set [ns]::ven_dev]_[set name].log"
debug_log 1 "add_[set [ns]::vendor]_[set [ns]::device] ${name} ${IP} ${port} ${_tol}"
if {[SplitReply [environment_simulation]]=="false"} {
debug_log 1 "makesctcontroller sct_ls370_${name} std ${IP}:${port}"
if {[string equal -nocase "aqadapter" "${IP}"]} {
# dcl 2013-05-27: in this case the port is the name of the AsyncQueue
puts "\nadd_ls370: makesctcontroller sct_ls370_$name aqadapter ${port} for Lakeshore model 370"
clientput "\nadd_ls370: makesctcontroller sct_ls370_$name aqadapter ${port} for Lakeshore model 370"
makesctcontroller sct_ls370_$name aqadapter ${port}
} else {
puts "\nadd_ls370: makesctcontroller sct_ls370_$name std ${IP}:$port $terminator for Lakeshore model 370"
clientput "\nadd_ls370: makesctcontroller sct_ls370_$name std ${IP}:$port $terminator for Lakeshore model 370"
makesctcontroller sct_ls370_$name std ${IP}:$port $terminator
}
}
@ -928,14 +928,71 @@ namespace import ::scobj::[set vendor]_[set device]::*
# add_lakeshore_370 "tc371" 127.0.0.1 7371 2.0
if { [ info exists ::config_dict ] && [ dict get $::config_dict ls370_2 enabled ] } {
puts "ADD LAKESHORE 370"
set IP [dict get $::config_dict ls370_2 ip]
set PORT [dict get $::config_dict ls370_2 port]
set NAME [dict get $::config_dict ls370_2 name]
set TOL [dict get $::config_dict ls370_2 tol]
set TERM [dict get $::config_dict ls370_2 terminator]
add_lakeshore_370 $NAME $IP $PORT $TOL
proc ::scobj::lakeshore_370::sics_log {debug_level debug_string} {
set catch_status [ catch {
set debug_threshold ${::scobj::lakeshore_370::debug_threshold}
if {${debug_level} >= ${debug_threshold}} {
sicslog "::scobj::lakeshore_370::${debug_string}"
}
} catch_message ]
}
proc ::scobj::lakeshore_370::read_config {} {
set catch_status [ catch {
set ns "::scobj::lakeshore_370"
dict for {k v} $::config_dict {
if { [dict exists $v "implementation"] } {
if { !([dict exists $v "name"] && [dict exists $v "enabled"]) } {
continue
}
set name [dict get $v name]
set enabled [string tolower [dict get $v "enabled"]]
set implementation [dict get $v "implementation"]
if { !([dict exists $::config_dict $implementation]) } {
continue
}
set v [dict get $::config_dict $implementation]
if { !([dict exists $v "driver"]) } {
continue
}
if { [string equal -nocase [dict get $v "driver"] "lakeshore_370"] } {
if { [string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
} else {
if { [dict exists $v "asyncprotocol"] } {
set asyncprotocol [dict get $v "asyncprotocol"]
} else {
set asyncprotocol ${name}_protocol
MakeAsyncProtocol ${asyncprotocol}
if { [dict exists $v "terminator"] } {
${asyncprotocol} sendterminator "[dict get $v "terminator"]"
${asyncprotocol} replyterminator "[dict get $v "terminator"]"
}
}
set asyncqueue ${name}_queue
set IP [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
add_lakeshore_370 ${name} "aqadapter" ${asyncqueue}
}
}
}
}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
if { [info exists ::config_dict] } {
::scobj::lakeshore_370::read_config
} else {
::scobj::lakeshore_370::sics_log 5 "No config dict"
}

View File

@ -46,15 +46,15 @@ namespace eval ::scobj::[set vendor]_[set device] {
}
# All of this takes place in a namespace based on the vendor and device
# Debug prints and vendor/device save
puts "Namespace: [namespace current]"
puts "Vendor:[set vendor]"
puts "Device:[set device]"
clientput "Namespace: [namespace current]"
clientput "Vendor:[set vendor]"
clientput "Device:[set device]"
set [namespace current]::vendor [set ::vendor]
set [namespace current]::device [set ::device]
set [namespace current]::ven_dev "[set ::vendor]_[set ::device]"
puts "[namespace current]::vendor [set [namespace current]::vendor]"
puts "[namespace current]::device [set [namespace current]::device]"
puts "[namespace current]::ven_dev [set [namespace current]::ven_dev]"
clientput "[namespace current]::vendor [set [namespace current]::vendor]"
clientput "[namespace current]::device [set [namespace current]::device]"
clientput "[namespace current]::ven_dev [set [namespace current]::ven_dev]"
proc debug_log {debug_level arg_string} {
# write a timestamped string message to a log file for debugging
@ -867,13 +867,13 @@ if {0} {
set fd [open [set [ns]::log_file] "w"]
close $fd
debug_log 1 "add_[set [ns]::vendor]_[set [ns]::device] ${the_name} ${IP} ${port} ${_tol}"
puts "Namespace: [namespace current]"
puts "::vendor $::vendor"
puts "::device $::device"
puts "[namespace current]::vendor [set [namespace current]::vendor]"
puts "[namespace current]::device [set [namespace current]::device]"
puts "[namespace current]::ven_dev [set [namespace current]::ven_dev]"
puts "[namespace current]::log_file [set [namespace current]::log_file]"
clientput "Namespace: [namespace current]"
clientput "::vendor $::vendor"
clientput "::device $::device"
clientput "[namespace current]::vendor [set [namespace current]::vendor]"
clientput "[namespace current]::device [set [namespace current]::device]"
clientput "[namespace current]::ven_dev [set [namespace current]::ven_dev]"
clientput "[namespace current]::log_file [set [namespace current]::log_file]"
if {[SplitReply [environment_simulation]]=="false"} {
debug_log 1 "makesctcontroller sct_${the_name} std ${IP}:${port} $terminator"
makesctcontroller sct_${the_name} std ${IP}:${port} $terminator
@ -888,17 +888,4 @@ if {0} {
namespace import ::scobj::[set vendor]_[set device]::*
# add_[set vendor]_[set device] "tc4" 127.0.0.1 7371 2.0
if { [ info exists ::config_dict ] && [ dict get $::config_dict mercury_scipi enabled ] } {
puts "ADD MERCURY SCIPI MODE"
set IP [dict get $::config_dict mercury_scipi ip]
set PORT [dict get $::config_dict mercury_scipi port]
set name [dict get $::config_dict mercury_scipi name]
set ctype [dict get $::config_dict mercury_scipi type]
set cid [dict get $::config_dict mercury_scipi id]
set tol [dict get $::config_dict mercury_scipi tol]
set term [dict get $::config_dict mercury_scipi terminator]
add_oxford_mercury $name $IP $PORT $cid $ctype $term $tol
}

View File

@ -10,15 +10,15 @@ set device "soloist"
namespace eval ::scobj::[set vendor]_[set device] {
# All of this takes place in a namespace based on the vendor and device
# Debug prints and vendor/device save
puts "Namespace: [namespace current]"
puts "Vendor:[set vendor]"
puts "Device:[set device]"
clientput "Namespace: [namespace current]"
clientput "Vendor:[set vendor]"
clientput "Device:[set device]"
set [namespace current]::vendor [set ::vendor]
set [namespace current]::device [set ::device]
set [namespace current]::ven_dev "[set ::vendor]_[set ::device]"
puts "[namespace current]::vendor [set [namespace current]::vendor]"
puts "[namespace current]::device [set [namespace current]::device]"
puts "[namespace current]::ven_dev [set [namespace current]::ven_dev]"
clientput "[namespace current]::vendor [set [namespace current]::vendor]"
clientput "[namespace current]::device [set [namespace current]::device]"
clientput "[namespace current]::ven_dev [set [namespace current]::ven_dev]"
proc debug_log {debug_level arg_string} {
# write a timestamped string message to a log file for debugging
@ -284,12 +284,12 @@ namespace eval ::scobj::[set vendor]_[set device] {
}
proc add_[set vendor]_[set device] {name IP port {_tol 5.0}} {
###puts "Namespace: [ns]"
###puts "::vendor $::vendor"
###puts "::device $::device"
###puts "[ns]::vendor [set [ns]::vendor]"
###puts "[ns]::device [set [ns]::device]"
###puts "[ns]::ven_dev [set [ns]::ven_dev]"
###clientput "Namespace: [ns]"
###clientput "::vendor $::vendor"
###clientput "::device $::device"
###clientput "[ns]::vendor [set [ns]::vendor]"
###clientput "[ns]::device [set [ns]::device]"
###clientput "[ns]::ven_dev [set [ns]::ven_dev]"
set [ns]::log_file "../log/[set [ns]::ven_dev]_[set name].log"
set fd [open "[set [namespace current]::log_file]" "w" 0777]
close $fd