tweak spacing and code, generate new drivers
This commit is contained in:
@ -127,6 +127,7 @@ driver hiden_xcs = {
|
||||
@ } else {
|
||||
@ sct geterror "Syntax error in: '${data}'"
|
||||
@ }
|
||||
|
||||
}
|
||||
code read_function read_twelve = {
|
||||
@ if { [string equal -nocase -length 5 "${data}" "AOUT ="] } {
|
||||
@ -150,6 +151,7 @@ driver hiden_xcs = {
|
||||
@ sct geterror "Syntax error in: '${data}'"
|
||||
@ }
|
||||
}
|
||||
|
||||
code read_function read_sixteen = {
|
||||
@ if { [string equal -nocase -length 5 "${data}" "AIN ="] } {
|
||||
@ set result [scan "${data}" "AIN = %d OK" val]
|
||||
@ -172,6 +174,7 @@ driver hiden_xcs = {
|
||||
@ sct geterror "Syntax error in: '${data}'"
|
||||
@ }
|
||||
}
|
||||
|
||||
code read_function read_all_data = {
|
||||
@ if { [string equal -nocase -length 2 "${data}" "A "] } {
|
||||
@ set data_list [split [string range "${data}" 2 end-3] ',']
|
||||
@ -182,15 +185,16 @@ driver hiden_xcs = {
|
||||
@ hupdate ${tc_root}/flow2 [expr [lindex ${data_list} 4] / [hval ${tc_root}/gas_factor]]
|
||||
@ hupdate ${tc_root}/flow3 [expr [lindex ${data_list} 5] / [hval ${tc_root}/gas_factor]]
|
||||
@ } else {
|
||||
@ sct geterror "Syntax error (Result=${result}) in: '${data}'"
|
||||
@ sct geterror "Syntax error (not 8) for read_all_data in: '${data}'"
|
||||
@ }
|
||||
@ } else {
|
||||
@ sct geterror "Syntax error for read_all_data in: '${data}'"
|
||||
@ sct geterror "Syntax error (not A) for read_all_data in: '${data}'"
|
||||
@ }
|
||||
@ if { [hpropexists [sct] target] } {
|
||||
@ set pid [pid_humidity ${tc_root} [sct target] ${data}]
|
||||
@ }
|
||||
}
|
||||
|
||||
code pid_function pid_humidity = {
|
||||
@ set path [pathname [sct]]
|
||||
@ set sign 1
|
||||
@ -206,23 +210,12 @@ driver hiden_xcs = {
|
||||
@ }
|
||||
@ }
|
||||
}
|
||||
|
||||
code fetch_function fetch_flow = {
|
||||
@ set data 0.0
|
||||
@ set targets 0.0
|
||||
@ set path [pathname [sct]]
|
||||
@ foreach node [list flow1 flow2] {
|
||||
@ set data [expr ${data} + [hval ${path}/${node}]]
|
||||
@ }
|
||||
@ sct result ${data}
|
||||
@ foreach node [list analog/sp1 analog/sp2] {
|
||||
@ set targets [expr ${targets} + [hval ${path}/${node}]]
|
||||
@ }
|
||||
@ sct targets ${targets}
|
||||
@ if { [hpropexists [sct] target] } {
|
||||
@ set pid [pid_flow ${tc_root} [sct target] ${data}]
|
||||
@ }
|
||||
@# cut this function short
|
||||
@ return ${nextState}
|
||||
@ set cmd "@@NOSEND@@"
|
||||
}
|
||||
code pid_function pid_flow = {
|
||||
@ set path [pathname [sct]]
|
||||
@ -236,6 +229,7 @@ driver hiden_xcs = {
|
||||
@ }
|
||||
@ }
|
||||
}
|
||||
|
||||
code write_function write_digital = {
|
||||
}
|
||||
code write_function write_twelve = {
|
||||
@ -264,6 +258,7 @@ driver hiden_xcs = {
|
||||
@ set par [expr int(${base} + (4095.0 * ${par} / ${span}))]
|
||||
@ set cmd "${cmd_str}${par}"
|
||||
}
|
||||
|
||||
code write_function write_flow = {
|
||||
@ if { [hpropexists ${tc_root}/humidity target] } {
|
||||
@ set humidity_target [hgetpropval ${tc_root}/humidity target]
|
||||
@ -276,6 +271,7 @@ driver hiden_xcs = {
|
||||
@ hset ${tc_root}/analog/sp2 ${flow2_target}
|
||||
@ set cmd "@@NOSEND@@"
|
||||
}
|
||||
|
||||
code write_function write_humidity = {
|
||||
@ if { [hpropexists ${tc_root}/flow target] } {
|
||||
@ set flow_target [hgetpropval ${tc_root}/flow target]
|
||||
@ -288,6 +284,7 @@ driver hiden_xcs = {
|
||||
@ hset ${tc_root}/analog/sp2 ${flow2_target}
|
||||
@ set cmd "@@NOSEND@@"
|
||||
}
|
||||
|
||||
code write_function no_op = {
|
||||
@ set cmd "@@NOSEND@@"
|
||||
}
|
||||
@ -296,6 +293,7 @@ driver hiden_xcs = {
|
||||
#
|
||||
code mkDriver = {
|
||||
}
|
||||
|
||||
code chkrange_function = {
|
||||
@ # hooked
|
||||
}
|
||||
|
@ -141,22 +141,10 @@ proc ::scobj::hiden_xcs::fetch_flow {tc_root nextState cmd_str} {
|
||||
}
|
||||
set cmd "${cmd_str}"
|
||||
# hook code starts
|
||||
set data 0.0
|
||||
set targets 0.0
|
||||
set path [pathname [sct]]
|
||||
foreach node [list flow1 flow2] {
|
||||
set data [expr ${data} + [hval ${path}/${node}]]
|
||||
}
|
||||
sct result ${data}
|
||||
foreach node [list analog/sp1 analog/sp2] {
|
||||
set targets [expr ${targets} + [hval ${path}/${node}]]
|
||||
}
|
||||
sct targets ${targets}
|
||||
if { [hpropexists [sct] target] } {
|
||||
set pid [pid_flow ${tc_root} [sct target] ${data}]
|
||||
}
|
||||
# cut this function short
|
||||
return ${nextState}
|
||||
set cmd "@@NOSEND@@"
|
||||
# hook code ends
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
debug_log 1 "[sct] error: [sct geterror]"
|
||||
@ -364,10 +352,10 @@ proc ::scobj::hiden_xcs::read_all_data {tc_root} {
|
||||
hupdate ${tc_root}/flow2 [expr [lindex ${data_list} 4] / [hval ${tc_root}/gas_factor]]
|
||||
hupdate ${tc_root}/flow3 [expr [lindex ${data_list} 5] / [hval ${tc_root}/gas_factor]]
|
||||
} else {
|
||||
sct geterror "Syntax error (Result=${result}) in: '${data}'"
|
||||
sct geterror "Syntax error (not 8) for read_all_data in: '${data}'"
|
||||
}
|
||||
} else {
|
||||
sct geterror "Syntax error for read_all_data in: '${data}'"
|
||||
sct geterror "Syntax error (not A) for read_all_data in: '${data}'"
|
||||
}
|
||||
if { [hpropexists [sct] target] } {
|
||||
set pid [pid_humidity ${tc_root} [sct target] ${data}]
|
||||
@ -763,7 +751,7 @@ proc ::scobj::hiden_xcs::mk_sct_hiden_xcs { sct_controller name tol } {
|
||||
hsetprop ${scobj_hpath}/enabled klass "environment"
|
||||
hsetprop ${scobj_hpath}/enabled sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/enabled type "part"
|
||||
hsetprop ${scobj_hpath}/enabled nxalias "${name}_enabled"
|
||||
hsetprop ${scobj_hpath}/enabled nxalias "${name}__enabled"
|
||||
|
||||
hfactory ${scobj_hpath}/flow plain user float
|
||||
hsetprop ${scobj_hpath}/flow read ${ns}::fetch_flow ${scobj_hpath} read_flow {None}
|
||||
@ -794,7 +782,7 @@ proc ::scobj::hiden_xcs::mk_sct_hiden_xcs { sct_controller name tol } {
|
||||
hsetprop ${scobj_hpath}/flow pid_pvalue "0.2"
|
||||
hsetprop ${scobj_hpath}/flow sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/flow type "drivable"
|
||||
hsetprop ${scobj_hpath}/flow nxalias "${name}_flow"
|
||||
hsetprop ${scobj_hpath}/flow nxalias "${name}__flow"
|
||||
|
||||
hfactory ${scobj_hpath}/flow1 plain user float
|
||||
hsetprop ${scobj_hpath}/flow1 control false
|
||||
@ -805,7 +793,7 @@ proc ::scobj::hiden_xcs::mk_sct_hiden_xcs { sct_controller name tol } {
|
||||
hsetprop ${scobj_hpath}/flow1 klass "environment"
|
||||
hsetprop ${scobj_hpath}/flow1 sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/flow1 type "part"
|
||||
hsetprop ${scobj_hpath}/flow1 nxalias "${name}_flow1"
|
||||
hsetprop ${scobj_hpath}/flow1 nxalias "${name}__flow1"
|
||||
|
||||
hfactory ${scobj_hpath}/flow2 plain user float
|
||||
hsetprop ${scobj_hpath}/flow2 control false
|
||||
@ -816,7 +804,7 @@ proc ::scobj::hiden_xcs::mk_sct_hiden_xcs { sct_controller name tol } {
|
||||
hsetprop ${scobj_hpath}/flow2 klass "environment"
|
||||
hsetprop ${scobj_hpath}/flow2 sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/flow2 type "part"
|
||||
hsetprop ${scobj_hpath}/flow2 nxalias "${name}_flow2"
|
||||
hsetprop ${scobj_hpath}/flow2 nxalias "${name}__flow2"
|
||||
|
||||
hfactory ${scobj_hpath}/flow3 plain user float
|
||||
hsetprop ${scobj_hpath}/flow3 control false
|
||||
@ -827,7 +815,7 @@ proc ::scobj::hiden_xcs::mk_sct_hiden_xcs { sct_controller name tol } {
|
||||
hsetprop ${scobj_hpath}/flow3 klass "environment"
|
||||
hsetprop ${scobj_hpath}/flow3 sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/flow3 type "part"
|
||||
hsetprop ${scobj_hpath}/flow3 nxalias "${name}_flow3"
|
||||
hsetprop ${scobj_hpath}/flow3 nxalias "${name}__flow3"
|
||||
|
||||
hfactory ${scobj_hpath}/gas_factor plain user float
|
||||
hsetprop ${scobj_hpath}/gas_factor control true
|
||||
@ -839,7 +827,7 @@ proc ::scobj::hiden_xcs::mk_sct_hiden_xcs { sct_controller name tol } {
|
||||
hsetprop ${scobj_hpath}/gas_factor klass "environment"
|
||||
hsetprop ${scobj_hpath}/gas_factor sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/gas_factor type "part"
|
||||
hsetprop ${scobj_hpath}/gas_factor nxalias "${name}_gas_factor"
|
||||
hsetprop ${scobj_hpath}/gas_factor nxalias "${name}__gas_factor"
|
||||
|
||||
hfactory ${scobj_hpath}/humidity plain user float
|
||||
hsetprop ${scobj_hpath}/humidity read ${ns}::getValue ${scobj_hpath} read_all_data {?ALL DATA}
|
||||
@ -872,7 +860,7 @@ proc ::scobj::hiden_xcs::mk_sct_hiden_xcs { sct_controller name tol } {
|
||||
hsetprop ${scobj_hpath}/humidity sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/humidity settle_time "5.25"
|
||||
hsetprop ${scobj_hpath}/humidity type "drivable"
|
||||
hsetprop ${scobj_hpath}/humidity nxalias "${name}_humidity"
|
||||
hsetprop ${scobj_hpath}/humidity nxalias "${name}__humidity"
|
||||
|
||||
hfactory ${scobj_hpath}/temperature plain user float
|
||||
hsetprop ${scobj_hpath}/temperature control false
|
||||
@ -883,7 +871,7 @@ proc ::scobj::hiden_xcs::mk_sct_hiden_xcs { sct_controller name tol } {
|
||||
hsetprop ${scobj_hpath}/temperature klass "environment"
|
||||
hsetprop ${scobj_hpath}/temperature sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/temperature type "part"
|
||||
hsetprop ${scobj_hpath}/temperature nxalias "${name}_temperature"
|
||||
hsetprop ${scobj_hpath}/temperature nxalias "${name}__temperature"
|
||||
|
||||
hsetprop ${scobj_hpath} data "true"
|
||||
hsetprop ${scobj_hpath} nxsave "true"
|
||||
@ -894,9 +882,9 @@ proc ::scobj::hiden_xcs::mk_sct_hiden_xcs { sct_controller name tol } {
|
||||
${sct_controller} poll ${scobj_hpath}/humidity 1
|
||||
${sct_controller} write ${scobj_hpath}/enabled
|
||||
${sct_controller} write ${scobj_hpath}/flow
|
||||
ansto_makesctdrive ${name}_temperature ${scobj_hpath}/flow ${scobj_hpath}/flow ${sct_controller}
|
||||
ansto_makesctdrive ${name}__flow ${scobj_hpath}/flow ${scobj_hpath}/flow ${sct_controller}
|
||||
${sct_controller} write ${scobj_hpath}/humidity
|
||||
ansto_makesctdrive ${name}_temperature ${scobj_hpath}/humidity ${scobj_hpath}/humidity ${sct_controller}
|
||||
ansto_makesctdrive ${name}__humidity ${scobj_hpath}/humidity ${scobj_hpath}/humidity ${sct_controller}
|
||||
}
|
||||
|
||||
hfactory ${scobj_hpath}/analog plain spy none
|
||||
|
@ -253,7 +253,7 @@ proc ::scobj::isotech_ps::mk_sct_isotech_ps { sct_controller name } {
|
||||
hsetprop ${scobj_hpath}/amps oldval 0.0
|
||||
hsetprop ${scobj_hpath}/amps sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/amps type "part"
|
||||
hsetprop ${scobj_hpath}/amps nxalias "${name}_amps"
|
||||
hsetprop ${scobj_hpath}/amps nxalias "${name}__amps"
|
||||
|
||||
hfactory ${scobj_hpath}/relay plain user int
|
||||
hsetprop ${scobj_hpath}/relay read ${ns}::getValue ${scobj_hpath} read_relay {F}
|
||||
@ -268,7 +268,7 @@ proc ::scobj::isotech_ps::mk_sct_isotech_ps { sct_controller name } {
|
||||
hsetprop ${scobj_hpath}/relay oldval 0
|
||||
hsetprop ${scobj_hpath}/relay sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/relay type "part"
|
||||
hsetprop ${scobj_hpath}/relay nxalias "${name}_relay"
|
||||
hsetprop ${scobj_hpath}/relay nxalias "${name}__relay"
|
||||
|
||||
hfactory ${scobj_hpath}/volts plain user float
|
||||
hsetprop ${scobj_hpath}/volts read ${ns}::getValue ${scobj_hpath} rdValue {V}
|
||||
@ -284,7 +284,7 @@ proc ::scobj::isotech_ps::mk_sct_isotech_ps { sct_controller name } {
|
||||
hsetprop ${scobj_hpath}/volts oldval 0.0
|
||||
hsetprop ${scobj_hpath}/volts sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/volts type "part"
|
||||
hsetprop ${scobj_hpath}/volts nxalias "${name}_volts"
|
||||
hsetprop ${scobj_hpath}/volts nxalias "${name}__volts"
|
||||
|
||||
if {[SplitReply [environment_simulation]]=="false"} {
|
||||
${sct_controller} poll ${scobj_hpath}/amps 5
|
||||
|
Reference in New Issue
Block a user