Upgrade of Siemens S5 Safety PLC System for Dazhang Quality Inspection Machine
2026-04-06 07:36:47··#1
Abstract:This paper briefly introduces some characteristics of safety PLC and presents an example of upgrading an S5 program to an S7 program. Keywords: Safety PLC, STEP 7, Upgrading Introduction Our company imported a large-scale quality inspection machine in August 2002. Its image inspection system was a second-generation printed product quality image inspection system developed and produced by KBA. Technically outdated, its inspection effect could no longer fully meet our production needs, and its maintenance costs and failure rate were relatively high. Furthermore, its operation was inconvenient. Therefore, it was necessary to modify and upgrade the inspection system. To facilitate the modification and upgrading of the inspection system, based on a comprehensive understanding of the equipment principles and related technologies, we decided to modify and upgrade the electrical control system. System Analysis The electrical control system of the imported large-scale inspection machine uses a Siemens S7412-2 PLC as its core. It connects to two touchscreens via an MPI bus, and to the main motor, main encoder, and ET200L-SC distributed I/O module via a Profibus bus. It connects to the S5 master-slave PLC responsible for main machine operation and safety via serial port one (9364R protocol) of the CP441-2 point-to-point communication module, and to the image detection system via serial port two (RK512 protocol) of the CP441-2 point-to-point communication module. The overall control system architecture is reasonable, mainstream, and flexible. However, the control system also has inconveniences: the S5-95F safety PLC is an outdated Siemens product, increasingly difficult to purchase on the market, and requires DOS-based software configuration before use. If this system malfunctions, it will seriously affect the company's normal production. Therefore, it is necessary to modify and upgrade the S5 system. 1. Hardware Architecture and Features of S5-95F PLC 1) Introduction to Safety-Related PLCs According to IEC standards, a safety-related system is called a Safety-Related System. It has a wide scope and is applicable to all industrial systems. It encompasses various factors affecting safety, such as protection systems composed of instruments, safety measures for process equipment, and management and personnel operation and regulations. Under what circumstances can a PLC be called a safety PLC? Generally speaking, a safety PLC is a programmable logic controller specifically designed for demanding tasks or safety-related applications; if a safety PLC fails, it will not pose a danger to personnel or process safety. In reality, the term "safety PLC" is not entirely accurate. Even if a PLC reaches a specific Safety Integrity Level (SIL), it can still cause unsafe results due to improper use. Of course, depending on the specific SIL level of the PLC, standard PLCs used for automation control can also be used in safety applications. Currently, the programming of some standard PLCs can also be verified for safety applications, and safety network controllers can replace safety PLCs in certain applications. A safety PLC requires various levels of redundancy and chips installed in different areas to be designed and constructed as an accident-safe PLC. It also needs third-party certification to meet the IEC 61508 standard. Ideally, the programming and interface of a safety PLC should be consistent with all other PLCs. This avoids confusion and reduces the possibility of errors. When a safety PLC achieves a specific reliability/failure probability level as required, it means it has extensive self-diagnostic capabilities, monitoring various aspects of hardware status, program execution status, and operating system status. Such a PLC is 'safe'. Currently, PLCs using microprocessor technology are widely used in engineering practice due to their high reliability, high availability, and maintainability. 2) Hardware Architecture of S5-95F PLC The S5-95F (6ES5 095-8FB01) is a small safety PLC launched by Siemens. S5-95F PLC systems generally employ a redundant design, including two independent PLC units (including CPU, power supply, and I/O), interconnected via fiber optic cables. The two S5-95F PLCs provide the following I/O resources: ① 16 failsafe digital inputs (DI32.0-33.7) ② 8 failsafe digital outputs (DQ32.0-32.7) ③ 8 digital outputs (A: DQ33.0-33.3, B: DQ32.0-34.3) ④ 4 failsafe interrupt inputs (DI59.0-59.3) ⑤ 2 failsafe counter inputs. These addresses are fixed and cannot be changed. After the system starts running, the S5-95F will test the above failsafe I/Os within a specified time. If an I/O fails, each I/O point or the system will return to a safe state within one basic cycle. The S5 system of the Dazhang inspection machine includes two S5-95F PLCs (PLC A and PLC B). Each PLC system has independent sensor input signals, and the outputs are coupled using intermediate relays to form a redundant system with a high safety level. A wiring example is shown in Figure 1. S1a and S1b in the figure are two independent sensors for the same safety protection device, serving as input signals for PLC A and PLC B respectively, thus providing higher redundancy for the safety signals. The relays only engage when both PLC A and PLC B's DQ32.2 outputs simultaneously, ensuring that critical external devices are controlled by both PLC A and PLC B, further enhancing the system's safety level. 3) S5-95F PLC Program (Step 5) Logic: The Step 5 programming language mainly consists of five types of blocks: Organization Blocks (OBs), Program Blocks (PBs), Continuous Blocks (SBs), Function Blocks (FBs), and Data Blocks (DBs). The organization block, as the entry point for the operating system's user program, determines the program's structure; program blocks (PBs), contiguous blocks (SBs), and function blocks (FBs) complete specific subroutine functions; data blocks (DBs) store the data required by the program. OB1 is used for loop processing and is the main program of the user program; OB21 and OB22 are executed only when the program starts. The program structure of the S5-95F PLC in the Dazhang quality inspection machine is shown in Figure 2. Program initialization is performed in OB21 and OB22, and PB10, PB11, PB12, and PB14 program blocks are called cyclically in OB1 to complete related program functions. Data exchange between the S5-95F PLC and the S7412-2 PLC is also discussed. The S5-95F PLC communicates with the S7412-2 PLC via serial port 1 (9364R protocol). The data transmission process is shown in Figure 3. 4) The controlled objects of the S5-95F PLC system and its role in the electrical control system: The input signals of the S5-95F PLC system of the Dazhang quality inspection machine are switch signals such as buttons and sensors, which do not have high time sensitivity requirements. Based on these input signals and the enable signal and operating information of the S7412-2 PLC, the S5-95F PLC system controls the movement of the main motor and ensures system safety according to the pre-set logic relationship. It also sends relevant safety information and alarm information to the S7412-2 PLC for display and control via the serial port. Based on the characteristics and safety level requirements of printing machinery, the rigorous program logic and the inherent safety and reliability of the Siemens PLC can fully meet the safety requirements of the electrical system of the Dazhang quality inspection machine. Therefore, this part of the control program of the S5-95F PLC can be integrated into the S7412-2 PLC program. 2. Scheme Selection Undoubtedly, the Dazhang quality inspection machine uses a stable and reliable industrial PLC as its control center. For this S5-95F PLC modification and upgrade, we have summarized three candidate schemes based on the actual situation: First, replace the S5-95F PLC with three I/O modules of the S7412-2 PLC, redesign the program block that can complete the original S5-95F PLC system functions, and integrate it into the S7412-2 PLC program; Second, replace the S5-95F PLC control system with an S7400 series PLC system; Third, replace the current control system as a whole with a PLC of other brands (taking Omron as an example). (1) Risk Comparison of Scheme Implementation In view of the requirements of industry applications, we define the risk of upgrading the localization of imported Dazhang quality inspection machines as follows: the uncertainty of completing the localization upgrade on schedule, specifically divided into technical uncertainty and construction uncertainty. The technical uncertainty includes the uncertainty of the application level of the control platform and the uncertainty of the understanding of the operating logic of the controlled object. Option 1 integrates the S5 control program into the S7 PLC as a hardware and software module without altering the program flow. This fully meets the low-speed requirements of the controlled objects, such as buttons, sensors, and main motors connected to the S5. Wiring work is minimal, and there are no critical uncertainties regarding hardware performance, wiring connections, or the understanding of the controlled object's operational logic. Option 2 replaces the outdated PLC with a mainstream PLC system from the same brand. The implementation risk is similar to, or even lower than, Option 1. Option 3 involves significant changes in both hardware and software, resulting in greater uncertainty in both technology and construction, particularly regarding the understanding of the controlled object's operational logic. Essentially, the electrical control system of the Dazhang quality inspection machine utilizes highly standardized PLC control technology and products. As long as the technical application capabilities of the corresponding platform and a deep understanding of the controlled object's operational logic are available, the risks of any option can be controlled. To be precise, Option 3 requires a large amount of construction work and a complete and in-depth understanding of the controlled object's operational logic. With the same platform application capabilities, Options 1 and 2 have lower overall risks. (2) Comparison of ease of use and maintenance: In terms of ease of use, both Scheme 1 and Scheme 2 retain the current operating methods and procedures, making them easier for workers to use than Scheme 3. In terms of ease of maintenance, Scheme 1, after upgrading outdated components to mainstream products, is comparable to Scheme 2. Therefore, the three schemes are not significantly different in terms of ease of use and maintenance. (3) Comparison of the economics of modification and maintenance: To this day, the reliability of any mainstream brand PLC (Siemens, Schneider, Omron, Mitsubishi, Rockwell, Keyence, etc.) can be guaranteed, and the failure rate is very low. Siemens PLCs are even more so. It can be said that the Siemens PLCs on imported large-scale quality inspection machines, whether S7 or S5 safety PLCs, are very likely to have a longer lifespan than brand new PLCs from other brands. Moreover, Siemens PLCs have a very high market share and are increasingly used in this industry (such as automatic sealing lines, multi-functional coding machines, centralized gas supply systems, etc.), and spare parts are very convenient. Since Option 1 only requires the purchase of three I/O cards—two 32-bit digital input cards (6ES7 421-1BL01-0AA0) and one 32-bit digital output card (6ES7 422-1BL00-0AA0)—the investment is significantly less compared to Option 2 and Option 3, which require purchasing an entire PLC system. Therefore, in terms of the economics of modification and maintenance, Option 1 is the best, followed by Option 2, and Option 3 is the worst. Considering the above comparison results, we believe that the best option is Option 1, which involves integrating the S5 control program into the S7 PLC as a hardware and software module based on a reasonable analysis of the control program. This maximizes operational continuity, improves project economy, reduces modification risks, and ensures rapid upgrade and replacement in case of S5 PLC failure. Solution Implementation 1: Hardware Design. Add the necessary I/O cards to the mainboard of the S7412-2 PLC, namely two 32-bit digital input cards (6ES7 421-1BL01-0AA0) and one 32-bit digital output card (6ES7 422-1BL00-0AA0). Connect the original wiring from the S5-95F PLC to the corresponding positions on these three I/O cards. Assign addresses to each I/O in STEP 7 according to the slot positions. To ensure system safety and reliability, the two independent sensor signals (safety information such as safety covers) originally connected to the master and slave S5-95F PLCs are connected in series to the corresponding input points on the I/O cards (Note: Whether the signals are connected in parallel or in series should be based on the on/off state of the switch signal during operation) to improve system redundancy and safety level. The original S5-95F PLC control system has two independent PLC units, with some outputs coupled using intermediate relays. In the new system, the negative terminal of the 24V DC power supply should be directly connected to one end of the relay coil, and the other end should be connected to the positive terminal through the corresponding output point of the digital output card. This will achieve the same control function as the original system. 2. Software Design 1) Based on the allocated I/O addresses, the S5_Run_Program function design is converted. ① To ensure program logic reliability and avoid resource conflicts, the principle of resource separation is adopted. Therefore, the Reference Data in STEP 7 is used to check the resources (I/O points, M, T, etc.) in the original S7 system, confirming resources not used by the original S7 system. These resources are then allocated to the S5_Run_Program function block, and the resources of this function block are concentrated as much as possible to ensure that the resources in the S5_Run_Program program do not overlap with the resources (I/O points, M, T, etc.) in the original S7 system, avoiding conflicts and improving the convenience and modifiability of program design. ② The symbolic quantities are edited to improve program readability. Use the Symbol Table in STEP 7 to edit symbolic variables, such as using "BUZZER" as the symbolic variable for Q0.7. This makes reading and designing programs easier to understand and read. ③ Analyze the characteristics of the controlled object to ensure its safety. The object controlled by the S5_Run_Program function is a high-power DC motor. To prevent the DC motor from experiencing "magnetic runaway," it is necessary to ensure that when starting the motor, the excitation power supply is supplied first, and then the armature power supply is supplied after ensuring that the excitation power supply is on. When stopping the motor, the order is reversed, that is, the armature power supply is disconnected first, and then the excitation power supply is disconnected. Therefore, the S5_Run_Program function should ensure the safety and reliability of the motor. When starting the motor: first supply the excitation power supply (53K13 closed), and then supply the armature power supply (53K11 closed) after the excitation power supply is on (feedback after the normally open contact of 53K13 is closed). When stopping the motor, first disconnect the armature power supply (53K11 disconnects when power is lost), then after a 15-second delay, disconnect the excitation power supply (53K13 disconnects when power is lost), as shown in the following procedure. Motor Start: OM 121.1 OM 120.0 S "MAIN MOTOR FIELD" // 53K13 — Excitation Power Supply A (OM 121.1 OM 120.0) A "FB-MOTOR FIELD" // Excitation Power Supply Feedback (53K13 Normally Open Contact) S "MAIN MOTOR DRIVE POWER" // 53K11 — Armature Power Supply Motor Stop: AN M 121.1 AN M 120.0 AN "MAIN MOTOR DRIVE RELAY" R "MAIN MOTOR DRIVE POWER" // 53K11 — Armature Power Supply NOP 0 A "MAIN MOTOR DRIVE POWER" // 53K11 — Armature Power Supply L S5T#15S SF T 14 AN T 14 AN M 121.1 AN M 120.0 R "MAIN MOTOR FIELD" // 53K13 ———— Excitation Power Supply ④, Design the individual functions of this function block according to the resources allocated by S5_Run_Program. During program design and conversion, attention should be paid to the correspondence between organization blocks, function blocks, and data blocks in Siemens STEP 5 and STEP 7. In STEP 5, OB and DB blocks still correspond to OB and DB blocks in STEP 7, but FB, SB, and DB all correspond to FC in STEP 7. In STEP 7, OB100 and OB101 (OB121 and OB22 in STEP 5) are only executed when the program starts. ⑤, Ensure system data exchange. Since the S5_Run_Program function block is integrated into the original S7412-2 PLC program, the information originally transmitted from the S5-95F PLC to the S7412-2 PLC via serial port can now be transferred in the new program by simply sending the data stored in the corresponding M area to the DB area of the S7412-2 PLC within the S5_Run_Program function. This completes the information transfer between the two PLCs (S7412-2 PLC and S5-95F PLC). See below: L MW 74 T DB100.DBW 2 L MW 76 T DB100.DBW 4 L MW 78 T DB100.DBW 6 ⑥. Integrated function block. Each function can be simulated and debugged to ensure its logical reliability. Then, according to the logical calling order, the function is integrated into a function block to ensure the relative independence of the original STEP 5 and STEP 7 programs; 5) To ensure the reliability of the S5_Run_Program function block, the initialization program S5_Init for this function block is designed. 6) In OB1 of the S7412-2 PLC program, call S5_Run_Program: CALL "AUT-MAN" CALL "MAN" CALL "AUTO" CALL "RUN" CALL "COMMAND" …… CALL "Counter" CALL "DATA for OP 27" CALL "S5_Run_Program" 7) In the PLC INIT (PLC program initialization) function of the S7412-2 PLC program, call S5_Init: CALL "S5_Init" AN M 255.0 OM 255.0 R "M 5.1" R "M 30.3" R "M 30.4" R "M 12.0" SM 81.5 …… RM 169.7 R "DEV. 10" R "DEV. 11" …… R "M 70.1" LW#16#0 T MW 39 T MB 11 ...T MW 144 OPN DB 10 LW#16#0 T DBW 2 ... RM 60.0 RM 103.0 Conclusion Based on the above methods, we successfully completed the electrical control system upgrade of the large-scale quality inspection machine. The upgrade and modification of the S5-95F PLC, with correct external wiring, was successful on the first attempt without on-site testing, achieving the expected goals. References: 1. SIEMENS Simatic S5 S5-95F Progrmmable Controller Manual; 2. KBA NotaCheckII Supporting Technical Documents . Deng Shijun, male, graduated from the Department of Automatic Control, Electrical Technology, Beijing University of Aeronautics and Astronautics in July 1992. Currently working in equipment management at Chengdu Printing and Minting Company.