PROFIBUS bus gateway module communication test method and related equipment
By automatically identifying and self-matching the communication parameters of the PROFIBUS bus gateway module, the problem of low testing efficiency in the prior art is solved, realizing automated and repeatable communication performance testing, and improving testing efficiency and result reliability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA NUCLEAR CONTROL SYST ENG
- Filing Date
- 2026-01-29
- Publication Date
- 2026-04-10
AI Technical Summary
In the existing technology, communication testing of PROFIBUS bus gateway modules requires manual parameter switching and manual interpretation, resulting in low testing efficiency, low coverage, and difficulty in automatically identifying the current communication parameters, making it impossible to generate repeatable test results.
By automatically identifying the communication parameters of the PROFIBUS bus gateway module under test and utilizing the communication parameter self-matching process, automated communication performance testing is achieved, including configuring test communication parameters, acquiring logic level sequences, data frame processing, and result determination, reducing manual operation.
It enables automated and repeatable communication performance testing of PROFIBUS bus gateway modules, reducing manual operation costs and ensuring the reliability and coverage of test results.
Smart Images

Figure CN121842033A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of industrial automation testing, and in particular to a PROFIBUS bus gateway module communication testing method and related equipment. BACKGROUND
[0002] When testing the communication of a PROFIBUS bus gateway module, the communication data volume between the PROFIBUS bus gateway module and the PROFIBUS bus device is large, and it is necessary to verify the communication performance of the PROFIBUS bus gateway module under different communication parameters and to determine whether data is lost in the communication process.
[0003] In related technologies, the communication testing of a PROFIBUS bus gateway module involves the combination of multiple baud rates and multiple working modes, and it is necessary to repeatedly switch parameters and observe data changes, which is a large amount of testing work, and the process relies on manual operation and manual interpretation, which is likely to cause low testing efficiency and time-consuming problem positioning, and it is difficult to automatically identify the current communication parameters of the PROFIBUS bus gateway module, and it is also not conducive to forming repeatable and recordable testing result output. SUMMARY
[0004] Therefore, the present application provides a PROFIBUS bus gateway module communication testing method and related equipment, which automatically identifies the current communication parameters of the PROFIBUS bus gateway module to be tested through a self-matching process of communication parameters, and realizes automatic and repeatable communication performance testing of the PROFIBUS bus gateway module to be tested.
[0005] According to an aspect of the present application, a PROFIBUS bus gateway module communication testing method is provided, which is applied to a PROFIBUS bus gateway module communication testing device, the device includes a first machine case, a second machine case and a PROFIBUS bus group, the first machine case includes a first control group and a gateway module group, the gateway module group includes a PROFIBUS bus gateway module to be tested, the second machine case includes a second control group, a PROFIBUS bus receiving group and a PROFIBUS bus device group, the first machine case and the second machine case can communicate through the PROFIBUS bus group, and the method includes:
[0006] The first control group configures the gateway module group based on preset communication parameters in response to a test instruction, to configure the test communication parameters of the gateway module group; The test software in the second control group configures the attempt working parameters of the driver in the PROFIBUS bus receiving group; if the channel state in the attempt working parameter is open, the driver acquires a logic level sequence on the PROFIBUS bus group, and based on a conversion from high level to low level in the logic level sequence, intercepts a logic level sub-sequence from the logic level sequence to take the logic level sub-sequence as a candidate data frame; the driver performs data frame processing on the candidate data frame based on the attempt baud rate in the attempt working parameter to obtain an effective data frame; the test software determines a target communication parameter matching the test communication parameter configured under the current configuration of the gateway module group based on the effective data frame, and changes the channel state of the driver to closed; the test software reconfigures the PROFIBUS bus device group according to the target communication parameter to control the reconfigured PROFIBUS bus device group to send test upstream data to the gateway module group, so that the gateway module group issues test downstream data to the PROFIBUS bus device group; the test software determines a test result of the test communication parameter configured under the current configuration of the gateway module group based on the test upstream data and the test downstream data; the first control group reconfigures the gateway module group until the preset communication parameter is completely tested.
[0007] According to another aspect of the present application, a PROFIBUS bus gateway module communication test system is provided, comprising: a configuration module configured to configure the test communication parameter of the gateway module group based on the preset communication parameter in response to a test instruction by the first control group, and the test software in the second control group configures the attempt working parameter of the driver in the PROFIBUS bus receiving group; a matching module configured to, if the channel state in the attempt working parameter is open, the driver acquires a logic level sequence on the PROFIBUS bus group, and based on a conversion from high level to low level in the logic level sequence, intercepts a logic level sub-sequence from the logic level sequence to take the logic level sub-sequence as a candidate data frame; and the driver performs data frame processing on the candidate data frame based on the attempt baud rate in the attempt working parameter to obtain an effective data frame; and the test software determines a target communication parameter matching the test communication parameter configured under the current configuration of the gateway module group based on the effective data frame, and changes the channel state of the driver to closed; a test module, configured to reconfigure the PROFIBUS bus device group according to the target communication parameters by the test software, so that the reconfigured PROFIBUS bus device group sends test uplink data to the gateway module group, and the gateway module group sends test downlink data to the PROFIBUS bus device group; and the test software determines a test result of the test communication parameters configured by the gateway module group under the current configuration based on the test uplink data and the test downlink data; a circulation module, configured to reconfigure the gateway module group by the first control group until the test of the preset communication parameters is completed.
[0008] According to still another aspect of the present application, a readable storage medium is provided, which stores a program or instructions, and the program or instructions are executed by a processor to implement the steps of the PROFIBUS bus gateway module communication test method.
[0009] According to still another aspect of the present application, a computer device is provided, which comprises a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, and the processor executes the program to implement the steps of the PROFIBUS bus gateway module communication test method.
[0010] By the technical scheme, the application provides a PROFIBUS bus gateway module communication test method and related equipment. The first control group responds to a test instruction, configures a gateway module group based on preset communication parameters, and obtains test communication parameters configured under a current configuration. Then, the test software of the second control group configures a trial working parameter for a driver in a PROFIBUS bus receiving group. When the channel state in the trial working parameter of the driver is open, the driver obtains a logic level sequence on the PROFIBUS bus group, and after recognizing a high level to low level conversion, truncates a logic level sub-sequence as a candidate data frame according to a preset bit number. Further, the test software executes data frame processing on the candidate data frame to obtain an effective data frame based on a trial baud rate in the trial working parameter. Subsequently, the test software calculates whether a data message determined based on the effective data frame conforms to a provision of a PROFIBUS communication protocol, judges whether the data message format is correct, and when the format is correct, determines a target communication parameter matched with the test communication parameter under the current configuration of the gateway module group, and changes the channel state of the driver to closed. Finally, the test software reconfigures the PROFIBUS bus equipment group according to the target communication parameter, and controls the reconfigured PROFIBUS bus equipment group to send test uplink data to the gateway module group, so that the gateway module group issues test downlink data to the PROFIBUS bus equipment group, thereby determining a test result of the test communication parameter of the gateway module group under the current configuration based on the test uplink data and the test downlink data. After completion, the first control group continues to switch a next group of test communication parameters of the gateway module group until all preset communication parameters are covered. Through the self-matching process of the communication parameters, the application can automatically identify different communication parameters under different configurations of the gateway module group, obtain the target communication parameters matched therewith, and trigger a re-matching mechanism of changing the baud rate when the baud rate is not matched, thereby reducing the operation cost of manual trial fitting. Moreover, after the target communication parameter is determined, the application reconfigures the PROFIBUS bus equipment group, so that the reconfigured PROFIBUS bus equipment group sends test uplink data to the gateway module group, and organizes the sending and reading of the test uplink data and the test downlink data issued by the gateway module group, forms a repeatable communication test process under the condition of the same target communication parameter, and makes the test result output as a qualified or unqualified conclusion around the purpose of whether data is lost, so that the automatic test of the communication parameters can be fully covered.
[0011] The above description is only a summary of the technical scheme of the application. In order to more clearly understand the technical means of the application, the application can be implemented according to the content of the description, and in order to make the above and other purposes, features and advantages of the application more obvious and easy to understand, the following specific embodiments of the application are described. BRIEF DESCRIPTION OF DRAWINGS
[0012] The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application. In the drawings: Figure 1 A structural block diagram of a PROFIBUS bus gateway module communication test device provided by an embodiment of the application is shown; Figure 2 A flowchart of a PROFIBUS bus gateway module communication test method provided by another embodiment of the application is shown; Figure 3 A flowchart of a PROFIBUS bus gateway module communication test method provided by another embodiment of the application is shown; Figure 4 A structural block diagram of a PROFIBUS bus gateway module communication test system provided by an embodiment of the application is shown. DETAILED DESCRIPTION
[0013] The application will be described in detail below with reference to the accompanying drawings and embodiments. It should be noted that the embodiments in the application and the features in the embodiments can be combined with each other without conflict.
[0014] The embodiments of the application will be described in detail below, examples of which are shown in the accompanying drawings, in which the same or similar reference signs represent the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by reference to the accompanying drawings are exemplary and are only used to explain the application, and cannot be interpreted as limiting the application.
[0015] Those skilled in the art can understand that, unless specifically stated, the singular forms "a", "an" and "the" used herein also include the plural forms. It should be further understood that the use of the phrase "comprises" in the specification of the application means that the features, integers, steps, operations, elements and / or components exist, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we say an element is "connected" or "joined" to another element, it can be directly connected or joined to the other element, or there can be intermediate elements. In addition, "connected" or "joined" used herein can include wireless connection or wireless connection. The phrase "and / or" used herein includes all or any single unit and all combinations of the associated listed items.
[0016] Now, exemplary embodiments according to this application will be described in greater detail by referring to the drawings. These exemplary embodiments can be implemented in various different forms, and should not be construed as being limited to the embodiments set forth herein. It should be understood that these embodiments are provided so that the present disclosure will be thorough and complete, and will fully convey the concept of these exemplary embodiments to those skilled in the art.
[0017] It should be noted that PROFIBUS (Process Fieldbus) is a fieldbus standard widely used in the field of industrial automation, which can meet the needs of efficient and reliable communication between different devices in the industrial field. The PROFIBUS bus gateway module is a bridge for communication between devices of different protocols, enabling different protocol devices to work together in the same system. In actual industrial scenarios, the PROFIBUS bus gateway module is connected to the PROFIBUS fieldbus network at one end and to other types of control systems or heterogeneous networks, such as DCS (Distributed Control System), at the other end. Thus, the PROFIBUS bus gateway module converts the data from the slave devices of the PROFIBUS fieldbus network into a format that can be recognized by the backend control system and uploads it, and converts the instructions and data from the control system into messages that comply with the PROFIBUS protocol specification and sends them to the corresponding slave devices in the PROFIBUS fieldbus network, thereby realizing bidirectional and reliable communication between the control system and the slave devices in the PROFIBUS fieldbus network.
[0018] Here, the PROFIBUS fieldbus network refers to a standardized industrial communication network system defined by the PROFIBUS communication protocol for connecting field devices and control systems, which includes complete specifications for the physical layer, data link layer, and application layer. The slave device refers to various types of field devices connected to the bus in the PROFIBUS fieldbus network, such as sensors, actuators, frequency converters, remote I / O modules, etc.
[0019] Due to the complex actual industrial scene environment, it is necessary to pass through comprehensive communication test to guarantee the communication function, data consistency and anti-interference ability of the PROFIBUS bus gateway module under various preset working conditions, so as to prevent production interruption or control failure caused by communication failure. In the related art, the typical communication test method for the PROFIBUS bus gateway module is to manually build a communication test environment and verify item by item. Specifically, first, the tester manually configures a specific set of communication parameters for the PROFIBUS bus gateway module on the control system side connected to the PROFIBUS bus gateway module according to the test case, including the PROFIBUS communication baud rate, the working mode, the station address of the slave device (i.e. the communication slave station address) that the PROFIBUS bus gateway module needs to communicate, etc. Second, on the PROFIBUS field bus network side, the tester manually configures the communication parameters consistent with the above on the slave device in the PROFIBUS field bus network. After the configuration is completed, the tester operates the slave device to send a set of pre-defined test data, i.e. test uplink data messages, to the PROFIBUS bus gateway module. Then, the tester needs to make a bidirectional observation: on the human-machine interface of the control system side, the tester checks the test uplink data messages uploaded by the PROFIBUS bus gateway module; at the same time, on the PROFIBUS field bus network side, the tester checks the test downlink data messages received by the slave device and forwarded by the PROFIBUS bus gateway module. Finally, by manually comparing whether the data messages in the two directions are lost, the tester determines whether the communication process is interrupted or has an error, so as to determine whether the communication test of the PROFIBUS bus gateway module under the current communication parameters passes. In order to verify whether the PROFIBUS bus gateway module can correctly and completely implement bidirectional forwarding and protocol conversion of data under the specified multiple baud rates and multiple working modes, it is necessary to perform comprehensive communication test covering the common 10 baud rates and 64 working modes. The tester must manually repeat all the above steps to traverse all the communication parameter combinations to be verified, which is not only low in communication test efficiency and coverage, but also difficult in communication fault diagnosis. It should be noted that the working mode is a data structure defined by the number of bytes of the uplink data message and the number of bytes of the transmitted data in the downlink data message. There are 64 such byte combinations in the PROFIBUS protocol specification, corresponding to different standard devices or application modes.
[0020] In summary, in the related art, the baud rate and test mode need to be selected and data need to be sent manually during the communication test of the PROFIBUS gateway module, and the test data needs to be interpreted by the naked eye, which is low in test efficiency. Moreover, without a PROFIBUS bus reading device, the test data cannot be read and interpreted, which affects the development of the automatic test program of the PROFIBUS gateway module.
[0021] In the related art, a PROFIBUS bus gateway module communication testing device is provided, as shown in Figure 1 The device includes a first cabinet, a second cabinet, and a PROFIBUS bus group. The first cabinet is used to simulate a PROFIBUS bus gateway module to be tested and a control system to which the PROFIBUS bus gateway module is connected in an actual industrial scene. The second cabinet is used to simulate a slave device in a PROFIBUS field bus network. The PROFIBUS bus group is a unique external physical link connecting the first cabinet and the second cabinet and carrying all PROFIBUS protocol test communications, so that the first cabinet and the second cabinet communicate through the PROFIBUS bus group.
[0022] Specifically, the first cabinet includes a first control group, a gateway module group, and a first bus group. The gateway module group includes a PROFIBUS bus gateway module to be tested. The first control group is used to configure the gateway module group to configure the communication parameters of the gateway module group. The first bus group is a communication backplane integrated in the first cabinet and is used to establish a communication link in the first cabinet. The first control group and the gateway module group communicate through the first bus group. Specifically, the first control group includes a first controller, an engineer station, and a first display control assembly. A test personnel is located at the engineer station and issues an instruction to the engineer station to complete the configuration function of the gateway module group and the first controller and to complete the communication function of the gateway module group and the first controller. The first display control assembly is used for visualizing the engineer station and the first controller. The gateway module group includes one PROFIBUS bus gateway module to be tested in a single machine mode or two PROFIBUS bus gateway modules to be tested in a redundant mode. The first bus group is provided with a first connector and a second connector to provide a communication path for the first control group and the gateway module group. The first control group is connected to the first bus group through the first connector, and the gateway module group is connected to the first bus group through the second connector. The gateway module group is further provided with a first interface connected to the PROFIBUS bus group through a first cable for communication between the gateway module group and the PROFIBUS bus group. Specifically, the first controller can be a DCS control station controller and can be an RS-485 communication or other communication form. The engineer station can be a computer installed with DCS configuration software and supporting a WINDOWS 10 operating system. The gateway module group can be an RS-485 communication mode. The first bus group can be an RS-485 communication. The first interface can be one or a group of DB9 connectors.
[0023] Here, the communication parameters of the gateway module group include the baud rate, the operation mode and the communication slave address. The communication slave address refers to the station address of the PROFIBUS slave module which the gateway module group needs to communicate in the PROFIBUS device group.
[0024] The second cabinet comprises a second control group, a PROFIBUS bus receiving group, a PROFIBUS bus device group and a second bus group. The PROFIBUS bus receiving group is used to access a logic level on the PROFIBUS bus group to determine the communication data transmitted on the PROFIBUS bus group through the logic level. The PROFIBUS bus device group is used to simulate a plurality of slave devices. The second control group is used to configure the PROFIBUS bus device group, control the PROFIBUS bus device group to send or receive data messages, and control whether the PROFIBUS bus receiving group accesses the logic level from the PROFIBUS bus group. The second bus group is a communication backplane integrated in the second cabinet, and is used to establish a communication link in the second cabinet. The second control group and the PROFIBUS bus device group, and the second control group and the PROFIBUS bus receiving group communicate through the second bus group. Specifically, the second control group comprises a second controller and a second display control component. The second controller is actually used for configuration and control of the PROFIBUS bus device group and control of the PROFIBUS bus receiving group, and the second display control component is used for visualization of the second controller. The PROFIBUS bus device group comprises a plurality of PROFIBUS bus slave modules and a matching cable. The PROFIBUS bus receiving group comprises a plurality of PROFIBUS bus receiving FPGA (Field Programmable Gate Array) modules and a matching cable. The PROFIBUS bus receiving group is installed with a second interface, and the PROFIBUS bus receiving group can access the logic level on the PROFIBUS bus group through the second interface. The PROFIBUS bus device group is installed with a third interface, and the third interface is connected with the PROFIBUS bus group through a third cable, and is used for communication between the PROFIBUS bus device group and the PROFIBUS bus group, so that the gateway module group communicates with the PROFIBUS bus device group through the first interface, the first cable, the third cable of the PROFIBUS bus group, the third interface in sequence, and a communication link of the PROFIBUS bus is established. The gateway module group, the PROFIBUS bus receiving group and the PROFIBUS bus device group share the PROFIBUS bus group. The second bus group is installed with a third connector, a fourth connector and a fifth connector, and provides a communication path between the second control group and the PROFIBUS bus receiving group and the PROFIBUS bus device group. The second control group is connected with the second bus group through the third connector, the PROFIBUS bus receiving group is connected with the second bus group through the fourth connector, and the PROFIBUS bus device group is connected with the second bus group through the fifth connector.For example, the second controller can be a PXI external controller or a PXI-E embedded system controller, and can be a PXI communication or other communication form. The second display control component can be a display, a keyboard, a mouse, or the like. The PROFIBUS bus receiving component can be a FPGA programmable high-speed I / O module based on a PXI or PXI-E bus, and can program binary logic levels received by the I / O port and output data messages transmitted by the logic levels. The PROFIBUS bus device component can be a PROFIBUS protocol sending and receiving module based on a PXI or PXI-E bus. The second control component can program data sent by the PROFIBUS bus device component and send triangular wave data conforming to the PROFIBUS bus protocol to the outside; and can also display data sent from the outside. The second bus component can be a PXI or PXI-E bus communication.
[0025] It is worth mentioning that the second control component runs a test software to realize actual control and configuration of the PROFIBUS bus device component and the PROFIBUS bus receiving component through the test software. A driver is installed in the second interface of the PROFIBUS bus receiving component, and the test software can call the driver and configure working parameters of the driver to control whether the driver accesses the logic levels from the PROFIBUS bus component through the second cable and a sampling frequency. Here, the working parameters of the driver include a first input parameter clk, a second input parameter ch, an output parameter data, and a system clock, the first input parameter is used to configure a baud rate of the driver, the second input parameter is used to configure a switch state of a receiving channel of the driver, the output parameter is used to output data in the driver, and the system clock is used to determine a frequency of the driver for the logic levels. For example, the test software can be C#, LabWindows / CVI, VC++, LabView, or the like, and a virtual control panel for calling the driver can be set on the test software running in the computer of the second control component. The virtual control panel integrates functions that the driver wants to achieve, and the working parameters of the driver are manually operated on the virtual control panel to control the driver to execute according to the working parameters, and the data received by the driver can be seen on the virtual control panel.
[0026] The PROFIBUS bus component can be a PROFIBUS bus test cable, and the first cable, the second cable, and the third cable can be DB9 interfaces.
[0027] In another embodiment of the present application, a PROFIBUS bus gateway module communication test method is provided, which is applied to the PROFIBUS bus gateway module communication test device described in the above embodiments, as shown in Figure 2 The method comprises: Step 201, the first control group configures the gateway module group based on the preset communication parameters in response to the test instruction, to configure the test communication parameters of the gateway module group.
[0028] Step 202, the test software in the second control group configures the attempt working parameters of the driver in the PROFIBUS bus receiving group.
[0029] Step 203, if the channel state in the attempt working parameters is open, the driver acquires the logic level sequence on the PROFIBUS bus group, and based on the conversion from high level to low level in the logic level sequence, intercepts the logic level sub-sequence from the logic level sequence as the candidate data frame.
[0030] Step 204, the driver performs data frame processing on the candidate data frame based on the attempt baud rate in the attempt working parameters, to obtain the effective data frame.
[0031] Step 205, the test software determines the target communication parameters matched with the test communication parameters configured under the current configuration of the gateway module group based on the effective data frame, and changes the channel state of the driver to closed.
[0032] Step 206, the test software reconfigures the PROFIBUS bus device group according to the target communication parameters, to control the reconfigured PROFIBUS bus device group to send test upstream data to the gateway module group, so that the gateway module group issues test downstream data to the PROFIBUS bus device group.
[0033] Step 207, the test software determines the test result of the test communication parameters configured under the current configuration of the gateway module group based on the test upstream data and the test downstream data.
[0034] Step 208, the first control group reconfigures the gateway module group until the preset communication parameters are all tested.
[0035] In the embodiment, the first control group configures the gateway module group based on the preset communication parameters in response to the test instruction to obtain the test communication parameters configured under the current configuration; then, the test software of the second control group configures the trial working parameters for the driver in the PROFIBUS bus receiving group; when the channel state in the trial working parameters of the driver is open, the driver acquires the logic level sequence on the PROFIBUS bus group, and after recognizing the high-to-low level conversion, the logic level sub-sequence is intercepted as a candidate data frame according to the preset bit number, and the effective data frame is obtained by performing data frame processing on the candidate data frame based on the trial baud rate in the trial working parameters; subsequently, the test software calculates whether the data message determined based on the effective data frame conforms to the PROFIBUS communication protocol, judges whether the data message format is correct, and when the format is correct, determines the target communication parameters matched with the test communication parameters under the current configuration of the gateway module group, and changes the channel state of the driver to closed; finally, the test software reconfigures the PROFIBUS bus device group according to the target communication parameters, and controls the reconfigured PROFIBUS bus device group to send test uplink data to the gateway module group, so that the gateway module group issues test downlink data to the PROFIBUS bus device group, thereby determining the test result of the test communication parameters of the gateway module group under the current configuration based on the test uplink data and the test downlink data; after completion, the first control group continues to switch the next group of test communication parameters of the gateway module group until all the preset communication parameters are covered. Through the self-matching process of the communication parameters, the application can automatically identify different communication parameters under different configurations of the gateway module group, obtain the target communication parameters matched therewith, and trigger the re-matching mechanism of changing the baud rate when the baud rate is not matched, thereby reducing the operation cost of manual trial fitting. Moreover, after the target communication parameters are determined, the application reconfigures the PROFIBUS bus device group, so that the reconfigured PROFIBUS bus device group sends test uplink data to the gateway module group, and organizes the sending and reading of the test uplink data and the test downlink data issued by the gateway module group, to form a repeatable communication test process under the condition of the same target communication parameters, so that the test result can output a qualified or unqualified conclusion around the purpose of whether the data is lost, and the automatic test of full coverage of the communication parameters can be realized.
[0036] In still another embodiment of the application, a PROFIBUS bus gateway module communication test method is provided, which is applied to the PROFIBUS bus gateway module communication test device described in the above embodiments, as shown in Figure 3 The method comprises the following steps: Step 301, the first control group responds to the test instruction.
[0037] If the test instruction is an initial test instruction, the first control group determines initial communication parameters as test communication parameters based on preset communication parameters, configures the gateway module group according to the initial communication parameters, and configures the PROFIBUS bus device group according to the initial communication parameters, so that the PROFIBUS bus group can transmit the uplink data messages sent by the PROFIBUS bus device group to the gateway module group and the downlink data messages sent by the gateway module group to the PROFIBUS bus device group.
[0038] If the test instruction is a continuous test instruction, the first control group switches the test communication parameters of the gateway module group based on the preset communication parameters, so that the PROFIBUS bus group can transmit the diagnostic data messages sent by the gateway module group to the PROFIBUS bus device group according to the switched test communication parameters.
[0039] In this embodiment, since the communication data volume between the gateway module group and the PROFIBUS bus device group is relatively large, it is necessary to test the communication of the gateway module group to determine whether data is lost in the communication process of the gateway module group with the PROFIBUS bus device group after being configured with different communication parameters, so as to determine the communication performance of the gateway module group under different communication parameters.
[0040] In steps 301-303, after the communication test device in the above embodiment is built, the test personnel issues a test instruction to the first control group through the engineer station in the first case, and the first control group responds to the test instruction to configure the gateway module group composed of the PROFIBUS bus gateway modules to be tested in the first case, and configures a set of test communication parameters for the gateway module group, so as to verify whether data is lost when the gateway module group communicates according to the test communication parameters configured under the current configuration in the subsequent steps.
[0041] Here, the test communication parameters include a test baud rate, a test operation mode, and a test communication slave address. The test communication slave address is a preset station address of a PROFIBUS slave module in the PROFIBUS slave module group that needs to be communicated by the gateway module group using the test communication parameters, and can be randomly selected from the preset station addresses of the PROFIBUS slave modules in the PROFIBUS slave module group. The test baud rate and the test operation mode need to be selected from the preset baud rates and the preset operation modes that can be used by the gateway module group in an actual industrial scene. For example, the preset baud rates include 9.6 kbps, 19.2 kbps, 45.45 kbps, 93.75 kbps, 187.5 kbps, 500 kbps, 1.5 Mbps, 3 Mbps, 6 Mbps, and 12 Mbps, and the preset operation modes include 64 operation modes. Thus, the preset baud rates, the preset operation modes, and the preset station addresses can be used as preset communication parameters, and the preset baud rates, the preset operation modes, and the preset station addresses can be combined to form a plurality of preset communication parameter combinations to be tested by the gateway module group. Thus, the first control group can select each communication parameter combination as the test communication parameters from the preset communication parameter combinations in turn each time the test instruction is received, so as to comprehensively cover all communication parameters that need to be verified by the gateway module group.
[0042] It should be noted that the test instruction includes an initial test instruction and a continued test instruction. The test instruction received by the first control group for the first time is the initial test instruction, and the first control group configures the gateway module group for the first time in response to the initial test instruction to configure a set of initial communication parameters as test communication parameters for the gateway module group based on the preset communication parameters. At the same time, the second control group configures the PROFIBUS bus device group with the same initial communication parameters, so that after the first control group receives the test instruction for the first time, the gateway module group and the PROFIBUS bus device group can successfully communicate based on the same set of initial communication parameters, and the communication data between the gateway module group and the PROFIBUS bus device group can be transmitted on the third bus group. It is worth mentioning that in subsequent steps, the communication parameters of the gateway module group and the PROFIBUS bus device group are changed from the initial communication parameters. When the gateway module group and the PROFIBUS bus device group successfully communicate based on the same set of initial communication parameters, the communication data transmitted on the PROFIBUS bus group is the uplink data message sent by the PROFIBUS bus device group to the gateway module group, and the downlink data message issued by the gateway module group to the PROFIBUS bus device group. As the test progresses, when the first control group receives a continued test instruction, the second control group will reconfigure the gateway module group in response to the continued test instruction to switch the test communication parameters of the gateway module group. At this time, the gateway module group and the PROFIBUS bus device group will not be able to successfully communicate, and at this time, the only communication data that can be transmitted on the PROFIBUS bus group is the diagnostic data message issued by the gateway module group to the PROFIBUS bus device group according to the switched test communication parameters.
[0043] Here, the uplink data message, the downlink data message and the diagnostic data message are all data messages defined by the PROFIBUS communication protocol. The data message defined by the PROFIBUS communication protocol includes a plurality of PROFIBUS bus data frames, and in the data message defined by the PROFIBUS communication protocol, the PROFIBUS bus data frame at the fixed position is used to represent the same content.
[0044] For example, the data message defined by the PROFIBUS communication protocol includes twelve PROFIBUS bus data frames, each of which is in hexadecimal representation and is a bit-level frame including a 1-bit start bit of low level, 8-bit data bits, 1-bit parity bit and 1-bit stop bit of high level. For example, the first four PROFIBUS bus data frames in the data message defined by the PROFIBUS communication protocol are frame headers; the fifth and sixth data frames are address frames, which are used to indicate the sending direction of the data message; the seventh to tenth data frames are transmission data frames of the data message; the eleventh data frame is a checksum frame of valid data; and the twelfth data frame is a frame tail. For example, for the data message "68, 07, 07, 68, 06, 02, 01, 02, 03, 04, 6F, 16", "68, 07, 07, 68" are frame headers of the data message; "06, 02" are address frames of the data message, which indicate an uplink data message sent from a slave station 06 to a master station 02; the transmission data in the uplink data message are "01, 02, 03, 04"; "6F" is a checksum of the transmission data, i.e., the sum of the transmission data; and "16" is a frame tail. For another example, for the data message "68, 07, 07, 68, 02, 06, 3D, 3D, 3D, 3D, 04, 16", "68, 07, 07, 68" are frame headers of the data message; "02, 06" indicate that the data message is a downlink data message sent from a master station 02 to a slave station 06; the transmission data in the downlink data message are "3D, 3D, 3D, 3D"; "04" is a checksum of the transmission data; and "16" is a frame tail.
[0045] It should be noted that in the embodiment, the communication address of the gateway module group as the master station is known. That is, the test communication slave station address of the gateway module group can be monitored from the address frames of the data message defined by the PROFIBUS communication protocol.
[0046] In step 304, the test software in the second control group configures the attempt working parameters of the driver in the PROFIBUS bus receiving group.
[0047] In this step, the test software in the second control group in the second chassis is started. Meanwhile, the PROFIBUS bus receiving group in the second chassis is powered on, and the driver thereon starts to execute. For each set of test communication parameters of the gateway module group, the test software first configures a set of attempt working parameters for the driver, including an attempt baud rate selected from the preset baud rates, the system clock of the driver and the channel state of the receiving channel. The attempt baud rate is used to match the test baud rate configured under the current configuration of the gateway module group used on the PROFIBUS bus group.
[0048] Specifically, the test software configures a first input parameter of the driver to attempt a baud rate, and configures a second input parameter of the driver to open a receiving channel. Here, if the test software does not configure the first input parameter and the second input parameter of the driver, the driver executes at a default baud rate and with the receiving channel closed. The system clock of the driver is fixed and does not change during the entire test, and is used to control the number of sampling points per bit at different attempted baud rates. For example, the default baud rate of the driver can be selected as 9.6 kbps. The system clock can be determined according to the maximum transmission rate of the data to be read by the driver. For example, if the maximum transmission rate of the data to be read by the driver is 12 MHz, 120 MHz can be selected as the system clock to ensure that the data transmission is lossless and interference-free. The number of sampling points per bit at different preset baud rates and system clocks is shown in Table 1.
[0049] Table 1
[0050] In step 305, if the channel state in the attempted working parameter is open, the driver obtains a logic level sequence on the PROFIBUS bus group. After identifying a transition from high to low in the logic level sequence, a logic level sub-sequence is extracted from the logic level sequence according to a preset bit number of a PROFIBUS bus data frame specified in the PROFIBUS communication protocol after the identified low, so as to take the logic level sub-sequence as a candidate data frame.
[0051] It is worth mentioning that there is no data on the PROFIBUS bus group, and the communication data can only be transmitted through the high and low states of the logic level represented by binary 0 and 1 on the PROFIBUS bus group.
[0052] In this step, after the test software opens the receiving channel of the driver by configuring the second input parameter of the driver, the driver can determine whether the PROFIBUS bus group is transmitting communication data through the high and low states of the logic level of the physical signal on the PROFIBUS bus group accessed through the second cable. It can be understood that after the channel of the driver is opened, the driver can continuously sample through the second cable according to the set system clock, that is, access the logic level of the physical signal on the PROFIBUS bus group according to the set system clock, and obtain a logic level sequence of the PROFIBUS bus group.
[0053] Thus, based on the format of the PROFIBUS bus data frame, when the driver program identifies the transition from high level to low level on the PROFIBUS bus group each time, it indicates that the PROFIBUS bus group is starting to transmit a PROFIBUS bus data frame. Specifically, if the driver program identifies that the logic level is high, it indicates that the PROFIBUS bus group is in an idle state and has not started to send a PROFIBUS bus data frame. At this time, the subsequent step of the data frame processing flow of the driver program is not triggered, avoiding the idle segment being treated as valid data for analysis. If the driver program identifies that the logic level transitions from high to low, it indicates that the PROFIBUS bus group is starting to transmit a PROFIBUS bus data frame. At this time, the data frame processing flow of the driver program is triggered. It should be noted that after the channel of the driver program is opened and the driver program identifies the transition from high to low on the PROFIBUS bus group for the first time, the driver program will immediately intercept a logic level sub-sequence from the logic level sequence after the low level according to the preset bit number of the PROFIBUS bus data frame each time the driver program identifies the transition from high to low on the PROFIBUS bus group, and take the logic level sub-sequence as a candidate data frame, and trigger the data frame processing flow of the driver program in the subsequent steps.
[0054] In step 306, the driver program sorts the candidate data frames in time sequence to obtain a data frame order; the driver program abstracts the data frame processing logic into a black box model; the driver program takes the candidate data frame at the first position in the data frame order as a current candidate data frame, and inputs the current candidate data frame into the black box model, so that the black box model outputs the byte data of the current candidate data frame based on the current configured trial baud rate of the driver program; if the byte data of the current candidate data frame output by the black box model does not meet the preset condition, the test software switches the current configured trial baud rate of the driver program to another trial baud rate, and the driver program inputs the next candidate data frame in the data frame order into the black box model as the current candidate data frame, so that the black box model outputs the byte data of the current candidate data frame based on the trial baud rate after the switch of the driver program, until the byte data of the current candidate data frame output by the black box model meets the preset condition; if the byte data of the current candidate data frame output by the black box model meets the preset condition, the driver program takes the byte data meeting the preset condition as a valid data frame, and the test software takes the trial baud rate configured by the driver program when the black box model outputs the valid data frame as a target baud rate matching the test baud rate configured under the current configuration of the gateway module group; the driver program continues to input the remaining candidate data frames in the data frame order into the black box model corresponding to the target baud rate until a preset stop condition is reached.
[0055] The other trial baud rate is determined according to the preset baud rate in the preset communication parameter except the trial baud rate already configured by the driver program.
[0056] It can be understood that the driver continuously intercepts the candidate data frames after the receiving channel of the driver is opened.
[0057] In this step, the driver sorts the candidate data frames according to the interception time of the candidate data frames to obtain a data frame order, so that the driver performs data frame processing on the candidate data frames in sequence according to the data frame order. At this time, the data frame processing logic can be regarded as a black box model. The driver inputs the candidate data frame located at the first position in the data frame order as a current candidate data frame into the black box model in sequence, and the black box model processes the current candidate data frame according to the currently configured trial baud rate of the driver to output byte data determined based on the current candidate data frame.
[0058] If the byte data output by the black box model for the current candidate data frame is all 0 or random code (i.e., does not meet the preset condition), it indicates that the currently configured trial baud rate of the driver does not match the test baud rate configured under the current configuration of the gateway module group, i.e., is inconsistent, and the driver cannot successfully parse the correct PROFIBUS bus data frame from the logical level subsequence. At this time, the test software immediately switches the trial baud rate of the driver to other baud rates in the preset baud rate except for the trial baud rate already configured by the driver, so that the black box model processes the next candidate data frame in the data frame order according to the switched trial baud rate, until the byte data output by the black box model for the current candidate data frame is regular and non-0 code (i.e., meets the preset condition).
[0059] Here, a fixed order can be set for the preset baud rate, so that after the gateway module group switches the test configuration parameters, the test software switches the trial baud rate of the driver according to the same order from beginning to end.
[0060] If the byte data output by the black box model for the current candidate data frame is regular and non-0 code, it indicates that the currently configured trial baud rate of the driver matches the test baud rate configured under the current configuration of the gateway module group, i.e., is consistent, and the driver can successfully parse the correct PROFIBUS bus data frame from the logical level subsequence. The driver regards the regular and non-0 code (i.e., the byte data meeting the preset condition) as valid data frames. At this time, the test software regards the trial baud rate of the driver when the black box model outputs the valid data frames as a target baud rate matching the test baud rate configured under the current configuration of the gateway module group. It can be understood that the target baud rate has the same value as the test baud rate configured under the current configuration of the gateway module group.
[0061] Thus, the driver program does not need to extract the test communication parameters of the gateway module group in advance, but can obtain the test communication parameters currently used by the gateway module group through the self-matching process.
[0062] After obtaining the first valid data frame, the driver program continues to input the remaining candidate data frames in the data frame sequence into the black box model, so that the black box model outputs more valid data frames for subsequent steps until a preset stopping condition is reached. For example, the preset stopping condition can be determined according to the number of valid data frames, which can meet the analysis requirements of subsequent steps, and the embodiment is not limited specifically.
[0063] Further, as a refinement and extension of the above embodiment, in order to fully describe the specific implementation process of the embodiment, the driver program outputs the byte data of the current candidate data frame based on the currently configured trial baud rate, specifically including: determining whether the first bit of the logical level subsequence corresponding to the current candidate data frame is a low-level start bit; based on the currently configured trial baud rate of the driver program, the data in the first preset bit sequence of the logical level subsequence corresponding to the current candidate data frame is parsed to obtain byte data; based on the byte data and the data in the second preset bit sequence of the logical level subsequence corresponding to the current candidate data frame, parity check is performed; determining whether the data in the third preset bit sequence of the logical level subsequence corresponding to the current candidate data frame is a high-level stop bit; if the parity check is incorrect, or the stop bit is not a high-level, or the currently configured trial baud rate of the driver program does not match the baud rate of the transmitted logical level subsequence, the byte data that does not meet the preset condition is output; if the parity check is correct, and the stop bit is a high-level, and the currently configured trial baud rate of the driver program matches the baud rate of the transmitted logical level subsequence, the byte data that meets the preset condition is output.
[0064] In this step, in the black box model, the driver program performs bit-level legality verification on the input current candidate data frame.
[0065] Specifically, in the black box model, the driver first determines whether the first bit in the time sequence position of the logical level subsequence corresponding to the current candidate data frame is a low level start bit. Then, 8 bits of data (i.e., the first preset bit sequence) are taken out at the time sequence position after the start bit in the logical level subsequence corresponding to the current candidate data frame, and the 8 bits of data are assembled into a hexadecimal byte data according to the current configured attempt baud rate of the driver. Then, a parity check bit (i.e., the second preset bit sequence) is obtained after the 8 bits of data in the logical level subsequence corresponding to the current candidate data frame, and the parity check bit is compared with the parity check value calculated according to the 8 bits of data in the current candidate data frame to verify the correctness of data transmission. Subsequently, a stop bit (i.e., the third preset bit sequence) is obtained after the parity check bit in the logical level subsequence corresponding to the current candidate data frame, and it is verified whether the stop bit is a high level. If the parity check of the logical level subsequence corresponding to the current candidate data frame is incorrect, or the stop bit is not a high level, or the current configured attempt baud rate of the driver does not match the baud rate of the transmitted logical level subsequence, the driver cannot successfully parse the byte data of the current candidate data frame, and the byte data output by the black box model is all 0 or random codes. If the parity check of the current candidate data frame is correct, the stop bit is a high level, and the current configured attempt baud rate of the driver matches the baud rate of the transmitted logical level subsequence, the driver can successfully parse the byte data of the current candidate data frame, and the byte data output by the black box model is a regular, non-0 code.
[0066] It should be noted that when the gateway module group and the PROFIBUS bus device group use the same set of initial communication parameters, the communication data transmitted on the PROFIBUS bus group includes the uplink data messages sent by the PROFIBUS bus device group and the downlink data messages issued by the gateway module group. At this time, the logical level subsequence accessed by the driver from the PROFIBUS bus group may be sent by the gateway module group or the PROFIBUS bus device. As the test progresses, when the control group 1 switches the test communication parameters of the gateway module group, the logical level subsequence accessed by the driver from the PROFIBUS bus group is sent by the gateway module group when the gateway module group issues diagnostic data. Therefore, this step actually matches the attempt baud rate of the driver with the test baud rate configured by the gateway module group in the current configuration to obtain a target baud rate that matches the test baud rate configured by the gateway module group in the current configuration.
[0067] In step 307, the test software calls the output parameter of the driver program, reads the valid data frames, and arranges the valid data frames in time sequence to obtain a valid data frame sequence; the test software intercepts a candidate data message in the valid data frame sequence according to the frame header and frame tail format of the data message specified in the PROFIBUS communication protocol; the test software determines candidate transmission data and candidate checksum in the candidate data message according to the transmission data frame and checksum frame format of the data message specified in the PROFIBUS communication protocol, and calculates the sum of the candidate transmission data; the test software takes the candidate data message whose sum of the candidate transmission data is equal to the candidate checksum as the valid data message; the test software determines a target baud rate and a target communication slave station address that match the test working mode and the test communication slave station address configured under the current configuration of the gateway module group according to the format of the data message specified in the PROFIBUS communication protocol based on the valid data message; and the test software determines the target communication parameters according to the target baud rate corresponding to the valid data frame, the target baud rate, and the target communication slave station address, and changes the channel state of the driver program to a closed state.
[0068] In this step, when the test software gets the target baud rate matching the test baud rate configured under the current configuration of the gateway module group, the output parameter of the driver program is called, the valid data frames output when the driver program configures the target baud rate are read, and the read valid data frames are arranged in the time sequence of reading to obtain a valid data frame sequence. The test software intercepts the candidate data message in the valid data frame sequence according to the frame header and the frame tail in the data message specified in the PROFIBUS communication protocol. Here, the adjacent frame header and frame tail and the valid data frame between the adjacent frame header and frame tail can be taken as the candidate data message from the first frame header in the valid data frame sequence; then, the candidate transmission data and the candidate checksum in the candidate data message are determined according to the transmission data frame position and the checksum frame position in the data message specified in the PROFIBUS communication protocol, and it is calculated whether the sum of the candidate transmission data is equal to the candidate checksum, if equal, the candidate data message is taken as the valid data message; further, the data of the address frame in the valid data message is extracted, the communication address data of the gateway module is removed from the data of the address frame in the valid data message, and the target communication slave address matching the test communication slave address configured under the current configuration of the gateway module group is determined; and according to the target communication slave address and the communication address of the gateway module, the valid uplink data message and the valid downlink data message in the valid data message are distinguished to determine the target working mode matching the test working mode configured under the current configuration of the gateway module group based on the valid uplink data message and the valid downlink data message. It can be understood that the target communication slave address is equal to the test communication slave address configured under the current configuration of the gateway module group, and the target working mode is equal to the test working mode configured under the current configuration of the gateway module group.
[0069] It should be noted that when the gateway module group and the PROFIBUS bus device group successfully communicate based on the same set of initial communication parameters, the valid uplink data message in the valid data message is the uplink data message sent by the PROFIBUS bus device group to the gateway module group, and the valid downlink data message is the downlink data message issued by the gateway module group to the PROFIBUS bus device group, at this time, the target working mode can be determined based on the number of bytes of the transmission data in the valid uplink data message and the valid downlink data message. With the progress of the test, after the first control group receives the continue test instruction and switches the test communication parameters of the gateway module group, the valid data message only includes the valid downlink data message, and the valid downlink data message at this time is the diagnostic data message issued by the gateway module group to the PROFIBUS bus device group.
[0070] Here, the diagnostic data packet still belongs to the data packet defined by the PROFIBUS communication protocol, but the address frame in the diagnostic data packet is changed according to the addresses of the gateway module group and the PROFIBUS bus device group. For example, if the gateway module group and the PROFIBUS bus device group can communicate normally, and 2 and 6 are used to represent the master station and the slave station respectively, then the address frame in the diagnostic data packet can be changed to 82 and 86, 8 being the identifier of the diagnostic data packet, indicating that the diagnostic data packet is sent from the master station 2 to the slave station 6. When the gateway module group and the PROFIBUS bus device group can communicate normally, the address frame in the data packet can be changed back to 02 and 06.
[0071] It is worth mentioning that when the gateway module group and the PROFIBUS bus device group cannot communicate normally, only the diagnostic data packet issued by the gateway module group is transmitted on the PROFIBUS bus group, and at this time, the test working mode configured by the gateway module group under the current configuration cannot be obtained by combining the byte number of the transmitted data in the valid uplink data packet and the valid downlink data packet. In the embodiment, the diagnostic data packet also carries the working mode code when the gateway module group issues the diagnostic data packet, so that the driving program can analyze the working mode of the diagnostic data packet. For example, Modhule="240 byte-in / 0 byte-out consist" 0x40, 0xFF, 0x40, 0xF7.
[0072] Therefore, the test software determines the target communication parameters, including the target baud rate, the target working mode and the target communication slave station address, which match the test baud rate, the test working mode and the test communication slave station address configured by the gateway module group under the current configuration. When the test software obtains the target communication parameters matching the test communication parameters configured by the gateway module group under the current configuration, the second input parameter of the driving program is called and changed to the closed state to close the receiving channel of the driving program. Until the next test instruction is received by the first control group, the test software reconfigures the second input parameter of the driving program to the open state.
[0073] Step 308, the test software reconfigures the PROFIBUS bus device group according to the target communication parameters, so as to control the reconfigured PROFIBUS bus device group to send test uplink data to the gateway module group, so that the gateway module group issues test downlink data to the PROFIBUS bus device group.
[0074] Step 309, the test software determines the test result of the test communication parameters configured by the gateway module group under the current configuration based on the test uplink data and the test downlink data.
[0075] Step 310, the first control group reconfigures the gateway module group until all the preset communication parameters are tested.
[0076] In steps 308-310, the test software reconfigures the PROFIBUS bus device group according to the target communication parameters, and controls the reconfigured PROFIBUS bus device group to cyclically send test uplink data in the form of triangular wave to the gateway module group. The test uplink data is received by the gateway module group via the third interface, the third cable, the PROFIBUS bus group, the first cable and the first interface. Since the target communication parameters of the reconfigured PROFIBUS bus device group are the same as the test communication parameters configured under the current configuration of the gateway module group, the reconfigured PROFIBUS bus device group and the gateway module group under the current configuration can successfully communicate, and the gateway module group under the current configuration can issue test downlink data to the reconfigured PROFIBUS bus device group. It can be understood that the test downlink data is also in the form of triangular wave.
[0077] For example, the triangular wave data can be 0-1-2-…-100-…2-1-0.
[0078] Further, the test software reads the test uplink data sent by the reconfigured PROFIBUS bus device group and the test downlink data received by the PROFIBUS bus device group, saves the test uplink data and the test downlink data into an excel table, and then converts the test uplink data or the test downlink data into a sine wave or a triangular wave. If the sine wave or the triangular wave has jumps or missing parts, it indicates that the gateway module group will lose data when communicating according to the test communication parameters configured under the current configuration, and the test result of the test communication parameters configured by the gateway module group under the current configuration is unqualified, otherwise, the test result of the test communication parameters configured by the gateway module group under the current configuration is qualified.
[0079] Further, after the test software obtains the test result of the test communication parameters configured by the gateway module group under the current configuration, the test software issues a stop instruction to the PROFIBUS bus device group, and then the first control group reselects the next set of test communication parameters based on the preset communication parameters to reconfigure the gateway module group, and performs the next round of communication test on the gateway module group. This cycle is repeated until all the preset communication parameters of the gateway module group are tested.
[0080] The embodiment can read the communication data transmitted on the PROFIBUS bus group, can complete the interpretation of the uplink data and downlink data on the PROFIBUS bus. Meanwhile, the automatic matching of the PROFIBUS communication baud rate can be performed, and the automatic switching of 64 test modes can be completed. Moreover, the embodiment can intercept and save the data message under the PROFIBUS communication protocol, complete the addressing and checking of all communication devices, and facilitate the rapid positioning of communication faults. In addition, the embodiment converts the uplink data of the PROFIBUS bus device group into a triangular wave and sends it to the gateway module group, and completes the triangular wave communication of 64 test modes. Thus, the automatic matching function of 10 baud rates and 64 modes of the PROFIBUS bus gateway module, the visualization of the data message under the PROFIBUS communication protocol, the debugging function of the PROFIBUS communication link, the function of the PROFIBUS bus device sending a triangular wave, and the automatic matching function of the PROFIBUS bus baud rate are completed.
[0081] It should be noted that the size of the serial number of each step in the above embodiment does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiment of the application.
[0082] Further, as shown in Figure 4 As a specific implementation of the PROFIBUS bus gateway module communication test method, the embodiment of the application provides a PROFIBUS bus gateway module communication test system 400, which comprises a configuration module 401, a matching module 402, a test module 403 and a cycle module 404.
[0083] The configuration module 401 is configured to configure the test communication parameters of the gateway module group based on the preset communication parameters in response to the test instruction. The matching module 402 is configured to, if the channel state in the trial working parameter is an open state, acquire the logic level sequence on the PROFIBUS bus group by the driver, intercept a logic level sub-sequence from the logic level sequence based on the conversion from high level to low level in the logic level sequence, and take the logic level sub-sequence as a candidate data frame; and based on the trial baud rate in the trial working parameter, the driver performs data frame processing on the candidate data frame to obtain an effective data frame; and based on the effective data frame, the test software determines a target communication parameter matched with the test communication parameter configured under the current configuration of the gateway module group, and changes the channel state of the driver to a closed state. The test module 403 is configured to test the software to reconfigure the PROFIBUS bus device group according to the target communication parameters, to control the reconfigured PROFIBUS bus device group to send test uplink data to the gateway module group, so that the gateway module group issues test downlink data to the PROFIBUS bus device group; and the test software determines the test result of the test communication parameters configured by the gateway module group under the current configuration based on the test uplink data and the test downlink data. The cycle module 404 is configured to reconfigure the gateway module group by the first control group until the preset communication parameters are all tested.
[0084] For specific definitions of the PROFIBUS bus gateway module communication test system, refer to the definitions of the PROFIBUS bus gateway module communication test method in the foregoing, which will not be repeated here. The various modules in the PROFIBUS bus gateway module communication test system described above can be realized by software, hardware, or a combination thereof, in whole or in part. The various modules described above can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so that the processor can call and execute the operations corresponding to the various modules.
[0085] Based on the method as shown in Figures 2-3 , correspondingly, the embodiment of the present application also provides a readable storage medium, which stores a computer program, and the program is executed by a processor to realize the PROFIBUS bus gateway module communication test method as shown in Figures 2-3 .
[0086] Based on such understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a U disk, a mobile hard disk, etc.), and includes a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in various implementation scenarios of the present application.
[0087] Based on the method as shown in Figures 2-3 , and Figure 4 the virtual system embodiment, in order to achieve the above purpose, the embodiment of the present application further provides a computer device, which can be a personal computer, a server, a network device, etc., and the computer device includes a storage medium and a processor; the storage medium is configured to store a computer program; and the processor is configured to execute the computer program to realize the PROFIBUS bus gateway module communication test method as shown in Figures 2-3 .
[0088] Optionally, the computer device can further include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, and the like. The user interface can include a display, an input unit such as a keyboard, and the like. Optionally, the user interface can further include a USB interface, a card reader interface, and the like. The network interface can optionally include a standard wired interface, a wireless interface (such as a Bluetooth interface, a WI-FI interface), and the like.
[0089] Those skilled in the art can understand that the computer device structure provided by the embodiment does not constitute a limitation on the computer device, and can include more or fewer components, or combine certain components, or different component arrangements.
[0090] The storage medium can further include an operating system and a network communication module. The operating system is a program for managing and saving computer device hardware and software resources, and supports the running of information processing programs and other software and / or programs. The network communication module is used to realize communication between components in the storage medium, and communication with other hardware and software in the entity device.
[0091] Those skilled in the art can clearly understand from the above description of the embodiments that the present application can be implemented by means of software and a necessary general hardware platform, or by hardware.
[0092] Those skilled in the art can understand that the accompanying drawings are only a schematic diagram of a preferred implementation scenario, and the modules or processes in the drawings are not necessarily essential for implementing the present application. Those skilled in the art can understand that the modules in the device in the implementation scenario can be distributed in the device in the implementation scenario according to the description of the implementation scenario, or can be changed and located in one or more devices different from the implementation scenario. The modules of the above implementation scenario can be combined as one module, or can be further split into multiple sub-modules.
[0093] The above serial numbers of the present application are only for description, and do not represent the advantages and disadvantages of the implementation scenario. The above disclosure is only several specific implementation scenarios of the present application, but the present application is not limited thereto. Any changes that can be thought of by those skilled in the art should fall within the protection scope of the present application.
Claims
1. A PROFIBUS bus gateway module communication testing method, applied to a PROFIBUS bus gateway module communication testing device, the device comprising a first chassis, a second chassis, and a PROFIBUS bus group, the first chassis comprising a first control group and a gateway module group, the gateway module group comprising a PROFIBUS bus gateway module under test, the second chassis comprising a second control group, a PROFIBUS bus receiving group, and a PROFIBUS bus device group, wherein the first chassis and the second chassis can communicate via the PROFIBUS bus group, characterized in that... The method includes: The first control group responds to the test command and configures the gateway module group based on preset communication parameters to configure the test communication parameters of the gateway module group; The test software in the second control group configures the trial operating parameters of the driver in the PROFIBUS bus receiver group; If the channel status in the attempted working parameters is in the open state, the driver obtains the logic level sequence on the PROFIBUS bus group, and based on the transition from high level to low level in the logic level sequence, extracts a logic level sub-sequence from the logic level sequence to use the logic level sub-sequence as a candidate data frame; The driver performs data frame processing on the candidate data frames based on the attempt baud rate in the attempt working parameters to obtain valid data frames; Based on the valid data frame, the test software determines the target communication parameters that match the test communication parameters configured in the current configuration of the gateway module group, and changes the channel status of the driver to the off state. The test software reconfigures the PROFIBUS bus device group according to the target communication parameters, so as to control the reconfigured PROFIBUS bus device group to send test uplink data to the gateway module group, and so that the gateway module group sends test downlink data to the PROFIBUS bus device group. The testing software determines the test results of the test communication parameters configured in the current configuration of the gateway module group based on the test uplink data and the test downlink data. The first control group reconfigures the gateway module group until all the preset communication parameters have been tested.
2. The PROFIBUS bus gateway module communication test method according to claim 1, characterized in that, The preset communication parameters include the preset baud rate, the preset working mode, and the preset station address of the PROFIBUS bus slave module in the PROFIBUS bus device group; the test communication parameters include the test baud rate determined according to the preset baud rate, the test working mode determined according to the preset working mode, and the test communication slave address of the gateway module group determined according to the preset station address. The attempt working parameters include the attempt baud rate determined according to the preset baud rate, the system clock, and the channel status of the driver receive channel.
3. The PROFIBUS bus gateway module communication test method according to claim 1, characterized in that, The test instructions include an initial test instruction and a continue test instruction. In response to the test instructions, the gateway module group is configured based on preset communication parameters to configure the test communication parameters of the gateway module group, specifically including: If the test instruction is the initial test instruction, the initial communication parameters are determined based on the preset communication parameters as the test communication parameters, and the gateway module group is configured according to the initial communication parameters. The second control group is configured according to the initial communication parameters to enable the transmission of uplink data packets sent by the PROFIBUS bus device group to the gateway module group and downlink data packets sent by the gateway module group to the PROFIBUS bus device group on the PROFIBUS bus group. If the test instruction is the continue test instruction, the test communication parameters of the gateway module group are switched based on the preset communication parameters so that the PROFIBUS bus group can transmit diagnostic data messages sent by the gateway module group to the PROFIBUS bus device group according to the switched test communication parameters.
4. The PROFIBUS bus gateway module communication test method according to claim 1, characterized in that, The step of acquiring the logic level sequence on the PROFIBUS bus group and extracting a logic level sub-sequence from the logic level sequence based on the transition from high to low level in the logic level sequence specifically includes: After recognizing the transition from high to low level in the logic level sequence, the logic level sub-sequence is extracted from the recognized low level in the logic level sequence according to the preset number of bits of the PROFIBUS bus data frame specified by the PROFIBUS communication protocol.
5. The PROFIBUS bus gateway module communication test method according to claim 1, characterized in that, The step of processing the candidate data frames based on the trial baud rate in the trial working parameters to obtain valid data frames specifically includes: The candidate data frames are sorted according to time order to obtain the data frame order; The data frame processing logic is abstracted into a black box model; The candidate data frame that is first in the data frame sequence is taken as the current candidate data frame, and the current candidate data frame is input into the black box model so that the black box model outputs the byte data of the current candidate data frame based on the attempt baud rate currently configured by the driver. If the byte data of the current candidate data frame output by the black-box model does not meet the preset conditions, the test software switches the currently configured attempt baud rate of the driver to another attempt baud rate, and the driver inputs the next candidate data frame in the data frame sequence as the current candidate data frame into the black-box model, so that the black-box model outputs the byte data of the current candidate data frame based on the attempt baud rate switched by the driver, until the byte data of the current candidate data frame output by the black-box model meets the preset conditions. The other attempt baud rate is determined according to the preset baud rate in the preset communication parameters excluding the attempt baud rate configured by the driver. If the byte data of the current candidate data frame output by the black-box model meets the preset conditions, the byte data that meets the preset conditions is taken as a valid data frame, and the test software takes the attempt baud rate configured by the driver when the black-box model outputs the valid data frame as the target baud rate that matches the test baud rate configured in the current configuration of the gateway module group. Continue to input the remaining candidate data frames in the data frame sequence into the black box model corresponding to the target baud rate until the preset stopping condition is reached.
6. The PROFIBUS bus gateway module communication test method according to claim 5, characterized in that, The step of outputting the byte data of the current candidate data frame based on the attempted baud rate currently configured by the driver specifically includes: Determine whether the first bit in the logic level sub-sequence corresponding to the current candidate data frame is a low-level start bit; Based on the attempt baud rate currently configured by the driver, the data in the first preset bit order of the logical level subsequence corresponding to the current candidate data frame is parsed to obtain the byte data; Parity check is performed based on the data in the second preset bit order of the logical level subsequence corresponding to the byte data and the current candidate data frame. Determine whether the data in the third preset bit sequence of the logic level sub-sequence corresponding to the current candidate data frame is a high-level stop bit; If the parity check fails, or the stop bit is not high, or the baud rate currently configured by the driver does not match the baud rate of the logic level subsequence, the byte data that does not meet the preset conditions will be output. If the parity check is correct, the stop bit is high, and the currently configured baud rate of the driver matches the baud rate of the transmitted logic level subsequence, the byte data that meets the preset conditions is output.
7. The PROFIBUS bus gateway module communication test method according to claim 1, characterized in that, The step of determining the target communication parameters that match the test communication parameters configured under the current configuration of the gateway module group based on the valid data frame specifically includes: The output parameters of the driver are called to read the valid data frames and arrange them in chronological order to obtain a valid data frame sequence. Candidate data packets are extracted from the valid data frame sequence according to the frame header and frame trailer format specified in the PROFIBUS communication protocol. According to the transmission data frame and checksum frame format of the data message specified in the PROFIBUS communication protocol, determine the candidate transmission data and candidate checksum in the candidate data message, and calculate the sum of the candidate transmission data; The candidate data packet whose sum of the candidate transmitted data is equal to the candidate checksum is taken as the valid data packet; Based on the data message format specified in the PROFIBUS communication protocol, and the valid data message, determine the target baud rate and target communication slave address that match the test working mode and test communication slave address configured in the current configuration of the gateway module group. The target communication parameters are determined based on the target baud rate corresponding to the valid data frame, the target baud rate, and the target communication slave address.
8. A PROFIBUS bus gateway module communication test system, characterized in that, The system includes: A configuration module is used for the first control group to configure the gateway module group based on preset communication parameters in response to a test command, so as to configure the test communication parameters of the gateway module group; and for the test software in the second control group to configure the trial operating parameters of the driver in the PROFIBUS bus receiving group. The matching module is configured to, if the channel status in the trial operating parameters is open, acquire the logic level sequence on the PROFIBUS bus group, and based on the transition from high to low level in the logic level sequence, extract a logic level sub-sequence from the logic level sequence to use the logic level sub-sequence as a candidate data frame; and, the driver performs data frame processing on the candidate data frame based on the trial baud rate in the trial operating parameters to obtain a valid data frame; and, based on the valid data frame, the test software determines the target communication parameter that matches the test communication parameters configured under the current configuration of the gateway module group, and changes the channel status of the driver to the closed state. The test module is used by the test software to reconfigure the PROFIBUS bus device group according to the target communication parameters, so as to control the reconfigured PROFIBUS bus device group to send test uplink data to the gateway module group, and so that the gateway module group sends test downlink data to the PROFIBUS bus device group; and the test software determines the test result of the test communication parameters configured by the gateway module group in the current configuration based on the test uplink data and the test downlink data. The loop module is used by the first control group to reconfigure the gateway module group until all the preset communication parameters have been tested.
9. A readable storage medium having a program or instructions stored thereon, characterized in that, When the program or instructions are executed by the processor, they implement the steps of the PROFIBUS bus gateway module communication test method as described in any one of claims 1 to 7.
10. A computer device, comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, characterized in that, When the processor executes the program, it implements the PROFIBUS bus gateway module communication test method as described in any one of claims 1 to 7.