Siemens PLC Practical Guide: Building a Highly Reliable Station Automation System with a Full-Stack Solution from Hardware to Software

The station automation system can significantly enhance operational efficiency, safety, and passenger experience, with the core being the organic integration of Siemens PLC control technology and network communication.

1. Hardware Configuration

The Siemens PLC plays a central role in the station automation system, and the selection must fully consider control points, communication requirements, and system scalability. Common configurations are as follows based on the scale and functional requirements of the station:

PLC and Expansion Module Selection Description:

  • Main Control PLC: S7-1500 series (CPU 1516-3 PN/DP), with high-performance processing capability and rich communication interfaces

  • Distributed I/O: ET 200SP series, flexibly arranged at platforms, corridors, equipment rooms, etc.

  • Safety Module: F-DI/DO module, meeting SIL2/3 safety requirements

I/O Point Allocation Table (Including Addresses):

| Device Type | Function Description | I/O Type | Address Range | Quantity |

|———|———|———|———|——|

| Escalator Control | Operating Status | DI | %I0.0-%I1.7 | 16 points |

| Escalator Control | Start/Stop Command | DO | %Q0.0-%Q0.7 | 8 points |

| Platform Door | Position Detection | DI | %I2.0-%I3.7 | 16 points |

| Platform Door | Switch Control | DO | %Q1.0-%Q1.7 | 8 points |

| Passenger Flow Detection | Count of People | AI | %IW64-%IW72 | 8 channels |

| Environmental Monitoring | Temperature, Humidity, etc. | AI | %IW80-%IW88 | 8 channels |

| Lighting System | Brightness Control | AO | %QW64-%QW68 | 4 channels |

System Wiring Key Points Description:

  • Standard 35mm rail installation inside the control cabinet, terminal block numbering corresponds to PLC addresses

  • Field devices connected using shielded cables, with strong anti-interference capability

  • Analog sensors use 4-20mA signals, three-wire connection

  • Key devices such as platform doors use dual-redundant wiring to ensure control reliability

2. Control Program Design

The program design of the station automation system adopts a hierarchical structure, with clear functional divisions and standardized variable naming as the basis for ensuring system reliability.

Variable Definition Specification:

// Global variable naming rules

// Format: g_<data type="">_<functional area="">_<specific function="">

// Example:

g_b_Platform_DoorOpened     // Boolean, platform door has been opened

g_i_Escalator_Speed         // Integer, escalator speed

g_r_Environment_Temperature // Real, environmental temperature
</specific></functional></data>

Program Architecture Design:

The program adopts the following hierarchical structure:

  • OB1: Main loop, calls various functional modules

  • OB30-38: Cyclic interrupts, handle timed tasks

  • OB80-88: Diagnostics and error handling

  • FB100-199: Device control function blocks

  • FC200-299: Auxiliary functions

  • DB300-399: Data storage blocks

Function Block Design Example:

// FB150 - Platform Door Control Function Block

FUNCTION_BLOCK "FB_PlatformDoor"

{ S7_Optimized_Access := 'TRUE' }

VERSION : 0.1

   VAR_INPUT 

      bOpenCommand : Bool;        // Open command

      bCloseCommand : Bool;       // Close command

      bEmergencyStop : Bool;      // Emergency stop

      bObstacleDetected : Bool;   // Obstacle detection

   END_VAR


   VAR_OUTPUT

      bDoorOpened : Bool;         // Door fully opened

      bDoorClosed : Bool;         // Door fully closed

      bDoorMoving : Bool;         // Door is moving

      bError : Bool;              // Error state

      iErrorCode : Int;           // Error code

   END_VAR


   VAR

      iState : Int := 0;          // Internal state machine

      tTimeout : Time;            // Operation timeout timer

      tStartTime : Time;          // Operation start time

   END_VAR


