fbarresi / BeckhoffS7Client

Unofficial TwinCAT function for S7 Communication
MIT License
34 stars 6 forks source link

Problem reading REAL values #2

Closed dbrowngm closed 2 years ago

dbrowngm commented 2 years ago

Hello, your code is working perfectly for reading and writing INT and BOOL values back and forth between a TwinCAT system and a Siemens S7-1500 PLC. However, I am unable to get REAL values to read.

My GVL config is shown below.

    {attribute 'S7.In'}
    {attribute 'S7.Address' := 'db72.d36.0'}
    VaporizerTemperature : REAL;

The log shows the value is recognized:

2022-07-25 13:48:12.308 -07:00 [INF] Converted Symbol to Gateway GVL.VaporizerTemperature to Input @db72.d36.0 of Type System.Single (isValid = True)

Could you add a REAL value to your example? Any suggestions would be much appreciated!

fbarresi commented 2 years ago

Hi! I will give a look to this deeper in the next days. For now I'm wondering about the way you wrote the address in your attribute. I think it should be just like db72.d36. Could you please give a quick try in the meantime and share the logfile for any errors?

Best regards, FB

dbrowngm commented 2 years ago

Hi FB, I did try removing the .0 bit reference and the behavior was exactly the same.

dbrowngm commented 2 years ago

Hi Frederico, have you been able to reproduce this issue?

fbarresi commented 2 years ago

Hi, sorry for letting you wait for me. I already gave a look into the code, but I wasn't able to reproduce your problem. Actually I'm wondering about this problem, because every variable you define go through the same path here and it is threated in the same way.

Now, according to the logging line and the description you posted, it seems to me like other variables just works well so, I don't know how can I help you. Would you be able to debug the software?

Can you please check or reply on the following things:

Best regards, FB

dbrowngm commented 2 years ago

S7PacketCapture.pcapng.zip

I've attached a wireshark capture of the S7 traffic. Looking through the requests from the S7 client (10.11.1.11) to the Siemens PLC (10.11.1.14), you can clearly see that the REAL values are never requested.

The REAL values are at the following addresses:

72.36
72.40
72.44
72.48
72.52
72.56
72.60
72.120

All of the non-REAL values in the GVL in the TwinCAT config are included in the wireshark capture.

These addresses are all INT datatype and are reading correctly:

72.2
72.4
72.18
72.20
72.22

These addresses are all BOOL data type and are reading correctly:

72.0.0 through .7
72.168.0 through .7
72.169.0 through .7
72.170.0 through .7
72.171.0 through .7

I can try your workaround of reading as BYTE next week. The machine is currently in operation and cannot be shutdown at the moment.

I can send you the full log file via email if you provide me your address. I'd prefer not to post it here due to the proprietary nature of this equipment.

fbarresi commented 2 years ago

Ok, that helps.

I will setup a test basing on it.

Best regards, FB

fbarresi commented 2 years ago

Hi! Thank you for your patience. I found out the problem! 🎉 Sadly it is a bug into Sharp7.Reactive. I already solve it an created a pull request . As soon as it get merged I will be able to update the library also in this project. So please, hold tight, it's going to be better! Thanks for using and improving this reporting this issue, I hope you can be successful in your job now and in future with this library! Best regards, FB

dbrowngm commented 2 years ago

Hi FB,

I see that the Sharp7 code has now been fixed. Can you please update your code now to reflect those changes?

Thanks! Darren

fbarresi commented 2 years ago

Sorry, you are right, I forgot it again. I'm pushing it now. Best regards, FB

dbrowngm commented 2 years ago

Thank you!