Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tango
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
tango
Commits
86e5a13b
Commit
86e5a13b
authored
4 years ago
by
Jan David Mol
Browse files
Options
Downloads
Patches
Plain Diff
Removed PROTECTED REGION markers, as we're abandoning pogo
parent
5388fc9d
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
RCUSCC/RCUSCC/RCUSCC.py
+3
-54
3 additions, 54 deletions
RCUSCC/RCUSCC/RCUSCC.py
with
3 additions
and
54 deletions
RCUSCC/RCUSCC/RCUSCC.py
+
3
−
54
View file @
86e5a13b
...
...
@@ -21,7 +21,6 @@ from tango.server import device_property
from
tango
import
AttrQuality
,
DispLevel
,
DevState
from
tango
import
AttrWriteType
,
PipeWriteType
# Additional import
# PROTECTED REGION ID(RCUSCC.additionnal_import) ENABLED START #
import
sys
import
opcua
import
traceback
...
...
@@ -32,6 +31,8 @@ from threading import Thread
from
functools
import
wraps
import
socket
__all__
=
[
"
RCUSCC
"
,
"
main
"
]
def
only_when_on
(
func
):
"""
Wrapper to return None when the device isn
'
t in ON state.
...
...
@@ -65,9 +66,6 @@ def fault_on_opcua_error(func):
return
None
return
opcua_error_wrapper
# PROTECTED REGION END # // RCUSCC.additionnal_import
__all__
=
[
"
RCUSCC
"
,
"
main
"
]
class
OPCUAConnection
(
Thread
):
"""
...
...
@@ -156,11 +154,9 @@ class RCUSCC(Device):
OPC_Time_Out
- Type:
'
DevDouble
'
"""
# PROTECTED REGION ID(RCUSCC.class_variable) ENABLED START #
client
=
0
name_space_index
=
0
obj
=
0
# PROTECTED REGION END # // RCUSCC.class_variable
# -----------------
# Device Properties
...
...
@@ -315,7 +311,6 @@ class RCUSCC(Device):
"""
Initialises the attributes and properties of the RCUSCC.
"""
Device
.
init_device
(
self
)
# PROTECTED REGION ID(RCUSCC.init_device) ENABLED START #
self
.
set_state
(
DevState
.
INIT
)
# Init the dict that contains attribute to OPC-UA MP/CP mappings.
...
...
@@ -375,12 +370,10 @@ class RCUSCC(Device):
# Everything went ok -- go online
self
.
On
()
# PROTECTED REGION END # // RCUSCC.init_device
def
always_executed_hook
(
self
):
"""
Method always executed before any TANGO command is executed.
"""
# PROTECTED REGION ID(RCUSCC.always_executed_hook) ENABLED START #
# PROTECTED REGION END # // RCUSCC.always_executed_hook
pass
def
delete_device
(
self
):
"""
Hook to delete resources allocated in init_device.
...
...
@@ -389,12 +382,10 @@ class RCUSCC(Device):
init_device method to be released. This method is called by the device
destructor and by the device Init command.
"""
# PROTECTED REGION ID(RCUSCC.delete_device) ENABLED START #
self
.
debug_stream
(
"
Shutting down...
"
)
self
.
Off
()
self
.
debug_stream
(
"
Shut down. Good bye.
"
)
# PROTECTED REGION END # // RCUSCC.delete_device
# ------------------
# Attributes methods
# ------------------
...
...
@@ -402,142 +393,112 @@ class RCUSCC(Device):
@only_when_on
@fault_on_opcua_error
def
read_Attenuator_R
(
self
):
# PROTECTED REGION ID(RCUSCC.Attenuator_R_read) ENABLED START #
"""
Return the Attenuator_R attribute.
"""
self
.
_Attenuator_R
=
numpy
.
array
([
self
.
attribute_mapping
[
"
Attenuator_R
"
][
0
].
get_value
(),
self
.
attribute_mapping
[
"
Attenuator_R
"
][
1
].
get_value
(),
self
.
attribute_mapping
[
"
Attenuator_R
"
][
2
].
get_value
()])
return
self
.
_Attenuator_R
# PROTECTED REGION END # // RCUSCC.Attenuator_R_read
@only_when_on
@fault_on_opcua_error
def
read_Attenuator_RW
(
self
):
# PROTECTED REGION ID(RCUSCC.Attenuator_RW_read) ENABLED START #
"""
Return the Attenuator_R attribute.
"""
self
.
_Attenuator_RW
=
numpy
.
array
([
self
.
attribute_mapping
[
"
Attenuator_RW
"
][
0
].
get_value
(),
self
.
attribute_mapping
[
"
Attenuator_RW
"
][
1
].
get_value
(),
self
.
attribute_mapping
[
"
Attenuator_RW
"
][
2
].
get_value
()])
return
self
.
_Attenuator_RW
# PROTECTED REGION END # // RCUSCC.Attenuator_RW_read
@only_when_on
@fault_on_opcua_error
def
write_Attenuator_RW
(
self
,
value
):
# PROTECTED REGION ID(RCUSCC.Attenuator_RW_write) ENABLED START #
"""
Set the Attenuator_RW attribute.
"""
self
.
attribute_mapping
[
"
Attenuator_RW
"
][
0
].
set_value
(
value
[
0
])
self
.
attribute_mapping
[
"
Attenuator_RW
"
][
1
].
set_value
(
value
[
1
])
self
.
attribute_mapping
[
"
Attenuator_RW
"
][
2
].
set_value
(
value
[
2
])
self
.
_Attenuator_RW
=
value
# PROTECTED REGION END # // RCUSCC.Attenuator_RW_write
@only_when_on
@fault_on_opcua_error
def
read_Band_R
(
self
):
# PROTECTED REGION ID(RCUSCC.Band_R_read) ENABLED START #
"""
Return the Band_R attribute.
"""
self
.
_Band_R
=
numpy
.
array
([
self
.
attribute_mapping
[
"
Band_R
"
][
0
].
get_value
(),
self
.
attribute_mapping
[
"
Band_R
"
][
1
].
get_value
(),
self
.
attribute_mapping
[
"
Band_R
"
][
2
].
get_value
()])
return
self
.
_Band_R
# PROTECTED REGION END # // RCUSCC.Band_R_read
@only_when_on
@fault_on_opcua_error
def
read_Band_RW
(
self
):
# PROTECTED REGION ID(RCUSCC.Band_RW_read) ENABLED START #
"""
Return the Band_R attribute.
"""
self
.
_Band_RW
=
numpy
.
array
([
self
.
attribute_mapping
[
"
Band_RW
"
][
0
].
get_value
(),
self
.
attribute_mapping
[
"
Band_RW
"
][
1
].
get_value
(),
self
.
attribute_mapping
[
"
Band_RW
"
][
2
].
get_value
()])
return
self
.
_Band_RW
# PROTECTED REGION END # // RCUSCC.Band_RW_read
@only_when_on
@fault_on_opcua_error
def
write_Band_RW
(
self
,
value
):
# PROTECTED REGION ID(RCUSCC.Band_RW_write) ENABLED START #
"""
Set the Band_RW attribute.
"""
self
.
attribute_mapping
[
"
Band_RW
"
][
0
].
set_value
(
value
[
0
])
self
.
attribute_mapping
[
"
Band_RW
"
][
1
].
set_value
(
value
[
1
])
self
.
attribute_mapping
[
"
Band_RW
"
][
2
].
set_value
(
value
[
2
])
self
.
_Band_RW
=
value
# PROTECTED REGION END # // RCUSCC.Band_RW_write
@only_when_on
@fault_on_opcua_error
def
read_Dither_Frequency_R
(
self
):
# PROTECTED REGION ID(RCUSCC.Dither_Frequency_R_read) ENABLED START #
"""
Return the Dither_Frequency_R attribute.
"""
self
.
_Dither_Frequency_R
=
numpy
.
array
([
self
.
attribute_mapping
[
"
Dither_Frequency_R
"
][
0
].
get_value
(),
self
.
attribute_mapping
[
"
Dither_Frequency_R
"
][
1
].
get_value
()])
return
self
.
_Dither_Frequency_R
# PROTECTED REGION END # // RCUSCC.Dither_Frequency_R_read
@only_when_on
@fault_on_opcua_error
def
read_Dither_Frequency_RW
(
self
):
# PROTECTED REGION ID(RCUSCC.Dither_Frequency_RW_read) ENABLED START #
"""
Return the Dither_Frequency_R attribute.
"""
self
.
_Dither_Frequency_RW
=
numpy
.
array
([
self
.
attribute_mapping
[
"
Dither_Frequency_RW
"
][
0
].
get_value
(),
self
.
attribute_mapping
[
"
Dither_Frequency_RW
"
][
1
].
get_value
()])
return
self
.
_Dither_Frequency_RW
# PROTECTED REGION END # // RCUSCC.Dither_Frequency_RW_read
@only_when_on
@fault_on_opcua_error
def
write_Dither_Frequency_RW
(
self
,
value
):
# PROTECTED REGION ID(RCUSCC.Dither_Frequency_RW_write) ENABLED START #
"""
Set the Dither_Frequency_RW attribute.
"""
self
.
attribute_mapping
[
"
Dither_Frequency_RW
"
][
0
].
set_value
(
value
[
0
])
self
.
attribute_mapping
[
"
Dither_Frequency_RW
"
][
1
].
set_value
(
value
[
1
])
self
.
_Dither_Frequency_RW
=
value
# PROTECTED REGION END # // RCUSCC.Dither_Frequency_RW_write
@only_when_on
@fault_on_opcua_error
def
read_LED_R
(
self
):
# PROTECTED REGION ID(RCUSCC.LED_R_read) ENABLED START #
"""
Return the LED_R attribute.
"""
self
.
_LED_R
=
self
.
attribute_mapping
[
"
LED_R
"
].
get_value
()
return
self
.
_LED_R
# PROTECTED REGION END # // RCUSCC.LED_R_read
@only_when_on
@fault_on_opcua_error
def
read_LED_RW
(
self
):
# PROTECTED REGION ID(RCUSCC.LED_RW_read) ENABLED START #
"""
Return the LED_RW attribute.
"""
self
.
_LED_RW
=
self
.
attribute_mapping
[
"
LED_RW
"
].
get_value
()
return
self
.
_LED_RW
# PROTECTED REGION END # // RCUSCC.LED_RW_read
@only_when_on
@fault_on_opcua_error
def
write_LED_RW
(
self
,
value
):
# PROTECTED REGION ID(RCUSCC.LED_RW_write) ENABLED START #
"""
Set the LED_RW attribute.
"""
self
.
attribute_mapping
[
"
LED_RW
"
].
set_value
(
value
)
self
.
_LED_RW
=
value
# PROTECTED REGION END # // RCUSCC.LED_RW_write
@only_when_on
@fault_on_opcua_error
def
read_Pwr_dig_R
(
self
):
# PROTECTED REGION ID(RCUSCC.Pwr_dig_R_read) ENABLED START #
"""
Return the Pwr_dig_R attribute.
"""
self
.
_Pwr_dig_R
=
self
.
attribute_mapping
[
"
Pwr_dig_R
"
].
get_value
()
return
self
.
_Pwr_dig_R
# PROTECTED REGION END # // RCUSCC.Pwr_dig_R_read
@only_when_on
@fault_on_opcua_error
def
read_Temperature_R
(
self
):
# PROTECTED REGION ID(RCUSCC.Temperature_R_read) ENABLED START #
"""
Return the Temperature_R attribute.
"""
self
.
_Temperature_R
=
self
.
attribute_mapping
[
"
Temperature_R
"
].
get_value
()
return
self
.
_Temperature_R
# PROTECTED REGION END # // RCUSCC.Temperature_R_read
@only_when_on
@fault_on_opcua_error
def
read_CLK_PLL_locked_R
(
self
):
# PROTECTED REGION ID(RCUSCC.CLK_PLL_locked_R_read) ENABLED START #
"""
Return the CLK_PLL_locked_R attribute.
"""
self
.
_CLK_PLL_locked_R
=
self
.
attribute_mapping
[
"
CLK_PLL_locked_R
"
].
get_value
()
return
self
.
_CLK_PLL_locked_R
# PROTECTED REGION END # // RCUSCC.CLK_PLL_locked_R_read
# --------
...
...
@@ -548,19 +509,16 @@ class RCUSCC(Device):
)
@DebugIt
()
def
On
(
self
):
# PROTECTED REGION ID(RCUSCC.On) ENABLED START #
"""
:return:None
"""
self
.
set_state
(
DevState
.
ON
)
# PROTECTED REGION END # // RCUSCC..On
@command
(
)
@DebugIt
()
def
Off
(
self
):
# PROTECTED REGION ID(RCUSCC.Off) ENABLED START #
"""
:return:None
...
...
@@ -574,13 +532,11 @@ class RCUSCC(Device):
# Turn off again, in case of race conditions through reconnecting
self
.
set_state
(
DevState
.
OFF
)
# PROTECTED REGION END # // RCUSCC.Off
@command
(
)
@DebugIt
()
def
Fault
(
self
):
# PROTECTED REGION ID(RCUSCC.On) ENABLED START #
"""
FAULT state is used to indicate our connection with the OPC-UA server is down.
...
...
@@ -589,31 +545,26 @@ class RCUSCC(Device):
:return:None
"""
self
.
set_state
(
DevState
.
FAULT
)
# PROTECTED REGION END # // RCUSCC..On
@command
(
)
@DebugIt
()
def
RCU_off
(
self
):
# PROTECTED REGION ID(RCUSCC.RCU_off) ENABLED START #
"""
:return:None
"""
# self.attribute_mapping["RCU_off"]()
# PROTECTED REGION END # // RCUSCC.RCU_off
@command
(
)
@DebugIt
()
def
RCU_on
(
self
):
# PROTECTED REGION ID(RCUSCC.RCU_on) ENABLED START #
"""
:return:None
"""
# self.attribute_mapping["RCU_on"]()
# PROTECTED REGION END # // RCUSCC.RCU_on
# ----------
...
...
@@ -623,9 +574,7 @@ class RCUSCC(Device):
def
main
(
args
=
None
,
**
kwargs
):
"""
Main function of the RCUSCC module.
"""
# PROTECTED REGION ID(RCUSCC.main) ENABLED START #
return
run
((
RCUSCC
,),
args
=
args
,
**
kwargs
)
# PROTECTED REGION END # // RCUSCC.main
if
__name__
==
'
__main__
'
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment