A communication network simulation system and a method for constructing the same

By using a bridge to convert the private protocols of communication nodes into a general protocol, a simulation environment is built, which solves the problem of lack of simulation testing for private protocols in battery management systems and enables flexible simulation and reliability verification.

CN115834403BActive Publication Date: 2026-03-31SHANGHAI RUIPU ENERGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-25
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

In the existing technology, the proprietary protocol between the battery management system and the battery management chip lacks simulation testing tools, making it difficult to conduct effective simulation testing, especially when simulating abnormal chip conditions, it is difficult to verify the system's response.

Method used

Design a communication network simulation system that uses a bridge to convert the private protocols of communication nodes into a general protocol, enabling the simulator to recognize and process the converted data information and build a simulation environment for testing.

Benefits of technology

It enables flexible simulation in different communication environments, can simulate various communication entities and link problems, verify the reliability of system design, discover software problems in advance, and meet information security functional requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115834403B_ABST
    Figure CN115834403B_ABST
Patent Text Reader

Abstract

The application provides a communication network simulation system and a construction method thereof. The communication network simulation system comprises a bridge and a simulator. One end of the bridge is used for connecting each communication node with a private protocol, and the other end is connected to the simulator. The bridge processes node data information of each communication node to obtain conversion data information. The conversion data information is transmitted by using a general protocol, and the general protocol can be recognized by the simulator. The simulator receives the conversion data information and performs simulation according to the conversion data information. The communication network simulation system can flexibly simulate in various different communication environments, and allows a user to customize each communication node in the communication network, so that the user can simulate possible problems of each communication entity and communication link within a reasonable cost, and effectively verify the reliability of system design.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to simulation testing technology, and in particular to a communication network simulation system and its construction method. Background Technology

[0002] In embedded software development, it is often necessary to artificially simulate various normal or abnormal external environments to test whether the embedded software can respond as expected under these different conditions. For systems with functional safety requirements, it is particularly important to conduct thorough simulation testing within a foreseeable range, such as battery management systems (BMS). Generally, a battery management system communicates with a specific battery management chip through internal communication lines, managing individual battery cells through the sampling and management functions provided by the battery management chip. Externally, the battery management system typically uses standard industrial bus interfaces (such as CAN, RS485, etc.) to communicate with other system components.

[0003] Currently, standard industrial bus interfaces generally have suitable simulation and testing tools available, such as CANOE. However, the communication between the battery management system and the battery management chip typically uses proprietary protocols from the chip manufacturer (e.g., TPL used by NXP's MC33771C chip), and simulation and testing tools for these proprietary protocols are virtually nonexistent. Furthermore, the battery management chip itself may malfunction during operation, and in many cases, it is extremely difficult to accurately simulate chip failures on actual hardware. Therefore, it is challenging to definitively verify during the design verification phase whether the battery management system will respond as expected to abnormal conditions occurring within the battery management chip itself.

[0004] Whether in specific battery management systems and battery management chips, or in other industrial applications, there are instances where chip manufacturers' proprietary protocols prevent the effective construction of simulation test networks. Therefore, it is urgent to solve the problem that simulation testing cannot be performed due to the need for a dedicated communication environment for proprietary protocols.

[0005] It should be noted that the above introduction to the technical background is only for the purpose of providing a clear and complete explanation of the technical solutions of this application and facilitating understanding by those skilled in the art. It should not be assumed that these technical solutions are known to those skilled in the art simply because they have been described in the background section of this application. Summary of the Invention

[0006] In view of the shortcomings of the prior art described above, the purpose of this invention is to provide a communication network simulation system and its construction method, so as to solve the problem of poor versatility of communication network simulators in the prior art.

[0007] To achieve the above and other related objectives, the present invention provides a communication network simulation system, including a bridge and a simulator;

[0008] One end of the bridge is used to connect each communication node, and the other end is connected to the simulator. Among the communication nodes, at least one communication node uses a proprietary protocol for communication.

[0009] The bridge processes the node data information of each communication node to obtain converted data information, which is transmitted using a common protocol that can be recognized by the emulator.

[0010] The simulator receives the conversion data information and performs simulation based on the conversion data information.

[0011] Preferably, the process by which the bridge processes the node data information of each communication node in the communication network to obtain transformed data information includes:

[0012] Pack and process node data information into frame data fields of a common protocol;

[0013] Frame information is obtained by processing other fields of the frame in the general protocol; the other fields of the frame are fields other than the frame data field in the frame format;

[0014] The frame information and the frame data field are merged to obtain the converted data information.

[0015] Preferably, the communication network simulation system further includes a communication network, which includes at least two communication nodes and at least one connection, wherein at least one communication node uses a proprietary communication protocol; and each connection connects two communication nodes.

[0016] Preferably, the simulator performs simulation based on the converted data information, including:

[0017] The converted data information is processed to construct a communication network including each communication node;

[0018] Simulation tests were conducted on the transmission of the communication network.

[0019] Preferably, the bridge transmits the converted data information to the emulator via the IPC channel.

[0020] Preferably, the standard stream method is used for transmission in the IPC channel.

[0021] Preferably, the process of the simulator performing simulation based on the converted data information includes:

[0022] The simulator's main process creates child processes based on all the conversion data information;

[0023] All data conversion is initiated in the main process;

[0024] After startup, each conversion data information is hosted as a sub-process in the simulator, with each conversion data information corresponding to one sub-process.

[0025] A communication channel is established between the main process and the child process to simulate the communication link.

[0026] Preferably, the IPC channel between the main process and the child process of the simulator uses three standard streams for transmission: standard input, standard output, and standard error output.

[0027] To achieve the above and other related objectives, the present invention also provides a method for constructing a communication network simulation system, comprising at least the following steps:

[0028] Construct a communication network, the communication network being configured to include at least one communication node with a private protocol;

[0029] The communication network is connected to the bridge, and the bridge is configured to process the node data information of each communication node in the communication network to obtain transformed data information.

[0030] The bridge is also connected to a simulator, which receives the conversion data information and performs simulation based on the conversion data information.

[0031] Preferably, the process by which the bridge processes the node data information of each communication node in the communication network to obtain transformed data information includes:

[0032] Pack and process node data information into frame data fields of a common protocol;

[0033] Frame information is obtained by processing other fields of the frame in the general protocol; the other fields of the frame are fields other than the frame data field in the frame format;

[0034] The frame information and the frame data field are merged to obtain the converted data information.

[0035] As described above, the communication network simulation system and its construction method of the present invention have the following beneficial effects:

[0036] The communication network simulation system of this invention can flexibly simulate various communication environments and allows users to customize each communication node in the communication network. This enables users to simulate various communication entities and potential problems in communication links within a reasonable cost, effectively verifying the reliability of the system design. The communication network simulation system of this invention has the following characteristics:

[0037] (1) Using such a simulation environment before conducting actual on-machine (hardware) testing is beneficial for identifying potential problems in the software in advance;

[0038] (2) Some faults are difficult to reproduce on actual hardware. Through the simulation environment, it is possible to check whether the software can specifically check and handle these faults.

[0039] (3) It facilitates message tampering and injection, and makes it easy to verify whether the software can meet some information security functional security requirements. Attached Figure Description

[0040] Figure 1 The diagram shown is a structural schematic of a communication network simulation system according to an embodiment of the present invention.

[0041] Figure 2 The diagram shows the frame format structure of the converted data information transmitted when using the SLIP protocol in an embodiment of the present invention.

[0042] Figure 3 The diagram shown is a schematic representation of the network structure of the communication network in an embodiment of the present invention.

[0043] Figure 4 The diagram shows the connection relationship between communication nodes in an embodiment of the present invention.

[0044] Figure 5 The diagram shows a communication network structure with a daisy-chain topology in an embodiment of the present invention.

[0045] Figure 6 The diagram shows a communication node-connection model of a daisy chain topology in an embodiment of the present invention.

[0046] Figure 7 The diagram shown is a schematic diagram of a communication network structure with a first star topology in an embodiment of the present invention.

[0047] Figure 8 The diagram shown is a schematic diagram of the communication node-connection model of the first star topology in an embodiment of the present invention.

[0048] Figure 9 The diagram shown is a schematic diagram of a communication network structure with a second star topology in an embodiment of the present invention.

[0049] Figure 10 The diagram shows the executable program corresponding to each communication node in the network structure of the communication network in this embodiment of the invention.

[0050] Figure 11 This diagram illustrates the communication and transmission relationship between the simulator's main process and its child processes in an embodiment of the present invention.

[0051] Figure 12 The diagram shown illustrates the structure of the communication network and its communication node-connection model in the simulator of this invention. Detailed Implementation

[0052] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention.

[0053] Please see Figure 1-12 It should be noted that the illustrations provided in this embodiment are only schematic representations of the basic concept of the present invention. Therefore, the drawings only show the components related to the present invention and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.

[0054] The communication network simulation system of the present invention can perform flexible simulations in various communication environments and allows users to customize various entities (also called "communication nodes") in the communication network. This enables users to simulate potential problems in the communication links between various communication entities at a reasonable cost, effectively verifying the reliability of the system design.

[0055] Example 1:

[0056] The communication network simulation system of the present invention includes a bridge and a simulator;

[0057] One end of the bridge is used to connect each communication node, and the other end is connected to the simulator. Among the communication nodes, at least one communication node uses a proprietary protocol for communication.

[0058] The bridge processes the node data information of each communication node to obtain converted data information, which is transmitted using a common protocol that can be recognized by the emulator.

[0059] The simulator receives the conversion data information and performs simulation based on the conversion data information.

[0060] This invention uses a hardware bridge to process the node data information of each communication node with a proprietary protocol to obtain transformed data information, so that the simulator can identify the node data information including each communication node, thereby enabling the simulator to perform simulation processing on various communication nodes with proprietary protocols.

[0061] In this embodiment of the invention, each communication node includes a hardware communication device and / or a software communication program. Therefore, the communication network simulation system of the present invention can perform hybrid hardware and software simulation.

[0062] like Figure 1 In the schematic diagram of the communication network simulation system shown, the communication nodes are hardware communication devices such as PLCs and MCUs, and their proprietary protocols are UART and I2C. 2 C, SPI, etc., under the processing of the bridge, convert the node data information of the communication node into converted data information, and realize the transmission of the converted data information between the bridge and the emulator based on the IPC mechanism.

[0063] The communication network simulation of this invention includes at least one general protocol. When there is only one general protocol, the basic implementation of the communication network can be guaranteed. When there are two or more communication protocols, the diversity and flexibility of node data information processing can be improved.

[0064] In this embodiment of the invention, the general protocol is one, which adopts the SLIP protocol, and the conversion data information transmitted by the SLIP protocol is an NCS frame.

[0065] like Figure 2 As shown, the SLIP stream transmitted by the Serial Line Internet Protocol (SLIP protocol) includes multiple SLIP packets, and the payload of each SLIP packet is an NCS frame. The payload in the SLIP packet is the conversion data information of this invention.

[0066] In this embodiment of the invention, a simple SLIP protocol is used for communication, simplifying the construction and data processing of the communication network simulation system. The full name of the NCS protocol in this invention is Node Command Set, which is used to encapsulate information that needs to be exchanged between the main process and child processes; this is called an NCS frame.

[0067] To gain a clearer understanding of the SLIP protocol and its transport, the following explanation is provided:

[0068] The SLIP protocol, defined by RFC 1055, was originally intended for encapsulating and transmitting IP protocols over serial ports, enabling the TCP / IP protocol stack to run on the serial port. The SLIP protocol only provides a mechanism for framing IP packets using a set of characters on the serial port; it does not possess any other functionalities, including error detection and correction.

[0069] The SLIP protocol defines two special characters: END and ESC. The octal value of the END character is 0300 (decimal value 192), and the octal value of the ESC character is 0333 (decimal value 219). When sending a SLIP packet, the sender only needs to send bytes one by one, starting from the first byte. If a byte in the SLIP packet is the same as the END character, it is replaced by the ESC character and the octal value 0334 (decimal value 220). If a byte in the SLIP packet is the same as the ESC character, it is replaced by the ESC character and the octal value 0335 (decimal value 221). After sending the last byte of the SLIP packet, the sender sends an END character to end the transmission.

[0070] The format of the NCS frame in this invention is shown in Table 1:

[0071] Table 1

[0072]

[0073] The NCS_SOF field, also known as the NCS frame start identifier, indicates the start position of the NCS frame within the SLIP packet. The two bytes of the NCS_SOF field are always 0xFF. Upon receiving a SLIP packet, the receiver needs to locate two consecutive 0xFF bytes within the packet and use these two bytes as the NCS_SOF field. All other fields are then read from the SLIP packet based on their relative positions to the NCS_SOF field.

[0074] The NCS_FRAMETYPE field represents the NCS frame type, which is the type of data information being converted in this invention. The NCS_FRAMEDATA field represents the NCS frame data, which is the data information being converted in this invention. Different information types correspond to different data. The type and data of the converted data information are two attributes of the information that needs to be exchanged between the main process and child processes in the simulator.

[0075] NCS_FRAMEFLAG is called the NCS frame flag bit, which contains 8 bits, corresponding to 8 Boolean values, as shown in Table 2 (bit 0 represents the least significant bit, and bit 7 represents the most significant bit).

[0076] Table 2

[0077]

[0078] The NCS_CKSM field is called the NCS frame check. The strength of the CRC check algorithm used is controlled by bit 0 of NCS_FRAMEFLAG (see Table 2). The value of the NCS_CKSM field is the CRC check value stored in little-endian order. The CRC check covers all bytes after the NCS_SOF field and before the NCS_CKSM field.

[0079] When using the CRC-16 checksum algorithm, the generator polynomial of CRC is G(x) = x. 16 +x 15 +x 2 +1, the initial value of the CRC register is 0xFFFF, and the length of the NCS_CKSM field is 2 bytes. When using the CRC-32 check algorithm, the generator polynomial of CRC is G(x) = x 32 +x 26 +x 23 +x 22 +x 16 +x 12 +x 11 +x 10 +x 8 +x 7 +x 5 +x 4 +x 2 +x+1, the initial value of the CRC register is 0x52325032.

[0080] In this invention, the process of processing the node data information of each communication node to obtain transformed data information includes:

[0081] Pack and process node data information into frame data fields of a common protocol;

[0082] Frame information is obtained by processing other fields of the frame in the general protocol; the other fields of the frame are fields other than the frame data field in the frame format;

[0083] The frame information and the frame data field are merged to obtain the converted data information.

[0084] In this embodiment of the invention, the general protocol adopts the SLIP protocol. The conversion data information transmitted by the SLIP protocol is an NCS frame, wherein the NCS_FRAMEDATA field is a frame data field, and other fields of the frame include the BCF_SOF field, the NCS_HDR field, and the NCS_CKSM field.

[0085] This invention packages the node data information of each communication node to obtain the frame data field of a general protocol, thus ensuring the integrity and correctness of the node data information. This invention also processes other fields of the frame in the communication protocol to obtain frame information, specifically by processing them according to their attributes, thereby perfecting the frame information and enabling the converted data information after merging and processing to be effectively transmitted and processed.

[0086] The communication network simulation system of the present invention also includes a communication network, which includes at least two communication nodes and at least one connection, wherein at least one communication node uses a proprietary communication protocol; each connection connects two communication nodes.

[0087] The communication network simulation system of the present invention is applicable to embedded systems. Specifically, in the embodiments of the present invention, the communication network simulated by the simulator of the communication network system includes various different topologies, such as daisy chain, star topology, mesh topology, etc.

[0088] A communication network includes communication nodes and interconnected network structures, as shown in the diagram below. Figure 3 As shown, the communication node ( Figure 3 The "○" symbol in the diagram represents an entity with communication capabilities within a network. For example, in an embedded system, an MCU can act as a communication node, as can an SPI-based electrically erasable programmable read-only memory (EEPROM). A connection is a channel for data transmission between two adjacent communication nodes in a network. Each connection ( Figure 3 The "→" symbol in the diagram represents a unidirectional data transmission channel. For example, in an embedded system, the MCU node and the EEPROM node communicate using full-duplex SPI. Data transmission between these two nodes via SPI can be represented by two connections in opposite directions. Each communication node in the network is represented by a globally unique identifier. Generally, the identifier is a string (such as "MCU-node", "EEPROM-node"), or it can be a numerical number (such as 1, 2, 3, ...).

[0089] The interface between a communication node and a connection is called a port. Each communication node can have one or more ports, and each port is further divided into a transmit port (TX) and a receive port (RX), such as... Figure 4 As shown, any connection in the network has a sender port pointing to a receiver port, indicating that data sent through that sender port will be transmitted to the corresponding receiver port. Any sender port in the network can have multiple connections pointing to multiple different receiver ports, indicating that data sent through that sender port will be broadcast to all of these receiver ports.

[0090] Each port in a communication node is represented by a number within the communication node. For example, communication node 1 can have ports 0 and 1, while communication node 2 can have ports 0, 1, 2, 3, etc. Port 0 of communication node 1 and port 0 of communication node 2 are two different ports.

[0091] The simulator in this invention simulates the converted data information, including:

[0092] The converted data information is processed to construct a communication network for each communication node;

[0093] Simulation tests were conducted on the transmission of the communication network.

[0094] Specifically, in this embodiment of the invention, the process of processing the converted data information to construct the communication network of each communication node is as follows: The directed transmission relationship between each communication node is determined based on the identifier (number) and signal transmission direction of each communication node in the converted data information. Network connections between the communication nodes are established based on these directed transmission relationships, thereby constructing the communication network between all communication nodes. Then, the transmission of the communication network is simulated and tested based on the converted data information, i.e., the connection between each communication node is simulated and tested.

[0095] To more clearly illustrate the various topologies, communication nodes, and connections included in the communication network of this invention, the following exemplary structural relationships are provided:

[0096] Daisy chain topology:

[0097] like Figure 5 The diagram shows a daisy-chain topology with four communication nodes, numbered 1-4. Adjacent nodes can communicate bidirectionally, essentially forming two unidirectional connections. Each intermediate node (nodes 2 and 3) is assigned two ports, and the boundary nodes (nodes 1 and 4) each have one port. These ports are then connected using connections, as shown below. Figure 6 As shown in Table 3, all connections in this daisy-chain topology are represented in a formal way, making it very easy to store in computer-readable formats (such as JSON, XML, etc.).

[0098] Table 3

[0099] # Source node Source port destination node Destination port 1 Communication Node 1 PT1 Communication Node 2 PT1 2 Communication Node 2 PT1 Communication Node 1 PT1 3 Communication Node 2 PT2 Communication Node 3 PT1 4 Communication Node 3 PT1 Communication Node 2 PT2 5 Communication Node 3 PT2 Communication Node 4 PT1 6 Communication Node 4 PT1 Communication Node 3 PT2

[0100] Star topology:

[0101] like Figure 7The diagram shows the first type of star topology. There are four communication nodes: communication node 1 is the central node, and the rest are boundary nodes. The central node can communicate bidirectionally with any boundary node. If the central communication node 1 is assigned three ports, and each of the other boundary nodes is assigned only one port for communication with the central node, then the communication node-connection model is as follows: Figure 8 As shown.

[0102] like Figure 9 The diagram shows the second type of star topology. There are four communication nodes, with communication node 1 being the central node and the rest being boundary nodes. Any two communication nodes can communicate bidirectionally, and the connection between any two communication nodes in bidirectional communication consists of connections in two directions.

[0103] Data transmitted between communication nodes via connections is called a message. Each message consists of several bytes, and its format is defined by the communication node according to its communication protocol. The encapsulation and parsing of messages are also performed by the communication node. Here, the message is node data information between the various communication nodes, and in the communication network simulator, it is processed and transformed data information.

[0104] Each communication node's node data has its own unique operational logic. Manufacturers or developers encapsulate this logic into an executable program. Each communication node corresponds to one executable program, and one executable program can be used by multiple communication nodes. Figure 10 As shown, Figure 10 In this context, node-mcu.exe, node-cridge.exe, msg-probe.exe, and node-target.exe all represent the corresponding executable program filenames in the communication nodes.

[0105] For the simulator, the internal business logic of the executable program corresponding to each communication node is not important and is not the concern of the communication network simulation system of this invention. The communication network simulation system of this invention needs to convert these executable programs, that is, the node data information of each communication node of this invention, into transformed data information and exchange information through a specific channel. This means that the code related to the specific channel needs to be implemented outside the business logic code in the executable program corresponding to each communication node in order to effectively exchange the executable programs and thus complete the construction and simulation of the communication network simulation system.

[0106] In this embodiment of the invention, the bridge transmits the converted data information to the emulator via the IPC channel. The node data information of each communication node is processed to obtain the converted data information as IPC code. Since the IPC-related code is only used for simulation testing and will not ultimately be used on the target platform (such as a microcontroller), it is necessary to extract the target platform-related code into a Platform Abstraction Layer (PAL) of the software architecture, and place the business logic part into the application layer. During simulation, the PAL layer is replaced with code adapted to the emulator, and after the simulation is completed, the PAL layer is replaced with the code of the actual target platform. This allows the code after simulation testing to be directly tested on the actual hardware.

[0107] There are many common IPC channels, such as TCP, UNIX Socket, and queues on the local loopback. However, using these channels requires relatively complex interfaces (such as Socket) or platform-specific interfaces (such as Windows API, POSIX, API, etc.), which complicates the design of the abstraction layer (PAL layer) program. The increased complexity does not bring any clear benefits.

[0108] This invention uses a standard stream method for transmission in the IPC channel, which is relatively simple. The simulator of this invention employs a multi-process architecture. Based on this multi-process architecture, the simulation process of the simulator according to the converted data information includes:

[0109] The simulator's main process creates child processes based on all the conversion data information;

[0110] All data conversion is initiated in the main process;

[0111] After startup, each conversion data information is hosted as a sub-process in the simulator, with each conversion data information uniquely corresponding to one sub-process.

[0112] A communication channel is established between the main process and the child process to simulate the communication link.

[0113] In the IPC channel between the main process and child processes of the simulator of this invention, three standard streams are used for transmission: standard input, standard output, and standard error output.

[0114] This invention employs inter-process communication based on standard streams, eliminating the need to create a server on the simulator side or for child processes to connect after startup. Simulation data can be transmitted between processes immediately after negotiation, significantly reducing the workload and number of interfaces required for a child process (i.e., a communication node), thereby reducing development costs.

[0115] Specifically, when the main process creates a child process, the main process directly establishes a pipe with the child process's standard input (stdin), standard output (stdout), and standard error output (stderr), and directly uses these pipes for IPC, such as... Figure 11 As shown, the standard input (stdin) and standard output (stdout) streams are byte streams. The IPC protocol requires these two standard streams to be used for transmitting SLIP streams. The NCS frame carries message data that needs to be exchanged between the main process and the child process, such as debugging information and negotiation information. The SLIP protocol is used to encapsulate and transmit the upper-layer NCS frame within the standard stream. In the implementation of the bridge in this invention, because the SLIP protocol is very simple, it can also be used to send and receive NCS frames via serial port.

[0116] Generally speaking, most commonly used programming languages ​​or frameworks have complete standard stream operation interfaces in their standard libraries. For example, in the C language (ISO 9899), the standard library provides three identifiers, stdin, stdout, and stderr, which correspond to three standard streams respectively. It also provides functions such as fread() and fwrite() to perform I / O operations on these streams.

[0117] Of the three standard streams, standard input (stdin) and standard output (stdout) are used to exchange message data, debugging information, negotiation information, etc. between the main process and child processes, and follow the IPC protocol described below. The standard error output stream (stderr) is only used to output textual debugging or error information. After capturing this information, the main process will directly print this information (text) to the terminal for the developer, without performing any further processing on this information.

[0118] Specifically, the simulator's processing only pertains to the NCS frames and is unrelated to the specific business logic associated with the proprietary protocols within the NCS frames. Therefore, during simulation, the executable programs of each communication node—i.e., the converted data information of this invention—are started, and these started executable programs are hosted as child processes in the simulator. Each communication node uniquely corresponds to one such child process, such as... Figure 12As shown, the simulator's main process establishes inter-process communication (IPC) channels with the child processes corresponding to each communication node. These IPC channels are used to exchange message data, debugging information, negotiation information, etc. For example, when a communication node needs to send a message, the child process of the source communication node sends the message data, target communication node, port, and other information to the main process via the IPC channel. After receiving this information, the main process locates the target child process's IPC channel based on the target communication node and port, and then sends this information out through the target child process's IPC channel.

[0119] The emulator supports three types of messages to be passed between its main process and child processes: Hello, Message, and Debug (each with a different NCS_FRAMETYPE value). Hello messages are used to confirm readiness between the child process and the main process when the child process starts. Message messages are used for both processes to send messages to each other. Debug messages are used by the child process to print debug text to the main process's terminal (interface).

[0120] The NCS_FRAMEDATA field of the Message information is used to carry the source / destination port number and a number of bytes of message data. Specifically, the communication node can transmit SPI frames, I... 2 C-frames and other elements are encapsulated within Message information to simulate message sending on actual hardware.

[0121] To illustrate in more detail the information exchanged between the emulator's main process and child processes, the following implementation example is provided:

[0122] The value of the NCS_FRAMETYPE field corresponding to the Hello message is 0x00, and the length of the NCS_FRAMEDATA field is 0 bytes. After the child communication node is ready, it must send the Hello message to the simulator process. Only after the simulator process receives the message can it start subsequent data interaction.

[0123] The value of the NCS_FRAMETYPE field corresponding to the Message information is 0x05. The NCS_FRAMEDATA field is used to carry the message source / destination port number (represented by MessagePort) and L. MessageData The format of the message data (represented by MessageData) with a length of 1 byte is shown in Table 4:

[0124] Table 4

[0125] Offset content illustrate 0 MessagePort The source / destination port number of the message. 1 <![CDATA[L MessageData ]]> The length of the message data. <![CDATA[2…1+L MessageData ]]> MessageData The data in the message.

[0126] Suppose that communication node 1 wants to send a message {0x12,0x34,0x56,0x78} to communication node 2's port 5 via port 3. Then, communication node 1 will construct the following NCS_FRAMEDATA and ultimately send it to the main process via the NCS and SLIP protocols: {0x03 / *MessagePort* / ,0x04 / *L MessageData * / ,0x12,0x34,0x56,0x78 / *MessageData* / }

[0127] In the main process, after receiving this NCS_FRAMEDATA, based on the network configuration, it is found that this message from port 3 of communication node 1 needs to be forwarded to port 5 of communication node 2. Therefore, the main process will modify MessagePort to 0x05 (port 5), and then communication node 2 will receive the following NCS_FRAMEDATA: {0x05 / *MessagePort* / , 0x04 / *L MessageData * / ,0x12,0x34,0x56,0x78 / *MessageData* / }

[0128] It is important to note that the communication node actually simulates a piece of hardware, so the content transmitted by the Message here should be the interaction between hardware (such as communication, DI / DO, etc.).

[0129] The value of the NCS_FRAMETYPE field corresponding to the debug information is 0xFC, and the NCS_FRAMEDATA field is used to carry the debug level (represented by DebugLevel) and L. DebugMessage The NCS_FRAMEDATA format of the ASCII-encoded debug text (denoted as DebugMessage) is as shown in Table 5.

[0130] Table 5

[0131] Offset content illustrate 0 DebugLevel Debugging level. 1 <![CDATA[L DebugMessage ]]> Adjust the length of the text. <![CDATA[2…1+L DebugMessage ]]> DebugMessage Debug text.

[0132] This implementation supports three debug levels: Informational (INFO), Warning (WARN), and Error (ERROR). The severity of the three debug levels increases sequentially, and the way the simulator displays debug text to developers also varies.

[0133] In an embodiment of the present invention, the above-described communication network simulator is used in the development process of a battery management system:

[0134] A battery management system based on the MC33771C battery management chip uses daisy chain for communication. The physical layer of communication adopts NXP's proprietary TPL protocol. The microcontroller uses the MC33664 chip to convert the SPI protocol to the TPL protocol.

[0135] To simulate various potential anomalies in such a system, several node programs can be written with reference to the datasheets of the MC33664 and MC33771C chips to fully simulate their operation (since these chips have relatively simple functions, they are relatively easy to implement). When simulating a specific fault, the corresponding fault simulation can be performed within the code simulating the chip's operation. The program running on the MCU can also be run in this simulation environment after being packaged.

[0136] Example 2:

[0137] The method for constructing a communication network simulation system provided in this embodiment of the invention includes:

[0138] Construct a communication network, the communication network being configured to include at least one communication node with a private protocol;

[0139] The communication network is connected to the bridge, and the bridge is configured to process the node data information of each communication node in the communication network to obtain transformed data information.

[0140] The bridge is also connected to a simulator, which receives the conversion data information and performs simulation based on the conversion data information.

[0141] The communication network simulation system constructed in this embodiment of the invention includes communication nodes with proprietary protocols, which can flexibly simulate various communication environments and allow users to customize each communication node in the communication network.

[0142] In this invention, the process of processing the node data information of each communication node to obtain transformed data information includes:

[0143] Pack and process node data information into frame data fields of a common protocol;

[0144] Frame information is obtained by processing other fields of the frame in the general protocol; the other fields of the frame are fields other than the frame data field in the frame format;

[0145] The frame information and the frame data field are merged to obtain the converted data information.

[0146] This invention obtains the frame data field of a general protocol by packaging the node data information of each communication node, thus ensuring the integrity and correctness of the node data information. Specifically, this invention processes other fields of the frame in the communication protocol to obtain frame information by performing corresponding processing based on the attributes of the fields, thereby perfecting the frame information and enabling the converted data information after merging and processing to be effectively transmitted and processed.

[0147] The processes and related protocols and data information processing involved in the construction method of the communication network simulation system provided in this embodiment of the invention have been described in detail in Embodiment 1, and will not be repeated here.

[0148] In summary, the communication network simulation system of this invention can flexibly simulate various communication environments and allows users to define individual entities, i.e., communication nodes, in the communication network. This enables users to simulate potential problems with various communication entities and communication links at a reasonable cost, effectively verifying the reliability of the system design. Therefore, this invention effectively overcomes the various shortcomings of existing technologies and has high industrial application value.

[0149] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.

Claims

1. A communication network simulation system, characterized by, The communication network simulation system comprises a bridge and an emulator; the communication network simulation system further comprises a communication network, which comprises at least two communication nodes and at least one link; each link connects two communication nodes; The bridge is connected to each communication node at one end and connected to the emulator at the other end, wherein the communication protocol of at least one of the communication nodes uses a private protocol; The bridge processes the node data information of each communication node to obtain converted data information, wherein the converted data information is transmitted in a general protocol that can be recognized by the emulator; The emulator receives the converted data information and performs simulation according to the converted data information, including: According to the identifiers and signal transmission directions of each communication node in the converted data information, the directed transmission relationship between each communication node is determined, and the network connection between each communication node is established according to the directed transmission relationship, so as to construct the communication network between all communication nodes; and the transmission of the communication network is simulated and tested based on the converted data information; The process of the bridge processing the node data information of each communication node to obtain the converted data information comprises: Packing the node data information into a frame data field of a general protocol; Processing other fields of the frame in the general protocol to obtain frame information; the other fields of the frame are other fields in the frame format except the frame data field; Merging the frame information and the frame data field to obtain the converted data information.

2. The communication network emulation system of claim 1, wherein, The bridge transmits the converted data information to the emulator through an IPC channel.

3. The communication network emulation system of claim 2, wherein, In the IPC channel, the transmission is performed in a standard stream mode.

4. The communication network emulation system of claim 3, wherein, The process of the emulator performing simulation according to the converted data information comprises: The main process of the emulator creates a sub-process according to all the converted data information; All the converted data information is started in the main process; After starting, each converted data information is hosted in the emulator as a sub-process, and each converted data information corresponds to a sub-process; A communication channel is established between the main process and the sub-process to realize the simulation of the communication link.

5. The communication network emulation system of claim 4, wherein, In the IPC channel between the main process and the sub-process of the emulator, three standard streams are used for transmission, and the three standard streams are standard input, standard output and standard error output.

6. A method of constructing a communication network simulation system, characterized by, At least the following steps are included: Constructing a communication network, wherein the communication network is configured to comprise at least one communication node with a private protocol; the communication network comprises at least two communication nodes and at least one link; each link connects two communication nodes; The communication network is communicatively connected to a bridge, wherein the bridge is configured to process the node data information of each communication node in the communication network to obtain converted data information; The bridge is further communicatively connected to an emulator, wherein the emulator receives the converted data information and performs simulation according to the converted data information, including: According to the identifiers of the communication nodes and the signal transmission directions in the conversion data information, a directed transmission relationship between the communication nodes is determined, and a network connection between the communication nodes is established according to the directed transmission relationship, so as to construct a communication network between all the communication nodes; and a transmission of the communication network is simulated and tested based on the conversion data information. The process of the bridge processing the node data information of the communication nodes to obtain the conversion data information includes: packaging the node data information into a frame data field of a general protocol; processing other fields of a frame in the general protocol to obtain frame information; the other fields of the frame are other fields in the frame format except the frame data field; merging the frame information and the frame data field to obtain the conversion data information.

Citation Information

Patent Citations

  • Communication emulation method, engine and system for multi-processor system

    CN102760114A

  • Semi-physical simulation communication method for power stability control device

    CN108255070A