Regenerate templated drivers to get changes to logging and simulation tests

This commit is contained in:
Douglas Clowes
2014-06-16 10:37:10 +10:00
parent 18d40f69d9
commit 1010003d6c
13 changed files with 151 additions and 61 deletions

View File

@ -10,7 +10,7 @@ proc ::scobj::astrium_chopper::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} {
set fd [open "/tmp/astrium_chopper_[basename ${tc_root}].log" "a"]
set fd [open "../log/astrium_chopper_[basename ${tc_root}].log" "a"]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
puts ${fd} "${line}"
close ${fd}

View File

@ -10,7 +10,7 @@ proc ::scobj::shutters::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} {
set fd [open "/tmp/shutters_[basename ${tc_root}].log" "a"]
set fd [open "../log/shutters_[basename ${tc_root}].log" "a"]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
puts ${fd} "${line}"
close ${fd}
@ -255,12 +255,14 @@ proc ::scobj::shutters::mkDriver { sct_controller name } {
hsetprop ${scobj_hpath} data "true"
hsetprop ${scobj_hpath} nxsave "true"
if {[SplitReply [motor_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [motor_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/fast_shutter 1
${sct_controller} poll ${scobj_hpath}/rough_100 1
${sct_controller} poll ${scobj_hpath}/rough_40 1
${sct_controller} write ${scobj_hpath}/rough_100
${sct_controller} write ${scobj_hpath}/rough_40
} else {
::scobj::shutters::sics_log 9 "[motor_simulation] => No poll/write for shutters"
}
hsetprop ${scobj_hpath} klass instrument
hsetprop ${scobj_hpath} debug_threshold 5
@ -280,7 +282,7 @@ namespace eval ::scobj::shutters {
proc add_shutters {name IP port} {
set catch_status [ catch {
::scobj::shutters::sics_log 9 "add_shutters ${name} ${IP} ${port}"
if {[SplitReply [motor_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [motor_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${IP}"]} {
::scobj::shutters::sics_log 9 "makesctcontroller sct_${name} aqadapter ${port}"
makesctcontroller sct_${name} aqadapter ${port}
@ -288,6 +290,8 @@ proc add_shutters {name IP port} {
::scobj::shutters::sics_log 9 "makesctcontroller sct_${name} dmc2280 ${IP}:${port}"
makesctcontroller sct_${name} dmc2280 ${IP}:${port}
}
} else {
::scobj::shutters::sics_log 9 "[motor_simulation] => No sctcontroller for shutters"
}
::scobj::shutters::sics_log 1 "::scobj::shutters::mkDriver sct_${name} ${name}"
::scobj::shutters::mkDriver sct_${name} ${name}
@ -306,7 +310,10 @@ proc ::scobj::shutters::read_config {} {
if { [dict get $v "driver"] == "shutters" } {
if { [dict get $v enabled] } {
set name [dict get $v name]
if { [dict exists $v "asyncqueue"] } {
if { ![string equal -nocase [SplitReply [motor_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[motor_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
} else {
if { [dict exists $v "asyncprotocol"] } {

View File

@ -10,7 +10,7 @@ proc ::scobj::tank::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} {
set fd [open "/tmp/tank_[basename ${tc_root}].log" "a"]
set fd [open "../log/tank_[basename ${tc_root}].log" "a"]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
puts ${fd} "${line}"
close ${fd}

View File

@ -10,7 +10,7 @@ proc ::scobj::hiden_xcs::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} {
set fd [open "/tmp/hiden_xcs_[basename ${tc_root}].log" "a"]
set fd [open "../log/hiden_xcs_[basename ${tc_root}].log" "a"]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
puts ${fd} "${line}"
close ${fd}
@ -835,9 +835,11 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name id } {
hsetprop ${scobj_hpath} data "true"
hsetprop ${scobj_hpath} nxsave "true"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/enabled 10
${sct_controller} write ${scobj_hpath}/enabled
} else {
::scobj::hiden_xcs::sics_log 9 "[environment_simulation] => No poll/write for hiden_xcs"
}
hfactory ${scobj_hpath}/analog plain spy none
@ -977,7 +979,7 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name id } {
hsetprop ${scobj_hpath}/analog/sp3 type "part"
hsetprop ${scobj_hpath}/analog/sp3 nxalias "${name}_analog_sp3"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/analog/ansto_temp 5
${sct_controller} poll ${scobj_hpath}/analog/pv1 5
${sct_controller} poll ${scobj_hpath}/analog/pv2 5
@ -990,6 +992,8 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name id } {
${sct_controller} write ${scobj_hpath}/analog/sp1
${sct_controller} write ${scobj_hpath}/analog/sp2
${sct_controller} write ${scobj_hpath}/analog/sp3
} else {
::scobj::hiden_xcs::sics_log 9 "[environment_simulation] => No poll/write for hiden_xcs"
}
hfactory ${scobj_hpath}/flow plain spy none
@ -1043,10 +1047,12 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name id } {
hsetprop ${scobj_hpath}/flow/setpoint type "drivable"
hsetprop ${scobj_hpath}/flow/setpoint nxalias "${name}_flow_setpoint"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/flow/sensor 1
${sct_controller} write ${scobj_hpath}/flow/setpoint
ansto_makesctdrive ${name}_flow_setpoint ${scobj_hpath}/flow/setpoint ${scobj_hpath}/flow/sensor ${sct_controller}
} else {
::scobj::hiden_xcs::sics_log 9 "[environment_simulation] => No poll/write for hiden_xcs"
}
hfactory ${scobj_hpath}/humidity plain spy none
@ -1100,10 +1106,12 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name id } {
hsetprop ${scobj_hpath}/humidity/setpoint type "drivable"
hsetprop ${scobj_hpath}/humidity/setpoint nxalias "${name}_humidity_setpoint"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/humidity/sensor 1
${sct_controller} write ${scobj_hpath}/humidity/setpoint
ansto_makesctdrive ${name}_humidity_setpoint ${scobj_hpath}/humidity/setpoint ${scobj_hpath}/humidity/sensor ${sct_controller}
} else {
::scobj::hiden_xcs::sics_log 9 "[environment_simulation] => No poll/write for hiden_xcs"
}
hsetprop ${scobj_hpath} klass environment
hsetprop ${scobj_hpath} debug_threshold 5
@ -1123,7 +1131,7 @@ namespace eval ::scobj::hiden_xcs {
proc add_hiden_xcs {name IP port id} {
set catch_status [ catch {
::scobj::hiden_xcs::sics_log 9 "add_hiden_xcs ${name} ${IP} ${port} ${id}"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${IP}"]} {
::scobj::hiden_xcs::sics_log 9 "makesctcontroller sct_${name} aqadapter ${port}"
makesctcontroller sct_${name} aqadapter ${port}
@ -1131,6 +1139,8 @@ proc add_hiden_xcs {name IP port id} {
::scobj::hiden_xcs::sics_log 9 "makesctcontroller sct_${name} std ${IP}:${port}"
makesctcontroller sct_${name} std ${IP}:${port}
}
} else {
::scobj::hiden_xcs::sics_log 9 "[environment_simulation] => No sctcontroller for hiden_xcs"
}
::scobj::hiden_xcs::sics_log 1 "::scobj::hiden_xcs::mkDriver sct_${name} ${name} ${id}"
::scobj::hiden_xcs::mkDriver sct_${name} ${name} ${id}
@ -1149,7 +1159,10 @@ proc ::scobj::hiden_xcs::read_config {} {
if { [dict get $v "driver"] == "hiden_xcs" } {
if { [dict get $v enabled] } {
set name [dict get $v name]
if { [dict exists $v "asyncqueue"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
} else {
if { [dict exists $v "asyncprotocol"] } {

View File

@ -10,7 +10,7 @@ proc ::scobj::isotech_ps::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} {
set fd [open "/tmp/isotech_ps_[basename ${tc_root}].log" "a"]
set fd [open "../log/isotech_ps_[basename ${tc_root}].log" "a"]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
puts ${fd} "${line}"
close ${fd}
@ -296,12 +296,14 @@ proc ::scobj::isotech_ps::mkDriver { sct_controller name } {
hsetprop ${scobj_hpath}/volts type "part"
hsetprop ${scobj_hpath}/volts nxalias "${name}_volts"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/amps 5
${sct_controller} poll ${scobj_hpath}/relay 5
${sct_controller} poll ${scobj_hpath}/volts 5
${sct_controller} write ${scobj_hpath}/relay
${sct_controller} write ${scobj_hpath}/volts
} else {
::scobj::isotech_ps::sics_log 9 "[environment_simulation] => No poll/write for isotech_ps"
}
hsetprop ${scobj_hpath} klass environment
hsetprop ${scobj_hpath} debug_threshold 5
@ -320,7 +322,7 @@ namespace eval ::scobj::isotech_ps {
proc add_isotech_ps {name IP port} {
set catch_status [ catch {
::scobj::isotech_ps::sics_log 9 "add_isotech_ps ${name} ${IP} ${port}"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${IP}"]} {
::scobj::isotech_ps::sics_log 9 "makesctcontroller sct_${name} aqadapter ${port}"
makesctcontroller sct_${name} aqadapter ${port}
@ -328,6 +330,8 @@ proc add_isotech_ps {name IP port} {
::scobj::isotech_ps::sics_log 9 "makesctcontroller sct_${name} std ${IP}:${port} \"\\r\""
makesctcontroller sct_${name} std ${IP}:${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}"
::scobj::isotech_ps::mkDriver sct_${name} ${name}
@ -346,7 +350,10 @@ proc ::scobj::isotech_ps::read_config {} {
if { [dict get $v "driver"] == "isotech_ps" } {
if { [dict get $v enabled] } {
set name [dict get $v name]
if { [dict exists $v "asyncqueue"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
} else {
if { [dict exists $v "asyncprotocol"] } {

View File

@ -10,7 +10,7 @@ proc ::scobj::mercury_base::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} {
set fd [open "/tmp/mercury_base_[basename ${tc_root}].log" "a"]
set fd [open "../log/mercury_base_[basename ${tc_root}].log" "a"]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
puts ${fd} "${line}"
close ${fd}
@ -344,13 +344,15 @@ proc ::scobj::mercury_base::mkDriver { sct_controller name id tol } {
hsetprop ${scobj_hpath}/Loop1/setpoint type "drivable"
hsetprop ${scobj_hpath}/Loop1/setpoint nxalias "${name}_Loop1_setpoint"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/Loop1/nick 15
${sct_controller} poll ${scobj_hpath}/Loop1/power 5
${sct_controller} poll ${scobj_hpath}/Loop1/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop1/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop1/setpoint
ansto_makesctdrive ${name}_Loop1_setpoint ${scobj_hpath}/Loop1/setpoint ${scobj_hpath}/Loop1/sensor ${sct_controller}
} else {
::scobj::mercury_base::sics_log 9 "[environment_simulation] => No poll/write for mercury_base"
}
hfactory ${scobj_hpath}/Loop2 plain spy none
@ -419,13 +421,15 @@ proc ::scobj::mercury_base::mkDriver { sct_controller name id tol } {
hsetprop ${scobj_hpath}/Loop2/setpoint type "drivable"
hsetprop ${scobj_hpath}/Loop2/setpoint nxalias "${name}_Loop2_setpoint"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/Loop2/nick 15
${sct_controller} poll ${scobj_hpath}/Loop2/power 5
${sct_controller} poll ${scobj_hpath}/Loop2/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop2/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop2/setpoint
ansto_makesctdrive ${name}_Loop2_setpoint ${scobj_hpath}/Loop2/setpoint ${scobj_hpath}/Loop2/sensor ${sct_controller}
} else {
::scobj::mercury_base::sics_log 9 "[environment_simulation] => No poll/write for mercury_base"
}
hfactory ${scobj_hpath}/Loop3 plain spy none
@ -494,13 +498,15 @@ proc ::scobj::mercury_base::mkDriver { sct_controller name id tol } {
hsetprop ${scobj_hpath}/Loop3/setpoint type "drivable"
hsetprop ${scobj_hpath}/Loop3/setpoint nxalias "${name}_Loop3_setpoint"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/Loop3/nick 15
${sct_controller} poll ${scobj_hpath}/Loop3/power 5
${sct_controller} poll ${scobj_hpath}/Loop3/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop3/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop3/setpoint
ansto_makesctdrive ${name}_Loop3_setpoint ${scobj_hpath}/Loop3/setpoint ${scobj_hpath}/Loop3/sensor ${sct_controller}
} else {
::scobj::mercury_base::sics_log 9 "[environment_simulation] => No poll/write for mercury_base"
}
hsetprop ${scobj_hpath} klass environment
hsetprop ${scobj_hpath} debug_threshold 5
@ -519,7 +525,7 @@ namespace eval ::scobj::mercury_base {
proc add_mercury_base {name IP port {id 99} {tol 1}} {
set catch_status [ catch {
::scobj::mercury_base::sics_log 9 "add_mercury_base ${name} ${IP} ${port} ${id} ${tol}"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${IP}"]} {
::scobj::mercury_base::sics_log 9 "makesctcontroller sct_${name} aqadapter ${port}"
makesctcontroller sct_${name} aqadapter ${port}
@ -527,6 +533,8 @@ proc add_mercury_base {name IP port {id 99} {tol 1}} {
::scobj::mercury_base::sics_log 9 "makesctcontroller sct_${name} std ${IP}:${port}"
makesctcontroller sct_${name} std ${IP}:${port}
}
} else {
::scobj::mercury_base::sics_log 9 "[environment_simulation] => No sctcontroller for mercury_base"
}
::scobj::mercury_base::sics_log 1 "::scobj::mercury_base::mkDriver sct_${name} ${name} ${id} ${tol}"
::scobj::mercury_base::mkDriver sct_${name} ${name} ${id} ${tol}
@ -544,10 +552,11 @@ proc ::scobj::mercury_base::read_config {} {
if { [dict exists $v "driver"] } {
if { [dict get $v "driver"] == "mercury_base" } {
if { [dict get $v enabled] } {
set IP [dict get $v ip]
set PORT [dict get $v port]
set name [dict get $v name]
if { [dict exists $v "asyncqueue"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
} else {
if { [dict exists $v "asyncprotocol"] } {
@ -561,6 +570,8 @@ proc ::scobj::mercury_base::read_config {} {
}
}
set asyncqueue ${name}_queue
set IP [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"

View File

@ -10,7 +10,7 @@ proc ::scobj::mercury_level::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} {
set fd [open "/tmp/mercury_level_[basename ${tc_root}].log" "a"]
set fd [open "../log/mercury_level_[basename ${tc_root}].log" "a"]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
puts ${fd} "${line}"
close ${fd}
@ -179,9 +179,11 @@ proc ::scobj::mercury_level::mkDriver { sct_controller name id } {
hsetprop ${scobj_hpath}/Level/Nitrogen type "part"
hsetprop ${scobj_hpath}/Level/Nitrogen nxalias "${name}_Level_Nitrogen"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/Level/Helium 15
${sct_controller} poll ${scobj_hpath}/Level/Nitrogen 15
} else {
::scobj::mercury_level::sics_log 9 "[environment_simulation] => No poll/write for mercury_level"
}
hsetprop ${scobj_hpath} klass environment
hsetprop ${scobj_hpath} debug_threshold 5
@ -200,7 +202,7 @@ namespace eval ::scobj::mercury_level {
proc add_mercury_level {name IP port {id 99}} {
set catch_status [ catch {
::scobj::mercury_level::sics_log 9 "add_mercury_level ${name} ${IP} ${port} ${id}"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${IP}"]} {
::scobj::mercury_level::sics_log 9 "makesctcontroller sct_${name} aqadapter ${port}"
makesctcontroller sct_${name} aqadapter ${port}
@ -208,6 +210,8 @@ proc add_mercury_level {name IP port {id 99}} {
::scobj::mercury_level::sics_log 9 "makesctcontroller sct_${name} std ${IP}:${port}"
makesctcontroller sct_${name} std ${IP}:${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} ${id}"
::scobj::mercury_level::mkDriver sct_${name} ${name} ${id}
@ -225,10 +229,11 @@ proc ::scobj::mercury_level::read_config {} {
if { [dict exists $v "driver"] } {
if { [dict get $v "driver"] == "mercury_level" } {
if { [dict get $v enabled] } {
set IP [dict get $v ip]
set PORT [dict get $v port]
set name [dict get $v name]
if { [dict exists $v "asyncqueue"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
} else {
if { [dict exists $v "asyncprotocol"] } {
@ -242,6 +247,8 @@ proc ::scobj::mercury_level::read_config {} {
}
}
set asyncqueue ${name}_queue
set IP [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"

View File

@ -10,7 +10,7 @@ proc ::scobj::mercury_pres::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} {
set fd [open "/tmp/mercury_pres_[basename ${tc_root}].log" "a"]
set fd [open "../log/mercury_pres_[basename ${tc_root}].log" "a"]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
puts ${fd} "${line}"
close ${fd}

View File

@ -10,7 +10,7 @@ proc ::scobj::mercury_scpi::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} {
set fd [open "/tmp/mercury_scpi_[basename ${tc_root}].log" "a"]
set fd [open "../log/mercury_scpi_[basename ${tc_root}].log" "a"]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
puts ${fd} "${line}"
close ${fd}
@ -342,9 +342,11 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name id permlink tol valve
hsetprop ${scobj_hpath}/Level/Nitrogen type "part"
hsetprop ${scobj_hpath}/Level/Nitrogen nxalias "${name}_Level_Nitrogen"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/Level/Helium 15
${sct_controller} poll ${scobj_hpath}/Level/Nitrogen 15
} else {
::scobj::mercury_scpi::sics_log 9 "[environment_simulation] => No poll/write for mercury_scpi"
}
hfactory ${scobj_hpath}/Loop1 plain spy none
@ -413,13 +415,15 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name id permlink tol valve
hsetprop ${scobj_hpath}/Loop1/setpoint type "drivable"
hsetprop ${scobj_hpath}/Loop1/setpoint nxalias "${name}_Loop1_setpoint"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/Loop1/nick 15
${sct_controller} poll ${scobj_hpath}/Loop1/power 5
${sct_controller} poll ${scobj_hpath}/Loop1/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop1/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop1/setpoint
ansto_makesctdrive ${name}_Loop1_setpoint ${scobj_hpath}/Loop1/setpoint ${scobj_hpath}/Loop1/sensor ${sct_controller}
} else {
::scobj::mercury_scpi::sics_log 9 "[environment_simulation] => No poll/write for mercury_scpi"
}
hfactory ${scobj_hpath}/Loop2 plain spy none
@ -488,13 +492,15 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name id permlink tol valve
hsetprop ${scobj_hpath}/Loop2/setpoint type "drivable"
hsetprop ${scobj_hpath}/Loop2/setpoint nxalias "${name}_Loop2_setpoint"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/Loop2/nick 15
${sct_controller} poll ${scobj_hpath}/Loop2/power 5
${sct_controller} poll ${scobj_hpath}/Loop2/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop2/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop2/setpoint
ansto_makesctdrive ${name}_Loop2_setpoint ${scobj_hpath}/Loop2/setpoint ${scobj_hpath}/Loop2/sensor ${sct_controller}
} else {
::scobj::mercury_scpi::sics_log 9 "[environment_simulation] => No poll/write for mercury_scpi"
}
hfactory ${scobj_hpath}/Loop3 plain spy none
@ -563,13 +569,15 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name id permlink tol valve
hsetprop ${scobj_hpath}/Loop3/setpoint type "drivable"
hsetprop ${scobj_hpath}/Loop3/setpoint nxalias "${name}_Loop3_setpoint"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/Loop3/nick 15
${sct_controller} poll ${scobj_hpath}/Loop3/power 5
${sct_controller} poll ${scobj_hpath}/Loop3/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop3/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop3/setpoint
ansto_makesctdrive ${name}_Loop3_setpoint ${scobj_hpath}/Loop3/setpoint ${scobj_hpath}/Loop3/sensor ${sct_controller}
} else {
::scobj::mercury_scpi::sics_log 9 "[environment_simulation] => No poll/write for mercury_scpi"
}
hfactory ${scobj_hpath}/Loop4 plain spy none
@ -638,13 +646,15 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name id permlink tol valve
hsetprop ${scobj_hpath}/Loop4/setpoint type "drivable"
hsetprop ${scobj_hpath}/Loop4/setpoint nxalias "${name}_Loop4_setpoint"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/Loop4/nick 15
${sct_controller} poll ${scobj_hpath}/Loop4/power 5
${sct_controller} poll ${scobj_hpath}/Loop4/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop4/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop4/setpoint
ansto_makesctdrive ${name}_Loop4_setpoint ${scobj_hpath}/Loop4/setpoint ${scobj_hpath}/Loop4/sensor ${sct_controller}
} else {
::scobj::mercury_scpi::sics_log 9 "[environment_simulation] => No poll/write for mercury_scpi"
}
hfactory ${scobj_hpath}/Valve plain spy none
@ -687,10 +697,12 @@ proc ::scobj::mercury_scpi::mkDriver { sct_controller name id permlink tol valve
hsetprop ${scobj_hpath}/Valve/setpoint type "drivable"
hsetprop ${scobj_hpath}/Valve/setpoint nxalias "${name}_Valve_setpoint"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/Valve/sensor 5
${sct_controller} write ${scobj_hpath}/Valve/setpoint
ansto_makesctdrive ${name}_Valve_setpoint ${scobj_hpath}/Valve/setpoint ${scobj_hpath}/Valve/sensor ${sct_controller}
} else {
::scobj::mercury_scpi::sics_log 9 "[environment_simulation] => No poll/write for mercury_scpi"
}
hsetprop ${scobj_hpath} klass environment
hsetprop ${scobj_hpath} debug_threshold 5
@ -709,7 +721,7 @@ namespace eval ::scobj::mercury_scpi {
proc add_mercury_scpi {name IP port {id 99} {permlink LT} {tol 1} {valve_tol 2}} {
set catch_status [ catch {
::scobj::mercury_scpi::sics_log 9 "add_mercury_scpi ${name} ${IP} ${port} ${id} ${permlink} ${tol} ${valve_tol}"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${IP}"]} {
::scobj::mercury_scpi::sics_log 9 "makesctcontroller sct_${name} aqadapter ${port}"
makesctcontroller sct_${name} aqadapter ${port}
@ -717,6 +729,8 @@ proc add_mercury_scpi {name IP port {id 99} {permlink LT} {tol 1} {valve_tol 2}}
::scobj::mercury_scpi::sics_log 9 "makesctcontroller sct_${name} std ${IP}:${port}"
makesctcontroller sct_${name} std ${IP}:${port}
}
} else {
::scobj::mercury_scpi::sics_log 9 "[environment_simulation] => No sctcontroller for mercury_scpi"
}
::scobj::mercury_scpi::sics_log 1 "::scobj::mercury_scpi::mkDriver sct_${name} ${name} ${id} ${permlink} ${tol} ${valve_tol}"
::scobj::mercury_scpi::mkDriver sct_${name} ${name} ${id} ${permlink} ${tol} ${valve_tol}
@ -735,7 +749,10 @@ proc ::scobj::mercury_scpi::read_config {} {
if { [dict get $v "driver"] == "mercury_scpi" } {
if { [dict get $v enabled] } {
set name [dict get $v name]
if { [dict exists $v "asyncqueue"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
} else {
if { [dict exists $v "asyncprotocol"] } {

View File

@ -10,7 +10,7 @@ proc ::scobj::mercury_temp::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} {
set fd [open "/tmp/mercury_temp_[basename ${tc_root}].log" "a"]
set fd [open "../log/mercury_temp_[basename ${tc_root}].log" "a"]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
puts ${fd} "${line}"
close ${fd}
@ -344,13 +344,15 @@ proc ::scobj::mercury_temp::mkDriver { sct_controller name id tol } {
hsetprop ${scobj_hpath}/Loop4/setpoint type "drivable"
hsetprop ${scobj_hpath}/Loop4/setpoint nxalias "${name}_Loop4_setpoint"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/Loop4/nick 15
${sct_controller} poll ${scobj_hpath}/Loop4/power 5
${sct_controller} poll ${scobj_hpath}/Loop4/sensor 1
${sct_controller} poll ${scobj_hpath}/Loop4/setpoint 5
${sct_controller} write ${scobj_hpath}/Loop4/setpoint
ansto_makesctdrive ${name}_Loop4_setpoint ${scobj_hpath}/Loop4/setpoint ${scobj_hpath}/Loop4/sensor ${sct_controller}
} else {
::scobj::mercury_temp::sics_log 9 "[environment_simulation] => No poll/write for mercury_temp"
}
hsetprop ${scobj_hpath} klass environment
hsetprop ${scobj_hpath} debug_threshold 5
@ -369,7 +371,7 @@ namespace eval ::scobj::mercury_temp {
proc add_mercury_temp {name IP port {id 99} {tol 1}} {
set catch_status [ catch {
::scobj::mercury_temp::sics_log 9 "add_mercury_temp ${name} ${IP} ${port} ${id} ${tol}"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${IP}"]} {
::scobj::mercury_temp::sics_log 9 "makesctcontroller sct_${name} aqadapter ${port}"
makesctcontroller sct_${name} aqadapter ${port}
@ -377,6 +379,8 @@ proc add_mercury_temp {name IP port {id 99} {tol 1}} {
::scobj::mercury_temp::sics_log 9 "makesctcontroller sct_${name} std ${IP}:${port}"
makesctcontroller sct_${name} std ${IP}:${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} ${id} ${tol}"
::scobj::mercury_temp::mkDriver sct_${name} ${name} ${id} ${tol}
@ -394,10 +398,11 @@ proc ::scobj::mercury_temp::read_config {} {
if { [dict exists $v "driver"] } {
if { [dict get $v "driver"] == "mercury_temp" } {
if { [dict get $v enabled] } {
set IP [dict get $v ip]
set PORT [dict get $v port]
set name [dict get $v name]
if { [dict exists $v "asyncqueue"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
} else {
if { [dict exists $v "asyncprotocol"] } {
@ -411,6 +416,8 @@ proc ::scobj::mercury_temp::read_config {} {
}
}
set asyncqueue ${name}_queue
set IP [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"

View File

@ -10,7 +10,7 @@ proc ::scobj::mercury_valve::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} {
set fd [open "/tmp/mercury_valve_[basename ${tc_root}].log" "a"]
set fd [open "../log/mercury_valve_[basename ${tc_root}].log" "a"]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
puts ${fd} "${line}"
close ${fd}
@ -296,10 +296,12 @@ proc ::scobj::mercury_valve::mkDriver { sct_controller name id valve_tol } {
hsetprop ${scobj_hpath}/Valve/setpoint type "drivable"
hsetprop ${scobj_hpath}/Valve/setpoint nxalias "${name}_Valve_setpoint"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/Valve/sensor 5
${sct_controller} write ${scobj_hpath}/Valve/setpoint
ansto_makesctdrive ${name}_Valve_setpoint ${scobj_hpath}/Valve/setpoint ${scobj_hpath}/Valve/sensor ${sct_controller}
} else {
::scobj::mercury_valve::sics_log 9 "[environment_simulation] => No poll/write for mercury_valve"
}
hsetprop ${scobj_hpath} klass environment
hsetprop ${scobj_hpath} debug_threshold 5
@ -318,7 +320,7 @@ namespace eval ::scobj::mercury_valve {
proc add_mercury_valve {name IP port {id 99} {valve_tol 2}} {
set catch_status [ catch {
::scobj::mercury_valve::sics_log 9 "add_mercury_valve ${name} ${IP} ${port} ${id} ${valve_tol}"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${IP}"]} {
::scobj::mercury_valve::sics_log 9 "makesctcontroller sct_${name} aqadapter ${port}"
makesctcontroller sct_${name} aqadapter ${port}
@ -326,6 +328,8 @@ proc add_mercury_valve {name IP port {id 99} {valve_tol 2}} {
::scobj::mercury_valve::sics_log 9 "makesctcontroller sct_${name} std ${IP}:${port}"
makesctcontroller sct_${name} std ${IP}:${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} ${id} ${valve_tol}"
::scobj::mercury_valve::mkDriver sct_${name} ${name} ${id} ${valve_tol}
@ -343,10 +347,11 @@ proc ::scobj::mercury_valve::read_config {} {
if { [dict exists $v "driver"] } {
if { [dict get $v "driver"] == "mercury_valve" } {
if { [dict get $v enabled] } {
set IP [dict get $v ip]
set PORT [dict get $v port]
set name [dict get $v name]
if { [dict exists $v "asyncqueue"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
} else {
if { [dict exists $v "asyncprotocol"] } {
@ -360,6 +365,8 @@ proc ::scobj::mercury_valve::read_config {} {
}
}
set asyncqueue ${name}_queue
set IP [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"

View File

@ -13,7 +13,7 @@ proc ::scobj::pfeiffer_hg::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} {
set fd [open "/tmp/pfeiffer_hg_[basename ${tc_root}].log" "a"]
set fd [open "../log/pfeiffer_hg_[basename ${tc_root}].log" "a"]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
puts ${fd} "${line}"
close ${fd}
@ -443,10 +443,12 @@ proc ::scobj::pfeiffer_hg::mkDriver { sct_controller name } {
hsetprop ${scobj_hpath}/pressure/setpoint type "drivable"
hsetprop ${scobj_hpath}/pressure/setpoint nxalias "${name}_pressure_setpoint"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/pressure/sensor 1
${sct_controller} write ${scobj_hpath}/pressure/setpoint
ansto_makesctdrive ${name}_pressure_setpoint ${scobj_hpath}/pressure/setpoint ${scobj_hpath}/pressure/sensor ${sct_controller}
} else {
::scobj::pfeiffer_hg::sics_log 9 "[environment_simulation] => No poll/write for pfeiffer_hg"
}
hsetprop ${scobj_hpath} klass environment
hsetprop ${scobj_hpath} debug_threshold 5
@ -468,7 +470,7 @@ namespace eval ::scobj::pfeiffer_hg {
proc add_pfeiffer_hg {name IP port} {
set catch_status [ catch {
::scobj::pfeiffer_hg::sics_log 9 "add_pfeiffer_hg ${name} ${IP} ${port}"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${IP}"]} {
::scobj::pfeiffer_hg::sics_log 9 "makesctcontroller sct_${name} aqadapter ${port}"
makesctcontroller sct_${name} aqadapter ${port}
@ -476,6 +478,8 @@ proc add_pfeiffer_hg {name IP port} {
::scobj::pfeiffer_hg::sics_log 9 "makesctcontroller sct_${name} std ${IP}:${port}"
makesctcontroller sct_${name} std ${IP}:${port}
}
} else {
::scobj::pfeiffer_hg::sics_log 9 "[environment_simulation] => No sctcontroller for pfeiffer_hg"
}
::scobj::pfeiffer_hg::sics_log 1 "::scobj::pfeiffer_hg::mkDriver sct_${name} ${name}"
::scobj::pfeiffer_hg::mkDriver sct_${name} ${name}
@ -494,7 +498,10 @@ proc ::scobj::pfeiffer_hg::read_config {} {
if { [dict get $v "driver"] == "pfeiffer_hg" } {
if { [dict get $v enabled] } {
set name [dict get $v name]
if { [dict exists $v "asyncqueue"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
} else {
if { [dict exists $v "asyncprotocol"] } {

View File

@ -10,7 +10,7 @@ proc ::scobj::reactor_status::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} {
set fd [open "/tmp/reactor_status_[basename ${tc_root}].log" "a"]
set fd [open "../log/reactor_status_[basename ${tc_root}].log" "a"]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
puts ${fd} "${line}"
close ${fd}
@ -298,8 +298,10 @@ proc ::scobj::reactor_status::mkDriver { sct_controller name } {
hsetprop ${scobj_hpath} control "true"
hsetprop ${scobj_hpath} data "true"
if {[SplitReply [opal_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [opal_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/status 30
} else {
::scobj::reactor_status::sics_log 9 "[opal_simulation] => No poll/write for reactor_status"
}
hsetprop ${scobj_hpath} klass NXsource
hsetprop ${scobj_hpath} debug_threshold 5
@ -319,7 +321,7 @@ namespace eval ::scobj::reactor_status {
proc add_reactor_status {name IP port} {
set catch_status [ catch {
::scobj::reactor_status::sics_log 9 "add_reactor_status ${name} ${IP} ${port}"
if {[SplitReply [opal_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [opal_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${IP}"]} {
::scobj::reactor_status::sics_log 9 "makesctcontroller sct_${name} aqadapter ${port}"
makesctcontroller sct_${name} aqadapter ${port}
@ -327,6 +329,8 @@ proc add_reactor_status {name IP port} {
::scobj::reactor_status::sics_log 9 "makesctcontroller sct_${name} std ${IP}:${port}"
makesctcontroller sct_${name} std ${IP}:${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}"
::scobj::reactor_status::mkDriver sct_${name} ${name}
@ -345,7 +349,10 @@ proc ::scobj::reactor_status::read_config {} {
if { [dict get $v "driver"] == "reactor_status" } {
if { [dict get $v enabled] } {
set name [dict get $v name]
if { [dict exists $v "asyncqueue"] } {
if { ![string equal -nocase [SplitReply [opal_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[opal_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
} else {
if { [dict exists $v "asyncprotocol"] } {