Efficient codec for electrical signals
12212343 ยท 2025-01-28
Assignee
Inventors
Cpc classification
International classification
Abstract
A method for compressing a signal, the method comprising: acquiring, via a signal recording module, a primary signal; modelling, via a processor, a model signal of the primary signal by: acquiring, via the processor, a sampled signal; acquiring, via the processor, a windowed signal; and extracting, via the processor: a fundamental frequency waveform having a fundamental magnitude and a fundamental phase; and at least one harmonic frequency waveform having a harmonic magnitude and a harmonic phase; wherein the model signal comprises the fundamental frequency waveform and the at least one harmonic frequency waveform; calculating, via the processor, an error signal between a reconstructed signal and the primary signal; determining, via the processor, an optimal gain from at least; an averaging step providing an average value, a predefined threshold, and a scaled signal.
Claims
1. A method for compressing a primary signal, the method comprising: acquiring, via a signal recording module, the primary signal; modelling, via a processor, a model signal of the primary signal by: acquiring, via the processor, a sampled signal from the primary signal; acquiring, via the processor, a windowed signal from the sampled signal; and extracting from the windowed signal, via the processor: a fundamental frequency waveform having a fundamental magnitude, a fundamental phase, and a fundamental frequency; at least one harmonic frequency waveform having a harmonic magnitude, a harmonic phase, and a harmonic frequency; and recreating the model signal from the fundamental frequency waveform and the at least one harmonic frequency waveform; calculating, via the processor, an error signal between the model signal and the primary signal; determining, via the processor, an optimal gain by iteratively: i) multiplying a historical error signal with a predetermined gain to create a scaled signal; ii) averaging a difference between the error signal and the scaled signal to obtain an average value; iii) comparing the average value with a predetermined threshold; and upon determining that the average value meets the predetermined threshold, setting the optimal gain to the predetermined gain; upon determining that the average value does not meet the predetermined threshold, adjusting the predetermined gain, and repeating steps i), ii), and iii) with the adjusted predetermined gain; subtracting the error signal from the historical error signal to create a residual signal; and vector quantising the residual signal as a number of residual indexes; and composing, via the processor, a compressed signal, wherein the compressed signal comprises: the fundamental phase; the fundamental magnitude; the fundamental frequency; the harmonic phase; the harmonic magnitude; the harmonic frequency; the optimal gain; and the residual indexes.
2. The method of claim 1, wherein: the sample signal is acquired by sampling, via the processor, the primary signal at the Nyquist rate; the windowed signal is acquired by applying, via the processor, a window function to the sampled signal; and the fundamental frequency waveform and the at least one harmonic frequency waveform are extracted by applying, via the processor, a Fast Fourier Transform to the windowed signal.
3. The method of claim 1, wherein the predetermined gain is adjusted, via the processor, using a stochastic descent algorithm.
4. The method of claim 1, wherein the residual signal is vector quantised with respect to a predefined codebook, wherein the predefined codebook is stored in a data store of an energy management system.
5. The method of claim 1, wherein the residual signal is delta encoded, thereby producing a delta encoded coefficient.
6. A method for decompressing a compressed primary signal obtained through the method as claimed in claim 1, the method comprising: extracting, via a processor, the fundamental phase, the fundamental magnitude, the fundamental frequency, the harmonic phase, the harmonic magnitude, the harmonic frequency, the optimal gain, and the residual indexes; and reconstructing, via the processor, a decompressed primary signal from the fundamental phase, the fundamental magnitude, the fundamental frequency, the harmonic phase, the harmonic magnitude, the harmonic frequency. the optimal gain, and the residual indexes.
7. The method according to claim 6, further comprising recreating the residual signal by: comparing, via the processor, the residual indexes to a predefined codebook, wherein the predefined codebook is stored in a data store; and recreating, via the processor, the residual signal with respect to the predefined codebook based on the residual indexes.
8. The method according to claim 6, wherein reconstructing the decompressed primary signal comprises: summing, via the processor, the residual signal with a historic residual signal multiplied by the optimal gain, thereby creating a summed residual signal; recreating, via the processor, a sinusoidal component of the decompressed primary signal based on: the fundamental phase; the fundamental magnitude; the fundamental frequency; the harmonic phase; the harmonic magnitude; and the harmonic frequency; summing, via the processor, the summed residual signal and the sinusoidal component, thereby reconstructing the decompressed primary signal.
9. The method according to claim 8, wherein the historical residual signal is a previous residual signal from a previous time interval stored in the data store.
10. A system for decompressing a compressed primary signal, the system comprising: a receiver configured to receive the compressed primary signal; a data store comprising: a predefined codebook; and a historic residual signal; and a decompression unit comprising a processor, the processor being configured to implement a decompression method as claimed in claim 6.
11. A system for compressing a primary signal, the system comprising: a signal recording module configured to acquire the primary signal; a data store comprising: a historical error signal; a predefined codebook; and a processor configured to: implement a compression method as claimed in claim 1; and a transmitter configured to transmit the compressed primary signal.
Description
DETAILED DESCRIPTION
(1) Specific embodiments will now be described by way of example only, and with reference to the accompanying drawings, in which:
(2)
(3)
(4)
(5)
(6) Referring to
(7) In use, and with reference to
(8) At step 202, the signal recording module 102 records a primary signal 203. The primary signal may be a current or voltage signal corresponding to the circuit 101.
(9) At step 204, the processor 110 samples the primary signal at the Nyquist rate, thereby creating a sampled signal 205.
(10) At step 206, the processor 110 applies a hamming window to the sampled signal 205, thereby creating a windowed signal 207.
(11) At step 208, the processor 110 applies a Fast Fourier Transform to the windowed signal 207, thereby creating a spectrum 209 of the windowed signal 207.
(12) At step 210, the processor 110 extracts a fundamental signal and a first six harmonic signals from the spectrum 209.
(13) At step 212, the processor 110 extracts a fundamental magnitude, a fundamental phase and a fundamental frequency from the fundamental signal of the spectrum 209. The processor 110 further extracts a harmonic magnitude, a harmonic phase and a harmonic frequency from each of the six harmonic signals of the spectrum 209. The fundamental magnitude, fundamental phase, harmonic magnitude and harmonic phase are stored in the data store 104.
(14) At step 214, the processor 110 recreates a model signal 215 using the fundamental magnitude, the fundamental phase, the fundamental frequency, the harmonic magnitude, the harmonic phase, and the harmonic frequency.
(15) At step 216, the processor 110 subtracts the model signal 215 from the primary signal 205, thereby creating an error signal 217.
(16) At step 218, the processor 110 initiates an iterative process by multiplying the historic error signal 105 by the predefined gain 107. The multiplication by the predefined gain 107 thereby creates a scaled signal 219.
(17) At step 220, the processor 110 subtracts the scaled signal 219 from the error signal 217. The subtractions of the scaled signal 2019 from the error signal 217 thereby creates a resulting signal 221.
(18) At step 222, the processor 110 calculates the average value of the difference and compares the average value with the predefined threshold 109.
(19) At step 224, if the average value meets the predefined threshold 109, then step 226 does not occur and the predefined gain is output as an optimal gain 225. If the average value does not meet the predefined threshold 109, then step 226 occurs.
(20) At step 226, the predefined gain is adjusted to a new gain 227 using a stochastic descent algorithm and steps 218 to 224 are repeated with the predefined gain 107 being the new gain 227.
(21) At step 228, the processor 110 subtracts the error signal 217 from the historical error signal 105, thereby creating a residual signal 229.
(22) At step 230, the processor 110 compares the residual signal 229 to the indexes in the codebook 111 in order to vector quantise the residual signal 229 as a number of residual indexes 231.
(23) At step 232, the processor 110 composes a compressed signal 233 comprising the fundamental magnitude, the fundamental phase, the fundamental frequency, the harmonic magnitude, the harmonic phase, the harmonic frequency, the optimal gain 225 and the residual indexes 231. It should be noted that the compressed signal 233 comprises the harmonic magnitude, the harmonic phase and the harmonic frequency of each of the six harmonic waveforms.
(24) At step 234, the transmitter 108 transmits the compressed signal 233.
(25) With reference to
(26) The decompression unit 300 comprises a processor 302, a receiver 304 and a data store 306. The data store 306 comprises a codebook 308 and a historic residual signal 312. The codebook 308 is substantially similar to the codebook 111 as described in
(27) In use, and with reference to
(28) At step 402, receiver 304 receives the compressed signal 233 and stores the compressed signal 233 in the data store 306. The compressed signal 233 comprises the fundamental magnitude, the fundamental phase, the fundamental frequency, the harmonic magnitude, the harmonic phase, the harmonic frequency, the optimal gain 225 and the residual indexes 231.
(29) At step 404, the processor 302 compares the residual indexes 231 to the indexes in the codebook 308 and creates a reconstructed residual signal 405 based on the indexes that match the residual indexes 231. The reconstructed residual signal 405 will be similar, but with some information lost, to the residual signal 229.
(30) At step 406, the processor multiplies the historic residual signal 312 by the optimal gain 225, thereby creating a scaled historic residual signal 407.
(31) At step 408, the processor sums the reconstructed residual signal 405 with the scaled historic residual signal 407, thereby creating a summed residual signal 409.
(32) At step 410, the processor combines the fundamental magnitude, the fundamental phase, the fundamental frequency, thereby creating a fundamental sinusoidal signal 411.
(33) At step 412, the processor combines the harmonic magnitude, the harmonic phase, and the harmonic frequency, thereby creating a harmonic sinusoidal signal 413.
(34) At step 414, the processor sums the fundamental sinusoidal signal 411 with the harmonic sinusoidal signal 413, thereby creating a sinusoidal signal 415.
(35) At step 416, the processor sums the sinusoidal signal 415 with the summed residual signal 409, thereby creating a decompressed signal 417. The decompressed signal 417 is substantially similar to the primary signal 203 but with some information lost.
(36) It will be appreciated that the above described embodiments are given by way of example only and that various modifications may be made to the described embodiments without departing from the scope of the invention as defined by the appended claims. For example, the primary signal may be current, voltage or any other circuit indicator. Further, there could be any number of harmonic signals extracted from the primary signal. Further, the primary signal may be sampled at any sampling rate and any windowing function may be applied to the sampled signal. Further, any suitable algorithm may be used to converge on an optimal gain value.