Skip to content
GitLab
Explore
Sign in
Register
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
6eb17604
Commit
6eb17604
authored
4 years ago
by
Thomas Juerges
Browse files
Options
Downloads
Patches
Plain Diff
Finished refactoring for pypcc2 with a lot of help from Jan David and Thijs
parent
928af3d1
No related branches found
No related tags found
1 merge request
!2
Refactor for Paulus' pypcc2 version with arrays
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
RCUSCC/RCUSCC/RCUSCC.py
+49
-43
49 additions, 43 deletions
RCUSCC/RCUSCC/RCUSCC.py
with
49 additions
and
43 deletions
RCUSCC/RCUSCC/RCUSCC.py
+
49
−
43
View file @
6eb17604
...
@@ -78,29 +78,29 @@ class RCUSCC(Device):
...
@@ -78,29 +78,29 @@ class RCUSCC(Device):
Ant_mask_RW
=
attribute
(
Ant_mask_RW
=
attribute
(
dtype
=
((
'
DevBoolean
'
,),),
dtype
=
((
'
DevBoolean
'
,),),
max_dim_x
=
3
2
,
max_dim_y
=
3
,
max_dim_x
=
3
,
max_dim_y
=
3
2
,
access
=
AttrWriteType
.
READ_WRITE
,
access
=
AttrWriteType
.
READ_WRITE
,
)
)
RCU_attenuator_R
=
attribute
(
RCU_attenuator_R
=
attribute
(
dtype
=
((
'
DevLong64
'
,),),
dtype
=
((
'
DevLong64
'
,),),
max_dim_x
=
3
2
,
max_dim_y
=
3
,
max_dim_x
=
3
,
max_dim_y
=
3
2
,
)
)
RCU_attenuator_RW
=
attribute
(
RCU_attenuator_RW
=
attribute
(
dtype
=
((
'
DevLong64
'
,),),
dtype
=
((
'
DevLong64
'
,),),
max_dim_x
=
3
2
,
max_dim_y
=
3
,
max_dim_x
=
3
,
max_dim_y
=
3
2
,
access
=
AttrWriteType
.
READ_WRITE
,
access
=
AttrWriteType
.
READ_WRITE
,
)
)
RCU_band_R
=
attribute
(
RCU_band_R
=
attribute
(
dtype
=
((
'
DevLong64
'
,),),
dtype
=
((
'
DevLong64
'
,),),
max_dim_x
=
3
2
,
max_dim_y
=
3
,
max_dim_x
=
3
,
max_dim_y
=
3
2
,
)
)
RCU_band_RW
=
attribute
(
RCU_band_RW
=
attribute
(
dtype
=
((
'
DevLong64
'
,),),
dtype
=
((
'
DevLong64
'
,),),
max_dim_x
=
3
2
,
max_dim_y
=
3
,
max_dim_x
=
3
,
max_dim_y
=
3
2
,
access
=
AttrWriteType
.
READ_WRITE
,
access
=
AttrWriteType
.
READ_WRITE
,
)
)
...
@@ -127,32 +127,32 @@ class RCUSCC(Device):
...
@@ -127,32 +127,32 @@ class RCUSCC(Device):
RCU_ADC_lock_R
=
attribute
(
RCU_ADC_lock_R
=
attribute
(
dtype
=
((
'
DevLong64
'
,),),
dtype
=
((
'
DevLong64
'
,),),
max_dim_x
=
3
2
,
max_dim_y
=
3
,
max_dim_x
=
3
,
max_dim_y
=
3
2
,
)
)
RCU_ADC_SYNC_R
=
attribute
(
RCU_ADC_SYNC_R
=
attribute
(
dtype
=
((
'
DevLong64
'
,),),
dtype
=
((
'
DevLong64
'
,),),
max_dim_x
=
3
2
,
max_dim_y
=
3
,
max_dim_x
=
3
,
max_dim_y
=
3
2
,
)
)
RCU_ADC_JESD_R
=
attribute
(
RCU_ADC_JESD_R
=
attribute
(
dtype
=
((
'
DevLong64
'
,),),
dtype
=
((
'
DevLong64
'
,),),
max_dim_x
=
3
2
,
max_dim_y
=
3
,
max_dim_x
=
3
,
max_dim_y
=
3
2
,
)
)
RCU_ADC_CML_R
=
attribute
(
RCU_ADC_CML_R
=
attribute
(
dtype
=
((
'
DevLong64
'
,),),
dtype
=
((
'
DevLong64
'
,),),
max_dim_x
=
3
2
,
max_dim_y
=
3
,
max_dim_x
=
3
,
max_dim_y
=
3
2
,
)
)
RCU_OUT1_R
=
attribute
(
RCU_OUT1_R
=
attribute
(
dtype
=
((
'
DevLong64
'
,),),
dtype
=
((
'
DevLong64
'
,),),
max_dim_x
=
3
2
,
max_dim_y
=
3
,
max_dim_x
=
3
,
max_dim_y
=
3
2
,
)
)
RCU_OUT2_R
=
attribute
(
RCU_OUT2_R
=
attribute
(
dtype
=
((
'
DevLong64
'
,),),
dtype
=
((
'
DevLong64
'
,),),
max_dim_x
=
3
2
,
max_dim_y
=
3
,
max_dim_x
=
3
,
max_dim_y
=
3
2
,
)
)
RCU_ID_R
=
attribute
(
RCU_ID_R
=
attribute
(
...
@@ -161,8 +161,8 @@ class RCUSCC(Device):
...
@@ -161,8 +161,8 @@ class RCUSCC(Device):
)
)
RCU_version_R
=
attribute
(
RCU_version_R
=
attribute
(
dtype
=
(
(
'
Dev
UChar
'
,)
,),
dtype
=
(
'
Dev
String
'
,),
max_dim_x
=
32
,
max_dim_y
=
10
,
max_dim_x
=
32
,
)
)
RCU_monitor_rate_RW
=
attribute
(
RCU_monitor_rate_RW
=
attribute
(
...
@@ -257,61 +257,61 @@ class RCUSCC(Device):
...
@@ -257,61 +257,61 @@ class RCUSCC(Device):
# Set default values in the RW/R attributes and add them to
# Set default values in the RW/R attributes and add them to
# the mapping.
# the mapping.
self
.
_RCU_mask_RW
=
((
0
,),
)
self
.
_RCU_mask_RW
=
numpy
.
full
(
32
,
False
)
self
.
attribute_mapping
[
"
RCU_mask_RW
"
]
=
{}
self
.
attribute_mapping
[
"
RCU_mask_RW
"
]
=
{}
self
.
_Ant_mask_RW
=
((
0
,),
)
self
.
_Ant_mask_RW
=
numpy
.
full
((
32
,
3
),
False
)
self
.
attribute_mapping
[
"
Ant_mask_RW
"
]
=
{}
self
.
attribute_mapping
[
"
Ant_mask_RW
"
]
=
{}
self
.
_RCU_attenuator_R
=
((
0
,),
)
self
.
_RCU_attenuator_R
=
numpy
.
full
((
32
,
3
),
0
)
self
.
attribute_mapping
[
"
RCU_attenuator_R
"
]
=
{}
self
.
attribute_mapping
[
"
RCU_attenuator_R
"
]
=
{}
self
.
_RCU_attenuator_RW
=
((
0
,),
)
self
.
_RCU_attenuator_RW
=
numpy
.
full
((
32
,
3
),
0
)
self
.
attribute_mapping
[
"
RCU_attenuator_RW
"
]
=
{}
self
.
attribute_mapping
[
"
RCU_attenuator_RW
"
]
=
{}
self
.
_RCU_band_R
=
((
0
,),
)
self
.
_RCU_band_R
=
numpy
.
full
((
32
,
3
),
0
)
self
.
attribute_mapping
[
"
RCU_band_R
"
]
=
{}
self
.
attribute_mapping
[
"
RCU_band_R
"
]
=
{}
self
.
_RCU_band_RW
=
((
0
,),
)
self
.
_RCU_band_RW
=
numpy
.
full
((
32
,
3
),
0
)
self
.
attribute_mapping
[
"
RCU_band_RW
"
]
=
{}
self
.
attribute_mapping
[
"
RCU_band_RW
"
]
=
{}
self
.
_RCU_temperature_R
=
(
0.0
,
)
self
.
_RCU_temperature_R
=
numpy
.
full
((
32
,
3
),
0.0
)
self
.
attribute_mapping
[
"
RCU_temperature_R
"
]
=
{}
self
.
attribute_mapping
[
"
RCU_temperature_R
"
]
=
{}
self
.
_RCU_Pwr_dig_R
=
(
0
,
)
self
.
_RCU_Pwr_dig_R
=
numpy
.
full
(
32
,
0
)
self
.
attribute_mapping
[
"
RCU_Pwr_dig_R
"
]
=
{}
self
.
attribute_mapping
[
"
RCU_Pwr_dig_R
"
]
=
{}
self
.
_RCU_LED0_R
=
((
0
,),
)
self
.
_RCU_LED0_R
=
numpy
.
full
(
32
,
0
)
self
.
attribute_mapping
[
"
RCU_LED0_R
"
]
=
{}
self
.
attribute_mapping
[
"
RCU_LED0_R
"
]
=
{}
self
.
_RCU_LED0_RW
=
((
0
,),
)
self
.
_RCU_LED0_RW
=
numpy
.
full
(
32
,
0
)
self
.
attribute_mapping
[
"
RCU_LED0_RW
"
]
=
{}
self
.
attribute_mapping
[
"
RCU_LED0_RW
"
]
=
{}
self
.
_RCU_ADC_lock_R
=
((
0
,),
)
self
.
_RCU_ADC_lock_R
=
numpy
.
full
((
32
,
3
),
0
)
self
.
attribute_mapping
[
"
RCU_ADC_lock_R
"
]
=
{}
self
.
attribute_mapping
[
"
RCU_ADC_lock_R
"
]
=
{}
self
.
_RCU_ADC_SYNC_R
=
((
0
,),
)
self
.
_RCU_ADC_SYNC_R
=
numpy
.
full
((
32
,
3
),
0
)
self
.
attribute_mapping
[
"
RCU_ADC_SYNC_R
"
]
=
{}
self
.
attribute_mapping
[
"
RCU_ADC_SYNC_R
"
]
=
{}
self
.
_RCU_ADC_JESD_R
=
((
0
,),
)
self
.
_RCU_ADC_JESD_R
=
numpy
.
full
((
32
,
3
),
0
)
self
.
attribute_mapping
[
"
RCU_ADC_JESD_R
"
]
=
{}
self
.
attribute_mapping
[
"
RCU_ADC_JESD_R
"
]
=
{}
self
.
_RCU_ADC_CML_R
=
((
0
,),
)
self
.
_RCU_ADC_CML_R
=
numpy
.
full
((
32
,
3
),
0
)
self
.
attribute_mapping
[
"
RCU_ADC_CML_R
"
]
=
{}
self
.
attribute_mapping
[
"
RCU_ADC_CML_R
"
]
=
{}
self
.
_RCU_OUT1_R
=
((
0
,),
)
self
.
_RCU_OUT1_R
=
numpy
.
full
((
32
,
3
),
0
)
self
.
attribute_mapping
[
"
RCU_OUT1_R
"
]
=
{}
self
.
attribute_mapping
[
"
RCU_OUT1_R
"
]
=
{}
self
.
_RCU_OUT2_R
=
((
0
,),
)
self
.
_RCU_OUT2_R
=
numpy
.
full
((
32
,
3
),
0
)
self
.
attribute_mapping
[
"
RCU_OUT2_R
"
]
=
{}
self
.
attribute_mapping
[
"
RCU_OUT2_R
"
]
=
{}
self
.
_RCU_ID_R
=
((
0
,),
)
self
.
_RCU_ID_R
=
numpy
.
full
(
32
,
0
)
self
.
attribute_mapping
[
"
RCU_ID_R
"
]
=
{}
self
.
attribute_mapping
[
"
RCU_ID_R
"
]
=
{}
self
.
_RCU_version_R
=
((
0
,),
)
self
.
_RCU_version_R
=
numpy
.
full
(
32
,
"
1234567890
"
)
self
.
attribute_mapping
[
"
RCU_version_R
"
]
=
{}
self
.
attribute_mapping
[
"
RCU_version_R
"
]
=
{}
self
.
_RCU_monitor_rate_RW
=
0.0
self
.
_RCU_monitor_rate_RW
=
6
0.0
self
.
attribute_mapping
[
"
RCU_monitor_rate_RW
"
]
=
{}
self
.
attribute_mapping
[
"
RCU_monitor_rate_RW
"
]
=
{}
# Init the dict that contains function to OPC-UA function mappings.
# Init the dict that contains function to OPC-UA function mappings.
...
@@ -345,6 +345,12 @@ class RCUSCC(Device):
...
@@ -345,6 +345,12 @@ class RCUSCC(Device):
# Everything went ok -- go online
# Everything went ok -- go online
self
.
On
()
self
.
On
()
# Set the masks
# TODO
# Read default masks from config DB
self
.
write_RCU_mask_RW
(
self
.
_RCU_mask_RW
)
self
.
write_Ant_mask_RW
(
self
.
_Ant_mask_RW
)
@DebugIt
()
@DebugIt
()
def
On
(
self
):
def
On
(
self
):
"""
"""
...
@@ -399,7 +405,7 @@ class RCUSCC(Device):
...
@@ -399,7 +405,7 @@ class RCUSCC(Device):
def
read_Ant_mask_R
(
self
):
def
read_Ant_mask_R
(
self
):
"""
Return the Ant_mask_R attribute.
"""
"""
Return the Ant_mask_R attribute.
"""
value
=
numpy
.
array
(
self
.
attribute_mapping
[
"
Ant_mask_R
"
].
get_value
())
value
=
numpy
.
array
(
self
.
attribute_mapping
[
"
Ant_mask_R
"
].
get_value
())
self
.
_Ant_mask_R
=
numpy
.
split
(
value
,
indices_or_sections
=
32
)
self
.
_Ant_mask_R
=
numpy
.
array
(
numpy
.
split
(
value
,
indices_or_sections
=
32
)
)
return
self
.
_Ant_mask_R
return
self
.
_Ant_mask_R
@only_when_on
@only_when_on
...
@@ -421,7 +427,7 @@ class RCUSCC(Device):
...
@@ -421,7 +427,7 @@ class RCUSCC(Device):
def
read_RCU_attenuator_R
(
self
):
def
read_RCU_attenuator_R
(
self
):
"""
Return the RCU_attenuator_R attribute.
"""
"""
Return the RCU_attenuator_R attribute.
"""
value
=
numpy
.
array
(
self
.
attribute_mapping
[
"
RCU_attenuator_R
"
].
get_value
())
value
=
numpy
.
array
(
self
.
attribute_mapping
[
"
RCU_attenuator_R
"
].
get_value
())
self
.
_RCU_attenuator_R
=
numpy
.
split
(
value
,
indices_or_sections
=
32
)
self
.
_RCU_attenuator_R
=
numpy
.
array
(
numpy
.
split
(
value
,
indices_or_sections
=
32
)
)
return
self
.
_RCU_attenuator_R
return
self
.
_RCU_attenuator_R
@only_when_on
@only_when_on
...
@@ -443,7 +449,7 @@ class RCUSCC(Device):
...
@@ -443,7 +449,7 @@ class RCUSCC(Device):
def
read_RCU_band_R
(
self
):
def
read_RCU_band_R
(
self
):
"""
Return the RCU_band_R attribute.
"""
"""
Return the RCU_band_R attribute.
"""
value
=
numpy
.
array
(
self
.
attribute_mapping
[
"
RCU_band_R
"
].
get_value
())
value
=
numpy
.
array
(
self
.
attribute_mapping
[
"
RCU_band_R
"
].
get_value
())
self
.
_RCU_band_R
=
numpy
.
split
(
value
,
indices_or_sections
=
32
)
self
.
_RCU_band_R
=
numpy
.
array
(
numpy
.
split
(
value
,
indices_or_sections
=
32
)
)
return
self
.
_RCU_band_R
return
self
.
_RCU_band_R
@only_when_on
@only_when_on
...
@@ -499,7 +505,7 @@ class RCUSCC(Device):
...
@@ -499,7 +505,7 @@ class RCUSCC(Device):
def
read_RCU_ADC_lock_R
(
self
):
def
read_RCU_ADC_lock_R
(
self
):
"""
Return the RCU_ADC_lock_R attribute.
"""
"""
Return the RCU_ADC_lock_R attribute.
"""
value
=
numpy
.
array
(
self
.
attribute_mapping
[
"
RCU_ADC_lock_R
"
].
get_value
())
value
=
numpy
.
array
(
self
.
attribute_mapping
[
"
RCU_ADC_lock_R
"
].
get_value
())
self
.
_RCU_ADC_lock_R
=
numpy
.
split
(
value
,
indices_or_sections
=
32
)
self
.
_RCU_ADC_lock_R
=
numpy
.
array
(
numpy
.
split
(
value
,
indices_or_sections
=
32
)
)
return
self
.
_RCU_ADC_lock_R
return
self
.
_RCU_ADC_lock_R
@only_when_on
@only_when_on
...
@@ -507,7 +513,7 @@ class RCUSCC(Device):
...
@@ -507,7 +513,7 @@ class RCUSCC(Device):
def
read_RCU_ADC_SYNC_R
(
self
):
def
read_RCU_ADC_SYNC_R
(
self
):
"""
Return the RCU_ADC_SYNC_R attribute.
"""
"""
Return the RCU_ADC_SYNC_R attribute.
"""
value
=
numpy
.
array
(
self
.
attribute_mapping
[
"
RCU_ADC_SYNC_R
"
].
get_value
())
value
=
numpy
.
array
(
self
.
attribute_mapping
[
"
RCU_ADC_SYNC_R
"
].
get_value
())
self
.
_RCU_ADC_SYNC_R
=
numpy
.
split
(
value
,
indices_or_sections
=
32
)
self
.
_RCU_ADC_SYNC_R
=
numpy
.
array
(
numpy
.
split
(
value
,
indices_or_sections
=
32
)
)
return
self
.
_RCU_ADC_SYNC_R
return
self
.
_RCU_ADC_SYNC_R
@only_when_on
@only_when_on
...
@@ -515,7 +521,7 @@ class RCUSCC(Device):
...
@@ -515,7 +521,7 @@ class RCUSCC(Device):
def
read_RCU_ADC_JESD_R
(
self
):
def
read_RCU_ADC_JESD_R
(
self
):
"""
Return the RCU_ADC_JESD_R attribute.
"""
"""
Return the RCU_ADC_JESD_R attribute.
"""
value
=
numpy
.
array
(
self
.
attribute_mapping
[
"
RCU_ADC_JESD_R
"
].
get_value
())
value
=
numpy
.
array
(
self
.
attribute_mapping
[
"
RCU_ADC_JESD_R
"
].
get_value
())
self
.
_RCU_ADC_JESD_R
=
numpy
.
split
(
value
,
indices_or_sections
=
32
)
self
.
_RCU_ADC_JESD_R
=
numpy
.
array
(
numpy
.
split
(
value
,
indices_or_sections
=
32
)
)
return
self
.
_RCU_ADC_JESD_R
return
self
.
_RCU_ADC_JESD_R
@only_when_on
@only_when_on
...
@@ -523,7 +529,7 @@ class RCUSCC(Device):
...
@@ -523,7 +529,7 @@ class RCUSCC(Device):
def
read_RCU_ADC_CML_R
(
self
):
def
read_RCU_ADC_CML_R
(
self
):
"""
Return the RCU_ADC_CML_R attribute.
"""
"""
Return the RCU_ADC_CML_R attribute.
"""
value
=
numpy
.
array
(
self
.
attribute_mapping
[
"
RCU_ADC_CML_R
"
].
get_value
())
value
=
numpy
.
array
(
self
.
attribute_mapping
[
"
RCU_ADC_CML_R
"
].
get_value
())
self
.
_RCU_ADC_CML_R
=
numpy
.
split
(
value
,
indices_or_sections
=
32
)
self
.
_RCU_ADC_CML_R
=
numpy
.
array
(
numpy
.
split
(
value
,
indices_or_sections
=
32
)
)
return
self
.
_RCU_ADC_CML_R
return
self
.
_RCU_ADC_CML_R
@only_when_on
@only_when_on
...
@@ -531,7 +537,7 @@ class RCUSCC(Device):
...
@@ -531,7 +537,7 @@ class RCUSCC(Device):
def
read_RCU_OUT1_R
(
self
):
def
read_RCU_OUT1_R
(
self
):
"""
Return the RCU_OUT1_R attribute.
"""
"""
Return the RCU_OUT1_R attribute.
"""
value
=
numpy
.
array
(
self
.
attribute_mapping
[
"
RCU_OUT1_R
"
].
get_value
())
value
=
numpy
.
array
(
self
.
attribute_mapping
[
"
RCU_OUT1_R
"
].
get_value
())
self
.
_RCU_OUT1_R
=
numpy
.
split
(
value
,
indices_or_sections
=
32
)
self
.
_RCU_OUT1_R
=
numpy
.
array
(
numpy
.
split
(
value
,
indices_or_sections
=
32
)
)
return
self
.
_RCU_OUT1_R
return
self
.
_RCU_OUT1_R
@only_when_on
@only_when_on
...
@@ -539,7 +545,7 @@ class RCUSCC(Device):
...
@@ -539,7 +545,7 @@ class RCUSCC(Device):
def
read_RCU_OUT2_R
(
self
):
def
read_RCU_OUT2_R
(
self
):
"""
Return the RCU_OUT2_R attribute.
"""
"""
Return the RCU_OUT2_R attribute.
"""
value
=
numpy
.
array
(
self
.
attribute_mapping
[
"
RCU_OUT2_R
"
].
get_value
())
value
=
numpy
.
array
(
self
.
attribute_mapping
[
"
RCU_OUT2_R
"
].
get_value
())
self
.
_RCU_OUT2_R
=
numpy
.
split
(
value
,
indices_or_sections
=
32
)
self
.
_RCU_OUT2_R
=
numpy
.
array
(
numpy
.
split
(
value
,
indices_or_sections
=
32
)
)
return
self
.
_RCU_OUT2_R
return
self
.
_RCU_OUT2_R
@only_when_on
@only_when_on
...
@@ -553,8 +559,8 @@ class RCUSCC(Device):
...
@@ -553,8 +559,8 @@ class RCUSCC(Device):
@fault_on_error
@fault_on_error
def
read_RCU_version_R
(
self
):
def
read_RCU_version_R
(
self
):
"""
Return the RCU_version_R attribute.
"""
"""
Return the RCU_version_R attribute.
"""
value
=
self
.
_RCU_version_R
=
numpy
.
array
(
self
.
attribute_mapping
[
"
RCU_version_R
"
].
get_value
()
)
value
=
self
.
attribute_mapping
[
"
RCU_version_R
"
].
get_value
()
self
.
_RCU_version_R
=
numpy
.
split
(
value
,
indices_or_sections
=
32
)
self
.
_RCU_version_R
=
numpy
.
array
(
value
)
return
self
.
_RCU_version_R
return
self
.
_RCU_version_R
@only_when_on
@only_when_on
...
...
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