Make all sct drivers.
This commit is contained in:
@@ -60,7 +60,7 @@ proc ::scobj::pfeiffer_hg::ack_enq {tc_root} {
|
||||
sct oldval ${data}
|
||||
sct update ${data}
|
||||
sct utime readtime
|
||||
}
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
@@ -197,19 +197,19 @@ proc ::scobj::pfeiffer_hg::noResponse {tc_root} {
|
||||
proc ::scobj::pfeiffer_hg::pid_pressure {tc_root sp pv} {
|
||||
set catch_status [ catch {
|
||||
debug_log ${tc_root} 1 "pid_pressure tc_root=${tc_root} sct=[sct] pv=${pv} sp=${sp}"
|
||||
sct pid_error [expr ${sp} - ${pv}]
|
||||
set p_value [expr [sct pid_pvalue] * [sct pid_error]]
|
||||
set d_value [expr [sct pid_dvalue] * (${pv} - [sct oldval])]
|
||||
sct pid_error [expr {${sp} - ${pv}}]
|
||||
set p_value [expr {[sct pid_pvalue] * [sct pid_error]}]
|
||||
set d_value [expr {[sct pid_dvalue] * (${pv} - [sct oldval])}]
|
||||
sct pid_deriv [sct pid_error]
|
||||
sct pid_integ [expr [sct pid_integ] + [sct pid_error]]
|
||||
sct pid_integ [expr {[sct pid_integ] + [sct pid_error]}]
|
||||
if { [sct pid_integ] > [sct pid_imax] } {
|
||||
sct pid_integ [sct pid_imax]
|
||||
}
|
||||
if { [sct pid_integ] < -[sct pid_imax] } {
|
||||
sct pid_integ -[sct pid_imax]
|
||||
}
|
||||
set i_value [expr [sct pid_ivalue] * [sct pid_integ]]
|
||||
set pid [expr ${p_value} + ${i_value} + ${d_value}]
|
||||
set i_value [expr {[sct pid_ivalue] * [sct pid_integ]}]
|
||||
set pid [expr {${p_value} + ${i_value} + ${d_value}}]
|
||||
# pid_pressure hook code starts
|
||||
if { [hpropexists [sct] pid_control] } {
|
||||
set co [hgetpropval [sct] pid_control]
|
||||
@@ -249,7 +249,7 @@ proc ::scobj::pfeiffer_hg::rdValue {tc_root} {
|
||||
sct oldval ${data}
|
||||
sct update ${data}
|
||||
sct utime readtime
|
||||
}
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
@@ -289,7 +289,7 @@ proc ::scobj::pfeiffer_hg::readPR1 {tc_root} {
|
||||
sct oldval ${data}
|
||||
sct update ${data}
|
||||
sct utime readtime
|
||||
}
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
@@ -446,12 +446,14 @@ proc ::scobj::pfeiffer_hg::mkDriver { sct_controller name } {
|
||||
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/pressure/sensor 1
|
||||
${sct_controller} write ${scobj_hpath}/pressure/setpoint
|
||||
ansto_makesctdrive ${name}_pressure_setpoint ${scobj_hpath}/pressure/setpoint ${scobj_hpath}/pressure/sensor ${sct_controller}
|
||||
} else {
|
||||
::scobj::pfeiffer_hg::sics_log 9 "[environment_simulation] => No poll/write for pfeiffer_hg"
|
||||
}
|
||||
hsetprop ${scobj_hpath} klass environment
|
||||
hsetprop ${scobj_hpath} debug_threshold 5
|
||||
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
|
||||
ansto_makesctdrive ${name}_pressure_setpoint ${scobj_hpath}/pressure/setpoint ${scobj_hpath}/pressure/sensor ${sct_controller}
|
||||
}
|
||||
# mkDriver hook code starts
|
||||
hsetprop ${scobj_hpath}/pressure/sensor read ${ns}::sendPR1 ${scobj_hpath} ack_enq {PR1}
|
||||
hsetprop ${scobj_hpath}/pressure/sensor ack_enq ${ns}::ack_enq ${scobj_hpath}
|
||||
@@ -493,14 +495,17 @@ clientput "file evaluation of sct_pfeiffer_hg.tcl"
|
||||
proc ::scobj::pfeiffer_hg::read_config {} {
|
||||
set catch_status [ catch {
|
||||
set ns "::scobj::pfeiffer_hg"
|
||||
dict for {k v} $::config_dict {
|
||||
if { [dict exists $v "implementation"] } {
|
||||
if { !([dict exists $v "name"] && [dict exists $v "enabled"]) } {
|
||||
dict for {k u} $::config_dict {
|
||||
if { [dict exists $u "implementation"] } {
|
||||
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
|
||||
continue
|
||||
}
|
||||
set name [dict get $v name]
|
||||
set enabled [string tolower [dict get $v "enabled"]]
|
||||
set implementation [dict get $v "implementation"]
|
||||
set enabled [string tolower [dict get $u "enabled"]]
|
||||
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
|
||||
continue
|
||||
}
|
||||
set name [dict get $u name]
|
||||
set implementation [dict get $u "implementation"]
|
||||
if { !([dict exists $::config_dict $implementation]) } {
|
||||
continue
|
||||
}
|
||||
@@ -509,31 +514,37 @@ proc ::scobj::pfeiffer_hg::read_config {} {
|
||||
continue
|
||||
}
|
||||
if { [string equal -nocase [dict get $v "driver"] "pfeiffer_hg"] } {
|
||||
if { [string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"] } {
|
||||
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
|
||||
set asyncqueue "null"
|
||||
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
|
||||
} elseif { [dict exists $v "asyncqueue"] } {
|
||||
set asyncqueue [dict get $v "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"] } {
|
||||
${asyncprotocol} sendterminator "[dict get $v "terminator"]"
|
||||
${asyncprotocol} replyterminator "[dict get $v "terminator"]"
|
||||
}
|
||||
}
|
||||
set asyncqueue ${name}_queue
|
||||
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
|
||||
set asyncqueue "null"
|
||||
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
|
||||
} elseif { [dict exists $v "asyncqueue"] } {
|
||||
set asyncqueue [dict get $v "asyncqueue"]
|
||||
if { [string equal -nocase ${asyncqueue} "sct"] } {
|
||||
set IP [dict get $v ip]
|
||||
set PORT [dict get $v port]
|
||||
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
|
||||
if { [dict exists $v "timeout"] } {
|
||||
${asyncqueue} timeout "[dict get $v "timeout"]"
|
||||
}
|
||||
} else {
|
||||
if { [dict exists $v "asyncprotocol"] } {
|
||||
set asyncprotocol [dict get $v "asyncprotocol"]
|
||||
} else {
|
||||
set asyncprotocol ${name}_protocol
|
||||
MakeAsyncProtocol ${asyncprotocol}
|
||||
if { [dict exists $v "terminator"] } {
|
||||
${asyncprotocol} sendterminator "[dict get $v "terminator"]"
|
||||
${asyncprotocol} replyterminator "[dict get $v "terminator"]"
|
||||
}
|
||||
}
|
||||
set asyncqueue ${name}_queue
|
||||
set IP [dict get $v ip]
|
||||
set PORT [dict get $v port]
|
||||
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
|
||||
if { [dict exists $v "timeout"] } {
|
||||
${asyncqueue} timeout "[dict get $v "timeout"]"
|
||||
}
|
||||
}
|
||||
if { [string equal -nocase ${asyncqueue} "sct"] } {
|
||||
add_pfeiffer_hg ${name} ${IP} ${PORT}
|
||||
} else {
|
||||
add_pfeiffer_hg ${name} "aqadapter" ${asyncqueue}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user