Read the spindle speed in a SIEMENS PLC s7 300 with python snap7

460 Views Asked by At

I would like to read the spindle speed of a Siemens PLC 317-2DP with NCU 720.2.

To do that, I use the python snap 7 library. I managed the connexion to the PLC, but I would like to read the spindle speed with the function read_area(area: Areas, dbnumber: int, start: int, size: int). I am unable to find the parameters dbNumber, start and size for my case.

Does someone can help me please? I read that it depends of the configuration of the PLC, but where I can find this configuration?

Thanks for your help

I read the documentation from Siemens "SINUMERIK 840D sl NC variables and interface signals" but I didn't find what I needed...

2

There are 2 best solutions below

0
DonMiguelSanchez On

In general in order to access to a variable in the plc you need to have a db block as I previously mentioned in one of my comments, but one important thing is to marked this block as not optimized:

Optimized block access off

if you have created this db an you recently added new variables a compile is needed to recalculate the offset in the variables. If you perform these steps successfully you will be able to see the offsets like in the following image:

variable offsets

I post this information as an answer for people that need that information in the future.

Regards

Miguel

0
DarthMorh On

Just to add more information to the answer, in the case of the S300 they are not able to mark the optimized block access (At least in my case a S313-2 DP)