BEGIN

   // Emergency stop handling

   IF #bEmergencyStop THEN

      #iState := 100;             // Emergency stop state

   END_IF;
   
   // State machine implementation

   CASE #iState OF

      0:  // Idle state

         #bDoorMoving := FALSE;

         IF #bOpenCommand AND #bDoorClosed THEN

            #iState := 10;        // Transition to open door state

            #tStartTime := TIME();

         ELSIF #bCloseCommand AND #bDoorOpened THEN

            #iState := 20;        // Transition to close door state

            #tStartTime := TIME();

         END_IF;
         
      10: // Open door state

         #bDoorMoving := TRUE;

         // Add open door drive code here

         IF #bDoorOpened THEN

            #iState := 0;         // Door fully opened, return to idle state

         ELSIF TIME() - #tStartTime > T#10S THEN

            #iState := 110;       // Open door timeout, enter error state

         END_IF;
         
      20: // Close door state

         #bDoorMoving := TRUE;

         IF #bObstacleDetected THEN

            #iState := 10;        // Obstacle detected, reopen door

         // Add close door drive code here

         ELSIF #bDoorClosed THEN

            #iState := 0;         // Door fully closed, return to idle state

         ELSIF TIME() - #tStartTime > T#10S THEN

            #iState := 120;       // Close door timeout, enter error state

         END_IF;
         
      100: // Emergency stop state

         #bDoorMoving := FALSE;

         // Add emergency stop handling code here

         IF NOT #bEmergencyStop THEN

            #iState := 0;         // Emergency stop released, return to idle state

         END_IF;
         
      110: // Open door error

         #bError := TRUE;

         #iErrorCode := 1;

         // Add error handling code here

         
      120: // Close door error

         #bError := TRUE;

         #iErrorCode := 2;

         // Add error handling code here

   END_CASE;
END_FUNCTION_BLOCK

State Control Design:

The station automation system uses a state machine to manage the operating modes of various devices and system states:

  1. Normal Operation Mode: All devices operate normally

  2. Peak Mode: Escalators speed up, adjust lighting brightness

  3. Emergency Mode: Take corresponding measures based on different levels of emergency events

  4. Night Mode: Turn off non-essential devices, reduce energy consumption

  5. Maintenance Mode: Allow maintenance personnel to service the equipment

3. Communication Network Architecture

The station automation system requires an efficient and reliable communication architecture to ensure seamless collaboration between subsystems.

Fieldbus Selection:

  • Platform Level: PROFINET, meeting real-time control requirements of 10ms

  • Device Level: PROFIBUS DP, connecting traditional field devices

  • Sensor Level: IO-Link, flexibly connecting smart sensors

Remote Communication Solutions:

  • Inter-station Communication: Industrial Ethernet, fiber optic redundant ring structure

  • Control Center Access: OPC UA server, achieving data transparency

  • Remote Maintenance: VPN encrypted tunnel, ensuring remote access security

Network Security Considerations:

  • Firewall Partitioning: Physical isolation of control network and office network

  • Access Control Lists: Restrict communication permissions between devices

  • Data Encryption: Key commands and data use TLS encryption

  • Intrusion Detection: Real-time monitoring of abnormal communication behavior

Communication Protocol Design:

  • Device Status Data: Collected in a 5-second cyclic manner

  • Alarm Information: Triggered by changes, priority transmission

  • Historical Data: Timed batch upload every 15 minutes

  • Control Commands: Confirmation mechanism to prevent misoperation

4. Operation Interface Design

The human-machine interface is the window for operators to interact with the station automation system, and excellent interface design can greatly enhance system usability.

Interface Layout Description:

  • Top Area: System status indication, time information, alarm overview

  • Central Area: Platform layout diagram, real-time display of device status

  • Left Area: Device navigation tree for quick location

  • Right Area: Detailed parameters and control panel of devices

  • Bottom Area: Alarm information scrolling bar and quick function buttons

Parameter Setting Description:

  • Hierarchical Permission Control: Three levels of permissions for operators, engineers, and administrators

  • Online Parameter Modification: Key parameter modifications require secondary confirmation

  • Parameter Range Check: Prevent misconfiguration leading to system anomalies

  • Parameter History Record: Record modification history for fault analysis

