A multi-sensor parallel control method and system
Patent Information
- Application Number
- CN202211612757.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-15
- Publication Date
- 2026-10-23
- Estimated Expiration
- 2042-12-15
AI Technical Summary
这就导致并联的多个传感器会占用主控芯片的多个引脚,而如果需要连接的传感器数量过多,会出现主控芯片的引脚不够用的情况
[0026]由上可见,本公开提供的技术方案,可以将多个并联的传感器接入至同一个引脚中,当接收到多个传感器发来的通信报文时,可以按照通信地址,对通信报文进行排序。后续,在转发通信报文时,可以按照排序结果依次转发,从而避免通信报文被转发至错误的处理单元中。可见,通过上述的方式,可以极大地提高系统整体的延展性,不会过多地占用主控芯片的引脚。
Smart Images

Figure CN116795747B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a multi-sensor parallel control method and system. Background Technology
[0002] Currently, sensor devices typically connect to the main control chip via I / O interfaces. When multiple sensors are connected in parallel in a system, each sensor needs to connect to the main control chip via an I / O interface. This results in multiple sensors in parallel occupying multiple pins of the main control chip, and if the number of sensors to be connected is too large, the main control chip may run out of pins.
[0003] Clearly, the existing methods of connecting multiple sensors in parallel impose significant constraints on the system's scalability. Summary of the Invention
[0004] This invention provides a multi-sensor parallel control method and system, which can improve the overall scalability of the system.
[0005] In view of this, the present invention provides a multi-sensor parallel control method, the method comprising:
[0006] Receive communication messages from multiple parallel sensors, wherein the communication messages carry the communication addresses of each sensor;
[0007] The communication messages are sorted according to the communication address to form a communication message sequence;
[0008] According to the order of each communication message in the communication message sequence, each communication message in the communication message sequence is forwarded sequentially to forward the communication message to the matching processing unit.
[0009] In one implementation, sorting the communication messages to form a communication message sequence includes:
[0010] The number of processing units is identified, and element slots matching the number of processing units are created in the communication message sequence, wherein the element slots have the communication addresses corresponding to the processing units;
[0011] According to the communication address carried in the communication message, the communication message is sequentially filled into the element slot;
[0012] If the communication address corresponding to a certain element slot is not included in any communication message, the element slot will be left empty.
[0013] In one implementation, forwarding each communication message in the communication message sequence sequentially includes:
[0014] If the current element slot is filled with a communication message, the communication message in the current element slot is forwarded to the corresponding processing unit.
[0015] If the current element slot is not filled with a communication message, skip the processing unit corresponding to the current element slot and forward the communication message to the corresponding processing unit in the next element slot.
[0016] In one implementation, forwarding each communication message in the communication message sequence sequentially includes:
[0017] The communication messages in the communication message sequence are grouped together, wherein the communication messages in the same group have the same communication address;
[0018] Forward communication messages in the same group to the same processing unit.
[0019] The present invention also provides a multi-sensor parallel control system, the system comprising:
[0020] A message receiving unit is used to receive communication messages sent by multiple parallel sensors, wherein the communication messages carry the communication addresses of each sensor.
[0021] The sorting unit is used to sort the communication messages according to the communication address to form a communication message sequence;
[0022] The forwarding unit is used to forward each communication message in the communication message sequence in the order of the communication messages, so as to forward the communication messages to the matching processing unit.
[0023] In one embodiment, the sorting unit is specifically used to: identify the number of processing units and create element slots in the communication message sequence that match the number of processing units, wherein each element slot has a communication address corresponding to the processing unit; fill the element slots sequentially according to the communication addresses carried in the communication messages; wherein if the communication address corresponding to a certain element slot is not included in any communication message, the element slot is left empty.
[0024] In one embodiment, the forwarding unit is specifically used to: if the current element slot is filled with a communication message, forward the communication message in the current element slot to the corresponding processing unit; if the current element slot is not filled with a communication message, skip the processing unit corresponding to the current element slot, and forward the communication message filled in the next element slot to the corresponding processing unit.
[0025] In one embodiment, the forwarding unit is specifically used to group the communication messages in the communication message sequence, wherein the communication messages in the same group have the same communication address; and to forward the communication messages in the same group to the same processing unit.
[0026] As can be seen from the above, the technical solution provided in this disclosure allows multiple parallel sensors to be connected to the same pin. When communication messages from multiple sensors are received, they can be sorted according to their communication addresses. Subsequently, when forwarding communication messages, they can be forwarded sequentially according to the sorting result, thereby avoiding the communication messages being forwarded to the wrong processing unit. Therefore, this method can greatly improve the overall scalability of the system without excessively occupying the pins of the main control chip.
[0027] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings.
[0028] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0029] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:
[0030] Figure 1 This is a schematic diagram illustrating the steps of a multi-sensor parallel control method in an embodiment of the present invention;
[0031] Figure 2 This is a schematic diagram of the functional modules of a multi-sensor parallel control system in an embodiment of the present invention. Detailed Implementation
[0032] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.
[0033] This invention provides a multi-sensor parallel control method; please refer to [link / reference]. Figure 1 The method includes the following steps.
[0034] S1: Receive communication messages from multiple parallel sensors, wherein the communication messages carry the communication addresses of each sensor.
[0035] S2: Sort the communication messages according to the communication address to form a communication message sequence.
[0036] S3: Forward each communication message in the communication message sequence in the order of the communication message sequence, so as to forward the communication message to the matching processing unit.
[0037] In this embodiment, multiple parallel sensors can be connected to the same pin of the main control chip via an RS485 interface. To prevent communication messages from different sensors from getting mixed up, the communication address of each sensor can be included in the communication message. This communication address can be a unique address pre-assigned to the sensor. Thus, after receiving communication messages from each sensor, the main control chip can sort the communication messages according to the communication addresses carried in the messages. The sensor whose communication address appears earlier in the message will have its message appear earlier in the sorted list.
[0038] The main control chip can include processing units corresponding to each sensor; these processing units can actually be threads. After sorting the communication messages, the main control chip obtains a communication message sequence. Based on the order of the communication messages in the sequence, the main control chip can send the communication messages to the corresponding processing units for processing.
[0039] Specifically, when sorting communication messages, the number of processing units can be identified, and element slots matching the number of processing units can be created in the communication message sequence. Each element slot contains the communication address corresponding to the processing unit. Then, communication messages can be sequentially filled into the element slots according to the communication addresses carried in the communication messages. During filling, if the communication address corresponding to a certain element slot is not included in any communication message, that element slot is left empty.
[0040] In this way, when forwarding each communication message in the communication message sequence sequentially, if the current element slot is filled with a communication message, the communication message in the current element slot is forwarded to the corresponding processing unit; if the current element slot is not filled with a communication message, the processing unit corresponding to the current element slot is skipped, and the communication message filled in the next element slot is forwarded to the corresponding processing unit. This ensures the correct correspondence between communication messages and processing units, preventing communication messages from being forwarded to the wrong processing unit.
[0041] In practical applications, the same sensor can send multiple communication messages simultaneously. In this way, the communication messages in the communication message sequence can be grouped, and the communication messages in the same group have the same communication address. Then, the communication messages in the same group can be forwarded to the same processing unit for processing.
[0042] Please see Figure 2 This invention provides a multi-sensor parallel control system, the system comprising:
[0043] A message receiving unit is used to receive communication messages sent by multiple parallel sensors, wherein the communication messages carry the communication addresses of each sensor.
[0044] The sorting unit is used to sort the communication messages according to the communication address to form a communication message sequence;
[0045] The forwarding unit is used to forward each communication message in the communication message sequence in the order of the communication messages, so as to forward the communication messages to the matching processing unit.
[0046] In one embodiment, the sorting unit is specifically used to: identify the number of processing units and create element slots in the communication message sequence that match the number of processing units, wherein each element slot has a communication address corresponding to the processing unit; fill the element slots sequentially according to the communication addresses carried in the communication messages; wherein if the communication address corresponding to a certain element slot is not included in any communication message, the element slot is left empty.
[0047] In one embodiment, the forwarding unit is specifically used to: if the current element slot is filled with a communication message, forward the communication message in the current element slot to the corresponding processing unit; if the current element slot is not filled with a communication message, skip the processing unit corresponding to the current element slot, and forward the communication message filled in the next element slot to the corresponding processing unit.
[0048] In one embodiment, the forwarding unit is specifically used to group the communication messages in the communication message sequence, wherein the communication messages in the same group have the same communication address; and to forward the communication messages in the same group to the same processing unit.
[0049] As can be seen from the above, the technical solution provided in this disclosure allows multiple parallel sensors to be connected to the same pin. When communication messages from multiple sensors are received, they can be sorted according to their communication addresses. Subsequently, when forwarding communication messages, they can be forwarded sequentially according to the sorting result, thereby avoiding the communication messages being forwarded to the wrong processing unit. Therefore, this method can greatly improve the overall scalability of the system without excessively occupying the pins of the main control chip.
[0050] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A multi-sensor parallel control method, characterized in that, The method includes: Receive communication messages from multiple parallel sensors, wherein the communication messages carry the communication addresses of each sensor; The communication messages are sorted according to the communication address to form a communication message sequence; According to the order of each communication message in the communication message sequence, each communication message in the communication message sequence is forwarded sequentially to forward the communication message to the matching processing unit; Sort the communication messages to form a communication message sequence, including: The number of processing units is identified, and element slots matching the number of processing units are created in the communication message sequence, wherein the element slots have the communication addresses corresponding to the processing units; According to the communication address carried in the communication message, the communication message is sequentially filled into the element slot; If the communication address corresponding to a certain element slot is not included in any communication message, the element slot will be left empty.
2. The method according to claim 1, characterized in that, Forwarding each communication message in the communication message sequence in sequence includes: If the current element slot is filled with a communication message, the communication message in the current element slot is forwarded to the corresponding processing unit. If the current element slot is not filled with a communication message, skip the processing unit corresponding to the current element slot and forward the communication message to the corresponding processing unit in the next element slot.
3. The method according to claim 1, characterized in that, Forwarding each communication message in the communication message sequence in sequence includes: The communication messages in the communication message sequence are grouped together, wherein the communication messages in the same group have the same communication address; Forward communication messages in the same group to the same processing unit.
4. A multi-sensor parallel control system, characterized in that, The system includes: A message receiving unit is used to receive communication messages sent by multiple parallel sensors, wherein the communication messages carry the communication addresses of each sensor. The sorting unit is used to sort the communication messages according to the communication address to form a communication message sequence; The forwarding unit is used to forward each communication message in the communication message sequence in the order of each communication message in the communication message sequence, so as to forward the communication message to the matching processing unit. The sorting unit is specifically used to: identify the number of processing units and create element slots in the communication message sequence that match the number of processing units, wherein each element slot has a communication address corresponding to the processing unit; fill the element slots sequentially according to the communication addresses carried in the communication messages; wherein if the communication address corresponding to a certain element slot is not included in any communication message, the element slot is left empty.
5. The system according to claim 4, characterized in that, The forwarding unit is specifically used to: if the current element slot is filled with a communication message, forward the communication message in the current element slot to the corresponding processing unit; if the current element slot is not filled with a communication message, skip the processing unit corresponding to the current element slot, and forward the communication message filled in the next element slot to the corresponding processing unit.
6. The system according to claim 4, characterized in that, The forwarding unit is specifically used to group the communication messages in the communication message sequence, wherein the communication messages in the same group have the same communication address; and to forward the communication messages in the same group to the same processing unit.
Citation Information
Patent Citations
Message processing method, and device and network device
CN105490961A
Message processing method, processing unit and virtual private network server
CN113014528A
Multi-sensor measurement data center-level real-time elastic processing method
CN113946442A