Control Parameters
IEC 104 data communication is bidirectional, i.e. both client and server can be sender and receiver of messages, which is divided into three set of frames which serves different purposes:
- I-frames (Information Frames): payload that contains data (measurements, commands, etc) and incremental sequence number (sq);
- S-frames (Supervisory Frames): used primarily for management and control of I-frames (Receive Ready for receipt and indicate the receiver is ready to accept more I-frames);
- U-frames (Unnumbered Frames): used to test network connectivity (TESTFR_ACT, TESTFR_CON).
The transmission is regulated with a set of link control parameters: K,W,T0-T3, ref Properties
Connection Establishment
Parameters: T0
Used by: client
Usage: Ensuring that the client does not indefinitely wait for a respons.
Value: Typically the T0 timer is set to about 30 seconds, providing a reasonable window to accommodate network delays and server processing times.
Example:
- Client connects to the server and waits for T0 for server to accept connection request;
- Client aborts after T0 timeout;
Data Transmission
Parameters: K, W, T1, T2
Used by: client and server
Usage: Ensures all I-frames are received orderly and processed by the receiver
Values: The sender will stop sending I-frames and wait for S-frame either when number of I-frames sent before last received S-frame reach K or T1 timeout. The receiver will send S-frame when number of received I-frames reach W or T2 timeout. To avoid the sender to wait for S-frames from the receiver, W and T2 for the receiver should be less than K and T1 for the sender, typically 1/2.
Example:
- Server sends up to K number of I-frames before stopping and waiting for ack (S-frame);
- Server resends the I-frames sent after last received ack if no acknowledment is received before T1 timeout;
- Client sends the ack after it has received W number of I-frames or T2 has timed out.
- Server resets the K counter and T1 timer when receiving ack and continue sending I-frames;
Example 2:
- Client has X number of command items where X > Server value of W
- Client tries to send a command item for all items at once
- Client will only be able to send X - Server value of W commands before the Server has processed and sent ack (S-frame)
- Client will in Apis see good quality for the first successfully sent Server value of W command items and bad quality for the rest
Connection Integrity
Parameters: T3
Used by: client and server
Usage: Ensures connection is alive
Values: Typically to avoid unnecessary sending of U-frames, T3 should be greater than the other timers, typically set to 20 seconds.
Example:
- Client receives no I-frames within T3 timeout peroid;
- Client sends an U-frame (TESTFR_ACT) to test connection;
- Server sends an U-frame (TESTFR_CON) back to Client to confirm connection;
Choosing Client Values Based On Server Values
Calculating client parameters from server parameters
Formula and example values for calculating client side parameters:
Parameter | Server Value | Client Formula | Server Example | Client Example |
---|---|---|---|---|
K | K_S | W_S * 2 | 12 | 16 |
W | W_S | K_S / 2 | 8 | 6 |
T0 | 30s | 30s | ||
T1 | T1_S | T2_S * 2 | 16s | 20s |
T2 | T2_S | T1_S / 2 | 10s | 8s |
T3 | 20s | 20s |
Choosing Server Values or Client Values With Unknown Server Values
Considerations for choosing K
Setting the "k" parameter has significant implications for the performance and efficiency of the network communication. The choice of a low vs. a high "k" value affects several aspects of the protocol's operation:
Low k Value (e.g., k=1):
- Increased Acknowledgments: A low "k" value means that each I-frame must be acknowledged before the next one can be sent. This can significantly increase the number of acknowledgment messages (S-frames), adding to the overhead in the communication.
- Lower Throughput: The need for frequent acknowledgments limits the number of I-frames that can be sent in a given period, potentially reducing the overall throughput of application data.
- Higher Sensitivity to Latency: The communication becomes more sensitive to network latency. Each I-frame's transmission depends on the round-trip time (RTT) for the acknowledgment of the previous frame, making the data transfer rate more susceptible to delays.
- Improved Error Recovery: On the positive side, a low "k" value can lead to faster error detection and recovery since any lost or unacknowledged frame will halt the transmission more quickly, allowing for prompt retransmission.
High k Value (e.g., k=1000):
- Reduced Acknowledgments: A higher "k" value allows more I-frames to be sent before an acknowledgment is required, reducing the overhead caused by acknowledgment messages and potentially making the communication more efficient.
- Higher Throughput: More I-frames can be "in-flight" before an acknowledgment is needed, which can significantly increase the data transmission rate, especially in networks with high latency.
- Buffer and Memory Considerations: Both the client and server must have sufficient buffer space to handle the higher number of unacknowledged I-frames. This requires careful resource management, especially in systems with limited memory.
- Delayed Error Recovery: With more unacknowledged frames allowed, it may take longer to detect and recover from errors. Lost or corrupted frames might only be identified after more frames have been sent, potentially complicating error recovery processes.
The choice between a low and high "k" value depends on the specific requirements of the application and the characteristics of the network. A low "k" may be preferred in networks where minimizing latency and quick error recovery are critical, albeit at the cost of throughput. A high "k" might be advantageous in stable networks with high latency or where maximizing throughput is desired, provided that the system can handle the increased memory and processing requirements for managing a larger number of unacknowledged frames. Balancing these factors is key to optimizing the performance and reliability of IEC 104 communications.
A commonly used range for "k" in many implementations is between 12 and 128. This range is considered to provide a good balance between throughput and the ability to quickly recover from errors in a variety of network conditions. However, the optimal value within this range, or even outside of it, should be determined based on testing and evaluation in the specific network environment and application context where it will be used.
Considerations for choosing W
A common recommendation is to set W
to approximately half of K
. This guideline helps to ensure that acknowledgments are received and processed before reaching the maximum number of unacknowledged I-frames, thus reducing the risk of transmission stops and enhancing data integrity.
For example, if `K = 32`, then `W` might effectively be set to around 16.
This ratio helps in managing network traffic more smoothly and prevents the scenario where the sender has to stop sending frames and wait for acknowledgments too frequently (which would happen if W
is too low) or too infrequently (which risks data overflow and errors if W
is too high).
Considerations for choosing T0
Recommended Setting: Typically, T0 is set to 30 seconds. This provides sufficient time for connection attempts even over slower or less reliable networks.
Considerations for choosing T1
Recommended Setting: T1 is usually set to around 15 seconds. This duration is enough to cover most transmission delays that might occur in typical network conditions.
Considerations for choosing T2
Recommended Setting: T2 is generally set shorter than T1, around 10 seconds. It should be less than T1 to ensure that a test frame can be sent and acknowledged before the T1 timeout for data frames.
Considerations for choosing T3
Recommended Setting: T3 is commonly set to 20 seconds. This setting should be longer than T1 and T2 to allow sufficient time for the test frames to be acknowledged under normal conditions.
Additional Considerations
Network Characteristics: These recommended settings can serve as a good starting point, but optimal values might vary based on specific network performance characteristics and requirements. Considerations include network latency, reliability, bandwidth, and the criticality of the application.
Adjustments and Testing: It is advisable to adjust and test these timers in the specific deployment environment to find the best settings that ensure reliable communication while minimizing unnecessary traffic.
Consistency with Standards: If there are industry-specific standards or regulations that dictate timer settings, those should take precedence to ensure compliance and interoperability.
These settings help balance the performance and reliability of the IEC 60870-5-104 communication by efficiently managing the connection lifecycle and error recovery processes. Adjustments based on actual network conditions and system performance are crucial for maintaining optimal operations.