A data collection method, device, equipment and storage medium
By adaptively adjusting the cache area capacity of the DAQ module and allocating it according to the capacity and cycle of the data acquisition module, the problems of overloading the cache area and waste of resources are solved, and the reliability and real-time nature of data acquisition are improved.
Patent Information
- Application Number
- CN202210657655.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2022-02-17
- Filing Date
- 2022-06-10
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2042-06-10
AI Technical Summary
In automotive electronic control systems, the size of the data cache area of the DAQ module is fixed, resulting in modules with short acquisition cycles that are prone to saturation and overload, while modules with long acquisition cycles are wasted resources, which cannot effectively solve the utilization problem of the cache area.
By acquiring the module data capacity and data acquisition cycle of multiple data acquisition modules, adaptive cache allocation is performed based on the capacity of the preset acquisition cache area, and the cache area of each data acquisition module is determined to ensure that the target acquisition is effectively stored when the associated event is triggered. data.
It improves the utilization rate of the cache area, improves the reliability and real-timeness of the data acquisition method, and avoids the overload problem of the cache area.
Smart Images

Figure CN115097751B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic control technology, and in particular to a data acquisition method, device, equipment and storage medium. Background Art
[0002] In the development process of automotive electronic control systems, the XCP protocol (Universal Calibration Protocol) is widely used. The XCP protocol designs a periodic data acquisition mechanism based on DAQ (synchronous data transmission). Every DAQ module acquisition cycle, the acquired data obtained after the acquisition of the data to be acquired in the DAQ module is completed will be temporarily stored in the data buffer corresponding to the DAQ module and wait to be sent to the host computer. If the acquired data in the data buffer has not been sent in time and the new acquired data is continuously stored in the data buffer, the buffer will be saturated, resulting in the inability to temporarily store the new acquired data and thus being discarded. This is the DAQ overload phenomenon.
[0003] At present, the data buffer size of each DAQ module is fixed and cannot be adjusted adaptively, resulting in a contradictory situation in which the buffer of the DAQ module with a short acquisition cycle is easily saturated and overloaded during the actual measurement process, while the buffer resources of the DAQ module with a long sampling cycle are wasted in large quantities. Therefore, a more reliable data acquisition method needs to be provided. Summary of the invention
[0004] The present application provides a data acquisition method, device, equipment and storage medium, which can improve the utilization rate of the cache area and effectively alleviate the overload problem of the cache area during high-speed transmission of target acquisition data, thereby improving the reliability and real-time performance of the data acquisition method.
[0005] The technical solution of this application is as follows:
[0006] In one aspect, a data collection method is provided, the method comprising:
[0007] Obtain module data capacity and data acquisition cycle corresponding to multiple data acquisition modules;
[0008] According to the preset data capacity of the preset acquisition cache area, the module data capacity and the data acquisition cycle, cache allocation is performed on the multiple data acquisition modules to determine the cache areas corresponding to the multiple data acquisition modules respectively;
[0009] When the associated events corresponding to the multiple data acquisition modules are triggered, the data to be collected in the associated events are collected according to the data collection information in the multiple data acquisition modules to obtain the target collection data corresponding to the multiple data acquisition modules;
[0010] The target acquisition data is stored in the cache areas corresponding to each of the multiple data acquisition modules.
[0011] In another aspect, a data acquisition device is provided, the device comprising:
[0012] An acquisition module is used to acquire module data capacity and data acquisition cycle corresponding to multiple data acquisition modules;
[0013] A cache allocation module, configured to allocate cache to the plurality of data acquisition modules according to a preset data capacity of a preset acquisition cache area, the module data capacity and the data acquisition cycle, and determine the cache areas corresponding to the plurality of data acquisition modules respectively;
[0014] A data acquisition module, configured to, when the associated events corresponding to the multiple data acquisition modules are triggered, respectively acquire the data to be acquired in the associated events according to the data acquisition information in the multiple data acquisition modules, and obtain the target acquisition data corresponding to the multiple data acquisition modules;
[0015] The data storage module is used to store the target collected data into the cache areas corresponding to the multiple data collection modules respectively.
[0016] On the other hand, a data acquisition device is provided, which includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the data acquisition method as described above.
[0017] On the other hand, a computer-readable storage medium is provided, wherein at least one instruction or at least one program is stored in the storage medium, and the at least one instruction or the at least one program is loaded and executed by a processor to implement the data acquisition method as described above.
[0018] The data collection method, device, equipment and storage medium provided by this application have the following technical effects:
[0019] By utilizing the technical solution provided by the present application, the module data capacity and data acquisition cycle corresponding to multiple data acquisition modules are obtained; then, according to the preset data capacity of the preset acquisition cache area, the module data capacity and the data acquisition cycle, the cache allocation is performed on the multiple data acquisition modules to determine the cache areas corresponding to the multiple data acquisition modules; then, when the associated events corresponding to the multiple data acquisition modules are triggered, according to the data acquisition information in the multiple data acquisition modules, the data to be collected in the associated events are respectively collected to obtain the target acquisition data corresponding to the multiple data acquisition modules; finally, the target acquisition data is stored in the cache areas corresponding to the multiple data acquisition modules, and by adaptively adjusting the capacity of the cache area of the data acquisition module, the utilization rate of the cache area can be improved, and the overload problem of the cache area during high-speed transmission of the target acquisition data can be effectively alleviated, thereby improving the reliability and real-time performance of the data acquisition method. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0021] Figure 1 It is a flow chart of a data collection method provided in an embodiment of the present application;
[0022] Figure 2 The present invention provides a flow chart of allocating cache to multiple data acquisition modules and determining cache areas corresponding to the multiple data acquisition modules according to the preset data capacity, module data capacity and data acquisition cycle of the preset acquisition cache area.
[0023] Figure 3 It is a flow chart of determining the second allocation ratio information of the currently traversed data acquisition module based on the current data capacity of the preset acquisition cache area provided by an embodiment of the present application;
[0024] Figure 4 This is another flowchart of determining the second allocation ratio information of the currently traversed data acquisition module based on the current data capacity of the preset acquisition cache area provided by an embodiment of the present application;
[0025] Figure 5 It is a flowchart of another data collection method provided in an embodiment of the present application;
[0026] Figure 6It is a flow chart of updating the cache areas of multiple data acquisition modules based on releasing cache capacity and adjusting information of a second preset ratio provided by an embodiment of the present application;
[0027] Figure 7 It is another flowchart of updating the cache areas of multiple data acquisition modules based on releasing cache capacity and adjusting information of a second preset ratio provided by an embodiment of the present application;
[0028] Figure 8 It is a schematic diagram of a data acquisition device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0029] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0031] The following describes a data collection method provided by an embodiment of the present application. Figure 1 A flow chart of a data acquisition method provided for an embodiment of the present application. It should be noted that this specification provides method operation steps as described in the embodiment or flow chart, but more or fewer operation steps may be included based on conventional or non-creative labor. The order of steps listed in the embodiment is only one way of executing the steps among many orders, and does not represent the only order of execution. When the actual system or product is executed, it can be executed in the order shown in the embodiment or the drawings or in parallel (for example, in a parallel processor or multi-threaded processing environment). Specifically, as Figure 1 As shown, the above method may include:
[0032] S101, obtaining module data capacity and data collection period corresponding to multiple data collection modules.
[0033] In actual applications, the vehicle-mounted terminal receives the data acquisition module setting instructions sent by the host computer. The above data acquisition module setting instructions carry the module data capacity and data acquisition cycle corresponding to multiple data acquisition modules. The vehicle-mounted terminal responds to the data acquisition module setting instructions and sets multiple data acquisition modules based on the module data capacity and data acquisition cycle corresponding to the multiple data acquisition modules.
[0034] In a specific embodiment, the data acquisition module may be a DAQ module under a DAQ data acquisition mechanism, and each data acquisition module may include at least one ODT (Object Descriptor Table), and each ODT may record data acquisition information, wherein the data acquisition information may include: data addresses and data lengths corresponding to a plurality of data to be collected. Specifically, the module data capacity of the data acquisition module may be measured based on the number of ODTs in the data acquisition module. For example, in the case where a data acquisition module includes 2 ODTs, the module data capacity of the data acquisition module may be: 2 ODTs.
[0035] S103, performing cache allocation for multiple data acquisition modules according to the preset data capacity of the preset acquisition cache area, the module data capacity and the data acquisition cycle, and determining the cache areas corresponding to the multiple data acquisition modules.
[0036] In the embodiments of the present specification, the preset acquisition cache area can be used to store the target acquisition data obtained after respectively acquiring the data to be acquired in the associated events corresponding to the multiple data acquisition modules. In practical applications, the preset acquisition cache area can be allocated to determine the cache area corresponding to each data acquisition module, and the cache area corresponding to each data acquisition module can be used to store the target acquisition data corresponding to each data acquisition module.
[0037] Specifically, under the DAQ data acquisition mechanism, the preset acquisition cache area may include a plurality of cache ODTs, and the plurality of cache ODTs are allocated to a plurality of data acquisition modules, thereby determining at least one cache ODT corresponding to each data acquisition module.
[0038] In the embodiments of this specification, Figure 2 As shown, the cache allocation for multiple data acquisition modules is performed according to the preset data capacity, module data capacity and data acquisition cycle of the preset acquisition cache area, and the cache area corresponding to each of the multiple data acquisition modules is determined to include:
[0039] S201, determining first allocation ratio information based on a preset data capacity and a sum of module data capacities of a plurality of data acquisition modules.
[0040] Specifically, the first allocation ratio information can be used to measure the ratio of the preset data capacity to the sum of the module data capacities of multiple data acquisition modules. Considering that the data contained in an ODT is packaged as a frame message for transmission in actual applications, the first allocation ratio information generally takes the integer value of the ratio of the preset data capacity to the sum of the module data capacities of multiple data acquisition modules, and discards the decimal part.
[0041] S203: When the first allocation ratio information satisfies a preset condition, traverse multiple data collection modules based on the ascending order of the data collection cycle.
[0042] In a specific embodiment, the preset condition may be that the first allocation ratio information is greater than or equal to 1. Specifically, when the first allocation ratio information is greater than or equal to 1, the preset data capacity is greater than or equal to the sum of the module data capacities of multiple data acquisition modules, and cache allocation can be performed; when the first allocation ratio information is less than 1, the preset data capacity is less than the sum of the module data capacities of multiple data acquisition modules, that is, the preset acquisition cache area cannot accommodate the target acquisition data obtained after the data to be collected in any associated event of the multiple data acquisition modules is collected, and therefore, the vehicle terminal reports an error and stops data acquisition.
[0043] S205, based on the current data capacity of the preset acquisition cache area, determine the second allocation ratio information of the currently traversed data acquisition module, the current data capacity is the difference between the preset data capacity and the sum of the cache area capacity of the first data acquisition module, and the first data acquisition module is a data acquisition module traversed before the currently traversed data acquisition module among multiple data acquisition modules.
[0044] Specifically, the second allocation ratio information may be a cache allocation ratio of the corresponding data acquisition module. Generally, the second allocation ratio information may be an integer.
[0045] S207: Determine a cache area of the currently traversed data acquisition module based on the second allocation ratio information and the module data capacity of the currently traversed data acquisition module.
[0046] Specifically, the cache capacity of the cache area of the currently traversed data acquisition module is determined according to the product of the second allocation ratio information and the module data capacity of the currently traversed data acquisition module.
[0047] It can be seen from the above embodiments that cache allocation is performed on multiple data acquisition modules in sequence according to the ascending order of the data acquisition cycle and the module data capacity, thereby improving the flexibility of cache allocation and the utilization rate of the cache area.
[0048] In an optional embodiment, if Figure 3As shown, the second allocation ratio information of the currently traversed data acquisition module determined based on the current data capacity of the preset acquisition buffer area may include:
[0049] S301, determining the initial cache capacity of the currently traversed data acquisition module based on third allocation ratio information and the module data capacity of the currently traversed data acquisition module, wherein the third allocation ratio information is the sum of the first allocation ratio information and the first preset ratio adjustment information.
[0050] Specifically, the first preset ratio adjustment information can adjust the first allocation ratio information to obtain the third allocation ratio information. In practical applications, the first preset ratio adjustment information can be set according to the first allocation ratio information in practical applications. Generally, the first preset ratio adjustment information is an integer. Optionally, the first preset ratio adjustment information can be 1.
[0051] Specifically, the initial cache capacity of the currently traversed data acquisition module is determined according to the product of the third allocation ratio information and the module data capacity of the currently traversed data acquisition module.
[0052] S303, when the difference between the current data capacity and the initial cache capacity is greater than or equal to the sum of the module data capacities of the second data acquisition module, the third allocation ratio information is used as the second allocation ratio information, and the second data acquisition module is an untraversed data acquisition module among the multiple data acquisition modules.
[0053] Specifically, the difference between the current data capacity and the initial cache capacity is greater than or equal to the sum of the module data capacities of the data acquisition modules that have not been traversed, that is, after completing the cache allocation of the currently traversed data acquisition module with the third allocation ratio information, the remaining data capacity of the preset acquisition cache area can accommodate the target acquisition data of the data acquisition modules that have not been traversed. Therefore, the third allocation ratio information is used as the second allocation ratio information of the currently traversed data acquisition module.
[0054] In another optional embodiment, Figure 4 As shown, after determining the initial cache capacity of the currently traversed data acquisition module based on the third allocation ratio information and the module data capacity of the currently traversed data acquisition module, the method may further include:
[0055] S305: When the difference between the current data capacity and the initial cache capacity is smaller than the sum of the module data capacities of the second data acquisition modules, the first allocation ratio information is used as the second allocation ratio information.
[0056] Specifically, the difference between the current data capacity and the initial cache capacity is smaller than the sum of the module data capacities of the data acquisition modules that have not been traversed, that is, after the cache allocation of the currently traversed data acquisition module is completed with the third allocation ratio information, the remaining data capacity of the preset acquisition cache area cannot accommodate the target acquisition data of the data acquisition module that has not been traversed. Therefore, the first allocation ratio information is not adjusted, and the first allocation ratio information is directly used as the second allocation ratio information of the currently traversed data acquisition module.
[0057] Taking the preset data capacity of the preset acquisition buffer area as 16 ODTs as an example, the module data capacity and data acquisition cycle corresponding to the four data acquisition modules are shown in the following table:
[0058] Identification Information Data collection cycle Module data capacity Data acquisition module 0 10ms 2 ODTs Data acquisition module 1 20ms 4 ODTs Data acquisition module 2 50ms 3 ODTs Data acquisition module 3 100ms 2 ODTs
[0059] First, the first allocation ratio information is determined to be 16 / (2+4+3+2)=16 / 11=1.
[0060] According to the ascending order of the data acquisition cycle, the data acquisition module 0 is traversed first, so the cache area is allocated to the data acquisition module 0 first. Taking the first preset ratio adjustment information as 1 as an example, the third allocation ratio information of the data acquisition module 0 is 1+1=2, then the initial cache capacity of the data acquisition module 0 is (1+1)×2=4 ODTs. Because the difference between the current data capacity and the initial cache capacity is 12 ODTs, which is greater than the sum of the module data capacities of the data acquisition modules that have not been traversed, that is, 4+3+2=9 ODTs, therefore, the third allocation ratio information 2 is used as the second allocation ratio information of the data acquisition module 0, and the cache capacity of the cache area of the data acquisition module 0 is 2×2=4 ODTs.
[0061] Next, traverse the data acquisition module 1 and allocate a cache area for the data acquisition module 1. The third allocation ratio information of the data acquisition module 1 is 2, and the initial cache capacity is (1+1)×4=8 ODTs. At this time, the current data capacity is 16-4=12 ODTs, and the difference between the current data capacity and the initial cache capacity is 4 ODTs, which is less than the sum of the module data capacities of the data acquisition modules that have not been traversed, that is, 3+2=5 ODTs. Therefore, the first allocation ratio information 1 is used as the second allocation ratio information of the data acquisition module 1, and the cache capacity of the cache area of the data acquisition module 1 is 1×4=4 ODTs.
[0062] By analogy, the final allocation of the cache areas of the four data acquisition modules is shown in the following table:
[0063]
[0064] It can be seen from the above embodiments that by comprehensively considering the cache allocation of the currently traversed data acquisition module and the cache allocation of the untraversed data acquisition modules, the rationality and universality of the cache allocation are improved, thereby improving the utilization rate of the cache area.
[0065] S105, when the associated events corresponding to the multiple data acquisition modules are triggered, data to be collected in the associated events are collected respectively according to the data collection information in the multiple data acquisition modules to obtain the target collection data corresponding to the multiple data acquisition modules.
[0066] In a specific embodiment, the data acquisition information may include: the data length and data address corresponding to the data to be acquired. According to the data acquisition information in the multiple data acquisition modules, the data to be acquired in the associated event are acquired respectively, and the target acquisition data corresponding to the multiple data acquisition modules may include:
[0067] According to the data lengths and data addresses corresponding to the data to be collected in the multiple data collection modules, data collection is performed on the data to be collected in the associated events respectively to obtain the target collection data corresponding to the multiple data collection modules.
[0068] In a specific embodiment, before respectively collecting data to be collected in the associated event according to the data lengths and data addresses corresponding to the data to be collected in the multiple data collection modules to obtain the target collection data corresponding to the multiple data collection modules, the method may further include:
[0069] 1) Receive a data acquisition request sent by the host computer, which carries the data length, data address and data acquisition cycle corresponding to the data to be collected;
[0070] 2) in response to the data collection request, adding the data length and data address corresponding to the data to be collected to the data collection module corresponding to the data collection period of the data to be collected;
[0071] 3) Based on the data lengths and data addresses corresponding to the data to be collected in the multiple data collection modules, the associated events corresponding to the multiple data collection modules are determined respectively.
[0072] Specifically, the associated event of each data acquisition module occurs once every corresponding data acquisition period. In an optional embodiment, multiple data acquisition modules with the same data acquisition period may correspond to the same associated event.
[0073] S107, storing the target collected data into the cache areas corresponding to the multiple data collection modules.
[0074] In a specific embodiment, after storing the target acquisition data in the cache areas corresponding to the multiple data acquisition modules, the method may further include: sending the target acquisition data in the cache areas to the host computer respectively.
[0075] It can be seen from the above embodiments that in response to the associated events occurring every data acquisition cycle, data acquisition is performed on the data to be collected in the associated events according to the data length and data address corresponding to the data to be collected in multiple data acquisition modules, and the target acquisition data corresponding to the multiple data acquisition modules are obtained. The target acquisition data is stored in the corresponding cache area and sent to the host computer, thereby improving the real-time and reliability of data acquisition.
[0076] In a specific embodiment, when the overload times of the cache area of the third data acquisition module exceeds a preset threshold, the third data acquisition module is any one of the multiple data acquisition modules, such as Figure 5 As shown, the above method may also include:
[0077] S109, obtaining a released cache capacity of a preset acquisition cache area, where the released cache capacity is a difference between a preset data capacity and a sum of cache area capacities of multiple data acquisition modules.
[0078] S111, updating the cache areas of multiple data acquisition modules based on the released cache capacity and the second preset ratio adjustment information.
[0079] Specifically, the above preset threshold can be preset in combination with the overload situation of the data cache module and the cache adjustment requirement in actual application.
[0080] Specifically, the second preset ratio adjustment information can be used to adjust the second allocation ratio information, thereby updating the cache area of the data acquisition module. Optionally, the second preset ratio adjustment information can be the same value as the first preset ratio adjustment information, or the second preset ratio adjustment information can be set separately in combination with the overload condition of the cache area of the third data acquisition module in actual application. Generally, the second preset ratio adjustment information is an integer.
[0081] It can be seen from the above embodiments that when the number of overload times of the cache area of a data acquisition module exceeds a preset threshold, the cache areas of multiple data acquisition modules are updated based on the released cache capacity of the preset acquisition cache area and the second preset ratio adjustment information, thereby improving the flexibility and rationality of the cache area update and effectively alleviating the overload problem of the cache area.
[0082] In an optional embodiment, if Figure 6 As shown, the updating of the cache areas of the plurality of data acquisition modules based on the released cache capacity and the second preset ratio adjustment information may include:
[0083] S601, determining a cache adjustment capacity of a third data acquisition module based on the module data capacity of the third data acquisition module and second preset ratio adjustment information.
[0084] Specifically, the cache adjustment capacity of the third data acquisition module is determined based on the product of the module data capacity of the third data acquisition module and the second preset ratio adjustment information.
[0085] S603, when the cache adjustment capacity of the third data acquisition module is less than or equal to the released cache capacity, based on the cache adjustment capacity of the third data acquisition module, increase the data capacity of the cache area of the third data acquisition module to obtain the target cache capacity of the third data acquisition module.
[0086] S605 , based on the target cache capacity of the third data acquisition module, updating the cache area of the third data acquisition module to obtain an updated cache area of the third data acquisition module.
[0087] Specifically, when the cache adjustment capacity of the third data acquisition module is less than or equal to the released cache capacity, the released cache capacity of the preset acquisition cache area can meet the cache adjustment requirements of the third data acquisition module. Therefore, based on the cache adjustment capacity of the third data acquisition module, the data capacity of the cache area of the third data acquisition module is increased, thereby updating the cache area of the third data acquisition module.
[0088] In another optional embodiment, when the cache adjustment capacity of the third data acquisition module is greater than the released cache capacity, the released cache capacity of the preset acquisition cache area cannot meet the cache adjustment requirements of the third data acquisition module. Therefore, by adjusting the cache area of the data acquisition module that is not overloaded, more cache capacity is released to update the cache area of the third data acquisition module. Specifically, Figure 7 As shown, after determining the cache adjustment capacity of the third data acquisition module based on the module data capacity of the third data acquisition module and the second preset ratio adjustment information, the method may further include:
[0089] S607, when the cache adjustment capacity of the third data acquisition module is greater than the released cache capacity, the data acquisition modules that are not overloaded among the multiple data acquisition modules are sorted based on the descending order of the data acquisition cycle to obtain the target data acquisition module.
[0090] S609: Determine a cache adjustment capacity of the first data acquisition module in the target data acquisition module based on the module data capacity of the first data acquisition module and the second preset ratio adjustment information.
[0091] Specifically, the cache adjustment capacity of the first data acquisition module is determined based on the product of the module data capacity of the first data acquisition module and the second preset ratio adjustment information.
[0092] S611, based on the cache adjustment capacity of the first data acquisition module, reduce the data capacity of the cache area of the first data acquisition module to obtain the target cache capacity of the first data acquisition module.
[0093] S613: Based on the target cache capacity of the first data acquisition module, the cache area of the first data acquisition module is updated to obtain an updated cache area of the first data acquisition module.
[0094] S615, based on the cache adjustment capacity of the first data acquisition module, update the released cache capacity to obtain the updated released cache capacity.
[0095] S617, based on the first data acquisition module, update the target data acquisition module to obtain an updated target data acquisition module.
[0096] S619, based on the updated target data acquisition module, repeatedly execute the descending order based on the data acquisition cycle, sort the data acquisition modules that are not overloaded among the multiple data acquisition modules, obtain the target data acquisition module to the cache adjustment capacity based on the first data acquisition module, update the released cache capacity, and obtain the updated capacity update step of the released cache capacity, until the cache adjustment capacity of the third data acquisition module is less than or equal to the current released cache capacity.
[0097] S621, based on the cache adjustment capacity of the third data acquisition module, increase the data capacity of the cache area of the third data acquisition module to obtain the target cache capacity of the third data acquisition module.
[0098] S623: Based on the target cache capacity of the third data acquisition module, the cache area of the third data acquisition module is updated to obtain an updated cache area of the third data acquisition module.
[0099] Specifically, based on the descending order of the data acquisition cycles, the cache capacities of the data acquisition modules that are not overloaded among the multiple data acquisition modules are adjusted in sequence until the currently released cache capacity can meet the cache capacity adjustment demand of the third data acquisition module.
[0100] It can be seen from the above embodiments that, when the released cache capacity of the preset acquisition cache area can meet the cache adjustment demand of the overloaded data acquisition module, the cache capacity of the overloaded data acquisition module is directly increased; when the released cache capacity of the preset acquisition cache area cannot meet the cache adjustment demand of the overloaded data acquisition module, by adjusting the cache area of the data acquisition module that is not overloaded, more cache capacity is released to meet the cache adjustment demand of the overloaded data acquisition module, which can reasonably allocate cache resources, improve the flexibility of cache updates and the utilization rate of the cache area, thereby effectively alleviating the overload problem of the cache area.
[0101] It can be seen from the technical solution provided by the embodiments of the above specification that, on the one hand, by obtaining the module data capacity and data acquisition cycle corresponding to multiple data acquisition modules, traversing multiple data acquisition modules according to the ascending order of the data acquisition cycle and the module data capacity, comprehensively considering the cache allocation of the currently traversed data acquisition module and the cache allocation of the untraversed data acquisition modules, the flexibility and universality of the cache allocation are improved, thereby improving the utilization rate of the cache area; on the other hand, when the overload number of the cache area of a data acquisition module exceeds the preset threshold, the cache capacity of the overloaded data acquisition module is directly increased when the released cache capacity of the preset acquisition cache area can meet the cache adjustment demand of the overloaded data acquisition module; the released cache capacity of the preset acquisition cache area When the cache adjustment demand of the overloaded data acquisition module cannot be met, by adjusting the cache area of the data acquisition module that is not overloaded, more cache capacity is released to meet the cache adjustment demand of the overloaded data acquisition module, which can reasonably allocate cache resources, improve the flexibility of cache update and the utilization rate of the cache area, thereby effectively alleviating the overload problem of the cache area; on the other hand, in response to the associated events occurring every data acquisition cycle, data collection is performed on the data to be collected in the associated events according to the data length and data address corresponding to the data to be collected in multiple data acquisition modules, and the target collection data corresponding to the multiple data acquisition modules are obtained, the target collection data is stored in the corresponding cache area, and sent to the host computer, thereby improving the real-time and reliability of data collection.
[0102] The present application embodiment provides a data acquisition device, such as Figure 8 As shown, the above device may include:
[0103] An acquisition module 810 is used to acquire module data capacity and data acquisition cycle corresponding to a plurality of data acquisition modules;
[0104] The cache allocation module 820 is used to allocate cache to multiple data acquisition modules according to the preset data capacity of the preset acquisition cache area, the module data capacity and the data acquisition cycle, and determine the cache areas corresponding to the multiple data acquisition modules;
[0105] The data acquisition module 830 is used to respectively acquire the data to be acquired in the associated events according to the data acquisition information in the multiple data acquisition modules when the associated events corresponding to the multiple data acquisition modules are triggered, so as to obtain the target acquisition data corresponding to the multiple data acquisition modules;
[0106] The data storage module 840 is used to store the target collected data into the cache areas corresponding to the multiple data collection modules.
[0107] In the embodiment of this specification, the cache allocation module 820 may include:
[0108] A first allocation ratio information unit, used to determine first allocation ratio information based on a sum of a preset data capacity and module data capacities of a plurality of data acquisition modules;
[0109] A traversal unit, configured to traverse the plurality of data acquisition modules based on an ascending order of the data acquisition cycle when the first allocation ratio information satisfies a preset condition;
[0110] A second allocation ratio information unit is used to determine the second allocation ratio information of the currently traversed data acquisition module based on the current data capacity of the preset acquisition cache area, the current data capacity being the difference between the preset data capacity and the sum of the cache area capacity of the first data acquisition module, the first data acquisition module being a data acquisition module traversed before the currently traversed data acquisition module among the multiple data acquisition modules;
[0111] The cache area determination unit is used to determine the cache area of the currently traversed data acquisition module based on the second allocation ratio information and the module data capacity of the currently traversed data acquisition module.
[0112] In an optional embodiment, the second allocation ratio information unit may include:
[0113] an initial cache capacity determination unit, configured to determine the initial cache capacity of the currently traversed data acquisition module based on third allocation ratio information and the module data capacity of the currently traversed data acquisition module, wherein the third allocation ratio information is the sum of the first allocation ratio information and the first preset ratio adjustment information;
[0114] The first allocation ratio determination unit is used to use the third allocation ratio information as the second allocation ratio information when the difference between the current data capacity and the initial cache capacity is greater than or equal to the sum of the module data capacities of the second data acquisition module, and the second data acquisition module is an untraversed data acquisition module among multiple data acquisition modules.
[0115] In another optional embodiment, the second allocation ratio information unit may further include:
[0116] The second allocation ratio determination unit is used to use the first allocation ratio information as the second allocation ratio information when the difference between the current data capacity and the initial cache capacity is smaller than the sum of the module data capacities of the second data acquisition modules.
[0117] In a specific embodiment, the above device may further include:
[0118] The target acquisition data sending module is used to send the target acquisition data in the buffer area to the host computer respectively.
[0119] In a specific embodiment, when the number of overload times of the cache area of the third data acquisition module exceeds a preset threshold, the third data acquisition module is any one of the multiple data acquisition modules, and the above device may further include:
[0120] A released cache capacity acquisition module is used to acquire the released cache capacity of a preset acquisition cache area, where the released cache capacity is the difference between the preset data capacity and the sum of the cache area capacities of multiple data acquisition modules;
[0121] The cache area update module is used to update the cache areas of multiple data acquisition modules based on the released cache capacity and the second preset ratio adjustment information.
[0122] In an optional embodiment, the cache area update module may include:
[0123] a first cache adjustment capacity determination unit, configured to determine a cache adjustment capacity of the third data acquisition module based on the module data capacity of the third data acquisition module and the second preset ratio adjustment information;
[0124] A first target cache capacity unit is used to increase the data capacity of the cache area of the third data acquisition module based on the cache adjustment capacity of the third data acquisition module to obtain a target cache capacity of the third data acquisition module when the cache adjustment capacity of the third data acquisition module is less than or equal to the released cache capacity;
[0125] The first cache area updating unit is used to update the cache area of the third data acquisition module based on the target cache capacity of the third data acquisition module to obtain the updated cache area of the third data acquisition module.
[0126] In another optional embodiment, the cache area update module may further include:
[0127] a target data acquisition module unit, for sorting the data acquisition modules that are not overloaded among the multiple data acquisition modules based on the descending order of the data acquisition cycles to obtain the target data acquisition module when the cache adjustment capacity of the third data acquisition module is greater than the released cache capacity;
[0128] A second cache adjustment capacity determination unit, configured to determine a cache adjustment capacity of the first data acquisition module in the target data acquisition module based on the module data capacity of the first data acquisition module and the second preset ratio adjustment information;
[0129] A second target cache capacity unit is used to reduce the data capacity of the cache area of the first data acquisition module based on the cache adjustment capacity of the first data acquisition module to obtain a target cache capacity of the first data acquisition module;
[0130] A second cache area updating unit is used to update the cache area of the first data acquisition module based on the target cache capacity of the first data acquisition module to obtain an updated cache area of the first data acquisition module;
[0131] A released cache capacity updating unit, used to update the released cache capacity based on the cache adjustment capacity of the first data acquisition module to obtain an updated released cache capacity;
[0132] A target data acquisition module updating unit, used to update the target data acquisition module based on the first data acquisition module to obtain an updated target data acquisition module;
[0133] A repeating execution unit is used to repeatedly execute the descending order based on the data acquisition cycle based on the updated target data acquisition module, sort the data acquisition modules that are not overloaded among the multiple data acquisition modules, obtain the target data acquisition module to the cache adjustment capacity based on the first data acquisition module, update the released cache capacity, and obtain the updated released cache capacity capacity update step, until the cache adjustment capacity of the third data acquisition module is less than or equal to the current released cache capacity;
[0134] A third target cache capacity unit, configured to increase the data capacity of the cache area of the third data acquisition module based on the cache adjustment capacity of the third data acquisition module, and obtain a target cache capacity of the third data acquisition module;
[0135] The third cache area update unit is used to update the cache area of the third data acquisition module based on the target cache capacity of the third data acquisition module to obtain the updated cache area of the third data acquisition module.
[0136] It should be noted that the device and method embodiments in the device embodiment are based on the same inventive concept.
[0137] An embodiment of the present application provides a data acquisition device, which includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the data acquisition method provided in the above method embodiment.
[0138] The memory can be used to store software programs and modules. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, application programs required for functions, etc.; the data storage area can store data created according to the use of the above devices, etc. In addition, the memory can include a high-speed random access memory and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory can also include a memory controller to provide the processor with access to the memory.
[0139] The method embodiments provided in the embodiments of the present application can be executed in a vehicle-mounted terminal or a similar computing device, that is, the above-mentioned data acquisition equipment can include a vehicle-mounted terminal or a similar computing device.
[0140] An embodiment of the present application also provides a storage medium, which can be set in a data acquisition device to store at least one instruction or at least one program related to a data acquisition method for implementing a method embodiment. The at least one instruction or the at least one program is loaded and executed by the processor to implement the data acquisition method provided by the above method embodiment.
[0141] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.
[0142] It can be seen from the above-mentioned embodiments of the data acquisition method, device, equipment or storage medium provided by the present application that, by utilizing the technical solution provided by the embodiments of the present specification, on the one hand, by obtaining the module data capacity and data acquisition cycle corresponding to multiple data acquisition modules, traversing multiple data acquisition modules according to the ascending order of the data acquisition cycle and the module data capacity, comprehensively considering the cache allocation of the currently traversed data acquisition module and the cache allocation of the untraversed data acquisition modules, the flexibility and universality of the cache allocation are improved, thereby improving the utilization rate of the cache area; on the other hand, when the overload times of the cache area of a data acquisition module exceeds a preset threshold, the cache capacity of the overloaded data acquisition module is directly increased when the released cache capacity of the preset acquisition cache area can meet the cache adjustment requirements of the overloaded data acquisition module; in When the released cache capacity of the preset acquisition cache area cannot meet the cache adjustment demand of the overloaded data acquisition module, by adjusting the cache area of the data acquisition module that is not overloaded, more cache capacity is released to meet the cache adjustment demand of the overloaded data acquisition module, which can reasonably allocate cache resources, improve the flexibility of cache update and the utilization rate of the cache area, thereby effectively alleviating the overload problem of the cache area; on the other hand, in response to the associated events occurring every data acquisition cycle, data collection is performed on the data to be collected in the associated events according to the data length and data address corresponding to the data to be collected in multiple data acquisition modules, and the target collection data corresponding to the multiple data acquisition modules are obtained, the target collection data is stored in the corresponding cache area, and sent to the host computer, thereby improving the real-time and reliability of data collection.
[0143] It should be noted that the above-mentioned sequence of the embodiments of the present application is for description only and does not represent the advantages and disadvantages of the embodiments. The above-mentioned specific embodiments of this specification are described. Other embodiments are within the scope of the attached claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0144] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment and storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0145] A person skilled in the art will appreciate that all or part of the steps to implement the above embodiments may be accomplished by hardware, or may be accomplished by instructing the relevant hardware through a program, and the above program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0146] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A data collection method, characterized in that: The method comprises: Obtain module data capacity and data acquisition cycle corresponding to multiple data acquisition modules; In the case where the first allocation ratio information satisfies a preset condition, traversing the plurality of data acquisition modules based on the ascending order of the data acquisition cycle, the first allocation ratio information being determined based on the sum of a preset data capacity of a preset acquisition buffer area and a module data capacity of the plurality of data acquisition modules; Based on the current data capacity of the preset acquisition cache area, determining the second allocation ratio information of the currently traversed data acquisition module, wherein the current data capacity is the difference between the preset data capacity and the sum of the cache area capacity of the first data acquisition module, and the first data acquisition module is a data acquisition module traversed before the currently traversed data acquisition module among the multiple data acquisition modules; Determining a cache area of the currently traversed data acquisition module based on the second allocation ratio information and the module data capacity of the currently traversed data acquisition module; When the associated events corresponding to the multiple data acquisition modules are triggered, the data to be collected in the associated events are collected according to the data collection information in the multiple data acquisition modules to obtain the target collection data corresponding to the multiple data acquisition modules; storing the target acquisition data in the cache areas corresponding to the multiple data acquisition modules; When the overload times of the cache area of the third data acquisition module exceeds a preset threshold, the cache areas of the multiple data acquisition modules are updated based on the released cache capacity of the preset acquisition cache area and the second preset ratio adjustment information, the third data acquisition module is any data acquisition module among the multiple data acquisition modules, and the released cache capacity is the difference between the preset data capacity and the sum of the cache area capacities of the multiple data acquisition modules.
2. The method according to claim 1, characterized in that The determining, based on the current data capacity of the preset acquisition buffer area, second allocation ratio information of the currently traversed data acquisition module comprises: Determine the initial cache capacity of the currently traversed data acquisition module based on third allocation ratio information and the module data capacity of the currently traversed data acquisition module, wherein the third allocation ratio information is the sum of the first allocation ratio information and the first preset ratio adjustment information; When the difference between the current data capacity and the initial cache capacity is greater than or equal to the sum of the module data capacities of the second data acquisition module, the third allocation ratio information is used as the second allocation ratio information, and the second data acquisition module is an untraversed data acquisition module among the multiple data acquisition modules.
3. The method according to claim 2, characterized in that After determining the initial cache capacity of the currently traversed data acquisition module based on the third allocation ratio information and the module data capacity of the currently traversed data acquisition module, the method further includes: When the difference between the current data capacity and the initial cache capacity is smaller than the sum of the module data capacities of the second data acquisition modules, the first allocation ratio information is used as the second allocation ratio information.
4. The method according to claim 1, characterized in that: The updating of the cache areas of the plurality of data acquisition modules based on the released cache capacity of the preset acquisition cache area and the second preset ratio adjustment information comprises: Determining a cache adjustment capacity of the third data acquisition module based on the module data capacity of the third data acquisition module and the second preset ratio adjustment information; In a case where the cache adjustment capacity of the third data acquisition module is less than or equal to the released cache capacity, based on the cache adjustment capacity of the third data acquisition module, the data capacity of the cache area of the third data acquisition module is increased to obtain the target cache capacity of the third data acquisition module; Based on the target cache capacity of the third data acquisition module, the cache area of the third data acquisition module is updated to obtain an updated cache area of the third data acquisition module.
5. The method according to claim 4, characterized in that After determining the cache adjustment capacity of the third data acquisition module based on the module data capacity of the third data acquisition module and the second preset ratio adjustment information, the method further includes: In the case where the cache adjustment capacity of the third data acquisition module is greater than the released cache capacity, based on the descending order of the data acquisition cycles, the data acquisition modules that are not overloaded among the multiple data acquisition modules are sorted to obtain a target data acquisition module; Determining a cache adjustment capacity of a first data acquisition module in the target data acquisition module based on the module data capacity of the first data acquisition module and the second preset ratio adjustment information; Based on the cache adjustment capacity of the first data acquisition module, reducing the data capacity of the cache area of the first data acquisition module to obtain the target cache capacity of the first data acquisition module; Based on the target cache capacity of the first data acquisition module, the cache area of the first data acquisition module is updated to obtain an updated cache area of the first data acquisition module; Based on the cache adjustment capacity of the first data acquisition module, updating the released cache capacity to obtain an updated released cache capacity; Based on the first data acquisition module, updating the target data acquisition module to obtain an updated target data acquisition module; Based on the updated target data acquisition module, repeatedly executing the descending order based on the data acquisition cycle, sorting the data acquisition modules that are not overloaded among the multiple data acquisition modules, obtaining the target data acquisition module to the cache adjustment capacity based on the first data acquisition module, updating the released cache capacity, and obtaining the updated released cache capacity capacity update step, until the cache adjustment capacity of the third data acquisition module is less than or equal to the current released cache capacity; Based on the cache adjustment capacity of the third data acquisition module, increase the data capacity of the cache area of the third data acquisition module to obtain the target cache capacity of the third data acquisition module; Based on the target cache capacity of the third data acquisition module, the cache area of the third data acquisition module is updated to obtain an updated cache area of the third data acquisition module.
6. The method according to any one of claims 1 to 5, characterized in that: After storing the target acquisition data in the cache areas corresponding to the multiple data acquisition modules, the method further includes: The target acquisition data in the buffer area are sent to the host computer respectively.
7. A data acquisition device, characterized in that: The device comprises: An acquisition module is used to acquire module data capacity and data acquisition cycle corresponding to multiple data acquisition modules; A cache allocation module, used to traverse the multiple data acquisition modules based on the ascending order of the data acquisition cycle when the first allocation ratio information meets the preset conditions, the first allocation ratio information is determined based on the sum of the preset data capacity of the preset acquisition cache area and the module data capacity of the multiple data acquisition modules; based on the current data capacity of the preset acquisition cache area, determine the second allocation ratio information of the currently traversed data acquisition module, the current data capacity is the difference between the preset data capacity and the sum of the cache area capacity of the first data acquisition module, the first data acquisition module is the data acquisition module traversed before the currently traversed data acquisition module among the multiple data acquisition modules; based on the second allocation ratio information and the module data capacity of the currently traversed data acquisition module, determine the cache area of the currently traversed data acquisition module; A data acquisition module, configured to, when the associated events corresponding to the multiple data acquisition modules are triggered, respectively acquire the data to be acquired in the associated events according to the data acquisition information in the multiple data acquisition modules, and obtain the target acquisition data corresponding to the multiple data acquisition modules; A data storage module, used for storing the target collected data into the cache areas corresponding to the multiple data collection modules respectively; A cache area update module is used to update the cache areas of the multiple data acquisition modules based on the released cache capacity of the preset acquisition cache area and the second preset ratio adjustment information when the overload frequency of the cache area of the third data acquisition module exceeds a preset threshold. The third data acquisition module is any data acquisition module among the multiple data acquisition modules, and the released cache capacity is the difference between the preset data capacity and the sum of the cache area capacities of the multiple data acquisition modules.
8. A data acquisition device, characterized in that: The device includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the data acquisition method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the data acquisition method as described in any one of claims 1 to 6.