Operation Monitoring Description:

  • Color Coding: Green (Normal), Yellow (Warning), Red (Alarm)

  • Real-time Trend Graph: Displays key indicators such as passenger flow and energy consumption

  • Device Operating Time Statistics: Predict maintenance needs

  • 3D Visualization: Intuitive display of station equipment operating status

Alarm Handling Description:

  • Alarm Levels: Four levels – Minor, General, Severe, Emergency

  • Popup Prompt: Important alarms automatically pop up, requiring confirmation for handling

  • Alarm Filtering: Filter display by device type and severity

  • Alarm Response Process: Standardized confirmation, handling, and recovery process

5. Exception Handling and Fault Safety

The station automation system must have a comprehensive exception handling mechanism to ensure safe operation under various fault conditions.

Exception Detection Mechanism:

  • Watchdog Timer: Monitors whether the PLC program is running normally

  • Communication Timeout Detection: Monitors network communication status

  • Sensor Signal Rationality Check: Prevent erroneous signals from causing misoperation

  • Redundant Signal Comparison: Key signals use dual or triple redundancy

Fault Response Strategy:

  • Graded Response: Take different measures based on the severity of the fault

  • Graceful Degradation: When non-critical functions fail, the system continues to provide core services

  • Safe Position: Drive devices into predefined safe states

  • Backup Resource Switching: Automatically switch to backup control units or communication paths

Data Block Example:

// DB350 - System Exception Handling Configuration Data Block

DATA_BLOCK "DB_ErrorHandling"

{ S7_Optimized_Access := 'TRUE' }

VERSION : 0.1

NON_RETAIN

   STRUCT 

      // Fault safety configuration

      SafetyConfig : STRUCT

         EnableWatchdog : Bool := TRUE;           // Enable watchdog

         WatchdogTime : Time := T#1S;             // Watchdog time

         CommTimeout : Time := T#5S;              // Communication timeout

         AutoResetMinorErrors : Bool := TRUE;     // Auto-reset minor faults

         MaxAutoResetCount : Int := 3;            // Maximum auto-reset count

      END_STRUCT;
      
      // Fault status record

      ErrorStatus : STRUCT

         SystemErrorActive : Bool := FALSE;       // System fault active

         ErrorCode : DWord := 16#0;               // Error code

         ErrorTimestamp : DTL;                    // Error timestamp

         ErrorLocation : String[50];              // Error location

         ErrorDescription : String[100];          // Error description

         ErrorResetCount : Int := 0;              // Error reset count

      END_STRUCT;
      
      // Device fault response configuration (for different device types)

      DeviceErrorResponse : ARRAY[1..10] OF STRUCT

         DeviceType : Int;                        // Device type

         SafePosition : Int;                      // Safe position definition

         RequireManualReset : Bool;               // Requires manual reset

         AlarmPriority : Int;                     // Alarm priority

         BackupDeviceID : Int;                    // Backup device ID

      END_STRUCT;

   END_STRUCT;

BEGIN

   // Initialize device fault response configuration

   DeviceErrorResponse[1].DeviceType := 1;        // Escalator

   DeviceErrorResponse[1].SafePosition := 0;      // Stop

   DeviceErrorResponse[1].RequireManualReset := TRUE;

   DeviceErrorResponse[1].AlarmPriority := 2;     // General priority

   DeviceErrorResponse[1].BackupDeviceID := 0;    // No backup device
   
   DeviceErrorResponse[2].DeviceType := 2;        // Platform Door

   DeviceErrorResponse[2].SafePosition := 1;      // Open state

   DeviceErrorResponse[2].RequireManualReset := TRUE;

   DeviceErrorResponse[2].AlarmPriority := 3;     // High priority

   DeviceErrorResponse[2].BackupDeviceID := 0;    // No backup device
   
   // More device configurations...

END_DATA_BLOCK

Conclusion

The station automation system is a comprehensive control system that integrates various technologies. This article elaborated on hardware configuration, program design, communication network, operation interface, and fault handling. We welcome discussions and exchanges of more practical experiences!

Leave a Comment