Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SOIL2OPC UA Translator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WZL-IQS-Public
Sensor Interfacing Language (SOIL)
SOIL2OPC UA Translator
Commits
1055ec21
Commit
1055ec21
authored
2 years ago
by
Oliver Rostig
Browse files
Options
Downloads
Patches
Plain Diff
robot als objecttype, typo-fix bei event
parent
3df95ab4
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
robot.py
+24
-12
24 additions, 12 deletions
robot.py
with
24 additions
and
12 deletions
robot.py
+
24
−
12
View file @
1055ec21
...
...
@@ -81,7 +81,7 @@ async def main():
paraobjectlist
=
[
openobject
,
automoveobject
]
#hauptobjekt
myobj
=
await
server
.
nodes
.
object
s
.
add_object
(
idx
,
"
Robot
"
)
myobj
type
=
await
server
.
nodes
.
base_
object
_type
.
add_object
_type
(
idx
,
"
Robot
"
)
#tcp als variable mit properties
vartype
=
await
server
.
nodes
.
base_data_type
.
add_data_type
(
idx
,
"
Measurement
"
)
...
...
@@ -93,32 +93,46 @@ async def main():
for
a
in
measureobjectlist
:
name
=
a
.
name
+
"
var
"
name
=
await
myobj
.
add_variable
(
idx
,
a
.
name
,
a
.
value
,
datatype
=
vartype
.
nodeid
)
name
=
await
myobjtype
.
add_variable
(
idx
,
a
.
name
,
a
.
value
,
datatype
=
vartype
.
nodeid
)
await
name
.
set_modelling_rule
(
True
)
#namelist = namelist + name
if
a
.
range
is
not
None
:
rangeprop
=
await
name
.
add_property
(
idx
,
"
range
"
,
ua
.
Range
(
a
.
range
[
0
],
a
.
range
[
1
]))
await
rangeprop
.
set_modelling_rule
(
True
)
if
a
.
unit
is
not
None
:
unitporp
=
await
name
.
add_property
(
idx
,
"
unit
"
,
a
.
unit
)
unitprop
=
await
name
.
add_property
(
idx
,
"
unit
"
,
a
.
unit
)
await
unitprop
.
set_modelling_rule
(
True
)
description
=
await
name
.
add_property
(
idx
,
"
Description
"
,
a
.
description
)
await
description
.
set_modelling_rule
(
True
)
#parameters
for
a
in
paraobjectlist
:
para
=
await
myobj
.
add_variable
(
idx
,
a
.
name
,
a
.
value
,
datatype
=
paratype
.
nodeid
)
para
=
await
myobjtype
.
add_variable
(
idx
,
a
.
name
,
a
.
value
,
datatype
=
paratype
.
nodeid
)
await
para
.
set_modelling_rule
(
True
)
if
a
.
range
is
not
None
:
rangeprop
=
await
para
.
add_property
(
idx
,
"
range
"
,
ua
.
Range
(
a
.
range
[
0
],
a
.
range
[
1
]))
await
rangeprop
.
set_modelling_rule
(
True
)
if
a
.
unit
is
not
None
:
unitporp
=
await
para
.
add_property
(
idx
,
"
unit
"
,
a
.
unit
)
unitprop
=
await
para
.
add_property
(
idx
,
"
unit
"
,
a
.
unit
)
await
unitprop
.
set_modelling_rule
(
True
)
description
=
await
para
.
add_property
(
idx
,
"
Description
"
,
a
.
description
)
await
description
.
set_modelling_rule
(
True
)
#gripper als componente
gripper
=
await
myobj
.
add_object
(
idx
,
"
Gripper
"
)
await
gripper
.
add_property
(
idx
,
"
Description
"
,
"
Gripper of a robot
"
)
gripper
=
await
myobjtype
.
add_object
(
idx
,
"
Gripper
"
)
await
gripper
.
set_modelling_rule
(
True
)
gripprop
=
await
gripper
.
add_property
(
idx
,
"
Description
"
,
"
Gripper of a robot
"
)
await
gripprop
.
set_modelling_rule
(
True
)
openvar
=
await
gripper
.
add_variable
(
idx
,
"
Open
"
,
True
,
datatype
=
paratype
.
nodeid
)
await
openvar
.
add_property
(
idx
,
"
Description
"
,
"
Flag to specify if something is open.
"
)
await
openvar
.
set_modelling_rule
(
True
)
grip_desc
=
await
openvar
.
add_property
(
idx
,
"
Description
"
,
"
Flag to specify if something is open.
"
)
await
grip_desc
.
set_modelling_rule
(
True
)
myobj
=
await
server
.
nodes
.
objects
.
add_object
(
idx
,
"
Robot
"
,
myobjtype
)
#getting node ids of battery and position
robotposname
=
"
2:
"
+
positionobject
.
name
...
...
@@ -135,12 +149,10 @@ async def main():
batterywarninggen
=
await
server
.
get_event_generator
(
batterywarning
,
myobj
)
#batterylow error event
batteryerror
=
await
server
.
create_custom_event_type
(
idx
,
"
BatteryLow
Warning
"
,
ua
.
ObjectIds
.
SystemEventType
)
batteryerror
=
await
server
.
create_custom_event_type
(
idx
,
"
BatteryLow
Error
"
,
ua
.
ObjectIds
.
SystemEventType
)
batteryerrorgen
=
await
server
.
get_event_generator
(
batteryerror
,
myobj
)
#server
async
with
server
:
print
(
"
Server läuft!
"
)
...
...
@@ -152,7 +164,7 @@ async def main():
if
20
>
batteryload
>=
10
:
await
batterywarning
.
trigger
(
"
Battery level is below 20%. Load shortly.
"
)
if
batteryload
<
10
:
await
battery
warning
.
trigger
(
"
Battery level is below 10%. Please load the battery immediately.
"
)
await
battery
error
.
trigger
(
"
Battery level is below 10%. Please load the battery immediately.
"
)
await
asyncio
.
sleep
(
1
)
if
__name__
==
'
__main__
'
:
...
...
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