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
95f0af5d
Commit
95f0af5d
authored
4 years ago
by
Taya Snijder
Browse files
Options
Downloads
Patches
Plain Diff
fixed scalar string issues
parent
daae688e
No related branches found
No related tags found
1 merge request
!28
Resolve #2021 "05 10 branched from master sdp update"
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
devices/SDP.py
+1
-1
1 addition, 1 deletion
devices/SDP.py
devices/clients/opcua_connection.py
+23
-2
23 additions, 2 deletions
devices/clients/opcua_connection.py
with
24 additions
and
3 deletions
devices/SDP.py
+
1
−
1
View file @
95f0af5d
This diff is collapsed.
Click to expand it.
devices/clients/opcua_connection.py
+
23
−
2
View file @
95f0af5d
...
...
@@ -51,6 +51,7 @@ class OPCUAConnection(CommClient):
fault_func
()
return
# determine namespace used
try
:
if
type
(
namespace
)
is
str
:
...
...
@@ -64,6 +65,7 @@ class OPCUAConnection(CommClient):
self
.
name_space_index
=
2
self
.
obj
=
self
.
client
.
get_objects_node
()
self
.
check_nodes
()
def
_servername
(
self
):
return
self
.
client
.
server_url
.
geturl
()
...
...
@@ -83,6 +85,21 @@ class OPCUAConnection(CommClient):
self
.
streams
.
error_stream
(
"
Could not connect to server %s: %s
"
,
self
.
_servername
(),
e
)
raise
Exception
(
"
Could not connect to server %s
"
,
self
.
_servername
())
from
e
def
check_nodes
(
self
):
"""
function purely for debugging/development only. Simply lists all top level nodes and the nodes below that
"""
for
i
in
self
.
obj
.
get_children
():
print
(
i
.
get_browse_name
())
for
j
in
i
.
get_children
():
try
:
print
(
j
.
get_browse_name
(),
j
.
get_data_type_as_variant_type
())
except
:
print
(
j
.
get_browse_name
())
finally
:
pass
def
disconnect
(
self
):
"""
...
...
@@ -160,7 +177,6 @@ class OPCUAConnection(CommClient):
self
.
streams
.
debug_stream
(
"
connected OPC ua node {} of type {} to attribute with dimensions: {} x {}
"
.
format
(
str
(
node_name
)[:
len
(
node_name
)
-
1
],
str
(
ua_type
)[
len
(
"
VariantType.
"
):],
dim_x
,
dim_y
))
except
:
pass
# return the read/write functions
return
prot_attr
.
read_function
,
prot_attr
.
write_function
...
...
@@ -182,12 +198,17 @@ class ProtocolAttribute:
"""
value
=
numpy
.
array
(
self
.
node
.
get_value
())
if
self
.
dim_y
!=
0
:
if
self
.
dim_y
+
self
.
dim_x
==
1
:
return
numpy
.
array
([
value
])
elif
self
.
dim_y
!=
0
:
value
=
numpy
.
array
(
numpy
.
split
(
value
,
indices_or_sections
=
self
.
dim_y
))
else
:
value
=
numpy
.
array
(
value
)
return
value
def
write_function
(
self
,
value
):
"""
write_RW function
...
...
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