Runtime Network Health Monitoring Between a Siemens S7 and LOGO! PLC

Summary

The Siemens LOGO! may be integrated into a larger S7 industrial network. This article is focused on monitoring the network connection from both the S7 and the LOGO! perspective. It’s a watchdog handshake where the S7 issues a pulse per second and expects a prompt reply from the LOGO!. The code operates at the application level where decisions are made as part of each PLC’s scan cycle.

Download the LOGO! and S7 files which were coded in LOGO! V8.4 and TIA Portal V20 for a CPU 1215FC: LOGO to S7.zip (1.3 MB)

:link: This article is part of DigiKey’s Siemens PLC and Automation Resource Hub. Visit the hub for more technical briefs on Siemens components, applications, and programming.

Figure 1: Side-by-side image of the Siemens S7-1200 and LOGO!.

Why would a LOGO! be used on an S7 network?

The LOGO! PLC fills a niche where the S7 1200 and S7-1500 are overkill. This includes the Safety Integrity Level (SIL) rated ET 200SP distributed I/O (Figure 3) used to expand the S7’s coverage.

LOGO! is useful for low-cost installations where independent logic is required at the edge of your network. LOGO!s with the integral text-based HMI (Figure 1) provide a desirable cost saving measure when a full featured HMI is not required.

How to Connect a Siemens LOGO! Client

The Siemens LOGO! may operate as a client on your S7-1200 or S7-1500 network. Siemens provides a detailed hands-on document showing how to configure both the LOGO! and S7. The document explores:

  • IP settings
  • S7 connections
  • Variable naming with emphasis on the S7 tags
  • LOGO! and S7 network configuration

Figure 2: Image from the Siemens webpage highlighting the LOGO to S7 connection.

Figure 3: Image of a Siemens S7-1200 distributed I/O on the author’s workbench.

Tech Tip: The ET 200 SP was built from the ground up to interface with the S7. It includes user programmable default (fail safe) logic that will activate upon loss of the network. For example, upon loss of network connectivity, an output may hold the last value, default high, or default low.

Why monitor network health?

Murphy’s law applies to industrial networks and PLCs. If it can, it will go wrong and at the worst possible moment.

For program sanity, both the LOGO! and the S7 monitor the network connection. If there is a fault, we can take appropriate action. The remainder of this brief describes LOGO! and S7 code to detect a network error or failure of the partner. Each PLC outputs a Boolean xFault that you can use to perform an orderly shutdown or limp-along routine.

Example S7 Code

The core ladder logic functionality is included as Figure 4. The key is to monitor xHeartbeat and xReply. This operates like a watchdog timer where the S7 expects to be fed by the LOGO!.

  • xHeartbeat: The heartbeat is a pulse per second signal with a 50% duty cycle that is sent across the network to the LOGO!.

  • xReply: The xReply is simply an echo, the LOGO! receives the byte from the S7 and then transfers it back to the S7 once per scan cycle.

As shown in the Figure 4 ladder logic, Network 1 performs an XOR operation to determine when xHeartbeat is different from xReply. Under normal operation, xReply is always slightly behind xHeartbeat for every 0 \rightarrow 1 or 1 \rightarrow 0 transition. This reflects the network latency and the time it takes for the LOGO! and S7 to perform their scan cycle operations.

Network 2 captures the transition latency time. See the results section for more information.

Network 3 includes a time-based trigger (TON function) that will set xFault if xReply does not respond fast enough. The reset logic is shown in Network 4.

Figure 4: Ladder logic function block allowing the S7 to monitor network and LOGO! connectivity.

Example LOGO! Code

The LOGO! function block code is included as Figure 5. The topmost NI1 and NQ1 blocks perform the critical echo of the S7’s xHeartbeat signal.

The timers in blocks 2 and 4 monitor the time spent in either a high or a low state. It’s important to monitor both states as the last received S7 message, as stored in the LOGO! memory, could be TRUE or FALSE. If no transitions occur in the 1.25 second window, a TON activates and the LOGO! enters a fault state.

The fault is latched by the B001 set/reset block. A fault will turn on the LOGO’s HMI red backlight. Finally, the fault is reset by pressing the LOGO’s left arrow key.

Figure 5: LOGO! Code to monitor S7 partnership with network status displayed as HMI color.

Results

The benchtop results are captured in Figure 6 where we see the expected latency between 70 and 260 ms. We can assume the S7 and LOGO! are the processing bottlenecks.


LOGO to S7.zip (1.3 MB)

Figure 6: Trace showing the network latency and response time of the LOGO!

Tech Tip: The delays in Figure 6 are concerning as 250 ms is a sizable portion of the 500 ms signal time. I recommend you add a function block to capture the min, max, and average latency times. This will certainly be useful for future troubleshooting.

If necessary, the timing restrictions can be reduced. Depending on your application, it’s trivial to extend the pulse period to a minute or even more if necessary.

Parting Thoughts

Both the LOGO! and S7 have their strengths that you can leverage by operating them on the same network. The featured code shows a way to detect a fault on that network.

There will be partner and network faults. With this detection code you can determine what is safe and appropriate machine response.

Welcome to PLC corner case programming.

Your next assignment is to monitor and control data flow in the S7 network.

Best wishes,

APDahlen

Related Articles by this Author

If you enjoyed this article, you may also find these related articles helpful:

TL;DR

About This Author

Aaron Dahlen, LCDR USCG (Ret.), serves as an application engineer at DigiKey. He has a unique electronics and automation foundation built over a 27-year military career as a technician and engineer which was further enhanced by 12 years of teaching (interwoven). With an MSEE degree from Minnesota State University, Mankato, Dahlen has taught in an ABET-accredited EE program, served as the program coordinator for an EET program, and taught component-level repair to military electronics technicians.

Dahlen has returned to his Northern Minnesota home, completing a decades-long journey that began as a search for capacitors. Read his story here.

1 Like