Skip to content
Snippets Groups Projects
Commit 1691f08a authored by Jan David Mol's avatar Jan David Mol
Browse files

Boot into OFF state, requiring explicit INIT (f.e. after other devices have been instantiated).

parent 8746bb42
No related branches found
No related tags found
1 merge request!1State management
...@@ -51,14 +51,14 @@ class RCUSCC(Device): ...@@ -51,14 +51,14 @@ class RCUSCC(Device):
OFF = Device is turned off, drops connection to the hardware, OFF = Device is turned off, drops connection to the hardware,
The following state transitions are implemented: The following state transitions are implemented:
boot -> INIT: Triggered by device. Device will initialise when it is started, boot -> OFF: Triggered by tango. Device will be instantiated,
OFF -> INIT: Triggered by device. Device will initialise (connect to hardware, other devices),
INIT -> STANDBY: Triggered by device. Device is initialised, and is ready for additional configuration by the user, INIT -> STANDBY: Triggered by device. Device is initialised, and is ready for additional configuration by the user,
STANDBY -> ON: Triggered by user. Device reports to be functional, STANDBY -> ON: Triggered by user. Device reports to be functional,
* -> FAULT: Triggered by device. Device has degraded to malfunctional, for example because the connection to the hardware is lost, * -> FAULT: Triggered by device. Device has degraded to malfunctional, for example because the connection to the hardware is lost,
* -> FAULT: Triggered by user. Emulate a forced malfunction for integration testing purposes, * -> FAULT: Triggered by user. Emulate a forced malfunction for integration testing purposes,
* -> OFF: Triggered by user. Device is turned off. Triggered by the Off() command, * -> OFF: Triggered by user. Device is turned off. Triggered by the Off() command,
FAULT -> INIT: Triggered by user. Device is reinitialised to recover from an error, FAULT -> INIT: Triggered by user. Device is reinitialised to recover from an error,
OFF -> INIT: Triggered by user. Device is turned on again.
The user triggers their transitions by the commands reflecting the target state (Init(), On(), Fault()). The user triggers their transitions by the commands reflecting the target state (Init(), On(), Fault()).
""" """
...@@ -226,11 +226,16 @@ class RCUSCC(Device): ...@@ -226,11 +226,16 @@ class RCUSCC(Device):
self.debug_stream("Mapping OPC-UA MP/CP to attributes done.") self.debug_stream("Mapping OPC-UA MP/CP to attributes done.")
def init_device(self): def init_device(self):
"""Initialises the attributes and properties of the RCUSCC.""" """ Instantiates the device in the OFF state. """
# NOTE: Will delete_device first, if necessary # NOTE: Will delete_device first, if necessary
Device.init_device(self) Device.init_device(self)
self.set_state(DevState.OFF)
def initialise(self):
"""Initialises the attributes and properties of the RCUSCC."""
self.set_state(DevState.INIT) self.set_state(DevState.INIT)
# Init the dict that contains attribute to OPC-UA MP/CP mappings. # Init the dict that contains attribute to OPC-UA MP/CP mappings.
...@@ -453,7 +458,7 @@ class RCUSCC(Device): ...@@ -453,7 +458,7 @@ class RCUSCC(Device):
:return:None :return:None
""" """
self.init_device() self.initialise()
@only_in_states([DevState.INIT]) @only_in_states([DevState.INIT])
def Standby(self): def Standby(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment