add HDB nodes
r3770 | jgn | 2012-10-18 14:54:11 +1100 (Thu, 18 Oct 2012) | 1 line
This commit is contained in:
committed by
Douglas Clowes
parent
12c6a9c0a8
commit
39a3e0ab19
@@ -11,13 +11,14 @@
|
||||
# object in TCL.
|
||||
#
|
||||
# @author: Jing Chen, ANSTO, 2012-08-22
|
||||
# @brief: driver for Lakeshore 218 Temperature Controller (in TCL)
|
||||
# @brief: SICS driver for Lakeshore 218 Temperature Controller (in TCL)
|
||||
#
|
||||
# ----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
# Default temperature controller parameters
|
||||
namespace eval ::scobj::ls218 {
|
||||
}
|
||||
|
||||
############# Reading polled nodes ###################################
|
||||
|
||||
@@ -31,13 +32,13 @@ namespace eval ::scobj::ls218 {
|
||||
# @param idx indicates which control loop or which input channel
|
||||
# the command belongs to
|
||||
# @return nextState The next function to call after this one (typically 'rdValue')
|
||||
proc getValue {idx nextState cmd chID} {
|
||||
proc ::scobj::ls218::getValue {idx cmd chID nextState} {
|
||||
if {[ catch {
|
||||
if {$chID == 1} {
|
||||
set comm "$cmd $idx"
|
||||
} else if {$chID == 0} {
|
||||
} elseif {$chID == 0} {
|
||||
set comm $cmd
|
||||
} else if {$chID == "G"} {
|
||||
} elseif {$chID == "G"} {
|
||||
if {1 <= $idx <= 4} {
|
||||
set comm "$cmd A"
|
||||
} else {
|
||||
@@ -46,10 +47,11 @@ proc getValue {idx nextState cmd chID} {
|
||||
} else {
|
||||
return -code error "in getValue: error input Ch ID"
|
||||
}
|
||||
sct send "$cmd\r\n"
|
||||
sct send "$comm\r\n"
|
||||
} message ]} {
|
||||
return -code error "in getValue: $message"
|
||||
}
|
||||
after 1000
|
||||
return $nextState
|
||||
}
|
||||
|
||||
@@ -58,15 +60,11 @@ proc getValue {idx nextState cmd chID} {
|
||||
# rdValue is the default nextState for getValue() and setValue()
|
||||
# @param idx indicates which control loop or which input channel the command belongs to
|
||||
# @return idle Always returns system state idle - command sequence completed.
|
||||
proc rdValue {nodeName varName idx} {
|
||||
proc ::scobj::ls218::rdValue {nodeName varName idx} {
|
||||
if {[ catch {
|
||||
set replyData [string trimright [sct result] " \r\n"]
|
||||
set fields [split $replyData ,]
|
||||
if {$replyData != [sct oldval]} {
|
||||
sct oldval $replyData
|
||||
sct update $replyData
|
||||
sct utime readtime
|
||||
}
|
||||
set curValue $replyData
|
||||
|
||||
switch -exact $varName {
|
||||
"alarm" { if {[lindex $fields 0] == 0} {
|
||||
@@ -84,7 +82,7 @@ proc rdValue {nodeName varName idx} {
|
||||
hset $nodeName/highValue [lindex $fields 2]
|
||||
hset $nodeName/lowValue [lindex $fields 3]
|
||||
hset $nodeName/deadband [lindex $fields 4]
|
||||
hset $nodeName/latchEnbale [lindex $fields 5]
|
||||
hset $nodeName/latchEnable [lindex $fields 5]
|
||||
}
|
||||
"aStatus" { if {[lindex $fields 0] == 0} {
|
||||
hset $nodeName/highStatus Unactivated
|
||||
@@ -97,7 +95,9 @@ proc rdValue {nodeName varName idx} {
|
||||
hset $nodeName/lowStatus Activated
|
||||
}
|
||||
}
|
||||
"Celsius" { hset $nodeName [lindex $fields 0] }
|
||||
"Celsius" { hset $nodeName [lindex $fields 0]
|
||||
set curValue [lindex $fields 0]
|
||||
}
|
||||
"CurveHd" { hset $nodeName/curve [lindex $fields 0]
|
||||
hset $nodeName/name [lindex $fields 1]
|
||||
hset $nodeName/SN [lindex $fields 2]
|
||||
@@ -114,22 +114,22 @@ proc rdValue {nodeName varName idx} {
|
||||
default {hset $nodeName/coefficient UNKNOW}
|
||||
}
|
||||
}
|
||||
"CurveID" { hset ind [lindex $fields 0]
|
||||
"CurveID" { set ind [lindex $fields 0]
|
||||
if {$ind == 0} {
|
||||
hset $nodeName none
|
||||
} else if { 1 <= $ind <= 5} {
|
||||
} elseif { 1 <= $ind <= 5} {
|
||||
hset $nodeName "Standard Diode Curves"
|
||||
} else if { 6 <= $ind <= 9} {
|
||||
} elseif { 6 <= $ind <= 9} {
|
||||
hset $nodeName "Standard Platium Curves"
|
||||
} else if { 21 <= $ind <= 28 } {
|
||||
} elseif { 21 <= $ind <= 28 } {
|
||||
hset $nodeName "User Curves"
|
||||
} else {
|
||||
}
|
||||
}
|
||||
"control" { hset ind [lindex $fields 0]
|
||||
"control" { set ind [lindex $fields 0]
|
||||
if {$ind == 0} {
|
||||
hset $nodeName off
|
||||
} else if {$ind == 1} {
|
||||
} elseif {$ind == 1} {
|
||||
hset $nodeName on
|
||||
} else {
|
||||
}
|
||||
@@ -144,7 +144,9 @@ proc rdValue {nodeName varName idx} {
|
||||
default { hset $nodeName UNKNOW}
|
||||
}
|
||||
}
|
||||
"Kelvin" { hset $nodeName $fields }
|
||||
"Kelvin" { hset $nodeName $fields
|
||||
set curValue $fields
|
||||
}
|
||||
"Linear" { hset $nodeName/varM [lindex $fields 0]
|
||||
hset $nodeName/varB [lindex $fields 2]
|
||||
switch -exact [lindex $fields 1] {
|
||||
@@ -154,7 +156,9 @@ proc rdValue {nodeName varName idx} {
|
||||
default { hset $nodeName/xSource UNKNOW}
|
||||
}
|
||||
}
|
||||
"LinearEquData" { hset $nodeName $fields }
|
||||
"LinearEquData" { hset $nodeName $fields
|
||||
set curValue $fields
|
||||
}
|
||||
"mnmxSource" { switch -exact [lindex $fields 0] {
|
||||
1 { hset $nodeName Kelvin}
|
||||
2 { hset $nodeName Celsius}
|
||||
@@ -171,21 +175,27 @@ proc rdValue {nodeName varName idx} {
|
||||
# 5 32 temp overrange
|
||||
# 6 64 units under range
|
||||
# 7 128 untis over range
|
||||
set i [expr {$fields >> 4}]
|
||||
set bitValue [expr {$i & 0x01}]
|
||||
set field [string trimleft $fields 0]
|
||||
set i [format %x $field]
|
||||
set i [expr 0x$i >> 4]
|
||||
set bitValue [expr 0x$i & 0x01]
|
||||
if {$bitValue == 1} { append $nodeName "temp underrange, " }
|
||||
set i [expr {$i >> 1}]
|
||||
set bitValue [expr {$i & 0x01}]
|
||||
set i [expr 0x$i >> 1]
|
||||
set bitValue [expr 0x$i & 0x01]
|
||||
if {$bitValue == 1} { append $nodeName "temp overrange, " }
|
||||
set i [expr {$i >> 1}]
|
||||
set bitValue [expr {$i & 0x01}]
|
||||
set i [expr 0x$i >> 1]
|
||||
set bitValue [expr 0x$i & 0x01]
|
||||
if {$bitValue == 1} { append $nodeName "units under range, " }
|
||||
set i [expr {$i >> 1}]
|
||||
set bitValue [expr {$i & 0x01}]
|
||||
set i [expr 0x$i >> 1]
|
||||
set bitValue [expr 0x$i & 0x01]
|
||||
if {$bitValue == 1} { append $nodeName "untis over range" }
|
||||
}
|
||||
"SensorUnitValue" { hset $nodeName $fields }
|
||||
"data" { hset $nodeName $fields }
|
||||
"SensorUnitValue" { hset $nodeName $fields
|
||||
set curValue $fields
|
||||
}
|
||||
"data" { hset $nodeName $fields
|
||||
set curValue $fields
|
||||
}
|
||||
"aOutput" { switch -exact [lindex $fields 0] {
|
||||
0 { hset $nodeName/bipolarEnable "positive only" }
|
||||
1 { hset $nodeName/bipolarEnable "bipolar" }
|
||||
@@ -235,6 +245,11 @@ proc rdValue {nodeName varName idx} {
|
||||
}
|
||||
default { return -code error "in rdValue: wrong input parameter"}
|
||||
}
|
||||
if {$curValue != [sct oldval]} {
|
||||
sct oldval $curValue
|
||||
sct update $curValue
|
||||
sct utime readtime
|
||||
}
|
||||
} message ]} {
|
||||
return -code error "in rdValue: $message "
|
||||
}
|
||||
@@ -268,14 +283,14 @@ proc rdValue {nodeName varName idx} {
|
||||
# @param nxalias attribute for HDB tree
|
||||
# @return OK
|
||||
|
||||
proc createNode {scobj_hpath idx sct_controller cmdGroup varName readable pollEnabled dataType permission rdCmd chID rdFunc \
|
||||
hdbEnable klass control data priv type nxsave mutable nxalias} {
|
||||
proc createNode {scobj_hpath idx sct_controller cmdGroup varName readable pollEnabled dataType permission rdCmd chID rdFunc} {
|
||||
# It is a command that is supported by the device
|
||||
if {[ catch {
|
||||
set ns ::scobj::ls218
|
||||
|
||||
if {$idx > 0 } {
|
||||
set basePath $scobj_hpath/ch$idx
|
||||
if {$idx > 0} {
|
||||
set channel ch$idx
|
||||
set basePath $scobj_hpath/$channel
|
||||
} else {
|
||||
set basePath $scobj_hpath
|
||||
}
|
||||
@@ -295,42 +310,39 @@ proc createNode {scobj_hpath idx sct_controller cmdGroup varName readable pollEn
|
||||
default {hset $nodeName UNKNOWN}
|
||||
}
|
||||
|
||||
switch -exact $dataType {
|
||||
"none" { hset $nodeName UNKNOW }
|
||||
"int" { hset $nodeName 0 }
|
||||
"float" { hset $nodeName 0 }
|
||||
"text" { hset $nodeName UNKNOW}
|
||||
default { hset $nodeName UNKNOWN }
|
||||
}
|
||||
|
||||
if {$readable == 1} {
|
||||
hsetprop $nodeName read ${ns}::getValue $idx $rdFunc $rdCmd $chID
|
||||
hsetprop $nodeName $rdFunc ${ns}::$rdFunc $nodeName $varName $idx
|
||||
hsetprop $nodeName oldval UNKNOW
|
||||
hsetprop $nodeName read ${ns}::getValue $idx $rdCmd $chID rdFuncState
|
||||
hsetprop $nodeName rdFuncState ${ns}::rdValue $nodeName $varName $idx
|
||||
hsetprop $nodeName oldval UNKNOW
|
||||
}
|
||||
if {$pollEnabled == 1} {
|
||||
# puts "enabling polling for $nodeName"
|
||||
$sct_controller poll $nodeName
|
||||
if {[SplitReply [environment_simulation]]=="false"} {
|
||||
# puts "enabling polling for $nodeName"
|
||||
$sct_controller poll $nodeName
|
||||
}
|
||||
}
|
||||
|
||||
# add hdb nodes
|
||||
if {$hdbEnable == 1} {
|
||||
hsetprop $nodeName nxalias $nxalias
|
||||
hsetprop $nodeName klass $klass
|
||||
hsetprop $nodeName privilege $priv
|
||||
hsetprop $nodeName control $control
|
||||
hsetprop $nodeName data $data
|
||||
hsetprop $nodeName nxsave $nxsave
|
||||
hsetprop $nodeName mutable $mutable
|
||||
hsetprop $nodeName sdsinfo ::nexus::scobj::sdsinfo
|
||||
}
|
||||
|
||||
} message ]} {
|
||||
return -code error "in createNode $message"
|
||||
}
|
||||
return OK
|
||||
}
|
||||
|
||||
# create parent HDB nods
|
||||
proc createParentHDBNode {hPath klass priv type control data} {
|
||||
|
||||
if {[ catch {
|
||||
hsetprop $hPath klass $klass
|
||||
hsetprop $hPath privilege $priv
|
||||
hsetprop $hPath type $type
|
||||
hsetprop $hPath control $control
|
||||
hsetprop $hPath data $data
|
||||
} message ]} {
|
||||
return -code error "in createParentHDBNode $message"
|
||||
}
|
||||
|
||||
return OK
|
||||
}
|
||||
|
||||
##
|
||||
# @brief mkLS218() creates a scriptcontext object for a Lakeshore 218 temperature controller
|
||||
# @param sct_controller name of the ls218 scriptcontext object (typically sct_ls218_tc1 or tc2)
|
||||
@@ -338,7 +350,7 @@ proc createNode {scobj_hpath idx sct_controller cmdGroup varName readable pollEn
|
||||
# @param tempobj short name for the temperature controller scriptcontext object (typ. tc1 or tc2)
|
||||
# @param tol temperature tolerance in Kelvin (typ. 1)
|
||||
# @return nothing (well, the sct object)
|
||||
proc mkLS218 {argList} {
|
||||
proc ::scobj::ls218::mkLS218 {argList} {
|
||||
if {[ catch {
|
||||
foreach {k v} $argList {
|
||||
set KEY [string toupper $k]
|
||||
@@ -346,61 +358,37 @@ proc mkLS218 {argList} {
|
||||
}
|
||||
|
||||
MakeSICSObj $pa(NAME) SCT_OBJECT
|
||||
sicslist setatt $pa(NAME) klass $pa(KLASS)
|
||||
sicslist setatt $pa(NAME) klass environment
|
||||
sicslist setatt $pa(NAME) long_name $pa(NAME)
|
||||
|
||||
set scobj_hpath /sics/$pa(NAME)
|
||||
|
||||
makesctcontroller sct_$pa(NAME) std $pa(IP):$pa(PORT)
|
||||
|
||||
::scobj::set_required_props $scobj_hpath
|
||||
|
||||
foreach {nodesToplevel permission dataType init klass control data priv type} {
|
||||
{} spy none none environment true true spy part
|
||||
|
||||
input spy none none environment true true spy NXsensor
|
||||
input/ch1 spy none none environment true true spy NXsensor
|
||||
input/ch2 spy none none environment true true spy NXsensor
|
||||
input/ch3 spy none none environment true true spy NXsensor
|
||||
input/ch4 spy none none environment true true spy NXsensor
|
||||
input/ch5 spy none none environment true true spy NXsensor
|
||||
input/ch6 spy none none environment true true spy NXsensor
|
||||
input/ch7 spy none none environment true true spy NXsensor
|
||||
input/ch8 spy none none environment true true spy NXsensor
|
||||
|
||||
output spy none UNKNOW environment true true spy NXsensor
|
||||
output/ch1 spy none UNKNOW environment true true spy NXsensor
|
||||
output/ch2 spy none UNKNOW environment true true spy NXsensor
|
||||
|
||||
relay spy none UNKNOW environment false true spy NXsensor
|
||||
relay/ch1 spy none UNKNOW environment false true spy NXsensor
|
||||
relay/ch2 spy none UNKNOW environment false true spy NXsensor
|
||||
relay/ch3 spy none UNKNOW environment false true spy NXsensor
|
||||
relay/ch4 spy none UNKNOW environment false true spy NXsensor
|
||||
relay/ch5 spy none UNKNOW environment false true spy NXsensor
|
||||
relay/ch6 spy none UNKNOW environment false true spy NXsensor
|
||||
relay/ch7 spy none UNKNOW environment false true spy NXsensor
|
||||
relay/ch8 spy none UNKNOW environment false true spy NXsensor
|
||||
|
||||
other spy none UNKNOW environment false true spy NXsensor
|
||||
} {
|
||||
if {$nodesToplevel != ""} {
|
||||
set hPath $scobj_hpath/$nodesToplevel
|
||||
hfactory $hPath plain $permission $dataType
|
||||
hset $hPath $init
|
||||
} else {
|
||||
set hPath $scobj_hpath
|
||||
}
|
||||
|
||||
if {$control == "true"} {
|
||||
hsetprop $hPath klass $klass
|
||||
hsetprop $hPath privilege $priv
|
||||
hsetprop $hPath type $type
|
||||
hsetprop $hPath control $control
|
||||
hsetprop $hPath data $data
|
||||
# create parent nodes for input, output, and relay
|
||||
foreach chanType {input output relay} {
|
||||
switch -exact $chanType {
|
||||
"input" {set chanList $pa(INPUTCHAN)}
|
||||
"output" {set chanList $pa(OUTPUTCHAN)}
|
||||
"relay" {set chanList $pa(RELAYCHAN)}
|
||||
}
|
||||
if {[string length $chanList] > 0} {
|
||||
set hPath $scobj_hpath/$chanType
|
||||
hfactory $hPath plain user none
|
||||
hset $hPath UNKNOWN
|
||||
foreach idx $chanList {
|
||||
set hPath $scobj_hpath/$chanType/ch$idx
|
||||
hfactory $hPath plain user none
|
||||
hset $hPath UNKNOWN
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# create parent node for other
|
||||
set hPath $scobj_hpath/other
|
||||
hfactory $hPath plain user none
|
||||
hset $hPath UNKNOWN
|
||||
|
||||
# Create state machines for the following device commands (non-polled entries are place-holders
|
||||
# for manually maintained nodes, like the selector for the input that provides the sample temperature
|
||||
# 'sampleSensor', the sample tempreature reading 'Tsample', the input that provides for the controlLoop
|
||||
@@ -433,110 +421,163 @@ proc mkLS218 {argList} {
|
||||
###########################################################################################################
|
||||
|
||||
set inputNodes {
|
||||
{} alarm 1 1 none user {ALARM?} 1 {rdValue} 0 {} {} {} {} {} {} {} {}
|
||||
alarm offOn 0 0 text user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
alarm source 0 0 text user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
alarm highValue 0 0 float user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
alarm lowValue 0 0 float user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
alarm deadband 0 0 float user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
alarm latchEnable 0 0 int user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
{} aStatus 1 1 none user {ALARMST?} 1 {rdValue} 0 {} {} {} {} {} {} {} {}
|
||||
aStatus highStatus 1 1 text user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
aStatus lowStatus 0 0 text user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
{} Celsius 1 1 float user {CRDG?} 1 {rdValue} 1 NXsensor true true true true {} {} reading-Celsius
|
||||
{} CurveHd 1 1 none user {CRVHDR?} 0 {rdValue} 0 {} {} {} {} {} {} {} {}
|
||||
CurveHd curve 0 0 int user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
CurveHd name 0 0 text user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
CurveHd SN 0 0 text user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
CurveHd format 0 0 text user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
CurveHd limitValue 0 0 float user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
CurveHd coefficient 0 0 text user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
{} CurveID 1 1 text user {INCRV?} 1 {rdValue} 0 {} {} {} {} {} {} {} {}
|
||||
{} control 1 1 text user {INPUT?} 1 {rdValue} 0 {} {} {} {} {} {} {} {}
|
||||
{} inputType 1 1 text user {INTYPE?} G {rdValue} 0 {} {} {} {} {} {} {} {}
|
||||
{} Kelvin 1 1 float user {KRDG?} 1 {rdValue} 1 NXsensor true true true true true true reading-Kelvin
|
||||
{} Linear 1 1 none user {LINEAR?} 1 {rdValue} 0 {} {} {} {} {} {} {} {}
|
||||
Linear varM 0 0 float user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
Linear xSource 0 0 text user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
Linear varB 0 0 float user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
{} LinearEquData 1 1 float user {LRDG?} 1 {rdValue} 0 {} {} {} {} {} {} {} {}
|
||||
{} mnmxSource 1 1 text user {MNMX?} 1 {rdValue} 0 {} {} {} {} {} {} {} {}
|
||||
{} mnmxValue 1 1 text user {MNMXRDG?} 1 {rdValue} 0 {} {} {} {} {} {} {} {}
|
||||
{} status 1 1 text user {RDGST?} 1 {rdValue} 0 {} {} {} {} {} {} {} {}
|
||||
{} SensorUnitValue 1 1 float user {SRDG?} 1 {rdValue} 1 NXsensor true true true true true true reading-SensorUnitValue
|
||||
{} alarm 1 1 none user {ALARM?} 1 {rdValue}
|
||||
alarm offOn 0 0 text user {} 0 {}
|
||||
alarm source 0 0 text user {} 0 {}
|
||||
alarm highValue 0 0 float user {} 0 {}
|
||||
alarm lowValue 0 0 float user {} 0 {}
|
||||
alarm deadband 0 0 float user {} 0 {}
|
||||
alarm latchEnable 0 0 int user {} 0 {}
|
||||
{} aStatus 1 1 none user {ALARMST?} 1 {rdValue}
|
||||
aStatus highStatus 0 0 text user {} 0 {}
|
||||
aStatus lowStatus 0 0 text user {} 0 {}
|
||||
{} Celsius 1 1 float user {CRDG?} 1 {rdValue}
|
||||
{} CurveHd 1 1 none user {CRVHDR?} 0 {rdValue}
|
||||
CurveHd curve 0 0 text user {} 0 {}
|
||||
CurveHd name 0 0 text user {} 0 {}
|
||||
CurveHd SN 0 0 text user {} 0 {}
|
||||
CurveHd format 0 0 text user {} 0 {}
|
||||
CurveHd limitValue 0 0 float user {} 0 {}
|
||||
CurveHd coefficient 0 0 text user {} 0 {}
|
||||
{} CurveID 1 1 text user {INCRV?} 1 {rdValue}
|
||||
{} control 1 1 text user {INPUT?} 1 {rdValue}
|
||||
{} inputType 1 1 text user {INTYPE?} G {rdValue}
|
||||
{} Kelvin 1 1 float user {KRDG?} 1 {rdValue}
|
||||
{} Linear 1 1 none user {LINEAR?} 1 {rdValue}
|
||||
Linear varM 0 0 float user {} 0 {}
|
||||
Linear xSource 0 0 text user {} 0 {}
|
||||
Linear varB 0 0 float user {} 0 {}
|
||||
{} LinearEquData 1 1 float user {LRDG?} 1 {rdValue}
|
||||
{} mnmxSource 1 1 text user {MNMX?} 1 {rdValue}
|
||||
{} mnmxValue 1 1 text user {MNMXRDG?} 1 {rdValue}
|
||||
{} status 1 1 text user {RDGST?} 1 {rdValue}
|
||||
{} SensorUnitValue 1 1 float user {SRDG?} 1 {rdValue}
|
||||
}
|
||||
|
||||
set outputNodes {
|
||||
{} data 1 1 float user {AOUT?} 1 {rdValue} 1 NXsensor true true true true true true reading-output
|
||||
{} aOutput 1 1 none user {ANALOG?} 1 {rdValue} 0 {} {} {} {} {} {} {} {}
|
||||
aOutput bipolarEnable 0 0 text user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
aOutput monitorMode 0 0 text user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
aOutput inputChID 0 0 int user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
aOutput source 0 0 text user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
aOutput highValue 0 0 float user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
aOutput lowValue 0 0 float user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
aOutput manualValue 0 0 int user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
{} data 1 1 float user {AOUT?} 1 {rdValue}
|
||||
{} aOutput 1 1 none user {ANALOG?} 1 {rdValue}
|
||||
aOutput bipolarEnable 0 0 text user {} 0 {}
|
||||
aOutput monitorMode 0 0 text user {} 0 {}
|
||||
aOutput inputChID 0 0 int user {} 0 {}
|
||||
aOutput source 0 0 text user {} 0 {}
|
||||
aOutput highValue 0 0 float user {} 0 {}
|
||||
aOutput lowValue 0 0 float user {} 0 {}
|
||||
aOutput manualValue 0 0 int user {} 0 {}
|
||||
}
|
||||
|
||||
set relayNodes {
|
||||
{} relay 1 1 none user {RELAY?} 1 {rdValue} 0 {} {} {} {} {} {} {} {}
|
||||
relay mode 1 1 text user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
relay input 0 0 int user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
relay alarmType 0 0 text user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
{} relay 1 1 none user {RELAY?} 1 {rdValue}
|
||||
relay mode 0 0 text user {} 0 {}
|
||||
relay input 0 0 int user {} 0 {}
|
||||
relay alarmType 0 0 text user {} 0 {}
|
||||
}
|
||||
|
||||
set otherNodes {
|
||||
{} IDN 1 1 none user {*IDN?} 0 {rdValue} 0 {} {} {} {} {} {} {} {}
|
||||
IDN manufacturer 0 0 text user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
IDN model 0 0 text user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
IDN serialNumber 0 0 text user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
IDN firmwareDate 0 0 text user {} 0 {} 0 {} {} {} {} {} {} {} {}
|
||||
{} logStatus 1 1 text user {LOG?} 0 {rdValue} 0 {} {} {} {} {} {} {} {}
|
||||
{} IDN 1 1 none user {*IDN?} 0 {rdValue}
|
||||
IDN manufacturer 0 0 text user {} 0 {}
|
||||
IDN model 0 0 text user {} 0 {}
|
||||
IDN serialNumber 0 0 text user {} 0 {}
|
||||
IDN firmwareDate 0 0 text user {} 0 {}
|
||||
{} logStatus 1 1 text user {LOG?} 0 {rdValue}
|
||||
}
|
||||
|
||||
# create sub-tree for all 8 input channels
|
||||
for {set idx 1} {$idx<=8} {incr idx} {
|
||||
foreach {cmdGroup varName readable pollEnabled dataType permission rdCmd chID rdFunc hdbEnable klass control data priv type nxsave mutable nxalias}\
|
||||
$inputNodes {
|
||||
createNode $scobj_hpath/input $idx sct_$pa(NAME) $cmdGroup $varName $readable $pollEnabled $dataType $permission $rdCmd $chID \
|
||||
$rdFunc $hdbEnable $klass $control $data $priv $type $nxsave $mutable $nxalias
|
||||
}
|
||||
foreach idx $pa(INPUTCHAN) {
|
||||
foreach {cmdGroup varName readable pollEnabled dataType permission rdCmd chID rdFunc} $inputNodes {
|
||||
createNode $scobj_hpath/input $idx sct_$pa(NAME) $cmdGroup $varName $readable $pollEnabled $dataType $permission $rdCmd $chID $rdFunc
|
||||
}
|
||||
}
|
||||
|
||||
# create sub-tree for all 2 output channels
|
||||
for {set idx 1} {$idx<=2} {incr idx} {
|
||||
foreach {cmdGroup varName readable pollEnabled dataType permission rdCmd chID rdFunc hdbEnable klass control data priv type nxsave mutable nxalias}\
|
||||
$outputNodes {
|
||||
createNode $scobj_hpath/output $idx sct_$pa(NAME) $cmdGroup $varName $readable $pollEnabled $dataType $permission $rdCmd $chID \
|
||||
$rdFunc $hdbEnable $klass $control $data $priv $type $nxsave $mutable $nxalias
|
||||
foreach idx $pa(OUTPUTCHAN) {
|
||||
foreach {cmdGroup varName readable pollEnabled dataType permission rdCmd chID rdFunc} $outputNodes {
|
||||
createNode $scobj_hpath/output $idx sct_$pa(NAME) $cmdGroup $varName $readable $pollEnabled $dataType $permission $rdCmd $chID $rdFunc
|
||||
}
|
||||
}
|
||||
|
||||
# create sub-tree for all 8 relay channels
|
||||
for {set idx 1} {$idx<=8} {incr idx} {
|
||||
foreach {cmdGroup varName readable pollEnabled dataType permission rdCmd chID rdFunc hdbEnable klass control data priv type nxsave mutable nxalias}\
|
||||
$relayNodes {
|
||||
createNode $scobj_hpath/relay $idx sct_$pa(NAME) $cmdGroup $varName $readable $pollEnabled $dataType $permission $rdCmd $chID \
|
||||
$rdFunc $hdbEnable $klass $control $data $priv $type $nxsave $mutable $nxalias
|
||||
foreach idx $pa(RELAYCHAN) {
|
||||
foreach {cmdGroup varName readable pollEnabled dataType permission rdCmd chID rdFunc} $relayNodes {
|
||||
createNode $scobj_hpath/relay $idx sct_$pa(NAME) $cmdGroup $varName $readable $pollEnabled $dataType $permission $rdCmd $chID $rdFunc
|
||||
}
|
||||
}
|
||||
|
||||
# create "other" sub-tree
|
||||
foreach {cmdGroup varName readable pollEnabled dataType permission rdCmd chID rdFunc hdbEnable klass control data priv type nxsave mutable nxalias}\
|
||||
$otherNodes {
|
||||
createNode $scobj_hpath/other 0 sct_$pa(NAME) $cmdGroup $varName $readable $pollEnabled $dataType $permission $rdCmd $chID \
|
||||
$rdFunc $hdbEnable $klass $control $data $priv $type $nxsave $mutable $nxalias
|
||||
foreach {cmdGroup varName readable pollEnabled dataType permission rdCmd chID rdFunc} $otherNodes {
|
||||
createNode $scobj_hpath/other 0 sct_$pa(NAME) $cmdGroup $varName $readable $pollEnabled $dataType $permission $rdCmd $chID $rdFunc
|
||||
}
|
||||
|
||||
::scobj::hinitprops $pa(NAME)
|
||||
# create HDB tree
|
||||
|
||||
::scobj::set_required_props $scobj_hpath
|
||||
|
||||
foreach {hPath klass control data priv type} {
|
||||
ls218 environment true true spy part
|
||||
input NXsensor true true user NXsensor
|
||||
output NXsensor true true user NXsensor
|
||||
} {
|
||||
switch -exact $hPath {
|
||||
"ls218" { set curPath /sics/$hPath
|
||||
createParentHDBNode $curPath $klass $priv $type $control $data
|
||||
}
|
||||
default { switch -exact $hPath {
|
||||
"input" {set chanList $pa(INPUTCHAN)}
|
||||
"output" {set chanList $pa(OUTPUTCHAN)}
|
||||
}
|
||||
if {[string length $chanList] > 0} {
|
||||
set curPath /sics/ls218/$hPath
|
||||
createParentHDBNode $curPath $klass $priv $type $control $data
|
||||
foreach idx $chanList {
|
||||
set curPath /sics/ls218/$hPath/ch$idx
|
||||
createParentHDBNode $curPath $klass $priv $type $control $data
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if {[string length $pa(INPUTCHAN)] > 0} {
|
||||
foreach idx $pa(INPUTCHAN) {
|
||||
foreach {item klass control data nxsave mutable priv alias} {
|
||||
Celsius sensor true true true true user Celsius
|
||||
Kelvin sensor true true true true user Kelvin
|
||||
SensorUnitValue sensor true true true true user SensorUnitValue
|
||||
} {
|
||||
set hpath /sics/ls218/input/ch$idx/$item
|
||||
hsetprop $hpath nxalias ls218-input-ch$idx-$alias
|
||||
hsetprop $hpath klass $klass
|
||||
hsetprop $hpath privilege $priv
|
||||
hsetprop $hpath control $control
|
||||
hsetprop $hpath data $data
|
||||
hsetprop $hpath nxsave $nxsave
|
||||
hsetprop $hpath mutable $mutable
|
||||
hsetprop $hpath sdsinfo ::nexus::scobj::sdsinfo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if {[string length $pa(OUTPUTCHAN)] > 0} {
|
||||
foreach idx $pa(OUTPUTCHAN) {
|
||||
set hpath /sics/ls218/output/ch$idx/data
|
||||
hsetprop $hpath nxalias ls218-output-ch$idx-data
|
||||
hsetprop $hpath klass sensor
|
||||
hsetprop $hpath privilege user
|
||||
hsetprop $hpath control true
|
||||
hsetprop $hpath data true
|
||||
hsetprop $hpath nxsave true
|
||||
hsetprop $hpath mutable true
|
||||
hsetprop $hpath sdsinfo ::nexus::scobj::sdsinfo
|
||||
}
|
||||
}
|
||||
|
||||
::scobj::hinitprops $pa(NAME)
|
||||
|
||||
} message ]} {
|
||||
return -code error "in mkLS218 $message"
|
||||
}
|
||||
}
|
||||
|
||||
namespace export ls218
|
||||
}
|
||||
# end of namespace ::scobj::ls218
|
||||
|
||||
# Main process call
|
||||
@@ -548,12 +589,13 @@ proc mkLS218 {argList} {
|
||||
# @return nothing (well, the sct object)
|
||||
|
||||
#::scobj::ls218::mkLS218 {
|
||||
# name "ls218"
|
||||
# IP 137.157.202.219
|
||||
# PORT 4001
|
||||
# tuning 1
|
||||
# interval 5
|
||||
# klass environment
|
||||
# name ls218
|
||||
# IP 137.157.202.219
|
||||
# PORT 4002
|
||||
# tuning 1
|
||||
# interval 5
|
||||
# inputChan {1 2 3 4 5 6 7 8}
|
||||
# outputChan {1 2}
|
||||
# relayChan {1 2 3 4 5 6 7 8}
|
||||
#}
|
||||
|
||||
namespace import ::scobj::ls218::*
|
||||
|
||||
Reference in New Issue
Block a user