Regenerated drivers

This commit is contained in:
Douglas Clowes
2014-09-11 13:29:52 +10:00
parent 65b50f3fcc
commit 0cb3f4f91c
36 changed files with 1387 additions and 883 deletions

View File

@ -230,14 +230,14 @@ proc ::scobj::astrium_chopper::setValue {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::astrium_chopper::mkDriver { sct_controller name ip_address tcp_port } { proc ::scobj::astrium_chopper::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } {
::scobj::astrium_chopper::sics_log 9 "::scobj::astrium_chopper::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port}" ::scobj::astrium_chopper::sics_log 9 "::scobj::astrium_chopper::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass NXdisk_chopper sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
@ -316,10 +316,10 @@ proc ::scobj::astrium_chopper::mkDriver { sct_controller name ip_address tcp_por
hsetprop ${scobj_hpath}/blade_1/state type "part" hsetprop ${scobj_hpath}/blade_1/state type "part"
hsetprop ${scobj_hpath}/blade_1/state nxalias "${name}_blade_1_state" hsetprop ${scobj_hpath}/blade_1/state nxalias "${name}_blade_1_state"
if {[string equal -nocase [SplitReply [chopper_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/blade_1/state 1 ${sct_controller} poll ${scobj_hpath}/blade_1/state 1
} else { } else {
::scobj::astrium_chopper::sics_log 9 "[chopper_simulation] => No poll/write for astrium_chopper" ::scobj::astrium_chopper::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for astrium_chopper"
} }
hfactory ${scobj_hpath}/blade_2 plain spy none hfactory ${scobj_hpath}/blade_2 plain spy none
@ -396,10 +396,10 @@ proc ::scobj::astrium_chopper::mkDriver { sct_controller name ip_address tcp_por
hsetprop ${scobj_hpath}/blade_2/state type "part" hsetprop ${scobj_hpath}/blade_2/state type "part"
hsetprop ${scobj_hpath}/blade_2/state nxalias "${name}_blade_2_state" hsetprop ${scobj_hpath}/blade_2/state nxalias "${name}_blade_2_state"
if {[string equal -nocase [SplitReply [chopper_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/blade_2/state 1 ${sct_controller} poll ${scobj_hpath}/blade_2/state 1
} else { } else {
::scobj::astrium_chopper::sics_log 9 "[chopper_simulation] => No poll/write for astrium_chopper" ::scobj::astrium_chopper::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for astrium_chopper"
} }
hfactory ${scobj_hpath}/blade_3 plain spy none hfactory ${scobj_hpath}/blade_3 plain spy none
@ -476,10 +476,10 @@ proc ::scobj::astrium_chopper::mkDriver { sct_controller name ip_address tcp_por
hsetprop ${scobj_hpath}/blade_3/state type "part" hsetprop ${scobj_hpath}/blade_3/state type "part"
hsetprop ${scobj_hpath}/blade_3/state nxalias "${name}_blade_3_state" hsetprop ${scobj_hpath}/blade_3/state nxalias "${name}_blade_3_state"
if {[string equal -nocase [SplitReply [chopper_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/blade_3/state 1 ${sct_controller} poll ${scobj_hpath}/blade_3/state 1
} else { } else {
::scobj::astrium_chopper::sics_log 9 "[chopper_simulation] => No poll/write for astrium_chopper" ::scobj::astrium_chopper::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for astrium_chopper"
} }
hfactory ${scobj_hpath}/blade_4 plain spy none hfactory ${scobj_hpath}/blade_4 plain spy none
@ -556,12 +556,12 @@ proc ::scobj::astrium_chopper::mkDriver { sct_controller name ip_address tcp_por
hsetprop ${scobj_hpath}/blade_4/state type "part" hsetprop ${scobj_hpath}/blade_4/state type "part"
hsetprop ${scobj_hpath}/blade_4/state nxalias "${name}_blade_4_state" hsetprop ${scobj_hpath}/blade_4/state nxalias "${name}_blade_4_state"
if {[string equal -nocase [SplitReply [chopper_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/blade_4/state 1 ${sct_controller} poll ${scobj_hpath}/blade_4/state 1
} else { } else {
::scobj::astrium_chopper::sics_log 9 "[chopper_simulation] => No poll/write for astrium_chopper" ::scobj::astrium_chopper::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for astrium_chopper"
} }
hsetprop ${scobj_hpath} klass NXdisk_chopper hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code starts # mkDriver hook code starts
@ -570,31 +570,37 @@ proc ::scobj::astrium_chopper::mkDriver { sct_controller name ip_address tcp_por
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::astrium_chopper::add_driver {name device_class simulation_flag ip_address tcp_port} {
set catch_status [ catch {
::scobj::astrium_chopper::sics_log 9 "::scobj::astrium_chopper::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::astrium_chopper::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::astrium_chopper::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
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 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}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::astrium_chopper { namespace eval ::scobj::astrium_chopper {
namespace export debug_threshold namespace export debug_threshold
namespace export debug_log namespace export debug_log
namespace export sics_log namespace export sics_log
namespace export mkDriver namespace export mkDriver
namespace export add_driver
} }
proc add_astrium_chopper {name ip_address tcp_port} { proc add_astrium_chopper {name ip_address tcp_port} {
set catch_status [ catch { set simulation_flag "[string tolower [SplitReply [chopper_simulation]]]"
::scobj::astrium_chopper::sics_log 9 "add_astrium_chopper ${name} ${ip_address} ${tcp_port}" ::scobj::astrium_chopper::add_driver ${name} "NXdisk_chopper" "${simulation_flag}" ${ip_address} ${tcp_port}
if {[string equal -nocase [SplitReply [chopper_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::astrium_chopper::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::astrium_chopper::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
}
} else {
::scobj::astrium_chopper::sics_log 9 "[chopper_simulation] => No sctcontroller for astrium_chopper"
}
::scobj::astrium_chopper::sics_log 1 "::scobj::astrium_chopper::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}"
::scobj::astrium_chopper::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
clientput "file evaluation of sct_astrium_chopper.tcl" clientput "file evaluation of sct_astrium_chopper.tcl"
@ -605,6 +611,8 @@ proc ::scobj::astrium_chopper::read_config {} {
set ns "::scobj::astrium_chopper" set ns "::scobj::astrium_chopper"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [chopper_simulation]]]"
set device_class "NXdisk_chopper"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -612,6 +620,12 @@ proc ::scobj::astrium_chopper::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -622,9 +636,9 @@ proc ::scobj::astrium_chopper::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "astrium_chopper"] } { if { [string equal -nocase [dict get $v "driver"] "astrium_chopper"] } {
if { ![string equal -nocase [SplitReply [chopper_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[chopper_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -651,9 +665,9 @@ proc ::scobj::astrium_chopper::read_config {} {
} }
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_astrium_chopper ${name} ${ip_address} ${tcp_port} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} else { } else {
add_astrium_chopper ${name} "aqadapter" ${asyncqueue} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue}
} }
} }
} }

View File

@ -193,14 +193,14 @@ proc ::scobj::shutters::write_switch {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::shutters::mkDriver { sct_controller name ip_address tcp_port } { proc ::scobj::shutters::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } {
::scobj::shutters::sics_log 9 "::scobj::shutters::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port}" ::scobj::shutters::sics_log 9 "::scobj::shutters::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass instrument sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
@ -257,16 +257,16 @@ proc ::scobj::shutters::mkDriver { sct_controller name ip_address tcp_port } {
hsetprop ${scobj_hpath} nxsave "true" hsetprop ${scobj_hpath} nxsave "true"
hsetprop ${scobj_hpath} type "part" hsetprop ${scobj_hpath} type "part"
if {[string equal -nocase [SplitReply [motor_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/fast_shutter 1 ${sct_controller} poll ${scobj_hpath}/fast_shutter 1
${sct_controller} poll ${scobj_hpath}/rough_100 1 ${sct_controller} poll ${scobj_hpath}/rough_100 1
${sct_controller} poll ${scobj_hpath}/rough_40 1 ${sct_controller} poll ${scobj_hpath}/rough_40 1
${sct_controller} write ${scobj_hpath}/rough_100 ${sct_controller} write ${scobj_hpath}/rough_100
${sct_controller} write ${scobj_hpath}/rough_40 ${sct_controller} write ${scobj_hpath}/rough_40
} else { } else {
::scobj::shutters::sics_log 9 "[motor_simulation] => No poll/write for shutters" ::scobj::shutters::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for shutters"
} }
hsetprop ${scobj_hpath} klass instrument hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code starts # mkDriver hook code starts
@ -275,31 +275,37 @@ proc ::scobj::shutters::mkDriver { sct_controller name ip_address tcp_port } {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::shutters::add_driver {name device_class simulation_flag ip_address tcp_port} {
set catch_status [ catch {
::scobj::shutters::sics_log 9 "::scobj::shutters::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::shutters::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::shutters::sics_log 9 "makesctcontroller sct_${name} dmc2280 ${ip_address}:${tcp_port}"
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 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}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::shutters { namespace eval ::scobj::shutters {
namespace export debug_threshold namespace export debug_threshold
namespace export debug_log namespace export debug_log
namespace export sics_log namespace export sics_log
namespace export mkDriver namespace export mkDriver
namespace export add_driver
} }
proc add_shutters {name ip_address tcp_port} { proc add_shutters {name ip_address tcp_port} {
set catch_status [ catch { set simulation_flag "[string tolower [SplitReply [motor_simulation]]]"
::scobj::shutters::sics_log 9 "add_shutters ${name} ${ip_address} ${tcp_port}" ::scobj::shutters::add_driver ${name} "instrument" "${simulation_flag}" ${ip_address} ${tcp_port}
if {[string equal -nocase [SplitReply [motor_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::shutters::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::shutters::sics_log 9 "makesctcontroller sct_${name} dmc2280 ${ip_address}:${tcp_port}"
makesctcontroller sct_${name} dmc2280 ${ip_address}:${tcp_port}
}
} else {
::scobj::shutters::sics_log 9 "[motor_simulation] => No sctcontroller for shutters"
}
::scobj::shutters::sics_log 1 "::scobj::shutters::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}"
::scobj::shutters::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
clientput "file evaluation of sct_shutters.tcl" clientput "file evaluation of sct_shutters.tcl"
@ -310,6 +316,8 @@ proc ::scobj::shutters::read_config {} {
set ns "::scobj::shutters" set ns "::scobj::shutters"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [motor_simulation]]]"
set device_class "instrument"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -317,6 +325,12 @@ proc ::scobj::shutters::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -327,9 +341,9 @@ proc ::scobj::shutters::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "shutters"] } { if { [string equal -nocase [dict get $v "driver"] "shutters"] } {
if { ![string equal -nocase [SplitReply [motor_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[motor_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -356,9 +370,9 @@ proc ::scobj::shutters::read_config {} {
} }
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_shutters ${name} ${ip_address} ${tcp_port} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} else { } else {
add_shutters ${name} "aqadapter" ${asyncqueue} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue}
} }
} }
} }

View File

@ -201,14 +201,14 @@ proc ::scobj::tank::setValue {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::tank::mkDriver { sct_controller name ip_address tcp_port } { proc ::scobj::tank::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } {
::scobj::tank::sics_log 9 "::scobj::tank::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port}" ::scobj::tank::sics_log 9 "::scobj::tank::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass instrument sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
@ -230,10 +230,10 @@ proc ::scobj::tank::mkDriver { sct_controller name ip_address tcp_port } {
hsetprop ${scobj_hpath} klass "@none" hsetprop ${scobj_hpath} klass "@none"
hsetprop ${scobj_hpath} type "part" hsetprop ${scobj_hpath} type "part"
if {[string equal -nocase [SplitReply [motor_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/pos 1 ${sct_controller} poll ${scobj_hpath}/pos 1
} else { } else {
::scobj::tank::sics_log 9 "[motor_simulation] => No poll/write for tank" ::scobj::tank::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for tank"
} }
hfactory ${scobj_hpath}/limits plain spy none hfactory ${scobj_hpath}/limits plain spy none
@ -267,11 +267,11 @@ proc ::scobj::tank::mkDriver { sct_controller name ip_address tcp_port } {
hsetprop ${scobj_hpath}/limits/reverse type "part" hsetprop ${scobj_hpath}/limits/reverse type "part"
hsetprop ${scobj_hpath}/limits/reverse nxalias "${name}_limits_reverse" hsetprop ${scobj_hpath}/limits/reverse nxalias "${name}_limits_reverse"
if {[string equal -nocase [SplitReply [motor_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/limits/forward 1 ${sct_controller} poll ${scobj_hpath}/limits/forward 1
${sct_controller} poll ${scobj_hpath}/limits/reverse 1 ${sct_controller} poll ${scobj_hpath}/limits/reverse 1
} else { } else {
::scobj::tank::sics_log 9 "[motor_simulation] => No poll/write for tank" ::scobj::tank::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for tank"
} }
hfactory ${scobj_hpath}/switches plain spy none hfactory ${scobj_hpath}/switches plain spy none
@ -305,13 +305,13 @@ proc ::scobj::tank::mkDriver { sct_controller name ip_address tcp_port } {
hsetprop ${scobj_hpath}/switches/reverse type "part" hsetprop ${scobj_hpath}/switches/reverse type "part"
hsetprop ${scobj_hpath}/switches/reverse nxalias "${name}_switches_reverse" hsetprop ${scobj_hpath}/switches/reverse nxalias "${name}_switches_reverse"
if {[string equal -nocase [SplitReply [motor_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/switches/forward 1 ${sct_controller} poll ${scobj_hpath}/switches/forward 1
${sct_controller} poll ${scobj_hpath}/switches/reverse 1 ${sct_controller} poll ${scobj_hpath}/switches/reverse 1
} else { } else {
::scobj::tank::sics_log 9 "[motor_simulation] => No poll/write for tank" ::scobj::tank::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for tank"
} }
hsetprop ${scobj_hpath} klass instrument hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code starts # mkDriver hook code starts
@ -323,17 +323,10 @@ proc ::scobj::tank::mkDriver { sct_controller name ip_address tcp_port } {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::tank { proc ::scobj::tank::add_driver {name device_class simulation_flag ip_address tcp_port} {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
}
proc add_tank {name ip_address tcp_port} {
set catch_status [ catch { set catch_status [ catch {
::scobj::tank::sics_log 9 "add_tank ${name} ${ip_address} ${tcp_port}" ::scobj::tank::sics_log 9 "::scobj::tank::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
if {[string equal -nocase [SplitReply [motor_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::tank::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" ::scobj::tank::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port} makesctcontroller sct_${name} aqadapter ${tcp_port}
@ -342,14 +335,27 @@ proc add_tank {name ip_address tcp_port} {
makesctcontroller sct_${name} dmc2280 ${ip_address}:${tcp_port} makesctcontroller sct_${name} dmc2280 ${ip_address}:${tcp_port}
} }
} else { } else {
::scobj::tank::sics_log 9 "[motor_simulation] => No sctcontroller for tank" ::scobj::tank::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for tank"
} }
::scobj::tank::sics_log 1 "::scobj::tank::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}" ::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} ${ip_address} ${tcp_port} ::scobj::tank::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} catch_message ] } catch_message ]
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::tank {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
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}
}
clientput "file evaluation of sct_tank.tcl" clientput "file evaluation of sct_tank.tcl"
::scobj::tank::sics_log 9 "file evaluation of sct_tank.tcl" ::scobj::tank::sics_log 9 "file evaluation of sct_tank.tcl"
@ -358,6 +364,8 @@ proc ::scobj::tank::read_config {} {
set ns "::scobj::tank" set ns "::scobj::tank"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [motor_simulation]]]"
set device_class "instrument"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -365,6 +373,12 @@ proc ::scobj::tank::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -375,9 +389,9 @@ proc ::scobj::tank::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "tank"] } { if { [string equal -nocase [dict get $v "driver"] "tank"] } {
if { ![string equal -nocase [SplitReply [motor_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[motor_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -404,9 +418,9 @@ proc ::scobj::tank::read_config {} {
} }
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_tank ${name} ${ip_address} ${tcp_port} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} else { } else {
add_tank ${name} "aqadapter" ${asyncqueue} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue}
} }
} }
} }

View File

@ -27,8 +27,8 @@ proc ::scobj::green_magnet_labview::sics_log {debug_level debug_string} {
} catch_message ] } catch_message ]
} }
proc ::scobj::green_magnet_labview::mkDriver { sct_controller name ip_address tcp_port } { proc ::scobj::green_magnet_labview::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } {
::scobj::green_magnet_labview::sics_log 9 "::scobj::green_magnet_labview::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port}" ::scobj::green_magnet_labview::sics_log 9 "::scobj::green_magnet_labview::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
@ -46,21 +46,27 @@ proc ::scobj::green_magnet_labview::mkDriver { sct_controller name ip_address tc
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::green_magnet_labview::add_driver {name device_class simulation_flag ip_address tcp_port} {
set catch_status [ catch {
::scobj::green_magnet_labview::sics_log 9 "::scobj::green_magnet_labview::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
::scobj::green_magnet_labview::sics_log 9 "No sctcontroller for green_magnet_labview"
::scobj::green_magnet_labview::sics_log 1 "::scobj::green_magnet_labview::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
::scobj::green_magnet_labview::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::green_magnet_labview { namespace eval ::scobj::green_magnet_labview {
namespace export debug_threshold namespace export debug_threshold
namespace export debug_log namespace export debug_log
namespace export sics_log namespace export sics_log
namespace export mkDriver namespace export mkDriver
namespace export add_driver
} }
proc add_green_magnet_labview {name ip_address tcp_port} { proc add_green_magnet_labview {name ip_address tcp_port} {
set catch_status [ catch { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::green_magnet_labview::sics_log 9 "add_green_magnet_labview ${name} ${ip_address} ${tcp_port}" ::scobj::green_magnet_labview::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port}
::scobj::green_magnet_labview::sics_log 9 "No sctcontroller for green_magnet_labview"
::scobj::green_magnet_labview::sics_log 1 "::scobj::green_magnet_labview::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}"
::scobj::green_magnet_labview::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
clientput "file evaluation of sct_green_magnet_labview.tcl" clientput "file evaluation of sct_green_magnet_labview.tcl"
@ -71,6 +77,8 @@ proc ::scobj::green_magnet_labview::read_config {} {
set ns "::scobj::green_magnet_labview" set ns "::scobj::green_magnet_labview"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -78,6 +86,12 @@ proc ::scobj::green_magnet_labview::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -88,9 +102,9 @@ proc ::scobj::green_magnet_labview::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "green_magnet_labview"] } { if { [string equal -nocase [dict get $v "driver"] "green_magnet_labview"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -117,9 +131,9 @@ proc ::scobj::green_magnet_labview::read_config {} {
} }
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_green_magnet_labview ${name} ${ip_address} ${tcp_port} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} else { } else {
add_green_magnet_labview ${name} "aqadapter" ${asyncqueue} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue}
} }
} }
} }

View File

@ -27,18 +27,18 @@ proc ::scobj::oxford12tlv::sics_log {debug_level debug_string} {
} catch_message ] } catch_message ]
} }
proc ::scobj::oxford12tlv::mkDriver { sct_controller name ip_address tcp_port id datype interval } { proc ::scobj::oxford12tlv::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id datype interval } {
::scobj::oxford12tlv::sics_log 9 "::scobj::oxford12tlv::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${id} ${datype} ${interval}" ::scobj::oxford12tlv::sics_log 9 "::scobj::oxford12tlv::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${interval}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code starts # mkDriver hook code starts
@ -53,17 +53,10 @@ proc ::scobj::oxford12tlv::mkDriver { sct_controller name ip_address tcp_port id
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::oxford12tlv { proc ::scobj::oxford12tlv::add_driver {name device_class simulation_flag ip_address tcp_port id datype interval} {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
}
proc add_oxford12tlv {name ip_address tcp_port id datype interval} {
set catch_status [ catch { set catch_status [ catch {
::scobj::oxford12tlv::sics_log 9 "add_oxford12tlv ${name} ${ip_address} ${tcp_port} ${id} ${datype} ${interval}" ::scobj::oxford12tlv::sics_log 9 "::scobj::oxford12tlv::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${interval}"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::oxford12tlv::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" ::scobj::oxford12tlv::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port} makesctcontroller sct_${name} aqadapter ${tcp_port}
@ -72,14 +65,27 @@ proc add_oxford12tlv {name ip_address tcp_port id datype interval} {
makesctcontroller sct_${name} std ${ip_address}:${tcp_port} makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
} }
} else { } else {
::scobj::oxford12tlv::sics_log 9 "[environment_simulation] => No sctcontroller for oxford12tlv" ::scobj::oxford12tlv::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for oxford12tlv"
} }
::scobj::oxford12tlv::sics_log 1 "::scobj::oxford12tlv::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id} ${datype} ${interval}" ::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} ${ip_address} ${tcp_port} ${id} ${datype} ${interval} ::scobj::oxford12tlv::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${interval}
} catch_message ] } catch_message ]
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::oxford12tlv {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
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}"
}
clientput "file evaluation of sct_oxford12tlv.tcl" clientput "file evaluation of sct_oxford12tlv.tcl"
::scobj::oxford12tlv::sics_log 9 "file evaluation of sct_oxford12tlv.tcl" ::scobj::oxford12tlv::sics_log 9 "file evaluation of sct_oxford12tlv.tcl"
@ -88,6 +94,8 @@ proc ::scobj::oxford12tlv::read_config {} {
set ns "::scobj::oxford12tlv" set ns "::scobj::oxford12tlv"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -95,6 +103,12 @@ proc ::scobj::oxford12tlv::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -105,9 +119,9 @@ proc ::scobj::oxford12tlv::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "oxford12tlv"] } { if { [string equal -nocase [dict get $v "driver"] "oxford12tlv"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -149,9 +163,9 @@ proc ::scobj::oxford12tlv::read_config {} {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_oxford12tlv ${name} ${ip_address} ${tcp_port} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else { } else {
add_oxford12tlv ${name} "aqadapter" ${asyncqueue} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
} }
} }
} }

View File

@ -263,14 +263,14 @@ proc ::scobj::tsi_smc::setValue {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::tsi_smc::mkDriver { sct_controller name ip_address tcp_port id } { proc ::scobj::tsi_smc::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id } {
::scobj::tsi_smc::sics_log 9 "::scobj::tsi_smc::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${id}" ::scobj::tsi_smc::sics_log 9 "::scobj::tsi_smc::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
@ -320,10 +320,10 @@ proc ::scobj::tsi_smc::mkDriver { sct_controller name ip_address tcp_port id } {
hsetprop ${scobj_hpath} klass "@none" hsetprop ${scobj_hpath} klass "@none"
hsetprop ${scobj_hpath} type "part" hsetprop ${scobj_hpath} type "part"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} write ${scobj_hpath}/setpoint ${sct_controller} write ${scobj_hpath}/setpoint
} else { } else {
::scobj::tsi_smc::sics_log 9 "[environment_simulation] => No poll/write for tsi_smc" ::scobj::tsi_smc::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for tsi_smc"
} }
hfactory ${scobj_hpath}/a plain spy none hfactory ${scobj_hpath}/a plain spy none
@ -404,7 +404,7 @@ proc ::scobj::tsi_smc::mkDriver { sct_controller name ip_address tcp_port id } {
hsetprop ${scobj_hpath}/a/S type "part" hsetprop ${scobj_hpath}/a/S type "part"
hsetprop ${scobj_hpath}/a/S nxalias "${name}_a_S" hsetprop ${scobj_hpath}/a/S nxalias "${name}_a_S"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/a/G 1 ${sct_controller} poll ${scobj_hpath}/a/G 1
${sct_controller} poll ${scobj_hpath}/a/J 1 ${sct_controller} poll ${scobj_hpath}/a/J 1
${sct_controller} poll ${scobj_hpath}/a/K 1 ${sct_controller} poll ${scobj_hpath}/a/K 1
@ -412,7 +412,7 @@ proc ::scobj::tsi_smc::mkDriver { sct_controller name ip_address tcp_port id } {
${sct_controller} poll ${scobj_hpath}/a/O 1 ${sct_controller} poll ${scobj_hpath}/a/O 1
${sct_controller} poll ${scobj_hpath}/a/S 1 ${sct_controller} poll ${scobj_hpath}/a/S 1
} else { } else {
::scobj::tsi_smc::sics_log 9 "[environment_simulation] => No poll/write for tsi_smc" ::scobj::tsi_smc::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for tsi_smc"
} }
hfactory ${scobj_hpath}/b plain spy none hfactory ${scobj_hpath}/b plain spy none
@ -485,18 +485,18 @@ proc ::scobj::tsi_smc::mkDriver { sct_controller name ip_address tcp_port id } {
hsetprop ${scobj_hpath}/b/Rate type "part" hsetprop ${scobj_hpath}/b/Rate type "part"
hsetprop ${scobj_hpath}/b/Rate nxalias "${name}_b_Rate" hsetprop ${scobj_hpath}/b/Rate nxalias "${name}_b_Rate"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} write ${scobj_hpath}/b/Lower ${sct_controller} write ${scobj_hpath}/b/Lower
${sct_controller} write ${scobj_hpath}/b/Pause ${sct_controller} write ${scobj_hpath}/b/Pause
${sct_controller} write ${scobj_hpath}/b/Ramp ${sct_controller} write ${scobj_hpath}/b/Ramp
${sct_controller} write ${scobj_hpath}/b/Rate ${sct_controller} write ${scobj_hpath}/b/Rate
} else { } else {
::scobj::tsi_smc::sics_log 9 "[environment_simulation] => No poll/write for tsi_smc" ::scobj::tsi_smc::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for tsi_smc"
} }
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
ansto_makesctdrive ${name}_setpoint ${scobj_hpath}/setpoint ${scobj_hpath}/value ${sct_controller} ansto_makesctdrive ${name}_setpoint ${scobj_hpath}/setpoint ${scobj_hpath}/value ${sct_controller}
} }
# mkDriver hook code goes here # mkDriver hook code goes here
@ -504,31 +504,37 @@ proc ::scobj::tsi_smc::mkDriver { sct_controller name ip_address tcp_port id } {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::tsi_smc::add_driver {name device_class simulation_flag ip_address tcp_port {id 1}} {
set catch_status [ catch {
::scobj::tsi_smc::sics_log 9 "::scobj::tsi_smc::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}"
if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::tsi_smc::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::tsi_smc::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
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 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}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::tsi_smc { namespace eval ::scobj::tsi_smc {
namespace export debug_threshold namespace export debug_threshold
namespace export debug_log namespace export debug_log
namespace export sics_log namespace export sics_log
namespace export mkDriver namespace export mkDriver
namespace export add_driver
} }
proc add_tsi_smc {name ip_address tcp_port {id 1}} { proc add_tsi_smc {name ip_address tcp_port {id 1}} {
set catch_status [ catch { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::tsi_smc::sics_log 9 "add_tsi_smc ${name} ${ip_address} ${tcp_port} ${id}" ::scobj::tsi_smc::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${{id}" "${1}}"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::tsi_smc::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::tsi_smc::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
}
} else {
::scobj::tsi_smc::sics_log 9 "[environment_simulation] => No sctcontroller for tsi_smc"
}
::scobj::tsi_smc::sics_log 1 "::scobj::tsi_smc::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id}"
::scobj::tsi_smc::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
clientput "file evaluation of sct_tsi_smc.tcl" clientput "file evaluation of sct_tsi_smc.tcl"
@ -539,6 +545,8 @@ proc ::scobj::tsi_smc::read_config {} {
set ns "::scobj::tsi_smc" set ns "::scobj::tsi_smc"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -546,6 +554,12 @@ proc ::scobj::tsi_smc::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -556,9 +570,9 @@ proc ::scobj::tsi_smc::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "tsi_smc"] } { if { [string equal -nocase [dict get $v "driver"] "tsi_smc"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -600,9 +614,9 @@ proc ::scobj::tsi_smc::read_config {} {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_tsi_smc ${name} ${ip_address} ${tcp_port} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else { } else {
add_tsi_smc ${name} "aqadapter" ${asyncqueue} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
} }
} }
} }

View File

@ -27,8 +27,8 @@ proc ::scobj::agilent_33220A::sics_log {debug_level debug_string} {
} catch_message ] } catch_message ]
} }
proc ::scobj::agilent_33220A::mkDriver { sct_controller name ip_address tcp_port } { proc ::scobj::agilent_33220A::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } {
::scobj::agilent_33220A::sics_log 9 "::scobj::agilent_33220A::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port}" ::scobj::agilent_33220A::sics_log 9 "::scobj::agilent_33220A::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
@ -40,21 +40,27 @@ proc ::scobj::agilent_33220A::mkDriver { sct_controller name ip_address tcp_port
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::agilent_33220A::add_driver {name device_class simulation_flag ip_address tcp_port} {
set catch_status [ catch {
::scobj::agilent_33220A::sics_log 9 "::scobj::agilent_33220A::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
::scobj::agilent_33220A::sics_log 9 "No sctcontroller for agilent_33220A"
::scobj::agilent_33220A::sics_log 1 "::scobj::agilent_33220A::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
::scobj::agilent_33220A::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::agilent_33220A { namespace eval ::scobj::agilent_33220A {
namespace export debug_threshold namespace export debug_threshold
namespace export debug_log namespace export debug_log
namespace export sics_log namespace export sics_log
namespace export mkDriver namespace export mkDriver
namespace export add_driver
} }
proc add_agilent_33220A {name ip_address tcp_port} { proc add_agilent_33220A {name ip_address tcp_port} {
set catch_status [ catch { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::agilent_33220A::sics_log 9 "add_agilent_33220A ${name} ${ip_address} ${tcp_port}" ::scobj::agilent_33220A::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port}
::scobj::agilent_33220A::sics_log 9 "No sctcontroller for agilent_33220A"
::scobj::agilent_33220A::sics_log 1 "::scobj::agilent_33220A::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}"
::scobj::agilent_33220A::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
clientput "file evaluation of sct_agilent_33220A.tcl" clientput "file evaluation of sct_agilent_33220A.tcl"
@ -65,6 +71,8 @@ proc ::scobj::agilent_33220A::read_config {} {
set ns "::scobj::agilent_33220A" set ns "::scobj::agilent_33220A"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -72,6 +80,12 @@ proc ::scobj::agilent_33220A::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -82,9 +96,9 @@ proc ::scobj::agilent_33220A::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "agilent_33220A"] } { if { [string equal -nocase [dict get $v "driver"] "agilent_33220A"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -111,9 +125,9 @@ proc ::scobj::agilent_33220A::read_config {} {
} }
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_agilent_33220A ${name} ${ip_address} ${tcp_port} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} else { } else {
add_agilent_33220A ${name} "aqadapter" ${asyncqueue} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue}
} }
} }
} }

View File

@ -745,14 +745,14 @@ proc ::scobj::hiden_xcs::write_twelve {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::hiden_xcs::mkDriver { sct_controller name ip_address tcp_port id } { proc ::scobj::hiden_xcs::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id } {
::scobj::hiden_xcs::sics_log 9 "::scobj::hiden_xcs::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${id}" ::scobj::hiden_xcs::sics_log 9 "::scobj::hiden_xcs::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
@ -837,11 +837,11 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name ip_address tcp_port id }
hsetprop ${scobj_hpath} nxsave "true" hsetprop ${scobj_hpath} nxsave "true"
hsetprop ${scobj_hpath} type "part" hsetprop ${scobj_hpath} type "part"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/enabled 10 ${sct_controller} poll ${scobj_hpath}/enabled 10
${sct_controller} write ${scobj_hpath}/enabled ${sct_controller} write ${scobj_hpath}/enabled
} else { } else {
::scobj::hiden_xcs::sics_log 9 "[environment_simulation] => No poll/write for hiden_xcs" ::scobj::hiden_xcs::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for hiden_xcs"
} }
hfactory ${scobj_hpath}/analog plain spy none hfactory ${scobj_hpath}/analog plain spy none
@ -984,7 +984,7 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name ip_address tcp_port id }
hsetprop ${scobj_hpath}/analog/sp3 type "part" hsetprop ${scobj_hpath}/analog/sp3 type "part"
hsetprop ${scobj_hpath}/analog/sp3 nxalias "${name}_analog_sp3" hsetprop ${scobj_hpath}/analog/sp3 nxalias "${name}_analog_sp3"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/analog/ansto_temp 5 ${sct_controller} poll ${scobj_hpath}/analog/ansto_temp 5
${sct_controller} poll ${scobj_hpath}/analog/pv1 5 ${sct_controller} poll ${scobj_hpath}/analog/pv1 5
${sct_controller} poll ${scobj_hpath}/analog/pv2 5 ${sct_controller} poll ${scobj_hpath}/analog/pv2 5
@ -998,7 +998,7 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name ip_address tcp_port id }
${sct_controller} write ${scobj_hpath}/analog/sp2 ${sct_controller} write ${scobj_hpath}/analog/sp2
${sct_controller} write ${scobj_hpath}/analog/sp3 ${sct_controller} write ${scobj_hpath}/analog/sp3
} else { } else {
::scobj::hiden_xcs::sics_log 9 "[environment_simulation] => No poll/write for hiden_xcs" ::scobj::hiden_xcs::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for hiden_xcs"
} }
hfactory ${scobj_hpath}/flow plain spy none hfactory ${scobj_hpath}/flow plain spy none
@ -1054,11 +1054,11 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name ip_address tcp_port id }
hsetprop ${scobj_hpath}/flow/setpoint type "drivable" hsetprop ${scobj_hpath}/flow/setpoint type "drivable"
hsetprop ${scobj_hpath}/flow/setpoint nxalias "${name}_flow_setpoint" hsetprop ${scobj_hpath}/flow/setpoint nxalias "${name}_flow_setpoint"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/flow/sensor 1 ${sct_controller} poll ${scobj_hpath}/flow/sensor 1
${sct_controller} write ${scobj_hpath}/flow/setpoint ${sct_controller} write ${scobj_hpath}/flow/setpoint
} else { } else {
::scobj::hiden_xcs::sics_log 9 "[environment_simulation] => No poll/write for hiden_xcs" ::scobj::hiden_xcs::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for hiden_xcs"
} }
hfactory ${scobj_hpath}/humidity plain spy none hfactory ${scobj_hpath}/humidity plain spy none
@ -1114,16 +1114,16 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name ip_address tcp_port id }
hsetprop ${scobj_hpath}/humidity/setpoint type "drivable" hsetprop ${scobj_hpath}/humidity/setpoint type "drivable"
hsetprop ${scobj_hpath}/humidity/setpoint nxalias "${name}_humidity_setpoint" hsetprop ${scobj_hpath}/humidity/setpoint nxalias "${name}_humidity_setpoint"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/humidity/sensor 1 ${sct_controller} poll ${scobj_hpath}/humidity/sensor 1
${sct_controller} write ${scobj_hpath}/humidity/setpoint ${sct_controller} write ${scobj_hpath}/humidity/setpoint
} else { } else {
::scobj::hiden_xcs::sics_log 9 "[environment_simulation] => No poll/write for hiden_xcs" ::scobj::hiden_xcs::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for hiden_xcs"
} }
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { 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}_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} ansto_makesctdrive ${name}_humidity_setpoint ${scobj_hpath}/humidity/setpoint ${scobj_hpath}/humidity/sensor ${sct_controller}
} }
@ -1133,17 +1133,10 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name ip_address tcp_port id }
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::hiden_xcs { proc ::scobj::hiden_xcs::add_driver {name device_class simulation_flag ip_address tcp_port id} {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
}
proc add_hiden_xcs {name ip_address tcp_port id} {
set catch_status [ catch { set catch_status [ catch {
::scobj::hiden_xcs::sics_log 9 "add_hiden_xcs ${name} ${ip_address} ${tcp_port} ${id}" ::scobj::hiden_xcs::sics_log 9 "::scobj::hiden_xcs::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::hiden_xcs::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" ::scobj::hiden_xcs::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port} makesctcontroller sct_${name} aqadapter ${tcp_port}
@ -1152,14 +1145,27 @@ proc add_hiden_xcs {name ip_address tcp_port id} {
makesctcontroller sct_${name} std ${ip_address}:${tcp_port} makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
} }
} else { } else {
::scobj::hiden_xcs::sics_log 9 "[environment_simulation] => No sctcontroller for hiden_xcs" ::scobj::hiden_xcs::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for hiden_xcs"
} }
::scobj::hiden_xcs::sics_log 1 "::scobj::hiden_xcs::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id}" ::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} ${ip_address} ${tcp_port} ${id} ::scobj::hiden_xcs::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}
} catch_message ] } catch_message ]
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::hiden_xcs {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
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}"
}
clientput "file evaluation of sct_hiden_xcs.tcl" clientput "file evaluation of sct_hiden_xcs.tcl"
::scobj::hiden_xcs::sics_log 9 "file evaluation of sct_hiden_xcs.tcl" ::scobj::hiden_xcs::sics_log 9 "file evaluation of sct_hiden_xcs.tcl"
@ -1168,6 +1174,8 @@ proc ::scobj::hiden_xcs::read_config {} {
set ns "::scobj::hiden_xcs" set ns "::scobj::hiden_xcs"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -1175,6 +1183,12 @@ proc ::scobj::hiden_xcs::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -1185,9 +1199,9 @@ proc ::scobj::hiden_xcs::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "hiden_xcs"] } { if { [string equal -nocase [dict get $v "driver"] "hiden_xcs"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -1229,9 +1243,9 @@ proc ::scobj::hiden_xcs::read_config {} {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_hiden_xcs ${name} ${ip_address} ${tcp_port} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else { } else {
add_hiden_xcs ${name} "aqadapter" ${asyncqueue} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
} }
} }
} }

View File

@ -287,8 +287,8 @@ proc ::scobj::huber_pilot::setValue {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::huber_pilot::mkDriver { sct_controller name ip_address tcp_port } { proc ::scobj::huber_pilot::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } {
::scobj::huber_pilot::sics_log 9 "::scobj::huber_pilot::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port}" ::scobj::huber_pilot::sics_log 9 "::scobj::huber_pilot::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
@ -296,7 +296,7 @@ proc ::scobj::huber_pilot::mkDriver { sct_controller name ip_address tcp_port }
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
@ -415,7 +415,7 @@ proc ::scobj::huber_pilot::mkDriver { sct_controller name ip_address tcp_port }
hsetprop ${scobj_hpath}/Loop1/vTmpMode type "part" hsetprop ${scobj_hpath}/Loop1/vTmpMode type "part"
hsetprop ${scobj_hpath}/Loop1/vTmpMode nxalias "${name}_Loop1_vTmpMode" hsetprop ${scobj_hpath}/Loop1/vTmpMode nxalias "${name}_Loop1_vTmpMode"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/Loop1/sensor_int 1 ${sct_controller} poll ${scobj_hpath}/Loop1/sensor_int 1
${sct_controller} poll ${scobj_hpath}/Loop1/setpoint 1 ${sct_controller} poll ${scobj_hpath}/Loop1/setpoint 1
${sct_controller} poll ${scobj_hpath}/Loop1/vMaxSP 1 ${sct_controller} poll ${scobj_hpath}/Loop1/vMaxSP 1
@ -425,12 +425,12 @@ proc ::scobj::huber_pilot::mkDriver { sct_controller name ip_address tcp_port }
${sct_controller} poll ${scobj_hpath}/Loop1/vTmpMode 1 ${sct_controller} poll ${scobj_hpath}/Loop1/vTmpMode 1
${sct_controller} write ${scobj_hpath}/Loop1/setpoint ${sct_controller} write ${scobj_hpath}/Loop1/setpoint
} else { } else {
::scobj::huber_pilot::sics_log 9 "[environment_simulation] => No poll/write for huber_pilot" ::scobj::huber_pilot::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for huber_pilot"
} }
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
ansto_makesctdrive ${name}_Loop1_setpoint ${scobj_hpath}/Loop1/setpoint ${scobj_hpath}/Loop1/sensor_int ${sct_controller} ansto_makesctdrive ${name}_Loop1_setpoint ${scobj_hpath}/Loop1/setpoint ${scobj_hpath}/Loop1/sensor_int ${sct_controller}
} }
# mkDriver hook code goes here # mkDriver hook code goes here
@ -438,31 +438,37 @@ proc ::scobj::huber_pilot::mkDriver { sct_controller name ip_address tcp_port }
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::huber_pilot::add_driver {name device_class simulation_flag ip_address tcp_port} {
set catch_status [ catch {
::scobj::huber_pilot::sics_log 9 "::scobj::huber_pilot::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::huber_pilot::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::huber_pilot::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
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 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}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::huber_pilot { namespace eval ::scobj::huber_pilot {
namespace export debug_threshold namespace export debug_threshold
namespace export debug_log namespace export debug_log
namespace export sics_log namespace export sics_log
namespace export mkDriver namespace export mkDriver
namespace export add_driver
} }
proc add_huber_pilot {name ip_address tcp_port} { proc add_huber_pilot {name ip_address tcp_port} {
set catch_status [ catch { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::huber_pilot::sics_log 9 "add_huber_pilot ${name} ${ip_address} ${tcp_port}" ::scobj::huber_pilot::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port}
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::huber_pilot::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::huber_pilot::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
}
} else {
::scobj::huber_pilot::sics_log 9 "[environment_simulation] => No sctcontroller for huber_pilot"
}
::scobj::huber_pilot::sics_log 1 "::scobj::huber_pilot::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}"
::scobj::huber_pilot::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
clientput "file evaluation of sct_huber_pilot.tcl" clientput "file evaluation of sct_huber_pilot.tcl"
@ -473,6 +479,8 @@ proc ::scobj::huber_pilot::read_config {} {
set ns "::scobj::huber_pilot" set ns "::scobj::huber_pilot"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -480,6 +488,12 @@ proc ::scobj::huber_pilot::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -490,9 +504,9 @@ proc ::scobj::huber_pilot::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "huber_pilot"] } { if { [string equal -nocase [dict get $v "driver"] "huber_pilot"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -519,9 +533,9 @@ proc ::scobj::huber_pilot::read_config {} {
} }
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_huber_pilot ${name} ${ip_address} ${tcp_port} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} else { } else {
add_huber_pilot ${name} "aqadapter" ${asyncqueue} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue}
} }
} }
} }

