Regenerate all the SCT drivers with new generator
This commit is contained in:
@@ -266,6 +266,14 @@ proc ::scobj::isotech_ps::mkDriver { sct_controller name device_class simulation
|
||||
hsetprop ${scobj_hpath}/amps type "part"
|
||||
hsetprop ${scobj_hpath}/amps nxalias "${name}_amps"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/amps 5
|
||||
hsetprop ${scobj_hpath}/amps simulated false
|
||||
} else {
|
||||
::scobj::isotech_ps::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for isotech_ps"
|
||||
hsetprop ${scobj_hpath}/amps simulated true
|
||||
}
|
||||
|
||||
hfactory ${scobj_hpath}/relay plain user int
|
||||
hsetprop ${scobj_hpath}/relay read ${ns}::getValue ${scobj_hpath} read_relay {F}
|
||||
hsetprop ${scobj_hpath}/relay read_relay ${ns}::read_relay ${scobj_hpath}
|
||||
@@ -282,6 +290,15 @@ proc ::scobj::isotech_ps::mkDriver { sct_controller name device_class simulation
|
||||
hsetprop ${scobj_hpath}/relay type "part"
|
||||
hsetprop ${scobj_hpath}/relay nxalias "${name}_relay"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/relay 5
|
||||
${sct_controller} write ${scobj_hpath}/relay
|
||||
hsetprop ${scobj_hpath}/relay simulated false
|
||||
} else {
|
||||
::scobj::isotech_ps::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for isotech_ps"
|
||||
hsetprop ${scobj_hpath}/relay simulated true
|
||||
}
|
||||
|
||||
hfactory ${scobj_hpath}/volts plain user float
|
||||
hsetprop ${scobj_hpath}/volts read ${ns}::getValue ${scobj_hpath} rdValue {V}
|
||||
hsetprop ${scobj_hpath}/volts rdValue ${ns}::rdValue ${scobj_hpath}
|
||||
@@ -299,19 +316,18 @@ proc ::scobj::isotech_ps::mkDriver { sct_controller name device_class simulation
|
||||
hsetprop ${scobj_hpath}/volts type "part"
|
||||
hsetprop ${scobj_hpath}/volts nxalias "${name}_volts"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/volts 5
|
||||
${sct_controller} write ${scobj_hpath}/volts
|
||||
hsetprop ${scobj_hpath}/volts simulated false
|
||||
} else {
|
||||
::scobj::isotech_ps::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for isotech_ps"
|
||||
hsetprop ${scobj_hpath}/volts 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}/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 "simulation_flag=${simulation_flag} => No poll/write for isotech_ps"
|
||||
}
|
||||
hsetprop ${scobj_hpath} klass ${device_class}
|
||||
hsetprop ${scobj_hpath} data true
|
||||
hsetprop ${scobj_hpath} debug_threshold 5
|
||||
@@ -332,7 +348,9 @@ proc ::scobj::isotech_ps::add_driver {name device_class simulation_flag ip_addre
|
||||
makesctcontroller sct_${name} std ${ip_address}:${tcp_port} "\r"
|
||||
}
|
||||
} else {
|
||||
::scobj::isotech_ps::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for isotech_ps"
|
||||
::scobj::isotech_ps::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for isotech_ps"
|
||||
::scobj::isotech_ps::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
|
||||
makesctcontroller sct_${name} aqadapter NULL
|
||||
}
|
||||
::scobj::isotech_ps::sics_log 1 "::scobj::isotech_ps::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
|
||||
::scobj::isotech_ps::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
|
||||
@@ -350,7 +368,7 @@ namespace eval ::scobj::isotech_ps {
|
||||
|
||||
proc add_isotech_ps {name ip_address tcp_port} {
|
||||
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
|
||||
::scobj::isotech_ps::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port}
|
||||
::scobj::isotech_ps::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port}
|
||||
}
|
||||
|
||||
clientput "file evaluation of sct_isotech_ps.tcl"
|
||||
@@ -389,20 +407,50 @@ proc ::scobj::isotech_ps::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]
|
||||
set arg_list [list]
|
||||
set missing_list [list]
|
||||
array unset default_map
|
||||
array set default_map [list terminator "\r"]
|
||||
foreach arg {terminator} {
|
||||
if {[dict exists $u $arg]} {
|
||||
lappend arg_list "[dict get $u $arg]"
|
||||
} elseif {[dict exists $v $arg]} {
|
||||
lappend arg_list "[dict get $v $arg]"
|
||||
} elseif {[info exists default_map($arg)]} {
|
||||
lappend arg_list $default_map($arg)
|
||||
} else {
|
||||
${ns}::sics_log 9 "Missing configuration value $arg"
|
||||
lappend missing_list $arg
|
||||
}
|
||||
}
|
||||
if { [llength $missing_list] > 0 } {
|
||||
error "$name is missing configuration values $missing_list"
|
||||
}
|
||||
makesctcontroller sct_${name} std ${ip_address}:${tcp_port} {*}$arg_list
|
||||
} 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"]"
|
||||
}
|
||||
}
|
||||
@@ -413,12 +461,9 @@ proc ::scobj::isotech_ps::read_config {} {
|
||||
if { [dict exists $v "timeout"] } {
|
||||
${asyncqueue} timeout "[dict get $v "timeout"]"
|
||||
}
|
||||
makesctcontroller sct_${name} aqadapter ${asyncqueue}
|
||||
}
|
||||
if { [string equal -nocase ${asyncqueue} "sct"] } {
|
||||
${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
|
||||
} else {
|
||||
${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue}
|
||||
}
|
||||
${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user