Define Virtual twin skeleton
Feature description
Write a first implementation of the virtual twin of the montratec system.
Requirements
This depends on #10 and partially on the issues #1, #2.
Information from the Montratec documentation
From the documentation we have that a montratec systems consists in the following instances
- Shuttle
- Node
- Modules
- TracSwitch divide
- TracSwitch collect
- TracSwitch arena
- TracCrossing
- TracSwitch complex
- StopStation
- StopWaitStation
- EditStation
- EditBusyStation
- CustomerStation
- MultiPositioningUnit
- TracDoor
- IO-Module
- Lift
- Route tables
- Processing table
It follows that we can consider a Montratec system as a container of entities of type 1-5. However at a messaging level we have to types of entities for which the MDAC protocol allows to communicate directly:
- Nodes, which represent a TC2-Unit
Each TC2-Unit is assigned a Node ID (unique ID of the communication node) which applies to the total project. This can be configured in the WebGUI of the TC2-Unit (see TC2-Unit manual).
- Modules components
As it is simple to comunicate with these instance, I propose to write the virtual twin-skeleto based in these instances.
Possible solution
A module can be described by
- Node where the module is
- id
- version
- type
- capabilities
- status(mdac get_state):
- Status quality 1: ineger from 0 to 6
- possible 4 data types as specified by Appendix B
- Error status in string
- Error code in numerical code, zero if no error
- Door State int, 0 open 1 closed
- IO State, binary description of the IO module state stored in I4 ('>i') (?)
- Register data
class cModuleStatus(object):
def __init__(_status, )
class cMdacModule(object):
def __init__(self, _node_id, _id, _version, _type, ):
¦ self.node_id_ = _node_id
¦ self.id_ = _id
¦ self.version_ = _mdac_rpc.get_version(_node_id, _id)
¦ self.capabilities_ = _mdac_rpc.get_capabilities(_node_id, _id)
¦ self.type_ = self.get_type(_node_id, _id)
def __str__(self):
¦ cap_num = len(self.capabilities_)
¦ res = 'Node = {:d}, Module = {:d}, version = {:f}, {:s}, capabilities = [' + \
¦ ¦ cap_num * '{:d} ' + '], type = {:s}'
¦ res = res.format(self.node_id_, self.id_, *self.version_,
¦ ¦ ¦ ¦ ¦ ¦*self.capabilities_, self.type_)
(Describe your proposed solution here.)