View File

@ -240,14 +240,14 @@ proc ::scobj::isotech_ps::write_voltage {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::isotech_ps::mkDriver { sct_controller name ip_address tcp_port } { proc ::scobj::isotech_ps::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } {
::scobj::isotech_ps::sics_log 9 "::scobj::isotech_ps::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port}" ::scobj::isotech_ps::sics_log 9 "::scobj::isotech_ps::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
@ -303,16 +303,16 @@ proc ::scobj::isotech_ps::mkDriver { sct_controller name ip_address tcp_port } {
hsetprop ${scobj_hpath} klass "@none" hsetprop ${scobj_hpath} klass "@none"
hsetprop ${scobj_hpath} type "part" hsetprop ${scobj_hpath} type "part"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/amps 5 ${sct_controller} poll ${scobj_hpath}/amps 5
${sct_controller} poll ${scobj_hpath}/relay 5 ${sct_controller} poll ${scobj_hpath}/relay 5
${sct_controller} poll ${scobj_hpath}/volts 5 ${sct_controller} poll ${scobj_hpath}/volts 5
${sct_controller} write ${scobj_hpath}/relay ${sct_controller} write ${scobj_hpath}/relay
${sct_controller} write ${scobj_hpath}/volts ${sct_controller} write ${scobj_hpath}/volts
} else { } else {
::scobj::isotech_ps::sics_log 9 "[environment_simulation] => No poll/write for isotech_ps" ::scobj::isotech_ps::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for isotech_ps"
} }
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code goes here # mkDriver hook code goes here
@ -320,31 +320,37 @@ proc ::scobj::isotech_ps::mkDriver { sct_controller name ip_address tcp_port } {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::isotech_ps::add_driver {name device_class simulation_flag ip_address tcp_port} {
set catch_status [ catch {
::scobj::isotech_ps::sics_log 9 "::scobj::isotech_ps::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::isotech_ps::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::isotech_ps::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port} \"\\r\""
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 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}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::isotech_ps { namespace eval ::scobj::isotech_ps {
namespace export debug_threshold namespace export debug_threshold
namespace export debug_log namespace export debug_log
namespace export sics_log namespace export sics_log
namespace export mkDriver namespace export mkDriver
namespace export add_driver
} }
proc add_isotech_ps {name ip_address tcp_port} { proc add_isotech_ps {name ip_address tcp_port} {
set catch_status [ catch { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::isotech_ps::sics_log 9 "add_isotech_ps ${name} ${ip_address} ${tcp_port}" ::scobj::isotech_ps::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port}
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::isotech_ps::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::isotech_ps::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port} \"\\r\""
makesctcontroller sct_${name} std ${ip_address}:${tcp_port} "\r"
}
} else {
::scobj::isotech_ps::sics_log 9 "[environment_simulation] => No sctcontroller for isotech_ps"
}
::scobj::isotech_ps::sics_log 1 "::scobj::isotech_ps::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}"
::scobj::isotech_ps::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
clientput "file evaluation of sct_isotech_ps.tcl" clientput "file evaluation of sct_isotech_ps.tcl"
@ -355,6 +361,8 @@ proc ::scobj::isotech_ps::read_config {} {
set ns "::scobj::isotech_ps" set ns "::scobj::isotech_ps"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -362,6 +370,12 @@ proc ::scobj::isotech_ps::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -372,9 +386,9 @@ proc ::scobj::isotech_ps::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "isotech_ps"] } { if { [string equal -nocase [dict get $v "driver"] "isotech_ps"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -401,9 +415,9 @@ proc ::scobj::isotech_ps::read_config {} {
} }
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_isotech_ps ${name} ${ip_address} ${tcp_port} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} else { } else {
add_isotech_ps ${name} "aqadapter" ${asyncqueue} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue}
} }
} }
} }

View File

@ -27,18 +27,18 @@ proc ::scobj::keithley_m2700::sics_log {debug_level debug_string} {
} catch_message ] } catch_message ]
} }
proc ::scobj::keithley_m2700::mkDriver { sct_controller name ip_address tcp_port id datype tol } { proc ::scobj::keithley_m2700::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id datype tol } {
::scobj::keithley_m2700::sics_log 9 "::scobj::keithley_m2700::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${id} ${datype} ${tol}" ::scobj::keithley_m2700::sics_log 9 "::scobj::keithley_m2700::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT user float MakeSICSObj ${name} SCT_OBJECT user float
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code starts # mkDriver hook code starts
@ -48,17 +48,10 @@ proc ::scobj::keithley_m2700::mkDriver { sct_controller name ip_address tcp_port
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::keithley_m2700 { proc ::scobj::keithley_m2700::add_driver {name device_class simulation_flag ip_address tcp_port id datype tol} {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
}
proc add_keithley_m2700 {name ip_address tcp_port id datype tol} {
set catch_status [ catch { set catch_status [ catch {
::scobj::keithley_m2700::sics_log 9 "add_keithley_m2700 ${name} ${ip_address} ${tcp_port} ${id} ${datype} ${tol}" ::scobj::keithley_m2700::sics_log 9 "::scobj::keithley_m2700::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol}"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::keithley_m2700::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" ::scobj::keithley_m2700::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port} makesctcontroller sct_${name} aqadapter ${tcp_port}
@ -67,14 +60,27 @@ proc add_keithley_m2700 {name ip_address tcp_port id datype tol} {
makesctcontroller sct_${name} std ${ip_address}:${tcp_port} makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
} }
} else { } else {
::scobj::keithley_m2700::sics_log 9 "[environment_simulation] => No sctcontroller for keithley_m2700" ::scobj::keithley_m2700::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for keithley_m2700"
} }
::scobj::keithley_m2700::sics_log 1 "::scobj::keithley_m2700::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id} ${datype} ${tol}" ::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} ${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}
} catch_message ] } catch_message ]
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::keithley_m2700 {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
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}"
}
clientput "file evaluation of sct_keithley_m2700.tcl" clientput "file evaluation of sct_keithley_m2700.tcl"
::scobj::keithley_m2700::sics_log 9 "file evaluation of sct_keithley_m2700.tcl" ::scobj::keithley_m2700::sics_log 9 "file evaluation of sct_keithley_m2700.tcl"
@ -83,6 +89,8 @@ proc ::scobj::keithley_m2700::read_config {} {
set ns "::scobj::keithley_m2700" set ns "::scobj::keithley_m2700"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -90,6 +98,12 @@ proc ::scobj::keithley_m2700::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -100,9 +114,9 @@ proc ::scobj::keithley_m2700::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "keithley_m2700"] } { if { [string equal -nocase [dict get $v "driver"] "keithley_m2700"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -144,9 +158,9 @@ proc ::scobj::keithley_m2700::read_config {} {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_keithley_m2700 ${name} ${ip_address} ${tcp_port} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else { } else {
add_keithley_m2700 ${name} "aqadapter" ${asyncqueue} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
} }
} }
} }

View File

@ -269,14 +269,14 @@ proc ::scobj::nhq_200::setValue {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::nhq_200::mkDriver { sct_controller name ip_address tcp_port } { proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } {
::scobj::nhq_200::sics_log 9 "::scobj::nhq_200::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port}" ::scobj::nhq_200::sics_log 9 "::scobj::nhq_200::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass NXdetector sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
@ -311,11 +311,11 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name ip_address tcp_port } {
hsetprop ${scobj_hpath} klass "@none" hsetprop ${scobj_hpath} klass "@none"
hsetprop ${scobj_hpath} type "part" hsetprop ${scobj_hpath} type "part"
if {[string equal -nocase [SplitReply [detector_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/break 10 ${sct_controller} poll ${scobj_hpath}/break 10
${sct_controller} poll ${scobj_hpath}/id 10 ${sct_controller} poll ${scobj_hpath}/id 10
} else { } else {
::scobj::nhq_200::sics_log 9 "[detector_simulation] => No poll/write for nhq_200" ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
} }
hfactory ${scobj_hpath}/ch1 plain spy none hfactory ${scobj_hpath}/ch1 plain spy none
@ -488,7 +488,7 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name ip_address tcp_port } {
hsetprop ${scobj_hpath}/ch1/voltage type "part" hsetprop ${scobj_hpath}/ch1/voltage type "part"
hsetprop ${scobj_hpath}/ch1/voltage nxalias "${name}_ch1_voltage" hsetprop ${scobj_hpath}/ch1/voltage nxalias "${name}_ch1_voltage"
if {[string equal -nocase [SplitReply [detector_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ch1/auto_start 5 ${sct_controller} poll ${scobj_hpath}/ch1/auto_start 5
${sct_controller} poll ${scobj_hpath}/ch1/current 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_lim 5
@ -505,7 +505,7 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name ip_address tcp_port } {
${sct_controller} write ${scobj_hpath}/ch1/v_ramp ${sct_controller} write ${scobj_hpath}/ch1/v_ramp
${sct_controller} write ${scobj_hpath}/ch1/v_sp ${sct_controller} write ${scobj_hpath}/ch1/v_sp
} else { } else {
::scobj::nhq_200::sics_log 9 "[detector_simulation] => No poll/write for nhq_200" ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
} }
hfactory ${scobj_hpath}/ch2 plain spy none hfactory ${scobj_hpath}/ch2 plain spy none
@ -678,7 +678,7 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name ip_address tcp_port } {
hsetprop ${scobj_hpath}/ch2/voltage type "part" hsetprop ${scobj_hpath}/ch2/voltage type "part"
hsetprop ${scobj_hpath}/ch2/voltage nxalias "${name}_ch2_voltage" hsetprop ${scobj_hpath}/ch2/voltage nxalias "${name}_ch2_voltage"
if {[string equal -nocase [SplitReply [detector_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ch2/auto_start 5 ${sct_controller} poll ${scobj_hpath}/ch2/auto_start 5
${sct_controller} poll ${scobj_hpath}/ch2/current 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_lim 5
@ -695,12 +695,12 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name ip_address tcp_port } {
${sct_controller} write ${scobj_hpath}/ch2/v_ramp ${sct_controller} write ${scobj_hpath}/ch2/v_ramp
${sct_controller} write ${scobj_hpath}/ch2/v_sp ${sct_controller} write ${scobj_hpath}/ch2/v_sp
} else { } else {
::scobj::nhq_200::sics_log 9 "[detector_simulation] => No poll/write for nhq_200" ::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
} }
hsetprop ${scobj_hpath} klass NXdetector hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
if {[string equal -nocase [SplitReply [detector_simulation]] "false"]} { 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}_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} ansto_makesctdrive ${name}_ch2_v_sp ${scobj_hpath}/ch2/v_sp ${scobj_hpath}/ch2/voltage ${sct_controller}
} }
@ -709,31 +709,37 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name ip_address tcp_port } {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::nhq_200::add_driver {name device_class simulation_flag ip_address tcp_port} {
set catch_status [ catch {
::scobj::nhq_200::sics_log 9 "::scobj::nhq_200::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::nhq_200::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::nhq_200::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
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 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}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::nhq_200 { namespace eval ::scobj::nhq_200 {
namespace export debug_threshold namespace export debug_threshold
namespace export debug_log namespace export debug_log
namespace export sics_log namespace export sics_log
namespace export mkDriver namespace export mkDriver
namespace export add_driver
} }
proc add_nhq_200 {name ip_address tcp_port} { proc add_nhq_200 {name ip_address tcp_port} {
set catch_status [ catch { set simulation_flag "[string tolower [SplitReply [detector_simulation]]]"
::scobj::nhq_200::sics_log 9 "add_nhq_200 ${name} ${ip_address} ${tcp_port}" ::scobj::nhq_200::add_driver ${name} "NXdetector" "${simulation_flag}" ${ip_address} ${tcp_port}
if {[string equal -nocase [SplitReply [detector_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::nhq_200::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::nhq_200::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
}
} else {
::scobj::nhq_200::sics_log 9 "[detector_simulation] => No sctcontroller for nhq_200"
}
::scobj::nhq_200::sics_log 1 "::scobj::nhq_200::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}"
::scobj::nhq_200::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
clientput "file evaluation of sct_nhq_200.tcl" clientput "file evaluation of sct_nhq_200.tcl"
@ -744,6 +750,8 @@ proc ::scobj::nhq_200::read_config {} {
set ns "::scobj::nhq_200" set ns "::scobj::nhq_200"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [detector_simulation]]]"
set device_class "NXdetector"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -751,6 +759,12 @@ proc ::scobj::nhq_200::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -761,9 +775,9 @@ proc ::scobj::nhq_200::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "nhq_200"] } { if { [string equal -nocase [dict get $v "driver"] "nhq_200"] } {
if { ![string equal -nocase [SplitReply [detector_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[detector_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -790,9 +804,9 @@ proc ::scobj::nhq_200::read_config {} {
} }
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_nhq_200 ${name} ${ip_address} ${tcp_port} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} else { } else {
add_nhq_200 ${name} "aqadapter" ${asyncqueue} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue}
} }
} }
} }

View File

@ -190,14 +190,14 @@ proc ::scobj::omron_hldc::setValue {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::omron_hldc::mkDriver { sct_controller name ip_address tcp_port } { proc ::scobj::omron_hldc::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } {
::scobj::omron_hldc::sics_log 9 "::scobj::omron_hldc::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port}" ::scobj::omron_hldc::sics_log 9 "::scobj::omron_hldc::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
@ -232,13 +232,13 @@ proc ::scobj::omron_hldc::mkDriver { sct_controller name ip_address tcp_port } {
hsetprop ${scobj_hpath} klass "@none" hsetprop ${scobj_hpath} klass "@none"
hsetprop ${scobj_hpath} type "part" hsetprop ${scobj_hpath} type "part"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/distance 1 ${sct_controller} poll ${scobj_hpath}/distance 1
${sct_controller} poll ${scobj_hpath}/id 10 ${sct_controller} poll ${scobj_hpath}/id 10
} else { } else {
::scobj::omron_hldc::sics_log 9 "[environment_simulation] => No poll/write for omron_hldc" ::scobj::omron_hldc::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for omron_hldc"
} }
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code goes here # mkDriver hook code goes here
@ -246,31 +246,37 @@ proc ::scobj::omron_hldc::mkDriver { sct_controller name ip_address tcp_port } {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::omron_hldc::add_driver {name device_class simulation_flag ip_address tcp_port} {
set catch_status [ catch {
::scobj::omron_hldc::sics_log 9 "::scobj::omron_hldc::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::omron_hldc::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::omron_hldc::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
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 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}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::omron_hldc { namespace eval ::scobj::omron_hldc {
namespace export debug_threshold namespace export debug_threshold
namespace export debug_log namespace export debug_log
namespace export sics_log namespace export sics_log
namespace export mkDriver namespace export mkDriver
namespace export add_driver
} }
proc add_omron_hldc {name ip_address tcp_port} { proc add_omron_hldc {name ip_address tcp_port} {
set catch_status [ catch { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::omron_hldc::sics_log 9 "add_omron_hldc ${name} ${ip_address} ${tcp_port}" ::scobj::omron_hldc::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port}
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::omron_hldc::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::omron_hldc::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
}
} else {
::scobj::omron_hldc::sics_log 9 "[environment_simulation] => No sctcontroller for omron_hldc"
}
::scobj::omron_hldc::sics_log 1 "::scobj::omron_hldc::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}"
::scobj::omron_hldc::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
clientput "file evaluation of sct_omron_hldc.tcl" clientput "file evaluation of sct_omron_hldc.tcl"
@ -281,6 +287,8 @@ proc ::scobj::omron_hldc::read_config {} {
set ns "::scobj::omron_hldc" set ns "::scobj::omron_hldc"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -288,6 +296,12 @@ proc ::scobj::omron_hldc::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -298,9 +312,9 @@ proc ::scobj::omron_hldc::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "omron_hldc"] } { if { [string equal -nocase [dict get $v "driver"] "omron_hldc"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -327,9 +341,9 @@ proc ::scobj::omron_hldc::read_config {} {
} }
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_omron_hldc ${name} ${ip_address} ${tcp_port} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} else { } else {
add_omron_hldc ${name} "aqadapter" ${asyncqueue} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue}
} }
} }
} }

View File

@ -27,18 +27,18 @@ proc ::scobj::protekmm::sics_log {debug_level debug_string} {
} catch_message ] } catch_message ]
} }
proc ::scobj::protekmm::mkDriver { sct_controller name ip_address tcp_port id datype } { proc ::scobj::protekmm::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id datype } {
::scobj::protekmm::sics_log 9 "::scobj::protekmm::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${id} ${datype}" ::scobj::protekmm::sics_log 9 "::scobj::protekmm::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT user float MakeSICSObj ${name} SCT_OBJECT user float
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code starts # mkDriver hook code starts
@ -48,17 +48,10 @@ proc ::scobj::protekmm::mkDriver { sct_controller name ip_address tcp_port id da
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::protekmm { proc ::scobj::protekmm::add_driver {name device_class simulation_flag ip_address tcp_port id datype} {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
}
proc add_protekmm {name ip_address tcp_port id datype} {
set catch_status [ catch { set catch_status [ catch {
::scobj::protekmm::sics_log 9 "add_protekmm ${name} ${ip_address} ${tcp_port} ${id} ${datype}" ::scobj::protekmm::sics_log 9 "::scobj::protekmm::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype}"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::protekmm::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" ::scobj::protekmm::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port} makesctcontroller sct_${name} aqadapter ${tcp_port}
@ -67,14 +60,27 @@ proc add_protekmm {name ip_address tcp_port id datype} {
makesctcontroller sct_${name} protek608 ${ip_address}:${tcp_port} makesctcontroller sct_${name} protek608 ${ip_address}:${tcp_port}
} }
} else { } else {
::scobj::protekmm::sics_log 9 "[environment_simulation] => No sctcontroller for protekmm" ::scobj::protekmm::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for protekmm"
} }
::scobj::protekmm::sics_log 1 "::scobj::protekmm::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id} ${datype}" ::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} ${ip_address} ${tcp_port} ${id} ${datype} ::scobj::protekmm::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype}
} catch_message ] } catch_message ]
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::protekmm {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
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}"
}
clientput "file evaluation of sct_protekmm.tcl" clientput "file evaluation of sct_protekmm.tcl"
::scobj::protekmm::sics_log 9 "file evaluation of sct_protekmm.tcl" ::scobj::protekmm::sics_log 9 "file evaluation of sct_protekmm.tcl"
@ -83,6 +89,8 @@ proc ::scobj::protekmm::read_config {} {
set ns "::scobj::protekmm" set ns "::scobj::protekmm"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -90,6 +98,12 @@ proc ::scobj::protekmm::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -100,9 +114,9 @@ proc ::scobj::protekmm::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "protekmm"] } { if { [string equal -nocase [dict get $v "driver"] "protekmm"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -144,9 +158,9 @@ proc ::scobj::protekmm::read_config {} {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_protekmm ${name} ${ip_address} ${tcp_port} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else { } else {
add_protekmm ${name} "aqadapter" ${asyncqueue} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
} }
} }
} }

View File

@ -27,18 +27,18 @@ proc ::scobj::eurotherm_m2000::sics_log {debug_level debug_string} {
} catch_message ] } catch_message ]
} }
proc ::scobj::eurotherm_m2000::mkDriver { sct_controller name ip_address tcp_port id datype dev_id tol } { proc ::scobj::eurotherm_m2000::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id datype dev_id tol } {
::scobj::eurotherm_m2000::sics_log 9 "::scobj::eurotherm_m2000::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}" ::scobj::eurotherm_m2000::sics_log 9 "::scobj::eurotherm_m2000::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT user float MakeSICSObj ${name} SCT_OBJECT user float
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code starts # mkDriver hook code starts
@ -48,17 +48,10 @@ proc ::scobj::eurotherm_m2000::mkDriver { sct_controller name ip_address tcp_por
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::eurotherm_m2000 { proc ::scobj::eurotherm_m2000::add_driver {name device_class simulation_flag ip_address tcp_port id datype dev_id tol} {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
}
proc add_eurotherm_m2000 {name ip_address tcp_port id datype dev_id tol} {
set catch_status [ catch { set catch_status [ catch {
::scobj::eurotherm_m2000::sics_log 9 "add_eurotherm_m2000 ${name} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}" ::scobj::eurotherm_m2000::sics_log 9 "::scobj::eurotherm_m2000::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::eurotherm_m2000::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" ::scobj::eurotherm_m2000::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port} makesctcontroller sct_${name} aqadapter ${tcp_port}
@ -67,14 +60,27 @@ proc add_eurotherm_m2000 {name ip_address tcp_port id datype dev_id tol} {
makesctcontroller sct_${name} std ${ip_address}:${tcp_port} makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
} }
} else { } else {
::scobj::eurotherm_m2000::sics_log 9 "[environment_simulation] => No sctcontroller for eurotherm_m2000" ::scobj::eurotherm_m2000::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for eurotherm_m2000"
} }
::scobj::eurotherm_m2000::sics_log 1 "::scobj::eurotherm_m2000::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}" ::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} ${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}
} catch_message ] } catch_message ]
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::eurotherm_m2000 {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
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}"
}
clientput "file evaluation of sct_eurotherm_m2000.tcl" clientput "file evaluation of sct_eurotherm_m2000.tcl"
::scobj::eurotherm_m2000::sics_log 9 "file evaluation of sct_eurotherm_m2000.tcl" ::scobj::eurotherm_m2000::sics_log 9 "file evaluation of sct_eurotherm_m2000.tcl"
@ -83,6 +89,8 @@ proc ::scobj::eurotherm_m2000::read_config {} {
set ns "::scobj::eurotherm_m2000" set ns "::scobj::eurotherm_m2000"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -90,6 +98,12 @@ proc ::scobj::eurotherm_m2000::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -100,9 +114,9 @@ proc ::scobj::eurotherm_m2000::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "eurotherm_m2000"] } { if { [string equal -nocase [dict get $v "driver"] "eurotherm_m2000"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -144,9 +158,9 @@ proc ::scobj::eurotherm_m2000::read_config {} {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_eurotherm_m2000 ${name} ${ip_address} ${tcp_port} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else { } else {
add_eurotherm_m2000 ${name} "aqadapter" ${asyncqueue} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
} }
} }
} }

View File

@ -364,14 +364,14 @@ proc ::scobj::julabo_lh45_gen::setValue {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::julabo_lh45_gen::mkDriver { sct_controller name ip_address tcp_port id ctrl_sensor tol } { proc ::scobj::julabo_lh45_gen::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id ctrl_sensor tol } {
::scobj::julabo_lh45_gen::sics_log 9 "::scobj::julabo_lh45_gen::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${id} ${ctrl_sensor} ${tol}" ::scobj::julabo_lh45_gen::sics_log 9 "::scobj::julabo_lh45_gen::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${ctrl_sensor} ${tol}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
@ -481,7 +481,7 @@ proc ::scobj::julabo_lh45_gen::mkDriver { sct_controller name ip_address tcp_por
hsetprop ${scobj_hpath} klass "@none" hsetprop ${scobj_hpath} klass "@none"
hsetprop ${scobj_hpath} type "part" hsetprop ${scobj_hpath} type "part"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/heating_power_percent 1 ${sct_controller} poll ${scobj_hpath}/heating_power_percent 1
${sct_controller} poll ${scobj_hpath}/lh45_state 1 ${sct_controller} poll ${scobj_hpath}/lh45_state 1
${sct_controller} poll ${scobj_hpath}/overtemp_warnlimit 1 ${sct_controller} poll ${scobj_hpath}/overtemp_warnlimit 1
@ -489,7 +489,7 @@ proc ::scobj::julabo_lh45_gen::mkDriver { sct_controller name ip_address tcp_por
${sct_controller} poll ${scobj_hpath}/subtemp_warnlimit 1 ${sct_controller} poll ${scobj_hpath}/subtemp_warnlimit 1
${sct_controller} write ${scobj_hpath}/setpoint ${sct_controller} write ${scobj_hpath}/setpoint
} else { } else {
::scobj::julabo_lh45_gen::sics_log 9 "[environment_simulation] => No poll/write for julabo_lh45_gen" ::scobj::julabo_lh45_gen::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for julabo_lh45_gen"
} }
hfactory ${scobj_hpath}/mode plain spy none hfactory ${scobj_hpath}/mode plain spy none
@ -529,13 +529,13 @@ proc ::scobj::julabo_lh45_gen::mkDriver { sct_controller name ip_address tcp_por
hsetprop ${scobj_hpath}/mode/on_else_off type "part" hsetprop ${scobj_hpath}/mode/on_else_off type "part"
hsetprop ${scobj_hpath}/mode/on_else_off nxalias "${name}_mode_on_else_off" hsetprop ${scobj_hpath}/mode/on_else_off nxalias "${name}_mode_on_else_off"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/mode/ext_else_bath 1 ${sct_controller} poll ${scobj_hpath}/mode/ext_else_bath 1
${sct_controller} poll ${scobj_hpath}/mode/on_else_off 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/ext_else_bath
${sct_controller} write ${scobj_hpath}/mode/on_else_off ${sct_controller} write ${scobj_hpath}/mode/on_else_off
} else { } else {
::scobj::julabo_lh45_gen::sics_log 9 "[environment_simulation] => No poll/write for julabo_lh45_gen" ::scobj::julabo_lh45_gen::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for julabo_lh45_gen"
} }
hfactory ${scobj_hpath}/sensor plain spy none hfactory ${scobj_hpath}/sensor plain spy none
@ -611,16 +611,16 @@ proc ::scobj::julabo_lh45_gen::mkDriver { sct_controller name ip_address tcp_por
hsetprop ${scobj_hpath}/sensor/value units "C" hsetprop ${scobj_hpath}/sensor/value units "C"
hsetprop ${scobj_hpath}/sensor/value nxalias "${name}_sensor_value" hsetprop ${scobj_hpath}/sensor/value nxalias "${name}_sensor_value"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/sensor/bathtemp 1 ${sct_controller} poll ${scobj_hpath}/sensor/bathtemp 1
${sct_controller} poll ${scobj_hpath}/sensor/external 1 ${sct_controller} poll ${scobj_hpath}/sensor/external 1
} else { } else {
::scobj::julabo_lh45_gen::sics_log 9 "[environment_simulation] => No poll/write for julabo_lh45_gen" ::scobj::julabo_lh45_gen::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for julabo_lh45_gen"
} }
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
ansto_makesctdrive ${name}_setpoint ${scobj_hpath}/setpoint ${scobj_hpath}/sensor/value ${sct_controller} ansto_makesctdrive ${name}_setpoint ${scobj_hpath}/setpoint ${scobj_hpath}/sensor/value ${sct_controller}
} }
# mkDriver hook code starts # mkDriver hook code starts
@ -635,17 +635,10 @@ proc ::scobj::julabo_lh45_gen::mkDriver { sct_controller name ip_address tcp_por
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::julabo_lh45_gen { proc ::scobj::julabo_lh45_gen::add_driver {name device_class simulation_flag ip_address tcp_port {id 1} {ctrl_sensor "bath"} {tol 5.0}} {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
}
proc add_julabo_lh45_gen {name ip_address tcp_port {id 1} {ctrl_sensor "bath"} {tol 5.0}} {
set catch_status [ catch { set catch_status [ catch {
::scobj::julabo_lh45_gen::sics_log 9 "add_julabo_lh45_gen ${name} ${ip_address} ${tcp_port} ${id} ${ctrl_sensor} ${tol}" ::scobj::julabo_lh45_gen::sics_log 9 "::scobj::julabo_lh45_gen::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${ctrl_sensor} ${tol}"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::julabo_lh45_gen::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" ::scobj::julabo_lh45_gen::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port} makesctcontroller sct_${name} aqadapter ${tcp_port}
@ -654,14 +647,27 @@ proc add_julabo_lh45_gen {name ip_address tcp_port {id 1} {ctrl_sensor "bath"} {
makesctcontroller sct_${name} std ${ip_address}:${tcp_port} "\r" makesctcontroller sct_${name} std ${ip_address}:${tcp_port} "\r"
} }
} else { } else {
::scobj::julabo_lh45_gen::sics_log 9 "[environment_simulation] => No sctcontroller for julabo_lh45_gen" ::scobj::julabo_lh45_gen::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for julabo_lh45_gen"
} }
::scobj::julabo_lh45_gen::sics_log 1 "::scobj::julabo_lh45_gen::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id} ${ctrl_sensor} ${tol}" ::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} ${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}
} catch_message ] } catch_message ]
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::julabo_lh45_gen {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
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}}"
}
clientput "file evaluation of sct_julabo_lh45_gen.tcl" clientput "file evaluation of sct_julabo_lh45_gen.tcl"
::scobj::julabo_lh45_gen::sics_log 9 "file evaluation of sct_julabo_lh45_gen.tcl" ::scobj::julabo_lh45_gen::sics_log 9 "file evaluation of sct_julabo_lh45_gen.tcl"
@ -670,6 +676,8 @@ proc ::scobj::julabo_lh45_gen::read_config {} {
set ns "::scobj::julabo_lh45_gen" set ns "::scobj::julabo_lh45_gen"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -677,6 +685,12 @@ proc ::scobj::julabo_lh45_gen::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -687,9 +701,9 @@ proc ::scobj::julabo_lh45_gen::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "julabo_lh45_gen"] } { if { [string equal -nocase [dict get $v "driver"] "julabo_lh45_gen"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -731,9 +745,9 @@ proc ::scobj::julabo_lh45_gen::read_config {} {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_julabo_lh45_gen ${name} ${ip_address} ${tcp_port} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else { } else {
add_julabo_lh45_gen ${name} "aqadapter" ${asyncqueue} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
} }
} }
} }

View File

