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
a9d09020
Commit
a9d09020
authored
4 years ago
by
Thomas Juerges
Browse files
Options
Downloads
Patches
Plain Diff
Adjust for the latest MP names
parent
aa406b0f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SDP/SDP/SDP.py
+39
-15
39 additions, 15 deletions
SDP/SDP/SDP.py
with
39 additions
and
15 deletions
SDP/SDP/SDP.py
+
39
−
15
View file @
a9d09020
...
@@ -144,8 +144,11 @@ class SDP(Device):
...
@@ -144,8 +144,11 @@ class SDP(Device):
self
.
debug_stream
(
"
Mapping OPC-UA MP/CP to attributes...
"
)
self
.
debug_stream
(
"
Mapping OPC-UA MP/CP to attributes...
"
)
self
.
attribute_mapping
[
"
SDP_mask_RW
"
]
=
self
.
get_pcc_node
(
"
SDP_mask_RW
"
)
self
.
attribute_mapping
[
"
fpga_weights_R
"
]
=
self
.
get_node
(
"
weights
"
)
self
.
attribute_mapping
[
"
fpga_temp_R
"
]
=
self
.
get_pcc_node
(
"
fpga_temp_R
"
)
self
.
attribute_mapping
[
"
fpga_mask_R
"
]
=
self
.
get_node
(
"
fpga_mask_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_version_R
"
]
=
self
.
get_node
(
"
fpga_version_R
"
)
self
.
debug_stream
(
"
Mapping OPC-UA MP/CP to attributes done.
"
)
self
.
debug_stream
(
"
Mapping OPC-UA MP/CP to attributes done.
"
)
...
@@ -167,10 +170,16 @@ class SDP(Device):
...
@@ -167,10 +170,16 @@ class SDP(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
.
_SDP_mask_RW
=
numpy
.
full
(
32
,
False
)
self
.
_fpga_weights_R
=
numpy
.
full
(
16
*
192
*
488
,
0.0
)
self
.
attribute_mapping
[
"
SDP_mask_RW
"
]
=
{}
self
.
attribute_mapping
[
"
fpga_weights_R
"
]
=
{}
self
.
_fpga_temp_R
=
numpy
.
full
(
4
,
False
)
self
.
_fpga_mask_R
=
numpy
.
full
(
16
,
False
)
self
.
attribute_mapping
[
"
fpga_mask_R
"
]
=
{}
self
.
_fpga_status_R
=
numpy
.
full
(
16
,
False
)
self
.
attribute_mapping
[
"
fpga_status_R
"
]
=
{}
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
.
attribute_mapping
[
"
fpga_version_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
=
{}
...
@@ -206,7 +215,7 @@ class SDP(Device):
...
@@ -206,7 +215,7 @@ class SDP(Device):
#
#
# TODO
# TODO
# Read default masks from config DB
# Read default masks from config DB
#self.write_
SDP
_mask_RW(self._
SDP
_mask_R)
#self.write_
fpga
_mask_RW(self._
fpga
_mask_R)
# Everything went ok -- go standby.
# Everything went ok -- go standby.
self
.
set_state
(
DevState
.
STANDBY
)
self
.
set_state
(
DevState
.
STANDBY
)
...
@@ -230,28 +239,43 @@ class SDP(Device):
...
@@ -230,28 +239,43 @@ class SDP(Device):
# ------------------
# ------------------
# Attributes methods
# Attributes methods
# ------------------
# ------------------
@only_when_on
@fault_on_error
def
read_fpga_weights_R
(
self
):
"""
Return the fpga_weights_R attribute.
"""
value
=
numpy
.
array
(
self
.
attribute_mapping
[
"
fpga_weights_R
"
].
get_value
())
fpgas
=
numpy
.
array
(
numpy
.
split
(
value
,
indices_or_sections
=
16
))
self
.
_fpga_weights_R
=
numpy
.
array
(
numpy
.
split
(
fpgas
,
indices_or_sections
=
192
))
return
self
.
_fpga_weights_R
@only_when_on
@only_when_on
@fault_on_error
@fault_on_error
def
read_SDP_mask_RW
(
self
):
def
read_fpga_mask_R
(
self
):
"""
Return the SDP_mask_RW attribute.
"""
"""
Return the fpga_mask_R attribute.
"""
return
self
.
_SDP_mask_RW
self
.
_fpga_mask_R
=
numpy
.
array
(
self
.
attribute_mapping
[
"
fpga_mask_R
"
].
get_value
())
return
self
.
_fpga_mask_R
@only_when_on
@only_when_on
@fault_on_error
@fault_on_error
def
write_SDP_mask
_R
W
(
self
,
value
):
def
read_fpga_status
_R
(
self
):
"""
S
et the
SDP_mask
_R
W
attribute.
"""
"""
R
et
urn
the
fpga_status
_R attribute.
"""
self
.
attribute_mapping
[
"
SDP_mask
_R
W
"
].
s
et_value
(
value
.
tolist
(
))
self
.
_fpga_status_R
=
numpy
.
array
(
self
.
attribute_mapping
[
"
fpga_status
_R
"
].
g
et_value
())
self
.
_SDP_mask_RW
=
value
return
self
.
_fpga_status_R
@only_when_on
@only_when_on
@fault_on_error
@fault_on_error
def
read_fpga_temp_R
(
self
):
def
read_fpga_temp_R
(
self
):
"""
Return the fpga_temp_R attribute.
"""
"""
Return the fpga_temp_R attribute.
"""
value
=
numpy
.
array
(
self
.
attribute_mapping
[
"
fpga_temp_R
"
].
get_value
())
self
.
_fpga_temp_R
=
numpy
.
array
(
self
.
attribute_mapping
[
"
fpga_temp_R
"
].
get_value
())
self
.
_fpga_temp_R
=
numpy
.
array
(
numpy
.
split
(
value
,
indices_or_sections
=
4
))
return
self
.
_fpga_temp_R
return
self
.
_fpga_temp_R
@only_when_on
@fault_on_error
def
read_fpga_version_R
(
self
):
"""
Return the fpga_version_R attribute.
"""
self
.
_fpga_version_R
=
numpy
.
array
(
self
.
attribute_mapping
[
"
fpga_version_R
"
].
get_value
())
return
self
.
_fpga_version_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