A method and related apparatus for simulating optical difference channel anomalies
By decoding, delaying, bit-flipping, and frame boundary processing of fiber optic communication data streams, abnormal scenarios in fiber optic channels are simulated, solving the problem that existing test systems cannot reproduce these scenarios with precision and improving the reliability testing effect of fiber optic communication systems.
Patent Information
- Application Number
- CN202611444881.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-17
- Publication Date
- 2026-11-17
AI Technical Summary
Existing fiber optic communication channel testing systems cannot accurately reproduce real-world abnormal scenarios such as microsecond-level delay fluctuations, intra-frame errors, continuous frame drops, and ultra-long frames caused by factors such as fiber optic cable aging, connector contamination, excessive bending, or environmental interference. This makes it difficult to comprehensively evaluate the fault tolerance and logic robustness of relay protection devices under non-ideal channel conditions.
The system acquires and decodes the input data stream, performs configurable delays and bit flips, extracts frame header and frame tail flags, determines data frame boundaries, performs bit flips within the frame boundaries, simulates frame errors and continuous frame drops, and finally switches between normal messages, abnormal simulated messages, and ultra-long frame simulated messages to construct various abnormal test scenarios.
It enables refined testing of fiber optic communication systems under non-ideal channel conditions, effectively identifying potential defects in relay protection devices under extreme or compound abnormal operating conditions, and improving the completeness and accuracy of testing.
Smart Images

