From 00574586eade868f3a2c144773f53cc8934c59db Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 6 Nov 2014 16:14:51 +1100 Subject: [PATCH 01/24] Import of changes in 3.2 --- site_ansto/instrument/util/gen_sct.py | 868 ++++++++++++++++++-------- 1 file changed, 614 insertions(+), 254 deletions(-) diff --git a/site_ansto/instrument/util/gen_sct.py b/site_ansto/instrument/util/gen_sct.py index 050897cd..97dbc0bb 100755 --- a/site_ansto/instrument/util/gen_sct.py +++ b/site_ansto/instrument/util/gen_sct.py @@ -30,17 +30,10 @@ # import os +import re import ply.lex as lex import ply.yacc as yacc -global Verbose -global DriverDump -global CodeDump -global FunctionTypes -global DriveableFunctionTypes -global NumberOfLinesIn -global NumberOfLinesOut - states = ( ('tcl', 'exclusive'), ) @@ -63,6 +56,34 @@ DriveableFunctionTypes = [ Verbose = False DriverDump = False CodeDump = False +PrintedFileName = -1 +NumberOfLinesIn = 0 +NumberOfLinesOut = 0 +SourceFileList = [] +SourceLineList = [] + +def PrintParseError(message): + global PrintedFileName + global lexer + global SourceLineList, SourceData + curr_line = lexer.lineno + curr_file = SourceLineList[curr_line - 1][0] + if curr_file != PrintedFileName: + PrintedFileName = curr_file + SourceFile = SourceFileList[curr_file] + print "in", SourceFile + print message + print "%4d:" % SourceLineList[curr_line - 1][1], SourceData[curr_line - 1] + +def PrintPostError(message): + global PrintedFileName + global SourceLineList + curr_file = 0 + if curr_file != PrintedFileName: + PrintedFileName = curr_file + SourceFile = SourceFileList[curr_file] + print "in", SourceFile + print message # # Tokenizer: This recognizes the tokens which can be keywords, identifiers, @@ -96,6 +117,7 @@ reserved = { 'VAR' : 'VAR', 'PROPERTY' : 'PROPERTY', 'CONTROL' : 'CONTROL', + 'CONDITIONAL' : 'CONDITIONAL', 'DATA' : 'DATA', 'NXSAVE' : 'NXSAVE', 'MUTABLE' : 'MUTABLE', @@ -212,16 +234,17 @@ def t_tcl_newline(t): t.lexer.lineno += t.value.count("\n") def t_tcl_error(t): - print("Illegal tcl character '%s'" % t.value[0]) + message = "Illegal tcl character '%s'" % t.value[0] + PrintParseError(message) t.lexer.skip(1) def t_TEXT_STRING1(t): - r'\'[^\']+\'' + r'\'[^\']*\'' t.value = t.value[1:-1] return t def t_TEXT_STRING2(t): - r"\"[^\"]+\"" + r"\"[^\"]*\"" t.value = t.value[1:-1] return t @@ -240,7 +263,8 @@ def t_FLOATER(t): try: t.value = float(t.value) except ValueError: - print "Floating value invalid:", t.value + message = "Floating value invalid: " + repr(t.value) + PrintParseError(message) t.value = 0.0 return t @@ -249,7 +273,8 @@ def t_INTEGER(t): try: t.value = int(t.value) except ValueError: - print "Integer value too large:", t.value + message = "Integer value too large: " + repr(t.value) + PrintParseError(message) t.value = 0 return t @@ -270,7 +295,9 @@ def t_newline(t): t.lexer.lineno += t.value.count("\n") def t_error(t): - print("Illegal character '%s'" % t.value[0]) + message = "Illegal character '%s' at line %d" % \ + (t.value[0], t.lexer.lineno) + PrintParseError(message) t.lexer.skip(1) # @@ -430,6 +457,7 @@ def p_var_typ_ass(p): | DATA EQUALS true_false | NXSAVE EQUALS true_false | MUTABLE EQUALS true_false + | CONDITIONAL EQUALS text_string ''' p[0] = { p[1] : p[3] } @@ -532,6 +560,14 @@ def p_code(p): | CODE code_type id_or_str EQUALS LBRACE tcl_code_block RBRACE | CODE code_type id_or_str EQUALS TCL_BEG code_block TCL_END ''' + if p[3].lower() == 'preamble': + name = 'preamble' + elif p[3].lower() == 'postamble': + name = 'postamble' + elif p[3].lower() == 'mkdriver': + name = 'mkDriver' + elif p[3].lower() == 'mkwrapper': + name = 'mkWrapper' p[0] = { 'Code' : { 'name' : p[3], 'type' : p[2], 'text' : p[6] }} def p_code_type(p): @@ -585,7 +621,10 @@ def p_empty(p): pass def p_error(t): - print("Syntax error at '%s'" % t.value), t + message = "Syntax error at line %d" % lexer.lineno + message += " " + repr(t) + message += " " + repr(t.value) + PrintParseError(message) # # Utility functions @@ -598,6 +637,54 @@ def make_path(MyVar): path += MyVar['name'] return path +def generate_filename(MyDriver): + global args + old_name = "sct_%s.tcl" % MyDriver['name'] + new_name = "%s_sct.tcl" % MyDriver['name'] + if 'PathName' in MyDriver: + full_old_name = os.path.join(MyDriver['PathName'], old_name) + full_new_name = os.path.join(MyDriver['PathName'], new_name) + else: + full_old_name = old_name + full_new_name = new_name + + # This block of code generates shell commands to help the old->new rename + if Move: + fd = open("git_mv.sh", "a") + fd.write( "git mv " + full_old_name + " " + full_new_name + "\n") + fd.close() + fd = open("grep_sed.sh", "a") + fd.write( "for f in $(grep " + old_name + " instrument -Irl" + "); do\n") + fd.write( " echo ${f}\n") + fd.write( " sed -i ${f} -e 's/" + old_name + "/" + new_name + "/'\n") + fd.write( "done\n") + fd.close() + + if args.sct == "before": + MyDriver['filename'] = old_name + MyDriver['fullname'] = full_old_name + else: + MyDriver['filename'] = new_name + MyDriver['fullname'] = full_new_name + +def parse_args(arg_str): + ''' + Parse the TCL argument string into a list of identifiers (in order) plus + a map of identifier to default value (or None) returned as a 2-tuple + ''' + arg_list = re.findall(r'({[^}]+}|[A-Za-z0-9_]+)', arg_str) + arg_lst = [] + arg_map = {} + for arg in arg_list: + if arg.startswith('{'): + bits = arg[1:-1].split(None, 1) + arg_lst.append(bits[0]) + arg_map[bits[0]] = bits[1] + else: + arg_lst.append(arg) + arg_map[arg] = None + return (arg_lst, arg_map) + # # This section handles building a driver tree from the Abstract Syntax Tree # generated by the parser. The driver tree has all of the defaults and @@ -709,7 +796,8 @@ def build_variable(MyDriver, p): MyDriver['Funcs'][MyVar[func]]['type'] = func else: # TODO FIXME error message - print 'Error: Function type mismatch: var = ' + str(MyVar) + ', code = ' + str(MyDriver['Funcs'][MyVar[func]]) + ', func = ' + str(func) + message = 'Error: Function type mismatch: var = ' + str(MyVar) + ', code = ' + str(MyDriver['Funcs'][MyVar[func]]) + ', func = ' + str(func) + PrintPostError(message) MyDriver['Funcs'][MyVar[func]]['reference_count'] += 1 if 'permlink' in MyVar: device_type, node_type = MyVar['permlink'].split('.') @@ -802,6 +890,30 @@ def adjust_group(MyGroup): if Verbose: print 'post adjust_group', MyGroup +def check_func_code(MyDriver): + for name in MyDriver['Funcs']: + #print name + left_paren_count = 0 + right_paren_count = 0 + left_brack_count = 0 + right_brack_count = 0 + left_brace_count = 0 + right_brace_count = 0 + for idx, line in enumerate(MyDriver['Funcs'][name]['text']): + #print "%4d:" % (idx + 1), line + left_paren_count += line.count('(') + right_paren_count += line.count(')') + left_brack_count += line.count('[') + right_brack_count += line.count(']') + left_brace_count += line.count('{') + right_brace_count += line.count('}') + if left_paren_count != right_paren_count: + PrintPostError("Warning: Mismatched Parens in function %s (%d != %d)" % (name, left_paren_count, right_paren_count)) + if left_brack_count != right_brack_count: + PrintPostError("Warning: Mismatched Brackets in function %s (%d != %d)" % (name, left_brack_count, right_brack_count)) + if left_brace_count != right_brace_count: + PrintPostError("Warning: Mismatched Braces in function %s (%d != %d)" % (name, left_brace_count, right_brace_count)) + def build_driver(MyDriver, TheTree): if Verbose: print "TheTree:", TheTree @@ -834,7 +946,34 @@ def build_driver(MyDriver, TheTree): MyDriver[key] = item[key] for item in MyDriver['Permlink']: if len(MyDriver['Permlink'][item]) > 1: - print 'Error: duplicate permlink entries for "%s"' % item, MyDriver['Permlink'][item] + message = 'Error: duplicate permlink entries for "%s"' % item + message += " " + repr(MyDriver['Permlink'][item]) + PrintPostError(message) + if 'add_args' in MyDriver: + MyDriver['add_args_lst'], MyDriver['add_args_map'] = parse_args(MyDriver['add_args']) + if Verbose: + print "ADD_ARGS:", MyDriver['add_args'] + arg_map = MyDriver['add_args_map'] + for arg in arg_map: + print ' %s:' % arg, arg_map[arg] + if 'make_args' in MyDriver: + MyDriver['make_args_lst'], MyDriver['make_args_map'] = parse_args(MyDriver['make_args']) + if Verbose: + print "MAKE_ARGS:", MyDriver['make_args'] + arg_map = MyDriver['make_args_map'] + for arg in arg_map: + print ' %s:' % arg, arg_map[arg] + if 'protocol_args' in MyDriver: + MyDriver['protocol_args_lst'], MyDriver['protocol_args_map'] = parse_args(MyDriver['protocol_args']) + if Verbose: + print "PROTOCOL_ARGS:", MyDriver['protocol_args'] + arg_map = MyDriver['protocol_args_map'] + for arg in arg_map: + print ' %s:' % arg, arg_map[arg] + if 'add_args_lst' in MyDriver and 'make_args_lst' in MyDriver: + if MyDriver['add_args_lst'] != MyDriver['make_args_lst']: + print "Add_Args:", MyDriver['add_args_lst'] + print "Make_Args:", MyDriver['make_args_lst'] if Verbose: print "MyDriver:", MyDriver # @@ -872,10 +1011,10 @@ def dump_driver_groups(groups, indent): if Comment in groups[item]: print indent + ' # %s = \'%s\'' % (Comment, groups[item][Comment]) for subitem in sorted([x for x in groups[item] if not x in Deferred]): - print indent + ' ', subitem, '=', groups[item][subitem] + print indent + ' ', subitem, '= \'%s\'' % groups[item][subitem] if 'GroupProperty' in groups[item]: for subitem in groups[item]['GroupProperty']: - print indent + ' GroupProperty', subitem, '=', groups[item]['GroupProperty'][subitem] + print indent + ' GroupProperty', subitem, '= \'%s\'' % groups[item]['GroupProperty'][subitem] dump_driver_vars(groups[item]['Vars'], indent) dump_driver_groups(groups[item]['Groups'], indent + ' ') print indent + '}' @@ -893,6 +1032,12 @@ def dump_driver_funcs(funcs): def dump_driver(MyDriver): print 'DRIVER ' + MyDriver['name'] + ' = {' Comments = ['PathName', 'Permlink'] + Comments += ['add_args_lst'] + Comments += ['add_args_map'] + Comments += ['make_args_lst'] + Comments += ['make_args_map'] + Comments += ['protocol_args_lst'] + Comments += ['protocol_args_map'] Deferred = ['Groups', 'Funcs', 'Deferred', 'name'] + Comments for Comment in sorted(Comments): if Comment in MyDriver: @@ -924,12 +1069,17 @@ def put_preamble(MyDriver): txt += ['namespace eval %s {' % MyDriver['namespace']] txt += [' set debug_threshold %s' % str( MyDriver['debug_threshold'])] if len(MyDriver['Permlink']) > 0: - if 'make_args' in MyDriver and 'id' in MyDriver['make_args'].split(): + if 'make_args_lst' in MyDriver and 'id' in MyDriver['make_args_lst']: pass else: txt += [' if { ![info exists ::scobj::permlink_device_counter]} {'] txt += [' set ::scobj::permlink_device_counter 0'] txt += [' }'] + func = 'preamble' + if func in MyDriver['Funcs']: + txt += ['# %s hook code starts' % func] + txt += MyDriver['Funcs'][func]['text'] + txt += ['# %s hook code ends' % func] txt += ['}'] txt += [''] txt += ['proc %s::debug_log {tc_root debug_level debug_string} {' % MyDriver['namespace']] @@ -1158,7 +1308,12 @@ def put_checkstatus_function(MyDriver, func): txt += ['# %s hook code goes here' % func] txt += [' if {[sct driving]} {'] txt += [' set sp "[sct target]"'] - txt += [' set pv "[hval ${tc_root}/[sct driveable]]"'] + txt += [' if {[hpropexists [sct] simulated] && [sct simulated] == "true"} {'] + txt += [' set pv "${sp}"'] + txt += [' hset ${tc_root}/[sct driveable] ${sp}'] + txt += [' }'] + txt += [' set pv "[hval ${tc_root}/[sct driveable]]"'] + txt += [' }'] txt += [' if { abs(${pv} - ${sp}) <= [sct tolerance] } {'] txt += [' if { [hpropexists [sct] settle_time] } {'] txt += [' if { [hpropexists [sct] settle_time_start] } {'] @@ -1239,159 +1394,201 @@ def put_pid_function(MyDriver, func): txt += ['}'] emit(txt) -def put_group(MyDriver, MyGroup): +def put_var(MyDriver, MyGroup, MyVar): readable_or_writeable = False + txt = [' # Start of var: ' + MyVar['name']] + postfix = [] + if MyGroup['name']: + nodename = MyGroup['path'] + '/' + MyVar['name'] + else: + nodename = MyVar['name'] + + # Check driveable attributes are present if required + if 'driveable' in MyVar and MyVar['driveable']: + for attr in ('lowerlimit', 'upperlimit', 'tolerance'): + if attr not in MyVar: + msg = 'Driveable: %s does not have required attribute: %s' % (nodename, attr) + print 'Warning:', msg + txt += [' # Warning: ' + msg] + # Check PID attributes are present if required + if 'pid_function' in MyVar: + for attr in ('pid_pvalue', + 'pid_ivalue', + 'pid_dvalue', + 'pid_imax', + 'pid_error', + 'pid_deriv', + 'pid_integ', + ): + if attr not in MyVar['Property']: + msg = 'PID: %s does not have required attribute: %s' % (nodename, attr) + print 'Warning:', msg + txt += [' # Warning: ' + msg] + + txt += [' hfactory ${scobj_hpath}/%s plain %s %s' % (nodename, MyVar['priv'], MyVar['type'])] + if MyVar['readable'] > 0: + readable_or_writeable = True + fetch_func = MyVar['fetch_function'] + if fetch_func == 'none': + fetch_func = 'getValue' + read_func = MyVar['read_function'] + if 'read_command' in MyVar: + read_command = MyVar['read_command'] + else: + read_command = '' + txt += [' hsetprop ${scobj_hpath}/%s read ${ns}::%s ${scobj_hpath} %s {%s}' % (nodename, fetch_func, read_func, read_command)] + txt += [' hsetprop ${scobj_hpath}/%s %s ${ns}::%s ${scobj_hpath}' % (nodename, read_func, read_func)] + if MyVar['writeable'] > 0 or MyVar['driveable']: + readable_or_writeable = True + check_func = MyVar['check_function'] + checkrange_func = MyVar['checkrange_function'] + write_func = MyVar['write_function'] + if 'write_command' in MyVar: + write_command = MyVar['write_command'] + else: + write_command = '' + txt += [' hsetprop ${scobj_hpath}/%s write ${ns}::%s ${scobj_hpath} %s {%s}' % (nodename, write_func, check_func, write_command)] + txt += [' hsetprop ${scobj_hpath}/%s %s ${ns}::%s ${scobj_hpath}' % (nodename, check_func, check_func)] + txt += [' hsetprop ${scobj_hpath}/%s check ${ns}::%s ${scobj_hpath}' % (nodename, checkrange_func)] + if MyVar['driveable']: + halt_func = MyVar['halt_function'] + checklimits_func = MyVar['checklimits_function'] + checkstatus_func = MyVar['checkstatus_function'] + txt += [' hsetprop ${scobj_hpath}/%s driving 0' % nodename] + txt += [' hsetprop ${scobj_hpath}/%s checklimits ${ns}::%s ${scobj_hpath}' % (nodename, checklimits_func)] + txt += [' hsetprop ${scobj_hpath}/%s checkstatus ${ns}::%s ${scobj_hpath}' % (nodename, checkstatus_func)] + txt += [' hsetprop ${scobj_hpath}/%s halt ${ns}::%s ${scobj_hpath}' % (nodename, halt_func)] + txt += [' hsetprop ${scobj_hpath}/%s driveable %s' % (nodename, MyVar['driveable'])] + if 'control' in MyVar: + txt += [' hsetprop ${scobj_hpath}/%s control %s' % (nodename, MyVar['control'])] + if 'data' in MyVar: + txt += [' hsetprop ${scobj_hpath}/%s data %s' % (nodename, MyVar['data'])] + if 'mutable' in MyVar: + txt += [' hsetprop ${scobj_hpath}/%s mutable %s' % (nodename, MyVar['mutable'])] + if 'nxsave' in MyVar: + txt += [' hsetprop ${scobj_hpath}/%s nxsave %s' % (nodename, MyVar['nxsave'])] + if 'lowerlimit' in MyVar: + txt += [' hsetprop ${scobj_hpath}/%s lowerlimit %s' % (nodename, MyVar['lowerlimit'])] + if 'upperlimit' in MyVar: + txt += [' hsetprop ${scobj_hpath}/%s upperlimit %s' % (nodename, MyVar['upperlimit'])] + if 'tolerance' in MyVar: + txt += [' hsetprop ${scobj_hpath}/%s tolerance %s' % (nodename, MyVar['tolerance'])] + if 'units' in MyVar: + txt += [' hsetprop ${scobj_hpath}/%s units %s' % (nodename, MyVar['units'])] + if 'allowed' in MyVar: + txt += [' hsetprop ${scobj_hpath}/%s values %s' % (nodename, MyVar['allowed'])] + if 'permlink' in MyVar: + device_type, node_type = MyVar['permlink'].split('.') + if device_type.startswith("#"): + if 'make_args_lst' in MyDriver and 'permlink' in MyDriver['make_args_lst']: + idx = int(device_type[1:]) + device_type = '[string index ${permlink} %d]' % idx + else: + message = 'Error: permlink required in make_ags' + PrintPostError(message) + if 'make_args_lst' in MyDriver and 'id' in MyDriver['make_args_lst']: + permlink = device_type + '[format "%02d" ${id}]' + node_type + else: + permlink = device_type + '${permlink_device_number}' + node_type + txt += [' hsetprop ${scobj_hpath}/%s permlink data_set "%s"' % (nodename, permlink)] + txt += [' hsetprop ${scobj_hpath}/%s @description "%s"' % (nodename, permlink)] + if 'value' in MyVar: + txt += [' hsetprop ${scobj_hpath}/%s oldval %s' % (nodename, MyVar['value'])] + txt += [' hset ${scobj_hpath}/%s %s' % (nodename, MyVar['value'])] + else: + if MyVar['type'] == 'none': + pass + elif MyVar['type'] == 'int': + txt += [' hsetprop ${scobj_hpath}/%s oldval 0' % nodename] + elif MyVar['type'] == 'float': + txt += [' hsetprop ${scobj_hpath}/%s oldval 0.0' % nodename] + else: + txt += [' hsetprop ${scobj_hpath}/%s oldval UNKNOWN' % nodename] + for key in sorted(MyVar['Property']): + txt += [' hsetprop ${scobj_hpath}/%s %s "%s"' % (nodename, key, MyVar['Property'][key])] + # Generate __ at runtime for nxalias + if 'nxalias' not in MyVar['Property']: + nxalias = '${name}_' + make_path(MyVar) + txt += [' hsetprop ${scobj_hpath}/%s nxalias "%s"' % (nodename, nxalias)] + + if readable_or_writeable: + txt += [''] + txt += [' if {[string equal -nocase "${simulation_flag}" "false"]} {'] + if MyVar['readable'] > 0: + poll_period = MyVar['readable'] + if poll_period < 1: + poll_period = 1 + if poll_period > 3600: + poll_period = 3600 + txt += [' ${sct_controller} poll ${scobj_hpath}/%s %s' % (nodename, poll_period)] + if MyVar['writeable'] > 0 or MyVar['driveable']: + txt += [' ${sct_controller} write ${scobj_hpath}/%s' % nodename] + if MyVar['driveable']: + # Generate __ at runtime for driveable + driveable = '${name}_' + make_path(MyVar) + postfix += [' ansto_makesctdrive %s ${scobj_hpath}/%s ${scobj_hpath}/%s ${sct_controller}' % (driveable, nodename, MyVar['driveable'])] + txt += [' hsetprop ${scobj_hpath}/%s simulated false' % nodename] + txt += [' } else {'] + txt += [' %s::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for %s"' % (MyDriver['namespace'], MyDriver['name'])] + txt += [' hsetprop ${scobj_hpath}/%s simulated true' % nodename] + txt += [' }'] + + if 'conditional' in MyVar: + for idx, line in enumerate(txt): + if len(line) > 0: + txt[idx] = ' ' + line + txt.insert(0, ' if {%s} {' % MyVar['conditional']) + txt.append(' }') + if len(postfix) > 0: + for idx, line in enumerate(postfix): + if len(line) > 0: + postfix[idx] = ' ' + line + postfix.insert(0, ' if {%s} {' % MyVar['conditional']) + postfix.append(' }') + + return (txt, postfix) + +def put_group(MyDriver, MyGroup): txt = [] + dfr = [] if MyGroup['name']: txt += [''] + txt += [' # Start of named group: ' + MyGroup['path']] txt += [' hfactory ${scobj_hpath}/%s plain spy none' % MyGroup['path']] - if 'GroupProperty' in MyGroup: - for key in sorted(MyGroup['GroupProperty']): - txt += [' hsetprop ${scobj_hpath}/%s %s "%s"' % (MyGroup['path'], key, MyGroup['GroupProperty'][key])] - groupname = MyGroup['path'] + '/' else: - groupname = '' + txt += [' # Start of unnamed group'] + for var in sorted(MyGroup['Vars']): txt += [''] MyVar = MyGroup['Vars'][var] - nodename = groupname + MyVar['name'] - # Check driveable attributes are present if required - if 'driveable' in MyVar and MyVar['driveable']: - for attr in ('lowerlimit', 'upperlimit', 'tolerance'): - if attr not in MyVar: - msg = 'Driveable: %s does not have required attribute: %s' % (nodename, attr) - print 'Warning:', msg - txt += [' # Warning: ' + msg] - # Check PID attributes are present if required - if 'pid_function' in MyVar: - for attr in ('pid_pvalue', - 'pid_ivalue', - 'pid_dvalue', - 'pid_imax', - 'pid_error', - 'pid_deriv', - 'pid_integ', - ): - if attr not in MyVar['Property']: - msg = 'PID: %s does not have required attribute: %s' % (nodename, attr) - print 'Warning:', msg - txt += [' # Warning: ' + msg] - txt += [' hfactory ${scobj_hpath}/%s plain %s %s' % (nodename, MyVar['priv'], MyVar['type'])] - if MyVar['readable'] > 0: - readable_or_writeable = True - fetch_func = MyVar['fetch_function'] - if fetch_func == 'none': - fetch_func = 'getValue' - read_func = MyVar['read_function'] - if 'read_command' in MyVar: - read_command = MyVar['read_command'] - else: - read_command = '' - txt += [' hsetprop ${scobj_hpath}/%s read ${ns}::%s ${scobj_hpath} %s {%s}' % (nodename, fetch_func, read_func, read_command)] - txt += [' hsetprop ${scobj_hpath}/%s %s ${ns}::%s ${scobj_hpath}' % (nodename, read_func, read_func)] - if MyVar['writeable'] > 0 or MyVar['driveable']: - readable_or_writeable = True - check_func = MyVar['check_function'] - checkrange_func = MyVar['checkrange_function'] - write_func = MyVar['write_function'] - if 'write_command' in MyVar: - write_command = MyVar['write_command'] - else: - write_command = '' - txt += [' hsetprop ${scobj_hpath}/%s write ${ns}::%s ${scobj_hpath} %s {%s}' % (nodename, write_func, check_func, write_command)] - txt += [' hsetprop ${scobj_hpath}/%s %s ${ns}::%s ${scobj_hpath}' % (nodename, check_func, check_func)] - txt += [' hsetprop ${scobj_hpath}/%s check ${ns}::%s ${scobj_hpath}' % (nodename, checkrange_func)] - if MyVar['driveable']: - halt_func = MyVar['halt_function'] - checklimits_func = MyVar['checklimits_function'] - checkstatus_func = MyVar['checkstatus_function'] - txt += [' hsetprop ${scobj_hpath}/%s driving 0' % nodename] - txt += [' hsetprop ${scobj_hpath}/%s checklimits ${ns}::%s ${scobj_hpath}' % (nodename, checklimits_func)] - txt += [' hsetprop ${scobj_hpath}/%s checkstatus ${ns}::%s ${scobj_hpath}' % (nodename, checkstatus_func)] - txt += [' hsetprop ${scobj_hpath}/%s halt ${ns}::%s ${scobj_hpath}' % (nodename, halt_func)] - txt += [' hsetprop ${scobj_hpath}/%s driveable %s' % (nodename, MyVar['driveable'])] - if 'control' in MyVar: - txt += [' hsetprop ${scobj_hpath}/%s control %s' % (nodename, MyVar['control'])] - if 'data' in MyVar: - txt += [' hsetprop ${scobj_hpath}/%s data %s' % (nodename, MyVar['data'])] - if 'mutable' in MyVar: - txt += [' hsetprop ${scobj_hpath}/%s mutable %s' % (nodename, MyVar['mutable'])] - if 'nxsave' in MyVar: - txt += [' hsetprop ${scobj_hpath}/%s nxsave %s' % (nodename, MyVar['nxsave'])] - if 'lowerlimit' in MyVar: - txt += [' hsetprop ${scobj_hpath}/%s lowerlimit %s' % (nodename, MyVar['lowerlimit'])] - if 'upperlimit' in MyVar: - txt += [' hsetprop ${scobj_hpath}/%s upperlimit %s' % (nodename, MyVar['upperlimit'])] - if 'tolerance' in MyVar: - txt += [' hsetprop ${scobj_hpath}/%s tolerance %s' % (nodename, MyVar['tolerance'])] - if 'units' in MyVar: - txt += [' hsetprop ${scobj_hpath}/%s units %s' % (nodename, MyVar['units'])] - if 'allowed' in MyVar: - txt += [' hsetprop ${scobj_hpath}/%s values %s' % (nodename, MyVar['allowed'])] - if 'permlink' in MyVar: - device_type, node_type = MyVar['permlink'].split('.') - if device_type.startswith("#"): - if 'make_args' in MyDriver and 'permlink' in MyDriver['make_args'].split(): - idx = int(device_type[1:]) - device_type = '[string index ${permlink} %d]' % idx - else: - print 'Error: permlink required in make_ags' - if 'make_args' in MyDriver and 'id' in MyDriver['make_args'].split(): - permlink = device_type + '[format "%02d" ${id}]' + node_type - else: - permlink = device_type + '${permlink_device_number}' + node_type - txt += [' hsetprop ${scobj_hpath}/%s permlink data_set "%s"' % (nodename, permlink)] - txt += [' hsetprop ${scobj_hpath}/%s @description "%s"' % (nodename, permlink)] - if 'value' in MyVar: - txt += [' hsetprop ${scobj_hpath}/%s oldval %s' % (nodename, MyVar['value'])] - txt += [' hset ${scobj_hpath}/%s %s' % (nodename, MyVar['value'])] - else: - if MyVar['type'] == 'none': - pass - elif MyVar['type'] == 'int': - txt += [' hsetprop ${scobj_hpath}/%s oldval 0' % nodename] - elif MyVar['type'] == 'float': - txt += [' hsetprop ${scobj_hpath}/%s oldval 0.0' % nodename] - else: - txt += [' hsetprop ${scobj_hpath}/%s oldval UNKNOWN' % nodename] - for key in sorted(MyVar['Property']): - txt += [' hsetprop ${scobj_hpath}/%s %s "%s"' % (nodename, key, MyVar['Property'][key])] - # Generate __ at runtime for nxalias - if 'nxalias' not in MyVar['Property']: - nxalias = '${name}_' + make_path(MyVar) - txt += [' hsetprop ${scobj_hpath}/%s nxalias "%s"' % (nodename, nxalias)] - if not MyGroup['name']: + infix, postfix = put_var(MyDriver, MyGroup, MyVar) + txt += infix + dfr += postfix + + if MyGroup['name']: + if 'GroupProperty' in MyGroup: + for key in sorted(MyGroup['GroupProperty']): + txt += [' hsetprop ${scobj_hpath}/%s %s "%s"' % (MyGroup['path'], key, MyGroup['GroupProperty'][key])] + txt += [' # End of named group: ' + MyGroup['path']] + else: if 'GroupProperty' in MyGroup: txt += [''] for key in sorted(MyGroup['GroupProperty']): txt += [' hsetprop ${scobj_hpath} %s "%s"' % (key, MyGroup['GroupProperty'][key])] - if readable_or_writeable: - txt += [''] - txt += [' if {[string equal -nocase "${simulation_flag}" "false"]} {'] - for var in sorted(MyGroup['Vars']): - MyVar = MyGroup['Vars'][var] - nodename = groupname + MyVar['name'] - if MyVar['readable'] > 0: - poll_period = MyVar['readable'] - if poll_period < 1: - poll_period = 1 - if poll_period > 3600: - poll_period = 3600 - txt += [' ${sct_controller} poll ${scobj_hpath}/%s %s' % (nodename, poll_period)] - for var in sorted(MyGroup['Vars']): - MyVar = MyGroup['Vars'][var] - nodename = groupname + MyVar['name'] - if MyVar['writeable'] > 0 or MyVar['driveable']: - txt += [' ${sct_controller} write ${scobj_hpath}/%s' % nodename] - if MyVar['driveable']: - # Generate __ at runtime for driveable - driveable = '${name}_' + make_path(MyVar) - MyDriver['Deferred'] += ['ansto_makesctdrive %s ${scobj_hpath}/%s ${scobj_hpath}/%s ${sct_controller}' % (driveable, nodename, MyVar['driveable'])] - txt += [' } else {'] - txt += [' %s::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for %s"' % (MyDriver['namespace'], MyDriver['name'])] - txt += [' }'] + txt += [' # End of unnamed group'] + for grp in sorted(MyGroup['Groups']): txt += put_group(MyDriver, MyGroup['Groups'][grp]) + + txt += dfr + + if 'conditional' in MyGroup: + for idx, line in enumerate(txt): + if len(line) > 0: + txt[idx] = ' ' + line + txt.insert(0, ' if {%s} {' % MyGroup['conditional']) + txt.append(' }') + return txt def put_mkDriver(MyDriver): @@ -1401,8 +1598,8 @@ def put_mkDriver(MyDriver): else: line = 'proc %s::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } {' % (MyDriver['namespace']) txt += [line] - if 'make_args' in MyDriver: - make_args = ' '.join(["${%s}"%arg for arg in MyDriver['make_args'].split()]) + if 'make_args_lst' in MyDriver: + make_args = ' '.join(["${%s}"%arg for arg in MyDriver['make_args_lst']]) txt += [' %s::sics_log 9 "%s::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} %s"' % (MyDriver['namespace'], MyDriver['namespace'], make_args)] else: txt += [' %s::sics_log 9 "%s::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"' % (MyDriver['namespace'], MyDriver['namespace'])] @@ -1416,7 +1613,7 @@ def put_mkDriver(MyDriver): txt += ['# %s hook code ends' % func] else: if len(MyDriver['Permlink']) > 0: - if 'make_args' in MyDriver and 'id' in MyDriver['make_args'].split(): + if 'make_args_lst' in MyDriver and 'id' in MyDriver['make_args_lst']: pass else: txt += [' set permlink_device_number [format "%02d" [incr ::scobj::permlink_device_counter]]'] @@ -1459,7 +1656,7 @@ def put_mkDriver(MyDriver): txt += ['}'] emit(txt) -def put_postamble(MyDriver): +def put_add_driver(MyDriver): txt = [''] if 'add_args' in MyDriver: line = 'proc %s::add_driver {name device_class simulation_flag ip_address tcp_port %s} {' % (MyDriver['namespace'], MyDriver['add_args']) @@ -1467,8 +1664,8 @@ def put_postamble(MyDriver): line = 'proc %s::add_driver {name device_class simulation_flag ip_address tcp_port} {' % (MyDriver['namespace']) txt += [line] txt += [' set catch_status [ catch {'] - if 'make_args' in MyDriver: - make_args = ' '.join(["${%s}"%arg for arg in MyDriver['make_args'].split()]) + if 'make_args_lst' in MyDriver: + make_args = ' '.join(["${%s}"%arg for arg in MyDriver['make_args_lst']]) txt += [' %s::sics_log 9 "%s::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} %s"' % (MyDriver['namespace'], MyDriver['namespace'], make_args)] else: txt += [' %s::sics_log 9 "%s::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"' % (MyDriver['namespace'], MyDriver['namespace'])] @@ -1481,18 +1678,29 @@ def put_postamble(MyDriver): txt += [' makesctcontroller sct_${name} aqadapter ${tcp_port}'] txt += [' } else {'] if 'protocol_args' in MyDriver: - protocol_args = MyDriver['protocol_args'].replace('\\', '\\\\').replace('"', '\\"') - txt += [' %s::sics_log 9 "makesctcontroller sct_${name} %s ${ip_address}:${tcp_port} %s"' % (MyDriver['namespace'], MyDriver['protocol'], protocol_args)] - txt += [' makesctcontroller sct_${name} %s ${ip_address}:${tcp_port} %s' % (MyDriver['protocol'], MyDriver['protocol_args'])] + protocol_args = [] + for arg in MyDriver['protocol_args_lst']: + if 'add_args_lst' in MyDriver and arg in MyDriver['add_args_lst']: + protocol_args.append('${%s}' % arg) + elif arg in MyDriver['protocol_args_map'] and MyDriver['protocol_args_map'][arg] is not None: + protocol_args.append(MyDriver['protocol_args_map'][arg]) + else: + PrintPostError('Protocol arg %s is not in add_args and has no default' % arg) + tmp = ' '.join(protocol_args).replace('\\', '\\\\').replace('"', '\\"') + txt += [' %s::sics_log 9 "makesctcontroller sct_${name} %s ${ip_address}:${tcp_port} %s"' % (MyDriver['namespace'], MyDriver['protocol'], tmp)] + tmp = ' '.join(protocol_args) + txt += [' makesctcontroller sct_${name} %s ${ip_address}:${tcp_port} %s' % (MyDriver['protocol'], tmp)] else: txt += [' %s::sics_log 9 "makesctcontroller sct_${name} %s ${ip_address}:${tcp_port}"' % (MyDriver['namespace'], MyDriver['protocol'])] txt += [' makesctcontroller sct_${name} %s ${ip_address}:${tcp_port}' % MyDriver['protocol']] txt += [' }'] txt += [' } else {'] - txt += [' %s::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for %s"' % (MyDriver['namespace'], MyDriver['name'])] + txt += [' %s::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for %s"' % (MyDriver['namespace'], MyDriver['name'])] + txt += [' %s::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"' % MyDriver['namespace']] + txt += [' makesctcontroller sct_${name} aqadapter NULL'] txt += [' }'] - if 'make_args' in MyDriver: - make_args = ' '.join(["${%s}"%arg for arg in MyDriver['make_args'].split()]) + if 'make_args_lst' in MyDriver: + make_args = ' '.join(["${%s}"%arg for arg in MyDriver['make_args_lst']]) txt += [' %s::sics_log 1 "%s::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} %s"' % (MyDriver['namespace'], MyDriver['namespace'], make_args)] txt += [' %s::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} %s' % (MyDriver['namespace'], make_args)] else: @@ -1504,13 +1712,21 @@ def put_postamble(MyDriver): txt += [' } catch_message ]'] txt += [' handle_exception ${catch_status} ${catch_message}'] txt += ['}'] - txt += [''] + emit(txt) + +def put_postamble(MyDriver): + txt = [''] txt += ['namespace eval %s {' % MyDriver['namespace']] txt += [' namespace export debug_threshold'] txt += [' namespace export debug_log'] txt += [' namespace export sics_log'] txt += [' namespace export mkDriver'] txt += [' namespace export add_driver'] + func = 'postamble' + if func in MyDriver['Funcs']: + txt += ['# %s hook code starts' % func] + txt += MyDriver['Funcs'][func]['text'] + txt += ['# %s hook code ends' % func] txt += ['}'] txt += [''] if 'add_args' in MyDriver: @@ -1519,15 +1735,17 @@ def put_postamble(MyDriver): line = 'proc add_%s {name ip_address tcp_port} {' % MyDriver['name'] txt += [line] txt += [' set simulation_flag "[string tolower [SplitReply [%s]]]"' % MyDriver['simulation_group']] - line = ' %s::add_driver ${name} "%s" "${simulation_flag}" ${ip_address} ${tcp_port}' % (MyDriver['namespace'], MyDriver['class']) - if 'add_args' in MyDriver: - for arg in MyDriver['add_args'].split(): - line += ' "${%s}"' % arg + line = ' %s::add_driver ${name} "%s"' % (MyDriver['namespace'], MyDriver['class']) + for arg in ['simulation_flag', 'ip_address', 'tcp_port']: + line += ' ${%s}' % arg + if 'add_args_lst' in MyDriver: + for arg in MyDriver['add_args_lst']: + line += ' ${%s}' % arg txt += [line] txt += ['}'] txt += [''] - txt += ['clientput "file evaluation of sct_%s.tcl"' % MyDriver['name']] - txt += ['%s::sics_log 9 "file evaluation of sct_%s.tcl"' % (MyDriver['namespace'], MyDriver['name'])] + txt += ['clientput "file evaluation of %s"' % MyDriver['filename']] + txt += ['%s::sics_log 9 "file evaluation of %s"' % (MyDriver['namespace'], MyDriver['filename'])] emit(txt) def put_read_config(MyDriver): @@ -1562,42 +1780,94 @@ def put_read_config(MyDriver): txt += [' continue'] txt += [' }'] txt += [' if { [string equal -nocase [dict get $v "driver"] "%s"] } {' % MyDriver['name']] - txt += [' if { ![string equal -nocase "${simulation_flag}" "false"] } {'] - txt += [' set asyncqueue "null"'] - txt += [' ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"'] - txt += [' } elseif { [dict exists $v "asyncqueue"] } {'] - txt += [' set asyncqueue [dict get $v "asyncqueue"]'] - txt += [' if { [string equal -nocase ${asyncqueue} "sct"] } {'] - txt += [' set ip_address [dict get $v ip]'] - txt += [' set tcp_port [dict get $v port]'] - txt += [' }'] - txt += [' } else {'] - txt += [' if { [dict exists $v "asyncprotocol"] } {'] - txt += [' set asyncprotocol [dict get $v "asyncprotocol"]'] - txt += [' } else {'] - txt += [' set asyncprotocol ${name}_protocol'] - txt += [' MakeAsyncProtocol ${asyncprotocol}'] - txt += [' if { [dict exists $v "terminator"] } {'] - txt += [' ${asyncprotocol} sendterminator "[dict get $v "terminator"]"'] - txt += [' ${asyncprotocol} replyterminator "[dict get $v "terminator"]"'] - txt += [' }'] - txt += [' }'] - txt += [' set asyncqueue ${name}_queue'] - txt += [' set ip_address [dict get $v ip]'] - txt += [' set tcp_port [dict get $v port]'] - txt += [' MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${ip_address} ${tcp_port}'] - txt += [' if { [dict exists $v "timeout"] } {'] - txt += [' ${asyncqueue} timeout "[dict get $v "timeout"]"'] - txt += [' }'] - txt += [' }'] - if 'make_args' in MyDriver: + if ('WrapperProperty' in MyDriver) and ('nosctcontroller' in MyDriver['WrapperProperty']): + txt += [' %s::sics_log 9 "No sctcontroller for %s"' % (MyDriver['namespace'], MyDriver['name'])] + else: + txt += [' if { ![string equal -nocase "${simulation_flag}" "false"] } {'] + txt += [' set asyncqueue "null"'] + txt += [' ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"'] + txt += [' ${ns}::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"'] + txt += [' makesctcontroller sct_${name} aqadapter NULL'] + txt += [' } elseif { [dict exists $v "asyncqueue"] } {'] + txt += [' set asyncqueue [dict get $v "asyncqueue"]'] + txt += [' if { [string equal -nocase ${asyncqueue} "sct"] } {'] + txt += [' set ip_address [dict get $v ip]'] + txt += [' set tcp_port [dict get $v port]'] + if 'protocol_args_lst' in MyDriver: + txt += [' set arg_list [list]'] + txt += [' set missing_list [list]'] + default_list = [] + for arg in [key for key in MyDriver['protocol_args_lst'] if MyDriver['protocol_args_map'][key] is not None]: + default_list += [arg, MyDriver['protocol_args_map'][arg]] + if len(default_list) > 0: + txt += [' array unset default_map'] + txt += [' array set default_map [list %s]' % ' '.join(default_list)] + txt += [' foreach arg {' + ' '.join(MyDriver['protocol_args_lst']) + '} {'] + txt += [' if {[dict exists $u $arg]} {'] + txt += [' lappend arg_list "[dict get $u $arg]"'] + txt += [' } elseif {[dict exists $v $arg]} {'] + txt += [' lappend arg_list "[dict get $v $arg]"'] + if len(default_list) > 0: + txt += [' } elseif {[info exists default_map($arg)]} {'] + txt += [' lappend arg_list $default_map($arg)'] + txt += [' } else {'] + txt += [' ${ns}::sics_log 9 "Missing configuration value $arg"'] + txt += [' lappend missing_list $arg'] + txt += [' }'] + txt += [' }'] + txt += [' if { [llength $missing_list] > 0 } {'] + txt += [' error "$name is missing configuration values $missing_list"'] + txt += [' }'] + protocol_args = ' {*}$arg_list' + else: + protocol_args = '' + txt += [' makesctcontroller sct_${name} %s ${ip_address}:${tcp_port}%s' % (MyDriver['protocol'], protocol_args)] + txt += [' } else {'] + txt += [' makesctcontroller sct_${name} aqadapter ${asyncqueue}'] + txt += [' }'] + txt += [' } else {'] + txt += [' if { [dict exists $v "asyncprotocol"] } {'] + txt += [' set asyncprotocol [dict get $v "asyncprotocol"]'] + txt += [' } else {'] + txt += [' set asyncprotocol ${name}_protocol'] + txt += [' MakeAsyncProtocol ${asyncprotocol}'] + txt += [' if { [dict exists $v "sendterminator"] } {'] + txt += [' ${asyncprotocol} sendterminator "[dict get $v "sendterminator"]"'] + txt += [' } elseif { [dict exists $v "terminator"] } {'] + txt += [' ${asyncprotocol} sendterminator "[dict get $v "terminator"]"'] + txt += [' }'] + txt += [' if { [dict exists $v "replyterminator"] } {'] + txt += [' ${asyncprotocol} replyterminator "[dict get $v "replyterminator"]"'] + txt += [' } elseif { [dict exists $v "terminator"] } {'] + txt += [' ${asyncprotocol} replyterminator "[dict get $v "terminator"]"'] + txt += [' }'] + txt += [' }'] + txt += [' set asyncqueue ${name}_queue'] + txt += [' set ip_address [dict get $v ip]'] + txt += [' set tcp_port [dict get $v port]'] + txt += [' MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${ip_address} ${tcp_port}'] + txt += [' if { [dict exists $v "timeout"] } {'] + txt += [' ${asyncqueue} timeout "[dict get $v "timeout"]"'] + txt += [' }'] + txt += [' makesctcontroller sct_${name} aqadapter ${asyncqueue}'] + txt += [' }'] + if 'make_args_lst' in MyDriver: txt += [' set arg_list [list]'] txt += [' set missing_list [list]'] - txt += [' foreach arg {' + MyDriver['make_args'] + '} {'] + default_list = [] + for arg in [key for key in MyDriver['make_args_lst'] if MyDriver['make_args_map'][key] is not None]: + default_list += [arg, MyDriver['make_args_map'][arg]] + if len(default_list) > 0: + txt += [' array unset default_map'] + txt += [' array set default_map [list %s]' % ' '.join(default_list)] + txt += [' foreach arg {' + ' '.join(MyDriver['make_args_lst']) + '} {'] txt += [' if {[dict exists $u $arg]} {'] txt += [' lappend arg_list "[dict get $u $arg]"'] txt += [' } elseif {[dict exists $v $arg]} {'] txt += [' lappend arg_list "[dict get $v $arg]"'] + if len(default_list) > 0: + txt += [' } elseif {[info exists default_map($arg)]} {'] + txt += [' lappend arg_list $default_map($arg)'] txt += [' } else {'] txt += [' ${ns}::sics_log 9 "Missing configuration value $arg"'] txt += [' lappend missing_list $arg'] @@ -1606,17 +1876,10 @@ def put_read_config(MyDriver): txt += [' if { [llength $missing_list] > 0 } {'] txt += [' error "$name is missing configuration values $missing_list"'] txt += [' }'] - txt += [' if { [string equal -nocase ${asyncqueue} "sct"] } {'] - txt += [' ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list'] - txt += [' } else {'] - txt += [' ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list'] - txt += [' }'] + make_args = ' {*}$arg_list' else: - txt += [' if { [string equal -nocase ${asyncqueue} "sct"] } {'] - txt += [' ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}'] - txt += [' } else {'] - txt += [' ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue}'] - txt += [' }'] + make_args = '' + txt += [' ${ns}::mkDriver sct_${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}' + make_args] txt += [' }'] txt += [' }'] txt += [' }'] @@ -1664,13 +1927,12 @@ def generate_driver(MyDriver): global NumberOfLinesOut global fdo NumberOfLinesOut = 0 - full_filename = filename = "sct_%s.tcl" % MyDriver['name'] - if 'PathName' in MyDriver: - full_filename = os.path.join(MyDriver['PathName'], filename) - fdo = open(full_filename, 'w') + generate_filename(MyDriver) + fdo = open(MyDriver['fullname'], 'w') put_preamble(MyDriver) put_standard_code(MyDriver) put_mkDriver(MyDriver) + put_add_driver(MyDriver) put_postamble(MyDriver) put_read_config(MyDriver) put_check_config(MyDriver) @@ -1681,7 +1943,9 @@ def generate_driver(MyDriver): print "Function:", f, "Type:", MyDriver['Funcs'][f]['type'], '#Uses:', MyDriver['Funcs'][f]['reference_count'] for l in MyDriver['Funcs'][f]['text']: print " ", l - print "Produced file %s with %d lines." % (filename, NumberOfLinesOut) + if Verbose: + print "Produced file %s with %d lines." % \ + ( MyDriver['filename'], NumberOfLinesOut) def process_drivers(TheDrivers): if Verbose: @@ -1695,50 +1959,122 @@ def process_drivers(TheDrivers): MyDriver['Permlink'] = {} MyDriver['Deferred'] = [] build_driver(MyDriver, TheDrivers[driver]) + check_func_code(MyDriver) if Verbose: print "MyDriver:", MyDriver['name'], '=', MyDriver if DriverDump or Verbose: dump_driver(MyDriver) generate_driver(MyDriver) -def process_source(source_files): - global PathName +def load_file(source_file, depth_list): + global SourceFileList, SourceLineList + # find the file and set the name + SourceFile = os.path.realpath(os.path.abspath(source_file)) + if not os.path.isfile(SourceFile): + #print source_file, SourceFile, SourceFileList + if len(SourceFileList) > 0: + trial_name = os.path.join(os.path.dirname(SourceFileList[0]), source_file) + #print trial_name + if os.path.isfile(trial_name): + SourceFile = os.path.realpath(os.path.abspath(trial_name)) + if SourceFile in depth_list: + PrintPostError('Error: recursive include of: %s' % SourceFile) + for idx, name in enumerate(depth_list): + PrintPostError(' ' * idx + name) + raise Exception('Bad recursive include of "' + SourceFile + '"') + SourceFileList.append(SourceFile) + curr_file = len(SourceFileList) - 1 + fd = open(SourceFile, 'r') + LocalData = [] + line_no = 0 + execing = False + exec_input = [] + exec_line = 0 + for line in fd: + line_no += 1 + line = line.rstrip('\n') + if execing: + match = re.match(r'\s*%end', line, flags=re.IGNORECASE) + if match: + #print "exec_input:" + #for temp_line in exec_input: + # print " " + temp_line + kw = {} + kw['exec_output'] = [] + exec('\n'.join(exec_input)) in kw + #print "exec_output:" + for line in kw['exec_output']: + # print " " + line + LocalData.append(line) + SourceLineList.append((curr_file, exec_line)) + exec_input = [] + execing = False + else: + exec_input.append(line) + continue + match = re.match(r'\s*%exec', line, flags=re.IGNORECASE) + if match: + execing = True + exec_line = line_no + continue + match = re.match(r'\s*%include\s+', line, flags=re.IGNORECASE) + if match: + new_source = re.sub(r'\s*%include\s+(.*)', r'\1', line, flags=re.IGNORECASE) + LocalData += load_file(new_source, depth_list + [SourceFile]) + continue + LocalData.append(line) + SourceLineList.append((curr_file, line_no)) + fd.close() + return LocalData + +def dump_source_files(data): + global SourceFileList, SourceLineList + print "SourceFileList:", SourceFileList + print "SourceLineList:", SourceLineList + curr_file = -1 + for line_no, line in enumerate(data): + if SourceLineList[line_no][0] != curr_file: + curr_file = SourceLineList[line_no][0] + print "File:", SourceFileList[curr_file] + print "%4d:" % SourceLineList[line_no][1], line + +def process_source(source_file): + global PathName, SourceFile global TheDrivers - global NumberOfLinesIn + global NumberOfLinesIn, NumberOfLinesOut + global SourceData + global PrintedFileName + global SourceFileList, SourceLineList TheDrivers = {} - # - # Build the lexer - # - lexer = lex.lex() - - - # - # Build the parser - # - #yaccer = yacc.yacc(tabmodule="gen_sct",outputdir="/tmp",write_tables=0,debug=0) - yaccer = yacc.yacc() - - for source_file in source_files: - PathName = os.path.realpath(os.path.abspath(os.path.dirname(source_file))) - fd = open(source_file, 'r') - data = fd.read() - fd.close() - NumberOfLinesIn = data.count('\n') - start_line = lexer.lineno - yaccer.parse(data) - stop_line = lexer.lineno - print 'Consumed file %s with %d lines (%d, %d)' % (source_file, - NumberOfLinesIn, start_line, stop_line - 1) - lexer.lineno = 1 + PrintedFileName = -1 + NumberOfLinesIn = 0 + NumberOfLinesOut = 0 + SourceFileList = list() + SourceLineList = list() + PathName = os.path.realpath(os.path.abspath(os.path.dirname(source_file))) + SourceData = load_file(source_file, []) + NumberOfLinesIn = len(SourceData) + start_line = lexer.lineno + yaccer.parse('\n'.join(SourceData)) + stop_line = lexer.lineno + if Verbose: + print 'Consumed file %s with %d lines (%d, %d)' % \ + (source_file, NumberOfLinesIn, start_line, stop_line - 1) + lexer.lineno = 1 process_drivers(TheDrivers) + if args.list: + dump_source_files(SourceData) def main(): + global lexer, yaccer global Verbose + global Move global DriverDump global CodeDump + global args import argparse parser = argparse.ArgumentParser() @@ -1746,11 +2082,18 @@ def main(): action="store_true") parser.add_argument("-d", "--driver", help="dump driver", action="store_true") + parser.add_argument("-l", "--list", help="list output", + action="store_true") + parser.add_argument("-m", "--move", help="generate move commands", + action="store_true") + parser.add_argument("--sct", help="where to put the sct in the filename", + choices=["before", "after"], default="after") parser.add_argument("-v", "--verbose", help="verbose output", action="store_true") parser.add_argument("driver_source", help="driver source file", nargs="*") args = parser.parse_args() - print args + if args.verbose: + print args if args.code: CodeDump = True else: @@ -1759,13 +2102,30 @@ def main(): DriverDump = True else: DriverDump = False + if args.move: + Move = True + else: + Move = False if args.verbose: Verbose = True else: Verbose = False - source_files = args.driver_source - if source_files: - process_source(source_files) + source_files = args.driver_source # + if source_files and len(source_files) > 0: + # Build the lexer + # + lexer = lex.lex() + + + # + # Build the parser + # + #yaccer = yacc.yacc(tabmodule="gen_sct",outputdir="/tmp",write_tables=0,debug=0) + yaccer = yacc.yacc(debug=0) + + + for source_file in source_files: + process_source(source_file) if __name__ == "__main__": main() From ad29e66160a28d1de5d4a0223cc730d947649efd Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 6 Nov 2014 16:18:43 +1100 Subject: [PATCH 02/24] Import of changes in 3.2 --- site_ansto/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/site_ansto/Makefile b/site_ansto/Makefile index 51d68603..f7d812c9 100755 --- a/site_ansto/Makefile +++ b/site_ansto/Makefile @@ -169,8 +169,14 @@ config: xref: all python xref.py $(SUBLIBS) $(GHTTP_LIBS) -sct: +sct1: find . -name "*.sct" -exec python instrument/util/gen_sct.py {} \; +sct2: + python instrument/util/gen_sct.py `find . -name "*.sct"` +sct3: + find . -name "*.sct" | xargs python instrument/util/gen_sct.py + +sct: | sct2 #TODO Add targets for other instruments echidna: all From f1595151cd10eb2989dc815aa3aa62d20a2542f8 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 6 Nov 2014 16:27:15 +1100 Subject: [PATCH 03/24] Changes to protocol_args to add defaults --- site_ansto/instrument/config/environment/isotech_ps.sct | 2 +- .../instrument/config/environment/temperature/julabo_lh45.sct | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/site_ansto/instrument/config/environment/isotech_ps.sct b/site_ansto/instrument/config/environment/isotech_ps.sct index 585a29d4..b50e60e7 100644 --- a/site_ansto/instrument/config/environment/isotech_ps.sct +++ b/site_ansto/instrument/config/environment/isotech_ps.sct @@ -5,7 +5,7 @@ driver isotech_ps = { vendor = isotech; device = ps; protocol = std; class = environment; simulation_group = environment_simulation; - protocol_args = '"\r"'; + protocol_args = '{terminator "\r"}'; group = { readable = 5 mutable = true diff --git a/site_ansto/instrument/config/environment/temperature/julabo_lh45.sct b/site_ansto/instrument/config/environment/temperature/julabo_lh45.sct index 20b2f7e3..06661609 100644 --- a/site_ansto/instrument/config/environment/temperature/julabo_lh45.sct +++ b/site_ansto/instrument/config/environment/temperature/julabo_lh45.sct @@ -8,7 +8,7 @@ driver julabo_lh45_gen = { simulation_group = environment_simulation add_args = '{id 1} {ctrl_sensor "bath"} {tol 5.0}'; make_args = 'id ctrl_sensor tol'; - protocol_args = '"\r"'; + protocol_args = '{terminator "\r"}'; # # Unnamed group has variables at device level # From 6bed30d5d4343decabf7ca944578e51fd000f9e0 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 6 Nov 2014 16:37:46 +1100 Subject: [PATCH 04/24] Reduce spurious differences in generated code --- site_ansto/instrument/util/gen_sct.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/site_ansto/instrument/util/gen_sct.py b/site_ansto/instrument/util/gen_sct.py index 97dbc0bb..44faf8d3 100755 --- a/site_ansto/instrument/util/gen_sct.py +++ b/site_ansto/instrument/util/gen_sct.py @@ -1310,7 +1310,7 @@ def put_checkstatus_function(MyDriver, func): txt += [' set sp "[sct target]"'] txt += [' if {[hpropexists [sct] simulated] && [sct simulated] == "true"} {'] txt += [' set pv "${sp}"'] - txt += [' hset ${tc_root}/[sct driveable] ${sp}'] + txt += [' hupdateif ${tc_root}/[sct driveable] ${sp}'] txt += [' }'] txt += [' set pv "[hval ${tc_root}/[sct driveable]]"'] txt += [' }'] @@ -1396,7 +1396,7 @@ def put_pid_function(MyDriver, func): def put_var(MyDriver, MyGroup, MyVar): readable_or_writeable = False - txt = [' # Start of var: ' + MyVar['name']] + txt = [] postfix = [] if MyGroup['name']: nodename = MyGroup['path'] + '/' + MyVar['name'] @@ -1553,10 +1553,9 @@ def put_group(MyDriver, MyGroup): dfr = [] if MyGroup['name']: txt += [''] - txt += [' # Start of named group: ' + MyGroup['path']] txt += [' hfactory ${scobj_hpath}/%s plain spy none' % MyGroup['path']] else: - txt += [' # Start of unnamed group'] + pass for var in sorted(MyGroup['Vars']): txt += [''] @@ -1569,13 +1568,11 @@ def put_group(MyDriver, MyGroup): if 'GroupProperty' in MyGroup: for key in sorted(MyGroup['GroupProperty']): txt += [' hsetprop ${scobj_hpath}/%s %s "%s"' % (MyGroup['path'], key, MyGroup['GroupProperty'][key])] - txt += [' # End of named group: ' + MyGroup['path']] else: if 'GroupProperty' in MyGroup: txt += [''] for key in sorted(MyGroup['GroupProperty']): txt += [' hsetprop ${scobj_hpath} %s "%s"' % (key, MyGroup['GroupProperty'][key])] - txt += [' # End of unnamed group'] for grp in sorted(MyGroup['Groups']): txt += put_group(MyDriver, MyGroup['Groups'][grp]) @@ -2087,7 +2084,7 @@ def main(): parser.add_argument("-m", "--move", help="generate move commands", action="store_true") parser.add_argument("--sct", help="where to put the sct in the filename", - choices=["before", "after"], default="after") + choices=["before", "after"], default="before") parser.add_argument("-v", "--verbose", help="verbose output", action="store_true") parser.add_argument("driver_source", help="driver source file", nargs="*") From c488733bcd46751327402aa44089d01512a6d29e Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 6 Nov 2014 18:16:02 +1100 Subject: [PATCH 05/24] Set default sct=before, add ${name} to mkDriver call --- site_ansto/instrument/util/gen_sct.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/site_ansto/instrument/util/gen_sct.py b/site_ansto/instrument/util/gen_sct.py index 44faf8d3..4e5d606d 100755 --- a/site_ansto/instrument/util/gen_sct.py +++ b/site_ansto/instrument/util/gen_sct.py @@ -1876,7 +1876,7 @@ def put_read_config(MyDriver): make_args = ' {*}$arg_list' else: make_args = '' - txt += [' ${ns}::mkDriver sct_${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}' + make_args] + txt += [' ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}' + make_args] txt += [' }'] txt += [' }'] txt += [' }'] @@ -2074,6 +2074,8 @@ def main(): global args import argparse + # RELEASE-3_1="before", RELEASE-3_2="after" + default_sct = "before" parser = argparse.ArgumentParser() parser.add_argument("-c", "--code", help="dump code", action="store_true") @@ -2083,8 +2085,9 @@ def main(): action="store_true") parser.add_argument("-m", "--move", help="generate move commands", action="store_true") - parser.add_argument("--sct", help="where to put the sct in the filename", - choices=["before", "after"], default="before") + parser.add_argument("--sct", + help="where to put the sct in the filename [%s]" % default_sct, + choices=["before", "after"], default=default_sct) parser.add_argument("-v", "--verbose", help="verbose output", action="store_true") parser.add_argument("driver_source", help="driver source file", nargs="*") From 3602f56352e45913725d6522b2aa3b640898fe9a Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 6 Nov 2014 18:17:02 +1100 Subject: [PATCH 06/24] Rework the he3_polanal.sct driver --- .../config/beamline/he3_polanal.sct | 67 +++++++++++++++---- 1 file changed, 53 insertions(+), 14 deletions(-) diff --git a/site_ansto/instrument/config/beamline/he3_polanal.sct b/site_ansto/instrument/config/beamline/he3_polanal.sct index 1d38fc98..28c8b45f 100644 --- a/site_ansto/instrument/config/beamline/he3_polanal.sct +++ b/site_ansto/instrument/config/beamline/he3_polanal.sct @@ -4,42 +4,73 @@ driver he3_polanal = { protocol = std; class = instrument; simulation_group = rfgen_simulation; + make_args = '{has_pol true} {has_anal true}'; + group polariser = { + conditional = '[string equal -nocase ${has_pol} "true"]'; + type = text; var spin = { - type = text; readable = 900; read_command = 'polariser'; read_function = rdValue; writeable = 1; write_command = 'polariser'; check_function = chkWrite; - allowed = "+,-,0" + allowed = "+,-,Refresh" } - var Amplitude = { type = text; } - var Freq = { type = text; units = 'Hertz'; } - var Phase = { type = text; units = 'Degree'; } - var Time2 = { type = text; units = 'Second'; } - var Field = { type = text; units = 'Oersted'; } + var Amplitude = { } + var Freq = { units = 'Hertz'; } + var Phase = { units = 'Degree'; } + var Time2 = { units = 'Second'; } + var Field = { units = 'Oersted'; } + var Timestamp = { } } + group polariser_start = { + conditional = '[string equal -nocase ${has_pol} "true"]'; + type = text; + var spin = { } + var Amplitude = { } + var Freq = { units = 'Hertz'; } + var Phase = { units = 'Degree'; } + var Time2 = { units = 'Second'; } + var Field = { units = 'Oersted'; } + var Timestamp = { } + } + group analyser = { + conditional = '[string equal -nocase ${has_anal} "true"]'; + type = text; var spin = { - type = text; readable = 900; read_command = 'analyser'; read_function = rdValue; writeable = 1; write_command = 'analyser'; check_function = chkWrite; - allowed = "+,-,0" + allowed = "+,-,Refresh" } - var Amplitude = { type = text; } - var Freq = { type = text; units = 'Hertz'; } - var Phase = { type = text; units = 'Degree'; } - var Time2 = { type = text; units = 'Second'; } - var Field = { type = text; units = 'Oersted'; } + var Amplitude = { } + var Freq = { units = 'Hertz'; } + var Phase = { units = 'Degree'; } + var Time2 = { units = 'Second'; } + var Field = { units = 'Oersted'; } + var Timestamp = { } } + group analyser_start = { + conditional = '[string equal -nocase ${has_anal} "true"]'; + type = text; + var spin = { } + var Amplitude = { } + var Freq = { units = 'Hertz'; } + var Phase = { units = 'Degree'; } + var Time2 = { units = 'Second'; } + var Field = { units = 'Oersted'; } + var Timestamp = { } + } + code chkWrite = {%% [namespace current]::rdValue ${tc_root} + clientput [sct result] %%} code rdValue = {%% @@ -61,6 +92,7 @@ driver he3_polanal = { set data [lindex ${dlist} 1] } set path [pathname [sct]] + set timestamp [clock format [clock seconds] -format "%T"] if {[llength ${dlist}] > 2} { set new_value [lindex ${dlist} 2] if { "${new_value}" == "NaN" } { @@ -80,6 +112,7 @@ driver he3_polanal = { if {[llength ${dlist}] > 6} { hupdateif ${path}/Field "[lindex ${dlist} 6]" } + hupdateif ${path}/Timestamp "${timestamp}" %%} code setValue = {%% @@ -87,6 +120,9 @@ driver he3_polanal = { if {[string equal -nocase [sct target] "refresh"]} { set cmd "${cmd_str}" } + if {[string equal -nocase [sct target] "minus"]} { + set cmd "${cmd_str} -" + } if {[string equal -nocase [sct target] "dn"]} { set cmd "${cmd_str} -" } @@ -96,6 +132,9 @@ driver he3_polanal = { if {[sct target] == "-" || [sct target] == -1} { set cmd "${cmd_str} -" } + if {[string equal -nocase [sct target] "plus"]} { + set cmd "${cmd_str} +" + } if {[string equal -nocase [sct target] "up"]} { set cmd "${cmd_str} +" } From 67b6c5c7ee139088e8a72c760eade9459eafcd5a Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 6 Nov 2014 18:17:25 +1100 Subject: [PATCH 07/24] regen sct_he3_polanal.tcl --- .../config/beamline/sct_he3_polanal.tcl | 586 +++++++++++++----- 1 file changed, 415 insertions(+), 171 deletions(-) diff --git a/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl b/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl index 1eda955e..26d97060 100644 --- a/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl +++ b/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl @@ -59,6 +59,7 @@ proc ::scobj::he3_polanal::chkWrite {tc_root} { debug_log ${tc_root} 1 "chkWrite tc_root=${tc_root} sct=[sct] resp=[sct result]" # chkWrite hook code starts [namespace current]::rdValue ${tc_root} + clientput [sct result] # chkWrite hook code ends return "idle" } catch_message ] @@ -126,6 +127,7 @@ proc ::scobj::he3_polanal::rdValue {tc_root} { set data [lindex ${dlist} 1] } set path [pathname [sct]] + set timestamp [clock format [clock seconds] -format "%T"] if {[llength ${dlist}] > 2} { set new_value [lindex ${dlist} 2] if { "${new_value}" == "NaN" } { @@ -145,6 +147,7 @@ proc ::scobj::he3_polanal::rdValue {tc_root} { if {[llength ${dlist}] > 6} { hupdateif ${path}/Field "[lindex ${dlist} 6]" } + hupdateif ${path}/Timestamp "${timestamp}" # rdValue hook code ends if { [hpropexists [sct] geterror] } { debug_log ${tc_root} 9 "[sct] error: [sct geterror]" @@ -175,6 +178,9 @@ proc ::scobj::he3_polanal::setValue {tc_root nextState cmd_str} { if {[string equal -nocase [sct target] "refresh"]} { set cmd "${cmd_str}" } + if {[string equal -nocase [sct target] "minus"]} { + set cmd "${cmd_str} -" + } if {[string equal -nocase [sct target] "dn"]} { set cmd "${cmd_str} -" } @@ -184,6 +190,9 @@ proc ::scobj::he3_polanal::setValue {tc_root nextState cmd_str} { if {[sct target] == "-" || [sct target] == -1} { set cmd "${cmd_str} -" } + if {[string equal -nocase [sct target] "plus"]} { + set cmd "${cmd_str} +" + } if {[string equal -nocase [sct target] "up"]} { set cmd "${cmd_str} +" } @@ -209,8 +218,8 @@ 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 } { - ::scobj::he3_polanal::sics_log 9 "::scobj::he3_polanal::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}" +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}" set ns "[namespace current]" set catch_status [ catch { @@ -220,181 +229,387 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio sicslist setatt ${name} long_name ${name} set scobj_hpath /sics/${name} + if {[string equal -nocase ${has_anal} "true"]} { - hfactory ${scobj_hpath}/analyser plain spy none - hsetprop ${scobj_hpath}/analyser data "true" - hsetprop ${scobj_hpath}/analyser klass "@none" - hsetprop ${scobj_hpath}/analyser type "part" + hfactory ${scobj_hpath}/analyser plain spy none - hfactory ${scobj_hpath}/analyser/Amplitude plain user text - hsetprop ${scobj_hpath}/analyser/Amplitude control true - hsetprop ${scobj_hpath}/analyser/Amplitude data true - hsetprop ${scobj_hpath}/analyser/Amplitude mutable true - hsetprop ${scobj_hpath}/analyser/Amplitude nxsave true - hsetprop ${scobj_hpath}/analyser/Amplitude oldval UNKNOWN - hsetprop ${scobj_hpath}/analyser/Amplitude klass "parameter" - hsetprop ${scobj_hpath}/analyser/Amplitude sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/analyser/Amplitude type "part" - hsetprop ${scobj_hpath}/analyser/Amplitude nxalias "${name}_analyser_Amplitude" + hfactory ${scobj_hpath}/analyser/Amplitude plain user text + hsetprop ${scobj_hpath}/analyser/Amplitude control true + hsetprop ${scobj_hpath}/analyser/Amplitude data true + hsetprop ${scobj_hpath}/analyser/Amplitude mutable true + hsetprop ${scobj_hpath}/analyser/Amplitude nxsave true + hsetprop ${scobj_hpath}/analyser/Amplitude oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser/Amplitude klass "parameter" + hsetprop ${scobj_hpath}/analyser/Amplitude sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser/Amplitude type "part" + hsetprop ${scobj_hpath}/analyser/Amplitude nxalias "${name}_analyser_Amplitude" - hfactory ${scobj_hpath}/analyser/Field plain user text - hsetprop ${scobj_hpath}/analyser/Field control true - hsetprop ${scobj_hpath}/analyser/Field data true - hsetprop ${scobj_hpath}/analyser/Field mutable true - hsetprop ${scobj_hpath}/analyser/Field nxsave true - hsetprop ${scobj_hpath}/analyser/Field units Oersted - hsetprop ${scobj_hpath}/analyser/Field oldval UNKNOWN - hsetprop ${scobj_hpath}/analyser/Field klass "parameter" - hsetprop ${scobj_hpath}/analyser/Field sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/analyser/Field type "part" - hsetprop ${scobj_hpath}/analyser/Field nxalias "${name}_analyser_Field" + hfactory ${scobj_hpath}/analyser/Field plain user text + hsetprop ${scobj_hpath}/analyser/Field control true + hsetprop ${scobj_hpath}/analyser/Field data true + hsetprop ${scobj_hpath}/analyser/Field mutable true + hsetprop ${scobj_hpath}/analyser/Field nxsave true + hsetprop ${scobj_hpath}/analyser/Field units Oersted + hsetprop ${scobj_hpath}/analyser/Field oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser/Field klass "parameter" + hsetprop ${scobj_hpath}/analyser/Field sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser/Field type "part" + hsetprop ${scobj_hpath}/analyser/Field nxalias "${name}_analyser_Field" - hfactory ${scobj_hpath}/analyser/Freq plain user text - hsetprop ${scobj_hpath}/analyser/Freq control true - hsetprop ${scobj_hpath}/analyser/Freq data true - hsetprop ${scobj_hpath}/analyser/Freq mutable true - hsetprop ${scobj_hpath}/analyser/Freq nxsave true - hsetprop ${scobj_hpath}/analyser/Freq units Hertz - hsetprop ${scobj_hpath}/analyser/Freq oldval UNKNOWN - hsetprop ${scobj_hpath}/analyser/Freq klass "parameter" - hsetprop ${scobj_hpath}/analyser/Freq sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/analyser/Freq type "part" - hsetprop ${scobj_hpath}/analyser/Freq nxalias "${name}_analyser_Freq" + hfactory ${scobj_hpath}/analyser/Freq plain user text + hsetprop ${scobj_hpath}/analyser/Freq control true + hsetprop ${scobj_hpath}/analyser/Freq data true + hsetprop ${scobj_hpath}/analyser/Freq mutable true + hsetprop ${scobj_hpath}/analyser/Freq nxsave true + hsetprop ${scobj_hpath}/analyser/Freq units Hertz + hsetprop ${scobj_hpath}/analyser/Freq oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser/Freq klass "parameter" + hsetprop ${scobj_hpath}/analyser/Freq sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser/Freq type "part" + hsetprop ${scobj_hpath}/analyser/Freq nxalias "${name}_analyser_Freq" - hfactory ${scobj_hpath}/analyser/Phase plain user text - hsetprop ${scobj_hpath}/analyser/Phase control true - hsetprop ${scobj_hpath}/analyser/Phase data true - hsetprop ${scobj_hpath}/analyser/Phase mutable true - hsetprop ${scobj_hpath}/analyser/Phase nxsave true - hsetprop ${scobj_hpath}/analyser/Phase units Degree - hsetprop ${scobj_hpath}/analyser/Phase oldval UNKNOWN - hsetprop ${scobj_hpath}/analyser/Phase klass "parameter" - hsetprop ${scobj_hpath}/analyser/Phase sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/analyser/Phase type "part" - hsetprop ${scobj_hpath}/analyser/Phase nxalias "${name}_analyser_Phase" + hfactory ${scobj_hpath}/analyser/Phase plain user text + hsetprop ${scobj_hpath}/analyser/Phase control true + hsetprop ${scobj_hpath}/analyser/Phase data true + hsetprop ${scobj_hpath}/analyser/Phase mutable true + hsetprop ${scobj_hpath}/analyser/Phase nxsave true + hsetprop ${scobj_hpath}/analyser/Phase units Degree + hsetprop ${scobj_hpath}/analyser/Phase oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser/Phase klass "parameter" + hsetprop ${scobj_hpath}/analyser/Phase sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser/Phase type "part" + hsetprop ${scobj_hpath}/analyser/Phase nxalias "${name}_analyser_Phase" - hfactory ${scobj_hpath}/analyser/Time2 plain user text - hsetprop ${scobj_hpath}/analyser/Time2 control true - hsetprop ${scobj_hpath}/analyser/Time2 data true - hsetprop ${scobj_hpath}/analyser/Time2 mutable true - hsetprop ${scobj_hpath}/analyser/Time2 nxsave true - hsetprop ${scobj_hpath}/analyser/Time2 units Second - hsetprop ${scobj_hpath}/analyser/Time2 oldval UNKNOWN - hsetprop ${scobj_hpath}/analyser/Time2 klass "parameter" - hsetprop ${scobj_hpath}/analyser/Time2 sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/analyser/Time2 type "part" - hsetprop ${scobj_hpath}/analyser/Time2 nxalias "${name}_analyser_Time2" + hfactory ${scobj_hpath}/analyser/Time2 plain user text + hsetprop ${scobj_hpath}/analyser/Time2 control true + hsetprop ${scobj_hpath}/analyser/Time2 data true + hsetprop ${scobj_hpath}/analyser/Time2 mutable true + hsetprop ${scobj_hpath}/analyser/Time2 nxsave true + hsetprop ${scobj_hpath}/analyser/Time2 units Second + hsetprop ${scobj_hpath}/analyser/Time2 oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser/Time2 klass "parameter" + hsetprop ${scobj_hpath}/analyser/Time2 sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser/Time2 type "part" + hsetprop ${scobj_hpath}/analyser/Time2 nxalias "${name}_analyser_Time2" - hfactory ${scobj_hpath}/analyser/spin plain user text - 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 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} - hsetprop ${scobj_hpath}/analyser/spin control true - hsetprop ${scobj_hpath}/analyser/spin data true - hsetprop ${scobj_hpath}/analyser/spin mutable true - hsetprop ${scobj_hpath}/analyser/spin nxsave true - hsetprop ${scobj_hpath}/analyser/spin values +,-,0 - hsetprop ${scobj_hpath}/analyser/spin oldval UNKNOWN - hsetprop ${scobj_hpath}/analyser/spin klass "parameter" - hsetprop ${scobj_hpath}/analyser/spin sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/analyser/spin type "part" - hsetprop ${scobj_hpath}/analyser/spin nxalias "${name}_analyser_spin" + hfactory ${scobj_hpath}/analyser/Timestamp plain user text + hsetprop ${scobj_hpath}/analyser/Timestamp control true + hsetprop ${scobj_hpath}/analyser/Timestamp data true + hsetprop ${scobj_hpath}/analyser/Timestamp mutable true + hsetprop ${scobj_hpath}/analyser/Timestamp nxsave true + hsetprop ${scobj_hpath}/analyser/Timestamp oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser/Timestamp klass "parameter" + hsetprop ${scobj_hpath}/analyser/Timestamp sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser/Timestamp type "part" + hsetprop ${scobj_hpath}/analyser/Timestamp nxalias "${name}_analyser_Timestamp" - if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/analyser/spin 900 - ${sct_controller} write ${scobj_hpath}/analyser/spin - } else { - ::scobj::he3_polanal::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for he3_polanal" + hfactory ${scobj_hpath}/analyser/spin plain user text + 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 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} + hsetprop ${scobj_hpath}/analyser/spin control true + hsetprop ${scobj_hpath}/analyser/spin data true + hsetprop ${scobj_hpath}/analyser/spin mutable true + hsetprop ${scobj_hpath}/analyser/spin nxsave true + hsetprop ${scobj_hpath}/analyser/spin values +,-,Refresh + hsetprop ${scobj_hpath}/analyser/spin oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser/spin klass "parameter" + hsetprop ${scobj_hpath}/analyser/spin sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser/spin type "part" + hsetprop ${scobj_hpath}/analyser/spin nxalias "${name}_analyser_spin" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/analyser/spin 900 + ${sct_controller} write ${scobj_hpath}/analyser/spin + hsetprop ${scobj_hpath}/analyser/spin simulated false + } else { + ::scobj::he3_polanal::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for he3_polanal" + hsetprop ${scobj_hpath}/analyser/spin simulated true + } + hsetprop ${scobj_hpath}/analyser data "true" + hsetprop ${scobj_hpath}/analyser klass "@none" + hsetprop ${scobj_hpath}/analyser type "part" } + if {[string equal -nocase ${has_anal} "true"]} { - hfactory ${scobj_hpath}/polariser plain spy none - hsetprop ${scobj_hpath}/polariser data "true" - hsetprop ${scobj_hpath}/polariser klass "@none" - hsetprop ${scobj_hpath}/polariser type "part" + hfactory ${scobj_hpath}/analyser_start plain spy none - hfactory ${scobj_hpath}/polariser/Amplitude plain user text - hsetprop ${scobj_hpath}/polariser/Amplitude control true - hsetprop ${scobj_hpath}/polariser/Amplitude data true - hsetprop ${scobj_hpath}/polariser/Amplitude mutable true - hsetprop ${scobj_hpath}/polariser/Amplitude nxsave true - hsetprop ${scobj_hpath}/polariser/Amplitude oldval UNKNOWN - hsetprop ${scobj_hpath}/polariser/Amplitude klass "parameter" - hsetprop ${scobj_hpath}/polariser/Amplitude sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/polariser/Amplitude type "part" - hsetprop ${scobj_hpath}/polariser/Amplitude nxalias "${name}_polariser_Amplitude" + hfactory ${scobj_hpath}/analyser_start/Amplitude plain user text + hsetprop ${scobj_hpath}/analyser_start/Amplitude control true + hsetprop ${scobj_hpath}/analyser_start/Amplitude data true + hsetprop ${scobj_hpath}/analyser_start/Amplitude mutable true + hsetprop ${scobj_hpath}/analyser_start/Amplitude nxsave true + hsetprop ${scobj_hpath}/analyser_start/Amplitude oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser_start/Amplitude klass "parameter" + hsetprop ${scobj_hpath}/analyser_start/Amplitude sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser_start/Amplitude type "part" + hsetprop ${scobj_hpath}/analyser_start/Amplitude nxalias "${name}_analyser_start_Amplitude" - hfactory ${scobj_hpath}/polariser/Field plain user text - hsetprop ${scobj_hpath}/polariser/Field control true - hsetprop ${scobj_hpath}/polariser/Field data true - hsetprop ${scobj_hpath}/polariser/Field mutable true - hsetprop ${scobj_hpath}/polariser/Field nxsave true - hsetprop ${scobj_hpath}/polariser/Field units Oersted - hsetprop ${scobj_hpath}/polariser/Field oldval UNKNOWN - hsetprop ${scobj_hpath}/polariser/Field klass "parameter" - hsetprop ${scobj_hpath}/polariser/Field sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/polariser/Field type "part" - hsetprop ${scobj_hpath}/polariser/Field nxalias "${name}_polariser_Field" + hfactory ${scobj_hpath}/analyser_start/Field plain user text + hsetprop ${scobj_hpath}/analyser_start/Field control true + hsetprop ${scobj_hpath}/analyser_start/Field data true + hsetprop ${scobj_hpath}/analyser_start/Field mutable true + hsetprop ${scobj_hpath}/analyser_start/Field nxsave true + hsetprop ${scobj_hpath}/analyser_start/Field units Oersted + hsetprop ${scobj_hpath}/analyser_start/Field oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser_start/Field klass "parameter" + hsetprop ${scobj_hpath}/analyser_start/Field sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser_start/Field type "part" + hsetprop ${scobj_hpath}/analyser_start/Field nxalias "${name}_analyser_start_Field" - hfactory ${scobj_hpath}/polariser/Freq plain user text - hsetprop ${scobj_hpath}/polariser/Freq control true - hsetprop ${scobj_hpath}/polariser/Freq data true - hsetprop ${scobj_hpath}/polariser/Freq mutable true - hsetprop ${scobj_hpath}/polariser/Freq nxsave true - hsetprop ${scobj_hpath}/polariser/Freq units Hertz - hsetprop ${scobj_hpath}/polariser/Freq oldval UNKNOWN - hsetprop ${scobj_hpath}/polariser/Freq klass "parameter" - hsetprop ${scobj_hpath}/polariser/Freq sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/polariser/Freq type "part" - hsetprop ${scobj_hpath}/polariser/Freq nxalias "${name}_polariser_Freq" + hfactory ${scobj_hpath}/analyser_start/Freq plain user text + hsetprop ${scobj_hpath}/analyser_start/Freq control true + hsetprop ${scobj_hpath}/analyser_start/Freq data true + hsetprop ${scobj_hpath}/analyser_start/Freq mutable true + hsetprop ${scobj_hpath}/analyser_start/Freq nxsave true + hsetprop ${scobj_hpath}/analyser_start/Freq units Hertz + hsetprop ${scobj_hpath}/analyser_start/Freq oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser_start/Freq klass "parameter" + hsetprop ${scobj_hpath}/analyser_start/Freq sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser_start/Freq type "part" + hsetprop ${scobj_hpath}/analyser_start/Freq nxalias "${name}_analyser_start_Freq" - hfactory ${scobj_hpath}/polariser/Phase plain user text - hsetprop ${scobj_hpath}/polariser/Phase control true - hsetprop ${scobj_hpath}/polariser/Phase data true - hsetprop ${scobj_hpath}/polariser/Phase mutable true - hsetprop ${scobj_hpath}/polariser/Phase nxsave true - hsetprop ${scobj_hpath}/polariser/Phase units Degree - hsetprop ${scobj_hpath}/polariser/Phase oldval UNKNOWN - hsetprop ${scobj_hpath}/polariser/Phase klass "parameter" - hsetprop ${scobj_hpath}/polariser/Phase sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/polariser/Phase type "part" - hsetprop ${scobj_hpath}/polariser/Phase nxalias "${name}_polariser_Phase" + hfactory ${scobj_hpath}/analyser_start/Phase plain user text + hsetprop ${scobj_hpath}/analyser_start/Phase control true + hsetprop ${scobj_hpath}/analyser_start/Phase data true + hsetprop ${scobj_hpath}/analyser_start/Phase mutable true + hsetprop ${scobj_hpath}/analyser_start/Phase nxsave true + hsetprop ${scobj_hpath}/analyser_start/Phase units Degree + hsetprop ${scobj_hpath}/analyser_start/Phase oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser_start/Phase klass "parameter" + hsetprop ${scobj_hpath}/analyser_start/Phase sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser_start/Phase type "part" + hsetprop ${scobj_hpath}/analyser_start/Phase nxalias "${name}_analyser_start_Phase" - hfactory ${scobj_hpath}/polariser/Time2 plain user text - hsetprop ${scobj_hpath}/polariser/Time2 control true - hsetprop ${scobj_hpath}/polariser/Time2 data true - hsetprop ${scobj_hpath}/polariser/Time2 mutable true - hsetprop ${scobj_hpath}/polariser/Time2 nxsave true - hsetprop ${scobj_hpath}/polariser/Time2 units Second - hsetprop ${scobj_hpath}/polariser/Time2 oldval UNKNOWN - hsetprop ${scobj_hpath}/polariser/Time2 klass "parameter" - hsetprop ${scobj_hpath}/polariser/Time2 sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/polariser/Time2 type "part" - hsetprop ${scobj_hpath}/polariser/Time2 nxalias "${name}_polariser_Time2" + hfactory ${scobj_hpath}/analyser_start/Time2 plain user text + hsetprop ${scobj_hpath}/analyser_start/Time2 control true + hsetprop ${scobj_hpath}/analyser_start/Time2 data true + hsetprop ${scobj_hpath}/analyser_start/Time2 mutable true + hsetprop ${scobj_hpath}/analyser_start/Time2 nxsave true + hsetprop ${scobj_hpath}/analyser_start/Time2 units Second + hsetprop ${scobj_hpath}/analyser_start/Time2 oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser_start/Time2 klass "parameter" + hsetprop ${scobj_hpath}/analyser_start/Time2 sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser_start/Time2 type "part" + hsetprop ${scobj_hpath}/analyser_start/Time2 nxalias "${name}_analyser_start_Time2" - hfactory ${scobj_hpath}/polariser/spin plain user text - 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 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} - hsetprop ${scobj_hpath}/polariser/spin control true - hsetprop ${scobj_hpath}/polariser/spin data true - hsetprop ${scobj_hpath}/polariser/spin mutable true - hsetprop ${scobj_hpath}/polariser/spin nxsave true - hsetprop ${scobj_hpath}/polariser/spin values +,-,0 - hsetprop ${scobj_hpath}/polariser/spin oldval UNKNOWN - hsetprop ${scobj_hpath}/polariser/spin klass "parameter" - hsetprop ${scobj_hpath}/polariser/spin sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/polariser/spin type "part" - hsetprop ${scobj_hpath}/polariser/spin nxalias "${name}_polariser_spin" + hfactory ${scobj_hpath}/analyser_start/Timestamp plain user text + hsetprop ${scobj_hpath}/analyser_start/Timestamp control true + hsetprop ${scobj_hpath}/analyser_start/Timestamp data true + hsetprop ${scobj_hpath}/analyser_start/Timestamp mutable true + hsetprop ${scobj_hpath}/analyser_start/Timestamp nxsave true + hsetprop ${scobj_hpath}/analyser_start/Timestamp oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser_start/Timestamp klass "parameter" + hsetprop ${scobj_hpath}/analyser_start/Timestamp sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser_start/Timestamp type "part" + hsetprop ${scobj_hpath}/analyser_start/Timestamp nxalias "${name}_analyser_start_Timestamp" - if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/polariser/spin 900 - ${sct_controller} write ${scobj_hpath}/polariser/spin - } else { - ::scobj::he3_polanal::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for he3_polanal" + hfactory ${scobj_hpath}/analyser_start/spin plain user text + hsetprop ${scobj_hpath}/analyser_start/spin control true + hsetprop ${scobj_hpath}/analyser_start/spin data true + hsetprop ${scobj_hpath}/analyser_start/spin mutable true + hsetprop ${scobj_hpath}/analyser_start/spin nxsave true + hsetprop ${scobj_hpath}/analyser_start/spin oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser_start/spin klass "parameter" + hsetprop ${scobj_hpath}/analyser_start/spin sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser_start/spin type "part" + hsetprop ${scobj_hpath}/analyser_start/spin nxalias "${name}_analyser_start_spin" + hsetprop ${scobj_hpath}/analyser_start data "true" + hsetprop ${scobj_hpath}/analyser_start klass "@none" + hsetprop ${scobj_hpath}/analyser_start type "part" + } + if {[string equal -nocase ${has_pol} "true"]} { + + hfactory ${scobj_hpath}/polariser plain spy none + + hfactory ${scobj_hpath}/polariser/Amplitude plain user text + hsetprop ${scobj_hpath}/polariser/Amplitude control true + hsetprop ${scobj_hpath}/polariser/Amplitude data true + hsetprop ${scobj_hpath}/polariser/Amplitude mutable true + hsetprop ${scobj_hpath}/polariser/Amplitude nxsave true + hsetprop ${scobj_hpath}/polariser/Amplitude oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser/Amplitude klass "parameter" + hsetprop ${scobj_hpath}/polariser/Amplitude sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser/Amplitude type "part" + hsetprop ${scobj_hpath}/polariser/Amplitude nxalias "${name}_polariser_Amplitude" + + hfactory ${scobj_hpath}/polariser/Field plain user text + hsetprop ${scobj_hpath}/polariser/Field control true + hsetprop ${scobj_hpath}/polariser/Field data true + hsetprop ${scobj_hpath}/polariser/Field mutable true + hsetprop ${scobj_hpath}/polariser/Field nxsave true + hsetprop ${scobj_hpath}/polariser/Field units Oersted + hsetprop ${scobj_hpath}/polariser/Field oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser/Field klass "parameter" + hsetprop ${scobj_hpath}/polariser/Field sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser/Field type "part" + hsetprop ${scobj_hpath}/polariser/Field nxalias "${name}_polariser_Field" + + hfactory ${scobj_hpath}/polariser/Freq plain user text + hsetprop ${scobj_hpath}/polariser/Freq control true + hsetprop ${scobj_hpath}/polariser/Freq data true + hsetprop ${scobj_hpath}/polariser/Freq mutable true + hsetprop ${scobj_hpath}/polariser/Freq nxsave true + hsetprop ${scobj_hpath}/polariser/Freq units Hertz + hsetprop ${scobj_hpath}/polariser/Freq oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser/Freq klass "parameter" + hsetprop ${scobj_hpath}/polariser/Freq sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser/Freq type "part" + hsetprop ${scobj_hpath}/polariser/Freq nxalias "${name}_polariser_Freq" + + hfactory ${scobj_hpath}/polariser/Phase plain user text + hsetprop ${scobj_hpath}/polariser/Phase control true + hsetprop ${scobj_hpath}/polariser/Phase data true + hsetprop ${scobj_hpath}/polariser/Phase mutable true + hsetprop ${scobj_hpath}/polariser/Phase nxsave true + hsetprop ${scobj_hpath}/polariser/Phase units Degree + hsetprop ${scobj_hpath}/polariser/Phase oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser/Phase klass "parameter" + hsetprop ${scobj_hpath}/polariser/Phase sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser/Phase type "part" + hsetprop ${scobj_hpath}/polariser/Phase nxalias "${name}_polariser_Phase" + + hfactory ${scobj_hpath}/polariser/Time2 plain user text + hsetprop ${scobj_hpath}/polariser/Time2 control true + hsetprop ${scobj_hpath}/polariser/Time2 data true + hsetprop ${scobj_hpath}/polariser/Time2 mutable true + hsetprop ${scobj_hpath}/polariser/Time2 nxsave true + hsetprop ${scobj_hpath}/polariser/Time2 units Second + hsetprop ${scobj_hpath}/polariser/Time2 oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser/Time2 klass "parameter" + hsetprop ${scobj_hpath}/polariser/Time2 sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser/Time2 type "part" + hsetprop ${scobj_hpath}/polariser/Time2 nxalias "${name}_polariser_Time2" + + hfactory ${scobj_hpath}/polariser/Timestamp plain user text + hsetprop ${scobj_hpath}/polariser/Timestamp control true + hsetprop ${scobj_hpath}/polariser/Timestamp data true + hsetprop ${scobj_hpath}/polariser/Timestamp mutable true + hsetprop ${scobj_hpath}/polariser/Timestamp nxsave true + hsetprop ${scobj_hpath}/polariser/Timestamp oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser/Timestamp klass "parameter" + hsetprop ${scobj_hpath}/polariser/Timestamp sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser/Timestamp type "part" + hsetprop ${scobj_hpath}/polariser/Timestamp nxalias "${name}_polariser_Timestamp" + + hfactory ${scobj_hpath}/polariser/spin plain user text + 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 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} + hsetprop ${scobj_hpath}/polariser/spin control true + hsetprop ${scobj_hpath}/polariser/spin data true + hsetprop ${scobj_hpath}/polariser/spin mutable true + hsetprop ${scobj_hpath}/polariser/spin nxsave true + hsetprop ${scobj_hpath}/polariser/spin values +,-,Refresh + hsetprop ${scobj_hpath}/polariser/spin oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser/spin klass "parameter" + hsetprop ${scobj_hpath}/polariser/spin sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser/spin type "part" + hsetprop ${scobj_hpath}/polariser/spin nxalias "${name}_polariser_spin" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/polariser/spin 900 + ${sct_controller} write ${scobj_hpath}/polariser/spin + hsetprop ${scobj_hpath}/polariser/spin simulated false + } else { + ::scobj::he3_polanal::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for he3_polanal" + hsetprop ${scobj_hpath}/polariser/spin simulated true + } + hsetprop ${scobj_hpath}/polariser data "true" + hsetprop ${scobj_hpath}/polariser klass "@none" + hsetprop ${scobj_hpath}/polariser type "part" + } + if {[string equal -nocase ${has_pol} "true"]} { + + hfactory ${scobj_hpath}/polariser_start plain spy none + + hfactory ${scobj_hpath}/polariser_start/Amplitude plain user text + hsetprop ${scobj_hpath}/polariser_start/Amplitude control true + hsetprop ${scobj_hpath}/polariser_start/Amplitude data true + hsetprop ${scobj_hpath}/polariser_start/Amplitude mutable true + hsetprop ${scobj_hpath}/polariser_start/Amplitude nxsave true + hsetprop ${scobj_hpath}/polariser_start/Amplitude oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser_start/Amplitude klass "parameter" + hsetprop ${scobj_hpath}/polariser_start/Amplitude sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser_start/Amplitude type "part" + hsetprop ${scobj_hpath}/polariser_start/Amplitude nxalias "${name}_polariser_start_Amplitude" + + hfactory ${scobj_hpath}/polariser_start/Field plain user text + hsetprop ${scobj_hpath}/polariser_start/Field control true + hsetprop ${scobj_hpath}/polariser_start/Field data true + hsetprop ${scobj_hpath}/polariser_start/Field mutable true + hsetprop ${scobj_hpath}/polariser_start/Field nxsave true + hsetprop ${scobj_hpath}/polariser_start/Field units Oersted + hsetprop ${scobj_hpath}/polariser_start/Field oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser_start/Field klass "parameter" + hsetprop ${scobj_hpath}/polariser_start/Field sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser_start/Field type "part" + hsetprop ${scobj_hpath}/polariser_start/Field nxalias "${name}_polariser_start_Field" + + hfactory ${scobj_hpath}/polariser_start/Freq plain user text + hsetprop ${scobj_hpath}/polariser_start/Freq control true + hsetprop ${scobj_hpath}/polariser_start/Freq data true + hsetprop ${scobj_hpath}/polariser_start/Freq mutable true + hsetprop ${scobj_hpath}/polariser_start/Freq nxsave true + hsetprop ${scobj_hpath}/polariser_start/Freq units Hertz + hsetprop ${scobj_hpath}/polariser_start/Freq oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser_start/Freq klass "parameter" + hsetprop ${scobj_hpath}/polariser_start/Freq sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser_start/Freq type "part" + hsetprop ${scobj_hpath}/polariser_start/Freq nxalias "${name}_polariser_start_Freq" + + hfactory ${scobj_hpath}/polariser_start/Phase plain user text + hsetprop ${scobj_hpath}/polariser_start/Phase control true + hsetprop ${scobj_hpath}/polariser_start/Phase data true + hsetprop ${scobj_hpath}/polariser_start/Phase mutable true + hsetprop ${scobj_hpath}/polariser_start/Phase nxsave true + hsetprop ${scobj_hpath}/polariser_start/Phase units Degree + hsetprop ${scobj_hpath}/polariser_start/Phase oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser_start/Phase klass "parameter" + hsetprop ${scobj_hpath}/polariser_start/Phase sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser_start/Phase type "part" + hsetprop ${scobj_hpath}/polariser_start/Phase nxalias "${name}_polariser_start_Phase" + + hfactory ${scobj_hpath}/polariser_start/Time2 plain user text + hsetprop ${scobj_hpath}/polariser_start/Time2 control true + hsetprop ${scobj_hpath}/polariser_start/Time2 data true + hsetprop ${scobj_hpath}/polariser_start/Time2 mutable true + hsetprop ${scobj_hpath}/polariser_start/Time2 nxsave true + hsetprop ${scobj_hpath}/polariser_start/Time2 units Second + hsetprop ${scobj_hpath}/polariser_start/Time2 oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser_start/Time2 klass "parameter" + hsetprop ${scobj_hpath}/polariser_start/Time2 sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser_start/Time2 type "part" + hsetprop ${scobj_hpath}/polariser_start/Time2 nxalias "${name}_polariser_start_Time2" + + hfactory ${scobj_hpath}/polariser_start/Timestamp plain user text + hsetprop ${scobj_hpath}/polariser_start/Timestamp control true + hsetprop ${scobj_hpath}/polariser_start/Timestamp data true + hsetprop ${scobj_hpath}/polariser_start/Timestamp mutable true + hsetprop ${scobj_hpath}/polariser_start/Timestamp nxsave true + hsetprop ${scobj_hpath}/polariser_start/Timestamp oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser_start/Timestamp klass "parameter" + hsetprop ${scobj_hpath}/polariser_start/Timestamp sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser_start/Timestamp type "part" + hsetprop ${scobj_hpath}/polariser_start/Timestamp nxalias "${name}_polariser_start_Timestamp" + + hfactory ${scobj_hpath}/polariser_start/spin plain user text + hsetprop ${scobj_hpath}/polariser_start/spin control true + hsetprop ${scobj_hpath}/polariser_start/spin data true + hsetprop ${scobj_hpath}/polariser_start/spin mutable true + hsetprop ${scobj_hpath}/polariser_start/spin nxsave true + hsetprop ${scobj_hpath}/polariser_start/spin oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser_start/spin klass "parameter" + hsetprop ${scobj_hpath}/polariser_start/spin sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser_start/spin type "part" + hsetprop ${scobj_hpath}/polariser_start/spin nxalias "${name}_polariser_start_spin" + hsetprop ${scobj_hpath}/polariser_start data "true" + hsetprop ${scobj_hpath}/polariser_start klass "@none" + hsetprop ${scobj_hpath}/polariser_start type "part" } hsetprop ${scobj_hpath} klass ${device_class} hsetprop ${scobj_hpath} data true @@ -406,7 +621,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}" + ::scobj::he3_polanal::sics_log 9 "::scobj::he3_polanal::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${has_pol} ${has_anal}" 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}" @@ -416,10 +631,12 @@ proc ::scobj::he3_polanal::add_driver {name device_class simulation_flag ip_addr makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::he3_polanal::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for he3_polanal" + ::scobj::he3_polanal::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for he3_polanal" + ::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}" - ::scobj::he3_polanal::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} + ::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} } catch_message ] handle_exception ${catch_status} ${catch_message} } @@ -434,7 +651,7 @@ namespace eval ::scobj::he3_polanal { proc add_he3_polanal {name ip_address tcp_port} { set simulation_flag "[string tolower [SplitReply [rfgen_simulation]]]" - ::scobj::he3_polanal::add_driver ${name} "instrument" "${simulation_flag}" ${ip_address} ${tcp_port} + ::scobj::he3_polanal::add_driver ${name} "instrument" ${simulation_flag} ${ip_address} ${tcp_port} } clientput "file evaluation of sct_he3_polanal.tcl" @@ -473,20 +690,31 @@ proc ::scobj::he3_polanal::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"]" } } @@ -497,12 +725,28 @@ proc ::scobj::he3_polanal::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 has_pol true has_anal true] + foreach arg {has_pol has_anal} { + 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 } } } From 6c6292bbb255556b72bd089110cab393085aa1f4 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Fri, 7 Nov 2014 09:10:17 +1100 Subject: [PATCH 08/24] Change nodenames to lowercase and add a 'stash' function in he3_polanal --- .../config/beamline/he3_polanal.sct | 69 +++++++++++-------- 1 file changed, 39 insertions(+), 30 deletions(-) diff --git a/site_ansto/instrument/config/beamline/he3_polanal.sct b/site_ansto/instrument/config/beamline/he3_polanal.sct index 28c8b45f..ebee331a 100644 --- a/site_ansto/instrument/config/beamline/he3_polanal.sct +++ b/site_ansto/instrument/config/beamline/he3_polanal.sct @@ -18,23 +18,23 @@ driver he3_polanal = { check_function = chkWrite; allowed = "+,-,Refresh" } - var Amplitude = { } - var Freq = { units = 'Hertz'; } - var Phase = { units = 'Degree'; } - var Time2 = { units = 'Second'; } - var Field = { units = 'Oersted'; } - var Timestamp = { } + var amplitude = { } + var freq = { units = 'Hertz'; } + var phase = { units = 'Degree'; } + var time2 = { units = 'Second'; } + var field = { units = 'Oersted'; } + var timestamp = { } } group polariser_start = { conditional = '[string equal -nocase ${has_pol} "true"]'; type = text; var spin = { } - var Amplitude = { } - var Freq = { units = 'Hertz'; } - var Phase = { units = 'Degree'; } - var Time2 = { units = 'Second'; } - var Field = { units = 'Oersted'; } - var Timestamp = { } + var amplitude = { } + var freq = { units = 'Hertz'; } + var phase = { units = 'Degree'; } + var time2 = { units = 'Second'; } + var field = { units = 'Oersted'; } + var timestamp = { } } group analyser = { @@ -49,23 +49,23 @@ driver he3_polanal = { check_function = chkWrite; allowed = "+,-,Refresh" } - var Amplitude = { } - var Freq = { units = 'Hertz'; } - var Phase = { units = 'Degree'; } - var Time2 = { units = 'Second'; } - var Field = { units = 'Oersted'; } - var Timestamp = { } + var amplitude = { } + var freq = { units = 'Hertz'; } + var phase = { units = 'Degree'; } + var time2 = { units = 'Second'; } + var field = { units = 'Oersted'; } + var timestamp = { } } group analyser_start = { conditional = '[string equal -nocase ${has_anal} "true"]'; type = text; var spin = { } - var Amplitude = { } - var Freq = { units = 'Hertz'; } - var Phase = { units = 'Degree'; } - var Time2 = { units = 'Second'; } - var Field = { units = 'Oersted'; } - var Timestamp = { } + var amplitude = { } + var freq = { units = 'Hertz'; } + var phase = { units = 'Degree'; } + var time2 = { units = 'Second'; } + var field = { units = 'Oersted'; } + var timestamp = { } } code chkWrite = {%% @@ -98,21 +98,21 @@ driver he3_polanal = { if { "${new_value}" == "NaN" } { set new_value 0 } - hupdateif ${path}/Amplitude "${new_value}" + hupdateif ${path}/amplitude "${new_value}" } if {[llength ${dlist}] > 3} { - hupdateif ${path}/Freq "[lindex ${dlist} 3]" + hupdateif ${path}/freq "[lindex ${dlist} 3]" } if {[llength ${dlist}] > 4} { - hupdateif ${path}/Phase "[lindex ${dlist} 4]" + hupdateif ${path}/phase "[lindex ${dlist} 4]" } if {[llength ${dlist}] > 5} { - hupdateif ${path}/Time2 "[lindex ${dlist} 5]" + hupdateif ${path}/time2 "[lindex ${dlist} 5]" } if {[llength ${dlist}] > 6} { - hupdateif ${path}/Field "[lindex ${dlist} 6]" + hupdateif ${path}/field "[lindex ${dlist} 6]" } - hupdateif ${path}/Timestamp "${timestamp}" + hupdateif ${path}/timestamp "${timestamp}" %%} code setValue = {%% @@ -142,4 +142,13 @@ driver he3_polanal = { set cmd "${cmd_str} +" } %%} + code postamble = { + @TCL + proc stash {node} { + foreach arg {spin amplitude freq phase time2 field timestamp} { + hupdateif ${node}_start/${arg} [hval ${node}/${arg}] + } + } + @END + } } From 9909c1412ef76e45bb5699a17d51964a1f55b9e8 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Fri, 7 Nov 2014 09:14:09 +1100 Subject: [PATCH 09/24] Regenerate all the SCT drivers with new generator --- .../config/chopper/sct_astrium_chopper.tcl | 60 +- .../bilby/config/motors/sct_shutters.tcl | 64 +- .../bilby/config/motors/sct_tank.tcl | 76 ++- .../config/beamline/sct_he3_polanal.tcl | 547 +++++++++--------- .../environment/magneticField/sct_bruker.tcl | 28 +- .../sct_green_magnet_labview.tcl | 37 +- .../magneticField/sct_oxford12tlv.tcl | 28 +- .../environment/magneticField/sct_tsi_smc.tcl | 141 +++-- .../config/environment/sct_agilent_33220A.tcl | 37 +- .../config/environment/sct_hiden_xcs.tcl | 179 ++++-- .../config/environment/sct_huber_pilot.tcl | 103 +++- .../config/environment/sct_isotech_ps.tcl | 81 ++- .../config/environment/sct_keithley_m2700.tcl | 28 +- .../config/environment/sct_knauer_pump.tcl | 135 +++-- .../config/environment/sct_mvp_valve.tcl | 37 +- .../config/environment/sct_nhq_200.tcl | 276 +++++++-- .../config/environment/sct_omron_hldc.tcl | 51 +- .../config/environment/sct_protekmm.tcl | 28 +- .../config/environment/sct_syringe_pump.tcl | 28 +- .../temperature/sct_eurotherm_3200.tcl | 163 ++++-- .../temperature/sct_eurotherm_m2000.tcl | 28 +- .../temperature/sct_julabo_lh45_gen.tcl | 156 +++-- .../temperature/sct_lakeshore_218.tcl | 113 +++- .../temperature/sct_lakeshore_m370.tcl | 28 +- .../environment/temperature/sct_ls336.tcl | 28 +- .../environment/temperature/sct_ls340.tcl | 28 +- .../temperature/sct_mercury_base.tcl | 148 +++-- .../temperature/sct_mercury_level.tcl | 45 +- .../temperature/sct_mercury_pres.tcl | 65 ++- .../temperature/sct_mercury_scpi.tcl | 221 +++++-- .../temperature/sct_mercury_temp.tcl | 74 ++- .../temperature/sct_mercury_valve.tcl | 56 +- .../environment/temperature/sct_nprvasm2.tcl | 28 +- .../temperature/sct_pfeiffer_hg.tcl | 56 +- .../environment/temperature/sct_srs_sr630.tcl | 114 +++- .../temperature/sct_watlow_mpm.tcl | 28 +- .../temperature/sct_watlow_mrm.tcl | 28 +- .../temperature/sct_watlow_mst4.tcl | 28 +- .../environment/temperature/sct_west4100.tcl | 37 +- .../environment/temperature/sct_west_6100.tcl | 154 +++-- .../config/robots/sct_epson_pandp.tcl | 37 +- .../config/source/sct_reactor_status.tcl | 42 +- 42 files changed, 2483 insertions(+), 1186 deletions(-) diff --git a/site_ansto/instrument/bilby/config/chopper/sct_astrium_chopper.tcl b/site_ansto/instrument/bilby/config/chopper/sct_astrium_chopper.tcl index d0c0c135..cd7e8f18 100644 --- a/site_ansto/instrument/bilby/config/chopper/sct_astrium_chopper.tcl +++ b/site_ansto/instrument/bilby/config/chopper/sct_astrium_chopper.tcl @@ -243,9 +243,6 @@ proc ::scobj::astrium_chopper::mkDriver { sct_controller name device_class simul set scobj_hpath /sics/${name} hfactory ${scobj_hpath}/blade_1 plain spy none - hsetprop ${scobj_hpath}/blade_1 data "true" - hsetprop ${scobj_hpath}/blade_1 klass "@none" - hsetprop ${scobj_hpath}/blade_1 type "part" hfactory ${scobj_hpath}/blade_1/aphase plain user float hsetprop ${scobj_hpath}/blade_1/aphase control true @@ -318,14 +315,16 @@ proc ::scobj::astrium_chopper::mkDriver { sct_controller name device_class simul if {[string equal -nocase "${simulation_flag}" "false"]} { ${sct_controller} poll ${scobj_hpath}/blade_1/state 1 + hsetprop ${scobj_hpath}/blade_1/state simulated false } else { ::scobj::astrium_chopper::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for astrium_chopper" + hsetprop ${scobj_hpath}/blade_1/state simulated true } + hsetprop ${scobj_hpath}/blade_1 data "true" + hsetprop ${scobj_hpath}/blade_1 klass "@none" + hsetprop ${scobj_hpath}/blade_1 type "part" hfactory ${scobj_hpath}/blade_2 plain spy none - hsetprop ${scobj_hpath}/blade_2 data "true" - hsetprop ${scobj_hpath}/blade_2 klass "@none" - hsetprop ${scobj_hpath}/blade_2 type "part" hfactory ${scobj_hpath}/blade_2/aphase plain user float hsetprop ${scobj_hpath}/blade_2/aphase control true @@ -398,14 +397,16 @@ proc ::scobj::astrium_chopper::mkDriver { sct_controller name device_class simul if {[string equal -nocase "${simulation_flag}" "false"]} { ${sct_controller} poll ${scobj_hpath}/blade_2/state 1 + hsetprop ${scobj_hpath}/blade_2/state simulated false } else { ::scobj::astrium_chopper::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for astrium_chopper" + hsetprop ${scobj_hpath}/blade_2/state simulated true } + hsetprop ${scobj_hpath}/blade_2 data "true" + hsetprop ${scobj_hpath}/blade_2 klass "@none" + hsetprop ${scobj_hpath}/blade_2 type "part" hfactory ${scobj_hpath}/blade_3 plain spy none - hsetprop ${scobj_hpath}/blade_3 data "true" - hsetprop ${scobj_hpath}/blade_3 klass "@none" - hsetprop ${scobj_hpath}/blade_3 type "part" hfactory ${scobj_hpath}/blade_3/aphase plain user float hsetprop ${scobj_hpath}/blade_3/aphase control true @@ -478,14 +479,16 @@ proc ::scobj::astrium_chopper::mkDriver { sct_controller name device_class simul if {[string equal -nocase "${simulation_flag}" "false"]} { ${sct_controller} poll ${scobj_hpath}/blade_3/state 1 + hsetprop ${scobj_hpath}/blade_3/state simulated false } else { ::scobj::astrium_chopper::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for astrium_chopper" + hsetprop ${scobj_hpath}/blade_3/state simulated true } + hsetprop ${scobj_hpath}/blade_3 data "true" + hsetprop ${scobj_hpath}/blade_3 klass "@none" + hsetprop ${scobj_hpath}/blade_3 type "part" hfactory ${scobj_hpath}/blade_4 plain spy none - hsetprop ${scobj_hpath}/blade_4 data "true" - hsetprop ${scobj_hpath}/blade_4 klass "@none" - hsetprop ${scobj_hpath}/blade_4 type "part" hfactory ${scobj_hpath}/blade_4/aphase plain user float hsetprop ${scobj_hpath}/blade_4/aphase control true @@ -558,9 +561,14 @@ proc ::scobj::astrium_chopper::mkDriver { sct_controller name device_class simul if {[string equal -nocase "${simulation_flag}" "false"]} { ${sct_controller} poll ${scobj_hpath}/blade_4/state 1 + hsetprop ${scobj_hpath}/blade_4/state simulated false } else { ::scobj::astrium_chopper::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for astrium_chopper" + hsetprop ${scobj_hpath}/blade_4/state simulated true } + hsetprop ${scobj_hpath}/blade_4 data "true" + hsetprop ${scobj_hpath}/blade_4 klass "@none" + hsetprop ${scobj_hpath}/blade_4 type "part" hsetprop ${scobj_hpath} klass ${device_class} hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} debug_threshold 5 @@ -582,7 +590,9 @@ proc ::scobj::astrium_chopper::add_driver {name device_class simulation_flag ip_ makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::astrium_chopper::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for astrium_chopper" + ::scobj::astrium_chopper::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for astrium_chopper" + ::scobj::astrium_chopper::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::astrium_chopper::sics_log 1 "::scobj::astrium_chopper::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}" ::scobj::astrium_chopper::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} @@ -600,7 +610,7 @@ namespace eval ::scobj::astrium_chopper { proc add_astrium_chopper {name ip_address tcp_port} { set simulation_flag "[string tolower [SplitReply [chopper_simulation]]]" - ::scobj::astrium_chopper::add_driver ${name} "NXdisk_chopper" "${simulation_flag}" ${ip_address} ${tcp_port} + ::scobj::astrium_chopper::add_driver ${name} "NXdisk_chopper" ${simulation_flag} ${ip_address} ${tcp_port} } clientput "file evaluation of sct_astrium_chopper.tcl" @@ -639,20 +649,31 @@ proc ::scobj::astrium_chopper::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"]" } } @@ -663,12 +684,9 @@ proc ::scobj::astrium_chopper::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/bilby/config/motors/sct_shutters.tcl b/site_ansto/instrument/bilby/config/motors/sct_shutters.tcl index be3528b4..d409f38e 100644 --- a/site_ansto/instrument/bilby/config/motors/sct_shutters.tcl +++ b/site_ansto/instrument/bilby/config/motors/sct_shutters.tcl @@ -218,6 +218,14 @@ proc ::scobj::shutters::mkDriver { sct_controller name device_class simulation_f hsetprop ${scobj_hpath}/fast_shutter sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/fast_shutter type "part" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/fast_shutter 1 + hsetprop ${scobj_hpath}/fast_shutter simulated false + } else { + ::scobj::shutters::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for shutters" + hsetprop ${scobj_hpath}/fast_shutter simulated true + } + hfactory ${scobj_hpath}/rough_100 plain user text hsetprop ${scobj_hpath}/rough_100 read ${ns}::getValue ${scobj_hpath} read_switch_pair {MG @IN[15], @IN[16]} hsetprop ${scobj_hpath}/rough_100 read_switch_pair ${ns}::read_switch_pair ${scobj_hpath} @@ -235,6 +243,15 @@ proc ::scobj::shutters::mkDriver { sct_controller name device_class simulation_f hsetprop ${scobj_hpath}/rough_100 sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/rough_100 type "part" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/rough_100 1 + ${sct_controller} write ${scobj_hpath}/rough_100 + hsetprop ${scobj_hpath}/rough_100 simulated false + } else { + ::scobj::shutters::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for shutters" + hsetprop ${scobj_hpath}/rough_100 simulated true + } + hfactory ${scobj_hpath}/rough_40 plain user text hsetprop ${scobj_hpath}/rough_40 read ${ns}::getValue ${scobj_hpath} read_switch_pair {MG @IN[13], @IN[14]} hsetprop ${scobj_hpath}/rough_40 read_switch_pair ${ns}::read_switch_pair ${scobj_hpath} @@ -252,20 +269,19 @@ proc ::scobj::shutters::mkDriver { sct_controller name device_class simulation_f hsetprop ${scobj_hpath}/rough_40 sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/rough_40 type "part" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/rough_40 1 + ${sct_controller} write ${scobj_hpath}/rough_40 + hsetprop ${scobj_hpath}/rough_40 simulated false + } else { + ::scobj::shutters::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for shutters" + hsetprop ${scobj_hpath}/rough_40 simulated true + } + hsetprop ${scobj_hpath} data "true" hsetprop ${scobj_hpath} klass "@none" hsetprop ${scobj_hpath} nxsave "true" hsetprop ${scobj_hpath} type "part" - - if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/fast_shutter 1 - ${sct_controller} poll ${scobj_hpath}/rough_100 1 - ${sct_controller} poll ${scobj_hpath}/rough_40 1 - ${sct_controller} write ${scobj_hpath}/rough_100 - ${sct_controller} write ${scobj_hpath}/rough_40 - } else { - ::scobj::shutters::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for shutters" - } hsetprop ${scobj_hpath} klass ${device_class} hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} debug_threshold 5 @@ -287,7 +303,9 @@ proc ::scobj::shutters::add_driver {name device_class simulation_flag ip_address makesctcontroller sct_${name} dmc2280 ${ip_address}:${tcp_port} } } else { - ::scobj::shutters::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for shutters" + ::scobj::shutters::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for shutters" + ::scobj::shutters::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::shutters::sics_log 1 "::scobj::shutters::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}" ::scobj::shutters::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} @@ -305,7 +323,7 @@ namespace eval ::scobj::shutters { proc add_shutters {name ip_address tcp_port} { set simulation_flag "[string tolower [SplitReply [motor_simulation]]]" - ::scobj::shutters::add_driver ${name} "instrument" "${simulation_flag}" ${ip_address} ${tcp_port} + ::scobj::shutters::add_driver ${name} "instrument" ${simulation_flag} ${ip_address} ${tcp_port} } clientput "file evaluation of sct_shutters.tcl" @@ -344,20 +362,31 @@ proc ::scobj::shutters::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} dmc2280 ${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"]" } } @@ -368,12 +397,9 @@ proc ::scobj::shutters::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/bilby/config/motors/sct_tank.tcl b/site_ansto/instrument/bilby/config/motors/sct_tank.tcl index 2ca7adf4..8f0019e6 100644 --- a/site_ansto/instrument/bilby/config/motors/sct_tank.tcl +++ b/site_ansto/instrument/bilby/config/motors/sct_tank.tcl @@ -226,20 +226,19 @@ proc ::scobj::tank::mkDriver { sct_controller name device_class simulation_flag hsetprop ${scobj_hpath}/pos type "part" hsetprop ${scobj_hpath}/pos nxalias "${name}_pos" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pos 1 + hsetprop ${scobj_hpath}/pos simulated false + } else { + ::scobj::tank::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for tank" + hsetprop ${scobj_hpath}/pos 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}/pos 1 - } else { - ::scobj::tank::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for tank" - } - hfactory ${scobj_hpath}/limits plain spy none - hsetprop ${scobj_hpath}/limits data "true" - hsetprop ${scobj_hpath}/limits klass "@none" - hsetprop ${scobj_hpath}/limits type "part" hfactory ${scobj_hpath}/limits/forward plain user text hsetprop ${scobj_hpath}/limits/forward read ${ns}::getValue ${scobj_hpath} read_switch {MG _LFH} @@ -254,6 +253,14 @@ proc ::scobj::tank::mkDriver { sct_controller name device_class simulation_flag hsetprop ${scobj_hpath}/limits/forward type "part" hsetprop ${scobj_hpath}/limits/forward nxalias "${name}_limits_forward" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/limits/forward 1 + hsetprop ${scobj_hpath}/limits/forward simulated false + } else { + ::scobj::tank::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for tank" + hsetprop ${scobj_hpath}/limits/forward simulated true + } + hfactory ${scobj_hpath}/limits/reverse plain user text hsetprop ${scobj_hpath}/limits/reverse read ${ns}::getValue ${scobj_hpath} read_switch {MG _LRH} hsetprop ${scobj_hpath}/limits/reverse read_switch ${ns}::read_switch ${scobj_hpath} @@ -268,16 +275,17 @@ proc ::scobj::tank::mkDriver { sct_controller name device_class simulation_flag hsetprop ${scobj_hpath}/limits/reverse nxalias "${name}_limits_reverse" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/limits/forward 1 ${sct_controller} poll ${scobj_hpath}/limits/reverse 1 + hsetprop ${scobj_hpath}/limits/reverse simulated false } else { ::scobj::tank::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for tank" + hsetprop ${scobj_hpath}/limits/reverse simulated true } + hsetprop ${scobj_hpath}/limits data "true" + hsetprop ${scobj_hpath}/limits klass "@none" + hsetprop ${scobj_hpath}/limits type "part" hfactory ${scobj_hpath}/switches plain spy none - hsetprop ${scobj_hpath}/switches data "true" - hsetprop ${scobj_hpath}/switches klass "@none" - hsetprop ${scobj_hpath}/switches type "part" hfactory ${scobj_hpath}/switches/forward plain user text hsetprop ${scobj_hpath}/switches/forward read ${ns}::getValue ${scobj_hpath} read_switch {MG @IN[5]} @@ -292,6 +300,14 @@ proc ::scobj::tank::mkDriver { sct_controller name device_class simulation_flag hsetprop ${scobj_hpath}/switches/forward type "part" hsetprop ${scobj_hpath}/switches/forward nxalias "${name}_switches_forward" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/switches/forward 1 + hsetprop ${scobj_hpath}/switches/forward simulated false + } else { + ::scobj::tank::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for tank" + hsetprop ${scobj_hpath}/switches/forward simulated true + } + hfactory ${scobj_hpath}/switches/reverse plain user text hsetprop ${scobj_hpath}/switches/reverse read ${ns}::getValue ${scobj_hpath} read_switch {MG @IN[6]} hsetprop ${scobj_hpath}/switches/reverse read_switch ${ns}::read_switch ${scobj_hpath} @@ -306,11 +322,15 @@ proc ::scobj::tank::mkDriver { sct_controller name device_class simulation_flag hsetprop ${scobj_hpath}/switches/reverse nxalias "${name}_switches_reverse" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/switches/forward 1 ${sct_controller} poll ${scobj_hpath}/switches/reverse 1 + hsetprop ${scobj_hpath}/switches/reverse simulated false } else { ::scobj::tank::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for tank" + hsetprop ${scobj_hpath}/switches/reverse simulated true } + hsetprop ${scobj_hpath}/switches data "true" + hsetprop ${scobj_hpath}/switches klass "@none" + hsetprop ${scobj_hpath}/switches type "part" hsetprop ${scobj_hpath} klass ${device_class} hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} debug_threshold 5 @@ -335,7 +355,9 @@ proc ::scobj::tank::add_driver {name device_class simulation_flag ip_address tcp makesctcontroller sct_${name} dmc2280 ${ip_address}:${tcp_port} } } else { - ::scobj::tank::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for tank" + ::scobj::tank::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for tank" + ::scobj::tank::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::tank::sics_log 1 "::scobj::tank::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}" ::scobj::tank::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} @@ -353,7 +375,7 @@ namespace eval ::scobj::tank { proc add_tank {name ip_address tcp_port} { set simulation_flag "[string tolower [SplitReply [motor_simulation]]]" - ::scobj::tank::add_driver ${name} "instrument" "${simulation_flag}" ${ip_address} ${tcp_port} + ::scobj::tank::add_driver ${name} "instrument" ${simulation_flag} ${ip_address} ${tcp_port} } clientput "file evaluation of sct_tank.tcl" @@ -392,20 +414,31 @@ proc ::scobj::tank::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} dmc2280 ${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"]" } } @@ -416,12 +449,9 @@ proc ::scobj::tank::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/beamline/sct_he3_polanal.tcl b/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl index 26d97060..c8a59aad 100644 --- a/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl +++ b/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl @@ -133,21 +133,21 @@ proc ::scobj::he3_polanal::rdValue {tc_root} { if { "${new_value}" == "NaN" } { set new_value 0 } - hupdateif ${path}/Amplitude "${new_value}" + hupdateif ${path}/amplitude "${new_value}" } if {[llength ${dlist}] > 3} { - hupdateif ${path}/Freq "[lindex ${dlist} 3]" + hupdateif ${path}/freq "[lindex ${dlist} 3]" } if {[llength ${dlist}] > 4} { - hupdateif ${path}/Phase "[lindex ${dlist} 4]" + hupdateif ${path}/phase "[lindex ${dlist} 4]" } if {[llength ${dlist}] > 5} { - hupdateif ${path}/Time2 "[lindex ${dlist} 5]" + hupdateif ${path}/time2 "[lindex ${dlist} 5]" } if {[llength ${dlist}] > 6} { - hupdateif ${path}/Field "[lindex ${dlist} 6]" + hupdateif ${path}/field "[lindex ${dlist} 6]" } - hupdateif ${path}/Timestamp "${timestamp}" + hupdateif ${path}/timestamp "${timestamp}" # rdValue hook code ends if { [hpropexists [sct] geterror] } { debug_log ${tc_root} 9 "[sct] error: [sct geterror]" @@ -233,75 +233,52 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hfactory ${scobj_hpath}/analyser plain spy none - hfactory ${scobj_hpath}/analyser/Amplitude plain user text - hsetprop ${scobj_hpath}/analyser/Amplitude control true - hsetprop ${scobj_hpath}/analyser/Amplitude data true - hsetprop ${scobj_hpath}/analyser/Amplitude mutable true - hsetprop ${scobj_hpath}/analyser/Amplitude nxsave true - hsetprop ${scobj_hpath}/analyser/Amplitude oldval UNKNOWN - hsetprop ${scobj_hpath}/analyser/Amplitude klass "parameter" - hsetprop ${scobj_hpath}/analyser/Amplitude sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/analyser/Amplitude type "part" - hsetprop ${scobj_hpath}/analyser/Amplitude nxalias "${name}_analyser_Amplitude" + hfactory ${scobj_hpath}/analyser/amplitude plain user text + hsetprop ${scobj_hpath}/analyser/amplitude control true + hsetprop ${scobj_hpath}/analyser/amplitude data true + hsetprop ${scobj_hpath}/analyser/amplitude mutable true + hsetprop ${scobj_hpath}/analyser/amplitude nxsave true + hsetprop ${scobj_hpath}/analyser/amplitude oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser/amplitude klass "parameter" + hsetprop ${scobj_hpath}/analyser/amplitude sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser/amplitude type "part" + hsetprop ${scobj_hpath}/analyser/amplitude nxalias "${name}_analyser_amplitude" - hfactory ${scobj_hpath}/analyser/Field plain user text - hsetprop ${scobj_hpath}/analyser/Field control true - hsetprop ${scobj_hpath}/analyser/Field data true - hsetprop ${scobj_hpath}/analyser/Field mutable true - hsetprop ${scobj_hpath}/analyser/Field nxsave true - hsetprop ${scobj_hpath}/analyser/Field units Oersted - hsetprop ${scobj_hpath}/analyser/Field oldval UNKNOWN - hsetprop ${scobj_hpath}/analyser/Field klass "parameter" - hsetprop ${scobj_hpath}/analyser/Field sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/analyser/Field type "part" - hsetprop ${scobj_hpath}/analyser/Field nxalias "${name}_analyser_Field" + hfactory ${scobj_hpath}/analyser/field plain user text + hsetprop ${scobj_hpath}/analyser/field control true + hsetprop ${scobj_hpath}/analyser/field data true + hsetprop ${scobj_hpath}/analyser/field mutable true + hsetprop ${scobj_hpath}/analyser/field nxsave true + hsetprop ${scobj_hpath}/analyser/field units Oersted + hsetprop ${scobj_hpath}/analyser/field oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser/field klass "parameter" + hsetprop ${scobj_hpath}/analyser/field sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser/field type "part" + hsetprop ${scobj_hpath}/analyser/field nxalias "${name}_analyser_field" - hfactory ${scobj_hpath}/analyser/Freq plain user text - hsetprop ${scobj_hpath}/analyser/Freq control true - hsetprop ${scobj_hpath}/analyser/Freq data true - hsetprop ${scobj_hpath}/analyser/Freq mutable true - hsetprop ${scobj_hpath}/analyser/Freq nxsave true - hsetprop ${scobj_hpath}/analyser/Freq units Hertz - hsetprop ${scobj_hpath}/analyser/Freq oldval UNKNOWN - hsetprop ${scobj_hpath}/analyser/Freq klass "parameter" - hsetprop ${scobj_hpath}/analyser/Freq sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/analyser/Freq type "part" - hsetprop ${scobj_hpath}/analyser/Freq nxalias "${name}_analyser_Freq" + hfactory ${scobj_hpath}/analyser/freq plain user text + hsetprop ${scobj_hpath}/analyser/freq control true + hsetprop ${scobj_hpath}/analyser/freq data true + hsetprop ${scobj_hpath}/analyser/freq mutable true + hsetprop ${scobj_hpath}/analyser/freq nxsave true + hsetprop ${scobj_hpath}/analyser/freq units Hertz + hsetprop ${scobj_hpath}/analyser/freq oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser/freq klass "parameter" + hsetprop ${scobj_hpath}/analyser/freq sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser/freq type "part" + hsetprop ${scobj_hpath}/analyser/freq nxalias "${name}_analyser_freq" - hfactory ${scobj_hpath}/analyser/Phase plain user text - hsetprop ${scobj_hpath}/analyser/Phase control true - hsetprop ${scobj_hpath}/analyser/Phase data true - hsetprop ${scobj_hpath}/analyser/Phase mutable true - hsetprop ${scobj_hpath}/analyser/Phase nxsave true - hsetprop ${scobj_hpath}/analyser/Phase units Degree - hsetprop ${scobj_hpath}/analyser/Phase oldval UNKNOWN - hsetprop ${scobj_hpath}/analyser/Phase klass "parameter" - hsetprop ${scobj_hpath}/analyser/Phase sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/analyser/Phase type "part" - hsetprop ${scobj_hpath}/analyser/Phase nxalias "${name}_analyser_Phase" - - hfactory ${scobj_hpath}/analyser/Time2 plain user text - hsetprop ${scobj_hpath}/analyser/Time2 control true - hsetprop ${scobj_hpath}/analyser/Time2 data true - hsetprop ${scobj_hpath}/analyser/Time2 mutable true - hsetprop ${scobj_hpath}/analyser/Time2 nxsave true - hsetprop ${scobj_hpath}/analyser/Time2 units Second - hsetprop ${scobj_hpath}/analyser/Time2 oldval UNKNOWN - hsetprop ${scobj_hpath}/analyser/Time2 klass "parameter" - hsetprop ${scobj_hpath}/analyser/Time2 sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/analyser/Time2 type "part" - hsetprop ${scobj_hpath}/analyser/Time2 nxalias "${name}_analyser_Time2" - - hfactory ${scobj_hpath}/analyser/Timestamp plain user text - hsetprop ${scobj_hpath}/analyser/Timestamp control true - hsetprop ${scobj_hpath}/analyser/Timestamp data true - hsetprop ${scobj_hpath}/analyser/Timestamp mutable true - hsetprop ${scobj_hpath}/analyser/Timestamp nxsave true - hsetprop ${scobj_hpath}/analyser/Timestamp oldval UNKNOWN - hsetprop ${scobj_hpath}/analyser/Timestamp klass "parameter" - hsetprop ${scobj_hpath}/analyser/Timestamp sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/analyser/Timestamp type "part" - hsetprop ${scobj_hpath}/analyser/Timestamp nxalias "${name}_analyser_Timestamp" + hfactory ${scobj_hpath}/analyser/phase plain user text + hsetprop ${scobj_hpath}/analyser/phase control true + hsetprop ${scobj_hpath}/analyser/phase data true + hsetprop ${scobj_hpath}/analyser/phase mutable true + hsetprop ${scobj_hpath}/analyser/phase nxsave true + hsetprop ${scobj_hpath}/analyser/phase units Degree + hsetprop ${scobj_hpath}/analyser/phase oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser/phase klass "parameter" + hsetprop ${scobj_hpath}/analyser/phase sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser/phase type "part" + hsetprop ${scobj_hpath}/analyser/phase nxalias "${name}_analyser_phase" hfactory ${scobj_hpath}/analyser/spin plain user text hsetprop ${scobj_hpath}/analyser/spin read ${ns}::getValue ${scobj_hpath} rdValue {analyser} @@ -328,6 +305,29 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio ::scobj::he3_polanal::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for he3_polanal" hsetprop ${scobj_hpath}/analyser/spin simulated true } + + hfactory ${scobj_hpath}/analyser/time2 plain user text + hsetprop ${scobj_hpath}/analyser/time2 control true + hsetprop ${scobj_hpath}/analyser/time2 data true + hsetprop ${scobj_hpath}/analyser/time2 mutable true + hsetprop ${scobj_hpath}/analyser/time2 nxsave true + hsetprop ${scobj_hpath}/analyser/time2 units Second + hsetprop ${scobj_hpath}/analyser/time2 oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser/time2 klass "parameter" + hsetprop ${scobj_hpath}/analyser/time2 sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser/time2 type "part" + hsetprop ${scobj_hpath}/analyser/time2 nxalias "${name}_analyser_time2" + + hfactory ${scobj_hpath}/analyser/timestamp plain user text + hsetprop ${scobj_hpath}/analyser/timestamp control true + hsetprop ${scobj_hpath}/analyser/timestamp data true + hsetprop ${scobj_hpath}/analyser/timestamp mutable true + hsetprop ${scobj_hpath}/analyser/timestamp nxsave true + hsetprop ${scobj_hpath}/analyser/timestamp oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser/timestamp klass "parameter" + hsetprop ${scobj_hpath}/analyser/timestamp sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser/timestamp type "part" + hsetprop ${scobj_hpath}/analyser/timestamp nxalias "${name}_analyser_timestamp" hsetprop ${scobj_hpath}/analyser data "true" hsetprop ${scobj_hpath}/analyser klass "@none" hsetprop ${scobj_hpath}/analyser type "part" @@ -336,75 +336,52 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hfactory ${scobj_hpath}/analyser_start plain spy none - hfactory ${scobj_hpath}/analyser_start/Amplitude plain user text - hsetprop ${scobj_hpath}/analyser_start/Amplitude control true - hsetprop ${scobj_hpath}/analyser_start/Amplitude data true - hsetprop ${scobj_hpath}/analyser_start/Amplitude mutable true - hsetprop ${scobj_hpath}/analyser_start/Amplitude nxsave true - hsetprop ${scobj_hpath}/analyser_start/Amplitude oldval UNKNOWN - hsetprop ${scobj_hpath}/analyser_start/Amplitude klass "parameter" - hsetprop ${scobj_hpath}/analyser_start/Amplitude sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/analyser_start/Amplitude type "part" - hsetprop ${scobj_hpath}/analyser_start/Amplitude nxalias "${name}_analyser_start_Amplitude" + hfactory ${scobj_hpath}/analyser_start/amplitude plain user text + hsetprop ${scobj_hpath}/analyser_start/amplitude control true + hsetprop ${scobj_hpath}/analyser_start/amplitude data true + hsetprop ${scobj_hpath}/analyser_start/amplitude mutable true + hsetprop ${scobj_hpath}/analyser_start/amplitude nxsave true + hsetprop ${scobj_hpath}/analyser_start/amplitude oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser_start/amplitude klass "parameter" + hsetprop ${scobj_hpath}/analyser_start/amplitude sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser_start/amplitude type "part" + hsetprop ${scobj_hpath}/analyser_start/amplitude nxalias "${name}_analyser_start_amplitude" - hfactory ${scobj_hpath}/analyser_start/Field plain user text - hsetprop ${scobj_hpath}/analyser_start/Field control true - hsetprop ${scobj_hpath}/analyser_start/Field data true - hsetprop ${scobj_hpath}/analyser_start/Field mutable true - hsetprop ${scobj_hpath}/analyser_start/Field nxsave true - hsetprop ${scobj_hpath}/analyser_start/Field units Oersted - hsetprop ${scobj_hpath}/analyser_start/Field oldval UNKNOWN - hsetprop ${scobj_hpath}/analyser_start/Field klass "parameter" - hsetprop ${scobj_hpath}/analyser_start/Field sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/analyser_start/Field type "part" - hsetprop ${scobj_hpath}/analyser_start/Field nxalias "${name}_analyser_start_Field" + hfactory ${scobj_hpath}/analyser_start/field plain user text + hsetprop ${scobj_hpath}/analyser_start/field control true + hsetprop ${scobj_hpath}/analyser_start/field data true + hsetprop ${scobj_hpath}/analyser_start/field mutable true + hsetprop ${scobj_hpath}/analyser_start/field nxsave true + hsetprop ${scobj_hpath}/analyser_start/field units Oersted + hsetprop ${scobj_hpath}/analyser_start/field oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser_start/field klass "parameter" + hsetprop ${scobj_hpath}/analyser_start/field sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser_start/field type "part" + hsetprop ${scobj_hpath}/analyser_start/field nxalias "${name}_analyser_start_field" - hfactory ${scobj_hpath}/analyser_start/Freq plain user text - hsetprop ${scobj_hpath}/analyser_start/Freq control true - hsetprop ${scobj_hpath}/analyser_start/Freq data true - hsetprop ${scobj_hpath}/analyser_start/Freq mutable true - hsetprop ${scobj_hpath}/analyser_start/Freq nxsave true - hsetprop ${scobj_hpath}/analyser_start/Freq units Hertz - hsetprop ${scobj_hpath}/analyser_start/Freq oldval UNKNOWN - hsetprop ${scobj_hpath}/analyser_start/Freq klass "parameter" - hsetprop ${scobj_hpath}/analyser_start/Freq sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/analyser_start/Freq type "part" - hsetprop ${scobj_hpath}/analyser_start/Freq nxalias "${name}_analyser_start_Freq" + hfactory ${scobj_hpath}/analyser_start/freq plain user text + hsetprop ${scobj_hpath}/analyser_start/freq control true + hsetprop ${scobj_hpath}/analyser_start/freq data true + hsetprop ${scobj_hpath}/analyser_start/freq mutable true + hsetprop ${scobj_hpath}/analyser_start/freq nxsave true + hsetprop ${scobj_hpath}/analyser_start/freq units Hertz + hsetprop ${scobj_hpath}/analyser_start/freq oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser_start/freq klass "parameter" + hsetprop ${scobj_hpath}/analyser_start/freq sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser_start/freq type "part" + hsetprop ${scobj_hpath}/analyser_start/freq nxalias "${name}_analyser_start_freq" - hfactory ${scobj_hpath}/analyser_start/Phase plain user text - hsetprop ${scobj_hpath}/analyser_start/Phase control true - hsetprop ${scobj_hpath}/analyser_start/Phase data true - hsetprop ${scobj_hpath}/analyser_start/Phase mutable true - hsetprop ${scobj_hpath}/analyser_start/Phase nxsave true - hsetprop ${scobj_hpath}/analyser_start/Phase units Degree - hsetprop ${scobj_hpath}/analyser_start/Phase oldval UNKNOWN - hsetprop ${scobj_hpath}/analyser_start/Phase klass "parameter" - hsetprop ${scobj_hpath}/analyser_start/Phase sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/analyser_start/Phase type "part" - hsetprop ${scobj_hpath}/analyser_start/Phase nxalias "${name}_analyser_start_Phase" - - hfactory ${scobj_hpath}/analyser_start/Time2 plain user text - hsetprop ${scobj_hpath}/analyser_start/Time2 control true - hsetprop ${scobj_hpath}/analyser_start/Time2 data true - hsetprop ${scobj_hpath}/analyser_start/Time2 mutable true - hsetprop ${scobj_hpath}/analyser_start/Time2 nxsave true - hsetprop ${scobj_hpath}/analyser_start/Time2 units Second - hsetprop ${scobj_hpath}/analyser_start/Time2 oldval UNKNOWN - hsetprop ${scobj_hpath}/analyser_start/Time2 klass "parameter" - hsetprop ${scobj_hpath}/analyser_start/Time2 sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/analyser_start/Time2 type "part" - hsetprop ${scobj_hpath}/analyser_start/Time2 nxalias "${name}_analyser_start_Time2" - - hfactory ${scobj_hpath}/analyser_start/Timestamp plain user text - hsetprop ${scobj_hpath}/analyser_start/Timestamp control true - hsetprop ${scobj_hpath}/analyser_start/Timestamp data true - hsetprop ${scobj_hpath}/analyser_start/Timestamp mutable true - hsetprop ${scobj_hpath}/analyser_start/Timestamp nxsave true - hsetprop ${scobj_hpath}/analyser_start/Timestamp oldval UNKNOWN - hsetprop ${scobj_hpath}/analyser_start/Timestamp klass "parameter" - hsetprop ${scobj_hpath}/analyser_start/Timestamp sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/analyser_start/Timestamp type "part" - hsetprop ${scobj_hpath}/analyser_start/Timestamp nxalias "${name}_analyser_start_Timestamp" + hfactory ${scobj_hpath}/analyser_start/phase plain user text + hsetprop ${scobj_hpath}/analyser_start/phase control true + hsetprop ${scobj_hpath}/analyser_start/phase data true + hsetprop ${scobj_hpath}/analyser_start/phase mutable true + hsetprop ${scobj_hpath}/analyser_start/phase nxsave true + hsetprop ${scobj_hpath}/analyser_start/phase units Degree + hsetprop ${scobj_hpath}/analyser_start/phase oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser_start/phase klass "parameter" + hsetprop ${scobj_hpath}/analyser_start/phase sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser_start/phase type "part" + hsetprop ${scobj_hpath}/analyser_start/phase nxalias "${name}_analyser_start_phase" hfactory ${scobj_hpath}/analyser_start/spin plain user text hsetprop ${scobj_hpath}/analyser_start/spin control true @@ -416,6 +393,29 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/analyser_start/spin sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analyser_start/spin type "part" hsetprop ${scobj_hpath}/analyser_start/spin nxalias "${name}_analyser_start_spin" + + hfactory ${scobj_hpath}/analyser_start/time2 plain user text + hsetprop ${scobj_hpath}/analyser_start/time2 control true + hsetprop ${scobj_hpath}/analyser_start/time2 data true + hsetprop ${scobj_hpath}/analyser_start/time2 mutable true + hsetprop ${scobj_hpath}/analyser_start/time2 nxsave true + hsetprop ${scobj_hpath}/analyser_start/time2 units Second + hsetprop ${scobj_hpath}/analyser_start/time2 oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser_start/time2 klass "parameter" + hsetprop ${scobj_hpath}/analyser_start/time2 sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser_start/time2 type "part" + hsetprop ${scobj_hpath}/analyser_start/time2 nxalias "${name}_analyser_start_time2" + + hfactory ${scobj_hpath}/analyser_start/timestamp plain user text + hsetprop ${scobj_hpath}/analyser_start/timestamp control true + hsetprop ${scobj_hpath}/analyser_start/timestamp data true + hsetprop ${scobj_hpath}/analyser_start/timestamp mutable true + hsetprop ${scobj_hpath}/analyser_start/timestamp nxsave true + hsetprop ${scobj_hpath}/analyser_start/timestamp oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser_start/timestamp klass "parameter" + hsetprop ${scobj_hpath}/analyser_start/timestamp sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/analyser_start/timestamp type "part" + hsetprop ${scobj_hpath}/analyser_start/timestamp nxalias "${name}_analyser_start_timestamp" hsetprop ${scobj_hpath}/analyser_start data "true" hsetprop ${scobj_hpath}/analyser_start klass "@none" hsetprop ${scobj_hpath}/analyser_start type "part" @@ -424,75 +424,52 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hfactory ${scobj_hpath}/polariser plain spy none - hfactory ${scobj_hpath}/polariser/Amplitude plain user text - hsetprop ${scobj_hpath}/polariser/Amplitude control true - hsetprop ${scobj_hpath}/polariser/Amplitude data true - hsetprop ${scobj_hpath}/polariser/Amplitude mutable true - hsetprop ${scobj_hpath}/polariser/Amplitude nxsave true - hsetprop ${scobj_hpath}/polariser/Amplitude oldval UNKNOWN - hsetprop ${scobj_hpath}/polariser/Amplitude klass "parameter" - hsetprop ${scobj_hpath}/polariser/Amplitude sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/polariser/Amplitude type "part" - hsetprop ${scobj_hpath}/polariser/Amplitude nxalias "${name}_polariser_Amplitude" + hfactory ${scobj_hpath}/polariser/amplitude plain user text + hsetprop ${scobj_hpath}/polariser/amplitude control true + hsetprop ${scobj_hpath}/polariser/amplitude data true + hsetprop ${scobj_hpath}/polariser/amplitude mutable true + hsetprop ${scobj_hpath}/polariser/amplitude nxsave true + hsetprop ${scobj_hpath}/polariser/amplitude oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser/amplitude klass "parameter" + hsetprop ${scobj_hpath}/polariser/amplitude sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser/amplitude type "part" + hsetprop ${scobj_hpath}/polariser/amplitude nxalias "${name}_polariser_amplitude" - hfactory ${scobj_hpath}/polariser/Field plain user text - hsetprop ${scobj_hpath}/polariser/Field control true - hsetprop ${scobj_hpath}/polariser/Field data true - hsetprop ${scobj_hpath}/polariser/Field mutable true - hsetprop ${scobj_hpath}/polariser/Field nxsave true - hsetprop ${scobj_hpath}/polariser/Field units Oersted - hsetprop ${scobj_hpath}/polariser/Field oldval UNKNOWN - hsetprop ${scobj_hpath}/polariser/Field klass "parameter" - hsetprop ${scobj_hpath}/polariser/Field sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/polariser/Field type "part" - hsetprop ${scobj_hpath}/polariser/Field nxalias "${name}_polariser_Field" + hfactory ${scobj_hpath}/polariser/field plain user text + hsetprop ${scobj_hpath}/polariser/field control true + hsetprop ${scobj_hpath}/polariser/field data true + hsetprop ${scobj_hpath}/polariser/field mutable true + hsetprop ${scobj_hpath}/polariser/field nxsave true + hsetprop ${scobj_hpath}/polariser/field units Oersted + hsetprop ${scobj_hpath}/polariser/field oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser/field klass "parameter" + hsetprop ${scobj_hpath}/polariser/field sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser/field type "part" + hsetprop ${scobj_hpath}/polariser/field nxalias "${name}_polariser_field" - hfactory ${scobj_hpath}/polariser/Freq plain user text - hsetprop ${scobj_hpath}/polariser/Freq control true - hsetprop ${scobj_hpath}/polariser/Freq data true - hsetprop ${scobj_hpath}/polariser/Freq mutable true - hsetprop ${scobj_hpath}/polariser/Freq nxsave true - hsetprop ${scobj_hpath}/polariser/Freq units Hertz - hsetprop ${scobj_hpath}/polariser/Freq oldval UNKNOWN - hsetprop ${scobj_hpath}/polariser/Freq klass "parameter" - hsetprop ${scobj_hpath}/polariser/Freq sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/polariser/Freq type "part" - hsetprop ${scobj_hpath}/polariser/Freq nxalias "${name}_polariser_Freq" + hfactory ${scobj_hpath}/polariser/freq plain user text + hsetprop ${scobj_hpath}/polariser/freq control true + hsetprop ${scobj_hpath}/polariser/freq data true + hsetprop ${scobj_hpath}/polariser/freq mutable true + hsetprop ${scobj_hpath}/polariser/freq nxsave true + hsetprop ${scobj_hpath}/polariser/freq units Hertz + hsetprop ${scobj_hpath}/polariser/freq oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser/freq klass "parameter" + hsetprop ${scobj_hpath}/polariser/freq sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser/freq type "part" + hsetprop ${scobj_hpath}/polariser/freq nxalias "${name}_polariser_freq" - hfactory ${scobj_hpath}/polariser/Phase plain user text - hsetprop ${scobj_hpath}/polariser/Phase control true - hsetprop ${scobj_hpath}/polariser/Phase data true - hsetprop ${scobj_hpath}/polariser/Phase mutable true - hsetprop ${scobj_hpath}/polariser/Phase nxsave true - hsetprop ${scobj_hpath}/polariser/Phase units Degree - hsetprop ${scobj_hpath}/polariser/Phase oldval UNKNOWN - hsetprop ${scobj_hpath}/polariser/Phase klass "parameter" - hsetprop ${scobj_hpath}/polariser/Phase sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/polariser/Phase type "part" - hsetprop ${scobj_hpath}/polariser/Phase nxalias "${name}_polariser_Phase" - - hfactory ${scobj_hpath}/polariser/Time2 plain user text - hsetprop ${scobj_hpath}/polariser/Time2 control true - hsetprop ${scobj_hpath}/polariser/Time2 data true - hsetprop ${scobj_hpath}/polariser/Time2 mutable true - hsetprop ${scobj_hpath}/polariser/Time2 nxsave true - hsetprop ${scobj_hpath}/polariser/Time2 units Second - hsetprop ${scobj_hpath}/polariser/Time2 oldval UNKNOWN - hsetprop ${scobj_hpath}/polariser/Time2 klass "parameter" - hsetprop ${scobj_hpath}/polariser/Time2 sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/polariser/Time2 type "part" - hsetprop ${scobj_hpath}/polariser/Time2 nxalias "${name}_polariser_Time2" - - hfactory ${scobj_hpath}/polariser/Timestamp plain user text - hsetprop ${scobj_hpath}/polariser/Timestamp control true - hsetprop ${scobj_hpath}/polariser/Timestamp data true - hsetprop ${scobj_hpath}/polariser/Timestamp mutable true - hsetprop ${scobj_hpath}/polariser/Timestamp nxsave true - hsetprop ${scobj_hpath}/polariser/Timestamp oldval UNKNOWN - hsetprop ${scobj_hpath}/polariser/Timestamp klass "parameter" - hsetprop ${scobj_hpath}/polariser/Timestamp sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/polariser/Timestamp type "part" - hsetprop ${scobj_hpath}/polariser/Timestamp nxalias "${name}_polariser_Timestamp" + hfactory ${scobj_hpath}/polariser/phase plain user text + hsetprop ${scobj_hpath}/polariser/phase control true + hsetprop ${scobj_hpath}/polariser/phase data true + hsetprop ${scobj_hpath}/polariser/phase mutable true + hsetprop ${scobj_hpath}/polariser/phase nxsave true + hsetprop ${scobj_hpath}/polariser/phase units Degree + hsetprop ${scobj_hpath}/polariser/phase oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser/phase klass "parameter" + hsetprop ${scobj_hpath}/polariser/phase sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser/phase type "part" + hsetprop ${scobj_hpath}/polariser/phase nxalias "${name}_polariser_phase" hfactory ${scobj_hpath}/polariser/spin plain user text hsetprop ${scobj_hpath}/polariser/spin read ${ns}::getValue ${scobj_hpath} rdValue {polariser} @@ -519,6 +496,29 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio ::scobj::he3_polanal::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for he3_polanal" hsetprop ${scobj_hpath}/polariser/spin simulated true } + + hfactory ${scobj_hpath}/polariser/time2 plain user text + hsetprop ${scobj_hpath}/polariser/time2 control true + hsetprop ${scobj_hpath}/polariser/time2 data true + hsetprop ${scobj_hpath}/polariser/time2 mutable true + hsetprop ${scobj_hpath}/polariser/time2 nxsave true + hsetprop ${scobj_hpath}/polariser/time2 units Second + hsetprop ${scobj_hpath}/polariser/time2 oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser/time2 klass "parameter" + hsetprop ${scobj_hpath}/polariser/time2 sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser/time2 type "part" + hsetprop ${scobj_hpath}/polariser/time2 nxalias "${name}_polariser_time2" + + hfactory ${scobj_hpath}/polariser/timestamp plain user text + hsetprop ${scobj_hpath}/polariser/timestamp control true + hsetprop ${scobj_hpath}/polariser/timestamp data true + hsetprop ${scobj_hpath}/polariser/timestamp mutable true + hsetprop ${scobj_hpath}/polariser/timestamp nxsave true + hsetprop ${scobj_hpath}/polariser/timestamp oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser/timestamp klass "parameter" + hsetprop ${scobj_hpath}/polariser/timestamp sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser/timestamp type "part" + hsetprop ${scobj_hpath}/polariser/timestamp nxalias "${name}_polariser_timestamp" hsetprop ${scobj_hpath}/polariser data "true" hsetprop ${scobj_hpath}/polariser klass "@none" hsetprop ${scobj_hpath}/polariser type "part" @@ -527,75 +527,52 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hfactory ${scobj_hpath}/polariser_start plain spy none - hfactory ${scobj_hpath}/polariser_start/Amplitude plain user text - hsetprop ${scobj_hpath}/polariser_start/Amplitude control true - hsetprop ${scobj_hpath}/polariser_start/Amplitude data true - hsetprop ${scobj_hpath}/polariser_start/Amplitude mutable true - hsetprop ${scobj_hpath}/polariser_start/Amplitude nxsave true - hsetprop ${scobj_hpath}/polariser_start/Amplitude oldval UNKNOWN - hsetprop ${scobj_hpath}/polariser_start/Amplitude klass "parameter" - hsetprop ${scobj_hpath}/polariser_start/Amplitude sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/polariser_start/Amplitude type "part" - hsetprop ${scobj_hpath}/polariser_start/Amplitude nxalias "${name}_polariser_start_Amplitude" + hfactory ${scobj_hpath}/polariser_start/amplitude plain user text + hsetprop ${scobj_hpath}/polariser_start/amplitude control true + hsetprop ${scobj_hpath}/polariser_start/amplitude data true + hsetprop ${scobj_hpath}/polariser_start/amplitude mutable true + hsetprop ${scobj_hpath}/polariser_start/amplitude nxsave true + hsetprop ${scobj_hpath}/polariser_start/amplitude oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser_start/amplitude klass "parameter" + hsetprop ${scobj_hpath}/polariser_start/amplitude sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser_start/amplitude type "part" + hsetprop ${scobj_hpath}/polariser_start/amplitude nxalias "${name}_polariser_start_amplitude" - hfactory ${scobj_hpath}/polariser_start/Field plain user text - hsetprop ${scobj_hpath}/polariser_start/Field control true - hsetprop ${scobj_hpath}/polariser_start/Field data true - hsetprop ${scobj_hpath}/polariser_start/Field mutable true - hsetprop ${scobj_hpath}/polariser_start/Field nxsave true - hsetprop ${scobj_hpath}/polariser_start/Field units Oersted - hsetprop ${scobj_hpath}/polariser_start/Field oldval UNKNOWN - hsetprop ${scobj_hpath}/polariser_start/Field klass "parameter" - hsetprop ${scobj_hpath}/polariser_start/Field sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/polariser_start/Field type "part" - hsetprop ${scobj_hpath}/polariser_start/Field nxalias "${name}_polariser_start_Field" + hfactory ${scobj_hpath}/polariser_start/field plain user text + hsetprop ${scobj_hpath}/polariser_start/field control true + hsetprop ${scobj_hpath}/polariser_start/field data true + hsetprop ${scobj_hpath}/polariser_start/field mutable true + hsetprop ${scobj_hpath}/polariser_start/field nxsave true + hsetprop ${scobj_hpath}/polariser_start/field units Oersted + hsetprop ${scobj_hpath}/polariser_start/field oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser_start/field klass "parameter" + hsetprop ${scobj_hpath}/polariser_start/field sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser_start/field type "part" + hsetprop ${scobj_hpath}/polariser_start/field nxalias "${name}_polariser_start_field" - hfactory ${scobj_hpath}/polariser_start/Freq plain user text - hsetprop ${scobj_hpath}/polariser_start/Freq control true - hsetprop ${scobj_hpath}/polariser_start/Freq data true - hsetprop ${scobj_hpath}/polariser_start/Freq mutable true - hsetprop ${scobj_hpath}/polariser_start/Freq nxsave true - hsetprop ${scobj_hpath}/polariser_start/Freq units Hertz - hsetprop ${scobj_hpath}/polariser_start/Freq oldval UNKNOWN - hsetprop ${scobj_hpath}/polariser_start/Freq klass "parameter" - hsetprop ${scobj_hpath}/polariser_start/Freq sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/polariser_start/Freq type "part" - hsetprop ${scobj_hpath}/polariser_start/Freq nxalias "${name}_polariser_start_Freq" + hfactory ${scobj_hpath}/polariser_start/freq plain user text + hsetprop ${scobj_hpath}/polariser_start/freq control true + hsetprop ${scobj_hpath}/polariser_start/freq data true + hsetprop ${scobj_hpath}/polariser_start/freq mutable true + hsetprop ${scobj_hpath}/polariser_start/freq nxsave true + hsetprop ${scobj_hpath}/polariser_start/freq units Hertz + hsetprop ${scobj_hpath}/polariser_start/freq oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser_start/freq klass "parameter" + hsetprop ${scobj_hpath}/polariser_start/freq sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser_start/freq type "part" + hsetprop ${scobj_hpath}/polariser_start/freq nxalias "${name}_polariser_start_freq" - hfactory ${scobj_hpath}/polariser_start/Phase plain user text - hsetprop ${scobj_hpath}/polariser_start/Phase control true - hsetprop ${scobj_hpath}/polariser_start/Phase data true - hsetprop ${scobj_hpath}/polariser_start/Phase mutable true - hsetprop ${scobj_hpath}/polariser_start/Phase nxsave true - hsetprop ${scobj_hpath}/polariser_start/Phase units Degree - hsetprop ${scobj_hpath}/polariser_start/Phase oldval UNKNOWN - hsetprop ${scobj_hpath}/polariser_start/Phase klass "parameter" - hsetprop ${scobj_hpath}/polariser_start/Phase sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/polariser_start/Phase type "part" - hsetprop ${scobj_hpath}/polariser_start/Phase nxalias "${name}_polariser_start_Phase" - - hfactory ${scobj_hpath}/polariser_start/Time2 plain user text - hsetprop ${scobj_hpath}/polariser_start/Time2 control true - hsetprop ${scobj_hpath}/polariser_start/Time2 data true - hsetprop ${scobj_hpath}/polariser_start/Time2 mutable true - hsetprop ${scobj_hpath}/polariser_start/Time2 nxsave true - hsetprop ${scobj_hpath}/polariser_start/Time2 units Second - hsetprop ${scobj_hpath}/polariser_start/Time2 oldval UNKNOWN - hsetprop ${scobj_hpath}/polariser_start/Time2 klass "parameter" - hsetprop ${scobj_hpath}/polariser_start/Time2 sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/polariser_start/Time2 type "part" - hsetprop ${scobj_hpath}/polariser_start/Time2 nxalias "${name}_polariser_start_Time2" - - hfactory ${scobj_hpath}/polariser_start/Timestamp plain user text - hsetprop ${scobj_hpath}/polariser_start/Timestamp control true - hsetprop ${scobj_hpath}/polariser_start/Timestamp data true - hsetprop ${scobj_hpath}/polariser_start/Timestamp mutable true - hsetprop ${scobj_hpath}/polariser_start/Timestamp nxsave true - hsetprop ${scobj_hpath}/polariser_start/Timestamp oldval UNKNOWN - hsetprop ${scobj_hpath}/polariser_start/Timestamp klass "parameter" - hsetprop ${scobj_hpath}/polariser_start/Timestamp sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/polariser_start/Timestamp type "part" - hsetprop ${scobj_hpath}/polariser_start/Timestamp nxalias "${name}_polariser_start_Timestamp" + hfactory ${scobj_hpath}/polariser_start/phase plain user text + hsetprop ${scobj_hpath}/polariser_start/phase control true + hsetprop ${scobj_hpath}/polariser_start/phase data true + hsetprop ${scobj_hpath}/polariser_start/phase mutable true + hsetprop ${scobj_hpath}/polariser_start/phase nxsave true + hsetprop ${scobj_hpath}/polariser_start/phase units Degree + hsetprop ${scobj_hpath}/polariser_start/phase oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser_start/phase klass "parameter" + hsetprop ${scobj_hpath}/polariser_start/phase sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser_start/phase type "part" + hsetprop ${scobj_hpath}/polariser_start/phase nxalias "${name}_polariser_start_phase" hfactory ${scobj_hpath}/polariser_start/spin plain user text hsetprop ${scobj_hpath}/polariser_start/spin control true @@ -607,6 +584,29 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/polariser_start/spin sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/polariser_start/spin type "part" hsetprop ${scobj_hpath}/polariser_start/spin nxalias "${name}_polariser_start_spin" + + hfactory ${scobj_hpath}/polariser_start/time2 plain user text + hsetprop ${scobj_hpath}/polariser_start/time2 control true + hsetprop ${scobj_hpath}/polariser_start/time2 data true + hsetprop ${scobj_hpath}/polariser_start/time2 mutable true + hsetprop ${scobj_hpath}/polariser_start/time2 nxsave true + hsetprop ${scobj_hpath}/polariser_start/time2 units Second + hsetprop ${scobj_hpath}/polariser_start/time2 oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser_start/time2 klass "parameter" + hsetprop ${scobj_hpath}/polariser_start/time2 sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser_start/time2 type "part" + hsetprop ${scobj_hpath}/polariser_start/time2 nxalias "${name}_polariser_start_time2" + + hfactory ${scobj_hpath}/polariser_start/timestamp plain user text + hsetprop ${scobj_hpath}/polariser_start/timestamp control true + hsetprop ${scobj_hpath}/polariser_start/timestamp data true + hsetprop ${scobj_hpath}/polariser_start/timestamp mutable true + hsetprop ${scobj_hpath}/polariser_start/timestamp nxsave true + hsetprop ${scobj_hpath}/polariser_start/timestamp oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser_start/timestamp klass "parameter" + hsetprop ${scobj_hpath}/polariser_start/timestamp sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/polariser_start/timestamp type "part" + hsetprop ${scobj_hpath}/polariser_start/timestamp nxalias "${name}_polariser_start_timestamp" hsetprop ${scobj_hpath}/polariser_start data "true" hsetprop ${scobj_hpath}/polariser_start klass "@none" hsetprop ${scobj_hpath}/polariser_start type "part" @@ -647,6 +647,13 @@ namespace eval ::scobj::he3_polanal { namespace export sics_log namespace export mkDriver namespace export add_driver +# postamble hook code starts + proc stash {node} { + foreach arg {spin amplitude freq phase time2 field timestamp} { + hupdateif ${node}_start/${arg} [hval ${node}/${arg}] + } + } +# postamble hook code ends } proc add_he3_polanal {name ip_address tcp_port} { diff --git a/site_ansto/instrument/config/environment/magneticField/sct_bruker.tcl b/site_ansto/instrument/config/environment/magneticField/sct_bruker.tcl index a195b1dc..7133d86f 100644 --- a/site_ansto/instrument/config/environment/magneticField/sct_bruker.tcl +++ b/site_ansto/instrument/config/environment/magneticField/sct_bruker.tcl @@ -51,7 +51,9 @@ proc ::scobj::bruker::add_driver {name device_class simulation_flag ip_address t makesctcontroller sct_${name} astvelsel ${ip_address}:${tcp_port} } } else { - ::scobj::bruker::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for bruker" + ::scobj::bruker::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for bruker" + ::scobj::bruker::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::bruker::sics_log 1 "::scobj::bruker::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol}" ::scobj::bruker::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol} @@ -69,7 +71,7 @@ namespace eval ::scobj::bruker { proc add_bruker {name ip_address tcp_port id datype {tol 0.1}} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::bruker::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}" "${datype}" "${{tol}" "${0.1}}" + ::scobj::bruker::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol} } clientput "file evaluation of sct_bruker.tcl" @@ -108,20 +110,31 @@ proc ::scobj::bruker::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} astvelsel ${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"]" } } @@ -132,6 +145,7 @@ proc ::scobj::bruker::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } set arg_list [list] set missing_list [list] @@ -148,11 +162,7 @@ proc ::scobj::bruker::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list - } + ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list } } } diff --git a/site_ansto/instrument/config/environment/magneticField/sct_green_magnet_labview.tcl b/site_ansto/instrument/config/environment/magneticField/sct_green_magnet_labview.tcl index d7fa10d9..fda8bef5 100644 --- a/site_ansto/instrument/config/environment/magneticField/sct_green_magnet_labview.tcl +++ b/site_ansto/instrument/config/environment/magneticField/sct_green_magnet_labview.tcl @@ -66,7 +66,7 @@ namespace eval ::scobj::green_magnet_labview { proc add_green_magnet_labview {name ip_address tcp_port} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::green_magnet_labview::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} + ::scobj::green_magnet_labview::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} } clientput "file evaluation of sct_green_magnet_labview.tcl" @@ -102,39 +102,8 @@ proc ::scobj::green_magnet_labview::read_config {} { continue } if { [string equal -nocase [dict get $v "driver"] "green_magnet_labview"] } { - if { ![string equal -nocase "${simulation_flag}" "false"] } { - set asyncqueue "null" - ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => 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] - } - } 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_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"]" - } - } - 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} - } + ::scobj::green_magnet_labview::sics_log 9 "No sctcontroller for green_magnet_labview" + ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} } } } diff --git a/site_ansto/instrument/config/environment/magneticField/sct_oxford12tlv.tcl b/site_ansto/instrument/config/environment/magneticField/sct_oxford12tlv.tcl index d0d0025f..4b5dedc3 100644 --- a/site_ansto/instrument/config/environment/magneticField/sct_oxford12tlv.tcl +++ b/site_ansto/instrument/config/environment/magneticField/sct_oxford12tlv.tcl @@ -65,7 +65,9 @@ proc ::scobj::oxford12tlv::add_driver {name device_class simulation_flag ip_addr makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::oxford12tlv::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for oxford12tlv" + ::scobj::oxford12tlv::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for oxford12tlv" + ::scobj::oxford12tlv::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::oxford12tlv::sics_log 1 "::scobj::oxford12tlv::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${interval}" ::scobj::oxford12tlv::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${interval} @@ -83,7 +85,7 @@ namespace eval ::scobj::oxford12tlv { proc add_oxford12tlv {name ip_address tcp_port id datype interval} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::oxford12tlv::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}" "${datype}" "${interval}" + ::scobj::oxford12tlv::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${interval} } clientput "file evaluation of sct_oxford12tlv.tcl" @@ -122,20 +124,31 @@ proc ::scobj::oxford12tlv::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"]" } } @@ -146,6 +159,7 @@ proc ::scobj::oxford12tlv::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } set arg_list [list] set missing_list [list] @@ -162,11 +176,7 @@ proc ::scobj::oxford12tlv::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list - } + ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list } } } 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 cc91ca94..7f30d08a 100644 --- a/site_ansto/instrument/config/environment/magneticField/sct_tsi_smc.tcl +++ b/site_ansto/instrument/config/environment/magneticField/sct_tsi_smc.tcl @@ -86,7 +86,12 @@ proc ::scobj::tsi_smc::checkstatus {tc_root} { # checkstatus hook code goes here if {[sct driving]} { set sp "[sct target]" - set pv "[hval ${tc_root}/[sct driveable]]" + if {[hpropexists [sct] simulated] && [sct simulated] == "true"} { + set pv "${sp}" + hupdateif ${tc_root}/[sct driveable] ${sp} + } + set pv "[hval ${tc_root}/[sct driveable]]" + } if { abs(${pv} - ${sp}) <= [sct tolerance] } { if { [hpropexists [sct] settle_time] } { if { [hpropexists [sct] settle_time_start] } { @@ -301,6 +306,14 @@ proc ::scobj::tsi_smc::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/setpoint units "G" hsetprop ${scobj_hpath}/setpoint nxalias "${name}_setpoint" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} write ${scobj_hpath}/setpoint + hsetprop ${scobj_hpath}/setpoint simulated false + } else { + ::scobj::tsi_smc::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for tsi_smc" + hsetprop ${scobj_hpath}/setpoint simulated true + } + hfactory ${scobj_hpath}/value plain user float hsetprop ${scobj_hpath}/value control true hsetprop ${scobj_hpath}/value data true @@ -319,17 +332,9 @@ proc ::scobj::tsi_smc::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath} data "true" hsetprop ${scobj_hpath} klass "@none" hsetprop ${scobj_hpath} type "part" - - if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} write ${scobj_hpath}/setpoint - } else { - ::scobj::tsi_smc::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for tsi_smc" - } + ansto_makesctdrive ${name}_setpoint ${scobj_hpath}/setpoint ${scobj_hpath}/value ${sct_controller} hfactory ${scobj_hpath}/a plain spy none - hsetprop ${scobj_hpath}/a data "false" - hsetprop ${scobj_hpath}/a klass "@none" - hsetprop ${scobj_hpath}/a type "part" hfactory ${scobj_hpath}/a/G plain user text hsetprop ${scobj_hpath}/a/G read ${ns}::getValue ${scobj_hpath} rdValue {G} @@ -344,6 +349,14 @@ proc ::scobj::tsi_smc::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/a/G type "part" hsetprop ${scobj_hpath}/a/G nxalias "${name}_a_G" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/a/G 1 + hsetprop ${scobj_hpath}/a/G simulated false + } else { + ::scobj::tsi_smc::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for tsi_smc" + hsetprop ${scobj_hpath}/a/G simulated true + } + hfactory ${scobj_hpath}/a/J plain user text hsetprop ${scobj_hpath}/a/J read ${ns}::getValue ${scobj_hpath} rdValue {J} hsetprop ${scobj_hpath}/a/J rdValue ${ns}::rdValue ${scobj_hpath} @@ -356,6 +369,14 @@ proc ::scobj::tsi_smc::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/a/J type "part" hsetprop ${scobj_hpath}/a/J nxalias "${name}_a_J" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/a/J 1 + hsetprop ${scobj_hpath}/a/J simulated false + } else { + ::scobj::tsi_smc::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for tsi_smc" + hsetprop ${scobj_hpath}/a/J simulated true + } + hfactory ${scobj_hpath}/a/K plain user text hsetprop ${scobj_hpath}/a/K read ${ns}::getValue ${scobj_hpath} rdValue {K} hsetprop ${scobj_hpath}/a/K rdValue ${ns}::rdValue ${scobj_hpath} @@ -368,6 +389,14 @@ proc ::scobj::tsi_smc::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/a/K type "part" hsetprop ${scobj_hpath}/a/K nxalias "${name}_a_K" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/a/K 1 + hsetprop ${scobj_hpath}/a/K simulated false + } else { + ::scobj::tsi_smc::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for tsi_smc" + hsetprop ${scobj_hpath}/a/K simulated true + } + hfactory ${scobj_hpath}/a/N plain user text hsetprop ${scobj_hpath}/a/N read ${ns}::getValue ${scobj_hpath} rdValue {N} hsetprop ${scobj_hpath}/a/N rdValue ${ns}::rdValue ${scobj_hpath} @@ -380,6 +409,14 @@ proc ::scobj::tsi_smc::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/a/N type "part" hsetprop ${scobj_hpath}/a/N nxalias "${name}_a_N" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/a/N 1 + hsetprop ${scobj_hpath}/a/N simulated false + } else { + ::scobj::tsi_smc::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for tsi_smc" + hsetprop ${scobj_hpath}/a/N simulated true + } + hfactory ${scobj_hpath}/a/O plain user text hsetprop ${scobj_hpath}/a/O read ${ns}::getValue ${scobj_hpath} rdValue {O} hsetprop ${scobj_hpath}/a/O rdValue ${ns}::rdValue ${scobj_hpath} @@ -392,6 +429,14 @@ proc ::scobj::tsi_smc::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/a/O type "part" hsetprop ${scobj_hpath}/a/O nxalias "${name}_a_O" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/a/O 1 + hsetprop ${scobj_hpath}/a/O simulated false + } else { + ::scobj::tsi_smc::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for tsi_smc" + hsetprop ${scobj_hpath}/a/O simulated true + } + hfactory ${scobj_hpath}/a/S plain user text hsetprop ${scobj_hpath}/a/S read ${ns}::getValue ${scobj_hpath} rdValue {S} hsetprop ${scobj_hpath}/a/S rdValue ${ns}::rdValue ${scobj_hpath} @@ -405,20 +450,17 @@ proc ::scobj::tsi_smc::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/a/S nxalias "${name}_a_S" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/a/G 1 - ${sct_controller} poll ${scobj_hpath}/a/J 1 - ${sct_controller} poll ${scobj_hpath}/a/K 1 - ${sct_controller} poll ${scobj_hpath}/a/N 1 - ${sct_controller} poll ${scobj_hpath}/a/O 1 ${sct_controller} poll ${scobj_hpath}/a/S 1 + hsetprop ${scobj_hpath}/a/S simulated false } else { ::scobj::tsi_smc::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for tsi_smc" + hsetprop ${scobj_hpath}/a/S simulated true } + hsetprop ${scobj_hpath}/a data "false" + hsetprop ${scobj_hpath}/a klass "@none" + hsetprop ${scobj_hpath}/a type "part" hfactory ${scobj_hpath}/b plain spy none - hsetprop ${scobj_hpath}/b data "true" - hsetprop ${scobj_hpath}/b klass "@none" - hsetprop ${scobj_hpath}/b type "part" hfactory ${scobj_hpath}/b/Lower plain user float hsetprop ${scobj_hpath}/b/Lower write ${ns}::setValue ${scobj_hpath} noResponse {L} @@ -437,6 +479,14 @@ proc ::scobj::tsi_smc::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/b/Lower units "A" hsetprop ${scobj_hpath}/b/Lower nxalias "${name}_b_Lower" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} write ${scobj_hpath}/b/Lower + hsetprop ${scobj_hpath}/b/Lower simulated false + } else { + ::scobj::tsi_smc::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for tsi_smc" + hsetprop ${scobj_hpath}/b/Lower simulated true + } + hfactory ${scobj_hpath}/b/Pause plain user int hsetprop ${scobj_hpath}/b/Pause write ${ns}::setValue ${scobj_hpath} noResponse {P} hsetprop ${scobj_hpath}/b/Pause noResponse ${ns}::noResponse ${scobj_hpath} @@ -454,6 +504,14 @@ proc ::scobj::tsi_smc::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/b/Pause type "part" hsetprop ${scobj_hpath}/b/Pause nxalias "${name}_b_Pause" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} write ${scobj_hpath}/b/Pause + hsetprop ${scobj_hpath}/b/Pause simulated false + } else { + ::scobj::tsi_smc::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for tsi_smc" + hsetprop ${scobj_hpath}/b/Pause simulated true + } + hfactory ${scobj_hpath}/b/Ramp plain user int hsetprop ${scobj_hpath}/b/Ramp write ${ns}::setValue ${scobj_hpath} noResponse {R} hsetprop ${scobj_hpath}/b/Ramp noResponse ${ns}::noResponse ${scobj_hpath} @@ -471,6 +529,14 @@ proc ::scobj::tsi_smc::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/b/Ramp type "part" hsetprop ${scobj_hpath}/b/Ramp nxalias "${name}_b_Ramp" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} write ${scobj_hpath}/b/Ramp + hsetprop ${scobj_hpath}/b/Ramp simulated false + } else { + ::scobj::tsi_smc::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for tsi_smc" + hsetprop ${scobj_hpath}/b/Ramp simulated true + } + hfactory ${scobj_hpath}/b/Rate plain user float hsetprop ${scobj_hpath}/b/Rate write ${ns}::setValue ${scobj_hpath} noResponse {A} hsetprop ${scobj_hpath}/b/Rate noResponse ${ns}::noResponse ${scobj_hpath} @@ -486,19 +552,18 @@ proc ::scobj::tsi_smc::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/b/Rate nxalias "${name}_b_Rate" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} write ${scobj_hpath}/b/Lower - ${sct_controller} write ${scobj_hpath}/b/Pause - ${sct_controller} write ${scobj_hpath}/b/Ramp ${sct_controller} write ${scobj_hpath}/b/Rate + hsetprop ${scobj_hpath}/b/Rate simulated false } else { ::scobj::tsi_smc::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for tsi_smc" + hsetprop ${scobj_hpath}/b/Rate simulated true } + hsetprop ${scobj_hpath}/b data "true" + hsetprop ${scobj_hpath}/b klass "@none" + hsetprop ${scobj_hpath}/b type "part" 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}/value ${sct_controller} - } # mkDriver hook code goes here } catch_message ] handle_exception ${catch_status} ${catch_message} @@ -516,7 +581,9 @@ proc ::scobj::tsi_smc::add_driver {name device_class simulation_flag ip_address makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::tsi_smc::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for tsi_smc" + ::scobj::tsi_smc::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for tsi_smc" + ::scobj::tsi_smc::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::tsi_smc::sics_log 1 "::scobj::tsi_smc::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}" ::scobj::tsi_smc::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} @@ -534,7 +601,7 @@ namespace eval ::scobj::tsi_smc { proc add_tsi_smc {name ip_address tcp_port {id 1}} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::tsi_smc::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${{id}" "${1}}" + ::scobj::tsi_smc::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} } clientput "file evaluation of sct_tsi_smc.tcl" @@ -573,20 +640,31 @@ proc ::scobj::tsi_smc::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"]" } } @@ -597,6 +675,7 @@ proc ::scobj::tsi_smc::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } set arg_list [list] set missing_list [list] @@ -613,11 +692,7 @@ proc ::scobj::tsi_smc::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list - } + ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list } } } diff --git a/site_ansto/instrument/config/environment/sct_agilent_33220A.tcl b/site_ansto/instrument/config/environment/sct_agilent_33220A.tcl index 1b335090..e608d917 100644 --- a/site_ansto/instrument/config/environment/sct_agilent_33220A.tcl +++ b/site_ansto/instrument/config/environment/sct_agilent_33220A.tcl @@ -60,7 +60,7 @@ namespace eval ::scobj::agilent_33220A { proc add_agilent_33220A {name ip_address tcp_port} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::agilent_33220A::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} + ::scobj::agilent_33220A::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} } clientput "file evaluation of sct_agilent_33220A.tcl" @@ -96,39 +96,8 @@ proc ::scobj::agilent_33220A::read_config {} { continue } if { [string equal -nocase [dict get $v "driver"] "agilent_33220A"] } { - if { ![string equal -nocase "${simulation_flag}" "false"] } { - set asyncqueue "null" - ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => 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] - } - } 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_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"]" - } - } - 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} - } + ::scobj::agilent_33220A::sics_log 9 "No sctcontroller for agilent_33220A" + ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} } } } diff --git a/site_ansto/instrument/config/environment/sct_hiden_xcs.tcl b/site_ansto/instrument/config/environment/sct_hiden_xcs.tcl index a56a10da..6758f56d 100644 --- a/site_ansto/instrument/config/environment/sct_hiden_xcs.tcl +++ b/site_ansto/instrument/config/environment/sct_hiden_xcs.tcl @@ -86,7 +86,12 @@ proc ::scobj::hiden_xcs::checkstatus {tc_root} { # checkstatus hook code goes here if {[sct driving]} { set sp "[sct target]" - set pv "[hval ${tc_root}/[sct driveable]]" + if {[hpropexists [sct] simulated] && [sct simulated] == "true"} { + set pv "${sp}" + hupdateif ${tc_root}/[sct driveable] ${sp} + } + set pv "[hval ${tc_root}/[sct driveable]]" + } if { abs(${pv} - ${sp}) <= [sct tolerance] } { if { [hpropexists [sct] settle_time] } { if { [hpropexists [sct] settle_time_start] } { @@ -826,6 +831,15 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/enabled type "part" hsetprop ${scobj_hpath}/enabled nxalias "${name}_enabled" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/enabled 10 + ${sct_controller} write ${scobj_hpath}/enabled + hsetprop ${scobj_hpath}/enabled simulated false + } else { + ::scobj::hiden_xcs::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for hiden_xcs" + hsetprop ${scobj_hpath}/enabled simulated true + } + hfactory ${scobj_hpath}/flow1 plain user float hsetprop ${scobj_hpath}/flow1 control false hsetprop ${scobj_hpath}/flow1 data false @@ -887,17 +901,7 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath} nxsave "true" hsetprop ${scobj_hpath} type "part" - if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/enabled 10 - ${sct_controller} write ${scobj_hpath}/enabled - } else { - ::scobj::hiden_xcs::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for hiden_xcs" - } - hfactory ${scobj_hpath}/analog plain spy none - hsetprop ${scobj_hpath}/analog data "false" - hsetprop ${scobj_hpath}/analog klass "@none" - hsetprop ${scobj_hpath}/analog type "part" hfactory ${scobj_hpath}/analog/ansto_temp plain user float hsetprop ${scobj_hpath}/analog/ansto_temp read ${ns}::getValue ${scobj_hpath} read_sixteen {?AIN,12} @@ -913,6 +917,14 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/analog/ansto_temp type "part" hsetprop ${scobj_hpath}/analog/ansto_temp nxalias "${name}_analog_ansto_temp" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/analog/ansto_temp 5 + hsetprop ${scobj_hpath}/analog/ansto_temp simulated false + } else { + ::scobj::hiden_xcs::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for hiden_xcs" + hsetprop ${scobj_hpath}/analog/ansto_temp simulated true + } + hfactory ${scobj_hpath}/analog/pv1 plain user float hsetprop ${scobj_hpath}/analog/pv1 read ${ns}::getValue ${scobj_hpath} read_sixteen {?AIN,0} hsetprop ${scobj_hpath}/analog/pv1 read_sixteen ${ns}::read_sixteen ${scobj_hpath} @@ -927,6 +939,14 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/analog/pv1 type "part" hsetprop ${scobj_hpath}/analog/pv1 nxalias "${name}_analog_pv1" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/analog/pv1 5 + hsetprop ${scobj_hpath}/analog/pv1 simulated false + } else { + ::scobj::hiden_xcs::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for hiden_xcs" + hsetprop ${scobj_hpath}/analog/pv1 simulated true + } + hfactory ${scobj_hpath}/analog/pv2 plain user float hsetprop ${scobj_hpath}/analog/pv2 read ${ns}::getValue ${scobj_hpath} read_sixteen {?AIN,1} hsetprop ${scobj_hpath}/analog/pv2 read_sixteen ${ns}::read_sixteen ${scobj_hpath} @@ -941,6 +961,14 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/analog/pv2 type "part" hsetprop ${scobj_hpath}/analog/pv2 nxalias "${name}_analog_pv2" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/analog/pv2 5 + hsetprop ${scobj_hpath}/analog/pv2 simulated false + } else { + ::scobj::hiden_xcs::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for hiden_xcs" + hsetprop ${scobj_hpath}/analog/pv2 simulated true + } + hfactory ${scobj_hpath}/analog/pv3 plain user float hsetprop ${scobj_hpath}/analog/pv3 read ${ns}::getValue ${scobj_hpath} read_sixteen {?AIN,2} hsetprop ${scobj_hpath}/analog/pv3 read_sixteen ${ns}::read_sixteen ${scobj_hpath} @@ -955,6 +983,14 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/analog/pv3 type "part" hsetprop ${scobj_hpath}/analog/pv3 nxalias "${name}_analog_pv3" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/analog/pv3 5 + hsetprop ${scobj_hpath}/analog/pv3 simulated false + } else { + ::scobj::hiden_xcs::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for hiden_xcs" + hsetprop ${scobj_hpath}/analog/pv3 simulated true + } + hfactory ${scobj_hpath}/analog/rhsense plain user float hsetprop ${scobj_hpath}/analog/rhsense read ${ns}::getValue ${scobj_hpath} read_sixteen {?AIN,9} hsetprop ${scobj_hpath}/analog/rhsense read_sixteen ${ns}::read_sixteen ${scobj_hpath} @@ -969,6 +1005,14 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/analog/rhsense type "part" hsetprop ${scobj_hpath}/analog/rhsense nxalias "${name}_analog_rhsense" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/analog/rhsense 5 + hsetprop ${scobj_hpath}/analog/rhsense simulated false + } else { + ::scobj::hiden_xcs::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for hiden_xcs" + hsetprop ${scobj_hpath}/analog/rhsense simulated true + } + hfactory ${scobj_hpath}/analog/rhtemp plain user float hsetprop ${scobj_hpath}/analog/rhtemp read ${ns}::getValue ${scobj_hpath} read_sixteen {?AIN,8} hsetprop ${scobj_hpath}/analog/rhtemp read_sixteen ${ns}::read_sixteen ${scobj_hpath} @@ -983,6 +1027,14 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/analog/rhtemp type "part" hsetprop ${scobj_hpath}/analog/rhtemp nxalias "${name}_analog_rhtemp" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/analog/rhtemp 5 + hsetprop ${scobj_hpath}/analog/rhtemp simulated false + } else { + ::scobj::hiden_xcs::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for hiden_xcs" + hsetprop ${scobj_hpath}/analog/rhtemp simulated true + } + hfactory ${scobj_hpath}/analog/sp1 plain user float hsetprop ${scobj_hpath}/analog/sp1 read ${ns}::getValue ${scobj_hpath} read_twelve {?AOUT,0} hsetprop ${scobj_hpath}/analog/sp1 read_twelve ${ns}::read_twelve ${scobj_hpath} @@ -1000,6 +1052,15 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/analog/sp1 type "part" hsetprop ${scobj_hpath}/analog/sp1 nxalias "${name}_analog_sp1" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/analog/sp1 5 + ${sct_controller} write ${scobj_hpath}/analog/sp1 + hsetprop ${scobj_hpath}/analog/sp1 simulated false + } else { + ::scobj::hiden_xcs::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for hiden_xcs" + hsetprop ${scobj_hpath}/analog/sp1 simulated true + } + hfactory ${scobj_hpath}/analog/sp2 plain user float hsetprop ${scobj_hpath}/analog/sp2 read ${ns}::getValue ${scobj_hpath} read_twelve {?AOUT,1} hsetprop ${scobj_hpath}/analog/sp2 read_twelve ${ns}::read_twelve ${scobj_hpath} @@ -1017,6 +1078,15 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/analog/sp2 type "part" hsetprop ${scobj_hpath}/analog/sp2 nxalias "${name}_analog_sp2" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/analog/sp2 5 + ${sct_controller} write ${scobj_hpath}/analog/sp2 + hsetprop ${scobj_hpath}/analog/sp2 simulated false + } else { + ::scobj::hiden_xcs::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for hiden_xcs" + hsetprop ${scobj_hpath}/analog/sp2 simulated true + } + hfactory ${scobj_hpath}/analog/sp3 plain user float hsetprop ${scobj_hpath}/analog/sp3 read ${ns}::getValue ${scobj_hpath} read_twelve {?AOUT,2} hsetprop ${scobj_hpath}/analog/sp3 read_twelve ${ns}::read_twelve ${scobj_hpath} @@ -1035,27 +1105,18 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/analog/sp3 nxalias "${name}_analog_sp3" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/analog/ansto_temp 5 - ${sct_controller} poll ${scobj_hpath}/analog/pv1 5 - ${sct_controller} poll ${scobj_hpath}/analog/pv2 5 - ${sct_controller} poll ${scobj_hpath}/analog/pv3 5 - ${sct_controller} poll ${scobj_hpath}/analog/rhsense 5 - ${sct_controller} poll ${scobj_hpath}/analog/rhtemp 5 - ${sct_controller} poll ${scobj_hpath}/analog/sp1 5 - ${sct_controller} poll ${scobj_hpath}/analog/sp2 5 ${sct_controller} poll ${scobj_hpath}/analog/sp3 5 - ${sct_controller} write ${scobj_hpath}/analog/sp1 - ${sct_controller} write ${scobj_hpath}/analog/sp2 ${sct_controller} write ${scobj_hpath}/analog/sp3 + hsetprop ${scobj_hpath}/analog/sp3 simulated false } else { ::scobj::hiden_xcs::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for hiden_xcs" + hsetprop ${scobj_hpath}/analog/sp3 simulated true } + hsetprop ${scobj_hpath}/analog data "false" + hsetprop ${scobj_hpath}/analog klass "@none" + hsetprop ${scobj_hpath}/analog type "part" hfactory ${scobj_hpath}/flow plain spy none - hsetprop ${scobj_hpath}/flow data "true" - hsetprop ${scobj_hpath}/flow klass "@none" - hsetprop ${scobj_hpath}/flow nxsave "true" - hsetprop ${scobj_hpath}/flow type "part" hfactory ${scobj_hpath}/flow/sensor plain user float hsetprop ${scobj_hpath}/flow/sensor read ${ns}::fetch_flow ${scobj_hpath} read_flow {None} @@ -1079,6 +1140,14 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/flow/sensor type "part" hsetprop ${scobj_hpath}/flow/sensor nxalias "${name}_flow_sensor" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/flow/sensor 1 + hsetprop ${scobj_hpath}/flow/sensor simulated false + } else { + ::scobj::hiden_xcs::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for hiden_xcs" + hsetprop ${scobj_hpath}/flow/sensor simulated true + } + hfactory ${scobj_hpath}/flow/setpoint plain user float hsetprop ${scobj_hpath}/flow/setpoint read ${ns}::getTarget ${scobj_hpath} rdValue {@} hsetprop ${scobj_hpath}/flow/setpoint rdValue ${ns}::rdValue ${scobj_hpath} @@ -1107,18 +1176,20 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/flow/setpoint nxalias "${name}_flow_setpoint" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/flow/sensor 1 ${sct_controller} poll ${scobj_hpath}/flow/setpoint 1 ${sct_controller} write ${scobj_hpath}/flow/setpoint + hsetprop ${scobj_hpath}/flow/setpoint simulated false } else { ::scobj::hiden_xcs::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for hiden_xcs" + hsetprop ${scobj_hpath}/flow/setpoint simulated true } + hsetprop ${scobj_hpath}/flow data "true" + hsetprop ${scobj_hpath}/flow klass "@none" + hsetprop ${scobj_hpath}/flow nxsave "true" + hsetprop ${scobj_hpath}/flow type "part" + ansto_makesctdrive ${name}_flow_setpoint ${scobj_hpath}/flow/setpoint ${scobj_hpath}/flow/sensor ${sct_controller} hfactory ${scobj_hpath}/humidity plain spy none - hsetprop ${scobj_hpath}/humidity data "true" - hsetprop ${scobj_hpath}/humidity klass "@none" - hsetprop ${scobj_hpath}/humidity nxsave "true" - hsetprop ${scobj_hpath}/humidity type "part" hfactory ${scobj_hpath}/humidity/sensor plain user float hsetprop ${scobj_hpath}/humidity/sensor read ${ns}::getValue ${scobj_hpath} read_all_data {?ALL DATA} @@ -1142,6 +1213,14 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/humidity/sensor type "part" hsetprop ${scobj_hpath}/humidity/sensor nxalias "${name}_humidity_sensor" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/humidity/sensor 1 + hsetprop ${scobj_hpath}/humidity/sensor simulated false + } else { + ::scobj::hiden_xcs::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for hiden_xcs" + hsetprop ${scobj_hpath}/humidity/sensor simulated true + } + hfactory ${scobj_hpath}/humidity/setpoint plain user float hsetprop ${scobj_hpath}/humidity/setpoint read ${ns}::getTarget ${scobj_hpath} rdValue {@} hsetprop ${scobj_hpath}/humidity/setpoint rdValue ${ns}::rdValue ${scobj_hpath} @@ -1170,19 +1249,21 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/humidity/setpoint nxalias "${name}_humidity_setpoint" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/humidity/sensor 1 ${sct_controller} poll ${scobj_hpath}/humidity/setpoint 1 ${sct_controller} write ${scobj_hpath}/humidity/setpoint + hsetprop ${scobj_hpath}/humidity/setpoint simulated false } else { ::scobj::hiden_xcs::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for hiden_xcs" + hsetprop ${scobj_hpath}/humidity/setpoint simulated true } + hsetprop ${scobj_hpath}/humidity data "true" + hsetprop ${scobj_hpath}/humidity klass "@none" + hsetprop ${scobj_hpath}/humidity nxsave "true" + hsetprop ${scobj_hpath}/humidity type "part" + ansto_makesctdrive ${name}_humidity_setpoint ${scobj_hpath}/humidity/setpoint ${scobj_hpath}/humidity/sensor ${sct_controller} 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}_flow_setpoint ${scobj_hpath}/flow/setpoint ${scobj_hpath}/flow/sensor ${sct_controller} - ansto_makesctdrive ${name}_humidity_setpoint ${scobj_hpath}/humidity/setpoint ${scobj_hpath}/humidity/sensor ${sct_controller} - } # mkDriver hook code starts # mkDriver hook code ends } catch_message ] @@ -1201,7 +1282,9 @@ proc ::scobj::hiden_xcs::add_driver {name device_class simulation_flag ip_addres makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::hiden_xcs::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for hiden_xcs" + ::scobj::hiden_xcs::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for hiden_xcs" + ::scobj::hiden_xcs::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::hiden_xcs::sics_log 1 "::scobj::hiden_xcs::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}" ::scobj::hiden_xcs::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} @@ -1219,7 +1302,7 @@ namespace eval ::scobj::hiden_xcs { proc add_hiden_xcs {name ip_address tcp_port id} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::hiden_xcs::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}" + ::scobj::hiden_xcs::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} } clientput "file evaluation of sct_hiden_xcs.tcl" @@ -1258,20 +1341,31 @@ proc ::scobj::hiden_xcs::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"]" } } @@ -1282,6 +1376,7 @@ proc ::scobj::hiden_xcs::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } set arg_list [list] set missing_list [list] @@ -1298,11 +1393,7 @@ proc ::scobj::hiden_xcs::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list - } + ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list } } } diff --git a/site_ansto/instrument/config/environment/sct_huber_pilot.tcl b/site_ansto/instrument/config/environment/sct_huber_pilot.tcl index 76f5f0c1..6e4774b0 100644 --- a/site_ansto/instrument/config/environment/sct_huber_pilot.tcl +++ b/site_ansto/instrument/config/environment/sct_huber_pilot.tcl @@ -89,7 +89,12 @@ proc ::scobj::huber_pilot::checkstatus {tc_root} { # checkstatus hook code goes here if {[sct driving]} { set sp "[sct target]" - set pv "[hval ${tc_root}/[sct driveable]]" + if {[hpropexists [sct] simulated] && [sct simulated] == "true"} { + set pv "${sp}" + hupdateif ${tc_root}/[sct driveable] ${sp} + } + set pv "[hval ${tc_root}/[sct driveable]]" + } if { abs(${pv} - ${sp}) <= [sct tolerance] } { if { [hpropexists [sct] settle_time] } { if { [hpropexists [sct] settle_time_start] } { @@ -302,9 +307,6 @@ proc ::scobj::huber_pilot::mkDriver { sct_controller name device_class simulatio set scobj_hpath /sics/${name} hfactory ${scobj_hpath}/Loop1 plain spy none - hsetprop ${scobj_hpath}/Loop1 data "true" - hsetprop ${scobj_hpath}/Loop1 klass "@none" - hsetprop ${scobj_hpath}/Loop1 type "part" hfactory ${scobj_hpath}/Loop1/sensor_int plain user float hsetprop ${scobj_hpath}/Loop1/sensor_int read ${ns}::getValue ${scobj_hpath} rdTemp {01} @@ -321,6 +323,14 @@ proc ::scobj::huber_pilot::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/Loop1/sensor_int type "part" hsetprop ${scobj_hpath}/Loop1/sensor_int nxalias "${name}_Loop1_sensor_int" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop1/sensor_int 1 + hsetprop ${scobj_hpath}/Loop1/sensor_int simulated false + } else { + ::scobj::huber_pilot::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for huber_pilot" + hsetprop ${scobj_hpath}/Loop1/sensor_int simulated true + } + hfactory ${scobj_hpath}/Loop1/setpoint plain user float hsetprop ${scobj_hpath}/Loop1/setpoint read ${ns}::getValue ${scobj_hpath} rdTemp {00} hsetprop ${scobj_hpath}/Loop1/setpoint rdTemp ${ns}::rdTemp ${scobj_hpath} @@ -348,6 +358,15 @@ proc ::scobj::huber_pilot::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/Loop1/setpoint type "drivable" hsetprop ${scobj_hpath}/Loop1/setpoint nxalias "${name}_Loop1_setpoint" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop1/setpoint 1 + ${sct_controller} write ${scobj_hpath}/Loop1/setpoint + hsetprop ${scobj_hpath}/Loop1/setpoint simulated false + } else { + ::scobj::huber_pilot::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for huber_pilot" + hsetprop ${scobj_hpath}/Loop1/setpoint simulated true + } + hfactory ${scobj_hpath}/Loop1/vMaxSP plain user float hsetprop ${scobj_hpath}/Loop1/vMaxSP read ${ns}::getValue ${scobj_hpath} rdTemp {31} hsetprop ${scobj_hpath}/Loop1/vMaxSP rdTemp ${ns}::rdTemp ${scobj_hpath} @@ -361,6 +380,14 @@ proc ::scobj::huber_pilot::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/Loop1/vMaxSP type "part" hsetprop ${scobj_hpath}/Loop1/vMaxSP nxalias "${name}_Loop1_vMaxSP" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop1/vMaxSP 1 + hsetprop ${scobj_hpath}/Loop1/vMaxSP simulated false + } else { + ::scobj::huber_pilot::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for huber_pilot" + hsetprop ${scobj_hpath}/Loop1/vMaxSP simulated true + } + hfactory ${scobj_hpath}/Loop1/vMinSP plain user float hsetprop ${scobj_hpath}/Loop1/vMinSP read ${ns}::getValue ${scobj_hpath} rdTemp {30} hsetprop ${scobj_hpath}/Loop1/vMinSP rdTemp ${ns}::rdTemp ${scobj_hpath} @@ -374,6 +401,14 @@ proc ::scobj::huber_pilot::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/Loop1/vMinSP type "part" hsetprop ${scobj_hpath}/Loop1/vMinSP nxalias "${name}_Loop1_vMinSP" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop1/vMinSP 1 + hsetprop ${scobj_hpath}/Loop1/vMinSP simulated false + } else { + ::scobj::huber_pilot::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for huber_pilot" + hsetprop ${scobj_hpath}/Loop1/vMinSP simulated true + } + hfactory ${scobj_hpath}/Loop1/vTE plain user float hsetprop ${scobj_hpath}/Loop1/vTE read ${ns}::getValue ${scobj_hpath} rdTemp {07} hsetprop ${scobj_hpath}/Loop1/vTE rdTemp ${ns}::rdTemp ${scobj_hpath} @@ -389,6 +424,14 @@ proc ::scobj::huber_pilot::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/Loop1/vTE type "part" hsetprop ${scobj_hpath}/Loop1/vTE nxalias "${name}_Loop1_vTE" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop1/vTE 1 + hsetprop ${scobj_hpath}/Loop1/vTE simulated false + } else { + ::scobj::huber_pilot::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for huber_pilot" + hsetprop ${scobj_hpath}/Loop1/vTE simulated true + } + hfactory ${scobj_hpath}/Loop1/vTmpActive plain user int hsetprop ${scobj_hpath}/Loop1/vTmpActive read ${ns}::getValue ${scobj_hpath} rdStatus {14} hsetprop ${scobj_hpath}/Loop1/vTmpActive rdStatus ${ns}::rdStatus ${scobj_hpath} @@ -402,6 +445,14 @@ proc ::scobj::huber_pilot::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/Loop1/vTmpActive type "part" hsetprop ${scobj_hpath}/Loop1/vTmpActive nxalias "${name}_Loop1_vTmpActive" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop1/vTmpActive 1 + hsetprop ${scobj_hpath}/Loop1/vTmpActive simulated false + } else { + ::scobj::huber_pilot::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for huber_pilot" + hsetprop ${scobj_hpath}/Loop1/vTmpActive simulated true + } + hfactory ${scobj_hpath}/Loop1/vTmpMode plain user int hsetprop ${scobj_hpath}/Loop1/vTmpMode read ${ns}::getValue ${scobj_hpath} rdStatus {13} hsetprop ${scobj_hpath}/Loop1/vTmpMode rdStatus ${ns}::rdStatus ${scobj_hpath} @@ -416,23 +467,19 @@ proc ::scobj::huber_pilot::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/Loop1/vTmpMode nxalias "${name}_Loop1_vTmpMode" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/Loop1/sensor_int 1 - ${sct_controller} poll ${scobj_hpath}/Loop1/setpoint 1 - ${sct_controller} poll ${scobj_hpath}/Loop1/vMaxSP 1 - ${sct_controller} poll ${scobj_hpath}/Loop1/vMinSP 1 - ${sct_controller} poll ${scobj_hpath}/Loop1/vTE 1 - ${sct_controller} poll ${scobj_hpath}/Loop1/vTmpActive 1 ${sct_controller} poll ${scobj_hpath}/Loop1/vTmpMode 1 - ${sct_controller} write ${scobj_hpath}/Loop1/setpoint + hsetprop ${scobj_hpath}/Loop1/vTmpMode simulated false } else { ::scobj::huber_pilot::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for huber_pilot" + hsetprop ${scobj_hpath}/Loop1/vTmpMode simulated true } + hsetprop ${scobj_hpath}/Loop1 data "true" + hsetprop ${scobj_hpath}/Loop1 klass "@none" + hsetprop ${scobj_hpath}/Loop1 type "part" + ansto_makesctdrive ${name}_Loop1_setpoint ${scobj_hpath}/Loop1/setpoint ${scobj_hpath}/Loop1/sensor_int ${sct_controller} 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}_Loop1_setpoint ${scobj_hpath}/Loop1/setpoint ${scobj_hpath}/Loop1/sensor_int ${sct_controller} - } # mkDriver hook code goes here } catch_message ] handle_exception ${catch_status} ${catch_message} @@ -450,7 +497,9 @@ proc ::scobj::huber_pilot::add_driver {name device_class simulation_flag ip_addr makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::huber_pilot::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for huber_pilot" + ::scobj::huber_pilot::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for huber_pilot" + ::scobj::huber_pilot::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::huber_pilot::sics_log 1 "::scobj::huber_pilot::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}" ::scobj::huber_pilot::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} @@ -468,7 +517,7 @@ namespace eval ::scobj::huber_pilot { proc add_huber_pilot {name ip_address tcp_port} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::huber_pilot::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} + ::scobj::huber_pilot::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} } clientput "file evaluation of sct_huber_pilot.tcl" @@ -507,20 +556,31 @@ proc ::scobj::huber_pilot::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"]" } } @@ -531,12 +591,9 @@ proc ::scobj::huber_pilot::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/sct_isotech_ps.tcl b/site_ansto/instrument/config/environment/sct_isotech_ps.tcl index 5a92cb66..f007fc82 100644 --- a/site_ansto/instrument/config/environment/sct_isotech_ps.tcl +++ b/site_ansto/instrument/config/environment/sct_isotech_ps.tcl @@ -266,6 +266,14 @@ proc ::scobj::isotech_ps::mkDriver { sct_controller name device_class simulation hsetprop ${scobj_hpath}/amps type "part" hsetprop ${scobj_hpath}/amps nxalias "${name}_amps" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/amps 5 + hsetprop ${scobj_hpath}/amps simulated false + } else { + ::scobj::isotech_ps::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for isotech_ps" + hsetprop ${scobj_hpath}/amps simulated true + } + hfactory ${scobj_hpath}/relay plain user int hsetprop ${scobj_hpath}/relay read ${ns}::getValue ${scobj_hpath} read_relay {F} hsetprop ${scobj_hpath}/relay read_relay ${ns}::read_relay ${scobj_hpath} @@ -282,6 +290,15 @@ proc ::scobj::isotech_ps::mkDriver { sct_controller name device_class simulation hsetprop ${scobj_hpath}/relay type "part" hsetprop ${scobj_hpath}/relay nxalias "${name}_relay" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/relay 5 + ${sct_controller} write ${scobj_hpath}/relay + hsetprop ${scobj_hpath}/relay simulated false + } else { + ::scobj::isotech_ps::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for isotech_ps" + hsetprop ${scobj_hpath}/relay simulated true + } + hfactory ${scobj_hpath}/volts plain user float hsetprop ${scobj_hpath}/volts read ${ns}::getValue ${scobj_hpath} rdValue {V} hsetprop ${scobj_hpath}/volts rdValue ${ns}::rdValue ${scobj_hpath} @@ -299,19 +316,18 @@ proc ::scobj::isotech_ps::mkDriver { sct_controller name device_class simulation hsetprop ${scobj_hpath}/volts type "part" hsetprop ${scobj_hpath}/volts nxalias "${name}_volts" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/volts 5 + ${sct_controller} write ${scobj_hpath}/volts + hsetprop ${scobj_hpath}/volts simulated false + } else { + ::scobj::isotech_ps::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for isotech_ps" + hsetprop ${scobj_hpath}/volts 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}/amps 5 - ${sct_controller} poll ${scobj_hpath}/relay 5 - ${sct_controller} poll ${scobj_hpath}/volts 5 - ${sct_controller} write ${scobj_hpath}/relay - ${sct_controller} write ${scobj_hpath}/volts - } else { - ::scobj::isotech_ps::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for isotech_ps" - } hsetprop ${scobj_hpath} klass ${device_class} hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} debug_threshold 5 @@ -332,7 +348,9 @@ proc ::scobj::isotech_ps::add_driver {name device_class simulation_flag ip_addre makesctcontroller sct_${name} std ${ip_address}:${tcp_port} "\r" } } else { - ::scobj::isotech_ps::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for isotech_ps" + ::scobj::isotech_ps::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for isotech_ps" + ::scobj::isotech_ps::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::isotech_ps::sics_log 1 "::scobj::isotech_ps::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}" ::scobj::isotech_ps::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} @@ -350,7 +368,7 @@ namespace eval ::scobj::isotech_ps { proc add_isotech_ps {name ip_address tcp_port} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::isotech_ps::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} + ::scobj::isotech_ps::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} } clientput "file evaluation of sct_isotech_ps.tcl" @@ -389,20 +407,50 @@ proc ::scobj::isotech_ps::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] + set arg_list [list] + set missing_list [list] + array unset default_map + array set default_map [list terminator "\r"] + foreach arg {terminator} { + 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" + } + makesctcontroller sct_${name} std ${ip_address}:${tcp_port} {*}$arg_list + } 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"]" } } @@ -413,12 +461,9 @@ proc ::scobj::isotech_ps::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/sct_keithley_m2700.tcl b/site_ansto/instrument/config/environment/sct_keithley_m2700.tcl index e4ff9fbf..5a76d00e 100644 --- a/site_ansto/instrument/config/environment/sct_keithley_m2700.tcl +++ b/site_ansto/instrument/config/environment/sct_keithley_m2700.tcl @@ -60,7 +60,9 @@ proc ::scobj::keithley_m2700::add_driver {name device_class simulation_flag ip_a makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::keithley_m2700::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for keithley_m2700" + ::scobj::keithley_m2700::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for keithley_m2700" + ::scobj::keithley_m2700::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::keithley_m2700::sics_log 1 "::scobj::keithley_m2700::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol}" ::scobj::keithley_m2700::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol} @@ -78,7 +80,7 @@ namespace eval ::scobj::keithley_m2700 { proc add_keithley_m2700 {name ip_address tcp_port id datype tol} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::keithley_m2700::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}" "${datype}" "${tol}" + ::scobj::keithley_m2700::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol} } clientput "file evaluation of sct_keithley_m2700.tcl" @@ -117,20 +119,31 @@ proc ::scobj::keithley_m2700::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"]" } } @@ -141,6 +154,7 @@ proc ::scobj::keithley_m2700::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } set arg_list [list] set missing_list [list] @@ -157,11 +171,7 @@ proc ::scobj::keithley_m2700::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list - } + ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list } } } diff --git a/site_ansto/instrument/config/environment/sct_knauer_pump.tcl b/site_ansto/instrument/config/environment/sct_knauer_pump.tcl index 1f269659..61aef858 100644 --- a/site_ansto/instrument/config/environment/sct_knauer_pump.tcl +++ b/site_ansto/instrument/config/environment/sct_knauer_pump.tcl @@ -583,7 +583,12 @@ proc ::scobj::knauer_pump::volume_checkstatus {tc_root} { # volume_checkstatus hook code goes here if {[sct driving]} { set sp "[sct target]" - set pv "[hval ${tc_root}/[sct driveable]]" + if {[hpropexists [sct] simulated] && [sct simulated] == "true"} { + set pv "${sp}" + hupdateif ${tc_root}/[sct driveable] ${sp} + } + set pv "[hval ${tc_root}/[sct driveable]]" + } if { abs(${pv} - ${sp}) <= [sct tolerance] } { if { [hpropexists [sct] settle_time] } { if { [hpropexists [sct] settle_time_start] } { @@ -881,9 +886,6 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio set scobj_hpath /sics/${name} hfactory ${scobj_hpath}/dummy plain spy none - hsetprop ${scobj_hpath}/dummy data "false" - hsetprop ${scobj_hpath}/dummy klass "@none" - hsetprop ${scobj_hpath}/dummy type "part" hfactory ${scobj_hpath}/dummy/glp plain user text hsetprop ${scobj_hpath}/dummy/glp read ${ns}::getValue ${scobj_hpath} read_glp {GLP?} @@ -898,6 +900,14 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/dummy/glp type "part" hsetprop ${scobj_hpath}/dummy/glp nxalias "${name}_dummy_glp" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/dummy/glp 1 + hsetprop ${scobj_hpath}/dummy/glp simulated false + } else { + ::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump" + hsetprop ${scobj_hpath}/dummy/glp simulated true + } + hfactory ${scobj_hpath}/dummy/status plain user text hsetprop ${scobj_hpath}/dummy/status read ${ns}::getValue ${scobj_hpath} read_status {STATUS?} hsetprop ${scobj_hpath}/dummy/status read_status ${ns}::read_status ${scobj_hpath} @@ -912,16 +922,17 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/dummy/status nxalias "${name}_dummy_status" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/dummy/glp 1 ${sct_controller} poll ${scobj_hpath}/dummy/status 1 + hsetprop ${scobj_hpath}/dummy/status simulated false } else { ::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump" + hsetprop ${scobj_hpath}/dummy/status simulated true } + hsetprop ${scobj_hpath}/dummy data "false" + hsetprop ${scobj_hpath}/dummy klass "@none" + hsetprop ${scobj_hpath}/dummy type "part" hfactory ${scobj_hpath}/pump plain spy none - hsetprop ${scobj_hpath}/pump data "true" - hsetprop ${scobj_hpath}/pump klass "@none" - hsetprop ${scobj_hpath}/pump type "part" hfactory ${scobj_hpath}/pump/remote plain user int hsetprop ${scobj_hpath}/pump/remote read ${ns}::getValue ${scobj_hpath} remote_read {REMOTE?} @@ -940,6 +951,15 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/pump/remote type "part" hsetprop ${scobj_hpath}/pump/remote nxalias "${name}_pump_remote" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pump/remote 1 + ${sct_controller} write ${scobj_hpath}/pump/remote + hsetprop ${scobj_hpath}/pump/remote simulated false + } else { + ::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump" + hsetprop ${scobj_hpath}/pump/remote simulated true + } + hfactory ${scobj_hpath}/pump/state plain user text hsetprop ${scobj_hpath}/pump/state read ${ns}::state_fetch ${scobj_hpath} rdValue { } hsetprop ${scobj_hpath}/pump/state rdValue ${ns}::rdValue ${scobj_hpath} @@ -953,6 +973,14 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/pump/state type "part" hsetprop ${scobj_hpath}/pump/state nxalias "${name}_pump_state" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pump/state 1 + hsetprop ${scobj_hpath}/pump/state simulated false + } else { + ::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump" + hsetprop ${scobj_hpath}/pump/state simulated true + } + hfactory ${scobj_hpath}/pump/status plain user text hsetprop ${scobj_hpath}/pump/status read ${ns}::status_fetch ${scobj_hpath} rdValue { } hsetprop ${scobj_hpath}/pump/status rdValue ${ns}::rdValue ${scobj_hpath} @@ -967,18 +995,17 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/pump/status nxalias "${name}_pump_status" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/pump/remote 1 - ${sct_controller} poll ${scobj_hpath}/pump/state 1 ${sct_controller} poll ${scobj_hpath}/pump/status 1 - ${sct_controller} write ${scobj_hpath}/pump/remote + hsetprop ${scobj_hpath}/pump/status simulated false } else { ::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump" + hsetprop ${scobj_hpath}/pump/status simulated true } + hsetprop ${scobj_hpath}/pump data "true" + hsetprop ${scobj_hpath}/pump klass "@none" + hsetprop ${scobj_hpath}/pump type "part" hfactory ${scobj_hpath}/pump/flow plain spy none - hsetprop ${scobj_hpath}/pump/flow data "true" - hsetprop ${scobj_hpath}/pump/flow klass "@none" - hsetprop ${scobj_hpath}/pump/flow type "part" hfactory ${scobj_hpath}/pump/flow/pval plain user float hsetprop ${scobj_hpath}/pump/flow/pval read ${ns}::flow_fetch ${scobj_hpath} rdValue { } @@ -994,6 +1021,14 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/pump/flow/pval units "mL/min" hsetprop ${scobj_hpath}/pump/flow/pval nxalias "${name}_pump_flow_pval" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pump/flow/pval 1 + hsetprop ${scobj_hpath}/pump/flow/pval simulated false + } else { + ::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump" + hsetprop ${scobj_hpath}/pump/flow/pval simulated true + } + hfactory ${scobj_hpath}/pump/flow/setp plain user float hsetprop ${scobj_hpath}/pump/flow/setp write ${ns}::flow_write ${scobj_hpath} noResponse { } hsetprop ${scobj_hpath}/pump/flow/setp noResponse ${ns}::noResponse ${scobj_hpath} @@ -1013,16 +1048,17 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/pump/flow/setp nxalias "${name}_pump_flow_setp" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/pump/flow/pval 1 ${sct_controller} write ${scobj_hpath}/pump/flow/setp + hsetprop ${scobj_hpath}/pump/flow/setp simulated false } else { ::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump" + hsetprop ${scobj_hpath}/pump/flow/setp simulated true } + hsetprop ${scobj_hpath}/pump/flow data "true" + hsetprop ${scobj_hpath}/pump/flow klass "@none" + hsetprop ${scobj_hpath}/pump/flow type "part" hfactory ${scobj_hpath}/pump/ratio plain spy none - hsetprop ${scobj_hpath}/pump/ratio data "true" - hsetprop ${scobj_hpath}/pump/ratio klass "@none" - hsetprop ${scobj_hpath}/pump/ratio type "part" hfactory ${scobj_hpath}/pump/ratio/pval plain user text hsetprop ${scobj_hpath}/pump/ratio/pval read ${ns}::ratio_fetch ${scobj_hpath} rdValue { } @@ -1038,6 +1074,14 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/pump/ratio/pval units "percent" hsetprop ${scobj_hpath}/pump/ratio/pval nxalias "${name}_pump_ratio_pval" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pump/ratio/pval 1 + hsetprop ${scobj_hpath}/pump/ratio/pval simulated false + } else { + ::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump" + hsetprop ${scobj_hpath}/pump/ratio/pval simulated true + } + hfactory ${scobj_hpath}/pump/ratio/setp plain user text hsetprop ${scobj_hpath}/pump/ratio/setp write ${ns}::ratio_write ${scobj_hpath} noResponse { } hsetprop ${scobj_hpath}/pump/ratio/setp noResponse ${ns}::noResponse ${scobj_hpath} @@ -1055,16 +1099,17 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/pump/ratio/setp nxalias "${name}_pump_ratio_setp" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/pump/ratio/pval 1 ${sct_controller} write ${scobj_hpath}/pump/ratio/setp + hsetprop ${scobj_hpath}/pump/ratio/setp simulated false } else { ::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump" + hsetprop ${scobj_hpath}/pump/ratio/setp simulated true } + hsetprop ${scobj_hpath}/pump/ratio data "true" + hsetprop ${scobj_hpath}/pump/ratio klass "@none" + hsetprop ${scobj_hpath}/pump/ratio type "part" hfactory ${scobj_hpath}/pump/volume plain spy none - hsetprop ${scobj_hpath}/pump/volume data "true" - hsetprop ${scobj_hpath}/pump/volume klass "@none" - hsetprop ${scobj_hpath}/pump/volume type "part" hfactory ${scobj_hpath}/pump/volume/pval plain user float hsetprop ${scobj_hpath}/pump/volume/pval read ${ns}::volume_fetch ${scobj_hpath} volume_read { } @@ -1080,6 +1125,14 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/pump/volume/pval units "mL" hsetprop ${scobj_hpath}/pump/volume/pval nxalias "${name}_pump_volume_pval" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pump/volume/pval 1 + hsetprop ${scobj_hpath}/pump/volume/pval simulated false + } else { + ::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump" + hsetprop ${scobj_hpath}/pump/volume/pval simulated true + } + hfactory ${scobj_hpath}/pump/volume/setp plain user float hsetprop ${scobj_hpath}/pump/volume/setp read ${ns}::volume_fsm ${scobj_hpath} volume_store { } hsetprop ${scobj_hpath}/pump/volume/setp volume_store ${ns}::volume_store ${scobj_hpath} @@ -1107,18 +1160,20 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/pump/volume/setp nxalias "${name}_pump_volume_setp" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/pump/volume/pval 1 ${sct_controller} poll ${scobj_hpath}/pump/volume/setp 1 ${sct_controller} write ${scobj_hpath}/pump/volume/setp + hsetprop ${scobj_hpath}/pump/volume/setp simulated false } else { ::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for knauer_pump" + hsetprop ${scobj_hpath}/pump/volume/setp simulated true } + hsetprop ${scobj_hpath}/pump/volume data "true" + hsetprop ${scobj_hpath}/pump/volume klass "@none" + hsetprop ${scobj_hpath}/pump/volume type "part" + ansto_makesctdrive ${name}_pump_volume_setp ${scobj_hpath}/pump/volume/setp ${scobj_hpath}/pump/volume/pval ${sct_controller} hsetprop ${scobj_hpath} klass ${device_class} hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} debug_threshold 0 - 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} - } # mkDriver hook code starts #hset ${scobj_hpath}/pump/remote 1 # mkDriver hook code ends @@ -1138,7 +1193,9 @@ proc ::scobj::knauer_pump::add_driver {name device_class simulation_flag ip_addr makesctcontroller sct_${name} knauer_ap ${ip_address}:${tcp_port} } } else { - ::scobj::knauer_pump::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for knauer_pump" + ::scobj::knauer_pump::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for knauer_pump" + ::scobj::knauer_pump::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::knauer_pump::sics_log 1 "::scobj::knauer_pump::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}" ::scobj::knauer_pump::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} @@ -1156,7 +1213,7 @@ namespace eval ::scobj::knauer_pump { proc add_knauer_pump {name ip_address tcp_port} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::knauer_pump::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} + ::scobj::knauer_pump::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} } clientput "file evaluation of sct_knauer_pump.tcl" @@ -1195,20 +1252,31 @@ proc ::scobj::knauer_pump::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} knauer_ap ${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"]" } } @@ -1219,12 +1287,9 @@ proc ::scobj::knauer_pump::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/sct_mvp_valve.tcl b/site_ansto/instrument/config/environment/sct_mvp_valve.tcl index 0bd5761d..a721bcb8 100644 --- a/site_ansto/instrument/config/environment/sct_mvp_valve.tcl +++ b/site_ansto/instrument/config/environment/sct_mvp_valve.tcl @@ -59,7 +59,7 @@ namespace eval ::scobj::mvp_valve { proc add_mvp_valve {name ip_address tcp_port id datype} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::mvp_valve::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}" "${datype}" + ::scobj::mvp_valve::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} } clientput "file evaluation of sct_mvp_valve.tcl" @@ -95,34 +95,7 @@ proc ::scobj::mvp_valve::read_config {} { continue } if { [string equal -nocase [dict get $v "driver"] "mvp_valve"] } { - if { ![string equal -nocase "${simulation_flag}" "false"] } { - set asyncqueue "null" - ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => 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] - } - } 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_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"]" - } - } + ::scobj::mvp_valve::sics_log 9 "No sctcontroller for mvp_valve" set arg_list [list] set missing_list [list] foreach arg {id datype} { @@ -138,11 +111,7 @@ proc ::scobj::mvp_valve::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list - } + ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list } } } diff --git a/site_ansto/instrument/config/environment/sct_nhq_200.tcl b/site_ansto/instrument/config/environment/sct_nhq_200.tcl index 23288ca5..96855507 100644 --- a/site_ansto/instrument/config/environment/sct_nhq_200.tcl +++ b/site_ansto/instrument/config/environment/sct_nhq_200.tcl @@ -86,7 +86,12 @@ proc ::scobj::nhq_200::checkstatus {tc_root} { # checkstatus hook code goes here if {[sct driving]} { set sp "[sct target]" - set pv "[hval ${tc_root}/[sct driveable]]" + if {[hpropexists [sct] simulated] && [sct simulated] == "true"} { + set pv "${sp}" + hupdateif ${tc_root}/[sct driveable] ${sp} + } + set pv "[hval ${tc_root}/[sct driveable]]" + } if { abs(${pv} - ${sp}) <= [sct tolerance] } { if { [hpropexists [sct] settle_time] } { if { [hpropexists [sct] settle_time_start] } { @@ -294,6 +299,14 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/break type "part" hsetprop ${scobj_hpath}/break nxalias "${name}_break" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/break 10 + hsetprop ${scobj_hpath}/break simulated false + } else { + ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" + hsetprop ${scobj_hpath}/break simulated true + } + hfactory ${scobj_hpath}/id plain user text hsetprop ${scobj_hpath}/id read ${ns}::getValue ${scobj_hpath} rdValue {#} hsetprop ${scobj_hpath}/id rdValue ${ns}::rdValue ${scobj_hpath} @@ -307,21 +320,19 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_fl 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::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" + 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}/break 10 - ${sct_controller} poll ${scobj_hpath}/id 10 - } else { - ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" - } - hfactory ${scobj_hpath}/ch1 plain spy none - hsetprop ${scobj_hpath}/ch1 data "true" - hsetprop ${scobj_hpath}/ch1 klass "@none" - hsetprop ${scobj_hpath}/ch1 type "part" hfactory ${scobj_hpath}/ch1/auto_start plain user int hsetprop ${scobj_hpath}/ch1/auto_start read ${ns}::getValue ${scobj_hpath} rdValue {A1} @@ -339,6 +350,15 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/ch1/auto_start type "part" hsetprop ${scobj_hpath}/ch1/auto_start nxalias "${name}_ch1_auto_start" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/ch1/auto_start 5 + ${sct_controller} write ${scobj_hpath}/ch1/auto_start + hsetprop ${scobj_hpath}/ch1/auto_start simulated false + } else { + ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" + hsetprop ${scobj_hpath}/ch1/auto_start simulated true + } + hfactory ${scobj_hpath}/ch1/current plain user text hsetprop ${scobj_hpath}/ch1/current read ${ns}::getValue ${scobj_hpath} rdCurrent {I1} hsetprop ${scobj_hpath}/ch1/current rdCurrent ${ns}::rdCurrent ${scobj_hpath} @@ -352,6 +372,14 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/ch1/current type "part" hsetprop ${scobj_hpath}/ch1/current nxalias "${name}_ch1_current" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/ch1/current 5 + hsetprop ${scobj_hpath}/ch1/current simulated false + } else { + ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" + hsetprop ${scobj_hpath}/ch1/current simulated true + } + hfactory ${scobj_hpath}/ch1/go plain user int hsetprop ${scobj_hpath}/ch1/go write ${ns}::setValue ${scobj_hpath} noResponse {G1} hsetprop ${scobj_hpath}/ch1/go noResponse ${ns}::noResponse ${scobj_hpath} @@ -366,6 +394,14 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/ch1/go type "part" hsetprop ${scobj_hpath}/ch1/go nxalias "${name}_ch1_go" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} write ${scobj_hpath}/ch1/go + hsetprop ${scobj_hpath}/ch1/go simulated false + } else { + ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" + hsetprop ${scobj_hpath}/ch1/go simulated true + } + hfactory ${scobj_hpath}/ch1/i_lim plain user int hsetprop ${scobj_hpath}/ch1/i_lim read ${ns}::getValue ${scobj_hpath} rdValue {N1} hsetprop ${scobj_hpath}/ch1/i_lim rdValue ${ns}::rdValue ${scobj_hpath} @@ -379,6 +415,14 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/ch1/i_lim type "part" hsetprop ${scobj_hpath}/ch1/i_lim nxalias "${name}_ch1_i_lim" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/ch1/i_lim 5 + hsetprop ${scobj_hpath}/ch1/i_lim simulated false + } else { + ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" + hsetprop ${scobj_hpath}/ch1/i_lim simulated true + } + hfactory ${scobj_hpath}/ch1/i_trip plain user int hsetprop ${scobj_hpath}/ch1/i_trip read ${ns}::getValue ${scobj_hpath} rdValue {L1} hsetprop ${scobj_hpath}/ch1/i_trip rdValue ${ns}::rdValue ${scobj_hpath} @@ -395,6 +439,15 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/ch1/i_trip type "part" hsetprop ${scobj_hpath}/ch1/i_trip nxalias "${name}_ch1_i_trip" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/ch1/i_trip 5 + ${sct_controller} write ${scobj_hpath}/ch1/i_trip + hsetprop ${scobj_hpath}/ch1/i_trip simulated false + } else { + ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" + hsetprop ${scobj_hpath}/ch1/i_trip simulated true + } + hfactory ${scobj_hpath}/ch1/module plain user int hsetprop ${scobj_hpath}/ch1/module read ${ns}::getValue ${scobj_hpath} rdValue {T1} hsetprop ${scobj_hpath}/ch1/module rdValue ${ns}::rdValue ${scobj_hpath} @@ -408,6 +461,14 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/ch1/module type "part" hsetprop ${scobj_hpath}/ch1/module nxalias "${name}_ch1_module" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/ch1/module 5 + hsetprop ${scobj_hpath}/ch1/module simulated false + } else { + ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" + hsetprop ${scobj_hpath}/ch1/module simulated true + } + hfactory ${scobj_hpath}/ch1/status plain user text hsetprop ${scobj_hpath}/ch1/status read ${ns}::getValue ${scobj_hpath} rdValue {S1} hsetprop ${scobj_hpath}/ch1/status rdValue ${ns}::rdValue ${scobj_hpath} @@ -421,6 +482,14 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/ch1/status type "part" hsetprop ${scobj_hpath}/ch1/status nxalias "${name}_ch1_status" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/ch1/status 5 + hsetprop ${scobj_hpath}/ch1/status simulated false + } else { + ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" + hsetprop ${scobj_hpath}/ch1/status simulated true + } + hfactory ${scobj_hpath}/ch1/v_lim plain user int hsetprop ${scobj_hpath}/ch1/v_lim read ${ns}::getValue ${scobj_hpath} rdValue {M1} hsetprop ${scobj_hpath}/ch1/v_lim rdValue ${ns}::rdValue ${scobj_hpath} @@ -434,6 +503,14 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/ch1/v_lim type "part" hsetprop ${scobj_hpath}/ch1/v_lim nxalias "${name}_ch1_v_lim" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/ch1/v_lim 5 + hsetprop ${scobj_hpath}/ch1/v_lim simulated false + } else { + ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" + hsetprop ${scobj_hpath}/ch1/v_lim simulated true + } + hfactory ${scobj_hpath}/ch1/v_ramp plain user int hsetprop ${scobj_hpath}/ch1/v_ramp read ${ns}::getValue ${scobj_hpath} rdValue {V1} hsetprop ${scobj_hpath}/ch1/v_ramp rdValue ${ns}::rdValue ${scobj_hpath} @@ -450,6 +527,15 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/ch1/v_ramp type "part" hsetprop ${scobj_hpath}/ch1/v_ramp nxalias "${name}_ch1_v_ramp" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/ch1/v_ramp 5 + ${sct_controller} write ${scobj_hpath}/ch1/v_ramp + hsetprop ${scobj_hpath}/ch1/v_ramp simulated false + } else { + ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" + hsetprop ${scobj_hpath}/ch1/v_ramp simulated true + } + hfactory ${scobj_hpath}/ch1/v_sp plain user int hsetprop ${scobj_hpath}/ch1/v_sp read ${ns}::getValue ${scobj_hpath} rdValue {D1} hsetprop ${scobj_hpath}/ch1/v_sp rdValue ${ns}::rdValue ${scobj_hpath} @@ -475,6 +561,15 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/ch1/v_sp type "drivable" hsetprop ${scobj_hpath}/ch1/v_sp nxalias "${name}_ch1_v_sp" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/ch1/v_sp 5 + ${sct_controller} write ${scobj_hpath}/ch1/v_sp + hsetprop ${scobj_hpath}/ch1/v_sp simulated false + } else { + ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" + hsetprop ${scobj_hpath}/ch1/v_sp simulated true + } + hfactory ${scobj_hpath}/ch1/voltage plain user int hsetprop ${scobj_hpath}/ch1/voltage read ${ns}::getValue ${scobj_hpath} rdVoltage {U1} hsetprop ${scobj_hpath}/ch1/voltage rdVoltage ${ns}::rdVoltage ${scobj_hpath} @@ -489,29 +584,18 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/ch1/voltage nxalias "${name}_ch1_voltage" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/ch1/auto_start 5 - ${sct_controller} poll ${scobj_hpath}/ch1/current 5 - ${sct_controller} poll ${scobj_hpath}/ch1/i_lim 5 - ${sct_controller} poll ${scobj_hpath}/ch1/i_trip 5 - ${sct_controller} poll ${scobj_hpath}/ch1/module 5 - ${sct_controller} poll ${scobj_hpath}/ch1/status 5 - ${sct_controller} poll ${scobj_hpath}/ch1/v_lim 5 - ${sct_controller} poll ${scobj_hpath}/ch1/v_ramp 5 - ${sct_controller} poll ${scobj_hpath}/ch1/v_sp 5 ${sct_controller} poll ${scobj_hpath}/ch1/voltage 5 - ${sct_controller} write ${scobj_hpath}/ch1/auto_start - ${sct_controller} write ${scobj_hpath}/ch1/go - ${sct_controller} write ${scobj_hpath}/ch1/i_trip - ${sct_controller} write ${scobj_hpath}/ch1/v_ramp - ${sct_controller} write ${scobj_hpath}/ch1/v_sp + hsetprop ${scobj_hpath}/ch1/voltage simulated false } else { ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" + hsetprop ${scobj_hpath}/ch1/voltage simulated true } + hsetprop ${scobj_hpath}/ch1 data "true" + hsetprop ${scobj_hpath}/ch1 klass "@none" + hsetprop ${scobj_hpath}/ch1 type "part" + ansto_makesctdrive ${name}_ch1_v_sp ${scobj_hpath}/ch1/v_sp ${scobj_hpath}/ch1/voltage ${sct_controller} hfactory ${scobj_hpath}/ch2 plain spy none - hsetprop ${scobj_hpath}/ch2 data "true" - hsetprop ${scobj_hpath}/ch2 klass "@none" - hsetprop ${scobj_hpath}/ch2 type "part" hfactory ${scobj_hpath}/ch2/auto_start plain user int hsetprop ${scobj_hpath}/ch2/auto_start read ${ns}::getValue ${scobj_hpath} rdValue {A2} @@ -529,6 +613,15 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/ch2/auto_start type "part" hsetprop ${scobj_hpath}/ch2/auto_start nxalias "${name}_ch2_auto_start" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/ch2/auto_start 5 + ${sct_controller} write ${scobj_hpath}/ch2/auto_start + hsetprop ${scobj_hpath}/ch2/auto_start simulated false + } else { + ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" + hsetprop ${scobj_hpath}/ch2/auto_start simulated true + } + hfactory ${scobj_hpath}/ch2/current plain user text hsetprop ${scobj_hpath}/ch2/current read ${ns}::getValue ${scobj_hpath} rdCurrent {I2} hsetprop ${scobj_hpath}/ch2/current rdCurrent ${ns}::rdCurrent ${scobj_hpath} @@ -542,6 +635,14 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/ch2/current type "part" hsetprop ${scobj_hpath}/ch2/current nxalias "${name}_ch2_current" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/ch2/current 5 + hsetprop ${scobj_hpath}/ch2/current simulated false + } else { + ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" + hsetprop ${scobj_hpath}/ch2/current simulated true + } + hfactory ${scobj_hpath}/ch2/go plain user int hsetprop ${scobj_hpath}/ch2/go write ${ns}::setValue ${scobj_hpath} noResponse {G2} hsetprop ${scobj_hpath}/ch2/go noResponse ${ns}::noResponse ${scobj_hpath} @@ -556,6 +657,14 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/ch2/go type "part" hsetprop ${scobj_hpath}/ch2/go nxalias "${name}_ch2_go" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} write ${scobj_hpath}/ch2/go + hsetprop ${scobj_hpath}/ch2/go simulated false + } else { + ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" + hsetprop ${scobj_hpath}/ch2/go simulated true + } + hfactory ${scobj_hpath}/ch2/i_lim plain user int hsetprop ${scobj_hpath}/ch2/i_lim read ${ns}::getValue ${scobj_hpath} rdValue {N2} hsetprop ${scobj_hpath}/ch2/i_lim rdValue ${ns}::rdValue ${scobj_hpath} @@ -569,6 +678,14 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/ch2/i_lim type "part" hsetprop ${scobj_hpath}/ch2/i_lim nxalias "${name}_ch2_i_lim" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/ch2/i_lim 5 + hsetprop ${scobj_hpath}/ch2/i_lim simulated false + } else { + ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" + hsetprop ${scobj_hpath}/ch2/i_lim simulated true + } + hfactory ${scobj_hpath}/ch2/i_trip plain user int hsetprop ${scobj_hpath}/ch2/i_trip read ${ns}::getValue ${scobj_hpath} rdValue {L2} hsetprop ${scobj_hpath}/ch2/i_trip rdValue ${ns}::rdValue ${scobj_hpath} @@ -585,6 +702,15 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/ch2/i_trip type "part" hsetprop ${scobj_hpath}/ch2/i_trip nxalias "${name}_ch2_i_trip" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/ch2/i_trip 5 + ${sct_controller} write ${scobj_hpath}/ch2/i_trip + hsetprop ${scobj_hpath}/ch2/i_trip simulated false + } else { + ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" + hsetprop ${scobj_hpath}/ch2/i_trip simulated true + } + hfactory ${scobj_hpath}/ch2/module plain user int hsetprop ${scobj_hpath}/ch2/module read ${ns}::getValue ${scobj_hpath} rdValue {T2} hsetprop ${scobj_hpath}/ch2/module rdValue ${ns}::rdValue ${scobj_hpath} @@ -598,6 +724,14 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/ch2/module type "part" hsetprop ${scobj_hpath}/ch2/module nxalias "${name}_ch2_module" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/ch2/module 5 + hsetprop ${scobj_hpath}/ch2/module simulated false + } else { + ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" + hsetprop ${scobj_hpath}/ch2/module simulated true + } + hfactory ${scobj_hpath}/ch2/status plain user text hsetprop ${scobj_hpath}/ch2/status read ${ns}::getValue ${scobj_hpath} rdValue {S2} hsetprop ${scobj_hpath}/ch2/status rdValue ${ns}::rdValue ${scobj_hpath} @@ -611,6 +745,14 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/ch2/status type "part" hsetprop ${scobj_hpath}/ch2/status nxalias "${name}_ch2_status" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/ch2/status 5 + hsetprop ${scobj_hpath}/ch2/status simulated false + } else { + ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" + hsetprop ${scobj_hpath}/ch2/status simulated true + } + hfactory ${scobj_hpath}/ch2/v_lim plain user int hsetprop ${scobj_hpath}/ch2/v_lim read ${ns}::getValue ${scobj_hpath} rdValue {M2} hsetprop ${scobj_hpath}/ch2/v_lim rdValue ${ns}::rdValue ${scobj_hpath} @@ -624,6 +766,14 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/ch2/v_lim type "part" hsetprop ${scobj_hpath}/ch2/v_lim nxalias "${name}_ch2_v_lim" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/ch2/v_lim 5 + hsetprop ${scobj_hpath}/ch2/v_lim simulated false + } else { + ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" + hsetprop ${scobj_hpath}/ch2/v_lim simulated true + } + hfactory ${scobj_hpath}/ch2/v_ramp plain user int hsetprop ${scobj_hpath}/ch2/v_ramp read ${ns}::getValue ${scobj_hpath} rdValue {V2} hsetprop ${scobj_hpath}/ch2/v_ramp rdValue ${ns}::rdValue ${scobj_hpath} @@ -640,6 +790,15 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/ch2/v_ramp type "part" hsetprop ${scobj_hpath}/ch2/v_ramp nxalias "${name}_ch2_v_ramp" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/ch2/v_ramp 5 + ${sct_controller} write ${scobj_hpath}/ch2/v_ramp + hsetprop ${scobj_hpath}/ch2/v_ramp simulated false + } else { + ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" + hsetprop ${scobj_hpath}/ch2/v_ramp simulated true + } + hfactory ${scobj_hpath}/ch2/v_sp plain user int hsetprop ${scobj_hpath}/ch2/v_sp read ${ns}::getValue ${scobj_hpath} rdValue {D2} hsetprop ${scobj_hpath}/ch2/v_sp rdValue ${ns}::rdValue ${scobj_hpath} @@ -665,6 +824,15 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/ch2/v_sp type "drivable" hsetprop ${scobj_hpath}/ch2/v_sp nxalias "${name}_ch2_v_sp" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/ch2/v_sp 5 + ${sct_controller} write ${scobj_hpath}/ch2/v_sp + hsetprop ${scobj_hpath}/ch2/v_sp simulated false + } else { + ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" + hsetprop ${scobj_hpath}/ch2/v_sp simulated true + } + hfactory ${scobj_hpath}/ch2/voltage plain user int hsetprop ${scobj_hpath}/ch2/voltage read ${ns}::getValue ${scobj_hpath} rdVoltage {U2} hsetprop ${scobj_hpath}/ch2/voltage rdVoltage ${ns}::rdVoltage ${scobj_hpath} @@ -679,31 +847,19 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_fl hsetprop ${scobj_hpath}/ch2/voltage nxalias "${name}_ch2_voltage" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/ch2/auto_start 5 - ${sct_controller} poll ${scobj_hpath}/ch2/current 5 - ${sct_controller} poll ${scobj_hpath}/ch2/i_lim 5 - ${sct_controller} poll ${scobj_hpath}/ch2/i_trip 5 - ${sct_controller} poll ${scobj_hpath}/ch2/module 5 - ${sct_controller} poll ${scobj_hpath}/ch2/status 5 - ${sct_controller} poll ${scobj_hpath}/ch2/v_lim 5 - ${sct_controller} poll ${scobj_hpath}/ch2/v_ramp 5 - ${sct_controller} poll ${scobj_hpath}/ch2/v_sp 5 ${sct_controller} poll ${scobj_hpath}/ch2/voltage 5 - ${sct_controller} write ${scobj_hpath}/ch2/auto_start - ${sct_controller} write ${scobj_hpath}/ch2/go - ${sct_controller} write ${scobj_hpath}/ch2/i_trip - ${sct_controller} write ${scobj_hpath}/ch2/v_ramp - ${sct_controller} write ${scobj_hpath}/ch2/v_sp + hsetprop ${scobj_hpath}/ch2/voltage simulated false } else { ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200" + hsetprop ${scobj_hpath}/ch2/voltage simulated true } + hsetprop ${scobj_hpath}/ch2 data "true" + hsetprop ${scobj_hpath}/ch2 klass "@none" + hsetprop ${scobj_hpath}/ch2 type "part" + ansto_makesctdrive ${name}_ch2_v_sp ${scobj_hpath}/ch2/v_sp ${scobj_hpath}/ch2/voltage ${sct_controller} 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}_ch1_v_sp ${scobj_hpath}/ch1/v_sp ${scobj_hpath}/ch1/voltage ${sct_controller} - ansto_makesctdrive ${name}_ch2_v_sp ${scobj_hpath}/ch2/v_sp ${scobj_hpath}/ch2/voltage ${sct_controller} - } # mkDriver hook code goes here } catch_message ] handle_exception ${catch_status} ${catch_message} @@ -721,7 +877,9 @@ proc ::scobj::nhq_200::add_driver {name device_class simulation_flag ip_address makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::nhq_200::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for nhq_200" + ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for nhq_200" + ::scobj::nhq_200::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::nhq_200::sics_log 1 "::scobj::nhq_200::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}" ::scobj::nhq_200::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} @@ -739,7 +897,7 @@ namespace eval ::scobj::nhq_200 { proc add_nhq_200 {name ip_address tcp_port} { set simulation_flag "[string tolower [SplitReply [detector_simulation]]]" - ::scobj::nhq_200::add_driver ${name} "NXdetector" "${simulation_flag}" ${ip_address} ${tcp_port} + ::scobj::nhq_200::add_driver ${name} "NXdetector" ${simulation_flag} ${ip_address} ${tcp_port} } clientput "file evaluation of sct_nhq_200.tcl" @@ -778,20 +936,31 @@ proc ::scobj::nhq_200::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"]" } } @@ -802,12 +971,9 @@ proc ::scobj::nhq_200::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/sct_omron_hldc.tcl b/site_ansto/instrument/config/environment/sct_omron_hldc.tcl index d78fffb3..7fc25189 100644 --- a/site_ansto/instrument/config/environment/sct_omron_hldc.tcl +++ b/site_ansto/instrument/config/environment/sct_omron_hldc.tcl @@ -215,6 +215,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 +236,17 @@ 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} klass ${device_class} hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} debug_threshold 5 @@ -258,7 +267,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 +287,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 +326,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 +361,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/sct_protekmm.tcl b/site_ansto/instrument/config/environment/sct_protekmm.tcl index c0be60ee..fa30a279 100644 --- a/site_ansto/instrument/config/environment/sct_protekmm.tcl +++ b/site_ansto/instrument/config/environment/sct_protekmm.tcl @@ -60,7 +60,9 @@ proc ::scobj::protekmm::add_driver {name device_class simulation_flag ip_address makesctcontroller sct_${name} protek608 ${ip_address}:${tcp_port} } } else { - ::scobj::protekmm::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for protekmm" + ::scobj::protekmm::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for protekmm" + ::scobj::protekmm::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::protekmm::sics_log 1 "::scobj::protekmm::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype}" ::scobj::protekmm::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} @@ -78,7 +80,7 @@ namespace eval ::scobj::protekmm { proc add_protekmm {name ip_address tcp_port id datype} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::protekmm::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}" "${datype}" + ::scobj::protekmm::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} } clientput "file evaluation of sct_protekmm.tcl" @@ -117,20 +119,31 @@ proc ::scobj::protekmm::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} protek608 ${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"]" } } @@ -141,6 +154,7 @@ proc ::scobj::protekmm::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } set arg_list [list] set missing_list [list] @@ -157,11 +171,7 @@ proc ::scobj::protekmm::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list - } + ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list } } } diff --git a/site_ansto/instrument/config/environment/sct_syringe_pump.tcl b/site_ansto/instrument/config/environment/sct_syringe_pump.tcl index dd4a923d..37969f1b 100644 --- a/site_ansto/instrument/config/environment/sct_syringe_pump.tcl +++ b/site_ansto/instrument/config/environment/sct_syringe_pump.tcl @@ -51,7 +51,9 @@ proc ::scobj::syringe_pump::add_driver {name device_class simulation_flag ip_add makesctcontroller sct_${name} syringe ${ip_address}:${tcp_port} } } else { - ::scobj::syringe_pump::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for syringe_pump" + ::scobj::syringe_pump::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for syringe_pump" + ::scobj::syringe_pump::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::syringe_pump::sics_log 1 "::scobj::syringe_pump::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype}" ::scobj::syringe_pump::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} @@ -69,7 +71,7 @@ namespace eval ::scobj::syringe_pump { proc add_syringe_pump {name ip_address tcp_port id datype} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::syringe_pump::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}" "${datype}" + ::scobj::syringe_pump::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} } clientput "file evaluation of sct_syringe_pump.tcl" @@ -108,20 +110,31 @@ proc ::scobj::syringe_pump::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} syringe ${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"]" } } @@ -132,6 +145,7 @@ proc ::scobj::syringe_pump::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } set arg_list [list] set missing_list [list] @@ -148,11 +162,7 @@ proc ::scobj::syringe_pump::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_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_eurotherm_3200.tcl b/site_ansto/instrument/config/environment/temperature/sct_eurotherm_3200.tcl index bf629afc..690f4227 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_eurotherm_3200.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_eurotherm_3200.tcl @@ -86,7 +86,12 @@ proc ::scobj::eurotherm_3200::checkstatus {tc_root} { # checkstatus hook code goes here if {[sct driving]} { set sp "[sct target]" - set pv "[hval ${tc_root}/[sct driveable]]" + if {[hpropexists [sct] simulated] && [sct simulated] == "true"} { + set pv "${sp}" + hupdateif ${tc_root}/[sct driveable] ${sp} + } + set pv "[hval ${tc_root}/[sct driveable]]" + } if { abs(${pv} - ${sp}) <= [sct tolerance] } { if { [hpropexists [sct] settle_time] } { if { [hpropexists [sct] settle_time_start] } { @@ -237,9 +242,6 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula set scobj_hpath /sics/${name} hfactory ${scobj_hpath}/loop1 plain spy none - hsetprop ${scobj_hpath}/loop1 data "true" - hsetprop ${scobj_hpath}/loop1 klass "@none" - hsetprop ${scobj_hpath}/loop1 type "part" hfactory ${scobj_hpath}/loop1/sensor plain user float hsetprop ${scobj_hpath}/loop1/sensor read ${ns}::getValue ${scobj_hpath} rdValue {1} @@ -256,6 +258,14 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula hsetprop ${scobj_hpath}/loop1/sensor type "part" hsetprop ${scobj_hpath}/loop1/sensor nxalias "${name}_loop1_sensor" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/loop1/sensor 1 + hsetprop ${scobj_hpath}/loop1/sensor simulated false + } else { + ::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200" + hsetprop ${scobj_hpath}/loop1/sensor simulated true + } + hfactory ${scobj_hpath}/loop1/setpoint plain user float hsetprop ${scobj_hpath}/loop1/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {2} hsetprop ${scobj_hpath}/loop1/setpoint rdValue ${ns}::rdValue ${scobj_hpath} @@ -283,17 +293,19 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula hsetprop ${scobj_hpath}/loop1/setpoint nxalias "${name}_loop1_setpoint" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/loop1/sensor 1 ${sct_controller} poll ${scobj_hpath}/loop1/setpoint 1 ${sct_controller} write ${scobj_hpath}/loop1/setpoint + hsetprop ${scobj_hpath}/loop1/setpoint simulated false } else { ::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200" + hsetprop ${scobj_hpath}/loop1/setpoint simulated true } + hsetprop ${scobj_hpath}/loop1 data "true" + hsetprop ${scobj_hpath}/loop1 klass "@none" + hsetprop ${scobj_hpath}/loop1 type "part" + ansto_makesctdrive ${name}_loop1_setpoint ${scobj_hpath}/loop1/setpoint ${scobj_hpath}/loop1/sensor ${sct_controller} hfactory ${scobj_hpath}/loop1_extra plain spy none - hsetprop ${scobj_hpath}/loop1_extra data "false" - hsetprop ${scobj_hpath}/loop1_extra klass "@none" - hsetprop ${scobj_hpath}/loop1_extra type "part" hfactory ${scobj_hpath}/loop1_extra/active_setpoint plain user float hsetprop ${scobj_hpath}/loop1_extra/active_setpoint read ${ns}::getValue ${scobj_hpath} rdValue {15} @@ -307,6 +319,14 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula hsetprop ${scobj_hpath}/loop1_extra/active_setpoint type "part" hsetprop ${scobj_hpath}/loop1_extra/active_setpoint nxalias "${name}_loop1_extra_active_setpoint" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/loop1_extra/active_setpoint 1 + hsetprop ${scobj_hpath}/loop1_extra/active_setpoint simulated false + } else { + ::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200" + hsetprop ${scobj_hpath}/loop1_extra/active_setpoint simulated true + } + hfactory ${scobj_hpath}/loop1_extra/alarm1_thresh plain user float hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh read ${ns}::getValue ${scobj_hpath} rdValue {13} hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh rdValue ${ns}::rdValue ${scobj_hpath} @@ -322,6 +342,15 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh type "part" hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh nxalias "${name}_loop1_extra_alarm1_thresh" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/loop1_extra/alarm1_thresh 1 + ${sct_controller} write ${scobj_hpath}/loop1_extra/alarm1_thresh + hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh simulated false + } else { + ::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200" + hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh simulated true + } + hfactory ${scobj_hpath}/loop1_extra/alarm2_thresh plain user float hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh read ${ns}::getValue ${scobj_hpath} rdValue {14} hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh rdValue ${ns}::rdValue ${scobj_hpath} @@ -337,6 +366,15 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh type "part" hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh nxalias "${name}_loop1_extra_alarm2_thresh" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/loop1_extra/alarm2_thresh 1 + ${sct_controller} write ${scobj_hpath}/loop1_extra/alarm2_thresh + hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh simulated false + } else { + ::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200" + hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh simulated true + } + hfactory ${scobj_hpath}/loop1_extra/manual_output plain user float hsetprop ${scobj_hpath}/loop1_extra/manual_output read ${ns}::getValue ${scobj_hpath} rdValue {3} hsetprop ${scobj_hpath}/loop1_extra/manual_output rdValue ${ns}::rdValue ${scobj_hpath} @@ -349,6 +387,14 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula hsetprop ${scobj_hpath}/loop1_extra/manual_output type "part" hsetprop ${scobj_hpath}/loop1_extra/manual_output nxalias "${name}_loop1_extra_manual_output" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/loop1_extra/manual_output 1 + hsetprop ${scobj_hpath}/loop1_extra/manual_output simulated false + } else { + ::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200" + hsetprop ${scobj_hpath}/loop1_extra/manual_output simulated true + } + hfactory ${scobj_hpath}/loop1_extra/power_limit_high plain user float hsetprop ${scobj_hpath}/loop1_extra/power_limit_high read ${ns}::getValue ${scobj_hpath} rdValue {30} hsetprop ${scobj_hpath}/loop1_extra/power_limit_high rdValue ${ns}::rdValue ${scobj_hpath} @@ -364,6 +410,15 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula hsetprop ${scobj_hpath}/loop1_extra/power_limit_high type "part" hsetprop ${scobj_hpath}/loop1_extra/power_limit_high nxalias "${name}_loop1_extra_power_limit_high" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/loop1_extra/power_limit_high 1 + ${sct_controller} write ${scobj_hpath}/loop1_extra/power_limit_high + hsetprop ${scobj_hpath}/loop1_extra/power_limit_high simulated false + } else { + ::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200" + hsetprop ${scobj_hpath}/loop1_extra/power_limit_high simulated true + } + hfactory ${scobj_hpath}/loop1_extra/power_limit_low plain user float hsetprop ${scobj_hpath}/loop1_extra/power_limit_low read ${ns}::getValue ${scobj_hpath} rdValue {31} hsetprop ${scobj_hpath}/loop1_extra/power_limit_low rdValue ${ns}::rdValue ${scobj_hpath} @@ -379,6 +434,15 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula hsetprop ${scobj_hpath}/loop1_extra/power_limit_low type "part" hsetprop ${scobj_hpath}/loop1_extra/power_limit_low nxalias "${name}_loop1_extra_power_limit_low" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/loop1_extra/power_limit_low 1 + ${sct_controller} write ${scobj_hpath}/loop1_extra/power_limit_low + hsetprop ${scobj_hpath}/loop1_extra/power_limit_low simulated false + } else { + ::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200" + hsetprop ${scobj_hpath}/loop1_extra/power_limit_low simulated true + } + hfactory ${scobj_hpath}/loop1_extra/power_slew_rate plain user float hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate read ${ns}::getValue ${scobj_hpath} rdValue {37} hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate rdValue ${ns}::rdValue ${scobj_hpath} @@ -394,6 +458,15 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate type "part" hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate nxalias "${name}_loop1_extra_power_slew_rate" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/loop1_extra/power_slew_rate 1 + ${sct_controller} write ${scobj_hpath}/loop1_extra/power_slew_rate + hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate simulated false + } else { + ::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200" + hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate simulated true + } + hfactory ${scobj_hpath}/loop1_extra/setpoint_slew_rate plain user float hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate read ${ns}::getValue ${scobj_hpath} rdValue {35} hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate rdValue ${ns}::rdValue ${scobj_hpath} @@ -409,6 +482,15 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate type "part" hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate nxalias "${name}_loop1_extra_setpoint_slew_rate" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/loop1_extra/setpoint_slew_rate 1 + ${sct_controller} write ${scobj_hpath}/loop1_extra/setpoint_slew_rate + hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate simulated false + } else { + ::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200" + hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate simulated true + } + hfactory ${scobj_hpath}/loop1_extra/working_output plain user float hsetprop ${scobj_hpath}/loop1_extra/working_output read ${ns}::getValue ${scobj_hpath} rdValue {4} hsetprop ${scobj_hpath}/loop1_extra/working_output rdValue ${ns}::rdValue ${scobj_hpath} @@ -421,6 +503,14 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula hsetprop ${scobj_hpath}/loop1_extra/working_output type "part" hsetprop ${scobj_hpath}/loop1_extra/working_output nxalias "${name}_loop1_extra_working_output" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/loop1_extra/working_output 1 + hsetprop ${scobj_hpath}/loop1_extra/working_output simulated false + } else { + ::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200" + hsetprop ${scobj_hpath}/loop1_extra/working_output simulated true + } + hfactory ${scobj_hpath}/loop1_extra/working_setpoint plain user float hsetprop ${scobj_hpath}/loop1_extra/working_setpoint read ${ns}::getValue ${scobj_hpath} rdValue {5} hsetprop ${scobj_hpath}/loop1_extra/working_setpoint rdValue ${ns}::rdValue ${scobj_hpath} @@ -434,30 +524,17 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula hsetprop ${scobj_hpath}/loop1_extra/working_setpoint nxalias "${name}_loop1_extra_working_setpoint" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/loop1_extra/active_setpoint 1 - ${sct_controller} poll ${scobj_hpath}/loop1_extra/alarm1_thresh 1 - ${sct_controller} poll ${scobj_hpath}/loop1_extra/alarm2_thresh 1 - ${sct_controller} poll ${scobj_hpath}/loop1_extra/manual_output 1 - ${sct_controller} poll ${scobj_hpath}/loop1_extra/power_limit_high 1 - ${sct_controller} poll ${scobj_hpath}/loop1_extra/power_limit_low 1 - ${sct_controller} poll ${scobj_hpath}/loop1_extra/power_slew_rate 1 - ${sct_controller} poll ${scobj_hpath}/loop1_extra/setpoint_slew_rate 1 - ${sct_controller} poll ${scobj_hpath}/loop1_extra/working_output 1 ${sct_controller} poll ${scobj_hpath}/loop1_extra/working_setpoint 1 - ${sct_controller} write ${scobj_hpath}/loop1_extra/alarm1_thresh - ${sct_controller} write ${scobj_hpath}/loop1_extra/alarm2_thresh - ${sct_controller} write ${scobj_hpath}/loop1_extra/power_limit_high - ${sct_controller} write ${scobj_hpath}/loop1_extra/power_limit_low - ${sct_controller} write ${scobj_hpath}/loop1_extra/power_slew_rate - ${sct_controller} write ${scobj_hpath}/loop1_extra/setpoint_slew_rate + hsetprop ${scobj_hpath}/loop1_extra/working_setpoint simulated false } else { ::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200" + hsetprop ${scobj_hpath}/loop1_extra/working_setpoint simulated true } + hsetprop ${scobj_hpath}/loop1_extra data "false" + hsetprop ${scobj_hpath}/loop1_extra klass "@none" + hsetprop ${scobj_hpath}/loop1_extra type "part" hfactory ${scobj_hpath}/util plain spy none - hsetprop ${scobj_hpath}/util data "false" - hsetprop ${scobj_hpath}/util klass "@none" - hsetprop ${scobj_hpath}/util type "part" hfactory ${scobj_hpath}/util/mode plain user text hsetprop ${scobj_hpath}/util/mode control false @@ -481,12 +558,12 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula hsetprop ${scobj_hpath}/util/unit sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/util/unit type "part" hsetprop ${scobj_hpath}/util/unit nxalias "${name}_util_unit" + hsetprop ${scobj_hpath}/util data "false" + hsetprop ${scobj_hpath}/util klass "@none" + hsetprop ${scobj_hpath}/util type "part" 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}_loop1_setpoint ${scobj_hpath}/loop1/setpoint ${scobj_hpath}/loop1/sensor ${sct_controller} - } # mkDriver hook code goes here } catch_message ] handle_exception ${catch_status} ${catch_message} @@ -504,7 +581,9 @@ proc ::scobj::eurotherm_3200::add_driver {name device_class simulation_flag ip_a makesctcontroller sct_${name} modbus_ap ${ip_address}:${tcp_port} } } else { - ::scobj::eurotherm_3200::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for eurotherm_3200" + ::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for eurotherm_3200" + ::scobj::eurotherm_3200::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::eurotherm_3200::sics_log 1 "::scobj::eurotherm_3200::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}" ::scobj::eurotherm_3200::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol} @@ -522,7 +601,7 @@ namespace eval ::scobj::eurotherm_3200 { proc add_eurotherm_3200 {name ip_address tcp_port id datype dev_id tol} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::eurotherm_3200::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}" "${datype}" "${dev_id}" "${tol}" + ::scobj::eurotherm_3200::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol} } clientput "file evaluation of sct_eurotherm_3200.tcl" @@ -561,20 +640,31 @@ proc ::scobj::eurotherm_3200::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} modbus_ap ${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"]" } } @@ -585,6 +675,7 @@ proc ::scobj::eurotherm_3200::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } set arg_list [list] set missing_list [list] @@ -601,11 +692,7 @@ proc ::scobj::eurotherm_3200::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_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_eurotherm_m2000.tcl b/site_ansto/instrument/config/environment/temperature/sct_eurotherm_m2000.tcl index 37c7c852..54ab2503 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_eurotherm_m2000.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_eurotherm_m2000.tcl @@ -60,7 +60,9 @@ proc ::scobj::eurotherm_m2000::add_driver {name device_class simulation_flag ip_ makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::eurotherm_m2000::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for eurotherm_m2000" + ::scobj::eurotherm_m2000::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for eurotherm_m2000" + ::scobj::eurotherm_m2000::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::eurotherm_m2000::sics_log 1 "::scobj::eurotherm_m2000::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}" ::scobj::eurotherm_m2000::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol} @@ -78,7 +80,7 @@ namespace eval ::scobj::eurotherm_m2000 { proc add_eurotherm_m2000 {name ip_address tcp_port id datype dev_id tol} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::eurotherm_m2000::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}" "${datype}" "${dev_id}" "${tol}" + ::scobj::eurotherm_m2000::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol} } clientput "file evaluation of sct_eurotherm_m2000.tcl" @@ -117,20 +119,31 @@ proc ::scobj::eurotherm_m2000::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"]" } } @@ -141,6 +154,7 @@ proc ::scobj::eurotherm_m2000::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } set arg_list [list] set missing_list [list] @@ -157,11 +171,7 @@ proc ::scobj::eurotherm_m2000::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_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_julabo_lh45_gen.tcl b/site_ansto/instrument/config/environment/temperature/sct_julabo_lh45_gen.tcl index aa790cec..708ef71e 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 @@ -86,7 +86,12 @@ proc ::scobj::julabo_lh45_gen::checkstatus {tc_root} { # checkstatus hook code goes here if {[sct driving]} { set sp "[sct target]" - set pv "[hval ${tc_root}/[sct driveable]]" + if {[hpropexists [sct] simulated] && [sct simulated] == "true"} { + set pv "${sp}" + hupdateif ${tc_root}/[sct driveable] ${sp} + } + set pv "[hval ${tc_root}/[sct driveable]]" + } if { abs(${pv} - ${sp}) <= [sct tolerance] } { if { [hpropexists [sct] settle_time] } { if { [hpropexists [sct] settle_time_start] } { @@ -389,6 +394,14 @@ proc ::scobj::julabo_lh45_gen::mkDriver { sct_controller name device_class simul hsetprop ${scobj_hpath}/heating_power_percent type "part" hsetprop ${scobj_hpath}/heating_power_percent nxalias "${name}_heating_power_percent" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/heating_power_percent 1 + hsetprop ${scobj_hpath}/heating_power_percent simulated false + } else { + ::scobj::julabo_lh45_gen::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for julabo_lh45_gen" + hsetprop ${scobj_hpath}/heating_power_percent simulated true + } + hfactory ${scobj_hpath}/lh45_lasterror plain user text hsetprop ${scobj_hpath}/lh45_lasterror control true hsetprop ${scobj_hpath}/lh45_lasterror data true @@ -413,6 +426,14 @@ proc ::scobj::julabo_lh45_gen::mkDriver { sct_controller name device_class simul hsetprop ${scobj_hpath}/lh45_state type "part" hsetprop ${scobj_hpath}/lh45_state nxalias "${name}_lh45_state" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/lh45_state 1 + hsetprop ${scobj_hpath}/lh45_state simulated false + } else { + ::scobj::julabo_lh45_gen::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for julabo_lh45_gen" + hsetprop ${scobj_hpath}/lh45_state simulated true + } + hfactory ${scobj_hpath}/overtemp_warnlimit plain user float hsetprop ${scobj_hpath}/overtemp_warnlimit read ${ns}::getValue ${scobj_hpath} rdValue {in_sp_03} hsetprop ${scobj_hpath}/overtemp_warnlimit rdValue ${ns}::rdValue ${scobj_hpath} @@ -426,6 +447,14 @@ proc ::scobj::julabo_lh45_gen::mkDriver { sct_controller name device_class simul hsetprop ${scobj_hpath}/overtemp_warnlimit type "part" hsetprop ${scobj_hpath}/overtemp_warnlimit nxalias "${name}_overtemp_warnlimit" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/overtemp_warnlimit 1 + hsetprop ${scobj_hpath}/overtemp_warnlimit simulated false + } else { + ::scobj::julabo_lh45_gen::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for julabo_lh45_gen" + hsetprop ${scobj_hpath}/overtemp_warnlimit simulated true + } + hfactory ${scobj_hpath}/remote_ctrl plain spy text hsetprop ${scobj_hpath}/remote_ctrl control true hsetprop ${scobj_hpath}/remote_ctrl data true @@ -464,6 +493,15 @@ proc ::scobj::julabo_lh45_gen::mkDriver { sct_controller name device_class simul hsetprop ${scobj_hpath}/setpoint units "C" hsetprop ${scobj_hpath}/setpoint nxalias "${name}_setpoint" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/setpoint 1 + ${sct_controller} write ${scobj_hpath}/setpoint + hsetprop ${scobj_hpath}/setpoint simulated false + } else { + ::scobj::julabo_lh45_gen::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for julabo_lh45_gen" + hsetprop ${scobj_hpath}/setpoint simulated true + } + hfactory ${scobj_hpath}/subtemp_warnlimit plain user float hsetprop ${scobj_hpath}/subtemp_warnlimit read ${ns}::getValue ${scobj_hpath} rdValue {in_sp_04} hsetprop ${scobj_hpath}/subtemp_warnlimit rdValue ${ns}::rdValue ${scobj_hpath} @@ -477,25 +515,20 @@ proc ::scobj::julabo_lh45_gen::mkDriver { sct_controller name device_class simul hsetprop ${scobj_hpath}/subtemp_warnlimit type "part" hsetprop ${scobj_hpath}/subtemp_warnlimit nxalias "${name}_subtemp_warnlimit" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/subtemp_warnlimit 1 + hsetprop ${scobj_hpath}/subtemp_warnlimit simulated false + } else { + ::scobj::julabo_lh45_gen::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for julabo_lh45_gen" + hsetprop ${scobj_hpath}/subtemp_warnlimit 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}/heating_power_percent 1 - ${sct_controller} poll ${scobj_hpath}/lh45_state 1 - ${sct_controller} poll ${scobj_hpath}/overtemp_warnlimit 1 - ${sct_controller} poll ${scobj_hpath}/setpoint 1 - ${sct_controller} poll ${scobj_hpath}/subtemp_warnlimit 1 - ${sct_controller} write ${scobj_hpath}/setpoint - } else { - ::scobj::julabo_lh45_gen::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for julabo_lh45_gen" - } + ansto_makesctdrive ${name}_setpoint ${scobj_hpath}/setpoint ${scobj_hpath}/sensor/value ${sct_controller} hfactory ${scobj_hpath}/mode plain spy none - hsetprop ${scobj_hpath}/mode data "true" - hsetprop ${scobj_hpath}/mode klass "@none" - hsetprop ${scobj_hpath}/mode type "part" hfactory ${scobj_hpath}/mode/ext_else_bath plain user int hsetprop ${scobj_hpath}/mode/ext_else_bath read ${ns}::getValue ${scobj_hpath} rdValue {in_mode_04} @@ -513,6 +546,15 @@ proc ::scobj::julabo_lh45_gen::mkDriver { sct_controller name device_class simul hsetprop ${scobj_hpath}/mode/ext_else_bath type "part" hsetprop ${scobj_hpath}/mode/ext_else_bath nxalias "${name}_mode_ext_else_bath" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/mode/ext_else_bath 1 + ${sct_controller} write ${scobj_hpath}/mode/ext_else_bath + hsetprop ${scobj_hpath}/mode/ext_else_bath simulated false + } else { + ::scobj::julabo_lh45_gen::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for julabo_lh45_gen" + hsetprop ${scobj_hpath}/mode/ext_else_bath simulated true + } + hfactory ${scobj_hpath}/mode/on_else_off plain user int hsetprop ${scobj_hpath}/mode/on_else_off read ${ns}::getValue ${scobj_hpath} rdValue {in_mode_05} hsetprop ${scobj_hpath}/mode/on_else_off rdValue ${ns}::rdValue ${scobj_hpath} @@ -530,18 +572,18 @@ proc ::scobj::julabo_lh45_gen::mkDriver { sct_controller name device_class simul hsetprop ${scobj_hpath}/mode/on_else_off nxalias "${name}_mode_on_else_off" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/mode/ext_else_bath 1 ${sct_controller} poll ${scobj_hpath}/mode/on_else_off 1 - ${sct_controller} write ${scobj_hpath}/mode/ext_else_bath ${sct_controller} write ${scobj_hpath}/mode/on_else_off + hsetprop ${scobj_hpath}/mode/on_else_off simulated false } else { ::scobj::julabo_lh45_gen::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for julabo_lh45_gen" + hsetprop ${scobj_hpath}/mode/on_else_off simulated true } + hsetprop ${scobj_hpath}/mode data "true" + hsetprop ${scobj_hpath}/mode klass "@none" + hsetprop ${scobj_hpath}/mode type "part" hfactory ${scobj_hpath}/sensor plain spy none - hsetprop ${scobj_hpath}/sensor data "true" - hsetprop ${scobj_hpath}/sensor klass "@none" - hsetprop ${scobj_hpath}/sensor type "part" hfactory ${scobj_hpath}/sensor/bathtemp plain internal float hsetprop ${scobj_hpath}/sensor/bathtemp read ${ns}::getValue ${scobj_hpath} rdSensor {in_pv_00} @@ -558,6 +600,14 @@ proc ::scobj::julabo_lh45_gen::mkDriver { sct_controller name device_class simul hsetprop ${scobj_hpath}/sensor/bathtemp units "C" hsetprop ${scobj_hpath}/sensor/bathtemp nxalias "${name}_sensor_bathtemp" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor/bathtemp 1 + hsetprop ${scobj_hpath}/sensor/bathtemp simulated false + } else { + ::scobj::julabo_lh45_gen::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for julabo_lh45_gen" + hsetprop ${scobj_hpath}/sensor/bathtemp simulated true + } + hfactory ${scobj_hpath}/sensor/end_temperature plain internal float hsetprop ${scobj_hpath}/sensor/end_temperature control true hsetprop ${scobj_hpath}/sensor/end_temperature data true @@ -585,6 +635,14 @@ proc ::scobj::julabo_lh45_gen::mkDriver { sct_controller name device_class simul hsetprop ${scobj_hpath}/sensor/external units "C" hsetprop ${scobj_hpath}/sensor/external nxalias "${name}_sensor_external" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor/external 1 + hsetprop ${scobj_hpath}/sensor/external simulated false + } else { + ::scobj::julabo_lh45_gen::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for julabo_lh45_gen" + hsetprop ${scobj_hpath}/sensor/external simulated true + } + hfactory ${scobj_hpath}/sensor/start_temperature plain internal float hsetprop ${scobj_hpath}/sensor/start_temperature control true hsetprop ${scobj_hpath}/sensor/start_temperature data true @@ -610,19 +668,12 @@ proc ::scobj::julabo_lh45_gen::mkDriver { sct_controller name device_class simul hsetprop ${scobj_hpath}/sensor/value type "part" hsetprop ${scobj_hpath}/sensor/value units "C" hsetprop ${scobj_hpath}/sensor/value nxalias "${name}_sensor_value" - - if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/sensor/bathtemp 1 - ${sct_controller} poll ${scobj_hpath}/sensor/external 1 - } else { - ::scobj::julabo_lh45_gen::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for julabo_lh45_gen" - } + hsetprop ${scobj_hpath}/sensor data "true" + hsetprop ${scobj_hpath}/sensor klass "@none" + hsetprop ${scobj_hpath}/sensor type "part" 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/value ${sct_controller} - } # mkDriver hook code starts if { ${ctrl_sensor} == "external" } { hset ${scobj_hpath}/mode/ext_else_bath 1 @@ -647,7 +698,9 @@ proc ::scobj::julabo_lh45_gen::add_driver {name device_class simulation_flag ip_ makesctcontroller sct_${name} std ${ip_address}:${tcp_port} "\r" } } else { - ::scobj::julabo_lh45_gen::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for julabo_lh45_gen" + ::scobj::julabo_lh45_gen::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for julabo_lh45_gen" + ::scobj::julabo_lh45_gen::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::julabo_lh45_gen::sics_log 1 "::scobj::julabo_lh45_gen::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${ctrl_sensor} ${tol}" ::scobj::julabo_lh45_gen::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${ctrl_sensor} ${tol} @@ -665,7 +718,7 @@ namespace eval ::scobj::julabo_lh45_gen { proc add_julabo_lh45_gen {name ip_address tcp_port {id 1} {ctrl_sensor "bath"} {tol 5.0}} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::julabo_lh45_gen::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${{id}" "${1}}" "${{ctrl_sensor}" "${"bath"}}" "${{tol}" "${5.0}}" + ::scobj::julabo_lh45_gen::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${ctrl_sensor} ${tol} } clientput "file evaluation of sct_julabo_lh45_gen.tcl" @@ -704,20 +757,50 @@ proc ::scobj::julabo_lh45_gen::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] + set arg_list [list] + set missing_list [list] + array unset default_map + array set default_map [list terminator "\r"] + foreach arg {terminator} { + 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" + } + makesctcontroller sct_${name} std ${ip_address}:${tcp_port} {*}$arg_list + } 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"]" } } @@ -728,6 +811,7 @@ proc ::scobj::julabo_lh45_gen::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } set arg_list [list] set missing_list [list] @@ -744,11 +828,7 @@ proc ::scobj::julabo_lh45_gen::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_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_218.tcl b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_218.tcl index e0aba1ab..7f78f926 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_218.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_218.tcl @@ -182,20 +182,19 @@ proc ::scobj::lakeshore_218::mkDriver { sct_controller name device_class simulat 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 - 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} @@ -210,6 +209,14 @@ proc ::scobj::lakeshore_218::mkDriver { sct_controller name device_class simulat 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 1 + 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/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} @@ -223,6 +230,14 @@ proc ::scobj::lakeshore_218::mkDriver { sct_controller name device_class simulat 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 1 + 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 + } + 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} @@ -236,6 +251,14 @@ proc ::scobj::lakeshore_218::mkDriver { sct_controller name device_class simulat 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 1 + 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 + } + 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} @@ -249,6 +272,14 @@ proc ::scobj::lakeshore_218::mkDriver { sct_controller name device_class simulat 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 1 + 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 + } + 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} @@ -262,6 +293,14 @@ proc ::scobj::lakeshore_218::mkDriver { sct_controller name device_class simulat 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 1 + 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 + } + 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} @@ -275,6 +314,14 @@ proc ::scobj::lakeshore_218::mkDriver { sct_controller name device_class simulat 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 1 + 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 + } + 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} @@ -288,6 +335,14 @@ proc ::scobj::lakeshore_218::mkDriver { sct_controller name device_class simulat 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 1 + 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 + } + 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} @@ -302,17 +357,15 @@ proc ::scobj::lakeshore_218::mkDriver { sct_controller name device_class simulat 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 + 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" hsetprop ${scobj_hpath} klass ${device_class} hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} debug_threshold 5 @@ -333,7 +386,9 @@ 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} @@ -351,7 +406,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 +445,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 +480,9 @@ 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} - } + ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} } } } 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 8e6e7de7..ec3b507e 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_m370.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_m370.tcl @@ -64,7 +64,9 @@ proc ::scobj::lakeshore_m370::add_driver {name device_class simulation_flag ip_a 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 9 "simulation_flag=${simulation_flag} => Null sctcontroller for lakeshore_m370" + ::scobj::lakeshore_m370::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::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} @@ -82,7 +84,7 @@ namespace eval ::scobj::lakeshore_m370 { 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}" + ::scobj::lakeshore_m370::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol} } clientput "file evaluation of sct_lakeshore_m370.tcl" @@ -121,20 +123,31 @@ proc ::scobj::lakeshore_m370::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"]" } } @@ -145,6 +158,7 @@ proc ::scobj::lakeshore_m370::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } set arg_list [list] set missing_list [list] @@ -161,11 +175,7 @@ proc ::scobj::lakeshore_m370::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_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_ls336.tcl b/site_ansto/instrument/config/environment/temperature/sct_ls336.tcl index f965579c..92c82679 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_ls336.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_ls336.tcl @@ -60,7 +60,9 @@ proc ::scobj::ls336::add_driver {name device_class simulation_flag ip_address tc makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::ls336::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for ls336" + ::scobj::ls336::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for ls336" + ::scobj::ls336::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::ls336::sics_log 1 "::scobj::ls336::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol1} ${tol2}" ::scobj::ls336::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol1} ${tol2} @@ -78,7 +80,7 @@ namespace eval ::scobj::ls336 { proc add_ls336 {name ip_address tcp_port id datype {tol1 1.0} {tol2 1.0}} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::ls336::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}" "${datype}" "${{tol1}" "${1.0}}" "${{tol2}" "${1.0}}" + ::scobj::ls336::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol1} ${tol2} } clientput "file evaluation of sct_ls336.tcl" @@ -117,20 +119,31 @@ proc ::scobj::ls336::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"]" } } @@ -141,6 +154,7 @@ proc ::scobj::ls336::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } set arg_list [list] set missing_list [list] @@ -157,11 +171,7 @@ proc ::scobj::ls336::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_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_ls340.tcl b/site_ansto/instrument/config/environment/temperature/sct_ls340.tcl index f607f937..ddf1c8c7 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_ls340.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_ls340.tcl @@ -60,7 +60,9 @@ proc ::scobj::ls340::add_driver {name device_class simulation_flag ip_address tc makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::ls340::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for ls340" + ::scobj::ls340::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for ls340" + ::scobj::ls340::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::ls340::sics_log 1 "::scobj::ls340::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol1} ${tol2}" ::scobj::ls340::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol1} ${tol2} @@ -78,7 +80,7 @@ namespace eval ::scobj::ls340 { proc add_ls340 {name ip_address tcp_port id datype {tol1 1.0} {tol2 1.0}} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::ls340::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}" "${datype}" "${{tol1}" "${1.0}}" "${{tol2}" "${1.0}}" + ::scobj::ls340::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol1} ${tol2} } clientput "file evaluation of sct_ls340.tcl" @@ -117,20 +119,31 @@ proc ::scobj::ls340::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"]" } } @@ -141,6 +154,7 @@ proc ::scobj::ls340::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } set arg_list [list] set missing_list [list] @@ -157,11 +171,7 @@ proc ::scobj::ls340::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_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_mercury_base.tcl b/site_ansto/instrument/config/environment/temperature/sct_mercury_base.tcl index ff95de1d..5b2a7d6b 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_mercury_base.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_mercury_base.tcl @@ -86,7 +86,12 @@ proc ::scobj::mercury_base::checkstatus {tc_root} { # checkstatus hook code goes here if {[sct driving]} { set sp "[sct target]" - set pv "[hval ${tc_root}/[sct driveable]]" + if {[hpropexists [sct] simulated] && [sct simulated] == "true"} { + set pv "${sp}" + hupdateif ${tc_root}/[sct driveable] ${sp} + } + set pv "[hval ${tc_root}/[sct driveable]]" + } if { abs(${pv} - ${sp}) <= [sct tolerance] } { if { [hpropexists [sct] settle_time] } { if { [hpropexists [sct] settle_time_start] } { @@ -279,9 +284,6 @@ proc ::scobj::mercury_base::mkDriver { sct_controller name device_class simulati set scobj_hpath /sics/${name} hfactory ${scobj_hpath}/Loop1 plain spy none - hsetprop ${scobj_hpath}/Loop1 data "true" - hsetprop ${scobj_hpath}/Loop1 klass "@none" - hsetprop ${scobj_hpath}/Loop1 type "part" hfactory ${scobj_hpath}/Loop1/nick plain user text hsetprop ${scobj_hpath}/Loop1/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:MB1.T1:TEMP:NICK} @@ -296,6 +298,14 @@ proc ::scobj::mercury_base::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop1/nick type "part" hsetprop ${scobj_hpath}/Loop1/nick nxalias "${name}_Loop1_nick" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop1/nick 15 + hsetprop ${scobj_hpath}/Loop1/nick simulated false + } else { + ::scobj::mercury_base::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_base" + hsetprop ${scobj_hpath}/Loop1/nick simulated true + } + hfactory ${scobj_hpath}/Loop1/power plain user float hsetprop ${scobj_hpath}/Loop1/power read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:MB0.H1:HTR:SIG:POWR} hsetprop ${scobj_hpath}/Loop1/power rdValue ${ns}::rdValue ${scobj_hpath} @@ -309,6 +319,14 @@ proc ::scobj::mercury_base::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop1/power type "part" hsetprop ${scobj_hpath}/Loop1/power nxalias "${name}_Loop1_power" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop1/power 5 + hsetprop ${scobj_hpath}/Loop1/power simulated false + } else { + ::scobj::mercury_base::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_base" + hsetprop ${scobj_hpath}/Loop1/power simulated true + } + hfactory ${scobj_hpath}/Loop1/sensor plain user float hsetprop ${scobj_hpath}/Loop1/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:MB1.T1:TEMP:SIG:TEMP} hsetprop ${scobj_hpath}/Loop1/sensor rdValue ${ns}::rdValue ${scobj_hpath} @@ -324,6 +342,14 @@ proc ::scobj::mercury_base::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop1/sensor type "part" hsetprop ${scobj_hpath}/Loop1/sensor nxalias "${name}_Loop1_sensor" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop1/sensor 1 + hsetprop ${scobj_hpath}/Loop1/sensor simulated false + } else { + ::scobj::mercury_base::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_base" + hsetprop ${scobj_hpath}/Loop1/sensor simulated true + } + hfactory ${scobj_hpath}/Loop1/setpoint plain user float hsetprop ${scobj_hpath}/Loop1/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:MB1.T1:TEMP:LOOP:TSET} hsetprop ${scobj_hpath}/Loop1/setpoint rdValue ${ns}::rdValue ${scobj_hpath} @@ -352,19 +378,19 @@ proc ::scobj::mercury_base::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop1/setpoint nxalias "${name}_Loop1_setpoint" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/Loop1/nick 15 - ${sct_controller} poll ${scobj_hpath}/Loop1/power 5 - ${sct_controller} poll ${scobj_hpath}/Loop1/sensor 1 ${sct_controller} poll ${scobj_hpath}/Loop1/setpoint 5 ${sct_controller} write ${scobj_hpath}/Loop1/setpoint + hsetprop ${scobj_hpath}/Loop1/setpoint simulated false } else { ::scobj::mercury_base::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_base" + hsetprop ${scobj_hpath}/Loop1/setpoint simulated true } + hsetprop ${scobj_hpath}/Loop1 data "true" + hsetprop ${scobj_hpath}/Loop1 klass "@none" + hsetprop ${scobj_hpath}/Loop1 type "part" + ansto_makesctdrive ${name}_Loop1_setpoint ${scobj_hpath}/Loop1/setpoint ${scobj_hpath}/Loop1/sensor ${sct_controller} hfactory ${scobj_hpath}/Loop2 plain spy none - hsetprop ${scobj_hpath}/Loop2 data "true" - hsetprop ${scobj_hpath}/Loop2 klass "@none" - hsetprop ${scobj_hpath}/Loop2 type "part" hfactory ${scobj_hpath}/Loop2/nick plain user text hsetprop ${scobj_hpath}/Loop2/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB6.T1:TEMP:NICK} @@ -379,6 +405,14 @@ proc ::scobj::mercury_base::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop2/nick type "part" hsetprop ${scobj_hpath}/Loop2/nick nxalias "${name}_Loop2_nick" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop2/nick 15 + hsetprop ${scobj_hpath}/Loop2/nick simulated false + } else { + ::scobj::mercury_base::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_base" + hsetprop ${scobj_hpath}/Loop2/nick simulated true + } + hfactory ${scobj_hpath}/Loop2/power plain user float hsetprop ${scobj_hpath}/Loop2/power read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB1.H1:HTR:SIG:POWR} hsetprop ${scobj_hpath}/Loop2/power rdValue ${ns}::rdValue ${scobj_hpath} @@ -392,6 +426,14 @@ proc ::scobj::mercury_base::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop2/power type "part" hsetprop ${scobj_hpath}/Loop2/power nxalias "${name}_Loop2_power" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop2/power 5 + hsetprop ${scobj_hpath}/Loop2/power simulated false + } else { + ::scobj::mercury_base::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_base" + hsetprop ${scobj_hpath}/Loop2/power simulated true + } + hfactory ${scobj_hpath}/Loop2/sensor plain user float hsetprop ${scobj_hpath}/Loop2/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB6.T1:TEMP:SIG:TEMP} hsetprop ${scobj_hpath}/Loop2/sensor rdValue ${ns}::rdValue ${scobj_hpath} @@ -407,6 +449,14 @@ proc ::scobj::mercury_base::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop2/sensor type "part" hsetprop ${scobj_hpath}/Loop2/sensor nxalias "${name}_Loop2_sensor" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop2/sensor 1 + hsetprop ${scobj_hpath}/Loop2/sensor simulated false + } else { + ::scobj::mercury_base::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_base" + hsetprop ${scobj_hpath}/Loop2/sensor simulated true + } + hfactory ${scobj_hpath}/Loop2/setpoint plain user float hsetprop ${scobj_hpath}/Loop2/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB6.T1:TEMP:LOOP:TSET} hsetprop ${scobj_hpath}/Loop2/setpoint rdValue ${ns}::rdValue ${scobj_hpath} @@ -435,19 +485,19 @@ proc ::scobj::mercury_base::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop2/setpoint nxalias "${name}_Loop2_setpoint" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/Loop2/nick 15 - ${sct_controller} poll ${scobj_hpath}/Loop2/power 5 - ${sct_controller} poll ${scobj_hpath}/Loop2/sensor 1 ${sct_controller} poll ${scobj_hpath}/Loop2/setpoint 5 ${sct_controller} write ${scobj_hpath}/Loop2/setpoint + hsetprop ${scobj_hpath}/Loop2/setpoint simulated false } else { ::scobj::mercury_base::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_base" + hsetprop ${scobj_hpath}/Loop2/setpoint simulated true } + hsetprop ${scobj_hpath}/Loop2 data "true" + hsetprop ${scobj_hpath}/Loop2 klass "@none" + hsetprop ${scobj_hpath}/Loop2 type "part" + ansto_makesctdrive ${name}_Loop2_setpoint ${scobj_hpath}/Loop2/setpoint ${scobj_hpath}/Loop2/sensor ${sct_controller} hfactory ${scobj_hpath}/Loop3 plain spy none - hsetprop ${scobj_hpath}/Loop3 data "true" - hsetprop ${scobj_hpath}/Loop3 klass "@none" - hsetprop ${scobj_hpath}/Loop3 type "part" hfactory ${scobj_hpath}/Loop3/nick plain user text hsetprop ${scobj_hpath}/Loop3/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB7.T1:TEMP:NICK} @@ -462,6 +512,14 @@ proc ::scobj::mercury_base::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop3/nick type "part" hsetprop ${scobj_hpath}/Loop3/nick nxalias "${name}_Loop3_nick" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop3/nick 15 + hsetprop ${scobj_hpath}/Loop3/nick simulated false + } else { + ::scobj::mercury_base::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_base" + hsetprop ${scobj_hpath}/Loop3/nick simulated true + } + hfactory ${scobj_hpath}/Loop3/power plain user float hsetprop ${scobj_hpath}/Loop3/power read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB2.H1:HTR:SIG:POWR} hsetprop ${scobj_hpath}/Loop3/power rdValue ${ns}::rdValue ${scobj_hpath} @@ -475,6 +533,14 @@ proc ::scobj::mercury_base::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop3/power type "part" hsetprop ${scobj_hpath}/Loop3/power nxalias "${name}_Loop3_power" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop3/power 5 + hsetprop ${scobj_hpath}/Loop3/power simulated false + } else { + ::scobj::mercury_base::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_base" + hsetprop ${scobj_hpath}/Loop3/power simulated true + } + hfactory ${scobj_hpath}/Loop3/sensor plain user float hsetprop ${scobj_hpath}/Loop3/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB7.T1:TEMP:SIG:TEMP} hsetprop ${scobj_hpath}/Loop3/sensor rdValue ${ns}::rdValue ${scobj_hpath} @@ -490,6 +556,14 @@ proc ::scobj::mercury_base::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop3/sensor type "part" hsetprop ${scobj_hpath}/Loop3/sensor nxalias "${name}_Loop3_sensor" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop3/sensor 1 + hsetprop ${scobj_hpath}/Loop3/sensor simulated false + } else { + ::scobj::mercury_base::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_base" + hsetprop ${scobj_hpath}/Loop3/sensor simulated true + } + hfactory ${scobj_hpath}/Loop3/setpoint plain user float hsetprop ${scobj_hpath}/Loop3/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB7.T1:TEMP:LOOP:TSET} hsetprop ${scobj_hpath}/Loop3/setpoint rdValue ${ns}::rdValue ${scobj_hpath} @@ -518,22 +592,20 @@ proc ::scobj::mercury_base::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop3/setpoint nxalias "${name}_Loop3_setpoint" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/Loop3/nick 15 - ${sct_controller} poll ${scobj_hpath}/Loop3/power 5 - ${sct_controller} poll ${scobj_hpath}/Loop3/sensor 1 ${sct_controller} poll ${scobj_hpath}/Loop3/setpoint 5 ${sct_controller} write ${scobj_hpath}/Loop3/setpoint + hsetprop ${scobj_hpath}/Loop3/setpoint simulated false } else { ::scobj::mercury_base::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_base" + hsetprop ${scobj_hpath}/Loop3/setpoint simulated true } + hsetprop ${scobj_hpath}/Loop3 data "true" + hsetprop ${scobj_hpath}/Loop3 klass "@none" + hsetprop ${scobj_hpath}/Loop3 type "part" + ansto_makesctdrive ${name}_Loop3_setpoint ${scobj_hpath}/Loop3/setpoint ${scobj_hpath}/Loop3/sensor ${sct_controller} 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}_Loop1_setpoint ${scobj_hpath}/Loop1/setpoint ${scobj_hpath}/Loop1/sensor ${sct_controller} - ansto_makesctdrive ${name}_Loop2_setpoint ${scobj_hpath}/Loop2/setpoint ${scobj_hpath}/Loop2/sensor ${sct_controller} - ansto_makesctdrive ${name}_Loop3_setpoint ${scobj_hpath}/Loop3/setpoint ${scobj_hpath}/Loop3/sensor ${sct_controller} - } # mkDriver hook code goes here } catch_message ] handle_exception ${catch_status} ${catch_message} @@ -551,7 +623,9 @@ proc ::scobj::mercury_base::add_driver {name device_class simulation_flag ip_add makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::mercury_base::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for mercury_base" + ::scobj::mercury_base::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for mercury_base" + ::scobj::mercury_base::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::mercury_base::sics_log 1 "::scobj::mercury_base::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol}" ::scobj::mercury_base::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol} @@ -569,7 +643,7 @@ namespace eval ::scobj::mercury_base { proc add_mercury_base {name ip_address tcp_port {id 99} {tol 1}} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::mercury_base::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${{id}" "${99}}" "${{tol}" "${1}}" + ::scobj::mercury_base::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol} } clientput "file evaluation of sct_mercury_base.tcl" @@ -608,20 +682,31 @@ proc ::scobj::mercury_base::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"]" } } @@ -632,6 +717,7 @@ proc ::scobj::mercury_base::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } set arg_list [list] set missing_list [list] @@ -648,11 +734,7 @@ proc ::scobj::mercury_base::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_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_mercury_level.tcl b/site_ansto/instrument/config/environment/temperature/sct_mercury_level.tcl index 897c6c71..f995489d 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_mercury_level.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_mercury_level.tcl @@ -150,9 +150,6 @@ proc ::scobj::mercury_level::mkDriver { sct_controller name device_class simulat set scobj_hpath /sics/${name} hfactory ${scobj_hpath}/Level plain spy none - hsetprop ${scobj_hpath}/Level data "true" - hsetprop ${scobj_hpath}/Level klass "@none" - hsetprop ${scobj_hpath}/Level type "part" 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} @@ -169,6 +166,14 @@ proc ::scobj::mercury_level::mkDriver { sct_controller name device_class simulat 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::mercury_level::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_level" + hsetprop ${scobj_hpath}/Level/Helium 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} @@ -185,11 +190,15 @@ proc ::scobj::mercury_level::mkDriver { sct_controller name device_class simulat hsetprop ${scobj_hpath}/Level/Nitrogen nxalias "${name}_Level_Nitrogen" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/Level/Helium 15 ${sct_controller} poll ${scobj_hpath}/Level/Nitrogen 15 + hsetprop ${scobj_hpath}/Level/Nitrogen simulated false } else { ::scobj::mercury_level::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_level" + 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" hsetprop ${scobj_hpath} klass ${device_class} hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} debug_threshold 5 @@ -210,7 +219,9 @@ proc ::scobj::mercury_level::add_driver {name device_class simulation_flag ip_ad makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::mercury_level::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for mercury_level" + ::scobj::mercury_level::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for mercury_level" + ::scobj::mercury_level::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::mercury_level::sics_log 1 "::scobj::mercury_level::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}" ::scobj::mercury_level::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} @@ -228,7 +239,7 @@ namespace eval ::scobj::mercury_level { proc add_mercury_level {name ip_address tcp_port {id 99}} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::mercury_level::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${{id}" "${99}}" + ::scobj::mercury_level::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} } clientput "file evaluation of sct_mercury_level.tcl" @@ -267,20 +278,31 @@ proc ::scobj::mercury_level::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"]" } } @@ -291,6 +313,7 @@ proc ::scobj::mercury_level::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } set arg_list [list] set missing_list [list] @@ -307,11 +330,7 @@ proc ::scobj::mercury_level::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_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_mercury_pres.tcl b/site_ansto/instrument/config/environment/temperature/sct_mercury_pres.tcl index 47493269..c0c754c3 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_mercury_pres.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_mercury_pres.tcl @@ -86,7 +86,12 @@ proc ::scobj::mercury_pres::checkstatus {tc_root} { # checkstatus hook code goes here if {[sct driving]} { set sp "[sct target]" - set pv "[hval ${tc_root}/[sct driveable]]" + if {[hpropexists [sct] simulated] && [sct simulated] == "true"} { + set pv "${sp}" + hupdateif ${tc_root}/[sct driveable] ${sp} + } + set pv "[hval ${tc_root}/[sct driveable]]" + } if { abs(${pv} - ${sp}) <= [sct tolerance] } { if { [hpropexists [sct] settle_time] } { if { [hpropexists [sct] settle_time_start] } { @@ -285,9 +290,6 @@ proc ::scobj::mercury_pres::mkDriver { sct_controller name device_class simulati set scobj_hpath /sics/${name} hfactory ${scobj_hpath}/Loop8 plain spy none - hsetprop ${scobj_hpath}/Loop8 data "true" - hsetprop ${scobj_hpath}/Loop8 klass "@none" - hsetprop ${scobj_hpath}/Loop8 type "part" hfactory ${scobj_hpath}/Loop8/nick plain user text hsetprop ${scobj_hpath}/Loop8/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB8.P1:PRES:NICK} @@ -302,6 +304,14 @@ proc ::scobj::mercury_pres::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop8/nick type "part" hsetprop ${scobj_hpath}/Loop8/nick nxalias "${name}_Loop8_nick" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop8/nick 15 + hsetprop ${scobj_hpath}/Loop8/nick simulated false + } else { + ::scobj::mercury_pres::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_pres" + hsetprop ${scobj_hpath}/Loop8/nick simulated true + } + hfactory ${scobj_hpath}/Loop8/sensor plain user float hsetprop ${scobj_hpath}/Loop8/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.P1:PRES:SIG:PRES} hsetprop ${scobj_hpath}/Loop8/sensor rdValue ${ns}::rdValue ${scobj_hpath} @@ -318,6 +328,14 @@ proc ::scobj::mercury_pres::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop8/sensor type "part" hsetprop ${scobj_hpath}/Loop8/sensor nxalias "${name}_Loop8_sensor" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop8/sensor 1 + hsetprop ${scobj_hpath}/Loop8/sensor simulated false + } else { + ::scobj::mercury_pres::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_pres" + hsetprop ${scobj_hpath}/Loop8/sensor simulated true + } + hfactory ${scobj_hpath}/Loop8/setpoint plain user float hsetprop ${scobj_hpath}/Loop8/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.P1:PRES:LOOP:TSET} hsetprop ${scobj_hpath}/Loop8/setpoint rdValue ${ns}::rdValue ${scobj_hpath} @@ -347,19 +365,20 @@ proc ::scobj::mercury_pres::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop8/setpoint nxalias "${name}_Loop8_setpoint" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/Loop8/nick 15 - ${sct_controller} poll ${scobj_hpath}/Loop8/sensor 1 ${sct_controller} poll ${scobj_hpath}/Loop8/setpoint 5 ${sct_controller} write ${scobj_hpath}/Loop8/setpoint + hsetprop ${scobj_hpath}/Loop8/setpoint simulated false } else { ::scobj::mercury_pres::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_pres" + hsetprop ${scobj_hpath}/Loop8/setpoint simulated true } + hsetprop ${scobj_hpath}/Loop8 data "true" + hsetprop ${scobj_hpath}/Loop8 klass "@none" + hsetprop ${scobj_hpath}/Loop8 type "part" + ansto_makesctdrive ${name}_Loop8_setpoint ${scobj_hpath}/Loop8/setpoint ${scobj_hpath}/Loop8/sensor ${sct_controller} 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}_Loop8_setpoint ${scobj_hpath}/Loop8/setpoint ${scobj_hpath}/Loop8/sensor ${sct_controller} - } # mkDriver hook code goes here } catch_message ] handle_exception ${catch_status} ${catch_message} @@ -377,7 +396,9 @@ proc ::scobj::mercury_pres::add_driver {name device_class simulation_flag ip_add makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::mercury_pres::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for mercury_pres" + ::scobj::mercury_pres::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for mercury_pres" + ::scobj::mercury_pres::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::mercury_pres::sics_log 1 "::scobj::mercury_pres::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol}" ::scobj::mercury_pres::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol} @@ -395,7 +416,7 @@ namespace eval ::scobj::mercury_pres { proc add_mercury_pres {name ip_address tcp_port {id 99} {tol 1}} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::mercury_pres::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${{id}" "${99}}" "${{tol}" "${1}}" + ::scobj::mercury_pres::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol} } clientput "file evaluation of sct_mercury_pres.tcl" @@ -434,20 +455,31 @@ proc ::scobj::mercury_pres::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"]" } } @@ -458,6 +490,7 @@ proc ::scobj::mercury_pres::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } set arg_list [list] set missing_list [list] @@ -474,11 +507,7 @@ proc ::scobj::mercury_pres::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_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_mercury_scpi.tcl b/site_ansto/instrument/config/environment/temperature/sct_mercury_scpi.tcl index 57b30b93..a7fb0ab2 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_mercury_scpi.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_mercury_scpi.tcl @@ -86,7 +86,12 @@ proc ::scobj::mercury_scpi::checkstatus {tc_root} { # checkstatus hook code goes here if {[sct driving]} { set sp "[sct target]" - set pv "[hval ${tc_root}/[sct driveable]]" + if {[hpropexists [sct] simulated] && [sct simulated] == "true"} { + set pv "${sp}" + hupdateif ${tc_root}/[sct driveable] ${sp} + } + set pv "[hval ${tc_root}/[sct driveable]]" + } if { abs(${pv} - ${sp}) <= [sct tolerance] } { if { [hpropexists [sct] settle_time] } { if { [hpropexists [sct] settle_time_start] } { @@ -313,9 +318,6 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name device_class simulati set scobj_hpath /sics/${name} hfactory ${scobj_hpath}/Level plain spy none - hsetprop ${scobj_hpath}/Level data "true" - hsetprop ${scobj_hpath}/Level klass "@none" - hsetprop ${scobj_hpath}/Level type "part" 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} @@ -332,6 +334,14 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name device_class simulati 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::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi" + hsetprop ${scobj_hpath}/Level/Helium 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} @@ -348,16 +358,17 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Level/Nitrogen nxalias "${name}_Level_Nitrogen" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/Level/Helium 15 ${sct_controller} poll ${scobj_hpath}/Level/Nitrogen 15 + hsetprop ${scobj_hpath}/Level/Nitrogen simulated false } else { ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi" + 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" hfactory ${scobj_hpath}/Loop1 plain spy none - hsetprop ${scobj_hpath}/Loop1 data "true" - hsetprop ${scobj_hpath}/Loop1 klass "@none" - hsetprop ${scobj_hpath}/Loop1 type "part" hfactory ${scobj_hpath}/Loop1/nick plain user text hsetprop ${scobj_hpath}/Loop1/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:MB1.T1:TEMP:NICK} @@ -372,6 +383,14 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop1/nick type "part" hsetprop ${scobj_hpath}/Loop1/nick nxalias "${name}_Loop1_nick" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop1/nick 15 + hsetprop ${scobj_hpath}/Loop1/nick simulated false + } else { + ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi" + hsetprop ${scobj_hpath}/Loop1/nick simulated true + } + hfactory ${scobj_hpath}/Loop1/power plain user float hsetprop ${scobj_hpath}/Loop1/power read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:MB0.H1:HTR:SIG:POWR} hsetprop ${scobj_hpath}/Loop1/power rdValue ${ns}::rdValue ${scobj_hpath} @@ -385,6 +404,14 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop1/power type "part" hsetprop ${scobj_hpath}/Loop1/power nxalias "${name}_Loop1_power" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop1/power 5 + hsetprop ${scobj_hpath}/Loop1/power simulated false + } else { + ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi" + hsetprop ${scobj_hpath}/Loop1/power simulated true + } + hfactory ${scobj_hpath}/Loop1/sensor plain user float hsetprop ${scobj_hpath}/Loop1/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:MB1.T1:TEMP:SIG:TEMP} hsetprop ${scobj_hpath}/Loop1/sensor rdValue ${ns}::rdValue ${scobj_hpath} @@ -400,6 +427,14 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop1/sensor type "part" hsetprop ${scobj_hpath}/Loop1/sensor nxalias "${name}_Loop1_sensor" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop1/sensor 1 + hsetprop ${scobj_hpath}/Loop1/sensor simulated false + } else { + ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi" + hsetprop ${scobj_hpath}/Loop1/sensor simulated true + } + hfactory ${scobj_hpath}/Loop1/setpoint plain user float hsetprop ${scobj_hpath}/Loop1/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:MB1.T1:TEMP:LOOP:TSET} hsetprop ${scobj_hpath}/Loop1/setpoint rdValue ${ns}::rdValue ${scobj_hpath} @@ -428,19 +463,19 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop1/setpoint nxalias "${name}_Loop1_setpoint" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/Loop1/nick 15 - ${sct_controller} poll ${scobj_hpath}/Loop1/power 5 - ${sct_controller} poll ${scobj_hpath}/Loop1/sensor 1 ${sct_controller} poll ${scobj_hpath}/Loop1/setpoint 5 ${sct_controller} write ${scobj_hpath}/Loop1/setpoint + hsetprop ${scobj_hpath}/Loop1/setpoint simulated false } else { ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi" + hsetprop ${scobj_hpath}/Loop1/setpoint simulated true } + hsetprop ${scobj_hpath}/Loop1 data "true" + hsetprop ${scobj_hpath}/Loop1 klass "@none" + hsetprop ${scobj_hpath}/Loop1 type "part" + ansto_makesctdrive ${name}_Loop1_setpoint ${scobj_hpath}/Loop1/setpoint ${scobj_hpath}/Loop1/sensor ${sct_controller} hfactory ${scobj_hpath}/Loop2 plain spy none - hsetprop ${scobj_hpath}/Loop2 data "true" - hsetprop ${scobj_hpath}/Loop2 klass "@none" - hsetprop ${scobj_hpath}/Loop2 type "part" hfactory ${scobj_hpath}/Loop2/nick plain user text hsetprop ${scobj_hpath}/Loop2/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB6.T1:TEMP:NICK} @@ -455,6 +490,14 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop2/nick type "part" hsetprop ${scobj_hpath}/Loop2/nick nxalias "${name}_Loop2_nick" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop2/nick 15 + hsetprop ${scobj_hpath}/Loop2/nick simulated false + } else { + ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi" + hsetprop ${scobj_hpath}/Loop2/nick simulated true + } + hfactory ${scobj_hpath}/Loop2/power plain user float hsetprop ${scobj_hpath}/Loop2/power read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB1.H1:HTR:SIG:POWR} hsetprop ${scobj_hpath}/Loop2/power rdValue ${ns}::rdValue ${scobj_hpath} @@ -468,6 +511,14 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop2/power type "part" hsetprop ${scobj_hpath}/Loop2/power nxalias "${name}_Loop2_power" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop2/power 5 + hsetprop ${scobj_hpath}/Loop2/power simulated false + } else { + ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi" + hsetprop ${scobj_hpath}/Loop2/power simulated true + } + hfactory ${scobj_hpath}/Loop2/sensor plain user float hsetprop ${scobj_hpath}/Loop2/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB6.T1:TEMP:SIG:TEMP} hsetprop ${scobj_hpath}/Loop2/sensor rdValue ${ns}::rdValue ${scobj_hpath} @@ -483,6 +534,14 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop2/sensor type "part" hsetprop ${scobj_hpath}/Loop2/sensor nxalias "${name}_Loop2_sensor" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop2/sensor 1 + hsetprop ${scobj_hpath}/Loop2/sensor simulated false + } else { + ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi" + hsetprop ${scobj_hpath}/Loop2/sensor simulated true + } + hfactory ${scobj_hpath}/Loop2/setpoint plain user float hsetprop ${scobj_hpath}/Loop2/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB6.T1:TEMP:LOOP:TSET} hsetprop ${scobj_hpath}/Loop2/setpoint rdValue ${ns}::rdValue ${scobj_hpath} @@ -511,19 +570,19 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop2/setpoint nxalias "${name}_Loop2_setpoint" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/Loop2/nick 15 - ${sct_controller} poll ${scobj_hpath}/Loop2/power 5 - ${sct_controller} poll ${scobj_hpath}/Loop2/sensor 1 ${sct_controller} poll ${scobj_hpath}/Loop2/setpoint 5 ${sct_controller} write ${scobj_hpath}/Loop2/setpoint + hsetprop ${scobj_hpath}/Loop2/setpoint simulated false } else { ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi" + hsetprop ${scobj_hpath}/Loop2/setpoint simulated true } + hsetprop ${scobj_hpath}/Loop2 data "true" + hsetprop ${scobj_hpath}/Loop2 klass "@none" + hsetprop ${scobj_hpath}/Loop2 type "part" + ansto_makesctdrive ${name}_Loop2_setpoint ${scobj_hpath}/Loop2/setpoint ${scobj_hpath}/Loop2/sensor ${sct_controller} hfactory ${scobj_hpath}/Loop3 plain spy none - hsetprop ${scobj_hpath}/Loop3 data "true" - hsetprop ${scobj_hpath}/Loop3 klass "@none" - hsetprop ${scobj_hpath}/Loop3 type "part" hfactory ${scobj_hpath}/Loop3/nick plain user text hsetprop ${scobj_hpath}/Loop3/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB7.T1:TEMP:NICK} @@ -538,6 +597,14 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop3/nick type "part" hsetprop ${scobj_hpath}/Loop3/nick nxalias "${name}_Loop3_nick" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop3/nick 15 + hsetprop ${scobj_hpath}/Loop3/nick simulated false + } else { + ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi" + hsetprop ${scobj_hpath}/Loop3/nick simulated true + } + hfactory ${scobj_hpath}/Loop3/power plain user float hsetprop ${scobj_hpath}/Loop3/power read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB2.H1:HTR:SIG:POWR} hsetprop ${scobj_hpath}/Loop3/power rdValue ${ns}::rdValue ${scobj_hpath} @@ -551,6 +618,14 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop3/power type "part" hsetprop ${scobj_hpath}/Loop3/power nxalias "${name}_Loop3_power" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop3/power 5 + hsetprop ${scobj_hpath}/Loop3/power simulated false + } else { + ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi" + hsetprop ${scobj_hpath}/Loop3/power simulated true + } + hfactory ${scobj_hpath}/Loop3/sensor plain user float hsetprop ${scobj_hpath}/Loop3/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB7.T1:TEMP:SIG:TEMP} hsetprop ${scobj_hpath}/Loop3/sensor rdValue ${ns}::rdValue ${scobj_hpath} @@ -566,6 +641,14 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop3/sensor type "part" hsetprop ${scobj_hpath}/Loop3/sensor nxalias "${name}_Loop3_sensor" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop3/sensor 1 + hsetprop ${scobj_hpath}/Loop3/sensor simulated false + } else { + ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi" + hsetprop ${scobj_hpath}/Loop3/sensor simulated true + } + hfactory ${scobj_hpath}/Loop3/setpoint plain user float hsetprop ${scobj_hpath}/Loop3/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB7.T1:TEMP:LOOP:TSET} hsetprop ${scobj_hpath}/Loop3/setpoint rdValue ${ns}::rdValue ${scobj_hpath} @@ -594,19 +677,19 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop3/setpoint nxalias "${name}_Loop3_setpoint" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/Loop3/nick 15 - ${sct_controller} poll ${scobj_hpath}/Loop3/power 5 - ${sct_controller} poll ${scobj_hpath}/Loop3/sensor 1 ${sct_controller} poll ${scobj_hpath}/Loop3/setpoint 5 ${sct_controller} write ${scobj_hpath}/Loop3/setpoint + hsetprop ${scobj_hpath}/Loop3/setpoint simulated false } else { ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi" + hsetprop ${scobj_hpath}/Loop3/setpoint simulated true } + hsetprop ${scobj_hpath}/Loop3 data "true" + hsetprop ${scobj_hpath}/Loop3 klass "@none" + hsetprop ${scobj_hpath}/Loop3 type "part" + ansto_makesctdrive ${name}_Loop3_setpoint ${scobj_hpath}/Loop3/setpoint ${scobj_hpath}/Loop3/sensor ${sct_controller} hfactory ${scobj_hpath}/Loop4 plain spy none - hsetprop ${scobj_hpath}/Loop4 data "true" - hsetprop ${scobj_hpath}/Loop4 klass "@none" - hsetprop ${scobj_hpath}/Loop4 type "part" hfactory ${scobj_hpath}/Loop4/nick plain user text hsetprop ${scobj_hpath}/Loop4/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB8.T1:TEMP:NICK} @@ -621,6 +704,14 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop4/nick type "part" hsetprop ${scobj_hpath}/Loop4/nick nxalias "${name}_Loop4_nick" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop4/nick 15 + hsetprop ${scobj_hpath}/Loop4/nick simulated false + } else { + ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi" + hsetprop ${scobj_hpath}/Loop4/nick simulated true + } + hfactory ${scobj_hpath}/Loop4/power plain user float hsetprop ${scobj_hpath}/Loop4/power read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB3.H1:HTR:SIG:POWR} hsetprop ${scobj_hpath}/Loop4/power rdValue ${ns}::rdValue ${scobj_hpath} @@ -634,6 +725,14 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop4/power type "part" hsetprop ${scobj_hpath}/Loop4/power nxalias "${name}_Loop4_power" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop4/power 5 + hsetprop ${scobj_hpath}/Loop4/power simulated false + } else { + ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi" + hsetprop ${scobj_hpath}/Loop4/power simulated true + } + hfactory ${scobj_hpath}/Loop4/sensor plain user float hsetprop ${scobj_hpath}/Loop4/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.T1:TEMP:SIG:TEMP} hsetprop ${scobj_hpath}/Loop4/sensor rdValue ${ns}::rdValue ${scobj_hpath} @@ -649,6 +748,14 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop4/sensor type "part" hsetprop ${scobj_hpath}/Loop4/sensor nxalias "${name}_Loop4_sensor" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop4/sensor 1 + hsetprop ${scobj_hpath}/Loop4/sensor simulated false + } else { + ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi" + hsetprop ${scobj_hpath}/Loop4/sensor simulated true + } + hfactory ${scobj_hpath}/Loop4/setpoint plain user float hsetprop ${scobj_hpath}/Loop4/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.T1:TEMP:LOOP:TSET} hsetprop ${scobj_hpath}/Loop4/setpoint rdValue ${ns}::rdValue ${scobj_hpath} @@ -677,19 +784,19 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop4/setpoint nxalias "${name}_Loop4_setpoint" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/Loop4/nick 15 - ${sct_controller} poll ${scobj_hpath}/Loop4/power 5 - ${sct_controller} poll ${scobj_hpath}/Loop4/sensor 1 ${sct_controller} poll ${scobj_hpath}/Loop4/setpoint 5 ${sct_controller} write ${scobj_hpath}/Loop4/setpoint + hsetprop ${scobj_hpath}/Loop4/setpoint simulated false } else { ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi" + hsetprop ${scobj_hpath}/Loop4/setpoint simulated true } + hsetprop ${scobj_hpath}/Loop4 data "true" + hsetprop ${scobj_hpath}/Loop4 klass "@none" + hsetprop ${scobj_hpath}/Loop4 type "part" + ansto_makesctdrive ${name}_Loop4_setpoint ${scobj_hpath}/Loop4/setpoint ${scobj_hpath}/Loop4/sensor ${sct_controller} hfactory ${scobj_hpath}/Valve plain spy none - hsetprop ${scobj_hpath}/Valve data "true" - hsetprop ${scobj_hpath}/Valve klass "@none" - hsetprop ${scobj_hpath}/Valve type "part" 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:OPEN} @@ -706,6 +813,14 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name device_class simulati 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::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi" + hsetprop ${scobj_hpath}/Valve/sensor simulated true + } + hfactory ${scobj_hpath}/Valve/setpoint plain user float hsetprop ${scobj_hpath}/Valve/setpoint write ${ns}::setValve ${scobj_hpath} noResponse {SET:DEV:DB4.G1:AUX:SIG:OPEN:} hsetprop ${scobj_hpath}/Valve/setpoint noResponse ${ns}::noResponse ${scobj_hpath} @@ -732,21 +847,19 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Valve/setpoint nxalias "${name}_Valve_setpoint" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/Valve/sensor 5 ${sct_controller} write ${scobj_hpath}/Valve/setpoint + hsetprop ${scobj_hpath}/Valve/setpoint simulated false } else { ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi" + hsetprop ${scobj_hpath}/Valve/setpoint simulated true } + hsetprop ${scobj_hpath}/Valve data "true" + hsetprop ${scobj_hpath}/Valve klass "@none" + hsetprop ${scobj_hpath}/Valve type "part" + ansto_makesctdrive ${name}_Valve_setpoint ${scobj_hpath}/Valve/setpoint ${scobj_hpath}/Valve/sensor ${sct_controller} 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}_Loop1_setpoint ${scobj_hpath}/Loop1/setpoint ${scobj_hpath}/Loop1/sensor ${sct_controller} - ansto_makesctdrive ${name}_Loop2_setpoint ${scobj_hpath}/Loop2/setpoint ${scobj_hpath}/Loop2/sensor ${sct_controller} - ansto_makesctdrive ${name}_Loop3_setpoint ${scobj_hpath}/Loop3/setpoint ${scobj_hpath}/Loop3/sensor ${sct_controller} - ansto_makesctdrive ${name}_Loop4_setpoint ${scobj_hpath}/Loop4/setpoint ${scobj_hpath}/Loop4/sensor ${sct_controller} - ansto_makesctdrive ${name}_Valve_setpoint ${scobj_hpath}/Valve/setpoint ${scobj_hpath}/Valve/sensor ${sct_controller} - } # mkDriver hook code goes here } catch_message ] handle_exception ${catch_status} ${catch_message} @@ -764,7 +877,9 @@ proc ::scobj::mercury_scpi::add_driver {name device_class simulation_flag ip_add makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::mercury_scpi::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for mercury_scpi" + ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for mercury_scpi" + ::scobj::mercury_scpi::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::mercury_scpi::sics_log 1 "::scobj::mercury_scpi::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${permlink} ${tol} ${valve_tol}" ::scobj::mercury_scpi::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${permlink} ${tol} ${valve_tol} @@ -782,7 +897,7 @@ namespace eval ::scobj::mercury_scpi { proc add_mercury_scpi {name ip_address tcp_port {id 99} {permlink LT} {tol 1} {valve_tol 2}} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::mercury_scpi::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${{id}" "${99}}" "${{permlink}" "${LT}}" "${{tol}" "${1}}" "${{valve_tol}" "${2}}" + ::scobj::mercury_scpi::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${permlink} ${tol} ${valve_tol} } clientput "file evaluation of sct_mercury_scpi.tcl" @@ -821,20 +936,31 @@ proc ::scobj::mercury_scpi::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"]" } } @@ -845,6 +971,7 @@ proc ::scobj::mercury_scpi::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } set arg_list [list] set missing_list [list] @@ -861,11 +988,7 @@ proc ::scobj::mercury_scpi::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_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_mercury_temp.tcl b/site_ansto/instrument/config/environment/temperature/sct_mercury_temp.tcl index 68d6391a..228afefa 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_mercury_temp.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_mercury_temp.tcl @@ -86,7 +86,12 @@ proc ::scobj::mercury_temp::checkstatus {tc_root} { # checkstatus hook code goes here if {[sct driving]} { set sp "[sct target]" - set pv "[hval ${tc_root}/[sct driveable]]" + if {[hpropexists [sct] simulated] && [sct simulated] == "true"} { + set pv "${sp}" + hupdateif ${tc_root}/[sct driveable] ${sp} + } + set pv "[hval ${tc_root}/[sct driveable]]" + } if { abs(${pv} - ${sp}) <= [sct tolerance] } { if { [hpropexists [sct] settle_time] } { if { [hpropexists [sct] settle_time_start] } { @@ -279,9 +284,6 @@ proc ::scobj::mercury_temp::mkDriver { sct_controller name device_class simulati set scobj_hpath /sics/${name} hfactory ${scobj_hpath}/Loop4 plain spy none - hsetprop ${scobj_hpath}/Loop4 data "true" - hsetprop ${scobj_hpath}/Loop4 klass "@none" - hsetprop ${scobj_hpath}/Loop4 type "part" hfactory ${scobj_hpath}/Loop4/nick plain user text hsetprop ${scobj_hpath}/Loop4/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB8.T1:TEMP:NICK} @@ -296,6 +298,14 @@ proc ::scobj::mercury_temp::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop4/nick type "part" hsetprop ${scobj_hpath}/Loop4/nick nxalias "${name}_Loop4_nick" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop4/nick 15 + hsetprop ${scobj_hpath}/Loop4/nick simulated false + } else { + ::scobj::mercury_temp::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_temp" + hsetprop ${scobj_hpath}/Loop4/nick simulated true + } + hfactory ${scobj_hpath}/Loop4/power plain user float hsetprop ${scobj_hpath}/Loop4/power read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB3.H1:HTR:SIG:POWR} hsetprop ${scobj_hpath}/Loop4/power rdValue ${ns}::rdValue ${scobj_hpath} @@ -309,6 +319,14 @@ proc ::scobj::mercury_temp::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop4/power type "part" hsetprop ${scobj_hpath}/Loop4/power nxalias "${name}_Loop4_power" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop4/power 5 + hsetprop ${scobj_hpath}/Loop4/power simulated false + } else { + ::scobj::mercury_temp::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_temp" + hsetprop ${scobj_hpath}/Loop4/power simulated true + } + hfactory ${scobj_hpath}/Loop4/sensor plain user float hsetprop ${scobj_hpath}/Loop4/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.T1:TEMP:SIG:TEMP} hsetprop ${scobj_hpath}/Loop4/sensor rdValue ${ns}::rdValue ${scobj_hpath} @@ -324,6 +342,14 @@ proc ::scobj::mercury_temp::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop4/sensor type "part" hsetprop ${scobj_hpath}/Loop4/sensor nxalias "${name}_Loop4_sensor" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Loop4/sensor 1 + hsetprop ${scobj_hpath}/Loop4/sensor simulated false + } else { + ::scobj::mercury_temp::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_temp" + hsetprop ${scobj_hpath}/Loop4/sensor simulated true + } + hfactory ${scobj_hpath}/Loop4/setpoint plain user float hsetprop ${scobj_hpath}/Loop4/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.T1:TEMP:LOOP:TSET} hsetprop ${scobj_hpath}/Loop4/setpoint rdValue ${ns}::rdValue ${scobj_hpath} @@ -352,20 +378,20 @@ proc ::scobj::mercury_temp::mkDriver { sct_controller name device_class simulati hsetprop ${scobj_hpath}/Loop4/setpoint nxalias "${name}_Loop4_setpoint" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/Loop4/nick 15 - ${sct_controller} poll ${scobj_hpath}/Loop4/power 5 - ${sct_controller} poll ${scobj_hpath}/Loop4/sensor 1 ${sct_controller} poll ${scobj_hpath}/Loop4/setpoint 5 ${sct_controller} write ${scobj_hpath}/Loop4/setpoint + hsetprop ${scobj_hpath}/Loop4/setpoint simulated false } else { ::scobj::mercury_temp::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_temp" + hsetprop ${scobj_hpath}/Loop4/setpoint simulated true } + hsetprop ${scobj_hpath}/Loop4 data "true" + hsetprop ${scobj_hpath}/Loop4 klass "@none" + hsetprop ${scobj_hpath}/Loop4 type "part" + ansto_makesctdrive ${name}_Loop4_setpoint ${scobj_hpath}/Loop4/setpoint ${scobj_hpath}/Loop4/sensor ${sct_controller} 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}_Loop4_setpoint ${scobj_hpath}/Loop4/setpoint ${scobj_hpath}/Loop4/sensor ${sct_controller} - } # mkDriver hook code goes here } catch_message ] handle_exception ${catch_status} ${catch_message} @@ -383,7 +409,9 @@ proc ::scobj::mercury_temp::add_driver {name device_class simulation_flag ip_add makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::mercury_temp::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for mercury_temp" + ::scobj::mercury_temp::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for mercury_temp" + ::scobj::mercury_temp::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::mercury_temp::sics_log 1 "::scobj::mercury_temp::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol}" ::scobj::mercury_temp::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol} @@ -401,7 +429,7 @@ namespace eval ::scobj::mercury_temp { proc add_mercury_temp {name ip_address tcp_port {id 99} {tol 1}} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::mercury_temp::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${{id}" "${99}}" "${{tol}" "${1}}" + ::scobj::mercury_temp::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol} } clientput "file evaluation of sct_mercury_temp.tcl" @@ -440,20 +468,31 @@ proc ::scobj::mercury_temp::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"]" } } @@ -464,6 +503,7 @@ proc ::scobj::mercury_temp::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } set arg_list [list] set missing_list [list] @@ -480,11 +520,7 @@ proc ::scobj::mercury_temp::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_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_mercury_valve.tcl b/site_ansto/instrument/config/environment/temperature/sct_mercury_valve.tcl index 76151dee..93565135 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_mercury_valve.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_mercury_valve.tcl @@ -86,7 +86,12 @@ proc ::scobj::mercury_valve::checkstatus {tc_root} { # checkstatus hook code goes here if {[sct driving]} { set sp "[sct target]" - set pv "[hval ${tc_root}/[sct driveable]]" + if {[hpropexists [sct] simulated] && [sct simulated] == "true"} { + set pv "${sp}" + hupdateif ${tc_root}/[sct driveable] ${sp} + } + set pv "[hval ${tc_root}/[sct driveable]]" + } if { abs(${pv} - ${sp}) <= [sct tolerance] } { if { [hpropexists [sct] settle_time] } { if { [hpropexists [sct] settle_time_start] } { @@ -257,9 +262,6 @@ proc ::scobj::mercury_valve::mkDriver { sct_controller name device_class simulat set scobj_hpath /sics/${name} hfactory ${scobj_hpath}/Valve plain spy none - hsetprop ${scobj_hpath}/Valve data "true" - hsetprop ${scobj_hpath}/Valve klass "@none" - hsetprop ${scobj_hpath}/Valve type "part" 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:OPEN} @@ -276,6 +278,14 @@ proc ::scobj::mercury_valve::mkDriver { sct_controller name device_class simulat 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::mercury_valve::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_valve" + hsetprop ${scobj_hpath}/Valve/sensor simulated true + } + hfactory ${scobj_hpath}/Valve/setpoint plain user float hsetprop ${scobj_hpath}/Valve/setpoint write ${ns}::setValve ${scobj_hpath} noResponse {SET:DEV:DB4.G1:AUX:SIG:OPEN:} hsetprop ${scobj_hpath}/Valve/setpoint noResponse ${ns}::noResponse ${scobj_hpath} @@ -302,17 +312,19 @@ proc ::scobj::mercury_valve::mkDriver { sct_controller name device_class simulat hsetprop ${scobj_hpath}/Valve/setpoint nxalias "${name}_Valve_setpoint" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/Valve/sensor 5 ${sct_controller} write ${scobj_hpath}/Valve/setpoint + hsetprop ${scobj_hpath}/Valve/setpoint simulated false } else { ::scobj::mercury_valve::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_valve" + hsetprop ${scobj_hpath}/Valve/setpoint simulated true } + hsetprop ${scobj_hpath}/Valve data "true" + hsetprop ${scobj_hpath}/Valve klass "@none" + hsetprop ${scobj_hpath}/Valve type "part" + ansto_makesctdrive ${name}_Valve_setpoint ${scobj_hpath}/Valve/setpoint ${scobj_hpath}/Valve/sensor ${sct_controller} 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}_Valve_setpoint ${scobj_hpath}/Valve/setpoint ${scobj_hpath}/Valve/sensor ${sct_controller} - } # mkDriver hook code goes here } catch_message ] handle_exception ${catch_status} ${catch_message} @@ -330,7 +342,9 @@ proc ::scobj::mercury_valve::add_driver {name device_class simulation_flag ip_ad makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::mercury_valve::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for mercury_valve" + ::scobj::mercury_valve::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for mercury_valve" + ::scobj::mercury_valve::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::mercury_valve::sics_log 1 "::scobj::mercury_valve::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${valve_tol}" ::scobj::mercury_valve::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${valve_tol} @@ -348,7 +362,7 @@ namespace eval ::scobj::mercury_valve { proc add_mercury_valve {name ip_address tcp_port {id 99} {valve_tol 2}} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::mercury_valve::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${{id}" "${99}}" "${{valve_tol}" "${2}}" + ::scobj::mercury_valve::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${valve_tol} } clientput "file evaluation of sct_mercury_valve.tcl" @@ -387,20 +401,31 @@ proc ::scobj::mercury_valve::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"]" } } @@ -411,6 +436,7 @@ proc ::scobj::mercury_valve::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } set arg_list [list] set missing_list [list] @@ -427,11 +453,7 @@ proc ::scobj::mercury_valve::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_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_nprvasm2.tcl b/site_ansto/instrument/config/environment/temperature/sct_nprvasm2.tcl index 24bac7f1..c51ea237 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_nprvasm2.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_nprvasm2.tcl @@ -60,7 +60,9 @@ proc ::scobj::nprvasm2::add_driver {name device_class simulation_flag ip_address makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::nprvasm2::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for nprvasm2" + ::scobj::nprvasm2::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for nprvasm2" + ::scobj::nprvasm2::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::nprvasm2::sics_log 1 "::scobj::nprvasm2::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${tol}" ::scobj::nprvasm2::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${tol} @@ -78,7 +80,7 @@ namespace eval ::scobj::nprvasm2 { proc add_nprvasm2 {name ip_address tcp_port {tol 1.0}} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::nprvasm2::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${{tol}" "${1.0}}" + ::scobj::nprvasm2::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${tol} } clientput "file evaluation of sct_nprvasm2.tcl" @@ -117,20 +119,31 @@ proc ::scobj::nprvasm2::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"]" } } @@ -141,6 +154,7 @@ proc ::scobj::nprvasm2::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } set arg_list [list] set missing_list [list] @@ -157,11 +171,7 @@ proc ::scobj::nprvasm2::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_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_pfeiffer_hg.tcl b/site_ansto/instrument/config/environment/temperature/sct_pfeiffer_hg.tcl index 1176f967..6814d2ab 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_pfeiffer_hg.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_pfeiffer_hg.tcl @@ -125,7 +125,12 @@ proc ::scobj::pfeiffer_hg::checkstatus {tc_root} { # checkstatus hook code goes here if {[sct driving]} { set sp "[sct target]" - set pv "[hval ${tc_root}/[sct driveable]]" + if {[hpropexists [sct] simulated] && [sct simulated] == "true"} { + set pv "${sp}" + hupdateif ${tc_root}/[sct driveable] ${sp} + } + set pv "[hval ${tc_root}/[sct driveable]]" + } if { abs(${pv} - ${sp}) <= [sct tolerance] } { if { [hpropexists [sct] settle_time] } { if { [hpropexists [sct] settle_time_start] } { @@ -400,9 +405,6 @@ proc ::scobj::pfeiffer_hg::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath} type "part" hfactory ${scobj_hpath}/pressure plain spy none - hsetprop ${scobj_hpath}/pressure data "true" - hsetprop ${scobj_hpath}/pressure klass "@none" - hsetprop ${scobj_hpath}/pressure type "part" hfactory ${scobj_hpath}/pressure/sensor plain user float hsetprop ${scobj_hpath}/pressure/sensor read ${ns}::sendPR1 ${scobj_hpath} readPR1 {PR1} @@ -428,6 +430,14 @@ proc ::scobj::pfeiffer_hg::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/pressure/sensor type "part" hsetprop ${scobj_hpath}/pressure/sensor nxalias "${name}_pressure_sensor" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/pressure/sensor 1 + hsetprop ${scobj_hpath}/pressure/sensor simulated false + } else { + ::scobj::pfeiffer_hg::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for pfeiffer_hg" + hsetprop ${scobj_hpath}/pressure/sensor simulated true + } + hfactory ${scobj_hpath}/pressure/setpoint plain user float hsetprop ${scobj_hpath}/pressure/setpoint write ${ns}::setPoint ${scobj_hpath} noResponse {@} hsetprop ${scobj_hpath}/pressure/setpoint noResponse ${ns}::noResponse ${scobj_hpath} @@ -454,17 +464,19 @@ proc ::scobj::pfeiffer_hg::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/pressure/setpoint nxalias "${name}_pressure_setpoint" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/pressure/sensor 1 ${sct_controller} write ${scobj_hpath}/pressure/setpoint + hsetprop ${scobj_hpath}/pressure/setpoint simulated false } else { ::scobj::pfeiffer_hg::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for pfeiffer_hg" + hsetprop ${scobj_hpath}/pressure/setpoint simulated true } + hsetprop ${scobj_hpath}/pressure data "true" + hsetprop ${scobj_hpath}/pressure klass "@none" + hsetprop ${scobj_hpath}/pressure type "part" + ansto_makesctdrive ${name}_pressure_setpoint ${scobj_hpath}/pressure/setpoint ${scobj_hpath}/pressure/sensor ${sct_controller} 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}_pressure_setpoint ${scobj_hpath}/pressure/setpoint ${scobj_hpath}/pressure/sensor ${sct_controller} - } # mkDriver hook code starts hsetprop ${scobj_hpath}/pressure/sensor read ${ns}::sendPR1 ${scobj_hpath} ack_enq {PR1} hsetprop ${scobj_hpath}/pressure/sensor ack_enq ${ns}::ack_enq ${scobj_hpath} @@ -485,7 +497,9 @@ proc ::scobj::pfeiffer_hg::add_driver {name device_class simulation_flag ip_addr makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::pfeiffer_hg::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for pfeiffer_hg" + ::scobj::pfeiffer_hg::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for pfeiffer_hg" + ::scobj::pfeiffer_hg::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::pfeiffer_hg::sics_log 1 "::scobj::pfeiffer_hg::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}" ::scobj::pfeiffer_hg::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} @@ -503,7 +517,7 @@ namespace eval ::scobj::pfeiffer_hg { proc add_pfeiffer_hg {name ip_address tcp_port} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::pfeiffer_hg::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} + ::scobj::pfeiffer_hg::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} } clientput "file evaluation of sct_pfeiffer_hg.tcl" @@ -542,20 +556,31 @@ proc ::scobj::pfeiffer_hg::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"]" } } @@ -566,12 +591,9 @@ proc ::scobj::pfeiffer_hg::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_srs_sr630.tcl b/site_ansto/instrument/config/environment/temperature/sct_srs_sr630.tcl index e6bb69eb..4287b27d 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_srs_sr630.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_srs_sr630.tcl @@ -217,6 +217,14 @@ proc ::scobj::srs_sr630::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 600 + hsetprop ${scobj_hpath}/id simulated false + } else { + ::scobj::srs_sr630::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for srs_sr630" + hsetprop ${scobj_hpath}/id simulated true + } + hfactory ${scobj_hpath}/sensor_01 plain user float hsetprop ${scobj_hpath}/sensor_01 read ${ns}::getSensor ${scobj_hpath} readSensor {1} hsetprop ${scobj_hpath}/sensor_01 readSensor ${ns}::readSensor ${scobj_hpath} @@ -230,6 +238,14 @@ proc ::scobj::srs_sr630::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/sensor_01 type "part" hsetprop ${scobj_hpath}/sensor_01 nxalias "${name}_sensor_01" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor_01 60 + hsetprop ${scobj_hpath}/sensor_01 simulated false + } else { + ::scobj::srs_sr630::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for srs_sr630" + hsetprop ${scobj_hpath}/sensor_01 simulated true + } + hfactory ${scobj_hpath}/sensor_02 plain user float hsetprop ${scobj_hpath}/sensor_02 read ${ns}::getSensor ${scobj_hpath} readSensor {2} hsetprop ${scobj_hpath}/sensor_02 readSensor ${ns}::readSensor ${scobj_hpath} @@ -243,6 +259,14 @@ proc ::scobj::srs_sr630::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/sensor_02 type "part" hsetprop ${scobj_hpath}/sensor_02 nxalias "${name}_sensor_02" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor_02 600 + hsetprop ${scobj_hpath}/sensor_02 simulated false + } else { + ::scobj::srs_sr630::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for srs_sr630" + hsetprop ${scobj_hpath}/sensor_02 simulated true + } + hfactory ${scobj_hpath}/sensor_03 plain user float hsetprop ${scobj_hpath}/sensor_03 read ${ns}::getSensor ${scobj_hpath} readSensor {3} hsetprop ${scobj_hpath}/sensor_03 readSensor ${ns}::readSensor ${scobj_hpath} @@ -256,6 +280,14 @@ proc ::scobj::srs_sr630::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/sensor_03 type "part" hsetprop ${scobj_hpath}/sensor_03 nxalias "${name}_sensor_03" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor_03 600 + hsetprop ${scobj_hpath}/sensor_03 simulated false + } else { + ::scobj::srs_sr630::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for srs_sr630" + hsetprop ${scobj_hpath}/sensor_03 simulated true + } + hfactory ${scobj_hpath}/sensor_04 plain user float hsetprop ${scobj_hpath}/sensor_04 read ${ns}::getSensor ${scobj_hpath} readSensor {4} hsetprop ${scobj_hpath}/sensor_04 readSensor ${ns}::readSensor ${scobj_hpath} @@ -269,6 +301,14 @@ proc ::scobj::srs_sr630::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/sensor_04 type "part" hsetprop ${scobj_hpath}/sensor_04 nxalias "${name}_sensor_04" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor_04 600 + hsetprop ${scobj_hpath}/sensor_04 simulated false + } else { + ::scobj::srs_sr630::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for srs_sr630" + hsetprop ${scobj_hpath}/sensor_04 simulated true + } + hfactory ${scobj_hpath}/sensor_05 plain user float hsetprop ${scobj_hpath}/sensor_05 read ${ns}::getSensor ${scobj_hpath} readSensor {5} hsetprop ${scobj_hpath}/sensor_05 readSensor ${ns}::readSensor ${scobj_hpath} @@ -282,6 +322,14 @@ proc ::scobj::srs_sr630::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/sensor_05 type "part" hsetprop ${scobj_hpath}/sensor_05 nxalias "${name}_sensor_05" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor_05 600 + hsetprop ${scobj_hpath}/sensor_05 simulated false + } else { + ::scobj::srs_sr630::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for srs_sr630" + hsetprop ${scobj_hpath}/sensor_05 simulated true + } + hfactory ${scobj_hpath}/sensor_06 plain user float hsetprop ${scobj_hpath}/sensor_06 read ${ns}::getSensor ${scobj_hpath} readSensor {6} hsetprop ${scobj_hpath}/sensor_06 readSensor ${ns}::readSensor ${scobj_hpath} @@ -295,6 +343,14 @@ proc ::scobj::srs_sr630::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/sensor_06 type "part" hsetprop ${scobj_hpath}/sensor_06 nxalias "${name}_sensor_06" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor_06 600 + hsetprop ${scobj_hpath}/sensor_06 simulated false + } else { + ::scobj::srs_sr630::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for srs_sr630" + hsetprop ${scobj_hpath}/sensor_06 simulated true + } + hfactory ${scobj_hpath}/sensor_07 plain user float hsetprop ${scobj_hpath}/sensor_07 read ${ns}::getSensor ${scobj_hpath} readSensor {7} hsetprop ${scobj_hpath}/sensor_07 readSensor ${ns}::readSensor ${scobj_hpath} @@ -308,6 +364,14 @@ proc ::scobj::srs_sr630::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/sensor_07 type "part" hsetprop ${scobj_hpath}/sensor_07 nxalias "${name}_sensor_07" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor_07 600 + hsetprop ${scobj_hpath}/sensor_07 simulated false + } else { + ::scobj::srs_sr630::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for srs_sr630" + hsetprop ${scobj_hpath}/sensor_07 simulated true + } + hfactory ${scobj_hpath}/sensor_08 plain user float hsetprop ${scobj_hpath}/sensor_08 read ${ns}::getSensor ${scobj_hpath} readSensor {8} hsetprop ${scobj_hpath}/sensor_08 readSensor ${ns}::readSensor ${scobj_hpath} @@ -321,23 +385,17 @@ proc ::scobj::srs_sr630::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/sensor_08 type "part" hsetprop ${scobj_hpath}/sensor_08 nxalias "${name}_sensor_08" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor_08 600 + hsetprop ${scobj_hpath}/sensor_08 simulated false + } else { + ::scobj::srs_sr630::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for srs_sr630" + hsetprop ${scobj_hpath}/sensor_08 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}/id 600 - ${sct_controller} poll ${scobj_hpath}/sensor_01 60 - ${sct_controller} poll ${scobj_hpath}/sensor_02 600 - ${sct_controller} poll ${scobj_hpath}/sensor_03 600 - ${sct_controller} poll ${scobj_hpath}/sensor_04 600 - ${sct_controller} poll ${scobj_hpath}/sensor_05 600 - ${sct_controller} poll ${scobj_hpath}/sensor_06 600 - ${sct_controller} poll ${scobj_hpath}/sensor_07 600 - ${sct_controller} poll ${scobj_hpath}/sensor_08 600 - } else { - ::scobj::srs_sr630::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for srs_sr630" - } hsetprop ${scobj_hpath} klass ${device_class} hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} debug_threshold 5 @@ -358,7 +416,9 @@ proc ::scobj::srs_sr630::add_driver {name device_class simulation_flag ip_addres makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::srs_sr630::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for srs_sr630" + ::scobj::srs_sr630::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for srs_sr630" + ::scobj::srs_sr630::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::srs_sr630::sics_log 1 "::scobj::srs_sr630::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}" ::scobj::srs_sr630::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} @@ -376,7 +436,7 @@ namespace eval ::scobj::srs_sr630 { proc add_srs_sr630 {name ip_address tcp_port} { set simulation_flag "[string tolower [SplitReply [detector_simulation]]]" - ::scobj::srs_sr630::add_driver ${name} "NXdetector" "${simulation_flag}" ${ip_address} ${tcp_port} + ::scobj::srs_sr630::add_driver ${name} "NXdetector" ${simulation_flag} ${ip_address} ${tcp_port} } clientput "file evaluation of sct_srs_sr630.tcl" @@ -415,20 +475,31 @@ proc ::scobj::srs_sr630::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"]" } } @@ -439,12 +510,9 @@ proc ::scobj::srs_sr630::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_watlow_mpm.tcl b/site_ansto/instrument/config/environment/temperature/sct_watlow_mpm.tcl index b36881c3..3f077f9d 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_watlow_mpm.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_watlow_mpm.tcl @@ -60,7 +60,9 @@ proc ::scobj::watlow_mpm::add_driver {name device_class simulation_flag ip_addre makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::watlow_mpm::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for watlow_mpm" + ::scobj::watlow_mpm::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for watlow_mpm" + ::scobj::watlow_mpm::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::watlow_mpm::sics_log 1 "::scobj::watlow_mpm::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}" ::scobj::watlow_mpm::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol} @@ -78,7 +80,7 @@ namespace eval ::scobj::watlow_mpm { proc add_watlow_mpm {name ip_address tcp_port id datype dev_id tol} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::watlow_mpm::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}" "${datype}" "${dev_id}" "${tol}" + ::scobj::watlow_mpm::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol} } clientput "file evaluation of sct_watlow_mpm.tcl" @@ -117,20 +119,31 @@ proc ::scobj::watlow_mpm::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"]" } } @@ -141,6 +154,7 @@ proc ::scobj::watlow_mpm::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } set arg_list [list] set missing_list [list] @@ -157,11 +171,7 @@ proc ::scobj::watlow_mpm::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_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_watlow_mrm.tcl b/site_ansto/instrument/config/environment/temperature/sct_watlow_mrm.tcl index 6258c1d4..ef75df4c 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_watlow_mrm.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_watlow_mrm.tcl @@ -60,7 +60,9 @@ proc ::scobj::watlow_mrm::add_driver {name device_class simulation_flag ip_addre makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::watlow_mrm::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for watlow_mrm" + ::scobj::watlow_mrm::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for watlow_mrm" + ::scobj::watlow_mrm::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::watlow_mrm::sics_log 1 "::scobj::watlow_mrm::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}" ::scobj::watlow_mrm::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol} @@ -78,7 +80,7 @@ namespace eval ::scobj::watlow_mrm { proc add_watlow_mrm {name ip_address tcp_port id datype dev_id tol} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::watlow_mrm::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}" "${datype}" "${dev_id}" "${tol}" + ::scobj::watlow_mrm::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol} } clientput "file evaluation of sct_watlow_mrm.tcl" @@ -117,20 +119,31 @@ proc ::scobj::watlow_mrm::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"]" } } @@ -141,6 +154,7 @@ proc ::scobj::watlow_mrm::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } set arg_list [list] set missing_list [list] @@ -157,11 +171,7 @@ proc ::scobj::watlow_mrm::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_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_watlow_mst4.tcl b/site_ansto/instrument/config/environment/temperature/sct_watlow_mst4.tcl index c81cf81b..b4c66ef3 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_watlow_mst4.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_watlow_mst4.tcl @@ -60,7 +60,9 @@ proc ::scobj::watlow_mst4::add_driver {name device_class simulation_flag ip_addr makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::watlow_mst4::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for watlow_mst4" + ::scobj::watlow_mst4::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for watlow_mst4" + ::scobj::watlow_mst4::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::watlow_mst4::sics_log 1 "::scobj::watlow_mst4::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}" ::scobj::watlow_mst4::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol} @@ -78,7 +80,7 @@ namespace eval ::scobj::watlow_mst4 { proc add_watlow_mst4 {name ip_address tcp_port id datype dev_id tol} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::watlow_mst4::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}" "${datype}" "${dev_id}" "${tol}" + ::scobj::watlow_mst4::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol} } clientput "file evaluation of sct_watlow_mst4.tcl" @@ -117,20 +119,31 @@ proc ::scobj::watlow_mst4::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"]" } } @@ -141,6 +154,7 @@ proc ::scobj::watlow_mst4::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } set arg_list [list] set missing_list [list] @@ -157,11 +171,7 @@ proc ::scobj::watlow_mst4::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_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_west4100.tcl b/site_ansto/instrument/config/environment/temperature/sct_west4100.tcl index d72629bc..0b439f99 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_west4100.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_west4100.tcl @@ -59,7 +59,7 @@ namespace eval ::scobj::west4100 { proc add_west4100 {name ip_address tcp_port dev_id} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::west4100::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${dev_id}" + ::scobj::west4100::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id} } clientput "file evaluation of sct_west4100.tcl" @@ -95,34 +95,7 @@ proc ::scobj::west4100::read_config {} { continue } if { [string equal -nocase [dict get $v "driver"] "west4100"] } { - if { ![string equal -nocase "${simulation_flag}" "false"] } { - set asyncqueue "null" - ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => 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] - } - } 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_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"]" - } - } + ::scobj::west4100::sics_log 9 "No sctcontroller for west4100" set arg_list [list] set missing_list [list] foreach arg {dev_id} { @@ -138,11 +111,7 @@ proc ::scobj::west4100::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_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_west_6100.tcl b/site_ansto/instrument/config/environment/temperature/sct_west_6100.tcl index 2453af03..cdc7fb77 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_west_6100.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_west_6100.tcl @@ -86,7 +86,12 @@ proc ::scobj::west_6100::checkstatus {tc_root} { # checkstatus hook code goes here if {[sct driving]} { set sp "[sct target]" - set pv "[hval ${tc_root}/[sct driveable]]" + if {[hpropexists [sct] simulated] && [sct simulated] == "true"} { + set pv "${sp}" + hupdateif ${tc_root}/[sct driveable] ${sp} + } + set pv "[hval ${tc_root}/[sct driveable]]" + } if { abs(${pv} - ${sp}) <= [sct tolerance] } { if { [hpropexists [sct] settle_time] } { if { [hpropexists [sct] settle_time_start] } { @@ -363,6 +368,15 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/alarm1 type "part" hsetprop ${scobj_hpath}/alarm1 nxalias "${name}_alarm1" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/alarm1 1 + ${sct_controller} write ${scobj_hpath}/alarm1 + hsetprop ${scobj_hpath}/alarm1 simulated false + } else { + ::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100" + hsetprop ${scobj_hpath}/alarm1 simulated true + } + hfactory ${scobj_hpath}/alarm2 plain user float hsetprop ${scobj_hpath}/alarm2 read ${ns}::getDecimal ${scobj_hpath} rdDecimal {14} hsetprop ${scobj_hpath}/alarm2 rdDecimal ${ns}::rdDecimal ${scobj_hpath} @@ -379,6 +393,15 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/alarm2 type "part" hsetprop ${scobj_hpath}/alarm2 nxalias "${name}_alarm2" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/alarm2 1 + ${sct_controller} write ${scobj_hpath}/alarm2 + hsetprop ${scobj_hpath}/alarm2 simulated false + } else { + ::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100" + hsetprop ${scobj_hpath}/alarm2 simulated true + } + hfactory ${scobj_hpath}/power plain user int hsetprop ${scobj_hpath}/power read ${ns}::getInteger ${scobj_hpath} rdInteger {3} hsetprop ${scobj_hpath}/power rdInteger ${ns}::rdInteger ${scobj_hpath} @@ -392,6 +415,14 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/power type "part" hsetprop ${scobj_hpath}/power nxalias "${name}_power" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/power 1 + hsetprop ${scobj_hpath}/power simulated false + } else { + ::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100" + hsetprop ${scobj_hpath}/power simulated true + } + hfactory ${scobj_hpath}/powermax plain user int hsetprop ${scobj_hpath}/powermax read ${ns}::getInteger ${scobj_hpath} rdInteger {20} hsetprop ${scobj_hpath}/powermax rdInteger ${ns}::rdInteger ${scobj_hpath} @@ -408,6 +439,15 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/powermax type "part" hsetprop ${scobj_hpath}/powermax nxalias "${name}_powermax" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/powermax 1 + ${sct_controller} write ${scobj_hpath}/powermax + hsetprop ${scobj_hpath}/powermax simulated false + } else { + ::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100" + hsetprop ${scobj_hpath}/powermax simulated true + } + hfactory ${scobj_hpath}/ramprate plain user float hsetprop ${scobj_hpath}/ramprate read ${ns}::getDecimal ${scobj_hpath} rdDecimal {24} hsetprop ${scobj_hpath}/ramprate rdDecimal ${ns}::rdDecimal ${scobj_hpath} @@ -424,6 +464,15 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/ramprate type "part" hsetprop ${scobj_hpath}/ramprate nxalias "${name}_ramprate" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/ramprate 1 + ${sct_controller} write ${scobj_hpath}/ramprate + hsetprop ${scobj_hpath}/ramprate simulated false + } else { + ::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100" + hsetprop ${scobj_hpath}/ramprate simulated true + } + hfactory ${scobj_hpath}/sensor plain user float hsetprop ${scobj_hpath}/sensor read ${ns}::getDecimal ${scobj_hpath} rdDecimal {1} hsetprop ${scobj_hpath}/sensor rdDecimal ${ns}::rdDecimal ${scobj_hpath} @@ -439,6 +488,14 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/sensor type "part" hsetprop ${scobj_hpath}/sensor nxalias "${name}_sensor" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor 1 + hsetprop ${scobj_hpath}/sensor simulated false + } else { + ::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100" + hsetprop ${scobj_hpath}/sensor simulated true + } + hfactory ${scobj_hpath}/setpoint plain user float hsetprop ${scobj_hpath}/setpoint read ${ns}::getDecimal ${scobj_hpath} rdDecimal {2} hsetprop ${scobj_hpath}/setpoint rdDecimal ${ns}::rdDecimal ${scobj_hpath} @@ -466,6 +523,15 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/setpoint type "drivable" hsetprop ${scobj_hpath}/setpoint nxalias "${name}_setpoint" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/setpoint 1 + ${sct_controller} write ${scobj_hpath}/setpoint + hsetprop ${scobj_hpath}/setpoint simulated false + } else { + ::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100" + hsetprop ${scobj_hpath}/setpoint simulated true + } + hfactory ${scobj_hpath}/w_sp plain user float hsetprop ${scobj_hpath}/w_sp read ${ns}::getDecimal ${scobj_hpath} rdDecimal {21} hsetprop ${scobj_hpath}/w_sp rdDecimal ${ns}::rdDecimal ${scobj_hpath} @@ -482,33 +548,21 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/w_sp type "part" hsetprop ${scobj_hpath}/w_sp nxalias "${name}_w_sp" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/w_sp 1 + ${sct_controller} write ${scobj_hpath}/w_sp + hsetprop ${scobj_hpath}/w_sp simulated false + } else { + ::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100" + hsetprop ${scobj_hpath}/w_sp 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}/alarm1 1 - ${sct_controller} poll ${scobj_hpath}/alarm2 1 - ${sct_controller} poll ${scobj_hpath}/power 1 - ${sct_controller} poll ${scobj_hpath}/powermax 1 - ${sct_controller} poll ${scobj_hpath}/ramprate 1 - ${sct_controller} poll ${scobj_hpath}/sensor 1 - ${sct_controller} poll ${scobj_hpath}/setpoint 1 - ${sct_controller} poll ${scobj_hpath}/w_sp 1 - ${sct_controller} write ${scobj_hpath}/alarm1 - ${sct_controller} write ${scobj_hpath}/alarm2 - ${sct_controller} write ${scobj_hpath}/powermax - ${sct_controller} write ${scobj_hpath}/ramprate - ${sct_controller} write ${scobj_hpath}/setpoint - ${sct_controller} write ${scobj_hpath}/w_sp - } else { - ::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100" - } + ansto_makesctdrive ${name}_setpoint ${scobj_hpath}/setpoint ${scobj_hpath}/sensor ${sct_controller} hfactory ${scobj_hpath}/aux plain spy none - hsetprop ${scobj_hpath}/aux data "false" - hsetprop ${scobj_hpath}/aux klass "@none" - hsetprop ${scobj_hpath}/aux type "part" hfactory ${scobj_hpath}/aux/decimal plain user int hsetprop ${scobj_hpath}/aux/decimal read ${ns}::getInteger ${scobj_hpath} rdInteger {18} @@ -523,6 +577,14 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/aux/decimal type "part" hsetprop ${scobj_hpath}/aux/decimal nxalias "${name}_aux_decimal" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/aux/decimal 2 + hsetprop ${scobj_hpath}/aux/decimal simulated false + } else { + ::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100" + hsetprop ${scobj_hpath}/aux/decimal simulated true + } + hfactory ${scobj_hpath}/aux/instatus plain user int hsetprop ${scobj_hpath}/aux/instatus read ${ns}::getInteger ${scobj_hpath} rdInteger {133} hsetprop ${scobj_hpath}/aux/instatus rdInteger ${ns}::rdInteger ${scobj_hpath} @@ -535,6 +597,14 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/aux/instatus type "part" hsetprop ${scobj_hpath}/aux/instatus nxalias "${name}_aux_instatus" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/aux/instatus 2 + hsetprop ${scobj_hpath}/aux/instatus simulated false + } else { + ::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100" + hsetprop ${scobj_hpath}/aux/instatus simulated true + } + hfactory ${scobj_hpath}/aux/model plain user int hsetprop ${scobj_hpath}/aux/model read ${ns}::getInteger ${scobj_hpath} rdInteger {122} hsetprop ${scobj_hpath}/aux/model rdInteger ${ns}::rdInteger ${scobj_hpath} @@ -548,18 +618,18 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_ hsetprop ${scobj_hpath}/aux/model nxalias "${name}_aux_model" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/aux/decimal 2 - ${sct_controller} poll ${scobj_hpath}/aux/instatus 2 ${sct_controller} poll ${scobj_hpath}/aux/model 2 + hsetprop ${scobj_hpath}/aux/model simulated false } else { ::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100" + hsetprop ${scobj_hpath}/aux/model simulated true } + hsetprop ${scobj_hpath}/aux data "false" + hsetprop ${scobj_hpath}/aux klass "@none" + hsetprop ${scobj_hpath}/aux type "part" 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} @@ -577,7 +647,9 @@ proc ::scobj::west_6100::add_driver {name device_class simulation_flag ip_addres makesctcontroller sct_${name} modbus_ap ${ip_address}:${tcp_port} } } else { - ::scobj::west_6100::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for west_6100" + ::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for west_6100" + ::scobj::west_6100::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::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} @@ -595,7 +667,7 @@ namespace eval ::scobj::west_6100 { 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} "${id}" + ::scobj::west_6100::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} } clientput "file evaluation of sct_west_6100.tcl" @@ -634,20 +706,31 @@ proc ::scobj::west_6100::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} modbus_ap ${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"]" } } @@ -658,6 +741,7 @@ proc ::scobj::west_6100::read_config {} { if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } + makesctcontroller sct_${name} aqadapter ${asyncqueue} } set arg_list [list] set missing_list [list] @@ -674,11 +758,7 @@ proc ::scobj::west_6100::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list - } + ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list } } } diff --git a/site_ansto/instrument/config/robots/sct_epson_pandp.tcl b/site_ansto/instrument/config/robots/sct_epson_pandp.tcl index 5a3a318d..ed7ab845 100644 --- a/site_ansto/instrument/config/robots/sct_epson_pandp.tcl +++ b/site_ansto/instrument/config/robots/sct_epson_pandp.tcl @@ -60,7 +60,7 @@ namespace eval ::scobj::epson_pandp { proc add_epson_pandp {name ip_address tcp_port robot_name} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::epson_pandp::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${robot_name}" + ::scobj::epson_pandp::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${robot_name} } clientput "file evaluation of sct_epson_pandp.tcl" @@ -96,34 +96,7 @@ proc ::scobj::epson_pandp::read_config {} { continue } if { [string equal -nocase [dict get $v "driver"] "epson_pandp"] } { - if { ![string equal -nocase "${simulation_flag}" "false"] } { - set asyncqueue "null" - ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => 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] - } - } 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_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"]" - } - } + ::scobj::epson_pandp::sics_log 9 "No sctcontroller for epson_pandp" set arg_list [list] set missing_list [list] foreach arg {robot_name} { @@ -139,11 +112,7 @@ proc ::scobj::epson_pandp::read_config {} { 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 - } else { - ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list - } + ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list } } } diff --git a/site_ansto/instrument/config/source/sct_reactor_status.tcl b/site_ansto/instrument/config/source/sct_reactor_status.tcl index a5635221..c62fc253 100644 --- a/site_ansto/instrument/config/source/sct_reactor_status.tcl +++ b/site_ansto/instrument/config/source/sct_reactor_status.tcl @@ -273,6 +273,14 @@ proc ::scobj::reactor_status::mkDriver { sct_controller name device_class simula hsetprop ${scobj_hpath}/status type "part" hsetprop ${scobj_hpath}/status nxalias "${name}_status" + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/status 30 + hsetprop ${scobj_hpath}/status simulated false + } else { + ::scobj::reactor_status::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for reactor_status" + hsetprop ${scobj_hpath}/status simulated true + } + hfactory ${scobj_hpath}/tg123 plain spy float hsetprop ${scobj_hpath}/tg123 control true hsetprop ${scobj_hpath}/tg123 data true @@ -299,12 +307,6 @@ proc ::scobj::reactor_status::mkDriver { sct_controller name device_class simula 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}/status 30 - } else { - ::scobj::reactor_status::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for reactor_status" - } hsetprop ${scobj_hpath} klass ${device_class} hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} debug_threshold 5 @@ -326,7 +328,9 @@ proc ::scobj::reactor_status::add_driver {name device_class simulation_flag ip_a makesctcontroller sct_${name} std ${ip_address}:${tcp_port} } } else { - ::scobj::reactor_status::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for reactor_status" + ::scobj::reactor_status::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for reactor_status" + ::scobj::reactor_status::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL } ::scobj::reactor_status::sics_log 1 "::scobj::reactor_status::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}" ::scobj::reactor_status::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} @@ -344,7 +348,7 @@ namespace eval ::scobj::reactor_status { proc add_reactor_status {name ip_address tcp_port} { set simulation_flag "[string tolower [SplitReply [opal_simulation]]]" - ::scobj::reactor_status::add_driver ${name} "NXsource" "${simulation_flag}" ${ip_address} ${tcp_port} + ::scobj::reactor_status::add_driver ${name} "NXsource" ${simulation_flag} ${ip_address} ${tcp_port} } clientput "file evaluation of sct_reactor_status.tcl" @@ -383,20 +387,31 @@ proc ::scobj::reactor_status::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"]" } } @@ -407,12 +422,9 @@ proc ::scobj::reactor_status::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} } } } From b28af1d0863989a054eb55ca84cbfba238424c28 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 6 Nov 2014 14:43:53 +1100 Subject: [PATCH 10/24] Update the gitignore file for .sw? and .orig files --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 49b99919..66d8d528 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,8 @@ made_config.h PATCH.TXT *.aux *.pdf -*.sw[op] +.*.sw? +*.orig *.svn *~ CVS From 22d81d4195a523ed2e9627a79c1070516de9d62c Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Tue, 28 Oct 2014 14:19:44 +1100 Subject: [PATCH 11/24] Add ls370 to Wombat sics_config.ini --- site_ansto/instrument/hipd/util/sics_config.ini | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/site_ansto/instrument/hipd/util/sics_config.ini b/site_ansto/instrument/hipd/util/sics_config.ini index 28d7c390..4f0cdd40 100644 --- a/site_ansto/instrument/hipd/util/sics_config.ini +++ b/site_ansto/instrument/hipd/util/sics_config.ini @@ -246,6 +246,14 @@ terminator = \r\n tol1 = 1.0 tol2 = 1.0 +[ls370_1] +desc = "Lakeshore 370 Resistance Bridge" +driver = "lakeshore_m370" +imptype = temperature +ip = 10.157.205.42 +port = 4001 +tol = 1.0 + [mercury_scpi_01] desc = "Oxford Mercury temperature controller in Mercury mode" driver = "mercury_scpi" @@ -311,3 +319,4 @@ imptype = temperature ip = 10.157.205.25 port = 502 timeout = 2000 + From 4dbaa0f73dafafa812b9cab1a26a5ee40328cf56 Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Mon, 3 Nov 2014 14:28:41 +1100 Subject: [PATCH 12/24] SICS-723 Provide a detector/reset_trip node to notify GumTree and allow reset. --- .../sans/config/hmm/hmm_configuration.tcl | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/site_ansto/instrument/sans/config/hmm/hmm_configuration.tcl b/site_ansto/instrument/sans/config/hmm/hmm_configuration.tcl index 8a619d2e..c34715e7 100644 --- a/site_ansto/instrument/sans/config/hmm/hmm_configuration.tcl +++ b/site_ansto/instrument/sans/config/hmm/hmm_configuration.tcl @@ -64,6 +64,26 @@ proc ::histogram_memory::isc_initialize {} { } } +# 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 + proc histmem {cmd args} { eval "_histmem $cmd $args" } From a375c6ce206bd0aa45bdb815818af3c31a5af48e Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Wed, 5 Nov 2014 12:52:32 +1100 Subject: [PATCH 13/24] SICS-821: You can now use the "whenall" keyword to forbid a move based on the positions of a set of motors. --- .../anticollider/anticollider_common.tcl | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 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 From 144f6ece2b770f571ed3d8ce61f36307365ba772 Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Wed, 5 Nov 2014 12:59:27 +1100 Subject: [PATCH 14/24] SICS-820 Prevent m2om from being driven into sample holder. --- .../kookaburra/config/anticollider/acscript.txt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/site_ansto/instrument/kookaburra/config/anticollider/acscript.txt b/site_ansto/instrument/kookaburra/config/anticollider/acscript.txt index 8ab23c54..a2c963ba 100644 --- a/site_ansto/instrument/kookaburra/config/anticollider/acscript.txt +++ b/site_ansto/instrument/kookaburra/config/anticollider/acscript.txt @@ -1,4 +1,9 @@ -# 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}} From 95ffc5673ac2db8a4ffa5a38e86340d0f82d1ba5 Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Thu, 6 Nov 2014 15:58:12 +1100 Subject: [PATCH 15/24] Fixed typo in the runsics script which prevents a 'kill -15' from executing. --- site_ansto/instrument/runsics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site_ansto/instrument/runsics.py b/site_ansto/instrument/runsics.py index 85cc110f..45a7473a 100755 --- a/site_ansto/instrument/runsics.py +++ b/site_ansto/instrument/runsics.py @@ -120,7 +120,7 @@ def stop_cmd(server, args): print 'Failed again!' print "Terminating PID %d with EXTREME PREJUDICE (-15)" % (pid) subprocess.call(shlex.split('sudo -u %s /bin/kill -15 %d' % - sics_killer, (pid))) + (sics_killer, pid))) else: return if status_cmd(server, args) != (0,0): From 8ad80f6fee5a35433f3e52a73ce197ecbd4c9a8d Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Thu, 6 Nov 2014 16:46:14 +1100 Subject: [PATCH 16/24] SICS-785 Make sure that TCL does a floating point calc if a SICSvar float is used in a calculation. --- sicvar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sicvar.c b/sicvar.c index 125277e4..075a29af 100644 --- a/sicvar.c +++ b/sicvar.c @@ -456,7 +456,7 @@ int VarWrapper(SConnection * pCon, SicsInterp * pInterp, void *pData, return 1; case veFloat: VarGetFloat(pVar, &fVal); - snprintf(pBueffel,sizeof(pBueffel)-1, "%s = %g", argv[0], fVal); + snprintf(pBueffel,sizeof(pBueffel)-1, "%s = %#g", argv[0], fVal); SCWrite(pCon, pBueffel, eValue); DeleteTokenList(pList); return 1; From 305e903d010ca101b16906383f8d486b4c8f071d Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Mon, 10 Nov 2014 18:57:22 +1100 Subject: [PATCH 17/24] 3He chnage to float and timestamp in seconds --- .../config/beamline/he3_polanal.sct | 49 +++++++++---------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/site_ansto/instrument/config/beamline/he3_polanal.sct b/site_ansto/instrument/config/beamline/he3_polanal.sct index ebee331a..68ba2a24 100644 --- a/site_ansto/instrument/config/beamline/he3_polanal.sct +++ b/site_ansto/instrument/config/beamline/he3_polanal.sct @@ -8,7 +8,7 @@ driver he3_polanal = { group polariser = { conditional = '[string equal -nocase ${has_pol} "true"]'; - type = text; + type = float; var spin = { readable = 900; read_command = 'polariser'; @@ -27,7 +27,7 @@ driver he3_polanal = { } group polariser_start = { conditional = '[string equal -nocase ${has_pol} "true"]'; - type = text; + type = float; var spin = { } var amplitude = { } var freq = { units = 'Hertz'; } @@ -39,7 +39,7 @@ driver he3_polanal = { group analyser = { conditional = '[string equal -nocase ${has_anal} "true"]'; - type = text; + type = float; var spin = { readable = 900; read_command = 'analyser'; @@ -58,7 +58,7 @@ driver he3_polanal = { } group analyser_start = { conditional = '[string equal -nocase ${has_anal} "true"]'; - type = text; + type = float; var spin = { } var amplitude = { } var freq = { units = 'Hertz'; } @@ -92,27 +92,13 @@ driver he3_polanal = { set data [lindex ${dlist} 1] } set path [pathname [sct]] - set timestamp [clock format [clock seconds] -format "%T"] - if {[llength ${dlist}] > 2} { - set new_value [lindex ${dlist} 2] - if { "${new_value}" == "NaN" } { - set new_value 0 - } - hupdateif ${path}/amplitude "${new_value}" - } - if {[llength ${dlist}] > 3} { - hupdateif ${path}/freq "[lindex ${dlist} 3]" - } - if {[llength ${dlist}] > 4} { - hupdateif ${path}/phase "[lindex ${dlist} 4]" - } - if {[llength ${dlist}] > 5} { - hupdateif ${path}/time2 "[lindex ${dlist} 5]" - } - if {[llength ${dlist}] > 6} { - hupdateif ${path}/field "[lindex ${dlist} 6]" - } - hupdateif ${path}/timestamp "${timestamp}" + set timestamp [clock seconds] + [namespace current]::do_update ${path}/amplitude ${dlist} 2 + [namespace current]::do_update ${path}/freq ${dlist} 3 + [namespace current]::do_update ${path}/phase ${dlist} 4 + [namespace current]::do_update ${path}/time2 ${dlist} 5 + [namespace current]::do_update ${path}/field ${dlist} 6 + hupdateif ${path}/timestamp ${timestamp} %%} code setValue = {%% @@ -142,6 +128,19 @@ driver he3_polanal = { set cmd "${cmd_str} +" } %%} + code preamble = { + @TCL + proc do_update { node dlist idx } { + if {[llength ${dlist}] > ${idx}} { + if {![string is double [lindex ${dlist} ${idx}]]} { + hupdateif ${node} 0.0 + } else { + hupdateif ${node} [lindex ${dlist} ${idx}] + } + } + } + @END + } code postamble = { @TCL proc stash {node} { From 14237f734bab1755c7e99b52ed682fa6eccd62df Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Mon, 10 Nov 2014 18:57:46 +1100 Subject: [PATCH 18/24] Change limites on e3200 setpoint --- .../config/environment/temperature/eurotherm_3200.sct | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/site_ansto/instrument/config/environment/temperature/eurotherm_3200.sct b/site_ansto/instrument/config/environment/temperature/eurotherm_3200.sct index 5f99100e..c06a97b7 100644 --- a/site_ansto/instrument/config/environment/temperature/eurotherm_3200.sct +++ b/site_ansto/instrument/config/environment/temperature/eurotherm_3200.sct @@ -3,8 +3,8 @@ driver eurotherm_3200 = { protocol = modbus_ap; class = environment; simulation_group = environment_simulation; - add_args = 'id datype dev_id tol'; - make_args = 'id datype dev_id tol'; + add_args = 'id datype dev_id {tol 5 } {lowerlimit 0} {upperlimit 500}'; + make_args = 'id datype dev_id {tol 5} {lowerlimit 0} {upperlimit 500}'; group util = { data = false; control = false; nxsave = false; mutable = false; @@ -17,7 +17,7 @@ driver eurotherm_3200 = { var sensor = { read_command = '1'; permlink = 'T.S01'; }; writeable = 1; var setpoint = { read_command = '2'; write_command = '2'; permlink = 'T.SP01'; - driveable = loop1/sensor; lowerlimit = 0; upperlimit =40; tolerance = '${tol}'; + driveable = loop1/sensor; lowerlimit = '${lowerlimit}'; upperlimit = '${upperlimit}'; tolerance = '${tol}'; }; } group loop1_extra = { From a42030ff41fc6b7fe8209378f650748fb0d926e0 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Mon, 10 Nov 2014 18:58:29 +1100 Subject: [PATCH 19/24] Bug! missing ' else {' in gen_sct --- site_ansto/instrument/util/gen_sct.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site_ansto/instrument/util/gen_sct.py b/site_ansto/instrument/util/gen_sct.py index 4e5d606d..ca69520b 100755 --- a/site_ansto/instrument/util/gen_sct.py +++ b/site_ansto/instrument/util/gen_sct.py @@ -1311,7 +1311,7 @@ def put_checkstatus_function(MyDriver, func): txt += [' if {[hpropexists [sct] simulated] && [sct simulated] == "true"} {'] txt += [' set pv "${sp}"'] txt += [' hupdateif ${tc_root}/[sct driveable] ${sp}'] - txt += [' }'] + txt += [' } else {'] txt += [' set pv "[hval ${tc_root}/[sct driveable]]"'] txt += [' }'] txt += [' if { abs(${pv} - ${sp}) <= [sct tolerance] } {'] From fe0bc8f0c0c8b1bfc1870080b8846735a1bf2710 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Mon, 10 Nov 2014 18:58:42 +1100 Subject: [PATCH 20/24] Regen two sct drivers --- .../config/beamline/sct_he3_polanal.tcl | 151 +++++++++--------- .../temperature/sct_eurotherm_3200.tcl | 28 ++-- 2 files changed, 90 insertions(+), 89 deletions(-) diff --git a/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl b/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl index c8a59aad..9a14dbc6 100644 --- a/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl +++ b/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl @@ -4,6 +4,17 @@ namespace eval ::scobj::he3_polanal { set debug_threshold 0 +# preamble hook code starts + proc do_update { node dlist idx } { + if {[llength ${dlist}] > ${idx}} { + if {![string is double [lindex ${dlist} ${idx}]]} { + hupdateif ${node} 0.0 + } else { + hupdateif ${node} [lindex ${dlist} ${idx}] + } + } + } +# preamble hook code ends } proc ::scobj::he3_polanal::debug_log {tc_root debug_level debug_string} { @@ -127,27 +138,13 @@ proc ::scobj::he3_polanal::rdValue {tc_root} { set data [lindex ${dlist} 1] } set path [pathname [sct]] - set timestamp [clock format [clock seconds] -format "%T"] - if {[llength ${dlist}] > 2} { - set new_value [lindex ${dlist} 2] - if { "${new_value}" == "NaN" } { - set new_value 0 - } - hupdateif ${path}/amplitude "${new_value}" - } - if {[llength ${dlist}] > 3} { - hupdateif ${path}/freq "[lindex ${dlist} 3]" - } - if {[llength ${dlist}] > 4} { - hupdateif ${path}/phase "[lindex ${dlist} 4]" - } - if {[llength ${dlist}] > 5} { - hupdateif ${path}/time2 "[lindex ${dlist} 5]" - } - if {[llength ${dlist}] > 6} { - hupdateif ${path}/field "[lindex ${dlist} 6]" - } - hupdateif ${path}/timestamp "${timestamp}" + set timestamp [clock seconds] + [namespace current]::do_update ${path}/amplitude ${dlist} 2 + [namespace current]::do_update ${path}/freq ${dlist} 3 + [namespace current]::do_update ${path}/phase ${dlist} 4 + [namespace current]::do_update ${path}/time2 ${dlist} 5 + [namespace current]::do_update ${path}/field ${dlist} 6 + hupdateif ${path}/timestamp ${timestamp} # rdValue hook code ends if { [hpropexists [sct] geterror] } { debug_log ${tc_root} 9 "[sct] error: [sct geterror]" @@ -233,54 +230,54 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hfactory ${scobj_hpath}/analyser plain spy none - hfactory ${scobj_hpath}/analyser/amplitude plain user text + hfactory ${scobj_hpath}/analyser/amplitude plain user float hsetprop ${scobj_hpath}/analyser/amplitude control true hsetprop ${scobj_hpath}/analyser/amplitude data true hsetprop ${scobj_hpath}/analyser/amplitude mutable true hsetprop ${scobj_hpath}/analyser/amplitude nxsave true - hsetprop ${scobj_hpath}/analyser/amplitude oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser/amplitude oldval 0.0 hsetprop ${scobj_hpath}/analyser/amplitude klass "parameter" hsetprop ${scobj_hpath}/analyser/amplitude sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analyser/amplitude type "part" hsetprop ${scobj_hpath}/analyser/amplitude nxalias "${name}_analyser_amplitude" - hfactory ${scobj_hpath}/analyser/field plain user text + hfactory ${scobj_hpath}/analyser/field plain user float hsetprop ${scobj_hpath}/analyser/field control true hsetprop ${scobj_hpath}/analyser/field data true hsetprop ${scobj_hpath}/analyser/field mutable true hsetprop ${scobj_hpath}/analyser/field nxsave true hsetprop ${scobj_hpath}/analyser/field units Oersted - hsetprop ${scobj_hpath}/analyser/field oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser/field oldval 0.0 hsetprop ${scobj_hpath}/analyser/field klass "parameter" hsetprop ${scobj_hpath}/analyser/field sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analyser/field type "part" hsetprop ${scobj_hpath}/analyser/field nxalias "${name}_analyser_field" - hfactory ${scobj_hpath}/analyser/freq plain user text + hfactory ${scobj_hpath}/analyser/freq plain user float hsetprop ${scobj_hpath}/analyser/freq control true hsetprop ${scobj_hpath}/analyser/freq data true hsetprop ${scobj_hpath}/analyser/freq mutable true hsetprop ${scobj_hpath}/analyser/freq nxsave true hsetprop ${scobj_hpath}/analyser/freq units Hertz - hsetprop ${scobj_hpath}/analyser/freq oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser/freq oldval 0.0 hsetprop ${scobj_hpath}/analyser/freq klass "parameter" hsetprop ${scobj_hpath}/analyser/freq sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analyser/freq type "part" hsetprop ${scobj_hpath}/analyser/freq nxalias "${name}_analyser_freq" - hfactory ${scobj_hpath}/analyser/phase plain user text + hfactory ${scobj_hpath}/analyser/phase plain user float hsetprop ${scobj_hpath}/analyser/phase control true hsetprop ${scobj_hpath}/analyser/phase data true hsetprop ${scobj_hpath}/analyser/phase mutable true hsetprop ${scobj_hpath}/analyser/phase nxsave true hsetprop ${scobj_hpath}/analyser/phase units Degree - hsetprop ${scobj_hpath}/analyser/phase oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser/phase oldval 0.0 hsetprop ${scobj_hpath}/analyser/phase klass "parameter" hsetprop ${scobj_hpath}/analyser/phase sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analyser/phase type "part" hsetprop ${scobj_hpath}/analyser/phase nxalias "${name}_analyser_phase" - hfactory ${scobj_hpath}/analyser/spin plain user text + 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 write ${ns}::setValue ${scobj_hpath} chkWrite {analyser} @@ -291,7 +288,7 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/analyser/spin mutable true hsetprop ${scobj_hpath}/analyser/spin nxsave true hsetprop ${scobj_hpath}/analyser/spin values +,-,Refresh - hsetprop ${scobj_hpath}/analyser/spin oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser/spin oldval 0.0 hsetprop ${scobj_hpath}/analyser/spin klass "parameter" hsetprop ${scobj_hpath}/analyser/spin sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analyser/spin type "part" @@ -306,24 +303,24 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/analyser/spin simulated true } - hfactory ${scobj_hpath}/analyser/time2 plain user text + hfactory ${scobj_hpath}/analyser/time2 plain user float hsetprop ${scobj_hpath}/analyser/time2 control true hsetprop ${scobj_hpath}/analyser/time2 data true hsetprop ${scobj_hpath}/analyser/time2 mutable true hsetprop ${scobj_hpath}/analyser/time2 nxsave true hsetprop ${scobj_hpath}/analyser/time2 units Second - hsetprop ${scobj_hpath}/analyser/time2 oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser/time2 oldval 0.0 hsetprop ${scobj_hpath}/analyser/time2 klass "parameter" hsetprop ${scobj_hpath}/analyser/time2 sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analyser/time2 type "part" hsetprop ${scobj_hpath}/analyser/time2 nxalias "${name}_analyser_time2" - hfactory ${scobj_hpath}/analyser/timestamp plain user text + hfactory ${scobj_hpath}/analyser/timestamp plain user float hsetprop ${scobj_hpath}/analyser/timestamp control true hsetprop ${scobj_hpath}/analyser/timestamp data true hsetprop ${scobj_hpath}/analyser/timestamp mutable true hsetprop ${scobj_hpath}/analyser/timestamp nxsave true - hsetprop ${scobj_hpath}/analyser/timestamp oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser/timestamp oldval 0.0 hsetprop ${scobj_hpath}/analyser/timestamp klass "parameter" hsetprop ${scobj_hpath}/analyser/timestamp sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analyser/timestamp type "part" @@ -336,82 +333,82 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hfactory ${scobj_hpath}/analyser_start plain spy none - hfactory ${scobj_hpath}/analyser_start/amplitude plain user text + hfactory ${scobj_hpath}/analyser_start/amplitude plain user float hsetprop ${scobj_hpath}/analyser_start/amplitude control true hsetprop ${scobj_hpath}/analyser_start/amplitude data true hsetprop ${scobj_hpath}/analyser_start/amplitude mutable true hsetprop ${scobj_hpath}/analyser_start/amplitude nxsave true - hsetprop ${scobj_hpath}/analyser_start/amplitude oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser_start/amplitude oldval 0.0 hsetprop ${scobj_hpath}/analyser_start/amplitude klass "parameter" hsetprop ${scobj_hpath}/analyser_start/amplitude sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analyser_start/amplitude type "part" hsetprop ${scobj_hpath}/analyser_start/amplitude nxalias "${name}_analyser_start_amplitude" - hfactory ${scobj_hpath}/analyser_start/field plain user text + hfactory ${scobj_hpath}/analyser_start/field plain user float hsetprop ${scobj_hpath}/analyser_start/field control true hsetprop ${scobj_hpath}/analyser_start/field data true hsetprop ${scobj_hpath}/analyser_start/field mutable true hsetprop ${scobj_hpath}/analyser_start/field nxsave true hsetprop ${scobj_hpath}/analyser_start/field units Oersted - hsetprop ${scobj_hpath}/analyser_start/field oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser_start/field oldval 0.0 hsetprop ${scobj_hpath}/analyser_start/field klass "parameter" hsetprop ${scobj_hpath}/analyser_start/field sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analyser_start/field type "part" hsetprop ${scobj_hpath}/analyser_start/field nxalias "${name}_analyser_start_field" - hfactory ${scobj_hpath}/analyser_start/freq plain user text + hfactory ${scobj_hpath}/analyser_start/freq plain user float hsetprop ${scobj_hpath}/analyser_start/freq control true hsetprop ${scobj_hpath}/analyser_start/freq data true hsetprop ${scobj_hpath}/analyser_start/freq mutable true hsetprop ${scobj_hpath}/analyser_start/freq nxsave true hsetprop ${scobj_hpath}/analyser_start/freq units Hertz - hsetprop ${scobj_hpath}/analyser_start/freq oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser_start/freq oldval 0.0 hsetprop ${scobj_hpath}/analyser_start/freq klass "parameter" hsetprop ${scobj_hpath}/analyser_start/freq sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analyser_start/freq type "part" hsetprop ${scobj_hpath}/analyser_start/freq nxalias "${name}_analyser_start_freq" - hfactory ${scobj_hpath}/analyser_start/phase plain user text + hfactory ${scobj_hpath}/analyser_start/phase plain user float hsetprop ${scobj_hpath}/analyser_start/phase control true hsetprop ${scobj_hpath}/analyser_start/phase data true hsetprop ${scobj_hpath}/analyser_start/phase mutable true hsetprop ${scobj_hpath}/analyser_start/phase nxsave true hsetprop ${scobj_hpath}/analyser_start/phase units Degree - hsetprop ${scobj_hpath}/analyser_start/phase oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser_start/phase oldval 0.0 hsetprop ${scobj_hpath}/analyser_start/phase klass "parameter" hsetprop ${scobj_hpath}/analyser_start/phase sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analyser_start/phase type "part" hsetprop ${scobj_hpath}/analyser_start/phase nxalias "${name}_analyser_start_phase" - hfactory ${scobj_hpath}/analyser_start/spin plain user text + hfactory ${scobj_hpath}/analyser_start/spin plain user float hsetprop ${scobj_hpath}/analyser_start/spin control true hsetprop ${scobj_hpath}/analyser_start/spin data true hsetprop ${scobj_hpath}/analyser_start/spin mutable true hsetprop ${scobj_hpath}/analyser_start/spin nxsave true - hsetprop ${scobj_hpath}/analyser_start/spin oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser_start/spin oldval 0.0 hsetprop ${scobj_hpath}/analyser_start/spin klass "parameter" hsetprop ${scobj_hpath}/analyser_start/spin sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analyser_start/spin type "part" hsetprop ${scobj_hpath}/analyser_start/spin nxalias "${name}_analyser_start_spin" - hfactory ${scobj_hpath}/analyser_start/time2 plain user text + hfactory ${scobj_hpath}/analyser_start/time2 plain user float hsetprop ${scobj_hpath}/analyser_start/time2 control true hsetprop ${scobj_hpath}/analyser_start/time2 data true hsetprop ${scobj_hpath}/analyser_start/time2 mutable true hsetprop ${scobj_hpath}/analyser_start/time2 nxsave true hsetprop ${scobj_hpath}/analyser_start/time2 units Second - hsetprop ${scobj_hpath}/analyser_start/time2 oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser_start/time2 oldval 0.0 hsetprop ${scobj_hpath}/analyser_start/time2 klass "parameter" hsetprop ${scobj_hpath}/analyser_start/time2 sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analyser_start/time2 type "part" hsetprop ${scobj_hpath}/analyser_start/time2 nxalias "${name}_analyser_start_time2" - hfactory ${scobj_hpath}/analyser_start/timestamp plain user text + hfactory ${scobj_hpath}/analyser_start/timestamp plain user float hsetprop ${scobj_hpath}/analyser_start/timestamp control true hsetprop ${scobj_hpath}/analyser_start/timestamp data true hsetprop ${scobj_hpath}/analyser_start/timestamp mutable true hsetprop ${scobj_hpath}/analyser_start/timestamp nxsave true - hsetprop ${scobj_hpath}/analyser_start/timestamp oldval UNKNOWN + hsetprop ${scobj_hpath}/analyser_start/timestamp oldval 0.0 hsetprop ${scobj_hpath}/analyser_start/timestamp klass "parameter" hsetprop ${scobj_hpath}/analyser_start/timestamp sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analyser_start/timestamp type "part" @@ -424,54 +421,54 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hfactory ${scobj_hpath}/polariser plain spy none - hfactory ${scobj_hpath}/polariser/amplitude plain user text + hfactory ${scobj_hpath}/polariser/amplitude plain user float hsetprop ${scobj_hpath}/polariser/amplitude control true hsetprop ${scobj_hpath}/polariser/amplitude data true hsetprop ${scobj_hpath}/polariser/amplitude mutable true hsetprop ${scobj_hpath}/polariser/amplitude nxsave true - hsetprop ${scobj_hpath}/polariser/amplitude oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser/amplitude oldval 0.0 hsetprop ${scobj_hpath}/polariser/amplitude klass "parameter" hsetprop ${scobj_hpath}/polariser/amplitude sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/polariser/amplitude type "part" hsetprop ${scobj_hpath}/polariser/amplitude nxalias "${name}_polariser_amplitude" - hfactory ${scobj_hpath}/polariser/field plain user text + hfactory ${scobj_hpath}/polariser/field plain user float hsetprop ${scobj_hpath}/polariser/field control true hsetprop ${scobj_hpath}/polariser/field data true hsetprop ${scobj_hpath}/polariser/field mutable true hsetprop ${scobj_hpath}/polariser/field nxsave true hsetprop ${scobj_hpath}/polariser/field units Oersted - hsetprop ${scobj_hpath}/polariser/field oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser/field oldval 0.0 hsetprop ${scobj_hpath}/polariser/field klass "parameter" hsetprop ${scobj_hpath}/polariser/field sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/polariser/field type "part" hsetprop ${scobj_hpath}/polariser/field nxalias "${name}_polariser_field" - hfactory ${scobj_hpath}/polariser/freq plain user text + hfactory ${scobj_hpath}/polariser/freq plain user float hsetprop ${scobj_hpath}/polariser/freq control true hsetprop ${scobj_hpath}/polariser/freq data true hsetprop ${scobj_hpath}/polariser/freq mutable true hsetprop ${scobj_hpath}/polariser/freq nxsave true hsetprop ${scobj_hpath}/polariser/freq units Hertz - hsetprop ${scobj_hpath}/polariser/freq oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser/freq oldval 0.0 hsetprop ${scobj_hpath}/polariser/freq klass "parameter" hsetprop ${scobj_hpath}/polariser/freq sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/polariser/freq type "part" hsetprop ${scobj_hpath}/polariser/freq nxalias "${name}_polariser_freq" - hfactory ${scobj_hpath}/polariser/phase plain user text + hfactory ${scobj_hpath}/polariser/phase plain user float hsetprop ${scobj_hpath}/polariser/phase control true hsetprop ${scobj_hpath}/polariser/phase data true hsetprop ${scobj_hpath}/polariser/phase mutable true hsetprop ${scobj_hpath}/polariser/phase nxsave true hsetprop ${scobj_hpath}/polariser/phase units Degree - hsetprop ${scobj_hpath}/polariser/phase oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser/phase oldval 0.0 hsetprop ${scobj_hpath}/polariser/phase klass "parameter" hsetprop ${scobj_hpath}/polariser/phase sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/polariser/phase type "part" hsetprop ${scobj_hpath}/polariser/phase nxalias "${name}_polariser_phase" - hfactory ${scobj_hpath}/polariser/spin plain user text + 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 write ${ns}::setValue ${scobj_hpath} chkWrite {polariser} @@ -482,7 +479,7 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/polariser/spin mutable true hsetprop ${scobj_hpath}/polariser/spin nxsave true hsetprop ${scobj_hpath}/polariser/spin values +,-,Refresh - hsetprop ${scobj_hpath}/polariser/spin oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser/spin oldval 0.0 hsetprop ${scobj_hpath}/polariser/spin klass "parameter" hsetprop ${scobj_hpath}/polariser/spin sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/polariser/spin type "part" @@ -497,24 +494,24 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/polariser/spin simulated true } - hfactory ${scobj_hpath}/polariser/time2 plain user text + hfactory ${scobj_hpath}/polariser/time2 plain user float hsetprop ${scobj_hpath}/polariser/time2 control true hsetprop ${scobj_hpath}/polariser/time2 data true hsetprop ${scobj_hpath}/polariser/time2 mutable true hsetprop ${scobj_hpath}/polariser/time2 nxsave true hsetprop ${scobj_hpath}/polariser/time2 units Second - hsetprop ${scobj_hpath}/polariser/time2 oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser/time2 oldval 0.0 hsetprop ${scobj_hpath}/polariser/time2 klass "parameter" hsetprop ${scobj_hpath}/polariser/time2 sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/polariser/time2 type "part" hsetprop ${scobj_hpath}/polariser/time2 nxalias "${name}_polariser_time2" - hfactory ${scobj_hpath}/polariser/timestamp plain user text + hfactory ${scobj_hpath}/polariser/timestamp plain user float hsetprop ${scobj_hpath}/polariser/timestamp control true hsetprop ${scobj_hpath}/polariser/timestamp data true hsetprop ${scobj_hpath}/polariser/timestamp mutable true hsetprop ${scobj_hpath}/polariser/timestamp nxsave true - hsetprop ${scobj_hpath}/polariser/timestamp oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser/timestamp oldval 0.0 hsetprop ${scobj_hpath}/polariser/timestamp klass "parameter" hsetprop ${scobj_hpath}/polariser/timestamp sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/polariser/timestamp type "part" @@ -527,82 +524,82 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hfactory ${scobj_hpath}/polariser_start plain spy none - hfactory ${scobj_hpath}/polariser_start/amplitude plain user text + hfactory ${scobj_hpath}/polariser_start/amplitude plain user float hsetprop ${scobj_hpath}/polariser_start/amplitude control true hsetprop ${scobj_hpath}/polariser_start/amplitude data true hsetprop ${scobj_hpath}/polariser_start/amplitude mutable true hsetprop ${scobj_hpath}/polariser_start/amplitude nxsave true - hsetprop ${scobj_hpath}/polariser_start/amplitude oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser_start/amplitude oldval 0.0 hsetprop ${scobj_hpath}/polariser_start/amplitude klass "parameter" hsetprop ${scobj_hpath}/polariser_start/amplitude sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/polariser_start/amplitude type "part" hsetprop ${scobj_hpath}/polariser_start/amplitude nxalias "${name}_polariser_start_amplitude" - hfactory ${scobj_hpath}/polariser_start/field plain user text + hfactory ${scobj_hpath}/polariser_start/field plain user float hsetprop ${scobj_hpath}/polariser_start/field control true hsetprop ${scobj_hpath}/polariser_start/field data true hsetprop ${scobj_hpath}/polariser_start/field mutable true hsetprop ${scobj_hpath}/polariser_start/field nxsave true hsetprop ${scobj_hpath}/polariser_start/field units Oersted - hsetprop ${scobj_hpath}/polariser_start/field oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser_start/field oldval 0.0 hsetprop ${scobj_hpath}/polariser_start/field klass "parameter" hsetprop ${scobj_hpath}/polariser_start/field sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/polariser_start/field type "part" hsetprop ${scobj_hpath}/polariser_start/field nxalias "${name}_polariser_start_field" - hfactory ${scobj_hpath}/polariser_start/freq plain user text + hfactory ${scobj_hpath}/polariser_start/freq plain user float hsetprop ${scobj_hpath}/polariser_start/freq control true hsetprop ${scobj_hpath}/polariser_start/freq data true hsetprop ${scobj_hpath}/polariser_start/freq mutable true hsetprop ${scobj_hpath}/polariser_start/freq nxsave true hsetprop ${scobj_hpath}/polariser_start/freq units Hertz - hsetprop ${scobj_hpath}/polariser_start/freq oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser_start/freq oldval 0.0 hsetprop ${scobj_hpath}/polariser_start/freq klass "parameter" hsetprop ${scobj_hpath}/polariser_start/freq sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/polariser_start/freq type "part" hsetprop ${scobj_hpath}/polariser_start/freq nxalias "${name}_polariser_start_freq" - hfactory ${scobj_hpath}/polariser_start/phase plain user text + hfactory ${scobj_hpath}/polariser_start/phase plain user float hsetprop ${scobj_hpath}/polariser_start/phase control true hsetprop ${scobj_hpath}/polariser_start/phase data true hsetprop ${scobj_hpath}/polariser_start/phase mutable true hsetprop ${scobj_hpath}/polariser_start/phase nxsave true hsetprop ${scobj_hpath}/polariser_start/phase units Degree - hsetprop ${scobj_hpath}/polariser_start/phase oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser_start/phase oldval 0.0 hsetprop ${scobj_hpath}/polariser_start/phase klass "parameter" hsetprop ${scobj_hpath}/polariser_start/phase sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/polariser_start/phase type "part" hsetprop ${scobj_hpath}/polariser_start/phase nxalias "${name}_polariser_start_phase" - hfactory ${scobj_hpath}/polariser_start/spin plain user text + hfactory ${scobj_hpath}/polariser_start/spin plain user float hsetprop ${scobj_hpath}/polariser_start/spin control true hsetprop ${scobj_hpath}/polariser_start/spin data true hsetprop ${scobj_hpath}/polariser_start/spin mutable true hsetprop ${scobj_hpath}/polariser_start/spin nxsave true - hsetprop ${scobj_hpath}/polariser_start/spin oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser_start/spin oldval 0.0 hsetprop ${scobj_hpath}/polariser_start/spin klass "parameter" hsetprop ${scobj_hpath}/polariser_start/spin sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/polariser_start/spin type "part" hsetprop ${scobj_hpath}/polariser_start/spin nxalias "${name}_polariser_start_spin" - hfactory ${scobj_hpath}/polariser_start/time2 plain user text + hfactory ${scobj_hpath}/polariser_start/time2 plain user float hsetprop ${scobj_hpath}/polariser_start/time2 control true hsetprop ${scobj_hpath}/polariser_start/time2 data true hsetprop ${scobj_hpath}/polariser_start/time2 mutable true hsetprop ${scobj_hpath}/polariser_start/time2 nxsave true hsetprop ${scobj_hpath}/polariser_start/time2 units Second - hsetprop ${scobj_hpath}/polariser_start/time2 oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser_start/time2 oldval 0.0 hsetprop ${scobj_hpath}/polariser_start/time2 klass "parameter" hsetprop ${scobj_hpath}/polariser_start/time2 sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/polariser_start/time2 type "part" hsetprop ${scobj_hpath}/polariser_start/time2 nxalias "${name}_polariser_start_time2" - hfactory ${scobj_hpath}/polariser_start/timestamp plain user text + hfactory ${scobj_hpath}/polariser_start/timestamp plain user float hsetprop ${scobj_hpath}/polariser_start/timestamp control true hsetprop ${scobj_hpath}/polariser_start/timestamp data true hsetprop ${scobj_hpath}/polariser_start/timestamp mutable true hsetprop ${scobj_hpath}/polariser_start/timestamp nxsave true - hsetprop ${scobj_hpath}/polariser_start/timestamp oldval UNKNOWN + hsetprop ${scobj_hpath}/polariser_start/timestamp oldval 0.0 hsetprop ${scobj_hpath}/polariser_start/timestamp klass "parameter" hsetprop ${scobj_hpath}/polariser_start/timestamp sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/polariser_start/timestamp type "part" diff --git a/site_ansto/instrument/config/environment/temperature/sct_eurotherm_3200.tcl b/site_ansto/instrument/config/environment/temperature/sct_eurotherm_3200.tcl index 690f4227..e4b2358e 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_eurotherm_3200.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_eurotherm_3200.tcl @@ -89,7 +89,7 @@ proc ::scobj::eurotherm_3200::checkstatus {tc_root} { 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] } { @@ -229,8 +229,8 @@ proc ::scobj::eurotherm_3200::setValue {tc_root nextState cmd_str} { handle_exception ${catch_status} ${catch_message} } -proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id datype dev_id tol } { - ::scobj::eurotherm_3200::sics_log 9 "::scobj::eurotherm_3200::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}" +proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id datype dev_id {tol 5} {lowerlimit 0} {upperlimit 500} } { + ::scobj::eurotherm_3200::sics_log 9 "::scobj::eurotherm_3200::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol} ${lowerlimit} ${upperlimit}" set ns "[namespace current]" set catch_status [ catch { @@ -281,8 +281,8 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula hsetprop ${scobj_hpath}/loop1/setpoint data true hsetprop ${scobj_hpath}/loop1/setpoint mutable true hsetprop ${scobj_hpath}/loop1/setpoint nxsave true - hsetprop ${scobj_hpath}/loop1/setpoint lowerlimit 0 - hsetprop ${scobj_hpath}/loop1/setpoint upperlimit 40 + hsetprop ${scobj_hpath}/loop1/setpoint lowerlimit ${lowerlimit} + hsetprop ${scobj_hpath}/loop1/setpoint upperlimit ${upperlimit} hsetprop ${scobj_hpath}/loop1/setpoint tolerance ${tol} hsetprop ${scobj_hpath}/loop1/setpoint permlink data_set "T[format "%02d" ${id}]SP01" hsetprop ${scobj_hpath}/loop1/setpoint @description "T[format "%02d" ${id}]SP01" @@ -569,9 +569,9 @@ proc ::scobj::eurotherm_3200::mkDriver { sct_controller name device_class simula handle_exception ${catch_status} ${catch_message} } -proc ::scobj::eurotherm_3200::add_driver {name device_class simulation_flag ip_address tcp_port id datype dev_id tol} { +proc ::scobj::eurotherm_3200::add_driver {name device_class simulation_flag ip_address tcp_port id datype dev_id {tol 5 } {lowerlimit 0} {upperlimit 500}} { set catch_status [ catch { - ::scobj::eurotherm_3200::sics_log 9 "::scobj::eurotherm_3200::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}" + ::scobj::eurotherm_3200::sics_log 9 "::scobj::eurotherm_3200::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol} ${lowerlimit} ${upperlimit}" if {[string equal -nocase "${simulation_flag}" "false"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} { ::scobj::eurotherm_3200::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" @@ -585,8 +585,8 @@ proc ::scobj::eurotherm_3200::add_driver {name device_class simulation_flag ip_a ::scobj::eurotherm_3200::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" makesctcontroller sct_${name} aqadapter NULL } - ::scobj::eurotherm_3200::sics_log 1 "::scobj::eurotherm_3200::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}" - ::scobj::eurotherm_3200::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol} + ::scobj::eurotherm_3200::sics_log 1 "::scobj::eurotherm_3200::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol} ${lowerlimit} ${upperlimit}" + ::scobj::eurotherm_3200::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol} ${lowerlimit} ${upperlimit} } catch_message ] handle_exception ${catch_status} ${catch_message} } @@ -599,9 +599,9 @@ namespace eval ::scobj::eurotherm_3200 { namespace export add_driver } -proc add_eurotherm_3200 {name ip_address tcp_port id datype dev_id tol} { +proc add_eurotherm_3200 {name ip_address tcp_port id datype dev_id {tol 5 } {lowerlimit 0} {upperlimit 500}} { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" - ::scobj::eurotherm_3200::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol} + ::scobj::eurotherm_3200::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol} ${lowerlimit} ${upperlimit} } clientput "file evaluation of sct_eurotherm_3200.tcl" @@ -679,11 +679,15 @@ proc ::scobj::eurotherm_3200::read_config {} { } set arg_list [list] set missing_list [list] - foreach arg {id datype dev_id tol} { + array unset default_map + array set default_map [list tol 5 lowerlimit 0 upperlimit 500] + foreach arg {id datype dev_id tol lowerlimit upperlimit} { 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 From 23bd45061b5409f97edcd2c0628cdcc31f3d6bba Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Fri, 7 Nov 2014 12:09:24 +1100 Subject: [PATCH 21/24] Copy changes made to ics1-echidna since R31C20 deployment. --- site_ansto/instrument/hrpd/config/INSTCFCOMMON.TXT | 1 + site_ansto/instrument/hrpd/echidna_configuration.tcl | 1 + 2 files changed, 2 insertions(+) diff --git a/site_ansto/instrument/hrpd/config/INSTCFCOMMON.TXT b/site_ansto/instrument/hrpd/config/INSTCFCOMMON.TXT index a8a26ccb..59e09aae 100644 --- a/site_ansto/instrument/hrpd/config/INSTCFCOMMON.TXT +++ b/site_ansto/instrument/hrpd/config/INSTCFCOMMON.TXT @@ -16,6 +16,7 @@ config/hmm/hmm_object.tcl config/hmm/hmm_cylindrical_detector_configuration.tcl config/hmm/anstohm_linked.xml config/robots/sct_pickandplace.tcl +config/robots/sct_epson_pandp.tcl config/scan/scan_common_1.hdd config/scan/scan_common_1.tcl config/nexus/nxscripts_common_1.tcl diff --git a/site_ansto/instrument/hrpd/echidna_configuration.tcl b/site_ansto/instrument/hrpd/echidna_configuration.tcl index 975afd82..e677dde9 100644 --- a/site_ansto/instrument/hrpd/echidna_configuration.tcl +++ b/site_ansto/instrument/hrpd/echidna_configuration.tcl @@ -50,6 +50,7 @@ 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 674fae911575111020b0f59ef5cfc3429b03d98d Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 13 Nov 2014 12:40:18 +1100 Subject: [PATCH 22/24] Regenerate SCT drivers --- .../instrument/config/environment/magneticField/sct_tsi_smc.tcl | 2 +- site_ansto/instrument/config/environment/sct_hiden_xcs.tcl | 2 +- site_ansto/instrument/config/environment/sct_huber_pilot.tcl | 2 +- site_ansto/instrument/config/environment/sct_knauer_pump.tcl | 2 +- site_ansto/instrument/config/environment/sct_nhq_200.tcl | 2 +- .../config/environment/temperature/sct_julabo_lh45_gen.tcl | 2 +- .../config/environment/temperature/sct_mercury_base.tcl | 2 +- .../config/environment/temperature/sct_mercury_pres.tcl | 2 +- .../config/environment/temperature/sct_mercury_scpi.tcl | 2 +- .../config/environment/temperature/sct_mercury_temp.tcl | 2 +- .../config/environment/temperature/sct_mercury_valve.tcl | 2 +- .../config/environment/temperature/sct_pfeiffer_hg.tcl | 2 +- .../instrument/config/environment/temperature/sct_west_6100.tcl | 2 +- 13 files changed, 13 insertions(+), 13 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 7f30d08a..e3607e66 100644 --- a/site_ansto/instrument/config/environment/magneticField/sct_tsi_smc.tcl +++ b/site_ansto/instrument/config/environment/magneticField/sct_tsi_smc.tcl @@ -89,7 +89,7 @@ proc ::scobj::tsi_smc::checkstatus {tc_root} { 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] } { diff --git a/site_ansto/instrument/config/environment/sct_hiden_xcs.tcl b/site_ansto/instrument/config/environment/sct_hiden_xcs.tcl index 6758f56d..766a81af 100644 --- a/site_ansto/instrument/config/environment/sct_hiden_xcs.tcl +++ b/site_ansto/instrument/config/environment/sct_hiden_xcs.tcl @@ -89,7 +89,7 @@ proc ::scobj::hiden_xcs::checkstatus {tc_root} { 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] } { diff --git a/site_ansto/instrument/config/environment/sct_huber_pilot.tcl b/site_ansto/instrument/config/environment/sct_huber_pilot.tcl index 6e4774b0..105af927 100644 --- a/site_ansto/instrument/config/environment/sct_huber_pilot.tcl +++ b/site_ansto/instrument/config/environment/sct_huber_pilot.tcl @@ -92,7 +92,7 @@ proc ::scobj::huber_pilot::checkstatus {tc_root} { 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] } { diff --git a/site_ansto/instrument/config/environment/sct_knauer_pump.tcl b/site_ansto/instrument/config/environment/sct_knauer_pump.tcl index 61aef858..2e04881a 100644 --- a/site_ansto/instrument/config/environment/sct_knauer_pump.tcl +++ b/site_ansto/instrument/config/environment/sct_knauer_pump.tcl @@ -586,7 +586,7 @@ proc ::scobj::knauer_pump::volume_checkstatus {tc_root} { 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] } { diff --git a/site_ansto/instrument/config/environment/sct_nhq_200.tcl b/site_ansto/instrument/config/environment/sct_nhq_200.tcl index 96855507..eb583049 100644 --- a/site_ansto/instrument/config/environment/sct_nhq_200.tcl +++ b/site_ansto/instrument/config/environment/sct_nhq_200.tcl @@ -89,7 +89,7 @@ proc ::scobj::nhq_200::checkstatus {tc_root} { 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] } { 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 708ef71e..922c20ef 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 @@ -89,7 +89,7 @@ proc ::scobj::julabo_lh45_gen::checkstatus {tc_root} { 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] } { diff --git a/site_ansto/instrument/config/environment/temperature/sct_mercury_base.tcl b/site_ansto/instrument/config/environment/temperature/sct_mercury_base.tcl index 5b2a7d6b..576e4163 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_mercury_base.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_mercury_base.tcl @@ -89,7 +89,7 @@ proc ::scobj::mercury_base::checkstatus {tc_root} { 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] } { diff --git a/site_ansto/instrument/config/environment/temperature/sct_mercury_pres.tcl b/site_ansto/instrument/config/environment/temperature/sct_mercury_pres.tcl index c0c754c3..c71bf29c 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_mercury_pres.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_mercury_pres.tcl @@ -89,7 +89,7 @@ proc ::scobj::mercury_pres::checkstatus {tc_root} { 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] } { diff --git a/site_ansto/instrument/config/environment/temperature/sct_mercury_scpi.tcl b/site_ansto/instrument/config/environment/temperature/sct_mercury_scpi.tcl index a7fb0ab2..1e025d09 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_mercury_scpi.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_mercury_scpi.tcl @@ -89,7 +89,7 @@ proc ::scobj::mercury_scpi::checkstatus {tc_root} { 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] } { diff --git a/site_ansto/instrument/config/environment/temperature/sct_mercury_temp.tcl b/site_ansto/instrument/config/environment/temperature/sct_mercury_temp.tcl index 228afefa..ce3c9d40 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_mercury_temp.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_mercury_temp.tcl @@ -89,7 +89,7 @@ proc ::scobj::mercury_temp::checkstatus {tc_root} { 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] } { diff --git a/site_ansto/instrument/config/environment/temperature/sct_mercury_valve.tcl b/site_ansto/instrument/config/environment/temperature/sct_mercury_valve.tcl index 93565135..41c27428 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_mercury_valve.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_mercury_valve.tcl @@ -89,7 +89,7 @@ proc ::scobj::mercury_valve::checkstatus {tc_root} { 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] } { diff --git a/site_ansto/instrument/config/environment/temperature/sct_pfeiffer_hg.tcl b/site_ansto/instrument/config/environment/temperature/sct_pfeiffer_hg.tcl index 6814d2ab..635e141a 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_pfeiffer_hg.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_pfeiffer_hg.tcl @@ -128,7 +128,7 @@ proc ::scobj::pfeiffer_hg::checkstatus {tc_root} { 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] } { 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 cdc7fb77..ad5e0ae0 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_west_6100.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_west_6100.tcl @@ -89,7 +89,7 @@ proc ::scobj::west_6100::checkstatus {tc_root} { 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] } { From 8dea026181db1e03d2f539109e99d15114d2631f Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 13 Nov 2014 12:30:54 +1100 Subject: [PATCH 23/24] Change log_file_name to add _date for sct driver logfiles --- site_ansto/instrument/util/gen_sct.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/site_ansto/instrument/util/gen_sct.py b/site_ansto/instrument/util/gen_sct.py index ca69520b..229cf991 100755 --- a/site_ansto/instrument/util/gen_sct.py +++ b/site_ansto/instrument/util/gen_sct.py @@ -1086,9 +1086,12 @@ def put_preamble(MyDriver): txt += [' set catch_status [ catch {'] txt += [' set debug_threshold [hgetpropval ${tc_root} debug_threshold]'] txt += [' if {${debug_level} >= ${debug_threshold}} {'] - txt += [' set fd [open "../log/%s_[basename ${tc_root}].log" "a"]' % MyDriver['name']] - txt += [' set line "[clock format [clock seconds] -format "%T"] ${debug_string}"'] - txt += [' puts ${fd} "${line}"'] + txt += [' set now [clock seconds]'] + txt += [' set ts [clock format ${now} -format "%Y%m%d"]'] + txt += [' set log_file_name "../log/%s_[basename ${tc_root}]_${ts}.log"' % MyDriver['name']] + txt += [' set fd [open "${log_file_name}" "a"]'] + txt += [' set ts [clock format ${now} -format "%T"]'] + txt += [' puts ${fd} "${ts} ${debug_string}"'] txt += [' close ${fd}'] txt += [' }'] txt += [' } catch_message ]'] From 5fefe5f00967639f287ec362d8f7bfcbec30d71c Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 13 Nov 2014 12:41:22 +1100 Subject: [PATCH 24/24] Regenerate SCT drivers --- .../bilby/config/chopper/sct_astrium_chopper.tcl | 9 ++++++--- .../instrument/bilby/config/motors/sct_shutters.tcl | 9 ++++++--- site_ansto/instrument/bilby/config/motors/sct_tank.tcl | 9 ++++++--- .../instrument/config/beamline/sct_he3_polanal.tcl | 9 ++++++--- .../config/environment/magneticField/sct_bruker.tcl | 9 ++++++--- .../magneticField/sct_green_magnet_labview.tcl | 9 ++++++--- .../config/environment/magneticField/sct_oxford12tlv.tcl | 9 ++++++--- .../config/environment/magneticField/sct_tsi_smc.tcl | 9 ++++++--- .../instrument/config/environment/sct_agilent_33220A.tcl | 9 ++++++--- .../instrument/config/environment/sct_hiden_xcs.tcl | 9 ++++++--- .../instrument/config/environment/sct_huber_pilot.tcl | 9 ++++++--- .../instrument/config/environment/sct_isotech_ps.tcl | 9 ++++++--- .../instrument/config/environment/sct_keithley_m2700.tcl | 9 ++++++--- .../instrument/config/environment/sct_knauer_pump.tcl | 9 ++++++--- .../instrument/config/environment/sct_mvp_valve.tcl | 9 ++++++--- site_ansto/instrument/config/environment/sct_nhq_200.tcl | 9 ++++++--- .../instrument/config/environment/sct_omron_hldc.tcl | 9 ++++++--- .../instrument/config/environment/sct_protekmm.tcl | 9 ++++++--- .../instrument/config/environment/sct_syringe_pump.tcl | 9 ++++++--- .../environment/temperature/sct_eurotherm_3200.tcl | 9 ++++++--- .../environment/temperature/sct_eurotherm_m2000.tcl | 9 ++++++--- .../environment/temperature/sct_julabo_lh45_gen.tcl | 9 ++++++--- .../config/environment/temperature/sct_lakeshore_218.tcl | 9 ++++++--- .../environment/temperature/sct_lakeshore_m370.tcl | 9 ++++++--- .../config/environment/temperature/sct_ls336.tcl | 9 ++++++--- .../config/environment/temperature/sct_ls340.tcl | 9 ++++++--- .../config/environment/temperature/sct_mercury_base.tcl | 9 ++++++--- .../config/environment/temperature/sct_mercury_level.tcl | 9 ++++++--- .../config/environment/temperature/sct_mercury_pres.tcl | 9 ++++++--- .../config/environment/temperature/sct_mercury_scpi.tcl | 9 ++++++--- .../config/environment/temperature/sct_mercury_temp.tcl | 9 ++++++--- .../config/environment/temperature/sct_mercury_valve.tcl | 9 ++++++--- .../config/environment/temperature/sct_nprvasm2.tcl | 9 ++++++--- .../config/environment/temperature/sct_pfeiffer_hg.tcl | 9 ++++++--- .../config/environment/temperature/sct_srs_sr630.tcl | 9 ++++++--- .../config/environment/temperature/sct_watlow_mpm.tcl | 9 ++++++--- .../config/environment/temperature/sct_watlow_mrm.tcl | 9 ++++++--- .../config/environment/temperature/sct_watlow_mst4.tcl | 9 ++++++--- .../config/environment/temperature/sct_west4100.tcl | 9 ++++++--- .../config/environment/temperature/sct_west_6100.tcl | 9 ++++++--- site_ansto/instrument/config/robots/sct_epson_pandp.tcl | 9 ++++++--- .../instrument/config/source/sct_reactor_status.tcl | 9 ++++++--- 42 files changed, 252 insertions(+), 126 deletions(-) diff --git a/site_ansto/instrument/bilby/config/chopper/sct_astrium_chopper.tcl b/site_ansto/instrument/bilby/config/chopper/sct_astrium_chopper.tcl index cd7e8f18..4a45f219 100644 --- a/site_ansto/instrument/bilby/config/chopper/sct_astrium_chopper.tcl +++ b/site_ansto/instrument/bilby/config/chopper/sct_astrium_chopper.tcl @@ -10,9 +10,12 @@ proc ::scobj::astrium_chopper::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/astrium_chopper_[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/astrium_chopper_[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 ] diff --git a/site_ansto/instrument/bilby/config/motors/sct_shutters.tcl b/site_ansto/instrument/bilby/config/motors/sct_shutters.tcl index d409f38e..1c0bbc93 100644 --- a/site_ansto/instrument/bilby/config/motors/sct_shutters.tcl +++ b/site_ansto/instrument/bilby/config/motors/sct_shutters.tcl @@ -10,9 +10,12 @@ proc ::scobj::shutters::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/shutters_[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/shutters_[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 ] diff --git a/site_ansto/instrument/bilby/config/motors/sct_tank.tcl b/site_ansto/instrument/bilby/config/motors/sct_tank.tcl index 8f0019e6..b03db167 100644 --- a/site_ansto/instrument/bilby/config/motors/sct_tank.tcl +++ b/site_ansto/instrument/bilby/config/motors/sct_tank.tcl @@ -10,9 +10,12 @@ proc ::scobj::tank::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/tank_[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/tank_[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 ] diff --git a/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl b/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl index 9a14dbc6..654db951 100644 --- a/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl +++ b/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl @@ -21,9 +21,12 @@ proc ::scobj::he3_polanal::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/he3_polanal_[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/he3_polanal_[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 ] diff --git a/site_ansto/instrument/config/environment/magneticField/sct_bruker.tcl b/site_ansto/instrument/config/environment/magneticField/sct_bruker.tcl index 7133d86f..7093b2d7 100644 --- a/site_ansto/instrument/config/environment/magneticField/sct_bruker.tcl +++ b/site_ansto/instrument/config/environment/magneticField/sct_bruker.tcl @@ -10,9 +10,12 @@ proc ::scobj::bruker::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/bruker_[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/bruker_[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 ] diff --git a/site_ansto/instrument/config/environment/magneticField/sct_green_magnet_labview.tcl b/site_ansto/instrument/config/environment/magneticField/sct_green_magnet_labview.tcl index fda8bef5..87111df6 100644 --- a/site_ansto/instrument/config/environment/magneticField/sct_green_magnet_labview.tcl +++ b/site_ansto/instrument/config/environment/magneticField/sct_green_magnet_labview.tcl @@ -10,9 +10,12 @@ proc ::scobj::green_magnet_labview::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/green_magnet_labview_[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/green_magnet_labview_[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 ] diff --git a/site_ansto/instrument/config/environment/magneticField/sct_oxford12tlv.tcl b/site_ansto/instrument/config/environment/magneticField/sct_oxford12tlv.tcl index 4b5dedc3..7efab920 100644 --- a/site_ansto/instrument/config/environment/magneticField/sct_oxford12tlv.tcl +++ b/site_ansto/instrument/config/environment/magneticField/sct_oxford12tlv.tcl @@ -10,9 +10,12 @@ proc ::scobj::oxford12tlv::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/oxford12tlv_[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/oxford12tlv_[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 ] 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 e3607e66..5a2910aa 100644 --- a/site_ansto/instrument/config/environment/magneticField/sct_tsi_smc.tcl +++ b/site_ansto/instrument/config/environment/magneticField/sct_tsi_smc.tcl @@ -10,9 +10,12 @@ proc ::scobj::tsi_smc::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/tsi_smc_[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/tsi_smc_[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 ] diff --git a/site_ansto/instrument/config/environment/sct_agilent_33220A.tcl b/site_ansto/instrument/config/environment/sct_agilent_33220A.tcl index e608d917..c410636d 100644 --- a/site_ansto/instrument/config/environment/sct_agilent_33220A.tcl +++ b/site_ansto/instrument/config/environment/sct_agilent_33220A.tcl @@ -10,9 +10,12 @@ proc ::scobj::agilent_33220A::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/agilent_33220A_[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/agilent_33220A_[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 ] diff --git a/site_ansto/instrument/config/environment/sct_hiden_xcs.tcl b/site_ansto/instrument/config/environment/sct_hiden_xcs.tcl index 766a81af..67164b2e 100644 --- a/site_ansto/instrument/config/environment/sct_hiden_xcs.tcl +++ b/site_ansto/instrument/config/environment/sct_hiden_xcs.tcl @@ -10,9 +10,12 @@ proc ::scobj::hiden_xcs::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/hiden_xcs_[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/hiden_xcs_[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 ] diff --git a/site_ansto/instrument/config/environment/sct_huber_pilot.tcl b/site_ansto/instrument/config/environment/sct_huber_pilot.tcl index 105af927..b4f6384b 100644 --- a/site_ansto/instrument/config/environment/sct_huber_pilot.tcl +++ b/site_ansto/instrument/config/environment/sct_huber_pilot.tcl @@ -13,9 +13,12 @@ proc ::scobj::huber_pilot::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/huber_pilot_[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/huber_pilot_[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 ] diff --git a/site_ansto/instrument/config/environment/sct_isotech_ps.tcl b/site_ansto/instrument/config/environment/sct_isotech_ps.tcl index f007fc82..5c6ac839 100644 --- a/site_ansto/instrument/config/environment/sct_isotech_ps.tcl +++ b/site_ansto/instrument/config/environment/sct_isotech_ps.tcl @@ -10,9 +10,12 @@ proc ::scobj::isotech_ps::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/isotech_ps_[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/isotech_ps_[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 ] diff --git a/site_ansto/instrument/config/environment/sct_keithley_m2700.tcl b/site_ansto/instrument/config/environment/sct_keithley_m2700.tcl index 5a76d00e..72fda1ad 100644 --- a/site_ansto/instrument/config/environment/sct_keithley_m2700.tcl +++ b/site_ansto/instrument/config/environment/sct_keithley_m2700.tcl @@ -10,9 +10,12 @@ proc ::scobj::keithley_m2700::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/keithley_m2700_[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/keithley_m2700_[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 ] diff --git a/site_ansto/instrument/config/environment/sct_knauer_pump.tcl b/site_ansto/instrument/config/environment/sct_knauer_pump.tcl index 2e04881a..47d7d8a5 100644 --- a/site_ansto/instrument/config/environment/sct_knauer_pump.tcl +++ b/site_ansto/instrument/config/environment/sct_knauer_pump.tcl @@ -10,9 +10,12 @@ proc ::scobj::knauer_pump::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/knauer_pump_[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/knauer_pump_[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 ] diff --git a/site_ansto/instrument/config/environment/sct_mvp_valve.tcl b/site_ansto/instrument/config/environment/sct_mvp_valve.tcl index a721bcb8..7fd5c536 100644 --- a/site_ansto/instrument/config/environment/sct_mvp_valve.tcl +++ b/site_ansto/instrument/config/environment/sct_mvp_valve.tcl @@ -10,9 +10,12 @@ proc ::scobj::mvp_valve::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/mvp_valve_[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/mvp_valve_[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 ] diff --git a/site_ansto/instrument/config/environment/sct_nhq_200.tcl b/site_ansto/instrument/config/environment/sct_nhq_200.tcl index eb583049..fad4bcc3 100644 --- a/site_ansto/instrument/config/environment/sct_nhq_200.tcl +++ b/site_ansto/instrument/config/environment/sct_nhq_200.tcl @@ -10,9 +10,12 @@ proc ::scobj::nhq_200::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/nhq_200_[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/nhq_200_[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 ] diff --git a/site_ansto/instrument/config/environment/sct_omron_hldc.tcl b/site_ansto/instrument/config/environment/sct_omron_hldc.tcl index 7fc25189..ae036bb1 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 ] diff --git a/site_ansto/instrument/config/environment/sct_protekmm.tcl b/site_ansto/instrument/config/environment/sct_protekmm.tcl index fa30a279..27dfa4e3 100644 --- a/site_ansto/instrument/config/environment/sct_protekmm.tcl +++ b/site_ansto/instrument/config/environment/sct_protekmm.tcl @@ -10,9 +10,12 @@ proc ::scobj::protekmm::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/protekmm_[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/protekmm_[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 ] diff --git a/site_ansto/instrument/config/environment/sct_syringe_pump.tcl b/site_ansto/instrument/config/environment/sct_syringe_pump.tcl index 37969f1b..3388b868 100644 --- a/site_ansto/instrument/config/environment/sct_syringe_pump.tcl +++ b/site_ansto/instrument/config/environment/sct_syringe_pump.tcl @@ -10,9 +10,12 @@ proc ::scobj::syringe_pump::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/syringe_pump_[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/syringe_pump_[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 ] diff --git a/site_ansto/instrument/config/environment/temperature/sct_eurotherm_3200.tcl b/site_ansto/instrument/config/environment/temperature/sct_eurotherm_3200.tcl index e4b2358e..b4e7aea2 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_eurotherm_3200.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_eurotherm_3200.tcl @@ -10,9 +10,12 @@ proc ::scobj::eurotherm_3200::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/eurotherm_3200_[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/eurotherm_3200_[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 ] diff --git a/site_ansto/instrument/config/environment/temperature/sct_eurotherm_m2000.tcl b/site_ansto/instrument/config/environment/temperature/sct_eurotherm_m2000.tcl index 54ab2503..72775280 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_eurotherm_m2000.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_eurotherm_m2000.tcl @@ -10,9 +10,12 @@ proc ::scobj::eurotherm_m2000::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/eurotherm_m2000_[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/eurotherm_m2000_[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 ] 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 922c20ef..1e41640b 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 @@ -10,9 +10,12 @@ proc ::scobj::julabo_lh45_gen::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/julabo_lh45_gen_[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/julabo_lh45_gen_[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 ] 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 7f78f926..ad9cfe8e 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 ] 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 ec3b507e..2fb85022 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_m370.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_m370.tcl @@ -10,9 +10,12 @@ proc ::scobj::lakeshore_m370::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_m370_[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_m370_[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 ] diff --git a/site_ansto/instrument/config/environment/temperature/sct_ls336.tcl b/site_ansto/instrument/config/environment/temperature/sct_ls336.tcl index 92c82679..fcbfd4aa 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_ls336.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_ls336.tcl @@ -10,9 +10,12 @@ proc ::scobj::ls336::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/ls336_[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/ls336_[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 ] diff --git a/site_ansto/instrument/config/environment/temperature/sct_ls340.tcl b/site_ansto/instrument/config/environment/temperature/sct_ls340.tcl index ddf1c8c7..0dc417e8 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_ls340.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_ls340.tcl @@ -10,9 +10,12 @@ proc ::scobj::ls340::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/ls340_[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/ls340_[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 ] diff --git a/site_ansto/instrument/config/environment/temperature/sct_mercury_base.tcl b/site_ansto/instrument/config/environment/temperature/sct_mercury_base.tcl index 576e4163..6e3c8e2b 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_mercury_base.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_mercury_base.tcl @@ -10,9 +10,12 @@ proc ::scobj::mercury_base::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/mercury_base_[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/mercury_base_[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 ] diff --git a/site_ansto/instrument/config/environment/temperature/sct_mercury_level.tcl b/site_ansto/instrument/config/environment/temperature/sct_mercury_level.tcl index f995489d..aba8da0e 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_mercury_level.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_mercury_level.tcl @@ -10,9 +10,12 @@ proc ::scobj::mercury_level::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/mercury_level_[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/mercury_level_[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 ] diff --git a/site_ansto/instrument/config/environment/temperature/sct_mercury_pres.tcl b/site_ansto/instrument/config/environment/temperature/sct_mercury_pres.tcl index c71bf29c..26bcb2f9 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_mercury_pres.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_mercury_pres.tcl @@ -10,9 +10,12 @@ proc ::scobj::mercury_pres::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/mercury_pres_[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/mercury_pres_[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 ] diff --git a/site_ansto/instrument/config/environment/temperature/sct_mercury_scpi.tcl b/site_ansto/instrument/config/environment/temperature/sct_mercury_scpi.tcl index 1e025d09..ad1618f9 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_mercury_scpi.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_mercury_scpi.tcl @@ -10,9 +10,12 @@ proc ::scobj::mercury_scpi::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/mercury_scpi_[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/mercury_scpi_[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 ] diff --git a/site_ansto/instrument/config/environment/temperature/sct_mercury_temp.tcl b/site_ansto/instrument/config/environment/temperature/sct_mercury_temp.tcl index ce3c9d40..d4d54adb 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_mercury_temp.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_mercury_temp.tcl @@ -10,9 +10,12 @@ proc ::scobj::mercury_temp::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/mercury_temp_[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/mercury_temp_[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 ] diff --git a/site_ansto/instrument/config/environment/temperature/sct_mercury_valve.tcl b/site_ansto/instrument/config/environment/temperature/sct_mercury_valve.tcl index 41c27428..099d7e09 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_mercury_valve.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_mercury_valve.tcl @@ -10,9 +10,12 @@ proc ::scobj::mercury_valve::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/mercury_valve_[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/mercury_valve_[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 ] diff --git a/site_ansto/instrument/config/environment/temperature/sct_nprvasm2.tcl b/site_ansto/instrument/config/environment/temperature/sct_nprvasm2.tcl index c51ea237..cc3ca0b4 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_nprvasm2.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_nprvasm2.tcl @@ -10,9 +10,12 @@ proc ::scobj::nprvasm2::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/nprvasm2_[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/nprvasm2_[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 ] diff --git a/site_ansto/instrument/config/environment/temperature/sct_pfeiffer_hg.tcl b/site_ansto/instrument/config/environment/temperature/sct_pfeiffer_hg.tcl index 635e141a..72343960 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_pfeiffer_hg.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_pfeiffer_hg.tcl @@ -13,9 +13,12 @@ proc ::scobj::pfeiffer_hg::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/pfeiffer_hg_[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/pfeiffer_hg_[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 ] diff --git a/site_ansto/instrument/config/environment/temperature/sct_srs_sr630.tcl b/site_ansto/instrument/config/environment/temperature/sct_srs_sr630.tcl index 4287b27d..da3e1158 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_srs_sr630.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_srs_sr630.tcl @@ -10,9 +10,12 @@ proc ::scobj::srs_sr630::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/srs_sr630_[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/srs_sr630_[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 ] diff --git a/site_ansto/instrument/config/environment/temperature/sct_watlow_mpm.tcl b/site_ansto/instrument/config/environment/temperature/sct_watlow_mpm.tcl index 3f077f9d..f0d92d9d 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_watlow_mpm.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_watlow_mpm.tcl @@ -10,9 +10,12 @@ proc ::scobj::watlow_mpm::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/watlow_mpm_[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/watlow_mpm_[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 ] diff --git a/site_ansto/instrument/config/environment/temperature/sct_watlow_mrm.tcl b/site_ansto/instrument/config/environment/temperature/sct_watlow_mrm.tcl index ef75df4c..6addd245 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_watlow_mrm.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_watlow_mrm.tcl @@ -10,9 +10,12 @@ proc ::scobj::watlow_mrm::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/watlow_mrm_[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/watlow_mrm_[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 ] diff --git a/site_ansto/instrument/config/environment/temperature/sct_watlow_mst4.tcl b/site_ansto/instrument/config/environment/temperature/sct_watlow_mst4.tcl index b4c66ef3..7d786863 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_watlow_mst4.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_watlow_mst4.tcl @@ -10,9 +10,12 @@ proc ::scobj::watlow_mst4::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/watlow_mst4_[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/watlow_mst4_[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 ] diff --git a/site_ansto/instrument/config/environment/temperature/sct_west4100.tcl b/site_ansto/instrument/config/environment/temperature/sct_west4100.tcl index 0b439f99..94dda30a 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_west4100.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_west4100.tcl @@ -10,9 +10,12 @@ proc ::scobj::west4100::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/west4100_[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/west4100_[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 ] 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 ad5e0ae0..5a818e53 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_west_6100.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_west_6100.tcl @@ -10,9 +10,12 @@ proc ::scobj::west_6100::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/west_6100_[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/west_6100_[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 ] diff --git a/site_ansto/instrument/config/robots/sct_epson_pandp.tcl b/site_ansto/instrument/config/robots/sct_epson_pandp.tcl index ed7ab845..ae97c235 100644 --- a/site_ansto/instrument/config/robots/sct_epson_pandp.tcl +++ b/site_ansto/instrument/config/robots/sct_epson_pandp.tcl @@ -10,9 +10,12 @@ proc ::scobj::epson_pandp::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/epson_pandp_[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/epson_pandp_[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 ] diff --git a/site_ansto/instrument/config/source/sct_reactor_status.tcl b/site_ansto/instrument/config/source/sct_reactor_status.tcl index c62fc253..292c8a57 100644 --- a/site_ansto/instrument/config/source/sct_reactor_status.tcl +++ b/site_ansto/instrument/config/source/sct_reactor_status.tcl @@ -10,9 +10,12 @@ proc ::scobj::reactor_status::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/reactor_status_[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/reactor_status_[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 ]