Regenerate all the SCT drivers with new generator
This commit is contained in:
@@ -86,7 +86,12 @@ proc ::scobj::mercury_temp::checkstatus {tc_root} {
|
||||
# checkstatus hook code goes here
|
||||
if {[sct driving]} {
|
||||
set sp "[sct target]"
|
||||
set pv "[hval ${tc_root}/[sct driveable]]"
|
||||
if {[hpropexists [sct] simulated] && [sct simulated] == "true"} {
|
||||
set pv "${sp}"
|
||||
hupdateif ${tc_root}/[sct driveable] ${sp}
|
||||
}
|
||||
set pv "[hval ${tc_root}/[sct driveable]]"
|
||||
}
|
||||
if { abs(${pv} - ${sp}) <= [sct tolerance] } {
|
||||
if { [hpropexists [sct] settle_time] } {
|
||||
if { [hpropexists [sct] settle_time_start] } {
|
||||
@@ -279,9 +284,6 @@ proc ::scobj::mercury_temp::mkDriver { sct_controller name device_class simulati
|
||||
set scobj_hpath /sics/${name}
|
||||
|
||||
hfactory ${scobj_hpath}/Loop4 plain spy none
|
||||
hsetprop ${scobj_hpath}/Loop4 data "true"
|
||||
hsetprop ${scobj_hpath}/Loop4 klass "@none"
|
||||
hsetprop ${scobj_hpath}/Loop4 type "part"
|
||||
|
||||
hfactory ${scobj_hpath}/Loop4/nick plain user text
|
||||
hsetprop ${scobj_hpath}/Loop4/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB8.T1:TEMP:NICK}
|
||||
@@ -296,6 +298,14 @@ proc ::scobj::mercury_temp::mkDriver { sct_controller name device_class simulati
|
||||
hsetprop ${scobj_hpath}/Loop4/nick type "part"
|
||||
hsetprop ${scobj_hpath}/Loop4/nick nxalias "${name}_Loop4_nick"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/Loop4/nick 15
|
||||
hsetprop ${scobj_hpath}/Loop4/nick simulated false
|
||||
} else {
|
||||
::scobj::mercury_temp::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_temp"
|
||||
hsetprop ${scobj_hpath}/Loop4/nick simulated true
|
||||
}
|
||||
|
||||
hfactory ${scobj_hpath}/Loop4/power plain user float
|
||||
hsetprop ${scobj_hpath}/Loop4/power read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB3.H1:HTR:SIG:POWR}
|
||||
hsetprop ${scobj_hpath}/Loop4/power rdValue ${ns}::rdValue ${scobj_hpath}
|
||||
@@ -309,6 +319,14 @@ proc ::scobj::mercury_temp::mkDriver { sct_controller name device_class simulati
|
||||
hsetprop ${scobj_hpath}/Loop4/power type "part"
|
||||
hsetprop ${scobj_hpath}/Loop4/power nxalias "${name}_Loop4_power"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/Loop4/power 5
|
||||
hsetprop ${scobj_hpath}/Loop4/power simulated false
|
||||
} else {
|
||||
::scobj::mercury_temp::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_temp"
|
||||
hsetprop ${scobj_hpath}/Loop4/power simulated true
|
||||
}
|
||||
|
||||
hfactory ${scobj_hpath}/Loop4/sensor plain user float
|
||||
hsetprop ${scobj_hpath}/Loop4/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.T1:TEMP:SIG:TEMP}
|
||||
hsetprop ${scobj_hpath}/Loop4/sensor rdValue ${ns}::rdValue ${scobj_hpath}
|
||||
@@ -324,6 +342,14 @@ proc ::scobj::mercury_temp::mkDriver { sct_controller name device_class simulati
|
||||
hsetprop ${scobj_hpath}/Loop4/sensor type "part"
|
||||
hsetprop ${scobj_hpath}/Loop4/sensor nxalias "${name}_Loop4_sensor"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/Loop4/sensor 1
|
||||
hsetprop ${scobj_hpath}/Loop4/sensor simulated false
|
||||
} else {
|
||||
::scobj::mercury_temp::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_temp"
|
||||
hsetprop ${scobj_hpath}/Loop4/sensor simulated true
|
||||
}
|
||||
|
||||
hfactory ${scobj_hpath}/Loop4/setpoint plain user float
|
||||
hsetprop ${scobj_hpath}/Loop4/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.T1:TEMP:LOOP:TSET}
|
||||
hsetprop ${scobj_hpath}/Loop4/setpoint rdValue ${ns}::rdValue ${scobj_hpath}
|
||||
@@ -352,20 +378,20 @@ proc ::scobj::mercury_temp::mkDriver { sct_controller name device_class simulati
|
||||
hsetprop ${scobj_hpath}/Loop4/setpoint nxalias "${name}_Loop4_setpoint"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/Loop4/nick 15
|
||||
${sct_controller} poll ${scobj_hpath}/Loop4/power 5
|
||||
${sct_controller} poll ${scobj_hpath}/Loop4/sensor 1
|
||||
${sct_controller} poll ${scobj_hpath}/Loop4/setpoint 5
|
||||
${sct_controller} write ${scobj_hpath}/Loop4/setpoint
|
||||
hsetprop ${scobj_hpath}/Loop4/setpoint simulated false
|
||||
} else {
|
||||
::scobj::mercury_temp::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_temp"
|
||||
hsetprop ${scobj_hpath}/Loop4/setpoint simulated true
|
||||
}
|
||||
hsetprop ${scobj_hpath}/Loop4 data "true"
|
||||
hsetprop ${scobj_hpath}/Loop4 klass "@none"
|
||||
hsetprop ${scobj_hpath}/Loop4 type "part"
|
||||
ansto_makesctdrive ${name}_Loop4_setpoint ${scobj_hpath}/Loop4/setpoint ${scobj_hpath}/Loop4/sensor ${sct_controller}
|
||||
hsetprop ${scobj_hpath} klass ${device_class}
|
||||
hsetprop ${scobj_hpath} data true
|
||||
hsetprop ${scobj_hpath} debug_threshold 5
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
ansto_makesctdrive ${name}_Loop4_setpoint ${scobj_hpath}/Loop4/setpoint ${scobj_hpath}/Loop4/sensor ${sct_controller}
|
||||
}
|
||||
# mkDriver hook code goes here
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
@@ -383,7 +409,9 @@ proc ::scobj::mercury_temp::add_driver {name device_class simulation_flag ip_add
|
||||
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
|
||||
}
|
||||
} else {
|
||||
::scobj::mercury_temp::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for mercury_temp"
|
||||
::scobj::mercury_temp::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for mercury_temp"
|
||||
::scobj::mercury_temp::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
|
||||
makesctcontroller sct_${name} aqadapter NULL
|
||||
}
|
||||
::scobj::mercury_temp::sics_log 1 "::scobj::mercury_temp::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol}"
|
||||
::scobj::mercury_temp::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol}
|
||||
@@ -401,7 +429,7 @@ namespace eval ::scobj::mercury_temp {
|
||||
|
||||
proc add_mercury_temp {name ip_address tcp_port {id 99} {tol 1}} {
|
||||
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
|
||||
::scobj::mercury_temp::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${{id}" "${99}}" "${{tol}" "${1}}"
|
||||
::scobj::mercury_temp::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol}
|
||||
}
|
||||
|
||||
clientput "file evaluation of sct_mercury_temp.tcl"
|
||||
@@ -440,20 +468,31 @@ proc ::scobj::mercury_temp::read_config {} {
|
||||
if { ![string equal -nocase "${simulation_flag}" "false"] } {
|
||||
set asyncqueue "null"
|
||||
${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
|
||||
${ns}::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
|
||||
makesctcontroller sct_${name} aqadapter NULL
|
||||
} elseif { [dict exists $v "asyncqueue"] } {
|
||||
set asyncqueue [dict get $v "asyncqueue"]
|
||||
if { [string equal -nocase ${asyncqueue} "sct"] } {
|
||||
set ip_address [dict get $v ip]
|
||||
set tcp_port [dict get $v port]
|
||||
}
|
||||
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
|
||||
} else {
|
||||
makesctcontroller sct_${name} aqadapter ${asyncqueue}
|
||||
}
|
||||
} else {
|
||||
if { [dict exists $v "asyncprotocol"] } {
|
||||
set asyncprotocol [dict get $v "asyncprotocol"]
|
||||
} else {
|
||||
set asyncprotocol ${name}_protocol
|
||||
MakeAsyncProtocol ${asyncprotocol}
|
||||
if { [dict exists $v "terminator"] } {
|
||||
if { [dict exists $v "sendterminator"] } {
|
||||
${asyncprotocol} sendterminator "[dict get $v "sendterminator"]"
|
||||
} elseif { [dict exists $v "terminator"] } {
|
||||
${asyncprotocol} sendterminator "[dict get $v "terminator"]"
|
||||
}
|
||||
if { [dict exists $v "replyterminator"] } {
|
||||
${asyncprotocol} replyterminator "[dict get $v "replyterminator"]"
|
||||
} elseif { [dict exists $v "terminator"] } {
|
||||
${asyncprotocol} replyterminator "[dict get $v "terminator"]"
|
||||
}
|
||||
}
|
||||
@@ -464,6 +503,7 @@ proc ::scobj::mercury_temp::read_config {} {
|
||||
if { [dict exists $v "timeout"] } {
|
||||
${asyncqueue} timeout "[dict get $v "timeout"]"
|
||||
}
|
||||
makesctcontroller sct_${name} aqadapter ${asyncqueue}
|
||||
}
|
||||
set arg_list [list]
|
||||
set missing_list [list]
|
||||
@@ -480,11 +520,7 @@ proc ::scobj::mercury_temp::read_config {} {
|
||||
if { [llength $missing_list] > 0 } {
|
||||
error "$name is missing configuration values $missing_list"
|
||||
}
|
||||
if { [string equal -nocase ${asyncqueue} "sct"] } {
|
||||
${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
|
||||
} else {
|
||||
${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
|
||||
}
|
||||
${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user