CN111865328B - Compression method of environment data and related device - Google Patents

Compression method of environment data and related device Download PDF

Info

Publication number
CN111865328B
CN111865328B CN202010803816.3A CN202010803816A CN111865328B CN 111865328 B CN111865328 B CN 111865328B CN 202010803816 A CN202010803816 A CN 202010803816A CN 111865328 B CN111865328 B CN 111865328B
Authority
CN
China
Prior art keywords
preset
environment data
value
original environment
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010803816.3A
Other languages
Chinese (zh)
Other versions
CN111865328A (en
Inventor
王旬贵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhuhai Megain Technology Co ltd
Original Assignee
Zhuhai Megain Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhuhai Megain Technology Co ltd filed Critical Zhuhai Megain Technology Co ltd
Priority to CN202010803816.3A priority Critical patent/CN111865328B/en
Publication of CN111865328A publication Critical patent/CN111865328A/en
Application granted granted Critical
Publication of CN111865328B publication Critical patent/CN111865328B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
    • H03M7/70Type of the data to be coded, other than image and sound

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The embodiment of the application provides a compression method of environmental data and a related device, and relates to the field of data processing. The method comprises the following steps: acquiring original environment data; compressing the original environment data according to the original environment data and a preset precision value and a preset lower limit value corresponding to the original environment data to obtain an actual stored value; the number of bits of the actual stored value is less than the number of bits of the original environment data; storing the actual storage value into a preset storage space; the number of bits of the preset storage space is determined by a preset precision value, a preset lower limit value and a preset upper limit value corresponding to the original environment data. The original environment data are compressed according to the original environment data and the preset precision value and the preset lower limit value corresponding to the original environment data, and the actual stored value of which the digit is smaller than the original environment data is obtained, so that the original environment data can occupy the storage space as little as possible when being stored, the data size when being transmitted is reduced, and the purpose of improving the storage and transmission efficiency of the environment data is achieved.

Description

Compression method of environment data and related device
Technical Field
The present application relates to the field of data processing, and in particular, to a method and a related apparatus for compressing environmental data.
Background
The application range of the environment data acquisition device (for example, a temperature sensor, a humidity sensor, a light sensor and the like) based on wireless transmission is very wide. People also increasingly use the environment data acquisition devices to acquire various types of environment data.
The current environmental data acquisition device generally transmits data based on a low-power transmission mode such as bluetooth, so as to reduce the operation power and prolong the operation time.
However, when tens of KB (Kilobyte) or even hundreds of KB of data needs to be transmitted, the data transmission time of the current environment data acquisition apparatus is long.
Disclosure of Invention
The application aims to provide a compression method and a related device for environmental data, which can compress the environmental data and improve the storage and transmission efficiency of the environmental data.
The embodiment of the application can be realized as follows:
in a first aspect, an embodiment of the present application provides a method for compressing environment data, including: acquiring original environment data; compressing the original environment data according to the original environment data and a preset precision value and a preset lower limit value corresponding to the original environment data to obtain an actual stored value; the number of bits of the actual stored value is less than the number of bits of the original environment data; storing the actual storage value into a preset storage space; and the bit number of the preset storage space is determined by the preset precision value, the preset lower limit value and a preset upper limit value corresponding to the original environment data.
In an optional embodiment, the step of compressing the original environment data according to the original environment data, a preset precision value corresponding to the original environment data, and a preset lower limit value to obtain an actual storage value includes: according to a first formula
Figure BDA0002628365640000021
Compressing the original environment data to obtain the actual storage value; wherein f (real) is the original environment data, f (min) is the preset lower limit value, f (a) is the preset precision value, and F (flash) is the actual storage value.
In an optional embodiment, the determining the number of bits of the preset storage space includes: determining the maximum storage space occupied by the actual storage value according to the preset precision value, the preset lower limit value and the preset upper limit value; and determining the bit number of the preset storage space according to the maximum occupied storage space.
In an optional embodiment, the step of determining, according to the preset precision value, the preset lower limit value, and the preset upper limit value, a maximum storage space occupied by the actual storage value includes: according to a second formula
Figure BDA0002628365640000022
Determining a maximum occupied storage space for the actual storage value; wherein f (max) is the preset upper limit, f (min) is the preset lower limit, f (a) is the preset precision value, and f (flash max) is the preset maximum occupied storage space.
In an optional embodiment, the step of determining the number of bits of the preset storage space according to the maximum occupied storage space includes: according to a third formula F (capacity) log2(F (flash max)) +1, and determining the digit of the preset storage space; wherein, f (flash max) is the maximum occupied storage space, and f (capacity) is the number of bits of the preset storage space.
In an optional embodiment, before the step of storing the actual stored value in a preset storage space, the method further includes: and compressing the actual storage value according to a preset compression rule.
In a second aspect, an embodiment of the present application provides an apparatus for compressing environment data, including: the acquisition module is used for acquiring original environment data; the compression module is used for compressing the original environment data according to the original environment data, a preset precision value and a preset lower limit value corresponding to the original environment data to obtain an actual stored value; the number of bits of the actual stored value is less than the number of bits of the original environment data; the compression module is further used for storing the actual storage value into a preset storage space; and the bit number of the preset storage space is determined by the preset precision value, the preset lower limit value and a preset upper limit value corresponding to the original environment data.
In an alternative embodiment, the compression module is configured to compress the first image according to a first formula
Figure BDA0002628365640000031
Figure BDA0002628365640000032
Compressing the original environment data to obtain the actual storage value; wherein f (real) is the original environment data, f (min) is the preset lower limit value, f (a) is the preset precision value, and F (flash) is the actual storage value.
In an optional embodiment, the compression module is configured to determine, according to the preset precision value, the preset lower limit value, and the preset upper limit value, a maximum storage space occupied by the actual storage value; the compression module is further configured to determine the number of bits of the preset storage space according to the maximum occupied storage space.
In an alternative embodiment, the compression module is configured to compress the first image according to a second formula
Figure BDA0002628365640000033
Determining a maximum occupied storage of the actual storage valuesA space; wherein f (max) is the preset upper limit, f (min) is the preset lower limit, f (a) is the preset precision value, and f (flash max) is the preset maximum occupied storage space.
In an alternative embodiment, the compression module is configured to compress the third equation f (capacity) log2(F (flash max)) +1, and determining the digit of the preset storage space; wherein, f (flash max) is the maximum occupied storage space, and f (capacity) is the number of bits of the preset storage space.
In an optional embodiment, the compression module is configured to compress the actual storage value according to a preset compression rule.
In a third aspect, an embodiment of the present application provides an environmental data acquiring apparatus, including a processor and a memory, where the memory stores a computer program, and the processor implements the steps of the method in any one of the foregoing embodiments when executing the computer program.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the method of any one of the foregoing embodiments.
The beneficial effects of the embodiment of the application include: the original environment data are compressed according to the original environment data and the preset precision value and the preset lower limit value corresponding to the original environment data, and the actual stored value of which the digit is smaller than the original environment data is obtained, so that the original environment data can occupy the storage space as little as possible when being stored, the data size when being transmitted is reduced, and the purpose of improving the storage and transmission efficiency of the environment data is achieved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
Fig. 1 is a block diagram of an environment data acquiring apparatus according to an embodiment of the present application;
FIG. 2 is a flowchart of a method for compressing environment data according to an embodiment of the present disclosure;
fig. 3 is a flowchart of S210 of a method for compressing environment data according to an embodiment of the present application;
FIG. 4 is a flowchart illustrating how to determine the number of bits of the predetermined storage space according to an embodiment of the present disclosure;
fig. 5 is a flowchart of S300 and S310 of the method shown in fig. 4 according to an embodiment of the present disclosure;
fig. 6 is a functional block diagram of an apparatus for compressing environmental data according to an embodiment of the present application.
Icon: 100-an environmental data acquisition device; 110-a memory; 120-a processor; 400-compression means of environmental data; 410-an obtaining module; 420-compression module.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
Furthermore, the appearances of the terms "first," "second," and the like, if any, are used solely to distinguish one from another and are not to be construed as indicating or implying relative importance.
It should be noted that the features of the embodiments of the present application may be combined with each other without conflict.
In the implementation process of the embodiment of the present application, the inventors of the present application find that:
the current environment data acquisition devices based on wireless transmission (also referred to as environment data recording devices, such as temperature sensors, humidity sensors, illumination sensors, etc.) have bottlenecks in data transmission. When data transmission is performed above tens of KB or even hundreds of KB, the transmission time is long. For example, under an Android system, the transmission speed of an environmental data acquisition device based on BLE (Bluetooth Low Energy) is 40-50 kpbs. The transmission time of 200KB data is more than 40s, which obviously consumes much time and energy.
Moreover, the current environment data is usually stored by using floating point numbers and integer numbers. The floating point number is generally required to be used for storing environmental data such as temperature, salinity and rainfall, and the precision loss problem exists when the floating point number is used for storing the environmental data. For example, assuming that the value to be stored is 0.3, since precision is lost by using floating point storage, the actual stored environment data is 0.299999. At this time, when 0.299999 is stored in Flash, it is difficult to ensure that the environmental parameter data is compressed, and even the amount of the compressed data is larger than that of the original data.
For another example, as shown in table 1 below, the existing data structure usually uses 4bytes +2bytes to represent the temperature and humidity data. The temperature data is stored by adopting 4bytes floating point number, the precision is 0.1, and the range is-40 to 80; the humidity data is stored in a 2bytes short integer with a precision of 1 in the range of 0 to 100. It can be appreciated that temperature data is difficult to ensure that the data can be compressed due to the floating point storage, and humidity data is in the range of 0 to 100, so that 2Bytes of space is not actually needed, and 8 high bits are wasted. It can be seen that the current environmental data acquisition device has the problems of large data storage space occupation and long data transmission time due to the insufficient optimization of the storage form of the data structure.
TABLE 1
Temperature (4Bytes) Humidity (2Bytes)
Floating point number storage 16 bit shaped storage
Precision of 1f, range-40 to 80 The precision is 1, and the range is 0-100 RH%
Floating point number preservation Short and intact type preservation
In addition, most of the environmental data acquisition devices adopt a low-power-consumption design mode, so that high-bandwidth transmission is difficult to achieve at the data transmission speed. The method has the advantages that the effectiveness of the load is improved on the limited data transmission bandwidth, great benefits are achieved, the use efficiency of the environmental data acquisition equipment can be effectively improved, and unnecessary waiting time is saved.
In order to overcome the above drawbacks of the prior art, embodiments of the present application provide a method and a related apparatus for compressing environment data, which can compress the environment data and improve the efficiency of storing and transmitting the environment data.
It should be noted that all the defects of the above prior art solutions are the results of the careful practical study by the inventors, and therefore, the discovery process of the above problems and the solutions proposed by the following embodiments of the present application to the above problems should be the contribution of the inventors to the realization of the present application.
Referring to fig. 1, a block diagram of an environment data acquiring apparatus 100 according to an embodiment of the present disclosure is shown. The environmental data acquisition device 100 may be a temperature sensor, a humidity sensor, a light sensor, etc. with an infinite data transmission function, which is not limited in this application.
The environmental data acquisition device 100 may include a memory 110, a processor 120, the memory 110, the processor 120 and a communication interface electrically connected to each other, directly or indirectly, to enable transmission or interaction of data. For example, the components may be electrically connected to each other via one or more buses or signal lines. Processor 120 may process information and/or data related to the compression of environmental data to perform one or more of the functions described herein. For example, the processor 120 may obtain the raw environment data, and then implement the method for compressing the environment data provided by the present application.
The Memory 110 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like.
The processor 120 may be an integrated circuit chip having signal processing capabilities. The Processor 120 may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
It is to be understood that the configuration shown in fig. 1 is merely illustrative, and that the environment data acquiring apparatus 100 may further include more or fewer components than shown in fig. 1, or have a different configuration than shown in fig. 1. The components shown in fig. 1 may be implemented in hardware, software, or a combination thereof.
Hereinafter, for convenience of understanding, the following embodiments of the present application will use the environment data acquiring apparatus 100 shown in fig. 1 as an example, and with reference to the accompanying drawings, describe a compression method of environment data provided by the embodiments of the present application.
Referring to fig. 2, fig. 2 is a flowchart illustrating a method for compressing environment data according to an embodiment of the present application. The method for compressing the environment data may be applied to the environment data acquiring apparatus 100 described above, and the method for compressing the environment data may include the steps of:
and S200, acquiring original environment data.
It should be understood that the raw environmental data may be temperature and humidity data, salinity data, wind speed data, rainfall data, etc., and the present application is not limited thereto. That is, the method provided by the present application can be applied to different types of environment data acquisition devices 100, such as a temperature sensor, a humidity sensor, a light sensor, and the like, which have an unlimited data transmission function.
S210, compressing the original environment data according to the original environment data, a preset precision value and a preset lower limit value corresponding to the original environment data to obtain an actual stored value; the number of bits of the actual stored value is less than the number of bits of the original environment data.
The preset precision value corresponding to the original environment data can be understood as a precision value required when the environment data is collected. For example, referring to Table 1 above, the temperature data is stored using 4bytes floating point numbers with a precision of 0.1, i.e., the temperature that can be detected is accurate to 1 decimal place (e.g., 20.3℃). The preset lower limit corresponding to the original environment data may be understood as a lower limit limited by the environment data, for example, referring to table 1, the temperature data is stored by using a 4bytes floating point number, which is in a range of-40 to 80, i.e. the minimum value of the detectable temperature is-40 ℃ (i.e. the preset lower limit).
Referring to table 1 above again, assuming that the original environment data is temperature data and the storage mode is that the temperature data is stored in the form of "temperature data is stored using 4bytes floating point number, precision is 0.1, and the range is-40 to 80" in table 1, the original environment data in binary form corresponding to 20.3 ℃ is "00010100.00110011".
At this time, the original environment data can be compressed according to the original environment data, the preset precision value and the preset lower limit value, and an actual storage value with the digit smaller than the original environment data is obtained. The data range between the original environment data and the preset lower limit value (namely the number of data, for binary number, 15 data exist between 1111 and 0001) can be determined through the original environment data, the preset precision value and the preset lower limit value, and then the data structure with the minimum number of occupied bits corresponding to the original environment data can be determined according to the data range, so that the compression of the original environment data is realized.
For example, if the binary original environment data corresponding to 20.3 ℃ is "00010100.00110011", the original environment data may be compressed according to the original environment data, the preset precision value and the preset lower limit value, and the actual stored value is "10100.00110011".
S220, storing the actual storage value into a preset storage space; the number of bits of the preset storage space is determined by a preset precision value, a preset lower limit value and a preset upper limit value corresponding to the original environment data.
Referring to table 1 above again, it is assumed that the original environment data is temperature data, and the storage mode is stored in the form of "temperature data is stored using 4bytes floating point number, precision is 0.1, and range is-40 to 80" in table 1. The preset lower limit value is-40, the preset upper limit value is 80 and the preset precision value is 0.1. Obviously, the data range of the compressed original environment data can be determined by the preset lower limit value, the preset upper limit value and the preset precision value (i.e. the number of data, for example, assuming that there are only ten states of a certain environment data, only ten binary numbers of 0000 to 1001 are needed to be fully represented under the condition of using binary representation). And the bit number of the preset storage space can be determined through the data range of the compressed original environment data.
It should be understood that, in the embodiment of the present application, the original environment data is compressed according to the original environment data, the preset precision value and the preset lower limit value corresponding to the original environment data, and the actual stored value of which the number of bits is smaller than that of the original environment data is obtained, so that the original environment data can occupy the storage space as little as possible when being stored, the size of data when being transmitted is reduced, and the purpose of improving the storage and transmission efficiency of the environment data is further achieved.
It can also be understood that the method and the device can adapt to data transmission of different types of environmental data acquisition equipment, and well solve the problem of compressed data transmission.
Further, as to how to compress the original environment data according to the original environment data, the preset precision value and the preset lower limit value corresponding to the original environment data, to obtain the actual storage value, "the embodiment of the present application provides a feasible implementation manner, and referring to fig. 3, S210 may include the following steps:
S210A, according to the first formula
Figure BDA0002628365640000091
Compressing the original environment data to obtain an actual stored value; wherein f (real) is the original environment data, f (min) is the preset lower limit value, f (a) is the preset precision value, and F (flash) is the actual storage value.
Referring to table 1 above again, it is assumed that the original environment data is temperature data, and the storage mode is stored in the form of "temperature data is stored using 4bytes floating point number, precision is 0.1, and range is-40 to 80" in table 1. The predetermined lower limit value f (min) is-40 and the predetermined precision value f (a) is 0.1. Assuming that the original environmental data f (real) is 20.3 ℃, it can be obtained according to the first formula
Figure BDA0002628365640000092
Figure BDA0002628365640000093
Thus, the actual storage value f (flash) is 603, and the conversion to binary storage is "1001011011".
Further, as to how to "determine the number of bits of the preset storage space", an embodiment of the present application provides a feasible implementation manner, please refer to fig. 4, where the method includes:
and S300, determining the maximum storage space occupied by the actual storage value according to the preset precision value, the preset lower limit value and the preset upper limit value.
And S310, determining the bit number of the preset storage space according to the maximum occupied storage space.
In some possible embodiments, referring to fig. 5, S300 may include:
S300A according to the second formula
Figure BDA0002628365640000094
Determining the maximum occupied storage space of the actual storage value; wherein f (max) is a preset upper limit, f (min) is a preset lower limit, f (a) is a preset precision value, and F (flash max) is a preset maximum occupied storage space.
Referring to table 1 above again, it is assumed that the original environment data is temperature data, and the storage mode is stored in the form of "temperature data is stored using 4bytes floating point number, precision is 0.1, and range is-40 to 80" in table 1. The predetermined lower limit f (min) is-40, the predetermined upper limit f (max) is 80, and the predetermined precision value f (a) is 0.1. Therefore, the temperature of the molten metal is controlled,
Figure BDA0002628365640000101
that is, the maximum occupied storage space is set to 1200 (there are 1200 possible data for the original environment data).
In some possible embodiments, referring to fig. 5 again, S310 may include:
S310A, according to the third formula f (capacity) log2(F (flash max)) +1, determining the bit number of the preset storage space; wherein, f (flash max) is the maximum occupied storage space, and f (capacity) is the number of bits of the preset storage space.
Continuing with the example in S300A, since the maximum occupied storage space is 1200, f (capacity) log is further passed2(1200) + 1-10.2288 + 1-11.2288, since the number of bits stored is an integer, obviously the resulting predetermined storage spaceThe number of bits of (2) is 12 bits. That is, it can be understood that log in the third formula2(F (flash max)) may be rounded up.
It can be understood that, by compressing the environment data in table 1 through the above method embodiment, the data structure representing the temperature and humidity data shown in table 2 below can be obtained.
TABLE 2
Temperature (2Bytes) Humidity (1Bytes)
Precision of 1f, range-40 to 80 The precision is 1, and the range is 0-100 RH%
The data range is 0-1200 Data range of 0-100
11bit 7bit
Further, in order to further improve the data transmission efficiency, on the basis of the method shown in fig. 2, the embodiment of the present application also provides a complete and feasible implementation manner. Prior to S220, the method may further comprise: and compressing the actual storage value according to a preset compression rule.
For example, the actual stored values may be further compressed using lzo (a data compression algorithm, Lempel Ziv oberchimer).
It is understood that in actual environmental data monitoring, the environmental data collected by the sensor generally changes linearly. Especially in the process of warehousing, cold chain transportation and the like, the acquired environmental data can be kept relatively stable. In this case the environmental data stored in the recording device will have a large number of compressible bits (bits). Therefore, after the step S220, the actual stored value is compressed according to the preset compression rule, so that the storage space occupied by the environment data can be further reduced, and the transmission efficiency of the environment data can be improved. That is, the amount of transmission data can be reduced again by reusing the compression algorithm. In practical application, the amount of data to be transmitted can be reduced to below 50% according to different storage structures and compression algorithms, so that the data transmission time is shortened to below 1/2.
It should be added that, in practical application, temperature and humidity data of 341 × 3 ═ 1023bytes are collected at room temperature (5-minute intervals), and if the compressed data 453bytes are obtained by performing 2 times of compression in combination with lzo (data compression algorithm, Lempel Ziv oberchimer), the compressed data amount can be calculated to be 44.3% of the original data amount, and the compression ratio is 2.26, using the method for compressing environmental data of the present application. In actual use, the monitored environment is mostly constant environment parameter environment such as cold chain, medicine, storage and the like, and higher compression ratio can be obtained.
In order to execute the corresponding steps in the above embodiments and various possible manners, an implementation manner of the apparatus for compressing environmental data is given below, please refer to fig. 6, and fig. 6 shows a functional block diagram of the apparatus for compressing environmental data provided by the embodiments of the present application. It should be noted that the basic principle and the technical effects of the apparatus 400 for compressing environmental data provided by the present embodiment are the same as those of the above embodiments, and for the sake of brief description, no part of the present embodiment is mentioned, and reference may be made to the corresponding contents in the above embodiments. The compressing apparatus 400 of the environment data may include: an acquisition module 410, a compression module 420.
Alternatively, the modules may be stored in a memory in the form of software or Firmware (Firmware) or be fixed in an Operating System (OS) of the environment data acquiring device 100 provided in the present application, and may be executed by a processor in the environment data acquiring device 100. Meanwhile, data, codes of programs, and the like required to execute the above modules may be stored in the memory.
The acquisition module 410 may be used to acquire raw environmental data.
It is to be appreciated that acquisition module 410 can be utilized to support environmental data acquisition device 100 in performing the above-described S200, and/or the like, and/or other processes for the techniques described herein.
The compression module 420 may be configured to compress the original environment data according to the original environment data, a preset precision value corresponding to the original environment data, and a preset lower limit value, so as to obtain an actual stored value.
It is to be appreciated that the compression module 420 can be utilized to support the environmental data acquisition device 100 in performing, among other things, S210 described above, and/or other processes for the techniques described herein, e.g., S210A.
The compression module 420 may be used to store the actual stored value to a preset storage space.
It is to be appreciated that the compression module 420 may be utilized to support the environmental data acquisition device 100 in performing the above-described S220, and/or the like, and/or other processes for the techniques described herein, e.g., S300, S310, S300A, S310A.
Based on the above method embodiment, the present application further provides a computer readable storage medium, where a computer program is stored on the computer readable storage medium, and when the computer program is executed by a processor, the computer program performs the steps of the above method for compressing environment data.
Specifically, the storage medium may be a general-purpose storage medium, such as a removable disk, a hard disk, or the like, and when the computer program on the storage medium is executed, the method for compressing the environment data can be executed, so as to solve the problem that "when data of tens of kilobytes (kbytes) or even hundreds of KB needs to be transmitted, the data transmission time of the current environment data acquisition device is long", and achieve the purpose of compressing the environment data and improving the storage and transmission efficiency of the environment data.
In summary, the embodiments of the present application provide a method and a related apparatus for compressing environmental data. The method comprises the following steps: acquiring original environment data; compressing the original environment data according to the original environment data and a preset precision value and a preset lower limit value corresponding to the original environment data to obtain an actual stored value; the number of bits of the actual stored value is less than the number of bits of the original environment data; storing the actual storage value into a preset storage space; the number of bits of the preset storage space is determined by a preset precision value, a preset lower limit value and a preset upper limit value corresponding to the original environment data. The original environment data are compressed according to the original environment data and the preset precision value and the preset lower limit value corresponding to the original environment data, and the actual stored value of which the digit is smaller than the original environment data is obtained, so that the original environment data can occupy the storage space as little as possible when being stored, the data size when being transmitted is reduced, and the purpose of improving the storage and transmission efficiency of the environment data is achieved.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present application should be covered within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (8)

1. A method for compressing environmental data, comprising:
acquiring original environment data;
compressing the original environment data according to the original environment data and a preset precision value and a preset lower limit value corresponding to the original environment data to obtain an actual stored value; the number of bits of the actual stored value is less than the number of bits of the original environment data;
storing the actual storage value into a preset storage space; the number of bits of the preset storage space is determined by the preset precision value, the preset lower limit value and a preset upper limit value corresponding to the original environment data;
the method for determining the number of bits of the preset storage space comprises the following steps:
determining the maximum storage space occupied by the actual storage value according to the preset precision value, the preset lower limit value and the preset upper limit value;
determining the digit of the preset storage space according to a third formula F (capacity) ═ log _2(F (flash max)) + 1;
wherein, f (flash max) is the maximum occupied storage space, and f (capacity) is the number of bits of the preset storage space; log _2(f (flash max)) rounds up.
2. The method according to claim 1, wherein the step of compressing the original environment data according to the original environment data, a preset precision value and a preset lower limit value corresponding to the original environment data to obtain an actual stored value comprises:
according to a first formula
Figure FDA0003462754370000011
Compressing the original environment data to obtain the actual storage value;
wherein f (real) is the original environment data, f (min) is the preset lower limit value, f (a) is the preset precision value, and F (flash) is the actual storage value.
3. The method according to claim 1, wherein the step of determining the maximum occupied storage space of the actual storage value from the preset precision value, the preset lower limit value and the preset upper limit value comprises:
according to a second formula
Figure FDA0003462754370000021
Determining a maximum occupied storage space for the actual storage value;
wherein f (max) is the preset upper limit, f (min) is the preset lower limit, f (a) is the preset precision value, and f (flash max) is the preset maximum occupied storage space.
4. The method according to claim 1, wherein the step of storing the actual stored value to a preset storage space is preceded by the method further comprising:
and compressing the actual storage value according to a preset compression rule.
5. An apparatus for compressing environmental data, comprising:
the acquisition module is used for acquiring original environment data;
the compression module is used for compressing the original environment data according to the original environment data, a preset precision value and a preset lower limit value corresponding to the original environment data to obtain an actual stored value; the number of bits of the actual stored value is less than the number of bits of the original environment data;
the compression module is further used for storing the actual storage value into a preset storage space; the number of bits of the preset storage space is determined by the preset precision value, the preset lower limit value and a preset upper limit value corresponding to the original environment data;
the method for determining the preset storage space by the compression module comprises the following steps:
determining the maximum storage space occupied by the actual storage value according to the preset precision value, the preset lower limit value and the preset upper limit value;
determining the digit of the preset storage space according to a third formula F (capacity) ═ log _2(F (flash max)) + 1;
wherein, f (flash max) is the maximum occupied storage space, and f (capacity) is the number of bits of the preset storage space; log _2(f (flash max)) rounds up.
6. The apparatus of claim 5, wherein the compression module is configured to compress the data according to a first formula
Figure FDA0003462754370000022
Compressing the original environment data to obtain the actual storage value;
wherein f (real) is the original environment data, f (min) is the preset lower limit value, f (a) is the preset precision value, and F (flash) is the actual storage value.
7. An ambient data acquisition device comprising a processor and a memory, the memory storing a computer program, characterized in that the processor realizes the steps of the method of any of claims 1 to 4 when executing the computer program.
8. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 4.
CN202010803816.3A 2020-08-11 2020-08-11 Compression method of environment data and related device Active CN111865328B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010803816.3A CN111865328B (en) 2020-08-11 2020-08-11 Compression method of environment data and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010803816.3A CN111865328B (en) 2020-08-11 2020-08-11 Compression method of environment data and related device

Publications (2)

Publication Number Publication Date
CN111865328A CN111865328A (en) 2020-10-30
CN111865328B true CN111865328B (en) 2022-03-01

Family

ID=72971924

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010803816.3A Active CN111865328B (en) 2020-08-11 2020-08-11 Compression method of environment data and related device

Country Status (1)

Country Link
CN (1) CN111865328B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114065240A (en) * 2021-11-10 2022-02-18 南京信易达计算技术有限公司 Storage encryption system based on domestic AI chip architecture and control method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104615785A (en) * 2015-03-04 2015-05-13 浪潮集团有限公司 Data storage method and device based on TYKY cNosql
CN105912330A (en) * 2016-04-07 2016-08-31 北京北方微电子基地设备工艺研究中心有限责任公司 Hardware device control method and device
CN106330995A (en) * 2015-06-19 2017-01-11 陕西重型汽车有限公司 Three-level data compression device used for vehicle networking and method thereof
CN110196836A (en) * 2019-03-29 2019-09-03 腾讯科技(深圳)有限公司 A kind of date storage method and device
CN111008230A (en) * 2019-11-22 2020-04-14 远景智能国际私人投资有限公司 Data storage method and device, computer equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6540110B2 (en) * 2015-03-11 2019-07-10 富士通株式会社 Database system, information processing apparatus, and database program

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104615785A (en) * 2015-03-04 2015-05-13 浪潮集团有限公司 Data storage method and device based on TYKY cNosql
CN106330995A (en) * 2015-06-19 2017-01-11 陕西重型汽车有限公司 Three-level data compression device used for vehicle networking and method thereof
CN105912330A (en) * 2016-04-07 2016-08-31 北京北方微电子基地设备工艺研究中心有限责任公司 Hardware device control method and device
CN110196836A (en) * 2019-03-29 2019-09-03 腾讯科技(深圳)有限公司 A kind of date storage method and device
CN111008230A (en) * 2019-11-22 2020-04-14 远景智能国际私人投资有限公司 Data storage method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN111865328A (en) 2020-10-30

Similar Documents

Publication Publication Date Title
US11705923B2 (en) Method and apparatus for storing data, and computer device and storage medium thereof
CN104899204B (en) Data storage method and device
CN111382863A (en) Neural network compression method and device
CN110602178B (en) Method for calculating and processing temperature sensor data based on edge compression
CN111865328B (en) Compression method of environment data and related device
CN109597798B (en) Network file deleting method and device, computer equipment and storage medium
CN107608630B (en) Data reading and writing method and device
CN111291083A (en) Webpage source code data processing method and device and computer equipment
CN108958755B (en) Method and device for generating application program installation package and electronic equipment
CN112052144B (en) Information management method, device, electronic equipment and storage medium
CN108287890B (en) Data management method and device
CN111159009A (en) Pressure testing method and device for log service system
CN115905168A (en) Adaptive compression method and compression apparatus, computer device, storage medium
CN111597098B (en) Data processing method and device
CN115794756A (en) Simulation file compression method and device, equipment and storage medium
CN113392131A (en) Data processing method and device and computer equipment
CN113946617A (en) Data processing method and device, electronic equipment and storage medium
CN110377665B (en) Data synchronization method and device, electronic equipment and storage medium
CN103617052A (en) Method and device for processing cache of application program
CN114116367B (en) Method for generating log and electronic equipment
CN112183644B (en) Index stability monitoring method and device, computer equipment and medium
CN115361032B (en) Antenna unit for 5G communication
CN116962299B (en) Data center calculation force scheduling method, system, equipment and readable storage medium
CN116186118A (en) Distributed database data compression method, device, equipment and storage medium
CN115396517A (en) Beidou communication data processing method and device, terminal equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant