Pull back changes from Dingo
This commit is contained in:
@@ -1,21 +1,97 @@
|
||||
set sim_mode [SplitReply [plc_simulation]]
|
||||
|
||||
if {$sim_mode == "false"} {
|
||||
MakeAsyncQueue plc_chan SafetyPLC [dict get $::PLC_HOSTPORT HOST] [dict get $::PLC_HOSTPORT PORT]
|
||||
MakeSafetyPLC plc plc_chan 0
|
||||
|
||||
}
|
||||
makesctcontroller sct_shutter std 137.157.204.213:30000
|
||||
|
||||
# Configuration Note:
|
||||
#
|
||||
# A default setting has been set in safetyplc.c code. following configuration
|
||||
# settings are only required when necessacy.
|
||||
#
|
||||
# fields Collimationgate, Detectorgate, Fastshutter, SecondTerShutter
|
||||
# and IndTerShutter NOT belong to dafault fields and need to be configured
|
||||
# based on particular instrument during deployment
|
||||
# values: 1 -- will display in PLC List
|
||||
# 0 -- wont show in PLC List
|
||||
set bitstream ""
|
||||
foreach {para paraval} {
|
||||
Key 1
|
||||
Secondary 1
|
||||
Tertiary 1
|
||||
MotionControl 1
|
||||
Access 1
|
||||
DC 1
|
||||
Exit 1
|
||||
Trip 1
|
||||
Fault 1
|
||||
Operate 1
|
||||
Relay 1
|
||||
Ready 1
|
||||
Collimationgate 0
|
||||
Detectorgate 0
|
||||
Fastshutter 1
|
||||
SecondTerShutter 0
|
||||
IndTerShutter 0
|
||||
} {
|
||||
append bitstream $paraval
|
||||
}
|
||||
plc setlist $bitstream
|
||||
|
||||
proc shutter {args} {
|
||||
set cmd "set shutter=$args\r\n"
|
||||
plc_chan send $cmd
|
||||
sct_shutter transact $cmd
|
||||
}
|
||||
|
||||
proc focuslight {args} {
|
||||
set cmd "set focuslight=$args\r\n"
|
||||
plc_chan send $cmd
|
||||
sct_shutter transact $cmd
|
||||
}
|
||||
|
||||
proc tertiary_shutter {args} {
|
||||
set cmd "set tertiary shutter=$args\r\n"
|
||||
sct_shutter transact $cmd
|
||||
}
|
||||
|
||||
publish shutter user
|
||||
publish focuslight user
|
||||
publish tertiary_shutter user
|
||||
|
||||
source $cfPath(plc)/plc_common_1.tcl
|
||||
|
||||
set plc_t "plc"
|
||||
MakeSICSObj $plc SCT_OBJECT
|
||||
sicslist setatt $plc_t klass environment
|
||||
sicslist setatt $plc_t long_name $plc_t
|
||||
|
||||
set scobj_hpath /sics/$plc_t
|
||||
|
||||
proc ::scobj::plc::getPlcValue {nextstate} {
|
||||
|
||||
plc_chan transact "READ"
|
||||
return $nextstate
|
||||
}
|
||||
|
||||
proc ::scobj::plc::rdPlcValue {} {
|
||||
|
||||
set replyData [string trimright [sct result] " \r\n"]
|
||||
|
||||
set d1 [clock format [clock seconds] -format %d%h%Y]
|
||||
set fd [open "../log/plc.log" a]
|
||||
|
||||
puts $fd "[clock format [clock seconds] -format "%D %T "] [string trim $replyData "{}"]"
|
||||
close $fd
|
||||
|
||||
return idle
|
||||
}
|
||||
|
||||
set ns ::::scobj::plc
|
||||
|
||||
hsetprop $scobj_hpath read ${ns}::getPlcValue getPlcValueState
|
||||
hsetprop $scobj_hpath getPlcValueState ${ns}::rdPlcValue
|
||||
|
||||
plc_chan poll $scobj_hpath 5
|
||||
|
||||
|
||||
Reference in New Issue
Block a user