Skip to content

Support for monitored properties #261

@dgl-cw

Description

@dgl-cw

Hi

I was using read_by_name before and wanted to switch to get_symbol(...).read() because of the nicer syntax and not having to pass around the plc object. So I discovered, that the latter failed for monitored properties.

With monitored properties I mean properties that have the monitoring pragma.

I couldn't find any documentation on accessing monitored properties over ADS, neither here nor on TwinCAT, so I experimented a bit.

Windows 10
TwinCAT 3.4024.10

With read_by_name

monitoring GVL Program Function Block
variable (✔️) (✔️) ❌1808
call ❌1808 ❌1808 ✔️

❌ is a ADSError: symbol not found (1808)
Same for write_by_name however with {attribute 'monitoring' := 'variable'} writing has not effect.

With get_symbol(...).read() or .write(...)

monitoring GVL Program Function Block
variable (✔️) (✔️) ❌1808
call ❌1808 ❌1808 1806

Mostly the same as above but function block with call fails with ADSError: objects do not match (1806)
Again .write(...) has no effect.

I was mostly interested in the 1806 case so I looked deeper and found that for the affected case adsGetSymbolInfo returns an index_group of 0xF019 and an index_offset of 0x0.
I could not find any documentation on the index group 0xF019.
As a workaround I tried to get a handle with plc.get_handle(...) for the case that index_group was 0xF019 and use that instead. That worked.

I did not look deeper into the case of the 1808 error.

In summary

I think

  • get_symbol should not fail, where read_by_name succeeds. Thus a workaround should be implemented.
  • it would be worth documenting that monitored properties can be read and written through ADS, with the limitations listed above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions