add hdb structure

r3745 | jgn | 2012-09-24 14:02:21 +1000 (Mon, 24 Sep 2012) | 1 line
This commit is contained in:
Jing Chen
2012-09-24 14:02:21 +10:00
committed by Douglas Clowes
parent 58b74c6f45
commit 9afb90b311

View File

@@ -136,15 +136,30 @@ proc ::scobj::hv::rdHVStatusFunc {basePath mode} {
if {$mode == "state"} {
hset $basePath/status/state "[lindex $replyText 3] [lindex $replyText 4]"
hset $basePath/status/voltage "[lindex $replyText 5] [lindex $replyText 6]"
hset $basePath/status/current "[lindex $replyText 7] [lindex $replyText 8]"
hset $basePath/status/DetectorHighPressure "[lindex $replyText 10] [lindex $replyText 11]"
hset $basePath/status/SampleHighPressure "[lindex $replyText 13] [lindex $replyText 14]"
hset $basePath/status/DetectorLowPressure "[lindex $replyText 16] [lindex $replyText 17]"
hset $basePath/status/SampleLowPressure "[lindex $replyText 19] [lindex $replyText 20]"
hset $basePath/status/pressure5 "[lindex $replyText 22] [lindex $replyText 23]"
hset $basePath/status/pressure6 "[lindex $replyText 25] [lindex $replyText 26]"
hset $basePath/status/voltage [lindex $replyText 5]
hsetprop $basePath/status/voltage units [lindex $replyText 6]
hset $basePath/status/current [lindex $replyText 7]
hsetprop $basePath/status/current units [lindex $replyText 8]
hset $basePath/status/DetectorHighPressure [lindex $replyText 10]
hsetprop $basePath/status/DetectorHighPressure units [lindex $replyText 11]
hset $basePath/status/SampleHighPressure [lindex $replyText 13]
hsetprop $basePath/status/SampleHighPressure units [lindex $replyText 14]
hset $basePath/status/DetectorLowPressure [lindex $replyText 16]
hsetprop $basePath/status/DetectorLowPressure units [lindex $replyText 17]
hset $basePath/status/SampleLowPressure [lindex $replyText 19]
hsetprop $basePath/status/SampleLowPressure units [lindex $replyText 20]
hset $basePath/status/pressure5 [lindex $replyText 22]
hsetprop $basePath/status/pressure5 units [lindex $replyText 23]
hset $basePath/status/pressure6 [lindex $replyText 25]
hsetprop $basePath/status/pressure6 units [lindex $replyText 26]
hset $basePath/status/PLC-S "[lindex $replyText 28]"
hset $basePath/status/PLC-H "[lindex $replyText 30]"
@@ -164,13 +179,19 @@ proc ::scobj::hv::rdHVStatusFunc {basePath mode} {
} elseif {$mode == "config"} {
hset $basePath/config/mode "[lindex $replyText 3] [lindex $replyText 4]"
hset $basePath/config/hv "[lindex $replyText 5]"
hset $basePath/config/pressure_threshold "[lindex $replyText 6] [lindex $replyText 7]"
} else {
return idle
}
hset $basePath/config/hv [lindex $replyText 5]
sct utime readtime
hset $basePath/config/pressure_threshold [lindex $replyText 6]
hsetprop $basePath/config/pressure_threshold units [lindex $replyText 7]
} else {
#return idle
}
}
if {$replyStr != [sct oldval]} {
sct oldval $replyStr
sct update $replyStr
sct utime readtime
}
return idle
@@ -199,104 +220,111 @@ proc ::scobj::hv::mkHV {argList} {
sicslist setatt $pa(NAME) klass instrument
sicslist setatt $pa(NAME) long_name $pa(NAME)
hfactory /sics/$pa(NAME)/msg plain user text
hfactory /sics/$pa(NAME)/dataRecording plain user text
set hvPath /sics/$pa(NAME)
hset /sics/$pa(NAME)/dataRecording "ON"
foreach {hPath type priv datatype init } {
msg plain user text UNKNOW
dataRecording plain user text ON
status plain user none UNKNOW
status/voltage plain user float 0
status/current plain user float 0
status/DetectorHighPressure plain user float 0
status/SampleHighPressure plain user float 0
status/DetectorLowPressure plain user float 0
status/SampleLowPressure plain user float 0
status/pressure5 plain user float 0
status/pressure6 plain user float 0
status/state plain user text UNKNOW
status/PLC-S plain user text UNKNOW
status/PLC-H plain user text UNKNOW
status/Presr-S plain user text UNKNOW
status/Presr-H plain user text UNKNOW
status/Soft-S plain user text UNKNOW
status/Hard-S plain user text UNKNOW
hfactory /sics/$pa(NAME)/status plain user none
hfactory /sics/$pa(NAME)/status/voltage plain user text
hfactory /sics/$pa(NAME)/status/current plain user text
hfactory /sics/$pa(NAME)/status/DetectorHighPressure plain user text
hfactory /sics/$pa(NAME)/status/SampleHighPressure plain user text
hfactory /sics/$pa(NAME)/status/DetectorLowPressure plain user text
hfactory /sics/$pa(NAME)/status/SampleLowPressure plain user text
hfactory /sics/$pa(NAME)/status/pressure5 plain user text
hfactory /sics/$pa(NAME)/status/pressure6 plain user text
hfactory /sics/$pa(NAME)/status/state plain user text
hfactory /sics/$pa(NAME)/status/PLC-S plain user text
hfactory /sics/$pa(NAME)/status/PLC-H plain user text
hfactory /sics/$pa(NAME)/status/Presr-S plain user text
hfactory /sics/$pa(NAME)/status/Presr-H plain user text
hfactory /sics/$pa(NAME)/status/Soft-S plain user text
hfactory /sics/$pa(NAME)/status/Hard-S plain user text
hfactory /sics/$pa(NAME)/config plain user none
hfactory /sics/$pa(NAME)/config/hv plain user text
hfactory /sics/$pa(NAME)/config/mode plain user text
hfactory /sics/$pa(NAME)/config/pressure_threshold plain user text
config plain user none UNKNOW
config/hv plain user float 0
config/mode plain user text UNKNOW
config/pressure_threshold plain user float 0
} {
hfactory $hvPath/$hPath $type $priv $datatype
hset $hvPath/$hPath $init
}
hsetprop $hvPath/status oldval UNKNOWN
hsetprop $hvPath/config oldval UNKNOWN
#makesctcontroller sct_hv rfamp $pa(IP):$pa(PORT)
makesctcontroller sct_hv std $pa(IP):$pa(PORT)
hsetprop /sics/$pa(NAME)/status read ::scobj::hv::getHVStatusFunc "state"
hsetprop /sics/$pa(NAME)/status rdHVStatus ::scobj::hv::rdHVStatusFunc /sics/$pa(NAME) "state"
hsetprop $hvPath/status read ::scobj::hv::getHVStatusFunc "state"
hsetprop $hvPath/status rdHVStatus ::scobj::hv::rdHVStatusFunc $hvPath "state"
hsetprop /sics/$pa(NAME)/config read ::scobj::hv::getHVStatusFunc "config"
hsetprop /sics/$pa(NAME)/config rdHVStatus ::scobj::hv::rdHVStatusFunc /sics/$pa(NAME) "config"
# Initialise properties required for generating the API for GumTree and to save data
::scobj::hinitprops $pa(NAME) status config
::scobj::hinitprops $pa(NAME) status/voltage status/current status/state
::scobj::hinitprops $pa(NAME) status/DetectorHighPressure status/SampleHighPressure status/DetectorLowPressure status/SampleLowPressure status/pressure5 status/pressure6
::scobj::hinitprops $pa(NAME) status/PLC-S status/PLC-H status/Presr-S status/Presr-H status/Soft-S status/Hard-S
::scobj::hinitprops $pa(NAME) config/hv config/pressure_threshold config/mode
hsetprop $hvPath/config read ::scobj::hv::getHVStatusFunc "config"
hsetprop $hvPath/config rdHVStatus ::scobj::hv::rdHVStatusFunc $hvPath "config"
if {[SplitReply [environment_simulation]]=="false"} {
sct_hv poll /sics/$pa(NAME)/status $pa(INTERVAL)
sct_hv poll /sics/$pa(NAME)/config $pa(INTERVAL)
sct_hv poll $hvPath/status $pa(INTERVAL)
sct_hv poll $hvPath/config $pa(INTERVAL)
}
hsetprop /sics/$pa(NAME) tuning $pa(TUNING)
hsetprop $hvPath tuning $pa(TUNING)
if {$pa(TUNING)} {
hfactory /sics/$pa(NAME)/set_hv plain user int
hfactory /sics/$pa(NAME)/set_pressure plain user int
hfactory /sics/$pa(NAME)/set_mode plain user text
hfactory /sics/$pa(NAME)/set_date plain user text
hfactory /sics/$pa(NAME)/clear_error plain user text
hfactory /sics/$pa(NAME)/set_PowerUp plain user text
hfactory /sics/$pa(NAME)/set_PowerDown plain user text
hfactory /sics/$pa(NAME)/set_dataRecording plain user text
::scobj::hinitprops $pa(NAME) set_hv set_pressure set_mode set_date clear_error set_PowerUp set_PowerDown set_dataRecording
foreach {hpath type priv datatype mark} {
set_hv plain user float voltage
set_pressure plain user float pressure
set_mode plain user text mode
set_date plain user text date
clear_error plain user text clear
set_PowerUp plain user text PowerUp
set_PowerDown plain user text PowerDown
set_dataRecording plain user text recording
} {
hfactory $hvPath/$hpath $type $priv $datatype
hsetprop $hvPath/$hpath write ::scobj::hv:setting $mark $hvPath
hsetprop $hvPath/$hpath checkReply ::scobj::hv::checkReplyFunc $hvPath
hsetprop /sics/$pa(NAME)/set_hv write ::scobj::hv:setting "voltage" /sics/$pa(NAME)
hsetprop /sics/$pa(NAME)/set_hv checkReply ::scobj::hv::checkReplyFunc /sics/$pa(NAME)
hsetprop /sics/$pa(NAME)/set_pressure write ::scobj::hv:setting "pressure" /sics/$pa(NAME)
hsetprop /sics/$pa(NAME)/set_pressure checkReply ::scobj::hv::checkReplyFunc /sics/$pa(NAME)
hsetprop /sics/$pa(NAME)/set_mode write ::scobj::hv:setting "mode" /sics/$pa(NAME)
hsetprop /sics/$pa(NAME)/set_mode checkReply ::scobj::hv::checkReplyFunc /sics/$pa(NAME)
hsetprop /sics/$pa(NAME)/set_date write ::scobj::hv:setting "date" /sics/$pa(NAME)
hsetprop /sics/$pa(NAME)/set_date checkReply ::scobj::hv::checkReplyFunc /sics/$pa(NAME)
hsetprop /sics/$pa(NAME)/clear_error write ::scobj::hv:setting "clear" /sics/$pa(NAME)
hsetprop /sics/$pa(NAME)/clear_error checkReply ::scobj::hv::checkReplyFunc /sics/$pa(NAME)
hsetprop /sics/$pa(NAME)/set_PowerUp write ::scobj::hv:setting "PowerUp" /sics/$pa(NAME)
hsetprop /sics/$pa(NAME)/set_PowerUp checkReply ::scobj::hv::checkReplyFunc /sics/$pa(NAME)
hsetprop /sics/$pa(NAME)/set_PowerDown write ::scobj::hv:setting "PowerDown" /sics/$pa(NAME)
hsetprop /sics/$pa(NAME)/set_PowerDown checkReply ::scobj::hv::checkReplyFunc /sics/$pa(NAME)
hsetprop /sics/$pa(NAME)/set_dataRecording write ::scobj::hv:setting "recording" /sics/$pa(NAME)
if {[SplitReply [environment_simulation]]=="false"} {
sct_hv write /sics/$pa(NAME)/set_hv $pa(INTERVAL)
sct_hv write /sics/$pa(NAME)/set_pressure $pa(INTERVAL)
sct_hv write /sics/$pa(NAME)/set_mode $pa(INTERVAL)
sct_hv write /sics/$pa(NAME)/set_date $pa(INTERVAL)
sct_hv write /sics/$pa(NAME)/clear_error $pa(INTERVAL)
sct_hv write /sics/$pa(NAME)/set_PowerUp $pa(INTERVAL)
sct_hv write /sics/$pa(NAME)/set_PowerDown $pa(INTERVAL)
sct_hv write /sics/$pa(NAME)/set_dataRecording $pa(INTERVAL)
if {[SplitReply [environment_simulation]]=="false"} {
sct_hv write $hvPath/$hpath $pa(INTERVAL)
}
}
}
foreach {hpath klass control data priv type} {
/sics/hv instrument true true spy part
/sics/hv/status NXsensor true true user NXsensor
} {
hsetprop $hpath klass $klass
hsetprop $hpath privilege $priv
hsetprop $hpath type $type
hsetprop $hpath control $control
hsetprop $hpath data $data
}
foreach {hpath klass control data nxsave mutable priv alias} {
/sics/hv/status/voltage NXsensor true true true true user hv-voltage
/sics/hv/status/current NXsensor true true true true user hv-current
/sics/hv/status/DetectorHighPressure NXsensor true true true true user hv-DetectorHighPressure
/sics/hv/status/DetectorLowPressure NXsensor true true true true user hv-DetectorLowPressure
/sics/hv/status/SampleHighPressure NXsensor true true true true user hv-SampleHighPressure
/sics/hv/status/SampleLowPressure NXsensor true true true true user hv-SampleLowPressure
/sics/hv/status/pressure5 NXsensor true true true true user hv-pressure5
/sics/hv/status/pressure6 NXsensor true true true true user hv-pressure6
} {
hsetprop $hpath nxalias $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
}
# Initialise properties required for generating the API for GumTree and to save data
::scobj::hinitprops $pa(NAME)
}
proc hv_status {} {
@@ -316,7 +344,7 @@ proc hv_clear_error {} {
proc hv_vol {{vol ""} args} {
if {$vol == ""} {
hget /sics/hv/config/hv
hget /instrument/hv/config/hv
} else {
set cmd "set hv=$vol\r\n"
sct_hv send $cmd
@@ -325,7 +353,7 @@ proc hv_vol {{vol ""} args} {
proc hv_pressure {{pressure ""} args} {
if {$pressure == ""} {
hget /sics/hv/config/pressure_threshold
hget /instrument/hv/config/pressure_threshold
} else {
set cmd "set pressure=$pressure\r\n"
sct_hv send $cmd
@@ -334,7 +362,7 @@ proc hv_pressure {{pressure ""} args} {
proc hv_mode {{mode ""} args} {
if {$mode == ""} {
hget /sics/hv/config/mode
hget /instrument/hv/config/mode
} else {
set cmd "set mode=$mode\r\n"
sct_hv send $cmd
@@ -366,10 +394,10 @@ proc hv_help {} {
proc set_data_record {args} {
switch $args {
"ON" {hset /sics/hv/dataRecording "ON"}
"on" {hset /sics/hv/dataRecording "ON"}
"OFF" {hset /sics/hv/dataRecording "OFF"}
"off" {hset /sics/hv/dataRecording "OFF"}
"ON" {hset /instrument/hv/dataRecording "ON"}
"on" {hset /instrument/hv/dataRecording "ON"}
"OFF" {hset /instrument/hv/dataRecording "OFF"}
"off" {hset /instrument/hv/dataRecording "OFF"}
default {error "ERROR: please enter 'on' or 'off' to set the switch"}
}
}