Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bliss
bliss
Commits
eed6d803
Commit
eed6d803
authored
May 10, 2021
by
Cyril Guilloud
Browse files
* add 2s delay before to check mode to bypass tango server issue
* comments
parent
028e3d7f
Changes
2
Hide whitespace changes
Inline
Side-by-side
bliss/controllers/tango_shutter.py
View file @
eed6d803
...
...
@@ -18,13 +18,13 @@ Example yml file:
# front end shutter
class: TangoShutter
name: frontend
uri: //orion:10000/fe/master/id
30
uri: //orion:10000/fe/master/id
42
-
# safety shutter
class: TangoShutter
name: safshut
uri: id
30
/bsh/1
uri: id
42
/bsh/1
"""
from
enum
import
Enum
...
...
@@ -196,7 +196,14 @@ class TangoShutter(BaseShutter):
@
property
def
mode
(
self
):
""" Get the opening mode. (only for FrontEnd).
"""
Get or set the opening mode of the FrontEnd.
state is read from tango attribute: `automatic_mode`.
Only available for FrontEnd shutters.
Parameters:
mode: (str): 'MANUAL' or 'AUTOMATIC'
Raises:
NotImplementedError: Not a Frontend shutter
"""
...
...
@@ -212,11 +219,6 @@ class TangoShutter(BaseShutter):
@
mode
.
setter
def
mode
(
self
,
mode
):
"""Set the opening mode (only for FrontEnd).
Args:
mode (str): MANUAL or AUTOMATIC
Raises: NotImplementedError: Not a Fronend shutter.
"""
if
not
self
.
frontend
:
raise
NotImplementedError
(
"Not a Frontend shutter"
)
...
...
@@ -225,9 +227,12 @@ class TangoShutter(BaseShutter):
self
.
__control
.
manual
()
elif
mode
==
"AUTOMATIC"
:
self
.
__control
.
automatic
()
else
:
raise
RuntimeError
(
f
"Unknown mode:
{
mode
}
"
)
self
.
_wait_mode
(
mode
=
mode
)
except
DevFailed
:
raise
RuntimeError
(
f
"Cannot set
{
mode
}
opening"
)
except
DevFailed
as
df_err
:
raise
RuntimeError
(
f
"Cannot set
{
mode
}
opening"
)
from
df_err
def
reset
(
self
):
"""Reset
...
...
@@ -251,9 +256,25 @@ class TangoShutter(BaseShutter):
self
.
_state_changed
(
self
.
state
)
def
_wait_mode
(
self
,
mode
,
timeout
=
3
):
with
Timeout
(
timeout
,
RuntimeError
(
f
"Cannot set
{
mode
}
opening"
)):
"""
Wait until set mode is equal to read mode.
"""
with
Timeout
(
timeout
,
RuntimeError
(
f
"Cannot set
{
mode
}
opening mode"
)):
# FE tango server feature: 'automatic_mode' goes True even
# if it's not allowed (ex: MDT)
# It switches back to False after ~1 second.
# So this method can return without error even if AUTOMATIC
# mode is not set properly.
sleep
(
2
)
# to be removed when FE tango server will be fixed.
while
self
.
mode
!=
mode
:
sleep
(
1
)
# print(f"{self.mode} != {mode}") # to be removed when FE tango server will be fixed.
sleep
(
0.2
)
# for i in range(100): # to be removed when FE tango server will be fixed.
# print(f"{self.mode} =? {mode}") # to be removed when FE tango server will be fixed.
# sleep(0.05) # to be removed when FE tango server will be fixed.
def
__enter__
(
self
):
self
.
open
()
...
...
doc/docs/config_shutter.md
View file @
eed6d803
...
...
@@ -178,12 +178,6 @@ Some commands/attributes (like `automatic`/`manual`) are only implemented in the
front end device server, set by the
`_frontend`
variable.
### FrontEnd mode
If a
`TangoShutter`
is a FrontEnd, a special attribute
`mode`
is usable.
It can be :
`MANUAL`
`AUTOMATIC`
or
`UNKNOWN`
### Usage examples
Example with a safety shutter:
...
...
@@ -215,38 +209,11 @@ DEMO [12]: rv9.open()
WARNING
2020
-
03
-
19
00
:
13
:
23
,
937
global
.
controllers
.
rv9
:
rv9
already
open
,
command
ignored
```
Example with a FrontEnd shutter:
```
python
DEMO
[
3
]:
fe
Out
[
3
]:
State
:
Fault
on
Front
End
Mode
:
No
mode
is
validated
!
Automatic
:
Automatic
opening
off
Type
:
UHV
Module
1
Gate
Valve
1
:
Open
Module
2
Gate
Valve
1
:
Close
Fault
,
pending
interlocks
are
:
Beam
permission
loop
was
opened
!
Cooling
fault
on
module1
fixed
absorber
Interlock
from
personal
safety
system
```
To change the opening mode of a
`FrontEnd`
shutter:
```
python
DEMO
[
3
]:
fe
.
mode
=
fe
.
MANUAL
fe
mode
was
AUTOMATIC
and
is
now
MANUAL
```
Example (during a shutdown):
```
python
DEMO
[
7
]:
fe
.
mode
=
fe
.
AUTOMATIC
!!!
===
RuntimeError
:
Cannot
set
AUTOMATIC
opening
===
!!!
```
### Configuration examples
Safety shutter and FrontEnd:
```
yaml
-
name
:
safshut
...
...
@@ -261,6 +228,7 @@ DEMO [7]: fe.mode = fe.AUTOMATIC
```
Remote valves:
```
yaml
-
name
:
rv0
...
...
@@ -275,3 +243,40 @@ DEMO [7]: fe.mode = fe.AUTOMATIC
class
:
TangoShutter
uri
:
id42/v-rv/2
```
### FrontEnd mode
If a
`TangoShutter`
is a FrontEnd, a special attribute
`mode`
is usable to
activate or deactivate the automatic openning mode.
It can be :
`MANUAL`
`AUTOMATIC`
or
`UNKNOWN`
Example:
```
python
DEMO
[
3
]:
fe
Out
[
3
]:
State
:
Fault
on
Front
End
Mode
:
No
mode
is
validated
!
Automatic
:
Automatic
opening
off
Type
:
UHV
Module
1
Gate
Valve
1
:
Open
Module
2
Gate
Valve
1
:
Close
Fault
,
pending
interlocks
are
:
Beam
permission
loop
was
opened
!
Cooling
fault
on
module1
fixed
absorber
Interlock
from
personal
safety
system
```
To change the opening mode of a
`FrontEnd`
shutter:
```
python
DEMO
[
3
]:
fe
.
mode
=
"MANUAL"
fe
mode
was
AUTOMATIC
and
is
now
MANUAL
```
Example (during a shutdown):
```
python
DEMO
[
7
]:
fe
.
mode
=
"AUTOMATIC"
!!!
===
RuntimeError
:
Cannot
set
AUTOMATIC
opening
===
!!!
```
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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