Data processing method and device and gateway system
By expanding the equipment in the building automatic control system to dynamically determine the priority of data frames and sending bus preemption requests, the data communication problem caused by insufficient gateway resources is solved, and data real-time and reliability are improved.
Patent Information
- Application Number
- CN202411474976.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2044-10-22
AI Technical Summary
Due to hardware resource limitations, the lightweight gateway in the building automatic control system is unable to support access to multiple extended devices, resulting in busy data communication bus, affecting data real-time and possibly causing communication failures.
By dynamically determining the priority of the data frame to be sent by the extension device, the sending bus preemption request is to the gateway, and the bus resources are allocated reasonably according to the priority and waiting time to ensure the timely transmission of important data.
It effectively alleviates the problem of bus congestion, improves the real-time data and the reliability of sending important data, and avoids data misreport.
Smart Images

Figure CN119316489A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of building automation technology, and in particular to a data processing method, device and gateway system. Background Art
[0002] In building automation systems, lightweight gateways are limited by hardware resources and have a small running memory space, which results in the inability to support the access of expansion devices, or the number of expandable devices that can be accessed and the number of devices accessed through expansion devices is small.
[0003] When there are many expansion devices connected to the gateway, the huge amount of data will cause the communication bus to be busy, so that the data of some expansion devices cannot be sent in time, affecting the real-time nature of the data. In addition, communication failures are likely to occur.
[0004] In order to alleviate the bus congestion problem, in the related art, a longer period of data reporting or a processing method of directly discarding old data is adopted, which will reduce the real-time nature of the data and may cause important data to be missed. Summary of the invention
[0005] The present disclosure provides a data processing method, device and gateway system.
[0006] According to a first aspect of the present disclosure, there is provided a data processing method, which is executed by an expansion device, and includes: acquiring data of at least one device connected to a gateway through the expansion device; framing the data of the at least one device to obtain a data frame to be sent; determining the priority of the data frame to be sent according to the priority of the at least one device and the waiting time for sending the data frame to be sent; sending a bus preemption request to the gateway, wherein the bus preemption request carries the priority of the data frame to be sent, so that the gateway generates a bus preemption response according to the priority of the data frame to be sent; and after receiving the bus preemption response indicating that the bus preemption is successful from the gateway, sending the data frame to be sent via the bus.
[0007] In some embodiments, determining the priority of the data frame to be sent based on the priority of the at least one device and the waiting time for sending the data frame to be sent includes: determining the initial priority of the data frame to be sent based on the priority of the device with the highest priority among the at least one device; and when the waiting time for sending the data frame to be sent is greater than or equal to a set time length, increasing the initial priority of the data frame to be sent to obtain the priority of the data frame to be sent.
[0008] In some embodiments, determining the priority of the data frame to be sent based on the priority of the at least one device and the waiting time for sending the data frame to be sent also includes: when the waiting time for sending the data frame to be sent is less than the set time length, using the initial priority as the priority of the data frame to be sent.
[0009] In some embodiments, increasing the initial priority of the data frame to be sent includes: taking a set duration as a timing period, and increasing the initial priority of the data frame to be sent according to a set step size at the end of each timing period, wherein the set step size is positively correlated with the accumulated number of the timing periods.
[0010] In some embodiments, the framing of the data of the at least one device to obtain the data frame to be sent includes: when the data of the at least one device includes data of a designated device, filtering out at least a portion of the data of the designated device other than data at a most recent moment to obtain filtered data, wherein the designated device is a device having a priority lower than a set threshold; framing the filtered data to obtain the data frame to be sent.
[0011] In some embodiments, obtaining data of at least one device that accesses the gateway through the expansion device includes: collecting original data of at least one device that accesses the gateway through the expansion device; preprocessing the original data and storing the preprocessed data in a cache; and obtaining data of the at least one device from the cache.
[0012] In some embodiments, the data processing method also includes: when sending a bus preemption request to the gateway, starting the timing; when no response to the successful bus preemption is received within a set time period, executing the step of determining the priority of the data frame to be sent again; sending the bus preemption request to the gateway again, and restarting the timing.
[0013] According to a second aspect of the present disclosure, there is provided a data processing apparatus, which is arranged in an expansion device and includes a module for executing the data processing method as described above.
[0014] According to a third aspect of the present disclosure, there is provided a data processing device, comprising: a memory; and a processor coupled to the memory, wherein the processor is configured to execute the data processing method as described above based on instructions stored in the memory.
[0015] According to a fourth aspect of the present disclosure, a gateway system is provided, comprising: a plurality of expansion devices, each expansion device comprising the data processing device as described above; a gateway, connected to the plurality of expansion devices, and configured to: receive bus preemption requests sent by the plurality of expansion devices, the bus preemption requests carrying the priority of the data frames to be sent; generate a bus preemption response according to the priority of the data frames to be sent; and send the bus preemption response to the plurality of expansion devices.
[0016] In some embodiments, the bus preemption request also carries the address code of the expansion device, and the gateway generates the bus preemption request according to the priority of the data frame to be sent, including: generating the bus preemption request according to the priority of the data frame to be sent and the address code of the expansion device.
[0017] According to a fifth aspect of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored, and when the instructions are executed by a processor, the data processing method as described above is implemented.
[0018] According to a sixth aspect of the present disclosure, a computer program product is provided, on which computer program instructions are stored, and when the instructions are executed by a processor, the data processing method as described above is implemented.
[0019] Other features and advantages of the present disclosure will become apparent from the following detailed description of exemplary embodiments of the present disclosure with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings, which constitute a part of the specification, illustrate embodiments of the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0021] Figure 1 is a flowchart of a data processing method according to some embodiments of the present disclosure;
[0022] Figure 2 is a flowchart of a data processing method according to some other embodiments of the present disclosure;
[0023] Figure 3 is a schematic diagram of the structure of a data frame to be sent according to some embodiments of the present disclosure;
[0024] Figure 4 is a schematic diagram of the structure of a data processing device according to some embodiments of the present disclosure;
[0025] Figure 5 is a schematic diagram of the structure of a data processing device according to some other embodiments of the present disclosure;
[0026] Figure 6 is a schematic diagram of the structure of a data processing device according to some further embodiments of the present disclosure;
[0027] Figure 7 It is a schematic diagram of the structure of a gateway system according to some embodiments of the present disclosure.
[0028] The present disclosure can be more clearly understood from the following detailed description with reference to the accompanying drawings. DETAILED DESCRIPTION
[0029] Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present disclosure unless otherwise specifically stated.
[0030] At the same time, it should be understood that for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.
[0031] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present disclosure, its application, or uses.
[0032] Technologies, methods, and apparatus known to ordinary technicians in the relevant field may not be discussed in detail, but where appropriate, such technologies, methods, and apparatus should be considered part of the authorization specification.
[0033] In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not as limiting. Therefore, other examples of the exemplary embodiments may have different values.
[0034] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0035] In order to make the objectives, technical solutions and advantages of the present disclosure more clearly understood, the present disclosure is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0036] Although the data processing method adopted by the expansion device in the related art can alleviate the bus congestion problem to a certain extent, it has shortcomings such as poor real-time data reporting and omission of important data.
[0037] In view of this, the present disclosure proposes a data processing method, device and gateway system, which can dynamically determine the priority of the data frames to be sent by the expansion device, so that the gateway can allocate the bus more reasonably based on this, which helps to alleviate bus congestion while improving the real-time transmission of important data.
[0038] Figure 1FIG. 1 is a flow chart of a data processing method according to some embodiments of the present disclosure. Figure 1 As shown, the data processing method is executed by an expansion device (also referred to as an expansion module) or a data processing apparatus located on the expansion device, and includes steps S11 to S15.
[0039] Step S11: Acquire data of at least one device connected to the gateway through the extension device.
[0040] The expansion device is connected to the gateway and is used to connect at least one device to the gateway through the expansion device. For example, the gateway is connected to multiple expansion devices, and each expansion device is connected to one or more terminal devices. The terminal device can be an air conditioner indoor unit, an air conditioner outdoor unit, and other devices.
[0041] In some examples, step S11 specifically includes: the extension device receives data reported by multiple devices.
[0042] In other examples, step S11 specifically includes: the expansion device collects raw data of at least one device connected to the gateway through the expansion device; preprocesses the raw data and stores the preprocessed data in a cache; and obtains data of at least one device from the cache.
[0043] The frequency of collecting data may be the same as or different from the frequency of obtaining data from the cache. The data obtained from the cache each time may be a part of the data in the cache or all of the data in the cache.
[0044] Among them, the preprocessing can flexibly set the processing logic according to the actual application scenario. For example, the preprocessing can include processing such as converting the communication protocol of the data. For example, assuming that the data reported by the terminal device A connected to the extension device is data using the first communication protocol, the data reported by the terminal device B connected to the extension device is data using the second communication protocol, and the extension device supports the third communication protocol, then the communication protocol of the data reported by the terminal device A and the data reported by the terminal device B is converted to the third communication protocol.
[0045] In the disclosed embodiment, the original data collected by the device is preprocessed and cached, and the preprocessed data is obtained from the cache for communication framing, so as to improve the device compatibility of the expansion device and the gateway.
[0046] Step S12: framing the data of at least one device to obtain a data frame to be sent.
[0047] In some examples, after acquiring data from at least one device, all acquired data are framed to obtain a data frame to be sent.
[0048] In other examples, after acquiring data from at least one device, the acquired data is filtered according to a preset filtering rule, and then the filtered data is framed to obtain a data frame to be sent.
[0049] The filtering rule may be to filter the data of a specified device. Exemplarily, after acquiring data of at least one device, it is determined whether the acquired data includes data of a specified device, where the specified device refers to a device whose priority is lower than a set threshold; if the acquired data includes data of a specified device, at least a portion of the data of the specified device other than the data at the most recent moment is filtered out to obtain filtered data, and then the filtered data is framed; if the acquired data does not include data of a specified device, all acquired data is framed. The set threshold may be flexibly set.
[0050] For example, assuming that the device data acquired at a certain time includes data of terminal device A at 8:10, 8:20, and 8:30, and the device priority of terminal device A is less than the set threshold, the data of terminal device A at 8:10 and 8:20 can be filtered out, and the data of terminal device A at 8:30 can be used as the filtered data, and then the filtered data can be framed.
[0051] For example, assuming that the device data acquired at a certain time includes data of terminal device A at 8:10, data of terminal device B at 8:20 and 8:30, and the device priority of terminal device A is greater than the set threshold, and the device priority of terminal device B is less than the set threshold, then the data of terminal device B at 8:20 can be filtered out, and the data of terminal device A at 8:10 and the data of terminal device B at 8:30 can be used as filtered data, and then the filtered data is framed.
[0052] In the disclosed embodiment, by performing the above filtering process before framing the data, old data of lower priority devices can be filtered out, thereby alleviating bus congestion and improving data real-time performance without missing important data.
[0053] Step S13: Determine the priority of the data frame to be sent according to the priority of at least one device and the waiting time for sending the data frame to be sent.
[0054] In some examples, step S13 includes: determining the initial priority of the data frame to be sent according to the priority of the device with the highest priority among the at least one device; and increasing the initial priority of the data frame to be sent to obtain the priority of the data frame to be sent when the waiting time for sending the data frame to be sent is greater than or equal to the set time. In addition, in the above example, step S13 may also include: using the initial priority as the priority of the data frame to be sent when the waiting time for sending the data frame to be sent is less than the set time.
[0055] The waiting time for sending refers to the time that elapses before the data frame to be sent is successfully sent. For example, if the timing starts from the moment when the bus preemption request is first sent, the waiting time for sending is the time interval from the moment when the bus preemption request is first sent to the current moment. For another example, if the timing starts from the moment when the frame is first formed, the waiting time for sending is the time interval from the moment when the frame is first formed to the current moment.
[0056] In the disclosed embodiment, through step S13, the priority of the data frame to be sent can be dynamically determined. When determining the priority, not only the priority of the device corresponding to the data frame to be sent is considered, but also the waiting time for the data frame to be sent is considered. In this way, the data frame priority determined by each expansion device takes into account both the importance of the data and the real-time nature of the data, which is convenient for the gateway to allocate the bus more reasonably, and helps to improve the real-time nature of the transmission of important data while alleviating bus congestion. Furthermore, by comparing the waiting time for sending with the set duration, and adopting different priority determination methods according to different comparison results, the priority of the data frame can be determined more efficiently and accurately.
[0057] Further, in the above example, there are multiple ways to determine the initial priority. The following is an explanation in combination with two exemplary ways. In the first exemplary way, the highest priority of the device to which the data participating in the framing belongs can be used as the initial priority. In the second exemplary way, the product of the highest priority of the device to which the data participating in the framing belongs and the set coefficient can be used as the initial priority.
[0058] Further, in the above example, there are multiple ways to increase the initial priority of the data frame to be sent. In an exemplary manner, increasing the initial priority of the data frame to be sent includes: taking a set duration as a timing cycle, and increasing the initial priority of the data frame to be sent according to a set step length at the end of each timing cycle. The set step length can be a fixed value or can be positively correlated with the cumulative number of timing cycles.
[0059] For example, assuming that the set time is 1 minute, the initial priority of the data frame to be sent is 5, and the set step size of the priority increase is 2, then when the waiting time for sending reaches 1 minute, the initial priority of the data frame to be sent is increased by 2, so that the priority of the data frame to be sent is 7; when the waiting time for sending reaches 2 minutes, the priority of the data frame to be sent is increased by 2 again, so that the priority of the data frame to be sent is 9.
[0060] For example, assuming that the set time is 1 minute, the initial priority of the data frame to be sent is 5, and the set step size of the priority increase is 2n (n is the cumulative number of timing cycles), then when the waiting time for sending reaches 1 minute, the initial priority of the data frame to be sent increases by 2, so that the priority of the data frame to be sent is 7; when the waiting time for sending reaches 2 minutes, the priority of the data frame to be sent is increased by 4 again, so that the priority of the data frame to be sent is 11.
[0061] In the disclosed embodiment, by taking a set time as the timing cycle and increasing the priority of the data frame to be sent according to the set step length each time, the expansion device can increase the priority at a more reasonable frequency, thereby taking into account the real-time nature of the priority update while reducing the resource consumption of the expansion device caused by the priority increase process. Furthermore, by making the set step length of the priority increase positively correlated with the cumulative number of timing cycles, the influence of the waiting time on the priority can be gradually increased, further improving the real-time nature of reporting important data.
[0062] In addition, in specific implementation, other methods can be adopted to increase the initial priority of the data frame to be sent. For example, increasing the initial priority of the data frame to be sent includes: setting different weight coefficients for the initial priority and the waiting time to send; performing weighted summation of the initial priority and the waiting time to send according to the weight coefficient, and using the summation result as the priority of the data frame to be sent.
[0063] Step S14: Send a bus preemption request to the gateway.
[0064] The bus preemption request carries the priority of the data frame to be sent. In addition, the bus preemption request may also carry other information, such as address information of an extended device.
[0065] After receiving bus preemption requests from multiple expansion devices, the gateway allocates the bus and generates a bus preemption response in descending order of the priority of the data frames to be sent by each expansion device. The bus preemption response can be a response of a successful bus preemption or a response of a failed bus preemption.
[0066] For example, after the gateway receives bus preemption requests from expansion device 1, expansion device 2, and expansion device 3, if the priority of the data frame to be sent by expansion device 1 is the highest, the bus is allocated to expansion device 1, and a bus preemption success response is generated for expansion device 1, and a bus preemption failure response is generated for expansion devices 2 and 3.
[0067] Step S15: after receiving a response indicating successful bus seizure, sending a data frame to be sent.
[0068] In the disclosed embodiment, through the above process, the priority of the data frames to be sent by each expansion device can be dynamically determined, so that the gateway can allocate the bus more reasonably, which helps to alleviate bus congestion while improving the real-time transmission of important data.
[0069] Figure 2 FIG. 1 is a flow chart of a data processing method according to other embodiments of the present disclosure. Figure 2 As shown, the data processing method can be executed by the expansion device, or a data processing apparatus located on the expansion device, and includes steps S21 to S26.
[0070] Step S21: Acquire data of at least one device connected to the gateway through the extension device.
[0071] Regarding how to specifically perform step S21, reference may be made to the relevant contents of the aforementioned embodiment.
[0072] Step S22: framing the data of at least one device to obtain a data frame to be sent.
[0073] Regarding how to specifically perform step S22, reference may be made to the relevant contents of the aforementioned embodiment.
[0074] Step S23: Determine the priority of the data frame to be sent.
[0075] Step S23 may be performed periodically, for example, at a set time interval.
[0076] In some embodiments, when step S23 is executed for the first time, the highest priority of the device to which the data participating in the framing belongs can be used as the priority of the data frame to be sent; when step S23 is executed for the second time and thereafter, the priority of the data frame to be sent can be determined based on the highest priority of the device to which the data participating in the framing belongs and the waiting time for sending the data frame to be sent.
[0077] The data frame to be sent may include multiple fields. In some examples, the data frame to be sent includes: Figure 3The fields shown are: address, data priority, data length, data address and data. Among them, address refers to the address of the extended device, and data priority refers to the priority of the data frame to be sent.
[0078] In some embodiments, the data processing method further includes: the user configures the priority of the device through the configuration management device, and expands the address of the device. The higher the priority of the device, the more important the data of the device is.
[0079] Step S24: Send a bus preemption request to the gateway and start timing.
[0080] In step S24, the timing may be started after sending the bus preemption request to the gateway, or may be started while sending the bus preemption request, wherein the bus preemption request carries the priority of the data frame to be sent.
[0081] Step S25: Determine whether the bus preemption is successful.
[0082] In some embodiments, it is periodically determined whether the bus preemption is successful. For example, it can be determined whether the bus preemption is successful in the following manner: after receiving a response that the bus preemption is successful, it is determined that the bus preemption is successful; otherwise, it is determined that the bus preemption is unsuccessful. In the case that the bus preemption is successful, step S26 is executed; otherwise, step S27 is executed.
[0083] Step S26: Send the data frame to be sent and end the timing.
[0084] In this step, after the expansion device successfully seizes the bus, it sends the data frame to be sent through the bus. At the same time, the timing of the data frame to be sent is terminated.
[0085] Step S27: Determine whether the timing is finished.
[0086] In this step, the set time is used as the timing cycle. If the time interval from the current time to the timing start time is greater than or equal to the set time, it is determined that the timing is over; otherwise, it is determined that the timing is not over. If the timing is over, step S23 is executed again; otherwise, step S25 is executed again.
[0087] In some embodiments, when step S23 is executed again, the priority of the data frame to be sent is increased according to the set step size to obtain an updated priority. By iteratively executing the above multiple steps, the priority of the data frame to be sent can be updated in time when the bus preemption is unsuccessful, thereby improving the timeliness, integrity and reliability of data processing.
[0088] In the disclosed embodiment, through the above process, the priority of the data frame to be sent by the expansion device can be dynamically determined, so that the gateway can allocate the bus more reasonably based on this, which helps to alleviate bus congestion while improving the real-time transmission of important data.
[0089] Figure 4 is a schematic diagram of the structure of a data processing device according to some embodiments of the present disclosure. Figure 4 As shown, the data processing device 40 is arranged in the expansion device, and is used to execute the data processing method as described above, including a data acquisition module 41, a communication framing module 42, a bus preemption module 43, and a data sending module 44.
[0090] The data acquisition module 41 is configured to acquire data of at least one device connected to the gateway through the extension device.
[0091] The communication framing module 42 is configured to frame the data of at least one device to obtain a data frame to be sent; and determine the priority of the data frame to be sent according to the priority of at least one device and the waiting time for sending the data frame to be sent.
[0092] The bus preemption module 43 is configured to send a bus preemption request to the gateway, wherein the bus preemption request carries the priority of the data frame to be sent, so that the gateway generates a bus preemption response according to the priority of the data frame to be sent.
[0093] The data sending module 44 is configured to send a to-be-sent data frame through the bus after receiving a bus seizure response indicating that the bus seizure is successful from the gateway.
[0094] In the disclosed embodiment, the above device can dynamically determine the priority of the data frames to be sent by each expansion device, so that the gateway can allocate the bus more reasonably, which helps to alleviate bus congestion while improving the real-time transmission of important data.
[0095] Figure 5 Schematic diagram of the structure of a data processing device according to some other embodiments of the present disclosure. Figure 5 As shown, the data processing device 50 is arranged in the expansion device, and includes a data acquisition module 51, a data processing module 52, a data buffer module 53, a communication framing module 54, a bus preemption module 55, and a data sending module 56.
[0096] The data collection module 51 is configured to collect raw data of at least one device connected to the gateway through the extension device.
[0097] The data processing module 52 is configured to pre-process the original data and store the pre-processed data in the data cache module 53 .
[0098] The communication framing module 54 is configured to frame the data of at least one device obtained from the data buffer module 53 to obtain a data frame to be sent, and determine the priority of the data frame to be sent.
[0099] In some embodiments, the communication framing module 54 determines the priority of the data frame to be sent according to the following method: when determining the priority of the data frame to be sent for the first time, the priority of the data frame to be sent is determined according to the priority of the device to which the data involved in the framing belongs; when determining the priority of the data frame to be sent for the second time and thereafter, the priority of the data frame to be sent is determined according to the priority of the device to which the data involved in the framing belongs and the waiting time for sending the data frame to be sent.
[0100] The bus preemption module 55 is configured to send a bus preemption request to the gateway and start timing, wherein the bus preemption request carries the priority of the data frame to be sent, so that the gateway generates a bus preemption response according to the priority of the data frame to be sent.
[0101] The data sending module 56 is configured to send the data frame to be sent through the bus after receiving the bus seizure response indicating that the bus seizure is successful from the gateway. At the same time, the timing is ended.
[0102] In some embodiments, after sending the bus preemption request through the bus preemption module 55, it is determined whether a response indicating a successful bus preemption is received within a set time period; if a response indicating a successful bus preemption is not received within the set time period, the priority of the data frame to be sent is updated through the communication frame assembly module 54. For example, assuming that the priority of the currently recorded data frame to be sent is 11, the step size is set to 2, and the sum of the priority of the currently recorded data frame to be sent and the set step size is used as the priority of the updated data frame to be sent.
[0103] In some embodiments, the data sending module 56 is further configured to: in the event that the data frame to be sent fails to be sent, save the data involved in the framing to the data cache module.
[0104] In the disclosed embodiment, the above device can dynamically determine the priority of the data frames to be sent by each expansion device, so that the gateway can allocate the bus more reasonably, which helps to alleviate bus congestion and improve the real-time transmission of important data.
[0105] Figure 6 is a schematic diagram of the structure of a data processing device according to some further embodiments of the present disclosure; Figure 6As shown, the data processing device 60 includes a memory 61 and a processor 62 coupled to the memory 61. The memory 61 is used to store instructions for executing the corresponding embodiments of the data processing method. The processor 62 is configured to execute the data processing method in any of the embodiments of the present disclosure based on the instructions stored in the memory 61.
[0106] Figure 7 is a schematic diagram of the structure of a gateway system according to some embodiments of the present disclosure. Figure 7 As shown, the gateway system includes a gateway 71 and multiple expansion devices. The multiple expansion devices include expansion devices 1 72, ..., and expansion device M 73. M is an integer greater than 1.
[0107] Each of the plurality of expansion devices comprises the data processing apparatus as described above.
[0108] The gateway 71 is connected to multiple expansion devices and is configured to: receive bus preemption requests sent by multiple expansion devices, the bus preemption requests carrying the priority of the data frame to be sent; generate a bus preemption response according to the priority of the data frame to be sent; and send the bus preemption response to the multiple expansion devices.
[0109] In some embodiments, the gateway generates a bus preemption response in the following manner: allocate the bus in descending order of the priority of the data frames to be sent of each expansion device; and generate a bus preemption response according to the bus allocation result. For example, the bus is allocated to the data frame to be sent with the highest priority, and a bus preemption success response is generated for the expansion device where the data frame to be sent is located; and a bus preemption failure response is generated for the expansion devices where other data frames to be sent are located.
[0110] In some embodiments, the gateway allocates the bus according to the priority of the data frame to be sent and the address code of the expansion device. For example, when the priorities of the data frames to be sent of each expansion device are different, the bus is allocated in the order of the priority of the data frames to be sent from high to low; when the priorities of the data frames to be sent of each expansion device are the same, the bus is allocated in the order of the address codes of each expansion module from large to small. Afterwards, a bus preemption response is generated according to the bus allocation result. By considering not only the priority of the data frames to be sent of each expansion device but also the address code of each expansion device when allocating the bus, the effect of bus allocation can be further improved and the real-time performance of data reporting can be improved.
[0111] Furthermore, the gateway system may also include multiple terminal devices, for example, terminal device 1 74, ..., terminal device K1 75 connected to the gateway through extension device 1, terminal device 1 76, ..., terminal device K2 77 connected to the gateway through extension device M 73. K1 and K2 are integers greater than 1.
[0112] In the disclosed embodiment, through the above gateway system, the priority of the data frames to be sent by each expansion device can be dynamically determined, so that the gateway can allocate the bus more reasonably, which helps to alleviate bus congestion while improving the real-time transmission of important data.
[0113] Here, various aspects of the present disclosure are described with reference to flowcharts and / or block diagrams of methods, devices, and computer program products according to embodiments of the present disclosure. It should be understood that each frame of the flowchart and / or block diagram and the combination of frames can be implemented by computer-readable program instructions.
[0114] These computer-readable program instructions may be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable device to produce a machine, so that the processor executes the instructions to produce means for implementing the functions specified in one or more blocks in the flowchart and / or block diagram.
[0115] These computer-readable program instructions may also be stored in a computer-readable memory, which cause the computer to work in a specific manner to produce an article of manufacture, including instructions for implementing the functions specified in one or more blocks in the flowchart and / or block diagram.
[0116] The present disclosure can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects.
[0117] So far, the data processing method, device and gateway system according to the present disclosure have been described in detail. In order to avoid obscuring the concept of the present disclosure, some details known in the art are not described. Based on the above description, those skilled in the art can fully understand how to implement the technical solution disclosed here.
Claims
1. A data processing method, executed by an expansion device, comprising: Acquire data of at least one device connected to the gateway through the extension device; framing the data of the at least one device to obtain a data frame to be sent; Determining the priority of the data frame to be sent according to the priority of the at least one device and the waiting time for sending the data frame to be sent; Sending a bus preemption request to the gateway, wherein the bus preemption request carries the priority of the data frame to be sent, so that the gateway generates a bus preemption response according to the priority of the data frame to be sent; After receiving a bus preemption response indicating that the bus preemption is successful from the gateway, the to-be-sent data frame is sent through the bus.
2. The data processing method according to claim 1, wherein: Determining the priority of the to-be-sent data frame according to the priority of the at least one device and the waiting time for sending the to-be-sent data frame comprises: Determining the initial priority of the data frame to be sent according to the priority of the device with the highest priority among the at least one device; When the waiting time for sending the data frame to be sent is greater than or equal to the set time length, the initial priority of the data frame to be sent is increased to obtain the priority of the data frame to be sent.
3. The data processing method according to claim 2, wherein: Determining the priority of the data frame to be sent according to the priority of the at least one device and the waiting time for sending the data frame to be sent also includes: When the waiting time for sending the data frame to be sent is less than the set time length, the initial priority is used as the priority of the data frame to be sent.
4. The data processing method according to claim 2, wherein: The increasing the initial priority of the data frame to be sent includes: The set duration is used as a timing cycle, and at the end of each timing cycle, the initial priority of the data frame to be sent is increased according to a set step length, wherein the set step length is positively correlated with the accumulated number of the timing cycles.
5. The data processing method according to claim 1, wherein: The framing of the data of the at least one device to obtain a data frame to be sent includes: When the data of the at least one device includes data of a designated device, filtering out at least a portion of the data of the designated device except the data at the most recent time to obtain filtered data, wherein the designated device is a device with a priority lower than a set threshold; The filtered data is framed to obtain a data frame to be sent.
6. The data processing method according to claim 1, wherein: The acquiring of data of at least one device accessing the gateway through the extension device comprises: Collecting raw data of at least one device connected to the gateway through the expansion device; Preprocessing the original data and storing the preprocessed data in a cache; The data of the at least one device is obtained from the cache.
7. The data processing method according to any one of claims 1 to 6, further comprising: In the case of sending a bus preemption request to the gateway, starting timing; If no bus preemption response indicating that the bus preemption is successful is received within the set time period, the step of determining the priority of the data frame to be sent is performed again; Send a bus preemption request to the gateway again and restart the timing.
8. A data processing device, arranged in an expansion device, comprising: A module for executing the data processing method according to any one of claims 1 to 7.
9. A data processing device, comprising: Memory; as well as A processor coupled to the memory, wherein the processor is configured to execute the data processing method according to any one of claims 1 to 7 based on instructions stored in the memory.
10. A gateway system, comprising: A plurality of expansion devices, each expansion device comprising a data processing apparatus as claimed in claim 8 or 9; A gateway, connected to the plurality of expansion devices, and configured to: receive bus preemption requests sent by the plurality of expansion devices, wherein the bus preemption requests carry the priority of the data frame to be sent; Generate a bus preemption response according to the priority of the data frame to be sent; The bus preemption response is sent to the plurality of expansion devices.
11. The gateway system according to claim 10, wherein: The bus preemption request also carries the address code of the expansion device, and the gateway generates a bus preemption response according to the priority allocation of the data frame to be sent, including: A bus preemption response is generated according to the priority of the data frame to be sent and the address code of the expansion device.
12. A computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, implement the data processing method as described in any one of claims 1 to 7.
13. A computer program product having computer program instructions stored thereon, wherein the instructions are executed by a processor to implement the data processing method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Bus conflict avoiding method and device
CN112217701A
Data processing method and system for hybrid access of multi-protocol Internet of Things terminal to RS485 bus
CN112489409A
Data transmission method and device
CN117939691A
Information processor, monitoring method, program, and gateway device
JP2019209961A