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::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"]"