@ -157,14 +157,14 @@ proc ::scobj::lakeshore_218::setValue {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::lakeshore_218::mkDriver { sct_controller name ip_address tcp_port } { proc ::scobj::lakeshore_218::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } {
::scobj::lakeshore_218::sics_log 9 "::scobj::lakeshore_218::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port}" ::scobj::lakeshore_218::sics_log 9 "::scobj::lakeshore_218::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass NXdetector sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
@ -186,10 +186,10 @@ proc ::scobj::lakeshore_218::mkDriver { sct_controller name ip_address tcp_port
hsetprop ${scobj_hpath} klass "@none" hsetprop ${scobj_hpath} klass "@none"
hsetprop ${scobj_hpath} type "part" hsetprop ${scobj_hpath} type "part"
if {[string equal -nocase [SplitReply [detector_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/krdg 1 ${sct_controller} poll ${scobj_hpath}/krdg 1
} else { } else {
::scobj::lakeshore_218::sics_log 9 "[detector_simulation] => No poll/write for lakeshore_218" ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218"
} }
hfactory ${scobj_hpath}/sensor plain spy none hfactory ${scobj_hpath}/sensor plain spy none
@ -301,7 +301,7 @@ proc ::scobj::lakeshore_218::mkDriver { sct_controller name ip_address tcp_port
hsetprop ${scobj_hpath}/sensor/ch8 type "part" hsetprop ${scobj_hpath}/sensor/ch8 type "part"
hsetprop ${scobj_hpath}/sensor/ch8 nxalias "${name}_sensor_ch8" hsetprop ${scobj_hpath}/sensor/ch8 nxalias "${name}_sensor_ch8"
if {[string equal -nocase [SplitReply [detector_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/sensor/ch1 1 ${sct_controller} poll ${scobj_hpath}/sensor/ch1 1
${sct_controller} poll ${scobj_hpath}/sensor/ch2 1 ${sct_controller} poll ${scobj_hpath}/sensor/ch2 1
${sct_controller} poll ${scobj_hpath}/sensor/ch3 1 ${sct_controller} poll ${scobj_hpath}/sensor/ch3 1
@ -311,9 +311,9 @@ proc ::scobj::lakeshore_218::mkDriver { sct_controller name ip_address tcp_port
${sct_controller} poll ${scobj_hpath}/sensor/ch7 1 ${sct_controller} poll ${scobj_hpath}/sensor/ch7 1
${sct_controller} poll ${scobj_hpath}/sensor/ch8 1 ${sct_controller} poll ${scobj_hpath}/sensor/ch8 1
} else { } else {
::scobj::lakeshore_218::sics_log 9 "[detector_simulation] => No poll/write for lakeshore_218" ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218"
} }
hsetprop ${scobj_hpath} klass NXdetector hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code goes here # mkDriver hook code goes here
@ -321,31 +321,37 @@ proc ::scobj::lakeshore_218::mkDriver { sct_controller name ip_address tcp_port
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::lakeshore_218::add_driver {name device_class simulation_flag ip_address tcp_port} {
set catch_status [ catch {
::scobj::lakeshore_218::sics_log 9 "::scobj::lakeshore_218::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::lakeshore_218::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::lakeshore_218::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
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 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}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::lakeshore_218 { namespace eval ::scobj::lakeshore_218 {
namespace export debug_threshold namespace export debug_threshold
namespace export debug_log namespace export debug_log
namespace export sics_log namespace export sics_log
namespace export mkDriver namespace export mkDriver
namespace export add_driver
} }
proc add_lakeshore_218 {name ip_address tcp_port} { proc add_lakeshore_218 {name ip_address tcp_port} {
set catch_status [ catch { set simulation_flag "[string tolower [SplitReply [detector_simulation]]]"
::scobj::lakeshore_218::sics_log 9 "add_lakeshore_218 ${name} ${ip_address} ${tcp_port}" ::scobj::lakeshore_218::add_driver ${name} "NXdetector" "${simulation_flag}" ${ip_address} ${tcp_port}
if {[string equal -nocase [SplitReply [detector_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::lakeshore_218::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::lakeshore_218::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
}
} else {
::scobj::lakeshore_218::sics_log 9 "[detector_simulation] => No sctcontroller for lakeshore_218"
}
::scobj::lakeshore_218::sics_log 1 "::scobj::lakeshore_218::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}"
::scobj::lakeshore_218::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
clientput "file evaluation of sct_lakeshore_218.tcl" clientput "file evaluation of sct_lakeshore_218.tcl"
@ -356,6 +362,8 @@ proc ::scobj::lakeshore_218::read_config {} {
set ns "::scobj::lakeshore_218" set ns "::scobj::lakeshore_218"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [detector_simulation]]]"
set device_class "NXdetector"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -363,6 +371,12 @@ proc ::scobj::lakeshore_218::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -373,9 +387,9 @@ proc ::scobj::lakeshore_218::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "lakeshore_218"] } { if { [string equal -nocase [dict get $v "driver"] "lakeshore_218"] } {
if { ![string equal -nocase [SplitReply [detector_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[detector_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -402,9 +416,9 @@ proc ::scobj::lakeshore_218::read_config {} {
} }
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_lakeshore_218 ${name} ${ip_address} ${tcp_port} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} else { } else {
add_lakeshore_218 ${name} "aqadapter" ${asyncqueue} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue}
} }
} }
} }

View File

@ -27,18 +27,18 @@ proc ::scobj::lakeshore_m370::sics_log {debug_level debug_string} {
} catch_message ] } catch_message ]
} }
proc ::scobj::lakeshore_m370::mkDriver { sct_controller name ip_address tcp_port id tol } { proc ::scobj::lakeshore_m370::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id tol } {
::scobj::lakeshore_m370::sics_log 9 "::scobj::lakeshore_m370::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${id} ${tol}" ::scobj::lakeshore_m370::sics_log 9 "::scobj::lakeshore_m370::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT user float MakeSICSObj ${name} SCT_OBJECT user float
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code starts # mkDriver hook code starts
@ -52,17 +52,10 @@ proc ::scobj::lakeshore_m370::mkDriver { sct_controller name ip_address tcp_port
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::lakeshore_m370 { proc ::scobj::lakeshore_m370::add_driver {name device_class simulation_flag ip_address tcp_port id tol} {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
}
proc add_lakeshore_m370 {name ip_address tcp_port id tol} {
set catch_status [ catch { set catch_status [ catch {
::scobj::lakeshore_m370::sics_log 9 "add_lakeshore_m370 ${name} ${ip_address} ${tcp_port} ${id} ${tol}" ::scobj::lakeshore_m370::sics_log 9 "::scobj::lakeshore_m370::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol}"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::lakeshore_m370::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" ::scobj::lakeshore_m370::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port} makesctcontroller sct_${name} aqadapter ${tcp_port}
@ -71,14 +64,27 @@ proc add_lakeshore_m370 {name ip_address tcp_port id tol} {
makesctcontroller sct_${name} std ${ip_address}:${tcp_port} makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
} }
} else { } else {
::scobj::lakeshore_m370::sics_log 9 "[environment_simulation] => No sctcontroller for lakeshore_m370" ::scobj::lakeshore_m370::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for lakeshore_m370"
} }
::scobj::lakeshore_m370::sics_log 1 "::scobj::lakeshore_m370::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id} ${tol}" ::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} ${ip_address} ${tcp_port} ${id} ${tol} ::scobj::lakeshore_m370::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol}
} catch_message ] } catch_message ]
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::lakeshore_m370 {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
proc add_lakeshore_m370 {name ip_address tcp_port id tol} {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::lakeshore_m370::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}" "${tol}"
}
clientput "file evaluation of sct_lakeshore_m370.tcl" clientput "file evaluation of sct_lakeshore_m370.tcl"
::scobj::lakeshore_m370::sics_log 9 "file evaluation of sct_lakeshore_m370.tcl" ::scobj::lakeshore_m370::sics_log 9 "file evaluation of sct_lakeshore_m370.tcl"
@ -87,6 +93,8 @@ proc ::scobj::lakeshore_m370::read_config {} {
set ns "::scobj::lakeshore_m370" set ns "::scobj::lakeshore_m370"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -94,6 +102,12 @@ proc ::scobj::lakeshore_m370::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -104,9 +118,9 @@ proc ::scobj::lakeshore_m370::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "lakeshore_m370"] } { if { [string equal -nocase [dict get $v "driver"] "lakeshore_m370"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -148,9 +162,9 @@ proc ::scobj::lakeshore_m370::read_config {} {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_lakeshore_m370 ${name} ${ip_address} ${tcp_port} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else { } else {
add_lakeshore_m370 ${name} "aqadapter" ${asyncqueue} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
} }
} }
} }

View File

@ -27,18 +27,18 @@ proc ::scobj::ls336::sics_log {debug_level debug_string} {
} catch_message ] } catch_message ]
} }
proc ::scobj::ls336::mkDriver { sct_controller name ip_address tcp_port id datype tol1 tol2 } { proc ::scobj::ls336::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id datype tol1 tol2 } {
::scobj::ls336::sics_log 9 "::scobj::ls336::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${id} ${datype} ${tol1} ${tol2}" ::scobj::ls336::sics_log 9 "::scobj::ls336::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol1} ${tol2}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code starts # mkDriver hook code starts
@ -48,17 +48,10 @@ proc ::scobj::ls336::mkDriver { sct_controller name ip_address tcp_port id datyp
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::ls336 { proc ::scobj::ls336::add_driver {name device_class simulation_flag ip_address tcp_port id datype {tol1 1.0} {tol2 1.0}} {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
}
proc add_ls336 {name ip_address tcp_port id datype {tol1 1.0} {tol2 1.0}} {
set catch_status [ catch { set catch_status [ catch {
::scobj::ls336::sics_log 9 "add_ls336 ${name} ${ip_address} ${tcp_port} ${id} ${datype} ${tol1} ${tol2}" ::scobj::ls336::sics_log 9 "::scobj::ls336::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol1} ${tol2}"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::ls336::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" ::scobj::ls336::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port} makesctcontroller sct_${name} aqadapter ${tcp_port}
@ -67,14 +60,27 @@ proc add_ls336 {name ip_address tcp_port id datype {tol1 1.0} {tol2 1.0}} {
makesctcontroller sct_${name} std ${ip_address}:${tcp_port} makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
} }
} else { } else {
::scobj::ls336::sics_log 9 "[environment_simulation] => No sctcontroller for ls336" ::scobj::ls336::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for ls336"
} }
::scobj::ls336::sics_log 1 "::scobj::ls336::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id} ${datype} ${tol1} ${tol2}" ::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} ${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}
} catch_message ] } catch_message ]
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::ls336 {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
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}}"
}
clientput "file evaluation of sct_ls336.tcl" clientput "file evaluation of sct_ls336.tcl"
::scobj::ls336::sics_log 9 "file evaluation of sct_ls336.tcl" ::scobj::ls336::sics_log 9 "file evaluation of sct_ls336.tcl"
@ -83,6 +89,8 @@ proc ::scobj::ls336::read_config {} {
set ns "::scobj::ls336" set ns "::scobj::ls336"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -90,6 +98,12 @@ proc ::scobj::ls336::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -100,9 +114,9 @@ proc ::scobj::ls336::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "ls336"] } { if { [string equal -nocase [dict get $v "driver"] "ls336"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -144,9 +158,9 @@ proc ::scobj::ls336::read_config {} {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_ls336 ${name} ${ip_address} ${tcp_port} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else { } else {
add_ls336 ${name} "aqadapter" ${asyncqueue} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
} }
} }
} }

View File

@ -27,18 +27,18 @@ proc ::scobj::ls340::sics_log {debug_level debug_string} {
} catch_message ] } catch_message ]
} }
proc ::scobj::ls340::mkDriver { sct_controller name ip_address tcp_port id datype tol1 tol2 } { proc ::scobj::ls340::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id datype tol1 tol2 } {
::scobj::ls340::sics_log 9 "::scobj::ls340::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${id} ${datype} ${tol1} ${tol2}" ::scobj::ls340::sics_log 9 "::scobj::ls340::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol1} ${tol2}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code starts # mkDriver hook code starts
@ -48,17 +48,10 @@ proc ::scobj::ls340::mkDriver { sct_controller name ip_address tcp_port id datyp
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::ls340 { proc ::scobj::ls340::add_driver {name device_class simulation_flag ip_address tcp_port id datype {tol1 1.0} {tol2 1.0}} {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
}
proc add_ls340 {name ip_address tcp_port id datype {tol1 1.0} {tol2 1.0}} {
set catch_status [ catch { set catch_status [ catch {
::scobj::ls340::sics_log 9 "add_ls340 ${name} ${ip_address} ${tcp_port} ${id} ${datype} ${tol1} ${tol2}" ::scobj::ls340::sics_log 9 "::scobj::ls340::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol1} ${tol2}"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::ls340::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" ::scobj::ls340::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port} makesctcontroller sct_${name} aqadapter ${tcp_port}
@ -67,14 +60,27 @@ proc add_ls340 {name ip_address tcp_port id datype {tol1 1.0} {tol2 1.0}} {
makesctcontroller sct_${name} std ${ip_address}:${tcp_port} makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
} }
} else { } else {
::scobj::ls340::sics_log 9 "[environment_simulation] => No sctcontroller for ls340" ::scobj::ls340::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for ls340"
} }
::scobj::ls340::sics_log 1 "::scobj::ls340::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id} ${datype} ${tol1} ${tol2}" ::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} ${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}
} catch_message ] } catch_message ]
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::ls340 {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
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}}"
}
clientput "file evaluation of sct_ls340.tcl" clientput "file evaluation of sct_ls340.tcl"
::scobj::ls340::sics_log 9 "file evaluation of sct_ls340.tcl" ::scobj::ls340::sics_log 9 "file evaluation of sct_ls340.tcl"
@ -83,6 +89,8 @@ proc ::scobj::ls340::read_config {} {
set ns "::scobj::ls340" set ns "::scobj::ls340"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -90,6 +98,12 @@ proc ::scobj::ls340::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -100,9 +114,9 @@ proc ::scobj::ls340::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "ls340"] } { if { [string equal -nocase [dict get $v "driver"] "ls340"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -144,9 +158,9 @@ proc ::scobj::ls340::read_config {} {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_ls340 ${name} ${ip_address} ${tcp_port} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else { } else {
add_ls340 ${name} "aqadapter" ${asyncqueue} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
} }
} }
} }

View File

@ -266,14 +266,14 @@ proc ::scobj::mercury_base::setValue {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::mercury_base::mkDriver { sct_controller name ip_address tcp_port id tol } { proc ::scobj::mercury_base::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id tol } {
::scobj::mercury_base::sics_log 9 "::scobj::mercury_base::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${id} ${tol}" ::scobj::mercury_base::sics_log 9 "::scobj::mercury_base::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
@ -351,14 +351,14 @@ proc ::scobj::mercury_base::mkDriver { sct_controller name ip_address tcp_port i
hsetprop ${scobj_hpath}/Loop1/setpoint type "drivable" hsetprop ${scobj_hpath}/Loop1/setpoint type "drivable"
hsetprop ${scobj_hpath}/Loop1/setpoint nxalias "${name}_Loop1_setpoint" hsetprop ${scobj_hpath}/Loop1/setpoint nxalias "${name}_Loop1_setpoint"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/Loop1/nick 15 ${sct_controller} poll ${scobj_hpath}/Loop1/nick 15
${sct_controller} poll ${scobj_hpath}/Loop1/power 5 ${sct_controller} poll ${scobj_hpath}/Loop1/power 5
${sct_controller} poll ${scobj_hpath}/Loop1/sensor 1 ${sct_controller} poll ${scobj_hpath}/Loop1/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop1/setpoint 5 ${sct_controller} poll ${scobj_hpath}/Loop1/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop1/setpoint ${sct_controller} write ${scobj_hpath}/Loop1/setpoint
} else { } else {
::scobj::mercury_base::sics_log 9 "[environment_simulation] => No poll/write for mercury_base" ::scobj::mercury_base::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_base"
} }
hfactory ${scobj_hpath}/Loop2 plain spy none hfactory ${scobj_hpath}/Loop2 plain spy none
@ -434,14 +434,14 @@ proc ::scobj::mercury_base::mkDriver { sct_controller name ip_address tcp_port i
hsetprop ${scobj_hpath}/Loop2/setpoint type "drivable" hsetprop ${scobj_hpath}/Loop2/setpoint type "drivable"
hsetprop ${scobj_hpath}/Loop2/setpoint nxalias "${name}_Loop2_setpoint" hsetprop ${scobj_hpath}/Loop2/setpoint nxalias "${name}_Loop2_setpoint"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/Loop2/nick 15 ${sct_controller} poll ${scobj_hpath}/Loop2/nick 15
${sct_controller} poll ${scobj_hpath}/Loop2/power 5 ${sct_controller} poll ${scobj_hpath}/Loop2/power 5
${sct_controller} poll ${scobj_hpath}/Loop2/sensor 1 ${sct_controller} poll ${scobj_hpath}/Loop2/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop2/setpoint 5 ${sct_controller} poll ${scobj_hpath}/Loop2/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop2/setpoint ${sct_controller} write ${scobj_hpath}/Loop2/setpoint
} else { } else {
::scobj::mercury_base::sics_log 9 "[environment_simulation] => No poll/write for mercury_base" ::scobj::mercury_base::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_base"
} }
hfactory ${scobj_hpath}/Loop3 plain spy none hfactory ${scobj_hpath}/Loop3 plain spy none
@ -517,19 +517,19 @@ proc ::scobj::mercury_base::mkDriver { sct_controller name ip_address tcp_port i
hsetprop ${scobj_hpath}/Loop3/setpoint type "drivable" hsetprop ${scobj_hpath}/Loop3/setpoint type "drivable"
hsetprop ${scobj_hpath}/Loop3/setpoint nxalias "${name}_Loop3_setpoint" hsetprop ${scobj_hpath}/Loop3/setpoint nxalias "${name}_Loop3_setpoint"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/Loop3/nick 15 ${sct_controller} poll ${scobj_hpath}/Loop3/nick 15
${sct_controller} poll ${scobj_hpath}/Loop3/power 5 ${sct_controller} poll ${scobj_hpath}/Loop3/power 5
${sct_controller} poll ${scobj_hpath}/Loop3/sensor 1 ${sct_controller} poll ${scobj_hpath}/Loop3/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop3/setpoint 5 ${sct_controller} poll ${scobj_hpath}/Loop3/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop3/setpoint ${sct_controller} write ${scobj_hpath}/Loop3/setpoint
} else { } else {
::scobj::mercury_base::sics_log 9 "[environment_simulation] => No poll/write for mercury_base" ::scobj::mercury_base::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_base"
} }
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { 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}_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}_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}_Loop3_setpoint ${scobj_hpath}/Loop3/setpoint ${scobj_hpath}/Loop3/sensor ${sct_controller}
@ -539,17 +539,10 @@ proc ::scobj::mercury_base::mkDriver { sct_controller name ip_address tcp_port i
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::mercury_base { proc ::scobj::mercury_base::add_driver {name device_class simulation_flag ip_address tcp_port {id 99} {tol 1}} {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
}
proc add_mercury_base {name ip_address tcp_port {id 99} {tol 1}} {
set catch_status [ catch { set catch_status [ catch {
::scobj::mercury_base::sics_log 9 "add_mercury_base ${name} ${ip_address} ${tcp_port} ${id} ${tol}" ::scobj::mercury_base::sics_log 9 "::scobj::mercury_base::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol}"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::mercury_base::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" ::scobj::mercury_base::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port} makesctcontroller sct_${name} aqadapter ${tcp_port}
@ -558,14 +551,27 @@ proc add_mercury_base {name ip_address tcp_port {id 99} {tol 1}} {
makesctcontroller sct_${name} std ${ip_address}:${tcp_port} makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
} }
} else { } else {
::scobj::mercury_base::sics_log 9 "[environment_simulation] => No sctcontroller for mercury_base" ::scobj::mercury_base::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for mercury_base"
} }
::scobj::mercury_base::sics_log 1 "::scobj::mercury_base::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id} ${tol}" ::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} ${ip_address} ${tcp_port} ${id} ${tol} ::scobj::mercury_base::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol}
} catch_message ] } catch_message ]
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::mercury_base {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
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}}"
}
clientput "file evaluation of sct_mercury_base.tcl" clientput "file evaluation of sct_mercury_base.tcl"
::scobj::mercury_base::sics_log 9 "file evaluation of sct_mercury_base.tcl" ::scobj::mercury_base::sics_log 9 "file evaluation of sct_mercury_base.tcl"
@ -574,6 +580,8 @@ proc ::scobj::mercury_base::read_config {} {
set ns "::scobj::mercury_base" set ns "::scobj::mercury_base"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -581,6 +589,12 @@ proc ::scobj::mercury_base::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -591,9 +605,9 @@ proc ::scobj::mercury_base::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "mercury_base"] } { if { [string equal -nocase [dict get $v "driver"] "mercury_base"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -635,9 +649,9 @@ proc ::scobj::mercury_base::read_config {} {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_mercury_base ${name} ${ip_address} ${tcp_port} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else { } else {
add_mercury_base ${name} "aqadapter" ${asyncqueue} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
} }
} }
} }

View File

