ConnectorIO / connectorio-addons

Dedicated repository for openHAB software extensions maintained by ConnectorIO.
Apache License 2.0
18 stars 11 forks source link

Automatic discovery of ADS symbols / channels #24

Closed splatch closed 8 months ago

splatch commented 9 months ago

Some of Beckhoff devices based on ADS protocol offers possibility to fetch "symbol table". Symbol table consist name of tag/data point, its type and several other flags. This information can be used to provision channels within discovered and connected PLCs things reducing commisioning time to minimum.

Example symbol table retrieved from TwinCAT/BSD virtual machine running empty PLC program:

      |           PLC4X Field         |          Hex          |                                                            
##### |          Query Syntax         |   Index   |   Offset  |    Type   | Name                                   | Size (B) | Type | Value (type)
------+-------------------------------+-----------+-----------+-----------+----------------------------------------+----------+------|
    0 |           0x4040/0x5dffd:BOOL |    0x4040 |   0x5dffd |      BOOL |Constants.bFPUSupport                   |        1 |   33 | true (java.lang.Boolean)
    2 |           0x4040/0x5dfeb:BOOL |    0x4040 |   0x5dfeb |      BOOL |Constants.bLittleEndian                 |        1 |   33 | true (java.lang.Boolean)
    4 |           0x4040/0x5e002:BOOL |    0x4040 |   0x5e002 |      BOOL |Constants.bMulticoreSupport             |        1 |   33 | false (java.lang.Boolean)
    6 |           0x4040/0x5dffc:BOOL |    0x4040 |   0x5dffc |      BOOL |Constants.bSimulationMode               |        1 |   33 | false (java.lang.Boolean)
    8 |        0x4040/0x5dff4:VERSION |    0x4040 |   0x5dff4 |   VERSION |Constants.CompilerVersion               |        8 |   65 | {uiMajor=3, uiMinor=5, uiServicePack=13, uiPatch=40} (java.util.Map)
   10 |          0x4040/0x5e008:DWORD |    0x4040 |   0x5e008 |     DWORD |Constants.CompilerVersionNumeric        |        4 |   19 | 50662696 (java.lang.Long)
   12 |           0x4040/0x5e000:UINT |    0x4040 |   0x5e000 |      UINT |Constants.nPackMode                     |        2 |   18 | 8 (java.lang.Integer)
   14 |           0x4040/0x5dffe:WORD |    0x4040 |   0x5dffe |      WORD |Constants.nRegisterSize                 |        2 |   18 | 64 (java.lang.Integer)
   16 |        0x4040/0x5dfec:VERSION |    0x4040 |   0x5dfec |   VERSION |Constants.RuntimeVersion                |        8 |   65 | {uiMajor=3, uiMinor=5, uiServicePack=13, uiPatch=0} (java.util.Map)
   18 |          0x4040/0x5e004:DWORD |    0x4040 |   0x5e004 |     DWORD |Constants.RuntimeVersionNumeric         |        4 |   19 | 50662656 (java.lang.Long)
splatch commented 8 months ago

Completed with 4d837f4.