Regenerate all the SCT drivers with new generator
This commit is contained in:
@@ -86,7 +86,12 @@ proc ::scobj::mercury_pres::checkstatus {tc_root} {
|
||||
# checkstatus hook code goes here
|
||||
if {[sct driving]} {
|
||||
set sp "[sct target]"
|
||||
set pv "[hval ${tc_root}/[sct driveable]]"
|
||||
if {[hpropexists [sct] simulated] && [sct simulated] == "true"} {
|
||||
set pv "${sp}"
|
||||
hupdateif ${tc_root}/[sct driveable] ${sp}
|
||||
}
|
||||
set pv "[hval ${tc_root}/[sct driveable]]"
|
||||
}
|
||||
if { abs(${pv} - ${sp}) <= [sct tolerance] } {
|
||||
if { [hpropexists [sct] settle_time] } {
|
||||
if { [hpropexists [sct] settle_time_start] } {
|
||||
@@ -285,9 +290,6 @@ proc ::scobj::mercury_pres::mkDriver { sct_controller name device_class simulati
|
||||
set scobj_hpath /sics/${name}
|
||||
|
||||
hfactory ${scobj_hpath}/Loop8 plain spy none
|
||||
hsetprop ${scobj_hpath}/Loop8 data "true"
|
||||
hsetprop ${scobj_hpath}/Loop8 klass "@none"
|
||||
hsetprop ${scobj_hpath}/Loop8 type "part"
|
||||
|
||||
hfactory ${scobj_hpath}/Loop8/nick plain user text
|
||||
hsetprop ${scobj_hpath}/Loop8/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB8.P1:PRES:NICK}
|
||||
@@ -302,6 +304,14 @@ proc ::scobj::mercury_pres::mkDriver { sct_controller name device_class simulati
|
||||
hsetprop ${scobj_hpath}/Loop8/nick type "part"
|
||||
hsetprop ${scobj_hpath}/Loop8/nick nxalias "${name}_Loop8_nick"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/Loop8/nick 15
|
||||
hsetprop ${scobj_hpath}/Loop8/nick simulated false
|
||||
} else {
|
||||
::scobj::mercury_pres::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_pres"
|
||||
hsetprop ${scobj_hpath}/Loop8/nick simulated true
|
||||
}
|
||||
|
||||
hfactory ${scobj_hpath}/Loop8/sensor plain user float
|
||||
hsetprop ${scobj_hpath}/Loop8/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.P1:PRES:SIG:PRES}
|
||||
hsetprop ${scobj_hpath}/Loop8/sensor rdValue ${ns}::rdValue ${scobj_hpath}
|
||||
@@ -318,6 +328,14 @@ proc ::scobj::mercury_pres::mkDriver { sct_controller name device_class simulati
|
||||
hsetprop ${scobj_hpath}/Loop8/sensor type "part"
|
||||
hsetprop ${scobj_hpath}/Loop8/sensor nxalias "${name}_Loop8_sensor"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/Loop8/sensor 1
|
||||
hsetprop ${scobj_hpath}/Loop8/sensor simulated false
|
||||
} else {
|
||||
::scobj::mercury_pres::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_pres"
|
||||
hsetprop ${scobj_hpath}/Loop8/sensor simulated true
|
||||
}
|
||||
|
||||
hfactory ${scobj_hpath}/Loop8/setpoint plain user float
|
||||
hsetprop ${scobj_hpath}/Loop8/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.P1:PRES:LOOP:TSET}
|
||||
hsetprop ${scobj_hpath}/Loop8/setpoint rdValue ${ns}::rdValue ${scobj_hpath}
|
||||
@@ -347,19 +365,20 @@ proc ::scobj::mercury_pres::mkDriver { sct_controller name device_class simulati
|
||||
hsetprop ${scobj_hpath}/Loop8/setpoint nxalias "${name}_Loop8_setpoint"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/Loop8/nick 15
|
||||
${sct_controller} poll ${scobj_hpath}/Loop8/sensor 1
|
||||
${sct_controller} poll ${scobj_hpath}/Loop8/setpoint 5
|
||||
${sct_controller} write ${scobj_hpath}/Loop8/setpoint
|
||||
hsetprop ${scobj_hpath}/Loop8/setpoint simulated false
|
||||
} else {
|
||||
::scobj::mercury_pres::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_pres"
|
||||
hsetprop ${scobj_hpath}/Loop8/setpoint simulated true
|
||||
}
|
||||
hsetprop ${scobj_hpath}/Loop8 data "true"
|
||||
hsetprop ${scobj_hpath}/Loop8 klass "@none"
|
||||
hsetprop ${scobj_hpath}/Loop8 type "part"
|
||||
ansto_makesctdrive ${name}_Loop8_setpoint ${scobj_hpath}/Loop8/setpoint ${scobj_hpath}/Loop8/sensor ${sct_controller}
|
||||
hsetprop ${scobj_hpath} klass ${device_class}
|
||||
hsetprop ${scobj_hpath} data true
|
||||
hsetprop ${scobj_hpath} debug_threshold 5
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
ansto_makesctdrive ${name}_Loop8_setpoint ${scobj_hpath}/Loop8/setpoint ${scobj_hpath}/Loop8/sensor ${sct_controller}
|
||||
}
|
||||
# mkDriver hook code goes here
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
@@ -377,7 +396,9 @@ proc ::scobj::mercury_pres::add_driver {name device_class simulation_flag ip_add
|
||||
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
|
||||
}
|
||||
} else {
|
||||
::scobj::mercury_pres::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for mercury_pres"
|
||||
::scobj::mercury_pres::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for mercury_pres"
|
||||
::scobj::mercury_pres::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
|
||||
makesctcontroller sct_${name} aqadapter NULL
|
||||
}
|
||||
::scobj::mercury_pres::sics_log 1 "::scobj::mercury_pres::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol}"
|
||||
::scobj::mercury_pres::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol}
|
||||
@@ -395,7 +416,7 @@ namespace eval ::scobj::mercury_pres {
|
||||
|
||||
proc add_mercury_pres {name ip_address tcp_port {id 99} {tol 1}} {
|
||||
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
|
||||
::scobj::mercury_pres::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${{id}" "${99}}" "${{tol}" "${1}}"
|
||||
::scobj::mercury_pres::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${tol}
|
||||
}
|
||||
|
||||
clientput "file evaluation of sct_mercury_pres.tcl"
|
||||
@@ -434,20 +455,31 @@ proc ::scobj::mercury_pres::read_config {} {
|
||||
if { ![string equal -nocase "${simulation_flag}" "false"] } {
|
||||
set asyncqueue "null"
|
||||
${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
|
||||
${ns}::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
|
||||
makesctcontroller sct_${name} aqadapter NULL
|
||||
} elseif { [dict exists $v "asyncqueue"] } {
|
||||
set asyncqueue [dict get $v "asyncqueue"]
|
||||
if { [string equal -nocase ${asyncqueue} "sct"] } {
|
||||
set ip_address [dict get $v ip]
|
||||
set tcp_port [dict get $v port]
|
||||
}
|
||||
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
|
||||
} else {
|
||||
makesctcontroller sct_${name} aqadapter ${asyncqueue}
|
||||
}
|
||||
} else {
|
||||
if { [dict exists $v "asyncprotocol"] } {
|
||||
set asyncprotocol [dict get $v "asyncprotocol"]
|
||||
} else {
|
||||
set asyncprotocol ${name}_protocol
|
||||
MakeAsyncProtocol ${asyncprotocol}
|
||||
if { [dict exists $v "terminator"] } {
|
||||
if { [dict exists $v "sendterminator"] } {
|
||||
${asyncprotocol} sendterminator "[dict get $v "sendterminator"]"
|
||||
} elseif { [dict exists $v "terminator"] } {
|
||||
${asyncprotocol} sendterminator "[dict get $v "terminator"]"
|
||||
}
|
||||
if { [dict exists $v "replyterminator"] } {
|
||||
${asyncprotocol} replyterminator "[dict get $v "replyterminator"]"
|
||||
} elseif { [dict exists $v "terminator"] } {
|
||||
${asyncprotocol} replyterminator "[dict get $v "terminator"]"
|
||||
}
|
||||
}
|
||||
@@ -458,6 +490,7 @@ proc ::scobj::mercury_pres::read_config {} {
|
||||
if { [dict exists $v "timeout"] } {
|
||||
${asyncqueue} timeout "[dict get $v "timeout"]"
|
||||
}
|
||||
makesctcontroller sct_${name} aqadapter ${asyncqueue}
|
||||
}
|
||||
set arg_list [list]
|
||||
set missing_list [list]
|
||||
@@ -474,11 +507,7 @@ proc ::scobj::mercury_pres::read_config {} {
|
||||
if { [llength $missing_list] > 0 } {
|
||||
error "$name is missing configuration values $missing_list"
|
||||
}
|
||||
if { [string equal -nocase ${asyncqueue} "sct"] } {
|
||||
${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
|
||||
} else {
|
||||
${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue} {*}$arg_list
|
||||
}
|
||||
${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user