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
9e87dfe5
Commit
9e87dfe5
authored
4 years ago
by
Jan David Mol
Browse files
Options
Downloads
Patches
Plain Diff
Allow manually setting the device to FAULT
parent
bd1a51d8
No related branches found
No related tags found
1 merge request
!1
State management
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
RCUSCC/RCUSCC/RCUSCC.py
+10
-5
10 additions, 5 deletions
RCUSCC/RCUSCC/RCUSCC.py
with
10 additions
and
5 deletions
RCUSCC/RCUSCC/RCUSCC.py
+
10
−
5
View file @
9e87dfe5
...
...
@@ -57,6 +57,8 @@ class RCUSCC(Device):
* -> OFF: Device is turned off. Triggered by the Off() command.
FAULT -> INIT: Device is reinitialised to recover from an error. Triggered by the Init() command.
OFF -> INIT: Device is turned on again. Triggered by the Init() command.
For integration testing reasons, the user is allowed to manually set the device to FAULT.
"""
client
=
0
name_space_index
=
0
...
...
@@ -273,11 +275,11 @@ class RCUSCC(Device):
self
.
client
=
opcua
.
Client
(
"
opc.tcp://{}:{}/
"
.
format
(
self
.
OPC_Server_Name
,
self
.
OPC_Server_Port
),
self
.
OPC_Time_Out
)
# timeout in seconds
# Connect to OPC-UA -- will set ON state on success
self
.
opcua_connection
=
OPCUAConnection
(
self
.
client
,
self
.
On
,
self
.
_
Fault
,
self
)
self
.
opcua_connection
=
OPCUAConnection
(
self
.
client
,
self
.
On
,
self
.
Fault
,
self
)
if
not
self
.
opcua_connection
.
connect
():
# hardware or infra is down -- needs fixing first
self
.
_
Fault
()
self
.
Fault
()
return
# Retrieve and map server attributes
...
...
@@ -285,7 +287,7 @@ class RCUSCC(Device):
self
.
_map_attributes
()
except
Exception
as
e
:
self
.
error_stream
(
"
Could not map server interface: %s
"
,
e
)
self
.
_
Fault
()
self
.
Fault
()
return
# Start keep-alive
...
...
@@ -472,8 +474,11 @@ class RCUSCC(Device):
# Turn off again, in case of race conditions through reconnecting
self
.
set_state
(
DevState
.
OFF
)
def
_Fault
(
self
):
@command
(
)
@only_in_states
([
DevState
.
ON
,
DevState
.
INIT
])
@DebugIt
()
def
Fault
(
self
):
"""
FAULT state is used to indicate our connection with the OPC-UA server is down.
...
...
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