r3762 | jgn | 2012-10-09 13:42:17 +1100 (Tue, 09 Oct 2012) | 1 line
This commit is contained in:
committed by
Douglas Clowes
parent
a3214236a8
commit
18a3a0b028
@@ -0,0 +1,559 @@
|
|||||||
|
# Define procs in ::scobj::xxx namespace
|
||||||
|
# MakeSICSObj $obj SCT_<class>
|
||||||
|
# The MakeSICSObj cmd adds a /sics/$obj node. NOTE the /sics node is not browsable.
|
||||||
|
|
||||||
|
##
|
||||||
|
# /*--------------------------------------------------------------------------
|
||||||
|
# L A K E S H O R E 3 x x S E R I E S D R I V E R
|
||||||
|
#
|
||||||
|
# This file contains the implementation of a driver for the Lakeshore 218
|
||||||
|
# controller implemented as a scriptcontext object in TCL.
|
||||||
|
# object in TCL.
|
||||||
|
#
|
||||||
|
# @author: Jing Chen, ANSTO, 2012-08-22
|
||||||
|
# @brief: driver for Lakeshore 218 Temperature Controller (in TCL)
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
# Default temperature controller parameters
|
||||||
|
namespace eval ::scobj::ls218 {
|
||||||
|
|
||||||
|
############# Reading polled nodes ###################################
|
||||||
|
|
||||||
|
##
|
||||||
|
# @brief Sends a query command to the device via a read node formalism
|
||||||
|
# @param tc_root The path to the root of the node
|
||||||
|
# @param nextState The next function to call after this one (typically 'rdValue'
|
||||||
|
# to read the response from the device)
|
||||||
|
# @param cmd The query command to be send to the device (written to the
|
||||||
|
# node data value)
|
||||||
|
# @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} {
|
||||||
|
if {[ catch {
|
||||||
|
if {$chID == 1} {
|
||||||
|
set comm "$cmd $idx"
|
||||||
|
} else if {$chID == 0} {
|
||||||
|
set comm $cmd
|
||||||
|
} else if {$chID == "G"} {
|
||||||
|
if {1 <= $idx <= 4} {
|
||||||
|
set comm "$cmd A"
|
||||||
|
} else {
|
||||||
|
set comm "$cmd B"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return -code error "in getValue: error input Ch ID"
|
||||||
|
}
|
||||||
|
sct send "$cmd\r\n"
|
||||||
|
} message ]} {
|
||||||
|
return -code error "in getValue: $message"
|
||||||
|
}
|
||||||
|
return $nextState
|
||||||
|
}
|
||||||
|
|
||||||
|
##
|
||||||
|
# @brief Reads the value of a read-node typically following a query command sent to the device
|
||||||
|
# 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} {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
switch -exact $varName {
|
||||||
|
"alarm" { if {[lindex $fields 0] == 0} {
|
||||||
|
hset $nodeName/offOn off
|
||||||
|
} else {
|
||||||
|
hset $nodeName/offOn on
|
||||||
|
}
|
||||||
|
switch -exact [lindex $fields 1] {
|
||||||
|
1 {hset $nodeName/source Kelvin}
|
||||||
|
2 {hset $nodeName/source Celsius}
|
||||||
|
3 {hset $nodeName/source "Sensor Units"}
|
||||||
|
4 {hset $nodeName/source "Linear data"}
|
||||||
|
default {hset $nodeName/source UNKNOW}
|
||||||
|
}
|
||||||
|
hset $nodeName/highValue [lindex $fields 2]
|
||||||
|
hset $nodeName/lowValue [lindex $fields 3]
|
||||||
|
hset $nodeName/deadband [lindex $fields 4]
|
||||||
|
hset $nodeName/latchEnbale [lindex $fields 5]
|
||||||
|
}
|
||||||
|
"aStatus" { if {[lindex $fields 0] == 0} {
|
||||||
|
hset $nodeName/highStatus Unactivated
|
||||||
|
} else {
|
||||||
|
hset $nodeName/highStatus Activated
|
||||||
|
}
|
||||||
|
if {[lindex $fields 1] == 0} {
|
||||||
|
hset $nodeName/lowStatus Unactivated
|
||||||
|
} else {
|
||||||
|
hset $nodeName/lowStatus Activated
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"Celsius" { hset $nodeName [lindex $fields 0] }
|
||||||
|
"CurveHd" { hset $nodeName/curve [lindex $fields 0]
|
||||||
|
hset $nodeName/name [lindex $fields 1]
|
||||||
|
hset $nodeName/SN [lindex $fields 2]
|
||||||
|
switch -exact [lindex $fields 3] {
|
||||||
|
2 {hset $nodeName/format V/K}
|
||||||
|
3 {hset $nodeName/format Ohm/K}
|
||||||
|
4 {hset $nodeName/format "log Ohm/K"}
|
||||||
|
default {}
|
||||||
|
}
|
||||||
|
hset $nodeName/limitValue [lindex $fields 4]
|
||||||
|
switch -exact [lindex $fields 5] {
|
||||||
|
1 {hset $nodeName/coefficient negative}
|
||||||
|
2 {hset $nodeName/coefficient positive}
|
||||||
|
default {hset $nodeName/coefficient UNKNOW}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"CurveID" { hset ind [lindex $fields 0]
|
||||||
|
if {$ind == 0} {
|
||||||
|
hset $nodeName none
|
||||||
|
} else if { 1 <= $ind <= 5} {
|
||||||
|
hset $nodeName "Standard Diode Curves"
|
||||||
|
} else if { 6 <= $ind <= 9} {
|
||||||
|
hset $nodeName "Standard Platium Curves"
|
||||||
|
} else if { 21 <= $ind <= 28 } {
|
||||||
|
hset $nodeName "User Curves"
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"control" { hset ind [lindex $fields 0]
|
||||||
|
if {$ind == 0} {
|
||||||
|
hset $nodeName off
|
||||||
|
} else if {$ind == 1} {
|
||||||
|
hset $nodeName on
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"inputType" { switch -exact [lindex $fields 0] {
|
||||||
|
0 { hset $nodeName "2.5V Diode"}
|
||||||
|
1 { hset $nodeName "7.5V Diode"}
|
||||||
|
2 { hset $nodeName "250 Ohms Platinum"}
|
||||||
|
3 { hset $nodeName "500 Ohms Platinum"}
|
||||||
|
4 { hset $nodeName "5K Ohms Platinum"}
|
||||||
|
5 { hset $nodeName "Cernox"}
|
||||||
|
default { hset $nodeName UNKNOW}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"Kelvin" { hset $nodeName $fields }
|
||||||
|
"Linear" { hset $nodeName/varM [lindex $fields 0]
|
||||||
|
hset $nodeName/varB [lindex $fields 2]
|
||||||
|
switch -exact [lindex $fields 1] {
|
||||||
|
1 { hset $nodeName/xSource Kelvin}
|
||||||
|
2 { hset $nodeName/xSource Celsius}
|
||||||
|
3 { hset $nodeName/xSource "sensor units"}
|
||||||
|
default { hset $nodeName/xSource UNKNOW}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"LinearEquData" { hset $nodeName $fields }
|
||||||
|
"mnmxSource" { switch -exact [lindex $fields 0] {
|
||||||
|
1 { hset $nodeName Kelvin}
|
||||||
|
2 { hset $nodeName Celsius}
|
||||||
|
3 { hset $nodeName "sensor units"}
|
||||||
|
4 { hset $nodeName "linear data"}
|
||||||
|
default { hset $nodeName UNKNOW}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"mnmxValue" { hset $nodeName "[lindex $fields 0] , [lindex $fields 1]"}
|
||||||
|
"status" { hset $nodeName ""
|
||||||
|
# RDGST? chID Reads input status returns an integer with the following meaning
|
||||||
|
# Bit Weighting StatusIndicator
|
||||||
|
# 4 16 temp underrange
|
||||||
|
# 5 32 temp overrange
|
||||||
|
# 6 64 units under range
|
||||||
|
# 7 128 untis over range
|
||||||
|
set i [expr {$fields >> 4}]
|
||||||
|
set bitValue [expr {$i & 0x01}]
|
||||||
|
if {$bitValue == 1} { append $nodeName "temp underrange, " }
|
||||||
|
set i [expr {$i >> 1}]
|
||||||
|
set bitValue [expr {$i & 0x01}]
|
||||||
|
if {$bitValue == 1} { append $nodeName "temp overrange, " }
|
||||||
|
set i [expr {$i >> 1}]
|
||||||
|
set bitValue [expr {$i & 0x01}]
|
||||||
|
if {$bitValue == 1} { append $nodeName "units under range, " }
|
||||||
|
set i [expr {$i >> 1}]
|
||||||
|
set bitValue [expr {$i & 0x01}]
|
||||||
|
if {$bitValue == 1} { append $nodeName "untis over range" }
|
||||||
|
}
|
||||||
|
"SensorUnitValue" { hset $nodeName $fields }
|
||||||
|
"data" { hset $nodeName $fields }
|
||||||
|
"aOutput" { switch -exact [lindex $fields 0] {
|
||||||
|
0 { hset $nodeName/bipolarEnable "positive only" }
|
||||||
|
1 { hset $nodeName/bipolarEnable "bipolar" }
|
||||||
|
default {}
|
||||||
|
}
|
||||||
|
switch -exact [lindex $fields 1] {
|
||||||
|
0 { hset $nodeName/monitorMode off }
|
||||||
|
1 { hset $nodeName/monitorMode input }
|
||||||
|
2 { hset $nodeName/monitorMode manual }
|
||||||
|
default { hset $nodeName/monitorMode UNKNOW }
|
||||||
|
}
|
||||||
|
hset $nodeName/inputChID [lindex $fields 2]
|
||||||
|
switch -exact [lindex $fields 3] {
|
||||||
|
1 { hset $nodeName/source Kelvin}
|
||||||
|
2 { hset $nodeName/source Celsius}
|
||||||
|
3 { hset $nodeName/source "sensor units"}
|
||||||
|
4 { hset $nodeName/source "linear data"}
|
||||||
|
default { hset $nodeName/source UNKNOW}
|
||||||
|
}
|
||||||
|
hset $nodeName/highValue [lindex $fields 4]
|
||||||
|
hset $nodeName/lowValue [lindex $fields 5]
|
||||||
|
hset $nodeName/manualValue [lindex $fields 6]
|
||||||
|
}
|
||||||
|
"IDN" { hset $nodeName/manufacturer [lindex $fields 0]
|
||||||
|
hset $nodeName/model [lindex $fields 1]
|
||||||
|
hset $nodeName/serialNumber [lindex $fields 2]
|
||||||
|
hset $nodeName/firmwareDate [lindex $fields 3]
|
||||||
|
}
|
||||||
|
"logStatus" { switch -exact [lindex $fields 0] {
|
||||||
|
0 { hset $nodeName off }
|
||||||
|
1 { hset $nodeName on }
|
||||||
|
default { hset $nodeName UNKNOW }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"relay" { switch -exact [lindex $fields 0] {
|
||||||
|
0 { hset $nodeName/mode off }
|
||||||
|
1 { hset $nodeName/mode on }
|
||||||
|
default { hset $nodeName/mode UNKNOW }
|
||||||
|
}
|
||||||
|
hset $nodeName/input [lindex $fields 1]
|
||||||
|
switch -exact [lindex $fields 2] {
|
||||||
|
0 { hset $nodeName/alarmType "low Alarm" }
|
||||||
|
1 { hset $nodeName/alarmType "High Alarm" }
|
||||||
|
2 { hset $nodeName/alarmType "Both Alarm" }
|
||||||
|
default { hset $nodeName/alarmType UNKNOW }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default { return -code error "in rdValue: wrong input parameter"}
|
||||||
|
}
|
||||||
|
} message ]} {
|
||||||
|
return -code error "in rdValue: $message "
|
||||||
|
}
|
||||||
|
return idle
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
##
|
||||||
|
# @brief createNode() creates a node for the given nodename with the properties and virtual
|
||||||
|
# function names provided
|
||||||
|
# @param nodeType represent for sub-tree inputNode, outputNode and otherNode
|
||||||
|
# @param scobj_hpath string variable holding the path to the object's base node in sics (/sample/tc1)
|
||||||
|
# @param sct_controller name of the ls218 scriptcontext object (typically sct_ls218_tc1 or tc2)
|
||||||
|
# @param cmdGroup subdirectory (below /sample/tc*/) in which the node is to be created
|
||||||
|
# @param varName name of the actual node typically representing one device command
|
||||||
|
# @param readable set to 1 if the node represents a query command, 0 if it is not
|
||||||
|
# @param pollEnabled set to 1 if the node property pollable is to be enabled (node gets read every 5 secs)
|
||||||
|
# @param idx indicates which control loop or which input channel the command corresponds to
|
||||||
|
# @param dataType data type of the node, must be one of none, int, float, text
|
||||||
|
# @param permission defines what user group may read/write to this node (is one of spy, user, manager)
|
||||||
|
# @param rdCmd actual device query command to be sent to the device
|
||||||
|
# @param rdFunc nextState Function to be called after the getValue function, typically rdValue()
|
||||||
|
# @param hdbEnable set to 1 if need to create a HDB node, otherwise ignore all following parameters
|
||||||
|
# @param klasse Nexus class name (?)
|
||||||
|
# @param control attribute for HDB tree
|
||||||
|
# @param data attribute for HDB tree
|
||||||
|
# @param priv attribute for HDB tree
|
||||||
|
# @param type attribute for HDB tree
|
||||||
|
# @param nxsave attribute for HDB tree
|
||||||
|
# @param mutable attribute for HDB tree
|
||||||
|
# @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} {
|
||||||
|
# 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
|
||||||
|
} else {
|
||||||
|
set basePath $scobj_hpath
|
||||||
|
}
|
||||||
|
|
||||||
|
if {1 > [string length $cmdGroup]} {
|
||||||
|
set nodeName $basePath/$varName
|
||||||
|
} else {
|
||||||
|
set nodeName $basePath/$cmdGroup/$varName
|
||||||
|
}
|
||||||
|
|
||||||
|
hfactory $nodeName plain $permission $dataType
|
||||||
|
switch -exact $dataType {
|
||||||
|
"none" {hset $nodeName none}
|
||||||
|
"text" {hset $nodeName UNKNOWN}
|
||||||
|
"int" {hset $nodeName 0}
|
||||||
|
"float" {hset $nodeName 0.0}
|
||||||
|
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
|
||||||
|
}
|
||||||
|
if {$pollEnabled == 1} {
|
||||||
|
# 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
|
||||||
|
}
|
||||||
|
|
||||||
|
##
|
||||||
|
# @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)
|
||||||
|
# @param klasse Nexus class name (?), typically 'environment'
|
||||||
|
# @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} {
|
||||||
|
if {[ catch {
|
||||||
|
foreach {k v} $argList {
|
||||||
|
set KEY [string toupper $k]
|
||||||
|
set pa($KEY) $v
|
||||||
|
}
|
||||||
|
|
||||||
|
MakeSICSObj $pa(NAME) SCT_OBJECT
|
||||||
|
sicslist setatt $pa(NAME) klass $pa(KLASS)
|
||||||
|
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 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
|
||||||
|
# 'value', and the control loop parameters in human-rdadable form 'ctrl_Loop_x')
|
||||||
|
# Note that drivable nodes require the index of the control loop in their call to halt()
|
||||||
|
# Nodes appear in gumtree in the order in which they are created here.
|
||||||
|
#
|
||||||
|
# Initialise the model-dependent list of supported device commands
|
||||||
|
# RdWrPlDrIdx
|
||||||
|
# cmdGroup subdirectory (below /sample/tc*/) in which the node is to be created
|
||||||
|
# varName name of the actual node typically representing one device command
|
||||||
|
#
|
||||||
|
# readable set to 1 if the node represents a query command, 0 if it is not
|
||||||
|
# pollEnabled set to 1 if the node property pollable is to be enabled (node gets read every 5 secs)
|
||||||
|
#
|
||||||
|
# dataType data type of the node, must be one of none, int, float, text
|
||||||
|
# permission defines what user group may read/write to this node (is one of spy, user, manager)
|
||||||
|
# rdCmd actual device query command to be sent to the device
|
||||||
|
# chID set to 1 presenting a need to specify the ID of input (1-8) or output (1-2) channels
|
||||||
|
# rdFunc nextState Function to be called after the getValue function, typically rdValue()
|
||||||
|
# hdbTree set to 1 if a HDB needs to be created at the node
|
||||||
|
# klass type of klass of the HDB node
|
||||||
|
# control type of contrl of the HDB node
|
||||||
|
# data type of data of the HDB node
|
||||||
|
# priv type of previlige level of the HDB node
|
||||||
|
# type type of the HDB node
|
||||||
|
# nxsave save the node or not, values are true or false
|
||||||
|
# mutable mutable control or not, values are true or false
|
||||||
|
# nxalias alias name of the node in the HDB tree
|
||||||
|
###########################################################################################################
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {} {} {} {} {} {} {} {}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {} {} {} {} {} {} {} {}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {} {} {} {} {} {} {} {}
|
||||||
|
}
|
||||||
|
|
||||||
|
# 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# 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
|
||||||
|
}
|
||||||
|
|
||||||
|
::scobj::hinitprops $pa(NAME)
|
||||||
|
|
||||||
|
} message ]} {
|
||||||
|
return -code error "in mkLS218 $message"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace export ls218
|
||||||
|
}
|
||||||
|
# end of namespace ::scobj::ls218
|
||||||
|
|
||||||
|
# Main process call
|
||||||
|
# @param name short name for the Lakeshore Temp controller 218
|
||||||
|
# @param IP IP address of the device (e.g. IP of moxabox that hooks up to the AG1010)
|
||||||
|
# @param port port number on the moxabox (typ. 4001, 4002, 4003, or 4004)
|
||||||
|
# @param turning if the parameter is turnable and can be set from the Gumtree
|
||||||
|
# @internal time internal in polling the nodes
|
||||||
|
# @return nothing (well, the sct object)
|
||||||
|
|
||||||
|
::scobj::ls218::mkLS218 {
|
||||||
|
name "ls218"
|
||||||
|
IP 137.157.202.219
|
||||||
|
PORT 4001
|
||||||
|
tuning 1
|
||||||
|
interval 5
|
||||||
|
klass environment
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace import ::scobj::ls218::*
|
||||||
Reference in New Issue
Block a user