A kind of lossless compression method of physiology condition sensor continuous collecting signal
Technical field
The present invention relates to a kind of data compression method, more specifically, more particularly to a kind of physiology condition sensor continues
Gather the lossless compression method of signal.
Background technology
With advances in technology with the research and development of smaller sensor, it is made up of condition sensor and its device and is can be used for remotely
Medical treatment and the body area network of long-term health identification technique, carry out long-range, the long-term acquisition of physiology sign, this mode of operation quilt
It is more and more extensive to receive.
Condition sensor and its sign for being gathered generally have following features:
1st, high frequency collection, to meet the basic collection requirement of sign, the collection to physiological signals such as such as pulse, electrocardios
Frequency is generally in more than 100Hz, the collection to physiological signals such as such as pulse, electrocardios, it usually needs 500Hz frequencies above could reach
To the requirement that medicinal is used.
2nd, be wirelessly transferred, condition sensor and harvester be usually taken wireless network transmissions mode meet comfortableness and
Portability needs.And at present in sign signal acquisition device, wireless communication module occupies the overwhelming majority of electrical source consumption.This
It is outer for the pattern of remote data transmission is carried out by 3G network, either now or future, what radio communication was based on
Signal frequency range is all scarce resource.The application of the body area network based on carrying out high frequency collection for a long time, to wireless network transmissions
Cost and bandwidth are all very sensitive.
Therefore, condition sensor, sign signal acquisition apparatus and system must be considered in carrying out data transmission in design
It is preceding to gather original sign be compressed, to reduce the volume of transmitted data of wireless network, thus reduce electrical source consumption and
Bandwidth consumption.
Data compression algorithm can be divided into lossy compression method and the major class of Lossless Compression two.Although lossy compression method compression ratio is higher,
A part of raw information can be lost.The compression ratio of Lossless Compression is not general high, but after convergence terminal is reduced to data decompression, no
Any raw information can be lost.
Because the requirement of the Clinical efficacy to data acquiring frequency and authenticity of sign is very high, it is therefore desirable to the greatest extent
Amount ensures the integrality of original sign, and this algorithm for requiring to perform compression for sign is that Lossless Compression is calculated first
Method is to ensure data reducibility, and it is individually designed to ensure high compression rate that next needs the characteristics of being directed to sign to carry out.
In addition, in addition it is also necessary to consider that the computing capability and storage capacity of condition sensor and harvester are limited, made
Algorithm needs faster operation speed and relatively low computational complexity, to ensure that the sign that high frequency is gathered can be
Transferred out in the short time as far as possible, so as to ensure to receive the requirement of real-time of other end received signal.
The content of the invention
Low it is an object of the invention to provide a kind of computation complexity, the small physiology condition sensor in committed memory space is held
The lossless compression method of continuous collection signal.
The technical proposal of the invention is realized in this way:A kind of Lossless Compression of physiology condition sensor continuous collecting signal
Method, the method comprises the steps:
(1) realize carrying out continuous acquisition based on Fixed Time Interval T to sign S using sensor, and carry out A/D turns
Change to form signal time sequence data St+0St+1St+2……St+n;There is minimum S in wherein collection signal SmWith maximum SnValue
Domain scope, i.e. S ∈ [Sm, Sn];
(2) the signal processing unit signal time scope W to be included according to each packet, it is determined that being compressed every time
Maximum data length n, the n=W ÷ T for the treatment of;
(3) signal processing unit has added up n signal data St+0St+1St+2……St+nAfterwards, first signal data is made
It is the reference data D of this packet datab, since second signal data, calculate data and go up data relatively
Difference D, and form sequence of differences Dt+1Dt+2……Dt+n;The codomain of the codomain ∈ signals S of the difference D, difference D exists effective
Minimum DmWith maximum DnCodomain scope, i.e. D ∈ [Dm, Dn], [Dm, Dn]∈[Sm, Sn], [Dm, Dn] and [Sm, Sn] positive
Close;
(4) sequence of differences is replaced using predefined encoder dictionary L;The predefined encoder dictionary L is based on
Normal distyribution function [D prepared in advancem, Dn] in each value frequency of use, wherein the frequency highest of the median 0 of codomain, DmWith
DnFrequency it is minimum, from median to DmAnd DnFrequency of use Normal Distribution prepared in advance;
(5) using encoder dictionary L to sequence of differences Dt+1Dt+2……Dt+nEncoded, formed compressed data sequences Lt+ 1Lt+2……Lt+n, with a reference value DbTogether it is stored as DbLt+1Lt+2……Lt+n, build compressed data packets PLW。
In a kind of lossless compression method of above-mentioned physiology condition sensor continuous collecting signal, in step (3), it is on duty
Difference D in value sequencek+1Numerical value exceed [Dm, Dn] when, terminate the coding of current difference sequence, make DbDt+1Dt+2……DkFor
Complete difference data bag, while with beyond the difference D of difference rangek+1Corresponding physiology sign Sk+1And institute is right
The time T for answeringk+1It is starting point, with remaining data or corresponding time Tk+nData be terminal, carry out new packet
Treatment and encapsulation, until total data treatment and encapsulation are finished, or run into another off-limits difference;K+1 ∈ [the t+
1, t+n].
In a kind of lossless compression method of above-mentioned physiology condition sensor continuous collecting signal, described in step (4)
Encoder dictionary L, the difference frequency of occurrences that coding calculates institute's foundation is carried out to the difference as coded object, is predefined frequency
Value, each difference correspondence only one coding, the difference of the highest frequency of occurrences uses the coding of most short bit, minimum appearance
The difference of frequency uses the coding of bit most long.
In a kind of lossless compression method of above-mentioned physiology condition sensor continuous collecting signal, described in step (4)
Encoder dictionary L, used as the difference of coded object, its data encoded scope is symbol in the interval time of adjacent collection twice
Close the maximum physiological signal excursion of physiological law.
For the signal continuously monitored using physiology condition sensor, the difference of its adjacent signals shows fixation
Rule:
(1) difference between adjacent signals is limited by basic physiological rule, and the absolute value of its difference has it to meet physiology
The limit of rule.
(2) limitation of physiological law, determines the limited range of difference.Off-limits difference, it is meant that signal is not
Reliability.
(3) absolute value of the absolute value of each difference in sequence of differences less than primary signal;
(4) frequency that the difference that absolute value is smaller in sequence of differences occurs is higher, and its distribution is similar with normal distribution.
(5) in the case of without sign mutation caused by external interference, the distribution of difference is similar with normal distribution.In the presence of outer
In the case of sign mutation caused by portion's interference, the distribution of difference is near laplacian distribution.
(6) sensor continuous signal collection characteristic, it is meant that in the absence of the frequency of occurrences to difference carry out total evidence,
Most complete statistics.
(7) statistical property of the difference frequency of occurrences determines that the encoder dictionary of suboptimum can in the absence of optimal encoder dictionary
Distribution function is built with according to fractional sample, and the probability of occurrence of each difference in effective difference range is carried out by distribution function
Calculate and assume.
The present invention takes full advantage of the above-mentioned rule of the signal that physiology condition sensor is gathered, using wireless sensor network
The characteristic of initial data in network, realizes the efficient lossless compression of data, and computation complexity is low, it is adaptable to various using wireless biography
The data that sensor network is monitored, such as temperature, humidity and mechanical oscillation signal.
As a result of the above-mentioned technical scheme that predefined encoder dictionary combination mathematic interpolation is carried out according to normal distribution,
The present invention has the advantage that:
The characteristic of the physiology sign that the present invention is gathered using real condition sensor, proposes a kind of physiology sign letter
Number and lossless date-compress method.The lossless compression method computation complexity is low, can operate in condition sensor and Worn type
In this arithmetic speed of harvester and memory size all constrained environments.Additionally, the lossless compression method be also applied for it is various
There is the data processing of the sensor of extreme value signal limitation, such as temperature, humidity changes slow signal, or similar to machinery
The violent signal of this change of vibration signal.The present invention can be effectively to there are periodic characteristics signal data press
Contracting, the purpose of the traffic and communication power consumption is reduced to reach, and can be effectively applied to that all kinds of needs are long-term, be carried out continuously monitoring
Field.Also, by predefined encoder dictionary, the abnormal conditions of the data for collecting can also be detected, it is ensured that the conjunction of data
Rationality and its use value.
Specific embodiment
With reference to specific embodiment, the present invention is described in further detail, but does not constitute to of the invention any
Limitation.
A kind of lossless compression method of physiology condition sensor continuous collecting signal of the invention, it is characterised in that the party
Method comprises the steps:
(1) realize carrying out continuous acquisition based on Fixed Time Interval T to sign S using sensor, and carry out A/D turns
Change to form signal time sequence data St+0St+1St+2……St+n;There is minimum S in wherein collection signal SmWith maximum SnValue
Domain scope, i.e. S ∈ [Sm, Sn];It is relevant that the data of signal of the Computer Storage space of S after being changed through A/D describe scope, such as
[Sm, Sn] be set to [0,4096], then each signal StComputer Storage space for 2 bytes (16 bit) memory space.
(2) the signal processing unit signal time scope W to be included according to each packet, it is determined that being compressed every time
Maximum data length n, the n=W ÷ T for the treatment of.
(3) signal processing unit has added up n signal data St+0St+1St+2……St+nAfterwards, first signal data is made
It is the reference data D of this packet datab, since second signal data, calculate data and go up data relatively
Difference D, and form sequence of differences Dt+1Dt+2……Dt+n;The codomain of the codomain ∈ signals S of the difference D, difference D exists effective
Minimum DmWith maximum DnCodomain scope, i.e. D ∈ [Dm, Dn], [Dm, Dn]∈[Sm, Sn], [Dm, Dn] and [Sm, Sn] positive
Close;As the difference D in sequence of differencesk+1Numerical value exceed [Dm, Dn] when, terminate the coding of current difference sequence, make DbDt+ 1Dt+2……DkIt is complete difference data bag, while with beyond the difference D of difference rangek+1Corresponding physiology sign
Sk+1And corresponding time Tk+1It is starting point, with remaining data or corresponding time Tk+nData be terminal, carry out
The treatment and encapsulation of new packet, until total data treatment and encapsulation are finished, or run into another off-limits difference;
The k+1 ∈ [t+1, t+n];Basis signal characteristic, [Dm, Dn] negatively correlated, the higher oversampling of codomain scope and sampling density
Degree causes the difference of two neighboring signal smaller, therefore sampling density, the data of primary signal statement codomain scope and difference value
There is equilibrium relation in domain scope.
The Computer Storage space of D and [Dm, Dn] data scope positive correlation is described, such as [Dm, Dn] scope for [- 128,
127], then the Computer Storage space of each difference of D is 1 byte (8 bit).Assuming that n=500, primary signal codomain is
[0,4096], then storing primary signal needs 500*2 byte=1000 byte (8000 bit), and carrying out storage using difference needs
Want 1*2 byte+499*1 byte=501 byte (4008 bit).
(4) sequence of differences is replaced using predefined encoder dictionary L;The predefined encoder dictionary L is based on
Normal distyribution function [D prepared in advancem, Dn] in each value frequency of use, wherein the frequency highest of the median 0 of codomain, DmWith
DnFrequency it is minimum, from median to DmAnd DnFrequency of use Normal Distribution prepared in advance;Wherein described coded word
Allusion quotation L, the difference frequency of occurrences that coding calculates institute's foundation is carried out to the difference as coded object, is predefined frequency values, often
One difference correspondence only one coding, the difference of the highest frequency of occurrences uses the coding of most short bit, the minimum frequency of occurrences
Difference using bit most long coding;And the encoder dictionary L is used as the difference of coded object, its data encoded
Scope, is the maximum physiological signal excursion for meeting physiological law in the interval time of adjacent collection twice.
Encoder dictionary table is compressed before processing to primary signal in signal processing unit, is built into signal in advance
In the addressable caching of processing unit, at the same be also built in compressed data sequences are carried out with decompression calculations collect terminal
In.
(5) using encoder dictionary L to sequence of differences Dt+1Dt+2……Dt+nEncoded, formed compressed data sequences Lt+ 1Lt+2……Lt+n, with a reference value DbTogether it is stored as DbLt+1Lt+2……Lt+n, build compressed data packets PLW。
(6) by compressed data packets PLWStorage is sent to remotely through network.
(7) program is received according to pre-defined encoder dictionary L to compressed data packets PLWEnter row decoding replacement, be reduced to
DbDt+1Dt+2……Dt+n。
(8) receive program and be based on baseline signal value DbReduction sequence of differences is St+0St+1St+2……St+n。
In this method, signal receive maximum allowable time delay, and signal frequency acquisition, be predefined parameter
Value.Parameter value is set according to physiological law and using needs, and is built in signal processing unit.
In the present invention according to Normal squeezing algorithm principle, by by the difference data of frequency of use higher with less ratio
Special position statement, the difference data of lower frequency of use is stated with more bits, and sequence of differences is entered by encoder dictionary L
Row is replaced, so as to describe the change of signal S in time range W with overall less bit.
Embodiment 1
1st, pulse beating sensor output voltage range be 200mV, output frequency be 500 times/second, amplified circuit and
A/D is changed, the excursion [S of pulse beating output valvem, Sn] it is [0,4096].Signal processing apparatus are using based on 32 ARM
The microprocessor of Cortex M0 core architectures, running frequency is 50MHz, the inside in Flash spaces and 64KB with 256KB
RAM, and it is configured with the additional Flash of 4MB.
2nd, the Fixed Time Interval T that harvester carries out signal acquisition is 2 milliseconds, and every 2 milliseconds obtain pulse beating sensing
Device output voltage, and amplify through signal and A/D conversions, keep in order.Every temporary physiology sign is stored with 2 bytes
To accommodate codomain [Sm, Sn] express ranges.
3rd, temporary initial data is compressed treatment and is transmitted once to host computer, hair by data processing unit for every 60 seconds
Send and successfully remove temporal data afterwards.
The signal time scope W that i.e. each packet to be included be 60 seconds, i.e., 60,000 millisecond, then during original number
It is 60,000 ÷ 2=30, then 000 primary signal, 60 seconds primary signals according to the pulse beat data quantity n for being included in bag
Data Storage Size be:30,000 × 2Bytes=60,000Bytes.
4th, when data processing unit starts to perform, first by carrying out the calculating of the sequence of differences D of signal, byte is realized
The compression of code.
By the assessment of change of being beaten to pulse in advance, and harvester is set, the positive constant between two adjacent signals
Value scope [Dm, Dn] be set as [- 128,127], you can accommodated by 1 byte.
Difference exceeds this scope, then it is assumed that the signal S of collectiontRelative to signal St-1Occur jump or signal interruption, then from
St-1Proceed by the division of data slot and begin setting up new compressed data packets.
Compressed data sequences first physiology sign S during uset+0On the basis of value Db, calculate two neighboring life
Sequence of differences D, D between reason sign include (Dt+1Dt+2……Dt+n), Dt+1=St+1-St+0, so as to obtain difference data bag:
DbDt+1Dt+2……Dt+n
In the case where there is no signal interruption, D includes 30,000-1=29,999 pen datas, is 1Byte per pen data,
The data size of D is 29,999 × 1Bytes=29,999Bytes.
Changed by sequence of differences, realize compression ratio:
The ≈ 50% of (29,999+2) ÷ 60,000
5th, on the basis of sequence of differences D sets up completion, data processing unit carries out the pressure of bit based on encoder dictionary
Contracting.
By the assessment of change of being beaten to pulse in advance, and harvester is set, harvester is built-in to be directed to
The encoder dictionary of codomain scope [- 128,127].
The weight of each coding in encoder dictionary, is presupposed to meet normal distribution, and once based on to each
The weight of coding is precalculated and solidified.
That is, code " 0 " is most short code length, and code " 127 " and " -128 " are the code length most grown.By
Huffman algorithms are optimized, and code length is 3 bits to 15 bits in encoder dictionary.
The encoder dictionary of solidification is built in harvester and in host computer simultaneously in advance.
Coding displacement is carried out to sequence of differences D by encoder dictionary, compressed data sequences L is formedt+1Lt+2……Lt+n, from
And obtain compressed data packets:
DbLt+1Lt+2……Lt+n
To compressed data packets additional packets time started Tt, form packet:
TtDbLt+1Lt+2……Lt+n
All data to packet calculate check code Ct.Check code uses the CRC16 algorithms of predefined mask table, and will
Result of calculation is attached to compressed data packets, so as to form packet:
CtTtDbLt+1Lt+2……Lt+n
6th, final packet is transferred to host computer by data processing unit.
If the 7, in processing procedure, running into difference beyond codomain scope [- 128,127], then terminate current data in advance
The treatment and encapsulation of bag, and the packet that will have been encapsulated is sent to host computer, while with beyond the difference D of difference ranget+1Institute is right
The physiology sign S for answeringt+1And corresponding time Tt+1It is starting point, with remaining data as terminal, carries out new data
The treatment and encapsulation of bag, until total data treatment and encapsulation are finished, or run into another off-limits difference.
Compression ratio contrast of the present embodiment to pulse beat data is as shown below.Be can be seen that from experimental result
Data compression process is carried out to 8 groups of different pulse beat datas in embodiment, the average compression ratio for obtaining is 26.79%.With
Compared including the compression algorithm such as gzip and 7z, with obvious advantage.
Data original length |
Compression ratio of the present invention |
GZ compression ratios |
7Z compression ratios |
618,496 |
25.01% |
45.70% |
31.13% |
192,512 |
24.37% |
46.81% |
31.91% |
118,784 |
28.89% |
48.28% |
31.03% |
61,440 |
25.92% |
46.67% |
33.33% |
57,344 |
24.42% |
42.86% |
28.57% |
2,035,712 |
29.03% |
46.08% |
30.58% |
192,512 |
28.74% |
46.81% |
31.91% |
262,144 |
27.90% |
46.88% |
31.25% |
Average compression ratio |
26.79% |
46.26% |
31.22% |
Compression ratio size of the invention is influenceed by difference codomain, by being changed to A/D after the physiology sign that is formed
Signal codomain [Sm, Sn] the codomain [D of adjacent signals difference that is formed of size and sample frequencym, Dn] size carry out
Adjustment, all has a great impact to compression ratio.
The present invention design compression method compared with other method, it is necessary to memory headroom it is smaller, computation complexity is lower.
Therefore, the lossless compression method that the present invention is provided carries out data processing on wireless senser and harvester, with respect to its elsewhere
Reason method has larger advantage, can apply to various fields that physiology sign monitoring is carried out using wireless sensor network.
Finally illustrate, the above embodiments are merely illustrative of the technical solutions of the present invention and it is unrestricted, although with reference to compared with
Osmanthus embodiment has been described in detail to the present invention, it will be understood by those within the art that, can be to skill of the invention
Art scheme is modified or equivalent, and without deviating from the objective and scope of the technical program, it all should cover in the present invention
Right in the middle of.