@ -137,14 +137,14 @@ proc ::scobj::mercury_level::setValue {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::mercury_level::mkDriver { sct_controller name ip_address tcp_port id } { proc ::scobj::mercury_level::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id } {
::scobj::mercury_level::sics_log 9 "::scobj::mercury_level::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${id}" ::scobj::mercury_level::sics_log 9 "::scobj::mercury_level::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
@ -184,13 +184,13 @@ proc ::scobj::mercury_level::mkDriver { sct_controller name ip_address tcp_port
hsetprop ${scobj_hpath}/Level/Nitrogen type "part" hsetprop ${scobj_hpath}/Level/Nitrogen type "part"
hsetprop ${scobj_hpath}/Level/Nitrogen nxalias "${name}_Level_Nitrogen" hsetprop ${scobj_hpath}/Level/Nitrogen nxalias "${name}_Level_Nitrogen"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/Level/Helium 15 ${sct_controller} poll ${scobj_hpath}/Level/Helium 15
${sct_controller} poll ${scobj_hpath}/Level/Nitrogen 15 ${sct_controller} poll ${scobj_hpath}/Level/Nitrogen 15
} else { } else {
::scobj::mercury_level::sics_log 9 "[environment_simulation] => No poll/write for mercury_level" ::scobj::mercury_level::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_level"
} }
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code goes here # mkDriver hook code goes here
@ -198,31 +198,37 @@ proc ::scobj::mercury_level::mkDriver { sct_controller name ip_address tcp_port
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::mercury_level::add_driver {name device_class simulation_flag ip_address tcp_port {id 99}} {
set catch_status [ catch {
::scobj::mercury_level::sics_log 9 "::scobj::mercury_level::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}"
if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::mercury_level::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::mercury_level::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
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 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}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::mercury_level { namespace eval ::scobj::mercury_level {
namespace export debug_threshold namespace export debug_threshold
namespace export debug_log namespace export debug_log
namespace export sics_log namespace export sics_log
namespace export mkDriver namespace export mkDriver
namespace export add_driver
} }
proc add_mercury_level {name ip_address tcp_port {id 99}} { proc add_mercury_level {name ip_address tcp_port {id 99}} {
set catch_status [ catch { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::mercury_level::sics_log 9 "add_mercury_level ${name} ${ip_address} ${tcp_port} ${id}" ::scobj::mercury_level::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${{id}" "${99}}"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::mercury_level::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::mercury_level::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
}
} else {
::scobj::mercury_level::sics_log 9 "[environment_simulation] => No sctcontroller for mercury_level"
}
::scobj::mercury_level::sics_log 1 "::scobj::mercury_level::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id}"
::scobj::mercury_level::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
clientput "file evaluation of sct_mercury_level.tcl" clientput "file evaluation of sct_mercury_level.tcl"
@ -233,6 +239,8 @@ proc ::scobj::mercury_level::read_config {} {
set ns "::scobj::mercury_level" set ns "::scobj::mercury_level"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -240,6 +248,12 @@ proc ::scobj::mercury_level::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -250,9 +264,9 @@ proc ::scobj::mercury_level::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "mercury_level"] } { if { [string equal -nocase [dict get $v "driver"] "mercury_level"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -294,9 +308,9 @@ proc ::scobj::mercury_level::read_config {} {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_mercury_level ${name} ${ip_address} ${tcp_port} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else { } else {
add_mercury_level ${name} "aqadapter" ${asyncqueue} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
} }
} }
} }

View File

@ -272,14 +272,14 @@ proc ::scobj::mercury_pres::setValue {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::mercury_pres::mkDriver { sct_controller name ip_address tcp_port id tol } { proc ::scobj::mercury_pres::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id tol } {
::scobj::mercury_pres::sics_log 9 "::scobj::mercury_pres::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${id} ${tol}" ::scobj::mercury_pres::sics_log 9 "::scobj::mercury_pres::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
@ -346,18 +346,18 @@ proc ::scobj::mercury_pres::mkDriver { sct_controller name ip_address tcp_port i
hsetprop ${scobj_hpath}/Loop8/setpoint type "drivable" hsetprop ${scobj_hpath}/Loop8/setpoint type "drivable"
hsetprop ${scobj_hpath}/Loop8/setpoint nxalias "${name}_Loop8_setpoint" hsetprop ${scobj_hpath}/Loop8/setpoint nxalias "${name}_Loop8_setpoint"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/Loop8/nick 15 ${sct_controller} poll ${scobj_hpath}/Loop8/nick 15
${sct_controller} poll ${scobj_hpath}/Loop8/sensor 1 ${sct_controller} poll ${scobj_hpath}/Loop8/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop8/setpoint 5 ${sct_controller} poll ${scobj_hpath}/Loop8/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop8/setpoint ${sct_controller} write ${scobj_hpath}/Loop8/setpoint
} else { } else {
::scobj::mercury_pres::sics_log 9 "[environment_simulation] => No poll/write for mercury_pres" ::scobj::mercury_pres::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_pres"
} }
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
ansto_makesctdrive ${name}_Loop8_setpoint ${scobj_hpath}/Loop8/setpoint ${scobj_hpath}/Loop8/sensor ${sct_controller} ansto_makesctdrive ${name}_Loop8_setpoint ${scobj_hpath}/Loop8/setpoint ${scobj_hpath}/Loop8/sensor ${sct_controller}
} }
# mkDriver hook code goes here # mkDriver hook code goes here
@ -365,31 +365,37 @@ proc ::scobj::mercury_pres::mkDriver { sct_controller name ip_address tcp_port i
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::mercury_pres::add_driver {name device_class simulation_flag ip_address tcp_port {id 99} {tol 1}} {
set catch_status [ catch {
::scobj::mercury_pres::sics_log 9 "::scobj::mercury_pres::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol}"
if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::mercury_pres::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::mercury_pres::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
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 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}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::mercury_pres { namespace eval ::scobj::mercury_pres {
namespace export debug_threshold namespace export debug_threshold
namespace export debug_log namespace export debug_log
namespace export sics_log namespace export sics_log
namespace export mkDriver namespace export mkDriver
namespace export add_driver
} }
proc add_mercury_pres {name ip_address tcp_port {id 99} {tol 1}} { proc add_mercury_pres {name ip_address tcp_port {id 99} {tol 1}} {
set catch_status [ catch { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::mercury_pres::sics_log 9 "add_mercury_pres ${name} ${ip_address} ${tcp_port} ${id} ${tol}" ::scobj::mercury_pres::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${{id}" "${99}}" "${{tol}" "${1}}"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::mercury_pres::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::mercury_pres::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
}
} else {
::scobj::mercury_pres::sics_log 9 "[environment_simulation] => No sctcontroller for mercury_pres"
}
::scobj::mercury_pres::sics_log 1 "::scobj::mercury_pres::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id} ${tol}"
::scobj::mercury_pres::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id} ${tol}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
clientput "file evaluation of sct_mercury_pres.tcl" clientput "file evaluation of sct_mercury_pres.tcl"
@ -400,6 +406,8 @@ proc ::scobj::mercury_pres::read_config {} {
set ns "::scobj::mercury_pres" set ns "::scobj::mercury_pres"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -407,6 +415,12 @@ proc ::scobj::mercury_pres::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -417,9 +431,9 @@ proc ::scobj::mercury_pres::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "mercury_pres"] } { if { [string equal -nocase [dict get $v "driver"] "mercury_pres"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -461,9 +475,9 @@ proc ::scobj::mercury_pres::read_config {} {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_mercury_pres ${name} ${ip_address} ${tcp_port} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else { } else {
add_mercury_pres ${name} "aqadapter" ${asyncqueue} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
} }
} }
} }

View File

@ -300,14 +300,14 @@ proc ::scobj::mercury_scpi::setValve {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::mercury_scpi::mkDriver { sct_controller name ip_address tcp_port id permlink tol valve_tol } { proc ::scobj::mercury_scpi::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id permlink tol valve_tol } {
::scobj::mercury_scpi::sics_log 9 "::scobj::mercury_scpi::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${id} ${permlink} ${tol} ${valve_tol}" ::scobj::mercury_scpi::sics_log 9 "::scobj::mercury_scpi::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${permlink} ${tol} ${valve_tol}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
@ -347,11 +347,11 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name ip_address tcp_port i
hsetprop ${scobj_hpath}/Level/Nitrogen type "part" hsetprop ${scobj_hpath}/Level/Nitrogen type "part"
hsetprop ${scobj_hpath}/Level/Nitrogen nxalias "${name}_Level_Nitrogen" hsetprop ${scobj_hpath}/Level/Nitrogen nxalias "${name}_Level_Nitrogen"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/Level/Helium 15 ${sct_controller} poll ${scobj_hpath}/Level/Helium 15
${sct_controller} poll ${scobj_hpath}/Level/Nitrogen 15 ${sct_controller} poll ${scobj_hpath}/Level/Nitrogen 15
} else { } else {
::scobj::mercury_scpi::sics_log 9 "[environment_simulation] => No poll/write for mercury_scpi" ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi"
} }
hfactory ${scobj_hpath}/Loop1 plain spy none hfactory ${scobj_hpath}/Loop1 plain spy none
@ -427,14 +427,14 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name ip_address tcp_port i
hsetprop ${scobj_hpath}/Loop1/setpoint type "drivable" hsetprop ${scobj_hpath}/Loop1/setpoint type "drivable"
hsetprop ${scobj_hpath}/Loop1/setpoint nxalias "${name}_Loop1_setpoint" hsetprop ${scobj_hpath}/Loop1/setpoint nxalias "${name}_Loop1_setpoint"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/Loop1/nick 15 ${sct_controller} poll ${scobj_hpath}/Loop1/nick 15
${sct_controller} poll ${scobj_hpath}/Loop1/power 5 ${sct_controller} poll ${scobj_hpath}/Loop1/power 5
${sct_controller} poll ${scobj_hpath}/Loop1/sensor 1 ${sct_controller} poll ${scobj_hpath}/Loop1/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop1/setpoint 5 ${sct_controller} poll ${scobj_hpath}/Loop1/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop1/setpoint ${sct_controller} write ${scobj_hpath}/Loop1/setpoint
} else { } else {
::scobj::mercury_scpi::sics_log 9 "[environment_simulation] => No poll/write for mercury_scpi" ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi"
} }
hfactory ${scobj_hpath}/Loop2 plain spy none hfactory ${scobj_hpath}/Loop2 plain spy none
@ -510,14 +510,14 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name ip_address tcp_port i
hsetprop ${scobj_hpath}/Loop2/setpoint type "drivable" hsetprop ${scobj_hpath}/Loop2/setpoint type "drivable"
hsetprop ${scobj_hpath}/Loop2/setpoint nxalias "${name}_Loop2_setpoint" hsetprop ${scobj_hpath}/Loop2/setpoint nxalias "${name}_Loop2_setpoint"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/Loop2/nick 15 ${sct_controller} poll ${scobj_hpath}/Loop2/nick 15
${sct_controller} poll ${scobj_hpath}/Loop2/power 5 ${sct_controller} poll ${scobj_hpath}/Loop2/power 5
${sct_controller} poll ${scobj_hpath}/Loop2/sensor 1 ${sct_controller} poll ${scobj_hpath}/Loop2/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop2/setpoint 5 ${sct_controller} poll ${scobj_hpath}/Loop2/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop2/setpoint ${sct_controller} write ${scobj_hpath}/Loop2/setpoint
} else { } else {
::scobj::mercury_scpi::sics_log 9 "[environment_simulation] => No poll/write for mercury_scpi" ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi"
} }
hfactory ${scobj_hpath}/Loop3 plain spy none hfactory ${scobj_hpath}/Loop3 plain spy none
@ -593,14 +593,14 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name ip_address tcp_port i
hsetprop ${scobj_hpath}/Loop3/setpoint type "drivable" hsetprop ${scobj_hpath}/Loop3/setpoint type "drivable"
hsetprop ${scobj_hpath}/Loop3/setpoint nxalias "${name}_Loop3_setpoint" hsetprop ${scobj_hpath}/Loop3/setpoint nxalias "${name}_Loop3_setpoint"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/Loop3/nick 15 ${sct_controller} poll ${scobj_hpath}/Loop3/nick 15
${sct_controller} poll ${scobj_hpath}/Loop3/power 5 ${sct_controller} poll ${scobj_hpath}/Loop3/power 5
${sct_controller} poll ${scobj_hpath}/Loop3/sensor 1 ${sct_controller} poll ${scobj_hpath}/Loop3/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop3/setpoint 5 ${sct_controller} poll ${scobj_hpath}/Loop3/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop3/setpoint ${sct_controller} write ${scobj_hpath}/Loop3/setpoint
} else { } else {
::scobj::mercury_scpi::sics_log 9 "[environment_simulation] => No poll/write for mercury_scpi" ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi"
} }
hfactory ${scobj_hpath}/Loop4 plain spy none hfactory ${scobj_hpath}/Loop4 plain spy none
@ -676,14 +676,14 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name ip_address tcp_port i
hsetprop ${scobj_hpath}/Loop4/setpoint type "drivable" hsetprop ${scobj_hpath}/Loop4/setpoint type "drivable"
hsetprop ${scobj_hpath}/Loop4/setpoint nxalias "${name}_Loop4_setpoint" hsetprop ${scobj_hpath}/Loop4/setpoint nxalias "${name}_Loop4_setpoint"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/Loop4/nick 15 ${sct_controller} poll ${scobj_hpath}/Loop4/nick 15
${sct_controller} poll ${scobj_hpath}/Loop4/power 5 ${sct_controller} poll ${scobj_hpath}/Loop4/power 5
${sct_controller} poll ${scobj_hpath}/Loop4/sensor 1 ${sct_controller} poll ${scobj_hpath}/Loop4/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop4/setpoint 5 ${sct_controller} poll ${scobj_hpath}/Loop4/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop4/setpoint ${sct_controller} write ${scobj_hpath}/Loop4/setpoint
} else { } else {
::scobj::mercury_scpi::sics_log 9 "[environment_simulation] => No poll/write for mercury_scpi" ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi"
} }
hfactory ${scobj_hpath}/Valve plain spy none hfactory ${scobj_hpath}/Valve plain spy none
@ -731,16 +731,16 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name ip_address tcp_port i
hsetprop ${scobj_hpath}/Valve/setpoint type "drivable" hsetprop ${scobj_hpath}/Valve/setpoint type "drivable"
hsetprop ${scobj_hpath}/Valve/setpoint nxalias "${name}_Valve_setpoint" hsetprop ${scobj_hpath}/Valve/setpoint nxalias "${name}_Valve_setpoint"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/Valve/sensor 5 ${sct_controller} poll ${scobj_hpath}/Valve/sensor 5
${sct_controller} write ${scobj_hpath}/Valve/setpoint ${sct_controller} write ${scobj_hpath}/Valve/setpoint
} else { } else {
::scobj::mercury_scpi::sics_log 9 "[environment_simulation] => No poll/write for mercury_scpi" ::scobj::mercury_scpi::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_scpi"
} }
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { 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}_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}_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}_Loop3_setpoint ${scobj_hpath}/Loop3/setpoint ${scobj_hpath}/Loop3/sensor ${sct_controller}
@ -752,17 +752,10 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name ip_address tcp_port i
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::mercury_scpi { proc ::scobj::mercury_scpi::add_driver {name device_class simulation_flag ip_address tcp_port {id 99} {permlink LT} {tol 1} {valve_tol 2}} {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
}
proc add_mercury_scpi {name ip_address tcp_port {id 99} {permlink LT} {tol 1} {valve_tol 2}} {
set catch_status [ catch { set catch_status [ catch {
::scobj::mercury_scpi::sics_log 9 "add_mercury_scpi ${name} ${ip_address} ${tcp_port} ${id} ${permlink} ${tol} ${valve_tol}" ::scobj::mercury_scpi::sics_log 9 "::scobj::mercury_scpi::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${permlink} ${tol} ${valve_tol}"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::mercury_scpi::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" ::scobj::mercury_scpi::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port} makesctcontroller sct_${name} aqadapter ${tcp_port}
@ -771,14 +764,27 @@ proc add_mercury_scpi {name ip_address tcp_port {id 99} {permlink LT} {tol 1} {v
makesctcontroller sct_${name} std ${ip_address}:${tcp_port} makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
} }
} else { } else {
::scobj::mercury_scpi::sics_log 9 "[environment_simulation] => No sctcontroller for mercury_scpi" ::scobj::mercury_scpi::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for mercury_scpi"
} }
::scobj::mercury_scpi::sics_log 1 "::scobj::mercury_scpi::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id} ${permlink} ${tol} ${valve_tol}" ::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} ${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}
} catch_message ] } catch_message ]
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::mercury_scpi {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
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}}"
}
clientput "file evaluation of sct_mercury_scpi.tcl" clientput "file evaluation of sct_mercury_scpi.tcl"
::scobj::mercury_scpi::sics_log 9 "file evaluation of sct_mercury_scpi.tcl" ::scobj::mercury_scpi::sics_log 9 "file evaluation of sct_mercury_scpi.tcl"
@ -787,6 +793,8 @@ proc ::scobj::mercury_scpi::read_config {} {
set ns "::scobj::mercury_scpi" set ns "::scobj::mercury_scpi"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -794,6 +802,12 @@ proc ::scobj::mercury_scpi::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -804,9 +818,9 @@ proc ::scobj::mercury_scpi::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "mercury_scpi"] } { if { [string equal -nocase [dict get $v "driver"] "mercury_scpi"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -848,9 +862,9 @@ proc ::scobj::mercury_scpi::read_config {} {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_mercury_scpi ${name} ${ip_address} ${tcp_port} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else { } else {
add_mercury_scpi ${name} "aqadapter" ${asyncqueue} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
} }
} }
} }

View File

