Signal Packaging Method
By automatically searching and adjusting signal locations, the problem of low signal packetization efficiency in vehicle network design is solved, achieving efficient signal packaging and automated packetization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING JINGWEI HIRAIN TECH CO INC
- Filing Date
- 2023-05-30
- Publication Date
- 2026-04-21
AI Technical Summary
In vehicle network design, manual operation is inefficient during signal data packetization, making it difficult to efficiently package signals.
A signal packaging method is provided, which automatically searches for consecutive empty slots in the target or adjusts the position of existing signals to package signals into messages, ensuring no overlap and making full use of message capacity, while reducing manual intervention.
It improves signal packaging efficiency, avoids signal overlap, and realizes an automated signal packaging process.
Smart Images

Figure CN116846922B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of signal processing technology, and in particular relates to a signal packaging method. Background Technology
[0002] When designing vehicle networks, it is often necessary to design the communication network segments and their message signals. However, the signal data under a network segment is usually very large, and each signal data has corresponding sending and receiving node information and other related data.
[0003] In signal packetization, the signal data needs to be distributed to the message. The starting position of the signal in the message needs to be calculated according to the signal length and the specified layout format. The packetization process is done manually, which results in low efficiency. Summary of the Invention
[0004] This application provides a signal packaging method that can automatically package signals, reduce manual intervention, and improve packaging efficiency.
[0005] In a first aspect, embodiments of this application provide a signal packaging method, including:
[0006] Acquire messages and current signals, wherein the messages consist of multiple bytes arranged in a sequential order;
[0007] If the remaining empty space in the message is greater than or equal to the signal length of the current signal, then the message is searched according to the distribution order;
[0008] If the target consecutive empty space is found, the current signal is placed in the target consecutive empty space, and the length of the target consecutive empty space is greater than or equal to the signal length of the current signal;
[0009] If no consecutive empty slots are found for the target, the positions of the signals already placed in the message are adjusted to obtain the consecutive empty slots for the target, and the current signal is placed in the consecutive empty slots for the target.
[0010] Secondly, embodiments of this application provide a signal packaging device, comprising:
[0011] The first acquisition module is used to acquire messages and current signals, wherein the messages include multiple bytes distributed in sequence;
[0012] The search module is used to search the message in the order of its distribution if the remaining empty space of the message is greater than or equal to the signal length of the current signal.
[0013] The first placement module is used to place the current signal in the target consecutive empty space if the target consecutive empty space is found, wherein the length of the target consecutive empty space is greater than or equal to the signal length of the current signal;
[0014] An adjustment module is used to adjust the position of the signals already placed in the message to obtain the target continuous empty space if the target continuous empty space is not found.
[0015] The second placement module is used to place the current signal in the target continuous empty space.
[0016] Thirdly, embodiments of this application provide an electronic device, the device including: a processor and a memory storing computer program instructions;
[0017] When the processor executes the computer program instructions, it implements the method as described in the first aspect.
[0018] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer program instructions that, when executed by a processor, implement the method described in the first aspect.
[0019] Fifthly, embodiments of this application provide a computer program product in which instructions, when executed by a processor of an electronic device, cause the electronic device to perform the method described in the first aspect.
[0020] The signal packing method of this application embodiment includes: acquiring a message and a current signal, wherein the message includes multiple bytes distributed sequentially; if the remaining empty space in the message is greater than or equal to the signal length of the current signal, then searching the message according to the distribution order; if the target consecutive empty space is found, then placing the current signal in the target consecutive empty space, wherein the length of the target consecutive empty space is greater than or equal to the signal length of the current signal; if the target consecutive empty space is not found, then adjusting the position of the signals already placed in the message to obtain the target consecutive empty space, and placing the current signal in the target consecutive empty space. Through the above process, the current signal can be packed into the message, making full use of the message capacity while ensuring that the signals in the message do not overlap. The entire process requires no manual intervention and can improve the efficiency of signal packing. Attached Figure Description
[0021] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a schematic flowchart of a signal packing method provided in one embodiment of this application;
[0023] Figure 2a This is a message signal layout diagram in Motorola Sequential format provided in one embodiment of this application;
[0024] Figure 2b This is a message signal layout diagram in Motorola Forward MSB format provided in one embodiment of this application;
[0025] Figure 3 This is a schematic diagram of the structure of a signal packaging device provided in one embodiment of this application;
[0026] Figure 4 This is a schematic diagram of the structure of an electronic device provided in another embodiment of this application. Detailed Implementation
[0027] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.
[0028] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.
[0029] To address the problems of the prior art, embodiments of this application provide a signal packaging method, apparatus, electronic device, medium, and product. The signal packaging method provided in this application embodiment will be described first below.
[0030] Figure 1A schematic flowchart of a signal packing method according to an embodiment of this application is shown. Figure 1 As shown, the signal packing method provided in this application embodiment includes the following steps 101-104, wherein:
[0031] Step 101: Obtain the message and the current signal, wherein the message includes multiple bytes distributed in sequence.
[0032] The current signal is the signal to be included in the message. In network design, the signal arrangement format under CAN messages can be divided into four types: Motorola Forward MSB, Motorola Forward LSB, Motorola Sequential, and Motorola Backward. Each format corresponds to a different signal arrangement within the message. For example... Figure 2a The diagram shows the signal layout of a Motorola Sequential message. Bit indices are arranged from left to right, and byte indices from top to bottom. The starting bit is the most significant bit (MSB). Figure 2b The diagram shows the message signal layout in Motorola Forward MSB format. Figure 2a and Figure 2b The message consists of 8 bytes, which are arranged sequentially from top to bottom.
[0033] In the process of packetizing signals, signals are added to the message one by one, and the layout of the signals in the message is based on minimizing the number of bytes occupied by each signal. However, when the total length of all signals in the message plus the length of the signal to be added does not exceed the number of bytes in the message, such as 8 bytes, but arranging the signals based solely on minimizing the number of bytes occupied would cause signal overlap or exceed 8 bytes, it is necessary to dynamically adjust the already arranged signals, change the original signal arrangement, and ensure that the signals added later can be added to the message without overlap.
[0034] It is important to note that when both the conditions of "minimizing the number of bytes occupied" and "signals must not overlap" need to be met, the "signals must not overlap" takes precedence over the "minimize the number of bytes occupied" condition.
[0035] This application provides signal packaging in two scenarios: one in which dynamic signal adjustment of the message is not required, and the other in which dynamic signal adjustment of the message is required.
[0036] Step 102: If the remaining empty space of the message is greater than or equal to the signal length of the current signal, then the message is searched according to the distribution order;
[0037] For example, starting from the first byte, the search checks for the existence of a target consecutive empty space, the length of which is greater than or equal to the signal length of the current signal. The target consecutive empty spaces can belong to the same byte or to multiple adjacent bytes.
[0038] Step 103: If the target consecutive empty space is found, then place the current signal in the target consecutive empty space.
[0039] This step is for cases where dynamic signal adjustment of the message is not required. Before placing the current signal into the message, it is checked whether the message can accommodate the current signal. This is done by comparing the remaining empty spaces in the message with the signal length of the current signal. If the remaining empty spaces are greater than or equal to the signal length of the current signal, and there is a target consecutive empty space within the remaining empty spaces whose length is greater than or equal to the signal length of the current signal, then the current signal is placed in the target consecutive empty space. Specifically, the current signal can be placed starting from the least significant bit of the target consecutive empty space; this is not limited here. The length of the target consecutive empty space refers to the number of bits occupied by the consecutive empty spaces.
[0040] Consecutive empty spaces can belong to the same byte or to multiple adjacent bytes.
[0041] Step 104: If no consecutive empty slots are found for the target, adjust the positions of the signals already placed in the message to obtain the consecutive empty slots for the target, and place the current signal in the consecutive empty slots for the target.
[0042] This step corresponds to situations where dynamic signal adjustment of the message is required. If there is no target consecutive empty space with a length greater than or equal to the signal length among the remaining empty spaces, the positions of the signals already placed in the message need to be adjusted to combine multiple discontinuous empty spaces into a single target consecutive empty space that can store the current signal.
[0043] The method in this embodiment acquires a message and a current signal. The message includes multiple bytes arranged in a sequential order. If the remaining empty space in the message is greater than or equal to the signal length of the current signal, the message is searched according to its distribution order. If a target consecutive empty space is found, the current signal is placed in the target consecutive empty space, where the length of the target consecutive empty space is greater than or equal to the signal length of the current signal. If the target consecutive empty space is not found, the positions of the signals already placed in the message are adjusted to obtain the target consecutive empty space, and the current signal is placed in the target consecutive empty space. Through the above process, the current signal can be packaged into the message, making full use of the message capacity while preventing signal overlap within the message. The entire process requires no manual intervention, thus improving the efficiency of signal packaging.
[0044] In one embodiment of this application, if the target consecutive empty spaces are found, the current signal is placed in the target consecutive empty spaces, including:
[0045] If the first byte found includes the target consecutive empty space, then the current signal is placed in the target consecutive empty space.
[0046] Specifically, the first byte can be the first byte found that includes the target contiguous empty space, and the length of the target contiguous empty space is the length of one or more bytes. No limitation is made here.
[0047] When adding signals normally in Motorola Sequential format, for the first signal in a message, the signal start bit calculation begins from the first position of the message, and signals are added sequentially according to their length. In this case, the start bit of the first signal is always 0. When adding subsequent signals to a message, the first unoccupied empty space in the message is first found. It is then determined whether the number of bits occupied by that empty space is sufficient to place the signal. If so, the signal is filled from that empty space forward, starting with the signal length.
[0048] However, if the number of bits occupied by the empty space is insufficient to fill a signal of that length, it will be determined how many bytes are needed to fill the signal. If the signal length is exactly a multiple of 8, it means that the signal can completely occupy a certain number of bytes, and a new byte will be used to fill the signal. That is, the signal length is N times 8, where N is a positive integer; correspondingly, in step 103, if the target consecutive empty spaces are found, the current signal is placed in the target consecutive empty spaces, including:
[0049] If the second byte contains the target consecutive empty space, the current signal is placed in the target consecutive empty space, and none of the bytes included in the second byte are filled with signals.
[0050] In this embodiment, the signal length of the current signal is an integer multiple of 8, which can completely occupy N bytes. In this case, a new, unpadded byte is used to place the current signal. The second byte can include one byte, or two or more bytes, where the first byte is the first unpadded byte among the multiple bytes. This method minimizes the number of bytes used to place the current signal, reducing the number of bytes spanned by the current signal.
[0051] In another embodiment of this application, if the signal length is greater than 8 and not an integer multiple of 8, the number of bytes occupied by filling the signal with new bytes and filling the signal starting from the empty space of the last filled byte in the message are compared, and the scheme occupying fewer bytes is preferentially selected for signal filling. Specifically, the signal length is greater than 8 and the signal length is not N times 8, where N is a positive integer;
[0052] Accordingly, in step 103, if the target consecutive empty spaces are found, the current signal is placed in the target consecutive empty spaces, including:
[0053] If the third and fourth bytes are found, the first number of occupied bytes and the second number of occupied bytes are determined. The first number of occupied bytes is the number of bytes occupied when the current signal is placed starting from the empty space of the third byte. The second number of occupied bytes is the number of bytes occupied when the current signal is placed starting from the empty space of the fourth byte. The third byte is the first byte in the plurality of bytes that is not filled by the signal. The fourth byte is the last byte in the filled bytes. The fourth byte is not filled.
[0054] If the number of first occupied bytes is less than the number of second occupied bytes, then the current signal is placed starting from the empty space of the third byte;
[0055] If the number of occupied bytes in the second position is less than the number of occupied bytes in the first position, then the current signal is placed starting from the empty space of the fourth byte.
[0056] By using the above methods, a signal filling method that occupies fewer bytes can be selected to make full use of the capacity of each byte.
[0057] Under normal circumstances, when multiple signals of different lengths are placed sequentially under the same message, it is often not possible to ensure that all signals occupy the optimal position and do not overlap. In this case, it is necessary to dynamically adjust the signals that have already been filled under the message so that the original signals and the signals that will be filled under the message are arranged better.
[0058] In one embodiment of this application, adjusting the position of the signal already placed in the message to obtain the target continuous empty space includes:
[0059] Obtain the length of each consecutive empty space in the remaining empty spaces;
[0060] The first start bit is determined based on the length of the plurality of bytes and the signal length;
[0061] Obtain the number of overlapping bits between the current signal and the signals already placed in the message, when the current signal is placed starting from the first start bit;
[0062] Based on the relationship between the empty space length and the number of overlapping bits, the positions of the signals already placed in the message are adjusted to obtain the target continuous empty space.
[0063] Specifically, when determining the first start bit based on the length of the multiple bytes and the signal length, the difference between the length of the multiple bytes and the signal length can be used as the first start bit. And when storing the current signal starting from the first start bit, the number of overlapping bits u that will cause overlap will be calculated.
[0064] Based on the length and overlap of each consecutive empty space in the remaining empty spaces, the placement of signals in the message is adjusted to make room for consecutive empty spaces with a longer length.
[0065] Based on the relationship between the length of the empty space and the number of overlapping positions, the following two processing methods can be obtained:
[0066] Scenario 1: Based on the relationship between the gap length and the number of overlapping bits, adjust the positions of the signals already placed in the message to obtain the target continuous gaps, including:
[0067] If the length m of the first empty space in the empty space length is greater than or equal to the number of overlapping bits u, then the first signal placed after the first empty space is placed starting from the beginning of the first empty space, and signals placed sequentially after the first signal are placed, so that the empty spaces located at the first empty space and the empty spaces thereafter all converge towards the end of the message to obtain the target continuous empty spaces.
[0068] Specifically, if there exists a space length (i.e. the length of the first space) m that is greater than the number of overlapping bits u, then starting from the starting bit s2 of that space length, all subsequent signals are locally adjusted forward. After such adjustment, all spaces after the starting bit s2 will be gathered at the end of the message, and the length of the last consecutive spaces will necessarily be greater than or equal to the signal length.
[0069] Scenario 2: Based on the relationship between the empty space length and the number of overlapping bits, adjust the positions of the signals already placed in the message to obtain the target continuous empty spaces, including:
[0070] If there is no first empty space whose length is greater than or equal to the number of overlapping bits, then the multiple bytes are searched in the order of distribution, starting from the first empty space, and the first signal after the first empty space is placed starting from the beginning of the first empty space.
[0071] If the length of the first empty space in the message is less than the signal length, then the search for the multiple bytes in the distribution order is repeated. Starting from the first empty space, the first signal after the first empty space is placed from the starting position of the first empty space until the length of the first empty space in the message is greater than or equal to the signal length.
[0072] If the length of the first empty space in the message is greater than or equal to the signal length, then the first empty space is determined to be the target continuous empty space.
[0073] Specifically, if all the space lengths are less than the number of overlapping bits u, it means that the signal cannot be placed by adjusting the message layout locally. In this case, it is necessary to make a global adjustment to the signal arrangement of the entire message.
[0074] This embodiment employs a recursive approach for space adjustment. Starting with the first empty space *s* in the message layout, all subsequent signals are adjusted forward. For each signal adjusted, it is re-evaluated whether there is a space long enough to place the current signal. If so, the signal is placed, and the adjustment ends; otherwise, the adjustment continues until there is enough space in the message to accommodate the newly added signal. Then, the signal is added again to the adjusted message layout. The advantage of this recursive algorithm is that it decomposes the complex problem of global adjustment into multiple sub-problems of local message layout adjustment under the same scenario, simplifying the complex problem. This allows for the optimal signal layout to be obtained after multiple adjustments without having to adjust every single empty space in the message.
[0075] In one embodiment of this application, the message adopts the Motorola Sequential format;
[0076] Placing the current signal in the target consecutive empty spaces includes:
[0077] Determine the starting position for placing the current signal in the target consecutive empty space, and place the current signal starting from the starting position of the target consecutive empty space.
[0078] When calculating the start bit, the calculated start bit of the Motorola Sequential format needs to be converted into one of three types—Motorola Forward MSB, Motorola Forward LSB, or Motorola Backward—according to certain rules, based on actual requirements. The following describes the three conversion methods:
[0079] In one embodiment of this application, the message adopts the Motorola Forward MSB format;
[0080] Placing the current signal in the target consecutive empty spaces includes:
[0081] Obtain the second start bit of the current signal when the message is placed in the target consecutive empty space under Motorola Sequential format;
[0082] If the second start bit is less than 8, the target start bit of the current signal in the target consecutive empty space is determined according to the following expression:
[0083] s msb =8-s seq -1
[0084] If the second start bit is greater than 8, the target start bit of the current signal in the target consecutive empty space is determined according to the following expression:
[0085] s msb =8*(i+1)-s seq -1+8*i
[0086] Where i = s seq / 8,s seq This is the second start bit.
[0087] In one embodiment of this application, the message adopts the Motorola Forward LSB format;
[0088] Placing the current signal in the target consecutive empty spaces includes:
[0089] Obtain the second start bit of the current signal when the message is placed in the target consecutive empty space under Motorola Sequential format;
[0090] If the parameter value n is less than 8, then the target start position of the current signal in the target continuous empty space is determined according to the following expression:
[0091] s lsb =8-n-1
[0092] If the parameter value n is greater than 8, then the target start position of the current signal in the target continuous empty space is determined according to the following expression:
[0093] s lsb = 8*(i+1)-n-1+8*i
[0094] Among them, i=n / 8, n=s seq +l seq -1,s seq For the second start bit, l seq This is the signal length.
[0095] In one embodiment of this application, the message adopts the Motorola Backward format;
[0096] Placing the current signal in the target consecutive empty spaces includes:
[0097] Obtain the second start bit of the current signal when the message is placed in the target consecutive empty space under Motorola Sequential format;
[0098] The target start position of the current signal in the target consecutive empty space is determined according to the following expression:
[0099] s backword =8 * dlc-s seq -l seq
[0100] Among them, s seq For the second start bit, l seq Where dlc is the signal length and dlc is the number of bytes in the message.
[0101] The signal packetization method provided in this application is illustrated below with an example. When packetizing signals, a network segment needs to be constructed, and a packet is constructed within that network segment. This packet is carried through the network segment, and a signal is created within the packet. The created signal needs to be packetized into the packet. The main implementation steps are as follows:
[0102] 1) Import the pre-designed signal list matrix, which includes signal name, signal length, transmitting node and receiving node, etc. parse the Excel matrix and encapsulate the data into a model based on the relationship between the nodes in the matrix and the transmitting and receiving nodes of the signal.
[0103] 2) Create a new network segment named "New_CAN_Network" to be used as the receiving network segment after data processing;
[0104] 3) Check if there is a column for signal start positions in the signal list matrix. If there is a signal start position, arrange the start positions in order.
[0105] 4) Check if there are nodes defined in the data matrix under the vehicle model, and whether there are nodes with the same names under the network segment. If not, create them. As shown in Table 1, ABSESP, BCM, CVT, etc. are node names.
[0106] Table 1
[0107]
[0108] 5) Traverse all the sent signals under the node, check whether the corresponding signal has been created under the network segment and whether the library signal exists. If not, create the corresponding signal.
[0109] 6) Determine if a message with the same sending node, period, and sending type as the signal exists in the network segment. If not, create a new message to receive the signal.
[0110] 7) If a matching message exists, determine whether the sum of the lengths of all signals in the message and the length of the signal exceeds the capacity of the current message (message capacity = message DLC * 8 bits). If not, use the message to receive the signal; otherwise, create a new message to receive the signal.
[0111] 8) When adding a signal to a message, the start bit of the signal is optimally calculated based on all the signals and their lengths in the current message to ensure that all signals in the message do not overlap when arranged in the message, and to ensure that each signal occupies the fewest bytes possible. This step can be done using the signal packing method provided in the embodiments of this application.
[0112] 9) If the signal is added successfully, add the currently edited node as the receiving node for the message;
[0113] 10) Re-edit all received signals from the node, and similarly judge the signals and calculate the start bit;
[0114] 11) Add the currently edited node as the signal receiving node to the set of signal receiving nodes;
[0115] 12) If a signal group exists in the signal list matrix, create the signal group, add signals to the signal group, and add the signal group to the corresponding message;
[0116] 13) After the start bit calculation and data encapsulation, all signals in the signal list are successfully encapsulated into the message and network segment, and the signal is automatically packaged into the message successfully.
[0117] The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0118] In methods for automatically packaging signals into messages, the signal start bit calculation algorithm plays a crucial role in determining how signals are arranged within the message layout. This algorithm ensures that signals do not overlap during message arrangement and minimizes the number of bytes occupied by each signal. In network design, CAN messages have four signal arrangement formats: Motorola Forward MSB, Motorola Forward LSB, Motorola Sequential, and Motorola Backward. Each format corresponds to a different signal arrangement within the message. When calculating the start bit arrangement, we use the Motorola Sequential format and then convert the start bit to the appropriate format based on actual needs. The Motorola Sequential layout is shown below. Figure 2a As shown. The Bit Index is arranged from left to right, and the Byte Index is arranged from top to bottom, with the starting bit being the MSB.
[0119] In signal packetization, signals are added to the packet individually. Initially, the signal layout is based on minimizing the number of bytes occupied by each signal. However, if the total length of all signals in the packet plus the length of the signal to be added does not exceed 8 bytes, but arranging signals solely based on minimizing byte occupation would cause signal overlap or exceed 8 bytes, then the already arranged signals need to be dynamically adjusted. This changes the original signal arrangement to ensure that subsequent signals are added to the packet without overlap. It's important to note that when both "minimum byte occupation" and "no signal overlap" conditions need to be met, "no signal overlap" takes precedence over "minimum byte occupation." The calculation methods for the signal start bit are discussed below for both normal signal addition and dynamic signal adjustment scenarios:
[0120] 1) Signal addition in non-overlapping conditions
[0121] When adding signals normally in Motorola Sequential format, for the first signal in a message, the signal start bit calculation begins from the first position of the Layout matrix, adding signals sequentially according to their length. In this case, the start bit of the first signal is always 0. When adding subsequent signals, the system first finds the first unoccupied empty space in the Layout. It then checks if the remaining bits in the byte containing that empty space are sufficient to fit a signal of that length. If so, the signal is filled starting from that empty space and continuing for the signal length. However, if the remaining bits in the byte containing that empty space are insufficient to fill the signal, the system determines how many bytes are needed to fill the signal. If the signal length is exactly a multiple of 8, it means the signal can occupy the required number of bytes, and a new byte is used to fill the signal. Otherwise, the system compares the number of bytes required to fill the signal using a new byte versus filling from the empty space, prioritizing the method that requires fewer bytes.
[0122] Using the method described above, signals that do not overlap and do not require adjustment can be optimally added to the message when the signals are packaged into the message, and the signal start bit can be calculated reasonably.
[0123] 2) Dynamic adjustment of message signals when overlap exists
[0124] The first scenario mentioned above, where no dynamic adjustment of signal arrangement is required, is ideal. However, under normal circumstances, when multiple signals of varying lengths are sequentially placed within the same message, it's often impossible to ensure that all signals occupy their optimal positions without overlap. Therefore, in this case, we need to dynamically adjust the signals already inserted into the message to ensure a better arrangement for both the original signals and those to be inserted.
[0125] In this situation, we need to consider how to move the fewest signals possible to fill the new signal without overlap. As mentioned earlier, when adding a signal to a message, we first calculate (total length of existing signals in the current message + length of the latest signal to be added <= 8*8 bits). Therefore, after some dynamic adjustment, all signals in the message can be arranged in the message layout without overlap. The signal start bit calculation algorithm used here is as follows: when the remaining empty space in the last byte is insufficient to fill the new signal, we first calculate the set of remaining empty space information in the current message layout, and then sort this set of empty space information in descending order according to the space length attribute. The empty space information includes the start bit and length of the space segment. Then, (8*8 - signal length) is used as the start bit s1 of the signal, and the number of overlapping bits starting from this start bit is calculated as u. At this point, we sequentially check whether there is a space length m greater than or equal to the number of overlapping bits u in the empty space information; there are two possibilities:
[0126] (1) If there is a space length m greater than the number of overlapping bits u, then starting from the starting position s2 of that space length, all subsequent signals are locally adjusted forward. After this adjustment, all spaces after the starting position s2 will converge at the end of the message layout. At this point, we can then determine that the signals will not overlap. However, it should be noted that the starting position s1 that initially caused the overlap cannot be used as the starting position of the signal to be filled, because the preceding signals have already undergone local adjustments. Therefore, we need to re-add the signal based on the original message signal layout. Only then will the calculated starting position be optimal.
[0127] (2) If all space lengths are less than the number of overlaps u, it means that the signal cannot be placed by locally adjusting the message layout. In this case, a global adjustment of the signal layout of the entire message is required. Here, a recursive algorithm is used. First, starting from the first empty space s in the message layout, all subsequent signals are adjusted forward. It is important to note that after each signal is adjusted, it is re-evaluated whether there is a space length long enough to place the current signal. If there is, the signal is placed and the adjustment ends; otherwise, the subsequent signals are adjusted forward until, after adjustment, there is a space length in the layout that can accommodate the newly added signal. Then, the signal is added again on the adjusted message layout, and the starting position is calculated to obtain the overall optimal starting position. The advantage of using a recursive algorithm is that it decomposes the complex problem of global adjustment into multiple sub-problems of locally adjusting the layout under the same scenario, simplifying the complex problem. This allows the optimal layout for storing signals to be obtained after multiple adjustments without having to adjust all empty spaces in the layout one by one.
[0128] The above two solutions address two scenarios where signal overlap occurs during automatic packet assembly, necessitating layout readjustment. These adjustments ensure that all signals are packaged into the packet in an orderly manner without overlap.
[0129] ②Calculation of conversion between Motorola Sequential and other layout formats
[0130] As mentioned above, there are various formats for signal arrangement in messages, but such as Figure 2a As shown, the more standard format is Motorola Sequential. Therefore, when automatically packing signals into packets and calculating the start bit, we need to convert the calculated start bit of the Motorola Sequential format into one of three types—Motorola Forward MSB, Motorola Forward LSB, or Motorola Backward—according to certain rules, based on actual needs. Below is the conversion calculation method between Motorola Sequential and other formats, obtained based on the layout matrix and the characteristics of various layout formats:
[0131] (1) Calculation of the start bit of the MSB for Motorola Sequential to Motorola Forward conversion.
[0132] The signal arrangement format in the Motorola Forward MSB message is as follows: Figure 3As shown, in this arrangement, the Bit Index is arranged from right to left, and the Byte Index is arranged from top to bottom, with the starting bit being the MSB. The method for converting the starting bit in Motorola Sequential format to Motorola Forward MSB is as follows:
[0133] When the start bit of the signal in Motorola Sequential format is 8, the start bit in Motorola ForwardMSB format is:
[0134] s msb =8-s seq -1
[0135] When the start bit of the signal in Motorola Sequential format is 8, the start bit in Motorola ForwardMSB format is:
[0136] i = s seq / 8
[0137] s msb =8*(i+1)-s seq -1+8*i
[0138] (2) Motorola Sequential to Motorola Forward LSB start bit calculation
[0139] The signal arrangement in Motorola Forward LSB format messages is the same as Motorola Forward MSB, but the start bit in LSB format is the LSB. The method for converting the start bit in Motorola Sequential format to Motorola Forward LSB is as follows:
[0140] First, the parameter value n is calculated using the start bit S_seq and signal length L_seq in Motorola Sequential format:
[0141] n = s seq +l seq -1
[0142] If n is less than 8, then the starting bit S_lsb in Motorola Forward LSB format is:
[0143] s lsb =8-n-1
[0144] If n is greater than 8, then the start bit S_lsb in Motorola Forward LSB format is:
[0145] i = n / 8
[0146] s lsb = 8*(i+1)-n-1+8*i
[0147] (3) Calculation of the starting position for Motorola Sequential to Motorola Backward conversion
[0148] The signal arrangement in the Motorola Backward format is somewhat special. In the Motorola Backward format, the bit index is arranged from right to left, and the byte index is arranged from bottom to top, with the starting bit being the LSB. Therefore, in this case, the signals packed into the message are arranged from the back of the layout to the front.
[0149] The formula for converting Motorola Sequential to Motorola Backward format is as follows:
[0150] s backword =8 * dlc-s seq -l seq
[0151] For example, if there are several pre-designed signals placed in a signal list matrix, as shown in Table 2, including: signal name, signal length, transmitting and receiving nodes, and other signal-related attributes, where s represents the node sending and r represents the node receiving.
[0152] Table 2
[0153]
[0154] When designing a network, these signals need to be encapsulated into corresponding messages according to the signal sending and receiving nodes, and the corresponding nodes need to be created. Under each node, there is information about the messages and signals sent and received by the node. Now, using the signal automatic message encapsulation method, after parsing the following matrix, the corresponding ECU and nodes ABSESP, BCM, and IC will be created, and the following messages ABSESP_0 (ID 0x150), BCM_0 (ID 0x180), and IC_0 (ID 0x149) will be created to receive the signals to be encapsulated, and the message length DLC is 8 bytes.
[0155] Assuming the current request message signal arrangement is Motorola Sequential, after calculating and packaging the start bit, the result is as follows: Under the network segment "New_CAN_Network", there are nodes ABSESP, BCM, and IC, and messages ABSESP_0, BCM_0, and IC_0. Under node ABSESP, the message sent is ABSESP_0, with transmitted signals ABSESP_150h_1 and ABSESP_150h_2; the received message is IC_0, with received signal IC_149_1. Under node BCM, the message sent is BCM_0, with transmitted signal... BCM_180h_1 receives the message ABSESP_0 and the signals ABSESP_150h_1 and ABSESP_150h_2. At the node IC, the message is sent as IC_0 and the signal is IC_149h_1. The received messages are ABSESP_0 and BCM_0, and the signals are ABSESP_150h_1, ABSESP_150h_2, and BCM_180h_1. The signal data is then automatically packaged, allowing network engineers to directly copy the packaged messages and node data for network design.
[0156] The signal packetization method provided in this application can automate the manual packetization and start bit calculation process of signal data by network engineers. Users can directly and completely package the designed signal data into the desired message and network segment data, which alleviates the problems of errors and signal conflicts in manual packetization to a certain extent, effectively improves the efficiency of signal packetization, and provides an effective solution for traditional manual packetization of signal data.
[0157] Figure 3 A structural diagram of the signal packaging device provided in an embodiment of this application is shown. Figure 3 As shown, the signal packaging device 300 includes:
[0158] The first acquisition module 301 is used to acquire a message and a current signal, wherein the message includes multiple bytes distributed in sequence;
[0159] The search module 302 is used to search the message in the order of its distribution if the remaining empty space of the message is greater than or equal to the signal length of the current signal.
[0160] The first placement module 303 is used to place the current signal in the target consecutive empty space if the target consecutive empty space is found, wherein the length of the target consecutive empty space is greater than or equal to the signal length of the current signal;
[0161] The adjustment module 304 is used to adjust the position of the signal already placed in the message to obtain the target continuous empty space if the target continuous empty space is not found.
[0162] The second placement module 305 is used to place the current signal in the target continuous empty space.
[0163] Optionally, the signal length is less than 8;
[0164] The first placement module 303 includes:
[0165] The first placement submodule is used to place the current signal in the target consecutive empty space if the first byte is found to include the target consecutive empty space.
[0166] Optionally, the signal length is N times 8, where N is a positive integer;
[0167] The first placement module 303 includes:
[0168] The second placement submodule is used to place the current signal in the target consecutive empty space if the second byte includes the target consecutive empty space, and none of the bytes included in the second byte have been filled with signals.
[0169] Optionally, the signal length is greater than 8 and the signal length is not N times 8, where N is a positive integer;
[0170] The first placement module 303 includes:
[0171] The first determining submodule is used to determine the first occupied byte count and the second occupied byte count if the third byte and the fourth byte are found. The first occupied byte count is the number of bytes occupied in the plurality of bytes when the current signal is placed starting from the empty position of the third byte. The second occupied byte count is the number of bytes occupied in the plurality of bytes when the current signal is placed starting from the empty position of the fourth byte. The third byte is the first byte in the plurality of bytes that is not filled by the signal. The fourth byte is the last byte in the filled bytes. The fourth byte is not filled.
[0172] The third placement submodule is used to place the current signal starting from the empty space of the third byte if the number of the first occupied bytes is less than the number of the second occupied bytes.
[0173] The fourth placement submodule is used to place the current signal starting from the empty space of the fourth byte if the number of the second occupied bytes is less than the number of the first occupied bytes.
[0174] Optionally, adjustment module 304 includes:
[0175] The first acquisition submodule is used to acquire the length of each consecutive empty space in the remaining empty spaces;
[0176] The second determining submodule is used to determine the first start bit based on the length of the plurality of bytes and the signal length;
[0177] The second acquisition submodule is used to acquire the number of overlapping bits between the current signal and the signals already placed in the message when the current signal is placed starting from the first start position.
[0178] The adjustment submodule is used to adjust the position of the signals already placed in the message according to the relationship between the empty space length and the number of overlapping bits, so as to obtain the target continuous empty space.
[0179] Optionally, adjust the submodules, including:
[0180] The first adjustment unit is configured to, if the length of the first empty space in the empty space length is greater than or equal to the number of overlapping bits, place the first signal after the first empty space starting from the starting position of the first empty space, and place the signals after the first signal in sequence, so that the empty spaces located at the first empty space and the empty spaces thereafter converge towards the end of the message to obtain the target continuous empty spaces.
[0181] Optionally, adjust the submodules, including:
[0182] The second adjustment unit is used to search the multiple bytes in the distribution order if there is no first empty space in the empty space length that is greater than or equal to the number of overlapping bits, starting from the first empty space, and placing the first signal after the first empty space starting from the starting position of the first empty space.
[0183] The third adjustment unit is used to repeatedly perform the search on the multiple bytes in the distribution order if the length of the first empty space in the message is less than the signal length, starting from the first empty space, and placing the first signal after the first empty space from the starting position of the first empty space until the length of the first empty space in the message is greater than or equal to the signal length.
[0184] The determining unit is configured to determine the first empty space as the target continuous empty space if the length of the first empty space in the message is greater than or equal to the signal length.
[0185] Optionally, the message uses the Motorola Forward MSB format;
[0186] The second placement module 305 is used for:
[0187] Obtain the second start bit of the current signal when the message is placed in the target consecutive empty space under Motorola Sequential format;
[0188] If the second start bit is less than 8, the target start bit of the current signal in the target consecutive empty space is determined according to the following expression:
[0189] s msb =8-s seq -1
[0190] If the second start bit is greater than 8, the target start bit of the current signal in the target consecutive empty space is determined according to the following expression:
[0191] s msb =8*(i+1)-s seq -1+8*i
[0192] Where i = s seq / 8,s seq This is the second start bit.
[0193] Optionally, the message uses the Motorola Forward LSB format;
[0194] The second placement module 305 is used for:
[0195] Obtain the second start bit of the current signal when the message is placed in the target consecutive empty space under Motorola Sequential format;
[0196] If the parameter value n is less than 8, then the target start position of the current signal in the target continuous empty space is determined according to the following expression:
[0197] s lsb =8-n-1
[0198] If the parameter value n is greater than 8, then the target start position of the current signal in the target continuous empty space is determined according to the following expression:
[0199] s lsb = 8*(i+1)-n-1+8*i
[0200] Among them, i=n / 8, n=s se +l seq-1,s seq For the second start bit, l seq This is the signal length.
[0201] Optionally, the message uses the Motorola Backward format;
[0202] The second placement module 305 is used for:
[0203] Obtain the second start bit of the current signal when the message is placed in the target consecutive empty space under Motorola Sequential format;
[0204] The target start position of the current signal in the target contiguous empty space is determined according to the following expression:
[0205] s backword =8 * dlc-s seq -l seq
[0206] Among them, s seq For the second start bit, l seq Where dlc is the signal length and dlc is the number of bytes in the message.
[0207] The signal packaging device 300 provided in this application embodiment can implement the various processes implemented in the aforementioned signal packaging method embodiment and achieve the same technical effect. To avoid repetition, it will not be described again here.
[0208] Figure 4 A schematic diagram of the hardware structure of the signal packaging method provided in an embodiment of this application is shown.
[0209] An electronic device may include a processor 601 and a memory 602 storing computer program instructions.
[0210] Specifically, the processor 601 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0211] Memory 602 may include mass storage for data or instructions. For example, and not limitingly, memory 602 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 602 may include removable or non-removable (or fixed) media. Where appropriate, memory 602 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 602 is non-volatile solid-state memory.
[0212] Memory may include read-only memory (ROM), random access memory (RAM), disk storage media devices, optical storage media devices, flash memory devices, and electrical, optical, or other physical / tangible memory storage devices. Therefore, typically, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to the first aspect of this disclosure.
[0213] The processor 601 implements any of the signal packing methods described in the above embodiments by reading and executing computer program instructions stored in the memory 602.
[0214] In one example, the electronic device may also include a communication interface 603 and a bus 610. For example, Figure 4 As shown, the processor 601, memory 602, and communication interface 603 are connected through bus 610 and complete communication with each other.
[0215] The communication interface 603 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.
[0216] Bus 610 includes hardware, software, or both, components of a signal packing method that are coupled together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 610 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, any suitable bus or interconnect is contemplated herein.
[0217] Furthermore, in conjunction with the signal packing methods in the above embodiments, this application embodiment can provide a computer-readable storage medium for implementation. This computer-readable storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the signal packing methods in the above embodiments.
[0218] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.
[0219] The functional blocks shown in the above-described structural diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.
[0220] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0221] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.
[0222] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.
Claims
1. A signal packetization method, characterized in that, The method includes: Acquire messages and current signals, wherein the messages consist of multiple bytes arranged in a sequential order; If the remaining empty space in the message is greater than or equal to the signal length of the current signal, then the message is searched according to the distribution order; If a consecutive empty space is found, the current signal is placed in the consecutive empty space, and the length of the consecutive empty space is greater than or equal to the signal length of the current signal. If the target consecutive empty space is not found, the position of the signal already placed in the message is adjusted to obtain the target consecutive empty space, and the current signal is placed in the target consecutive empty space.
2. The signal packaging method according to claim 1, characterized in that, If the target consecutive empty spaces are found, the current signal is placed in the target consecutive empty spaces, including: If the first byte found includes the target consecutive empty space, then the current signal is placed in the target consecutive empty space.
3. The signal packing method according to claim 1, characterized in that, The signal length is N times 8, where N is a positive integer; If the target consecutive empty spaces are found, the current signal is placed in the target consecutive empty spaces, including: If the second byte contains the target consecutive empty space, the current signal is placed in the target consecutive empty space, and none of the bytes included in the second byte are filled with signals.
4. The signal packaging method according to claim 1, characterized in that, The signal length is greater than 8 and is not N times 8, where N is a positive integer; If the target consecutive empty spaces are found, the current signal is placed in the target consecutive empty spaces, including: If the third and fourth bytes are found, the first number of occupied bytes and the second number of occupied bytes are determined. The first number of occupied bytes is the number of bytes occupied when the current signal is placed starting from the empty space of the third byte. The second number of occupied bytes is the number of bytes occupied when the current signal is placed starting from the empty space of the fourth byte. The third byte is the first byte in the plurality of bytes that is not filled by the signal. The fourth byte is the last byte in the filled bytes. The fourth byte is not filled. If the number of first occupied bytes is less than the number of second occupied bytes, then the current signal is placed starting from the empty space of the third byte; If the number of occupied bytes in the second position is less than the number of occupied bytes in the first position, then the current signal is placed starting from the empty space of the fourth byte.
5. The signal packing method according to claim 1, characterized in that, Adjusting the positions of signals already placed in the message to obtain the target continuous empty spaces includes: Obtain the length of each consecutive empty space in the remaining empty spaces; The first start bit is determined based on the length of the plurality of bytes and the signal length; Obtain the number of overlapping bits between the current signal and the signals already placed in the message, when the current signal is placed starting from the first start bit; Based on the relationship between the empty space length and the number of overlapping bits, the positions of the signals already placed in the message are adjusted to obtain the target continuous empty space.
6. The signal packing method according to claim 5, characterized in that, Based on the relationship between the gap length and the number of overlapping bits, the positions of the signals already placed in the message are adjusted to obtain the target continuous gaps, including: If the length of the first empty space in the empty space length is greater than or equal to the number of overlapping bits, then the first signal placed after the first empty space is placed starting from the beginning of the first empty space, and signals placed sequentially after the first signal are placed, so that the empty spaces located at the first empty space and the empty spaces thereafter all converge towards the end of the message to obtain the target continuous empty spaces.
7. The signal packing method according to claim 5, characterized in that, Based on the relationship between the gap length and the number of overlapping bits, the positions of the signals already placed in the message are adjusted to obtain the target continuous gaps, including: If there is no first empty space whose length is greater than or equal to the number of overlapping bits, then the multiple bytes are searched in the order of distribution, starting from the first empty space, and the first signal after the first empty space is placed starting from the beginning of the first empty space. If the length of the first empty space in the message is less than the signal length, then the search for the multiple bytes in the distribution order is repeated. Starting from the first empty space, the first signal after the first empty space is placed from the starting position of the first empty space until the length of the first empty space in the message is greater than or equal to the signal length. If the length of the first empty space in the message is greater than or equal to the signal length, then the first empty space is determined to be the target continuous empty space.
8. The signal packing method according to claim 1, characterized in that, The message uses the Motorola ForwardMSB format; Placing the current signal in the target consecutive empty spaces includes: Obtain the second start bit of the current signal when the message is placed in the target consecutive empty space under Motorola Sequential format; If the second start bit is less than 8, the target start bit of the current signal in the target consecutive empty space is determined according to the following expression: s msb =8-s seq -1 If the second start bit is greater than 8, the target start bit of the current signal in the target consecutive empty space is determined according to the following expression: s msb =8*(i+1)-s seq -1+8*i Where i = s seq / 8,s seq This is the second start bit.
9. The signal packing method according to claim 1, characterized in that, The message uses the Motorola ForwardLSB format; Placing the current signal in the target consecutive empty spaces includes: Obtain the second start bit of the current signal when the message is placed in the target consecutive empty space under Motorola Sequential format; If the parameter value n is less than 8, the target start position of the current signal in the target continuous empty space is determined according to the following expression: s lsb =8-n-1 If the parameter value n is greater than 8, then the target start position of the current signal in the target continuous empty space is determined according to the following expression: s lsb =8*(i+1)-n-1+8*i Among them, i=n / 8, n=s seq +l seq -1,s seq For the second start bit, l seq This is the signal length.
10. The signal packing method according to claim 1, characterized in that, The message uses Motorola Backward format; Placing the current signal in the target consecutive empty spaces includes: Obtain the second start bit of the current signal when the message is placed in the target consecutive empty space under Motorola Sequential format; The target start position of the current signal in the target consecutive empty space is determined according to the following expression: s backword =8*dlc-s seq -l seq Among them, s seq For the second start bit, l seq Where dlc is the signal length and dlc is the number of bytes in the message.
Citation Information
Patent Citations
Router wire card and data processing method
CN102780639A
Data format for efficient encoding and access of multiple data items in RFID tags
US20070276984A1