-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for monitored properties #261
Comments
If I get it right from the documentation monitoring is just an attribute that is used by the TwinCAT IDE and it should not influence the way a variable can be accessed via ADS. |
My experiments above indicate, that the pragma does influence the accessibility via ADS. The TwinCAT documentation is clearly incomplete here (like in many other places). So I guess the best we can do for now is to reverse engineer these parts. |
I'm just wondering why read_by_name works. Did we already implement the workaround there? Most certainly not 🤔. OK, I had to look it up: for read_by_name we use a handle while for the symbols we aquire the indexGroup and indexOffset via adsGetSymbolInfo. So for me this indicates that adsGetSymbolInfo does not work the way it should for monitored values or it has some undocumented functionality as @dgl-cw suggests. In the first case it would not be a good choice to implement a workaround in pyads as the problem might get fixed in later versions. |
Hi
I was using
read_by_name
before and wanted to switch toget_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
variable
call
❌ 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
variable
call
Mostly the same as above but function block with
call
fails withADSError: 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 caseadsGetSymbolInfo
returns an index_group of0xF019
and an index_offset of0x0
.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 was0xF019
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, whereread_by_name
succeeds. Thus a workaround should be implemented.The text was updated successfully, but these errors were encountered: