Regenerate all the SCT drivers with new generator
This commit is contained in:
@@ -86,7 +86,12 @@ proc ::scobj::west_6100::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] } {
|
||||
@@ -363,6 +368,15 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
|
||||
hsetprop ${scobj_hpath}/alarm1 type "part"
|
||||
hsetprop ${scobj_hpath}/alarm1 nxalias "${name}_alarm1"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/alarm1 1
|
||||
${sct_controller} write ${scobj_hpath}/alarm1
|
||||
hsetprop ${scobj_hpath}/alarm1 simulated false
|
||||
} else {
|
||||
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
|
||||
hsetprop ${scobj_hpath}/alarm1 simulated true
|
||||
}
|
||||
|
||||
hfactory ${scobj_hpath}/alarm2 plain user float
|
||||
hsetprop ${scobj_hpath}/alarm2 read ${ns}::getDecimal ${scobj_hpath} rdDecimal {14}
|
||||
hsetprop ${scobj_hpath}/alarm2 rdDecimal ${ns}::rdDecimal ${scobj_hpath}
|
||||
@@ -379,6 +393,15 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
|
||||
hsetprop ${scobj_hpath}/alarm2 type "part"
|
||||
hsetprop ${scobj_hpath}/alarm2 nxalias "${name}_alarm2"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/alarm2 1
|
||||
${sct_controller} write ${scobj_hpath}/alarm2
|
||||
hsetprop ${scobj_hpath}/alarm2 simulated false
|
||||
} else {
|
||||
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
|
||||
hsetprop ${scobj_hpath}/alarm2 simulated true
|
||||
}
|
||||
|
||||
hfactory ${scobj_hpath}/power plain user int
|
||||
hsetprop ${scobj_hpath}/power read ${ns}::getInteger ${scobj_hpath} rdInteger {3}
|
||||
hsetprop ${scobj_hpath}/power rdInteger ${ns}::rdInteger ${scobj_hpath}
|
||||
@@ -392,6 +415,14 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
|
||||
hsetprop ${scobj_hpath}/power type "part"
|
||||
hsetprop ${scobj_hpath}/power nxalias "${name}_power"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/power 1
|
||||
hsetprop ${scobj_hpath}/power simulated false
|
||||
} else {
|
||||
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
|
||||
hsetprop ${scobj_hpath}/power simulated true
|
||||
}
|
||||
|
||||
hfactory ${scobj_hpath}/powermax plain user int
|
||||
hsetprop ${scobj_hpath}/powermax read ${ns}::getInteger ${scobj_hpath} rdInteger {20}
|
||||
hsetprop ${scobj_hpath}/powermax rdInteger ${ns}::rdInteger ${scobj_hpath}
|
||||
@@ -408,6 +439,15 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
|
||||
hsetprop ${scobj_hpath}/powermax type "part"
|
||||
hsetprop ${scobj_hpath}/powermax nxalias "${name}_powermax"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/powermax 1
|
||||
${sct_controller} write ${scobj_hpath}/powermax
|
||||
hsetprop ${scobj_hpath}/powermax simulated false
|
||||
} else {
|
||||
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
|
||||
hsetprop ${scobj_hpath}/powermax simulated true
|
||||
}
|
||||
|
||||
hfactory ${scobj_hpath}/ramprate plain user float
|
||||
hsetprop ${scobj_hpath}/ramprate read ${ns}::getDecimal ${scobj_hpath} rdDecimal {24}
|
||||
hsetprop ${scobj_hpath}/ramprate rdDecimal ${ns}::rdDecimal ${scobj_hpath}
|
||||
@@ -424,6 +464,15 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
|
||||
hsetprop ${scobj_hpath}/ramprate type "part"
|
||||
hsetprop ${scobj_hpath}/ramprate nxalias "${name}_ramprate"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/ramprate 1
|
||||
${sct_controller} write ${scobj_hpath}/ramprate
|
||||
hsetprop ${scobj_hpath}/ramprate simulated false
|
||||
} else {
|
||||
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
|
||||
hsetprop ${scobj_hpath}/ramprate simulated true
|
||||
}
|
||||
|
||||
hfactory ${scobj_hpath}/sensor plain user float
|
||||
hsetprop ${scobj_hpath}/sensor read ${ns}::getDecimal ${scobj_hpath} rdDecimal {1}
|
||||
hsetprop ${scobj_hpath}/sensor rdDecimal ${ns}::rdDecimal ${scobj_hpath}
|
||||
@@ -439,6 +488,14 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
|
||||
hsetprop ${scobj_hpath}/sensor type "part"
|
||||
hsetprop ${scobj_hpath}/sensor nxalias "${name}_sensor"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/sensor 1
|
||||
hsetprop ${scobj_hpath}/sensor simulated false
|
||||
} else {
|
||||
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
|
||||
hsetprop ${scobj_hpath}/sensor simulated true
|
||||
}
|
||||
|
||||
hfactory ${scobj_hpath}/setpoint plain user float
|
||||
hsetprop ${scobj_hpath}/setpoint read ${ns}::getDecimal ${scobj_hpath} rdDecimal {2}
|
||||
hsetprop ${scobj_hpath}/setpoint rdDecimal ${ns}::rdDecimal ${scobj_hpath}
|
||||
@@ -466,6 +523,15 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
|
||||
hsetprop ${scobj_hpath}/setpoint type "drivable"
|
||||
hsetprop ${scobj_hpath}/setpoint nxalias "${name}_setpoint"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/setpoint 1
|
||||
${sct_controller} write ${scobj_hpath}/setpoint
|
||||
hsetprop ${scobj_hpath}/setpoint simulated false
|
||||
} else {
|
||||
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
|
||||
hsetprop ${scobj_hpath}/setpoint simulated true
|
||||
}
|
||||
|
||||
hfactory ${scobj_hpath}/w_sp plain user float
|
||||
hsetprop ${scobj_hpath}/w_sp read ${ns}::getDecimal ${scobj_hpath} rdDecimal {21}
|
||||
hsetprop ${scobj_hpath}/w_sp rdDecimal ${ns}::rdDecimal ${scobj_hpath}
|
||||
@@ -482,33 +548,21 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
|
||||
hsetprop ${scobj_hpath}/w_sp type "part"
|
||||
hsetprop ${scobj_hpath}/w_sp nxalias "${name}_w_sp"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/w_sp 1
|
||||
${sct_controller} write ${scobj_hpath}/w_sp
|
||||
hsetprop ${scobj_hpath}/w_sp simulated false
|
||||
} else {
|
||||
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
|
||||
hsetprop ${scobj_hpath}/w_sp simulated true
|
||||
}
|
||||
|
||||
hsetprop ${scobj_hpath} data "true"
|
||||
hsetprop ${scobj_hpath} klass "@none"
|
||||
hsetprop ${scobj_hpath} type "part"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/alarm1 1
|
||||
${sct_controller} poll ${scobj_hpath}/alarm2 1
|
||||
${sct_controller} poll ${scobj_hpath}/power 1
|
||||
${sct_controller} poll ${scobj_hpath}/powermax 1
|
||||
${sct_controller} poll ${scobj_hpath}/ramprate 1
|
||||
${sct_controller} poll ${scobj_hpath}/sensor 1
|
||||
${sct_controller} poll ${scobj_hpath}/setpoint 1
|
||||
${sct_controller} poll ${scobj_hpath}/w_sp 1
|
||||
${sct_controller} write ${scobj_hpath}/alarm1
|
||||
${sct_controller} write ${scobj_hpath}/alarm2
|
||||
${sct_controller} write ${scobj_hpath}/powermax
|
||||
${sct_controller} write ${scobj_hpath}/ramprate
|
||||
${sct_controller} write ${scobj_hpath}/setpoint
|
||||
${sct_controller} write ${scobj_hpath}/w_sp
|
||||
} else {
|
||||
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
|
||||
}
|
||||
ansto_makesctdrive ${name}_setpoint ${scobj_hpath}/setpoint ${scobj_hpath}/sensor ${sct_controller}
|
||||
|
||||
hfactory ${scobj_hpath}/aux plain spy none
|
||||
hsetprop ${scobj_hpath}/aux data "false"
|
||||
hsetprop ${scobj_hpath}/aux klass "@none"
|
||||
hsetprop ${scobj_hpath}/aux type "part"
|
||||
|
||||
hfactory ${scobj_hpath}/aux/decimal plain user int
|
||||
hsetprop ${scobj_hpath}/aux/decimal read ${ns}::getInteger ${scobj_hpath} rdInteger {18}
|
||||
@@ -523,6 +577,14 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
|
||||
hsetprop ${scobj_hpath}/aux/decimal type "part"
|
||||
hsetprop ${scobj_hpath}/aux/decimal nxalias "${name}_aux_decimal"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/aux/decimal 2
|
||||
hsetprop ${scobj_hpath}/aux/decimal simulated false
|
||||
} else {
|
||||
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
|
||||
hsetprop ${scobj_hpath}/aux/decimal simulated true
|
||||
}
|
||||
|
||||
hfactory ${scobj_hpath}/aux/instatus plain user int
|
||||
hsetprop ${scobj_hpath}/aux/instatus read ${ns}::getInteger ${scobj_hpath} rdInteger {133}
|
||||
hsetprop ${scobj_hpath}/aux/instatus rdInteger ${ns}::rdInteger ${scobj_hpath}
|
||||
@@ -535,6 +597,14 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
|
||||
hsetprop ${scobj_hpath}/aux/instatus type "part"
|
||||
hsetprop ${scobj_hpath}/aux/instatus nxalias "${name}_aux_instatus"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/aux/instatus 2
|
||||
hsetprop ${scobj_hpath}/aux/instatus simulated false
|
||||
} else {
|
||||
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
|
||||
hsetprop ${scobj_hpath}/aux/instatus simulated true
|
||||
}
|
||||
|
||||
hfactory ${scobj_hpath}/aux/model plain user int
|
||||
hsetprop ${scobj_hpath}/aux/model read ${ns}::getInteger ${scobj_hpath} rdInteger {122}
|
||||
hsetprop ${scobj_hpath}/aux/model rdInteger ${ns}::rdInteger ${scobj_hpath}
|
||||
@@ -548,18 +618,18 @@ proc ::scobj::west_6100::mkDriver { sct_controller name device_class simulation_
|
||||
hsetprop ${scobj_hpath}/aux/model nxalias "${name}_aux_model"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/aux/decimal 2
|
||||
${sct_controller} poll ${scobj_hpath}/aux/instatus 2
|
||||
${sct_controller} poll ${scobj_hpath}/aux/model 2
|
||||
hsetprop ${scobj_hpath}/aux/model simulated false
|
||||
} else {
|
||||
::scobj::west_6100::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for west_6100"
|
||||
hsetprop ${scobj_hpath}/aux/model simulated true
|
||||
}
|
||||
hsetprop ${scobj_hpath}/aux data "false"
|
||||
hsetprop ${scobj_hpath}/aux klass "@none"
|
||||
hsetprop ${scobj_hpath}/aux type "part"
|
||||
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}_setpoint ${scobj_hpath}/setpoint ${scobj_hpath}/sensor ${sct_controller}
|
||||
}
|
||||
# mkDriver hook code goes here
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
@@ -577,7 +647,9 @@ proc ::scobj::west_6100::add_driver {name device_class simulation_flag ip_addres
|
||||
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 9 "simulation_flag=${simulation_flag} => Null sctcontroller for west_6100"
|
||||
::scobj::west_6100::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
|
||||
makesctcontroller sct_${name} aqadapter NULL
|
||||
}
|
||||
::scobj::west_6100::sics_log 1 "::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}"
|
||||
::scobj::west_6100::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id}
|
||||
@@ -595,7 +667,7 @@ namespace eval ::scobj::west_6100 {
|
||||
|
||||
proc add_west_6100 {name ip_address tcp_port id} {
|
||||
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
|
||||
::scobj::west_6100::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port} "${id}"
|
||||
::scobj::west_6100::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id}
|
||||
}
|
||||
|
||||
clientput "file evaluation of sct_west_6100.tcl"
|
||||
@@ -634,20 +706,31 @@ proc ::scobj::west_6100::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} modbus_ap ${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"]"
|
||||
}
|
||||
}
|
||||
@@ -658,6 +741,7 @@ proc ::scobj::west_6100::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]
|
||||
@@ -674,11 +758,7 @@ proc ::scobj::west_6100::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