Data storage method and device, product and digital oscilloscope
By performing time periodic analysis and polynomial fitting of digital oscilloscope data, the storage depth is optimized, and the sampling performance improvement and cost savings are achieved without increasing hardware configuration.
Patent Information
- Application Number
- CN202411303014.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2025-01-07
AI Technical Summary
Digital oscilloscopes record waveforms for longer periods while increasing the sampling frequency while maintaining the recording time, which requires increasing hardware configuration, resulting in increased production costs and fixed storage depth limits sampling performance.
By performing time periodic analysis of the oscilloscope data, determining the fluctuation period and stationary period, using polynomial fitting to compress the fluctuation period data, using the average value instead of the stationary period data, and optimizing the use of storage depth.
Without increasing the hardware configuration, the sampling performance of the digital oscilloscope is improved, and the sampling frequency or longer recording time is achieved, the storage depth is occupied and production costs are saved.
Smart Images

Figure CN119271953A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of signal processing technology, and in particular to a data storage method, device, product and digital oscilloscope. Background Art
[0002] With the development of digital technology, the frequency of digital signals is getting higher and higher, from the early KHz to the current GHz. For example, the clock frequency of DDR5 (Double Data Rate SDRAM) memory can reach more than 2GHz, which poses a challenge to the sampling and storage performance of digital oscilloscopes.
[0003] In the production process of hardware products, digital oscilloscopes are usually used in the quality inspection process to measure hardware signals. The working process of a digital oscilloscope mainly involves: sampling, quantization, encoding, storage and display. Due to the difference between sampling frequency and data processing speed, after the digital oscilloscope samples and quantizes the analog signal, it is necessary to store the encoded binary data first, and then process and display the stored data in the subsequent process.
[0004] The storage depth is the number of waveform data points that can be saved in the internal memory of a digital oscilloscope. Usually, a digital oscilloscope will use the storage depth evenly when saving data. The storage depth is affected by the sampling frequency and recording time of the oscilloscope. When the storage depth of the oscilloscope is fixed, its sampling performance is limited. If you want to increase the sampling frequency, you can only shorten the recording time. If you want to record for a longer time, you can only reduce the sampling frequency. If you want to increase the sampling frequency while maintaining the recording time, or record waveforms for a longer time while maintaining the sampling frequency, you can only increase the hardware configuration of the oscilloscope, which will increase production costs. Therefore, how to improve the sampling performance of the oscilloscope without changing the configuration of the oscilloscope is a problem that needs to be solved. Summary of the invention
[0005] In view of this, the present application aims to propose a data storage method, device, product and digital oscilloscope, so as to improve the sampling performance of the digital oscilloscope without changing the configuration.
[0006] To achieve the above purpose, the technical solution of this application is as follows: A first aspect of an embodiment of the present application provides a data storage method, which is applied to a digital oscilloscope, comprising: Obtaining oscilloscope data according to a time period; the oscilloscope data is obtained through quantization encoding; For each time period, calculating the variance of a plurality of oscilloscope data in the time period as a first variance, and comparing the first variance with a variance threshold; When the first variance is greater than the variance threshold, determining that the time period is a fluctuation period; Performing polynomial fitting on a plurality of oscilloscope data within the fluctuation period to obtain a target polynomial; the target polynomial includes at least 3 target coefficients; Using all target coefficients in the target polynomial as processing values of the fluctuation period; The processed value is used to replace a plurality of oscilloscope data in the fluctuation period for storage.
[0007] Optionally, performing polynomial fitting on a plurality of oscilloscope data within the fluctuation period to obtain a target polynomial includes: Constructing an initial polynomial, and using the initial polynomial to fit a plurality of oscilloscope data within the fluctuation period to obtain a corresponding number of fitting data; the initial polynomial is a second-order polynomial; Calculating an error value according to the plurality of oscilloscope data and the fitting data; Comparing the error value with the variance threshold; if the error value is less than or equal to the variance threshold, determining the initial polynomial as the target polynomial; Each coefficient in the target polynomial is determined as a target coefficient.
[0008] Optionally, after comparing the error value with the variance threshold, the method further includes: When the error value is greater than the variance threshold, the order of the current polynomial is increased by 1 to obtain a new polynomial; Using the new polynomial to fit a plurality of oscilloscope data within the fluctuation period, to obtain a corresponding number of new fitting data; Calculating a new error value according to the plurality of oscilloscope data and the new fitting data; The new error value is compared with the variance threshold; if the new error value is less than or equal to the variance threshold, the new polynomial is determined as the target polynomial.
[0009] Optionally, when the error value is greater than the variance threshold, the method further includes: Compare the order of the current target polynomial with the order threshold; If the order of the current target polynomial reaches the order threshold, stop constructing the new target polynomial; A plurality of oscilloscope data within the fluctuation period are directly stored.
[0010] Optionally, the data storage method further includes: When the first variance is less than or equal to the variance threshold, determining that the time period is a stable period; Calculating an average value of a plurality of oscilloscope data within the stable period; Taking the average value of a plurality of oscilloscope data within the stable period as the processing value of the stable period; The processed value is used to replace a plurality of oscilloscope data in the stable period for storage.
[0011] Optionally, the data storage method further includes: In the case where there are multiple continuous stable periods, an average value of multiple oscilloscope data in each stable period is obtained; According to the arrangement order of each stable period, the average values of multiple oscilloscope data in adjacent stable periods are compared; When the average values of the plurality of oscilloscope data in any two adjacent stable periods are the same, the two adjacent stable periods are merged to obtain an integrated period; Taking the average value corresponding to any stable period in the integration period as the processing value of the integration period; Using the processed value to replace all oscilloscope data in the integration period for storage; In the case where the integration period has a next adjacent stationary period, comparing the processed value of the integration period with an average value corresponding to the next adjacent stationary period; When the processed value of the integration period is the same as the average value corresponding to the next adjacent stable period, the integration period is merged with the stable period to obtain a new integration period; The time period corresponding to the stored processing values is updated to the new integration period, and the stored redundant processing values are removed.
[0012] Optionally, the data storage method further includes: Acquire the vertical resolution of the digital oscilloscope; Based on the vertical resolution, calculating the amount of data that the digital oscilloscope can display in the vertical direction; According to the data quantity, the maximum variance of a plurality of oscilloscope data within a time period is calculated as the variance threshold under the current accuracy.
[0013] According to a second aspect of an embodiment of the present application, a data storage device is provided, for implementing the data storage method provided in the first aspect of the embodiment of the present application, the device comprising: The determination submodule is configured to obtain oscilloscope data according to a time period; the oscilloscope data is obtained through quantization encoding; for each time period, calculate the variance of multiple oscilloscope data in the time period as a first variance, and compare the first variance with a variance threshold; when the first variance is greater than the variance threshold, determine that the time period is a fluctuation period; A first processing module is configured to perform polynomial fitting on a plurality of oscilloscope data within the fluctuation period to obtain a target polynomial; the target polynomial includes at least 3 target coefficients; and all target coefficients in the target polynomial are used as processing values of the fluctuation period; The storage submodule is configured to use the processed value to replace the multiple oscilloscope data in the fluctuation period for storage.
[0014] According to a third aspect of an embodiment of the present application, a digital oscilloscope is provided, comprising: Data acquisition unit, microprocessor and display unit; The data acquisition unit comprises: an analog-to-digital converter, a first processing unit and an acquisition memory; the analog-to-digital converter is used to sample and quantize an input signal to obtain oscilloscope data; the first processing unit is used to execute the data storage method provided in the first aspect of the present application, process the oscilloscope data to obtain corresponding processed values, and use the processed values to replace multiple oscilloscope data in a corresponding time period; the acquisition memory is used to store the processed values; The microprocessor is used to read the processing value of each time period from the acquisition memory and send it to the display unit; The display unit is used to generate and display a target waveform based on the processing values of each time period.
[0015] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the data storage method described in the first aspect of the embodiment of the present application are implemented.
[0016] According to a fifth aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps in the data storage method as described in the first aspect of the embodiment of the present application are implemented.
[0017] The data storage method provided by the present application is adopted to obtain the quantized coded oscilloscope data according to the time period, calculate the first variance of multiple oscilloscope data in each time period, and compare the first variance in the time period with the variance threshold. If the first variance in the time period is greater than the variance threshold, it means that the data fluctuation in the time period is large, that is, the time period is a fluctuation period. For the fluctuation period, data compression is performed by polynomial fitting. Specifically, the oscilloscope data in the time period is polynomially fitted to obtain all target coefficients in the target polynomial, and the target coefficients are used to replace the oscilloscope data in the time period for storage.
[0018] Since the number of target coefficients in the polynomial is much smaller than the number of oscilloscope data in a time period, using target coefficients instead of original oscilloscope data for storage achieves compression of the stored data volume and optimizes the use of storage depth, so that more data can be stored with the same storage depth, thereby improving the sampling performance of the oscilloscope and being able to use a higher sampling frequency or record for a longer time under the same configuration. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0020] Figure 1 It is the working flow chart of digital oscilloscope; Figure 2 is a flow chart of a data storage method proposed in one embodiment of the present application; Figure 3 is a flow chart of processing oscilloscope data in one embodiment of the present application; Figure 4 is a schematic diagram of a data storage device proposed in an embodiment of the present application; Figure 5 is a schematic diagram of a digital oscilloscope proposed in one embodiment of the present application; Figure 6 It is a schematic diagram of an electronic device proposed in an embodiment of the present application. DETAILED DESCRIPTION
[0021] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0022] It should be understood that the references to "one embodiment" or "an embodiment" throughout the specification mean that the specific features, structures, or characteristics associated with the embodiment are included in at least one embodiment of the present application. Therefore, the references to "in one embodiment" or "in an embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0023] In the various embodiments of the present application, it should be understood that the size of the serial numbers of the following processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0024] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects as detailed in the present application.
[0025] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application may be combined with each other.
[0026] The workflow of a digital oscilloscope mainly involves the following steps: sampling, quantization, encoding, storage and display. Figure 1 This is the working flow chart of the digital oscilloscope. Figure 1 As shown in the figure, when the analog signal is input into the oscilloscope, the amplitude is amplified by the vertical gain, and then sampled by the ADC (Analog-to-Digital Converter) to capture a series of sample values of the waveform. The sampled values are quantized into binary data, then encoded into digital signals and stored in the memory, allowing the user to read the data from the memory for analysis. After that, the oscilloscope takes out the digital signal from the memory, and displays it on the display after processing, so that the user can see the waveform of the measured signal on the display.
[0027] The technical parameters of digital oscilloscopes mainly include hardware bandwidth, sampling rate and memory depth. Among them, hardware bandwidth is an indicator of the signal frequency range that the oscilloscope can handle, and sampling rate refers to the number of times the oscilloscope samples the analog signal per second, with Sps (samples per second) as the unit. Memory depth refers to the number of waveform data points that can be stored in the memory inside the oscilloscope, usually in points (points) or megapoints (Mpts). The memory depth of the oscilloscope is related to the sampling rate and the recorded data, as follows: Memory depth = sampling frequency × recording time. This means that when the memory depth of the oscilloscope is fixed, the higher the sampling frequency, the shorter the time that can be recorded.
[0028] The sampling performance of current digital oscilloscopes is limited by the storage depth. In the process of measuring signals and storing them, the oscilloscope uses the storage depth evenly. For example, for a digital oscilloscope with a storage depth of 62.5Mpts, if you want to record a 10ms waveform, the oscilloscope's sampling rate can be set to a maximum of 6.25GS / s. If you want to increase the sampling frequency without shortening the recording time, or write a longer waveform without affecting the sampling frequency, you can only increase the oscilloscope's hardware configuration, that is, replace a larger storage device, which will increase costs.
[0029] Based on the above problems, the present application proposes a solution for storing oscilloscope data, which appropriately compresses the oscilloscope data during storage, thereby reducing the amount of data storage while ensuring data accuracy, thereby saving storage depth occupancy and improving the sampling performance of the oscilloscope.
[0030] The present application will be described in detail below with reference to the accompanying drawings and in combination with embodiments.
[0031] Figure 2 1 is a flow chart of a data storage method proposed in an embodiment of the present application. The method is applied to a digital oscilloscope, such as Figure 2 As shown, the method includes: S1: Acquire oscilloscope data according to a time period; the oscilloscope data is obtained through quantization encoding; S2: for each time period, calculating the variance of a plurality of oscilloscope data in the time period as a first variance, and comparing the first variance with a variance threshold; S3: when the first variance is greater than the variance threshold, determining that the time period is a fluctuation period; S4: performing polynomial fitting on the plurality of oscilloscope data within the fluctuation period to obtain a target polynomial; the target polynomial includes at least 3 target coefficients; S5: taking all target coefficients in the target polynomial as processing values of the fluctuation period; S6: Using the processed value to replace the plurality of oscilloscope data in the fluctuation period for storage.
[0032] In this embodiment, a time period is preset, and the oscilloscope data is processed and stored according to the time period. First, a plurality of oscilloscope data that have been quantized and encoded in each time period are obtained, and the variance of all oscilloscope data in the time period, i.e., the first variance, is calculated. The first variance in a time period is compared with the variance threshold. If the first variance of the current time period is greater than the variance threshold, it means that the data fluctuation in the time period is large, and the time period is determined as a fluctuation period. On the contrary, if the first variance of the current time period is less than or equal to the variance threshold, it means that the data fluctuation in the time period is small, and the time period is determined as a stable period.
[0033] For each fluctuation period, the present application adopts a polynomial to fit all oscilloscope data within each fluctuation period, and finally obtains a corresponding target polynomial for each fluctuation period. It is worth noting that the target polynomial includes at least 3 target coefficients, that is, the order of the target polynomial is not less than 2. After obtaining the target polynomial, each target coefficient in the target polynomial is used as the processing value within the corresponding fluctuation period. The processed value is used to replace the oscilloscope data within the corresponding time period for storage. When the time period is fixed, the higher the oscilloscope sampling frequency, the more oscilloscope data in each time period. The use of polynomial fitting can significantly reduce the amount of data storage, thereby reducing the storage depth occupancy.
[0034] In this embodiment, the quantized and encoded oscilloscope data are grouped according to time periods, variance analysis is performed on the data in each time period, and data with larger fluctuations are screened out for polynomial fitting, thereby achieving compression of the oscilloscope data in the fluctuation period and reducing the occupancy of the oscilloscope storage depth by the oscilloscope data in the fluctuation period, thereby enabling the oscilloscope to increase the sampling frequency or record for a longer time, thereby improving the sampling performance of the oscilloscope.
[0035] As an implementation manner of the present application, the data storage method is characterized by further comprising: Acquire the vertical resolution of the digital oscilloscope; Based on the vertical resolution, calculating the amount of data that the digital oscilloscope can display in the vertical direction; According to the data quantity, the maximum variance of a plurality of oscilloscope data within a time period is calculated as the variance threshold under the current accuracy.
[0036] In one embodiment, the variance threshold is determined based on the vertical resolution and maximum range value of the digital oscilloscope. The display accuracy of the digital oscilloscope is related to the vertical resolution. For a digital oscilloscope with a vertical resolution of k bits, the voltage value that can be recorded is Based on the maximum voltage range value U of the digital oscilloscope, the minimum voltage range that the oscilloscope can distinguish can be calculated. .
[0037] Wherein, k is the vertical resolution of the digital oscilloscope, and U is the maximum range value of the digital oscilloscope.
[0038] For example, for a digital oscilloscope with an 8-bit vertical resolution, there are 2^8=256 voltage values that can be recorded. Assuming that a 3.3V waveform needs to be recorded, the voltage range of the oscilloscope is usually set to -5V to 5V, that is, the maximum range value is 10V. In this case, the minimum voltage range that the oscilloscope can distinguish is calculated to be 39.06mV (approximate value). In other words, when the data fluctuation changes within the range of ±19.5mV (approximate value), the oscilloscope cannot distinguish it and will record all oscilloscope data within the range as the same value.
[0039] For m oscilloscope data in a time period , calculate the variance of all oscilloscope data within the time period for: ; Where m is the number of oscilloscope data in a time period, It is the average value of all oscilloscope data in a time period.
[0040] Since the oscilloscope cannot distinguish the minimum voltage range If the difference between all oscilloscope data in a time period and the average value in the time period is less than the minimum voltage range (i.e. the difference is less than ), the oscilloscope cannot recognize the data fluctuation and will record all the oscilloscope data in the time period as the same value. Therefore, the maximum value of the variance value corresponding to the data fluctuation that the oscilloscope cannot distinguish is taken as the variance threshold, that is, the variance threshold for: ; Wherein, m is the number of oscilloscope data in a time period, k is the vertical resolution of the digital oscilloscope, and U is the maximum range value of the digital oscilloscope.
[0041] In this embodiment, the variance threshold under the current accuracy of the oscilloscope is calculated according to the vertical resolution and the maximum range value of the digital oscilloscope, and then the variance threshold is adjusted for different digital oscilloscopes, so that each time period can be more accurately determined to be a fluctuation period or a stable period. On this basis, when determining whether polynomial fitting is required, it is possible to avoid missing oscilloscope data with large fluctuations, reduce the error between the fitting result and the original oscilloscope data, and improve the accuracy of the fitting result.
[0042] As an implementation mode of the present application, polynomial fitting is performed on a plurality of oscilloscope data within the fluctuation period to obtain a target polynomial, including: Constructing an initial polynomial, and using the initial polynomial to fit a plurality of oscilloscope data within the fluctuation period to obtain a corresponding number of fitting data; the initial polynomial is a second-order polynomial; Calculating an error value according to the plurality of oscilloscope data and the fitting data; Comparing the error value with the variance threshold; if the error value is less than or equal to the variance threshold, determining the initial polynomial as the target polynomial; Each coefficient in the target polynomial is determined as a target coefficient.
[0043] In one embodiment, polynomial fitting is performed on multiple oscilloscope data in each fluctuation period, and the specific process is as follows: (1) Construct an initial second-order polynomial; (2) Fit all oscilloscope data within the fluctuation period based on the initial second-order polynomial. Specifically, assuming that the final target polynomial is a second-order polynomial, the second-order polynomial is used to represent the m data within the fluctuation period: ; Wherein, x represents the time corresponding to the oscilloscope data, and y represents the voltage corresponding to the oscilloscope data.
[0044] All oscilloscope data within the fluctuation period are fitted using the following fitting expression:
[0045] In the above fitting expression, x represents the time corresponding to the oscilloscope data, y represents the voltage corresponding to the oscilloscope data, m is the number of oscilloscope data in the fluctuation period, and n is the order of the polynomial. For example, in the case of a second-order polynomial, the value of n is 2. Using the above fitting expression, the coefficients of the polynomial can be obtained (for example: , , ) value; (3) Further, based on the fitted polynomial, the fitting data corresponding to each oscilloscope data is calculated. Specifically, the time (x value) corresponding to each oscilloscope data is substituted into the fitting expression to calculate the corresponding voltage value (y value). Based on each oscilloscope data and the corresponding fitting data, the error value Z is calculated: ; Where m is the number of oscilloscope data in the time period, is the i-th fitting data in the time period, is the i-th oscilloscope data in the time period; (4) Compare the error value with the variance threshold. If the error value is not greater than the variance threshold, it means that the error caused by the polynomial fitting is smaller than the error caused by the oscilloscope's own accuracy. Therefore, replacing the method of storing the original oscilloscope data with the polynomial fitting method will not affect the oscilloscope's accuracy. On this basis, the polynomial is determined as the target polynomial; (5) The coefficients in the target polynomial are used as target coefficients to replace the multiple oscilloscope data in the time period and stored in the acquisition memory. For example, when the target polynomial is a second-order polynomial, the target coefficients (for example: , , ) replaces the m original oscilloscope data within the time period for storage.
[0046] It is worth noting that in actual application, the time period needs to be divided to ensure that the number of oscilloscope data in each time period is not less than the preset number. The preset number can be defined according to the actual application needs and can be set to an integer greater than 3.
[0047] As an implementation manner of the present application, after comparing the error value with the variance threshold, the method further includes: When the error value is greater than the variance threshold, the order of the current polynomial is increased by 1 to obtain a new polynomial; Using the new polynomial to fit a plurality of oscilloscope data within the fluctuation period, to obtain a corresponding number of new fitting data; Calculating a new error value according to the plurality of oscilloscope data and the new fitting data; The new error value is compared with the variance threshold; if the new error value is less than or equal to the variance threshold, the new polynomial is determined as the target polynomial.
[0048] In the above embodiment, if the error value Z between the fitting data obtained based on the current polynomial fitting and the original oscilloscope data is greater than the variance threshold, it means that the error of the current fitting result is large. Based on this, the order of the current polynomial is increased by 1 (for example, the second-order polynomial is changed to a third-order polynomial), and the new polynomial is used to refit the m oscilloscope data within the time period until the fitting data obtained by the new polynomial fitting has an error less than or equal to the variance threshold with the oscilloscope data, and the new polynomial meets the error accuracy. Further, the new polynomial is used as the target polynomial, and each target coefficient thereof replaces the m oscilloscope data within the time period and is stored as a processed value.
[0049] In this embodiment, the error value between the fitting data and the original oscilloscope data is calculated, the error value is compared with the variance threshold, and the processed value is stored when the error value is less than the variance threshold corresponding to the oscilloscope's own accuracy, thereby ensuring the accuracy of the stored processed value and not causing new errors based on the oscilloscope's own accuracy error range.
[0050] As an implementation manner of the present application, when the error value is greater than the variance threshold, the method further includes: Compare the order of the current target polynomial with the order threshold; If the order of the current target polynomial reaches the order threshold, stop constructing the new target polynomial; A plurality of oscilloscope data within the fluctuation period are directly stored.
[0051] In one embodiment, when the order of the polynomial increases to the order threshold corresponding to the current time period, the polynomial fitting of the oscilloscope data in the changed time period is stopped. In this embodiment, the order threshold is determined based on the amount of oscilloscope data in the current time period: Order threshold = the number of oscilloscope data in the current time period - 2; When the polynomial ends at "m-2", the error value Z still cannot be less than or equal to the variance threshold. If the polynomial coefficient is further increased to "m-1", the new polynomial will contain m coefficients, that is, the number of polynomial coefficients is the same as the number of oscilloscope data in the time period. In this case, continuing to fit will not reduce the amount of stored data. Therefore, when the order of the polynomial reaches the order threshold and the error value Z is still greater than the variance threshold, stop fitting and directly store the original multiple oscilloscope data in the time period as processed values.
[0052] As an implementation manner of the present application, the data storage method further includes: When the first variance is less than or equal to the variance threshold, determining that the time period is a stable period; Calculating an average value of a plurality of oscilloscope data within the stable period; Taking the average value of a plurality of oscilloscope data within the stable period as the processing value of the stable period; The processed value is used to replace a plurality of oscilloscope data in the stable period for storage.
[0053] The change of the signal is not chaotic, and it is often a constant level. For an oscilloscope, if the fluctuation range is smaller than the minimum voltage range that the oscilloscope can recognize, it will be regarded as a constant level by the oscilloscope. In one embodiment, if the first variance of all oscilloscope data in a time period is less than or equal to the variance threshold, it means that the oscilloscope cannot distinguish the data fluctuations in the time period. On this basis, the time period is determined to be a stable period. For a stable period, the average value of all oscilloscope data in the period is stored as the processed value of the stable period, that is, only one processed value needs to be stored in a stable period, replacing multiple original oscilloscope data in the period for storage.
[0054] Figure 3 FIG. 1 is a flow chart of processing oscilloscope data in one embodiment of the present application. Figure 3 As shown, the type of the time period is determined based on the variance threshold, and different steps of compressing the storage data volume are performed respectively.
[0055] Specifically, m oscilloscope data in each time period are read in turn, and the first variance of the m oscilloscope data in the time period is calculated. The first variance is compared with the variance threshold. For the case where it is greater than the variance threshold, it is determined to be a fluctuation period, and the target polynomial is determined by polynomial fitting. During the fitting process, the order of the polynomial is increased by 1 each time until the error Z satisfies less than or equal to the variance threshold, then the current polynomial is determined to be the target polynomial, and all coefficients in the target polynomial are replaced by the original oscilloscope data and written into the acquisition memory for storage. It is worth noting that if the order of the polynomial reaches m-2 and the error value Z is still greater than the variance threshold, the original oscilloscope data in the fluctuation period is directly stored. For the case where the first variance is less than or equal to the variance threshold, it is determined to be a stable period, and a processing value is determined for each stable period by taking the average value and written into the acquisition memory for storage.
[0056] In this embodiment, in addition to using polynomial fitting to reduce the storage depth occupied by the fluctuation period, for the stable period in which the oscilloscope cannot distinguish the data fluctuations, a processing value of the stable period is determined to replace multiple oscilloscope data in the period for storage, thereby achieving compression of the storage data volume of the stable period and further optimizing the storage depth occupation.
[0057] In addition, in actual applications, engineers do not pay attention to all recorded data, but only to a part of it. For example, when measuring the quality of hardware single-ended signal waveforms, engineers often pay more attention to the part of data changes, that is, the data changes in the fluctuation period. The frequency of occurrence of stable periods is much higher than that of fluctuation periods, which leads to a larger proportion of storage depth occupied by the oscilloscope data of stable periods based on the traditional method of uniformly using storage depth, and the oscilloscope data of the fluctuation period that the second engineer focuses on occupies a smaller proportion, resulting in a waste of storage depth. In this embodiment, the data storage capacity compression method for the fluctuation period and the stable period, since only one processing value (average value) needs to be stored for each stable period, the proportion of the data storage capacity of the stable period to the whole is reduced, and a reasonable allocation of the storage depth occupation ratio of the stable period and the fluctuation period is achieved, that is, the interval with larger waveform changes occupies more storage depth, and the interval with smaller waveform changes uses a smaller storage depth, which is convenient for engineers to analyze the time period (fluctuation period) that needs to be focused on.
[0058] As an implementation manner of the present application, the data storage method further includes: In the case where there are multiple continuous stable periods, an average value of multiple oscilloscope data in each stable period is obtained; According to the arrangement order of each stable period, the average values of multiple oscilloscope data in adjacent stable periods are compared; When the average values of the plurality of oscilloscope data in any two adjacent stable periods are the same, the two adjacent stable periods are merged to obtain an integrated period; Taking the average value corresponding to any stable period in the integration period as the processing value of the integration period; Using the processed value to replace all oscilloscope data in the integration period for storage; In the case where the integration period has a next adjacent stationary period, comparing the processed value of the integration period with an average value corresponding to the next adjacent stationary period; When the processed value of the integration period is the same as the average value corresponding to the next adjacent stable period, the integration period is merged with the stable period to obtain a new integration period; The time period corresponding to the stored processing value is updated to the new integration period, and the stored redundant processing value is removed.
[0059] In one embodiment, if there are multiple continuous stable periods, a processing value is determined for each stable period and stored. Specifically, the average value of the oscilloscope data in each stable period is first calculated and written into the acquisition memory as the processing value of the corresponding period. Then, the processing values (average values) of two adjacent stable periods are read from the acquisition memory in sequence for comparison. If the processing values of the current two adjacent stable periods are the same, the two stable periods are integrated, and the time period corresponding to the processing value stored in the memory is updated to the corresponding integration period, and the redundant processing values in the memory are optimized. That is, only one processing value is retained for each integration period in the memory. Further, the processing value of the current integration period and the processing value (average value) of the next adjacent stable period are read from the memory for comparison. If the two are the same, a new integration period is obtained by further integration, and the redundant processing values in the memory are optimized. Repeat the above steps until the processing values of each adjacent integration period or stable period are different, thereby further compressing the amount of stored data of the stable period and further saving the occupation of the storage depth.
[0060] Optionally, in the case where there are multiple consecutive stable cycles, the average value corresponding to the current stable cycle and the average value corresponding to the next stable cycle can also be obtained in chronological order. When the average values corresponding to the two cycles are the same, the integrated cycle is directly integrated to generate the integrated cycle, and the processed value is used as the processed value of the integrated cycle. Then, the average value corresponding to the next stable cycle is obtained and compared with the processed value of the integrated cycle. If the two are the same, the integrated cycle is integrated with the next stable cycle to generate a new integrated cycle, and the processed value is used as the processed value of the new integrated cycle. And so on, until the average value of the next stable cycle is different from the processed value of the current integrated cycle, the processed value corresponding to the current integrated cycle is written into the acquisition memory for storage. Then, the above integration steps are repeated for the next stable cycle. In this embodiment, all adjacent stable cycles with the same average value are first integrated, and then the corresponding processed values are written into the acquisition memory, avoiding a large number of repeated readings of the processed values in the acquisition memory and overwriting the updated data, saving the steps of removing redundant processed values, further saving system processing system resources, and improving storage efficiency.
[0061] Based on the same inventive concept, an embodiment of the present application provides a data storage device. Figure 4 , Figure 4 FIG. 1 is a schematic diagram of a data storage device 100 according to an embodiment of the present application. Figure 4 As shown, the device comprises: The determination submodule 101 is configured to obtain oscilloscope data according to a time period; the oscilloscope data is obtained through quantization coding; for each time period, the variance of multiple oscilloscope data in the time period is calculated as a first variance, and the first variance is compared with a variance threshold; when the first variance is greater than the variance threshold, the time period is determined to be a fluctuation period; The first processing module 102 is configured to perform polynomial fitting on the multiple oscilloscope data within the fluctuation period to obtain a target polynomial; the target polynomial includes at least 3 target coefficients; all the target coefficients in the target polynomial are used as processing values of the fluctuation period; The storage submodule 103 is configured to use the processed value to replace the multiple oscilloscope data in the fluctuation period for storage.
[0062] As an implementation manner of the present application, the first processing module 102 is configured to perform polynomial fitting on a plurality of oscilloscope data within the fluctuation period to obtain a target polynomial, including: Constructing an initial polynomial, and using the initial polynomial to fit a plurality of oscilloscope data within the fluctuation period to obtain a corresponding number of fitting data; the initial polynomial is a second-order polynomial; Calculating an error value according to the plurality of oscilloscope data and the fitting data; Comparing the error value with the variance threshold; if the error value is less than or equal to the variance threshold, determining the initial polynomial as the target polynomial; Each coefficient in the target polynomial is determined as a target coefficient.
[0063] As an implementation manner of the present application, the first processing module 102 is further configured to perform the following steps: When the error value is greater than the variance threshold, the order of the current polynomial is increased by 1 to obtain a new polynomial; Using the new polynomial to fit a plurality of oscilloscope data within the fluctuation period, to obtain a corresponding number of new fitting data; Calculating a new error value according to the plurality of oscilloscope data and the new fitting data; The new error value is compared with the variance threshold; if the new error value is less than or equal to the variance threshold, the new polynomial is determined as the target polynomial.
[0064] As an implementation manner of the present application, the first processing module 102 is further configured to perform the following steps: When the error value is greater than the variance threshold, comparing the order of the current target polynomial with the order threshold; If the order of the current target polynomial reaches the order threshold, stop constructing the new target polynomial; A plurality of oscilloscope data within the fluctuation period are directly stored.
[0065] As an implementation manner of the present application, the determination submodule 101 is configured to determine that the time period is a stable period when the first variance is less than or equal to the variance threshold; The data storage device 100 further includes a second processing module configured to calculate an average value of a plurality of oscilloscope data within the stable period; and use the average value of the plurality of oscilloscope data within the stable period as a processing value of the stable period; The storage submodule 103 is further configured to use the processed value to replace the multiple oscilloscope data in the stable period for storage.
[0066] As an implementation mode of the present application, the second processing module is further configured to obtain the average value of multiple oscilloscope data in each stable period when there are multiple continuous stable periods; compare the average values of multiple oscilloscope data in adjacent stable periods according to the arrangement order of each stable period; when the average values of multiple oscilloscope data in any two adjacent stable periods are the same, merge the two adjacent stable periods to obtain an integrated period; and use the average value corresponding to any stable period in the integrated period as the processing value of the integrated period; The storage submodule 103 is further configured to use the processed value to replace all oscilloscope data in the integration period for storage; The second processing module is further configured to compare the processed value of the integration period with the average value corresponding to the next adjacent stable period when the integration period has a next adjacent stable period; and to merge the integration period with the stable period to obtain a new integration period when the processed value of the integration period is the same as the average value corresponding to the next adjacent stable period. The storage submodule 103 is further configured to update the time period corresponding to the stored processing value to the new integration period, and remove the stored redundant processing values.
[0067] As an implementation manner of the present application, the data storage device 100 further includes an accuracy determination module configured to perform the following steps: Acquire the vertical resolution of the digital oscilloscope; Based on the vertical resolution, calculating the amount of data that the digital oscilloscope can display in the vertical direction; According to the data quantity, the maximum variance of a plurality of oscilloscope data within a time period is calculated as the variance threshold under the current accuracy.
[0068] Based on the same inventive concept, an embodiment of the present application provides a digital oscilloscope. Figure 5 , Figure 5 Schematic diagram of a digital oscilloscope according to an embodiment of the present application. Figure 5 As shown, the digital oscilloscope includes: a data acquisition unit, a microprocessor and a display unit; The data acquisition unit includes: an analog-to-digital converter, a first processing unit and an acquisition memory; the analog-to-digital converter is used to sample and quantize the input signal to obtain oscilloscope data; the first processing unit is used to execute the data storage method described in the above embodiment, process the oscilloscope data to obtain corresponding processing values, and use the processing values to replace multiple oscilloscope data in a corresponding time period; the acquisition memory is used to store the processing values; The microprocessor is used to read the processing value of each time period from the acquisition memory and send it to the display unit; The display unit is used to generate and display a target waveform based on the processing values of each time period.
[0069] Based on the same inventive concept, an embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, the steps in the data storage method described in any of the above embodiments of the present application are implemented.
[0070] Based on the same inventive concept, an embodiment of the present application provides a readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps in the data storage method described in any of the above embodiments of the present application are implemented.
[0071] Based on the same inventive concept, an embodiment of the present application provides an electronic device. Figure 6 Schematic diagram of an electronic device according to an embodiment of the present application. Figure 6 As shown, the electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor; when the processor executes the computer program, the steps in the data storage method described in any of the above embodiments of the present application are implemented.
[0072] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0073] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
[0074] For the method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and components involved are not necessarily required by the present application.
[0075] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the embodiments of the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0076] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0077] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0078] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0079] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they are aware of the basic creative concepts. Therefore, the present application is interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.
[0080] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0081] The data storage method, device, product and digital oscilloscope provided by the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application; at the same time, for general technicians in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A data storage method, characterized in that: Applications in digital oscilloscopes include: Obtaining oscilloscope data according to a time period; the oscilloscope data is obtained through quantization encoding; For each time period, calculating the variance of a plurality of oscilloscope data in the time period as a first variance, and comparing the first variance with a variance threshold; When the first variance is greater than the variance threshold, determining that the time period is a fluctuation period; Performing polynomial fitting on a plurality of oscilloscope data within the fluctuation period to obtain a target polynomial; the target polynomial includes at least 3 target coefficients; Using all target coefficients in the target polynomial as processing values of the fluctuation period; The processed value is used to replace a plurality of oscilloscope data in the fluctuation period for storage.
2. The data storage method according to claim 1, characterized in that: Performing polynomial fitting on a plurality of oscilloscope data within the fluctuation period to obtain a target polynomial includes: Constructing an initial polynomial, and using the initial polynomial to fit a plurality of oscilloscope data within the fluctuation period to obtain a corresponding number of fitting data; the initial polynomial is a second-order polynomial; Calculating an error value according to the plurality of oscilloscope data and the fitting data; Comparing the error value with the variance threshold; if the error value is less than or equal to the variance threshold, determining the initial polynomial as the target polynomial; Each coefficient in the target polynomial is determined as a target coefficient.
3. The data storage method according to claim 2, characterized in that: After comparing the error value with the variance threshold, the method further comprises: When the error value is greater than the variance threshold, the order of the current polynomial is increased by 1 to obtain a new polynomial; Using the new polynomial to fit a plurality of oscilloscope data within the fluctuation period, to obtain a corresponding number of new fitting data; Calculating a new error value according to the plurality of oscilloscope data and the new fitting data; The new error value is compared with the variance threshold; if the new error value is less than or equal to the variance threshold, the new polynomial is determined as the target polynomial.
4. The data storage method according to claim 3, characterized in that: In the case where the error value is greater than the variance threshold, the method further includes: Compare the order of the current target polynomial with the order threshold; If the order of the current target polynomial reaches the order threshold, stop constructing the new target polynomial; A plurality of oscilloscope data within the fluctuation period are directly stored.
5. The data storage method according to claim 1, characterized in that: Also includes: When the first variance is less than or equal to the variance threshold, determining that the time period is a stable period; Calculating an average value of a plurality of oscilloscope data within the stable period; Taking the average value of a plurality of oscilloscope data within the stable period as the processing value of the stable period; The processed value is used to replace a plurality of oscilloscope data in the stable period for storage.
6. The data storage method according to claim 5, characterized in that: Also includes: In the case where there are multiple continuous stable periods, an average value of multiple oscilloscope data in each stable period is obtained; According to the arrangement order of each stable period, the average values of multiple oscilloscope data in adjacent stable periods are compared; When the average values of the plurality of oscilloscope data in any two adjacent stable periods are the same, the two adjacent stable periods are merged to obtain an integrated period; Taking the average value corresponding to any stable period in the integration period as the processing value of the integration period; Using the processed value to replace all oscilloscope data in the integration period for storage; In the case where the integration period has a next adjacent stationary period, comparing the processed value of the integration period with an average value corresponding to the next adjacent stationary period; When the processed value of the integration period is the same as the average value corresponding to the next adjacent stable period, the integration period is merged with the stable period to obtain a new integration period; The time period corresponding to the stored processing values is updated to the new integration period, and the stored redundant processing values are removed.
7. The data storage method according to claim 1, characterized in that: Also includes: Acquire the vertical resolution of the digital oscilloscope; Based on the vertical resolution, calculating the amount of data that the digital oscilloscope can display in the vertical direction; According to the data quantity, the maximum variance of a plurality of oscilloscope data within a time period is calculated as the variance threshold under the current accuracy.
8. A data storage device, characterized in that: Used to implement the method according to any one of claims 1 to 7, comprising: The determination submodule is configured to obtain oscilloscope data according to a time period; the oscilloscope data is obtained through quantization encoding; for each time period, calculate the variance of multiple oscilloscope data in the time period as a first variance, and compare the first variance with a variance threshold; when the first variance is greater than the variance threshold, determine that the time period is a fluctuation period; A first processing module is configured to perform polynomial fitting on a plurality of oscilloscope data within the fluctuation period to obtain a target polynomial; the target polynomial includes at least 3 target coefficients; and all target coefficients in the target polynomial are used as processing values of the fluctuation period; The storage submodule is configured to use the processed value to replace the multiple oscilloscope data in the fluctuation period for storage.
9. A digital oscilloscope, characterized in that: include: Data acquisition unit, microprocessor and display unit; The data acquisition unit comprises: an analog-to-digital converter, a first processing unit and an acquisition memory; the analog-to-digital converter is used to sample and quantize the input signal to obtain oscilloscope data; the first processing unit is used to execute the method according to any one of claims 1 to 7, process the oscilloscope data to obtain corresponding processing values, and use the processing values to replace multiple oscilloscope data in a corresponding time period; the acquisition memory is used to store the processing values; The microprocessor is used to read the processing value of each time period from the acquisition memory and send it to the display unit; The display unit is used to generate and display a target waveform based on the processing values of each time period.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps in any one of the methods of claims 1-7 are implemented.
11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps in the method according to any one of claims 1 to 7 are implemented.