@ -266,14 +266,14 @@ proc ::scobj::mercury_temp::setValue {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::mercury_temp::mkDriver { sct_controller name ip_address tcp_port id tol } { proc ::scobj::mercury_temp::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id tol } {
::scobj::mercury_temp::sics_log 9 "::scobj::mercury_temp::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${id} ${tol}" ::scobj::mercury_temp::sics_log 9 "::scobj::mercury_temp::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
@ -351,19 +351,19 @@ proc ::scobj::mercury_temp::mkDriver { sct_controller name ip_address tcp_port i
hsetprop ${scobj_hpath}/Loop4/setpoint type "drivable" hsetprop ${scobj_hpath}/Loop4/setpoint type "drivable"
hsetprop ${scobj_hpath}/Loop4/setpoint nxalias "${name}_Loop4_setpoint" hsetprop ${scobj_hpath}/Loop4/setpoint nxalias "${name}_Loop4_setpoint"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/Loop4/nick 15 ${sct_controller} poll ${scobj_hpath}/Loop4/nick 15
${sct_controller} poll ${scobj_hpath}/Loop4/power 5 ${sct_controller} poll ${scobj_hpath}/Loop4/power 5
${sct_controller} poll ${scobj_hpath}/Loop4/sensor 1 ${sct_controller} poll ${scobj_hpath}/Loop4/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop4/setpoint 5 ${sct_controller} poll ${scobj_hpath}/Loop4/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop4/setpoint ${sct_controller} write ${scobj_hpath}/Loop4/setpoint
} else { } else {
::scobj::mercury_temp::sics_log 9 "[environment_simulation] => No poll/write for mercury_temp" ::scobj::mercury_temp::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_temp"
} }
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
ansto_makesctdrive ${name}_Loop4_setpoint ${scobj_hpath}/Loop4/setpoint ${scobj_hpath}/Loop4/sensor ${sct_controller} ansto_makesctdrive ${name}_Loop4_setpoint ${scobj_hpath}/Loop4/setpoint ${scobj_hpath}/Loop4/sensor ${sct_controller}
} }
# mkDriver hook code goes here # mkDriver hook code goes here
@ -371,31 +371,37 @@ proc ::scobj::mercury_temp::mkDriver { sct_controller name ip_address tcp_port i
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::mercury_temp::add_driver {name device_class simulation_flag ip_address tcp_port {id 99} {tol 1}} {
set catch_status [ catch {
::scobj::mercury_temp::sics_log 9 "::scobj::mercury_temp::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol}"
if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::mercury_temp::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::mercury_temp::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
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 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}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::mercury_temp { namespace eval ::scobj::mercury_temp {
namespace export debug_threshold namespace export debug_threshold
namespace export debug_log namespace export debug_log
namespace export sics_log namespace export sics_log
namespace export mkDriver namespace export mkDriver
namespace export add_driver
} }
proc add_mercury_temp {name ip_address tcp_port {id 99} {tol 1}} { proc add_mercury_temp {name ip_address tcp_port {id 99} {tol 1}} {
set catch_status [ catch { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::mercury_temp::sics_log 9 "add_mercury_temp ${name} ${ip_address} ${tcp_port} ${id} ${tol}" ::scobj::mercury_temp::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${{id}" "${99}}" "${{tol}" "${1}}"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::mercury_temp::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::mercury_temp::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
}
} else {
::scobj::mercury_temp::sics_log 9 "[environment_simulation] => No sctcontroller for mercury_temp"
}
::scobj::mercury_temp::sics_log 1 "::scobj::mercury_temp::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id} ${tol}"
::scobj::mercury_temp::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id} ${tol}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
clientput "file evaluation of sct_mercury_temp.tcl" clientput "file evaluation of sct_mercury_temp.tcl"
@ -406,6 +412,8 @@ proc ::scobj::mercury_temp::read_config {} {
set ns "::scobj::mercury_temp" set ns "::scobj::mercury_temp"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -413,6 +421,12 @@ proc ::scobj::mercury_temp::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -423,9 +437,9 @@ proc ::scobj::mercury_temp::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "mercury_temp"] } { if { [string equal -nocase [dict get $v "driver"] "mercury_temp"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -467,9 +481,9 @@ proc ::scobj::mercury_temp::read_config {} {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_mercury_temp ${name} ${ip_address} ${tcp_port} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else { } else {
add_mercury_temp ${name} "aqadapter" ${asyncqueue} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
} }
} }
} }

View File

@ -244,14 +244,14 @@ proc ::scobj::mercury_valve::setValve {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::mercury_valve::mkDriver { sct_controller name ip_address tcp_port id valve_tol } { proc ::scobj::mercury_valve::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id valve_tol } {
::scobj::mercury_valve::sics_log 9 "::scobj::mercury_valve::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${id} ${valve_tol}" ::scobj::mercury_valve::sics_log 9 "::scobj::mercury_valve::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${valve_tol}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
@ -301,16 +301,16 @@ proc ::scobj::mercury_valve::mkDriver { sct_controller name ip_address tcp_port
hsetprop ${scobj_hpath}/Valve/setpoint type "drivable" hsetprop ${scobj_hpath}/Valve/setpoint type "drivable"
hsetprop ${scobj_hpath}/Valve/setpoint nxalias "${name}_Valve_setpoint" hsetprop ${scobj_hpath}/Valve/setpoint nxalias "${name}_Valve_setpoint"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/Valve/sensor 5 ${sct_controller} poll ${scobj_hpath}/Valve/sensor 5
${sct_controller} write ${scobj_hpath}/Valve/setpoint ${sct_controller} write ${scobj_hpath}/Valve/setpoint
} else { } else {
::scobj::mercury_valve::sics_log 9 "[environment_simulation] => No poll/write for mercury_valve" ::scobj::mercury_valve::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_valve"
} }
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
ansto_makesctdrive ${name}_Valve_setpoint ${scobj_hpath}/Valve/setpoint ${scobj_hpath}/Valve/sensor ${sct_controller} ansto_makesctdrive ${name}_Valve_setpoint ${scobj_hpath}/Valve/setpoint ${scobj_hpath}/Valve/sensor ${sct_controller}
} }
# mkDriver hook code goes here # mkDriver hook code goes here
@ -318,31 +318,37 @@ proc ::scobj::mercury_valve::mkDriver { sct_controller name ip_address tcp_port
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::mercury_valve::add_driver {name device_class simulation_flag ip_address tcp_port {id 99} {valve_tol 2}} {
set catch_status [ catch {
::scobj::mercury_valve::sics_log 9 "::scobj::mercury_valve::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${valve_tol}"
if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::mercury_valve::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::mercury_valve::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
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 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}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::mercury_valve { namespace eval ::scobj::mercury_valve {
namespace export debug_threshold namespace export debug_threshold
namespace export debug_log namespace export debug_log
namespace export sics_log namespace export sics_log
namespace export mkDriver namespace export mkDriver
namespace export add_driver
} }
proc add_mercury_valve {name ip_address tcp_port {id 99} {valve_tol 2}} { proc add_mercury_valve {name ip_address tcp_port {id 99} {valve_tol 2}} {
set catch_status [ catch { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::mercury_valve::sics_log 9 "add_mercury_valve ${name} ${ip_address} ${tcp_port} ${id} ${valve_tol}" ::scobj::mercury_valve::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${{id}" "${99}}" "${{valve_tol}" "${2}}"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::mercury_valve::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::mercury_valve::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
}
} else {
::scobj::mercury_valve::sics_log 9 "[environment_simulation] => No sctcontroller for mercury_valve"
}
::scobj::mercury_valve::sics_log 1 "::scobj::mercury_valve::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id} ${valve_tol}"
::scobj::mercury_valve::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id} ${valve_tol}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
clientput "file evaluation of sct_mercury_valve.tcl" clientput "file evaluation of sct_mercury_valve.tcl"
@ -353,6 +359,8 @@ proc ::scobj::mercury_valve::read_config {} {
set ns "::scobj::mercury_valve" set ns "::scobj::mercury_valve"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -360,6 +368,12 @@ proc ::scobj::mercury_valve::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -370,9 +384,9 @@ proc ::scobj::mercury_valve::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "mercury_valve"] } { if { [string equal -nocase [dict get $v "driver"] "mercury_valve"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -414,9 +428,9 @@ proc ::scobj::mercury_valve::read_config {} {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_mercury_valve ${name} ${ip_address} ${tcp_port} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else { } else {
add_mercury_valve ${name} "aqadapter" ${asyncqueue} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
} }
} }
} }

View File

@ -27,18 +27,18 @@ proc ::scobj::nprvasm2::sics_log {debug_level debug_string} {
} catch_message ] } catch_message ]
} }
proc ::scobj::nprvasm2::mkDriver { sct_controller name ip_address tcp_port tol } { proc ::scobj::nprvasm2::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port tol } {
::scobj::nprvasm2::sics_log 9 "::scobj::nprvasm2::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${tol}" ::scobj::nprvasm2::sics_log 9 "::scobj::nprvasm2::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${tol}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code starts # mkDriver hook code starts
@ -48,17 +48,10 @@ proc ::scobj::nprvasm2::mkDriver { sct_controller name ip_address tcp_port tol }
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::nprvasm2 { proc ::scobj::nprvasm2::add_driver {name device_class simulation_flag ip_address tcp_port {tol 1.0}} {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
}
proc add_nprvasm2 {name ip_address tcp_port {tol 1.0}} {
set catch_status [ catch { set catch_status [ catch {
::scobj::nprvasm2::sics_log 9 "add_nprvasm2 ${name} ${ip_address} ${tcp_port} ${tol}" ::scobj::nprvasm2::sics_log 9 "::scobj::nprvasm2::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${tol}"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::nprvasm2::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" ::scobj::nprvasm2::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port} makesctcontroller sct_${name} aqadapter ${tcp_port}
@ -67,14 +60,27 @@ proc add_nprvasm2 {name ip_address tcp_port {tol 1.0}} {
makesctcontroller sct_${name} std ${ip_address}:${tcp_port} makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
} }
} else { } else {
::scobj::nprvasm2::sics_log 9 "[environment_simulation] => No sctcontroller for nprvasm2" ::scobj::nprvasm2::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for nprvasm2"
} }
::scobj::nprvasm2::sics_log 1 "::scobj::nprvasm2::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${tol}" ::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} ${ip_address} ${tcp_port} ${tol} ::scobj::nprvasm2::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${tol}
} catch_message ] } catch_message ]
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::nprvasm2 {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
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}}"
}
clientput "file evaluation of sct_nprvasm2.tcl" clientput "file evaluation of sct_nprvasm2.tcl"
::scobj::nprvasm2::sics_log 9 "file evaluation of sct_nprvasm2.tcl" ::scobj::nprvasm2::sics_log 9 "file evaluation of sct_nprvasm2.tcl"
@ -83,6 +89,8 @@ proc ::scobj::nprvasm2::read_config {} {
set ns "::scobj::nprvasm2" set ns "::scobj::nprvasm2"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -90,6 +98,12 @@ proc ::scobj::nprvasm2::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -100,9 +114,9 @@ proc ::scobj::nprvasm2::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "nprvasm2"] } { if { [string equal -nocase [dict get $v "driver"] "nprvasm2"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -144,9 +158,9 @@ proc ::scobj::nprvasm2::read_config {} {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_nprvasm2 ${name} ${ip_address} ${tcp_port} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else { } else {
add_nprvasm2 ${name} "aqadapter" ${asyncqueue} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
} }
} }
} }

View File

@ -370,8 +370,8 @@ proc ::scobj::pfeiffer_hg::setValue {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::pfeiffer_hg::mkDriver { sct_controller name ip_address tcp_port } { proc ::scobj::pfeiffer_hg::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } {
::scobj::pfeiffer_hg::sics_log 9 "::scobj::pfeiffer_hg::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port}" ::scobj::pfeiffer_hg::sics_log 9 "::scobj::pfeiffer_hg::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
@ -379,7 +379,7 @@ proc ::scobj::pfeiffer_hg::mkDriver { sct_controller name ip_address tcp_port }
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
@ -453,16 +453,16 @@ proc ::scobj::pfeiffer_hg::mkDriver { sct_controller name ip_address tcp_port }
hsetprop ${scobj_hpath}/pressure/setpoint type "drivable" hsetprop ${scobj_hpath}/pressure/setpoint type "drivable"
hsetprop ${scobj_hpath}/pressure/setpoint nxalias "${name}_pressure_setpoint" hsetprop ${scobj_hpath}/pressure/setpoint nxalias "${name}_pressure_setpoint"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/pressure/sensor 1 ${sct_controller} poll ${scobj_hpath}/pressure/sensor 1
${sct_controller} write ${scobj_hpath}/pressure/setpoint ${sct_controller} write ${scobj_hpath}/pressure/setpoint
} else { } else {
::scobj::pfeiffer_hg::sics_log 9 "[environment_simulation] => No poll/write for pfeiffer_hg" ::scobj::pfeiffer_hg::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for pfeiffer_hg"
} }
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
ansto_makesctdrive ${name}_pressure_setpoint ${scobj_hpath}/pressure/setpoint ${scobj_hpath}/pressure/sensor ${sct_controller} ansto_makesctdrive ${name}_pressure_setpoint ${scobj_hpath}/pressure/setpoint ${scobj_hpath}/pressure/sensor ${sct_controller}
} }
# mkDriver hook code starts # mkDriver hook code starts
@ -473,17 +473,10 @@ proc ::scobj::pfeiffer_hg::mkDriver { sct_controller name ip_address tcp_port }
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::pfeiffer_hg { proc ::scobj::pfeiffer_hg::add_driver {name device_class simulation_flag ip_address tcp_port} {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
}
proc add_pfeiffer_hg {name ip_address tcp_port} {
set catch_status [ catch { set catch_status [ catch {
::scobj::pfeiffer_hg::sics_log 9 "add_pfeiffer_hg ${name} ${ip_address} ${tcp_port}" ::scobj::pfeiffer_hg::sics_log 9 "::scobj::pfeiffer_hg::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::pfeiffer_hg::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" ::scobj::pfeiffer_hg::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port} makesctcontroller sct_${name} aqadapter ${tcp_port}
@ -492,14 +485,27 @@ proc add_pfeiffer_hg {name ip_address tcp_port} {
makesctcontroller sct_${name} std ${ip_address}:${tcp_port} makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
} }
} else { } else {
::scobj::pfeiffer_hg::sics_log 9 "[environment_simulation] => No sctcontroller for pfeiffer_hg" ::scobj::pfeiffer_hg::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for pfeiffer_hg"
} }
::scobj::pfeiffer_hg::sics_log 1 "::scobj::pfeiffer_hg::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}" ::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} ${ip_address} ${tcp_port} ::scobj::pfeiffer_hg::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} catch_message ] } catch_message ]
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::pfeiffer_hg {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
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}
}
clientput "file evaluation of sct_pfeiffer_hg.tcl" clientput "file evaluation of sct_pfeiffer_hg.tcl"
::scobj::pfeiffer_hg::sics_log 9 "file evaluation of sct_pfeiffer_hg.tcl" ::scobj::pfeiffer_hg::sics_log 9 "file evaluation of sct_pfeiffer_hg.tcl"
@ -508,6 +514,8 @@ proc ::scobj::pfeiffer_hg::read_config {} {
set ns "::scobj::pfeiffer_hg" set ns "::scobj::pfeiffer_hg"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -515,6 +523,12 @@ proc ::scobj::pfeiffer_hg::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -525,9 +539,9 @@ proc ::scobj::pfeiffer_hg::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "pfeiffer_hg"] } { if { [string equal -nocase [dict get $v "driver"] "pfeiffer_hg"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -554,9 +568,9 @@ proc ::scobj::pfeiffer_hg::read_config {} {
} }
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_pfeiffer_hg ${name} ${ip_address} ${tcp_port} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} else { } else {
add_pfeiffer_hg ${name} "aqadapter" ${asyncqueue} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue}
} }
} }
} }

View File

@ -191,14 +191,14 @@ proc ::scobj::srs_sr630::setValue {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::srs_sr630::mkDriver { sct_controller name ip_address tcp_port } { proc ::scobj::srs_sr630::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } {
::scobj::srs_sr630::sics_log 9 "::scobj::srs_sr630::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port}" ::scobj::srs_sr630::sics_log 9 "::scobj::srs_sr630::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass NXdetector sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
@ -325,7 +325,7 @@ proc ::scobj::srs_sr630::mkDriver { sct_controller name ip_address tcp_port } {
hsetprop ${scobj_hpath} klass "@none" hsetprop ${scobj_hpath} klass "@none"
hsetprop ${scobj_hpath} type "part" hsetprop ${scobj_hpath} type "part"
if {[string equal -nocase [SplitReply [detector_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/id 600 ${sct_controller} poll ${scobj_hpath}/id 600
${sct_controller} poll ${scobj_hpath}/sensor_01 60 ${sct_controller} poll ${scobj_hpath}/sensor_01 60
${sct_controller} poll ${scobj_hpath}/sensor_02 600 ${sct_controller} poll ${scobj_hpath}/sensor_02 600
@ -336,9 +336,9 @@ proc ::scobj::srs_sr630::mkDriver { sct_controller name ip_address tcp_port } {
${sct_controller} poll ${scobj_hpath}/sensor_07 600 ${sct_controller} poll ${scobj_hpath}/sensor_07 600
${sct_controller} poll ${scobj_hpath}/sensor_08 600 ${sct_controller} poll ${scobj_hpath}/sensor_08 600
} else { } else {
::scobj::srs_sr630::sics_log 9 "[detector_simulation] => No poll/write for srs_sr630" ::scobj::srs_sr630::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for srs_sr630"
} }
hsetprop ${scobj_hpath} klass NXdetector hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code goes here # mkDriver hook code goes here
@ -346,31 +346,37 @@ proc ::scobj::srs_sr630::mkDriver { sct_controller name ip_address tcp_port } {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::srs_sr630::add_driver {name device_class simulation_flag ip_address tcp_port} {
set catch_status [ catch {
::scobj::srs_sr630::sics_log 9 "::scobj::srs_sr630::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::srs_sr630::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::srs_sr630::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
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 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}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::srs_sr630 { namespace eval ::scobj::srs_sr630 {
namespace export debug_threshold namespace export debug_threshold
namespace export debug_log namespace export debug_log
namespace export sics_log namespace export sics_log
namespace export mkDriver namespace export mkDriver
namespace export add_driver
} }
proc add_srs_sr630 {name ip_address tcp_port} { proc add_srs_sr630 {name ip_address tcp_port} {
set catch_status [ catch { set simulation_flag "[string tolower [SplitReply [detector_simulation]]]"
::scobj::srs_sr630::sics_log 9 "add_srs_sr630 ${name} ${ip_address} ${tcp_port}" ::scobj::srs_sr630::add_driver ${name} "NXdetector" "${simulation_flag}" ${ip_address} ${tcp_port}
if {[string equal -nocase [SplitReply [detector_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::srs_sr630::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::srs_sr630::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
}
} else {
::scobj::srs_sr630::sics_log 9 "[detector_simulation] => No sctcontroller for srs_sr630"
}
::scobj::srs_sr630::sics_log 1 "::scobj::srs_sr630::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}"
::scobj::srs_sr630::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
clientput "file evaluation of sct_srs_sr630.tcl" clientput "file evaluation of sct_srs_sr630.tcl"
@ -381,6 +387,8 @@ proc ::scobj::srs_sr630::read_config {} {
set ns "::scobj::srs_sr630" set ns "::scobj::srs_sr630"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [detector_simulation]]]"
set device_class "NXdetector"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -388,6 +396,12 @@ proc ::scobj::srs_sr630::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -398,9 +412,9 @@ proc ::scobj::srs_sr630::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "srs_sr630"] } { if { [string equal -nocase [dict get $v "driver"] "srs_sr630"] } {
if { ![string equal -nocase [SplitReply [detector_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[detector_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -427,9 +441,9 @@ proc ::scobj::srs_sr630::read_config {} {
} }
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_srs_sr630 ${name} ${ip_address} ${tcp_port} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} else { } else {
add_srs_sr630 ${name} "aqadapter" ${asyncqueue} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue}
} }
} }
} }

View File

@ -27,18 +27,18 @@ proc ::scobj::watlow_mpm::sics_log {debug_level debug_string} {
} catch_message ] } catch_message ]
} }
proc ::scobj::watlow_mpm::mkDriver { sct_controller name ip_address tcp_port id datype dev_id tol } { proc ::scobj::watlow_mpm::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id datype dev_id tol } {
::scobj::watlow_mpm::sics_log 9 "::scobj::watlow_mpm::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}" ::scobj::watlow_mpm::sics_log 9 "::scobj::watlow_mpm::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT user float MakeSICSObj ${name} SCT_OBJECT user float
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code starts # mkDriver hook code starts
@ -48,17 +48,10 @@ proc ::scobj::watlow_mpm::mkDriver { sct_controller name ip_address tcp_port id
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::watlow_mpm { proc ::scobj::watlow_mpm::add_driver {name device_class simulation_flag ip_address tcp_port id datype dev_id tol} {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
}
proc add_watlow_mpm {name ip_address tcp_port id datype dev_id tol} {
set catch_status [ catch { set catch_status [ catch {
::scobj::watlow_mpm::sics_log 9 "add_watlow_mpm ${name} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}" ::scobj::watlow_mpm::sics_log 9 "::scobj::watlow_mpm::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::watlow_mpm::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" ::scobj::watlow_mpm::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port} makesctcontroller sct_${name} aqadapter ${tcp_port}
@ -67,14 +60,27 @@ proc add_watlow_mpm {name ip_address tcp_port id datype dev_id tol} {
makesctcontroller sct_${name} std ${ip_address}:${tcp_port} makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
} }
} else { } else {
::scobj::watlow_mpm::sics_log 9 "[environment_simulation] => No sctcontroller for watlow_mpm" ::scobj::watlow_mpm::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for watlow_mpm"
} }
::scobj::watlow_mpm::sics_log 1 "::scobj::watlow_mpm::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}" ::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} ${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}
} catch_message ] } catch_message ]
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::watlow_mpm {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
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}"
}
clientput "file evaluation of sct_watlow_mpm.tcl" clientput "file evaluation of sct_watlow_mpm.tcl"
::scobj::watlow_mpm::sics_log 9 "file evaluation of sct_watlow_mpm.tcl" ::scobj::watlow_mpm::sics_log 9 "file evaluation of sct_watlow_mpm.tcl"
@ -83,6 +89,8 @@ proc ::scobj::watlow_mpm::read_config {} {
set ns "::scobj::watlow_mpm" set ns "::scobj::watlow_mpm"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -90,6 +98,12 @@ proc ::scobj::watlow_mpm::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -100,9 +114,9 @@ proc ::scobj::watlow_mpm::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "watlow_mpm"] } { if { [string equal -nocase [dict get $v "driver"] "watlow_mpm"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -144,9 +158,9 @@ proc ::scobj::watlow_mpm::read_config {} {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_watlow_mpm ${name} ${ip_address} ${tcp_port} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else { } else {
add_watlow_mpm ${name} "aqadapter" ${asyncqueue} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
} }
} }
} }

View File

@ -27,18 +27,18 @@ proc ::scobj::watlow_mrm::sics_log {debug_level debug_string} {
} catch_message ] } catch_message ]
} }
proc ::scobj::watlow_mrm::mkDriver { sct_controller name ip_address tcp_port id datype dev_id tol } { proc ::scobj::watlow_mrm::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id datype dev_id tol } {
::scobj::watlow_mrm::sics_log 9 "::scobj::watlow_mrm::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}" ::scobj::watlow_mrm::sics_log 9 "::scobj::watlow_mrm::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT user float MakeSICSObj ${name} SCT_OBJECT user float
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code starts # mkDriver hook code starts
@ -48,17 +48,10 @@ proc ::scobj::watlow_mrm::mkDriver { sct_controller name ip_address tcp_port id
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::watlow_mrm { proc ::scobj::watlow_mrm::add_driver {name device_class simulation_flag ip_address tcp_port id datype dev_id tol} {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
}
proc add_watlow_mrm {name ip_address tcp_port id datype dev_id tol} {
set catch_status [ catch { set catch_status [ catch {
::scobj::watlow_mrm::sics_log 9 "add_watlow_mrm ${name} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}" ::scobj::watlow_mrm::sics_log 9 "::scobj::watlow_mrm::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::watlow_mrm::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" ::scobj::watlow_mrm::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port} makesctcontroller sct_${name} aqadapter ${tcp_port}
@ -67,14 +60,27 @@ proc add_watlow_mrm {name ip_address tcp_port id datype dev_id tol} {
makesctcontroller sct_${name} std ${ip_address}:${tcp_port} makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
} }
} else { } else {
::scobj::watlow_mrm::sics_log 9 "[environment_simulation] => No sctcontroller for watlow_mrm" ::scobj::watlow_mrm::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for watlow_mrm"
} }
::scobj::watlow_mrm::sics_log 1 "::scobj::watlow_mrm::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}" ::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} ${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}
} catch_message ] } catch_message ]
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::watlow_mrm {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
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}"
}
clientput "file evaluation of sct_watlow_mrm.tcl" clientput "file evaluation of sct_watlow_mrm.tcl"
::scobj::watlow_mrm::sics_log 9 "file evaluation of sct_watlow_mrm.tcl" ::scobj::watlow_mrm::sics_log 9 "file evaluation of sct_watlow_mrm.tcl"
@ -83,6 +89,8 @@ proc ::scobj::watlow_mrm::read_config {} {
set ns "::scobj::watlow_mrm" set ns "::scobj::watlow_mrm"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -90,6 +98,12 @@ proc ::scobj::watlow_mrm::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -100,9 +114,9 @@ proc ::scobj::watlow_mrm::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "watlow_mrm"] } { if { [string equal -nocase [dict get $v "driver"] "watlow_mrm"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -144,9 +158,9 @@ proc ::scobj::watlow_mrm::read_config {} {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_watlow_mrm ${name} ${ip_address} ${tcp_port} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else { } else {
add_watlow_mrm ${name} "aqadapter" ${asyncqueue} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
} }
} }
} }

