Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
slu-shutter
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cs
ds
slu-shutter
Commits
30141c1d
Commit
30141c1d
authored
Jul 17, 2020
by
Milan Prica
⛷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
As currently deployed at FERMI.
parents
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
211 additions
and
0 deletions
+211
-0
Makefile
Makefile
+19
-0
README.md
README.md
+13
-0
src/SLUshutter.py
src/SLUshutter.py
+179
-0
No files found.
Makefile
0 → 100644
View file @
30141c1d
NAME
=
slushutter-srv
MAIN
=
SLUshutter.py
DIRNAME
=
$
(
NAME:-srv
=)
MODNAME
=
$(MAIN:.py=)
PY_FILES
+=
$(
wildcard
src/
*
.py
)
default
:
bin ${PY_FILES}
@
cp
${PY_FILES}
bin/
${DIRNAME}
@
echo
"#!/usr/bin/env python
\n
import sys
\n
sys.path.append(sys.path[0]+'/
${DIRNAME}
')
\n
from
${MODNAME}
import main
\n
if __name__ == '__main__':
\n
main()
\n
"
>
bin/
${NAME}
@
chmod
+x bin/
${NAME}
bin/
${DIRNAME}
/
${MAIN}
bin
:
@
test
-d
$@
||
mkdir
-p
$@
/
${DIRNAME}
clean
:
@
rm
-fr
bin/ src/
*
~
.PHONY
:
clean
README.md
0 → 100644
View file @
30141c1d
# SLU shutter
slushutter-srv -> SLUshutter.py
PyTango device with two commands: open(), close() that controls
the USER SEED LASER switch and reports the corresponding state
(OPEN/CLOSE).
Needed to allow the reuse of valves-like graphic inteface.
Has one device property:
Device name of the Tango device that actually controls the shutter.
(e.g. 'ldm/daq/executer_exp_daq' for LDM BL).
src/SLUshutter.py
0 → 100644
View file @
30141c1d
#!/usr/bin/env python
# "$Name: $";
# "$Header: /home/cvsadm/cvsroot/fermi/servers/slushutter/SLUshutter.py,v 1.1.1.1 2014-03-13 10:57:43 milan Exp $";
#=============================================================================
#
# file : SLUshutter.py
#
# description : Very simple Tango device with two basic commands:
# open and close and the corresponding state.
#
# project : TANGO Device Server
#
# $Author: milan $ Elettra SCI.COMP.GROUP.
#
# $Revision: 1.1.1.1 $
#
#=============================================================================
#
import
sys
import
PyTango
#==================================================================
# Device States Description:
# DevState.INIT: Initializing device
# DevState.OPEN : Shutter open
# DevState.CLOSE : Shutter closed
# DevState.FAULT : Connection lost
#==================================================================
class
SLUshutter
(
PyTango
.
Device_4Impl
):
#------------------------------------------------------------------
# Device constructor
#------------------------------------------------------------------
def
__init__
(
self
,
cl
,
name
):
print
'In Device constructor'
PyTango
.
Device_4Impl
.
__init__
(
self
,
cl
,
name
)
SLUshutter
.
init_device
(
self
)
#------------------------------------------------------------------
# Device destructor
#------------------------------------------------------------------
def
delete_device
(
self
):
print
"[Device delete_device method] for device"
,
self
.
get_name
()
#------------------------------------------------------------------
# Device initialization
#------------------------------------------------------------------
def
init_device
(
self
):
# print "In ", self.get_name(), "::init_device()"
self
.
set_state
(
PyTango
.
DevState
.
INIT
)
self
.
status_string
=
"Initializing device..."
self
.
get_device_properties
(
self
.
get_device_class
())
try
:
self
.
shutter_proxy
=
PyTango
.
DeviceProxy
(
self
.
ShutterDevice
)
if
self
.
shutter_proxy
.
SLU_shutter_opened
:
self
.
set_state
(
PyTango
.
DevState
.
OPEN
)
else
:
self
.
set_state
(
PyTango
.
DevState
.
CLOSE
)
except
PyTango
.
DevFailed
:
print
'proxy failed'
self
.
set_state
(
PyTango
.
DevState
.
FAULT
)
#------------------------------------------------------------------
# Always excuted hook method
#------------------------------------------------------------------
def
always_executed_hook
(
self
):
# print "In ", self.get_name(), "::always_executed_hook()"
try
:
if
self
.
shutter_proxy
.
SLU_shutter_opened
:
self
.
set_state
(
PyTango
.
DevState
.
OPEN
)
else
:
self
.
set_state
(
PyTango
.
DevState
.
CLOSE
)
except
PyTango
.
DevFailed
:
print
'proxy failed'
self
.
set_state
(
PyTango
.
DevState
.
FAULT
)
#==================================================================
#
# SLUshutter command methods
#
#==================================================================
#------------------------------------------------------------------
# Open command:
#
# Description: open shutter
#------------------------------------------------------------------
def
Open
(
self
):
print
"In "
,
self
.
get_name
(),
"::Open()"
try
:
self
.
shutter_proxy
.
SLU_shutter_opened
=
True
except
PyTango
.
DevFailed
:
print
'proxy failed'
self
.
set_state
(
PyTango
.
DevState
.
FAULT
)
#------------------------------------------------------------------
# Close command:
#
# Description: open shutter
#------------------------------------------------------------------
def
Close
(
self
):
print
"In "
,
self
.
get_name
(),
"::Close()"
try
:
self
.
shutter_proxy
.
SLU_shutter_opened
=
False
except
PyTango
.
DevFailed
:
print
'proxy failed'
self
.
set_state
(
PyTango
.
DevState
.
FAULT
)
#==================================================================
#
# SLUshutterClass class definition
#
#==================================================================
class
SLUshutterClass
(
PyTango
.
DeviceClass
):
# Class Properties
class_property_list
=
{
}
# Device Properties
device_property_list
=
{
'ShutterDevice'
:
[
PyTango
.
DevString
,
'TangoDevice that controls SLU shutter.'
,
'ldm/daq/executer_exp_daq'
],
}
# Command definitions
cmd_list
=
{
'Open'
:
[[
PyTango
.
DevVoid
,
'Open shutter'
],
[
PyTango
.
DevVoid
]],
'Close'
:
[[
PyTango
.
DevVoid
,
'Close shutter'
],
[
PyTango
.
DevVoid
]],
}
#------------------------------------------------------------------
# SLUshutterClass Constructor
#------------------------------------------------------------------
def
__init__
(
self
,
name
):
print
'In SLUshutterClass constructor'
PyTango
.
DeviceClass
.
__init__
(
self
,
name
)
self
.
set_type
(
name
);
#==================================================================
#
# SLUshutter class main method
#
#==================================================================
if
__name__
==
'__main__'
:
try
:
py
=
PyTango
.
Util
(
sys
.
argv
)
py
.
add_TgClass
(
SLUshutterClass
,
SLUshutter
,
'SLUshutter'
)
U
=
PyTango
.
Util
.
instance
()
U
.
server_init
()
U
.
server_run
()
except
PyTango
.
DevFailed
,
e
:
print
'-------> Received a DevFailed exception:'
,
e
except
Exception
,
e
:
print
'-------> An unforeseen exception occured....'
,
e
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment