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
1aca240a
Commit
1aca240a
authored
4 years ago
by
Thomas Juerges
Browse files
Options
Downloads
Patches
Plain Diff
Add new MPs/CPs
Worth mentioning: added weights, 2 * 488 * 12 * 16 int16_t.
parent
e6b3ce1a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
SDP/SDP/SDP.py
+101
-9
101 additions, 9 deletions
SDP/SDP/SDP.py
with
101 additions
and
9 deletions
SDP/SDP/SDP.py
+
101
−
9
View file @
1aca240a
...
@@ -94,15 +94,15 @@ class SDP(Device):
...
@@ -94,15 +94,15 @@ class SDP(Device):
access
=
AttrWriteType
.
READ_WRITE
,
access
=
AttrWriteType
.
READ_WRITE
,
)
)
fpga_scrap_R
W
=
attribute
(
fpga_scrap_R
=
attribute
(
dtype
=
(
'
DevLong
'
,),
dtype
=
(
'
DevLong
'
,),
max_dim_x
=
2048
,
max_dim_x
=
2048
,
access
=
AttrWriteType
.
READ_WRITE
,
)
)
fpga_scrap_R
=
attribute
(
fpga_scrap_R
W
=
attribute
(
dtype
=
(
'
DevLong
'
,),
dtype
=
(
'
DevLong
'
,),
max_dim_x
=
2048
,
max_dim_x
=
2048
,
access
=
AttrWriteType
.
READ_WRITE
,
)
)
fpga_status_R
=
attribute
(
fpga_status_R
=
attribute
(
...
@@ -120,6 +120,33 @@ class SDP(Device):
...
@@ -120,6 +120,33 @@ class SDP(Device):
max_dim_x
=
16
,
max_dim_x
=
16
,
)
)
fpga_weights_R
=
attribute
(
dtype
=
((
'
DevShort
'
,),),
max_dim_x
=
12
*
488
*
2
,
max_dim_y
=
16
,
)
fpga_weights_RW
=
attribute
(
dtype
=
((
'
DevShort
'
,),),
max_dim_x
=
12
*
488
*
2
,
max_dim_y
=
16
,
access
=
AttrWriteType
.
READ_WRITE
,
)
sdp_info_R
=
attribute
(
dtype
=
(
'
DevString
'
,),
)
tod_R
=
attribute
(
dtype
=
(
'
DevString
'
,),
)
translator_network_R
=
attribute
(
dtype
=
(
'
DevString
'
,),
)
translator_timing_R
=
attribute
(
dtype
=
(
'
DevString
'
,),
)
# ---------------
# ---------------
# General methods
# General methods
...
@@ -150,11 +177,17 @@ class SDP(Device):
...
@@ -150,11 +177,17 @@ class SDP(Device):
self
.
info_stream
(
"
Mapping OPC-UA MP/CP to attributes...
"
)
self
.
info_stream
(
"
Mapping OPC-UA MP/CP to attributes...
"
)
self
.
attribute_mapping
[
"
fpga_mask_RW
"
]
=
self
.
get_node
(
"
fpga_mask_RW
"
)
self
.
attribute_mapping
[
"
fpga_mask_RW
"
]
=
self
.
get_node
(
"
fpga_mask_RW
"
)
self
.
attribute_mapping
[
"
fpga_scrap_RW
"
]
=
self
.
get_node
(
"
fpga_scrap_RW
"
)
self
.
attribute_mapping
[
"
fpga_scrap_R
"
]
=
self
.
get_node
(
"
fpga_scrap_R
"
)
self
.
attribute_mapping
[
"
fpga_scrap_R
"
]
=
self
.
get_node
(
"
fpga_scrap_R
"
)
self
.
attribute_mapping
[
"
fpga_scrap_RW
"
]
=
self
.
get_node
(
"
fpga_scrap_RW
"
)
self
.
attribute_mapping
[
"
fpga_status_R
"
]
=
self
.
get_node
(
"
fpga_status_R
"
)
self
.
attribute_mapping
[
"
fpga_status_R
"
]
=
self
.
get_node
(
"
fpga_status_R
"
)
self
.
attribute_mapping
[
"
fpga_temp_R
"
]
=
self
.
get_node
(
"
fpga_temp_R
"
)
self
.
attribute_mapping
[
"
fpga_temp_R
"
]
=
self
.
get_node
(
"
fpga_temp_R
"
)
self
.
attribute_mapping
[
"
fpga_version_R
"
]
=
self
.
get_node
(
"
fpga_version_R
"
)
self
.
attribute_mapping
[
"
fpga_version_R
"
]
=
self
.
get_node
(
"
fpga_version_R
"
)
self
.
attribute_mapping
[
"
fpga_weights_R
"
]
=
self
.
get_node
(
"
fpga_weights_R
"
)
self
.
attribute_mapping
[
"
fpga_weights_RW
"
]
=
self
.
get_node
(
"
fpga_weights_RW
"
)
self
.
attribute_mapping
[
"
sdp_info_R
"
]
=
self
.
get_node
(
"
sdp_info
"
)
self
.
attribute_mapping
[
"
tod_R
"
]
=
self
.
get_node
(
"
tod
"
)
self
.
attribute_mapping
[
"
translator_network_R
"
]
=
self
.
get_node
(
"
translator_network
"
)
self
.
attribute_mapping
[
"
translator_timing_R
"
]
=
self
.
get_node
(
"
translator_timing
"
)
self
.
info_stream
(
"
Mapping OPC-UA MP/CP to attributes done.
"
)
self
.
info_stream
(
"
Mapping OPC-UA MP/CP to attributes done.
"
)
...
@@ -178,16 +211,28 @@ class SDP(Device):
...
@@ -178,16 +211,28 @@ class SDP(Device):
# the mapping.
# the mapping.
self
.
_fpga_mask_RW
=
numpy
.
full
(
16
,
False
)
self
.
_fpga_mask_RW
=
numpy
.
full
(
16
,
False
)
self
.
attribute_mapping
[
"
fpga_mask_RW
"
]
=
{}
self
.
attribute_mapping
[
"
fpga_mask_RW
"
]
=
{}
self
.
_fpga_scrap_RW
=
numpy
.
full
(
2048
,
False
)
self
.
attribute_mapping
[
"
fpga_scrap_RW
"
]
=
{}
self
.
_fpga_scrap_R
=
numpy
.
full
(
2048
,
False
)
self
.
_fpga_scrap_R
=
numpy
.
full
(
2048
,
False
)
self
.
attribute_mapping
[
"
fpga_scrap_R
"
]
=
{}
self
.
attribute_mapping
[
"
fpga_scrap_R
"
]
=
{}
self
.
_fpga_scrap_RW
=
numpy
.
full
(
2048
,
False
)
self
.
attribute_mapping
[
"
fpga_scrap_RW
"
]
=
{}
self
.
_fpga_status_R
=
numpy
.
full
(
16
,
False
)
self
.
_fpga_status_R
=
numpy
.
full
(
16
,
False
)
self
.
attribute_mapping
[
"
fpga_status_R
"
]
=
{}
self
.
attribute_mapping
[
"
fpga_status_R
"
]
=
{}
self
.
_fpga_temp_R
=
numpy
.
full
(
16
,
0.0
)
self
.
_fpga_temp_R
=
numpy
.
full
(
16
,
0.0
)
self
.
attribute_mapping
[
"
fpga_temp_R
"
]
=
{}
self
.
attribute_mapping
[
"
fpga_temp_R
"
]
=
{}
self
.
_fpga_version_R
=
numpy
.
full
(
16
,
"
NO_VERSION_INFO_YET
"
)
self
.
_fpga_version_R
=
numpy
.
full
(
16
,
"
NO_VERSION_INFO_YET
"
)
self
.
attribute_mapping
[
"
fpga_version_R
"
]
=
{}
self
.
attribute_mapping
[
"
fpga_version_R
"
]
=
{}
self
.
_fpga_weights_R
=
numpy
.
full
((
16
,
2
*
488
*
12
),
0
)
self
.
attribute_mapping
[
"
fpga_weights_R
"
]
=
{}
self
.
_fpga_weights_RW
=
numpy
.
full
((
16
,
2
*
488
*
12
),
0
)
self
.
attribute_mapping
[
"
fpga_weights_RW
"
]
=
{}
self
.
_sdp_info_R
=
"
NOT_INITIALISED
"
self
.
attribute_mapping
[
"
sdp_info_R
"
]
=
{}
self
.
_tod_R
=
"
NOT_INITIALISED
"
self
.
attribute_mapping
[
"
tod_R
"
]
=
{}
self
.
_translator_network_R
=
"
NOT_INITIALISED
"
self
.
attribute_mapping
[
"
translator_network_R
"
]
=
{}
self
.
_translator_timing_R
=
"
NOT_INITIALISED
"
self
.
attribute_mapping
[
"
translator_timing_R
"
]
=
{}
# Init the dict that contains function to OPC-UA function mappings.
# Init the dict that contains function to OPC-UA function mappings.
self
.
function_mapping
=
{}
self
.
function_mapping
=
{}
...
@@ -265,9 +310,7 @@ class SDP(Device):
...
@@ -265,9 +310,7 @@ class SDP(Device):
@fault_on_error
@fault_on_error
def
read_fpga_scrap_R
(
self
):
def
read_fpga_scrap_R
(
self
):
"""
Return the fpga_scrap_R attribute.
"""
"""
Return the fpga_scrap_R attribute.
"""
value
=
numpy
.
array
(
numpy
.
split
(
self
.
attribute_mapping
[
"
fpga_scrap_R
"
].
get_data_value
().
Value
.
Value
,
indices_or_sections
=
16
))
self
.
_fpga_scrap_R
=
numpy
.
array
(
numpy
.
split
(
self
.
attribute_mapping
[
"
fpga_scrap_R
"
].
get_data_value
().
Value
.
Value
,
indices_or_sections
=
16
))
value_tuples
=
numpy
.
array
(
numpy
.
split
(
value
,
indices_or_sections
=
2
))
self
.
_fpga_scrap_R
=
value_tuples
return
self
.
_fpga_scrap_R
return
self
.
_fpga_scrap_R
@only_when_on
@only_when_on
...
@@ -304,6 +347,55 @@ class SDP(Device):
...
@@ -304,6 +347,55 @@ class SDP(Device):
self
.
_fpga_version_R
=
numpy
.
array
(
self
.
attribute_mapping
[
"
fpga_version_R
"
].
get_value
())
self
.
_fpga_version_R
=
numpy
.
array
(
self
.
attribute_mapping
[
"
fpga_version_R
"
].
get_value
())
return
self
.
_fpga_version_R
return
self
.
_fpga_version_R
@only_when_on
@fault_on_error
def
read_fpga_weights_R
(
self
):
"""
Return the fpga_weights_R attribute.
"""
value
=
numpy
.
array
(
numpy
.
split
(
self
.
attribute_mapping
[
"
fpga_weights_R
"
].
get_value
(),
indices_or_sections
=
16
))
self
.
_fpga_weights_R
=
value
return
self
.
_fpga_weights_R
@only_when_on
@fault_on_error
def
read_fpga_weights_RW
(
self
):
"""
Return the fpga_weights_RW attribute.
"""
return
self
.
_fpga_weights_RW
@only_when_on
@fault_on_error
def
write_fpga_weights_RW
(
self
,
value
):
"""
Return the fpga_weights_RW attribute.
"""
self
.
attribute_mapping
[
"
fpga_weights_RW
"
].
set_data_value
(
opcua
.
ua
.
uatypes
.
Variant
(
value
=
value
.
tolist
(),
varianttype
=
opcua
.
ua
.
VariantType
.
Int16
))
_fpga_weights_RW
=
value
@only_when_on
@fault_on_error
def
read_sdp_info_R
(
self
):
"""
Return the sdp_info_R attribute.
"""
self
.
_sdp_info_R
=
self
.
attribute_mapping
[
"
sdp_info_R
"
].
get_value
()
return
self
.
_sdp_info_R
@only_when_on
@fault_on_error
def
read_sdp_tod_R
(
self
):
"""
Return the sdp_tod_R attribute.
"""
self
.
_sdp_tod_R
=
self
.
attribute_mapping
[
"
sdp_tod_R
"
].
get_value
()
return
self
.
_sdp_tod_R
@only_when_on
@fault_on_error
def
read_translator_network_R
(
self
):
"""
Return the _translator_network_R attribute.
"""
self
.
_translator_network_R
=
self
.
attribute_mapping
[
"
translator_network_R
"
].
get_value
()
return
self
.
_translator_network_R
@only_when_on
@fault_on_error
def
read_translator_timing_R
(
self
):
"""
Return the _translator_timing_R attribute.
"""
self
.
_translator_timing_R
=
self
.
attribute_mapping
[
"
translator_timing_R
"
].
get_value
()
return
self
.
_translator_timing_R
# --------
# --------
# Commands
# Commands
...
...
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