From 86e1f7b7cf692335e69dd0ad2a6ebf0a31b290b0 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Fri, 23 Jan 2015 09:18:14 +1100 Subject: [PATCH 01/22] SICS-819 Fix SICS crash in logsetup Directory creation involving path creation failed because the path has a trailing slash. After creating the directory of the full path, SICS tried to create the path again with the trailing slash - it failed. When logger creation failed, SICS registered the callback with NULL. This was dereferenced in the hipadaba callback. Suppress trailing slashes in directory path creation. Do not register the callback if the creation failed. --- logger.c | 3 +++ logsetup.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/logger.c b/logger.c index 37d0d631..bcf7c682 100644 --- a/logger.c +++ b/logger.c @@ -397,6 +397,9 @@ static int LoggerMakeDir(char *path) return 0; /* mkdir failed */ snprintf(buffer, sizeof buffer, "%s", path); lpath = strlen(buffer); + /* Discard any trailing slash characters */ + while (lpath > 0 && buffer[lpath - 1] == '/') + buffer[--lpath] = '\0'; do { slash = strrchr(buffer, '/'); if (!slash) diff --git a/logsetup.c b/logsetup.c index a8394b97..aceb023e 100644 --- a/logsetup.c +++ b/logsetup.c @@ -118,6 +118,11 @@ static int LogSetup(SConnection * pCon, SicsInterp * pSics, void *pData, LoggerChange(logger, period, name); } else { logger = LoggerMake(name, period, !numeric); + /* If that failed, we cannot continue - it crashes in the callback */ + if (logger == NULL) { + SCPrintf(pCon, eError, "ERROR: logger %s not created", argv[1]); + return 0; + } LoggerSetNumeric(logger, numeric); SetHdbProperty(node, "logger_name", name); cb = MakeHipadabaCallback(LoggerUpdateCallback, logger, From b88580a5718b168cd13fded677e4076595e30d16 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Fri, 23 Jan 2015 12:28:53 +1100 Subject: [PATCH 02/22] SICS-151 Remove extraconfig.tcl from remaining MANIFEST.TXT files We don't want these files deployed anyway since they get updated on the instrument. --- site_ansto/instrument/qld/MANIFEST.TXT | 1 - site_ansto/instrument/reflectometer/MANIFEST.TXT | 1 - site_ansto/instrument/rsd/MANIFEST.TXT | 1 - site_ansto/instrument/sans/MANIFEST.TXT | 1 - 4 files changed, 4 deletions(-) mode change 100644 => 100755 site_ansto/instrument/qld/MANIFEST.TXT mode change 100644 => 100755 site_ansto/instrument/reflectometer/MANIFEST.TXT mode change 100644 => 100755 site_ansto/instrument/rsd/MANIFEST.TXT mode change 100644 => 100755 site_ansto/instrument/sans/MANIFEST.TXT diff --git a/site_ansto/instrument/qld/MANIFEST.TXT b/site_ansto/instrument/qld/MANIFEST.TXT old mode 100644 new mode 100755 index 80d4dd24..5779a3c4 --- a/site_ansto/instrument/qld/MANIFEST.TXT +++ b/site_ansto/instrument/qld/MANIFEST.TXT @@ -4,6 +4,5 @@ hipadaba_configuration.tcl hpaths.tcl koala.hdd troubleshoot_setup.tcl -extraconfig.tcl InstXML.xml sics_simulation.tcl diff --git a/site_ansto/instrument/reflectometer/MANIFEST.TXT b/site_ansto/instrument/reflectometer/MANIFEST.TXT old mode 100644 new mode 100755 index 4e5b24ad..ce262adc --- a/site_ansto/instrument/reflectometer/MANIFEST.TXT +++ b/site_ansto/instrument/reflectometer/MANIFEST.TXT @@ -2,7 +2,6 @@ runsics_def.py platypus_configuration.tcl sics_ports.tcl script_validator_ports.tcl -extraconfig.tcl config util hostport_config.tcl diff --git a/site_ansto/instrument/rsd/MANIFEST.TXT b/site_ansto/instrument/rsd/MANIFEST.TXT old mode 100644 new mode 100755 index 23eab905..e8c34b80 --- a/site_ansto/instrument/rsd/MANIFEST.TXT +++ b/site_ansto/instrument/rsd/MANIFEST.TXT @@ -2,7 +2,6 @@ runsics_def.py sics_ports.tcl script_validator_ports.tcl kowari_configuration.tcl -extraconfig.tcl config util hostport_config.tcl diff --git a/site_ansto/instrument/sans/MANIFEST.TXT b/site_ansto/instrument/sans/MANIFEST.TXT old mode 100644 new mode 100755 index 930f85a3..69bc15f9 --- a/site_ansto/instrument/sans/MANIFEST.TXT +++ b/site_ansto/instrument/sans/MANIFEST.TXT @@ -2,7 +2,6 @@ runsics_def.py quokka_configuration.tcl sics_ports.tcl script_validator_ports.tcl -extraconfig.tcl config util hostport_config.tcl From be0d932a210cfcec69ce47c98a62d49a90af512b Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Fri, 23 Jan 2015 17:13:50 +1100 Subject: [PATCH 03/22] SICS-846 Off by one error in argc check sct_asyncqueue.c --- site_ansto/hardsup/sct_asyncqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site_ansto/hardsup/sct_asyncqueue.c b/site_ansto/hardsup/sct_asyncqueue.c index 1fec9251..897f162e 100644 --- a/site_ansto/hardsup/sct_asyncqueue.c +++ b/site_ansto/hardsup/sct_asyncqueue.c @@ -324,7 +324,7 @@ static int scaqaAsconInit(Ascon *a, SConnection *pCon, int argc, char *argv[]) for (i = 0; i < argc; ++i) { SCPrintf(pCon, eStatus, "scaqaAsconInit: arg[%d] = %s\n", i, argv[i]); } - if (argc < 1) { + if (argc < 2) { SCPrintf(pCon, eError, "Insufficient arguments to scaqaAsconInit: %d\n", argc); return 0; } From 2993a04485a20242b37b6cd6d7fa49a924c5da23 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Fri, 13 Feb 2015 10:56:21 +1100 Subject: [PATCH 04/22] Alternative Oxford Magnet Labview interface --- .../environment/magneticField/oxford10tlv.sct | 188 ++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 site_ansto/instrument/config/environment/magneticField/oxford10tlv.sct diff --git a/site_ansto/instrument/config/environment/magneticField/oxford10tlv.sct b/site_ansto/instrument/config/environment/magneticField/oxford10tlv.sct new file mode 100644 index 00000000..56d9cd04 --- /dev/null +++ b/site_ansto/instrument/config/environment/magneticField/oxford10tlv.sct @@ -0,0 +1,188 @@ +# vim: ft=tcl ts=8 sts=2 sw=2 expandtab autoindent smartindent nocindent +driver oxford10tlv = { + protocol = std + class = environment + simulation_group = environment_simulation + add_args = 'id datype interval' + make_args = 'id datype interval' + + group magnet = { + type = float; + var setpoint = { + driveable = 'magnet/field'; + lowerlimit = -10; upperlimit = 10; tolerance = 0.01; + property settle_time = 30; + write_function = write_setpoint; + checkrange_function = check_error; + } + var htr_sw = { + type = int; + writeable = 1; + write_function = write_heater; + read_function = read_heater; # Used in the write function + allowed = '0,1'; + } + var rate = { + writeable = 1; + write_function = write_rate; + read_function = read_rate; # Used in the write function + } + var field = { + readable = 5; + read_command = "getF"; + read_function = read_field; + } + var current = { } + var state = { + type = text; data = false; nxsave = false; mutable = false; + readable = 1; + fetch_function = fetch_state; + read_function = read_state; + value = 'IDLE'; + property htron_delay = 10; + property htroff_delay = 10; + } + } + + code check_error = { + @TCL + if { [hpropexists [sct] driving] } { + if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { + set my_state [hval ${tc_root}/magnet/state] + if {${my_state} != "IDLE"} { + error "Cannot run/drive in state '${my_state}', must be 'IDLE'" + } + } else { + error "Use run/drive and not hset" + } + } + @END + } + + code checkstatus = { + @TCL + @END + } + + code fetch_state = { + @TCL + set my_state [hval [sct]] + set cmd "@@NOSEND@@" + if {${my_state} == "START"} { + set cmd "setHS ON\r\n@@NOREPLY@@" + sct utime start_time + hupdate [sct] "HTRON" + } elseif {${my_state} == "HTRON"} { + if {[hpropexists [sct] htron_delay]} { + set htron_delay [sct htron_delay] + if {$htron_delay < 10} { + set htron_delay 30 + } elseif {$htron_delay > 60} { + set htron_delay 30 + } + } else { + set htron_delay 30 + } + if {[sct utime] - [sct start_time] > $htron_delay} { + set cmd "setF [hval ${tc_root}/magnet/setpoint]\r\n@@NOREPLY@@" + hupdate [sct] "DRIVE" + } else { + set nextState "idle" + } + } elseif {${my_state} == "DRIVE"} { + if {[hgetpropval ${tc_root}/magnet/setpoint driving] == 0} { + set cmd "setHS OFF\r\n@@NOREPLY@@" + sct utime start_time + hupdate [sct] "HTROFF" + } else { + set nextState "idle" + } + } elseif {${my_state} == "HTROFF"} { + if {[hpropexists [sct] htroff_delay]} { + set htroff_delay [sct htroff_delay] + if {$htroff_delay <= 10} { + set htroff_delay 30 + } elseif {$htroff_delay >= 60} { + set htroff_delay 30 + } + } else { + set htroff_delay 30 + } + if {[sct utime] - [sct start_time] > $htroff_delay} { + hupdate [sct] "IDLE" + } else { + set nextState "idle" + } + } elseif {${my_state} == "IDLE"} { + set nextState "idle" + } + @END + } + + code read_field = { + @TCL + set s1 [string trimright [sct result] "\n"] + set s2 [split $s1 ";"] + if {[llength $s2] > 1} { + if {[string equal -nocase -length 14 "Field_Current=" [lindex $s2 0]]} { + #hupdateif ${tc_root}/magnet/current [string range [lindex $s2 0] 14 end] + set current [string range [lindex $s2 0] 14 end] + hsetprop ${tc_root}/magnet/current result ${current} + set ns [namespace current] + sct with ${tc_root}/magnet/current "${ns}::rdValue ${tc_root}" + } + if {[string equal -nocase -length 12 "Field_Tesla=" [lindex $s2 1]]} { + set data [string range [lindex $s2 1] 12 end] + } + } + @END + } + + code read_state = { + @TCL + return "idle" + @END + } + + code write_heater = { + @TCL + if {${par} == 0} { + set cmd "setHS OFF\r\n@@NOREPLY@@" + } elseif {${par} == 1} { + set cmd "setHS ON\r\n@@NOREPLY@@" + } else { + error "Invalid parameter '${par}' should be 0 or 1" + } + # Invoke the read function to set the value as if read back + sct result $par + read_heater ${tc_root} + @END + } + + code write_setpoint = { + @TCL + hset ${tc_root}/magnet/state "START" + # Force the driving flag for the state check + sct driving 1 + # Set the value on the field + hupdateif [sct] $par + # It's all over now + set cmd "@@NOSEND@@" + set nextState "idle" + @END + } + + code write_rate = { + @TCL + if {${par} >= 0 && ${par} <= 10} { + set cmd "setR ${par}\r\n@@NOREPLY@@" + } else { + error "Invalid parameter '${par}' should be 0 to 10" + } + # Invoke the read function to set the value as if read back + sct result $par + read_rate ${tc_root} + @END + } + +} From 3486b75d47b199fecf92c20be678f9dc27295079 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Fri, 13 Feb 2015 10:57:58 +1100 Subject: [PATCH 05/22] Generate the TCL from the new Oxford --- .../magneticField/sct_oxford10tlv.tcl | 860 ++++++++++++++++++ 1 file changed, 860 insertions(+) create mode 100644 site_ansto/instrument/config/environment/magneticField/sct_oxford10tlv.tcl diff --git a/site_ansto/instrument/config/environment/magneticField/sct_oxford10tlv.tcl b/site_ansto/instrument/config/environment/magneticField/sct_oxford10tlv.tcl new file mode 100644 index 00000000..00da0e00 --- /dev/null +++ b/site_ansto/instrument/config/environment/magneticField/sct_oxford10tlv.tcl @@ -0,0 +1,860 @@ +# Generated driver for oxford10tlv +# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent +# + +namespace eval ::scobj::oxford10tlv { + set debug_threshold 5 +} + +proc ::scobj::oxford10tlv::debug_log {tc_root debug_level debug_string} { + set catch_status [ catch { + set debug_threshold [hgetpropval ${tc_root} debug_threshold] + if {${debug_level} >= ${debug_threshold}} { + set now [clock seconds] + set ts [clock format ${now} -format "%Y%m%d"] + set log_file_name "../log/oxford10tlv_[basename ${tc_root}]_${ts}.log" + set fd [open "${log_file_name}" "a"] + set ts [clock format ${now} -format "%T"] + puts ${fd} "${ts} ${debug_string}" + close ${fd} + } + } catch_message ] +} + +proc ::scobj::oxford10tlv::sics_log {debug_level debug_string} { + set catch_status [ catch { + set debug_threshold ${::scobj::oxford10tlv::debug_threshold} + if {${debug_level} >= ${debug_threshold}} { + sicslog "::scobj::oxford10tlv::${debug_string}" + } + } catch_message ] +} + +# check function for hset change +proc ::scobj::oxford10tlv::check_error {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "check_error tc_root=${tc_root} sct=[sct] target=[sct target]" + set setpoint [sct target] + if { [hpropexists [sct] lowerlimit] } { + set lolimit [sct lowerlimit] + } else { + # lowerlimit not set, use target + set lolimit [sct target] + } + if { [hpropexists [sct] upperlimit] } { + set hilimit [sct upperlimit] + } else { + # upperlimit not set, use target + set hilimit [sct target] + } +# check_error hook code starts + if { [hpropexists [sct] driving] } { + if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { + set my_state [hval ${tc_root}/magnet/state] + if {${my_state} != "IDLE"} { + error "Cannot run/drive in state '${my_state}', must be 'IDLE'" + } + } else { + error "Use run/drive and not hset" + } + } +# check_error hook code ends + if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } { + error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]" + } + return OK + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# checklimits function for driveable interface +proc ::scobj::oxford10tlv::checklimits {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "checklimits tc_root=${tc_root} sct=[sct] target=[sct target]" + set setpoint [sct target] + if { [hpropexists [sct] lowerlimit] } { + set lolimit [sct lowerlimit] + } else { + # lowerlimit not set, use target + set lolimit [sct target] + } + if { [hpropexists [sct] upperlimit] } { + set hilimit [sct upperlimit] + } else { + # upperlimit not set, use target + set hilimit [sct target] + } +# checklimits hook code goes here + if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } { + sct driving 0 + error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]" + } + return OK + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# check function for hset change +proc ::scobj::oxford10tlv::checkrange {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "checkrange tc_root=${tc_root} sct=[sct] target=[sct target]" + set setpoint [sct target] + if { [hpropexists [sct] lowerlimit] } { + set lolimit [sct lowerlimit] + } else { + # lowerlimit not set, use target + set lolimit [sct target] + } + if { [hpropexists [sct] upperlimit] } { + set hilimit [sct upperlimit] + } else { + # upperlimit not set, use target + set hilimit [sct target] + } +# checkrange hook code goes here + if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } { + error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]" + } + return OK + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# checkstatus function for driveable interface +proc ::scobj::oxford10tlv::checkstatus {tc_root} { + set catch_status [ catch { +# checkstatus hook code goes here + if {[sct driving]} { + set sp "[sct target]" + if {[hpropexists [sct] simulated] && [sct simulated] == "true"} { + set pv "${sp}" + hupdateif ${tc_root}/[sct driveable] ${sp} + } else { + set pv "[hval ${tc_root}/[sct driveable]]" + } + if { abs(${pv} - ${sp}) <= [sct tolerance] } { + if { [hpropexists [sct] settle_time] } { + if { [hpropexists [sct] settle_time_start] } { + if { [sct utime] - [sct settle_time_start] >= [sct settle_time]} { + sct driving 0 + return "idle" + } + return "busy" + } else { + sct utime settle_time_start + return "busy" + } + } + sct driving 0 + return "idle" + } + if { [hpropexists [sct] settle_time_start] } { + hdelprop [sct] settle_time_start + } + return "busy" + } else { + return "idle" + } + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to request the read of a parameter on a device +proc ::scobj::oxford10tlv::fetch_state {tc_root nextState cmd_str} { + set catch_status [ catch { + debug_log ${tc_root} 1 "fetch_state tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set cmd "${cmd_str}" +# fetch_state hook code starts + set my_state [hval [sct]] + set cmd "@@NOSEND@@" + if {${my_state} == "START"} { + set cmd "setHS ON\r\n@@NOREPLY@@" + sct utime start_time + hupdate [sct] "HTRON" + } elseif {${my_state} == "HTRON"} { + if {[hpropexists [sct] htron_delay]} { + set htron_delay [sct htron_delay] + if {$htron_delay < 10} { + set htron_delay 30 + } elseif {$htron_delay > 60} { + set htron_delay 30 + } + } else { + set htron_delay 30 + } + if {[sct utime] - [sct start_time] > $htron_delay} { + set cmd "setF [hval ${tc_root}/magnet/setpoint]\r\n@@NOREPLY@@" + hupdate [sct] "DRIVE" + } else { + set nextState "idle" + } + } elseif {${my_state} == "DRIVE"} { + if {[hgetpropval ${tc_root}/magnet/setpoint driving] == 0} { + set cmd "setHS OFF\r\n@@NOREPLY@@" + sct utime start_time + hupdate [sct] "HTROFF" + } else { + set nextState "idle" + } + } elseif {${my_state} == "HTROFF"} { + if {[hpropexists [sct] htroff_delay]} { + set htroff_delay [sct htroff_delay] + if {$htroff_delay <= 10} { + set htroff_delay 30 + } elseif {$htroff_delay >= 60} { + set htroff_delay 30 + } + } else { + set htroff_delay 30 + } + if {[sct utime] - [sct start_time] > $htroff_delay} { + hupdate [sct] "IDLE" + } else { + set nextState "idle" + } + } elseif {${my_state} == "IDLE"} { + set nextState "idle" + } +# fetch_state hook code ends + if { [hpropexists [sct] geterror] } { + debug_log ${tc_root} 9 "[sct] error: [sct geterror]" + error "[sct geterror]" + } + debug_log ${tc_root} 1 "fetch_state sct send ${cmd}" + if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { + sct send "${cmd}" + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to request the read of a parameter on a device +proc ::scobj::oxford10tlv::getValue {tc_root nextState cmd_str} { + set catch_status [ catch { + debug_log ${tc_root} 1 "getValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set cmd "${cmd_str}" +# getValue hook code goes here + debug_log ${tc_root} 1 "getValue sct send ${cmd}" + if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { + sct send "${cmd}" + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# halt function for driveable interface +proc ::scobj::oxford10tlv::halt {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "halt tc_root=${tc_root} sct=[sct] driving=[sct driving]" + ### TODO hset [sct] [hval [sct]] +# halt hook code goes here + sct driving 0 + return "idle" + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to check the write parameter on a device +proc ::scobj::oxford10tlv::noResponse {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "noResponse tc_root=${tc_root} sct=[sct] resp=[sct result]" +# noResponse hook code goes here + return "idle" + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to parse the read of a parameter on a device +proc ::scobj::oxford10tlv::rdValue {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "rdValue tc_root=${tc_root} sct=[sct] result=[sct result]" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set data [sct result] + set nextState "idle" + if {[string equal -nocase -length 7 ${data} "ASCERR:"]} { + # the protocol driver has reported an error + sct geterror "${data}" + error "[sct geterror]" + } +# rdValue hook code goes here + if { ${data} != [sct oldval] } { + debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]" + sct oldval ${data} + sct update ${data} + sct utime readtime + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to parse the read of a parameter on a device +proc ::scobj::oxford10tlv::read_field {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "read_field tc_root=${tc_root} sct=[sct] result=[sct result]" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set data [sct result] + set nextState "idle" + if {[string equal -nocase -length 7 ${data} "ASCERR:"]} { + # the protocol driver has reported an error + sct geterror "${data}" + error "[sct geterror]" + } +# read_field hook code starts + set s1 [string trimright [sct result] "\n"] + set s2 [split $s1 ";"] + if {[llength $s2] > 1} { + if {[string equal -nocase -length 14 "Field_Current=" [lindex $s2 0]]} { + #hupdateif ${tc_root}/magnet/current [string range [lindex $s2 0] 14 end] + set current [string range [lindex $s2 0] 14 end] + hsetprop ${tc_root}/magnet/current result ${current} + set ns [namespace current] + sct with ${tc_root}/magnet/current "${ns}::rdValue ${tc_root}" + } + if {[string equal -nocase -length 12 "Field_Tesla=" [lindex $s2 1]]} { + set data [string range [lindex $s2 1] 12 end] + } + } +# read_field hook code ends + if { [hpropexists [sct] geterror] } { + debug_log ${tc_root} 9 "[sct] error: [sct geterror]" + error "[sct geterror]" + } + if { ${data} != [sct oldval] } { + debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]" + sct oldval ${data} + sct update ${data} + sct utime readtime + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to parse the read of a parameter on a device +proc ::scobj::oxford10tlv::read_heater {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "read_heater tc_root=${tc_root} sct=[sct] result=[sct result]" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set data [sct result] + set nextState "idle" + if {[string equal -nocase -length 7 ${data} "ASCERR:"]} { + # the protocol driver has reported an error + sct geterror "${data}" + error "[sct geterror]" + } +# read_heater hook code goes here + if { ${data} != [sct oldval] } { + debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]" + sct oldval ${data} + sct update ${data} + sct utime readtime + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to parse the read of a parameter on a device +proc ::scobj::oxford10tlv::read_rate {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "read_rate tc_root=${tc_root} sct=[sct] result=[sct result]" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set data [sct result] + set nextState "idle" + if {[string equal -nocase -length 7 ${data} "ASCERR:"]} { + # the protocol driver has reported an error + sct geterror "${data}" + error "[sct geterror]" + } +# read_rate hook code goes here + if { ${data} != [sct oldval] } { + debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]" + sct oldval ${data} + sct update ${data} + sct utime readtime + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to parse the read of a parameter on a device +proc ::scobj::oxford10tlv::read_state {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "read_state tc_root=${tc_root} sct=[sct] result=[sct result]" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set data [sct result] + set nextState "idle" + if {[string equal -nocase -length 7 ${data} "ASCERR:"]} { + # the protocol driver has reported an error + sct geterror "${data}" + error "[sct geterror]" + } +# read_state hook code starts + return "idle" +# read_state hook code ends + if { [hpropexists [sct] geterror] } { + debug_log ${tc_root} 9 "[sct] error: [sct geterror]" + error "[sct geterror]" + } + if { ${data} != [sct oldval] } { + debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]" + sct oldval ${data} + sct update ${data} + sct utime readtime + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to write a parameter value on a device +proc ::scobj::oxford10tlv::setValue {tc_root nextState cmd_str} { + set catch_status [ catch { + debug_log ${tc_root} 1 "setValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set par [sct target] + set cmd "${cmd_str}${par}" +# setValue hook code goes here + if { [hpropexists [sct] driving] } { + if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { + sct driving 1 + } + } + debug_log ${tc_root} 1 "setValue sct send ${cmd}" + if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { + sct send "${cmd}" + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to write a parameter value on a device +proc ::scobj::oxford10tlv::write_heater {tc_root nextState cmd_str} { + set catch_status [ catch { + debug_log ${tc_root} 1 "write_heater tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set par [sct target] + set cmd "${cmd_str}${par}" +# write_heater hook code starts + if {${par} == 0} { + set cmd "setHS OFF\r\n@@NOREPLY@@" + } elseif {${par} == 1} { + set cmd "setHS ON\r\n@@NOREPLY@@" + } else { + error "Invalid parameter '${par}' should be 0 or 1" + } + # Invoke the read function to set the value as if read back + sct result $par + read_heater ${tc_root} +# write_heater hook code ends + if { [hpropexists [sct] geterror] } { + debug_log ${tc_root} 9 "[sct] error: [sct geterror]" + error "[sct geterror]" + } + if { [hpropexists [sct] driving] } { + if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { + sct driving 1 + } + } + debug_log ${tc_root} 1 "write_heater sct send ${cmd}" + if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { + sct send "${cmd}" + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to write a parameter value on a device +proc ::scobj::oxford10tlv::write_rate {tc_root nextState cmd_str} { + set catch_status [ catch { + debug_log ${tc_root} 1 "write_rate tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set par [sct target] + set cmd "${cmd_str}${par}" +# write_rate hook code starts + if {${par} >= 0 && ${par} <= 10} { + set cmd "setR ${par}\r\n@@NOREPLY@@" + } else { + error "Invalid parameter '${par}' should be 0 to 10" + } + # Invoke the read function to set the value as if read back + sct result $par + read_rate ${tc_root} +# write_rate hook code ends + if { [hpropexists [sct] geterror] } { + debug_log ${tc_root} 9 "[sct] error: [sct geterror]" + error "[sct geterror]" + } + if { [hpropexists [sct] driving] } { + if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { + sct driving 1 + } + } + debug_log ${tc_root} 1 "write_rate sct send ${cmd}" + if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { + sct send "${cmd}" + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to write a parameter value on a device +proc ::scobj::oxford10tlv::write_setpoint {tc_root nextState cmd_str} { + set catch_status [ catch { + debug_log ${tc_root} 1 "write_setpoint tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set par [sct target] + set cmd "${cmd_str}${par}" +# write_setpoint hook code starts + hset ${tc_root}/magnet/state "START" + # Force the driving flag for the state check + sct driving 1 + # Set the value on the field + hupdateif [sct] $par + # It's all over now + set cmd "@@NOSEND@@" + set nextState "idle" +# write_setpoint hook code ends + if { [hpropexists [sct] geterror] } { + debug_log ${tc_root} 9 "[sct] error: [sct geterror]" + error "[sct geterror]" + } + if { [hpropexists [sct] driving] } { + if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { + sct driving 1 + } + } + debug_log ${tc_root} 1 "write_setpoint sct send ${cmd}" + if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { + sct send "${cmd}" + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +proc ::scobj::oxford10tlv::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id datype interval } { + ::scobj::oxford10tlv::sics_log 9 "::scobj::oxford10tlv::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${interval}" + set ns "[namespace current]" + set catch_status [ catch { + + MakeSICSObj ${name} SCT_OBJECT + + sicslist setatt ${name} driver oxford10tlv + sicslist setatt ${name} klass ${device_class} + sicslist setatt ${name} long_name ${name} + + set scobj_hpath /sics/${name} + + hfactory ${scobj_hpath}/magnet plain spy none + + hfactory ${scobj_hpath}/magnet/current plain user float + hsetprop ${scobj_hpath}/magnet/current control true + hsetprop ${scobj_hpath}/magnet/current data true + hsetprop ${scobj_hpath}/magnet/current mutable true + hsetprop ${scobj_hpath}/magnet/current nxsave true + hsetprop ${scobj_hpath}/magnet/current oldval 0.0 + hsetprop ${scobj_hpath}/magnet/current klass "parameter" + hsetprop ${scobj_hpath}/magnet/current sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/magnet/current type "part" + hsetprop ${scobj_hpath}/magnet/current nxalias "${name}_magnet_current" + + hfactory ${scobj_hpath}/magnet/field plain user float + hsetprop ${scobj_hpath}/magnet/field read ${ns}::getValue ${scobj_hpath} read_field {getF} + hsetprop ${scobj_hpath}/magnet/field read_field ${ns}::read_field ${scobj_hpath} + hsetprop ${scobj_hpath}/magnet/field control true + hsetprop ${scobj_hpath}/magnet/field data true + hsetprop ${scobj_hpath}/magnet/field mutable true + hsetprop ${scobj_hpath}/magnet/field nxsave true + hsetprop ${scobj_hpath}/magnet/field oldval 0.0 + hsetprop ${scobj_hpath}/magnet/field klass "parameter" + hsetprop ${scobj_hpath}/magnet/field sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/magnet/field type "part" + hsetprop ${scobj_hpath}/magnet/field nxalias "${name}_magnet_field" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/magnet/field 5 + hsetprop ${scobj_hpath}/magnet/field simulated false + } else { + ::scobj::oxford10tlv::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford10tlv" + hsetprop ${scobj_hpath}/magnet/field simulated true + } + + hfactory ${scobj_hpath}/magnet/htr_sw plain user int + hsetprop ${scobj_hpath}/magnet/htr_sw write ${ns}::write_heater ${scobj_hpath} noResponse {} + hsetprop ${scobj_hpath}/magnet/htr_sw noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/magnet/htr_sw check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/magnet/htr_sw control true + hsetprop ${scobj_hpath}/magnet/htr_sw data true + hsetprop ${scobj_hpath}/magnet/htr_sw mutable true + hsetprop ${scobj_hpath}/magnet/htr_sw nxsave true + hsetprop ${scobj_hpath}/magnet/htr_sw values 0,1 + hsetprop ${scobj_hpath}/magnet/htr_sw oldval 0 + hsetprop ${scobj_hpath}/magnet/htr_sw klass "parameter" + hsetprop ${scobj_hpath}/magnet/htr_sw sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/magnet/htr_sw type "part" + hsetprop ${scobj_hpath}/magnet/htr_sw nxalias "${name}_magnet_htr_sw" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} write ${scobj_hpath}/magnet/htr_sw + hsetprop ${scobj_hpath}/magnet/htr_sw simulated false + } else { + ::scobj::oxford10tlv::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford10tlv" + hsetprop ${scobj_hpath}/magnet/htr_sw simulated true + } + + hfactory ${scobj_hpath}/magnet/rate plain user float + hsetprop ${scobj_hpath}/magnet/rate write ${ns}::write_rate ${scobj_hpath} noResponse {} + hsetprop ${scobj_hpath}/magnet/rate noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/magnet/rate check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/magnet/rate control true + hsetprop ${scobj_hpath}/magnet/rate data true + hsetprop ${scobj_hpath}/magnet/rate mutable true + hsetprop ${scobj_hpath}/magnet/rate nxsave true + hsetprop ${scobj_hpath}/magnet/rate oldval 0.0 + hsetprop ${scobj_hpath}/magnet/rate klass "parameter" + hsetprop ${scobj_hpath}/magnet/rate sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/magnet/rate type "part" + hsetprop ${scobj_hpath}/magnet/rate nxalias "${name}_magnet_rate" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} write ${scobj_hpath}/magnet/rate + hsetprop ${scobj_hpath}/magnet/rate simulated false + } else { + ::scobj::oxford10tlv::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford10tlv" + hsetprop ${scobj_hpath}/magnet/rate simulated true + } + + hfactory ${scobj_hpath}/magnet/setpoint plain user float + hsetprop ${scobj_hpath}/magnet/setpoint write ${ns}::write_setpoint ${scobj_hpath} noResponse {} + hsetprop ${scobj_hpath}/magnet/setpoint noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/magnet/setpoint check ${ns}::check_error ${scobj_hpath} + hsetprop ${scobj_hpath}/magnet/setpoint driving 0 + hsetprop ${scobj_hpath}/magnet/setpoint checklimits ${ns}::checklimits ${scobj_hpath} + hsetprop ${scobj_hpath}/magnet/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath} + hsetprop ${scobj_hpath}/magnet/setpoint halt ${ns}::halt ${scobj_hpath} + hsetprop ${scobj_hpath}/magnet/setpoint driveable magnet/field + hsetprop ${scobj_hpath}/magnet/setpoint control true + hsetprop ${scobj_hpath}/magnet/setpoint data true + hsetprop ${scobj_hpath}/magnet/setpoint mutable true + hsetprop ${scobj_hpath}/magnet/setpoint nxsave true + hsetprop ${scobj_hpath}/magnet/setpoint lowerlimit -10 + hsetprop ${scobj_hpath}/magnet/setpoint upperlimit 10 + hsetprop ${scobj_hpath}/magnet/setpoint tolerance 0.01 + hsetprop ${scobj_hpath}/magnet/setpoint oldval 0.0 + hsetprop ${scobj_hpath}/magnet/setpoint klass "parameter" + hsetprop ${scobj_hpath}/magnet/setpoint sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/magnet/setpoint settle_time "30" + hsetprop ${scobj_hpath}/magnet/setpoint type "drivable" + hsetprop ${scobj_hpath}/magnet/setpoint nxalias "${name}_magnet_setpoint" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} write ${scobj_hpath}/magnet/setpoint + hsetprop ${scobj_hpath}/magnet/setpoint simulated false + } else { + ::scobj::oxford10tlv::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford10tlv" + hsetprop ${scobj_hpath}/magnet/setpoint simulated true + } + + hfactory ${scobj_hpath}/magnet/state plain user text + hsetprop ${scobj_hpath}/magnet/state read ${ns}::fetch_state ${scobj_hpath} read_state {} + hsetprop ${scobj_hpath}/magnet/state read_state ${ns}::read_state ${scobj_hpath} + hsetprop ${scobj_hpath}/magnet/state control true + hsetprop ${scobj_hpath}/magnet/state data false + hsetprop ${scobj_hpath}/magnet/state mutable false + hsetprop ${scobj_hpath}/magnet/state nxsave false + hsetprop ${scobj_hpath}/magnet/state oldval IDLE + hset ${scobj_hpath}/magnet/state IDLE + hsetprop ${scobj_hpath}/magnet/state htroff_delay "10" + hsetprop ${scobj_hpath}/magnet/state htron_delay "10" + hsetprop ${scobj_hpath}/magnet/state sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/magnet/state type "part" + hsetprop ${scobj_hpath}/magnet/state nxalias "${name}_magnet_state" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/magnet/state 1 + hsetprop ${scobj_hpath}/magnet/state simulated false + } else { + ::scobj::oxford10tlv::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford10tlv" + hsetprop ${scobj_hpath}/magnet/state simulated true + } + hsetprop ${scobj_hpath}/magnet data "true" + hsetprop ${scobj_hpath}/magnet klass "@none" + hsetprop ${scobj_hpath}/magnet type "part" + ansto_makesctdrive ${name}_magnet_setpoint ${scobj_hpath}/magnet/setpoint ${scobj_hpath}/magnet/field ${sct_controller} + hsetprop ${scobj_hpath} driver oxford10tlv + hsetprop ${scobj_hpath} klass ${device_class} + hsetprop ${scobj_hpath} data true + hsetprop ${scobj_hpath} debug_threshold 5 +# mkDriver hook code goes here + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +proc ::scobj::oxford10tlv::add_driver {name device_class simulation_flag ip_address tcp_port id datype interval} { + set catch_status [ catch { + ::scobj::oxford10tlv::sics_log 9 "::scobj::oxford10tlv::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${interval}" + if {[string equal -nocase "${simulation_flag}" "false"]} { + if {[string equal -nocase "aqadapter" "${ip_address}"]} { + ::scobj::oxford10tlv::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" + makesctcontroller sct_${name} aqadapter ${tcp_port} + } else { + ::scobj::oxford10tlv::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}" + makesctcontroller sct_${name} std ${ip_address}:${tcp_port} + } + } else { + ::scobj::oxford10tlv::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for oxford10tlv" + ::scobj::oxford10tlv::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL + } + ::scobj::oxford10tlv::sics_log 1 "::scobj::oxford10tlv::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${interval}" + ::scobj::oxford10tlv::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${interval} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +namespace eval ::scobj::oxford10tlv { + namespace export debug_threshold + namespace export debug_log + namespace export sics_log + namespace export mkDriver + namespace export add_driver +} + +proc add_oxford10tlv {name ip_address tcp_port id datype interval} { + set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" + ::scobj::oxford10tlv::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${interval} +} + +clientput "file evaluation of sct_oxford10tlv.tcl" +::scobj::oxford10tlv::sics_log 9 "file evaluation of sct_oxford10tlv.tcl" + +proc ::scobj::oxford10tlv::read_config {} { + set catch_status [ catch { + set ns "::scobj::oxford10tlv" + dict for {k u} $::config_dict { + if { [dict exists $u "implementation"] } { + set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" + set device_class "environment" + if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { + continue + } + set enabled [string tolower [dict get $u "enabled"]] + if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { + continue + } + if { [dict exists $u "simulation_group"] } { + set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]] + } + if { [dict exists $u "device_class"] } { + set device_class "[dict get $u "device_class"]" + } + set name [dict get $u name] + set implementation [dict get $u "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"] "oxford10tlv"] } { + if { ![string equal -nocase "${simulation_flag}" "false"] } { + set asyncqueue "null" + ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue" + ${ns}::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL + } elseif { [dict exists $v "asyncqueue"] } { + set asyncqueue [dict get $v "asyncqueue"] + if { [string equal -nocase ${asyncqueue} "sct"] } { + set ip_address [dict get $v ip] + set tcp_port [dict get $v port] + makesctcontroller sct_${name} std ${ip_address}:${tcp_port} + } else { + makesctcontroller sct_${name} aqadapter ${asyncqueue} + } + } else { + if { [dict exists $v "asyncprotocol"] } { + set asyncprotocol [dict get $v "asyncprotocol"] + } else { + set asyncprotocol ${name}_protocol + MakeAsyncProtocol ${asyncprotocol} + if { [dict exists $v "sendterminator"] } { + ${asyncprotocol} sendterminator "[dict get $v "sendterminator"]" + } elseif { [dict exists $v "terminator"] } { + ${asyncprotocol} sendterminator "[dict get $v "terminator"]" + } + if { [dict exists $v "replyterminator"] } { + ${asyncprotocol} replyterminator "[dict get $v "replyterminator"]" + } elseif { [dict exists $v "terminator"] } { + ${asyncprotocol} replyterminator "[dict get $v "terminator"]" + } + } + set asyncqueue ${name}_queue + set ip_address [dict get $v ip] + set tcp_port [dict get $v port] + MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${ip_address} ${tcp_port} + if { [dict exists $v "timeout"] } { + ${asyncqueue} timeout "[dict get $v "timeout"]" + } + makesctcontroller sct_${name} aqadapter ${asyncqueue} + } + set arg_list [list] + set missing_list [list] + foreach arg {id datype interval} { + if {[dict exists $u $arg]} { + lappend arg_list "[dict get $u $arg]" + } elseif {[dict exists $v $arg]} { + lappend arg_list "[dict get $v $arg]" + } else { + ${ns}::sics_log 9 "Missing configuration value $arg" + lappend missing_list $arg + } + } + if { [llength $missing_list] > 0 } { + error "$name is missing configuration values $missing_list" + } + ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list + } + } + } + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +if { [info exists ::config_dict] } { + ::scobj::oxford10tlv::read_config +} else { + ::scobj::oxford10tlv::sics_log 5 "No config dict" +} From 22bb6122969899b0b8722c429669af112a69f29f Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Mon, 16 Feb 2015 12:36:12 +1100 Subject: [PATCH 06/22] Fake device for Oxford LabView testing --- .../instrument/TEST_SICS/fakeOLV/FakeOLV.py | 124 ++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100755 site_ansto/instrument/TEST_SICS/fakeOLV/FakeOLV.py diff --git a/site_ansto/instrument/TEST_SICS/fakeOLV/FakeOLV.py b/site_ansto/instrument/TEST_SICS/fakeOLV/FakeOLV.py new file mode 100755 index 00000000..52363069 --- /dev/null +++ b/site_ansto/instrument/TEST_SICS/fakeOLV/FakeOLV.py @@ -0,0 +1,124 @@ +#!/usr/bin/python +# vim: ft=python ts=8 sts=4 sw=4 et autoindent smartindent nocindent +# author: Douglas Clowes (douglas.clowes@ansto.gov.au) 2015 +''' + Fake Oxford LabView program for the 10/12 Tesla magnet driver +''' + +from twisted.internet import reactor, protocol +from twisted.internet.task import LoopingCall + +devices = [] + +class FakeOLV(protocol.Protocol): + '''Fake Oxford Labview Protocol Object''' + def __init__(self): + self.setpoint = 0.0 + self.field = 0.0 + self.rate = 0.0 + self.hsw = 0 + self.t_1 = 120.0 + self.t_2 = 120.0 + self.t_3 = 120.0 + self.dsp = 0.0 + self.dpv = 0.0 + self.hsp = 0.0 + self.hpv = 0.0 + + def dataReceived(self, data): + print "RECEIVED ", data + reply = "" + cmd_pars = data.split() + if len(cmd_pars) < 1: + return + cmd = cmd_pars[0].lower() + if cmd.startswith("set"): + reply = self.set_command(cmd, cmd_pars) + elif cmd.startswith("get"): + reply = self.get_command(cmd) + else: + reply = "Error Command!" + print "REPLY ", reply + self.transport.write(reply + "\r\n") + + def set_command(self, cmd, cmd_pars): + '''Execute a setXX command''' + reply = "" + if len(cmd_pars) < 2: + reply = "Error Command!" + elif cmd == "setr": + self.rate = float(cmd_pars[1]) + elif cmd == "seths": + if cmd_pars[1].lower() == "on": + self.hsw = 1 + if cmd_pars[1].lower() == "off": + self.hsw = 0 + elif cmd == "sethelioxtemp": + self.hsp = float(cmd_pars[1]) + elif cmd == "setdiluttemp": + self.dsp = float(cmd_pars[1]) + elif cmd == "setf": + self.setpoint = float(cmd_pars[1]) + else: + reply = "Error Command!" + return reply + + def get_command(self, cmd): + '''Execute a getXX command''' + reply = "" + if cmd == "getf": + current = self.field * 10.0 + reply = "Field_Current=%.6f;" % current + reply += "Field_Tesla=%.6f" % self.field + elif cmd == "gett": + reply = "T1=120.000000;T2=120.000000;T3=120.000000" + elif cmd == "gethelioxtemp": + reply = "Temp=0.000000;SetPoint=0.000000 Cdeg" + elif cmd == "getdilutiontemp": + reply = "Temp=0.000000;SetPoint=0.000000" + else: + reply = "Error Command!" + return reply + + def iterate(self): + '''Iterate the setpoints''' + if abs(self.field - self.setpoint) > 0.01: + self.field += 0.1 * (self.setpoint - self.field) + else: + self.field = self.setpoint + if abs(self.dsp - self.dpv) > 0.01: + self.dpv += 0.1 * (self.dsp - self.dpv) + else: + self.dpv = self.dsp + if abs(self.hsp - self.hpv) > 0.01: + self.hpv += 0.1 * (self.hsp - self.hpv) + else: + self.hpv = self.hsp + + def connectionMade(self): + '''Add this new connection to the list of devices''' + print "connectionMade" + devices.append(self) + + def connectionLost(self, reason): + '''Drop this old connection from the list of devices''' + print "connectionLost" + devices.remove(self) + +def device_iterator(): + '''Iterate over all connected devices and do them''' + #print "device_iterator" + for dev in devices: + dev.iterate() + +def main(): + '''Main program''' + dev_iter = LoopingCall(device_iterator) + dev_iter.start(1.0) + factory = protocol.ServerFactory() + factory.protocol = FakeOLV + reactor.listenTCP(55001, factory) + reactor.run() + +if __name__ == "__main__": + main() From f80bec1403336af60e11f1521b743fe7a005696e Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Mon, 16 Feb 2015 12:38:02 +1100 Subject: [PATCH 07/22] Changes to get and set the field coil values --- .../config/beamline/he3_polanal.sct | 80 +++++++++++++++++-- 1 file changed, 75 insertions(+), 5 deletions(-) diff --git a/site_ansto/instrument/config/beamline/he3_polanal.sct b/site_ansto/instrument/config/beamline/he3_polanal.sct index 5352068d..7d48a708 100644 --- a/site_ansto/instrument/config/beamline/he3_polanal.sct +++ b/site_ansto/instrument/config/beamline/he3_polanal.sct @@ -3,7 +3,7 @@ driver he3_polanal = { protocol = std; class = instrument; simulation_group = rfgen_simulation; - make_args = '{has_pol true} {has_anal true}'; + make_args = '{has_pol true} {has_anal true} {has_coil false}'; group polariser = { conditional = '[string equal -nocase ${has_pol} "true"]'; @@ -11,7 +11,7 @@ driver he3_polanal = { var spin = { readable = 900; read_command = 'polariser'; - read_function = rdValue; + read_function = read_spin; writeable = 1; write_command = 'polariser'; check_function = chkWrite; @@ -42,7 +42,7 @@ driver he3_polanal = { var spin = { readable = 900; read_command = 'analyser'; - read_function = rdValue; + read_function = read_spin; writeable = 1; write_command = 'analyser'; check_function = chkWrite; @@ -67,12 +67,82 @@ driver he3_polanal = { var timestamp = { type = int; } } + group magnet = { + conditional = '[string equal -nocase ${has_coil} "true"]'; + type = float; + group sense = { + var x_voltage = {} + var x_current = {} + var y_voltage = {} + var y_current = {} + var z_voltage = {} + var z_current = {} + var sense = { + type = int; data = false; mutable = false; nxsave = false; + readable = 30; + read_command = 'magnet_xyz'; + read_function = read_magnet; + writeable = 1; + write_function = fetch_magnet; + write_command = 'magnet_xyz'; + } + } + group setpoint = { + var x_current_sp = {} + var y_current_sp = {} + var z_current_sp = {} + var store = { + type = int; data = false; mutable = false; nxsave = false; + writeable = 1; + write_function = write_magnet; + write_command = 'magnet_xyz'; + } + } + } + + code read_magnet = { + @TCL + set dlist [split [string trim ${data}]] + if {[llength $dlist] != 7} { + error "Syntax error: '${data}'" + } + set index 1 + set path [pathname [sct]] + set ns [namespace current] + foreach node {x_voltage x_current y_voltage y_current z_voltage z_current} { + hsetprop ${path}/${node} result [lindex $dlist ${index}] + sct with ${path}/${node} "${ns}::rdValue ${tc_root}" + incr index + } + set data 0 + @END + } + + code fetch_magnet = { + @TCL + # Just do a fetch and go on to the read state + set cmd "${cmd_str}" + set nextState "read_magnet" + @END + } + + code write_magnet = { + @TCL + # Just do a fetch and go on to the read state + set path [pathname [sct]] + set cmd "${cmd_str}" + set cmd "${cmd} [hval ${path}/x_current_sp]" + set cmd "${cmd} [hval ${path}/y_current_sp]" + set cmd "${cmd} [hval ${path}/z_current_sp]" + @END + } + code chkWrite = {%% - [namespace current]::rdValue ${tc_root} + [namespace current]::read_spin ${tc_root} clientput [sct result] %%} - code rdValue = {%% + code read_spin = {%% set dlist [split [string trim ${data}]] if {[llength ${dlist}] < 2} { sct geterror "Syntax Error: '${data}'" From cad4f64dcc517b1f4a3daeaaff4db0a89095d395 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Mon, 16 Feb 2015 12:38:43 +1100 Subject: [PATCH 08/22] Regenerate the 3He driver for the coils --- .../config/beamline/sct_he3_polanal.tcl | 326 +++++++++++++++++- 1 file changed, 312 insertions(+), 14 deletions(-) diff --git a/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl b/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl index 336a503f..f838962b 100644 --- a/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl +++ b/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl @@ -72,7 +72,7 @@ proc ::scobj::he3_polanal::chkWrite {tc_root} { set catch_status [ catch { debug_log ${tc_root} 1 "chkWrite tc_root=${tc_root} sct=[sct] resp=[sct result]" # chkWrite hook code starts - [namespace current]::rdValue ${tc_root} + [namespace current]::read_spin ${tc_root} clientput [sct result] # chkWrite hook code ends return "idle" @@ -80,6 +80,38 @@ proc ::scobj::he3_polanal::chkWrite {tc_root} { handle_exception ${catch_status} ${catch_message} } +# function to write a parameter value on a device +proc ::scobj::he3_polanal::fetch_magnet {tc_root nextState cmd_str} { + set catch_status [ catch { + debug_log ${tc_root} 1 "fetch_magnet tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set par [sct target] + set cmd "${cmd_str}${par}" +# fetch_magnet hook code starts + # Just do a fetch and go on to the read state + set cmd "${cmd_str}" + set nextState "read_magnet" +# fetch_magnet hook code ends + if { [hpropexists [sct] geterror] } { + debug_log ${tc_root} 9 "[sct] error: [sct geterror]" + error "[sct geterror]" + } + if { [hpropexists [sct] driving] } { + if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { + sct driving 1 + } + } + debug_log ${tc_root} 1 "fetch_magnet sct send ${cmd}" + if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { + sct send "${cmd}" + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + # function to request the read of a parameter on a device proc ::scobj::he3_polanal::getValue {tc_root nextState cmd_str} { set catch_status [ catch { @@ -122,7 +154,77 @@ proc ::scobj::he3_polanal::rdValue {tc_root} { sct geterror "${data}" error "[sct geterror]" } -# rdValue hook code starts +# rdValue hook code goes here + if { ${data} != [sct oldval] } { + debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]" + sct oldval ${data} + sct update ${data} + sct utime readtime + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to parse the read of a parameter on a device +proc ::scobj::he3_polanal::read_magnet {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "read_magnet tc_root=${tc_root} sct=[sct] result=[sct result]" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set data [sct result] + set nextState "idle" + if {[string equal -nocase -length 7 ${data} "ASCERR:"]} { + # the protocol driver has reported an error + sct geterror "${data}" + error "[sct geterror]" + } +# read_magnet hook code starts + set dlist [split [string trim ${data}]] + if {[llength $dlist] != 7} { + error "Syntax error: '${data}'" + } + set index 1 + set path [pathname [sct]] + set ns [namespace current] + foreach node {x_voltage x_current y_voltage y_current z_voltage z_current} { + hsetprop ${path}/${node} result [lindex $dlist ${index}] + sct with ${path}/${node} "${ns}::rdValue ${tc_root}" + incr index + } + set data 0 +# read_magnet hook code ends + if { [hpropexists [sct] geterror] } { + debug_log ${tc_root} 9 "[sct] error: [sct geterror]" + error "[sct geterror]" + } + if { ${data} != [sct oldval] } { + debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]" + sct oldval ${data} + sct update ${data} + sct utime readtime + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to parse the read of a parameter on a device +proc ::scobj::he3_polanal::read_spin {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "read_spin tc_root=${tc_root} sct=[sct] result=[sct result]" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set data [sct result] + set nextState "idle" + if {[string equal -nocase -length 7 ${data} "ASCERR:"]} { + # the protocol driver has reported an error + sct geterror "${data}" + error "[sct geterror]" + } +# read_spin hook code starts set dlist [split [string trim ${data}]] if {[llength ${dlist}] < 2} { sct geterror "Syntax Error: '${data}'" @@ -148,7 +250,7 @@ proc ::scobj::he3_polanal::rdValue {tc_root} { [namespace current]::do_update ${path}/time2 ${dlist} 5 [namespace current]::do_update ${path}/field ${dlist} 6 hupdateif ${path}/timestamp ${timestamp} -# rdValue hook code ends +# read_spin hook code ends if { [hpropexists [sct] geterror] } { debug_log ${tc_root} 9 "[sct] error: [sct geterror]" error "[sct geterror]" @@ -200,8 +302,43 @@ proc ::scobj::he3_polanal::setValue {tc_root nextState cmd_str} { handle_exception ${catch_status} ${catch_message} } -proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port {has_pol true} {has_anal true} } { - ::scobj::he3_polanal::sics_log 9 "::scobj::he3_polanal::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${has_pol} ${has_anal}" +# function to write a parameter value on a device +proc ::scobj::he3_polanal::write_magnet {tc_root nextState cmd_str} { + set catch_status [ catch { + debug_log ${tc_root} 1 "write_magnet tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set par [sct target] + set cmd "${cmd_str}${par}" +# write_magnet hook code starts + # Just do a fetch and go on to the read state + set path [pathname [sct]] + set cmd "${cmd_str}" + set cmd "${cmd} [hval ${path}/x_current_sp]" + set cmd "${cmd} [hval ${path}/y_current_sp]" + set cmd "${cmd} [hval ${path}/z_current_sp]" +# write_magnet hook code ends + if { [hpropexists [sct] geterror] } { + debug_log ${tc_root} 9 "[sct] error: [sct geterror]" + error "[sct geterror]" + } + if { [hpropexists [sct] driving] } { + if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { + sct driving 1 + } + } + debug_log ${tc_root} 1 "write_magnet sct send ${cmd}" + if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { + sct send "${cmd}" + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port {has_pol true} {has_anal true} {has_coil false} } { + ::scobj::he3_polanal::sics_log 9 "::scobj::he3_polanal::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${has_pol} ${has_anal} ${has_coil}" set ns "[namespace current]" set catch_status [ catch { @@ -264,8 +401,8 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/analyser/phase nxalias "${name}_analyser_phase" hfactory ${scobj_hpath}/analyser/spin plain user float - hsetprop ${scobj_hpath}/analyser/spin read ${ns}::getValue ${scobj_hpath} rdValue {analyser} - hsetprop ${scobj_hpath}/analyser/spin rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/analyser/spin read ${ns}::getValue ${scobj_hpath} read_spin {analyser} + hsetprop ${scobj_hpath}/analyser/spin read_spin ${ns}::read_spin ${scobj_hpath} hsetprop ${scobj_hpath}/analyser/spin write ${ns}::setValue ${scobj_hpath} chkWrite {analyser} hsetprop ${scobj_hpath}/analyser/spin chkWrite ${ns}::chkWrite ${scobj_hpath} hsetprop ${scobj_hpath}/analyser/spin check ${ns}::checkrange ${scobj_hpath} @@ -404,6 +541,167 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/analyser_start type "part" } + if {[string equal -nocase ${has_coil} "true"]} { + hfactory ${scobj_hpath}/magnet plain spy none + hsetprop ${scobj_hpath}/magnet data "true" + hsetprop ${scobj_hpath}/magnet klass "@none" + hsetprop ${scobj_hpath}/magnet type "part" + + hfactory ${scobj_hpath}/magnet/sense plain spy none + + hfactory ${scobj_hpath}/magnet/sense/sense plain user int + hsetprop ${scobj_hpath}/magnet/sense/sense read ${ns}::getValue ${scobj_hpath} read_magnet {magnet_xyz} + hsetprop ${scobj_hpath}/magnet/sense/sense read_magnet ${ns}::read_magnet ${scobj_hpath} + hsetprop ${scobj_hpath}/magnet/sense/sense write ${ns}::fetch_magnet ${scobj_hpath} noResponse {magnet_xyz} + hsetprop ${scobj_hpath}/magnet/sense/sense noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/magnet/sense/sense check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/magnet/sense/sense control true + hsetprop ${scobj_hpath}/magnet/sense/sense data false + hsetprop ${scobj_hpath}/magnet/sense/sense mutable false + hsetprop ${scobj_hpath}/magnet/sense/sense nxsave false + hsetprop ${scobj_hpath}/magnet/sense/sense oldval 0 + hsetprop ${scobj_hpath}/magnet/sense/sense sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/magnet/sense/sense type "part" + hsetprop ${scobj_hpath}/magnet/sense/sense nxalias "${name}_magnet_sense_sense" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/magnet/sense/sense 30 + ${sct_controller} write ${scobj_hpath}/magnet/sense/sense + hsetprop ${scobj_hpath}/magnet/sense/sense simulated false + } else { + ::scobj::he3_polanal::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for he3_polanal" + hsetprop ${scobj_hpath}/magnet/sense/sense simulated true + } + + hfactory ${scobj_hpath}/magnet/sense/x_current plain user float + hsetprop ${scobj_hpath}/magnet/sense/x_current control true + hsetprop ${scobj_hpath}/magnet/sense/x_current data true + hsetprop ${scobj_hpath}/magnet/sense/x_current mutable true + hsetprop ${scobj_hpath}/magnet/sense/x_current nxsave true + hsetprop ${scobj_hpath}/magnet/sense/x_current oldval 0.0 + hsetprop ${scobj_hpath}/magnet/sense/x_current klass "parameter" + hsetprop ${scobj_hpath}/magnet/sense/x_current sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/magnet/sense/x_current type "part" + hsetprop ${scobj_hpath}/magnet/sense/x_current nxalias "${name}_magnet_sense_x_current" + + hfactory ${scobj_hpath}/magnet/sense/x_voltage plain user float + hsetprop ${scobj_hpath}/magnet/sense/x_voltage control true + hsetprop ${scobj_hpath}/magnet/sense/x_voltage data true + hsetprop ${scobj_hpath}/magnet/sense/x_voltage mutable true + hsetprop ${scobj_hpath}/magnet/sense/x_voltage nxsave true + hsetprop ${scobj_hpath}/magnet/sense/x_voltage oldval 0.0 + hsetprop ${scobj_hpath}/magnet/sense/x_voltage klass "parameter" + hsetprop ${scobj_hpath}/magnet/sense/x_voltage sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/magnet/sense/x_voltage type "part" + hsetprop ${scobj_hpath}/magnet/sense/x_voltage nxalias "${name}_magnet_sense_x_voltage" + + hfactory ${scobj_hpath}/magnet/sense/y_current plain user float + hsetprop ${scobj_hpath}/magnet/sense/y_current control true + hsetprop ${scobj_hpath}/magnet/sense/y_current data true + hsetprop ${scobj_hpath}/magnet/sense/y_current mutable true + hsetprop ${scobj_hpath}/magnet/sense/y_current nxsave true + hsetprop ${scobj_hpath}/magnet/sense/y_current oldval 0.0 + hsetprop ${scobj_hpath}/magnet/sense/y_current klass "parameter" + hsetprop ${scobj_hpath}/magnet/sense/y_current sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/magnet/sense/y_current type "part" + hsetprop ${scobj_hpath}/magnet/sense/y_current nxalias "${name}_magnet_sense_y_current" + + hfactory ${scobj_hpath}/magnet/sense/y_voltage plain user float + hsetprop ${scobj_hpath}/magnet/sense/y_voltage control true + hsetprop ${scobj_hpath}/magnet/sense/y_voltage data true + hsetprop ${scobj_hpath}/magnet/sense/y_voltage mutable true + hsetprop ${scobj_hpath}/magnet/sense/y_voltage nxsave true + hsetprop ${scobj_hpath}/magnet/sense/y_voltage oldval 0.0 + hsetprop ${scobj_hpath}/magnet/sense/y_voltage klass "parameter" + hsetprop ${scobj_hpath}/magnet/sense/y_voltage sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/magnet/sense/y_voltage type "part" + hsetprop ${scobj_hpath}/magnet/sense/y_voltage nxalias "${name}_magnet_sense_y_voltage" + + hfactory ${scobj_hpath}/magnet/sense/z_current plain user float + hsetprop ${scobj_hpath}/magnet/sense/z_current control true + hsetprop ${scobj_hpath}/magnet/sense/z_current data true + hsetprop ${scobj_hpath}/magnet/sense/z_current mutable true + hsetprop ${scobj_hpath}/magnet/sense/z_current nxsave true + hsetprop ${scobj_hpath}/magnet/sense/z_current oldval 0.0 + hsetprop ${scobj_hpath}/magnet/sense/z_current klass "parameter" + hsetprop ${scobj_hpath}/magnet/sense/z_current sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/magnet/sense/z_current type "part" + hsetprop ${scobj_hpath}/magnet/sense/z_current nxalias "${name}_magnet_sense_z_current" + + hfactory ${scobj_hpath}/magnet/sense/z_voltage plain user float + hsetprop ${scobj_hpath}/magnet/sense/z_voltage control true + hsetprop ${scobj_hpath}/magnet/sense/z_voltage data true + hsetprop ${scobj_hpath}/magnet/sense/z_voltage mutable true + hsetprop ${scobj_hpath}/magnet/sense/z_voltage nxsave true + hsetprop ${scobj_hpath}/magnet/sense/z_voltage oldval 0.0 + hsetprop ${scobj_hpath}/magnet/sense/z_voltage klass "parameter" + hsetprop ${scobj_hpath}/magnet/sense/z_voltage sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/magnet/sense/z_voltage type "part" + hsetprop ${scobj_hpath}/magnet/sense/z_voltage nxalias "${name}_magnet_sense_z_voltage" + hsetprop ${scobj_hpath}/magnet/sense data "true" + hsetprop ${scobj_hpath}/magnet/sense klass "@none" + hsetprop ${scobj_hpath}/magnet/sense type "part" + + hfactory ${scobj_hpath}/magnet/setpoint plain spy none + + hfactory ${scobj_hpath}/magnet/setpoint/store plain user int + hsetprop ${scobj_hpath}/magnet/setpoint/store write ${ns}::write_magnet ${scobj_hpath} noResponse {magnet_xyz} + hsetprop ${scobj_hpath}/magnet/setpoint/store noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/magnet/setpoint/store check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/magnet/setpoint/store control true + hsetprop ${scobj_hpath}/magnet/setpoint/store data false + hsetprop ${scobj_hpath}/magnet/setpoint/store mutable false + hsetprop ${scobj_hpath}/magnet/setpoint/store nxsave false + hsetprop ${scobj_hpath}/magnet/setpoint/store oldval 0 + hsetprop ${scobj_hpath}/magnet/setpoint/store sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/magnet/setpoint/store type "part" + hsetprop ${scobj_hpath}/magnet/setpoint/store nxalias "${name}_magnet_setpoint_store" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} write ${scobj_hpath}/magnet/setpoint/store + hsetprop ${scobj_hpath}/magnet/setpoint/store simulated false + } else { + ::scobj::he3_polanal::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for he3_polanal" + hsetprop ${scobj_hpath}/magnet/setpoint/store simulated true + } + + hfactory ${scobj_hpath}/magnet/setpoint/x_current_sp plain user float + hsetprop ${scobj_hpath}/magnet/setpoint/x_current_sp control true + hsetprop ${scobj_hpath}/magnet/setpoint/x_current_sp data true + hsetprop ${scobj_hpath}/magnet/setpoint/x_current_sp mutable true + hsetprop ${scobj_hpath}/magnet/setpoint/x_current_sp nxsave true + hsetprop ${scobj_hpath}/magnet/setpoint/x_current_sp oldval 0.0 + hsetprop ${scobj_hpath}/magnet/setpoint/x_current_sp klass "parameter" + hsetprop ${scobj_hpath}/magnet/setpoint/x_current_sp sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/magnet/setpoint/x_current_sp type "part" + hsetprop ${scobj_hpath}/magnet/setpoint/x_current_sp nxalias "${name}_magnet_setpoint_x_current_sp" + + hfactory ${scobj_hpath}/magnet/setpoint/y_current_sp plain user float + hsetprop ${scobj_hpath}/magnet/setpoint/y_current_sp control true + hsetprop ${scobj_hpath}/magnet/setpoint/y_current_sp data true + hsetprop ${scobj_hpath}/magnet/setpoint/y_current_sp mutable true + hsetprop ${scobj_hpath}/magnet/setpoint/y_current_sp nxsave true + hsetprop ${scobj_hpath}/magnet/setpoint/y_current_sp oldval 0.0 + hsetprop ${scobj_hpath}/magnet/setpoint/y_current_sp klass "parameter" + hsetprop ${scobj_hpath}/magnet/setpoint/y_current_sp sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/magnet/setpoint/y_current_sp type "part" + hsetprop ${scobj_hpath}/magnet/setpoint/y_current_sp nxalias "${name}_magnet_setpoint_y_current_sp" + + hfactory ${scobj_hpath}/magnet/setpoint/z_current_sp plain user float + hsetprop ${scobj_hpath}/magnet/setpoint/z_current_sp control true + hsetprop ${scobj_hpath}/magnet/setpoint/z_current_sp data true + hsetprop ${scobj_hpath}/magnet/setpoint/z_current_sp mutable true + hsetprop ${scobj_hpath}/magnet/setpoint/z_current_sp nxsave true + hsetprop ${scobj_hpath}/magnet/setpoint/z_current_sp oldval 0.0 + hsetprop ${scobj_hpath}/magnet/setpoint/z_current_sp klass "parameter" + hsetprop ${scobj_hpath}/magnet/setpoint/z_current_sp sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/magnet/setpoint/z_current_sp type "part" + hsetprop ${scobj_hpath}/magnet/setpoint/z_current_sp nxalias "${name}_magnet_setpoint_z_current_sp" + hsetprop ${scobj_hpath}/magnet/setpoint data "true" + hsetprop ${scobj_hpath}/magnet/setpoint klass "@none" + hsetprop ${scobj_hpath}/magnet/setpoint type "part" + } + if {[string equal -nocase ${has_pol} "true"]} { hfactory ${scobj_hpath}/polariser plain spy none @@ -455,8 +753,8 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/polariser/phase nxalias "${name}_polariser_phase" hfactory ${scobj_hpath}/polariser/spin plain user float - hsetprop ${scobj_hpath}/polariser/spin read ${ns}::getValue ${scobj_hpath} rdValue {polariser} - hsetprop ${scobj_hpath}/polariser/spin rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/polariser/spin read ${ns}::getValue ${scobj_hpath} read_spin {polariser} + hsetprop ${scobj_hpath}/polariser/spin read_spin ${ns}::read_spin ${scobj_hpath} hsetprop ${scobj_hpath}/polariser/spin write ${ns}::setValue ${scobj_hpath} chkWrite {polariser} hsetprop ${scobj_hpath}/polariser/spin chkWrite ${ns}::chkWrite ${scobj_hpath} hsetprop ${scobj_hpath}/polariser/spin check ${ns}::checkrange ${scobj_hpath} @@ -605,7 +903,7 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio proc ::scobj::he3_polanal::add_driver {name device_class simulation_flag ip_address tcp_port} { set catch_status [ catch { - ::scobj::he3_polanal::sics_log 9 "::scobj::he3_polanal::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${has_pol} ${has_anal}" + ::scobj::he3_polanal::sics_log 9 "::scobj::he3_polanal::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${has_pol} ${has_anal} ${has_coil}" if {[string equal -nocase "${simulation_flag}" "false"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} { ::scobj::he3_polanal::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" @@ -619,8 +917,8 @@ proc ::scobj::he3_polanal::add_driver {name device_class simulation_flag ip_addr ::scobj::he3_polanal::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" makesctcontroller sct_${name} aqadapter NULL } - ::scobj::he3_polanal::sics_log 1 "::scobj::he3_polanal::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${has_pol} ${has_anal}" - ::scobj::he3_polanal::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${has_pol} ${has_anal} + ::scobj::he3_polanal::sics_log 1 "::scobj::he3_polanal::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${has_pol} ${has_anal} ${has_coil}" + ::scobj::he3_polanal::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${has_pol} ${has_anal} ${has_coil} } catch_message ] handle_exception ${catch_status} ${catch_message} } @@ -721,8 +1019,8 @@ proc ::scobj::he3_polanal::read_config {} { set arg_list [list] set missing_list [list] array unset default_map - array set default_map [list has_pol true has_anal true] - foreach arg {has_pol has_anal} { + array set default_map [list has_pol true has_anal true has_coil false] + foreach arg {has_pol has_anal has_coil} { if {[dict exists $u $arg]} { lappend arg_list "[dict get $u $arg]" } elseif {[dict exists $v $arg]} { From f0bc6f06937a7c3b58cd986a0063894207017b4e Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Wed, 18 Feb 2015 11:54:08 +1100 Subject: [PATCH 09/22] Backport the build command from RELEASE-3_2 --- site_ansto/build | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 site_ansto/build diff --git a/site_ansto/build b/site_ansto/build new file mode 100755 index 00000000..cf12c883 --- /dev/null +++ b/site_ansto/build @@ -0,0 +1,3 @@ +#!/bin/bash +#/usr/bin/time make --debug=b all 2>&1 | tee ${HOME}/build.log +/usr/bin/time make all 2>&1 | tee ${HOME}/build.log From 648c7bf1dddc2adf361cbf75beb623ea88c903d8 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Wed, 18 Feb 2015 12:36:11 +1100 Subject: [PATCH 10/22] Update Quokka configuration file --- site_ansto/instrument/sans/quokka_configuration.tcl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/site_ansto/instrument/sans/quokka_configuration.tcl b/site_ansto/instrument/sans/quokka_configuration.tcl index d558d904..ed6cfcb2 100644 --- a/site_ansto/instrument/sans/quokka_configuration.tcl +++ b/site_ansto/instrument/sans/quokka_configuration.tcl @@ -61,12 +61,16 @@ fileeval $cfPath(hmm)/detector.tcl fileeval $cfPath(scan)/scan.tcl fileeval $cfPath(commands)/commands.tcl fileeval $cfPath(anticollider)/anticollider.tcl -fileeval $cfPath(environment)/temperature/sct_julabo_lh45.tcl +fileeval $cfPath(environment)/temperature/sct_julabo_lh45_gen.tcl fileeval $cfPath(environment)/temperature/sct_qlink.tcl fileeval $cfPath(environment)/magneticField/sct_tsi_smc.tcl fileeval $cfPath(environment)/temperature/sct_oxford_itc.tcl fileeval $cfPath(environment)/magneticField/oxford_labview.tcl +fileeval $cfPath(environment)/magneticField/sct_oxford10tlv.tcl +fileeval $cfPath(environment)/magneticField/sct_oxford12tlv.tcl fileeval $cfPath(environment)/magneticField/sct_bruker_BEC1.tcl +fileeval $cfPath(environment)/magneticField/sct_bruker.tcl +fileeval $cfPath(beamline)/sct_he3_polanal.tcl fileeval $cfPath(environment)/environment.tcl fileeval $cfPath(environment)/sct_rheometer.tcl fileeval $cfPath(environment)/sct_antonparr_MCR500.tcl From 45d4663816516f5c3f0e867a4b3ddfa97a1ccc0e Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 19 Feb 2015 09:04:43 +1100 Subject: [PATCH 11/22] Pullback limit adjustments from Quokka to sct template drivers --- .../instrument/config/environment/magneticField/tsi_smc.sct | 4 ++-- .../instrument/config/environment/temperature/julabo_lh45.sct | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/site_ansto/instrument/config/environment/magneticField/tsi_smc.sct b/site_ansto/instrument/config/environment/magneticField/tsi_smc.sct index 704f6d83..e32ff44a 100644 --- a/site_ansto/instrument/config/environment/magneticField/tsi_smc.sct +++ b/site_ansto/instrument/config/environment/magneticField/tsi_smc.sct @@ -22,7 +22,7 @@ driver tsi_smc = { permlink = 'B.SP01'; writeable = 1; write_function = setGauss; - lowerlimit = 0; upperlimit = 500.0; tolerance = 10; + lowerlimit = 0; upperlimit = 15000.0; tolerance = 10; property settle_time = 5; mutable = true; property klass = 'sensor'; @@ -49,7 +49,7 @@ driver tsi_smc = { priv = user; type = text; var Rate = { type = float; write_command = "A"; }; - var Lower = { type = float; write_command = "L"; lowerlimit = 0; upperlimit = 2; property 'units' = "A"; }; + var Lower = { type = float; write_command = "L"; lowerlimit = 0; upperlimit = 60; property 'units' = "A"; }; var Ramp = { type = int; write_command = "R"; allowed = "0,1"; lowerlimit = 0; upperlimit = 1; }; var Pause = { type = int; write_command = "P"; allowed = "0,1"; lowerlimit = 0; upperlimit = 1; }; }; diff --git a/site_ansto/instrument/config/environment/temperature/julabo_lh45.sct b/site_ansto/instrument/config/environment/temperature/julabo_lh45.sct index 6d490b51..5f706bb3 100644 --- a/site_ansto/instrument/config/environment/temperature/julabo_lh45.sct +++ b/site_ansto/instrument/config/environment/temperature/julabo_lh45.sct @@ -22,7 +22,7 @@ driver julabo_lh45_gen = { permlink = 'T.SP01'; writeable = 1; write_function = setPoint; write_command = 'out_sp_00'; driveable = sensor/'value'; - lowerlimit = 10; upperlimit = 90; tolerance = '${tol}'; + lowerlimit = -20; upperlimit = 90; tolerance = '${tol}'; } var overtemp_warnlimit = { read_command = 'in_sp_03'; From 287b67156986153bb0f24263d610355c2fac155b Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 19 Feb 2015 09:14:23 +1100 Subject: [PATCH 12/22] Regenerate for limit changes --- .../config/environment/magneticField/sct_tsi_smc.tcl | 4 ++-- .../config/environment/temperature/sct_julabo_lh45_gen.tcl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/site_ansto/instrument/config/environment/magneticField/sct_tsi_smc.tcl b/site_ansto/instrument/config/environment/magneticField/sct_tsi_smc.tcl index 13d44544..f6312e2d 100644 --- a/site_ansto/instrument/config/environment/magneticField/sct_tsi_smc.tcl +++ b/site_ansto/instrument/config/environment/magneticField/sct_tsi_smc.tcl @@ -298,7 +298,7 @@ proc ::scobj::tsi_smc::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/setpoint mutable true hsetprop ${scobj_hpath}/setpoint nxsave true hsetprop ${scobj_hpath}/setpoint lowerlimit 0 - hsetprop ${scobj_hpath}/setpoint upperlimit 500.0 + hsetprop ${scobj_hpath}/setpoint upperlimit 15000.0 hsetprop ${scobj_hpath}/setpoint tolerance 10 hsetprop ${scobj_hpath}/setpoint permlink data_set "B[format "%02d" ${id}]SP01" hsetprop ${scobj_hpath}/setpoint @description "B[format "%02d" ${id}]SP01" @@ -475,7 +475,7 @@ proc ::scobj::tsi_smc::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/b/Lower mutable true hsetprop ${scobj_hpath}/b/Lower nxsave true hsetprop ${scobj_hpath}/b/Lower lowerlimit 0 - hsetprop ${scobj_hpath}/b/Lower upperlimit 2 + hsetprop ${scobj_hpath}/b/Lower upperlimit 60 hsetprop ${scobj_hpath}/b/Lower oldval 0.0 hsetprop ${scobj_hpath}/b/Lower klass "parameter" hsetprop ${scobj_hpath}/b/Lower sdsinfo "::nexus::scobj::sdsinfo" diff --git a/site_ansto/instrument/config/environment/temperature/sct_julabo_lh45_gen.tcl b/site_ansto/instrument/config/environment/temperature/sct_julabo_lh45_gen.tcl index bf891b47..31da5f34 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_julabo_lh45_gen.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_julabo_lh45_gen.tcl @@ -485,7 +485,7 @@ proc ::scobj::julabo_lh45_gen::mkDriver { sct_controller name device_class simul hsetprop ${scobj_hpath}/setpoint data true hsetprop ${scobj_hpath}/setpoint mutable true hsetprop ${scobj_hpath}/setpoint nxsave true - hsetprop ${scobj_hpath}/setpoint lowerlimit 10 + hsetprop ${scobj_hpath}/setpoint lowerlimit -20 hsetprop ${scobj_hpath}/setpoint upperlimit 90 hsetprop ${scobj_hpath}/setpoint tolerance ${tol} hsetprop ${scobj_hpath}/setpoint permlink data_set "T[format "%02d" ${id}]SP01" From 8c4eed9bfe25fd0e1e38abd7936d5e5ff4fa7607 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 19 Feb 2015 09:40:49 +1100 Subject: [PATCH 13/22] Merged changes from Quokka as at 2015-02-18 --- .../temperature/sct_julabo_lh45.tcl | 85 +++++++++++++++++++ .../temperature/sct_lakeshore_370.tcl | 2 +- .../config/hmm/hmm_configuration_common_1.tcl | 20 +++++ .../environment/sct_antonparr_MCR500.tcl | 4 + .../sans/config/environment/sct_rheometer.tcl | 1 + .../config/motors/motor_configuration.tcl | 4 +- 6 files changed, 113 insertions(+), 3 deletions(-) diff --git a/site_ansto/instrument/config/environment/temperature/sct_julabo_lh45.tcl b/site_ansto/instrument/config/environment/temperature/sct_julabo_lh45.tcl index 9dfb08ca..5c21a3e6 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_julabo_lh45.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_julabo_lh45.tcl @@ -439,3 +439,88 @@ proc add_julabo_lh45 { name IP port {sensor "bath"} {_tol 5.0} {CID 1} {CTYPE T} } makesctemon $name /sics/$name/emon/monmode /sics/$name/emon/isintol /sics/$name/emon/errhandler } + +namespace eval ::scobj::julabo_lh45 { +set debug_threshold 5 +} +proc ::scobj::julabo_lh45::sics_log {debug_level debug_string} { + set catch_status [ catch { + set debug_threshold ${::scobj::julabo_lh45::debug_threshold} + if {${debug_level} >= ${debug_threshold}} { + sicslog "::scobj::julabo_lh45::${debug_string}" + } + } catch_message ] +} + +clientput "file evaluation of sct_julabo_lh45.tcl" +::scobj::julabo_lh45::sics_log 9 "file evaluation of sct_julabo_lh45.tcl" + +proc ::scobj::julabo_lh45::read_config {} { + set catch_status [ catch { + set ns "::scobj::julabo_lh45" + 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"] "julabo_lh45"] } { + 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"]" + } + } + set arg_list [list] + foreach arg {ctrl_sensor tol id type} { + if {[dict exists $v $arg]} { + lappend arg_list "[dict get $v $arg]" + } else { + ${ns}::sics_log 9 "Missing configuration value $arg" + error "Missing configuration value $arg" + } + } + add_julabo_lh45 ${name} "aqadapter" ${asyncqueue} {*}$arg_list + } + } + } + } + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +if { [info exists ::config_dict] } { + ::scobj::julabo_lh45::read_config +} else { + ::scobj::julabo_lh45::sics_log 5 "No config dict" +} + + diff --git a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl index 74233b4a..6fe63945 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl @@ -50,7 +50,7 @@ namespace eval ::scobj::[set vendor]_[set device] { proc debug_log {debug_level arg_string} { # write a timestamped string message to a log file for debugging - set debug_threshold 0 + set debug_threshold 5 if {$debug_level >= $debug_threshold} { set fd [open "[set [namespace current]::log_file]" "a"] set line "[clock format [clock seconds] -format "%T"] $arg_string" diff --git a/site_ansto/instrument/config/hmm/hmm_configuration_common_1.tcl b/site_ansto/instrument/config/hmm/hmm_configuration_common_1.tcl index 24d0b707..af8c09f3 100644 --- a/site_ansto/instrument/config/hmm/hmm_configuration_common_1.tcl +++ b/site_ansto/instrument/config/hmm/hmm_configuration_common_1.tcl @@ -1471,6 +1471,26 @@ sicslist setatt ::histogram_memory::ratemap_xy_total klass detector sicslist setatt ::histogram_memory::ratemap_xy_total long_name total_maprate sicslist setatt ::histogram_memory::ratemap_xy_total mutable true +# Returns 0 If all trips acknowledged, -n if n trips unacknowledged, +n if too many acks? +::utility::macro::getset float ::histogram_memory::reset_trip {args} { + set num_trips [ SplitReply [hmm configure detector_protect_num_trip] ] + set num_acks [ SplitReply [hmm configure detector_protect_num_trip_ack] ] + set trip_cnt_diff [expr {$num_acks - $num_trips}] + if {$args == ""} { + return "reset_trip = $trip_cnt_diff" + } else { + if {$trip_cnt_diff != 0} { + hmm configure fat_detector_protect_num_trip_ack $num_trips + hmm astop + wait 2 + hmm init + } + } +} +sicslist setatt ::histogram_memory::reset_trip klass detector +sicslist setatt ::histogram_memory::reset_trip long_name reset_trip +sicslist setatt ::histogram_memory::reset_trip data false + ## # @brief Update the beam monitors when the histmem has finished counting. proc ::histogram_memory::countend_event {} { diff --git a/site_ansto/instrument/sans/config/environment/sct_antonparr_MCR500.tcl b/site_ansto/instrument/sans/config/environment/sct_antonparr_MCR500.tcl index bd93bd8c..3dae5815 100644 --- a/site_ansto/instrument/sans/config/environment/sct_antonparr_MCR500.tcl +++ b/site_ansto/instrument/sans/config/environment/sct_antonparr_MCR500.tcl @@ -33,8 +33,12 @@ proc ::scobj::antonparr_MCR500::mkDriver { speed_name torque_name tol settle } { set catch_status [ catch { # mkDriver hook code starts + if [::utility::obj_exists $speed_name] { add_rheo $speed_name $tol $settle + } + if [::utility::obj_exists $torque_name] { add_rheo $torque_name $tol $settle + } # mkDriver hook code ends } catch_message ] handle_exception ${catch_status} ${catch_message} diff --git a/site_ansto/instrument/sans/config/environment/sct_rheometer.tcl b/site_ansto/instrument/sans/config/environment/sct_rheometer.tcl index 7c2f49e7..463214f7 100644 --- a/site_ansto/instrument/sans/config/environment/sct_rheometer.tcl +++ b/site_ansto/instrument/sans/config/environment/sct_rheometer.tcl @@ -100,4 +100,5 @@ proc add_rheo {rhControl tol settle} { hfactory /sics/$rhControl/settletime plain user float hset /sics/$rhControl/settletime $settle hsetprop /sics/$rhControl timecheck 0 + hsetprop /sics/$rhControl callBack "rhCallBack /sics/$rhControl" } diff --git a/site_ansto/instrument/sans/config/motors/motor_configuration.tcl b/site_ansto/instrument/sans/config/motors/motor_configuration.tcl index 846db865..e765bdff 100644 --- a/site_ansto/instrument/sans/config/motors/motor_configuration.tcl +++ b/site_ansto/instrument/sans/config/motors/motor_configuration.tcl @@ -718,7 +718,7 @@ Motor apx $motor_driver_type [params \ axis E\ units mm\ hardlowerlim -260\ - hardupperlim 5\ + hardupperlim 45\ maxSpeed 5\ maxAccel 5\ maxDecel 5\ @@ -730,7 +730,7 @@ apx part collimator apx long_name apx apx home 0 apx softlowerlim -255 -apx softupperlim 5 +apx softupperlim 45 apx speed 5 # Sample aperture y From fbdd46e258dd9a0c8493cbf6e90521a77b503e75 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 19 Feb 2015 10:34:12 +1100 Subject: [PATCH 14/22] Pullback from Taipan 2015-02-19 --- .../config/counter/counter_common_1.tcl | 5 +- .../temperature/sct_lakeshore_370.tcl | 2 +- .../temperature/sct_oxford_mercury.tcl | 2996 ++++++++++++----- .../environment/temperature/sct_west_6100.tcl | 109 +- site_ansto/instrument/server_config.tcl | 34 +- .../tas/config/motors/motor_configuration.tcl | 281 +- .../instrument/tas/taipan_configuration.tcl | 62 +- .../instrument/tas/util/sics_config.ini | 400 ++- 8 files changed, 2684 insertions(+), 1205 deletions(-) diff --git a/site_ansto/instrument/config/counter/counter_common_1.tcl b/site_ansto/instrument/config/counter/counter_common_1.tcl index 1a16dd32..9d11a570 100644 --- a/site_ansto/instrument/config/counter/counter_common_1.tcl +++ b/site_ansto/instrument/config/counter/counter_common_1.tcl @@ -7,7 +7,6 @@ namespace eval counter { proc ::counter::transferscript {} { variable isc_numchannels - bm status set val [SplitReply [bm1 gettime]] for {set i 1} {$i <= $isc_numchannels} {incr i} { append val " [SplitReply [bm$i getcounts] ]" @@ -36,8 +35,8 @@ proc ::counter::ic_initialize {} { # This must be sourced before the hmm_configuration.tcl until we separate the scan setup from the hmm setup for {set i 0; set n 1} {$i < $isc_numchannels} {incr i; incr n} { MakeCounter bm$n anstomonitor [ params host $isc_monitor_address port [lindex $isc_portlist $i] ] - bm$n send scan=1 - bm$n send sample=10 + bm$n send set scan=1 + bm$n send set sample=10 append bm_list "bm$n " } } diff --git a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl index 74233b4a..6fe63945 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl @@ -50,7 +50,7 @@ namespace eval ::scobj::[set vendor]_[set device] { proc debug_log {debug_level arg_string} { # write a timestamped string message to a log file for debugging - set debug_threshold 0 + set debug_threshold 5 if {$debug_level >= $debug_threshold} { set fd [open "[set [namespace current]::log_file]" "a"] set line "[clock format [clock seconds] -format "%T"] $arg_string" diff --git a/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl b/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl index 22ebad6b..4b0651f9 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl @@ -1,891 +1,2143 @@ -# vim: ts=8 sw=2 sta sts=2 et ai si -# This is a template driver for a mercury temperaure controller from Oxford Instruments +# Generated driver for oxford_mercury +# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent # -# Author: Douglas Clowes -# Date: August 2012 -# -if { "[lindex [split [info nameofexecutable] "/"] end]" == "tclsh"} { -# This block is to suppress spurious error/warning messages when loaded in Nagelfar - set catch_status [ catch { - puts "TCLSH" - proc environment_simulation {} { return "" } - proc SplitReply {str} { return "" } - proc makesctcontroller {args} { } - proc MakeSICSObj {args} { } - proc sicslist {args} { } - proc hfactory {args} { } - proc hdelprop {args} { } - proc hsetprop {args} { } - proc hgetprop {args} { } - proc hpropexists {args} { } - proc hlistprop {args} { } - proc hset {args} { } - proc hget {args} { } - proc hval {args} { } - proc hinfo {args} { } - proc hlist {args} { } - proc sct {args} { } - proc debug_log {args} { } - proc pathname {args} { } - proc basename {args} { } - proc channel {args} { } - proc ns {args} { } - } catch_message ] - if {$catch_status != 0} { - puts "error in main $catch_message" - return -code error "in main $catch_message" - } + +namespace eval ::scobj::oxford_mercury { + set debug_threshold 5 +# preamble hook code starts + proc make_config {sct_controller} { + set syscat [${sct_controller} transact READ:SYS:CAT] + set result "" + set devs [regexp -inline -all {DEV:[DM][[:alnum:]\.]*:[[:alnum:]]*} ${syscat}] + foreach dev [lsort ${devs}] { + set typ [string index [lindex [split ${dev} :] end] 0] + set typ [string map {A V} ${typ}] + clientput "${dev} ${typ}" + set result "${result}${typ}" + } + clientput "Result: ${result}" + return ${result} + } + proc read_all {sct_controller} { + set syscat [${sct_controller} transact READ:SYS:CAT] + set devs [regexp -inline -all {DEV:[DM][[:alnum:]\.]*:[[:alnum:]]*} ${syscat}] + foreach dev [lsort ${devs}] { + set response [${sct_controller} transact READ:${dev}] + clientput "Device: ${response}" + } + } + proc read_loop {sct_controller} { + set pat {\m[A-Z]{1,}:[^:]{1,}} + set syscat [${sct_controller} transact READ:SYS:CAT] + set devs [regexp -inline -all {DEV:[DM][[:alnum:]\.]*:[[:alnum:]]*} ${syscat}] + foreach dev [lsort ${devs}] { + set response [${sct_controller} transact READ:${dev}:LOOP] + clientput "Device: ${response}" + clientput " Loop: [regexp -inline -all $pat [string trim ${response}]]" + } + } + proc read_sig {sct_controller} { + set pat {\m[A-Z]{1,}:[^:]{1,}} + set syscat [${sct_controller} transact READ:SYS:CAT] + set devs [regexp -inline -all {DEV:[DM][[:alnum:]\.]*:[[:alnum:]]*} ${syscat}] + foreach dev [lsort ${devs}] { + set response [${sct_controller} transact READ:${dev}:SIG] + clientput "Device: ${response}" + clientput " Sig: [regexp -inline -all $pat [string trim ${response}]]" + } + } +# preamble hook code ends } -set vendor "oxford" -set device "mercury" - -namespace eval ::scobj::[set vendor]_[set device] { - proc ns {} { - return "[namespace current]" - } - # All of this takes place in a namespace based on the vendor and device - # Debug prints and vendor/device save - 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]" - 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 - set debug_threshold 0 - if {$debug_level >= $debug_threshold} { - set fd [open "[set [namespace current]::log_file]" "a"] - set line "[clock format [clock seconds] -format "%T"] $arg_string" - puts $fd "$line" - close $fd +proc ::scobj::oxford_mercury::debug_log {tc_root debug_level debug_string} { + set catch_status [ catch { + set debug_threshold [hgetpropval ${tc_root} debug_threshold] + if {${debug_level} >= ${debug_threshold}} { + set now [clock seconds] + set ts [clock format ${now} -format "%Y%m%d"] + set log_file_name "../log/oxford_mercury_[basename ${tc_root}]_${ts}.log" + set fd [open "${log_file_name}" "a"] + set ts [clock format ${now} -format "%T"] + puts ${fd} "${ts} ${debug_string}" + close ${fd} } - } + } catch_message ] +} - proc channel {arg} { - # strip the trailing digits from the arg and return them as a string - set result 0 - for { set i 0 } { $i < [string length $arg] } { incr i } { - if { ! [string match {[0-9]} [string index $arg end-$i]] } { - break +proc ::scobj::oxford_mercury::sics_log {debug_level debug_string} { + set catch_status [ catch { + set debug_threshold ${::scobj::oxford_mercury::debug_threshold} + if {${debug_level} >= ${debug_threshold}} { + sicslog "::scobj::oxford_mercury::${debug_string}" + } + } catch_message ] +} + +# checklimits function for driveable interface +proc ::scobj::oxford_mercury::checklimits {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "checklimits tc_root=${tc_root} sct=[sct] target=[sct target]" + set setpoint [sct target] + if { [hpropexists [sct] lowerlimit] } { + set lolimit [sct lowerlimit] + } else { + # lowerlimit not set, use target + set lolimit [sct target] + } + if { [hpropexists [sct] upperlimit] } { + set hilimit [sct upperlimit] + } else { + # upperlimit not set, use target + set hilimit [sct target] + } +# checklimits hook code goes here + if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } { + sct driving 0 + error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]" + } + return OK + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# check function for hset change +proc ::scobj::oxford_mercury::checkrange {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "checkrange tc_root=${tc_root} sct=[sct] target=[sct target]" + set setpoint [sct target] + if { [hpropexists [sct] lowerlimit] } { + set lolimit [sct lowerlimit] + } else { + # lowerlimit not set, use target + set lolimit [sct target] + } + if { [hpropexists [sct] upperlimit] } { + set hilimit [sct upperlimit] + } else { + # upperlimit not set, use target + set hilimit [sct target] + } +# checkrange hook code goes here + if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } { + error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]" + } + return OK + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# checkstatus function for driveable interface +proc ::scobj::oxford_mercury::checkstatus {tc_root} { + set catch_status [ catch { +# checkstatus hook code goes here + if {[sct driving]} { + set sp "[sct target]" + if {[hpropexists [sct] simulated] && [sct simulated] == "true"} { + set pv "${sp}" + hupdateif ${tc_root}/[sct driveable] ${sp} + } else { + set pv "[hval ${tc_root}/[sct driveable]]" } - set result [string range "$arg" end-$i end] + if { abs(${pv} - ${sp}) <= [sct tolerance] } { + if { [hpropexists [sct] settle_time] } { + if { [hpropexists [sct] settle_time_start] } { + if { [sct utime] - [sct settle_time_start] >= [sct settle_time]} { + sct driving 0 + return "idle" + } + return "busy" + } else { + sct utime settle_time_start + return "busy" + } + } + sct driving 0 + return "idle" + } + if { [hpropexists [sct] settle_time_start] } { + hdelprop [sct] settle_time_start + } + return "busy" + } else { + return "idle" } - debug_log 1 "Extract channel $result from argument $arg" - return $result - } + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} - proc setPoint {tc_root nextState cmd} { - # send a command to set a value - debug_log 1 "setPoint tc_root=$tc_root sct=[sct] $cmd [sct target]" +# function to request the read of a parameter on a device +proc ::scobj::oxford_mercury::getValue {tc_root nextState cmd_str} { + set catch_status [ catch { + debug_log ${tc_root} 1 "getValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set cmd "${cmd_str}" +# getValue hook code goes here + debug_log ${tc_root} 1 "getValue sct send ${cmd}" + if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { + sct send "${cmd}" + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# halt function for driveable interface +proc ::scobj::oxford_mercury::halt {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "halt tc_root=${tc_root} sct=[sct] driving=[sct driving]" + ### TODO hset [sct] [hval [sct]] +# halt hook code goes here + sct driving 0 + return "idle" + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to check the write parameter on a device +proc ::scobj::oxford_mercury::noResponse {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "noResponse tc_root=${tc_root} sct=[sct] resp=[sct result]" +# noResponse hook code goes here + return "idle" + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to parse the read of a parameter on a device +proc ::scobj::oxford_mercury::rdOnOff {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "rdOnOff tc_root=${tc_root} sct=[sct] result=[sct result]" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set data [sct result] + set nextState "idle" + if {[string equal -nocase -length 7 ${data} "ASCERR:"]} { + # the protocol driver has reported an error + sct geterror "${data}" + error "[sct geterror]" + } +# rdOnOff hook code starts + scan [lindex [split "$data" ":"] end] "%s" data + if {[string equal -nocase ${data} "ON"]} { + set data 1 + } else { + set data 0 + } +# rdOnOff hook code ends + if { [hpropexists [sct] geterror] } { + debug_log ${tc_root} 9 "[sct] error: [sct geterror]" + error "[sct geterror]" + } + if { ${data} != [sct oldval] } { + debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]" + sct oldval ${data} + sct update ${data} + sct utime readtime + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to parse the read of a parameter on a device +proc ::scobj::oxford_mercury::rdText {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "rdText tc_root=${tc_root} sct=[sct] result=[sct result]" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set data [sct result] + set nextState "idle" + if {[string equal -nocase -length 7 ${data} "ASCERR:"]} { + # the protocol driver has reported an error + sct geterror "${data}" + error "[sct geterror]" + } +# rdText hook code starts + scan [lindex [split "$data" ":"] end] "%s" data +# rdText hook code ends + if { [hpropexists [sct] geterror] } { + debug_log ${tc_root} 9 "[sct] error: [sct geterror]" + error "[sct geterror]" + } + if { ${data} != [sct oldval] } { + debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]" + sct oldval ${data} + sct update ${data} + sct utime readtime + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to parse the read of a parameter on a device +proc ::scobj::oxford_mercury::rdValue {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "rdValue tc_root=${tc_root} sct=[sct] result=[sct result]" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set data [sct result] + set nextState "idle" + if {[string equal -nocase -length 7 ${data} "ASCERR:"]} { + # the protocol driver has reported an error + sct geterror "${data}" + error "[sct geterror]" + } +# rdValue hook code starts + set value [lindex [split "${data}" ":"] end] + if {[string equal -nocase -length 3 ${value} NaN]} { + set value 0 + } + if {[string equal -nocase -length 3 ${value} inf] || [string equal -nocase -length 4 ${value} -inf]} { + set value 0 + } + if {![string is digit [string index ${value} 0]]} { + set value 0 + } + debug_log ${tc_root} 1 "rdValue tc_root=${tc_root} sct=[sct] result=[sct result]" + debug_log ${tc_root} 1 "rdValue tc_root=${tc_root} data=${data} value=${value}" + scan ${value} "%g" data +# rdValue hook code ends + if { [hpropexists [sct] geterror] } { + debug_log ${tc_root} 9 "[sct] error: [sct geterror]" + error "[sct geterror]" + } + if { ${data} != [sct oldval] } { + debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]" + sct oldval ${data} + sct update ${data} + sct utime readtime + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to write a parameter value on a device +proc ::scobj::oxford_mercury::setPoint {tc_root nextState cmd_str} { + set catch_status [ catch { + debug_log ${tc_root} 1 "setPoint tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" if { [hpropexists [sct] geterror] } { hdelprop [sct] geterror } set par [sct target] - set command "$cmd:$par" - - debug_log 1 "setPoint tc_root=$tc_root sct=[sct] Write $command" - sct send "$command" - sct driving 1 - sct time_check [clock seconds] - if {$par != [sct oldval]} { - sct oldval $par - sct update $par - sct utime readtime - debug_log 1 "setPoint: new data for $tc_root [sct] result=$par" - } - return $nextState - } - - proc chkWrite {tc_root} { - # process the response to the write - # - not all devices will respond to writes - set data [sct result] - debug_log 1 "chkWrite tc_root=$tc_root sct=[sct] resp=$data" - if {[string equal -nocase -length 7 $data "ASCERR:"]} { - # the protocol driver has reported an error - sct geterror "$data" - } elseif {[string equal -nocase -length 1 $data "?"]} { - # the device has reported an error - sct geterror "Error: $data" - } else { - # the write was successful, record the data - set data [sct target] - if {$data != [sct oldval]} { - sct oldval $data - sct update $data - sct utime readtime - debug_log 1 "chkWrite new data for $tc_root [sct] result=$data" + set cmd "${cmd_str}${par}" +# setPoint hook code goes here + if { [hpropexists [sct] driving] } { + if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { + sct driving 1 } } - return idle - } - - proc noResponse {tc_root} { - set data "[sct result]" - debug_log 1 "noResponse tc_root=$tc_root sct=[sct] resp=$data" - return idle - } - - proc getValue {tc_root nextState cmd} { - # send a command to request a value - debug_log 1 "getValue tc_root=$tc_root sct=[sct] $cmd" - if { [hpropexists [sct] geterror] } { - hdelprop [sct] geterror + debug_log ${tc_root} 1 "setPoint sct send ${cmd}" + if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { + sct send "${cmd}" } - if { [string equal -nocase -length 4 "$cmd" "XXXX"] } { - set cmd "$cmd [channel [pathname [sct]]]" - } - debug_log 1 "getValue sct send $cmd" - sct send "$cmd" - return $nextState - } - - proc rdValue {tc_root} { - # process the received response to the read request - debug_log 1 "[ns]::rdValue tc_root=$tc_root sct=[sct] result=[sct result]" - set data [sct result] - if {[string equal -nocase -length 7 $data "ASCERR:"]} { - # the protocol driver has reported an error - sct geterror "$data" - } elseif {[string equal -nocase -length 1 $data "?"]} { - # the device has reported an error - sct geterror "Error: $data" - } else { - if { [string equal -nocase [basename [sct]] "XXXX"] } { - return "idle" - } - scan [lindex [split "$data" ":"] end] "%g" data - if {$data != [sct oldval]} { - debug_log 1 "[sct] changed to new:$data, from old:[sct oldval]" - sct oldval $data - sct update $data - sct utime readtime - } - } - return "idle" - } - - proc rdText {tc_root} { - # process the received response to the read request - debug_log 1 "[ns]::rdText tc_root=$tc_root sct=[sct] result=[sct result]" - set data [sct result] - if {[string equal -nocase -length 7 $data "ASCERR:"]} { - # the protocol driver has reported an error - sct geterror "$data" - } elseif {[string equal -nocase -length 1 $data "?"]} { - # the device has reported an error - sct geterror "Error: $data" - } else { - if { [string equal -nocase [basename [sct]] "XXXX"] } { - return "idle" - } - scan [lindex [split "$data" ":"] end] "%s" data - if {$data != [sct oldval]} { - debug_log 1 "[sct] changed to new:$data, from old:[sct oldval]" - sct oldval $data - sct update $data - sct utime readtime - } - } - return "idle" - } - - proc rdTextAll {tc_root} { - # process the received response to the read request - debug_log 1 "[ns]::rdText tc_root=$tc_root sct=[sct] result=[sct result]" - set data [sct result] - if {[string equal -nocase -length 7 $data "ASCERR:"]} { - # the protocol driver has reported an error - sct geterror "$data" - } elseif {[string equal -nocase -length 1 $data "?"]} { - # the device has reported an error - sct geterror "Error: $data" - } else { - if { [string equal -nocase [basename [sct]] "XXXX"] } { - return "idle" - } - #scan [lindex [split "$data" ":"] end] "%s" data - if {$data != [sct oldval]} { - debug_log 1 "[sct] changed to new:$data, from old:[sct oldval]" - sct oldval $data - sct update $data - sct utime readtime - } - } - return "idle" - } - - proc getTemp {tc_root nextState cmd} { - debug_log 1 "getTemp tc_root=$tc_root sct=[sct] $cmd" - if { ! [hpropexists [sct] my_state] } { - sct my_state 0 - } - if { [sct my_state] == 0 } { - set command "CSET?" - } else { - set command "RDGK? [sct channel]" - } - debug_log 1 "getTemp sct send $command" - sct send "$command" - return "$nextState" - } - - proc rdTemp {tc_root} { - debug_log 1 "rdTemp tc_root=$tc_root sct=[sct] result=[sct result]" - if { [sct my_state] == 0 } { - set response "[split [sct result] ","]" - sct channel [lindex $response 0] - sct filter [lindex $response 1] - sct my_state 1 - return "read" - } else { - set data "[sct result]" - if {$data != [sct oldval]} { - debug_log 1 "[sct] changed to new:$data, from old:[sct oldval]" - sct oldval $data - sct update $data - sct utime readtime - } - sct my_state 0 - return "idle" - } - } - - proc gtLoop {tc_root nextState cmd} { - debug_log 1 "gtLoop tc_root=$tc_root sct=[sct] nextState=$nextState cmd=$cmd" - debug_log 1 "gtLoop tc_root=$tc_root pathname=[pathname [sct]] basename=[basename [sct]]" - if { ! [hpropexists [sct] my_state] } { - debug_log 1 "gtLoop setting my_state to zero because it doesn't exist" - sct my_state 0 - } - if { [sct my_state] == 0 } { - set command "RAMP?" - } else { - set command "SETP?" - } - debug_log 1 "gtLoop sct=[sct] command=$command" - sct send "$command" - return "$nextState" - return idle - } - - proc rdLoop {tc_root} { - debug_log 1 "rdLoop tc_root=$tc_root sct=[sct] result=[sct result]" - debug_log 1 "rdLoop tc_root=$tc_root pathname=[pathname [sct]] basename=[basename [sct]]" - set nextState "read" - if { [sct my_state] == 0 } { - debug_log 1 "rdLoop sct=[sct] RAMP - result=[sct result]" - set nextState "read" - } else { - debug_log 1 "rdLoop sct=[sct] SETP - result=[sct result]" - set nextState "idle" - sct my_state -1 - } - sct my_state "[expr {[sct my_state] + 1}]" - return $nextState - } - - proc wrLoop {tc_root nextState cmd} { - debug_log 1 "wrLoop tc_root=$tc_root sct=[sct] nextState=$nextState cmd=$cmd" - if { ! [hpropexists [sct] my_state] } { - debug_log 1 "wrLoop setting my_state to zero because it doesn't exist" - sct my_state 0 - } - if { [sct writestatus] == "start" } { - debug_log 1 "wrLoop setting my_state to zero because writestatus is [sct writestatus]" - sct my_state 0 - } - debug_log 1 "wrLoop target=[sct target] writestatus=[sct writestatus] my_state=[sct my_state]" - if { [sct my_state] == 0 } { - set my_rate [hval [sct]/ramp_rate] - if { $my_rate > 0.0 } { - set command "RAMP 0,0;RAMP?" - } else { - set command "RAMP 1,$my_rate;RAMP?" - } - } else { - set command "SETP [hval [sct]/setpoint];SETP?" - } - debug_log 1 "wrLoop sct=[sct] command=$command" - sct send "$command" - return "$nextState" - } - - proc ckLoop {tc_root} { - debug_log 1 "ckLoop tc_root=$tc_root sct=[sct] result=[sct result]" - debug_log 1 "ckLoop target=[sct target] writestatus=[sct writestatus] my_state=[sct my_state]" - set nextState "write" - if { [sct my_state] == 0 } { - debug_log 1 "ckLoop sct=[sct] RAMP - result=[sct result]" - [ns]::rdValue $tc_root - set nextState "write" - } else { - debug_log 1 "ckLoop sct=[sct] SETP - result=[sct result]" - [ns]::rdValue $tc_root - sct my_state -1 - set nextState "idle" - } - sct my_state "[expr {[sct my_state] + 1}]" - return $nextState - } - - ## - # @brief getState() sends commands/requests to the device under control - # - # @param tc_root the path to the device_state node - # @param nextState the next sct state (rdState) - # @param cmd empty argument - # - # @return the next sct state (rdState) - # - proc getState {tc_root nextState cmd} { - if { [hpropexists [sct] geterror] } { - hdelprop [sct] geterror - } - debug_log 1 "getState $tc_root sct=[sct] state=[hval [sct]] substate=[sct substate] next=$nextState" - set my_state [hval [sct]] - set my_substate [sct substate] - if {$my_state == "STATE_INIT"} { - if { $my_substate == 0 } { - set command "*IDN?" - } elseif { $my_substate == 1 } { - set command "*TST?" - } - } elseif { $my_state == "STATE_CURVE"} { - if { $my_substate == 0 } { - set my_substate 1000 - sct substate $my_substate - } - if { ($my_substate % 1000) == 0 } { - set command "CRVHDR? [expr {int($my_substate / 1000)}]" - } else { - set command "CRVPT? [expr {int($my_substate / 1000)}],[expr {($my_substate % 1000)}]" - } - } elseif { $my_state == "STATE_IDLE"} { - if { $my_substate == 0 } { - set command "*ESE?" - } elseif { $my_substate == 1 } { - set command "*ESR?" - } elseif { $my_substate == 2 } { - set command "*STB?" - } - } - debug_log 1 "getState sct send $command" - sct send $command - return "$nextState" - } - - ## - # @brief rdState() handles events from the device under control - # - # @param tc_root the path to the device_state node - # - proc rdState {tc_root} { - if { [hpropexists [sct] geterror] } { - hdelprop [sct] geterror - } - debug_log 1 "rdState $tc_root sct=[sct] state=[hval [sct]] substate=[sct substate] response=\"[sct result]\"" - set nextState "read" - set my_state [hval [sct]] - set my_substate [sct substate] - if {$my_state == "STATE_INIT"} { - if { $my_substate == 0 } { # IDN - sct identity [sct result] - incr my_substate - } elseif { $my_substate == 1 } { - sct selftest [sct result] - incr my_substate - } - if { $my_substate > 1 } { - #hset [sct] "STATE_IDLE" - hset [sct] "STATE_CURVE" - set my_substate 0 - } - } elseif { $my_state == "STATE_CURVE"} { - if { ($my_substate % 1000) == 0 } { - debug_log 1 "Curve: [expr {$my_substate / 1000}] Header: [sct result]" - } else { - debug_log 1 "Curve: [expr {$my_substate / 1000}] Point: [expr {$my_substate % 1000}] Value: [sct result]" - set rslt [scan "[sct result]" "%f,%f" units temperature] - debug_log 1 "Curve: [expr {$my_substate / 1000}] Point: [expr {$my_substate % 1000}] Result: $rslt Units: $units Temp: $temperature" - if { $units == 0.0 && $temperature == 0.0 } { - set my_substate [expr { (($my_substate / 1000)) * 1000 + 999}] - } - } - if { ($my_substate % 1000) >= 200 } { - if { ($my_substate / 1000) >= 20 } { - hset [sct] "STATE_IDLE" - set my_substate 0 - } else { - set my_substate [expr { (($my_substate / 1000) + 1) * 1000 }] - } - } else { - set my_substate [expr { $my_substate + 1 }] - } - } elseif { $my_state == "STATE_IDLE"} { - if { $my_substate == 0 } { # ESE - sct the_ese [sct result] - incr my_substate - } elseif { $my_substate == 1 } { # ESR - sct the_esr [sct result] - incr my_substate - } elseif { $my_substate == 2 } { # STB - sct the_stb [sct result] - incr my_substate - } - if { $my_substate > 2 } { - set my_substate 0 - set nextState "idle" - } - } - sct substate $my_substate - if { $my_state != [hval [sct]] } { - debug_log 1 "device_state $my_state to [hval [sct]]" - } - return "$nextState" - } - - proc chkTarget {tc_root par} { - set target {} - if {[hpropexists [sct] values]} { - set values [split [SplitReply [sct values]] ","] - foreach value $values { - #sct print "Testing $par against $value" - set lo_hi [split $value ":"] - if {[llength $lo_hi] == 2} { - if {[lindex $lo_hi 0] <= $par && [lindex $lo_hi 1] >= $par} { - #sct print "Success $par between [lindex $lo_hi 0] and [lindex $lo_hi 1]" - set target "$par" - break - } - } else { - if {[string toupper "$par"] == [string toupper "$value"]} { - #sct print "Success $par matches $value" - set target "$par" - break - } - } - } - if {"$target" == ""} { - #sct print "Failure $par no matches in $values" - return -code error "Invalid value: \"$par\"" - } - } else { - set target "$par" - } - return $target - } - -## -# @brief Implement the checkstatus command for the drivable interface -# -# NOTE: The drive adapter initially sets the writestatus to "start" and will -# only call this when writestatus!="start" - proc drivestatus {tc_root} { - #debug_log 1 "drivestatus tc_root=$tc_root, sct=[sct], setpoint=[hval [sct]], temp=[hval [pathname [sct]]/sensor], driving=[sct driving]" - if {[sct driving]} { - # tolerance - set temp [hval [pathname [sct]]/sensor] - set loval [expr {[hval [sct]] - [sct tolerance]}] - set hival [expr {[hval [sct]] + [sct tolerance]}] - if {$loval <= $temp && $temp <= $hival} { - # settle time - set timeout [sct settletime] - set timecheck [sct time_check] - set currtime [clock seconds] - #debug_log 1 "drivestatus tc_root=$tc_root, sct=[sct], setpoint=[hval [sct]], temp=[hval [pathname [sct]]/sensor], temp=($loval, $temp, $hival), time=($timecheck, $currtime, $timeout)" - if { ($currtime - $timecheck) >= $timeout } { - debug_log 1 "drivestatus tc_root=$tc_root, sct=[sct], finished driving" - sct driving 0 - } - } else { - sct time_check [clock seconds] - } - return busy - } else { - debug_log 1 "drivestatus tc_root=$tc_root, sct=[sct], now idle" - return idle - } - } - - proc halt {tc_root} { - debug_log 1 "halt $tc_root" - foreach loop {Loop1 Loop2 Loop3 Loop4} { - set catch_status [ catch { - hset $tc_root/$loop/setpoint [hval $tc_root/$loop/sensor] - hsetprop $tc_root/$loop/setpoint driving 0 - } catch_message ] - } - debug_log 1 "halt $tc_root done driving" - return idle - } - - proc check {tc_root} { - debug_log 1 "check tc_root=$tc_root, sct=[sct], target=[sct target]" - set catch_status [ catch { - set target [chkTarget $tc_root [sct target]] - if { "$target" == "" } { - error "setpoint violates limits" - } - } catch_message ] - if {$catch_status != 0} { - return -code error $catch_message - } - return OK - } - - proc wrNode {tc_root cmd level} { - set space [string repeat " " $level] - set val [hval $tc_root] - if {"$val" == ""} { - set line "$tc_root ([hinfo $tc_root])" - } else { - set line "$tc_root ([hinfo $tc_root]) = $val" - } - sct print "$space* $line" - if {"[string tolower "$cmd"]" == "-prop"} { - set props [hlistprop $tc_root] - #sct print "<<$props>>" - foreach prop $props { - #sct print "prop: $prop" - set flds [split $prop "="] - #sct print "flds: $flds" - if {[llength $flds] > 1} { - set fld0 [lindex $flds 0] - #sct print "fld0: $fld0" - if {[hpropexists $tc_root $fld0]} { - sct print "$space - [hgetprop $tc_root $fld0]" - } - } - } - } - foreach node [hlist $tc_root] { - [ns]::wrNode $tc_root/$node "$cmd" [expr {$level + 1}] - } - } - - proc wrTree {tc_root nextState cmd} { - debug_log 1 "wrTree root=$tc_root sct=[sct] cmd=$cmd target=[sct target]" - sct print "$tc_root" - [ns]::wrNode $tc_root "[sct target]" 1 - return idle - } - - ## - # @brief createNode() creates a node for the given nodename with the properties given - # - # @param scobj_hpath string variable holding the path to the object's base node in sics (/sample/tc1) - # @param sct_controller name of the scriptcontext object (typically sct_xxx_yyy) - # @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 writable set to 1 if the node represents a request for a change in settings sent to the device - # @param drivable if set to 1 it prepares the node to provide a drivable interface - # @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 wrCmd actual device write command to be sent to the device - # @param wrFunc Function to be called to send the wrCmd to the device, typically setValue() - # @param allowedValues allowed values for the node data - does not permit other - # @param klass Nexus class name (?) - # @return OK - proc createNode {scobj_hpath sct_controller\ - cmdGroup varName\ - readable writable drivable\ - dataType permission\ - rdCmd rdFunc\ - wrCmd wrFunc\ - allowedValues klass} { - - set catch_status [ catch { - set ns "[ns]" - set nodeName "$scobj_hpath/$cmdGroup/$varName" - if {1 > [string length $cmdGroup]} { - set nodeName "$scobj_hpath/$varName" - } - debug_log 1 "Creating node $nodeName" - hfactory $nodeName plain $permission $dataType - if {$readable > 0} { - # the node is readable so set it up to be polled using the rdFunc - # rdFunc is getValueFunc.rdValueFunc with both explicit functions - # or rdValueFunc where "getValue" is the implied getValueFunc - set parts [split "$rdFunc" "."] - if { [llength $parts] == 2 } { - set func_name [lindex $parts 0] - set next_state [lindex $parts 1] - } else { - set func_name "getValue" - set next_state [lindex $parts 0] - } - hsetprop $nodeName read ${ns}::$func_name $scobj_hpath $next_state $rdCmd - hsetprop $nodeName $next_state ${ns}::$next_state $scobj_hpath - # set the poll rate as a period in seconds - # TODO allow directly settable value in seconds - set poll_period 5 - if { $readable >= 0 && $readable <= 300 } { - set poll_period [expr {int($readable)}] - } - debug_log 1 "Registering node $nodeName for poll at $poll_period seconds" - $sct_controller poll $nodeName $poll_period - } - if {$writable == 1} { - # the node is writable so set it up to invoke a callback when written - # rdFunc is putValueFunc.chkWriteFunc with both explicit functions - # or putValueFunc where "noResponse" is the implied chkWriteFunc - set parts [split "$wrFunc" "."] - if { [llength $parts] == 2 } { - set func_name [lindex $parts 0] - set next_state [lindex $parts 1] - } else { - set func_name [lindex $parts 0] - set next_state "noResponse" - } - hsetprop $nodeName write ${ns}::$func_name $scobj_hpath $next_state $wrCmd - hsetprop $nodeName $next_state ${ns}::$next_state $scobj_hpath - hsetprop $nodeName writestatus UNKNOWN - debug_log 1 "Registering node $nodeName for write callback" - $sct_controller write $nodeName - } - # Initialise the previous value to test against - switch -exact $dataType { - "none" { } - "int" { hsetprop $nodeName oldval -1 } - "float" { hsetprop $nodeName oldval -1.0 } - default { hsetprop $nodeName oldval UNKNOWN } - } - # Set the allowed values property - if {1 < [string length $allowedValues]} { - hsetprop $nodeName values $allowedValues - } - # Drive adapter interface - # TODO make it a separate function and pass in all this stuff - if {$drivable == 1} { - hsetprop $nodeName check ${ns}::check $scobj_hpath - hsetprop $nodeName driving 0 - hsetprop $nodeName checklimits ${ns}::check $scobj_hpath - hsetprop $nodeName checkstatus ${ns}::drivestatus $scobj_hpath - hsetprop $nodeName halt ${ns}::halt $scobj_hpath - } else { - hsetprop $nodeName driving 0 - } - } catch_message ] - if {$catch_status != 0} { - debug_log 5 "error in [ns]::createNode $catch_message" - return -code error "in [ns]::createNode $catch_message" - } - return OK - } - - proc mk_sct_driver {sct_controller the_klass the_name tol CID CTYPE} { - debug_log 1 "mk_sct_driver $sct_controller $the_klass $the_name $tol $CID $CTYPE" - set catch_status [ catch { - - MakeSICSObj $the_name SCT_OBJECT - sicslist setatt $the_name klass $the_klass - sicslist setatt $the_name long_name $the_name - - set scobj_hpath /sics/$the_name - - hfactory $scobj_hpath/Loop1 plain spy none - hfactory $scobj_hpath/Loop2 plain spy none - hfactory $scobj_hpath/Loop3 plain spy none - hfactory $scobj_hpath/Loop4 plain spy none - hfactory $scobj_hpath/Level plain spy none - - set deviceCommand {\ - Loop1 setpoint 5 1 1 float user {READ:DEV:MB1.T1:TEMP:LOOP:TSET} {rdValue} {SET:DEV:MB1.T1:TEMP:LOOP:TSET} {setPoint} {1:333}\ - Loop1 sensor 1 0 0 float user {READ:DEV:MB1.T1:TEMP:SIG:TEMP} {rdValue} {} {} {}\ - Loop1 nick 5 0 0 text user {READ:DEV:MB1.T1:TEMP:NICK} {rdText} {} {} {}\ - Loop1 temp 0 0 0 text user {READ:DEV:MB1.T1:TEMP} {rdTextAll} {} {} {}\ - Loop1 loop 0 0 0 text user {READ:DEV:MB1.T1:TEMP:LOOP} {rdTextAll} {} {} {}\ - Loop1 heater 0 0 0 text user {READ:DEV:MB0.H1:HTR} {rdTextAll} {} {} {}\ - Loop1 power 5 0 0 float user {READ:DEV:MB0.H1:HTR:SIG:POWR} {rdValue} {} {} {}\ - Loop2 setpoint 5 1 1 float user {READ:DEV:DB6.T1:TEMP:LOOP:TSET} {rdValue} {SET:DEV:DB6.T1:TEMP:LOOP:TSET} {setPoint} {1:333}\ - Loop2 sensor 1 0 0 float user {READ:DEV:DB6.T1:TEMP:SIG:TEMP} {rdValue} {} {} {}\ - Loop2 nick 5 0 0 text user {READ:DEV:DB6.T1:TEMP:NICK} {rdText} {} {} {}\ - Loop2 temp 0 0 0 text user {READ:DEV:DB6.T1:TEMP} {rdTextAll} {} {} {}\ - Loop2 loop 0 0 0 text user {READ:DEV:DB6.T1:TEMP:LOOP} {rdTextAll} {} {} {}\ - Loop2 heater 0 0 0 text user {READ:DEV:DB1.H1:HTR} {rdTextAll} {} {} {}\ - Loop2 power 5 0 0 float user {READ:DEV:DB1.H1:HTR:SIG:POWR} {rdValue} {} {} {}\ - Loop3 setpoint 5 1 1 float user {READ:DEV:DB7.T1:TEMP:LOOP:TSET} {rdValue} {SET:DEV:DB7.T1:TEMP:LOOP:TSET} {setPoint} {1:333}\ - Loop3 sensor 1 0 0 float user {READ:DEV:DB7.T1:TEMP:SIG:TEMP} {rdValue} {} {} {}\ - Loop3 nick 5 0 0 text user {READ:DEV:DB7.T1:TEMP:NICK} {rdText} {} {} {}\ - Loop3 temp 0 0 0 text user {READ:DEV:DB7.T1:TEMP} {rdTextAll} {} {} {}\ - Loop3 loop 0 0 0 text user {READ:DEV:DB7.T1:TEMP:LOOP} {rdTextAll} {} {} {}\ - Loop3 heater 0 0 0 text user {READ:DEV:DB2.H1:HTR} {rdTextAll} {} {} {}\ - Loop3 power 5 0 0 float user {READ:DEV:DB2.H1:HTR:SIG:POWR} {rdValue} {} {} {}\ - Loop4 setpoint 5 1 1 float user {READ:DEV:DB8.T1:TEMP:LOOP:TSET} {rdValue} {SET:DEV:DB8.T1:TEMP:LOOP:TSET} {setPoint} {1:333}\ - Loop4 sensor 1 0 0 float user {READ:DEV:DB8.T1:TEMP:SIG:TEMP} {rdValue} {} {} {}\ - Loop4 nick 5 0 0 text user {READ:DEV:DB8.T1:TEMP:NICK} {rdText} {} {} {}\ - Loop4 temp 0 0 0 text user {READ:DEV:DB8.T1:TEMP} {rdTextAll} {} {} {}\ - Loop4 loop 0 0 0 text user {READ:DEV:DB7.T1:TEMP:LOOP} {rdTextAll} {} {} {}\ - Loop4 heater 0 0 0 text user {READ:DEV:DB3.H1:HTR} {rdTextAll} {} {} {}\ - Loop4 power 5 0 0 float user {READ:DEV:DB3.H1:HTR:SIG:POWR} {rdValue} {} {} {}\ - Level Nitrogen 15 0 0 float user {READ:DEV:DB5.L1:LVL:SIG:NIT:LEV} {rdValue} {} {} {}\ - Level Helium 15 0 0 float user {READ:DEV:DB5.L1:LVL:SIG:HEL:LEV} {rdValue} {} {} {}\ - } - - foreach {cmdGroup varName\ - readable writable drivable\ - dataType permission\ - rdCmd rdFunc\ - wrCmd wrFunc\ - allowedValues} $deviceCommand { - [ns]::createNode $scobj_hpath $sct_controller\ - $cmdGroup $varName\ - $readable $writable $drivable\ - $dataType $permission\ - $rdCmd $rdFunc\ - $wrCmd $wrFunc\ - $allowedValues $the_klass - } - - foreach cmdGroup { Loop1 Loop2 Loop3 Loop4 } { - set pathName "$scobj_hpath/$cmdGroup" - hsetprop $pathName type part - hsetprop $pathName klass NXsensor - hsetprop $pathName privilege spy - hsetprop $pathName control true - hsetprop $pathName data true - hsetprop $pathName nxsave true - hsetprop $pathName/setpoint tolerance $tol - hsetprop $pathName/setpoint settletime 5 - foreach varName { setpoint sensor nick } { - set nodeName "$pathName/$varName" - hsetprop $nodeName nxalias ${the_name}_${cmdGroup}_${varName}_value - hsetprop $nodeName long_name $varName - hsetprop $nodeName klass sensor - hsetprop $nodeName priviledge user - hsetprop $nodeName control true - hsetprop $nodeName data true - hsetprop $nodeName nxsave true - hsetprop $nodeName mutable true - hsetprop $nodeName sdsinfo ::nexus::scobj::sdsinfo - } - } - - foreach cmdGroup { Level } { - set pathName "$scobj_hpath/$cmdGroup" - hsetprop $pathName type part - hsetprop $pathName klass NXsensor - hsetprop $pathName privilege spy - hsetprop $pathName control true - hsetprop $pathName data true - hsetprop $pathName nxsave true - foreach varName { Nitrogen Helium } { - set nodeName "$pathName/$varName" - hsetprop $nodeName long_name $varName - hsetprop $nodeName klass sensor - hsetprop $nodeName priviledge user - hsetprop $nodeName control true - hsetprop $nodeName data true - hsetprop $nodeName nxsave true - hsetprop $nodeName nxalias ${the_name}_${cmdGroup}_${varName}_value - hsetprop $nodeName mutable true - hsetprop $nodeName sdsinfo ::nexus::scobj::sdsinfo - } - } - - hfactory $scobj_hpath/device_state plain spy none - hset $scobj_hpath/device_state "STATE_INIT" - hsetprop $scobj_hpath/device_state substate 0 - - set point 0 - set catch_status_2 [ catch { - hsetprop $scobj_hpath privilege spy - hsetprop $scobj_hpath long_name $the_name - hsetprop $scobj_hpath sicsdev $the_name - hsetprop $scobj_hpath nxalias $the_name - hsetprop $scobj_hpath control true - hsetprop $scobj_hpath data true - hsetprop $scobj_hpath nxsave true - hsetprop $scobj_hpath mutable true - hsetprop $scobj_hpath klass parameter - hsetprop $scobj_hpath sdsinfo ::nexus::scobj::sdsinfo - set point 1 -if {0} { - ::scobj::hinitprops $the_name Loop1 - set point 2 - ::scobj::hinitprops $the_name Loop2/setpoint - set point 3 - ::scobj::hinitprops $the_name Loop3/setpoint - set point 4 - ::scobj::hinitprops $the_name Loop4/setpoint - set point 5 -} - } catch_message_2 ] - if {$catch_status_2 != 0} { - debug_log 5 "error in [ns]::mk_sct_driver($point) $catch_message_2" - return -code error "in [ns]::mk_sct_driver($point) $catch_message_2" - } - hsetprop $scobj_hpath/Loop1/setpoint permlink data_set ${CTYPE}${CID}SP1 - hsetprop $scobj_hpath/Loop1/setpoint @description ${CTYPE}${CID}SP1 - hsetprop $scobj_hpath/Loop1/setpoint permlink data_set ${CTYPE}${CID}SP1 - hsetprop $scobj_hpath/Loop1/setpoint @description ${CTYPE}${CID}SP1 - hsetprop $scobj_hpath/Loop2/setpoint permlink data_set ${CTYPE}${CID}SP2 - hsetprop $scobj_hpath/Loop2/setpoint @description ${CTYPE}${CID}SP2 - hsetprop $scobj_hpath/Loop3/setpoint permlink data_set ${CTYPE}${CID}SP3 - hsetprop $scobj_hpath/Loop3/setpoint @description ${CTYPE}${CID}SP3 - hsetprop $scobj_hpath/Loop4/setpoint permlink data_set ${CTYPE}${CID}SP4 - hsetprop $scobj_hpath/Loop4/setpoint @description ${CTYPE}${CID}SP4 - - hsetprop $scobj_hpath/Loop1/sensor permlink data_set ${CTYPE}${CID}S1 - hsetprop $scobj_hpath/Loop1/sensor @description ${CTYPE}${CID}S1 - hsetprop $scobj_hpath/Loop2/sensor permlink data_set ${CTYPE}${CID}S2 - hsetprop $scobj_hpath/Loop2/sensor @description ${CTYPE}${CID}S2 - hsetprop $scobj_hpath/Loop3/sensor permlink data_set ${CTYPE}${CID}S3 - hsetprop $scobj_hpath/Loop3/sensor @description ${CTYPE}${CID}S3 - hsetprop $scobj_hpath/Loop4/sensor permlink data_set ${CTYPE}${CID}S4 - hsetprop $scobj_hpath/Loop4/sensor @description ${CTYPE}${CID}S4 - - if {[SplitReply [environment_simulation]]=="false"} { - hsetprop $scobj_hpath/Loop1/setpoint type drivable - hsetprop $scobj_hpath/Loop2/setpoint type drivable - hsetprop $scobj_hpath/Loop3/setpoint type drivable - hsetprop $scobj_hpath/Loop4/setpoint type drivable - ansto_makesctdrive ${the_name}_loop1 $scobj_hpath/Loop1/setpoint $scobj_hpath/Loop1/sensor $sct_controller - ansto_makesctdrive ${the_name}_loop2 $scobj_hpath/Loop2/setpoint $scobj_hpath/Loop2/sensor $sct_controller - ansto_makesctdrive ${the_name}_loop3 $scobj_hpath/Loop3/setpoint $scobj_hpath/Loop3/sensor $sct_controller - ansto_makesctdrive ${the_name}_loop4 $scobj_hpath/Loop4/setpoint $scobj_hpath/Loop4/sensor $sct_controller - } - } catch_message ] - if {$catch_status != 0} { - debug_log 5 "error in [ns]::mk_sct_driver $catch_message" - return -code error "in [ns]::mk_sct_driver $catch_message" - } - } - - proc add_[set vendor]_[set device] {the_name IP port CID CTYPE terminator {_tol 5.0}} { - set [ns]::log_file "../log/[set [ns]::ven_dev]_[set the_name].log" - 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}" - 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 - } - debug_log 1 "::scobj::oxford_mercury::mk_sct_driver sct_${the_name} environment ${the_name} ${_tol} $CID $CTYPE" - ::scobj::oxford_mercury::mk_sct_driver sct_${the_name} environment ${the_name} ${_tol} $CID $CTYPE - } - - - namespace export add_[set vendor]_[set device] + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} } -namespace import ::scobj::[set vendor]_[set device]::* +# function to write a parameter value on a device +proc ::scobj::oxford_mercury::setValue {tc_root nextState cmd_str} { + set catch_status [ catch { + debug_log ${tc_root} 1 "setValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set par [sct target] + set cmd "${cmd_str}${par}" +# setValue hook code goes here + if { [hpropexists [sct] driving] } { + if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { + sct driving 1 + } + } + debug_log ${tc_root} 1 "setValue sct send ${cmd}" + if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { + sct send "${cmd}" + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} +# function to write a parameter value on a device +proc ::scobj::oxford_mercury::setValve {tc_root nextState cmd_str} { + set catch_status [ catch { + debug_log ${tc_root} 1 "setValve tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set par [sct target] + set cmd "${cmd_str}${par}" +# setValve hook code goes here + if { [hpropexists [sct] driving] } { + if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { + sct driving 1 + } + } + debug_log ${tc_root} 1 "setValve sct send ${cmd}" + if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { + sct send "${cmd}" + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} +# function to write a parameter value on a device +proc ::scobj::oxford_mercury::wrOnOff {tc_root nextState cmd_str} { + set catch_status [ catch { + debug_log ${tc_root} 1 "wrOnOff tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set par [sct target] + set cmd "${cmd_str}${par}" +# wrOnOff hook code starts + if { ${par} == 1 } { + set cmd "${cmd_str}ON" + } else { + set cmd "${cmd_str}OFF" + } +# wrOnOff hook code ends + if { [hpropexists [sct] geterror] } { + debug_log ${tc_root} 9 "[sct] error: [sct geterror]" + error "[sct geterror]" + } + if { [hpropexists [sct] driving] } { + if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { + sct driving 1 + } + } + debug_log ${tc_root} 1 "wrOnOff sct send ${cmd}" + if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { + sct send "${cmd}" + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +proc ::scobj::oxford_mercury::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id {cards NNNNNNNN} {assoc 00000000} {ttol 1} {ptol 5} {vtol 5} } { + ::scobj::oxford_mercury::sics_log 9 "::scobj::oxford_mercury::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${cards} ${assoc} ${ttol} ${ptol} ${vtol}" + set ns "[namespace current]" + set catch_status [ catch { + + MakeSICSObj ${name} SCT_OBJECT + + sicslist setatt ${name} klass ${device_class} + sicslist setatt ${name} long_name ${name} + + set scobj_hpath /sics/${name} + + hsetprop ${scobj_hpath} assoc "${assoc}" + hsetprop ${scobj_hpath} cards "${cards}" + hsetprop ${scobj_hpath} data "true" + hsetprop ${scobj_hpath} klass "@none" + hsetprop ${scobj_hpath} type "part" + + if {[string equal -nocase [string index ${cards} 4] L]} { + hfactory ${scobj_hpath}/level plain spy none + + hfactory ${scobj_hpath}/level/helium plain user float + hsetprop ${scobj_hpath}/level/helium read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB5.L1:LVL:SIG:HEL:LEV} + hsetprop ${scobj_hpath}/level/helium rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/level/helium control true + hsetprop ${scobj_hpath}/level/helium data true + hsetprop ${scobj_hpath}/level/helium mutable true + hsetprop ${scobj_hpath}/level/helium nxsave true + hsetprop ${scobj_hpath}/level/helium permlink data_set "T[format "%02d" ${id}]He" + hsetprop ${scobj_hpath}/level/helium @description "T[format "%02d" ${id}]He" + hsetprop ${scobj_hpath}/level/helium oldval 0.0 + hsetprop ${scobj_hpath}/level/helium klass "parameter" + hsetprop ${scobj_hpath}/level/helium sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/level/helium type "part" + hsetprop ${scobj_hpath}/level/helium nxalias "${name}_level_helium" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/level/helium 15 + hsetprop ${scobj_hpath}/level/helium simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/level/helium simulated true + } + + hfactory ${scobj_hpath}/level/nick plain user text + hsetprop ${scobj_hpath}/level/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB5.L1:LVL:NICK} + hsetprop ${scobj_hpath}/level/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/level/nick control true + hsetprop ${scobj_hpath}/level/nick data true + hsetprop ${scobj_hpath}/level/nick mutable true + hsetprop ${scobj_hpath}/level/nick nxsave true + hsetprop ${scobj_hpath}/level/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/level/nick klass "parameter" + hsetprop ${scobj_hpath}/level/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/level/nick type "part" + hsetprop ${scobj_hpath}/level/nick nxalias "${name}_level_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/level/nick 15 + hsetprop ${scobj_hpath}/level/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/level/nick simulated true + } + + hfactory ${scobj_hpath}/level/nitrogen plain user float + hsetprop ${scobj_hpath}/level/nitrogen read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB5.L1:LVL:SIG:NIT:LEV} + hsetprop ${scobj_hpath}/level/nitrogen rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/level/nitrogen control true + hsetprop ${scobj_hpath}/level/nitrogen data true + hsetprop ${scobj_hpath}/level/nitrogen mutable true + hsetprop ${scobj_hpath}/level/nitrogen nxsave true + hsetprop ${scobj_hpath}/level/nitrogen permlink data_set "T[format "%02d" ${id}]N2" + hsetprop ${scobj_hpath}/level/nitrogen @description "T[format "%02d" ${id}]N2" + hsetprop ${scobj_hpath}/level/nitrogen oldval 0.0 + hsetprop ${scobj_hpath}/level/nitrogen klass "parameter" + hsetprop ${scobj_hpath}/level/nitrogen sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/level/nitrogen type "part" + hsetprop ${scobj_hpath}/level/nitrogen nxalias "${name}_level_nitrogen" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/level/nitrogen 15 + hsetprop ${scobj_hpath}/level/nitrogen simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/level/nitrogen simulated true + } + hsetprop ${scobj_hpath}/level data "true" + hsetprop ${scobj_hpath}/level klass "@none" + hsetprop ${scobj_hpath}/level type "part" + } + + if {[string equal -nocase [string index ${cards} 4] P]} { + hfactory ${scobj_hpath}/pres5 plain spy none + + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 4] 4]} { + hfactory ${scobj_hpath}/pres5/auto plain user int + hsetprop ${scobj_hpath}/pres5/auto read ${ns}::getValue ${scobj_hpath} rdOnOff {READ:DEV:DB5.P1:PRES:LOOP:FAUT} + hsetprop ${scobj_hpath}/pres5/auto rdOnOff ${ns}::rdOnOff ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/auto write ${ns}::wrOnOff ${scobj_hpath} noResponse {SET:DEV:DB5.P1:PRES:LOOP:FAUT:} + hsetprop ${scobj_hpath}/pres5/auto noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/auto check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/auto control true + hsetprop ${scobj_hpath}/pres5/auto data true + hsetprop ${scobj_hpath}/pres5/auto mutable true + hsetprop ${scobj_hpath}/pres5/auto nxsave true + hsetprop ${scobj_hpath}/pres5/auto values 0,1 + hsetprop ${scobj_hpath}/pres5/auto oldval 0 + hsetprop ${scobj_hpath}/pres5/auto klass "parameter" + hsetprop ${scobj_hpath}/pres5/auto sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres5/auto type "part" + hsetprop ${scobj_hpath}/pres5/auto nxalias "${name}_pres5_auto" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres5/auto 5 + ${sct_controller} write ${scobj_hpath}/pres5/auto + hsetprop ${scobj_hpath}/pres5/auto simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres5/auto simulated true + } + } + + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 4] 4]} { + hfactory ${scobj_hpath}/pres5/enab plain user int + hsetprop ${scobj_hpath}/pres5/enab read ${ns}::getValue ${scobj_hpath} rdOnOff {READ:DEV:DB5.P1:PRES:LOOP:ENAB} + hsetprop ${scobj_hpath}/pres5/enab rdOnOff ${ns}::rdOnOff ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/enab write ${ns}::wrOnOff ${scobj_hpath} noResponse {SET:DEV:DB5.P1:PRES:LOOP:ENAB:} + hsetprop ${scobj_hpath}/pres5/enab noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/enab check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/enab control true + hsetprop ${scobj_hpath}/pres5/enab data true + hsetprop ${scobj_hpath}/pres5/enab mutable true + hsetprop ${scobj_hpath}/pres5/enab nxsave true + hsetprop ${scobj_hpath}/pres5/enab values 0,1 + hsetprop ${scobj_hpath}/pres5/enab oldval 0 + hsetprop ${scobj_hpath}/pres5/enab klass "parameter" + hsetprop ${scobj_hpath}/pres5/enab sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres5/enab type "part" + hsetprop ${scobj_hpath}/pres5/enab nxalias "${name}_pres5_enab" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres5/enab 5 + ${sct_controller} write ${scobj_hpath}/pres5/enab + hsetprop ${scobj_hpath}/pres5/enab simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres5/enab simulated true + } + } + + hfactory ${scobj_hpath}/pres5/fset plain user float + hsetprop ${scobj_hpath}/pres5/fset read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB5.P1:PRES:LOOP:FSET} + hsetprop ${scobj_hpath}/pres5/fset rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/fset write ${ns}::setValue ${scobj_hpath} noResponse {SET:DEV:DB5.P1:PRES:LOOP:FSET:} + hsetprop ${scobj_hpath}/pres5/fset noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/fset check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/fset control true + hsetprop ${scobj_hpath}/pres5/fset data true + hsetprop ${scobj_hpath}/pres5/fset mutable true + hsetprop ${scobj_hpath}/pres5/fset nxsave true + hsetprop ${scobj_hpath}/pres5/fset lowerlimit 0 + hsetprop ${scobj_hpath}/pres5/fset upperlimit 100 + hsetprop ${scobj_hpath}/pres5/fset oldval 0.0 + hsetprop ${scobj_hpath}/pres5/fset klass "parameter" + hsetprop ${scobj_hpath}/pres5/fset sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres5/fset type "part" + hsetprop ${scobj_hpath}/pres5/fset nxalias "${name}_pres5_fset" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres5/fset 5 + ${sct_controller} write ${scobj_hpath}/pres5/fset + hsetprop ${scobj_hpath}/pres5/fset simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres5/fset simulated true + } + + hfactory ${scobj_hpath}/pres5/nick plain user text + hsetprop ${scobj_hpath}/pres5/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB5.P1:PRES:NICK} + hsetprop ${scobj_hpath}/pres5/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/nick control true + hsetprop ${scobj_hpath}/pres5/nick data true + hsetprop ${scobj_hpath}/pres5/nick mutable true + hsetprop ${scobj_hpath}/pres5/nick nxsave true + hsetprop ${scobj_hpath}/pres5/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/pres5/nick klass "parameter" + hsetprop ${scobj_hpath}/pres5/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres5/nick type "part" + hsetprop ${scobj_hpath}/pres5/nick nxalias "${name}_pres5_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres5/nick 15 + hsetprop ${scobj_hpath}/pres5/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres5/nick simulated true + } + + hfactory ${scobj_hpath}/pres5/sensor plain user float + hsetprop ${scobj_hpath}/pres5/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB5.P1:PRES:SIG:PRES} + hsetprop ${scobj_hpath}/pres5/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/sensor control true + hsetprop ${scobj_hpath}/pres5/sensor data true + hsetprop ${scobj_hpath}/pres5/sensor mutable true + hsetprop ${scobj_hpath}/pres5/sensor nxsave true + hsetprop ${scobj_hpath}/pres5/sensor units mB + hsetprop ${scobj_hpath}/pres5/sensor permlink data_set "P[format "%02d" ${id}]PS05" + hsetprop ${scobj_hpath}/pres5/sensor @description "P[format "%02d" ${id}]PS05" + hsetprop ${scobj_hpath}/pres5/sensor oldval 0.0 + hsetprop ${scobj_hpath}/pres5/sensor klass "parameter" + hsetprop ${scobj_hpath}/pres5/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres5/sensor type "part" + hsetprop ${scobj_hpath}/pres5/sensor nxalias "${name}_pres5_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres5/sensor 1 + hsetprop ${scobj_hpath}/pres5/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres5/sensor simulated true + } + + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 4] 4]} { + hfactory ${scobj_hpath}/pres5/setpoint plain user float + hsetprop ${scobj_hpath}/pres5/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB5.P1:PRES:LOOP:TSET} + hsetprop ${scobj_hpath}/pres5/setpoint rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/setpoint write ${ns}::setPoint ${scobj_hpath} noResponse {SET:DEV:DB8.P1:PRES:LOOP:TSET:} + hsetprop ${scobj_hpath}/pres5/setpoint noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/setpoint check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/setpoint driving 0 + hsetprop ${scobj_hpath}/pres5/setpoint checklimits ${ns}::checklimits ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/setpoint halt ${ns}::halt ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/setpoint driveable pres5/sensor + hsetprop ${scobj_hpath}/pres5/setpoint control true + hsetprop ${scobj_hpath}/pres5/setpoint data true + hsetprop ${scobj_hpath}/pres5/setpoint mutable true + hsetprop ${scobj_hpath}/pres5/setpoint nxsave true + hsetprop ${scobj_hpath}/pres5/setpoint lowerlimit 0 + hsetprop ${scobj_hpath}/pres5/setpoint upperlimit 333 + hsetprop ${scobj_hpath}/pres5/setpoint tolerance ${ptol} + hsetprop ${scobj_hpath}/pres5/setpoint units mB + hsetprop ${scobj_hpath}/pres5/setpoint permlink data_set "P[format "%02d" ${id}]PSP05" + hsetprop ${scobj_hpath}/pres5/setpoint @description "P[format "%02d" ${id}]PSP05" + hsetprop ${scobj_hpath}/pres5/setpoint oldval 0.0 + hsetprop ${scobj_hpath}/pres5/setpoint klass "parameter" + hsetprop ${scobj_hpath}/pres5/setpoint sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres5/setpoint settle_time "15" + hsetprop ${scobj_hpath}/pres5/setpoint type "drivable" + hsetprop ${scobj_hpath}/pres5/setpoint nxalias "${name}_pres5_setpoint" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres5/setpoint 5 + ${sct_controller} write ${scobj_hpath}/pres5/setpoint + hsetprop ${scobj_hpath}/pres5/setpoint simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres5/setpoint simulated true + } + } + + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 4] 4]} { + hfactory ${scobj_hpath}/pres5/valve plain user float + hsetprop ${scobj_hpath}/pres5/valve read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB4.G1:AUX:SIG:PERC} + hsetprop ${scobj_hpath}/pres5/valve rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/valve control true + hsetprop ${scobj_hpath}/pres5/valve data true + hsetprop ${scobj_hpath}/pres5/valve mutable true + hsetprop ${scobj_hpath}/pres5/valve nxsave true + hsetprop ${scobj_hpath}/pres5/valve oldval 0.0 + hsetprop ${scobj_hpath}/pres5/valve klass "parameter" + hsetprop ${scobj_hpath}/pres5/valve sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres5/valve type "part" + hsetprop ${scobj_hpath}/pres5/valve nxalias "${name}_pres5_valve" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres5/valve 5 + hsetprop ${scobj_hpath}/pres5/valve simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres5/valve simulated true + } + } + hsetprop ${scobj_hpath}/pres5 data "true" + hsetprop ${scobj_hpath}/pres5 klass "@none" + hsetprop ${scobj_hpath}/pres5 type "part" + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 4] 4]} { + ansto_makesctdrive ${name}_pres5_setpoint ${scobj_hpath}/pres5/setpoint ${scobj_hpath}/pres5/sensor ${sct_controller} + } + } + + if {[string equal -nocase [string index ${cards} 7] P]} { + hfactory ${scobj_hpath}/pres8 plain spy none + + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 7] 4]} { + hfactory ${scobj_hpath}/pres8/auto plain user int + hsetprop ${scobj_hpath}/pres8/auto read ${ns}::getValue ${scobj_hpath} rdOnOff {READ:DEV:DB8.P1:PRES:LOOP:FAUT} + hsetprop ${scobj_hpath}/pres8/auto rdOnOff ${ns}::rdOnOff ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/auto write ${ns}::wrOnOff ${scobj_hpath} noResponse {SET:DEV:DB8.P1:PRES:LOOP:FAUT:} + hsetprop ${scobj_hpath}/pres8/auto noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/auto check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/auto control true + hsetprop ${scobj_hpath}/pres8/auto data true + hsetprop ${scobj_hpath}/pres8/auto mutable true + hsetprop ${scobj_hpath}/pres8/auto nxsave true + hsetprop ${scobj_hpath}/pres8/auto values 0,1 + hsetprop ${scobj_hpath}/pres8/auto oldval 0 + hsetprop ${scobj_hpath}/pres8/auto klass "parameter" + hsetprop ${scobj_hpath}/pres8/auto sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres8/auto type "part" + hsetprop ${scobj_hpath}/pres8/auto nxalias "${name}_pres8_auto" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres8/auto 5 + ${sct_controller} write ${scobj_hpath}/pres8/auto + hsetprop ${scobj_hpath}/pres8/auto simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres8/auto simulated true + } + } + + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 7] 4]} { + hfactory ${scobj_hpath}/pres8/enab plain user int + hsetprop ${scobj_hpath}/pres8/enab read ${ns}::getValue ${scobj_hpath} rdOnOff {READ:DEV:DB8.P1:PRES:LOOP:ENAB} + hsetprop ${scobj_hpath}/pres8/enab rdOnOff ${ns}::rdOnOff ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/enab write ${ns}::wrOnOff ${scobj_hpath} noResponse {SET:DEV:DB8.P1:PRES:LOOP:ENAB:} + hsetprop ${scobj_hpath}/pres8/enab noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/enab check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/enab control true + hsetprop ${scobj_hpath}/pres8/enab data true + hsetprop ${scobj_hpath}/pres8/enab mutable true + hsetprop ${scobj_hpath}/pres8/enab nxsave true + hsetprop ${scobj_hpath}/pres8/enab values 0,1 + hsetprop ${scobj_hpath}/pres8/enab oldval 0 + hsetprop ${scobj_hpath}/pres8/enab klass "parameter" + hsetprop ${scobj_hpath}/pres8/enab sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres8/enab type "part" + hsetprop ${scobj_hpath}/pres8/enab nxalias "${name}_pres8_enab" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres8/enab 5 + ${sct_controller} write ${scobj_hpath}/pres8/enab + hsetprop ${scobj_hpath}/pres8/enab simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres8/enab simulated true + } + } + + hfactory ${scobj_hpath}/pres8/fset plain user float + hsetprop ${scobj_hpath}/pres8/fset read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.P1:PRES:LOOP:FSET} + hsetprop ${scobj_hpath}/pres8/fset rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/fset write ${ns}::setValue ${scobj_hpath} noResponse {SET:DEV:DB8.P1:PRES:LOOP:FSET:} + hsetprop ${scobj_hpath}/pres8/fset noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/fset check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/fset control true + hsetprop ${scobj_hpath}/pres8/fset data true + hsetprop ${scobj_hpath}/pres8/fset mutable true + hsetprop ${scobj_hpath}/pres8/fset nxsave true + hsetprop ${scobj_hpath}/pres8/fset lowerlimit 0 + hsetprop ${scobj_hpath}/pres8/fset upperlimit 100 + hsetprop ${scobj_hpath}/pres8/fset oldval 0.0 + hsetprop ${scobj_hpath}/pres8/fset klass "parameter" + hsetprop ${scobj_hpath}/pres8/fset sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres8/fset type "part" + hsetprop ${scobj_hpath}/pres8/fset nxalias "${name}_pres8_fset" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres8/fset 5 + ${sct_controller} write ${scobj_hpath}/pres8/fset + hsetprop ${scobj_hpath}/pres8/fset simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres8/fset simulated true + } + + hfactory ${scobj_hpath}/pres8/nick plain user text + hsetprop ${scobj_hpath}/pres8/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB8.P1:PRES:NICK} + hsetprop ${scobj_hpath}/pres8/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/nick control true + hsetprop ${scobj_hpath}/pres8/nick data true + hsetprop ${scobj_hpath}/pres8/nick mutable true + hsetprop ${scobj_hpath}/pres8/nick nxsave true + hsetprop ${scobj_hpath}/pres8/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/pres8/nick klass "parameter" + hsetprop ${scobj_hpath}/pres8/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres8/nick type "part" + hsetprop ${scobj_hpath}/pres8/nick nxalias "${name}_pres8_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres8/nick 15 + hsetprop ${scobj_hpath}/pres8/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres8/nick simulated true + } + + hfactory ${scobj_hpath}/pres8/sensor plain user float + hsetprop ${scobj_hpath}/pres8/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.P1:PRES:SIG:PRES} + hsetprop ${scobj_hpath}/pres8/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/sensor control true + hsetprop ${scobj_hpath}/pres8/sensor data true + hsetprop ${scobj_hpath}/pres8/sensor mutable true + hsetprop ${scobj_hpath}/pres8/sensor nxsave true + hsetprop ${scobj_hpath}/pres8/sensor units mB + hsetprop ${scobj_hpath}/pres8/sensor permlink data_set "P[format "%02d" ${id}]PS08" + hsetprop ${scobj_hpath}/pres8/sensor @description "P[format "%02d" ${id}]PS08" + hsetprop ${scobj_hpath}/pres8/sensor oldval 0.0 + hsetprop ${scobj_hpath}/pres8/sensor klass "parameter" + hsetprop ${scobj_hpath}/pres8/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres8/sensor type "part" + hsetprop ${scobj_hpath}/pres8/sensor nxalias "${name}_pres8_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres8/sensor 1 + hsetprop ${scobj_hpath}/pres8/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres8/sensor simulated true + } + + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 7] 4]} { + hfactory ${scobj_hpath}/pres8/setpoint plain user float + hsetprop ${scobj_hpath}/pres8/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.P1:PRES:LOOP:TSET} + hsetprop ${scobj_hpath}/pres8/setpoint rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/setpoint write ${ns}::setPoint ${scobj_hpath} noResponse {SET:DEV:DB8.P1:PRES:LOOP:TSET:} + hsetprop ${scobj_hpath}/pres8/setpoint noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/setpoint check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/setpoint driving 0 + hsetprop ${scobj_hpath}/pres8/setpoint checklimits ${ns}::checklimits ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/setpoint halt ${ns}::halt ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/setpoint driveable pres8/sensor + hsetprop ${scobj_hpath}/pres8/setpoint control true + hsetprop ${scobj_hpath}/pres8/setpoint data true + hsetprop ${scobj_hpath}/pres8/setpoint mutable true + hsetprop ${scobj_hpath}/pres8/setpoint nxsave true + hsetprop ${scobj_hpath}/pres8/setpoint lowerlimit 0 + hsetprop ${scobj_hpath}/pres8/setpoint upperlimit 333 + hsetprop ${scobj_hpath}/pres8/setpoint tolerance ${ptol} + hsetprop ${scobj_hpath}/pres8/setpoint units mB + hsetprop ${scobj_hpath}/pres8/setpoint permlink data_set "P[format "%02d" ${id}]PSP08" + hsetprop ${scobj_hpath}/pres8/setpoint @description "P[format "%02d" ${id}]PSP08" + hsetprop ${scobj_hpath}/pres8/setpoint oldval 0.0 + hsetprop ${scobj_hpath}/pres8/setpoint klass "parameter" + hsetprop ${scobj_hpath}/pres8/setpoint sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres8/setpoint settle_time "15" + hsetprop ${scobj_hpath}/pres8/setpoint type "drivable" + hsetprop ${scobj_hpath}/pres8/setpoint nxalias "${name}_pres8_setpoint" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres8/setpoint 5 + ${sct_controller} write ${scobj_hpath}/pres8/setpoint + hsetprop ${scobj_hpath}/pres8/setpoint simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres8/setpoint simulated true + } + } + + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 7] 4]} { + hfactory ${scobj_hpath}/pres8/valve plain user float + hsetprop ${scobj_hpath}/pres8/valve read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB4.G1:AUX:SIG:PERC} + hsetprop ${scobj_hpath}/pres8/valve rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/valve control true + hsetprop ${scobj_hpath}/pres8/valve data true + hsetprop ${scobj_hpath}/pres8/valve mutable true + hsetprop ${scobj_hpath}/pres8/valve nxsave true + hsetprop ${scobj_hpath}/pres8/valve oldval 0.0 + hsetprop ${scobj_hpath}/pres8/valve klass "parameter" + hsetprop ${scobj_hpath}/pres8/valve sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres8/valve type "part" + hsetprop ${scobj_hpath}/pres8/valve nxalias "${name}_pres8_valve" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres8/valve 5 + hsetprop ${scobj_hpath}/pres8/valve simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres8/valve simulated true + } + } + hsetprop ${scobj_hpath}/pres8 data "true" + hsetprop ${scobj_hpath}/pres8 klass "@none" + hsetprop ${scobj_hpath}/pres8 type "part" + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 7] 4]} { + ansto_makesctdrive ${name}_pres8_setpoint ${scobj_hpath}/pres8/setpoint ${scobj_hpath}/pres8/sensor ${sct_controller} + } + } + + hfactory ${scobj_hpath}/temp0 plain spy none + + hfactory ${scobj_hpath}/temp0/auto plain user int + hsetprop ${scobj_hpath}/temp0/auto read ${ns}::getValue ${scobj_hpath} rdOnOff {READ:DEV:MB1.T1:TEMP:LOOP:ENAB} + hsetprop ${scobj_hpath}/temp0/auto rdOnOff ${ns}::rdOnOff ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/auto write ${ns}::wrOnOff ${scobj_hpath} noResponse {SET:DEV:MB1.T1:TEMP:LOOP:ENAB:} + hsetprop ${scobj_hpath}/temp0/auto noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/auto check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/auto control true + hsetprop ${scobj_hpath}/temp0/auto data true + hsetprop ${scobj_hpath}/temp0/auto mutable true + hsetprop ${scobj_hpath}/temp0/auto nxsave true + hsetprop ${scobj_hpath}/temp0/auto values 0,1 + hsetprop ${scobj_hpath}/temp0/auto oldval 0 + hsetprop ${scobj_hpath}/temp0/auto klass "parameter" + hsetprop ${scobj_hpath}/temp0/auto sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp0/auto type "part" + hsetprop ${scobj_hpath}/temp0/auto nxalias "${name}_temp0_auto" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp0/auto 5 + ${sct_controller} write ${scobj_hpath}/temp0/auto + hsetprop ${scobj_hpath}/temp0/auto simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp0/auto simulated true + } + + hfactory ${scobj_hpath}/temp0/nick plain user text + hsetprop ${scobj_hpath}/temp0/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:MB1.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/temp0/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/nick control true + hsetprop ${scobj_hpath}/temp0/nick data true + hsetprop ${scobj_hpath}/temp0/nick mutable true + hsetprop ${scobj_hpath}/temp0/nick nxsave true + hsetprop ${scobj_hpath}/temp0/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/temp0/nick klass "parameter" + hsetprop ${scobj_hpath}/temp0/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp0/nick type "part" + hsetprop ${scobj_hpath}/temp0/nick nxalias "${name}_temp0_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp0/nick 15 + hsetprop ${scobj_hpath}/temp0/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp0/nick simulated true + } + + hfactory ${scobj_hpath}/temp0/sensor plain user float + hsetprop ${scobj_hpath}/temp0/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:MB1.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/temp0/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/sensor control true + hsetprop ${scobj_hpath}/temp0/sensor data true + hsetprop ${scobj_hpath}/temp0/sensor mutable true + hsetprop ${scobj_hpath}/temp0/sensor nxsave true + hsetprop ${scobj_hpath}/temp0/sensor permlink data_set "T[format "%02d" ${id}]S00" + hsetprop ${scobj_hpath}/temp0/sensor @description "T[format "%02d" ${id}]S00" + hsetprop ${scobj_hpath}/temp0/sensor oldval 0.0 + hsetprop ${scobj_hpath}/temp0/sensor klass "parameter" + hsetprop ${scobj_hpath}/temp0/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp0/sensor type "part" + hsetprop ${scobj_hpath}/temp0/sensor nxalias "${name}_temp0_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp0/sensor 1 + hsetprop ${scobj_hpath}/temp0/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp0/sensor simulated true + } + + hfactory ${scobj_hpath}/temp0/setpoint plain user float + hsetprop ${scobj_hpath}/temp0/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:MB1.T1:TEMP:LOOP:TSET} + hsetprop ${scobj_hpath}/temp0/setpoint rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/setpoint write ${ns}::setPoint ${scobj_hpath} noResponse {SET:DEV:MB1.T1:TEMP:LOOP:TSET:} + hsetprop ${scobj_hpath}/temp0/setpoint noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/setpoint check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/setpoint driving 0 + hsetprop ${scobj_hpath}/temp0/setpoint checklimits ${ns}::checklimits ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/setpoint halt ${ns}::halt ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/setpoint driveable temp0/sensor + hsetprop ${scobj_hpath}/temp0/setpoint control true + hsetprop ${scobj_hpath}/temp0/setpoint data true + hsetprop ${scobj_hpath}/temp0/setpoint mutable true + hsetprop ${scobj_hpath}/temp0/setpoint nxsave true + hsetprop ${scobj_hpath}/temp0/setpoint lowerlimit 0 + hsetprop ${scobj_hpath}/temp0/setpoint upperlimit 333 + hsetprop ${scobj_hpath}/temp0/setpoint tolerance ${ttol} + hsetprop ${scobj_hpath}/temp0/setpoint permlink data_set "T[format "%02d" ${id}]SP00" + hsetprop ${scobj_hpath}/temp0/setpoint @description "T[format "%02d" ${id}]SP00" + hsetprop ${scobj_hpath}/temp0/setpoint oldval 0.0 + hsetprop ${scobj_hpath}/temp0/setpoint klass "parameter" + hsetprop ${scobj_hpath}/temp0/setpoint sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp0/setpoint settle_time "15" + hsetprop ${scobj_hpath}/temp0/setpoint type "drivable" + hsetprop ${scobj_hpath}/temp0/setpoint nxalias "${name}_temp0_setpoint" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp0/setpoint 5 + ${sct_controller} write ${scobj_hpath}/temp0/setpoint + hsetprop ${scobj_hpath}/temp0/setpoint simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp0/setpoint simulated true + } + hsetprop ${scobj_hpath}/temp0 data "true" + hsetprop ${scobj_hpath}/temp0 klass "@none" + hsetprop ${scobj_hpath}/temp0 type "part" + + hfactory ${scobj_hpath}/temp0/heater plain spy none + + hfactory ${scobj_hpath}/temp0/heater/hset plain user float + hsetprop ${scobj_hpath}/temp0/heater/hset read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:MB1.T1:TEMP:LOOP:HSET} + hsetprop ${scobj_hpath}/temp0/heater/hset rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/heater/hset write ${ns}::setValue ${scobj_hpath} noResponse {SET:DEV:MB1.T1:TEMP:LOOP:HSET:} + hsetprop ${scobj_hpath}/temp0/heater/hset noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/heater/hset check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/heater/hset control true + hsetprop ${scobj_hpath}/temp0/heater/hset data true + hsetprop ${scobj_hpath}/temp0/heater/hset mutable true + hsetprop ${scobj_hpath}/temp0/heater/hset nxsave true + hsetprop ${scobj_hpath}/temp0/heater/hset lowerlimit 0 + hsetprop ${scobj_hpath}/temp0/heater/hset upperlimit 100 + hsetprop ${scobj_hpath}/temp0/heater/hset oldval 0.0 + hsetprop ${scobj_hpath}/temp0/heater/hset klass "parameter" + hsetprop ${scobj_hpath}/temp0/heater/hset sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp0/heater/hset type "part" + hsetprop ${scobj_hpath}/temp0/heater/hset nxalias "${name}_temp0_heater_hset" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp0/heater/hset 5 + ${sct_controller} write ${scobj_hpath}/temp0/heater/hset + hsetprop ${scobj_hpath}/temp0/heater/hset simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp0/heater/hset simulated true + } + + hfactory ${scobj_hpath}/temp0/heater/perc plain user float + hsetprop ${scobj_hpath}/temp0/heater/perc read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:MB0.H1:HTR:SIG:PERC} + hsetprop ${scobj_hpath}/temp0/heater/perc rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/heater/perc control true + hsetprop ${scobj_hpath}/temp0/heater/perc data true + hsetprop ${scobj_hpath}/temp0/heater/perc mutable true + hsetprop ${scobj_hpath}/temp0/heater/perc nxsave true + hsetprop ${scobj_hpath}/temp0/heater/perc oldval 0.0 + hsetprop ${scobj_hpath}/temp0/heater/perc klass "parameter" + hsetprop ${scobj_hpath}/temp0/heater/perc sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp0/heater/perc type "part" + hsetprop ${scobj_hpath}/temp0/heater/perc nxalias "${name}_temp0_heater_perc" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp0/heater/perc 5 + hsetprop ${scobj_hpath}/temp0/heater/perc simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp0/heater/perc simulated true + } + + hfactory ${scobj_hpath}/temp0/heater/power plain user float + hsetprop ${scobj_hpath}/temp0/heater/power read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:MB0.H1:HTR:SIG:POWR} + hsetprop ${scobj_hpath}/temp0/heater/power rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/heater/power control true + hsetprop ${scobj_hpath}/temp0/heater/power data true + hsetprop ${scobj_hpath}/temp0/heater/power mutable true + hsetprop ${scobj_hpath}/temp0/heater/power nxsave true + hsetprop ${scobj_hpath}/temp0/heater/power oldval 0.0 + hsetprop ${scobj_hpath}/temp0/heater/power klass "parameter" + hsetprop ${scobj_hpath}/temp0/heater/power sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp0/heater/power type "part" + hsetprop ${scobj_hpath}/temp0/heater/power nxalias "${name}_temp0_heater_power" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp0/heater/power 5 + hsetprop ${scobj_hpath}/temp0/heater/power simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp0/heater/power simulated true + } + hsetprop ${scobj_hpath}/temp0/heater data "true" + hsetprop ${scobj_hpath}/temp0/heater klass "@none" + hsetprop ${scobj_hpath}/temp0/heater type "part" + ansto_makesctdrive ${name}_temp0_setpoint ${scobj_hpath}/temp0/setpoint ${scobj_hpath}/temp0/sensor ${sct_controller} + + if {[string equal -nocase [string index ${cards} 0] T]} { + hfactory ${scobj_hpath}/temp1 plain spy none + + hfactory ${scobj_hpath}/temp1/nick plain user text + hsetprop ${scobj_hpath}/temp1/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB1.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/temp1/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/temp1/nick control true + hsetprop ${scobj_hpath}/temp1/nick data true + hsetprop ${scobj_hpath}/temp1/nick mutable true + hsetprop ${scobj_hpath}/temp1/nick nxsave true + hsetprop ${scobj_hpath}/temp1/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/temp1/nick klass "parameter" + hsetprop ${scobj_hpath}/temp1/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp1/nick type "part" + hsetprop ${scobj_hpath}/temp1/nick nxalias "${name}_temp1_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp1/nick 15 + hsetprop ${scobj_hpath}/temp1/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp1/nick simulated true + } + + hfactory ${scobj_hpath}/temp1/sensor plain user float + hsetprop ${scobj_hpath}/temp1/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB1.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/temp1/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp1/sensor control true + hsetprop ${scobj_hpath}/temp1/sensor data true + hsetprop ${scobj_hpath}/temp1/sensor mutable true + hsetprop ${scobj_hpath}/temp1/sensor nxsave true + hsetprop ${scobj_hpath}/temp1/sensor permlink data_set "T[format "%02d" ${id}]S01" + hsetprop ${scobj_hpath}/temp1/sensor @description "T[format "%02d" ${id}]S01" + hsetprop ${scobj_hpath}/temp1/sensor oldval 0.0 + hsetprop ${scobj_hpath}/temp1/sensor klass "parameter" + hsetprop ${scobj_hpath}/temp1/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp1/sensor type "part" + hsetprop ${scobj_hpath}/temp1/sensor nxalias "${name}_temp1_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp1/sensor 1 + hsetprop ${scobj_hpath}/temp1/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp1/sensor simulated true + } + hsetprop ${scobj_hpath}/temp1 data "true" + hsetprop ${scobj_hpath}/temp1 klass "@none" + hsetprop ${scobj_hpath}/temp1 type "part" + } + + if {[string equal -nocase [string index ${cards} 1] T]} { + hfactory ${scobj_hpath}/temp2 plain spy none + + hfactory ${scobj_hpath}/temp2/nick plain user text + hsetprop ${scobj_hpath}/temp2/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB2.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/temp2/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/temp2/nick control true + hsetprop ${scobj_hpath}/temp2/nick data true + hsetprop ${scobj_hpath}/temp2/nick mutable true + hsetprop ${scobj_hpath}/temp2/nick nxsave true + hsetprop ${scobj_hpath}/temp2/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/temp2/nick klass "parameter" + hsetprop ${scobj_hpath}/temp2/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp2/nick type "part" + hsetprop ${scobj_hpath}/temp2/nick nxalias "${name}_temp2_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp2/nick 15 + hsetprop ${scobj_hpath}/temp2/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp2/nick simulated true + } + + hfactory ${scobj_hpath}/temp2/sensor plain user float + hsetprop ${scobj_hpath}/temp2/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB2.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/temp2/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp2/sensor control true + hsetprop ${scobj_hpath}/temp2/sensor data true + hsetprop ${scobj_hpath}/temp2/sensor mutable true + hsetprop ${scobj_hpath}/temp2/sensor nxsave true + hsetprop ${scobj_hpath}/temp2/sensor permlink data_set "T[format "%02d" ${id}]S02" + hsetprop ${scobj_hpath}/temp2/sensor @description "T[format "%02d" ${id}]S02" + hsetprop ${scobj_hpath}/temp2/sensor oldval 0.0 + hsetprop ${scobj_hpath}/temp2/sensor klass "parameter" + hsetprop ${scobj_hpath}/temp2/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp2/sensor type "part" + hsetprop ${scobj_hpath}/temp2/sensor nxalias "${name}_temp2_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp2/sensor 1 + hsetprop ${scobj_hpath}/temp2/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp2/sensor simulated true + } + hsetprop ${scobj_hpath}/temp2 data "true" + hsetprop ${scobj_hpath}/temp2 klass "@none" + hsetprop ${scobj_hpath}/temp2 type "part" + } + + if {[string equal -nocase [string index ${cards} 2] T]} { + hfactory ${scobj_hpath}/temp3 plain spy none + + hfactory ${scobj_hpath}/temp3/nick plain user text + hsetprop ${scobj_hpath}/temp3/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB3.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/temp3/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/temp3/nick control true + hsetprop ${scobj_hpath}/temp3/nick data true + hsetprop ${scobj_hpath}/temp3/nick mutable true + hsetprop ${scobj_hpath}/temp3/nick nxsave true + hsetprop ${scobj_hpath}/temp3/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/temp3/nick klass "parameter" + hsetprop ${scobj_hpath}/temp3/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp3/nick type "part" + hsetprop ${scobj_hpath}/temp3/nick nxalias "${name}_temp3_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp3/nick 15 + hsetprop ${scobj_hpath}/temp3/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp3/nick simulated true + } + + hfactory ${scobj_hpath}/temp3/sensor plain user float + hsetprop ${scobj_hpath}/temp3/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB3.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/temp3/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp3/sensor control true + hsetprop ${scobj_hpath}/temp3/sensor data true + hsetprop ${scobj_hpath}/temp3/sensor mutable true + hsetprop ${scobj_hpath}/temp3/sensor nxsave true + hsetprop ${scobj_hpath}/temp3/sensor permlink data_set "T[format "%02d" ${id}]S03" + hsetprop ${scobj_hpath}/temp3/sensor @description "T[format "%02d" ${id}]S03" + hsetprop ${scobj_hpath}/temp3/sensor oldval 0.0 + hsetprop ${scobj_hpath}/temp3/sensor klass "parameter" + hsetprop ${scobj_hpath}/temp3/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp3/sensor type "part" + hsetprop ${scobj_hpath}/temp3/sensor nxalias "${name}_temp3_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp3/sensor 1 + hsetprop ${scobj_hpath}/temp3/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp3/sensor simulated true + } + hsetprop ${scobj_hpath}/temp3 data "true" + hsetprop ${scobj_hpath}/temp3 klass "@none" + hsetprop ${scobj_hpath}/temp3 type "part" + } + + if {[string equal -nocase [string index ${cards} 3] T]} { + hfactory ${scobj_hpath}/temp4 plain spy none + + hfactory ${scobj_hpath}/temp4/nick plain user text + hsetprop ${scobj_hpath}/temp4/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB4.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/temp4/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/temp4/nick control true + hsetprop ${scobj_hpath}/temp4/nick data true + hsetprop ${scobj_hpath}/temp4/nick mutable true + hsetprop ${scobj_hpath}/temp4/nick nxsave true + hsetprop ${scobj_hpath}/temp4/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/temp4/nick klass "parameter" + hsetprop ${scobj_hpath}/temp4/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp4/nick type "part" + hsetprop ${scobj_hpath}/temp4/nick nxalias "${name}_temp4_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp4/nick 15 + hsetprop ${scobj_hpath}/temp4/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp4/nick simulated true + } + + hfactory ${scobj_hpath}/temp4/sensor plain user float + hsetprop ${scobj_hpath}/temp4/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB4.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/temp4/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp4/sensor control true + hsetprop ${scobj_hpath}/temp4/sensor data true + hsetprop ${scobj_hpath}/temp4/sensor mutable true + hsetprop ${scobj_hpath}/temp4/sensor nxsave true + hsetprop ${scobj_hpath}/temp4/sensor permlink data_set "T[format "%02d" ${id}]S04" + hsetprop ${scobj_hpath}/temp4/sensor @description "T[format "%02d" ${id}]S04" + hsetprop ${scobj_hpath}/temp4/sensor oldval 0.0 + hsetprop ${scobj_hpath}/temp4/sensor klass "parameter" + hsetprop ${scobj_hpath}/temp4/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp4/sensor type "part" + hsetprop ${scobj_hpath}/temp4/sensor nxalias "${name}_temp4_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp4/sensor 1 + hsetprop ${scobj_hpath}/temp4/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp4/sensor simulated true + } + hsetprop ${scobj_hpath}/temp4 data "true" + hsetprop ${scobj_hpath}/temp4 klass "@none" + hsetprop ${scobj_hpath}/temp4 type "part" + } + + if {[string equal -nocase [string index ${cards} 4] T]} { + hfactory ${scobj_hpath}/temp5 plain spy none + + hfactory ${scobj_hpath}/temp5/nick plain user text + hsetprop ${scobj_hpath}/temp5/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB5.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/temp5/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/temp5/nick control true + hsetprop ${scobj_hpath}/temp5/nick data true + hsetprop ${scobj_hpath}/temp5/nick mutable true + hsetprop ${scobj_hpath}/temp5/nick nxsave true + hsetprop ${scobj_hpath}/temp5/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/temp5/nick klass "parameter" + hsetprop ${scobj_hpath}/temp5/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp5/nick type "part" + hsetprop ${scobj_hpath}/temp5/nick nxalias "${name}_temp5_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp5/nick 15 + hsetprop ${scobj_hpath}/temp5/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp5/nick simulated true + } + + hfactory ${scobj_hpath}/temp5/sensor plain user float + hsetprop ${scobj_hpath}/temp5/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB5.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/temp5/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp5/sensor control true + hsetprop ${scobj_hpath}/temp5/sensor data true + hsetprop ${scobj_hpath}/temp5/sensor mutable true + hsetprop ${scobj_hpath}/temp5/sensor nxsave true + hsetprop ${scobj_hpath}/temp5/sensor permlink data_set "T[format "%02d" ${id}]S05" + hsetprop ${scobj_hpath}/temp5/sensor @description "T[format "%02d" ${id}]S05" + hsetprop ${scobj_hpath}/temp5/sensor oldval 0.0 + hsetprop ${scobj_hpath}/temp5/sensor klass "parameter" + hsetprop ${scobj_hpath}/temp5/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp5/sensor type "part" + hsetprop ${scobj_hpath}/temp5/sensor nxalias "${name}_temp5_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp5/sensor 1 + hsetprop ${scobj_hpath}/temp5/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp5/sensor simulated true + } + hsetprop ${scobj_hpath}/temp5 data "true" + hsetprop ${scobj_hpath}/temp5 klass "@none" + hsetprop ${scobj_hpath}/temp5 type "part" + } + + if {[string equal -nocase [string index ${cards} 5] T]} { + hfactory ${scobj_hpath}/temp6 plain spy none + + if {[string equal -nocase [string index ${cards} 0] H] && [string equal -nocase [string index ${assoc} 5] 1]} { + hfactory ${scobj_hpath}/temp6/auto plain user int + hsetprop ${scobj_hpath}/temp6/auto read ${ns}::getValue ${scobj_hpath} rdOnOff {READ:DEV:DB6.T1:TEMP:LOOP:ENAB} + hsetprop ${scobj_hpath}/temp6/auto rdOnOff ${ns}::rdOnOff ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/auto write ${ns}::wrOnOff ${scobj_hpath} noResponse {SET:DEV:DB6.T1:TEMP:LOOP:ENAB:} + hsetprop ${scobj_hpath}/temp6/auto noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/auto check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/auto control true + hsetprop ${scobj_hpath}/temp6/auto data true + hsetprop ${scobj_hpath}/temp6/auto mutable true + hsetprop ${scobj_hpath}/temp6/auto nxsave true + hsetprop ${scobj_hpath}/temp6/auto values 0,1 + hsetprop ${scobj_hpath}/temp6/auto oldval 0 + hsetprop ${scobj_hpath}/temp6/auto klass "parameter" + hsetprop ${scobj_hpath}/temp6/auto sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp6/auto type "part" + hsetprop ${scobj_hpath}/temp6/auto nxalias "${name}_temp6_auto" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp6/auto 5 + ${sct_controller} write ${scobj_hpath}/temp6/auto + hsetprop ${scobj_hpath}/temp6/auto simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp6/auto simulated true + } + } + + hfactory ${scobj_hpath}/temp6/nick plain user text + hsetprop ${scobj_hpath}/temp6/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB6.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/temp6/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/nick control true + hsetprop ${scobj_hpath}/temp6/nick data true + hsetprop ${scobj_hpath}/temp6/nick mutable true + hsetprop ${scobj_hpath}/temp6/nick nxsave true + hsetprop ${scobj_hpath}/temp6/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/temp6/nick klass "parameter" + hsetprop ${scobj_hpath}/temp6/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp6/nick type "part" + hsetprop ${scobj_hpath}/temp6/nick nxalias "${name}_temp6_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp6/nick 15 + hsetprop ${scobj_hpath}/temp6/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp6/nick simulated true + } + + hfactory ${scobj_hpath}/temp6/sensor plain user float + hsetprop ${scobj_hpath}/temp6/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB6.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/temp6/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/sensor control true + hsetprop ${scobj_hpath}/temp6/sensor data true + hsetprop ${scobj_hpath}/temp6/sensor mutable true + hsetprop ${scobj_hpath}/temp6/sensor nxsave true + hsetprop ${scobj_hpath}/temp6/sensor permlink data_set "T[format "%02d" ${id}]S06" + hsetprop ${scobj_hpath}/temp6/sensor @description "T[format "%02d" ${id}]S06" + hsetprop ${scobj_hpath}/temp6/sensor oldval 0.0 + hsetprop ${scobj_hpath}/temp6/sensor klass "parameter" + hsetprop ${scobj_hpath}/temp6/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp6/sensor type "part" + hsetprop ${scobj_hpath}/temp6/sensor nxalias "${name}_temp6_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp6/sensor 1 + hsetprop ${scobj_hpath}/temp6/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp6/sensor simulated true + } + + if {[string equal -nocase [string index ${cards} 0] H] && [string equal -nocase [string index ${assoc} 5] 1]} { + hfactory ${scobj_hpath}/temp6/setpoint plain user float + hsetprop ${scobj_hpath}/temp6/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB6.T1:TEMP:LOOP:TSET} + hsetprop ${scobj_hpath}/temp6/setpoint rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/setpoint write ${ns}::setPoint ${scobj_hpath} noResponse {SET:DEV:DB6.T1:TEMP:LOOP:TSET:} + hsetprop ${scobj_hpath}/temp6/setpoint noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/setpoint check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/setpoint driving 0 + hsetprop ${scobj_hpath}/temp6/setpoint checklimits ${ns}::checklimits ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/setpoint halt ${ns}::halt ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/setpoint driveable temp6/sensor + hsetprop ${scobj_hpath}/temp6/setpoint control true + hsetprop ${scobj_hpath}/temp6/setpoint data true + hsetprop ${scobj_hpath}/temp6/setpoint mutable true + hsetprop ${scobj_hpath}/temp6/setpoint nxsave true + hsetprop ${scobj_hpath}/temp6/setpoint lowerlimit 0 + hsetprop ${scobj_hpath}/temp6/setpoint upperlimit 333 + hsetprop ${scobj_hpath}/temp6/setpoint tolerance ${ttol} + hsetprop ${scobj_hpath}/temp6/setpoint permlink data_set "T[format "%02d" ${id}]SP06" + hsetprop ${scobj_hpath}/temp6/setpoint @description "T[format "%02d" ${id}]SP06" + hsetprop ${scobj_hpath}/temp6/setpoint oldval 0.0 + hsetprop ${scobj_hpath}/temp6/setpoint klass "parameter" + hsetprop ${scobj_hpath}/temp6/setpoint sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp6/setpoint settle_time "15" + hsetprop ${scobj_hpath}/temp6/setpoint type "drivable" + hsetprop ${scobj_hpath}/temp6/setpoint nxalias "${name}_temp6_setpoint" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp6/setpoint 5 + ${sct_controller} write ${scobj_hpath}/temp6/setpoint + hsetprop ${scobj_hpath}/temp6/setpoint simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp6/setpoint simulated true + } + } + hsetprop ${scobj_hpath}/temp6 data "true" + hsetprop ${scobj_hpath}/temp6 klass "@none" + hsetprop ${scobj_hpath}/temp6 type "part" + + if {[string equal -nocase [string index ${cards} 0] H] && [string equal -nocase [string index ${assoc} 5] 1]} { + hfactory ${scobj_hpath}/temp6/heater plain spy none + + hfactory ${scobj_hpath}/temp6/heater/hset plain user float + hsetprop ${scobj_hpath}/temp6/heater/hset read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB6.T1:TEMP:LOOP:HSET} + hsetprop ${scobj_hpath}/temp6/heater/hset rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/heater/hset write ${ns}::setValue ${scobj_hpath} noResponse {SET:DEV:DB6.T1:TEMP:LOOP:HSET:} + hsetprop ${scobj_hpath}/temp6/heater/hset noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/heater/hset check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/heater/hset control true + hsetprop ${scobj_hpath}/temp6/heater/hset data true + hsetprop ${scobj_hpath}/temp6/heater/hset mutable true + hsetprop ${scobj_hpath}/temp6/heater/hset nxsave true + hsetprop ${scobj_hpath}/temp6/heater/hset lowerlimit 0 + hsetprop ${scobj_hpath}/temp6/heater/hset upperlimit 100 + hsetprop ${scobj_hpath}/temp6/heater/hset oldval 0.0 + hsetprop ${scobj_hpath}/temp6/heater/hset klass "parameter" + hsetprop ${scobj_hpath}/temp6/heater/hset sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp6/heater/hset type "part" + hsetprop ${scobj_hpath}/temp6/heater/hset nxalias "${name}_temp6_heater_hset" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp6/heater/hset 5 + ${sct_controller} write ${scobj_hpath}/temp6/heater/hset + hsetprop ${scobj_hpath}/temp6/heater/hset simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp6/heater/hset simulated true + } + + hfactory ${scobj_hpath}/temp6/heater/perc plain user float + hsetprop ${scobj_hpath}/temp6/heater/perc read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB1.H1:HTR:SIG:PERC} + hsetprop ${scobj_hpath}/temp6/heater/perc rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/heater/perc control true + hsetprop ${scobj_hpath}/temp6/heater/perc data true + hsetprop ${scobj_hpath}/temp6/heater/perc mutable true + hsetprop ${scobj_hpath}/temp6/heater/perc nxsave true + hsetprop ${scobj_hpath}/temp6/heater/perc oldval 0.0 + hsetprop ${scobj_hpath}/temp6/heater/perc klass "parameter" + hsetprop ${scobj_hpath}/temp6/heater/perc sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp6/heater/perc type "part" + hsetprop ${scobj_hpath}/temp6/heater/perc nxalias "${name}_temp6_heater_perc" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp6/heater/perc 5 + hsetprop ${scobj_hpath}/temp6/heater/perc simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp6/heater/perc simulated true + } + + hfactory ${scobj_hpath}/temp6/heater/power plain user float + hsetprop ${scobj_hpath}/temp6/heater/power read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB1.H1:HTR:SIG:POWR} + hsetprop ${scobj_hpath}/temp6/heater/power rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/heater/power control true + hsetprop ${scobj_hpath}/temp6/heater/power data true + hsetprop ${scobj_hpath}/temp6/heater/power mutable true + hsetprop ${scobj_hpath}/temp6/heater/power nxsave true + hsetprop ${scobj_hpath}/temp6/heater/power oldval 0.0 + hsetprop ${scobj_hpath}/temp6/heater/power klass "parameter" + hsetprop ${scobj_hpath}/temp6/heater/power sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp6/heater/power type "part" + hsetprop ${scobj_hpath}/temp6/heater/power nxalias "${name}_temp6_heater_power" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp6/heater/power 5 + hsetprop ${scobj_hpath}/temp6/heater/power simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp6/heater/power simulated true + } + hsetprop ${scobj_hpath}/temp6/heater data "true" + hsetprop ${scobj_hpath}/temp6/heater klass "@none" + hsetprop ${scobj_hpath}/temp6/heater type "part" + } + if {[string equal -nocase [string index ${cards} 0] H] && [string equal -nocase [string index ${assoc} 5] 1]} { + ansto_makesctdrive ${name}_temp6_setpoint ${scobj_hpath}/temp6/setpoint ${scobj_hpath}/temp6/sensor ${sct_controller} + } + } + + if {[string equal -nocase [string index ${cards} 6] T]} { + hfactory ${scobj_hpath}/temp7 plain spy none + + if {[string equal -nocase [string index ${cards} 1] H] && [string equal -nocase [string index ${assoc} 6] 2]} { + hfactory ${scobj_hpath}/temp7/auto plain user int + hsetprop ${scobj_hpath}/temp7/auto read ${ns}::getValue ${scobj_hpath} rdOnOff {READ:DEV:DB7.T1:TEMP:LOOP:ENAB} + hsetprop ${scobj_hpath}/temp7/auto rdOnOff ${ns}::rdOnOff ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/auto write ${ns}::wrOnOff ${scobj_hpath} noResponse {SET:DEV:DB7.T1:TEMP:LOOP:ENAB:} + hsetprop ${scobj_hpath}/temp7/auto noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/auto check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/auto control true + hsetprop ${scobj_hpath}/temp7/auto data true + hsetprop ${scobj_hpath}/temp7/auto mutable true + hsetprop ${scobj_hpath}/temp7/auto nxsave true + hsetprop ${scobj_hpath}/temp7/auto values 0,1 + hsetprop ${scobj_hpath}/temp7/auto oldval 0 + hsetprop ${scobj_hpath}/temp7/auto klass "parameter" + hsetprop ${scobj_hpath}/temp7/auto sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp7/auto type "part" + hsetprop ${scobj_hpath}/temp7/auto nxalias "${name}_temp7_auto" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp7/auto 5 + ${sct_controller} write ${scobj_hpath}/temp7/auto + hsetprop ${scobj_hpath}/temp7/auto simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp7/auto simulated true + } + } + + hfactory ${scobj_hpath}/temp7/nick plain user text + hsetprop ${scobj_hpath}/temp7/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB7.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/temp7/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/nick control true + hsetprop ${scobj_hpath}/temp7/nick data true + hsetprop ${scobj_hpath}/temp7/nick mutable true + hsetprop ${scobj_hpath}/temp7/nick nxsave true + hsetprop ${scobj_hpath}/temp7/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/temp7/nick klass "parameter" + hsetprop ${scobj_hpath}/temp7/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp7/nick type "part" + hsetprop ${scobj_hpath}/temp7/nick nxalias "${name}_temp7_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp7/nick 15 + hsetprop ${scobj_hpath}/temp7/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp7/nick simulated true + } + + hfactory ${scobj_hpath}/temp7/sensor plain user float + hsetprop ${scobj_hpath}/temp7/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB7.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/temp7/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/sensor control true + hsetprop ${scobj_hpath}/temp7/sensor data true + hsetprop ${scobj_hpath}/temp7/sensor mutable true + hsetprop ${scobj_hpath}/temp7/sensor nxsave true + hsetprop ${scobj_hpath}/temp7/sensor permlink data_set "T[format "%02d" ${id}]S07" + hsetprop ${scobj_hpath}/temp7/sensor @description "T[format "%02d" ${id}]S07" + hsetprop ${scobj_hpath}/temp7/sensor oldval 0.0 + hsetprop ${scobj_hpath}/temp7/sensor klass "parameter" + hsetprop ${scobj_hpath}/temp7/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp7/sensor type "part" + hsetprop ${scobj_hpath}/temp7/sensor nxalias "${name}_temp7_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp7/sensor 1 + hsetprop ${scobj_hpath}/temp7/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp7/sensor simulated true + } + + if {[string equal -nocase [string index ${cards} 1] H] && [string equal -nocase [string index ${assoc} 6] 2]} { + hfactory ${scobj_hpath}/temp7/setpoint plain user float + hsetprop ${scobj_hpath}/temp7/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB7.T1:TEMP:LOOP:TSET} + hsetprop ${scobj_hpath}/temp7/setpoint rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/setpoint write ${ns}::setPoint ${scobj_hpath} noResponse {SET:DEV:DB7.T1:TEMP:LOOP:TSET:} + hsetprop ${scobj_hpath}/temp7/setpoint noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/setpoint check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/setpoint driving 0 + hsetprop ${scobj_hpath}/temp7/setpoint checklimits ${ns}::checklimits ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/setpoint halt ${ns}::halt ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/setpoint driveable temp7/sensor + hsetprop ${scobj_hpath}/temp7/setpoint control true + hsetprop ${scobj_hpath}/temp7/setpoint data true + hsetprop ${scobj_hpath}/temp7/setpoint mutable true + hsetprop ${scobj_hpath}/temp7/setpoint nxsave true + hsetprop ${scobj_hpath}/temp7/setpoint lowerlimit 0 + hsetprop ${scobj_hpath}/temp7/setpoint upperlimit 333 + hsetprop ${scobj_hpath}/temp7/setpoint tolerance ${ttol} + hsetprop ${scobj_hpath}/temp7/setpoint permlink data_set "T[format "%02d" ${id}]SP07" + hsetprop ${scobj_hpath}/temp7/setpoint @description "T[format "%02d" ${id}]SP07" + hsetprop ${scobj_hpath}/temp7/setpoint oldval 0.0 + hsetprop ${scobj_hpath}/temp7/setpoint klass "parameter" + hsetprop ${scobj_hpath}/temp7/setpoint sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp7/setpoint settle_time "15" + hsetprop ${scobj_hpath}/temp7/setpoint type "drivable" + hsetprop ${scobj_hpath}/temp7/setpoint nxalias "${name}_temp7_setpoint" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp7/setpoint 5 + ${sct_controller} write ${scobj_hpath}/temp7/setpoint + hsetprop ${scobj_hpath}/temp7/setpoint simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp7/setpoint simulated true + } + } + hsetprop ${scobj_hpath}/temp7 data "true" + hsetprop ${scobj_hpath}/temp7 klass "@none" + hsetprop ${scobj_hpath}/temp7 type "part" + + if {[string equal -nocase [string index ${cards} 1] H] && [string equal -nocase [string index ${assoc} 6] 2]} { + hfactory ${scobj_hpath}/temp7/heater plain spy none + + hfactory ${scobj_hpath}/temp7/heater/hset plain user float + hsetprop ${scobj_hpath}/temp7/heater/hset read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB7.T1:TEMP:LOOP:HSET} + hsetprop ${scobj_hpath}/temp7/heater/hset rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/heater/hset write ${ns}::setValue ${scobj_hpath} noResponse {SET:DEV:DB7.T1:TEMP:LOOP:HSET:} + hsetprop ${scobj_hpath}/temp7/heater/hset noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/heater/hset check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/heater/hset control true + hsetprop ${scobj_hpath}/temp7/heater/hset data true + hsetprop ${scobj_hpath}/temp7/heater/hset mutable true + hsetprop ${scobj_hpath}/temp7/heater/hset nxsave true + hsetprop ${scobj_hpath}/temp7/heater/hset lowerlimit 0 + hsetprop ${scobj_hpath}/temp7/heater/hset upperlimit 100 + hsetprop ${scobj_hpath}/temp7/heater/hset oldval 0.0 + hsetprop ${scobj_hpath}/temp7/heater/hset klass "parameter" + hsetprop ${scobj_hpath}/temp7/heater/hset sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp7/heater/hset type "part" + hsetprop ${scobj_hpath}/temp7/heater/hset nxalias "${name}_temp7_heater_hset" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp7/heater/hset 5 + ${sct_controller} write ${scobj_hpath}/temp7/heater/hset + hsetprop ${scobj_hpath}/temp7/heater/hset simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp7/heater/hset simulated true + } + + hfactory ${scobj_hpath}/temp7/heater/perc plain user float + hsetprop ${scobj_hpath}/temp7/heater/perc read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB2.H1:HTR:SIG:PERC} + hsetprop ${scobj_hpath}/temp7/heater/perc rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/heater/perc control true + hsetprop ${scobj_hpath}/temp7/heater/perc data true + hsetprop ${scobj_hpath}/temp7/heater/perc mutable true + hsetprop ${scobj_hpath}/temp7/heater/perc nxsave true + hsetprop ${scobj_hpath}/temp7/heater/perc oldval 0.0 + hsetprop ${scobj_hpath}/temp7/heater/perc klass "parameter" + hsetprop ${scobj_hpath}/temp7/heater/perc sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp7/heater/perc type "part" + hsetprop ${scobj_hpath}/temp7/heater/perc nxalias "${name}_temp7_heater_perc" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp7/heater/perc 5 + hsetprop ${scobj_hpath}/temp7/heater/perc simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp7/heater/perc simulated true + } + + hfactory ${scobj_hpath}/temp7/heater/power plain user float + hsetprop ${scobj_hpath}/temp7/heater/power read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB2.H1:HTR:SIG:POWR} + hsetprop ${scobj_hpath}/temp7/heater/power rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/heater/power control true + hsetprop ${scobj_hpath}/temp7/heater/power data true + hsetprop ${scobj_hpath}/temp7/heater/power mutable true + hsetprop ${scobj_hpath}/temp7/heater/power nxsave true + hsetprop ${scobj_hpath}/temp7/heater/power oldval 0.0 + hsetprop ${scobj_hpath}/temp7/heater/power klass "parameter" + hsetprop ${scobj_hpath}/temp7/heater/power sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp7/heater/power type "part" + hsetprop ${scobj_hpath}/temp7/heater/power nxalias "${name}_temp7_heater_power" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp7/heater/power 5 + hsetprop ${scobj_hpath}/temp7/heater/power simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp7/heater/power simulated true + } + hsetprop ${scobj_hpath}/temp7/heater data "true" + hsetprop ${scobj_hpath}/temp7/heater klass "@none" + hsetprop ${scobj_hpath}/temp7/heater type "part" + } + if {[string equal -nocase [string index ${cards} 1] H] && [string equal -nocase [string index ${assoc} 6] 2]} { + ansto_makesctdrive ${name}_temp7_setpoint ${scobj_hpath}/temp7/setpoint ${scobj_hpath}/temp7/sensor ${sct_controller} + } + } + + if {[string equal -nocase [string index ${cards} 7] T]} { + hfactory ${scobj_hpath}/temp8 plain spy none + + if {[string equal -nocase [string index ${cards} 2] H] && [string equal -nocase [string index ${assoc} 7] 3]} { + hfactory ${scobj_hpath}/temp8/auto plain user int + hsetprop ${scobj_hpath}/temp8/auto read ${ns}::getValue ${scobj_hpath} rdOnOff {READ:DEV:DB8.T1:TEMP:LOOP:ENAB} + hsetprop ${scobj_hpath}/temp8/auto rdOnOff ${ns}::rdOnOff ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/auto write ${ns}::wrOnOff ${scobj_hpath} noResponse {SET:DEV:DB8.T1:TEMP:LOOP:ENAB:} + hsetprop ${scobj_hpath}/temp8/auto noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/auto check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/auto control true + hsetprop ${scobj_hpath}/temp8/auto data true + hsetprop ${scobj_hpath}/temp8/auto mutable true + hsetprop ${scobj_hpath}/temp8/auto nxsave true + hsetprop ${scobj_hpath}/temp8/auto values 0,1 + hsetprop ${scobj_hpath}/temp8/auto oldval 0 + hsetprop ${scobj_hpath}/temp8/auto klass "parameter" + hsetprop ${scobj_hpath}/temp8/auto sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp8/auto type "part" + hsetprop ${scobj_hpath}/temp8/auto nxalias "${name}_temp8_auto" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp8/auto 5 + ${sct_controller} write ${scobj_hpath}/temp8/auto + hsetprop ${scobj_hpath}/temp8/auto simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp8/auto simulated true + } + } + + hfactory ${scobj_hpath}/temp8/nick plain user text + hsetprop ${scobj_hpath}/temp8/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB8.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/temp8/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/nick control true + hsetprop ${scobj_hpath}/temp8/nick data true + hsetprop ${scobj_hpath}/temp8/nick mutable true + hsetprop ${scobj_hpath}/temp8/nick nxsave true + hsetprop ${scobj_hpath}/temp8/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/temp8/nick klass "parameter" + hsetprop ${scobj_hpath}/temp8/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp8/nick type "part" + hsetprop ${scobj_hpath}/temp8/nick nxalias "${name}_temp8_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp8/nick 15 + hsetprop ${scobj_hpath}/temp8/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp8/nick simulated true + } + + hfactory ${scobj_hpath}/temp8/sensor plain user float + hsetprop ${scobj_hpath}/temp8/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/temp8/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/sensor control true + hsetprop ${scobj_hpath}/temp8/sensor data true + hsetprop ${scobj_hpath}/temp8/sensor mutable true + hsetprop ${scobj_hpath}/temp8/sensor nxsave true + hsetprop ${scobj_hpath}/temp8/sensor permlink data_set "T[format "%02d" ${id}]S08" + hsetprop ${scobj_hpath}/temp8/sensor @description "T[format "%02d" ${id}]S08" + hsetprop ${scobj_hpath}/temp8/sensor oldval 0.0 + hsetprop ${scobj_hpath}/temp8/sensor klass "parameter" + hsetprop ${scobj_hpath}/temp8/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp8/sensor type "part" + hsetprop ${scobj_hpath}/temp8/sensor nxalias "${name}_temp8_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp8/sensor 1 + hsetprop ${scobj_hpath}/temp8/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp8/sensor simulated true + } + + if {[string equal -nocase [string index ${cards} 2] H] && [string equal -nocase [string index ${assoc} 7] 3]} { + hfactory ${scobj_hpath}/temp8/setpoint plain user float + hsetprop ${scobj_hpath}/temp8/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.T1:TEMP:LOOP:TSET} + hsetprop ${scobj_hpath}/temp8/setpoint rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/setpoint write ${ns}::setPoint ${scobj_hpath} noResponse {SET:DEV:DB8.T1:TEMP:LOOP:TSET:} + hsetprop ${scobj_hpath}/temp8/setpoint noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/setpoint check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/setpoint driving 0 + hsetprop ${scobj_hpath}/temp8/setpoint checklimits ${ns}::checklimits ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/setpoint halt ${ns}::halt ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/setpoint driveable temp8/sensor + hsetprop ${scobj_hpath}/temp8/setpoint control true + hsetprop ${scobj_hpath}/temp8/setpoint data true + hsetprop ${scobj_hpath}/temp8/setpoint mutable true + hsetprop ${scobj_hpath}/temp8/setpoint nxsave true + hsetprop ${scobj_hpath}/temp8/setpoint lowerlimit 0 + hsetprop ${scobj_hpath}/temp8/setpoint upperlimit 333 + hsetprop ${scobj_hpath}/temp8/setpoint tolerance ${ttol} + hsetprop ${scobj_hpath}/temp8/setpoint permlink data_set "T[format "%02d" ${id}]SP08" + hsetprop ${scobj_hpath}/temp8/setpoint @description "T[format "%02d" ${id}]SP08" + hsetprop ${scobj_hpath}/temp8/setpoint oldval 0.0 + hsetprop ${scobj_hpath}/temp8/setpoint klass "parameter" + hsetprop ${scobj_hpath}/temp8/setpoint sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp8/setpoint settle_time "15" + hsetprop ${scobj_hpath}/temp8/setpoint type "drivable" + hsetprop ${scobj_hpath}/temp8/setpoint nxalias "${name}_temp8_setpoint" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp8/setpoint 5 + ${sct_controller} write ${scobj_hpath}/temp8/setpoint + hsetprop ${scobj_hpath}/temp8/setpoint simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp8/setpoint simulated true + } + } + hsetprop ${scobj_hpath}/temp8 data "true" + hsetprop ${scobj_hpath}/temp8 klass "@none" + hsetprop ${scobj_hpath}/temp8 type "part" + + if {[string equal -nocase [string index ${cards} 2] H] && [string equal -nocase [string index ${assoc} 7] 3]} { + hfactory ${scobj_hpath}/temp8/heater plain spy none + + hfactory ${scobj_hpath}/temp8/heater/hset plain user float + hsetprop ${scobj_hpath}/temp8/heater/hset read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.T1:TEMP:LOOP:HSET} + hsetprop ${scobj_hpath}/temp8/heater/hset rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/heater/hset write ${ns}::setValue ${scobj_hpath} noResponse {SET:DEV:DB8.T1:TEMP:LOOP:HSET:} + hsetprop ${scobj_hpath}/temp8/heater/hset noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/heater/hset check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/heater/hset control true + hsetprop ${scobj_hpath}/temp8/heater/hset data true + hsetprop ${scobj_hpath}/temp8/heater/hset mutable true + hsetprop ${scobj_hpath}/temp8/heater/hset nxsave true + hsetprop ${scobj_hpath}/temp8/heater/hset lowerlimit 0 + hsetprop ${scobj_hpath}/temp8/heater/hset upperlimit 100 + hsetprop ${scobj_hpath}/temp8/heater/hset oldval 0.0 + hsetprop ${scobj_hpath}/temp8/heater/hset klass "parameter" + hsetprop ${scobj_hpath}/temp8/heater/hset sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp8/heater/hset type "part" + hsetprop ${scobj_hpath}/temp8/heater/hset nxalias "${name}_temp8_heater_hset" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp8/heater/hset 5 + ${sct_controller} write ${scobj_hpath}/temp8/heater/hset + hsetprop ${scobj_hpath}/temp8/heater/hset simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp8/heater/hset simulated true + } + + hfactory ${scobj_hpath}/temp8/heater/perc plain user float + hsetprop ${scobj_hpath}/temp8/heater/perc read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB3.H1:HTR:SIG:PERC} + hsetprop ${scobj_hpath}/temp8/heater/perc rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/heater/perc control true + hsetprop ${scobj_hpath}/temp8/heater/perc data true + hsetprop ${scobj_hpath}/temp8/heater/perc mutable true + hsetprop ${scobj_hpath}/temp8/heater/perc nxsave true + hsetprop ${scobj_hpath}/temp8/heater/perc oldval 0.0 + hsetprop ${scobj_hpath}/temp8/heater/perc klass "parameter" + hsetprop ${scobj_hpath}/temp8/heater/perc sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp8/heater/perc type "part" + hsetprop ${scobj_hpath}/temp8/heater/perc nxalias "${name}_temp8_heater_perc" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp8/heater/perc 5 + hsetprop ${scobj_hpath}/temp8/heater/perc simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp8/heater/perc simulated true + } + + hfactory ${scobj_hpath}/temp8/heater/power plain user float + hsetprop ${scobj_hpath}/temp8/heater/power read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB3.H1:HTR:SIG:POWR} + hsetprop ${scobj_hpath}/temp8/heater/power rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/heater/power control true + hsetprop ${scobj_hpath}/temp8/heater/power data true + hsetprop ${scobj_hpath}/temp8/heater/power mutable true + hsetprop ${scobj_hpath}/temp8/heater/power nxsave true + hsetprop ${scobj_hpath}/temp8/heater/power oldval 0.0 + hsetprop ${scobj_hpath}/temp8/heater/power klass "parameter" + hsetprop ${scobj_hpath}/temp8/heater/power sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp8/heater/power type "part" + hsetprop ${scobj_hpath}/temp8/heater/power nxalias "${name}_temp8_heater_power" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp8/heater/power 5 + hsetprop ${scobj_hpath}/temp8/heater/power simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp8/heater/power simulated true + } + hsetprop ${scobj_hpath}/temp8/heater data "true" + hsetprop ${scobj_hpath}/temp8/heater klass "@none" + hsetprop ${scobj_hpath}/temp8/heater type "part" + } + if {[string equal -nocase [string index ${cards} 2] H] && [string equal -nocase [string index ${assoc} 7] 3]} { + ansto_makesctdrive ${name}_temp8_setpoint ${scobj_hpath}/temp8/setpoint ${scobj_hpath}/temp8/sensor ${sct_controller} + } + } + + if {[string equal -nocase [string index ${cards} 3] V]} { + hfactory ${scobj_hpath}/valve plain spy none + + hfactory ${scobj_hpath}/valve/nick plain user text + hsetprop ${scobj_hpath}/valve/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB4.G1:AUX:NICK} + hsetprop ${scobj_hpath}/valve/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/valve/nick control true + hsetprop ${scobj_hpath}/valve/nick data true + hsetprop ${scobj_hpath}/valve/nick mutable true + hsetprop ${scobj_hpath}/valve/nick nxsave true + hsetprop ${scobj_hpath}/valve/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/valve/nick klass "parameter" + hsetprop ${scobj_hpath}/valve/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/valve/nick type "part" + hsetprop ${scobj_hpath}/valve/nick nxalias "${name}_valve_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/valve/nick 15 + hsetprop ${scobj_hpath}/valve/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/valve/nick simulated true + } + + hfactory ${scobj_hpath}/valve/sensor plain user float + hsetprop ${scobj_hpath}/valve/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB4.G1:AUX:SIG:PERC} + hsetprop ${scobj_hpath}/valve/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/valve/sensor control true + hsetprop ${scobj_hpath}/valve/sensor data true + hsetprop ${scobj_hpath}/valve/sensor mutable true + hsetprop ${scobj_hpath}/valve/sensor nxsave true + hsetprop ${scobj_hpath}/valve/sensor oldval 0.0 + hsetprop ${scobj_hpath}/valve/sensor klass "parameter" + hsetprop ${scobj_hpath}/valve/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/valve/sensor type "part" + hsetprop ${scobj_hpath}/valve/sensor nxalias "${name}_valve_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/valve/sensor 5 + hsetprop ${scobj_hpath}/valve/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/valve/sensor simulated true + } + hsetprop ${scobj_hpath}/valve data "true" + hsetprop ${scobj_hpath}/valve klass "@none" + hsetprop ${scobj_hpath}/valve type "part" + } + hsetprop ${scobj_hpath} klass ${device_class} + hsetprop ${scobj_hpath} data true + hsetprop ${scobj_hpath} debug_threshold 5 +# mkDriver hook code goes here + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +proc ::scobj::oxford_mercury::add_driver {name device_class simulation_flag ip_address tcp_port id {cards NNNNNNNN} {assoc 00000000} {ttol 1} {ptol 5} {vtol 5}} { + set catch_status [ catch { + ::scobj::oxford_mercury::sics_log 9 "::scobj::oxford_mercury::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${cards} ${assoc} ${ttol} ${ptol} ${vtol}" + if {[string equal -nocase "${simulation_flag}" "false"]} { + if {[string equal -nocase "aqadapter" "${ip_address}"]} { + ::scobj::oxford_mercury::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" + makesctcontroller sct_${name} aqadapter ${tcp_port} + } else { + ::scobj::oxford_mercury::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}" + makesctcontroller sct_${name} std ${ip_address}:${tcp_port} + } + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for oxford_mercury" + ::scobj::oxford_mercury::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL + } + ::scobj::oxford_mercury::sics_log 1 "::scobj::oxford_mercury::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${cards} ${assoc} ${ttol} ${ptol} ${vtol}" + ::scobj::oxford_mercury::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${cards} ${assoc} ${ttol} ${ptol} ${vtol} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +namespace eval ::scobj::oxford_mercury { + namespace export debug_threshold + namespace export debug_log + namespace export sics_log + namespace export mkDriver + namespace export add_driver +} + +proc add_oxford_mercury {name ip_address tcp_port id {cards NNNNNNNN} {assoc 00000000} {ttol 1} {ptol 5} {vtol 5}} { + set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" + ::scobj::oxford_mercury::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${cards} ${assoc} ${ttol} ${ptol} ${vtol} +} + +clientput "file evaluation of sct_oxford_mercury.tcl" +::scobj::oxford_mercury::sics_log 9 "file evaluation of sct_oxford_mercury.tcl" + +proc ::scobj::oxford_mercury::read_config {} { + set catch_status [ catch { + set ns "::scobj::oxford_mercury" + dict for {k u} $::config_dict { + if { [dict exists $u "implementation"] } { + set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" + set device_class "environment" + if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { + continue + } + set enabled [string tolower [dict get $u "enabled"]] + if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { + continue + } + if { [dict exists $u "simulation_group"] } { + set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]] + } + if { [dict exists $u "device_class"] } { + set device_class "[dict get $u "device_class"]" + } + set name [dict get $u name] + set implementation [dict get $u "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"] "oxford_mercury"] } { + if { ![string equal -nocase "${simulation_flag}" "false"] } { + set asyncqueue "null" + ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue" + ${ns}::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL + } elseif { [dict exists $v "asyncqueue"] } { + set asyncqueue [dict get $v "asyncqueue"] + if { [string equal -nocase ${asyncqueue} "sct"] } { + set ip_address [dict get $v ip] + set tcp_port [dict get $v port] + makesctcontroller sct_${name} std ${ip_address}:${tcp_port} + } else { + makesctcontroller sct_${name} aqadapter ${asyncqueue} + } + } else { + if { [dict exists $v "asyncprotocol"] } { + set asyncprotocol [dict get $v "asyncprotocol"] + } else { + set asyncprotocol ${name}_protocol + MakeAsyncProtocol ${asyncprotocol} + if { [dict exists $v "sendterminator"] } { + ${asyncprotocol} sendterminator "[dict get $v "sendterminator"]" + } elseif { [dict exists $v "terminator"] } { + ${asyncprotocol} sendterminator "[dict get $v "terminator"]" + } + if { [dict exists $v "replyterminator"] } { + ${asyncprotocol} replyterminator "[dict get $v "replyterminator"]" + } elseif { [dict exists $v "terminator"] } { + ${asyncprotocol} replyterminator "[dict get $v "terminator"]" + } + } + set asyncqueue ${name}_queue + set ip_address [dict get $v ip] + set tcp_port [dict get $v port] + MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${ip_address} ${tcp_port} + if { [dict exists $v "timeout"] } { + ${asyncqueue} timeout "[dict get $v "timeout"]" + } + makesctcontroller sct_${name} aqadapter ${asyncqueue} + } + set arg_list [list] + set missing_list [list] + array unset default_map + array set default_map [list cards NNNNNNNN assoc 00000000 ttol 1 ptol 5 vtol 5] + foreach arg {id cards assoc ttol ptol vtol} { + if {[dict exists $u $arg]} { + lappend arg_list "[dict get $u $arg]" + } elseif {[dict exists $v $arg]} { + lappend arg_list "[dict get $v $arg]" + } elseif {[info exists default_map($arg)]} { + lappend arg_list $default_map($arg) + } else { + ${ns}::sics_log 9 "Missing configuration value $arg" + lappend missing_list $arg + } + } + if { [llength $missing_list] > 0 } { + error "$name is missing configuration values $missing_list" + } + ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list + } + } + } + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +if { [info exists ::config_dict] } { + ::scobj::oxford_mercury::read_config +} else { + ::scobj::oxford_mercury::sics_log 5 "No config dict" +} diff --git a/site_ansto/instrument/config/environment/temperature/sct_west_6100.tcl b/site_ansto/instrument/config/environment/temperature/sct_west_6100.tcl index 1372950a..56ae1327 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_west_6100.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_west_6100.tcl @@ -27,6 +27,33 @@ proc ::scobj::west_6100::sics_log {debug_level debug_string} { } catch_message ] } +# checklimits function for driveable interface +proc ::scobj::west_6100::checklimits {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "checklimits tc_root=${tc_root} sct=[sct] target=[sct target]" + set setpoint [sct target] + if { [hpropexists [sct] lowerlimit] } { + set lolimit [sct lowerlimit] + } else { + # lowerlimit not set, use target + set lolimit [sct target] + } + if { [hpropexists [sct] upperlimit] } { + set hilimit [sct upperlimit] + } else { + # upperlimit not set, use target + set hilimit [sct target] + } +# checklimits hook code goes here + if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } { + sct driving 0 + error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]" + } + return OK + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + # check function for hset change proc ::scobj::west_6100::checkrange {tc_root} { set catch_status [ catch { @@ -53,6 +80,40 @@ proc ::scobj::west_6100::checkrange {tc_root} { handle_exception ${catch_status} ${catch_message} } +# checkstatus function for driveable interface +proc ::scobj::west_6100::checkstatus {tc_root} { + set catch_status [ catch { +# checkstatus hook code goes here + if {[sct driving]} { + set sp "[sct target]" + set pv "[hval ${tc_root}/[sct driveable]]" + if { abs(${pv} - ${sp}) <= [sct tolerance] } { + if { [hpropexists [sct] settle_time] } { + if { [hpropexists [sct] settle_time_start] } { + if { [sct utime] - [sct settle_time_start] >= [sct settle_time]} { + sct driving 0 + return "idle" + } + return "busy" + } else { + sct utime settle_time_start + return "busy" + } + } + sct driving 0 + return "idle" + } + if { [hpropexists [sct] settle_time_start] } { + hdelprop [sct] settle_time_start + } + return "busy" + } else { + return "idle" + } + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + # function to request the read of a parameter on a device proc ::scobj::west_6100::getDecimal {tc_root nextState cmd_str} { set catch_status [ catch { @@ -101,6 +162,18 @@ proc ::scobj::west_6100::getInteger {tc_root nextState cmd_str} { handle_exception ${catch_status} ${catch_message} } +# halt function for driveable interface +proc ::scobj::west_6100::halt {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "halt tc_root=${tc_root} sct=[sct] driving=[sct driving]" + ### TODO hset [sct] [hval [sct]] +# halt hook code goes here + sct driving 0 + return "idle" + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + # function to check the write parameter on a device proc ::scobj::west_6100::noResponse {tc_root} { set catch_status [ catch { @@ -262,8 +335,8 @@ proc ::scobj::west_6100::wrInteger {tc_root nextState cmd_str} { handle_exception ${catch_status} ${catch_message} } -proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port dev_id } { - ::scobj::west_6100::sics_log 9 "::scobj::west_6100::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}" +proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id {datype T} } { + ::scobj::west_6100::sics_log 9 "::scobj::west_6100::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}" set ns "[namespace current]" set catch_status [ catch { @@ -358,6 +431,8 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/sensor data true hsetprop ${scobj_hpath}/sensor mutable true hsetprop ${scobj_hpath}/sensor nxsave true + hsetprop ${scobj_hpath}/sensor permlink data_set "${datype}[format "%02d" ${id}]S01" + hsetprop ${scobj_hpath}/sensor @description "${datype}[format "%02d" ${id}]S01" hsetprop ${scobj_hpath}/sensor oldval 0.0 hsetprop ${scobj_hpath}/sensor klass "parameter" hsetprop ${scobj_hpath}/sensor sdsinfo "::nexus::scobj::sdsinfo" @@ -370,14 +445,25 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/setpoint write ${ns}::wrDecimal ${scobj_hpath} noResponse {2} hsetprop ${scobj_hpath}/setpoint noResponse ${ns}::noResponse ${scobj_hpath} hsetprop ${scobj_hpath}/setpoint check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/setpoint driving 0 + hsetprop ${scobj_hpath}/setpoint checklimits ${ns}::checklimits ${scobj_hpath} + hsetprop ${scobj_hpath}/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath} + hsetprop ${scobj_hpath}/setpoint halt ${ns}::halt ${scobj_hpath} + hsetprop ${scobj_hpath}/setpoint driveable sensor hsetprop ${scobj_hpath}/setpoint control true hsetprop ${scobj_hpath}/setpoint data true hsetprop ${scobj_hpath}/setpoint mutable true hsetprop ${scobj_hpath}/setpoint nxsave true + hsetprop ${scobj_hpath}/setpoint lowerlimit 0 + hsetprop ${scobj_hpath}/setpoint upperlimit 1600 + hsetprop ${scobj_hpath}/setpoint tolerance 1 + hsetprop ${scobj_hpath}/setpoint permlink data_set "${datype}[format "%02d" ${id}]SP01" + hsetprop ${scobj_hpath}/setpoint @description "${datype}[format "%02d" ${id}]SP01" hsetprop ${scobj_hpath}/setpoint oldval 0.0 hsetprop ${scobj_hpath}/setpoint klass "parameter" hsetprop ${scobj_hpath}/setpoint sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/setpoint type "part" + hsetprop ${scobj_hpath}/setpoint settle_time "30" + hsetprop ${scobj_hpath}/setpoint type "drivable" hsetprop ${scobj_hpath}/setpoint nxalias "${name}_setpoint" hfactory ${scobj_hpath}/w_sp plain user float @@ -471,14 +557,17 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath} klass ${device_class} hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} debug_threshold 5 + if {[string equal -nocase "${simulation_flag}" "false"]} { + ansto_makesctdrive ${name}_setpoint ${scobj_hpath}/setpoint ${scobj_hpath}/sensor ${sct_controller} + } # mkDriver hook code goes here } catch_message ] handle_exception ${catch_status} ${catch_message} } -proc ::scobj::west_6100::add_driver {name device_class simulation_flag ip_address tcp_port dev_id} { +proc ::scobj::west_6100::add_driver {name device_class simulation_flag ip_address tcp_port id {datype T} } { set catch_status [ catch { - ::scobj::west_6100::sics_log 9 "::scobj::west_6100::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}" + ::scobj::west_6100::sics_log 9 "::scobj::west_6100::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}" if {[string equal -nocase "${simulation_flag}" "false"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} { ::scobj::west_6100::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" @@ -490,8 +579,8 @@ proc ::scobj::west_6100::add_driver {name device_class simulation_flag ip_addres } else { ::scobj::west_6100::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for west_6100" } - ::scobj::west_6100::sics_log 1 "::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}" - ::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id} + ::scobj::west_6100::sics_log 1 "::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}" + ::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} $datype } catch_message ] handle_exception ${catch_status} ${catch_message} } @@ -504,9 +593,9 @@ namespace eval ::scobj::west_6100 { namespace export add_driver } -proc add_west_6100 {name ip_address tcp_port dev_id} { +proc add_west_6100 {name ip_address tcp_port id {datype T} } { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::west_6100::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${dev_id}" + ::scobj::west_6100::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id} ${datype}" } clientput "file evaluation of sct_west_6100.tcl" @@ -572,7 +661,7 @@ proc ::scobj::west_6100::read_config {} { } set arg_list [list] set missing_list [list] - foreach arg {dev_id} { + foreach arg {id datype} { if {[dict exists $u $arg]} { lappend arg_list "[dict get $u $arg]" } elseif {[dict exists $v $arg]} { diff --git a/site_ansto/instrument/server_config.tcl b/site_ansto/instrument/server_config.tcl index 64e1ece4..100e6e31 100644 --- a/site_ansto/instrument/server_config.tcl +++ b/site_ansto/instrument/server_config.tcl @@ -254,25 +254,20 @@ proc waitaction {obj action args} { publish waitaction user proc server_set_sobj_attributes {} { - if [ catch { - motor_set_sobj_attributes - ::utility::set_motor_attributes -#XXX::utility::set_histomem_attributes - ::utility::set_sobj_attributes - ::utility::set_envcontrol_attributes - ::plc::set_sobj_attributes - ::counter::set_sobj_attributes - ::nexus::set_sobj_attributes - ::histogram_memory::set_sobj_attributes - ::utility::set_chopper_attributes - ::utility::set_sct_object_attributes -## TODO move the following to the new ansto gumxml.tcl - sicslist setatt getgumtreexml privilege internal - clientput "serverport $::serverport" - } message ] { - if {$::errorCode=="NONE"} {return $message} - return -code error $message - } + if [ catch { motor_set_sobj_attributes } msg ] { puts $msg } + if [ catch { ::utility::set_motor_attributes } msg ] { puts $msg } + #XXX::utility::set_histomem_attributes + if [ catch { ::utility::set_sobj_attributes } msg ] { puts $msg } + if [ catch { ::utility::set_envcontrol_attributes } msg ] { puts $msg } + if [ catch { ::plc::set_sobj_attributes } msg ] { puts $msg } + if [ catch { ::counter::set_sobj_attributes } msg ] { puts $msg } + if [ catch { ::nexus::set_sobj_attributes } msg ] { puts $msg } + if [ catch { ::histogram_memory::set_sobj_attributes } msg ] { puts $msg } + if [ catch { ::utility::set_chopper_attributes } msg ] { puts $msg } + if [ catch { ::utility::set_sct_object_attributes } msg ] { puts $msg } + ## TODO move the following to the new ansto gumxml.tcl + if [ catch { sicslist setatt getgumtreexml privilege internal } msg ] { puts $msg } + clientput "serverport $::serverport" } proc server_init {} { @@ -313,6 +308,7 @@ proc server_init {} { fileeval ../extraconfig.tcl } server_set_sobj_attributes + if [ catch { hsetprop /sics/magnet1/magneticFieldTesla permlink data_set B1S1 } msg ] { puts $msg } buildHDB instrument_dictionary } message ] diff --git a/site_ansto/instrument/tas/config/motors/motor_configuration.tcl b/site_ansto/instrument/tas/config/motors/motor_configuration.tcl index b37eaad2..b8f46acd 100644 --- a/site_ansto/instrument/tas/config/motors/motor_configuration.tcl +++ b/site_ansto/instrument/tas/config/motors/motor_configuration.tcl @@ -4,9 +4,6 @@ # FastShutter is currently set on Quokka only #::utility::mkVar FastShutter text manager FastShutter false instrument true false -# SET TO 1 TO USE THE TILT STAGE ie sample phi and chi -set use_tiltstage 0 - set animal taipan set sim_mode [SplitReply [motor_simulation]] @@ -93,6 +90,75 @@ set move_count 100 ############################ # +# CHOOSE HERE for sample stage configuration +########################################## +# Set axis_config as follows to use different axis configurations +# 0: normal stage configuration +# 1: Oxford magnet sample stick +set axis_config 0 + +if { [ info exists ::config_dict ] } { + if { [ dict exists $::config_dict sample_stage implementation ] } { + set implementation [ dict get $::config_dict sample_stage implementation ] + if {$implementation == "normal_sample_stage"} { + set axis_config 0 + } elseif {$implementation == "12tmagnet_sample_insert"} { + set axis_config 1 + } elseif {$implementation == "eulerian_cradle"} { + set axis_config 2 + } else { + set axis_config 0 + } + } + if { [ dict exists $::config_dict m2s2 implementation ] } { + set implementation [ dict get $::config_dict m2s2 implementation ] + if {$implementation == "normal_m2s2"} { + set m2_speed 0.4 + set m2_accel 0.04 + set m2_decel 0.04 + set s2_speed 0.8 + set s2_accel 0.2 + set s2_decel 0.2 + } elseif {$implementation == "extended_m2s2"} { + set m2_speed 0.1 + set m2_accel 0.025 + set m2_decel 0.025 + set s2_speed 0.4 + set s2_accel 0.1 + set s2_decel 0.1 + } else { + set m2_speed 0.4 + set m2_accel 0.04 + set m2_decel 0.04 + set s2_speed 0.8 + set s2_accel 0.2 + set s2_decel 0.2 + } + } +} + +switch $axis_config { + 0 { + set use_s1_stage "true" + set tilt_motor_driver_type $motor_driver_type + fileeval $cfPath(motors)/tilt_configuration.tcl + } + 1 { + set magmot s1 + set magmot_aq "mc2" + set magmot_axis "A" + set use_s1_stage "false" + set tilt_motor_driver_type asim + fileeval $cfPath(motors)/tilt_configuration.tcl + fileeval $cfPath(motors)/magnet_configuration.tcl + } + 2 { + set use_s1_stage "true" + fileeval $cfPath(motors)/euler_configuration.tcl + } +} + + # Dummy translation motor, useful for testing scans Motor dummy_motor asim [params \ @@ -138,36 +204,6 @@ dummy_s1 softupperlim 180 dummy_s1 precision 0.02 dummy_s1 home 0 -if { [ info exists ::config_dict ] && [ dict get $::config_dict s1_sample_insert enabled ] } { - set samp_stage_name "s1ss" - set tilt_motor_driver_type asim - - Motor s1 $motor_driver_type [params \ - asyncqueue mc2\ - host mc2-taipan\ - port pmc2-taipan\ - axis A\ - units degrees\ - hardlowerlim -1440\ - hardupperlim 1440\ - maxSpeed 1\ - maxAccel 1\ - maxDecel 1\ - stepsPerX [expr 67.0 * 25000 / 360]\ - absEnc 1\ - absEncHome 31275743\ - cntsPerX [expr 67.0 * 8192 / 360]] - s1 part sample - s1 long_name s1 - s1 softlowerlim -180 - s1 softupperlim 180 - s1 home 0 -} else { - set samp_stage_name "s1" - set tilt_motor_driver_type $motor_driver_type -} - -#if $use_tiltstage { # mc1: Monochromator crystal selection rotation/Tilt Motor mtilt $motor_driver_type [params \ asyncqueue mc1\ @@ -182,16 +218,14 @@ Motor mtilt $motor_driver_type [params \ maxDecel 1\ stepsPerX 25000\ absEnc 1\ - absEncHome 79650\ + absEncHome 27115\ cntsPerX 4096] mtilt part crystal mtilt long_name mtilt mtilt softlowerlim -5 mtilt softupperlim 5 mtilt home 0 -#} -set atest mtilt # mc1: Monochromator Linear (Translate) Motor mtrans $motor_driver_type [params \ @@ -207,7 +241,7 @@ Motor mtrans $motor_driver_type [params \ maxDecel 1\ stepsPerX 25000\ absEnc 1\ - absEncHome 469388\ + absEncHome 859242\ cntsPerX 4096] mtrans part crystal mtrans long_name mtrans @@ -249,9 +283,9 @@ m2 motOffDelay 0 m2 backlash_offset -0.5 m2 creep_offset 0.1 m2 creep_precision 0.0 -m2 speed 0.4 -m2 accel 0.04 -m2 decel 0.04 +m2 speed $m2_speed +m2 accel $m2_accel +m2 decel $m2_decel # mc1: Detector Rotate Motor a2 $motor_driver_type [params \ @@ -291,120 +325,31 @@ a2 decel 0.2 ############################ # -# mc2: Sample Tilt 1 -Motor sgu $tilt_motor_driver_type [params \ - asyncqueue mc2\ - host mc2-taipan\ - port pmc2-taipan\ - axis A\ - units degrees\ - hardlowerlim -13\ - hardupperlim 16.5\ - maxSpeed 2\ - maxAccel 1\ - maxDecel 1\ - stepsPerX 25000\ - absEnc 1\ - absEncHome 7745478\ - cntsPerX 8192] -sgu part sample -sgu long_name sgu -sgu softlowerlim -13 -sgu softupperlim 16.5 -sgu home 0 -sgu backlash_offset -0.2 - -# mc2: Sample Tilt 2 -Motor sgl $tilt_motor_driver_type [params \ - asyncqueue mc2\ - host mc2-taipan\ - port pmc2-taipan\ - axis B\ - units degrees\ - hardlowerlim -16.5\ - hardupperlim 17.5\ - maxSpeed 2\ - maxAccel 1\ - maxDecel 1\ - stepsPerX 25000\ - absEnc 1\ - absEncHome 7499135\ - cntsPerX 8192] -sgl part sample -sgl long_name sgl -sgl softlowerlim -16.5 -sgl softupperlim 17.5 -sgl home 0 -sgl backlash_offset -0.2 - -# mc2: Sample Up Tanslation -Motor stu $motor_driver_type [params \ - asyncqueue mc2\ - host mc2-taipan\ - port pmc2-taipan\ - axis C\ - units mm\ - hardlowerlim -15\ - hardupperlim 15\ - maxSpeed 2\ - maxAccel 1\ - maxDecel 1\ - stepsPerX -25000\ - absEnc 1\ - absEncHome 7392933\ - cntsPerX -8192] -stu part sample -stu long_name stu -stu softlowerlim -15 -stu softupperlim 15 -stu home 0.0 -stu backlash_offset -0.2 - -# mc2: Sample Lower Tanslation -Motor stl $motor_driver_type [params \ - asyncqueue mc2\ - host mc2-taipan\ - port pmc2-taipan\ - axis D\ - units mm\ - hardlowerlim -15\ - hardupperlim 15\ - maxSpeed 2\ - maxAccel 1\ - maxDecel 1\ - stepsPerX 25000\ - absEnc 1\ - absEncHome 7582773\ - cntsPerX 8192] -stl part sample -stl long_name stl -stl softlowerlim -15 -stl softupperlim 15 -stl home 0.0 -stl backlash_offset -0.2 - # mc2: Sample Rotate -Motor $samp_stage_name $motor_driver_type [params \ - asyncqueue mc2\ - host mc2-taipan\ - port pmc2-taipan\ - axis E\ - units degrees\ - hardlowerlim -194\ - hardupperlim 134\ - maxSpeed 4\ - maxAccel 2\ - maxDecel 2\ - stepsPerX 12495\ - absEnc 1\ - absEncHome 10695068\ - cntsPerX 4096] -$samp_stage_name part sample -$samp_stage_name long_name $samp_stage_name -$samp_stage_name softlowerlim -170 -$samp_stage_name softupperlim 120 -$samp_stage_name home 35.997 -$samp_stage_name backlash_offset -0.2 +if {$use_s1_stage == "true"} { + Motor s1 $motor_driver_type [params \ + asyncqueue mc2\ + host mc2-taipan\ + port pmc2-taipan\ + axis E\ + units degrees\ + hardlowerlim -194\ + hardupperlim 134\ + maxSpeed 4\ + maxAccel 2\ + maxDecel 2\ + stepsPerX 12495\ + absEnc 1\ + absEncHome 10695068\ + cntsPerX 4096] + s1 part sample + s1 long_name s1 + s1 softlowerlim -170 + s1 softupperlim 120 + s1 home 35.997 + s1 backlash_offset -0.2 +} + # mc2: Analyser Detector Rotate -- Sample Scattering Angle # absEncHome 20728908\ at -50 @@ -437,9 +382,9 @@ s2 backlash_offset 0.5 s2 blockage_thresh 1 s2 creep_offset 0.015 s2 creep_precision 0.005 -s2 speed 0.8 -s2 accel 0.2 -s2 decel 0.2 +s2 speed $s2_speed +s2 accel $s2_accel +s2 decel $s2_decel # mc2: Analyser Horizontal Focus Motor ahfocus $motor_driver_type [params \ @@ -517,9 +462,10 @@ mvfocus long_name mvfocus mvfocus softlowerlim 0 mvfocus softupperlim 300 mvfocus home 0.0 -mvfocus Blockage_Thresh 2 +mvfocus Blockage_Thresh 4 mvfocus Blockage_Check_Interval 2 mvfocus creep_offset 0.2 +mvfocus backlash_offset -4 # mc3: Monochromator Horizontal Focus Motor mhfocus $motor_driver_type [params \ asyncqueue mc3\ @@ -528,25 +474,26 @@ Motor mhfocus $motor_driver_type [params \ axis B\ units degrees\ precision 0.2\ - hardlowerlim -80\ - hardupperlim 240\ + hardlowerlim -10\ + hardupperlim 280\ maxSpeed 3.6\ maxAccel 1.728\ maxDecel 1.728\ stepsPerX [expr 25000.0 * 50.0 / 360.0]\ absEnc 1\ bias_bits 12\ - bias_bias 1540\ - absEncHome 2788\ - cntsPerX [expr -4096.0 / 360.0]] + bias_bias 1300\ + absEncHome 243\ + cntsPerX [expr 4096.0 / 360.0]] mhfocus part crystal mhfocus long_name mhfocus -mhfocus softlowerlim -75 -mhfocus softupperlim 235 +mhfocus softlowerlim -10 +mhfocus softupperlim 280 mhfocus home 0 -mhfocus Blockage_Thresh 2 +mhfocus Blockage_Thresh 4 mhfocus Blockage_Check_Interval 2 mhfocus creep_offset 0.2 +mhfocus backlash_offset -4 # mc3: Monochromator Rotate Motor m1 $motor_driver_type [params \ @@ -563,13 +510,13 @@ Motor m1 $motor_driver_type [params \ maxDecel 0.25\ stepsPerX 100000\ absEnc 1\ - absEncHome 16323070\ + absEncHome 16189898\ cntsPerX -2048] m1 part crystal m1 long_name m1 m1 softlowerlim 5 m1 softupperlim 40 -m1 home 20.45933 +m1 home 0 m1 backlash_offset -1.0 # mc4: Analyzer Tilt 1 -- Two-theta Angle diff --git a/site_ansto/instrument/tas/taipan_configuration.tcl b/site_ansto/instrument/tas/taipan_configuration.tcl index 2e910fc4..c605b795 100644 --- a/site_ansto/instrument/tas/taipan_configuration.tcl +++ b/site_ansto/instrument/tas/taipan_configuration.tcl @@ -35,21 +35,27 @@ namespace eval anticollider { proc ::anticollider::init {} {} } #fileeval $cfPath(anticollider)/anticollider.tcl #fileeval $cfPath(tasmad)/taspub_sics/tasp.tcl #fileeval $cfPath(tasmad)/taspub_sics/tasscript.tcl + +fileeval $cfPath(environment)/sct_agilent_33220A.tcl +fileeval $cfPath(environment)/sct_protek_common.tcl +fileeval $cfPath(environment)/sct_protekmm.tcl fileeval $cfPath(environment)/temperature/sct_eurotherm_2000.tcl +fileeval $cfPath(environment)/temperature/sct_eurotherm_3200.tcl fileeval $cfPath(environment)/temperature/sct_julabo_lh45.tcl fileeval $cfPath(environment)/temperature/sct_lakeshore_336.tcl +fileeval $cfPath(environment)/temperature/sct_ls336.tcl fileeval $cfPath(environment)/temperature/sct_lakeshore_340.tcl +fileeval $cfPath(environment)/temperature/sct_ls340.tcl fileeval $cfPath(environment)/temperature/sct_lakeshore_370.tcl +fileeval $cfPath(environment)/temperature/sct_lakeshore_m370.tcl fileeval $cfPath(environment)/temperature/sct_oxford_itc.tcl fileeval $cfPath(environment)/temperature/sct_oxford_mercury.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_base.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_temp.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_pres.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_level.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_valve.tcl fileeval $cfPath(environment)/temperature/west400.tcl +fileeval $cfPath(environment)/temperature/sct_west_6100.tcl fileeval $cfPath(environment)/he3/sct_he3.tcl fileeval $cfPath(environment)/magneticField/oxford_labview.tcl +fileeval $cfPath(environment)/magneticField/sct_oxford12tlv.tcl +fileeval $cfPath(beamline)/sct_he3_polanal.tcl fileeval config/load_setup.tcl fileeval log.tcl publish logbook spy @@ -58,12 +64,44 @@ source gumxml.tcl ::utility::mkVar ::anticollider::protect_detector text manager protect_detector false detector true false ::anticollider::protect_detector "true" +if { [ dict exists $::config_dict sample_stage implementation ] } { + set sample_stage [ dict get $::config_dict sample_stage implementation ] +} else { + set sample_stage "normal_sample_stage" +} +switch $sample_stage { + "eulerian_cradle" { + # s1-> eom, sgu -> ephi, sgl -> echi + set OMEGA s1 + set PHI ephi + set CHI echi + } + "normal_sample_stage" - default { + set OMEGA s1 + set PHI sgu + set CHI sgl + } +} # init for the tasUB #make mcv mch acv ach into mvfocus mhfocus avfocus ahfocus when it works puts "doing tasub" -MakeTasUB tasub m1 m2 mcv mch s1 s2 sgu sgl a1 a2 acv ach +MakeTasUB tasub m1 m2 mvfocus mhfocus $OMEGA s2 $PHI $CHI a1 a2 avfocus ahfocus tasub mono dd 3.35416 tasub ana dd 3.35416 +# NOTE Autofocussing parameters (vbn, hbn) persist in status.tcl +# To override this behaviour you can set them in extraconfig.tcl +tasub mono vb1 102.2 +tasub mono vb2 1.78 +tasub mono hb1 18.28 +tasub mono hb2 60.1 +tasub mono hb3 0.951 +tasub ana vb1 115 +tasub ana vb2 2.13 +tasub ana hb1 45.68 +tasub ana hb2 105.7 +tasub ana hb3 0.945 +tasub focusfn energy +tasub autofocus 0 tasub updatetargets puts "done tasub" @@ -74,6 +112,16 @@ server_init ########################################### # WARNING: Do not add any code below server_init, if you do SICS may fail to initialise properly. +puts "Making hkl command" +MakeMono mono PG m1 m2 +mono dd 3.35416 +MakeWaveLength lambda mono +MakeEnergy energy mono +#MakeSingleX singlex +#MakeHKL s2 $OMEGA $PHI $CHI +#MakeHKLMot hkl +#MakeUBcalc ubcalc hkl + # Provide tasmot notifications to GumTree when real motors move proc m2tasupdate {} { tasub update @@ -109,7 +157,7 @@ proc a2tasupdate {} { publish a2tasupdate user scriptcallback connect m2 MOTEND m2tasupdate -scriptcallback connect s1 MOTEND s1s2tasupdate +scriptcallback connect $OMEGA MOTEND s1s2tasupdate scriptcallback connect s2 MOTEND s1s2tasupdate scriptcallback connect a2 MOTEND a2tasupdate diff --git a/site_ansto/instrument/tas/util/sics_config.ini b/site_ansto/instrument/tas/util/sics_config.ini index a6d20e29..2051ff37 100644 --- a/site_ansto/instrument/tas/util/sics_config.ini +++ b/site_ansto/instrument/tas/util/sics_config.ini @@ -1,156 +1,304 @@ -[12tmagnet] -desc = "12 Tesla Oxford Magnet" -driver = "12tmagnet" -enabled = False -group = environment:magnet -id = 11 -ip = 10.157.205.3 -name = magnetic -port = 55001 -type = B - [12tmagnet_setup] -cascade = 12tmagnet,s1_sample_insert,mercury_scpi +cascade = B1:12tmagnet_oxford,sample_stage:12tmagnet_sample_insert,T1:mercury_scpi_01 enabled = False -group = 0setup - -[ls336_1] -desc = "tc1: Lakeshore 336 temperature controller" -driver = "ls336" +[CF1] +cascade = T1:CF1_ls340,sample_stage:normal_sample_stage +enabled = False +[Default] +cascade = sample_stage:normal_sample_stage +enabled = True +[B1] +datype = B enabled = False -group = environment:temperature id = 1 -ip = 10.157.205.28 -name = tc1 -port = 7777 -terminator = \r\n -tol1 = 1.0 -tol2 = 1.0 -type = T - -[ls336_12] -desc = "tc6: Lakeshore 336 temperature controller" -driver = "ls336" +implementation = none +name = magnet1 +optype = magnetic_field +[Function_Generator] +datype = V enabled = False -group = environment:temperature -id = 6 -ip = 10.157.205.31 -name = tc6 -port = 7777 -terminator = \r\n -tol1 = 1.0 -tol2 = 1.0 -type = T - -[ls336_2] -desc = "tc2: Lakeshore 336 temperature controller" -driver = "ls336" +id = 1 +implementation = none +name = pulser +optype = function_generator +[I1] +datype = I +enabled = False +id = 1 +implementation = none +name = curr1 +optype = multimeter +[I2] +datype = I enabled = False -group = environment:temperature id = 2 -ip = 10.157.205.29 +implementation = none +name = curr2 +optype = multimeter +[T1] +datype = T +enabled = False +id = 1 +implementation = none +name = tc1 +optype = temperature +[T2] +datype = T +enabled = False +id = 2 +implementation = none name = tc2 -port = 7777 -terminator = \r\n -tol1 = 1.0 -tol2 = 1.0 -type = T - -[ls336_4] -desc = "tc3: Lakeshore 336 temperature controller" -driver = "ls336" +optype = temperature +[T3] +datype = T enabled = False -group = environment:temperature id = 3 -ip = 10.157.205.30 +implementation = none name = tc3 -port = 7777 -terminator = \r\n -tol1 = 1.0 -tol2 = 1.0 -type = T - -[ls336_5] -desc = "tc4: Lakeshore 336 temperature controller" -driver = "ls336" +optype = temperature +[T4] +datype = T enabled = False -group = environment:temperature id = 4 -ip = 137.157.201.21 +implementation = none name = tc4 -port = 7777 -terminator = \r\n -tol1 = 1.0 -tol2 = 1.0 -type = T - -[ls336_6] -desc = "tc5: Lakeshore 336 temperature controller" -driver = "ls336" +optype = temperature +[V1] +datype = V enabled = False -group = environment:temperature -id = 5 -ip = 137.157.201.21 -name = tc5 -port = 7777 -terminator = \r\n -tol1 = 1.0 -tol2 = 1.0 -type = T +id = 1 +implementation = none +name = volts1 +optype = multimeter +[V2] +datype = V +enabled = False +id = 2 +implementation = none +name = volts2 +optype = multimeter +[sample_stage] +enabled = Always +implementation = normal_sample_stage +name = sample_stage +optype = motion_axis +[12tmagnet_oxford] +asyncqueue = sct +desc = "12 Tesla Oxford Magnet" +driver = "oxford12tlv" +imptype = magnetic_field +interval = 5 +ip = 10.157.205.3 +port = 55001 -[ls340_1] -desc = "tc13: Lakeshore 340 temperature controller" +[12tmagnet_sample_insert] +desc = "s1 will be redefined as the magnet sample insert rotation." +imptype = motion_axis + +[CF1_ls340] +desc = "cf1: Bottom loading cryofurnace" driver = "ls340" -enabled = False -group = environment:temperature -id = 13 -ip = 137.157.203.137 -name = tc13 +imptype = temperature +ip = 10.157.205.43 port = 4001 terminator = \r\n tol1 = 1.0 tol2 = 1.0 -type = T -[ls370] -desc = "tc8: Lakeshore 370 temperature controller" -driver = "ls370" -enabled = False -group = environment:temperature -id = 8 -ip = 137.157.203.137 -name = tc8 -port = 4003 +[agilent_33220A] +asyncqueue = sct +desc = "Function Generator" +driver = agilent_33220A +imptype = function_generator +ip = 10.157.205.16 +name = pulser +port = 5025 + +[ls336_01] +asyncqueue = sct +desc = "Lakeshore 336 temperature controller" +driver = "ls336" +imptype = temperature +ip = 10.157.205.28 +port = 7777 terminator = \r\n -tol = 2.0 -type = T +tol1 = 1.0 +tol2 = 1.0 -[mercury_scpi] -desc = "tc9: Oxford Mercury temperature controller in Mercury mode" -driver = "mercury_scpi" -enabled = False -group = environment:temperature -id = 9 +[ls336_02] +asyncqueue = sct +desc = "Lakeshore 336 temperature controller" +driver = "ls336" +imptype = temperature +ip = 10.157.205.29 +port = 7777 +terminator = \r\n +tol1 = 1.0 +tol2 = 1.0 + +[ls336_04] +asyncqueue = sct +desc = "Lakeshore 336 temperature controller" +driver = "ls336" +imptype = temperature +ip = 10.157.205.30 +port = 7777 +terminator = \r\n +tol1 = 1.0 +tol2 = 1.0 + +[ls336_05] +asyncqueue = sct +desc = "Lakeshore 336 temperature controller" +driver = "ls336" +imptype = temperature +ip = 137.157.201.21 +port = 7777 +terminator = \r\n +tol1 = 1.0 +tol2 = 1.0 + +[ls336_06] +asyncqueue = sct +desc = "Lakeshore 336 temperature controller" +driver = "ls336" +imptype = temperature +ip = 10.157.205.30 +port = 7777 +terminator = \r\n +tol1 = 1.0 +tol2 = 1.0 + +[ls336_11] +desc = "Lakeshore 336 temperature controller" +driver = "ls336" +imptype = temperature +ip = 10.157.205.27 +port = 7777 +terminator = \r\n +tol1 = 1.0 +tol2 = 1.0 + +[ls336_12] +asyncqueue = sct +desc = "Lakeshore 336 temperature controller" +driver = "ls336" +imptype = temperature +ip = 10.157.205.31 +port = 7777 +terminator = \r\n +tol1 = 1.0 +tol2 = 1.0 + +[ls340_01] +asyncqueue = sct +desc = "Lakeshore 340 temperature controller" +driver = "ls340" +imptype = temperature +ip = 137.157.201.86 +port = 4001 +terminator = \r\n +tol1 = 1.0 +tol2 = 1.0 + +[ls340_02] +asyncqueue = sct +desc = "Lakeshore 340 temperature controller" +driver = "ls340" +imptype = temperature +ip = 137.157.201.86 +port = 4002 +terminator = \r\n +tol1 = 1.0 +tol2 = 1.0 + +[ls340_11] +desc = "Lakeshore 340 temperature controller" +driver = "ls340" +imptype = temperature +ip = 137.157.201.86 +port = 4001 +terminator = \r\n +tol1 = 1.0 +tol2 = 1.0 + +[mercury_scpi_01] +desc = "Oxford Mercury temperature controller with three temperature loops." +driver = "mercury_base" +imptype = temperature ip = 10.157.205.5 -name = tc9 -offifon = mercury_itc500 +permlink = LT port = 7020 -terminator = \r -tol = 2.0 -type = T +terminator = \r\n +tol = 1.0 +valve_tol = 2 -[s1_sample_insert] -desc = "s1 will be defined as the sample insert rotation. Sample stage will be renamed to s1ss and sgu and sgl will be simulated" -enabled = False -group = motors +[mercury_scpi_02] +desc = "Oxford Mercury temperature controller with four temperature loops and needle valve control" +driver = "mercury_scpi" +imptype = temperature +ip = 10.157.205.47 +permlink = LT +port = 7020 +terminator = \r\n +tol = 1.0 +valve_tol = 2 -[west4100] -desc = "tc10: Blue furnace temperature controller" +[normal_sample_stage] +desc = "This is the default sample stage configuration" +imptype = motion_axis + +[protek_01] +asyncqueue = sct +desc = "Protek Multimeter" +driver = "protekmm" +imptype = multimeter +ip = 10.157.205.36 +port = 4001 + +[protek_02] +asyncqueue = sct +desc = "Protek Multimeter" +driver = "protekmm" +imptype = multimeter +ip = 10.157.205.37 +port = 4001 + +[vf1_west4100] +asyncqueue = sct +desc = "VF1 Blue furnace temperature controller" +dev_id = 1 driver = "west4100" -enabled = False -group = environment:temperature -id = 10 -ip = 10.157.205.19 -name = tc10 -type = T +imptype = temperature +ip = 10.157.205.24 +port = 502 + +[vf1_west6100] +asyncprotocol = modbus_ap +desc = "VF1 Blue furnace 6100 temperature controller" +dev_id = 1 +driver = "west_6100" +imptype = temperature +ip = 10.157.205.24 +port = 502 +timeout = 2000 + +[vf2_west4100] +asyncqueue = sct +desc = "VF2 Blue furnace temperature controller" +dev_id = 1 +driver = "west4100" +imptype = temperature +ip = 10.157.205.25 +port = 502 + +[vf2_west6100] +asyncprotocol = modbus_ap +desc = "VF2 Blue furnace 6100 temperature controller" +dev_id = 1 +driver = "west_6100" +imptype = temperature +ip = 10.157.205.25 +port = 502 +timeout = 2000 From 666a70cb968e69b79d398230984dce37d92cb820 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 19 Feb 2015 10:34:31 +1100 Subject: [PATCH 15/22] Dubious diffs from Taipan 2015-02-19 --- .../temperature/sct_lakeshore_m370.tcl | 117 ++++++++---------- 1 file changed, 52 insertions(+), 65 deletions(-) diff --git a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_m370.tcl b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_m370.tcl index 401527b9..c959e923 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_m370.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_m370.tcl @@ -27,24 +27,23 @@ proc ::scobj::lakeshore_m370::sics_log {debug_level debug_string} { } catch_message ] } -proc ::scobj::lakeshore_m370::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id tol } { - ::scobj::lakeshore_m370::sics_log 9 "::scobj::lakeshore_m370::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol}" +proc ::scobj::lakeshore_m370::mkDriver { sct_controller name id tol} { + ::scobj::lakeshore_m370::sics_log 9 "::scobj::lakeshore_m370::mkDriver ${sct_controller} ${name} ${id} ${tol}" set ns "[namespace current]" set catch_status [ catch { - MakeSICSObj ${name} SCT_OBJECT user float + MakeSICSObj ${name} SCT_OBJECT user none - sicslist setatt ${name} klass ${device_class} + sicslist setatt ${name} klass environment sicslist setatt ${name} long_name ${name} set scobj_hpath /sics/${name} - hsetprop ${scobj_hpath} klass ${device_class} - hsetprop ${scobj_hpath} data true + hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} debug_threshold 5 # mkDriver hook code starts ::scobj::lakeshore_370::mk_sct_driver $sct_controller environment $name $tol - hsetprop ${scobj_hpath}/setpoint permlink data_set T[format "%02d" ${id}]SP01 - hsetprop ${scobj_hpath}/setpoint @description T[format "%02d" ${id}]SP01 + hsetprop ${scobj_hpath}/Loop1/setpoint permlink data_set T[format "%02d" ${id}]SP01 + hsetprop ${scobj_hpath}/Loop1/setpoint @description T[format "%02d" ${id}]SP01 hsetprop ${scobj_hpath}/Sensor/value permlink data_set T[format "%02d" ${id}]S01 hsetprop ${scobj_hpath}/Sensor/value @description T[format "%02d" ${id}]S01 # mkDriver hook code ends @@ -52,37 +51,31 @@ proc ::scobj::lakeshore_m370::mkDriver { sct_controller name device_class simula handle_exception ${catch_status} ${catch_message} } -proc ::scobj::lakeshore_m370::add_driver {name device_class simulation_flag ip_address tcp_port id tol} { - set catch_status [ catch { - ::scobj::lakeshore_m370::sics_log 9 "::scobj::lakeshore_m370::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol}" - if {[string equal -nocase "${simulation_flag}" "false"]} { - if {[string equal -nocase "aqadapter" "${ip_address}"]} { - ::scobj::lakeshore_m370::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" - makesctcontroller sct_${name} aqadapter ${tcp_port} - } else { - ::scobj::lakeshore_m370::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}" - makesctcontroller sct_${name} std ${ip_address}:${tcp_port} - } - } else { - ::scobj::lakeshore_m370::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for lakeshore_m370" - } - ::scobj::lakeshore_m370::sics_log 1 "::scobj::lakeshore_m370::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol}" - ::scobj::lakeshore_m370::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol} - } catch_message ] - handle_exception ${catch_status} ${catch_message} -} - namespace eval ::scobj::lakeshore_m370 { namespace export debug_threshold namespace export debug_log namespace export sics_log namespace export mkDriver - namespace export add_driver } -proc add_lakeshore_m370 {name ip_address tcp_port id tol} { - set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::lakeshore_m370::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}" "${tol}" +proc add_lakeshore_m370 {name IP port id tol} { + set catch_status [ catch { + ::scobj::lakeshore_m370::sics_log 9 "add_lakeshore_m370 ${name} ${IP} ${port} ${tol}" + if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { + if {[string equal -nocase "aqadapter" "${IP}"]} { + ::scobj::lakeshore_m370::sics_log 9 "makesctcontroller sct_${name} aqadapter ${port}" + makesctcontroller sct_${name} aqadapter ${port} + } else { + ::scobj::lakeshore_m370::sics_log 9 "makesctcontroller sct_${name} std ${IP}:${port}" + makesctcontroller sct_${name} std ${IP}:${port} + } + } else { + ::scobj::lakeshore_m370::sics_log 9 "[environment_simulation] => No sctcontroller for lakeshore_m370" + } + ::scobj::lakeshore_m370::sics_log 1 "::scobj::lakeshore_m370::mkDriver sct_${name} ${name} ${id} ${tol}" + ::scobj::lakeshore_m370::mkDriver sct_${name} ${name} ${id} ${tol} + } catch_message ] + handle_exception ${catch_status} ${catch_message} } clientput "file evaluation of sct_lakeshore_m370.tcl" @@ -91,41 +84,42 @@ clientput "file evaluation of sct_lakeshore_m370.tcl" proc ::scobj::lakeshore_m370::read_config {} { set catch_status [ catch { set ns "::scobj::lakeshore_m370" - dict for {k u} $::config_dict { - if { [dict exists $u "implementation"] } { - set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - set device_class "environment" - if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { + dict for {k v} $::config_dict { + if { [dict exists $v "implementation"] } { + if { !([dict exists $v "name"] && [dict exists $v "enabled"]) } { continue } - set enabled [string tolower [dict get $u "enabled"]] + set enabled [string tolower [dict get $v "enabled"]] if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { continue } - if { [dict exists $u "simulation_group"] } { - set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]] - } - if { [dict exists $u "device_class"] } { - set device_class "[dict get $u "device_class"]" - } - set name [dict get $u name] - set implementation [dict get $u "implementation"] + set name [dict get $v name] + set implementation [dict get $v "implementation"] if { !([dict exists $::config_dict $implementation]) } { continue } + set arg_list [list] + foreach arg {id} { + if {[dict exists $v $arg]} { + lappend arg_list "[dict get $v $arg]" + } else { + ${ns}::sics_log 9 "Missing configuration value $arg" + error "Missing configuration value $arg" + } + } set v [dict get $::config_dict $implementation] if { !([dict exists $v "driver"]) } { continue } if { [string equal -nocase [dict get $v "driver"] "lakeshore_m370"] } { - if { ![string equal -nocase "${simulation_flag}" "false"] } { + if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { set asyncqueue "null" - ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue" + ${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" } elseif { [dict exists $v "asyncqueue"] } { set asyncqueue [dict get $v "asyncqueue"] if { [string equal -nocase ${asyncqueue} "sct"] } { - set ip_address [dict get $v ip] - set tcp_port [dict get $v port] + set IP [dict get $v ip] + set PORT [dict get $v port] } } else { if { [dict exists $v "asyncprotocol"] } { @@ -139,32 +133,25 @@ proc ::scobj::lakeshore_m370::read_config {} { } } set asyncqueue ${name}_queue - set ip_address [dict get $v ip] - set tcp_port [dict get $v port] - MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${ip_address} ${tcp_port} + 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"]" } } - set arg_list [list] - set missing_list [list] - foreach arg {id tol} { - if {[dict exists $u $arg]} { - lappend arg_list "[dict get $u $arg]" - } elseif {[dict exists $v $arg]} { + foreach arg {tol} { + if {[dict exists $v $arg]} { lappend arg_list "[dict get $v $arg]" } else { ${ns}::sics_log 9 "Missing configuration value $arg" - lappend missing_list $arg + error "Missing configuration value $arg" } } - if { [llength $missing_list] > 0 } { - error "$name is missing configuration values $missing_list" - } if { [string equal -nocase ${asyncqueue} "sct"] } { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list + add_lakeshore_m370 ${name} ${IP} ${PORT} {*}$arg_list } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list + add_lakeshore_m370 ${name} "aqadapter" ${asyncqueue} {*}$arg_list } } } From 2dcf274618d30c5ffcc7f33810191975cec5d132 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 19 Feb 2015 10:35:21 +1100 Subject: [PATCH 16/22] Tilt configuration from Taipan 2015-02-19 --- .../tas/config/motors/tilt_configuration.tcl | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 site_ansto/instrument/tas/config/motors/tilt_configuration.tcl diff --git a/site_ansto/instrument/tas/config/motors/tilt_configuration.tcl b/site_ansto/instrument/tas/config/motors/tilt_configuration.tcl new file mode 100644 index 00000000..40da9973 --- /dev/null +++ b/site_ansto/instrument/tas/config/motors/tilt_configuration.tcl @@ -0,0 +1,92 @@ +# mc2: Sample Tilt 1 +Motor sgu $tilt_motor_driver_type [params \ + asyncqueue mc2\ + host mc2-taipan\ + port pmc2-taipan\ + axis A\ + units degrees\ + hardlowerlim -13\ + hardupperlim 16.5\ + maxSpeed 2\ + maxAccel 1\ + maxDecel 1\ + stepsPerX 25000\ + absEnc 1\ + absEncHome 7745478\ + cntsPerX 8192] +sgu part sample +sgu long_name sgu +sgu softlowerlim -13 +sgu softupperlim 16.5 +sgu home 0 +sgu backlash_offset -0.2 + +# mc2: Sample Tilt 2 +Motor sgl $tilt_motor_driver_type [params \ + asyncqueue mc2\ + host mc2-taipan\ + port pmc2-taipan\ + axis B\ + units degrees\ + hardlowerlim -16.5\ + hardupperlim 17.5\ + maxSpeed 2\ + maxAccel 1\ + maxDecel 1\ + stepsPerX 25000\ + absEnc 1\ + absEncHome 7499135\ + cntsPerX 8192] +sgl part sample +sgl long_name sgl +sgl softlowerlim -16.5 +sgl softupperlim 17.5 +sgl home 0 +sgl backlash_offset -0.2 + +# mc2: Sample Up Tanslation +Motor stu $motor_driver_type [params \ + asyncqueue mc2\ + host mc2-taipan\ + port pmc2-taipan\ + axis C\ + units mm\ + hardlowerlim -15\ + hardupperlim 15\ + maxSpeed 2\ + maxAccel 1\ + maxDecel 1\ + stepsPerX -25000\ + absEnc 1\ + absEncHome 7392933\ + cntsPerX -8192] +stu part sample +stu long_name stu +stu softlowerlim -15 +stu softupperlim 15 +stu home 0.0 +stu backlash_offset -0.2 + +# mc2: Sample Lower Tanslation +Motor stl $motor_driver_type [params \ + asyncqueue mc2\ + host mc2-taipan\ + port pmc2-taipan\ + axis D\ + units mm\ + hardlowerlim -15\ + hardupperlim 15\ + maxSpeed 2\ + maxAccel 1\ + maxDecel 1\ + stepsPerX 25000\ + absEnc 1\ + absEncHome 7582773\ + cntsPerX 8192] +stl part sample +stl long_name stl +stl softlowerlim -15 +stl softupperlim 15 +stl home 0.0 +stl backlash_offset -0.2 + From 40d2a1e2f41d82b375975c40bd9174f6a885ea25 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 19 Feb 2015 11:24:44 +1100 Subject: [PATCH 17/22] Pullback from Pelican 2015-02-19 --- .../temperature/sct_lakeshore_218.tcl | 421 ++++++++++++------ .../temperature/sct_lakeshore_370.tcl | 2 +- .../temperature/sct_oxford_mercury.tcl | 2 +- .../config/motors/motor_configuration.tcl | 7 +- .../pelican/pelican_configuration.tcl | 5 + 5 files changed, 291 insertions(+), 146 deletions(-) diff --git a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_218.tcl b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_218.tcl index e0aba1ab..2b13d4cb 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_218.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_218.tcl @@ -10,9 +10,12 @@ proc ::scobj::lakeshore_218::debug_log {tc_root debug_level debug_string} { set catch_status [ catch { set debug_threshold [hgetpropval ${tc_root} debug_threshold] if {${debug_level} >= ${debug_threshold}} { - set fd [open "../log/lakeshore_218_[basename ${tc_root}].log" "a"] - set line "[clock format [clock seconds] -format "%T"] ${debug_string}" - puts ${fd} "${line}" + set now [clock seconds] + set ts [clock format ${now} -format "%Y%m%d"] + set log_file_name "../log/lakeshore_218_[basename ${tc_root}]_${ts}.log" + set fd [open "${log_file_name}" "a"] + set ts [clock format ${now} -format "%T"] + puts ${fd} "${ts} ${debug_string}" close ${fd} } } catch_message ] @@ -62,7 +65,7 @@ proc ::scobj::lakeshore_218::getTemp {tc_root nextState cmd_str} { } set cmd "${cmd_str}" # getTemp hook code starts - set temps [split "[hval ${tc_root}/krdg]" ","] + set temps [split "[hgetpropval ${tc_root}/krdg real_data]" ","] sct result [lindex ${temps} ${cmd_str}] set cmd "@@NOSEND@@" # getTemp hook code ends @@ -133,6 +136,39 @@ proc ::scobj::lakeshore_218::rdValue {tc_root} { handle_exception ${catch_status} ${catch_message} } +# function to parse the read of a parameter on a device +proc ::scobj::lakeshore_218::read_krdg {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "read_krdg tc_root=${tc_root} sct=[sct] result=[sct result]" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set data [sct result] + set nextState "idle" + if {[string equal -nocase -length 7 ${data} "ASCERR:"]} { + # the protocol driver has reported an error + sct geterror "${data}" + error "[sct geterror]" + } +# read_krdg hook code starts + sct real_data "${data}" + set data "Hidden in real_data property" +# read_krdg hook code ends + if { [hpropexists [sct] geterror] } { + debug_log ${tc_root} 9 "[sct] error: [sct geterror]" + error "[sct geterror]" + } + if { ${data} != [sct oldval] } { + debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]" + sct oldval ${data} + sct update ${data} + sct utime readtime + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + # function to write a parameter value on a device proc ::scobj::lakeshore_218::setValue {tc_root nextState cmd_str} { set catch_status [ catch { @@ -157,8 +193,8 @@ proc ::scobj::lakeshore_218::setValue {tc_root nextState cmd_str} { handle_exception ${catch_status} ${catch_message} } -proc ::scobj::lakeshore_218::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } { - ::scobj::lakeshore_218::sics_log 9 "::scobj::lakeshore_218::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}" +proc ::scobj::lakeshore_218::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port {num_chans 8} } { + ::scobj::lakeshore_218::sics_log 9 "::scobj::lakeshore_218::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${num_chans}" set ns "[namespace current]" set catch_status [ catch { @@ -170,149 +206,219 @@ proc ::scobj::lakeshore_218::mkDriver { sct_controller name device_class simulat set scobj_hpath /sics/${name} hfactory ${scobj_hpath}/krdg plain user text - hsetprop ${scobj_hpath}/krdg read ${ns}::getValue ${scobj_hpath} rdValue {KRDG? 0} - hsetprop ${scobj_hpath}/krdg rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/krdg read ${ns}::getValue ${scobj_hpath} read_krdg {KRDG? 0} + hsetprop ${scobj_hpath}/krdg read_krdg ${ns}::read_krdg ${scobj_hpath} hsetprop ${scobj_hpath}/krdg control false hsetprop ${scobj_hpath}/krdg data false hsetprop ${scobj_hpath}/krdg mutable true hsetprop ${scobj_hpath}/krdg nxsave false - hsetprop ${scobj_hpath}/krdg oldval 0,0,0,0,0,0,0,0 - hset ${scobj_hpath}/krdg 0,0,0,0,0,0,0,0 + hsetprop ${scobj_hpath}/krdg oldval "Hidden in real_data property" + hset ${scobj_hpath}/krdg "Hidden in real_data property" + hsetprop ${scobj_hpath}/krdg real_data "0,0,0,0,0,0,0,0" hsetprop ${scobj_hpath}/krdg sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/krdg type "part" hsetprop ${scobj_hpath}/krdg nxalias "${name}_krdg" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/krdg 1 + hsetprop ${scobj_hpath}/krdg simulated false + } else { + ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" + hsetprop ${scobj_hpath}/krdg simulated true + } + hsetprop ${scobj_hpath} data "false" hsetprop ${scobj_hpath} klass "@none" hsetprop ${scobj_hpath} type "part" - if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/krdg 1 - } else { - ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" + hfactory ${scobj_hpath}/sensor plain spy none + + if {${num_chans} > 0} { + hfactory ${scobj_hpath}/sensor/ch1 plain user float + hsetprop ${scobj_hpath}/sensor/ch1 read ${ns}::getTemp ${scobj_hpath} rdValue {0} + hsetprop ${scobj_hpath}/sensor/ch1 rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/sensor/ch1 control true + hsetprop ${scobj_hpath}/sensor/ch1 data true + hsetprop ${scobj_hpath}/sensor/ch1 mutable true + hsetprop ${scobj_hpath}/sensor/ch1 nxsave true + hsetprop ${scobj_hpath}/sensor/ch1 oldval 0.0 + hsetprop ${scobj_hpath}/sensor/ch1 klass "parameter" + hsetprop ${scobj_hpath}/sensor/ch1 sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/sensor/ch1 type "part" + hsetprop ${scobj_hpath}/sensor/ch1 nxalias "${name}_sensor_ch1" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor/ch1 15 + hsetprop ${scobj_hpath}/sensor/ch1 simulated false + } else { + ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" + hsetprop ${scobj_hpath}/sensor/ch1 simulated true + } } - hfactory ${scobj_hpath}/sensor plain spy none + if {${num_chans} > 1} { + hfactory ${scobj_hpath}/sensor/ch2 plain user float + hsetprop ${scobj_hpath}/sensor/ch2 read ${ns}::getTemp ${scobj_hpath} rdValue {1} + hsetprop ${scobj_hpath}/sensor/ch2 rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/sensor/ch2 control true + hsetprop ${scobj_hpath}/sensor/ch2 data true + hsetprop ${scobj_hpath}/sensor/ch2 mutable true + hsetprop ${scobj_hpath}/sensor/ch2 nxsave true + hsetprop ${scobj_hpath}/sensor/ch2 oldval 0.0 + hsetprop ${scobj_hpath}/sensor/ch2 klass "parameter" + hsetprop ${scobj_hpath}/sensor/ch2 sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/sensor/ch2 type "part" + hsetprop ${scobj_hpath}/sensor/ch2 nxalias "${name}_sensor_ch2" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor/ch2 15 + hsetprop ${scobj_hpath}/sensor/ch2 simulated false + } else { + ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" + hsetprop ${scobj_hpath}/sensor/ch2 simulated true + } + } + + if {${num_chans} > 2} { + hfactory ${scobj_hpath}/sensor/ch3 plain user float + hsetprop ${scobj_hpath}/sensor/ch3 read ${ns}::getTemp ${scobj_hpath} rdValue {2} + hsetprop ${scobj_hpath}/sensor/ch3 rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/sensor/ch3 control true + hsetprop ${scobj_hpath}/sensor/ch3 data true + hsetprop ${scobj_hpath}/sensor/ch3 mutable true + hsetprop ${scobj_hpath}/sensor/ch3 nxsave true + hsetprop ${scobj_hpath}/sensor/ch3 oldval 0.0 + hsetprop ${scobj_hpath}/sensor/ch3 klass "parameter" + hsetprop ${scobj_hpath}/sensor/ch3 sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/sensor/ch3 type "part" + hsetprop ${scobj_hpath}/sensor/ch3 nxalias "${name}_sensor_ch3" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor/ch3 15 + hsetprop ${scobj_hpath}/sensor/ch3 simulated false + } else { + ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" + hsetprop ${scobj_hpath}/sensor/ch3 simulated true + } + } + + if {${num_chans} > 3} { + hfactory ${scobj_hpath}/sensor/ch4 plain user float + hsetprop ${scobj_hpath}/sensor/ch4 read ${ns}::getTemp ${scobj_hpath} rdValue {3} + hsetprop ${scobj_hpath}/sensor/ch4 rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/sensor/ch4 control true + hsetprop ${scobj_hpath}/sensor/ch4 data true + hsetprop ${scobj_hpath}/sensor/ch4 mutable true + hsetprop ${scobj_hpath}/sensor/ch4 nxsave true + hsetprop ${scobj_hpath}/sensor/ch4 oldval 0.0 + hsetprop ${scobj_hpath}/sensor/ch4 klass "parameter" + hsetprop ${scobj_hpath}/sensor/ch4 sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/sensor/ch4 type "part" + hsetprop ${scobj_hpath}/sensor/ch4 nxalias "${name}_sensor_ch4" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor/ch4 15 + hsetprop ${scobj_hpath}/sensor/ch4 simulated false + } else { + ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" + hsetprop ${scobj_hpath}/sensor/ch4 simulated true + } + } + + if {${num_chans} > 4} { + hfactory ${scobj_hpath}/sensor/ch5 plain user float + hsetprop ${scobj_hpath}/sensor/ch5 read ${ns}::getTemp ${scobj_hpath} rdValue {4} + hsetprop ${scobj_hpath}/sensor/ch5 rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/sensor/ch5 control true + hsetprop ${scobj_hpath}/sensor/ch5 data true + hsetprop ${scobj_hpath}/sensor/ch5 mutable true + hsetprop ${scobj_hpath}/sensor/ch5 nxsave true + hsetprop ${scobj_hpath}/sensor/ch5 oldval 0.0 + hsetprop ${scobj_hpath}/sensor/ch5 klass "parameter" + hsetprop ${scobj_hpath}/sensor/ch5 sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/sensor/ch5 type "part" + hsetprop ${scobj_hpath}/sensor/ch5 nxalias "${name}_sensor_ch5" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor/ch5 15 + hsetprop ${scobj_hpath}/sensor/ch5 simulated false + } else { + ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" + hsetprop ${scobj_hpath}/sensor/ch5 simulated true + } + } + + if {${num_chans} > 5} { + hfactory ${scobj_hpath}/sensor/ch6 plain user float + hsetprop ${scobj_hpath}/sensor/ch6 read ${ns}::getTemp ${scobj_hpath} rdValue {5} + hsetprop ${scobj_hpath}/sensor/ch6 rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/sensor/ch6 control true + hsetprop ${scobj_hpath}/sensor/ch6 data true + hsetprop ${scobj_hpath}/sensor/ch6 mutable true + hsetprop ${scobj_hpath}/sensor/ch6 nxsave true + hsetprop ${scobj_hpath}/sensor/ch6 oldval 0.0 + hsetprop ${scobj_hpath}/sensor/ch6 klass "parameter" + hsetprop ${scobj_hpath}/sensor/ch6 sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/sensor/ch6 type "part" + hsetprop ${scobj_hpath}/sensor/ch6 nxalias "${name}_sensor_ch6" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor/ch6 15 + hsetprop ${scobj_hpath}/sensor/ch6 simulated false + } else { + ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" + hsetprop ${scobj_hpath}/sensor/ch6 simulated true + } + } + + if {${num_chans} > 6} { + hfactory ${scobj_hpath}/sensor/ch7 plain user float + hsetprop ${scobj_hpath}/sensor/ch7 read ${ns}::getTemp ${scobj_hpath} rdValue {6} + hsetprop ${scobj_hpath}/sensor/ch7 rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/sensor/ch7 control true + hsetprop ${scobj_hpath}/sensor/ch7 data true + hsetprop ${scobj_hpath}/sensor/ch7 mutable true + hsetprop ${scobj_hpath}/sensor/ch7 nxsave true + hsetprop ${scobj_hpath}/sensor/ch7 oldval 0.0 + hsetprop ${scobj_hpath}/sensor/ch7 klass "parameter" + hsetprop ${scobj_hpath}/sensor/ch7 sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/sensor/ch7 type "part" + hsetprop ${scobj_hpath}/sensor/ch7 nxalias "${name}_sensor_ch7" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor/ch7 15 + hsetprop ${scobj_hpath}/sensor/ch7 simulated false + } else { + ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" + hsetprop ${scobj_hpath}/sensor/ch7 simulated true + } + } + + if {${num_chans} > 7} { + hfactory ${scobj_hpath}/sensor/ch8 plain user float + hsetprop ${scobj_hpath}/sensor/ch8 read ${ns}::getTemp ${scobj_hpath} rdValue {7} + hsetprop ${scobj_hpath}/sensor/ch8 rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/sensor/ch8 control true + hsetprop ${scobj_hpath}/sensor/ch8 data true + hsetprop ${scobj_hpath}/sensor/ch8 mutable true + hsetprop ${scobj_hpath}/sensor/ch8 nxsave true + hsetprop ${scobj_hpath}/sensor/ch8 oldval 0.0 + hsetprop ${scobj_hpath}/sensor/ch8 klass "parameter" + hsetprop ${scobj_hpath}/sensor/ch8 sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/sensor/ch8 type "part" + hsetprop ${scobj_hpath}/sensor/ch8 nxalias "${name}_sensor_ch8" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor/ch8 15 + hsetprop ${scobj_hpath}/sensor/ch8 simulated false + } else { + ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" + hsetprop ${scobj_hpath}/sensor/ch8 simulated true + } + } hsetprop ${scobj_hpath}/sensor data "true" hsetprop ${scobj_hpath}/sensor klass "@none" hsetprop ${scobj_hpath}/sensor type "part" - - hfactory ${scobj_hpath}/sensor/ch1 plain user float - hsetprop ${scobj_hpath}/sensor/ch1 read ${ns}::getTemp ${scobj_hpath} rdValue {0} - hsetprop ${scobj_hpath}/sensor/ch1 rdValue ${ns}::rdValue ${scobj_hpath} - hsetprop ${scobj_hpath}/sensor/ch1 control true - hsetprop ${scobj_hpath}/sensor/ch1 data true - hsetprop ${scobj_hpath}/sensor/ch1 mutable true - hsetprop ${scobj_hpath}/sensor/ch1 nxsave true - hsetprop ${scobj_hpath}/sensor/ch1 oldval 0.0 - hsetprop ${scobj_hpath}/sensor/ch1 klass "parameter" - hsetprop ${scobj_hpath}/sensor/ch1 sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/sensor/ch1 type "part" - hsetprop ${scobj_hpath}/sensor/ch1 nxalias "${name}_sensor_ch1" - - hfactory ${scobj_hpath}/sensor/ch2 plain user float - hsetprop ${scobj_hpath}/sensor/ch2 read ${ns}::getTemp ${scobj_hpath} rdValue {1} - hsetprop ${scobj_hpath}/sensor/ch2 rdValue ${ns}::rdValue ${scobj_hpath} - hsetprop ${scobj_hpath}/sensor/ch2 control true - hsetprop ${scobj_hpath}/sensor/ch2 data true - hsetprop ${scobj_hpath}/sensor/ch2 mutable true - hsetprop ${scobj_hpath}/sensor/ch2 nxsave true - hsetprop ${scobj_hpath}/sensor/ch2 oldval 0.0 - hsetprop ${scobj_hpath}/sensor/ch2 klass "parameter" - hsetprop ${scobj_hpath}/sensor/ch2 sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/sensor/ch2 type "part" - hsetprop ${scobj_hpath}/sensor/ch2 nxalias "${name}_sensor_ch2" - - hfactory ${scobj_hpath}/sensor/ch3 plain user float - hsetprop ${scobj_hpath}/sensor/ch3 read ${ns}::getTemp ${scobj_hpath} rdValue {2} - hsetprop ${scobj_hpath}/sensor/ch3 rdValue ${ns}::rdValue ${scobj_hpath} - hsetprop ${scobj_hpath}/sensor/ch3 control true - hsetprop ${scobj_hpath}/sensor/ch3 data true - hsetprop ${scobj_hpath}/sensor/ch3 mutable true - hsetprop ${scobj_hpath}/sensor/ch3 nxsave true - hsetprop ${scobj_hpath}/sensor/ch3 oldval 0.0 - hsetprop ${scobj_hpath}/sensor/ch3 klass "parameter" - hsetprop ${scobj_hpath}/sensor/ch3 sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/sensor/ch3 type "part" - hsetprop ${scobj_hpath}/sensor/ch3 nxalias "${name}_sensor_ch3" - - hfactory ${scobj_hpath}/sensor/ch4 plain user float - hsetprop ${scobj_hpath}/sensor/ch4 read ${ns}::getTemp ${scobj_hpath} rdValue {3} - hsetprop ${scobj_hpath}/sensor/ch4 rdValue ${ns}::rdValue ${scobj_hpath} - hsetprop ${scobj_hpath}/sensor/ch4 control true - hsetprop ${scobj_hpath}/sensor/ch4 data true - hsetprop ${scobj_hpath}/sensor/ch4 mutable true - hsetprop ${scobj_hpath}/sensor/ch4 nxsave true - hsetprop ${scobj_hpath}/sensor/ch4 oldval 0.0 - hsetprop ${scobj_hpath}/sensor/ch4 klass "parameter" - hsetprop ${scobj_hpath}/sensor/ch4 sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/sensor/ch4 type "part" - hsetprop ${scobj_hpath}/sensor/ch4 nxalias "${name}_sensor_ch4" - - hfactory ${scobj_hpath}/sensor/ch5 plain user float - hsetprop ${scobj_hpath}/sensor/ch5 read ${ns}::getTemp ${scobj_hpath} rdValue {4} - hsetprop ${scobj_hpath}/sensor/ch5 rdValue ${ns}::rdValue ${scobj_hpath} - hsetprop ${scobj_hpath}/sensor/ch5 control true - hsetprop ${scobj_hpath}/sensor/ch5 data true - hsetprop ${scobj_hpath}/sensor/ch5 mutable true - hsetprop ${scobj_hpath}/sensor/ch5 nxsave true - hsetprop ${scobj_hpath}/sensor/ch5 oldval 0.0 - hsetprop ${scobj_hpath}/sensor/ch5 klass "parameter" - hsetprop ${scobj_hpath}/sensor/ch5 sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/sensor/ch5 type "part" - hsetprop ${scobj_hpath}/sensor/ch5 nxalias "${name}_sensor_ch5" - - hfactory ${scobj_hpath}/sensor/ch6 plain user float - hsetprop ${scobj_hpath}/sensor/ch6 read ${ns}::getTemp ${scobj_hpath} rdValue {5} - hsetprop ${scobj_hpath}/sensor/ch6 rdValue ${ns}::rdValue ${scobj_hpath} - hsetprop ${scobj_hpath}/sensor/ch6 control true - hsetprop ${scobj_hpath}/sensor/ch6 data true - hsetprop ${scobj_hpath}/sensor/ch6 mutable true - hsetprop ${scobj_hpath}/sensor/ch6 nxsave true - hsetprop ${scobj_hpath}/sensor/ch6 oldval 0.0 - hsetprop ${scobj_hpath}/sensor/ch6 klass "parameter" - hsetprop ${scobj_hpath}/sensor/ch6 sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/sensor/ch6 type "part" - hsetprop ${scobj_hpath}/sensor/ch6 nxalias "${name}_sensor_ch6" - - hfactory ${scobj_hpath}/sensor/ch7 plain user float - hsetprop ${scobj_hpath}/sensor/ch7 read ${ns}::getTemp ${scobj_hpath} rdValue {6} - hsetprop ${scobj_hpath}/sensor/ch7 rdValue ${ns}::rdValue ${scobj_hpath} - hsetprop ${scobj_hpath}/sensor/ch7 control true - hsetprop ${scobj_hpath}/sensor/ch7 data true - hsetprop ${scobj_hpath}/sensor/ch7 mutable true - hsetprop ${scobj_hpath}/sensor/ch7 nxsave true - hsetprop ${scobj_hpath}/sensor/ch7 oldval 0.0 - hsetprop ${scobj_hpath}/sensor/ch7 klass "parameter" - hsetprop ${scobj_hpath}/sensor/ch7 sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/sensor/ch7 type "part" - hsetprop ${scobj_hpath}/sensor/ch7 nxalias "${name}_sensor_ch7" - - hfactory ${scobj_hpath}/sensor/ch8 plain user float - hsetprop ${scobj_hpath}/sensor/ch8 read ${ns}::getTemp ${scobj_hpath} rdValue {7} - hsetprop ${scobj_hpath}/sensor/ch8 rdValue ${ns}::rdValue ${scobj_hpath} - hsetprop ${scobj_hpath}/sensor/ch8 control true - hsetprop ${scobj_hpath}/sensor/ch8 data true - hsetprop ${scobj_hpath}/sensor/ch8 mutable true - hsetprop ${scobj_hpath}/sensor/ch8 nxsave true - hsetprop ${scobj_hpath}/sensor/ch8 oldval 0.0 - hsetprop ${scobj_hpath}/sensor/ch8 klass "parameter" - hsetprop ${scobj_hpath}/sensor/ch8 sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/sensor/ch8 type "part" - hsetprop ${scobj_hpath}/sensor/ch8 nxalias "${name}_sensor_ch8" - - if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/sensor/ch1 1 - ${sct_controller} poll ${scobj_hpath}/sensor/ch2 1 - ${sct_controller} poll ${scobj_hpath}/sensor/ch3 1 - ${sct_controller} poll ${scobj_hpath}/sensor/ch4 1 - ${sct_controller} poll ${scobj_hpath}/sensor/ch5 1 - ${sct_controller} poll ${scobj_hpath}/sensor/ch6 1 - ${sct_controller} poll ${scobj_hpath}/sensor/ch7 1 - ${sct_controller} poll ${scobj_hpath}/sensor/ch8 1 - } else { - ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" - } hsetprop ${scobj_hpath} klass ${device_class} hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} debug_threshold 5 @@ -323,7 +429,7 @@ proc ::scobj::lakeshore_218::mkDriver { sct_controller name device_class simulat proc ::scobj::lakeshore_218::add_driver {name device_class simulation_flag ip_address tcp_port} { set catch_status [ catch { - ::scobj::lakeshore_218::sics_log 9 "::scobj::lakeshore_218::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}" + ::scobj::lakeshore_218::sics_log 9 "::scobj::lakeshore_218::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${num_chans}" if {[string equal -nocase "${simulation_flag}" "false"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} { ::scobj::lakeshore_218::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" @@ -333,10 +439,12 @@ proc ::scobj::lakeshore_218::add_driver {name device_class simulation_flag ip_ad makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::lakeshore_218::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for lakeshore_218" + ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for lakeshore_218" + ::scobj::lakeshore_218::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } - ::scobj::lakeshore_218::sics_log 1 "::scobj::lakeshore_218::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}" - ::scobj::lakeshore_218::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} + ::scobj::lakeshore_218::sics_log 1 "::scobj::lakeshore_218::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${num_chans}" + ::scobj::lakeshore_218::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${num_chans} } catch_message ] handle_exception ${catch_status} ${catch_message} } @@ -351,7 +459,7 @@ namespace eval ::scobj::lakeshore_218 { proc add_lakeshore_218 {name ip_address tcp_port} { set simulation_flag "[string tolower [SplitReply [detector_simulation]]]" - ::scobj::lakeshore_218::add_driver ${name} "NXdetector" "${simulation_flag}" ${ip_address} ${tcp_port} + ::scobj::lakeshore_218::add_driver ${name} "NXdetector" ${simulation_flag} ${ip_address} ${tcp_port} } clientput "file evaluation of sct_lakeshore_218.tcl" @@ -390,20 +498,31 @@ proc ::scobj::lakeshore_218::read_config {} { if { ![string equal -nocase "${simulation_flag}" "false"] } { set asyncqueue "null" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue" + ${ns}::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } elseif { [dict exists $v "asyncqueue"] } { set asyncqueue [dict get $v "asyncqueue"] if { [string equal -nocase ${asyncqueue} "sct"] } { set ip_address [dict get $v ip] set tcp_port [dict get $v port] - } + makesctcontroller sct_${name} std ${ip_address}:${tcp_port} + } else { + makesctcontroller sct_${name} aqadapter ${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"] } { + if { [dict exists $v "sendterminator"] } { + ${asyncprotocol} sendterminator "[dict get $v "sendterminator"]" + } elseif { [dict exists $v "terminator"] } { ${asyncprotocol} sendterminator "[dict get $v "terminator"]" + } + if { [dict exists $v "replyterminator"] } { + ${asyncprotocol} replyterminator "[dict get $v "replyterminator"]" + } elseif { [dict exists $v "terminator"] } { ${asyncprotocol} replyterminator "[dict get $v "terminator"]" } } @@ -414,12 +533,28 @@ proc ::scobj::lakeshore_218::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } - if { [string equal -nocase ${asyncqueue} "sct"] } { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} + set arg_list [list] + set missing_list [list] + array unset default_map + array set default_map [list num_chans 8] + foreach arg {num_chans} { + if {[dict exists $u $arg]} { + lappend arg_list "[dict get $u $arg]" + } elseif {[dict exists $v $arg]} { + lappend arg_list "[dict get $v $arg]" + } elseif {[info exists default_map($arg)]} { + lappend arg_list $default_map($arg) + } else { + ${ns}::sics_log 9 "Missing configuration value $arg" + lappend missing_list $arg + } } + if { [llength $missing_list] > 0 } { + error "$name is missing configuration values $missing_list" + } + ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list } } } diff --git a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl index 74233b4a..6fe63945 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl @@ -50,7 +50,7 @@ namespace eval ::scobj::[set vendor]_[set device] { proc debug_log {debug_level arg_string} { # write a timestamped string message to a log file for debugging - set debug_threshold 0 + set debug_threshold 5 if {$debug_level >= $debug_threshold} { set fd [open "[set [namespace current]::log_file]" "a"] set line "[clock format [clock seconds] -format "%T"] $arg_string" diff --git a/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl b/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl index 22ebad6b..67266192 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl @@ -58,7 +58,7 @@ namespace eval ::scobj::[set vendor]_[set device] { proc debug_log {debug_level arg_string} { # write a timestamped string message to a log file for debugging - set debug_threshold 0 + set debug_threshold 5 if {$debug_level >= $debug_threshold} { set fd [open "[set [namespace current]::log_file]" "a"] set line "[clock format [clock seconds] -format "%T"] $arg_string" diff --git a/site_ansto/instrument/pelican/config/motors/motor_configuration.tcl b/site_ansto/instrument/pelican/config/motors/motor_configuration.tcl index 6e3fd7c6..a330b820 100644 --- a/site_ansto/instrument/pelican/config/motors/motor_configuration.tcl +++ b/site_ansto/instrument/pelican/config/motors/motor_configuration.tcl @@ -910,7 +910,7 @@ proc get_vei {} { proc set_vwi {wavelength} { set dd 3.35416 set theta [expr (180.0 / 3.141592654) * asin($wavelength / (2.0 * $dd))] - set result [format "moma=%f,momb=%f,momc=%f,mtth=%f" $theta $theta $theta [expr 2.0 * $theta]] + set result [format "moma=%f,momb=%f,momc=%f,mtth=%f" -$theta -$theta -$theta [expr 2.0 * $theta]] return $result } @@ -930,10 +930,15 @@ vwi drivescript set_vwi sicslist setatt vwi units Angstrom sicslist setatt vwi klass crystal sicslist setatt vwi long_name wavelength +sicslist setatt vwi hdbchain mtth MakeConfigurableMotor vei vei readscript get_vei vei drivescript set_vei +sicslist setatt vei units mEv +sicslist setatt vei klass crystal +sicslist setatt vei long_name energy +sicslist setatt vei hdbchain mtth publish get_vwi user publish set_vwi user diff --git a/site_ansto/instrument/pelican/pelican_configuration.tcl b/site_ansto/instrument/pelican/pelican_configuration.tcl index 2598608d..c1efa4c3 100644 --- a/site_ansto/instrument/pelican/pelican_configuration.tcl +++ b/site_ansto/instrument/pelican/pelican_configuration.tcl @@ -117,3 +117,8 @@ server_init # WARNING: Do not add any code below server_init, if you do SICS may fail to initialise properly. # You can add extra-configuration code in ../extraconfig.tcl +# Update chopper speed and phase if a stop or idle command is issued. +sicspoll add /instrument/fermi_chopper/mchs hdb 5 +sicspoll add /instrument/fermi_chopper/mchp hdb 5 +sicspoll add /instrument/fermi_chopper/schs hdb 5 +sicspoll add /instrument/fermi_chopper/schp hdb 5 From da2383f5ce7d33b16d0a4bbaac38fc8b63e0442b Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 19 Feb 2015 11:30:48 +1100 Subject: [PATCH 18/22] Pullback from Platypus 2015-02-19 --- .../config/environment/sct_knauer_pump.tcl | 4 +- .../config/environment/sct_omron_hldc.tcl | 62 +++++++++++++------ .../temperature/sct_lakeshore_370.tcl | 2 +- .../environment/temperature/sct_ls340.tcl | 2 +- .../temperature/sct_oxford_mercury.tcl | 2 +- .../reflectometer/config/hmm/detector.tcl | 4 ++ .../reflectometer/platypus_configuration.tcl | 2 + .../reflectometer/sics_simulation.tcl | 2 +- 8 files changed, 55 insertions(+), 25 deletions(-) diff --git a/site_ansto/instrument/config/environment/sct_knauer_pump.tcl b/site_ansto/instrument/config/environment/sct_knauer_pump.tcl index 1f269659..bc80d54a 100644 --- a/site_ansto/instrument/config/environment/sct_knauer_pump.tcl +++ b/site_ansto/instrument/config/environment/sct_knauer_pump.tcl @@ -3,7 +3,7 @@ # namespace eval ::scobj::knauer_pump { - set debug_threshold 0 + set debug_threshold 5 } proc ::scobj::knauer_pump::debug_log {tc_root debug_level debug_string} { @@ -1115,7 +1115,7 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio } hsetprop ${scobj_hpath} klass ${device_class} hsetprop ${scobj_hpath} data true - hsetprop ${scobj_hpath} debug_threshold 0 + hsetprop ${scobj_hpath} debug_threshold 5 if {[string equal -nocase "${simulation_flag}" "false"]} { ansto_makesctdrive ${name}_pump_volume_setp ${scobj_hpath}/pump/volume/setp ${scobj_hpath}/pump/volume/pval ${sct_controller} } diff --git a/site_ansto/instrument/config/environment/sct_omron_hldc.tcl b/site_ansto/instrument/config/environment/sct_omron_hldc.tcl index d78fffb3..6c51a2bb 100644 --- a/site_ansto/instrument/config/environment/sct_omron_hldc.tcl +++ b/site_ansto/instrument/config/environment/sct_omron_hldc.tcl @@ -10,9 +10,12 @@ proc ::scobj::omron_hldc::debug_log {tc_root debug_level debug_string} { set catch_status [ catch { set debug_threshold [hgetpropval ${tc_root} debug_threshold] if {${debug_level} >= ${debug_threshold}} { - set fd [open "../log/omron_hldc_[basename ${tc_root}].log" "a"] - set line "[clock format [clock seconds] -format "%T"] ${debug_string}" - puts ${fd} "${line}" + set now [clock seconds] + set ts [clock format ${now} -format "%Y%m%d"] + set log_file_name "../log/omron_hldc_[basename ${tc_root}]_${ts}.log" + set fd [open "${log_file_name}" "a"] + set ts [clock format ${now} -format "%T"] + puts ${fd} "${ts} ${debug_string}" close ${fd} } } catch_message ] @@ -197,6 +200,7 @@ proc ::scobj::omron_hldc::mkDriver { sct_controller name device_class simulation MakeSICSObj ${name} SCT_OBJECT + sicslist setatt ${name} driver omron_hldc sicslist setatt ${name} klass ${device_class} sicslist setatt ${name} long_name ${name} @@ -215,6 +219,14 @@ proc ::scobj::omron_hldc::mkDriver { sct_controller name device_class simulation hsetprop ${scobj_hpath}/distance type "part" hsetprop ${scobj_hpath}/distance nxalias "${name}_distance" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/distance 1 + hsetprop ${scobj_hpath}/distance simulated false + } else { + ::scobj::omron_hldc::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for omron_hldc" + hsetprop ${scobj_hpath}/distance simulated true + } + hfactory ${scobj_hpath}/id plain user text hsetprop ${scobj_hpath}/id read ${ns}::getValue ${scobj_hpath} read_id {0501} hsetprop ${scobj_hpath}/id read_id ${ns}::read_id ${scobj_hpath} @@ -228,16 +240,18 @@ proc ::scobj::omron_hldc::mkDriver { sct_controller name device_class simulation hsetprop ${scobj_hpath}/id type "part" hsetprop ${scobj_hpath}/id nxalias "${name}_id" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/id 10 + hsetprop ${scobj_hpath}/id simulated false + } else { + ::scobj::omron_hldc::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for omron_hldc" + hsetprop ${scobj_hpath}/id simulated true + } + hsetprop ${scobj_hpath} data "true" hsetprop ${scobj_hpath} klass "@none" hsetprop ${scobj_hpath} type "part" - - if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/distance 1 - ${sct_controller} poll ${scobj_hpath}/id 10 - } else { - ::scobj::omron_hldc::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for omron_hldc" - } + hsetprop ${scobj_hpath} driver omron_hldc hsetprop ${scobj_hpath} klass ${device_class} hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} debug_threshold 5 @@ -258,7 +272,9 @@ proc ::scobj::omron_hldc::add_driver {name device_class simulation_flag ip_addre makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::omron_hldc::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for omron_hldc" + ::scobj::omron_hldc::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for omron_hldc" + ::scobj::omron_hldc::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::omron_hldc::sics_log 1 "::scobj::omron_hldc::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}" ::scobj::omron_hldc::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} @@ -276,7 +292,7 @@ namespace eval ::scobj::omron_hldc { proc add_omron_hldc {name ip_address tcp_port} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::omron_hldc::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} + ::scobj::omron_hldc::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} } clientput "file evaluation of sct_omron_hldc.tcl" @@ -315,20 +331,31 @@ proc ::scobj::omron_hldc::read_config {} { if { ![string equal -nocase "${simulation_flag}" "false"] } { set asyncqueue "null" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue" + ${ns}::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } elseif { [dict exists $v "asyncqueue"] } { set asyncqueue [dict get $v "asyncqueue"] if { [string equal -nocase ${asyncqueue} "sct"] } { set ip_address [dict get $v ip] set tcp_port [dict get $v port] - } + makesctcontroller sct_${name} std ${ip_address}:${tcp_port} + } else { + makesctcontroller sct_${name} aqadapter ${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"] } { + if { [dict exists $v "sendterminator"] } { + ${asyncprotocol} sendterminator "[dict get $v "sendterminator"]" + } elseif { [dict exists $v "terminator"] } { ${asyncprotocol} sendterminator "[dict get $v "terminator"]" + } + if { [dict exists $v "replyterminator"] } { + ${asyncprotocol} replyterminator "[dict get $v "replyterminator"]" + } elseif { [dict exists $v "terminator"] } { ${asyncprotocol} replyterminator "[dict get $v "terminator"]" } } @@ -339,12 +366,9 @@ proc ::scobj::omron_hldc::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } - if { [string equal -nocase ${asyncqueue} "sct"] } { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} - } + ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} } } } diff --git a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl index 74233b4a..6fe63945 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl @@ -50,7 +50,7 @@ namespace eval ::scobj::[set vendor]_[set device] { proc debug_log {debug_level arg_string} { # write a timestamped string message to a log file for debugging - set debug_threshold 0 + set debug_threshold 5 if {$debug_level >= $debug_threshold} { set fd [open "[set [namespace current]::log_file]" "a"] set line "[clock format [clock seconds] -format "%T"] $arg_string" diff --git a/site_ansto/instrument/config/environment/temperature/sct_ls340.tcl b/site_ansto/instrument/config/environment/temperature/sct_ls340.tcl index f607f937..4cd951b9 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_ls340.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_ls340.tcl @@ -57,7 +57,7 @@ proc ::scobj::ls340::add_driver {name device_class simulation_flag ip_address tc makesctcontroller sct_${name} aqadapter ${tcp_port} } else { ::scobj::ls340::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}" - makesctcontroller sct_${name} std ${ip_address}:${tcp_port} + makesctcontroller sct_${name} std ${ip_address}:${tcp_port} \r\n } } else { ::scobj::ls340::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for ls340" diff --git a/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl b/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl index 22ebad6b..67266192 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl @@ -58,7 +58,7 @@ namespace eval ::scobj::[set vendor]_[set device] { proc debug_log {debug_level arg_string} { # write a timestamped string message to a log file for debugging - set debug_threshold 0 + set debug_threshold 5 if {$debug_level >= $debug_threshold} { set fd [open "[set [namespace current]::log_file]" "a"] set line "[clock format [clock seconds] -format "%T"] $arg_string" diff --git a/site_ansto/instrument/reflectometer/config/hmm/detector.tcl b/site_ansto/instrument/reflectometer/config/hmm/detector.tcl index d9d29c41..0938a1ab 100644 --- a/site_ansto/instrument/reflectometer/config/hmm/detector.tcl +++ b/site_ansto/instrument/reflectometer/config/hmm/detector.tcl @@ -14,10 +14,14 @@ evfactory new dhv1 nhq200 acq 1 dhv1 tolerance 5 dhv1 rate 25 dhv1 upper 3000 +dhv1 max 3000 +dhv1 upperlimit 3000 #dhv1 lock evfactory new dhv2 nhq200 acq 2 dhv2 tolerance 5 dhv2 rate 25 dhv2 upper 1500 +dhv1 max 1500 +dhv1 upperlimit 1500 #dhv2 lock } diff --git a/site_ansto/instrument/reflectometer/platypus_configuration.tcl b/site_ansto/instrument/reflectometer/platypus_configuration.tcl index 5234f5e1..7cefb18d 100644 --- a/site_ansto/instrument/reflectometer/platypus_configuration.tcl +++ b/site_ansto/instrument/reflectometer/platypus_configuration.tcl @@ -33,6 +33,7 @@ fileeval $cfPath(environment)/sct_mvp_valve.tcl fileeval $cfPath(environment)/sct_protek_common.tcl fileeval $cfPath(environment)/sct_protekmm.tcl fileeval $cfPath(environment)/sct_omron_hldc.tcl +fileeval $cfPath(environment)/sct_keysight_N8740A.tcl fileeval $cfPath(environment)/magneticField/sct_bruker_BEC1.tcl fileeval $cfPath(environment)/magneticField/sct_bruker.tcl fileeval $cfPath(environment)/temperature/sct_lakeshore_336.tcl @@ -48,6 +49,7 @@ fileeval $cfPath(chopper)/chopper.tcl fileeval $cfPath(commands)/commands.tcl fileeval $cfPath(anticollider)/anticollider.tcl fileeval $cfPath(beamline)/polanal.tcl +fileeval $cfPath(beamline)/he3_polanal_sct.tcl fileeval $cfPath(commands)/pulser.tcl fileeval $cfPath(commands)/hvcommands.tcl diff --git a/site_ansto/instrument/reflectometer/sics_simulation.tcl b/site_ansto/instrument/reflectometer/sics_simulation.tcl index e940d6ae..94913622 100644 --- a/site_ansto/instrument/reflectometer/sics_simulation.tcl +++ b/site_ansto/instrument/reflectometer/sics_simulation.tcl @@ -4,7 +4,7 @@ # icsval column = settings when running on the Instrument Control Server (ie SICS_SIMULATION not defined) # fakedev column = settings for test platforms (ie SICS_SIMULATION=fakedev) foreach {simflag icsval fakedev} { - opal_simulation true true + opal_simulation false true detector_simulation false true hmm_simulation false true environment_simulation false true From 31420ab850e786933ebe7edd10c8271ae19c33c5 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 19 Feb 2015 11:43:50 +1100 Subject: [PATCH 19/22] Pullback from Echidna 2015-02-19 --- .../config/counter/counter_common_1.tcl | 1 - .../config/environment/sct_knauer_pump.tcl | 4 +- .../temperature/sct_lakeshore_370.tcl | 2 +- .../temperature/sct_oxford_mercury.tcl | 2996 ++++++++++++----- .../environment/temperature/sct_west_6100.tcl | 109 +- .../environment/temperature/west400.tcl | 8 +- .../config/hmm/hmm_configuration_common_1.tcl | 4 +- .../config/motors/sct_positmotor_common.tcl | 2 +- .../config/motors/motor_configuration.tcl | 3 +- .../instrument/hrpd/echidna_configuration.tcl | 8 +- 10 files changed, 2238 insertions(+), 899 deletions(-) diff --git a/site_ansto/instrument/config/counter/counter_common_1.tcl b/site_ansto/instrument/config/counter/counter_common_1.tcl index 1a16dd32..9ad2782c 100644 --- a/site_ansto/instrument/config/counter/counter_common_1.tcl +++ b/site_ansto/instrument/config/counter/counter_common_1.tcl @@ -7,7 +7,6 @@ namespace eval counter { proc ::counter::transferscript {} { variable isc_numchannels - bm status set val [SplitReply [bm1 gettime]] for {set i 1} {$i <= $isc_numchannels} {incr i} { append val " [SplitReply [bm$i getcounts] ]" diff --git a/site_ansto/instrument/config/environment/sct_knauer_pump.tcl b/site_ansto/instrument/config/environment/sct_knauer_pump.tcl index d58d4bf4..9af43fa2 100644 --- a/site_ansto/instrument/config/environment/sct_knauer_pump.tcl +++ b/site_ansto/instrument/config/environment/sct_knauer_pump.tcl @@ -3,7 +3,7 @@ # namespace eval ::scobj::knauer_pump { - set debug_threshold 0 + set debug_threshold 5 } proc ::scobj::knauer_pump::debug_log {tc_root debug_level debug_string} { @@ -1755,7 +1755,7 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio } hsetprop ${scobj_hpath} klass ${device_class} hsetprop ${scobj_hpath} data true - hsetprop ${scobj_hpath} debug_threshold 0 + hsetprop ${scobj_hpath} debug_threshold 5 if {[string equal -nocase "${simulation_flag}" "false"]} { ansto_makesctdrive ${name}_pump_volume_sp ${scobj_hpath}/pump/volume_sp ${scobj_hpath}/pump/volume_pv ${sct_controller} } diff --git a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl index 74233b4a..6fe63945 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl @@ -50,7 +50,7 @@ namespace eval ::scobj::[set vendor]_[set device] { proc debug_log {debug_level arg_string} { # write a timestamped string message to a log file for debugging - set debug_threshold 0 + set debug_threshold 5 if {$debug_level >= $debug_threshold} { set fd [open "[set [namespace current]::log_file]" "a"] set line "[clock format [clock seconds] -format "%T"] $arg_string" diff --git a/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl b/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl index 22ebad6b..4b0651f9 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl @@ -1,891 +1,2143 @@ -# vim: ts=8 sw=2 sta sts=2 et ai si -# This is a template driver for a mercury temperaure controller from Oxford Instruments +# Generated driver for oxford_mercury +# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent # -# Author: Douglas Clowes -# Date: August 2012 -# -if { "[lindex [split [info nameofexecutable] "/"] end]" == "tclsh"} { -# This block is to suppress spurious error/warning messages when loaded in Nagelfar - set catch_status [ catch { - puts "TCLSH" - proc environment_simulation {} { return "" } - proc SplitReply {str} { return "" } - proc makesctcontroller {args} { } - proc MakeSICSObj {args} { } - proc sicslist {args} { } - proc hfactory {args} { } - proc hdelprop {args} { } - proc hsetprop {args} { } - proc hgetprop {args} { } - proc hpropexists {args} { } - proc hlistprop {args} { } - proc hset {args} { } - proc hget {args} { } - proc hval {args} { } - proc hinfo {args} { } - proc hlist {args} { } - proc sct {args} { } - proc debug_log {args} { } - proc pathname {args} { } - proc basename {args} { } - proc channel {args} { } - proc ns {args} { } - } catch_message ] - if {$catch_status != 0} { - puts "error in main $catch_message" - return -code error "in main $catch_message" - } + +namespace eval ::scobj::oxford_mercury { + set debug_threshold 5 +# preamble hook code starts + proc make_config {sct_controller} { + set syscat [${sct_controller} transact READ:SYS:CAT] + set result "" + set devs [regexp -inline -all {DEV:[DM][[:alnum:]\.]*:[[:alnum:]]*} ${syscat}] + foreach dev [lsort ${devs}] { + set typ [string index [lindex [split ${dev} :] end] 0] + set typ [string map {A V} ${typ}] + clientput "${dev} ${typ}" + set result "${result}${typ}" + } + clientput "Result: ${result}" + return ${result} + } + proc read_all {sct_controller} { + set syscat [${sct_controller} transact READ:SYS:CAT] + set devs [regexp -inline -all {DEV:[DM][[:alnum:]\.]*:[[:alnum:]]*} ${syscat}] + foreach dev [lsort ${devs}] { + set response [${sct_controller} transact READ:${dev}] + clientput "Device: ${response}" + } + } + proc read_loop {sct_controller} { + set pat {\m[A-Z]{1,}:[^:]{1,}} + set syscat [${sct_controller} transact READ:SYS:CAT] + set devs [regexp -inline -all {DEV:[DM][[:alnum:]\.]*:[[:alnum:]]*} ${syscat}] + foreach dev [lsort ${devs}] { + set response [${sct_controller} transact READ:${dev}:LOOP] + clientput "Device: ${response}" + clientput " Loop: [regexp -inline -all $pat [string trim ${response}]]" + } + } + proc read_sig {sct_controller} { + set pat {\m[A-Z]{1,}:[^:]{1,}} + set syscat [${sct_controller} transact READ:SYS:CAT] + set devs [regexp -inline -all {DEV:[DM][[:alnum:]\.]*:[[:alnum:]]*} ${syscat}] + foreach dev [lsort ${devs}] { + set response [${sct_controller} transact READ:${dev}:SIG] + clientput "Device: ${response}" + clientput " Sig: [regexp -inline -all $pat [string trim ${response}]]" + } + } +# preamble hook code ends } -set vendor "oxford" -set device "mercury" - -namespace eval ::scobj::[set vendor]_[set device] { - proc ns {} { - return "[namespace current]" - } - # All of this takes place in a namespace based on the vendor and device - # Debug prints and vendor/device save - 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]" - 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 - set debug_threshold 0 - if {$debug_level >= $debug_threshold} { - set fd [open "[set [namespace current]::log_file]" "a"] - set line "[clock format [clock seconds] -format "%T"] $arg_string" - puts $fd "$line" - close $fd +proc ::scobj::oxford_mercury::debug_log {tc_root debug_level debug_string} { + set catch_status [ catch { + set debug_threshold [hgetpropval ${tc_root} debug_threshold] + if {${debug_level} >= ${debug_threshold}} { + set now [clock seconds] + set ts [clock format ${now} -format "%Y%m%d"] + set log_file_name "../log/oxford_mercury_[basename ${tc_root}]_${ts}.log" + set fd [open "${log_file_name}" "a"] + set ts [clock format ${now} -format "%T"] + puts ${fd} "${ts} ${debug_string}" + close ${fd} } - } + } catch_message ] +} - proc channel {arg} { - # strip the trailing digits from the arg and return them as a string - set result 0 - for { set i 0 } { $i < [string length $arg] } { incr i } { - if { ! [string match {[0-9]} [string index $arg end-$i]] } { - break +proc ::scobj::oxford_mercury::sics_log {debug_level debug_string} { + set catch_status [ catch { + set debug_threshold ${::scobj::oxford_mercury::debug_threshold} + if {${debug_level} >= ${debug_threshold}} { + sicslog "::scobj::oxford_mercury::${debug_string}" + } + } catch_message ] +} + +# checklimits function for driveable interface +proc ::scobj::oxford_mercury::checklimits {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "checklimits tc_root=${tc_root} sct=[sct] target=[sct target]" + set setpoint [sct target] + if { [hpropexists [sct] lowerlimit] } { + set lolimit [sct lowerlimit] + } else { + # lowerlimit not set, use target + set lolimit [sct target] + } + if { [hpropexists [sct] upperlimit] } { + set hilimit [sct upperlimit] + } else { + # upperlimit not set, use target + set hilimit [sct target] + } +# checklimits hook code goes here + if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } { + sct driving 0 + error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]" + } + return OK + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# check function for hset change +proc ::scobj::oxford_mercury::checkrange {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "checkrange tc_root=${tc_root} sct=[sct] target=[sct target]" + set setpoint [sct target] + if { [hpropexists [sct] lowerlimit] } { + set lolimit [sct lowerlimit] + } else { + # lowerlimit not set, use target + set lolimit [sct target] + } + if { [hpropexists [sct] upperlimit] } { + set hilimit [sct upperlimit] + } else { + # upperlimit not set, use target + set hilimit [sct target] + } +# checkrange hook code goes here + if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } { + error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]" + } + return OK + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# checkstatus function for driveable interface +proc ::scobj::oxford_mercury::checkstatus {tc_root} { + set catch_status [ catch { +# checkstatus hook code goes here + if {[sct driving]} { + set sp "[sct target]" + if {[hpropexists [sct] simulated] && [sct simulated] == "true"} { + set pv "${sp}" + hupdateif ${tc_root}/[sct driveable] ${sp} + } else { + set pv "[hval ${tc_root}/[sct driveable]]" } - set result [string range "$arg" end-$i end] + if { abs(${pv} - ${sp}) <= [sct tolerance] } { + if { [hpropexists [sct] settle_time] } { + if { [hpropexists [sct] settle_time_start] } { + if { [sct utime] - [sct settle_time_start] >= [sct settle_time]} { + sct driving 0 + return "idle" + } + return "busy" + } else { + sct utime settle_time_start + return "busy" + } + } + sct driving 0 + return "idle" + } + if { [hpropexists [sct] settle_time_start] } { + hdelprop [sct] settle_time_start + } + return "busy" + } else { + return "idle" } - debug_log 1 "Extract channel $result from argument $arg" - return $result - } + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} - proc setPoint {tc_root nextState cmd} { - # send a command to set a value - debug_log 1 "setPoint tc_root=$tc_root sct=[sct] $cmd [sct target]" +# function to request the read of a parameter on a device +proc ::scobj::oxford_mercury::getValue {tc_root nextState cmd_str} { + set catch_status [ catch { + debug_log ${tc_root} 1 "getValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set cmd "${cmd_str}" +# getValue hook code goes here + debug_log ${tc_root} 1 "getValue sct send ${cmd}" + if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { + sct send "${cmd}" + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# halt function for driveable interface +proc ::scobj::oxford_mercury::halt {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "halt tc_root=${tc_root} sct=[sct] driving=[sct driving]" + ### TODO hset [sct] [hval [sct]] +# halt hook code goes here + sct driving 0 + return "idle" + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to check the write parameter on a device +proc ::scobj::oxford_mercury::noResponse {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "noResponse tc_root=${tc_root} sct=[sct] resp=[sct result]" +# noResponse hook code goes here + return "idle" + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to parse the read of a parameter on a device +proc ::scobj::oxford_mercury::rdOnOff {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "rdOnOff tc_root=${tc_root} sct=[sct] result=[sct result]" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set data [sct result] + set nextState "idle" + if {[string equal -nocase -length 7 ${data} "ASCERR:"]} { + # the protocol driver has reported an error + sct geterror "${data}" + error "[sct geterror]" + } +# rdOnOff hook code starts + scan [lindex [split "$data" ":"] end] "%s" data + if {[string equal -nocase ${data} "ON"]} { + set data 1 + } else { + set data 0 + } +# rdOnOff hook code ends + if { [hpropexists [sct] geterror] } { + debug_log ${tc_root} 9 "[sct] error: [sct geterror]" + error "[sct geterror]" + } + if { ${data} != [sct oldval] } { + debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]" + sct oldval ${data} + sct update ${data} + sct utime readtime + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to parse the read of a parameter on a device +proc ::scobj::oxford_mercury::rdText {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "rdText tc_root=${tc_root} sct=[sct] result=[sct result]" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set data [sct result] + set nextState "idle" + if {[string equal -nocase -length 7 ${data} "ASCERR:"]} { + # the protocol driver has reported an error + sct geterror "${data}" + error "[sct geterror]" + } +# rdText hook code starts + scan [lindex [split "$data" ":"] end] "%s" data +# rdText hook code ends + if { [hpropexists [sct] geterror] } { + debug_log ${tc_root} 9 "[sct] error: [sct geterror]" + error "[sct geterror]" + } + if { ${data} != [sct oldval] } { + debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]" + sct oldval ${data} + sct update ${data} + sct utime readtime + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to parse the read of a parameter on a device +proc ::scobj::oxford_mercury::rdValue {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "rdValue tc_root=${tc_root} sct=[sct] result=[sct result]" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set data [sct result] + set nextState "idle" + if {[string equal -nocase -length 7 ${data} "ASCERR:"]} { + # the protocol driver has reported an error + sct geterror "${data}" + error "[sct geterror]" + } +# rdValue hook code starts + set value [lindex [split "${data}" ":"] end] + if {[string equal -nocase -length 3 ${value} NaN]} { + set value 0 + } + if {[string equal -nocase -length 3 ${value} inf] || [string equal -nocase -length 4 ${value} -inf]} { + set value 0 + } + if {![string is digit [string index ${value} 0]]} { + set value 0 + } + debug_log ${tc_root} 1 "rdValue tc_root=${tc_root} sct=[sct] result=[sct result]" + debug_log ${tc_root} 1 "rdValue tc_root=${tc_root} data=${data} value=${value}" + scan ${value} "%g" data +# rdValue hook code ends + if { [hpropexists [sct] geterror] } { + debug_log ${tc_root} 9 "[sct] error: [sct geterror]" + error "[sct geterror]" + } + if { ${data} != [sct oldval] } { + debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]" + sct oldval ${data} + sct update ${data} + sct utime readtime + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to write a parameter value on a device +proc ::scobj::oxford_mercury::setPoint {tc_root nextState cmd_str} { + set catch_status [ catch { + debug_log ${tc_root} 1 "setPoint tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" if { [hpropexists [sct] geterror] } { hdelprop [sct] geterror } set par [sct target] - set command "$cmd:$par" - - debug_log 1 "setPoint tc_root=$tc_root sct=[sct] Write $command" - sct send "$command" - sct driving 1 - sct time_check [clock seconds] - if {$par != [sct oldval]} { - sct oldval $par - sct update $par - sct utime readtime - debug_log 1 "setPoint: new data for $tc_root [sct] result=$par" - } - return $nextState - } - - proc chkWrite {tc_root} { - # process the response to the write - # - not all devices will respond to writes - set data [sct result] - debug_log 1 "chkWrite tc_root=$tc_root sct=[sct] resp=$data" - if {[string equal -nocase -length 7 $data "ASCERR:"]} { - # the protocol driver has reported an error - sct geterror "$data" - } elseif {[string equal -nocase -length 1 $data "?"]} { - # the device has reported an error - sct geterror "Error: $data" - } else { - # the write was successful, record the data - set data [sct target] - if {$data != [sct oldval]} { - sct oldval $data - sct update $data - sct utime readtime - debug_log 1 "chkWrite new data for $tc_root [sct] result=$data" + set cmd "${cmd_str}${par}" +# setPoint hook code goes here + if { [hpropexists [sct] driving] } { + if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { + sct driving 1 } } - return idle - } - - proc noResponse {tc_root} { - set data "[sct result]" - debug_log 1 "noResponse tc_root=$tc_root sct=[sct] resp=$data" - return idle - } - - proc getValue {tc_root nextState cmd} { - # send a command to request a value - debug_log 1 "getValue tc_root=$tc_root sct=[sct] $cmd" - if { [hpropexists [sct] geterror] } { - hdelprop [sct] geterror + debug_log ${tc_root} 1 "setPoint sct send ${cmd}" + if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { + sct send "${cmd}" } - if { [string equal -nocase -length 4 "$cmd" "XXXX"] } { - set cmd "$cmd [channel [pathname [sct]]]" - } - debug_log 1 "getValue sct send $cmd" - sct send "$cmd" - return $nextState - } - - proc rdValue {tc_root} { - # process the received response to the read request - debug_log 1 "[ns]::rdValue tc_root=$tc_root sct=[sct] result=[sct result]" - set data [sct result] - if {[string equal -nocase -length 7 $data "ASCERR:"]} { - # the protocol driver has reported an error - sct geterror "$data" - } elseif {[string equal -nocase -length 1 $data "?"]} { - # the device has reported an error - sct geterror "Error: $data" - } else { - if { [string equal -nocase [basename [sct]] "XXXX"] } { - return "idle" - } - scan [lindex [split "$data" ":"] end] "%g" data - if {$data != [sct oldval]} { - debug_log 1 "[sct] changed to new:$data, from old:[sct oldval]" - sct oldval $data - sct update $data - sct utime readtime - } - } - return "idle" - } - - proc rdText {tc_root} { - # process the received response to the read request - debug_log 1 "[ns]::rdText tc_root=$tc_root sct=[sct] result=[sct result]" - set data [sct result] - if {[string equal -nocase -length 7 $data "ASCERR:"]} { - # the protocol driver has reported an error - sct geterror "$data" - } elseif {[string equal -nocase -length 1 $data "?"]} { - # the device has reported an error - sct geterror "Error: $data" - } else { - if { [string equal -nocase [basename [sct]] "XXXX"] } { - return "idle" - } - scan [lindex [split "$data" ":"] end] "%s" data - if {$data != [sct oldval]} { - debug_log 1 "[sct] changed to new:$data, from old:[sct oldval]" - sct oldval $data - sct update $data - sct utime readtime - } - } - return "idle" - } - - proc rdTextAll {tc_root} { - # process the received response to the read request - debug_log 1 "[ns]::rdText tc_root=$tc_root sct=[sct] result=[sct result]" - set data [sct result] - if {[string equal -nocase -length 7 $data "ASCERR:"]} { - # the protocol driver has reported an error - sct geterror "$data" - } elseif {[string equal -nocase -length 1 $data "?"]} { - # the device has reported an error - sct geterror "Error: $data" - } else { - if { [string equal -nocase [basename [sct]] "XXXX"] } { - return "idle" - } - #scan [lindex [split "$data" ":"] end] "%s" data - if {$data != [sct oldval]} { - debug_log 1 "[sct] changed to new:$data, from old:[sct oldval]" - sct oldval $data - sct update $data - sct utime readtime - } - } - return "idle" - } - - proc getTemp {tc_root nextState cmd} { - debug_log 1 "getTemp tc_root=$tc_root sct=[sct] $cmd" - if { ! [hpropexists [sct] my_state] } { - sct my_state 0 - } - if { [sct my_state] == 0 } { - set command "CSET?" - } else { - set command "RDGK? [sct channel]" - } - debug_log 1 "getTemp sct send $command" - sct send "$command" - return "$nextState" - } - - proc rdTemp {tc_root} { - debug_log 1 "rdTemp tc_root=$tc_root sct=[sct] result=[sct result]" - if { [sct my_state] == 0 } { - set response "[split [sct result] ","]" - sct channel [lindex $response 0] - sct filter [lindex $response 1] - sct my_state 1 - return "read" - } else { - set data "[sct result]" - if {$data != [sct oldval]} { - debug_log 1 "[sct] changed to new:$data, from old:[sct oldval]" - sct oldval $data - sct update $data - sct utime readtime - } - sct my_state 0 - return "idle" - } - } - - proc gtLoop {tc_root nextState cmd} { - debug_log 1 "gtLoop tc_root=$tc_root sct=[sct] nextState=$nextState cmd=$cmd" - debug_log 1 "gtLoop tc_root=$tc_root pathname=[pathname [sct]] basename=[basename [sct]]" - if { ! [hpropexists [sct] my_state] } { - debug_log 1 "gtLoop setting my_state to zero because it doesn't exist" - sct my_state 0 - } - if { [sct my_state] == 0 } { - set command "RAMP?" - } else { - set command "SETP?" - } - debug_log 1 "gtLoop sct=[sct] command=$command" - sct send "$command" - return "$nextState" - return idle - } - - proc rdLoop {tc_root} { - debug_log 1 "rdLoop tc_root=$tc_root sct=[sct] result=[sct result]" - debug_log 1 "rdLoop tc_root=$tc_root pathname=[pathname [sct]] basename=[basename [sct]]" - set nextState "read" - if { [sct my_state] == 0 } { - debug_log 1 "rdLoop sct=[sct] RAMP - result=[sct result]" - set nextState "read" - } else { - debug_log 1 "rdLoop sct=[sct] SETP - result=[sct result]" - set nextState "idle" - sct my_state -1 - } - sct my_state "[expr {[sct my_state] + 1}]" - return $nextState - } - - proc wrLoop {tc_root nextState cmd} { - debug_log 1 "wrLoop tc_root=$tc_root sct=[sct] nextState=$nextState cmd=$cmd" - if { ! [hpropexists [sct] my_state] } { - debug_log 1 "wrLoop setting my_state to zero because it doesn't exist" - sct my_state 0 - } - if { [sct writestatus] == "start" } { - debug_log 1 "wrLoop setting my_state to zero because writestatus is [sct writestatus]" - sct my_state 0 - } - debug_log 1 "wrLoop target=[sct target] writestatus=[sct writestatus] my_state=[sct my_state]" - if { [sct my_state] == 0 } { - set my_rate [hval [sct]/ramp_rate] - if { $my_rate > 0.0 } { - set command "RAMP 0,0;RAMP?" - } else { - set command "RAMP 1,$my_rate;RAMP?" - } - } else { - set command "SETP [hval [sct]/setpoint];SETP?" - } - debug_log 1 "wrLoop sct=[sct] command=$command" - sct send "$command" - return "$nextState" - } - - proc ckLoop {tc_root} { - debug_log 1 "ckLoop tc_root=$tc_root sct=[sct] result=[sct result]" - debug_log 1 "ckLoop target=[sct target] writestatus=[sct writestatus] my_state=[sct my_state]" - set nextState "write" - if { [sct my_state] == 0 } { - debug_log 1 "ckLoop sct=[sct] RAMP - result=[sct result]" - [ns]::rdValue $tc_root - set nextState "write" - } else { - debug_log 1 "ckLoop sct=[sct] SETP - result=[sct result]" - [ns]::rdValue $tc_root - sct my_state -1 - set nextState "idle" - } - sct my_state "[expr {[sct my_state] + 1}]" - return $nextState - } - - ## - # @brief getState() sends commands/requests to the device under control - # - # @param tc_root the path to the device_state node - # @param nextState the next sct state (rdState) - # @param cmd empty argument - # - # @return the next sct state (rdState) - # - proc getState {tc_root nextState cmd} { - if { [hpropexists [sct] geterror] } { - hdelprop [sct] geterror - } - debug_log 1 "getState $tc_root sct=[sct] state=[hval [sct]] substate=[sct substate] next=$nextState" - set my_state [hval [sct]] - set my_substate [sct substate] - if {$my_state == "STATE_INIT"} { - if { $my_substate == 0 } { - set command "*IDN?" - } elseif { $my_substate == 1 } { - set command "*TST?" - } - } elseif { $my_state == "STATE_CURVE"} { - if { $my_substate == 0 } { - set my_substate 1000 - sct substate $my_substate - } - if { ($my_substate % 1000) == 0 } { - set command "CRVHDR? [expr {int($my_substate / 1000)}]" - } else { - set command "CRVPT? [expr {int($my_substate / 1000)}],[expr {($my_substate % 1000)}]" - } - } elseif { $my_state == "STATE_IDLE"} { - if { $my_substate == 0 } { - set command "*ESE?" - } elseif { $my_substate == 1 } { - set command "*ESR?" - } elseif { $my_substate == 2 } { - set command "*STB?" - } - } - debug_log 1 "getState sct send $command" - sct send $command - return "$nextState" - } - - ## - # @brief rdState() handles events from the device under control - # - # @param tc_root the path to the device_state node - # - proc rdState {tc_root} { - if { [hpropexists [sct] geterror] } { - hdelprop [sct] geterror - } - debug_log 1 "rdState $tc_root sct=[sct] state=[hval [sct]] substate=[sct substate] response=\"[sct result]\"" - set nextState "read" - set my_state [hval [sct]] - set my_substate [sct substate] - if {$my_state == "STATE_INIT"} { - if { $my_substate == 0 } { # IDN - sct identity [sct result] - incr my_substate - } elseif { $my_substate == 1 } { - sct selftest [sct result] - incr my_substate - } - if { $my_substate > 1 } { - #hset [sct] "STATE_IDLE" - hset [sct] "STATE_CURVE" - set my_substate 0 - } - } elseif { $my_state == "STATE_CURVE"} { - if { ($my_substate % 1000) == 0 } { - debug_log 1 "Curve: [expr {$my_substate / 1000}] Header: [sct result]" - } else { - debug_log 1 "Curve: [expr {$my_substate / 1000}] Point: [expr {$my_substate % 1000}] Value: [sct result]" - set rslt [scan "[sct result]" "%f,%f" units temperature] - debug_log 1 "Curve: [expr {$my_substate / 1000}] Point: [expr {$my_substate % 1000}] Result: $rslt Units: $units Temp: $temperature" - if { $units == 0.0 && $temperature == 0.0 } { - set my_substate [expr { (($my_substate / 1000)) * 1000 + 999}] - } - } - if { ($my_substate % 1000) >= 200 } { - if { ($my_substate / 1000) >= 20 } { - hset [sct] "STATE_IDLE" - set my_substate 0 - } else { - set my_substate [expr { (($my_substate / 1000) + 1) * 1000 }] - } - } else { - set my_substate [expr { $my_substate + 1 }] - } - } elseif { $my_state == "STATE_IDLE"} { - if { $my_substate == 0 } { # ESE - sct the_ese [sct result] - incr my_substate - } elseif { $my_substate == 1 } { # ESR - sct the_esr [sct result] - incr my_substate - } elseif { $my_substate == 2 } { # STB - sct the_stb [sct result] - incr my_substate - } - if { $my_substate > 2 } { - set my_substate 0 - set nextState "idle" - } - } - sct substate $my_substate - if { $my_state != [hval [sct]] } { - debug_log 1 "device_state $my_state to [hval [sct]]" - } - return "$nextState" - } - - proc chkTarget {tc_root par} { - set target {} - if {[hpropexists [sct] values]} { - set values [split [SplitReply [sct values]] ","] - foreach value $values { - #sct print "Testing $par against $value" - set lo_hi [split $value ":"] - if {[llength $lo_hi] == 2} { - if {[lindex $lo_hi 0] <= $par && [lindex $lo_hi 1] >= $par} { - #sct print "Success $par between [lindex $lo_hi 0] and [lindex $lo_hi 1]" - set target "$par" - break - } - } else { - if {[string toupper "$par"] == [string toupper "$value"]} { - #sct print "Success $par matches $value" - set target "$par" - break - } - } - } - if {"$target" == ""} { - #sct print "Failure $par no matches in $values" - return -code error "Invalid value: \"$par\"" - } - } else { - set target "$par" - } - return $target - } - -## -# @brief Implement the checkstatus command for the drivable interface -# -# NOTE: The drive adapter initially sets the writestatus to "start" and will -# only call this when writestatus!="start" - proc drivestatus {tc_root} { - #debug_log 1 "drivestatus tc_root=$tc_root, sct=[sct], setpoint=[hval [sct]], temp=[hval [pathname [sct]]/sensor], driving=[sct driving]" - if {[sct driving]} { - # tolerance - set temp [hval [pathname [sct]]/sensor] - set loval [expr {[hval [sct]] - [sct tolerance]}] - set hival [expr {[hval [sct]] + [sct tolerance]}] - if {$loval <= $temp && $temp <= $hival} { - # settle time - set timeout [sct settletime] - set timecheck [sct time_check] - set currtime [clock seconds] - #debug_log 1 "drivestatus tc_root=$tc_root, sct=[sct], setpoint=[hval [sct]], temp=[hval [pathname [sct]]/sensor], temp=($loval, $temp, $hival), time=($timecheck, $currtime, $timeout)" - if { ($currtime - $timecheck) >= $timeout } { - debug_log 1 "drivestatus tc_root=$tc_root, sct=[sct], finished driving" - sct driving 0 - } - } else { - sct time_check [clock seconds] - } - return busy - } else { - debug_log 1 "drivestatus tc_root=$tc_root, sct=[sct], now idle" - return idle - } - } - - proc halt {tc_root} { - debug_log 1 "halt $tc_root" - foreach loop {Loop1 Loop2 Loop3 Loop4} { - set catch_status [ catch { - hset $tc_root/$loop/setpoint [hval $tc_root/$loop/sensor] - hsetprop $tc_root/$loop/setpoint driving 0 - } catch_message ] - } - debug_log 1 "halt $tc_root done driving" - return idle - } - - proc check {tc_root} { - debug_log 1 "check tc_root=$tc_root, sct=[sct], target=[sct target]" - set catch_status [ catch { - set target [chkTarget $tc_root [sct target]] - if { "$target" == "" } { - error "setpoint violates limits" - } - } catch_message ] - if {$catch_status != 0} { - return -code error $catch_message - } - return OK - } - - proc wrNode {tc_root cmd level} { - set space [string repeat " " $level] - set val [hval $tc_root] - if {"$val" == ""} { - set line "$tc_root ([hinfo $tc_root])" - } else { - set line "$tc_root ([hinfo $tc_root]) = $val" - } - sct print "$space* $line" - if {"[string tolower "$cmd"]" == "-prop"} { - set props [hlistprop $tc_root] - #sct print "<<$props>>" - foreach prop $props { - #sct print "prop: $prop" - set flds [split $prop "="] - #sct print "flds: $flds" - if {[llength $flds] > 1} { - set fld0 [lindex $flds 0] - #sct print "fld0: $fld0" - if {[hpropexists $tc_root $fld0]} { - sct print "$space - [hgetprop $tc_root $fld0]" - } - } - } - } - foreach node [hlist $tc_root] { - [ns]::wrNode $tc_root/$node "$cmd" [expr {$level + 1}] - } - } - - proc wrTree {tc_root nextState cmd} { - debug_log 1 "wrTree root=$tc_root sct=[sct] cmd=$cmd target=[sct target]" - sct print "$tc_root" - [ns]::wrNode $tc_root "[sct target]" 1 - return idle - } - - ## - # @brief createNode() creates a node for the given nodename with the properties given - # - # @param scobj_hpath string variable holding the path to the object's base node in sics (/sample/tc1) - # @param sct_controller name of the scriptcontext object (typically sct_xxx_yyy) - # @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 writable set to 1 if the node represents a request for a change in settings sent to the device - # @param drivable if set to 1 it prepares the node to provide a drivable interface - # @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 wrCmd actual device write command to be sent to the device - # @param wrFunc Function to be called to send the wrCmd to the device, typically setValue() - # @param allowedValues allowed values for the node data - does not permit other - # @param klass Nexus class name (?) - # @return OK - proc createNode {scobj_hpath sct_controller\ - cmdGroup varName\ - readable writable drivable\ - dataType permission\ - rdCmd rdFunc\ - wrCmd wrFunc\ - allowedValues klass} { - - set catch_status [ catch { - set ns "[ns]" - set nodeName "$scobj_hpath/$cmdGroup/$varName" - if {1 > [string length $cmdGroup]} { - set nodeName "$scobj_hpath/$varName" - } - debug_log 1 "Creating node $nodeName" - hfactory $nodeName plain $permission $dataType - if {$readable > 0} { - # the node is readable so set it up to be polled using the rdFunc - # rdFunc is getValueFunc.rdValueFunc with both explicit functions - # or rdValueFunc where "getValue" is the implied getValueFunc - set parts [split "$rdFunc" "."] - if { [llength $parts] == 2 } { - set func_name [lindex $parts 0] - set next_state [lindex $parts 1] - } else { - set func_name "getValue" - set next_state [lindex $parts 0] - } - hsetprop $nodeName read ${ns}::$func_name $scobj_hpath $next_state $rdCmd - hsetprop $nodeName $next_state ${ns}::$next_state $scobj_hpath - # set the poll rate as a period in seconds - # TODO allow directly settable value in seconds - set poll_period 5 - if { $readable >= 0 && $readable <= 300 } { - set poll_period [expr {int($readable)}] - } - debug_log 1 "Registering node $nodeName for poll at $poll_period seconds" - $sct_controller poll $nodeName $poll_period - } - if {$writable == 1} { - # the node is writable so set it up to invoke a callback when written - # rdFunc is putValueFunc.chkWriteFunc with both explicit functions - # or putValueFunc where "noResponse" is the implied chkWriteFunc - set parts [split "$wrFunc" "."] - if { [llength $parts] == 2 } { - set func_name [lindex $parts 0] - set next_state [lindex $parts 1] - } else { - set func_name [lindex $parts 0] - set next_state "noResponse" - } - hsetprop $nodeName write ${ns}::$func_name $scobj_hpath $next_state $wrCmd - hsetprop $nodeName $next_state ${ns}::$next_state $scobj_hpath - hsetprop $nodeName writestatus UNKNOWN - debug_log 1 "Registering node $nodeName for write callback" - $sct_controller write $nodeName - } - # Initialise the previous value to test against - switch -exact $dataType { - "none" { } - "int" { hsetprop $nodeName oldval -1 } - "float" { hsetprop $nodeName oldval -1.0 } - default { hsetprop $nodeName oldval UNKNOWN } - } - # Set the allowed values property - if {1 < [string length $allowedValues]} { - hsetprop $nodeName values $allowedValues - } - # Drive adapter interface - # TODO make it a separate function and pass in all this stuff - if {$drivable == 1} { - hsetprop $nodeName check ${ns}::check $scobj_hpath - hsetprop $nodeName driving 0 - hsetprop $nodeName checklimits ${ns}::check $scobj_hpath - hsetprop $nodeName checkstatus ${ns}::drivestatus $scobj_hpath - hsetprop $nodeName halt ${ns}::halt $scobj_hpath - } else { - hsetprop $nodeName driving 0 - } - } catch_message ] - if {$catch_status != 0} { - debug_log 5 "error in [ns]::createNode $catch_message" - return -code error "in [ns]::createNode $catch_message" - } - return OK - } - - proc mk_sct_driver {sct_controller the_klass the_name tol CID CTYPE} { - debug_log 1 "mk_sct_driver $sct_controller $the_klass $the_name $tol $CID $CTYPE" - set catch_status [ catch { - - MakeSICSObj $the_name SCT_OBJECT - sicslist setatt $the_name klass $the_klass - sicslist setatt $the_name long_name $the_name - - set scobj_hpath /sics/$the_name - - hfactory $scobj_hpath/Loop1 plain spy none - hfactory $scobj_hpath/Loop2 plain spy none - hfactory $scobj_hpath/Loop3 plain spy none - hfactory $scobj_hpath/Loop4 plain spy none - hfactory $scobj_hpath/Level plain spy none - - set deviceCommand {\ - Loop1 setpoint 5 1 1 float user {READ:DEV:MB1.T1:TEMP:LOOP:TSET} {rdValue} {SET:DEV:MB1.T1:TEMP:LOOP:TSET} {setPoint} {1:333}\ - Loop1 sensor 1 0 0 float user {READ:DEV:MB1.T1:TEMP:SIG:TEMP} {rdValue} {} {} {}\ - Loop1 nick 5 0 0 text user {READ:DEV:MB1.T1:TEMP:NICK} {rdText} {} {} {}\ - Loop1 temp 0 0 0 text user {READ:DEV:MB1.T1:TEMP} {rdTextAll} {} {} {}\ - Loop1 loop 0 0 0 text user {READ:DEV:MB1.T1:TEMP:LOOP} {rdTextAll} {} {} {}\ - Loop1 heater 0 0 0 text user {READ:DEV:MB0.H1:HTR} {rdTextAll} {} {} {}\ - Loop1 power 5 0 0 float user {READ:DEV:MB0.H1:HTR:SIG:POWR} {rdValue} {} {} {}\ - Loop2 setpoint 5 1 1 float user {READ:DEV:DB6.T1:TEMP:LOOP:TSET} {rdValue} {SET:DEV:DB6.T1:TEMP:LOOP:TSET} {setPoint} {1:333}\ - Loop2 sensor 1 0 0 float user {READ:DEV:DB6.T1:TEMP:SIG:TEMP} {rdValue} {} {} {}\ - Loop2 nick 5 0 0 text user {READ:DEV:DB6.T1:TEMP:NICK} {rdText} {} {} {}\ - Loop2 temp 0 0 0 text user {READ:DEV:DB6.T1:TEMP} {rdTextAll} {} {} {}\ - Loop2 loop 0 0 0 text user {READ:DEV:DB6.T1:TEMP:LOOP} {rdTextAll} {} {} {}\ - Loop2 heater 0 0 0 text user {READ:DEV:DB1.H1:HTR} {rdTextAll} {} {} {}\ - Loop2 power 5 0 0 float user {READ:DEV:DB1.H1:HTR:SIG:POWR} {rdValue} {} {} {}\ - Loop3 setpoint 5 1 1 float user {READ:DEV:DB7.T1:TEMP:LOOP:TSET} {rdValue} {SET:DEV:DB7.T1:TEMP:LOOP:TSET} {setPoint} {1:333}\ - Loop3 sensor 1 0 0 float user {READ:DEV:DB7.T1:TEMP:SIG:TEMP} {rdValue} {} {} {}\ - Loop3 nick 5 0 0 text user {READ:DEV:DB7.T1:TEMP:NICK} {rdText} {} {} {}\ - Loop3 temp 0 0 0 text user {READ:DEV:DB7.T1:TEMP} {rdTextAll} {} {} {}\ - Loop3 loop 0 0 0 text user {READ:DEV:DB7.T1:TEMP:LOOP} {rdTextAll} {} {} {}\ - Loop3 heater 0 0 0 text user {READ:DEV:DB2.H1:HTR} {rdTextAll} {} {} {}\ - Loop3 power 5 0 0 float user {READ:DEV:DB2.H1:HTR:SIG:POWR} {rdValue} {} {} {}\ - Loop4 setpoint 5 1 1 float user {READ:DEV:DB8.T1:TEMP:LOOP:TSET} {rdValue} {SET:DEV:DB8.T1:TEMP:LOOP:TSET} {setPoint} {1:333}\ - Loop4 sensor 1 0 0 float user {READ:DEV:DB8.T1:TEMP:SIG:TEMP} {rdValue} {} {} {}\ - Loop4 nick 5 0 0 text user {READ:DEV:DB8.T1:TEMP:NICK} {rdText} {} {} {}\ - Loop4 temp 0 0 0 text user {READ:DEV:DB8.T1:TEMP} {rdTextAll} {} {} {}\ - Loop4 loop 0 0 0 text user {READ:DEV:DB7.T1:TEMP:LOOP} {rdTextAll} {} {} {}\ - Loop4 heater 0 0 0 text user {READ:DEV:DB3.H1:HTR} {rdTextAll} {} {} {}\ - Loop4 power 5 0 0 float user {READ:DEV:DB3.H1:HTR:SIG:POWR} {rdValue} {} {} {}\ - Level Nitrogen 15 0 0 float user {READ:DEV:DB5.L1:LVL:SIG:NIT:LEV} {rdValue} {} {} {}\ - Level Helium 15 0 0 float user {READ:DEV:DB5.L1:LVL:SIG:HEL:LEV} {rdValue} {} {} {}\ - } - - foreach {cmdGroup varName\ - readable writable drivable\ - dataType permission\ - rdCmd rdFunc\ - wrCmd wrFunc\ - allowedValues} $deviceCommand { - [ns]::createNode $scobj_hpath $sct_controller\ - $cmdGroup $varName\ - $readable $writable $drivable\ - $dataType $permission\ - $rdCmd $rdFunc\ - $wrCmd $wrFunc\ - $allowedValues $the_klass - } - - foreach cmdGroup { Loop1 Loop2 Loop3 Loop4 } { - set pathName "$scobj_hpath/$cmdGroup" - hsetprop $pathName type part - hsetprop $pathName klass NXsensor - hsetprop $pathName privilege spy - hsetprop $pathName control true - hsetprop $pathName data true - hsetprop $pathName nxsave true - hsetprop $pathName/setpoint tolerance $tol - hsetprop $pathName/setpoint settletime 5 - foreach varName { setpoint sensor nick } { - set nodeName "$pathName/$varName" - hsetprop $nodeName nxalias ${the_name}_${cmdGroup}_${varName}_value - hsetprop $nodeName long_name $varName - hsetprop $nodeName klass sensor - hsetprop $nodeName priviledge user - hsetprop $nodeName control true - hsetprop $nodeName data true - hsetprop $nodeName nxsave true - hsetprop $nodeName mutable true - hsetprop $nodeName sdsinfo ::nexus::scobj::sdsinfo - } - } - - foreach cmdGroup { Level } { - set pathName "$scobj_hpath/$cmdGroup" - hsetprop $pathName type part - hsetprop $pathName klass NXsensor - hsetprop $pathName privilege spy - hsetprop $pathName control true - hsetprop $pathName data true - hsetprop $pathName nxsave true - foreach varName { Nitrogen Helium } { - set nodeName "$pathName/$varName" - hsetprop $nodeName long_name $varName - hsetprop $nodeName klass sensor - hsetprop $nodeName priviledge user - hsetprop $nodeName control true - hsetprop $nodeName data true - hsetprop $nodeName nxsave true - hsetprop $nodeName nxalias ${the_name}_${cmdGroup}_${varName}_value - hsetprop $nodeName mutable true - hsetprop $nodeName sdsinfo ::nexus::scobj::sdsinfo - } - } - - hfactory $scobj_hpath/device_state plain spy none - hset $scobj_hpath/device_state "STATE_INIT" - hsetprop $scobj_hpath/device_state substate 0 - - set point 0 - set catch_status_2 [ catch { - hsetprop $scobj_hpath privilege spy - hsetprop $scobj_hpath long_name $the_name - hsetprop $scobj_hpath sicsdev $the_name - hsetprop $scobj_hpath nxalias $the_name - hsetprop $scobj_hpath control true - hsetprop $scobj_hpath data true - hsetprop $scobj_hpath nxsave true - hsetprop $scobj_hpath mutable true - hsetprop $scobj_hpath klass parameter - hsetprop $scobj_hpath sdsinfo ::nexus::scobj::sdsinfo - set point 1 -if {0} { - ::scobj::hinitprops $the_name Loop1 - set point 2 - ::scobj::hinitprops $the_name Loop2/setpoint - set point 3 - ::scobj::hinitprops $the_name Loop3/setpoint - set point 4 - ::scobj::hinitprops $the_name Loop4/setpoint - set point 5 -} - } catch_message_2 ] - if {$catch_status_2 != 0} { - debug_log 5 "error in [ns]::mk_sct_driver($point) $catch_message_2" - return -code error "in [ns]::mk_sct_driver($point) $catch_message_2" - } - hsetprop $scobj_hpath/Loop1/setpoint permlink data_set ${CTYPE}${CID}SP1 - hsetprop $scobj_hpath/Loop1/setpoint @description ${CTYPE}${CID}SP1 - hsetprop $scobj_hpath/Loop1/setpoint permlink data_set ${CTYPE}${CID}SP1 - hsetprop $scobj_hpath/Loop1/setpoint @description ${CTYPE}${CID}SP1 - hsetprop $scobj_hpath/Loop2/setpoint permlink data_set ${CTYPE}${CID}SP2 - hsetprop $scobj_hpath/Loop2/setpoint @description ${CTYPE}${CID}SP2 - hsetprop $scobj_hpath/Loop3/setpoint permlink data_set ${CTYPE}${CID}SP3 - hsetprop $scobj_hpath/Loop3/setpoint @description ${CTYPE}${CID}SP3 - hsetprop $scobj_hpath/Loop4/setpoint permlink data_set ${CTYPE}${CID}SP4 - hsetprop $scobj_hpath/Loop4/setpoint @description ${CTYPE}${CID}SP4 - - hsetprop $scobj_hpath/Loop1/sensor permlink data_set ${CTYPE}${CID}S1 - hsetprop $scobj_hpath/Loop1/sensor @description ${CTYPE}${CID}S1 - hsetprop $scobj_hpath/Loop2/sensor permlink data_set ${CTYPE}${CID}S2 - hsetprop $scobj_hpath/Loop2/sensor @description ${CTYPE}${CID}S2 - hsetprop $scobj_hpath/Loop3/sensor permlink data_set ${CTYPE}${CID}S3 - hsetprop $scobj_hpath/Loop3/sensor @description ${CTYPE}${CID}S3 - hsetprop $scobj_hpath/Loop4/sensor permlink data_set ${CTYPE}${CID}S4 - hsetprop $scobj_hpath/Loop4/sensor @description ${CTYPE}${CID}S4 - - if {[SplitReply [environment_simulation]]=="false"} { - hsetprop $scobj_hpath/Loop1/setpoint type drivable - hsetprop $scobj_hpath/Loop2/setpoint type drivable - hsetprop $scobj_hpath/Loop3/setpoint type drivable - hsetprop $scobj_hpath/Loop4/setpoint type drivable - ansto_makesctdrive ${the_name}_loop1 $scobj_hpath/Loop1/setpoint $scobj_hpath/Loop1/sensor $sct_controller - ansto_makesctdrive ${the_name}_loop2 $scobj_hpath/Loop2/setpoint $scobj_hpath/Loop2/sensor $sct_controller - ansto_makesctdrive ${the_name}_loop3 $scobj_hpath/Loop3/setpoint $scobj_hpath/Loop3/sensor $sct_controller - ansto_makesctdrive ${the_name}_loop4 $scobj_hpath/Loop4/setpoint $scobj_hpath/Loop4/sensor $sct_controller - } - } catch_message ] - if {$catch_status != 0} { - debug_log 5 "error in [ns]::mk_sct_driver $catch_message" - return -code error "in [ns]::mk_sct_driver $catch_message" - } - } - - proc add_[set vendor]_[set device] {the_name IP port CID CTYPE terminator {_tol 5.0}} { - set [ns]::log_file "../log/[set [ns]::ven_dev]_[set the_name].log" - 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}" - 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 - } - debug_log 1 "::scobj::oxford_mercury::mk_sct_driver sct_${the_name} environment ${the_name} ${_tol} $CID $CTYPE" - ::scobj::oxford_mercury::mk_sct_driver sct_${the_name} environment ${the_name} ${_tol} $CID $CTYPE - } - - - namespace export add_[set vendor]_[set device] + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} } -namespace import ::scobj::[set vendor]_[set device]::* +# function to write a parameter value on a device +proc ::scobj::oxford_mercury::setValue {tc_root nextState cmd_str} { + set catch_status [ catch { + debug_log ${tc_root} 1 "setValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set par [sct target] + set cmd "${cmd_str}${par}" +# setValue hook code goes here + if { [hpropexists [sct] driving] } { + if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { + sct driving 1 + } + } + debug_log ${tc_root} 1 "setValue sct send ${cmd}" + if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { + sct send "${cmd}" + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} +# function to write a parameter value on a device +proc ::scobj::oxford_mercury::setValve {tc_root nextState cmd_str} { + set catch_status [ catch { + debug_log ${tc_root} 1 "setValve tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set par [sct target] + set cmd "${cmd_str}${par}" +# setValve hook code goes here + if { [hpropexists [sct] driving] } { + if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { + sct driving 1 + } + } + debug_log ${tc_root} 1 "setValve sct send ${cmd}" + if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { + sct send "${cmd}" + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} +# function to write a parameter value on a device +proc ::scobj::oxford_mercury::wrOnOff {tc_root nextState cmd_str} { + set catch_status [ catch { + debug_log ${tc_root} 1 "wrOnOff tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set par [sct target] + set cmd "${cmd_str}${par}" +# wrOnOff hook code starts + if { ${par} == 1 } { + set cmd "${cmd_str}ON" + } else { + set cmd "${cmd_str}OFF" + } +# wrOnOff hook code ends + if { [hpropexists [sct] geterror] } { + debug_log ${tc_root} 9 "[sct] error: [sct geterror]" + error "[sct geterror]" + } + if { [hpropexists [sct] driving] } { + if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { + sct driving 1 + } + } + debug_log ${tc_root} 1 "wrOnOff sct send ${cmd}" + if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { + sct send "${cmd}" + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +proc ::scobj::oxford_mercury::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id {cards NNNNNNNN} {assoc 00000000} {ttol 1} {ptol 5} {vtol 5} } { + ::scobj::oxford_mercury::sics_log 9 "::scobj::oxford_mercury::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${cards} ${assoc} ${ttol} ${ptol} ${vtol}" + set ns "[namespace current]" + set catch_status [ catch { + + MakeSICSObj ${name} SCT_OBJECT + + sicslist setatt ${name} klass ${device_class} + sicslist setatt ${name} long_name ${name} + + set scobj_hpath /sics/${name} + + hsetprop ${scobj_hpath} assoc "${assoc}" + hsetprop ${scobj_hpath} cards "${cards}" + hsetprop ${scobj_hpath} data "true" + hsetprop ${scobj_hpath} klass "@none" + hsetprop ${scobj_hpath} type "part" + + if {[string equal -nocase [string index ${cards} 4] L]} { + hfactory ${scobj_hpath}/level plain spy none + + hfactory ${scobj_hpath}/level/helium plain user float + hsetprop ${scobj_hpath}/level/helium read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB5.L1:LVL:SIG:HEL:LEV} + hsetprop ${scobj_hpath}/level/helium rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/level/helium control true + hsetprop ${scobj_hpath}/level/helium data true + hsetprop ${scobj_hpath}/level/helium mutable true + hsetprop ${scobj_hpath}/level/helium nxsave true + hsetprop ${scobj_hpath}/level/helium permlink data_set "T[format "%02d" ${id}]He" + hsetprop ${scobj_hpath}/level/helium @description "T[format "%02d" ${id}]He" + hsetprop ${scobj_hpath}/level/helium oldval 0.0 + hsetprop ${scobj_hpath}/level/helium klass "parameter" + hsetprop ${scobj_hpath}/level/helium sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/level/helium type "part" + hsetprop ${scobj_hpath}/level/helium nxalias "${name}_level_helium" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/level/helium 15 + hsetprop ${scobj_hpath}/level/helium simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/level/helium simulated true + } + + hfactory ${scobj_hpath}/level/nick plain user text + hsetprop ${scobj_hpath}/level/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB5.L1:LVL:NICK} + hsetprop ${scobj_hpath}/level/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/level/nick control true + hsetprop ${scobj_hpath}/level/nick data true + hsetprop ${scobj_hpath}/level/nick mutable true + hsetprop ${scobj_hpath}/level/nick nxsave true + hsetprop ${scobj_hpath}/level/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/level/nick klass "parameter" + hsetprop ${scobj_hpath}/level/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/level/nick type "part" + hsetprop ${scobj_hpath}/level/nick nxalias "${name}_level_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/level/nick 15 + hsetprop ${scobj_hpath}/level/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/level/nick simulated true + } + + hfactory ${scobj_hpath}/level/nitrogen plain user float + hsetprop ${scobj_hpath}/level/nitrogen read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB5.L1:LVL:SIG:NIT:LEV} + hsetprop ${scobj_hpath}/level/nitrogen rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/level/nitrogen control true + hsetprop ${scobj_hpath}/level/nitrogen data true + hsetprop ${scobj_hpath}/level/nitrogen mutable true + hsetprop ${scobj_hpath}/level/nitrogen nxsave true + hsetprop ${scobj_hpath}/level/nitrogen permlink data_set "T[format "%02d" ${id}]N2" + hsetprop ${scobj_hpath}/level/nitrogen @description "T[format "%02d" ${id}]N2" + hsetprop ${scobj_hpath}/level/nitrogen oldval 0.0 + hsetprop ${scobj_hpath}/level/nitrogen klass "parameter" + hsetprop ${scobj_hpath}/level/nitrogen sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/level/nitrogen type "part" + hsetprop ${scobj_hpath}/level/nitrogen nxalias "${name}_level_nitrogen" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/level/nitrogen 15 + hsetprop ${scobj_hpath}/level/nitrogen simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/level/nitrogen simulated true + } + hsetprop ${scobj_hpath}/level data "true" + hsetprop ${scobj_hpath}/level klass "@none" + hsetprop ${scobj_hpath}/level type "part" + } + + if {[string equal -nocase [string index ${cards} 4] P]} { + hfactory ${scobj_hpath}/pres5 plain spy none + + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 4] 4]} { + hfactory ${scobj_hpath}/pres5/auto plain user int + hsetprop ${scobj_hpath}/pres5/auto read ${ns}::getValue ${scobj_hpath} rdOnOff {READ:DEV:DB5.P1:PRES:LOOP:FAUT} + hsetprop ${scobj_hpath}/pres5/auto rdOnOff ${ns}::rdOnOff ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/auto write ${ns}::wrOnOff ${scobj_hpath} noResponse {SET:DEV:DB5.P1:PRES:LOOP:FAUT:} + hsetprop ${scobj_hpath}/pres5/auto noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/auto check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/auto control true + hsetprop ${scobj_hpath}/pres5/auto data true + hsetprop ${scobj_hpath}/pres5/auto mutable true + hsetprop ${scobj_hpath}/pres5/auto nxsave true + hsetprop ${scobj_hpath}/pres5/auto values 0,1 + hsetprop ${scobj_hpath}/pres5/auto oldval 0 + hsetprop ${scobj_hpath}/pres5/auto klass "parameter" + hsetprop ${scobj_hpath}/pres5/auto sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres5/auto type "part" + hsetprop ${scobj_hpath}/pres5/auto nxalias "${name}_pres5_auto" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres5/auto 5 + ${sct_controller} write ${scobj_hpath}/pres5/auto + hsetprop ${scobj_hpath}/pres5/auto simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres5/auto simulated true + } + } + + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 4] 4]} { + hfactory ${scobj_hpath}/pres5/enab plain user int + hsetprop ${scobj_hpath}/pres5/enab read ${ns}::getValue ${scobj_hpath} rdOnOff {READ:DEV:DB5.P1:PRES:LOOP:ENAB} + hsetprop ${scobj_hpath}/pres5/enab rdOnOff ${ns}::rdOnOff ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/enab write ${ns}::wrOnOff ${scobj_hpath} noResponse {SET:DEV:DB5.P1:PRES:LOOP:ENAB:} + hsetprop ${scobj_hpath}/pres5/enab noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/enab check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/enab control true + hsetprop ${scobj_hpath}/pres5/enab data true + hsetprop ${scobj_hpath}/pres5/enab mutable true + hsetprop ${scobj_hpath}/pres5/enab nxsave true + hsetprop ${scobj_hpath}/pres5/enab values 0,1 + hsetprop ${scobj_hpath}/pres5/enab oldval 0 + hsetprop ${scobj_hpath}/pres5/enab klass "parameter" + hsetprop ${scobj_hpath}/pres5/enab sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres5/enab type "part" + hsetprop ${scobj_hpath}/pres5/enab nxalias "${name}_pres5_enab" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres5/enab 5 + ${sct_controller} write ${scobj_hpath}/pres5/enab + hsetprop ${scobj_hpath}/pres5/enab simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres5/enab simulated true + } + } + + hfactory ${scobj_hpath}/pres5/fset plain user float + hsetprop ${scobj_hpath}/pres5/fset read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB5.P1:PRES:LOOP:FSET} + hsetprop ${scobj_hpath}/pres5/fset rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/fset write ${ns}::setValue ${scobj_hpath} noResponse {SET:DEV:DB5.P1:PRES:LOOP:FSET:} + hsetprop ${scobj_hpath}/pres5/fset noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/fset check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/fset control true + hsetprop ${scobj_hpath}/pres5/fset data true + hsetprop ${scobj_hpath}/pres5/fset mutable true + hsetprop ${scobj_hpath}/pres5/fset nxsave true + hsetprop ${scobj_hpath}/pres5/fset lowerlimit 0 + hsetprop ${scobj_hpath}/pres5/fset upperlimit 100 + hsetprop ${scobj_hpath}/pres5/fset oldval 0.0 + hsetprop ${scobj_hpath}/pres5/fset klass "parameter" + hsetprop ${scobj_hpath}/pres5/fset sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres5/fset type "part" + hsetprop ${scobj_hpath}/pres5/fset nxalias "${name}_pres5_fset" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres5/fset 5 + ${sct_controller} write ${scobj_hpath}/pres5/fset + hsetprop ${scobj_hpath}/pres5/fset simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres5/fset simulated true + } + + hfactory ${scobj_hpath}/pres5/nick plain user text + hsetprop ${scobj_hpath}/pres5/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB5.P1:PRES:NICK} + hsetprop ${scobj_hpath}/pres5/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/nick control true + hsetprop ${scobj_hpath}/pres5/nick data true + hsetprop ${scobj_hpath}/pres5/nick mutable true + hsetprop ${scobj_hpath}/pres5/nick nxsave true + hsetprop ${scobj_hpath}/pres5/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/pres5/nick klass "parameter" + hsetprop ${scobj_hpath}/pres5/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres5/nick type "part" + hsetprop ${scobj_hpath}/pres5/nick nxalias "${name}_pres5_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres5/nick 15 + hsetprop ${scobj_hpath}/pres5/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres5/nick simulated true + } + + hfactory ${scobj_hpath}/pres5/sensor plain user float + hsetprop ${scobj_hpath}/pres5/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB5.P1:PRES:SIG:PRES} + hsetprop ${scobj_hpath}/pres5/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/sensor control true + hsetprop ${scobj_hpath}/pres5/sensor data true + hsetprop ${scobj_hpath}/pres5/sensor mutable true + hsetprop ${scobj_hpath}/pres5/sensor nxsave true + hsetprop ${scobj_hpath}/pres5/sensor units mB + hsetprop ${scobj_hpath}/pres5/sensor permlink data_set "P[format "%02d" ${id}]PS05" + hsetprop ${scobj_hpath}/pres5/sensor @description "P[format "%02d" ${id}]PS05" + hsetprop ${scobj_hpath}/pres5/sensor oldval 0.0 + hsetprop ${scobj_hpath}/pres5/sensor klass "parameter" + hsetprop ${scobj_hpath}/pres5/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres5/sensor type "part" + hsetprop ${scobj_hpath}/pres5/sensor nxalias "${name}_pres5_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres5/sensor 1 + hsetprop ${scobj_hpath}/pres5/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres5/sensor simulated true + } + + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 4] 4]} { + hfactory ${scobj_hpath}/pres5/setpoint plain user float + hsetprop ${scobj_hpath}/pres5/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB5.P1:PRES:LOOP:TSET} + hsetprop ${scobj_hpath}/pres5/setpoint rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/setpoint write ${ns}::setPoint ${scobj_hpath} noResponse {SET:DEV:DB8.P1:PRES:LOOP:TSET:} + hsetprop ${scobj_hpath}/pres5/setpoint noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/setpoint check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/setpoint driving 0 + hsetprop ${scobj_hpath}/pres5/setpoint checklimits ${ns}::checklimits ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/setpoint halt ${ns}::halt ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/setpoint driveable pres5/sensor + hsetprop ${scobj_hpath}/pres5/setpoint control true + hsetprop ${scobj_hpath}/pres5/setpoint data true + hsetprop ${scobj_hpath}/pres5/setpoint mutable true + hsetprop ${scobj_hpath}/pres5/setpoint nxsave true + hsetprop ${scobj_hpath}/pres5/setpoint lowerlimit 0 + hsetprop ${scobj_hpath}/pres5/setpoint upperlimit 333 + hsetprop ${scobj_hpath}/pres5/setpoint tolerance ${ptol} + hsetprop ${scobj_hpath}/pres5/setpoint units mB + hsetprop ${scobj_hpath}/pres5/setpoint permlink data_set "P[format "%02d" ${id}]PSP05" + hsetprop ${scobj_hpath}/pres5/setpoint @description "P[format "%02d" ${id}]PSP05" + hsetprop ${scobj_hpath}/pres5/setpoint oldval 0.0 + hsetprop ${scobj_hpath}/pres5/setpoint klass "parameter" + hsetprop ${scobj_hpath}/pres5/setpoint sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres5/setpoint settle_time "15" + hsetprop ${scobj_hpath}/pres5/setpoint type "drivable" + hsetprop ${scobj_hpath}/pres5/setpoint nxalias "${name}_pres5_setpoint" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres5/setpoint 5 + ${sct_controller} write ${scobj_hpath}/pres5/setpoint + hsetprop ${scobj_hpath}/pres5/setpoint simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres5/setpoint simulated true + } + } + + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 4] 4]} { + hfactory ${scobj_hpath}/pres5/valve plain user float + hsetprop ${scobj_hpath}/pres5/valve read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB4.G1:AUX:SIG:PERC} + hsetprop ${scobj_hpath}/pres5/valve rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/pres5/valve control true + hsetprop ${scobj_hpath}/pres5/valve data true + hsetprop ${scobj_hpath}/pres5/valve mutable true + hsetprop ${scobj_hpath}/pres5/valve nxsave true + hsetprop ${scobj_hpath}/pres5/valve oldval 0.0 + hsetprop ${scobj_hpath}/pres5/valve klass "parameter" + hsetprop ${scobj_hpath}/pres5/valve sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres5/valve type "part" + hsetprop ${scobj_hpath}/pres5/valve nxalias "${name}_pres5_valve" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres5/valve 5 + hsetprop ${scobj_hpath}/pres5/valve simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres5/valve simulated true + } + } + hsetprop ${scobj_hpath}/pres5 data "true" + hsetprop ${scobj_hpath}/pres5 klass "@none" + hsetprop ${scobj_hpath}/pres5 type "part" + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 4] 4]} { + ansto_makesctdrive ${name}_pres5_setpoint ${scobj_hpath}/pres5/setpoint ${scobj_hpath}/pres5/sensor ${sct_controller} + } + } + + if {[string equal -nocase [string index ${cards} 7] P]} { + hfactory ${scobj_hpath}/pres8 plain spy none + + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 7] 4]} { + hfactory ${scobj_hpath}/pres8/auto plain user int + hsetprop ${scobj_hpath}/pres8/auto read ${ns}::getValue ${scobj_hpath} rdOnOff {READ:DEV:DB8.P1:PRES:LOOP:FAUT} + hsetprop ${scobj_hpath}/pres8/auto rdOnOff ${ns}::rdOnOff ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/auto write ${ns}::wrOnOff ${scobj_hpath} noResponse {SET:DEV:DB8.P1:PRES:LOOP:FAUT:} + hsetprop ${scobj_hpath}/pres8/auto noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/auto check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/auto control true + hsetprop ${scobj_hpath}/pres8/auto data true + hsetprop ${scobj_hpath}/pres8/auto mutable true + hsetprop ${scobj_hpath}/pres8/auto nxsave true + hsetprop ${scobj_hpath}/pres8/auto values 0,1 + hsetprop ${scobj_hpath}/pres8/auto oldval 0 + hsetprop ${scobj_hpath}/pres8/auto klass "parameter" + hsetprop ${scobj_hpath}/pres8/auto sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres8/auto type "part" + hsetprop ${scobj_hpath}/pres8/auto nxalias "${name}_pres8_auto" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres8/auto 5 + ${sct_controller} write ${scobj_hpath}/pres8/auto + hsetprop ${scobj_hpath}/pres8/auto simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres8/auto simulated true + } + } + + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 7] 4]} { + hfactory ${scobj_hpath}/pres8/enab plain user int + hsetprop ${scobj_hpath}/pres8/enab read ${ns}::getValue ${scobj_hpath} rdOnOff {READ:DEV:DB8.P1:PRES:LOOP:ENAB} + hsetprop ${scobj_hpath}/pres8/enab rdOnOff ${ns}::rdOnOff ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/enab write ${ns}::wrOnOff ${scobj_hpath} noResponse {SET:DEV:DB8.P1:PRES:LOOP:ENAB:} + hsetprop ${scobj_hpath}/pres8/enab noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/enab check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/enab control true + hsetprop ${scobj_hpath}/pres8/enab data true + hsetprop ${scobj_hpath}/pres8/enab mutable true + hsetprop ${scobj_hpath}/pres8/enab nxsave true + hsetprop ${scobj_hpath}/pres8/enab values 0,1 + hsetprop ${scobj_hpath}/pres8/enab oldval 0 + hsetprop ${scobj_hpath}/pres8/enab klass "parameter" + hsetprop ${scobj_hpath}/pres8/enab sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres8/enab type "part" + hsetprop ${scobj_hpath}/pres8/enab nxalias "${name}_pres8_enab" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres8/enab 5 + ${sct_controller} write ${scobj_hpath}/pres8/enab + hsetprop ${scobj_hpath}/pres8/enab simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres8/enab simulated true + } + } + + hfactory ${scobj_hpath}/pres8/fset plain user float + hsetprop ${scobj_hpath}/pres8/fset read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.P1:PRES:LOOP:FSET} + hsetprop ${scobj_hpath}/pres8/fset rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/fset write ${ns}::setValue ${scobj_hpath} noResponse {SET:DEV:DB8.P1:PRES:LOOP:FSET:} + hsetprop ${scobj_hpath}/pres8/fset noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/fset check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/fset control true + hsetprop ${scobj_hpath}/pres8/fset data true + hsetprop ${scobj_hpath}/pres8/fset mutable true + hsetprop ${scobj_hpath}/pres8/fset nxsave true + hsetprop ${scobj_hpath}/pres8/fset lowerlimit 0 + hsetprop ${scobj_hpath}/pres8/fset upperlimit 100 + hsetprop ${scobj_hpath}/pres8/fset oldval 0.0 + hsetprop ${scobj_hpath}/pres8/fset klass "parameter" + hsetprop ${scobj_hpath}/pres8/fset sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres8/fset type "part" + hsetprop ${scobj_hpath}/pres8/fset nxalias "${name}_pres8_fset" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres8/fset 5 + ${sct_controller} write ${scobj_hpath}/pres8/fset + hsetprop ${scobj_hpath}/pres8/fset simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres8/fset simulated true + } + + hfactory ${scobj_hpath}/pres8/nick plain user text + hsetprop ${scobj_hpath}/pres8/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB8.P1:PRES:NICK} + hsetprop ${scobj_hpath}/pres8/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/nick control true + hsetprop ${scobj_hpath}/pres8/nick data true + hsetprop ${scobj_hpath}/pres8/nick mutable true + hsetprop ${scobj_hpath}/pres8/nick nxsave true + hsetprop ${scobj_hpath}/pres8/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/pres8/nick klass "parameter" + hsetprop ${scobj_hpath}/pres8/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres8/nick type "part" + hsetprop ${scobj_hpath}/pres8/nick nxalias "${name}_pres8_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres8/nick 15 + hsetprop ${scobj_hpath}/pres8/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres8/nick simulated true + } + + hfactory ${scobj_hpath}/pres8/sensor plain user float + hsetprop ${scobj_hpath}/pres8/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.P1:PRES:SIG:PRES} + hsetprop ${scobj_hpath}/pres8/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/sensor control true + hsetprop ${scobj_hpath}/pres8/sensor data true + hsetprop ${scobj_hpath}/pres8/sensor mutable true + hsetprop ${scobj_hpath}/pres8/sensor nxsave true + hsetprop ${scobj_hpath}/pres8/sensor units mB + hsetprop ${scobj_hpath}/pres8/sensor permlink data_set "P[format "%02d" ${id}]PS08" + hsetprop ${scobj_hpath}/pres8/sensor @description "P[format "%02d" ${id}]PS08" + hsetprop ${scobj_hpath}/pres8/sensor oldval 0.0 + hsetprop ${scobj_hpath}/pres8/sensor klass "parameter" + hsetprop ${scobj_hpath}/pres8/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres8/sensor type "part" + hsetprop ${scobj_hpath}/pres8/sensor nxalias "${name}_pres8_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres8/sensor 1 + hsetprop ${scobj_hpath}/pres8/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres8/sensor simulated true + } + + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 7] 4]} { + hfactory ${scobj_hpath}/pres8/setpoint plain user float + hsetprop ${scobj_hpath}/pres8/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.P1:PRES:LOOP:TSET} + hsetprop ${scobj_hpath}/pres8/setpoint rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/setpoint write ${ns}::setPoint ${scobj_hpath} noResponse {SET:DEV:DB8.P1:PRES:LOOP:TSET:} + hsetprop ${scobj_hpath}/pres8/setpoint noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/setpoint check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/setpoint driving 0 + hsetprop ${scobj_hpath}/pres8/setpoint checklimits ${ns}::checklimits ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/setpoint halt ${ns}::halt ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/setpoint driveable pres8/sensor + hsetprop ${scobj_hpath}/pres8/setpoint control true + hsetprop ${scobj_hpath}/pres8/setpoint data true + hsetprop ${scobj_hpath}/pres8/setpoint mutable true + hsetprop ${scobj_hpath}/pres8/setpoint nxsave true + hsetprop ${scobj_hpath}/pres8/setpoint lowerlimit 0 + hsetprop ${scobj_hpath}/pres8/setpoint upperlimit 333 + hsetprop ${scobj_hpath}/pres8/setpoint tolerance ${ptol} + hsetprop ${scobj_hpath}/pres8/setpoint units mB + hsetprop ${scobj_hpath}/pres8/setpoint permlink data_set "P[format "%02d" ${id}]PSP08" + hsetprop ${scobj_hpath}/pres8/setpoint @description "P[format "%02d" ${id}]PSP08" + hsetprop ${scobj_hpath}/pres8/setpoint oldval 0.0 + hsetprop ${scobj_hpath}/pres8/setpoint klass "parameter" + hsetprop ${scobj_hpath}/pres8/setpoint sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres8/setpoint settle_time "15" + hsetprop ${scobj_hpath}/pres8/setpoint type "drivable" + hsetprop ${scobj_hpath}/pres8/setpoint nxalias "${name}_pres8_setpoint" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres8/setpoint 5 + ${sct_controller} write ${scobj_hpath}/pres8/setpoint + hsetprop ${scobj_hpath}/pres8/setpoint simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres8/setpoint simulated true + } + } + + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 7] 4]} { + hfactory ${scobj_hpath}/pres8/valve plain user float + hsetprop ${scobj_hpath}/pres8/valve read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB4.G1:AUX:SIG:PERC} + hsetprop ${scobj_hpath}/pres8/valve rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/pres8/valve control true + hsetprop ${scobj_hpath}/pres8/valve data true + hsetprop ${scobj_hpath}/pres8/valve mutable true + hsetprop ${scobj_hpath}/pres8/valve nxsave true + hsetprop ${scobj_hpath}/pres8/valve oldval 0.0 + hsetprop ${scobj_hpath}/pres8/valve klass "parameter" + hsetprop ${scobj_hpath}/pres8/valve sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/pres8/valve type "part" + hsetprop ${scobj_hpath}/pres8/valve nxalias "${name}_pres8_valve" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pres8/valve 5 + hsetprop ${scobj_hpath}/pres8/valve simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/pres8/valve simulated true + } + } + hsetprop ${scobj_hpath}/pres8 data "true" + hsetprop ${scobj_hpath}/pres8 klass "@none" + hsetprop ${scobj_hpath}/pres8 type "part" + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 7] 4]} { + ansto_makesctdrive ${name}_pres8_setpoint ${scobj_hpath}/pres8/setpoint ${scobj_hpath}/pres8/sensor ${sct_controller} + } + } + + hfactory ${scobj_hpath}/temp0 plain spy none + + hfactory ${scobj_hpath}/temp0/auto plain user int + hsetprop ${scobj_hpath}/temp0/auto read ${ns}::getValue ${scobj_hpath} rdOnOff {READ:DEV:MB1.T1:TEMP:LOOP:ENAB} + hsetprop ${scobj_hpath}/temp0/auto rdOnOff ${ns}::rdOnOff ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/auto write ${ns}::wrOnOff ${scobj_hpath} noResponse {SET:DEV:MB1.T1:TEMP:LOOP:ENAB:} + hsetprop ${scobj_hpath}/temp0/auto noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/auto check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/auto control true + hsetprop ${scobj_hpath}/temp0/auto data true + hsetprop ${scobj_hpath}/temp0/auto mutable true + hsetprop ${scobj_hpath}/temp0/auto nxsave true + hsetprop ${scobj_hpath}/temp0/auto values 0,1 + hsetprop ${scobj_hpath}/temp0/auto oldval 0 + hsetprop ${scobj_hpath}/temp0/auto klass "parameter" + hsetprop ${scobj_hpath}/temp0/auto sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp0/auto type "part" + hsetprop ${scobj_hpath}/temp0/auto nxalias "${name}_temp0_auto" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp0/auto 5 + ${sct_controller} write ${scobj_hpath}/temp0/auto + hsetprop ${scobj_hpath}/temp0/auto simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp0/auto simulated true + } + + hfactory ${scobj_hpath}/temp0/nick plain user text + hsetprop ${scobj_hpath}/temp0/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:MB1.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/temp0/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/nick control true + hsetprop ${scobj_hpath}/temp0/nick data true + hsetprop ${scobj_hpath}/temp0/nick mutable true + hsetprop ${scobj_hpath}/temp0/nick nxsave true + hsetprop ${scobj_hpath}/temp0/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/temp0/nick klass "parameter" + hsetprop ${scobj_hpath}/temp0/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp0/nick type "part" + hsetprop ${scobj_hpath}/temp0/nick nxalias "${name}_temp0_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp0/nick 15 + hsetprop ${scobj_hpath}/temp0/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp0/nick simulated true + } + + hfactory ${scobj_hpath}/temp0/sensor plain user float + hsetprop ${scobj_hpath}/temp0/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:MB1.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/temp0/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/sensor control true + hsetprop ${scobj_hpath}/temp0/sensor data true + hsetprop ${scobj_hpath}/temp0/sensor mutable true + hsetprop ${scobj_hpath}/temp0/sensor nxsave true + hsetprop ${scobj_hpath}/temp0/sensor permlink data_set "T[format "%02d" ${id}]S00" + hsetprop ${scobj_hpath}/temp0/sensor @description "T[format "%02d" ${id}]S00" + hsetprop ${scobj_hpath}/temp0/sensor oldval 0.0 + hsetprop ${scobj_hpath}/temp0/sensor klass "parameter" + hsetprop ${scobj_hpath}/temp0/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp0/sensor type "part" + hsetprop ${scobj_hpath}/temp0/sensor nxalias "${name}_temp0_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp0/sensor 1 + hsetprop ${scobj_hpath}/temp0/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp0/sensor simulated true + } + + hfactory ${scobj_hpath}/temp0/setpoint plain user float + hsetprop ${scobj_hpath}/temp0/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:MB1.T1:TEMP:LOOP:TSET} + hsetprop ${scobj_hpath}/temp0/setpoint rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/setpoint write ${ns}::setPoint ${scobj_hpath} noResponse {SET:DEV:MB1.T1:TEMP:LOOP:TSET:} + hsetprop ${scobj_hpath}/temp0/setpoint noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/setpoint check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/setpoint driving 0 + hsetprop ${scobj_hpath}/temp0/setpoint checklimits ${ns}::checklimits ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/setpoint halt ${ns}::halt ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/setpoint driveable temp0/sensor + hsetprop ${scobj_hpath}/temp0/setpoint control true + hsetprop ${scobj_hpath}/temp0/setpoint data true + hsetprop ${scobj_hpath}/temp0/setpoint mutable true + hsetprop ${scobj_hpath}/temp0/setpoint nxsave true + hsetprop ${scobj_hpath}/temp0/setpoint lowerlimit 0 + hsetprop ${scobj_hpath}/temp0/setpoint upperlimit 333 + hsetprop ${scobj_hpath}/temp0/setpoint tolerance ${ttol} + hsetprop ${scobj_hpath}/temp0/setpoint permlink data_set "T[format "%02d" ${id}]SP00" + hsetprop ${scobj_hpath}/temp0/setpoint @description "T[format "%02d" ${id}]SP00" + hsetprop ${scobj_hpath}/temp0/setpoint oldval 0.0 + hsetprop ${scobj_hpath}/temp0/setpoint klass "parameter" + hsetprop ${scobj_hpath}/temp0/setpoint sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp0/setpoint settle_time "15" + hsetprop ${scobj_hpath}/temp0/setpoint type "drivable" + hsetprop ${scobj_hpath}/temp0/setpoint nxalias "${name}_temp0_setpoint" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp0/setpoint 5 + ${sct_controller} write ${scobj_hpath}/temp0/setpoint + hsetprop ${scobj_hpath}/temp0/setpoint simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp0/setpoint simulated true + } + hsetprop ${scobj_hpath}/temp0 data "true" + hsetprop ${scobj_hpath}/temp0 klass "@none" + hsetprop ${scobj_hpath}/temp0 type "part" + + hfactory ${scobj_hpath}/temp0/heater plain spy none + + hfactory ${scobj_hpath}/temp0/heater/hset plain user float + hsetprop ${scobj_hpath}/temp0/heater/hset read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:MB1.T1:TEMP:LOOP:HSET} + hsetprop ${scobj_hpath}/temp0/heater/hset rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/heater/hset write ${ns}::setValue ${scobj_hpath} noResponse {SET:DEV:MB1.T1:TEMP:LOOP:HSET:} + hsetprop ${scobj_hpath}/temp0/heater/hset noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/heater/hset check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/heater/hset control true + hsetprop ${scobj_hpath}/temp0/heater/hset data true + hsetprop ${scobj_hpath}/temp0/heater/hset mutable true + hsetprop ${scobj_hpath}/temp0/heater/hset nxsave true + hsetprop ${scobj_hpath}/temp0/heater/hset lowerlimit 0 + hsetprop ${scobj_hpath}/temp0/heater/hset upperlimit 100 + hsetprop ${scobj_hpath}/temp0/heater/hset oldval 0.0 + hsetprop ${scobj_hpath}/temp0/heater/hset klass "parameter" + hsetprop ${scobj_hpath}/temp0/heater/hset sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp0/heater/hset type "part" + hsetprop ${scobj_hpath}/temp0/heater/hset nxalias "${name}_temp0_heater_hset" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp0/heater/hset 5 + ${sct_controller} write ${scobj_hpath}/temp0/heater/hset + hsetprop ${scobj_hpath}/temp0/heater/hset simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp0/heater/hset simulated true + } + + hfactory ${scobj_hpath}/temp0/heater/perc plain user float + hsetprop ${scobj_hpath}/temp0/heater/perc read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:MB0.H1:HTR:SIG:PERC} + hsetprop ${scobj_hpath}/temp0/heater/perc rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/heater/perc control true + hsetprop ${scobj_hpath}/temp0/heater/perc data true + hsetprop ${scobj_hpath}/temp0/heater/perc mutable true + hsetprop ${scobj_hpath}/temp0/heater/perc nxsave true + hsetprop ${scobj_hpath}/temp0/heater/perc oldval 0.0 + hsetprop ${scobj_hpath}/temp0/heater/perc klass "parameter" + hsetprop ${scobj_hpath}/temp0/heater/perc sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp0/heater/perc type "part" + hsetprop ${scobj_hpath}/temp0/heater/perc nxalias "${name}_temp0_heater_perc" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp0/heater/perc 5 + hsetprop ${scobj_hpath}/temp0/heater/perc simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp0/heater/perc simulated true + } + + hfactory ${scobj_hpath}/temp0/heater/power plain user float + hsetprop ${scobj_hpath}/temp0/heater/power read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:MB0.H1:HTR:SIG:POWR} + hsetprop ${scobj_hpath}/temp0/heater/power rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp0/heater/power control true + hsetprop ${scobj_hpath}/temp0/heater/power data true + hsetprop ${scobj_hpath}/temp0/heater/power mutable true + hsetprop ${scobj_hpath}/temp0/heater/power nxsave true + hsetprop ${scobj_hpath}/temp0/heater/power oldval 0.0 + hsetprop ${scobj_hpath}/temp0/heater/power klass "parameter" + hsetprop ${scobj_hpath}/temp0/heater/power sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp0/heater/power type "part" + hsetprop ${scobj_hpath}/temp0/heater/power nxalias "${name}_temp0_heater_power" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp0/heater/power 5 + hsetprop ${scobj_hpath}/temp0/heater/power simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp0/heater/power simulated true + } + hsetprop ${scobj_hpath}/temp0/heater data "true" + hsetprop ${scobj_hpath}/temp0/heater klass "@none" + hsetprop ${scobj_hpath}/temp0/heater type "part" + ansto_makesctdrive ${name}_temp0_setpoint ${scobj_hpath}/temp0/setpoint ${scobj_hpath}/temp0/sensor ${sct_controller} + + if {[string equal -nocase [string index ${cards} 0] T]} { + hfactory ${scobj_hpath}/temp1 plain spy none + + hfactory ${scobj_hpath}/temp1/nick plain user text + hsetprop ${scobj_hpath}/temp1/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB1.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/temp1/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/temp1/nick control true + hsetprop ${scobj_hpath}/temp1/nick data true + hsetprop ${scobj_hpath}/temp1/nick mutable true + hsetprop ${scobj_hpath}/temp1/nick nxsave true + hsetprop ${scobj_hpath}/temp1/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/temp1/nick klass "parameter" + hsetprop ${scobj_hpath}/temp1/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp1/nick type "part" + hsetprop ${scobj_hpath}/temp1/nick nxalias "${name}_temp1_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp1/nick 15 + hsetprop ${scobj_hpath}/temp1/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp1/nick simulated true + } + + hfactory ${scobj_hpath}/temp1/sensor plain user float + hsetprop ${scobj_hpath}/temp1/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB1.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/temp1/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp1/sensor control true + hsetprop ${scobj_hpath}/temp1/sensor data true + hsetprop ${scobj_hpath}/temp1/sensor mutable true + hsetprop ${scobj_hpath}/temp1/sensor nxsave true + hsetprop ${scobj_hpath}/temp1/sensor permlink data_set "T[format "%02d" ${id}]S01" + hsetprop ${scobj_hpath}/temp1/sensor @description "T[format "%02d" ${id}]S01" + hsetprop ${scobj_hpath}/temp1/sensor oldval 0.0 + hsetprop ${scobj_hpath}/temp1/sensor klass "parameter" + hsetprop ${scobj_hpath}/temp1/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp1/sensor type "part" + hsetprop ${scobj_hpath}/temp1/sensor nxalias "${name}_temp1_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp1/sensor 1 + hsetprop ${scobj_hpath}/temp1/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp1/sensor simulated true + } + hsetprop ${scobj_hpath}/temp1 data "true" + hsetprop ${scobj_hpath}/temp1 klass "@none" + hsetprop ${scobj_hpath}/temp1 type "part" + } + + if {[string equal -nocase [string index ${cards} 1] T]} { + hfactory ${scobj_hpath}/temp2 plain spy none + + hfactory ${scobj_hpath}/temp2/nick plain user text + hsetprop ${scobj_hpath}/temp2/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB2.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/temp2/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/temp2/nick control true + hsetprop ${scobj_hpath}/temp2/nick data true + hsetprop ${scobj_hpath}/temp2/nick mutable true + hsetprop ${scobj_hpath}/temp2/nick nxsave true + hsetprop ${scobj_hpath}/temp2/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/temp2/nick klass "parameter" + hsetprop ${scobj_hpath}/temp2/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp2/nick type "part" + hsetprop ${scobj_hpath}/temp2/nick nxalias "${name}_temp2_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp2/nick 15 + hsetprop ${scobj_hpath}/temp2/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp2/nick simulated true + } + + hfactory ${scobj_hpath}/temp2/sensor plain user float + hsetprop ${scobj_hpath}/temp2/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB2.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/temp2/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp2/sensor control true + hsetprop ${scobj_hpath}/temp2/sensor data true + hsetprop ${scobj_hpath}/temp2/sensor mutable true + hsetprop ${scobj_hpath}/temp2/sensor nxsave true + hsetprop ${scobj_hpath}/temp2/sensor permlink data_set "T[format "%02d" ${id}]S02" + hsetprop ${scobj_hpath}/temp2/sensor @description "T[format "%02d" ${id}]S02" + hsetprop ${scobj_hpath}/temp2/sensor oldval 0.0 + hsetprop ${scobj_hpath}/temp2/sensor klass "parameter" + hsetprop ${scobj_hpath}/temp2/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp2/sensor type "part" + hsetprop ${scobj_hpath}/temp2/sensor nxalias "${name}_temp2_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp2/sensor 1 + hsetprop ${scobj_hpath}/temp2/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp2/sensor simulated true + } + hsetprop ${scobj_hpath}/temp2 data "true" + hsetprop ${scobj_hpath}/temp2 klass "@none" + hsetprop ${scobj_hpath}/temp2 type "part" + } + + if {[string equal -nocase [string index ${cards} 2] T]} { + hfactory ${scobj_hpath}/temp3 plain spy none + + hfactory ${scobj_hpath}/temp3/nick plain user text + hsetprop ${scobj_hpath}/temp3/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB3.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/temp3/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/temp3/nick control true + hsetprop ${scobj_hpath}/temp3/nick data true + hsetprop ${scobj_hpath}/temp3/nick mutable true + hsetprop ${scobj_hpath}/temp3/nick nxsave true + hsetprop ${scobj_hpath}/temp3/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/temp3/nick klass "parameter" + hsetprop ${scobj_hpath}/temp3/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp3/nick type "part" + hsetprop ${scobj_hpath}/temp3/nick nxalias "${name}_temp3_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp3/nick 15 + hsetprop ${scobj_hpath}/temp3/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp3/nick simulated true + } + + hfactory ${scobj_hpath}/temp3/sensor plain user float + hsetprop ${scobj_hpath}/temp3/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB3.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/temp3/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp3/sensor control true + hsetprop ${scobj_hpath}/temp3/sensor data true + hsetprop ${scobj_hpath}/temp3/sensor mutable true + hsetprop ${scobj_hpath}/temp3/sensor nxsave true + hsetprop ${scobj_hpath}/temp3/sensor permlink data_set "T[format "%02d" ${id}]S03" + hsetprop ${scobj_hpath}/temp3/sensor @description "T[format "%02d" ${id}]S03" + hsetprop ${scobj_hpath}/temp3/sensor oldval 0.0 + hsetprop ${scobj_hpath}/temp3/sensor klass "parameter" + hsetprop ${scobj_hpath}/temp3/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp3/sensor type "part" + hsetprop ${scobj_hpath}/temp3/sensor nxalias "${name}_temp3_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp3/sensor 1 + hsetprop ${scobj_hpath}/temp3/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp3/sensor simulated true + } + hsetprop ${scobj_hpath}/temp3 data "true" + hsetprop ${scobj_hpath}/temp3 klass "@none" + hsetprop ${scobj_hpath}/temp3 type "part" + } + + if {[string equal -nocase [string index ${cards} 3] T]} { + hfactory ${scobj_hpath}/temp4 plain spy none + + hfactory ${scobj_hpath}/temp4/nick plain user text + hsetprop ${scobj_hpath}/temp4/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB4.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/temp4/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/temp4/nick control true + hsetprop ${scobj_hpath}/temp4/nick data true + hsetprop ${scobj_hpath}/temp4/nick mutable true + hsetprop ${scobj_hpath}/temp4/nick nxsave true + hsetprop ${scobj_hpath}/temp4/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/temp4/nick klass "parameter" + hsetprop ${scobj_hpath}/temp4/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp4/nick type "part" + hsetprop ${scobj_hpath}/temp4/nick nxalias "${name}_temp4_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp4/nick 15 + hsetprop ${scobj_hpath}/temp4/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp4/nick simulated true + } + + hfactory ${scobj_hpath}/temp4/sensor plain user float + hsetprop ${scobj_hpath}/temp4/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB4.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/temp4/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp4/sensor control true + hsetprop ${scobj_hpath}/temp4/sensor data true + hsetprop ${scobj_hpath}/temp4/sensor mutable true + hsetprop ${scobj_hpath}/temp4/sensor nxsave true + hsetprop ${scobj_hpath}/temp4/sensor permlink data_set "T[format "%02d" ${id}]S04" + hsetprop ${scobj_hpath}/temp4/sensor @description "T[format "%02d" ${id}]S04" + hsetprop ${scobj_hpath}/temp4/sensor oldval 0.0 + hsetprop ${scobj_hpath}/temp4/sensor klass "parameter" + hsetprop ${scobj_hpath}/temp4/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp4/sensor type "part" + hsetprop ${scobj_hpath}/temp4/sensor nxalias "${name}_temp4_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp4/sensor 1 + hsetprop ${scobj_hpath}/temp4/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp4/sensor simulated true + } + hsetprop ${scobj_hpath}/temp4 data "true" + hsetprop ${scobj_hpath}/temp4 klass "@none" + hsetprop ${scobj_hpath}/temp4 type "part" + } + + if {[string equal -nocase [string index ${cards} 4] T]} { + hfactory ${scobj_hpath}/temp5 plain spy none + + hfactory ${scobj_hpath}/temp5/nick plain user text + hsetprop ${scobj_hpath}/temp5/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB5.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/temp5/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/temp5/nick control true + hsetprop ${scobj_hpath}/temp5/nick data true + hsetprop ${scobj_hpath}/temp5/nick mutable true + hsetprop ${scobj_hpath}/temp5/nick nxsave true + hsetprop ${scobj_hpath}/temp5/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/temp5/nick klass "parameter" + hsetprop ${scobj_hpath}/temp5/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp5/nick type "part" + hsetprop ${scobj_hpath}/temp5/nick nxalias "${name}_temp5_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp5/nick 15 + hsetprop ${scobj_hpath}/temp5/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp5/nick simulated true + } + + hfactory ${scobj_hpath}/temp5/sensor plain user float + hsetprop ${scobj_hpath}/temp5/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB5.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/temp5/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp5/sensor control true + hsetprop ${scobj_hpath}/temp5/sensor data true + hsetprop ${scobj_hpath}/temp5/sensor mutable true + hsetprop ${scobj_hpath}/temp5/sensor nxsave true + hsetprop ${scobj_hpath}/temp5/sensor permlink data_set "T[format "%02d" ${id}]S05" + hsetprop ${scobj_hpath}/temp5/sensor @description "T[format "%02d" ${id}]S05" + hsetprop ${scobj_hpath}/temp5/sensor oldval 0.0 + hsetprop ${scobj_hpath}/temp5/sensor klass "parameter" + hsetprop ${scobj_hpath}/temp5/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp5/sensor type "part" + hsetprop ${scobj_hpath}/temp5/sensor nxalias "${name}_temp5_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp5/sensor 1 + hsetprop ${scobj_hpath}/temp5/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp5/sensor simulated true + } + hsetprop ${scobj_hpath}/temp5 data "true" + hsetprop ${scobj_hpath}/temp5 klass "@none" + hsetprop ${scobj_hpath}/temp5 type "part" + } + + if {[string equal -nocase [string index ${cards} 5] T]} { + hfactory ${scobj_hpath}/temp6 plain spy none + + if {[string equal -nocase [string index ${cards} 0] H] && [string equal -nocase [string index ${assoc} 5] 1]} { + hfactory ${scobj_hpath}/temp6/auto plain user int + hsetprop ${scobj_hpath}/temp6/auto read ${ns}::getValue ${scobj_hpath} rdOnOff {READ:DEV:DB6.T1:TEMP:LOOP:ENAB} + hsetprop ${scobj_hpath}/temp6/auto rdOnOff ${ns}::rdOnOff ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/auto write ${ns}::wrOnOff ${scobj_hpath} noResponse {SET:DEV:DB6.T1:TEMP:LOOP:ENAB:} + hsetprop ${scobj_hpath}/temp6/auto noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/auto check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/auto control true + hsetprop ${scobj_hpath}/temp6/auto data true + hsetprop ${scobj_hpath}/temp6/auto mutable true + hsetprop ${scobj_hpath}/temp6/auto nxsave true + hsetprop ${scobj_hpath}/temp6/auto values 0,1 + hsetprop ${scobj_hpath}/temp6/auto oldval 0 + hsetprop ${scobj_hpath}/temp6/auto klass "parameter" + hsetprop ${scobj_hpath}/temp6/auto sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp6/auto type "part" + hsetprop ${scobj_hpath}/temp6/auto nxalias "${name}_temp6_auto" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp6/auto 5 + ${sct_controller} write ${scobj_hpath}/temp6/auto + hsetprop ${scobj_hpath}/temp6/auto simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp6/auto simulated true + } + } + + hfactory ${scobj_hpath}/temp6/nick plain user text + hsetprop ${scobj_hpath}/temp6/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB6.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/temp6/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/nick control true + hsetprop ${scobj_hpath}/temp6/nick data true + hsetprop ${scobj_hpath}/temp6/nick mutable true + hsetprop ${scobj_hpath}/temp6/nick nxsave true + hsetprop ${scobj_hpath}/temp6/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/temp6/nick klass "parameter" + hsetprop ${scobj_hpath}/temp6/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp6/nick type "part" + hsetprop ${scobj_hpath}/temp6/nick nxalias "${name}_temp6_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp6/nick 15 + hsetprop ${scobj_hpath}/temp6/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp6/nick simulated true + } + + hfactory ${scobj_hpath}/temp6/sensor plain user float + hsetprop ${scobj_hpath}/temp6/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB6.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/temp6/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/sensor control true + hsetprop ${scobj_hpath}/temp6/sensor data true + hsetprop ${scobj_hpath}/temp6/sensor mutable true + hsetprop ${scobj_hpath}/temp6/sensor nxsave true + hsetprop ${scobj_hpath}/temp6/sensor permlink data_set "T[format "%02d" ${id}]S06" + hsetprop ${scobj_hpath}/temp6/sensor @description "T[format "%02d" ${id}]S06" + hsetprop ${scobj_hpath}/temp6/sensor oldval 0.0 + hsetprop ${scobj_hpath}/temp6/sensor klass "parameter" + hsetprop ${scobj_hpath}/temp6/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp6/sensor type "part" + hsetprop ${scobj_hpath}/temp6/sensor nxalias "${name}_temp6_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp6/sensor 1 + hsetprop ${scobj_hpath}/temp6/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp6/sensor simulated true + } + + if {[string equal -nocase [string index ${cards} 0] H] && [string equal -nocase [string index ${assoc} 5] 1]} { + hfactory ${scobj_hpath}/temp6/setpoint plain user float + hsetprop ${scobj_hpath}/temp6/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB6.T1:TEMP:LOOP:TSET} + hsetprop ${scobj_hpath}/temp6/setpoint rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/setpoint write ${ns}::setPoint ${scobj_hpath} noResponse {SET:DEV:DB6.T1:TEMP:LOOP:TSET:} + hsetprop ${scobj_hpath}/temp6/setpoint noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/setpoint check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/setpoint driving 0 + hsetprop ${scobj_hpath}/temp6/setpoint checklimits ${ns}::checklimits ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/setpoint halt ${ns}::halt ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/setpoint driveable temp6/sensor + hsetprop ${scobj_hpath}/temp6/setpoint control true + hsetprop ${scobj_hpath}/temp6/setpoint data true + hsetprop ${scobj_hpath}/temp6/setpoint mutable true + hsetprop ${scobj_hpath}/temp6/setpoint nxsave true + hsetprop ${scobj_hpath}/temp6/setpoint lowerlimit 0 + hsetprop ${scobj_hpath}/temp6/setpoint upperlimit 333 + hsetprop ${scobj_hpath}/temp6/setpoint tolerance ${ttol} + hsetprop ${scobj_hpath}/temp6/setpoint permlink data_set "T[format "%02d" ${id}]SP06" + hsetprop ${scobj_hpath}/temp6/setpoint @description "T[format "%02d" ${id}]SP06" + hsetprop ${scobj_hpath}/temp6/setpoint oldval 0.0 + hsetprop ${scobj_hpath}/temp6/setpoint klass "parameter" + hsetprop ${scobj_hpath}/temp6/setpoint sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp6/setpoint settle_time "15" + hsetprop ${scobj_hpath}/temp6/setpoint type "drivable" + hsetprop ${scobj_hpath}/temp6/setpoint nxalias "${name}_temp6_setpoint" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp6/setpoint 5 + ${sct_controller} write ${scobj_hpath}/temp6/setpoint + hsetprop ${scobj_hpath}/temp6/setpoint simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp6/setpoint simulated true + } + } + hsetprop ${scobj_hpath}/temp6 data "true" + hsetprop ${scobj_hpath}/temp6 klass "@none" + hsetprop ${scobj_hpath}/temp6 type "part" + + if {[string equal -nocase [string index ${cards} 0] H] && [string equal -nocase [string index ${assoc} 5] 1]} { + hfactory ${scobj_hpath}/temp6/heater plain spy none + + hfactory ${scobj_hpath}/temp6/heater/hset plain user float + hsetprop ${scobj_hpath}/temp6/heater/hset read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB6.T1:TEMP:LOOP:HSET} + hsetprop ${scobj_hpath}/temp6/heater/hset rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/heater/hset write ${ns}::setValue ${scobj_hpath} noResponse {SET:DEV:DB6.T1:TEMP:LOOP:HSET:} + hsetprop ${scobj_hpath}/temp6/heater/hset noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/heater/hset check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/heater/hset control true + hsetprop ${scobj_hpath}/temp6/heater/hset data true + hsetprop ${scobj_hpath}/temp6/heater/hset mutable true + hsetprop ${scobj_hpath}/temp6/heater/hset nxsave true + hsetprop ${scobj_hpath}/temp6/heater/hset lowerlimit 0 + hsetprop ${scobj_hpath}/temp6/heater/hset upperlimit 100 + hsetprop ${scobj_hpath}/temp6/heater/hset oldval 0.0 + hsetprop ${scobj_hpath}/temp6/heater/hset klass "parameter" + hsetprop ${scobj_hpath}/temp6/heater/hset sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp6/heater/hset type "part" + hsetprop ${scobj_hpath}/temp6/heater/hset nxalias "${name}_temp6_heater_hset" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp6/heater/hset 5 + ${sct_controller} write ${scobj_hpath}/temp6/heater/hset + hsetprop ${scobj_hpath}/temp6/heater/hset simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp6/heater/hset simulated true + } + + hfactory ${scobj_hpath}/temp6/heater/perc plain user float + hsetprop ${scobj_hpath}/temp6/heater/perc read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB1.H1:HTR:SIG:PERC} + hsetprop ${scobj_hpath}/temp6/heater/perc rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/heater/perc control true + hsetprop ${scobj_hpath}/temp6/heater/perc data true + hsetprop ${scobj_hpath}/temp6/heater/perc mutable true + hsetprop ${scobj_hpath}/temp6/heater/perc nxsave true + hsetprop ${scobj_hpath}/temp6/heater/perc oldval 0.0 + hsetprop ${scobj_hpath}/temp6/heater/perc klass "parameter" + hsetprop ${scobj_hpath}/temp6/heater/perc sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp6/heater/perc type "part" + hsetprop ${scobj_hpath}/temp6/heater/perc nxalias "${name}_temp6_heater_perc" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp6/heater/perc 5 + hsetprop ${scobj_hpath}/temp6/heater/perc simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp6/heater/perc simulated true + } + + hfactory ${scobj_hpath}/temp6/heater/power plain user float + hsetprop ${scobj_hpath}/temp6/heater/power read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB1.H1:HTR:SIG:POWR} + hsetprop ${scobj_hpath}/temp6/heater/power rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp6/heater/power control true + hsetprop ${scobj_hpath}/temp6/heater/power data true + hsetprop ${scobj_hpath}/temp6/heater/power mutable true + hsetprop ${scobj_hpath}/temp6/heater/power nxsave true + hsetprop ${scobj_hpath}/temp6/heater/power oldval 0.0 + hsetprop ${scobj_hpath}/temp6/heater/power klass "parameter" + hsetprop ${scobj_hpath}/temp6/heater/power sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp6/heater/power type "part" + hsetprop ${scobj_hpath}/temp6/heater/power nxalias "${name}_temp6_heater_power" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp6/heater/power 5 + hsetprop ${scobj_hpath}/temp6/heater/power simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp6/heater/power simulated true + } + hsetprop ${scobj_hpath}/temp6/heater data "true" + hsetprop ${scobj_hpath}/temp6/heater klass "@none" + hsetprop ${scobj_hpath}/temp6/heater type "part" + } + if {[string equal -nocase [string index ${cards} 0] H] && [string equal -nocase [string index ${assoc} 5] 1]} { + ansto_makesctdrive ${name}_temp6_setpoint ${scobj_hpath}/temp6/setpoint ${scobj_hpath}/temp6/sensor ${sct_controller} + } + } + + if {[string equal -nocase [string index ${cards} 6] T]} { + hfactory ${scobj_hpath}/temp7 plain spy none + + if {[string equal -nocase [string index ${cards} 1] H] && [string equal -nocase [string index ${assoc} 6] 2]} { + hfactory ${scobj_hpath}/temp7/auto plain user int + hsetprop ${scobj_hpath}/temp7/auto read ${ns}::getValue ${scobj_hpath} rdOnOff {READ:DEV:DB7.T1:TEMP:LOOP:ENAB} + hsetprop ${scobj_hpath}/temp7/auto rdOnOff ${ns}::rdOnOff ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/auto write ${ns}::wrOnOff ${scobj_hpath} noResponse {SET:DEV:DB7.T1:TEMP:LOOP:ENAB:} + hsetprop ${scobj_hpath}/temp7/auto noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/auto check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/auto control true + hsetprop ${scobj_hpath}/temp7/auto data true + hsetprop ${scobj_hpath}/temp7/auto mutable true + hsetprop ${scobj_hpath}/temp7/auto nxsave true + hsetprop ${scobj_hpath}/temp7/auto values 0,1 + hsetprop ${scobj_hpath}/temp7/auto oldval 0 + hsetprop ${scobj_hpath}/temp7/auto klass "parameter" + hsetprop ${scobj_hpath}/temp7/auto sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp7/auto type "part" + hsetprop ${scobj_hpath}/temp7/auto nxalias "${name}_temp7_auto" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp7/auto 5 + ${sct_controller} write ${scobj_hpath}/temp7/auto + hsetprop ${scobj_hpath}/temp7/auto simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp7/auto simulated true + } + } + + hfactory ${scobj_hpath}/temp7/nick plain user text + hsetprop ${scobj_hpath}/temp7/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB7.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/temp7/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/nick control true + hsetprop ${scobj_hpath}/temp7/nick data true + hsetprop ${scobj_hpath}/temp7/nick mutable true + hsetprop ${scobj_hpath}/temp7/nick nxsave true + hsetprop ${scobj_hpath}/temp7/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/temp7/nick klass "parameter" + hsetprop ${scobj_hpath}/temp7/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp7/nick type "part" + hsetprop ${scobj_hpath}/temp7/nick nxalias "${name}_temp7_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp7/nick 15 + hsetprop ${scobj_hpath}/temp7/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp7/nick simulated true + } + + hfactory ${scobj_hpath}/temp7/sensor plain user float + hsetprop ${scobj_hpath}/temp7/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB7.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/temp7/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/sensor control true + hsetprop ${scobj_hpath}/temp7/sensor data true + hsetprop ${scobj_hpath}/temp7/sensor mutable true + hsetprop ${scobj_hpath}/temp7/sensor nxsave true + hsetprop ${scobj_hpath}/temp7/sensor permlink data_set "T[format "%02d" ${id}]S07" + hsetprop ${scobj_hpath}/temp7/sensor @description "T[format "%02d" ${id}]S07" + hsetprop ${scobj_hpath}/temp7/sensor oldval 0.0 + hsetprop ${scobj_hpath}/temp7/sensor klass "parameter" + hsetprop ${scobj_hpath}/temp7/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp7/sensor type "part" + hsetprop ${scobj_hpath}/temp7/sensor nxalias "${name}_temp7_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp7/sensor 1 + hsetprop ${scobj_hpath}/temp7/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp7/sensor simulated true + } + + if {[string equal -nocase [string index ${cards} 1] H] && [string equal -nocase [string index ${assoc} 6] 2]} { + hfactory ${scobj_hpath}/temp7/setpoint plain user float + hsetprop ${scobj_hpath}/temp7/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB7.T1:TEMP:LOOP:TSET} + hsetprop ${scobj_hpath}/temp7/setpoint rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/setpoint write ${ns}::setPoint ${scobj_hpath} noResponse {SET:DEV:DB7.T1:TEMP:LOOP:TSET:} + hsetprop ${scobj_hpath}/temp7/setpoint noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/setpoint check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/setpoint driving 0 + hsetprop ${scobj_hpath}/temp7/setpoint checklimits ${ns}::checklimits ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/setpoint halt ${ns}::halt ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/setpoint driveable temp7/sensor + hsetprop ${scobj_hpath}/temp7/setpoint control true + hsetprop ${scobj_hpath}/temp7/setpoint data true + hsetprop ${scobj_hpath}/temp7/setpoint mutable true + hsetprop ${scobj_hpath}/temp7/setpoint nxsave true + hsetprop ${scobj_hpath}/temp7/setpoint lowerlimit 0 + hsetprop ${scobj_hpath}/temp7/setpoint upperlimit 333 + hsetprop ${scobj_hpath}/temp7/setpoint tolerance ${ttol} + hsetprop ${scobj_hpath}/temp7/setpoint permlink data_set "T[format "%02d" ${id}]SP07" + hsetprop ${scobj_hpath}/temp7/setpoint @description "T[format "%02d" ${id}]SP07" + hsetprop ${scobj_hpath}/temp7/setpoint oldval 0.0 + hsetprop ${scobj_hpath}/temp7/setpoint klass "parameter" + hsetprop ${scobj_hpath}/temp7/setpoint sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp7/setpoint settle_time "15" + hsetprop ${scobj_hpath}/temp7/setpoint type "drivable" + hsetprop ${scobj_hpath}/temp7/setpoint nxalias "${name}_temp7_setpoint" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp7/setpoint 5 + ${sct_controller} write ${scobj_hpath}/temp7/setpoint + hsetprop ${scobj_hpath}/temp7/setpoint simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp7/setpoint simulated true + } + } + hsetprop ${scobj_hpath}/temp7 data "true" + hsetprop ${scobj_hpath}/temp7 klass "@none" + hsetprop ${scobj_hpath}/temp7 type "part" + + if {[string equal -nocase [string index ${cards} 1] H] && [string equal -nocase [string index ${assoc} 6] 2]} { + hfactory ${scobj_hpath}/temp7/heater plain spy none + + hfactory ${scobj_hpath}/temp7/heater/hset plain user float + hsetprop ${scobj_hpath}/temp7/heater/hset read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB7.T1:TEMP:LOOP:HSET} + hsetprop ${scobj_hpath}/temp7/heater/hset rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/heater/hset write ${ns}::setValue ${scobj_hpath} noResponse {SET:DEV:DB7.T1:TEMP:LOOP:HSET:} + hsetprop ${scobj_hpath}/temp7/heater/hset noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/heater/hset check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/heater/hset control true + hsetprop ${scobj_hpath}/temp7/heater/hset data true + hsetprop ${scobj_hpath}/temp7/heater/hset mutable true + hsetprop ${scobj_hpath}/temp7/heater/hset nxsave true + hsetprop ${scobj_hpath}/temp7/heater/hset lowerlimit 0 + hsetprop ${scobj_hpath}/temp7/heater/hset upperlimit 100 + hsetprop ${scobj_hpath}/temp7/heater/hset oldval 0.0 + hsetprop ${scobj_hpath}/temp7/heater/hset klass "parameter" + hsetprop ${scobj_hpath}/temp7/heater/hset sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp7/heater/hset type "part" + hsetprop ${scobj_hpath}/temp7/heater/hset nxalias "${name}_temp7_heater_hset" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp7/heater/hset 5 + ${sct_controller} write ${scobj_hpath}/temp7/heater/hset + hsetprop ${scobj_hpath}/temp7/heater/hset simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp7/heater/hset simulated true + } + + hfactory ${scobj_hpath}/temp7/heater/perc plain user float + hsetprop ${scobj_hpath}/temp7/heater/perc read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB2.H1:HTR:SIG:PERC} + hsetprop ${scobj_hpath}/temp7/heater/perc rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/heater/perc control true + hsetprop ${scobj_hpath}/temp7/heater/perc data true + hsetprop ${scobj_hpath}/temp7/heater/perc mutable true + hsetprop ${scobj_hpath}/temp7/heater/perc nxsave true + hsetprop ${scobj_hpath}/temp7/heater/perc oldval 0.0 + hsetprop ${scobj_hpath}/temp7/heater/perc klass "parameter" + hsetprop ${scobj_hpath}/temp7/heater/perc sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp7/heater/perc type "part" + hsetprop ${scobj_hpath}/temp7/heater/perc nxalias "${name}_temp7_heater_perc" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp7/heater/perc 5 + hsetprop ${scobj_hpath}/temp7/heater/perc simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp7/heater/perc simulated true + } + + hfactory ${scobj_hpath}/temp7/heater/power plain user float + hsetprop ${scobj_hpath}/temp7/heater/power read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB2.H1:HTR:SIG:POWR} + hsetprop ${scobj_hpath}/temp7/heater/power rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp7/heater/power control true + hsetprop ${scobj_hpath}/temp7/heater/power data true + hsetprop ${scobj_hpath}/temp7/heater/power mutable true + hsetprop ${scobj_hpath}/temp7/heater/power nxsave true + hsetprop ${scobj_hpath}/temp7/heater/power oldval 0.0 + hsetprop ${scobj_hpath}/temp7/heater/power klass "parameter" + hsetprop ${scobj_hpath}/temp7/heater/power sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp7/heater/power type "part" + hsetprop ${scobj_hpath}/temp7/heater/power nxalias "${name}_temp7_heater_power" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp7/heater/power 5 + hsetprop ${scobj_hpath}/temp7/heater/power simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp7/heater/power simulated true + } + hsetprop ${scobj_hpath}/temp7/heater data "true" + hsetprop ${scobj_hpath}/temp7/heater klass "@none" + hsetprop ${scobj_hpath}/temp7/heater type "part" + } + if {[string equal -nocase [string index ${cards} 1] H] && [string equal -nocase [string index ${assoc} 6] 2]} { + ansto_makesctdrive ${name}_temp7_setpoint ${scobj_hpath}/temp7/setpoint ${scobj_hpath}/temp7/sensor ${sct_controller} + } + } + + if {[string equal -nocase [string index ${cards} 7] T]} { + hfactory ${scobj_hpath}/temp8 plain spy none + + if {[string equal -nocase [string index ${cards} 2] H] && [string equal -nocase [string index ${assoc} 7] 3]} { + hfactory ${scobj_hpath}/temp8/auto plain user int + hsetprop ${scobj_hpath}/temp8/auto read ${ns}::getValue ${scobj_hpath} rdOnOff {READ:DEV:DB8.T1:TEMP:LOOP:ENAB} + hsetprop ${scobj_hpath}/temp8/auto rdOnOff ${ns}::rdOnOff ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/auto write ${ns}::wrOnOff ${scobj_hpath} noResponse {SET:DEV:DB8.T1:TEMP:LOOP:ENAB:} + hsetprop ${scobj_hpath}/temp8/auto noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/auto check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/auto control true + hsetprop ${scobj_hpath}/temp8/auto data true + hsetprop ${scobj_hpath}/temp8/auto mutable true + hsetprop ${scobj_hpath}/temp8/auto nxsave true + hsetprop ${scobj_hpath}/temp8/auto values 0,1 + hsetprop ${scobj_hpath}/temp8/auto oldval 0 + hsetprop ${scobj_hpath}/temp8/auto klass "parameter" + hsetprop ${scobj_hpath}/temp8/auto sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp8/auto type "part" + hsetprop ${scobj_hpath}/temp8/auto nxalias "${name}_temp8_auto" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp8/auto 5 + ${sct_controller} write ${scobj_hpath}/temp8/auto + hsetprop ${scobj_hpath}/temp8/auto simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp8/auto simulated true + } + } + + hfactory ${scobj_hpath}/temp8/nick plain user text + hsetprop ${scobj_hpath}/temp8/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB8.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/temp8/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/nick control true + hsetprop ${scobj_hpath}/temp8/nick data true + hsetprop ${scobj_hpath}/temp8/nick mutable true + hsetprop ${scobj_hpath}/temp8/nick nxsave true + hsetprop ${scobj_hpath}/temp8/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/temp8/nick klass "parameter" + hsetprop ${scobj_hpath}/temp8/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp8/nick type "part" + hsetprop ${scobj_hpath}/temp8/nick nxalias "${name}_temp8_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp8/nick 15 + hsetprop ${scobj_hpath}/temp8/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp8/nick simulated true + } + + hfactory ${scobj_hpath}/temp8/sensor plain user float + hsetprop ${scobj_hpath}/temp8/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/temp8/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/sensor control true + hsetprop ${scobj_hpath}/temp8/sensor data true + hsetprop ${scobj_hpath}/temp8/sensor mutable true + hsetprop ${scobj_hpath}/temp8/sensor nxsave true + hsetprop ${scobj_hpath}/temp8/sensor permlink data_set "T[format "%02d" ${id}]S08" + hsetprop ${scobj_hpath}/temp8/sensor @description "T[format "%02d" ${id}]S08" + hsetprop ${scobj_hpath}/temp8/sensor oldval 0.0 + hsetprop ${scobj_hpath}/temp8/sensor klass "parameter" + hsetprop ${scobj_hpath}/temp8/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp8/sensor type "part" + hsetprop ${scobj_hpath}/temp8/sensor nxalias "${name}_temp8_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp8/sensor 1 + hsetprop ${scobj_hpath}/temp8/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp8/sensor simulated true + } + + if {[string equal -nocase [string index ${cards} 2] H] && [string equal -nocase [string index ${assoc} 7] 3]} { + hfactory ${scobj_hpath}/temp8/setpoint plain user float + hsetprop ${scobj_hpath}/temp8/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.T1:TEMP:LOOP:TSET} + hsetprop ${scobj_hpath}/temp8/setpoint rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/setpoint write ${ns}::setPoint ${scobj_hpath} noResponse {SET:DEV:DB8.T1:TEMP:LOOP:TSET:} + hsetprop ${scobj_hpath}/temp8/setpoint noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/setpoint check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/setpoint driving 0 + hsetprop ${scobj_hpath}/temp8/setpoint checklimits ${ns}::checklimits ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/setpoint halt ${ns}::halt ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/setpoint driveable temp8/sensor + hsetprop ${scobj_hpath}/temp8/setpoint control true + hsetprop ${scobj_hpath}/temp8/setpoint data true + hsetprop ${scobj_hpath}/temp8/setpoint mutable true + hsetprop ${scobj_hpath}/temp8/setpoint nxsave true + hsetprop ${scobj_hpath}/temp8/setpoint lowerlimit 0 + hsetprop ${scobj_hpath}/temp8/setpoint upperlimit 333 + hsetprop ${scobj_hpath}/temp8/setpoint tolerance ${ttol} + hsetprop ${scobj_hpath}/temp8/setpoint permlink data_set "T[format "%02d" ${id}]SP08" + hsetprop ${scobj_hpath}/temp8/setpoint @description "T[format "%02d" ${id}]SP08" + hsetprop ${scobj_hpath}/temp8/setpoint oldval 0.0 + hsetprop ${scobj_hpath}/temp8/setpoint klass "parameter" + hsetprop ${scobj_hpath}/temp8/setpoint sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp8/setpoint settle_time "15" + hsetprop ${scobj_hpath}/temp8/setpoint type "drivable" + hsetprop ${scobj_hpath}/temp8/setpoint nxalias "${name}_temp8_setpoint" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp8/setpoint 5 + ${sct_controller} write ${scobj_hpath}/temp8/setpoint + hsetprop ${scobj_hpath}/temp8/setpoint simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp8/setpoint simulated true + } + } + hsetprop ${scobj_hpath}/temp8 data "true" + hsetprop ${scobj_hpath}/temp8 klass "@none" + hsetprop ${scobj_hpath}/temp8 type "part" + + if {[string equal -nocase [string index ${cards} 2] H] && [string equal -nocase [string index ${assoc} 7] 3]} { + hfactory ${scobj_hpath}/temp8/heater plain spy none + + hfactory ${scobj_hpath}/temp8/heater/hset plain user float + hsetprop ${scobj_hpath}/temp8/heater/hset read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.T1:TEMP:LOOP:HSET} + hsetprop ${scobj_hpath}/temp8/heater/hset rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/heater/hset write ${ns}::setValue ${scobj_hpath} noResponse {SET:DEV:DB8.T1:TEMP:LOOP:HSET:} + hsetprop ${scobj_hpath}/temp8/heater/hset noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/heater/hset check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/heater/hset control true + hsetprop ${scobj_hpath}/temp8/heater/hset data true + hsetprop ${scobj_hpath}/temp8/heater/hset mutable true + hsetprop ${scobj_hpath}/temp8/heater/hset nxsave true + hsetprop ${scobj_hpath}/temp8/heater/hset lowerlimit 0 + hsetprop ${scobj_hpath}/temp8/heater/hset upperlimit 100 + hsetprop ${scobj_hpath}/temp8/heater/hset oldval 0.0 + hsetprop ${scobj_hpath}/temp8/heater/hset klass "parameter" + hsetprop ${scobj_hpath}/temp8/heater/hset sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp8/heater/hset type "part" + hsetprop ${scobj_hpath}/temp8/heater/hset nxalias "${name}_temp8_heater_hset" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp8/heater/hset 5 + ${sct_controller} write ${scobj_hpath}/temp8/heater/hset + hsetprop ${scobj_hpath}/temp8/heater/hset simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp8/heater/hset simulated true + } + + hfactory ${scobj_hpath}/temp8/heater/perc plain user float + hsetprop ${scobj_hpath}/temp8/heater/perc read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB3.H1:HTR:SIG:PERC} + hsetprop ${scobj_hpath}/temp8/heater/perc rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/heater/perc control true + hsetprop ${scobj_hpath}/temp8/heater/perc data true + hsetprop ${scobj_hpath}/temp8/heater/perc mutable true + hsetprop ${scobj_hpath}/temp8/heater/perc nxsave true + hsetprop ${scobj_hpath}/temp8/heater/perc oldval 0.0 + hsetprop ${scobj_hpath}/temp8/heater/perc klass "parameter" + hsetprop ${scobj_hpath}/temp8/heater/perc sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp8/heater/perc type "part" + hsetprop ${scobj_hpath}/temp8/heater/perc nxalias "${name}_temp8_heater_perc" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp8/heater/perc 5 + hsetprop ${scobj_hpath}/temp8/heater/perc simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp8/heater/perc simulated true + } + + hfactory ${scobj_hpath}/temp8/heater/power plain user float + hsetprop ${scobj_hpath}/temp8/heater/power read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB3.H1:HTR:SIG:POWR} + hsetprop ${scobj_hpath}/temp8/heater/power rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/temp8/heater/power control true + hsetprop ${scobj_hpath}/temp8/heater/power data true + hsetprop ${scobj_hpath}/temp8/heater/power mutable true + hsetprop ${scobj_hpath}/temp8/heater/power nxsave true + hsetprop ${scobj_hpath}/temp8/heater/power oldval 0.0 + hsetprop ${scobj_hpath}/temp8/heater/power klass "parameter" + hsetprop ${scobj_hpath}/temp8/heater/power sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/temp8/heater/power type "part" + hsetprop ${scobj_hpath}/temp8/heater/power nxalias "${name}_temp8_heater_power" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/temp8/heater/power 5 + hsetprop ${scobj_hpath}/temp8/heater/power simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/temp8/heater/power simulated true + } + hsetprop ${scobj_hpath}/temp8/heater data "true" + hsetprop ${scobj_hpath}/temp8/heater klass "@none" + hsetprop ${scobj_hpath}/temp8/heater type "part" + } + if {[string equal -nocase [string index ${cards} 2] H] && [string equal -nocase [string index ${assoc} 7] 3]} { + ansto_makesctdrive ${name}_temp8_setpoint ${scobj_hpath}/temp8/setpoint ${scobj_hpath}/temp8/sensor ${sct_controller} + } + } + + if {[string equal -nocase [string index ${cards} 3] V]} { + hfactory ${scobj_hpath}/valve plain spy none + + hfactory ${scobj_hpath}/valve/nick plain user text + hsetprop ${scobj_hpath}/valve/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB4.G1:AUX:NICK} + hsetprop ${scobj_hpath}/valve/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/valve/nick control true + hsetprop ${scobj_hpath}/valve/nick data true + hsetprop ${scobj_hpath}/valve/nick mutable true + hsetprop ${scobj_hpath}/valve/nick nxsave true + hsetprop ${scobj_hpath}/valve/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/valve/nick klass "parameter" + hsetprop ${scobj_hpath}/valve/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/valve/nick type "part" + hsetprop ${scobj_hpath}/valve/nick nxalias "${name}_valve_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/valve/nick 15 + hsetprop ${scobj_hpath}/valve/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/valve/nick simulated true + } + + hfactory ${scobj_hpath}/valve/sensor plain user float + hsetprop ${scobj_hpath}/valve/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB4.G1:AUX:SIG:PERC} + hsetprop ${scobj_hpath}/valve/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/valve/sensor control true + hsetprop ${scobj_hpath}/valve/sensor data true + hsetprop ${scobj_hpath}/valve/sensor mutable true + hsetprop ${scobj_hpath}/valve/sensor nxsave true + hsetprop ${scobj_hpath}/valve/sensor oldval 0.0 + hsetprop ${scobj_hpath}/valve/sensor klass "parameter" + hsetprop ${scobj_hpath}/valve/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/valve/sensor type "part" + hsetprop ${scobj_hpath}/valve/sensor nxalias "${name}_valve_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/valve/sensor 5 + hsetprop ${scobj_hpath}/valve/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/valve/sensor simulated true + } + hsetprop ${scobj_hpath}/valve data "true" + hsetprop ${scobj_hpath}/valve klass "@none" + hsetprop ${scobj_hpath}/valve type "part" + } + hsetprop ${scobj_hpath} klass ${device_class} + hsetprop ${scobj_hpath} data true + hsetprop ${scobj_hpath} debug_threshold 5 +# mkDriver hook code goes here + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +proc ::scobj::oxford_mercury::add_driver {name device_class simulation_flag ip_address tcp_port id {cards NNNNNNNN} {assoc 00000000} {ttol 1} {ptol 5} {vtol 5}} { + set catch_status [ catch { + ::scobj::oxford_mercury::sics_log 9 "::scobj::oxford_mercury::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${cards} ${assoc} ${ttol} ${ptol} ${vtol}" + if {[string equal -nocase "${simulation_flag}" "false"]} { + if {[string equal -nocase "aqadapter" "${ip_address}"]} { + ::scobj::oxford_mercury::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" + makesctcontroller sct_${name} aqadapter ${tcp_port} + } else { + ::scobj::oxford_mercury::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}" + makesctcontroller sct_${name} std ${ip_address}:${tcp_port} + } + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for oxford_mercury" + ::scobj::oxford_mercury::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL + } + ::scobj::oxford_mercury::sics_log 1 "::scobj::oxford_mercury::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${cards} ${assoc} ${ttol} ${ptol} ${vtol}" + ::scobj::oxford_mercury::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${cards} ${assoc} ${ttol} ${ptol} ${vtol} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +namespace eval ::scobj::oxford_mercury { + namespace export debug_threshold + namespace export debug_log + namespace export sics_log + namespace export mkDriver + namespace export add_driver +} + +proc add_oxford_mercury {name ip_address tcp_port id {cards NNNNNNNN} {assoc 00000000} {ttol 1} {ptol 5} {vtol 5}} { + set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" + ::scobj::oxford_mercury::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${cards} ${assoc} ${ttol} ${ptol} ${vtol} +} + +clientput "file evaluation of sct_oxford_mercury.tcl" +::scobj::oxford_mercury::sics_log 9 "file evaluation of sct_oxford_mercury.tcl" + +proc ::scobj::oxford_mercury::read_config {} { + set catch_status [ catch { + set ns "::scobj::oxford_mercury" + dict for {k u} $::config_dict { + if { [dict exists $u "implementation"] } { + set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" + set device_class "environment" + if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { + continue + } + set enabled [string tolower [dict get $u "enabled"]] + if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { + continue + } + if { [dict exists $u "simulation_group"] } { + set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]] + } + if { [dict exists $u "device_class"] } { + set device_class "[dict get $u "device_class"]" + } + set name [dict get $u name] + set implementation [dict get $u "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"] "oxford_mercury"] } { + if { ![string equal -nocase "${simulation_flag}" "false"] } { + set asyncqueue "null" + ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue" + ${ns}::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL + } elseif { [dict exists $v "asyncqueue"] } { + set asyncqueue [dict get $v "asyncqueue"] + if { [string equal -nocase ${asyncqueue} "sct"] } { + set ip_address [dict get $v ip] + set tcp_port [dict get $v port] + makesctcontroller sct_${name} std ${ip_address}:${tcp_port} + } else { + makesctcontroller sct_${name} aqadapter ${asyncqueue} + } + } else { + if { [dict exists $v "asyncprotocol"] } { + set asyncprotocol [dict get $v "asyncprotocol"] + } else { + set asyncprotocol ${name}_protocol + MakeAsyncProtocol ${asyncprotocol} + if { [dict exists $v "sendterminator"] } { + ${asyncprotocol} sendterminator "[dict get $v "sendterminator"]" + } elseif { [dict exists $v "terminator"] } { + ${asyncprotocol} sendterminator "[dict get $v "terminator"]" + } + if { [dict exists $v "replyterminator"] } { + ${asyncprotocol} replyterminator "[dict get $v "replyterminator"]" + } elseif { [dict exists $v "terminator"] } { + ${asyncprotocol} replyterminator "[dict get $v "terminator"]" + } + } + set asyncqueue ${name}_queue + set ip_address [dict get $v ip] + set tcp_port [dict get $v port] + MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${ip_address} ${tcp_port} + if { [dict exists $v "timeout"] } { + ${asyncqueue} timeout "[dict get $v "timeout"]" + } + makesctcontroller sct_${name} aqadapter ${asyncqueue} + } + set arg_list [list] + set missing_list [list] + array unset default_map + array set default_map [list cards NNNNNNNN assoc 00000000 ttol 1 ptol 5 vtol 5] + foreach arg {id cards assoc ttol ptol vtol} { + if {[dict exists $u $arg]} { + lappend arg_list "[dict get $u $arg]" + } elseif {[dict exists $v $arg]} { + lappend arg_list "[dict get $v $arg]" + } elseif {[info exists default_map($arg)]} { + lappend arg_list $default_map($arg) + } else { + ${ns}::sics_log 9 "Missing configuration value $arg" + lappend missing_list $arg + } + } + if { [llength $missing_list] > 0 } { + error "$name is missing configuration values $missing_list" + } + ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list + } + } + } + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +if { [info exists ::config_dict] } { + ::scobj::oxford_mercury::read_config +} else { + ::scobj::oxford_mercury::sics_log 5 "No config dict" +} diff --git a/site_ansto/instrument/config/environment/temperature/sct_west_6100.tcl b/site_ansto/instrument/config/environment/temperature/sct_west_6100.tcl index 1372950a..2453af03 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_west_6100.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_west_6100.tcl @@ -27,6 +27,33 @@ proc ::scobj::west_6100::sics_log {debug_level debug_string} { } catch_message ] } +# checklimits function for driveable interface +proc ::scobj::west_6100::checklimits {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "checklimits tc_root=${tc_root} sct=[sct] target=[sct target]" + set setpoint [sct target] + if { [hpropexists [sct] lowerlimit] } { + set lolimit [sct lowerlimit] + } else { + # lowerlimit not set, use target + set lolimit [sct target] + } + if { [hpropexists [sct] upperlimit] } { + set hilimit [sct upperlimit] + } else { + # upperlimit not set, use target + set hilimit [sct target] + } +# checklimits hook code goes here + if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } { + sct driving 0 + error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]" + } + return OK + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + # check function for hset change proc ::scobj::west_6100::checkrange {tc_root} { set catch_status [ catch { @@ -53,6 +80,40 @@ proc ::scobj::west_6100::checkrange {tc_root} { handle_exception ${catch_status} ${catch_message} } +# checkstatus function for driveable interface +proc ::scobj::west_6100::checkstatus {tc_root} { + set catch_status [ catch { +# checkstatus hook code goes here + if {[sct driving]} { + set sp "[sct target]" + set pv "[hval ${tc_root}/[sct driveable]]" + if { abs(${pv} - ${sp}) <= [sct tolerance] } { + if { [hpropexists [sct] settle_time] } { + if { [hpropexists [sct] settle_time_start] } { + if { [sct utime] - [sct settle_time_start] >= [sct settle_time]} { + sct driving 0 + return "idle" + } + return "busy" + } else { + sct utime settle_time_start + return "busy" + } + } + sct driving 0 + return "idle" + } + if { [hpropexists [sct] settle_time_start] } { + hdelprop [sct] settle_time_start + } + return "busy" + } else { + return "idle" + } + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + # function to request the read of a parameter on a device proc ::scobj::west_6100::getDecimal {tc_root nextState cmd_str} { set catch_status [ catch { @@ -101,6 +162,18 @@ proc ::scobj::west_6100::getInteger {tc_root nextState cmd_str} { handle_exception ${catch_status} ${catch_message} } +# halt function for driveable interface +proc ::scobj::west_6100::halt {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "halt tc_root=${tc_root} sct=[sct] driving=[sct driving]" + ### TODO hset [sct] [hval [sct]] +# halt hook code goes here + sct driving 0 + return "idle" + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + # function to check the write parameter on a device proc ::scobj::west_6100::noResponse {tc_root} { set catch_status [ catch { @@ -262,8 +335,8 @@ proc ::scobj::west_6100::wrInteger {tc_root nextState cmd_str} { handle_exception ${catch_status} ${catch_message} } -proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port dev_id } { - ::scobj::west_6100::sics_log 9 "::scobj::west_6100::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}" +proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id } { + ::scobj::west_6100::sics_log 9 "::scobj::west_6100::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}" set ns "[namespace current]" set catch_status [ catch { @@ -358,6 +431,8 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/sensor data true hsetprop ${scobj_hpath}/sensor mutable true hsetprop ${scobj_hpath}/sensor nxsave true + hsetprop ${scobj_hpath}/sensor permlink data_set "T[format "%02d" ${id}]S01" + hsetprop ${scobj_hpath}/sensor @description "T[format "%02d" ${id}]S01" hsetprop ${scobj_hpath}/sensor oldval 0.0 hsetprop ${scobj_hpath}/sensor klass "parameter" hsetprop ${scobj_hpath}/sensor sdsinfo "::nexus::scobj::sdsinfo" @@ -370,14 +445,25 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/setpoint write ${ns}::wrDecimal ${scobj_hpath} noResponse {2} hsetprop ${scobj_hpath}/setpoint noResponse ${ns}::noResponse ${scobj_hpath} hsetprop ${scobj_hpath}/setpoint check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/setpoint driving 0 + hsetprop ${scobj_hpath}/setpoint checklimits ${ns}::checklimits ${scobj_hpath} + hsetprop ${scobj_hpath}/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath} + hsetprop ${scobj_hpath}/setpoint halt ${ns}::halt ${scobj_hpath} + hsetprop ${scobj_hpath}/setpoint driveable sensor hsetprop ${scobj_hpath}/setpoint control true hsetprop ${scobj_hpath}/setpoint data true hsetprop ${scobj_hpath}/setpoint mutable true hsetprop ${scobj_hpath}/setpoint nxsave true + hsetprop ${scobj_hpath}/setpoint lowerlimit 0 + hsetprop ${scobj_hpath}/setpoint upperlimit 1600 + hsetprop ${scobj_hpath}/setpoint tolerance 1 + hsetprop ${scobj_hpath}/setpoint permlink data_set "T[format "%02d" ${id}]SP01" + hsetprop ${scobj_hpath}/setpoint @description "T[format "%02d" ${id}]SP01" hsetprop ${scobj_hpath}/setpoint oldval 0.0 hsetprop ${scobj_hpath}/setpoint klass "parameter" hsetprop ${scobj_hpath}/setpoint sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/setpoint type "part" + hsetprop ${scobj_hpath}/setpoint settle_time "30" + hsetprop ${scobj_hpath}/setpoint type "drivable" hsetprop ${scobj_hpath}/setpoint nxalias "${name}_setpoint" hfactory ${scobj_hpath}/w_sp plain user float @@ -471,14 +557,17 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath} klass ${device_class} hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} debug_threshold 5 + if {[string equal -nocase "${simulation_flag}" "false"]} { + ansto_makesctdrive ${name}_setpoint ${scobj_hpath}/setpoint ${scobj_hpath}/sensor ${sct_controller} + } # mkDriver hook code goes here } catch_message ] handle_exception ${catch_status} ${catch_message} } -proc ::scobj::west_6100::add_driver {name device_class simulation_flag ip_address tcp_port dev_id} { +proc ::scobj::west_6100::add_driver {name device_class simulation_flag ip_address tcp_port id} { set catch_status [ catch { - ::scobj::west_6100::sics_log 9 "::scobj::west_6100::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}" + ::scobj::west_6100::sics_log 9 "::scobj::west_6100::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}" if {[string equal -nocase "${simulation_flag}" "false"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} { ::scobj::west_6100::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" @@ -490,8 +579,8 @@ proc ::scobj::west_6100::add_driver {name device_class simulation_flag ip_addres } else { ::scobj::west_6100::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for west_6100" } - ::scobj::west_6100::sics_log 1 "::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}" - ::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id} + ::scobj::west_6100::sics_log 1 "::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}" + ::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} } catch_message ] handle_exception ${catch_status} ${catch_message} } @@ -504,9 +593,9 @@ namespace eval ::scobj::west_6100 { namespace export add_driver } -proc add_west_6100 {name ip_address tcp_port dev_id} { +proc add_west_6100 {name ip_address tcp_port id} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::west_6100::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${dev_id}" + ::scobj::west_6100::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}" } clientput "file evaluation of sct_west_6100.tcl" @@ -572,7 +661,7 @@ proc ::scobj::west_6100::read_config {} { } set arg_list [list] set missing_list [list] - foreach arg {dev_id} { + foreach arg {id} { if {[dict exists $u $arg]} { lappend arg_list "[dict get $u $arg]" } elseif {[dict exists $v $arg]} { diff --git a/site_ansto/instrument/config/environment/temperature/west400.tcl b/site_ansto/instrument/config/environment/temperature/west400.tcl index 586247a3..71945a84 100644 --- a/site_ansto/instrument/config/environment/temperature/west400.tcl +++ b/site_ansto/instrument/config/environment/temperature/west400.tcl @@ -20,10 +20,12 @@ MakeRS232Controller sertemp $IP 502 sertemp timeout 300 sertemp sendterminator 0x0 sertemp replyterminator 0x0 -EvFactory new tc1 west4100 sertemp $ID 2 +#ffr 2014-09-22: The modbus addr should be 1 for single port moxas (Not $ID which is a SICS ID) +# EvFactory new tc1 west4100 sertemp $ID 2 +EvFactory new $temp_sobj west4100 sertemp 1 2 -sicslist setatt tc1 units kelvin -sicslist setatt tc1 klass @none +sicslist setatt $temp_sobj units kelvin +sicslist setatt $temp_sobj klass @none } # @brief Adds a west400 temperature controller object. diff --git a/site_ansto/instrument/config/hmm/hmm_configuration_common_1.tcl b/site_ansto/instrument/config/hmm/hmm_configuration_common_1.tcl index cbe97274..24d0b707 100644 --- a/site_ansto/instrument/config/hmm/hmm_configuration_common_1.tcl +++ b/site_ansto/instrument/config/hmm/hmm_configuration_common_1.tcl @@ -390,7 +390,7 @@ namespace eval histogram_memory { if [ catch { set det_height_mm [SplitReply [detector_active_height_mm]] set max_chan [OAT_TABLE Y -getdata MAX_CHAN] - set scale_factor [expr {$det_height_mm / $max_chan}] + set scale_factor [expr {1.0 * $det_height_mm / $max_chan}] set offset 0.0 ::histogram_memory::calc_axis "y_pixel_offset" $scale_factor $offset [OAT_TABLE Y -getdata BOUNDARIES] if {$args == "-get_data_ref"} { @@ -426,7 +426,7 @@ namespace eval histogram_memory { if [ catch { set det_width_mm [SplitReply [detector_active_width_mm]] set max_chan [OAT_TABLE X -getdata MAX_CHAN] - set scale_factor [expr {$det_width_mm / $max_chan}] + set scale_factor [expr {1.0 * $det_width_mm / $max_chan}] set offset 0.0 ::histogram_memory::calc_axis "x_pixel_offset" $scale_factor $offset [OAT_TABLE X -getdata BOUNDARIES] if {$args == "-get_data_ref"} { diff --git a/site_ansto/instrument/config/motors/sct_positmotor_common.tcl b/site_ansto/instrument/config/motors/sct_positmotor_common.tcl index 7e78e281..b4511d83 100644 --- a/site_ansto/instrument/config/motors/sct_positmotor_common.tcl +++ b/site_ansto/instrument/config/motors/sct_positmotor_common.tcl @@ -124,7 +124,7 @@ proc ::scobj::positmotor::mot2ID {mot precision table} { if {abs($mot - $m) <= $precision} { return $i } elseif {[expr {$sign * ($mot - $m)} ] < 0} { - return [expr {($mot-$mprev)*($i - $iprev)/($m - $mprev)+$iprev}] + return [expr {1.0 * ($mot-$mprev)*($i - $iprev)/($m - $mprev)+$iprev}] } set iprev $i set mprev $m diff --git a/site_ansto/instrument/hrpd/config/motors/motor_configuration.tcl b/site_ansto/instrument/hrpd/config/motors/motor_configuration.tcl index d68d2262..81c78da7 100644 --- a/site_ansto/instrument/hrpd/config/motors/motor_configuration.tcl +++ b/site_ansto/instrument/hrpd/config/motors/motor_configuration.tcl @@ -24,7 +24,8 @@ set my_Home 8389613 #set mx_Home 7580366 set mx_Home 8392083 #set mom_Home 13442930 -set mom_Home 8218065 +#set mom_Home 8218065 +set mom_Home 8295887 set mtth_Home 11534660 set pcx_Home 6330515 set pcr_Home 21650101 diff --git a/site_ansto/instrument/hrpd/echidna_configuration.tcl b/site_ansto/instrument/hrpd/echidna_configuration.tcl index 975afd82..2aeaca4f 100644 --- a/site_ansto/instrument/hrpd/echidna_configuration.tcl +++ b/site_ansto/instrument/hrpd/echidna_configuration.tcl @@ -40,16 +40,12 @@ fileeval $cfPath(environment)/temperature/sct_lakeshore_340.tcl fileeval $cfPath(environment)/temperature/sct_ls340.tcl fileeval $cfPath(environment)/temperature/sct_lakeshore_370.tcl fileeval $cfPath(environment)/temperature/sct_lakeshore_m370.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_base.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_level.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_pres.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_scpi.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_temp.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_valve.tcl +fileeval $cfPath(environment)/temperature/sct_oxford_mercury.tcl fileeval $cfPath(environment)/sct_protek_common.tcl fileeval $cfPath(environment)/sct_protekmm.tcl fileeval $cfPath(environment)/temperature/west400.tcl fileeval $cfPath(environment)/temperature/sct_west4100.tcl +fileeval $cfPath(environment)/temperature/sct_west_6100.tcl fileeval $cfPath(environment)/temperature/sct_watlow_pm.tcl fileeval $cfPath(environment)/magneticField/sct_oxford_labview.tcl fileeval $cfPath(environment)/magneticField/sct_oxford12tlv.tcl From 14be249401f40d0e7c3ab39ed7dab1f59df9e536 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 19 Feb 2015 11:51:51 +1100 Subject: [PATCH 20/22] Pullback from Wombat 2015-02-19 --- .../instrument/config/commands/hvcommands.tcl | 214 +++++++++++------- .../instrument/config/commands/pulser.tcl | 2 +- .../config/counter/counter_common_1.tcl | 1 - .../temperature/sct_lakeshore_370.tcl | 2 +- .../temperature/sct_lakeshore_m370.tcl | 6 +- .../temperature/sct_oxford_mercury.tcl | 2 +- .../environment/temperature/west400.tcl | 8 +- .../hipd/config/commands/commands.tcl | 105 ++++++++- .../hipd/config/commands/eulerscan.tcl | 15 ++ .../hipd/config/hmm/hmm_configuration.tcl | 2 +- .../instrument/hipd/config/hmm/hmm_rapid.tcl | 20 +- .../config/motors/euler_configuration.tcl | 14 +- .../config/motors/motor_configuration.tcl | 106 +++++---- .../hipd/config/motors/tilt_configuration.tcl | 3 +- .../instrument/hipd/util/sics_config.ini | 22 +- .../instrument/hipd/wombat_configuration.tcl | 9 +- 16 files changed, 347 insertions(+), 184 deletions(-) diff --git a/site_ansto/instrument/config/commands/hvcommands.tcl b/site_ansto/instrument/config/commands/hvcommands.tcl index e1b8456c..50da9008 100644 --- a/site_ansto/instrument/config/commands/hvcommands.tcl +++ b/site_ansto/instrument/config/commands/hvcommands.tcl @@ -1,5 +1,9 @@ -set scaleval 1000.0 +set scaleval 2000.0 +set rampstep 100 +set rampdelay 3 +set motdir 1 +set pulserstate 0 proc SetVoltScale {newscaleval} { global scaleval @@ -11,17 +15,58 @@ proc VoltScale {involt} { return [expr {($involt*1.0)/$scaleval}] } +proc SetRampParms {_rampstep _rampdelay} { + global rampstep rampdelay + set rampstep $_rampstep + set rampdelay $_rampdelay +} + proc SetVolt {volt} { + global pulserstate if {$volt== 0} { PulserOff + set pulserstate 0 } else { set pulservolt [VoltScale $volt] - sct_pulser send "VOLT:OFFS $pulservolt; OFFS?" - PulserDC $pulservolt - PulserOn +# sct_pulser send "VOLT:OFFS $pulservolt; OFFS?" +# PulserDC $pulservolt + if {$pulserstate==0} { + PulserDC $pulservolt + PulserOn + set pulserstate 1 + } else { + sct_pulser send "VOLT:OFFS $pulservolt; OFFS?" + PulserOn + } } } +proc VoltSetStep {start step fin delay} { + set i [expr {$start*1.0}] + set loopvar 1 + SetVolt $i + if {($start == $fin) || ($step == 0)} {break} + while {$loopvar} { + wait $delay + if {($start < $fin)} { + set i [expr {$i + abs($step)}] + if {$i >= $fin} { + set i $fin + set loopvar 0 + } + } + if {($start > $fin)} { + set i [expr {$i - abs($step)}] + if {$i <= $fin} { + set i $fin + set loopvar 0 + } + } + SetVolt $i + } +} + + proc GetVolt {} { sct_pulser transact VOLT:OFFS? } @@ -29,25 +74,18 @@ proc GetVolt {} { proc SingleVolt {volt oscno} { histmem mode unlimited newfile HISTOGRAM_XY - if {$volt== 0} { - PulserOff - } else { - set pulservolt [VoltScale $volt] - sct_pulser send "VOLT:OFFS $pulservolt; OFFS?" - pulserDC $pulservolt - PulserOn - } - oscmd start $oscno - hmm countblock + SetVolt $volt + oct oscillate_count $oscno + oct oscillate start save 0 - oscmd stop + } proc SetDC {} { pulseroff #NOTE: Setting FUNC DC generates a remote ctrl error if the # burst mode happens to be on - set resp [sct_pulser transact "BURS:STAT OFF;:FUNC DC;:VOLT:OFFS 0; OFFS?"] + set resp [sct_pulser send "BURS:STAT OFF;:FUNC DC;:VOLT:OFFS 0; OFFS?"] pulseron } @@ -61,55 +99,58 @@ proc VoltRamp {start step fin oscno} { set j [expr {$i*$step+$start}] if {$j> $fin && $step > 0} {break} if {$j< $fin && $step < 0} {break} - if {$j== 0} { - PulserOff - } else { - set pulservolt [VoltScale $j] - pulserDC $pulservolt - PulserOn - } - oscmd start $oscno - hmm countblock + SetVolt $j + oct oscillate_count $oscno + oct oscillate start save $i incr i } - oscmd stop } -proc VoltTextureRamp {start step fin mot tstart tstep tfin oscno} { - histmem mode unlimited - - - set loopvar 1 +proc SingleVTexScan {mot tstart tstep tfin oscno} { + global motdir + broadcast in singlevtexscan + set loopvar 1 + set i_bool 0 + histmem mode unlimited + if {$motdir == 1} { + set currentmot $tstart set i 0 - while {$loopvar} { - set j [expr {$i*$step+$start}] - if {$j> $fin && $step > 0} {break} - if {$j< $fin && $step < 0} {break} - if {$j== 0} { - PulserOff - } else { - set pulservolt [VoltScale $j] - pulserDC $pulservolt - PulserOn - } - sampledescription voltage $j - broadcast voltage $j - newfile HISTOGRAM_XY - set m 0 - while {1} { - set n [expr {$m*$tstep+$tstart}] - if {$n> $tfin && $tstep > 0} {break} - if {$n< $tfin && $tstep < 0} {break} - drive $mot $n - oscmd start $oscno - hmm countblock - save $m - incr m - } - oscmd stop - incr i - } + } else { + set currentmot $tfin + set i [expr {int(($tfin-$tstart)/$tstep)}] + } + newfile HISTOGRAM_XY + while {$i_bool==0} { + drive $mot $currentmot + oct oscillate_count $oscno + oct oscillate start + hmm countblock + save $i + if {($motdir > 0)} { + + set currentmot [expr {$currentmot + $tstep}] + if {$currentmot > $tfin} {set i_bool 1} + incr i + } else { + set currentmot [expr {$currentmot - $tstep}] + if {$currentmot < $tstart} {set i_bool 1} + incr i -1 + } + } + set motdir [expr {(-1*$motdir)}] +} + +proc VListTexScan {voltlist mot tstart tstep tfin oscno} { + global rampstep rampdelay + set curvolt [lindex $voltlist 0] + broadcast $curvolt + SetVolt $curvolt + foreach volt $voltlist { + broadcast $volt + VoltSetStep $curvolt $rampstep $volt $rampdelay + SingleVTexScan $mot $tstart $tstep $tfin $oscno + } } @@ -124,12 +165,10 @@ proc SquarePulseTexture {motor start step numsteps volt freq bins oscno} { for {set i 0} {$i < $numsteps} {incr i} { drive $motor [expr $i*$step+$start] - oscmd start $oscno - hmm countblock + oct oscillate_count $oscno + oct oscillate start save $i } - - oscmd stop } proc UniPulseTexture {motor start step numsteps volt freq bins oscno} { @@ -144,12 +183,10 @@ proc UniPulseTexture {motor start step numsteps volt freq bins oscno} { for {set i 0} {$i < $numsteps} {incr i} { drive $motor [expr $i*$step+$start] - oscmd start $oscno - hmm countblock + oct oscillate_count $oscno + oct oscillate start save $i } - - oscmd stop } @@ -162,8 +199,8 @@ proc BehlkePulseTexture {motor start step numsteps freq bins oscno} { PulserOn for {set i 0} {$i < $numsteps} {incr i} { drive $motor [expr $i*$step+$start] - oscmd start $oscno - hmm countblock + oct oscillate_count $oscno + oct oscillate start save $i } } @@ -189,12 +226,11 @@ proc SquarePulseVolt {start step fin freq bins oscno} { PulserOn # sct_pulser send "APPL:SQU $freq,$pulservolt,0" } - oscmd start $oscno - hmm countblock + oct oscillate_count $oscno + oct oscillate start save $i incr i } - oscmd stop } proc SquarePulseFreq {volt freqlist bins oscno} { @@ -209,12 +245,11 @@ proc SquarePulseFreq {volt freqlist bins oscno} { PulserSquare $freq $pulservolt PulserOn # sct_pulser send "APPL:SQU $freq,$pulservolt,0" - oscmd start $oscno - hmm countblock + oct oscillate_count $oscno + oct oscillate start save $i incr i } - oscmd stop } proc BehlkePulseFreq {freqlist bins oscno} { @@ -227,12 +262,11 @@ proc BehlkePulseFreq {freqlist bins oscno} { wait 3 PulserSquareOffs $freq 2.5 2.5 PulserOn - oscmd start $oscno - hmm countblock + oct oscillate_count $oscno + oct oscillate start save $i incr i } - oscmd stop } proc SinePulseFreq {volt freqlist bins oscno} { @@ -246,12 +280,11 @@ proc SinePulseFreq {volt freqlist bins oscno} { wait 3 PulserSin $freq $pulservolt PulserOn - oscmd start $oscno - hmm countblock + oct oscillate_count $oscno + oct oscillate start save $i incr i } - oscmd stop } @@ -271,12 +304,11 @@ proc UniPulseFreq {volt freqlist bins oscno} { PulserSquareOffs $freq $pulservolt $pulseroffs PulserOn # sct_pulser send "APPL:SQU $freq,$pulservolt,[expr {$pulservolt/2}]" - oscmd start $oscno - hmm countblock + oct oscillate_count $oscno + oct oscillate start save $i incr i } - oscmd stop } proc UniPulseFatigue {volt freq bins oscno reps runs} { @@ -290,13 +322,14 @@ proc UniPulseFatigue {volt freq bins oscno reps runs} { for {set i 0} {$i<$runs} {incr i} { newfile HISTOGRAM_XYT for {set j 0} {$j<$reps} {incr j} { - oscmd start $oscno - hmm countblock + oct oscillate_count $oscno + oct oscillate start save $j } oscmd stop } PulserOff + set pulserstate 0 Histmem_strobo_off } @@ -315,6 +348,7 @@ proc PulserBurst {} { if {[string first 1 $sval] >-1} {break} } PulserOff + set pulserstate 0 } @@ -338,6 +372,7 @@ proc VoltPulseRun {vlo vhi freq cycl} { sct_pulser send "BURS:NCYC $prem; NCYC?" PulserBurst PulserOff + set pulserstate 0 sct_pulser send "BURS:STAT OFF; STAT?" } @@ -376,6 +411,7 @@ proc OneTri {volt period} { sct_pulser send "BURS:NCYC 1; NCYC?" PulserBurst PulserOff + set pulserstat 0 } @@ -384,6 +420,9 @@ publish GetVolt user publish SetDC user publish SetVolt user publish SetVoltScale user +publish SingleVTexScan user +publish VListTexScan user +publish SetRampParms user publish SingleVolt user publish VoltRamp user publish SquarePulseVolt user @@ -399,5 +438,6 @@ publish SquarePulseTexture user publish BehlkePulseTexture user publish BehlkePulseFreq user publish UniPulseTexture user - +publish VoltSetStep user + diff --git a/site_ansto/instrument/config/commands/pulser.tcl b/site_ansto/instrument/config/commands/pulser.tcl index 99b2ecaf..bef9a102 100644 --- a/site_ansto/instrument/config/commands/pulser.tcl +++ b/site_ansto/instrument/config/commands/pulser.tcl @@ -54,7 +54,7 @@ proc PulserSquareOffs {Freq Volt Offs} { proc PulserDC {Volt} { #NOTE: Setting FUNC DC generates a remote ctrl error if the # burst mode happens to be on - set resp [sct_pulser transact "BURS:STAT OFF;:FUNC DC;:VOLT:OFFS $Volt; OFFS?"] + set resp [sct_pulser send "BURS:STAT OFF;:FUNC DC;:VOLT:OFFS $Volt; OFFS?"] broadcast $resp } diff --git a/site_ansto/instrument/config/counter/counter_common_1.tcl b/site_ansto/instrument/config/counter/counter_common_1.tcl index 1a16dd32..9ad2782c 100644 --- a/site_ansto/instrument/config/counter/counter_common_1.tcl +++ b/site_ansto/instrument/config/counter/counter_common_1.tcl @@ -7,7 +7,6 @@ namespace eval counter { proc ::counter::transferscript {} { variable isc_numchannels - bm status set val [SplitReply [bm1 gettime]] for {set i 1} {$i <= $isc_numchannels} {incr i} { append val " [SplitReply [bm$i getcounts] ]" diff --git a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl index 74233b4a..6fe63945 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl @@ -50,7 +50,7 @@ namespace eval ::scobj::[set vendor]_[set device] { proc debug_log {debug_level arg_string} { # write a timestamped string message to a log file for debugging - set debug_threshold 0 + set debug_threshold 5 if {$debug_level >= $debug_threshold} { set fd [open "[set [namespace current]::log_file]" "a"] set line "[clock format [clock seconds] -format "%T"] $arg_string" diff --git a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_m370.tcl b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_m370.tcl index 401527b9..8e6e7de7 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_m370.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_m370.tcl @@ -32,7 +32,7 @@ proc ::scobj::lakeshore_m370::mkDriver { sct_controller name device_class simula set ns "[namespace current]" set catch_status [ catch { - MakeSICSObj ${name} SCT_OBJECT user float + MakeSICSObj ${name} SCT_OBJECT user none sicslist setatt ${name} klass ${device_class} sicslist setatt ${name} long_name ${name} @@ -43,8 +43,8 @@ proc ::scobj::lakeshore_m370::mkDriver { sct_controller name device_class simula hsetprop ${scobj_hpath} debug_threshold 5 # mkDriver hook code starts ::scobj::lakeshore_370::mk_sct_driver $sct_controller environment $name $tol - hsetprop ${scobj_hpath}/setpoint permlink data_set T[format "%02d" ${id}]SP01 - hsetprop ${scobj_hpath}/setpoint @description T[format "%02d" ${id}]SP01 + hsetprop ${scobj_hpath}/Loop1/setpoint permlink data_set T[format "%02d" ${id}]SP01 + hsetprop ${scobj_hpath}/Loop1/setpoint @description T[format "%02d" ${id}]SP01 hsetprop ${scobj_hpath}/Sensor/value permlink data_set T[format "%02d" ${id}]S01 hsetprop ${scobj_hpath}/Sensor/value @description T[format "%02d" ${id}]S01 # mkDriver hook code ends diff --git a/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl b/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl index 22ebad6b..67266192 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl @@ -58,7 +58,7 @@ namespace eval ::scobj::[set vendor]_[set device] { proc debug_log {debug_level arg_string} { # write a timestamped string message to a log file for debugging - set debug_threshold 0 + set debug_threshold 5 if {$debug_level >= $debug_threshold} { set fd [open "[set [namespace current]::log_file]" "a"] set line "[clock format [clock seconds] -format "%T"] $arg_string" diff --git a/site_ansto/instrument/config/environment/temperature/west400.tcl b/site_ansto/instrument/config/environment/temperature/west400.tcl index 586247a3..71945a84 100644 --- a/site_ansto/instrument/config/environment/temperature/west400.tcl +++ b/site_ansto/instrument/config/environment/temperature/west400.tcl @@ -20,10 +20,12 @@ MakeRS232Controller sertemp $IP 502 sertemp timeout 300 sertemp sendterminator 0x0 sertemp replyterminator 0x0 -EvFactory new tc1 west4100 sertemp $ID 2 +#ffr 2014-09-22: The modbus addr should be 1 for single port moxas (Not $ID which is a SICS ID) +# EvFactory new tc1 west4100 sertemp $ID 2 +EvFactory new $temp_sobj west4100 sertemp 1 2 -sicslist setatt tc1 units kelvin -sicslist setatt tc1 klass @none +sicslist setatt $temp_sobj units kelvin +sicslist setatt $temp_sobj klass @none } # @brief Adds a west400 temperature controller object. diff --git a/site_ansto/instrument/hipd/config/commands/commands.tcl b/site_ansto/instrument/hipd/config/commands/commands.tcl index 75bd42d8..0eb6d3bc 100644 --- a/site_ansto/instrument/hipd/config/commands/commands.tcl +++ b/site_ansto/instrument/hipd/config/commands/commands.tcl @@ -6,7 +6,7 @@ namespace eval motor { } namespace eval ajscmds { -namespace export SetRadColl SimpleRun SimpleScan RadCollRun RadCollTimed RadCollScan +namespace export SetRadColl SimpleRun SimpleScan RadCollRun RadCollTimed RadCollScan RadCollBiScan # SetRadColl command SetRadColl { @@ -34,13 +34,13 @@ catch { } msg clientput $msg } + # SimpleRun command SimpleRun { float=0:inf steptime int=1:inf numsteps } { -# RadCollOff histmem mode time histmem preset $steptime newfile HISTOGRAM_XY @@ -49,6 +49,7 @@ int=1:inf numsteps save $i } } + # SimpleScan command SimpleScan { text=drivable motor @@ -58,7 +59,6 @@ int=1:inf numsteps float=0:inf steptime } { -# RadCollOff histmem mode time histmem preset $steptime newfile HISTOGRAM_XY @@ -68,13 +68,13 @@ float=0:inf steptime save $i } } + # RadCollRun command RadCollRun { int=1:inf oscno int=1:inf reps } { -# RadCollOn $oscno histmem mode unlimited newfile HISTOGRAM_XY for {set i 0} {$i < $reps} {incr i} { @@ -83,8 +83,8 @@ int=1:inf reps hmm countblock save $i } -# RadCollOff } + # RadCollTimed command RadCollTimed { int=1:inf oscno @@ -99,14 +99,16 @@ float=0:inf time set i 0 set timsecs [expr $time*60] while {$bool == 0} { + oct oscillate_count $oscno + oct oscillate start histmem start block save $i incr i set tim2 [expr [clock seconds] - $tim1] if {$tim2 > $timsecs} {set bool 1} } - RadCollOff } + # RadCollScan command RadCollScan { text=drivable motor @@ -115,8 +117,6 @@ float step int=1:inf numsteps int=1:inf oscno } { - -# RadCollOn $oscno histmem mode unlimited newfile HISTOGRAM_XY for {set i 0} {$i < $numsteps} {incr i} { @@ -126,8 +126,12 @@ int=1:inf oscno hmm countblock save $i } -# RadCollOff } + + + + + } namespace import ::ajscmds::* publish SetRadColl user @@ -140,3 +144,86 @@ publish RadCollScan user proc ::commands::isc_initialize {} { ::commands::ic_initialize } + + +# RadCollScanRange +proc RadCollScanRange {motor start step fin oscno} { + if {$step==0} {break} + if {($start > $fin) && ($step > 0)} {break} + if {($start < $fin) && ($step < 0)} {break} + set i_bool 0 + histmem mode unlimited + set currentmot $start + set i 0 + newfile HISTOGRAM_XY + while {$i_bool==0} { + drive $motor $currentmot + $motor send SH` + oct oscillate_count $oscno + oct oscillate start + hmm countblock + + set currentmot [expr {$currentmot + $step}] + if {($step > 0) && ($currentmot > $fin)} {set i_bool 1} + if {($step < 0) && ($currentmot < $fin)} {set i_bool 1} + if {($i_bool == 0)} {run $motor $currentmot} + save $i + incr i + } +} + +publish RadCollScanRange user + +#RadCollScanBi +proc RadCollScanBi {motor start step fin oscno motdir} { + + set i_bool 0 + set spx -12500 + set spstep [expr {$spx * $step * $motdir}] + histmem stop + histmem mode unlimited + + if {$motdir == 1} { + set currentmot $start + set i 0 + } else { + set currentmot $fin + set i [expr {int(($fin-$start)/$step)}] + } + drive $motor $currentmot + newfile HISTOGRAM_XY + + while {$i_bool==0} { + oct oscillate_count $oscno + oct oscillate start + hmm countblock + + if {($motdir > 0)} { + set currentmot [expr {$currentmot + $step}] + if {$currentmot > $fin} {set i_bool 1} + + } else { + set currentmot [expr {$currentmot - $step}] + if {$currentmot < $start} {set i_bool 1} + + } + + if {($i_bool == 0)} {run $motor $currentmot} + save $i + if {($motdir > 0)} {incr i 1} else {incr i -1} + +# if {($i_bool == 0)} { +# $motor send SH` +# $motor send PR` $spstep +# $motor send BG` +# +# } +# save $i + } +} + +publish RadCollScanBi user + + + + diff --git a/site_ansto/instrument/hipd/config/commands/eulerscan.tcl b/site_ansto/instrument/hipd/config/commands/eulerscan.tcl index 45b0724b..41f0c9a3 100644 --- a/site_ansto/instrument/hipd/config/commands/eulerscan.tcl +++ b/site_ansto/instrument/hipd/config/commands/eulerscan.tcl @@ -1,7 +1,22 @@ # Euler cradle scan commands for texture runs # AJS Dec 2010 +proc EulerScan {mstart mstep mend oscno} { + ephi speed 5 + ephi accel 5 + ephi decel 5 + echi speed 2 + set motdir 1 + drive echi 0 ephi $mstart + foreach chival {0 15 30 45 60 75 90} { + drive echi $chival + RadCollScanBi ephi $mstart $mstep $mend $oscno $motdir + set motdir [expr {$motdir * -1}] + } + drive echi 0 ephi $mstart +} +publish EulerScan user # continous scan for EPHI- the euler cradle phi stage (innermost axis) # note make sure controller 2 has the PHISCAN code in it diff --git a/site_ansto/instrument/hipd/config/hmm/hmm_configuration.tcl b/site_ansto/instrument/hipd/config/hmm/hmm_configuration.tcl index 47087171..58300baa 100644 --- a/site_ansto/instrument/hipd/config/hmm/hmm_configuration.tcl +++ b/site_ansto/instrument/hipd/config/hmm/hmm_configuration.tcl @@ -28,7 +28,7 @@ proc ::histogram_memory::init_OAT_TABLE {args} { hmm configure fat_frame_source INTERNAL - # set resolution "double_x" +# set resolution "double_x" switch $resolution { "hires" { diff --git a/site_ansto/instrument/hipd/config/hmm/hmm_rapid.tcl b/site_ansto/instrument/hipd/config/hmm/hmm_rapid.tcl index fd7c040f..d8b6931f 100644 --- a/site_ansto/instrument/hipd/config/hmm/hmm_rapid.tcl +++ b/site_ansto/instrument/hipd/config/hmm/hmm_rapid.tcl @@ -148,7 +148,7 @@ proc SetHistoOneShot {frq framenum } { bat_table -set NO_REPEAT_ENTRY 1 NO_REPEAT_TABLE 1 NO_EXECUTE_TABLE 1 PERIOD_INDICES { 0 1 } fat_table -set NOS_PERIODS $framenum oat_table -set T {0 2200000} NTC 1 - oat_table -set Y {-0.5 15.5} NYC 16 + oat_table -set Y {-0.5 31.5} NYC 16 histmem freq $frq histmem loadconf @@ -160,4 +160,22 @@ proc SetHistoOneShot {frq framenum } { publish SetHistoOneShot user +proc SetHistoStd {} { + histmem stop + hmm astop + FAT_TABLE -set MULTI_HOST_HISTO_STITCH_OVERLAP 8 MULTI_HOST_HISTO_JOIN_STITCH_ORDER INVERTED + OAT_TABLE -set X { 991.5 987.5 } NXC 248 Y { -0.5 3.5 } NYC 128 T { 0 20000 } NTC 1 + histmem loadconf +} +publish SetHistoStd user + +proc SetHistoDX {} { + histmem stop + hmm astop + FAT_TABLE -set MULTI_HOST_HISTO_STITCH_OVERLAP 16 MULTI_HOST_HISTO_JOIN_STITCH_ORDER INVERTED + OAT_TABLE -set X { 991.5 989.5 } NXC 496 Y { -0.5 3.5 } NYC 128 T { 0 20000 } NTC 1 + histmem loadconf +} + +publish SetHistoDX user diff --git a/site_ansto/instrument/hipd/config/motors/euler_configuration.tcl b/site_ansto/instrument/hipd/config/motors/euler_configuration.tcl index cb4b340e..4d59dad1 100644 --- a/site_ansto/instrument/hipd/config/motors/euler_configuration.tcl +++ b/site_ansto/instrument/hipd/config/motors/euler_configuration.tcl @@ -56,20 +56,20 @@ Motor ephi $motor_driver_type [params \ asyncqueue mc2\ axis C\ units degrees\ - hardlowerlim -185\ - hardupperlim 185\ + hardlowerlim -365\ + hardupperlim 365\ maxSpeed 5\ maxAccel 5\ - maxDecel 1\ + maxDecel 5\ stepsPerX -12500\ absEnc 1\ absEncHome $ephi_Home\ cntsPerX -4096] -setHomeandRange -motor ephi -home 0 -lowrange 180 -uprange 180 -ephi softlowerlim -180 -ephi softupperlim 180 +setHomeandRange -motor ephi -home 0 -lowrange -360 -uprange 360 +ephi softlowerlim -360 +ephi softupperlim 360 ephi home 0 -ephi speed 1 +ephi speed 3 ephi movecount $move_count ephi precision 0.01 ephi part sample diff --git a/site_ansto/instrument/hipd/config/motors/motor_configuration.tcl b/site_ansto/instrument/hipd/config/motors/motor_configuration.tcl index e3953a9f..837972bc 100644 --- a/site_ansto/instrument/hipd/config/motors/motor_configuration.tcl +++ b/site_ansto/instrument/hipd/config/motors/motor_configuration.tcl @@ -24,8 +24,9 @@ if {$sim_mode == "true"} { #set mx_Home 23263535 set mx_Home 8390583 #set mom_Home 9274794 -#set mom_Home 8391038 -set mom_Home 8147038 +##set mom_Home 8391038 +#set mom_Home 8147038 +set mom_Home 7979102 set mtth_Home 19927837 #set mphi_Home 7613516 #set mphi_Home 27847793 @@ -33,6 +34,7 @@ set mphi_Home 8384818 #set mchi_Home 9050090 #set mchi_Home 25561619 set mchi_Home 8389526 +#set mchi_Home 6847710 #set my_Home 6767221 set my_Home 8378212 set som_Home 17214054 @@ -342,7 +344,7 @@ Motor $sample_stage_rotate $motor_driver_type [params \ asyncqueue mc2\ axis E\ units degrees\ - hardlowerlim -71\ + hardlowerlim -121\ hardupperlim 116\ maxSpeed 5\ maxAccel 3\ @@ -362,8 +364,10 @@ Motor stth $motor_driver_type [params \ asyncqueue mc2\ axis F\ units degrees\ - hardlowerlim 15.8\ + hardlowerlim 13\ hardupperlim 29.7\ + softlowerlim 13.4\ + softupperlim 29.6\ maxSpeed 0.5\ maxAccel 0.1\ maxDecel 0.1\ @@ -373,7 +377,7 @@ Motor stth $motor_driver_type [params \ bias_bits 25\ bias_bias 932070\ cntsPerX -93207] -stth softlowerlim 15.9 +stth softlowerlim 13.4 stth softupperlim 29.6 stth home 28.481113 #stth home 18.981113 @@ -413,28 +417,34 @@ oct long_name oct ############################ # -# Monochromator Focusing (HOPG) -#Motor mf1 $motor_driver_type [params \ -# asyncqueue mc3\ -# axis A\ -# units degrees\ -# hardlowerlim xxxx\ -# hardupperlim xxxx\ -# maxSpeed xxxx\ -# maxAccel xxxx\ -# maxDecel xxxx\ -# stepsPerX xxxx\ -# absEnc 1\ -# absEncHome $mf1_Home\ -# cntsPerX xxxx] -#setHomeandRange -motor mf1 -home 0 -lowrange 0 -uprange 360 -#mf1 speed 1 -#mf1 movecount $move_count -#mf1 precision 0.01 -#mf1 part monochromator -#mf1 long_name mf1 +set mf_config 1 + +switch $mf_config { + 1 { +# Monochromator Focusing (HOPG) + Motor mf1 $motor_driver_type [params \ + asyncqueue mc3\ + axis A\ + units degrees\ + hardlowerlim -0.1\ + hardupperlim 1.1\ + maxSpeed 0.1\ + maxAccel 0.1\ + maxDecel 0.1\ + stepsPerX 22000\ + absEnc 1\ + absEncHome 3965\ + cntsPerX -3500] + setHomeandRange -motor mf1 -home 0 -lowrange 0 -uprange 1 + mf1 speed 0.02 +# mf1 movecount $move_count + mf1 precision 0.005 + mf1 part monochromator + mf1 long_name mf1 + } # Monochromator Focusing (Ge) + ## ffr 31/7/2012 ## absEncHome was found to be 16777217 on 31/7/2012 when the ## encoder clocked over to 114 counts to give a posn @@ -443,26 +453,32 @@ oct long_name oct ## and has a 24bit range (ie max cnt=16777216) ## I set a bias of 10000 counts with absenchome = 10000 ## so that SICS can drive the axis to the allowed limits. -Motor mf2 $motor_driver_type [params \ - asyncqueue mc3\ - axis A\ - units degrees\ - hardlowerlim -2\ - hardupperlim 2\ - maxSpeed 0.1\ - maxAccel 0.1\ - maxDecel 0.1\ - stepsPerX 22000\ - absEnc 1\ - absEncHome 42768\ - bias_bits 24\ - bias_bias 10000\ - cntsPerX -3500] -setHomeandRange -motor mf2 -home 0 -lowrange 0 -uprange 2 -mf2 speed 0.02 -mf2 precision 0.005 -mf2 part monochromator -mf2 long_name mf2 + + 2 { + + Motor mf2 $motor_driver_type [params \ + asyncqueue mc3\ + axis A\ + units degrees\ + hardlowerlim -0.1\ + hardupperlim 1.1\ + maxSpeed 0.1\ + maxAccel 0.1\ + maxDecel 0.1\ + stepsPerX 22000\ + absEnc 1\ + absEncHome 10000\ + bias_bits 24\ + bias_bias 10000\ + cntsPerX -3500] + setHomeandRange -motor mf2 -home 0 -lowrange 0 -uprange 1 + mf2 speed 0.02 + mf2 precision 0.005 + mf2 part monochromator + mf2 long_name mf2 + } +} + # Slit 1, right Motor ss1r $motor_driver_type [params \ diff --git a/site_ansto/instrument/hipd/config/motors/tilt_configuration.tcl b/site_ansto/instrument/hipd/config/motors/tilt_configuration.tcl index f4d77b6e..6681b7a6 100644 --- a/site_ansto/instrument/hipd/config/motors/tilt_configuration.tcl +++ b/site_ansto/instrument/hipd/config/motors/tilt_configuration.tcl @@ -1,7 +1,8 @@ # This must be loaded by motor_configuration.tcl set sphi_Home 7938520 -set schi_Home 7586052 +#set schi_Home 7586052 +set schi_Home 9932404 set sy_Home 7790194 set sx_Home 7556649 diff --git a/site_ansto/instrument/hipd/util/sics_config.ini b/site_ansto/instrument/hipd/util/sics_config.ini index ab40aac9..e67afd1d 100644 --- a/site_ansto/instrument/hipd/util/sics_config.ini +++ b/site_ansto/instrument/hipd/util/sics_config.ini @@ -104,7 +104,7 @@ name = sample_stage optype = motion_axis [12tmagnet_oxford] desc = "12 Tesla Oxford Magnet" -driver = "oxford_labview" +driver = "oxford12tlv" imptype = magnetic_field ip = 10.157.205.3 port = 55001 @@ -294,37 +294,17 @@ imptype = motion_axis asyncqueue = sct desc = "VF1 Blue furnace temperature controller" dev_id = 1 -driver = "west4100" -imptype = temperature -ip = 10.157.205.24 -port = 502 - -[vf1_west6100] -asyncprotocol = modbus_ap -desc = "VF1 Blue furnace 6100 temperature controller" -dev_id = 1 driver = "west_6100" imptype = temperature ip = 10.157.205.24 port = 502 -timeout = 2000 [vf2_west4100] asyncqueue = sct desc = "VF2 Blue furnace temperature controller" dev_id = 1 -driver = "west4100" -imptype = temperature -ip = 10.157.205.25 -port = 502 - -[vf2_west6100] -asyncprotocol = modbus_ap -desc = "VF2 Blue furnace 6100 temperature controller" -dev_id = 1 driver = "west_6100" imptype = temperature ip = 10.157.205.25 port = 502 -timeout = 2000 diff --git a/site_ansto/instrument/hipd/wombat_configuration.tcl b/site_ansto/instrument/hipd/wombat_configuration.tcl index e92da140..27c735d4 100644 --- a/site_ansto/instrument/hipd/wombat_configuration.tcl +++ b/site_ansto/instrument/hipd/wombat_configuration.tcl @@ -29,8 +29,9 @@ fileeval $cfPath(environment)/sct_agilent_33220A.tcl fileeval $cfPath(environment)/sct_hiden_xcs.tcl fileeval $cfPath(environment)/sct_huber_pilot.tcl fileeval $cfPath(environment)/sct_isotech_ps.tcl -fileeval $cfPath(environment)/temperature/sct_eurotherm_2000.tcl -fileeval $cfPath(environment)/temperature/sct_eurotherm_m2000.tcl +#fileeval $cfPath(environment)/temperature/sct_eurotherm_2000.tcl +#fileeval $cfPath(environment)/temperature/sct_eurotherm_m2000.tcl +fileeval $cfPath(environment)/temperature/eurotherm_3200_sct.tcl fileeval $cfPath(environment)/sct_keithley_2700.tcl fileeval $cfPath(environment)/sct_keithley_m2700.tcl fileeval $cfPath(environment)/temperature/sct_lakeshore_218.tcl @@ -52,6 +53,7 @@ fileeval $cfPath(environment)/temperature/sct_julabo_lh45_gen.tcl fileeval $cfPath(environment)/temperature/sct_qlink.tcl fileeval $cfPath(environment)/temperature/west400.tcl fileeval $cfPath(environment)/temperature/sct_west4100.tcl +fileeval $cfPath(environment)/temperature/sct_west_6100.tcl fileeval $cfPath(environment)/magneticField/sct_oxford_labview.tcl fileeval $cfPath(environment)/magneticField/sct_oxford12tlv.tcl fileeval $cfPath(environment)/he3/sct_he3.tcl @@ -65,13 +67,16 @@ fileeval $cfPath(commands)/pulser.tcl fileeval $cfPath(commands)/hvcommands.tcl fileeval $cfPath(commands)/vactex.tcl fileeval $cfPath(commands)/eulerscan.tcl +fileeval $cfPath(commands)/cfcommands.tcl fileeval $cfPath(anticollider)/anticollider.tcl +fileeval $cfPath(beamline)/sct_he3_polanal.tcl fileeval $cfPath(hmm)/hmm_rapid.tcl source gumxml.tcl # Wombat only change to hvcommands' scaleval variable SetVoltScale 2000.0 + # The Alice Thing # Qlink : 9600, 8 data, 1 stop, No Parity, None Flow # LS340 : 9600, 7 data, 1 stop, Odd Parity, None Flow From 0cff1f7c3cc9471e3c261d45e0777d2840e3f472 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 19 Feb 2015 15:51:41 +1100 Subject: [PATCH 21/22] Pullback from Kookaburra 2015-02-19 --- .../anticollider/anticollider_common.tcl | 26 ++++++++++--------- .../config/environment/sct_knauer_pump.tcl | 4 +-- .../temperature/sct_lakeshore_370.tcl | 2 +- .../temperature/sct_oxford_mercury.tcl | 2 +- .../config/anticollider/acscript.txt | 17 +++++++++--- .../config/anticollider/anticollider.tcl | 21 +++++++++++++++ .../config/motors/motor_configuration.tcl | 12 ++++----- .../kookaburra/config/scan/scan.tcl | 2 +- .../kookaburra/kookaburra_configuration.tcl | 3 +++ 9 files changed, 62 insertions(+), 27 deletions(-) diff --git a/site_ansto/instrument/config/anticollider/anticollider_common.tcl b/site_ansto/instrument/config/anticollider/anticollider_common.tcl index 209a3522..011ad101 100644 --- a/site_ansto/instrument/config/anticollider/anticollider_common.tcl +++ b/site_ansto/instrument/config/anticollider/anticollider_common.tcl @@ -93,6 +93,7 @@ proc ::anticollider::genveto {veto_rules} { lappend condlist $mot $range } lappend veto_region($vp(for)) [list $vp(forbid) @and $condlist] + unset condlist } elseif [info exists vp(when)] { lappend veto_region($vp(for)) [list $vp(forbid) $vp(when) $vp(in)] } else { @@ -132,12 +133,12 @@ proc ::anticollider::veto_region_acscript {args} { foreach row $veto_region($regmot) { if { [lindex $row 1] == "@and"} { set forbid [lindex $row 0] - set veto 0 + set veto 1 foreach {mot range} [lindex $row 2] { set pos [SplitReply [$mot]] foreach {lower upper} [join $range] { - if {$pos >= $lower && $pos <= $upper} { - set veto 1 + if {$pos < $lower || $pos > $upper} { + set veto 0 break } } @@ -147,7 +148,10 @@ proc ::anticollider::veto_region_acscript {args} { } else { foreach {min max} $forbid {} if {$min <= $target && $target <= $max} { - error "ERROR:The range ($forbid) is forbidden for $regmot when [lindex $row 2]" + foreach {mot range} [lindex $row 2] { + lappend msg [list $mot in $range] + } + error "ERROR:The range ($forbid) is forbidden for $regmot when [join $msg { and }]" } } } else { @@ -212,15 +216,13 @@ proc ::anticollider::init {} { lappend ::anticollider::scripts ::anticollider::veto_region_acscript proc ::anticollider::acscript {args} { set catch_status [ catch { - if {[::anticollider::enable $args] == "false"} { - return - } else { - foreach {regmot target} $args { - anticollision add 0 $regmot $target - } + foreach {regmot target} $args { + anticollision add 0 $regmot $target } - foreach script $::anticollider::scripts { - $script {*}$args + if {[::anticollider::enable $args] == "true"} { + foreach script $::anticollider::scripts { + $script {*}$args + } } } message ] handle_acscript_exception $catch_status $message diff --git a/site_ansto/instrument/config/environment/sct_knauer_pump.tcl b/site_ansto/instrument/config/environment/sct_knauer_pump.tcl index 1f269659..bc80d54a 100644 --- a/site_ansto/instrument/config/environment/sct_knauer_pump.tcl +++ b/site_ansto/instrument/config/environment/sct_knauer_pump.tcl @@ -3,7 +3,7 @@ # namespace eval ::scobj::knauer_pump { - set debug_threshold 0 + set debug_threshold 5 } proc ::scobj::knauer_pump::debug_log {tc_root debug_level debug_string} { @@ -1115,7 +1115,7 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio } hsetprop ${scobj_hpath} klass ${device_class} hsetprop ${scobj_hpath} data true - hsetprop ${scobj_hpath} debug_threshold 0 + hsetprop ${scobj_hpath} debug_threshold 5 if {[string equal -nocase "${simulation_flag}" "false"]} { ansto_makesctdrive ${name}_pump_volume_setp ${scobj_hpath}/pump/volume/setp ${scobj_hpath}/pump/volume/pval ${sct_controller} } diff --git a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl index 74233b4a..6fe63945 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl @@ -50,7 +50,7 @@ namespace eval ::scobj::[set vendor]_[set device] { proc debug_log {debug_level arg_string} { # write a timestamped string message to a log file for debugging - set debug_threshold 0 + set debug_threshold 5 if {$debug_level >= $debug_threshold} { set fd [open "[set [namespace current]::log_file]" "a"] set line "[clock format [clock seconds] -format "%T"] $arg_string" diff --git a/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl b/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl index 22ebad6b..67266192 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl @@ -58,7 +58,7 @@ namespace eval ::scobj::[set vendor]_[set device] { proc debug_log {debug_level arg_string} { # write a timestamped string message to a log file for debugging - set debug_threshold 0 + set debug_threshold 5 if {$debug_level >= $debug_threshold} { set fd [open "[set [namespace current]::log_file]" "a"] set line "[clock format [clock seconds] -format "%T"] $arg_string" diff --git a/site_ansto/instrument/kookaburra/config/anticollider/acscript.txt b/site_ansto/instrument/kookaburra/config/anticollider/acscript.txt index 8ab23c54..b7ef8bc9 100644 --- a/site_ansto/instrument/kookaburra/config/anticollider/acscript.txt +++ b/site_ansto/instrument/kookaburra/config/anticollider/acscript.txt @@ -1,4 +1,13 @@ -# Forbid detector motion when the detector voltage is on -# comment out -- Jing -#forbid {-inf inf} for det when dhv1 in {800 inf} -#forbid {-inf inf} for detoff when dhv1 in {800 inf} +# Prevent m2om encoder from driving into sample holder. +forbid {10 inf} for m2om whenall {m2y in {-inf 200} m2om in {-inf 10}} +forbid {-inf 170} for m2om whenall {m2y in {-inf 200} m2om in {170 inf}} +forbid {-inf inf} for m2om whenall {m2y in {-inf 200} m2om in {11 169}} +forbid {-inf 200} for m2y when m2om in {10 170} + +# Following two rules allow recovery if m2om position has crept above 10 or below 170 +forbid {11 inf} for m2om whenall {m2y in {-inf 200} m2om in {10 11}} +forbid {-inf 169} for m2om whenall {m2y in {-inf 200} m2om in {169 170}} + +# Protect long Cd tunnel +forbid {-5.65 inf} for m2x when m2om in {170 182} +forbid {55.43 inf} for m2x when m2om in {-2 10} diff --git a/site_ansto/instrument/kookaburra/config/anticollider/anticollider.tcl b/site_ansto/instrument/kookaburra/config/anticollider/anticollider.tcl index 85a5de00..c0a09f35 100644 --- a/site_ansto/instrument/kookaburra/config/anticollider/anticollider.tcl +++ b/site_ansto/instrument/kookaburra/config/anticollider/anticollider.tcl @@ -12,3 +12,24 @@ proc ::anticollider::enable {args} { } ::anticollider::loadscript acscript.txt + +# Default enable or disable anticollision for all axes +# TODO: Provide a list of motors to enable or disable +proc anticollider {args} { + set usage "Usage: anticollider (enable | disable)" + if {$args == "enable"} { + # TODO change protect_detector to just 'protect' + ::anticollider::protect_detector "true" + } elseif {$args == "disable"} { + ::anticollider::protect_detector "false" + } elseif {$args == "help"} { + clientput $usage + } else { + if {[SplitReply [::anticollider::protect_detector]] == "false"} { + clientput "Anticollision disabled on all axes" + } else { + clientput "Anticollision enabled on all axes" + } + } +} +publish anticollider user diff --git a/site_ansto/instrument/kookaburra/config/motors/motor_configuration.tcl b/site_ansto/instrument/kookaburra/config/motors/motor_configuration.tcl index 3a3cc835..bbaa44f5 100644 --- a/site_ansto/instrument/kookaburra/config/motors/motor_configuration.tcl +++ b/site_ansto/instrument/kookaburra/config/motors/motor_configuration.tcl @@ -235,7 +235,7 @@ Motor m1chi $motor_driver_type [params \ cntsPerX [expr 131072*100.0/68.681]\ nopowersave 1] m1chi precision 0.001 -m1chi speed 0.200 +m1chi speed 0.137362 m1chi part crystal m1chi long_name m1chi m1chi softlowerlim -2 @@ -435,7 +435,7 @@ Motor samz $motor_driver_type [params \ stepsPerX [expr 25000.0 * 100 / 10.0]\ cntsPerX 819.2\ absEnc 1\ - absEncHome 72607] + absEncHome 75330] samz part sample samz long_name samz samz softlowerlim 0 @@ -590,7 +590,7 @@ Motor m2chi $motor_driver_type [params \ cntsPerX [expr 131072*100.0/68.681]\ nopowersave 1] m2chi precision 0.001 -m2chi speed 0.200 +m2chi speed 0.137362 m2chi part crystal m2chi long_name m2chi m2chi softlowerlim -2 @@ -610,7 +610,7 @@ Motor m2om $motor_driver_type [params \ port pmc3-kookaburra\ axis F\ units degrees\ - hardlowerlim 0\ + hardlowerlim -2\ hardupperlim 182\ maxSpeed [expr 300000.0/$m2omSetRate]\ maxAccel [expr 25000.0/$m2omSetRate]\ @@ -673,7 +673,7 @@ Motor m2y $motor_driver_type [params \ axis H\ units mm\ hardlowerlim -4.35\ - hardupperlim 357.9\ + hardupperlim 400\ maxSpeed [expr 100000.0/$m2ySetRate]\ maxAccel [expr 25000.0/$m2ySetRate]\ maxDecel [expr 25000.0/$m2ySetRate]\ @@ -685,7 +685,7 @@ m2y speed 0.5 m2y part crystal m2y long_name m2y m2y softlowerlim -4.3 -m2y softupperlim 355 +m2y softupperlim 399 m2y home 0 diff --git a/site_ansto/instrument/kookaburra/config/scan/scan.tcl b/site_ansto/instrument/kookaburra/config/scan/scan.tcl index d2dadee7..491719c7 100644 --- a/site_ansto/instrument/kookaburra/config/scan/scan.tcl +++ b/site_ansto/instrument/kookaburra/config/scan/scan.tcl @@ -32,7 +32,7 @@ proc thresholdscan {minVoltage maxVoltage stepVoltage minBMThreshold manBMThresh clientput "Start scanning loop now" for {set vol $minVoltage} {$vol <= $maxVoltage} {incr vol $stepVoltage} { - emHV1 $vol +# emHV1 $vol set curCount "" for {set thres $minBMThreshold} {$thres <= $manBMThreshold} {incr thres $stepBMThreshold} { clientput "set thredshold to $thres" diff --git a/site_ansto/instrument/kookaburra/kookaburra_configuration.tcl b/site_ansto/instrument/kookaburra/kookaburra_configuration.tcl index b719b85e..f1f984cc 100644 --- a/site_ansto/instrument/kookaburra/kookaburra_configuration.tcl +++ b/site_ansto/instrument/kookaburra/kookaburra_configuration.tcl @@ -45,6 +45,8 @@ fileeval $cfPath(environment)/temperature/sct_mercury_valve.tcl fileeval $cfPath(environment)/sct_protek_common.tcl fileeval $cfPath(environment)/sct_protekmm.tcl fileeval $cfPath(environment)/temperature/sct_julabo_lh45_gen.tcl +fileeval $cfPath(environment)/sct_rheometer.tcl +fileeval $cfPath(environment)/sct_antonparr_MCR500.tcl fileeval $cfPath(counter)/sct_bm.tcl fileeval $cfPath(hmm)/hmm_configuration.tcl fileeval $cfPath(nexus)/nxscripts.tcl @@ -54,6 +56,7 @@ fileeval $cfPath(commands)/commands.tcl fileeval $cfPath(anticollider)/anticollider.tcl fileeval $cfPath(parameters)/parameters.tcl + source gumxml.tcl ::utility::mkVar ::anticollider::protect_detector text manager protect_detector false detector true false From 27c3a48d913f45818e75255008eb2971853ff493 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 19 Feb 2015 15:59:22 +1100 Subject: [PATCH 22/22] Pullback from Dingo 2015-02-19 --- .../temperature/sct_lakeshore_370.tcl | 2 +- .../temperature/sct_oxford_mercury.tcl | 2 +- .../instrument/dingo/config/plc/plc.tcl | 34 +++++++++++++++---- .../instrument/dingo/dingo_configuration.tcl | 25 ++++++++++++-- .../instrument/dingo/sics_simulation.tcl | 2 +- site_ansto/instrument/server_config.tcl | 31 ++++++++--------- 6 files changed, 67 insertions(+), 29 deletions(-) diff --git a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl index 74233b4a..6fe63945 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl @@ -50,7 +50,7 @@ namespace eval ::scobj::[set vendor]_[set device] { proc debug_log {debug_level arg_string} { # write a timestamped string message to a log file for debugging - set debug_threshold 0 + set debug_threshold 5 if {$debug_level >= $debug_threshold} { set fd [open "[set [namespace current]::log_file]" "a"] set line "[clock format [clock seconds] -format "%T"] $arg_string" diff --git a/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl b/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl index 22ebad6b..67266192 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl @@ -58,7 +58,7 @@ namespace eval ::scobj::[set vendor]_[set device] { proc debug_log {debug_level arg_string} { # write a timestamped string message to a log file for debugging - set debug_threshold 0 + set debug_threshold 5 if {$debug_level >= $debug_threshold} { set fd [open "[set [namespace current]::log_file]" "a"] set line "[clock format [clock seconds] -format "%T"] $arg_string" diff --git a/site_ansto/instrument/dingo/config/plc/plc.tcl b/site_ansto/instrument/dingo/config/plc/plc.tcl index 1386c276..531c7902 100644 --- a/site_ansto/instrument/dingo/config/plc/plc.tcl +++ b/site_ansto/instrument/dingo/config/plc/plc.tcl @@ -5,8 +5,6 @@ if {$sim_mode == "false"} { MakeSafetyPLC plc plc_chan 0 } -makesctcontroller sct_shutter std 137.157.204.213:30000 - # Configuration Note: # # A default setting has been set in safetyplc.c code. following configuration @@ -51,14 +49,38 @@ proc focuslight {args} { sct_shutter transact $cmd } -proc tertiary_shutter {args} { - set cmd "set tertiary shutter=$args\r\n" - sct_shutter transact $cmd +proc tertiary {sw} { + set sw [string tolower $sw] + switch $sw { + "open" { + wait 1 + plc_chan send set output=0 + wait 1 + plc_chan send set output=3 + wait 1 + plc_chan send set output=1 + wait 1 + plc_chan send set output=3 + } + "close" { + wait 1 + plc_chan send set output=0 + wait 1 + plc_chan send set output=3 + wait 1 + plc_chan send set output=2 + wait 1 + plc_chan send set output=3 + } + default { + clientput ERROR: [info level 0] command should be open or close not $sw + } + } } publish shutter user publish focuslight user -publish tertiary_shutter user +publish tertiary user source $cfPath(plc)/plc_common_1.tcl diff --git a/site_ansto/instrument/dingo/dingo_configuration.tcl b/site_ansto/instrument/dingo/dingo_configuration.tcl index 0c6c3804..144390ee 100644 --- a/site_ansto/instrument/dingo/dingo_configuration.tcl +++ b/site_ansto/instrument/dingo/dingo_configuration.tcl @@ -21,14 +21,33 @@ fileeval $cfPath(source)/source.tcl fileeval $cfPath(motors)/motor_configuration.tcl #fileeval $cfPath(motors)/positmotor_configuration.tcl #fileeval $cfPath(motors)/extraconfig.tcl -#fileeval $cfPath(plc)/plc.tcl +fileeval $cfPath(plc)/plc.tcl #fileeval $cfPath(counter)/counter.tcl #fileeval $cfPath(hmm)/hmm_configuration.tcl +fileeval $cfPath(environment)/sct_agilent_33220A.tcl +fileeval $cfPath(environment)/sct_isotech_ps.tcl +fileeval $cfPath(environment)/sct_keithley_2700.tcl +fileeval $cfPath(environment)/sct_keithley_m2700.tcl +fileeval $cfPath(environment)/temperature/sct_lakeshore_218.tcl +fileeval $cfPath(environment)/temperature/sct_lakeshore_336.tcl +fileeval $cfPath(environment)/temperature/sct_ls336.tcl +fileeval $cfPath(environment)/temperature/sct_lakeshore_340.tcl +fileeval $cfPath(environment)/temperature/sct_ls340.tcl +fileeval $cfPath(environment)/temperature/sct_mercury_base.tcl +fileeval $cfPath(environment)/temperature/sct_mercury_level.tcl +fileeval $cfPath(environment)/temperature/sct_mercury_pres.tcl +fileeval $cfPath(environment)/temperature/sct_mercury_scpi.tcl +fileeval $cfPath(environment)/temperature/sct_mercury_temp.tcl +fileeval $cfPath(environment)/temperature/sct_mercury_valve.tcl +fileeval $cfPath(environment)/sct_protek_common.tcl +fileeval $cfPath(environment)/sct_protekmm.tcl +fileeval $cfPath(environment)/temperature/west400.tcl +fileeval $cfPath(environment)/temperature/sct_west4100.tcl fileeval $cfPath(nexus)/nxscripts.tcl fileeval $cfPath(scan)/scan.tcl fileeval $cfPath(commands)/commands.tcl -#fileeval $cfPath(commands)/pulser.tcl -#fileeval $cfPath(commands)/hvcommands.tcl +fileeval $cfPath(commands)/pulser.tcl +fileeval $cfPath(commands)/hvcommands.tcl fileeval $cfPath(anticollider)/anticollider.tcl source gumxml.tcl diff --git a/site_ansto/instrument/dingo/sics_simulation.tcl b/site_ansto/instrument/dingo/sics_simulation.tcl index d1fad2a9..400867c3 100644 --- a/site_ansto/instrument/dingo/sics_simulation.tcl +++ b/site_ansto/instrument/dingo/sics_simulation.tcl @@ -12,7 +12,7 @@ foreach {simflag icsval fakedev} { motor_simulation false false chopper_simulation false true velsel_simulation false true - plc_simulation true true + plc_simulation false true rfgen_simulation false true goniometer_simulation false true magnetic_simulation false true diff --git a/site_ansto/instrument/server_config.tcl b/site_ansto/instrument/server_config.tcl index 64e1ece4..2d6732c2 100644 --- a/site_ansto/instrument/server_config.tcl +++ b/site_ansto/instrument/server_config.tcl @@ -254,25 +254,20 @@ proc waitaction {obj action args} { publish waitaction user proc server_set_sobj_attributes {} { - if [ catch { - motor_set_sobj_attributes - ::utility::set_motor_attributes + if [ catch { motor_set_sobj_attributes } msg ] { puts $msg } + if [ catch { ::utility::set_motor_attributes } msg ] { puts $msg } #XXX::utility::set_histomem_attributes - ::utility::set_sobj_attributes - ::utility::set_envcontrol_attributes - ::plc::set_sobj_attributes - ::counter::set_sobj_attributes - ::nexus::set_sobj_attributes - ::histogram_memory::set_sobj_attributes - ::utility::set_chopper_attributes - ::utility::set_sct_object_attributes + if [ catch { ::utility::set_sobj_attributes } msg ] { puts $msg } + if [ catch { ::utility::set_envcontrol_attributes } msg ] { puts $msg } + if [ catch { ::plc::set_sobj_attributes } msg ] { puts $msg } + if [ catch { ::counter::set_sobj_attributes } msg ] { puts $msg } + if [ catch { ::nexus::set_sobj_attributes } msg ] { puts $msg } + if [ catch { ::histogram_memory::set_sobj_attributes } msg ] { puts $msg } + if [ catch { ::utility::set_chopper_attributes } msg ] { puts $msg } + if [ catch { ::utility::set_sct_object_attributes } msg ] { puts $msg } ## TODO move the following to the new ansto gumxml.tcl - sicslist setatt getgumtreexml privilege internal + if [ catch { sicslist setatt getgumtreexml privilege internal } msg ] { puts $msg } clientput "serverport $::serverport" - } message ] { - if {$::errorCode=="NONE"} {return $message} - return -code error $message - } } proc server_init {} { @@ -312,9 +307,11 @@ proc server_init {} { if [file exists ../extraconfig.tcl] { fileeval ../extraconfig.tcl } +clientput "DBG 1" server_set_sobj_attributes +clientput "DBG 2" buildHDB instrument_dictionary - +clientput "DBG 3" } message ] handle_exception $catch_status $message }