Background technology
Along with the progress of technology and the more research and development of Miniature Sensor, be can be used for the body area network of tele-medicine and long-term health identification technique by condition sensor and installation composition thereof, carry out long-range, the collection for a long time of physiology sign signal, this mode of operation is accepted more and more widely.
Condition sensor and the sign signal gathering thereof have following features conventionally:
1, high frequency collection, for meeting the basic collection requirement of sign signal, to if the frequency acquisition of the physiological signal such as pulse, electrocardio is conventionally more than 100Hz, to as the collection of the physiological signal such as pulse, electrocardio, conventionally need 500Hz just can reach the requirement of medical clinical use with upper frequency.
2, wireless transmission, condition sensor and harvester take the mode of wireless network transmissions to meet comfortableness and portable needs conventionally.And at present in sign signal acquisition device, wireless communication module has occupied the overwhelming majority of electrical source consumption.In addition concerning carry out the pattern of remote data transmission by 3G network, be no matter now or future, radio communication based on signal frequency range be all scarce resource.To carry out for a long time the application of high frequency collection as basic body area network, the cost to wireless network transmissions and bandwidth are all very responsive.
Therefore, condition sensor, sign signal acquisition Apparatus and system are levied signal to the initial body gathering must consider carrying out transfer of data in the time of design before and are compressed, and to reduce the volume of transmitted data of wireless network, thereby reduce electrical source consumption and bandwidth consumption.
Data compression algorithm can be divided into lossy compression method and the large class of Lossless Compression two.Although lossy compression method compression ratio is higher, can lose a part of raw information.The compression ratio of Lossless Compression is generally not high, but after convergence terminal is to data decompression reduction, can not lose any raw information.
Because the Clinical efficacy of sign signal is very high to the requirement of data acquiring frequency and authenticity, therefore need to ensure that initial body levies the integrality of signal as far as possible, first this algorithm that just requires to carry out compression for sign signal is lossless compression algorithm to ensure that data can reducibility, secondly need to carry out design separately to ensure high compression rate for the feature of sign signal.
In addition, also need to consider that the computing capability of condition sensor and harvester and storage capacity are limited, the algorithm using need to have arithmetic speed and lower computational complexity faster, can in the short time, transfer out trying one's best with the sign signal that ensures high frequency collection, thereby ensure to receive the requirement of real-time of the signal that the other end receives.
Summary of the invention
The object of the present invention is to provide a kind of computation complexity low, the lossless compression method of the little physiology condition sensor continuous collecting signal in committed memory space.
Technical scheme of the present invention is achieved in that a kind of lossless compression method of physiology condition sensor continuous collecting signal, and the method comprises the steps:
(1) utilize transducer to realize sign signal S is carried out to continuous acquisition based on Fixed Time Interval T, and carry out A/D conversion formation signal time sequence data S
t+0s
t+1s
t+2s
t+n; There is minimum S in collection signal S wherein
mwith maximum S
ncodomain scope, i.e. S ∈ [S
m, S
n];
(2) the signal time scope W that signal processing unit should comprise according to each packet, determines and compresses the maximum data length n processing, n=W ÷ T at every turn;
(3) signal processing unit has added up n signal data S
t+0s
t+1s
t+2s
t+nafter, the reference data D using first signal data as this packet data
b, since second signal data, calculate data and relatively go up the difference D of data, and form sequence of differences D
t+1d
t+2d
t+n; The codomain of described difference D is not more than the codomain of signal S, and difference D exists effective minimum D
mwith maximum D
ncodomain scope, i.e. D ∈ [D
m, D
n], [D
m, D
n] ∈ [S
m, S
n], [D
m, D
n] and [S
m, S
n] positive correlation;
(4) use predefined encoder dictionary L to replace sequence of differences; Described predefined encoder dictionary L is based on normal distyribution function [D prepared in advance
m, D
n] in the frequency of utilization of each value, wherein the frequency of the median 0 of codomain is the highest, D
mand D
nfrequency minimum, from median to D
mand D
nfrequency of utilization Normal Distribution prepared in advance;
(5) use encoder dictionary L to sequence of differences D
t+1d
t+2d
t+nencode, form compressed data sequences L
t+1l
t+2l
t+n, with fiducial value D
btogether be stored as D
bl
t+1l
t+2l
t+n, build compressed data packets PL
w.
In the lossless compression method of above-mentioned a kind of physiology condition sensor continuous collecting signal, in step (3), as the difference D in sequence of differences
k+1numerical value exceed [D
m, D
n] time, finish the coding of current sequence of differences, make D
bd
t+1d
t+2d
kfor complete difference data bag, simultaneously to exceed the difference D of difference range
k+1corresponding physiology sign signal S
k+1, and corresponding time T
k+1for starting point, with remaining data or corresponding time T
k+ndata be terminal, carry out processing and the encapsulation of new packet, until that total data is processed and encapsulated is complete, or run into another off-limits difference; Described k+1 ∈ [t+1, t+n].
In the lossless compression method of above-mentioned a kind of physiology condition sensor continuous collecting signal, encoder dictionary L described in step (4), calculate the difference frequency of occurrences of institute's foundation to encoding as the difference of coded object, for predefined frequency values, the corresponding unique coding of each difference, the difference of the high frequency of occurrences is used the coding of short bit, and the difference of the minimum frequency of occurrences is used the coding of long bit.
In the lossless compression method of above-mentioned a kind of physiology condition sensor continuous collecting signal, encoder dictionary L described in step (4), as the difference of coded object, the data area that it is encoded, be in the interval time of twice adjacent collection, meet the maximum physiological signal excursion of physiological law.
For utilizing physiology condition sensor to carry out the signal of monitoring continuously, the difference table of its adjacent signals reveals fixing rule:
(1) difference between adjacent signals is subject to the restriction of basic physiological rule, and the absolute value of its difference has it to meet the limit of physiological law.
(2) restriction of physiological law, has determined the limited range of difference.Off-limits difference, means the unreliability of signal.
(3) absolute value of the each difference in sequence of differences is less than the absolute value of primary signal;
(4) frequency that the difference that in sequence of differences, absolute value is less occurs is higher, and it distributes similar with normal distribution.
(5) do not have in the situation of sign mutation that external interference causes, distribution and the normal distribution of difference are similar.Exist in the situation of sign mutation that external disturbance causes, the distribution of difference is near laplacian distribution.
(6) continuous signal of transducer gathers characteristic, means not exist the frequency of occurrences of difference is carried out to statistics all data, most complete.
(7) statistical property of the difference frequency of occurrences has determined not exist optimum encoder dictionary, and the encoder dictionary of suboptimum can build distribution function according to fractional sample, and is carried out calculating and the supposition of the probability of occurrence of the each difference in effective difference range by distribution function.
The present invention takes full advantage of the above-mentioned rule of the signal that physiology condition sensor gathers, utilize the characteristic of initial data in wireless sensor network, realize the efficient lossless compression of data, computation complexity is low, be applicable to the multiple data of utilizing wireless sensor network to monitor, as temperature, humidity and mechanical oscillation signal.
Due to adopted above-mentioned according to normal distribution carry out predefined encoder dictionary in conjunction with difference calculate technical scheme, the present invention has advantages of as follows:
The present invention utilizes the characteristic of the physiology sign signal that real condition sensor gathers, and proposes a kind of method of physiology sign signal and data lossless compression.This lossless compression method computation complexity is low, can operate in condition sensor and this arithmetic speed of Worn type harvester and memory size all in constrained environment.In addition, this lossless compression method is also applicable to the data processing of the various transducers that have extreme value signal limitations, as temperature, humidity etc. change signal slowly, or is similar to the violent signal of this variation of mechanical oscillation signal.The present invention can, effectively to existing the periodically signal data of feature to compress, to reach the object that reduces the traffic and communication power consumption, can effectively be applied to the field that all kinds of needs are monitored for a long time, continuously.And, by predefined encoder dictionary, can also detect the abnormal conditions of the data that collect, ensure reasonability and the use value thereof of data.
Embodiment
Below in conjunction with specific embodiment, the present invention is described in further detail, but do not form any limitation of the invention.
The lossless compression method of a kind of physiology condition sensor continuous collecting signal of the present invention, is characterized in that, the method comprises the steps:
(1) utilize transducer to realize sign signal S is carried out to continuous acquisition based on Fixed Time Interval T, and carry out A/D conversion formation signal time sequence data S
t+0s
t+1s
t+2s
t+n; There is minimum S in collection signal S wherein
mwith maximum S
ncodomain scope, i.e. S ∈ [S
m, S
n]; The Computer Storage space of S is relevant with the data description scope of the signal after A/D conversion, as [S
m, S
n] be set to [0,4096], each signal S
tcomputer Storage space be the memory space of 2 bytes (16 bit).
(2) the signal time scope W that signal processing unit should comprise according to each packet, determines and compresses the maximum data length n processing, n=W ÷ T at every turn.
(3) signal processing unit has added up n signal data S
t+0s
t+1s
t+2s
t+nafter, the reference data D using first signal data as this packet data
b, since second signal data, calculate data and relatively go up the difference D of data, and form sequence of differences D
t+1d
t+2d
t+n; The codomain of described difference D is not more than the codomain of signal S, and difference D exists effective minimum D
mwith maximum D
ncodomain scope, i.e. D ∈ [D
m, D
n], [D
m, D
n] ∈ [S
m, S
n], [D
m, D
n] and [S
m, S
n] positive correlation; As the difference D in sequence of differences
k+1numerical value exceed [D
m, D
n] time, finish the coding of current sequence of differences, make D
bd
t+1d
t+2d
kfor complete difference data bag, simultaneously to exceed the difference D of difference range
k+1corresponding physiology sign signal S
k+1, and corresponding time T
k+1for starting point, with remaining data or corresponding time T
k+ndata be terminal, carry out processing and the encapsulation of new packet, until that total data is processed and encapsulated is complete, or run into another off-limits difference; Described k+1 ∈ [t+1, t+n]; Basis signal characteristic, [D
m, D
n] codomain scope and sampling density negative correlation, higher sampling density causes the difference of adjacent two signals less, there is equilibrium relation in the data of sampling density, primary signal statements codomain scope and difference codomain scope therefore.
The Computer Storage space of D and [D
m, D
n] the positive correlation of data description scope, as [D
m, D
n] scope be [128,127], the Computer Storage space of each difference of D is 1 byte (8 bit).Suppose n=500, primary signal codomain is [0,4096], and storing primary signal needs 500*2 byte=1000 byte (8000 bit), and using difference to store needs 1*2 byte+499*1 byte=501 bytes (4008 bit).
(4) use predefined encoder dictionary L to replace sequence of differences; Described predefined encoder dictionary L is based on normal distyribution function [D prepared in advance
m, D
n] in the frequency of utilization of each value, wherein the frequency of the median 0 of codomain is the highest, D
mand D
nfrequency minimum, from median to D
mand D
nfrequency of utilization Normal Distribution prepared in advance; Wherein said encoder dictionary L, calculate the difference frequency of occurrences of institute's foundation to encoding as the difference of coded object, for predefined frequency values, the corresponding unique coding of each difference, the difference of the high frequency of occurrences is used the coding of short bit, and the difference of the minimum frequency of occurrences is used the coding of long bit; And described encoder dictionary L is as the difference of coded object, and the data area that it is encoded, is in the interval time of twice adjacent collection, meets the maximum physiological signal excursion of physiological law.
Encoder dictionary table has been built in the addressable buffer memory of signal processing unit before primary signal being compressed at signal processing unit and being processed in advance, is also built in compressed data sequences is carried out to collecting in terminal of decompression calculations simultaneously.
(5) use encoder dictionary L to sequence of differences D
t+1d
t+2d
t+nencode, form compressed data sequences L
t+1l
t+2l
t+n, with fiducial value D
btogether be stored as D
bl
t+1l
t+2l
t+n, build compressed data packets PL
w.
(6) by compressed data packets PL
wstore or send to long-range through network.
(7) the predefined encoder dictionary L of reception program foundation is to compressed data packets PL
wthe replacement of encoding, is reduced to D
bd
t+1d
t+2d
t+n.
(8) reception program is based on baseline signal value D
breduction sequence of differences is S
t+0s
t+1s
t+2s
t+n.
In this method, the maximum that signal receives allows time of delay, and the frequency acquisition of signal, is predefined parameter value.Parameter value need to be set according to physiological law and use, and is built in signal processing unit.
In the present invention, calculate ratio juris according to Normal squeezing, by the difference data of higher frequency of utilization is explained with bit still less, the difference data of lower frequency of utilization is explained with more bit, by encoder dictionary, L replaces sequence of differences, thereby describes the variation of signal S in time range W with overall bit still less.
Embodiment 1
1, the beat voltage range of transducer output of pulse is 200mV, and output frequency is 500 times/second, and through amplifying circuit and A/D conversion, the beat excursion [Sm, Sn] of output valve of pulse is [0,4096].Signal processing apparatus adopts the microprocessor based on 32 ARMCortexM0 kernel frameworks, and running frequency is 50MHz, has the Flash space of 256KB and the internal RAM of 64KB, and has configured the additional Flash of 4MB.
2, to carry out the Fixed Time Interval T of signals collecting be 2 milliseconds to harvester, and every 2 milliseconds are obtained the pulse sensor output voltage of beating, and amplify and A/D conversion through signal, keep in order.Every temporary physiology sign signal with 2 bytes store to hold the express ranges of codomain [Sm, Sn].
3., every 60 seconds of data processing unit compresses temporary initial data to process and transmit once to host computer, sends successfully removing temporal data afterwards.
Be that the signal time scope W that each packet should comprise is 60 seconds, 60,000 millisecond, the pulse comprising in raw data packets the data bulk n of beating is 60,000 ÷ 2=30,000 primary signal, the data sizes of memory of 60 seconds primary signals is: 30,000 × 2Bytes=60,000Bytes.
4,, in the time that data processing unit starts to carry out, first, by carrying out the calculating of sequence of differences D of signal, realize the compression of bytecode.
By in advance, to the pulse assessment changing of beating, and to harvester setting, the normal difference range [Dm, Dn] between two adjacent signals is set as [128,127], can be held by 1 byte.
Difference exceeds this scope, think gather signal S
twith respect to signal S
t-1occur jumping or signal interruption, from S
t-1start to carry out the division of data slot and start to set up new compressed data packets.
First physiology sign signal S between the compressed data sequences operating period
t+0for fiducial value D
b, calculating the sequence of differences D between adjacent two physiology sign signals, D comprises (D
t+
1d
t+
2d
t+
n), D
t+
1=S
t+
1-S
t+
0thereby, obtain difference data bag:
D
bD
t+1D
t+2……D
t+n
In the situation that there is not signal interruption, D comprises 30,000-1=29,999 data, and every data are 1B
yte, the data size of D is 29,999 × 1Bytes=29,999Bytes.
Change by sequence of differences, realize compression ratio:
(29,999+2)÷60,000≈50%
5,, on the basis of having set up at sequence of differences D, data processing unit carries out the compression of bit based on encoder dictionary.
By in advance, to the pulse assessment changing of beating, and to harvester setting, harvester is built-in for the encoder dictionary of codomain scope [128,127].
The weight of each coding in encoder dictionary, is presupposed as meeting normal distribution, and once for basis has carried out calculating in advance and solidifying to the weight of each coding.
That is, code " 0 " is the shortest code length, and code " 127 " and " 128 " are the longest code length.Be optimized through Huffman algorithm, in encoder dictionary, code length is 3 bit to 15 bits.
Curing encoder dictionary be built in advance in harvester simultaneously and host computer in.
To the sequence of differences D displacement of encoding, form compressed data sequences L by encoder dictionary
t+1l
t+2l
t+n.Thereby, obtain compressed data packets:
D
bL
t+1L
t+2……L
t+n
To compressed data packets additional packets time started T
t, form packet:
T
tD
bL
t+1L
t+2……L
t+n
To all data calculation check code C of packet
t.Check code uses the CRC16 algorithm of predefine mask table, and result of calculation is appended to compressed data packets, thereby forms packet:
C
tT
tD
bL
t+1L
t+2……L
t+n
6, final data packet transmission is arrived host computer by data processing unit.
If 7 in processing procedure, run into difference and exceed codomain scope [128,127], finish in advance processing and the encapsulation of current data packet, and by the Packet Generation having encapsulated to host computer, simultaneously to exceed the difference D of difference range
t+1corresponding physiology sign signal S
t+
1, and corresponding time T
t+
1for starting point, taking remaining data as terminal, carry out processing and the encapsulation of new packet, until that total data is processed and encapsulated is complete, or run into another off-limits difference.
The present embodiment is as shown in the table to the beat compression ratio contrast of data of pulse.From experimental result, can find out, on embodiment, 8 groups of different pulses data of beating are carried out to data compression process, the mean pressure shrinkage obtaining is 26.79%.Compare with comprising the compression algorithm such as gzip and 7z, there is obvious advantage.
Data original length |
Compression ratio of the present invention |
GZ compression ratio |
7Z compression ratio |
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% |
Mean pressure shrinkage |
26.79% |
46.26% |
31.22% |
Compression ratio size of the present invention is subject to the impact of difference codomain, by the physiology sign signal codomain [Sm forming after A/D is changed, Sn] size and the size of the codomain [Dm, Dn] of the adjacent signals difference that forms of sample frequency adjust, all compression ratio is had a great impact.
The compression method of the present invention's design is compared with additive method, and the memory headroom needing is less, and computation complexity is lower.Therefore, lossless compression method provided by the invention carries out data processing on wireless senser and harvester, and other processing methods have larger advantage relatively, can be applied to the multiple field that utilizes wireless sensor network to carry out the monitoring of physiology sign.
Finally explanation is, above embodiment is only unrestricted in order to technical scheme of the present invention to be described, although with reference to compared with osmanthus embodiment, the present invention being had been described in detail, those of ordinary skill in the art is to be understood that, can modify or be equal to replacement technical scheme of the present invention, and not departing from aim and the scope of the technical program, it all should be encompassed in the middle of claim scope of the present invention.