Perform the rename
This commit is contained in:
@@ -0,0 +1,561 @@
|
||||
# Generated driver for pfeiffer_hg
|
||||
# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
|
||||
#
|
||||
|
||||
namespace eval ::scobj::pfeiffer_hg {
|
||||
set debug_threshold 5
|
||||
if { ![info exists ::scobj::permlink_device_counter]} {
|
||||
set ::scobj::permlink_device_counter 0
|
||||
}
|
||||
}
|
||||
|
||||
proc ::scobj::pfeiffer_hg::debug_log {tc_root debug_level debug_string} {
|
||||
set catch_status [ catch {
|
||||
set debug_threshold [hgetpropval ${tc_root} debug_threshold]
|
||||
if {${debug_level} >= ${debug_threshold}} {
|
||||
set fd [open "../log/pfeiffer_hg_[basename ${tc_root}].log" "a"]
|
||||
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
|
||||
puts ${fd} "${line}"
|
||||
close ${fd}
|
||||
}
|
||||
} catch_message ]
|
||||
}
|
||||
|
||||
proc ::scobj::pfeiffer_hg::sics_log {debug_level debug_string} {
|
||||
set catch_status [ catch {
|
||||
set debug_threshold ${::scobj::pfeiffer_hg::debug_threshold}
|
||||
if {${debug_level} >= ${debug_threshold}} {
|
||||
sicslog "::scobj::pfeiffer_hg::${debug_string}"
|
||||
}
|
||||
} catch_message ]
|
||||
}
|
||||
|
||||
# function to parse the read of a parameter on a device
|
||||
proc ::scobj::pfeiffer_hg::ack_enq {tc_root} {
|
||||
set catch_status [ catch {
|
||||
debug_log ${tc_root} 1 "ack_enq tc_root=${tc_root} sct=[sct] result=[sct result]"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set data [sct result]
|
||||
set nextState "idle"
|
||||
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
|
||||
# the protocol driver has reported an error
|
||||
sct geterror "${data}"
|
||||
error "[sct geterror]"
|
||||
}
|
||||
# ack_enq hook code starts
|
||||
if {[string equal -nocase -length 1 ${data} "\x06"]} {
|
||||
debug_log ${tc_root} 1 "ack_enq received ACK, send ENQ"
|
||||
sct send "\x05"
|
||||
}
|
||||
return "readPR1"
|
||||
# ack_enq hook code ends
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
debug_log ${tc_root} 9 "[sct] error: [sct geterror]"
|
||||
error "[sct geterror]"
|
||||
}
|
||||
if { ${data} != [sct oldval] } {
|
||||
debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]"
|
||||
sct oldval ${data}
|
||||
sct update ${data}
|
||||
sct utime readtime
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# checklimits function for driveable interface
|
||||
proc ::scobj::pfeiffer_hg::checklimits {tc_root} {
|
||||
set catch_status [ catch {
|
||||
debug_log ${tc_root} 1 "checklimits tc_root=${tc_root} sct=[sct] target=[sct target]"
|
||||
set setpoint [sct target]
|
||||
if { [hpropexists [sct] lowerlimit] } {
|
||||
set lolimit [sct lowerlimit]
|
||||
} else {
|
||||
# lowerlimit not set, use target
|
||||
set lolimit [sct target]
|
||||
}
|
||||
if { [hpropexists [sct] upperlimit] } {
|
||||
set hilimit [sct upperlimit]
|
||||
} else {
|
||||
# upperlimit not set, use target
|
||||
set hilimit [sct target]
|
||||
}
|
||||
# checklimits hook code goes here
|
||||
if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } {
|
||||
sct driving 0
|
||||
error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]"
|
||||
}
|
||||
return OK
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# check function for hset change
|
||||
proc ::scobj::pfeiffer_hg::checkrange {tc_root} {
|
||||
set catch_status [ catch {
|
||||
debug_log ${tc_root} 1 "checkrange tc_root=${tc_root} sct=[sct] target=[sct target]"
|
||||
set setpoint [sct target]
|
||||
if { [hpropexists [sct] lowerlimit] } {
|
||||
set lolimit [sct lowerlimit]
|
||||
} else {
|
||||
# lowerlimit not set, use target
|
||||
set lolimit [sct target]
|
||||
}
|
||||
if { [hpropexists [sct] upperlimit] } {
|
||||
set hilimit [sct upperlimit]
|
||||
} else {
|
||||
# upperlimit not set, use target
|
||||
set hilimit [sct target]
|
||||
}
|
||||
# checkrange hook code goes here
|
||||
if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } {
|
||||
error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]"
|
||||
}
|
||||
return OK
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# checkstatus function for driveable interface
|
||||
proc ::scobj::pfeiffer_hg::checkstatus {tc_root} {
|
||||
set catch_status [ catch {
|
||||
# checkstatus hook code goes here
|
||||
if {[sct driving]} {
|
||||
set sp "[sct target]"
|
||||
set pv "[hval ${tc_root}/[sct driveable]]"
|
||||
if { abs(${pv} - ${sp}) <= [sct tolerance] } {
|
||||
if { [hpropexists [sct] settle_time] } {
|
||||
if { [hpropexists [sct] settle_time_start] } {
|
||||
if { [sct utime] - [sct settle_time_start] >= [sct settle_time]} {
|
||||
sct driving 0
|
||||
return "idle"
|
||||
}
|
||||
return "busy"
|
||||
} else {
|
||||
sct utime settle_time_start
|
||||
return "busy"
|
||||
}
|
||||
}
|
||||
sct driving 0
|
||||
return "idle"
|
||||
}
|
||||
if { [hpropexists [sct] settle_time_start] } {
|
||||
hdelprop [sct] settle_time_start
|
||||
}
|
||||
return "busy"
|
||||
} else {
|
||||
return "idle"
|
||||
}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to request the read of a parameter on a device
|
||||
proc ::scobj::pfeiffer_hg::getValue {tc_root nextState cmd_str} {
|
||||
set catch_status [ catch {
|
||||
debug_log ${tc_root} 1 "getValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set cmd "${cmd_str}"
|
||||
# getValue hook code goes here
|
||||
debug_log ${tc_root} 1 "getValue sct send ${cmd}"
|
||||
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
|
||||
sct send "${cmd}"
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# halt function for driveable interface
|
||||
proc ::scobj::pfeiffer_hg::halt {tc_root} {
|
||||
set catch_status [ catch {
|
||||
debug_log ${tc_root} 1 "halt tc_root=${tc_root} sct=[sct] driving=[sct driving]"
|
||||
### TODO hset [sct] [hval [sct]]
|
||||
# halt hook code goes here
|
||||
sct driving 0
|
||||
return "idle"
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to check the write parameter on a device
|
||||
proc ::scobj::pfeiffer_hg::noResponse {tc_root} {
|
||||
set catch_status [ catch {
|
||||
debug_log ${tc_root} 1 "noResponse tc_root=${tc_root} sct=[sct] resp=[sct result]"
|
||||
# noResponse hook code goes here
|
||||
return "idle"
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# pid function for PID control
|
||||
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_deriv [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}}]
|
||||
# pid_pressure hook code starts
|
||||
if { [hpropexists [sct] pid_control] } {
|
||||
set co [hgetpropval [sct] pid_control]
|
||||
if { !([hpropexists ${co} pid_bias] && [hgetpropval ${co} pid_bias] == ${pid}) } {
|
||||
hsetprop ${co} pid_bias ${pid}
|
||||
if { [hpropexists ${co} target] } {
|
||||
hset ${co} [hgetpropval ${co} target]
|
||||
} else {
|
||||
hset ${co} [hval ${co}]
|
||||
}
|
||||
}
|
||||
}
|
||||
# pid_pressure hook code ends
|
||||
sct pid_output ${pid}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
return ${pid}
|
||||
}
|
||||
|
||||
# function to parse the read of a parameter on a device
|
||||
proc ::scobj::pfeiffer_hg::rdValue {tc_root} {
|
||||
set catch_status [ catch {
|
||||
debug_log ${tc_root} 1 "rdValue tc_root=${tc_root} sct=[sct] result=[sct result]"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set data [sct result]
|
||||
set nextState "idle"
|
||||
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
|
||||
# the protocol driver has reported an error
|
||||
sct geterror "${data}"
|
||||
error "[sct geterror]"
|
||||
}
|
||||
# rdValue hook code goes here
|
||||
if { ${data} != [sct oldval] } {
|
||||
debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]"
|
||||
sct oldval ${data}
|
||||
sct update ${data}
|
||||
sct utime readtime
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to parse the read of a parameter on a device
|
||||
proc ::scobj::pfeiffer_hg::readPR1 {tc_root} {
|
||||
set catch_status [ catch {
|
||||
debug_log ${tc_root} 1 "readPR1 tc_root=${tc_root} sct=[sct] result=[sct result]"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set data [sct result]
|
||||
set nextState "idle"
|
||||
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
|
||||
# the protocol driver has reported an error
|
||||
sct geterror "${data}"
|
||||
error "[sct geterror]"
|
||||
}
|
||||
# readPR1 hook code starts
|
||||
set val [string range $data 3 12]
|
||||
set status [string range $data 0 0]
|
||||
set data ${val}
|
||||
hupdate ${tc_root}/status $status
|
||||
if { [hpropexists [sct] pid_control] && [hpropexists [sct] pid_setpoint] } {
|
||||
set sp [hval ${tc_root}/[sct pid_setpoint]]
|
||||
set pv $val
|
||||
pid_pressure ${tc_root} ${sp} ${pv}
|
||||
}
|
||||
# readPR1 hook code ends
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
debug_log ${tc_root} 9 "[sct] error: [sct geterror]"
|
||||
error "[sct geterror]"
|
||||
}
|
||||
if { ${data} != [sct oldval] } {
|
||||
debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]"
|
||||
sct oldval ${data}
|
||||
sct update ${data}
|
||||
sct utime readtime
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to request the read of a parameter on a device
|
||||
proc ::scobj::pfeiffer_hg::sendPR1 {tc_root nextState cmd_str} {
|
||||
set catch_status [ catch {
|
||||
debug_log ${tc_root} 1 "sendPR1 tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set cmd "${cmd_str}"
|
||||
# sendPR1 hook code goes here
|
||||
debug_log ${tc_root} 1 "sendPR1 sct send ${cmd}"
|
||||
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
|
||||
sct send "${cmd}"
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to write a parameter value on a device
|
||||
proc ::scobj::pfeiffer_hg::setPoint {tc_root nextState cmd_str} {
|
||||
set catch_status [ catch {
|
||||
debug_log ${tc_root} 1 "setPoint tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set par [sct target]
|
||||
set cmd "${cmd_str}${par}"
|
||||
# setPoint hook code starts
|
||||
sct pid_control /sample/tc9/Valve/Setpoint
|
||||
sct update [sct target]
|
||||
set cmd "@@NOSEND@@"
|
||||
set nextState "idle"
|
||||
# setPoint hook code ends
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
debug_log ${tc_root} 9 "[sct] error: [sct geterror]"
|
||||
error "[sct geterror]"
|
||||
}
|
||||
if { [hpropexists [sct] driving] } {
|
||||
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
|
||||
sct driving 1
|
||||
}
|
||||
}
|
||||
debug_log ${tc_root} 1 "setPoint sct send ${cmd}"
|
||||
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
|
||||
sct send "${cmd}"
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to write a parameter value on a device
|
||||
proc ::scobj::pfeiffer_hg::setValue {tc_root nextState cmd_str} {
|
||||
set catch_status [ catch {
|
||||
debug_log ${tc_root} 1 "setValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set par [sct target]
|
||||
set cmd "${cmd_str}${par}"
|
||||
# setValue hook code goes here
|
||||
if { [hpropexists [sct] driving] } {
|
||||
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
|
||||
sct driving 1
|
||||
}
|
||||
}
|
||||
debug_log ${tc_root} 1 "setValue sct send ${cmd}"
|
||||
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
|
||||
sct send "${cmd}"
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
proc ::scobj::pfeiffer_hg::mkDriver { sct_controller name } {
|
||||
::scobj::pfeiffer_hg::sics_log 9 "::scobj::pfeiffer_hg::mkDriver for ${name}"
|
||||
set ns "[namespace current]"
|
||||
set catch_status [ catch {
|
||||
|
||||
set permlink_device_number [format "%02d" [incr ::scobj::permlink_device_counter]]
|
||||
|
||||
MakeSICSObj ${name} SCT_OBJECT
|
||||
|
||||
sicslist setatt ${name} klass environment
|
||||
sicslist setatt ${name} long_name ${name}
|
||||
|
||||
set scobj_hpath /sics/${name}
|
||||
|
||||
hfactory ${scobj_hpath}/status plain user int
|
||||
hsetprop ${scobj_hpath}/status control true
|
||||
hsetprop ${scobj_hpath}/status data true
|
||||
hsetprop ${scobj_hpath}/status mutable false
|
||||
hsetprop ${scobj_hpath}/status nxsave true
|
||||
hsetprop ${scobj_hpath}/status oldval 0
|
||||
hsetprop ${scobj_hpath}/status sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/status type "part"
|
||||
hsetprop ${scobj_hpath}/status nxalias "${name}_status"
|
||||
|
||||
hfactory ${scobj_hpath}/pressure plain spy none
|
||||
|
||||
hfactory ${scobj_hpath}/pressure/sensor plain user float
|
||||
hsetprop ${scobj_hpath}/pressure/sensor read ${ns}::sendPR1 ${scobj_hpath} readPR1 {PR1}
|
||||
hsetprop ${scobj_hpath}/pressure/sensor readPR1 ${ns}::readPR1 ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/pressure/sensor control true
|
||||
hsetprop ${scobj_hpath}/pressure/sensor data true
|
||||
hsetprop ${scobj_hpath}/pressure/sensor mutable false
|
||||
hsetprop ${scobj_hpath}/pressure/sensor nxsave true
|
||||
hsetprop ${scobj_hpath}/pressure/sensor permlink data_set "P${permlink_device_number}S01"
|
||||
hsetprop ${scobj_hpath}/pressure/sensor @description "P${permlink_device_number}S01"
|
||||
hsetprop ${scobj_hpath}/pressure/sensor oldval 0.0
|
||||
hsetprop ${scobj_hpath}/pressure/sensor pid_control "/sample/tc9/Valve/Setpoint"
|
||||
hsetprop ${scobj_hpath}/pressure/sensor pid_deriv "0"
|
||||
hsetprop ${scobj_hpath}/pressure/sensor pid_dvalue "0.0"
|
||||
hsetprop ${scobj_hpath}/pressure/sensor pid_error "0"
|
||||
hsetprop ${scobj_hpath}/pressure/sensor pid_imax "30"
|
||||
hsetprop ${scobj_hpath}/pressure/sensor pid_integ "0"
|
||||
hsetprop ${scobj_hpath}/pressure/sensor pid_ivalue "0.1"
|
||||
hsetprop ${scobj_hpath}/pressure/sensor pid_pvalue "0.2"
|
||||
hsetprop ${scobj_hpath}/pressure/sensor pid_setpoint "pressure/setpoint"
|
||||
hsetprop ${scobj_hpath}/pressure/sensor sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/pressure/sensor type "part"
|
||||
hsetprop ${scobj_hpath}/pressure/sensor nxalias "${name}_pressure_sensor"
|
||||
|
||||
hfactory ${scobj_hpath}/pressure/setpoint plain user float
|
||||
hsetprop ${scobj_hpath}/pressure/setpoint write ${ns}::setPoint ${scobj_hpath} noResponse {@}
|
||||
hsetprop ${scobj_hpath}/pressure/setpoint noResponse ${ns}::noResponse ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/pressure/setpoint check ${ns}::checkrange ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/pressure/setpoint driving 0
|
||||
hsetprop ${scobj_hpath}/pressure/setpoint checklimits ${ns}::checklimits ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/pressure/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/pressure/setpoint halt ${ns}::halt ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/pressure/setpoint driveable pressure/sensor
|
||||
hsetprop ${scobj_hpath}/pressure/setpoint control true
|
||||
hsetprop ${scobj_hpath}/pressure/setpoint data true
|
||||
hsetprop ${scobj_hpath}/pressure/setpoint mutable false
|
||||
hsetprop ${scobj_hpath}/pressure/setpoint nxsave true
|
||||
hsetprop ${scobj_hpath}/pressure/setpoint lowerlimit 0
|
||||
hsetprop ${scobj_hpath}/pressure/setpoint upperlimit 1000
|
||||
hsetprop ${scobj_hpath}/pressure/setpoint tolerance 100
|
||||
hsetprop ${scobj_hpath}/pressure/setpoint permlink data_set "P${permlink_device_number}SP01"
|
||||
hsetprop ${scobj_hpath}/pressure/setpoint @description "P${permlink_device_number}SP01"
|
||||
hsetprop ${scobj_hpath}/pressure/setpoint oldval 0.0
|
||||
hsetprop ${scobj_hpath}/pressure/setpoint sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/pressure/setpoint settle_time "90"
|
||||
hsetprop ${scobj_hpath}/pressure/setpoint type "drivable"
|
||||
hsetprop ${scobj_hpath}/pressure/setpoint nxalias "${name}_pressure_setpoint"
|
||||
|
||||
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/pressure/sensor 1
|
||||
${sct_controller} write ${scobj_hpath}/pressure/setpoint
|
||||
} 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}
|
||||
# mkDriver hook code ends
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
namespace eval ::scobj::pfeiffer_hg {
|
||||
namespace export debug_threshold
|
||||
namespace export debug_log
|
||||
namespace export sics_log
|
||||
namespace export mkDriver
|
||||
}
|
||||
|
||||
proc add_pfeiffer_hg {name IP port} {
|
||||
set catch_status [ catch {
|
||||
::scobj::pfeiffer_hg::sics_log 9 "add_pfeiffer_hg ${name} ${IP} ${port}"
|
||||
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
|
||||
if {[string equal -nocase "aqadapter" "${IP}"]} {
|
||||
::scobj::pfeiffer_hg::sics_log 9 "makesctcontroller sct_${name} aqadapter ${port}"
|
||||
makesctcontroller sct_${name} aqadapter ${port}
|
||||
} else {
|
||||
::scobj::pfeiffer_hg::sics_log 9 "makesctcontroller sct_${name} std ${IP}:${port}"
|
||||
makesctcontroller sct_${name} std ${IP}:${port}
|
||||
}
|
||||
} else {
|
||||
::scobj::pfeiffer_hg::sics_log 9 "[environment_simulation] => No sctcontroller for pfeiffer_hg"
|
||||
}
|
||||
::scobj::pfeiffer_hg::sics_log 1 "::scobj::pfeiffer_hg::mkDriver sct_${name} ${name}"
|
||||
::scobj::pfeiffer_hg::mkDriver sct_${name} ${name}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
clientput "file evaluation of sct_pfeiffer_hg.tcl"
|
||||
::scobj::pfeiffer_hg::sics_log 9 "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 u} $::config_dict {
|
||||
if { [dict exists $u "implementation"] } {
|
||||
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
|
||||
continue
|
||||
}
|
||||
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
|
||||
}
|
||||
set v [dict get $::config_dict $implementation]
|
||||
if { !([dict exists $v "driver"]) } {
|
||||
continue
|
||||
}
|
||||
if { [string equal -nocase [dict get $v "driver"] "pfeiffer_hg"] } {
|
||||
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]
|
||||
}
|
||||
} 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}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
if { [info exists ::config_dict] } {
|
||||
::scobj::pfeiffer_hg::read_config
|
||||
} else {
|
||||
::scobj::pfeiffer_hg::sics_log 5 "No config dict"
|
||||
}
|
||||
Reference in New Issue
Block a user