Figure CN123122646A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of relay protection technology, and more specifically, to a method and related apparatus for simulating and testing abnormalities in optical differential channels. Background Technology
[0002] Fiber optic digital communication technology, due to its advantages such as large transmission capacity and strong resistance to electromagnetic interference, has been widely used in the protection of power transmission lines. Fiber optic differential protection, as the primary protection scheme, places extremely high demands on the transmission quality, real-time performance, and data integrity of the communication channel. During the research, development, production, and field commissioning phases of relay protection devices, it is typically necessary to simulate and test various scenarios that the communication channel may encounter in order to verify the correctness of the device's operational logic under different operating conditions. Existing testing technologies mainly focus on solving the time synchronization problem between dual-end test equipment distributed at both ends of the line, ensuring that the testers on both sides can simulate the fault electrical quantities at the same moment, thereby correctly verifying the action behavior of the protection device. In addition, some existing technologies also provide basic testing methods based on fixed delay, general error rate superposition, and physical link interruption. These methods use test terminals connected in series in the fiber optic channel to perform simple signal processing to assist in the detection of channel quality.
[0003] However, in actual power grid operation environments, fiber optic communication channels face complex physical and link layer challenges, and existing testing schemes have significant limitations in simulating these complex and abnormal operating conditions. Current testing systems often treat fiber optic communication channels as ideal transparent transmission media, making it difficult to accurately reproduce real-world abnormal scenarios such as microsecond-level delay fluctuations, intra-frame bit errors in specific areas, continuous frame drops, and excessively long frames caused by factors such as cable aging, connector contamination, excessive bending, or environmental interference. This insufficient test coverage makes it difficult to comprehensively evaluate the fault tolerance and logical robustness of relay protection devices under non-ideal channel conditions, and fails to effectively detect potential defects in devices under extreme or combined abnormal operating conditions, posing certain hidden dangers to the safe and stable operation of the power grid. Summary of the Invention
[0004] In view of this, the present invention discloses an optical differential channel anomaly simulation test method and related apparatus, aiming to solve the technical problem that the existing test system treats the optical fiber channel as an ideal transmission medium and cannot accurately simulate real abnormal scenarios such as delay fluctuations, intra-frame errors, continuous frame loss and ultra-long frames, which makes it difficult to comprehensively evaluate the fault tolerance capability and potential defects of relay protection devices under non-ideal channels.
[0005] A method for simulating optical difference channel anomalies includes:
[0006] Acquire the input data stream, and decode the input data stream to obtain the decoded data stream;
[0007] The decoded data stream is subjected to configurable delay processing, and the delayed data stream is bit-flipped to obtain an intermediate data stream containing error characteristics;
[0008] Extract the frame header and frame tail flags from the intermediate data stream;
[0009] The frame boundary of the data frame is determined based on the frame header flag and the frame tail flag. Bit flipping is performed on the valid data area within the frame boundary in the intermediate data stream to obtain the target data stream after erroneous frame injection.
[0010] Based on the frame header flag and the frame tail flag, complete data frames are identified from the target data stream. Continuous frame dropping operations are then performed on the identified complete data frames according to the frame dropping configuration parameters to obtain the data stream after frame dropping processing.
[0011] The system switches between normal messages, abnormal simulated messages, and ultra-long frame simulated messages, and uses the switched messages as the input data stream, which is then encoded and output.
[0012] Optionally, the configurable delay processing includes:
[0013] Obtain the delay configuration parameters, which are in units of bit transmission time;
[0014] The read delay amount of the buffer is determined according to the delay configuration parameters, the decoded data stream is written into the buffer, and the data is read from the buffer after delaying the read delay amount.
[0015] Optionally, the bit flipping includes:
[0016] Obtain the bit error rate parameter, and determine the flip-off time based on the bit error rate parameter;
[0017] When the flipping moment arrives, the bits in the data stream are inverted.
[0018] Optionally, extracting the frame header and frame tail markers from the intermediate data stream includes:
[0019] The frame header and frame tail flags are detected in the intermediate data stream, and the original bit stream without padding bits is output.
[0020] Optionally, performing bit flipping on the valid data region located within the frame boundary in the intermediate data stream includes:
[0021] The start and end positions of the valid data area are determined based on the frame header flag and the frame tail flag.
[0022] Within the valid data area, periodic bit flipping is performed according to the error frame period parameter.
[0023] Optionally, performing continuous frame dropping operations on the identified complete data frames according to the frame dropping configuration parameters includes:
[0024] The boundaries of the complete data frame are identified based on the frame header flag and the frame tail flag;
[0025] In response to a frame dropping count greater than 0 in the frame dropping configuration parameters, a specified number of data frames are continuously dropped starting from the currently identified complete data frame, and a flag byte is output during the frame dropping period.
[0026] Optionally, the switching between normal messages, abnormal simulated messages, and ultra-long frame simulated messages includes:
[0027] According to a preset priority, a target message is selected for transmission among normal messages, abnormal simulated messages, and ultra-long frame simulated messages. Among the preset priorities, normal messages have the highest priority, ultra-long frame simulated messages have the second highest priority, and abnormal simulated messages are in the default transmission state. Both normal messages and abnormal simulated messages can be enabled or disabled through configuration registers.
[0028] If the normal message is enabled and there is data to be sent, send the normal message;
[0029] If the normal message is not enabled or has no data to be sent, and the number of data to be sent in the ultra-long frame simulation message is greater than 0, the ultra-long frame simulation message is sent. The ultra-long frame simulation message supports fixed data mode and pseudo-random data mode. The fixed data mode sends fixed data through register configuration, and the pseudo-random data mode generates pseudo-random data through a linear feedback shift register configured with an initial seed. In the ultra-long frame simulation message mode, the ultra-long frame simulation message is sent according to either an accumulation mode or a single-shot mode. The accumulation mode continues to send ultra-long frames when parameters change, and the single-shot mode recounts and sends ultra-long frames when parameters change.
[0030] If the normal message is not enabled and the ultra-long frame simulation message is not enabled, the abnormal simulation message is sent; the abnormal simulation message is a message that has undergone at least one abnormal processing, such as delay, bit error, frame error or frame loss.
[0031] An optical differential channel anomaly simulation test system includes:
[0032] The underlying interface module is used to acquire the input data stream, decode the input data stream, and obtain the decoded data stream.
[0033] The delay error module is used to perform configurable delay processing on the decoded data stream and perform bit flipping on the delayed data stream to obtain an intermediate data stream containing error characteristics.
[0034] The physical layer receiving module is used to extract the frame header flag and frame trailer flag from the intermediate data stream;
[0035] The frame error injection module is used to determine the frame boundary of the data frame based on the frame header flag and the frame tail flag, and to perform bit flipping on the valid data area located within the frame boundary in the intermediate data stream to obtain the target data stream after frame error injection.
[0036] The frame dropping control module is used to identify complete data frames from the target data stream based on the frame header flag and the frame tail flag, and to perform continuous frame dropping operations on the identified complete data frames according to the frame dropping configuration parameters to obtain the data stream after frame dropping processing.
[0037] The message switching module is used to switch between normal messages, abnormal simulated messages, and ultra-long frame simulated messages, and send the switched message to the underlying interface module.
[0038] A computer-readable storage medium storing at least one instruction, which, when executed by an FPGA chip, implements the above-described optical differential channel anomaly simulation test method.
[0039] An optical differential channel anomaly simulation test device, the optical differential channel anomaly simulation test device comprising: a memory and an FPGA chip;
[0040] The memory is used to store at least one instruction;
[0041] The FPGA chip is used to execute at least one instruction to implement the optical differential channel anomaly simulation test method described above.
[0042] As can be seen from the above technical solution, the present invention discloses an optical differential channel anomaly simulation test method and related apparatus. It acquires and decodes the input data stream, then performs configurable delay processing and bit flipping on the decoded data stream to obtain an intermediate data stream containing error characteristics, thereby simulating channel transmission delay and bit errors. Based on this, frame header and frame tail markers are extracted from the intermediate data stream to determine data frame boundaries, and bit flipping is performed on the effective data area within the frame boundaries to obtain the target data stream after erroneous frame injection, thus achieving erroneous frame simulation for protocol layer payloads. Subsequently, complete data frames are identified from the target data stream based on the frame header and frame tail markers, and continuous frame dropping operations are performed according to frame dropping configuration parameters to obtain the data stream after frame dropping processing, simulating link packet loss scenarios. Finally, switching is performed between normal messages, anomaly simulation messages, and ultra-long frame simulation messages, and the switched messages are encoded and output, thereby enabling the flexible construction of various anomaly test scenarios. Therefore, through the above-mentioned synergistic processing, the present invention solves the problem that existing test systems are unable to reproduce abnormal scenarios such as delay fluctuations, intra-frame errors, frame drops, and ultra-long frames with fine detail. It avoids the defect that the fault tolerance capability and logic robustness of relay protection devices under non-ideal channel conditions are difficult to fully evaluate due to incomplete test scenario coverage. Thus, it can effectively discover potential defects that may exist in the device under extreme or compound abnormal operating conditions, and improve the completeness and accuracy of reliability testing of optical differential communication systems. Attached Figure Description
[0043] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the published drawings without creative effort.
[0044] Figure 1 This is a flowchart of a method for simulating optical difference channel anomalies according to an embodiment of the present invention;
[0045] Figure 2 This is a schematic diagram of the module connection of an optical differential channel anomaly simulation test system disclosed in an embodiment of the present invention;
[0046] Figure 3 This is a structural block diagram of a message switching module disclosed in an embodiment of the present invention;
[0047] Figure 4 This is a connection diagram of a simulation test device for optical difference channel anomalies in a dual-end test scenario disclosed in an embodiment of the present invention;
[0048] Figure 5 This is a connection diagram of a dual-module cascade loopback test scenario disclosed in an embodiment of the present invention;
[0049] Figure 6 This is a schematic diagram of the internal structure in a local loopback test scenario disclosed in an embodiment of the present invention;
[0050] Figure 7 This is a schematic diagram of the structure of an optical differential channel anomaly simulation test device disclosed in an embodiment of the present invention. Detailed Implementation
[0051] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0052] See Figure 1 The present invention discloses a flowchart of a method for simulating optical difference channel anomalies, which includes:
[0053] Step S101: Obtain the input data stream and decode the input data stream to obtain the decoded data stream.
[0054] The input data stream is a raw bit sequence from the peer device or test signal source, and its physical encoding format includes, but is not limited to, non-return-to-zero code, Manchester encoding, or differential Manchester encoding.
[0055] The decoding process aims to convert the physical layer's level signals into a logic bit stream, a process implemented through the low-level interface module. This module samples the physical signals at a specified rate and parses them into a standard logic level sequence, thereby reconstructing the decoded data stream that serves as the underlying data source for subsequent anomaly simulations.
[0056] Step S102: Perform configurable delay processing on the decoded data stream, and perform bit flipping on the delayed data stream to obtain an intermediate data stream containing error characteristics.
[0057] Configurable delay processing is used to simulate transmission delays caused by differences in fiber optic link length or variations in transmission medium characteristics. Specifically, the decoded data stream is written to a buffer, and the offset of the read pointer is controlled according to preset delay configuration parameters to precisely control the lag time of data output. Delay configuration parameters can be in units of bit transmission time, allowing delay adjustment accuracy to reach nanosecond or microsecond levels, thereby quantitatively evaluating the protection device's tolerance margin to minute delay variations.
[0058] After the delay processing, a bit-flipping operation is performed on the data stream, that is, the logical values of some bits are randomly or periodically inverted (e.g., from 1 to 0, or from 0 to 1), to simulate single-bit or multi-bit errors caused by channel noise or interference. The data stream formed by this processing is the intermediate data stream containing bit error characteristics.
[0059] Step S103: Extract the frame header flag and frame tail flag from the intermediate data stream.
[0060] The frame header and frame trailer are special bit sequences used in data link layer protocols to delineate the start and end of a data frame. For example, 0x7E is typically used as the flag byte in High-Level Data Link Control (HDLC) protocols.
[0061] This embodiment extracts the frame header and frame tail flags to identify the valid boundaries of the data frame. This process is performed by the physical layer receiving module, which detects the position of the flag bits by performing pattern matching in the data stream.
[0062] The output of this step is the original bitstream without removing padding bits. That is, if the intermediate data stream contains padding bits (such as 0 bits) inserted for transparent transmission, these padding bits are still retained at this stage. Retaining the original bitstream ensures that subsequent delay and error handling remain physically accurate, avoiding phase shifts or timing jitter introduced by zero-insertion operations, thereby guaranteeing the physical fidelity of abnormal simulations.
[0063] Step S104: Determine the frame boundary of the data frame according to the frame header flag and the frame tail flag, and perform bit flipping on the valid data area located within the frame boundary in the intermediate data stream to obtain the target data stream after erroneous frame injection.
[0064] Based on the extracted frame header and frame tail markers, the start and end positions of the data frame can be accurately located, thereby determining the valid data area within the frame boundary carrying actual service or control information. Bit flipping is performed within this valid data area to simulate frame errors, where the valid content within the data frame is damaged, but the frame structure (frame header and frame tail) may still be intact. This step, which involves destructive processing of the protocol payload, differs from the full-stream bit flipping in step S102 and more realistically reflects the scenario of protocol layer data verification failure.
[0065] This embodiment generates the target data stream after frame error injection by inverting specific bits within the valid data area.
[0066] Step S105: Based on the frame header flag and the frame tail flag, identify complete data frames from the target data stream, and perform continuous frame dropping operations on the identified complete data frames according to the frame dropping configuration parameters to obtain the data stream after frame dropping processing.
[0067] In the target data stream, independent and complete data frames are identified based on frame header and frame trailer flags. Frame dropping operations are used to simulate data packet loss caused by communication link instability. Frame dropping operations are triggered by the number of frame dropping parameters in the frame dropping configuration parameters. When the number of frame dropping parameters is greater than 0, a specified number of data frames are continuously dropped, starting from the currently identified complete data frame. During continuous frame dropping, to maintain the temporal continuity of the data stream, the device continuously outputs flag bytes transmitted during idle periods. The data stream output after this processing is the data stream containing artificially created missing data segments after frame dropping.
[0068] Step S106: Switch between normal messages, abnormal simulated messages, and ultra-long frame simulated messages, and use the switched messages as the input data stream, which are then encoded and output.
[0069] Message switching, as the output control link of the test system, determines the data type sent to the peer device, such as the protection device under test. Normal messages refer to standard data frames that conform to the protocol specifications and are free from anomaly injection, and are issued by the CPU (Central Processing Unit). Abnormal simulated messages refer to data messages that have undergone one or more of the above-mentioned delay, bit error, frame error, or frame loss processing. Extra-long frame simulated messages refer to abnormal messages whose frame length exceeds the maximum limit specified by the protocol, and are used to test the system's ability to process extra-long data.
[0070] The system switches between normal messages, abnormal simulated messages, and ultra-long frame simulated messages according to the test requirements, and uses the selected message as a new input data stream, which is then encoded and output.
[0071] The multi-mode switching method shown in this step supports flexible configuration of a single abnormal scenario or a complex scenario with multiple concurrent abnormalities, thereby comprehensively verifying the communication performance and reliability of the optical differential channel under different operating conditions.
[0072] In summary, this invention discloses a method for simulating optical differential channel anomalies. It acquires and decodes the input data stream, then performs configurable delay processing and bit flipping on the decoded data stream to obtain an intermediate data stream containing error characteristics, thereby simulating channel transmission delay and bit errors. Based on this, frame header and frame tail markers are extracted from the intermediate data stream to determine data frame boundaries, and bit flipping is performed on the effective data area within the frame boundaries to obtain the target data stream after erroneous frame injection, thus simulating erroneous frames for protocol layer payloads. Subsequently, complete data frames are identified from the target data stream based on the frame header and frame tail markers, and continuous frame dropping operations are performed according to frame dropping configuration parameters to obtain the data stream after frame dropping processing, simulating link packet loss scenarios. Finally, switching is performed between normal messages, anomaly simulation messages, and ultra-long frame simulation messages, and the switched messages are encoded and output, thus enabling the flexible construction of various anomaly test scenarios. Therefore, through the above-mentioned synergistic processing, the present invention solves the problem that existing test systems are unable to reproduce abnormal scenarios such as delay fluctuations, intra-frame errors, frame drops, and ultra-long frames with fine detail. It avoids the defect that the fault tolerance capability and logic robustness of relay protection devices under non-ideal channel conditions are difficult to fully evaluate due to incomplete test scenario coverage. Thus, it can effectively discover potential defects that may exist in the device under extreme or compound abnormal operating conditions, and improve the completeness and accuracy of reliability testing of optical differential communication systems.
[0073] In one embodiment, the configurable delay processing procedure includes:
[0074] Obtain the delay configuration parameters, which are in units of bit transmission time;
[0075] The read delay amount of the buffer is determined according to the delay configuration parameters, the decoded data stream is written into the buffer, and the data is read from the buffer after delaying the read delay amount.
[0076] Delay configuration parameters, as the core quantitative indicator for controlling signal transmission delay, characterize the duration for which data remains in the communication link. Unlike traditional fixed-time settings, delay configuration parameters are closely related to the physical transmission rate of the communication link.
[0077] During the test configuration phase, the delay configuration parameters are automatically calculated and generated based on the user-defined target delay duration and the current optical differential channel's communication baud rate. Since optical differential protection communication typically uses a fixed transmission rate, defining the unit of measurement for delay time as bit transmission time—the time required to transmit one binary bit—allows delay control to adapt to different communication rate environments. For example, at a transmission rate of 2.048 Mbps, the transmission time for a single bit is approximately 488 nanoseconds; if a 1 ms delay needs to be configured, the corresponding delay configuration parameter is calculated as 2048 bit transmission time units. This parameter definition scheme based on bit transmission time ensures the physical consistency of delay simulation under different communication rate test scenarios, effectively avoiding deviations in delay control accuracy caused by rate changes.
[0078] The read latency directly determines the number of clock cycles or memory units the data stream stays in the buffer. The buffer, as a temporary data storage unit, is used to coordinate the time difference between the input and output data streams.
[0079] During execution, the decoded data stream is first continuously written to the buffer, and the buffer's write pointer moves continuously with the input of the data stream. Simultaneously, the movement of the read pointer is controlled by a defined read latency, causing the read pointer to lag behind the write pointer by a specific distance in spatial position. After the decoded data stream is written to the buffer, the read pointer waits for a time period corresponding to the read latency before reading data from the buffer and outputting it.
[0080] In this embodiment, by maintaining a fixed time delay between writing and reading, the data stream precisely undergoes a preset time delay as it flows through the buffer, thereby achieving configurable delay processing with an accuracy down to the microsecond or even nanosecond level. Compared to software timer delay schemes, the hardware buffer-based implementation offers extremely low jitter and extremely high determinism, meeting the high-precision requirements of relay protection devices for communication channel delay testing.
[0081] In one embodiment, the bit flipping process specifically includes:
[0082] Obtain the bit error rate parameter, and determine the flip-off time based on the bit error rate parameter;
[0083] When the flipping moment arrives, the bits in the data stream are inverted.
[0084] The bit error rate period parameter, a key timing configuration parameter controlling the frequency and density of bit error injection, physically represents the time interval or bit number interval between two adjacent bit flip operations. This parameter can be flexibly configured according to specific Fibre Channel test scenarios, rather than being a fixed value. For example, when simulating narrowband interference scenarios with strong periodicity, the bit error rate period parameter can be configured to a smaller value to produce a denser bit error distribution; while when simulating sporadic pulse interference scenarios, the parameter can be configured to a larger value to produce a sparser bit error distribution.
[0085] The methods for determining the bit error rate period parameter include: calculating it based on the communication rate to be tested and the preset bit error rate index; or extracting the average period of bit error occurrence through statistical analysis based on historical bit error statistics monitored in the actual channel, and using this statistical value as the basis for configuring the bit error rate period parameter.
[0086] Based on the acquired bit error rate period parameters, precise timing calculations are performed to determine the flip point. In this embodiment, a hardware counter can be used to implement the logic for determining this point: using the bit clock of the data stream as the driving source, starting from a reference time, such as the start time of data stream transmission or the last flip point, the number of bit cycles that have elapsed is accumulated; the current count value of the counter is compared with the bit error rate period parameters in real time; when the count value reaches the value set by the bit error rate period parameters, the current time is determined to be the flip point. Through the above comparison, it is ensured that the flip point and the clock edge of the data stream maintain a strict synchronization relationship, thereby achieving bit-level precision in bit error injection control and avoiding the accumulation of unexpected bit errors due to timing deviations.
[0087] A bit refers to a bit in the data stream that is in a transmission or processing state during the clock cycle at which the flip point arrives. The invert operation is a logical operation that reverses the logic level of that bit. In digital circuit implementations, the data stream is represented as a binary sequence composed of logic 0s and logic 1s. The specific implementation of the invert operation is: if a bit is logic 1, it is changed to logic 0; if a bit is logic 0, it is changed to logic 1.
[0088] In response to the arrival of the flip time, the aforementioned inversion operation is immediately performed on the bits in the data stream. This process only changes the value of the current specific bit and does not affect the data content of other bits before or after that bit, thus ensuring that the granularity of error injection is strictly limited to the single bit level. For example, suppose a segment in the original data stream is 11001101, and the flip time corresponds to the 3rd bit in the sequence (i.e., the first 0). After performing the inversion operation, this bit changes from 0 to 1, and the data stream then becomes 11101101.
[0089] This embodiment uses single-bit flipping to simulate the bit error phenomenon caused by the distortion of a single symbol in an optical fiber channel, enabling the test system to inject a bit error signal that conforms to physical reality into the device under test, thereby verifying the error detection and correction capabilities of the device under test when faced with discrete bit errors.
[0090] In one embodiment, the process of extracting frame header and frame trailer markers from an intermediate data stream specifically includes:
[0091] Detect the frame header and frame tail flags in the intermediate data stream and output the raw bit stream without removing padding bits.
[0092] After the bitstream, processed for delay and error correction, is input to the physical layer receiving module, the start and end positions of data frames are identified by scanning specific bit patterns within the bitstream. In High-level Data Link Control (HDLC) protocols and similar data link layer protocols, frame header and trailer flags are typically composed of specific byte sequences, such as the flag sequence 0x7E (01111110 in binary). The detection process involves searching for this specific bit sequence pattern in the continuously arriving bitstream; once a match is found, the corresponding frame boundary flag is determined to have been detected.
[0093] Based on the frame boundary detection results, the output raw bitstream without padding bits is maintained in the original bit arrangement order transmitted at the physical layer, without performing the zero-insertion or flag-bit removal processing specified by the protocol layer. In existing technologies, standard protocol parsing typically performs data link layer parsing after detecting flag bits, such as removing inserted 0s (i.e., padding bits) after five consecutive 1s to restore the original payload data. However, this processing alters the length and phase relationship of the data stream. This embodiment skips this conventional protocol parsing step and directly outputs the raw bitstream including padding bits.
[0094] In this embodiment, the original bitstream corresponds to the actual signal sequence transmitted on the physical link, including data bits, padding bits, and flag bits. By detecting the intermediate data stream and preserving its original form, subsequent abnormal simulation operations such as frame error injection and frame loss control can be directly applied to the physical layer data structure, avoiding data shifts or length changes introduced by protocol parsing, ensuring accurate alignment between frame boundary identification and abnormal injection position, thereby realistically reproducing the abnormal characteristics in the physical channel.
[0095] In one embodiment, performing a bit-flipping process on a valid data region located within a frame boundary in an intermediate data stream includes:
[0096] The start and end positions of the valid data area are determined based on the frame header flag and the frame tail flag.
[0097] Within the valid data area, periodic bit flipping is performed according to the error frame period parameter.
[0098] By parsing the frame header and trailer markers from the intermediate data stream, the start and end positions of the valid data area are defined. These start and end positions serve as boundary pointers defining the scope of error injection, reflecting the specific coordinates of the user payload field in the bit stream within the communication protocol frame structure. Compared to indiscriminate error injection into the entire data stream, precise parsing of the frame header and trailer markers strictly limits bit flipping to the interval between the frame header and trailer markers.
[0099] Based on the flag signal output by the physical layer receiving module, the aforementioned start and end positions are determined in real time: when a frame header flag is detected, the bit position is latched as the start position of the valid data area; when a frame tail flag is detected, the preceding bit position is locked as the end position. This positioning method ensures that subsequent bit flipping operations only apply to the area actually carrying service information, thereby realistically simulating data field corruption caused by external interference and avoiding atypical frame structure errors caused by incorrect flipping of frame check sequences or padding bits.
[0100] The frame error period parameter, as a configuration variable controlling the frequency and distribution density of frame error injection, defines the interval time or number of bits between two adjacent bit flip operations. This parameter can be set to a fixed number of bits, such as flipping once every 1000 bits, or a periodic value based on time units. The specific value is set by the tester according to the required frame error rate target.
[0101] A counter is used to count the bits that pass through the valid data area. Whenever the cumulative value of the counter reaches the threshold defined by the error frame period parameter, a bit flip is triggered, inverting the logic level of the bit (from 0 to 1 or from 1 to 0), then resetting the counter and restarting the accumulation. This process repeats continuously, forming periodically distributed error points within the effective payload of the data frame, thereby simulating intermittent channel interference or sudden data corruption. In this way, data frame anomalies under a specific error frame rate can be accurately simulated, effectively testing the relay protection device's ability to process messages containing erroneous service data and its fault-tolerant logic.
[0102] In summary, this embodiment achieves accurate positioning of valid data regions in the data stream through precise coordination of frame header and frame tail markers, and performs periodic bit flipping within these regions based on the error frame period parameter. This processing method refines the error frame injection target from the macroscopic data stream to the microscopic protocol fields, making the simulated abnormal conditions more closely resemble actual communication scenarios where data area damage is caused by signal interference. By strictly limiting the flipping range and period, it ensures the specificity of the abnormal simulation while providing a flexible and controllable means to adjust the error frame intensity, providing reliable test input for verifying the behavior of the optical differential protection device under conditions of compromised data integrity.
[0103] In one embodiment, the process of performing continuous frame dropping operations on the identified complete data frames according to frame dropping configuration parameters may specifically include:
[0104] The boundaries of the complete data frame are identified based on the frame header flag and the frame tail flag;
[0105] In response to a frame dropping count greater than 0 in the frame dropping configuration parameters, a specified number of data frames are continuously dropped starting from the currently identified complete data frame, and a flag byte is output during the frame dropping period.
[0106] By monitoring the frame header and trailer markers in the data stream in real time, the precise start and end positions of individual data frames are determined, thus defining the boundaries of complete data frames. A specific frame header marker sequence (e.g., 0x7E) is searched in the data stream; when this sequence is detected, the position is recorded as the start boundary of the data frame. Monitoring continues until the corresponding trailer marker sequence is detected, and this position is recorded as the end boundary of the data frame. Based on these two boundary positions, each independent and complete data frame is accurately extracted from the continuous bit stream, providing precise operational targets and location criteria for subsequent frame loss control.
[0107] When the frame dropping count in the frame dropping configuration parameters is greater than 0, the frame dropping state machine enters the frame dropping execution state. In this state, the frame dropping configuration parameters are read, which define the number of data frames to be continuously dropped, such as 5 or 10 frames. Starting from the first complete data frame identified at the current moment, normal forwarding processing is stopped, and its data content is dropped instead. As subsequent data frames arrive, the maintenance counter decrements until the cumulative number of dropped data frames reaches the specified number.
[0108] This embodiment continuously outputs flag bytes during frame loss, preventing the peer device from receiving control commands or data information sent by the local device. At the same time, it provides a stable bit synchronization clock reference, enabling the receiving device to maintain a clock-locked state and identify anomalies only at the data content level without triggering a physical link failure alarm. This allows for more accurate verification of the protection device's processing logic and fault tolerance capability for frame loss at the data link layer.
[0109] In one embodiment, the process of switching between normal messages, abnormal simulated messages, and ultra-long frame simulated messages specifically includes:
[0110] According to a preset priority, a target message is selected for transmission among normal messages, abnormal simulated messages, and ultra-long frame simulated messages. Among the preset priorities, normal messages have the highest priority, ultra-long frame simulated messages have the second highest priority, and abnormal simulated messages are in the default transmission state. Both normal messages and abnormal simulated messages can be enabled or disabled through configuration registers.
[0111] If the normal message is enabled and there is data to be sent, send the normal message;
[0112] If the normal message is not enabled or has no data to be sent, and the number of data to be sent in the ultra-long frame simulation message is greater than 0, the ultra-long frame simulation message is sent. The ultra-long frame simulation message supports fixed data mode and pseudo-random data mode. The fixed data mode sends fixed data through register configuration, and the pseudo-random data mode generates pseudo-random data through a linear feedback shift register configured with an initial seed. In the ultra-long frame simulation message mode, the ultra-long frame simulation message is sent according to either an accumulation mode or a single-shot mode. The accumulation mode continues to send ultra-long frames when parameters change, and the single-shot mode recounts and sends ultra-long frames when parameters change.
[0113] If the normal message is not enabled and the ultra-long frame simulation message is not enabled, the abnormal simulation message is sent; the abnormal simulation message is a message that has undergone at least one abnormal processing, such as delay, bit error, frame error or frame loss.
[0114] Very long frame (VLS) simulated messages refer to data frames whose frame length exceeds the maximum transmission unit specified by the communication protocol standard. They are designed to test the receiver's ability to process very long data and its robustness.
[0115] In cumulative mode, the generation and transmission of ultra-long frames exhibit continuous characteristics. When the configuration parameters of ultra-long frames (such as frame length, frame content, or transmission interval) are dynamically modified during testing, the internal transmission counter or state machine maintains its current state without being reset, and continues to execute the cumulative transmission based on the original state. This mode is suitable for simulating continuous large data traffic surges or attack scenarios to verify the effectiveness of the system's memory management mechanism, buffer overflow protection capability, and flow control strategy under long-term reception of ultra-long frames. For example, if the initial configuration sends 100 ultra-long frames, and the frame length parameter is adjusted when sending the 50th frame, the system will continue to complete the remaining transmission tasks and generate subsequent ultra-long frames based on the new parameters, thus forming continuous test pressure.
[0116] In single-shot mode, the generation and transmission of ultra-long frames exhibit a reset characteristic. Once a parameter change command is detected, the system's internal transmission counter is immediately reset to zero, and counting and transmission of ultra-long frames resume. This mode is suitable for simulating sporadic ultra-long frame anomalies or single-frame boundary tests, focusing on verifying the receiver's accuracy in parsing individual ultra-long data packets, error detection mechanisms, and state recovery capabilities after single-frame processing. For example, when testing the device's response to ultra-long frames of a specific length, parameters can be fine-tuned multiple times and transmissions triggered in single-shot mode. Each trigger is considered an independent test event and does not interfere with others, thus facilitating problem localization and assessment of the impact of single anomalies.
[0117] By configuring the cumulative mode and the single-shot mode, it is possible to cover two typical scenarios: continuous stress testing and single-shot robustness testing, which significantly improves the flexibility and coverage of optical differential channel anomaly simulation testing.
[0118] In practical applications, under the ultra-long frame simulated message transmission mode, it supports two data generation methods: fixed data and pseudo-random data, as well as multiple transmission modes such as superimposed transmission and non-superimposed transmission. The pseudo-random data is generated through a linear feedback shift register configured with an initial seed.
[0119] In summary, this embodiment achieves dynamic scheduling of different test modes by acquiring message switching instructions; and by leveraging the differentiated design of the accumulation mode and the single-shot mode, it provides simulation methods for continuous ultra-long frame impacts and single ultra-long frame anomalies, respectively. This technical solution enables testers to flexibly combine different working modes and transmission strategies according to specific test objectives, thereby comprehensively verifying the performance of relay protection devices under extreme communication conditions.
[0120] Corresponding to the above method embodiments, the present invention also discloses an optical difference channel anomaly simulation test system.
[0121] See Figure 2The present invention discloses a schematic diagram of the module connection of an optical differential channel anomaly simulation test system, the system comprising:
[0122] The underlying interface module 201 is used to acquire the input data stream and decode the input data stream to obtain the decoded data stream.
[0123] The delay error module 202 is used to perform configurable delay processing on the decoded data stream and perform bit flipping on the delayed data stream to obtain an intermediate data stream containing error characteristics.
[0124] The physical layer receiving module 203 is used to extract the frame header flag and frame tail flag from the intermediate data stream.
[0125] The frame error injection module 204 is used to determine the frame boundary of the data frame based on the frame header flag and the frame tail flag, and to perform bit flipping on the valid data area located within the frame boundary in the intermediate data stream to obtain the target data stream after frame error injection.
[0126] The frame dropping control module 205 is used to identify complete data frames from the target data stream based on the frame header flag and the frame tail flag, and to perform continuous frame dropping operations on the identified complete data frames according to the frame dropping configuration parameters to obtain the data stream after frame dropping processing.
[0127] The message switching module 206 is used to switch between normal messages, abnormal simulated messages and ultra-long frame simulated messages, and send the switched message to the underlying interface module.
[0128] The test system disclosed in this invention adopts a layered modular design. The data flow for abnormal simulation is as follows: bottom interface module 201 → delay error module 202 → physical layer receiving module 203 → frame error injection module 204 → frame loss control module 205 → message switching module 206 → bottom interface module 201.
[0129] The normal data flow for packet capture is as follows: underlying interface module 201 → packet capture monitoring link → CPU → normal message distribution link → message switching module 206 → underlying interface module 201.
[0130] The transmission of ultra-long frames is achieved by sending parameters directly from the message switching module via the configuration register module.
[0131] The transmission of ultra-long frames is directly generated by the message switching module 206 after the configuration register module 207 sends parameters. Specifically, the configuration register module 207 receives ultra-long frame configuration parameters from the CPU, which include the ultra-long frame data content and transmission mode. The message switching module 206 generates an ultra-long frame simulated message with a length exceeding the maximum transmission unit specified in the protocol based on the configuration parameters, and sends it to the underlying interface module 201 according to the transmission mode. After encoding, it is output to the peer device.
[0132] It should be noted that each module in the optical differential channel anomaly simulation test system can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in an FPGA (Field Programmable Gate Array) chip in hardware form; the CPU (Central Processing Unit) sends configuration parameters to the FPGA chip via a bus to control the operating status of each module.
[0133] In summary, this invention discloses an optical differential channel anomaly simulation test system. It acquires and decodes the input data stream, then performs configurable delay processing and bit flipping on the decoded data stream to obtain an intermediate data stream containing error characteristics, thereby simulating channel transmission delay and bit errors. Based on this, frame header and frame tail markers are extracted from the intermediate data stream to determine data frame boundaries, and bit flipping is performed on the effective data area within the frame boundaries to obtain the target data stream after erroneous frame injection, thus achieving erroneous frame simulation for protocol layer payloads. Subsequently, complete data frames are identified from the target data stream based on the frame header and frame tail markers, and continuous frame dropping operations are performed according to frame dropping configuration parameters to obtain the data stream after frame dropping processing, simulating link packet loss scenarios. Finally, switching is performed between normal messages, anomaly simulation messages, and ultra-long frame simulation messages, and the switched messages are encoded and output, thus enabling the flexible construction of various anomaly test scenarios. Therefore, through the above-mentioned synergistic processing, the present invention solves the problem that existing test systems are unable to reproduce abnormal scenarios such as delay fluctuations, intra-frame errors, frame drops, and ultra-long frames with fine detail. It avoids the defect that the fault tolerance capability and logic robustness of relay protection devices under non-ideal channel conditions are difficult to fully evaluate due to incomplete test scenario coverage. Thus, it can effectively discover potential defects that may exist in the device under extreme or compound abnormal operating conditions, and improve the completeness and accuracy of reliability testing of optical differential communication systems.
[0134] In one embodiment, the delay error module 202 can be specifically used for:
[0135] Obtain the delay configuration parameters, which are in units of bit transmission time;
[0136] The read delay amount of the buffer is determined according to the delay configuration parameters, the decoded data stream is written into the buffer, and the data is read from the buffer after delaying the read delay amount.
[0137] In one embodiment, the delay error module 202 can also be used for:
[0138] Obtain the bit error rate parameter, and determine the flip-off time based on the bit error rate parameter;
[0139] When the flipping moment arrives, the bits in the data stream are inverted.
[0140] In one embodiment, the physical layer receiving module 203 can be specifically used for:
[0141] The frame header and frame tail flags are detected in the intermediate data stream, and the original bit stream without padding bits is output.
[0142] In one embodiment, the frame error injection module 204 can be specifically used for:
[0143] The start and end positions of the valid data area are determined based on the frame header flag and the frame tail flag.
[0144] Within the valid data area, periodic bit flipping is performed according to the error frame period parameter.
[0145] In one embodiment, the frame dropping control module 205 can be specifically used for:
[0146] The boundaries of the complete data frame are identified based on the frame header flag and the frame tail flag;
[0147] In response to a frame dropping count greater than 0 in the frame dropping configuration parameters, a specified number of data frames are continuously dropped starting from the currently identified complete data frame, and a flag byte is output during the frame dropping period.
[0148] In one embodiment, the message switching module 206 can be specifically used for:
[0149] According to a preset priority, a target message is selected for transmission among normal messages, abnormal simulated messages, and ultra-long frame simulated messages. Among the preset priorities, normal messages have the highest priority, ultra-long frame simulated messages have the second highest priority, and abnormal simulated messages are in the default transmission state. Both normal messages and abnormal simulated messages can be enabled or disabled through configuration registers.
[0150] If the normal message is enabled and there is data to be sent, send the normal message;
[0151] If the normal message is not enabled or has no data to be sent, and the number of data to be sent in the ultra-long frame simulation message is greater than 0, the ultra-long frame simulation message is sent. The ultra-long frame simulation message supports fixed data mode and pseudo-random data mode. The fixed data mode sends fixed data through register configuration, and the pseudo-random data mode generates pseudo-random data through a linear feedback shift register configured with an initial seed. In the ultra-long frame simulation message mode, the ultra-long frame simulation message is sent according to either an accumulation mode or a single-shot mode. The accumulation mode continues to send ultra-long frames when parameters change, and the single-shot mode recounts and sends ultra-long frames when parameters change.
[0152] If the normal message is not enabled and the ultra-long frame simulation message is not enabled, the abnormal simulation message is sent; the abnormal simulation message is a message that has undergone at least one abnormal processing, such as delay, bit error, frame error or frame loss.
[0153] See Figure 3 The present invention discloses a structural block diagram of a message switching module, as shown in the embodiment of the present invention. Figure 3 As shown, the message switching module 206 includes an ultra-long frame generator and an arbitrator. The normal message delivery link inputs normal messages into the message switching module 206; the abnormal simulation link inputs abnormal simulated messages, processed by at least one of the following abnormalities: delay, bit error, frame error, or frame loss, into the message switching module 206; the ultra-long frame generator generates ultra-long frame simulated messages according to the ultra-long frame configuration parameters issued by the configuration register module 207, and inputs the ultra-long frame simulated messages into the message switching module 206. The arbitrator receives the normal messages, the abnormal simulated messages, and the ultra-long frame simulated messages, selects a target message among them according to a preset priority, and sends the selected target message to the underlying interface module 201, where it is encoded and output to the peer device.
[0154] In one optional embodiment, the present invention also provides a communication interruption simulation function for simulating physical link high / low level faults.
[0155] In communication interrupt mode, the transmit control logic of the underlying interface module 201 no longer outputs valid data. First, it receives the communication interrupt enable signal and interrupt output level configuration parameters issued by the configuration register 207. The communication interrupt enable signal is used to enable or disable the communication interrupt simulation function; the interrupt output level configuration parameters are used to set the polarity of the constant level, for example, it can be configured as all 0 level or all 1 level.
[0156] When the communication interruption enable signal is active, the transmission control logic of the underlying interface module 201 stops transmitting the data stream from the message switching module and instead continuously outputs a constant level symbol set by the interrupt output level configuration parameter. This constant level is output to the physical link in bit stream form, simulating a high-level or low-level clamping fault in the physical link caused by a complete break in the optical cable, failure of the optical module, or a fault at the signal transmitting end in optical fiber communication. In this mode, the receiving device at the other end will detect a continuous fixed-level signal, thereby triggering a receiving link alarm or signal loss state, which can be used to verify the fault detection capability and recovery logic of the relay protection device in the event of a physical link interruption.
[0157] When the communication interruption enable signal is withdrawn, the underlying interface module resumes normal message forwarding function and continuously outputs valid data stream.
[0158] In an optional embodiment, the present invention also provides a loopback test function for verifying the functional correctness of the optical differential channel anomaly simulation test device itself and the processing logic of the protection device under test under loop anomaly conditions. The loopback test function includes dual-module cascaded loopback test and local loopback test.
[0159] like Figure 4 As shown, in a dual-end testing scenario, the optical differential channel anomaly simulation test system is implemented on the optical differential channel anomaly simulation test device. This device connects to relay protection device A and relay protection device B via one transmitter (TX) and one receiver (RX) within it. Specifically, one side of the optical differential channel anomaly simulation test device's receiver is connected to the transmitter of relay protection device A, and the other side's transmitter is connected to the receiver of relay protection device B. The other side's receiver is connected to the transmitter of relay protection device B, and the other side's transmitter is connected to the receiver of relay protection device A, thus forming a complete path that can simulate abnormal operating conditions between the two devices.
[0160] like Figure 5 As shown, in the dual-module cascade loopback test mode, the receiver of the first optical differential channel anomaly simulation test device is connected to the transmitter of relay protection device A, and its transmitter is connected to the receiver of relay protection device A; the receiver of the second optical differential channel anomaly simulation test device is connected to the transmitter of relay protection device B, and its transmitter is connected to the receiver of relay protection device B; at the same time, a communication connection is established between relay protection device A and relay protection device B. By interconnecting the receivers and transmitters of the two test protection devices and configuring the dual-module loopback function, a complete communication loop can be simulated to verify the synchronization and processing logic of the relay protection device under loop anomaly.
[0161] like Figure 6As shown, in the local loopback test mode, the transmitting end of the optical differential channel anomaly simulation test device is directly fed back to its receiving end. The device internally generates a test data stream, which is processed sequentially by the delay error module, physical layer receiving module, frame error injection module, frame loss control module, and message switching module before being sent out from the transmitting end and directly transmitted to the receiving end via the feedback connection. The underlying interface module then receives and processes the data again. By comparing the consistency between the transmitted and received data, the device's modules are verified to function correctly during the anomaly simulation process, thus realizing the self-testing function of the anomaly simulation test device.
[0162] In one optional implementation, the present invention also provides a configuration register module for configuring parameters and monitoring the status of each anomaly simulation module.
[0163] The configuration register module provides multiple registers, each corresponding to configuration parameters for different anomaly simulation functions. These registers include, but are not limited to: a delay time configuration register (for setting the delay amount for delay processing); an error period configuration register (for setting the bit flipping period parameter); an error type configuration register (for setting the type of error injection); a frame loss count configuration register (for setting the number of consecutive frame losses); a communication interruption parameter register (for setting the communication interruption enable signal and interrupt output level); an ultra-long frame data content register (for setting the payload data of the ultra-long frame simulated message); and an ultra-long frame transmission mode register (for setting either accumulation mode or single-shot mode).
[0164] The configuration register module receives configuration parameters from the CPU and, based on the target module identifier in the configuration parameters, sends the corresponding configuration parameters to the appropriate exception simulation module to control each exception simulation module to perform the corresponding exception simulation operation. Simultaneously, the configuration register module also supports reading back the real-time status monitoring information of each module, enabling the CPU to monitor the system's operating status in real time.
[0165] In an optional implementation, this application also provides a packet capture monitoring link, which is used to realize the uploading of underlying link information and the reception of CPU-sent messages.
[0166] One end of the packet capture monitoring link is connected to the underlying interface module, and the other end is connected to the CPU via a bus interface. In the data uplink direction, the packet capture monitoring link parses the physical signals received by the underlying interface module, extracts the message data carried in the underlying link signals, and sends the parsed messages to the CPU via the bus interface for the CPU to perform link status analysis, message recording, or fault diagnosis.
[0167] In the data transmission direction, the packet capture monitoring link receives normal message data sent by the CPU and transmits it to the message switching module. The message switching module then encodes and outputs the normal message data via the underlying interface module in the CPU's normal message transmission mode. Through this packet capture monitoring link, bidirectional data interaction between the CPU and the underlying data stream is achieved, supporting both real-time monitoring of the underlying communication content and the CPU's active injection of test messages.
[0168] Corresponding to the above embodiments, the present invention also discloses a computer-readable storage medium that stores at least one instruction, which, when executed by an FPGA chip, implements the steps shown in the embodiments of the optical differential channel anomaly simulation test method.
[0169] Computer-readable storage media can be tangible media that may contain or store programs for use by or in conjunction with an instruction execution system, apparatus, or device. Computer-readable storage media can be machine-readable signal media or machine-readable storage media. Computer-readable storage media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0170] Corresponding to the above embodiments, such as Figure 7 As shown, the present invention also provides a structural schematic diagram of an optical difference channel anomaly simulation test device, which may include: FPGA chip 1 and memory 2;
[0171] Among them, FPGA chip 1 and memory 2 communicate with each other through communication bus 3;
[0172] FPGA chip 1 is used to execute at least one instruction;
[0173] Memory 2 is used to store at least one instruction;
[0174] The FPGA chip 1 contains programmable logic resources to implement all steps in the embodiment of the optical differential channel anomaly simulation test method, except for the CPU issuing configuration parameters.
[0175] Memory 2 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.
[0176] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0177] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0178] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for simulating and testing optical difference channel anomalies, characterized in that, include: Acquire the input data stream, and decode the input data stream to obtain the decoded data stream; The decoded data stream is subjected to configurable delay processing, and the delayed data stream is bit-flipped to obtain an intermediate data stream containing error characteristics; Extract the frame header and frame tail flags from the intermediate data stream; The frame boundary of the data frame is determined based on the frame header flag and the frame tail flag. Bit flipping is performed on the valid data area within the frame boundary in the intermediate data stream to obtain the target data stream after erroneous frame injection. Based on the frame header flag and the frame tail flag, complete data frames are identified from the target data stream. Continuous frame dropping operations are then performed on the identified complete data frames according to the frame dropping configuration parameters to obtain the data stream after frame dropping processing. The system switches between normal messages, abnormal simulated messages, and ultra-long frame simulated messages, and uses the switched messages as the input data stream, which is then encoded and output.
2. The optical difference channel anomaly simulation test method according to claim 1, characterized in that, The configurable delay processing includes: Obtain the delay configuration parameters, which are in units of bit transmission time; The read delay amount of the buffer is determined according to the delay configuration parameters, the decoded data stream is written into the buffer, and the data is read from the buffer after delaying the read delay amount.
3. The optical difference channel anomaly simulation test method according to claim 1, characterized in that, The bit flipping includes: Obtain the bit error rate parameter, and determine the flip-off time based on the bit error rate parameter; When the flipping moment arrives, the bits in the data stream are inverted.
4. The optical difference channel anomaly simulation test method according to any one of claims 1 to 3, characterized in that, Extracting the frame header and frame tail markers from the intermediate data stream includes: The frame header and frame tail flags are detected in the intermediate data stream, and the original bit stream without padding bits is output.
5. The optical difference channel anomaly simulation test method according to claim 1, characterized in that, Performing bit flipping on the valid data region located within the frame boundary in the intermediate data stream includes: The start and end positions of the valid data area are determined based on the frame header flag and the frame tail flag. Within the valid data area, periodic bit flipping is performed according to the error frame period parameter.
6. The optical difference channel anomaly simulation test method according to claim 1 or 5, characterized in that, The step of performing continuous frame dropping operations on the identified complete data frames according to the frame dropping configuration parameters includes: The boundaries of the complete data frame are identified based on the frame header flag and the frame tail flag; In response to a frame dropping count greater than 0 in the frame dropping configuration parameters, a specified number of data frames are continuously dropped starting from the currently identified complete data frame, and a flag byte is output during the frame dropping period.
7. The optical difference channel anomaly simulation test method according to claim 1, characterized in that, The switching between normal messages, abnormal simulated messages, and ultra-long frame simulated messages includes: According to a preset priority, a target message is selected for transmission among normal messages, abnormal simulated messages, and ultra-long frame simulated messages. Among the preset priorities, normal messages have the highest priority, ultra-long frame simulated messages have the second highest priority, and abnormal simulated messages are in the default transmission state. Both normal messages and abnormal simulated messages can be enabled or disabled through configuration registers. If the normal message is enabled and there is data to be sent, send the normal message; If the normal message is not enabled or has no data to be sent, and the number of data to be sent in the ultra-long frame simulation message is greater than 0, the ultra-long frame simulation message is sent. The ultra-long frame simulation message supports fixed data mode and pseudo-random data mode. The fixed data mode sends fixed data through register configuration, and the pseudo-random data mode generates pseudo-random data through a linear feedback shift register configured with an initial seed. In the ultra-long frame simulation message mode, the ultra-long frame simulation message is sent according to either an accumulation mode or a single-shot mode. The accumulation mode continues to send ultra-long frames when parameters change, and the single-shot mode recounts and sends ultra-long frames when parameters change. If the normal message is not enabled and the ultra-long frame simulation message is not enabled, the abnormal simulation message is sent; the abnormal simulation message is a message that has undergone at least one abnormal processing, such as delay, bit error, frame error or frame loss.
8. A simulation test system for optical difference channel anomalies, characterized in that, include: The underlying interface module is used to acquire the input data stream, decode the input data stream, and obtain the decoded data stream. The delay error module is used to perform configurable delay processing on the decoded data stream and perform bit flipping on the delayed data stream to obtain an intermediate data stream containing error characteristics. The physical layer receiving module is used to extract the frame header flag and frame trailer flag from the intermediate data stream; The frame error injection module is used to determine the frame boundary of the data frame based on the frame header flag and the frame tail flag, and to perform bit flipping on the valid data area located within the frame boundary in the intermediate data stream to obtain the target data stream after frame error injection. The frame dropping control module is used to identify complete data frames from the target data stream based on the frame header flag and the frame tail flag, and to perform continuous frame dropping operations on the identified complete data frames according to the frame dropping configuration parameters to obtain the data stream after frame dropping processing. The message switching module is used to switch between normal messages, abnormal simulated messages, and ultra-long frame simulated messages, and send the switched message to the underlying interface module.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one instruction, which, when executed by the FPGA chip, implements the optical differential channel anomaly simulation test method as described in any one of claims 1 to 7.
10. A device for simulating and testing optical difference channel anomalies, characterized in that, The optical differential channel anomaly simulation test device includes: a memory and an FPGA chip; The memory is used to store at least one instruction; The FPGA chip is used to execute at least one instruction to implement the optical differential channel anomaly simulation test method as described in any one of claims 1 to 7.