View File

@ -27,18 +27,18 @@ proc ::scobj::watlow_mst4::sics_log {debug_level debug_string} {
} catch_message ] } catch_message ]
} }
proc ::scobj::watlow_mst4::mkDriver { sct_controller name ip_address tcp_port id datype dev_id tol } { proc ::scobj::watlow_mst4::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id datype dev_id tol } {
::scobj::watlow_mst4::sics_log 9 "::scobj::watlow_mst4::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}" ::scobj::watlow_mst4::sics_log 9 "::scobj::watlow_mst4::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT user float MakeSICSObj ${name} SCT_OBJECT user float
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code starts # mkDriver hook code starts
@ -48,17 +48,10 @@ proc ::scobj::watlow_mst4::mkDriver { sct_controller name ip_address tcp_port id
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::watlow_mst4 { proc ::scobj::watlow_mst4::add_driver {name device_class simulation_flag ip_address tcp_port id datype dev_id tol} {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
}
proc add_watlow_mst4 {name ip_address tcp_port id datype dev_id tol} {
set catch_status [ catch { set catch_status [ catch {
::scobj::watlow_mst4::sics_log 9 "add_watlow_mst4 ${name} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}" ::scobj::watlow_mst4::sics_log 9 "::scobj::watlow_mst4::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::watlow_mst4::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" ::scobj::watlow_mst4::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port} makesctcontroller sct_${name} aqadapter ${tcp_port}
@ -67,14 +60,27 @@ proc add_watlow_mst4 {name ip_address tcp_port id datype dev_id tol} {
makesctcontroller sct_${name} std ${ip_address}:${tcp_port} makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
} }
} else { } else {
::scobj::watlow_mst4::sics_log 9 "[environment_simulation] => No sctcontroller for watlow_mst4" ::scobj::watlow_mst4::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for watlow_mst4"
} }
::scobj::watlow_mst4::sics_log 1 "::scobj::watlow_mst4::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}" ::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} ${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}
} catch_message ] } catch_message ]
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::watlow_mst4 {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
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}"
}
clientput "file evaluation of sct_watlow_mst4.tcl" clientput "file evaluation of sct_watlow_mst4.tcl"
::scobj::watlow_mst4::sics_log 9 "file evaluation of sct_watlow_mst4.tcl" ::scobj::watlow_mst4::sics_log 9 "file evaluation of sct_watlow_mst4.tcl"
@ -83,6 +89,8 @@ proc ::scobj::watlow_mst4::read_config {} {
set ns "::scobj::watlow_mst4" set ns "::scobj::watlow_mst4"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -90,6 +98,12 @@ proc ::scobj::watlow_mst4::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -100,9 +114,9 @@ proc ::scobj::watlow_mst4::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "watlow_mst4"] } { if { [string equal -nocase [dict get $v "driver"] "watlow_mst4"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -144,9 +158,9 @@ proc ::scobj::watlow_mst4::read_config {} {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_watlow_mst4 ${name} ${ip_address} ${tcp_port} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else { } else {
add_watlow_mst4 ${name} "aqadapter" ${asyncqueue} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
} }
} }
} }

View File

@ -27,8 +27,8 @@ proc ::scobj::west4100::sics_log {debug_level debug_string} {
} catch_message ] } catch_message ]
} }
proc ::scobj::west4100::mkDriver { sct_controller name ip_address tcp_port dev_id } { proc ::scobj::west4100::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port dev_id } {
::scobj::west4100::sics_log 9 "::scobj::west4100::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${dev_id}" ::scobj::west4100::sics_log 9 "::scobj::west4100::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
@ -39,21 +39,27 @@ proc ::scobj::west4100::mkDriver { sct_controller name ip_address tcp_port dev_i
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::west4100::add_driver {name device_class simulation_flag ip_address tcp_port dev_id} {
set catch_status [ catch {
::scobj::west4100::sics_log 9 "::scobj::west4100::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}"
::scobj::west4100::sics_log 9 "No sctcontroller for west4100"
::scobj::west4100::sics_log 1 "::scobj::west4100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}"
::scobj::west4100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::west4100 { namespace eval ::scobj::west4100 {
namespace export debug_threshold namespace export debug_threshold
namespace export debug_log namespace export debug_log
namespace export sics_log namespace export sics_log
namespace export mkDriver namespace export mkDriver
namespace export add_driver
} }
proc add_west4100 {name ip_address tcp_port dev_id} { proc add_west4100 {name ip_address tcp_port dev_id} {
set catch_status [ catch { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::west4100::sics_log 9 "add_west4100 ${name} ${ip_address} ${tcp_port} ${dev_id}" ::scobj::west4100::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${dev_id}"
::scobj::west4100::sics_log 9 "No sctcontroller for west4100"
::scobj::west4100::sics_log 1 "::scobj::west4100::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${dev_id}"
::scobj::west4100::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${dev_id}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
clientput "file evaluation of sct_west4100.tcl" clientput "file evaluation of sct_west4100.tcl"
@ -64,6 +70,8 @@ proc ::scobj::west4100::read_config {} {
set ns "::scobj::west4100" set ns "::scobj::west4100"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -71,6 +79,12 @@ proc ::scobj::west4100::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -81,9 +95,9 @@ proc ::scobj::west4100::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "west4100"] } { if { [string equal -nocase [dict get $v "driver"] "west4100"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -125,9 +139,9 @@ proc ::scobj::west4100::read_config {} {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_west4100 ${name} ${ip_address} ${tcp_port} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else { } else {
add_west4100 ${name} "aqadapter" ${asyncqueue} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
} }
} }
} }

View File

@ -262,14 +262,14 @@ proc ::scobj::west_6100::wrInteger {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::west_6100::mkDriver { sct_controller name ip_address tcp_port dev_id } { proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port dev_id } {
::scobj::west_6100::sics_log 9 "::scobj::west_6100::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${dev_id}" ::scobj::west_6100::sics_log 9 "::scobj::west_6100::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass environment sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
@ -400,7 +400,7 @@ proc ::scobj::west_6100::mkDriver { sct_controller name ip_address tcp_port dev_
hsetprop ${scobj_hpath} klass "@none" hsetprop ${scobj_hpath} klass "@none"
hsetprop ${scobj_hpath} type "part" hsetprop ${scobj_hpath} type "part"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/alarm1 1 ${sct_controller} poll ${scobj_hpath}/alarm1 1
${sct_controller} poll ${scobj_hpath}/alarm2 1 ${sct_controller} poll ${scobj_hpath}/alarm2 1
${sct_controller} poll ${scobj_hpath}/power 1 ${sct_controller} poll ${scobj_hpath}/power 1
@ -416,7 +416,7 @@ proc ::scobj::west_6100::mkDriver { sct_controller name ip_address tcp_port dev_
${sct_controller} write ${scobj_hpath}/setpoint ${sct_controller} write ${scobj_hpath}/setpoint
${sct_controller} write ${scobj_hpath}/w_sp ${sct_controller} write ${scobj_hpath}/w_sp
} else { } else {
::scobj::west_6100::sics_log 9 "[environment_simulation] => No poll/write for west_6100" ::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
} }
hfactory ${scobj_hpath}/aux plain spy none hfactory ${scobj_hpath}/aux plain spy none
@ -461,14 +461,14 @@ proc ::scobj::west_6100::mkDriver { sct_controller name ip_address tcp_port dev_
hsetprop ${scobj_hpath}/aux/model type "part" hsetprop ${scobj_hpath}/aux/model type "part"
hsetprop ${scobj_hpath}/aux/model nxalias "${name}_aux_model" hsetprop ${scobj_hpath}/aux/model nxalias "${name}_aux_model"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/aux/decimal 2 ${sct_controller} poll ${scobj_hpath}/aux/decimal 2
${sct_controller} poll ${scobj_hpath}/aux/instatus 2 ${sct_controller} poll ${scobj_hpath}/aux/instatus 2
${sct_controller} poll ${scobj_hpath}/aux/model 2 ${sct_controller} poll ${scobj_hpath}/aux/model 2
} else { } else {
::scobj::west_6100::sics_log 9 "[environment_simulation] => No poll/write for west_6100" ::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
} }
hsetprop ${scobj_hpath} klass environment hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code goes here # mkDriver hook code goes here
@ -476,31 +476,37 @@ proc ::scobj::west_6100::mkDriver { sct_controller name ip_address tcp_port dev_
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::west_6100::add_driver {name device_class simulation_flag ip_address tcp_port dev_id} {
set catch_status [ catch {
::scobj::west_6100::sics_log 9 "::scobj::west_6100::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}"
if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::west_6100::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::west_6100::sics_log 9 "makesctcontroller sct_${name} modbus_ap ${ip_address}:${tcp_port}"
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 1 "::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}"
::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${dev_id}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::west_6100 { namespace eval ::scobj::west_6100 {
namespace export debug_threshold namespace export debug_threshold
namespace export debug_log namespace export debug_log
namespace export sics_log namespace export sics_log
namespace export mkDriver namespace export mkDriver
namespace export add_driver
} }
proc add_west_6100 {name ip_address tcp_port dev_id} { proc add_west_6100 {name ip_address tcp_port dev_id} {
set catch_status [ catch { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::west_6100::sics_log 9 "add_west_6100 ${name} ${ip_address} ${tcp_port} ${dev_id}" ::scobj::west_6100::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${dev_id}"
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::west_6100::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::west_6100::sics_log 9 "makesctcontroller sct_${name} modbus_ap ${ip_address}:${tcp_port}"
makesctcontroller sct_${name} modbus_ap ${ip_address}:${tcp_port}
}
} else {
::scobj::west_6100::sics_log 9 "[environment_simulation] => No sctcontroller for west_6100"
}
::scobj::west_6100::sics_log 1 "::scobj::west_6100::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${dev_id}"
::scobj::west_6100::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${dev_id}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
clientput "file evaluation of sct_west_6100.tcl" clientput "file evaluation of sct_west_6100.tcl"
@ -511,6 +517,8 @@ proc ::scobj::west_6100::read_config {} {
set ns "::scobj::west_6100" set ns "::scobj::west_6100"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -518,6 +526,12 @@ proc ::scobj::west_6100::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -528,9 +542,9 @@ proc ::scobj::west_6100::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "west_6100"] } { if { [string equal -nocase [dict get $v "driver"] "west_6100"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -572,9 +586,9 @@ proc ::scobj::west_6100::read_config {} {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_west_6100 ${name} ${ip_address} ${tcp_port} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else { } else {
add_west_6100 ${name} "aqadapter" ${asyncqueue} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
} }
} }
} }

View File

@ -27,8 +27,8 @@ proc ::scobj::epson_pandp::sics_log {debug_level debug_string} {
} catch_message ] } catch_message ]
} }
proc ::scobj::epson_pandp::mkDriver { sct_controller name ip_address tcp_port robot_name } { proc ::scobj::epson_pandp::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port robot_name } {
::scobj::epson_pandp::sics_log 9 "::scobj::epson_pandp::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port} ${robot_name}" ::scobj::epson_pandp::sics_log 9 "::scobj::epson_pandp::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${robot_name}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
@ -40,21 +40,27 @@ proc ::scobj::epson_pandp::mkDriver { sct_controller name ip_address tcp_port ro
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::epson_pandp::add_driver {name device_class simulation_flag ip_address tcp_port robot_name} {
set catch_status [ catch {
::scobj::epson_pandp::sics_log 9 "::scobj::epson_pandp::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${robot_name}"
::scobj::epson_pandp::sics_log 9 "No sctcontroller for epson_pandp"
::scobj::epson_pandp::sics_log 1 "::scobj::epson_pandp::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${robot_name}"
::scobj::epson_pandp::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${robot_name}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::epson_pandp { namespace eval ::scobj::epson_pandp {
namespace export debug_threshold namespace export debug_threshold
namespace export debug_log namespace export debug_log
namespace export sics_log namespace export sics_log
namespace export mkDriver namespace export mkDriver
namespace export add_driver
} }
proc add_epson_pandp {name ip_address tcp_port robot_name} { proc add_epson_pandp {name ip_address tcp_port robot_name} {
set catch_status [ catch { set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::epson_pandp::sics_log 9 "add_epson_pandp ${name} ${ip_address} ${tcp_port} ${robot_name}" ::scobj::epson_pandp::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${robot_name}"
::scobj::epson_pandp::sics_log 9 "No sctcontroller for epson_pandp"
::scobj::epson_pandp::sics_log 1 "::scobj::epson_pandp::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${robot_name}"
::scobj::epson_pandp::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port} ${robot_name}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
clientput "file evaluation of sct_epson_pandp.tcl" clientput "file evaluation of sct_epson_pandp.tcl"
@ -65,6 +71,8 @@ proc ::scobj::epson_pandp::read_config {} {
set ns "::scobj::epson_pandp" set ns "::scobj::epson_pandp"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
set device_class "environment"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -72,6 +80,12 @@ proc ::scobj::epson_pandp::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -82,9 +96,9 @@ proc ::scobj::epson_pandp::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "epson_pandp"] } { if { [string equal -nocase [dict get $v "driver"] "epson_pandp"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -126,9 +140,9 @@ proc ::scobj::epson_pandp::read_config {} {
error "$name is missing configuration values $missing_list" error "$name is missing configuration values $missing_list"
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_epson_pandp ${name} ${ip_address} ${tcp_port} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
} else { } else {
add_epson_pandp ${name} "aqadapter" ${asyncqueue} {*}$arg_list ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
} }
} }
} }

View File

@ -216,14 +216,14 @@ proc ::scobj::reactor_status::setValue {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::reactor_status::mkDriver { sct_controller name ip_address tcp_port } { proc ::scobj::reactor_status::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } {
::scobj::reactor_status::sics_log 9 "::scobj::reactor_status::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port}" ::scobj::reactor_status::sics_log 9 "::scobj::reactor_status::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
set ns "[namespace current]" set ns "[namespace current]"
set catch_status [ catch { set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass NXsource sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name} sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name} set scobj_hpath /sics/${name}
@ -300,12 +300,12 @@ proc ::scobj::reactor_status::mkDriver { sct_controller name ip_address tcp_port
hsetprop ${scobj_hpath} klass "@none" hsetprop ${scobj_hpath} klass "@none"
hsetprop ${scobj_hpath} type "part" hsetprop ${scobj_hpath} type "part"
if {[string equal -nocase [SplitReply [opal_simulation]] "false"]} { if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/status 30 ${sct_controller} poll ${scobj_hpath}/status 30
} else { } else {
::scobj::reactor_status::sics_log 9 "[opal_simulation] => No poll/write for reactor_status" ::scobj::reactor_status::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for reactor_status"
} }
hsetprop ${scobj_hpath} klass NXsource hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5 hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code starts # mkDriver hook code starts
@ -314,31 +314,37 @@ proc ::scobj::reactor_status::mkDriver { sct_controller name ip_address tcp_port
handle_exception ${catch_status} ${catch_message} handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::reactor_status::add_driver {name device_class simulation_flag ip_address tcp_port} {
set catch_status [ catch {
::scobj::reactor_status::sics_log 9 "::scobj::reactor_status::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::reactor_status::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::reactor_status::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
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 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}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::reactor_status { namespace eval ::scobj::reactor_status {
namespace export debug_threshold namespace export debug_threshold
namespace export debug_log namespace export debug_log
namespace export sics_log namespace export sics_log
namespace export mkDriver namespace export mkDriver
namespace export add_driver
} }
proc add_reactor_status {name ip_address tcp_port} { proc add_reactor_status {name ip_address tcp_port} {
set catch_status [ catch { set simulation_flag "[string tolower [SplitReply [opal_simulation]]]"
::scobj::reactor_status::sics_log 9 "add_reactor_status ${name} ${ip_address} ${tcp_port}" ::scobj::reactor_status::add_driver ${name} "NXsource" "${simulation_flag}" ${ip_address} ${tcp_port}
if {[string equal -nocase [SplitReply [opal_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::reactor_status::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::reactor_status::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
}
} else {
::scobj::reactor_status::sics_log 9 "[opal_simulation] => No sctcontroller for reactor_status"
}
::scobj::reactor_status::sics_log 1 "::scobj::reactor_status::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}"
::scobj::reactor_status::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
clientput "file evaluation of sct_reactor_status.tcl" clientput "file evaluation of sct_reactor_status.tcl"
@ -349,6 +355,8 @@ proc ::scobj::reactor_status::read_config {} {
set ns "::scobj::reactor_status" set ns "::scobj::reactor_status"
dict for {k u} $::config_dict { dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } { if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [opal_simulation]]]"
set device_class "NXsource"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue continue
} }
@ -356,6 +364,12 @@ proc ::scobj::reactor_status::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue continue
} }
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name] set name [dict get $u name]
set implementation [dict get $u "implementation"] set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } { if { !([dict exists $::config_dict $implementation]) } {
@ -366,9 +380,9 @@ proc ::scobj::reactor_status::read_config {} {
continue continue
} }
if { [string equal -nocase [dict get $v "driver"] "reactor_status"] } { if { [string equal -nocase [dict get $v "driver"] "reactor_status"] } {
if { ![string equal -nocase [SplitReply [opal_simulation]] "false"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null" set asyncqueue "null"
${ns}::sics_log 9 "[opal_simulation] => using null asyncqueue" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } { } elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"] set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
@ -395,9 +409,9 @@ proc ::scobj::reactor_status::read_config {} {
} }
} }
if { [string equal -nocase ${asyncqueue} "sct"] } { if { [string equal -nocase ${asyncqueue} "sct"] } {
add_reactor_status ${name} ${ip_address} ${tcp_port} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} else { } else {
add_reactor_status ${name} "aqadapter" ${asyncqueue} ${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue}
} }
} }
} }