Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
opcua-cloning
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yogesh.m
opcua-cloning
Commits
571dd19e
Commit
571dd19e
authored
Mar 02, 2023
by
yogesh.m
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
3314a156
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
7 deletions
+11
-7
.idea/misc.xml
.idea/misc.xml
+1
-1
.idea/opcua-cloning.iml
.idea/opcua-cloning.iml
+1
-1
opcua_receiver.py
opcua_receiver.py
+1
-2
opcua_subscriber/__pycache__/opcua_subscribe.cpython-39.pyc
opcua_subscriber/__pycache__/opcua_subscribe.cpython-39.pyc
+0
-0
opcua_subscriber/opcua_subscribe.py
opcua_subscriber/opcua_subscribe.py
+8
-3
No files found.
.idea/misc.xml
View file @
571dd19e
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.9"
project-jdk-type=
"Python SDK"
/>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.9
(pythonProject)
"
project-jdk-type=
"Python SDK"
/>
</project>
</project>
\ No newline at end of file
.idea/opcua-cloning.iml
View file @
571dd19e
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<module
type=
"PYTHON_MODULE"
version=
"4"
>
<module
type=
"PYTHON_MODULE"
version=
"4"
>
<component
name=
"NewModuleRootManager"
>
<component
name=
"NewModuleRootManager"
>
<content
url=
"file://$MODULE_DIR$"
/>
<content
url=
"file://$MODULE_DIR$"
/>
<orderEntry
type=
"jdk"
jdkName=
"Python 3.9"
jdkType=
"Python SDK"
/>
<orderEntry
type=
"jdk"
jdkName=
"Python 3.9
(pythonProject)
"
jdkType=
"Python SDK"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
</component>
</component>
</module>
</module>
\ No newline at end of file
opcua_receiver.py
View file @
571dd19e
...
@@ -26,11 +26,10 @@ UDPServerSocket.bind((localIP, localPort))
...
@@ -26,11 +26,10 @@ UDPServerSocket.bind((localIP, localPort))
print
(
"UDP server up and listening"
)
print
(
"UDP server up and listening"
)
opua
=
opcua_pack
()
opua
=
opcua_pack
()
sock
=
opua
.
connect
(
"opc.tcp://2.2.2.5:53530/OPCUA/SimulationServer"
)
sock
=
opua
.
connect
(
"opc.tcp://2.2.2.5:53530/OPCUA/SimulationServer"
)
opua
.
write_opcua_value
(
sock
,
3
,
1002
,
11
)
while
(
True
):
while
(
True
):
bytesAddressPair
=
UDPServerSocket
.
recvfrom
(
bufferSize
)
bytesAddressPair
=
UDPServerSocket
.
recvfrom
(
bufferSize
)
message
=
bytesAddressPair
[
0
]
message
=
bytesAddressPair
[
0
]
datatype
,
value
,
ns
,
nodeid
=
message
.
decode
()
.
split
(
"&"
)
datatype
,
value
,
ns
,
nodeid
=
message
.
decode
()
.
split
(
"&"
)
print
(
nodeid
)
print
(
nodeid
)
opua
.
write_opcua_value
(
sock
,
int
(
ns
),
int
(
nodeid
)
,
value
,
datatype
)
opua
.
write_opcua_value
(
sock
,
ns
,
nodeid
,
value
,
datatype
)
opcua_subscriber/__pycache__/opcua_subscribe.cpython-39.pyc
View file @
571dd19e
No preview for this file type
opcua_subscriber/opcua_subscribe.py
View file @
571dd19e
...
@@ -13,6 +13,7 @@ class opcua_pack():
...
@@ -13,6 +13,7 @@ class opcua_pack():
self
.
identifier_string
=
""
self
.
identifier_string
=
""
self
.
int_chunk_seq
=
5
self
.
int_chunk_seq
=
5
self
.
float_chunk_seq
=
4
self
.
float_chunk_seq
=
4
self
.
cs
=
5
def
helf
(
self
,
address
):
def
helf
(
self
,
address
):
...
@@ -377,7 +378,8 @@ class opcua_pack():
...
@@ -377,7 +378,8 @@ class opcua_pack():
else
:
else
:
Message_Size
=
123
Message_Size
=
123
vt_type
=
6
vt_type
=
6
vt_value
=
struct
.
pack
(
'i'
,
value
)
print
(
value
)
vt_value
=
struct
.
pack
(
'i'
,
int
(
value
))
statuscode
=
binascii
.
unhexlify
(
"00000000"
)
statuscode
=
binascii
.
unhexlify
(
"00000000"
)
...
@@ -452,6 +454,9 @@ class opcua_pack():
...
@@ -452,6 +454,9 @@ class opcua_pack():
def
write_opcua_value
(
self
,
sock
,
ns
,
nodeid
,
val
,
datatype
):
def
write_opcua_value
(
self
,
sock
,
ns
,
nodeid
,
val
,
datatype
):
if
(
datatype
==
"<class 'float'>"
):
if
(
datatype
==
"<class 'float'>"
):
sock
.
sendall
(
self
.
write_request
(
self
.
SecureChannelId
,
self
.
TokenId
,
self
.
identifier_string
,
self
.
int_chunk_seq
,
ns
,
nodeid
,
val
,
datatype
))
sock
.
sendall
(
self
.
write_request
(
self
.
SecureChannelId
,
self
.
TokenId
,
self
.
identifier_string
,
self
.
cs
,
int
(
ns
),
int
(
nodeid
),
float
(
val
),
datatype
))
self
.
cs
=
self
.
cs
+
1
else
:
else
:
sock
.
sendall
(
self
.
write_request
(
self
.
SecureChannelId
,
self
.
TokenId
,
self
.
identifier_string
,
self
.
float_chunk_seq
,
ns
,
nodeid
,
val
,
datatype
))
sock
.
sendall
(
self
.
write_request
(
self
.
SecureChannelId
,
self
.
TokenId
,
self
.
identifier_string
,
self
.
cs
,
int
(
ns
),
int
(
nodeid
),
float
(
val
),
datatype
))
self
.
cs
=
self
.
cs
+
1
print
(
sock
.
recv
(
1024
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment