Search code examples
c#cycleplcsiemens

C# and Siemens PLC communication


Does anyone know a C# read data command will take place in which step of PLC cycle?

The PLC process steps are:

  1. The operating system starts the scan cycle monitoring time.
  2. The CPU writes the values from the process-image output table in the output modules.
  3. The CPU reads out the status of the inputs at the inputs modules and updates the process-image input table.
  4. The CPU processes the user program in time slices and performs the operations specified in the program.
  5. At the end of a cycle, the operating system executes pending tasks, such as the loading and clearing of blocks.
  6. The CPU the goes back to the begining of the cycle after the configured minimum cycle time, as necessary, and starts cycle time monitoring again.

My purpose is to find out how a C# application can affect on PLC CPU scan cycle time.


Solution

  • It really depends on how you read values from the PLC, but - in general - it's irrelevant: whenever you read, you get the value stored in PLC memory at that time.

    From my experience, client applications connected to PLCs have no measurable effect on scan cycle time. By the way, I highly recommend you to use OPC UA subscriptions to maximize read / write efficiency and let the PLC firmware manage tasks internally.

    Probably a more detailed answer is possibile with additional details (PLC type, library used for connection / data read-write, ecc).