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} } } }