Parameter change trend determination method and device, equipment and storage medium
By using multiple analog-to-digital conversion sampling and filtering algorithms from sensors, the parameter values and change rates of the target parameters are determined, solving the problem of insufficient accuracy in parameter change rate and enabling real-time monitoring of parameter changes and real-time control of the equipment.
Patent Information
- Application Number
- CN202110745109.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-30
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2041-06-30
AI Technical Summary
Existing technologies lack the precision of parameter change rate, making it impossible to accurately measure minute changes, and they are slow to respond, thus failing to achieve real-time control.
By repeatedly sampling the target parameters using analog-to-digital conversion from the sensor, and combining this with a filtering algorithm to select the sampled values, the parameter values at the target time and historical parameter values are determined, and the rate of parameter change is calculated.
It improves the accuracy of parameter values and the real-time performance of change rate, enabling it to reflect subtle changes and achieve real-time control of equipment.
Smart Images

Figure CN113552997B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the field of data processing, and particularly relates to a parameter change trend determination method and device, equipment and a storage medium. BACKGROUND
[0002] In parameter measurement, the value of the measured parameter is output on a display screen, and the accuracy of the value depends on the graduation value of the parameter display. For example, when measuring temperature, the temperature value is output on the display screen, and the accuracy of the output temperature value depends on the graduation value of the temperature display.
[0003] When observing the change trend of a parameter, generally, when the value of the parameter continuously rises or continuously falls, the residence time of each value is calculated, the number of graduation values changed per unit time is determined based on the residence time of each value, and the change rate is obtained.
[0004] In the above manner, since the graduation value is relatively rough, the subtle change of the parameter cannot be obtained. Therefore, the accuracy of the parameter change rate needs to be improved. SUMMARY
[0005] To solve the above problems in the prior art, i.e., to improve the accuracy of the parameter change rate, the present application provides a parameter change trend determination method, device, equipment and storage medium.
[0006] In a first aspect, the present application provides a parameter change trend determination method, comprising:
[0007] Converting the sensor of the target parameter to analog-to-digital multiple times to obtain multiple sampling values;
[0008] Determining the parameter value of the target parameter at the target time according to the multiple sampling values;
[0009] Determining the parameter change rate of the target parameter at the target time according to the parameter value of the target parameter at the target time and the historical parameter value of the target parameter before the target time.
[0010] In a possible implementation manner, the determining the parameter value of the target parameter at the target time according to the multiple sampling values comprises:
[0011] Filtering the multiple sampling values;
[0012] Determining the parameter value of the target parameter at the target time according to the filtered sampling values.
[0013] In a possible implementation manner, the filtering the multiple sampling values comprises:
[0014] The multiple sampled values are filtered using a filtering algorithm, which includes at least one of the following: extremum removal method, arithmetic mean filtering method, first-order lag filtering method, and hysteresis filtering method.
[0015] In one possible implementation, the filtering algorithm for selecting the plurality of sampled values includes:
[0016] Remove the maximum and minimum values from the multiple sampled values;
[0017] Determine the arithmetic mean of multiple sample values after removing the maximum and minimum values;
[0018] Determine the weighted average of the arithmetic mean and the historical sample values;
[0019] The filtered sampled values are determined based on the historical sampled values and the weighted average value, wherein the historical sampled values are sampled values prior to the target time.
[0020] In one possible implementation, determining the filtered sampled values based on the historical sampled values and the weighted average includes:
[0021] If the absolute value of the difference between the historical sample value and the weighted average is greater than a preset threshold, then the filtered sample value is determined to be the weighted average.
[0022] In one possible implementation, determining the parameter value of the target parameter at the target time based on the filtered sampled values includes:
[0023] Based on the correspondence between the reference sample value and the reference parameter value and the filtered sample value, the parameter value of the target parameter at the target time is determined.
[0024] In one possible implementation, determining the parameter value of the target parameter at the target time based on the correspondence between the reference sample value and the reference parameter value and the filtered sample value includes:
[0025] If the reference sample value includes the filtered sample value, then according to the correspondence, the parameter value of the target parameter at the target time is determined to be the reference parameter value corresponding to the filtered sample value;
[0026] Alternatively, if the reference sample value does not include the filtered sample value, the parameter value of the target parameter at the target time is determined according to the linear interpolation method, the correspondence, and the filtered sample value.
[0027] In one possible implementation, the target parameter has multiple historical parameter values prior to the target time, and the sampling time corresponding to different historical parameter values has a different time interval from the target time; determining the parameter change rate of the target parameter at the target time based on the parameter value of the target parameter at the target time and the historical parameter values of the target parameter prior to the target time includes:
[0028] The rate of change of the parameter is determined based on the difference and time interval between the parameter value of the target parameter at the target time and at least two historical parameter values.
[0029] In one possible implementation, determining the parameter change rate based on the difference and time interval between the target parameter value at the target time and at least two historical parameter values includes:
[0030] The rate of change of the parameter is obtained by weighted summing the differences between the parameter value of the target parameter at the target time and the at least two historical parameter values;
[0031] Different historical parameter values correspond to different weights. Among the at least two historical parameter values, the time interval between the sampling time and the target time corresponding to the historical parameter value with the largest weight has the smallest difference with the reaction time of the sensor.
[0032] In one possible implementation, the method for determining the parameter change trend further includes:
[0033] Based on the parameter value of the target parameter at the target time, update the historical parameter value sequence of the target parameter, wherein the historical parameter value sequence includes the parameter values of the target parameter at multiple historical times.
[0034] Secondly, this application provides a device for determining the trend of parameter changes, comprising:
[0035] The sampling module is used to perform multiple analog-to-digital conversions on the sensor to sample the target parameters and obtain multiple sample values.
[0036] The first determining module is used to determine the parameter value of the target parameter at the target time based on the multiple sampled values;
[0037] The second determining module is used to determine the rate of change of the target parameter at the target time based on the parameter value of the target parameter at the target time and the historical parameter values of the target parameter before the target time.
[0038] Thirdly, this application provides an electronic device, comprising:
[0039] Processor and memory;
[0040] The memory stores computer programs;
[0041] When the processor executes the computer program stored in the memory, it implements the parameter change trend determination method provided by the first aspect or any possible implementation of the first aspect.
[0042] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the parameter change trend determination method provided in the first aspect or any possible implementation thereof.
[0043] Fifthly, this application provides a chip, comprising:
[0044] Processor and memory;
[0045] The memory stores computer programs;
[0046] When the processor executes the computer program stored in the memory, it implements the parameter change trend determination method provided by the first aspect or any possible implementation of the first aspect.
[0047] Sixthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the parameter change trend determination method provided by the first aspect or any possible implementation of the first aspect.
[0048] Those skilled in the art will understand that, in this application, based on multiple sampled values obtained from multiple analog-to-digital conversions of the target parameter by the sensor, the parameter value of the target parameter at the target time is obtained. Based on the parameter value of the target parameter at the target time and the historical parameter values of the target parameter before the target time, the rate of change of the target parameter at the target time is determined. Thus, by multiple analog-to-digital conversions, the accuracy of the parameter value of the target parameter at the target time is improved. By combining the parameter value of the target parameter at the target time and the historical parameter values of the target parameter before the target time, the accuracy of the rate of change of the target parameter at the target time is improved. Attached Figure Description
[0049] Preferred embodiments of the parameter variation trend determination method, apparatus, device, and storage medium of this application will now be described with reference to the accompanying drawings. The drawings are as follows:
[0050] Figure 1 Example diagrams of application scenarios provided in the embodiments of this application;
[0051] Figure 2 This is a flowchart illustrating a method for determining parameter change trends according to an embodiment of this application;
[0052] Figure 3 This is a flowchart illustrating a method for determining parameter change trends provided in another embodiment of this application;
[0053] Figure 4 This is a flowchart illustrating a method for determining parameter change trends provided in another embodiment of this application;
[0054] Figure 5 A schematic diagram of the structure of a parameter change trend determination device provided in an embodiment of this application;
[0055] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0056] First, those skilled in the art should understand that these embodiments are merely for explaining the technical principles of this application and are not intended to limit the scope of protection of this application. Those skilled in the art can make adjustments as needed to adapt to specific application scenarios.
[0057] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to limit the invention. The singular forms "a" and "the" as used in the embodiments of this application are also intended to include the plural forms unless the context clearly indicates otherwise.
[0058] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can be represented as: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0059] Depending on the context, the words “if” or “suppose” as used here can be interpreted as “when” or “in response to determination” or “in response to detection.” Similarly, depending on the context, the phrases “if determination” or “if detection (of the stated condition or event)” can be interpreted as “when determination” or “in response to determination” or “when detection (of the stated condition or event)” or “in response to detection (of the stated condition or event).”
[0060] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a product or system comprising a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a product or system. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the product or system that includes said element.
[0061] When determining the trend of parameter changes, the usual method is to calculate the dwell time of each value as the parameter value rises or falls continuously. Based on the dwell time of each value, the difference in change per unit time is determined, thus obtaining the parameter's rate of change. However, currently, parameter values are usually displayed on the screen, leading to the following shortcomings in the above method:
[0062] On the one hand, the accuracy of the values output by the display screen is limited by the scale value (i.e. the smallest scale value) displayed, and the scale value is usually coarse (for example, the temperature displayed on the air conditioner screen is usually an integer), which affects the accuracy of the parameter change rate and makes it impossible to measure subtle changes.
[0063] On the other hand, when the parameter change rate is low, it often takes a long time to change a single scale value, resulting in a long time to obtain the parameter change rate, a sluggish response, and an inability to control the equipment in real time based on the measured parameter change rate.
[0064] For example, taking a water heater as an example, the water temperature displayed by the water heater is an integer. When the water temperature in the inner tank of the water heater gradually rises and the rate of water temperature change is relatively low, it takes a long time for the displayed water temperature to change from 40 degrees Celsius to 41 degrees Celsius. Only after the displayed water temperature changes from 40 degrees Celsius to 41 degrees Celsius can the rate of water temperature change be measured, and it is impossible to observe more subtle changes, such as the change from 40 degrees Celsius to 40.1 degrees Celsius.
[0065] To address the aforementioned problems, embodiments of this application provide a method for determining parameter change trends. In this method, the parameter value of the target parameter at a target time is determined by multiple analog-to-digital conversion samples from the sensor. The obtained parameter value is not limited by the scale division, thus improving the accuracy of the parameter value. Furthermore, based on the parameter value of the target parameter at the target time and its historical values prior to the target time, the rate of change of the target parameter at the target time is determined, thereby improving the accuracy of the rate of change. This is beneficial for measuring subtle changes in the parameter, enhancing the real-time performance of the rate of change measurement, and facilitating real-time control of equipment based on the rate of change.
[0066] In one example, the target parameter is temperature, and the sensor for the target parameter is a temperature sensor.
[0067] Optionally, the temperature sensor is a negative temperature coefficient (NTC) sensor, or a positive temperature coefficient (PTC) sensor.
[0068] In another example, the target parameter is humidity, and the sensor for the target parameter is a humidity sensor.
[0069] In another example, the target parameter is light intensity, and the sensor for the target parameter is a photoresistor.
[0070] In addition, the target parameters can also be velocity, acceleration, angle, etc., and the sensors for the target parameters can also be accelerometers, gravity sensors, inertial sensors, etc.
[0071] Figure 1 The diagram illustrates application scenarios provided in the embodiments of this application. For example... Figure 1 As shown, this application scenario includes home appliances 110 ( Figure 1 In this example, taking a water heater as an example of a household appliance, the parameter sampling circuit 111 on the appliance 110 collects parameters through sensors and an analog-to-digital converter (ADC) and determines the rate of parameter change. After obtaining the rate of parameter change, the appliance 110 can be controlled according to the rate of parameter change.
[0072] Taking water temperature heating as an example, the heating power of the water heater can be controlled according to the rate of water temperature change. For example, when the rate of water temperature rise is large, the heating power of the water heater can be reduced to improve the safety of the water heater and water use; when the rate of water temperature rise is small, the heating power of the water heater can be increased to improve the heating efficiency of the water heater.
[0073] Taking a cold water injection scenario as an example, the amount or flow rate of cold water injected into the water heater can be controlled according to the rate of change of water temperature. For example, when the rate of decrease in water temperature is greater than a certain threshold, the amount or flow rate of cold water injected is reduced; when the rate of decrease in water temperature is less than another threshold, the amount or flow rate of cold water injected is maintained or increased.
[0074] Optionally, the application scenario may also include server 120 and / or terminal 130. Home appliance 110 can send data collected by temperature sensor and ADC to server 120 and / or terminal 130, determine the parameter change rate on server 120 and / or terminal 130, and then control home appliance 110 based on the parameter change rate. Among them, terminal 130 includes, for example, handheld devices with wireless communication function (e.g., smartphones, tablets), computing devices (e.g., personal computers (PCs)), wearable devices (e.g., smartwatches, smart bracelets), and smart home devices (e.g., smart display devices).
[0075] For example, the execution subject of each method embodiment of this application may be an electronic device, such as... Figure 1 The components include home appliances 110, servers 120, and terminals 130.
[0076] Figure 2 This is a flowchart illustrating a method for determining parameter change trends according to an embodiment of this application. Figure 2 As shown, the method includes:
[0077] S201. The sensor performs multiple analog-to-digital conversions to sample the target parameters, obtaining multiple sampled values.
[0078] In the target parameter sampling circuit, the target parameter sensor can detect the target parameter and respond to changes in the target parameter by causing changes in the analog quantities in the sampling circuit. For example, in the water temperature sampling circuit, the temperature sensor can detect the water temperature and cause changes in analog quantities such as voltage, circuit resistance, or resistance in the sampling circuit according to changes in the water temperature.
[0079] Specifically, in the sampling circuit for the target parameter, in response to the change of the target parameter, the analog quantity related to the sensor of the target parameter changes over time. The analog quantity related to the sensor of the target parameter can be sampled multiple times by analog-to-digital converter (ADC) to obtain multiple sampled values related to the target parameter.
[0080] In one example, the sampled values include current sampled values, voltage sampled values, or resistance sampled values. Multiple analog-to-digital conversion samples are performed on the current of the line where the sensor of the target parameter is located, or multiple analog-to-digital conversion samples are performed on the voltage of the sensor of the target parameter or the voltage of the fixed resistor connected in series with the sensor of the target parameter, or multiple analog-to-digital samples are performed on the resistance of the sensor of the target parameter, to obtain multiple sampled values.
[0081] S202. Based on multiple sampled values, determine the parameter value of the target parameter at the target time.
[0082] The target time refers to the sampling time at which multiple analog-to-digital conversions are performed on the sensor to obtain multiple sample values for the target parameter. For example, if multiple analog-to-digital conversions are performed within the nth second after the sampling circuit is powered on, then the target time is the nth second after the sampling circuit is powered on.
[0083] Specifically, after obtaining multiple sample values, the target parameter value at the target time can be determined based on the characteristics of the sensor and by combining multiple sample values. Compared to directly reading the parameter value displayed on the screen or determining the target parameter value based on only one sample value, determining the parameter value by combining multiple sample values helps improve the accuracy of the parameter value.
[0084] The characteristic of the sensor for the target parameter refers to the one-to-one correspondence between the sensor's sampled values and the target parameter values, allowing the determination of the corresponding parameter values based on the sampled values. Taking water temperature as the target parameter and a temperature sensor as an example, the corresponding water temperature can be obtained based on the sampled values of the temperature sensor. For instance, when the current sampled value is a1, the water temperature is obtained as b1.
[0085] S203. Determine the rate of change of the target parameter at the target time based on the parameter value of the target parameter at the target time and the historical parameter values of the target parameter before the target time.
[0086] This involves performing multiple analog-to-digital conversions on the sensor of the target parameter at sampling times prior to the target time, obtaining multiple historical sampling values. Based on these multiple historical sampling values, the historical parameter value of the target parameter before the target time is determined. There can be one or more historical parameter values. For example, the target time is the nth second after the sampling circuit is powered on, and the sampling times prior to the target time are the nmth second, n-2mth second, etc., at the power-on port of the sampling circuit, where m is the time interval between adjacent sampling times.
[0087] Specifically, after obtaining the parameter value of the target parameter at the target time, the rate of change of the target parameter at the target time can be determined based on the change of the parameter value of the target parameter at the target time compared with the historical parameter value of the target parameter before the target time.
[0088] In this embodiment, the target parameter value is determined in real time based on the sampled values obtained from multiple analog-to-digital conversions, thus overcoming the limitation of the scale value on the parameter value during parameter display and improving the accuracy of the obtained target parameter value. Based on the parameter value and historical parameter values, the parameter change rate of the target parameter is determined, which improves the accuracy of the parameter change rate and can reflect subtle changes in the target parameter. This improves the real-time performance and sensitivity of the parameter change rate, which is beneficial for realizing real-time control of equipment based on the parameter change rate.
[0089] Figure 3A flowchart illustrating a method for determining parameter change trends, provided in another embodiment of this application. Figure 3 As shown, the method includes:
[0090] S301. The sensor performs multiple analog-to-digital conversions to sample the target parameter, obtaining multiple sampled values.
[0091] S301 can be referred to the description of the foregoing embodiments, and will not be repeated here.
[0092] S302. Filter multiple sampled values.
[0093] Specifically, after obtaining multiple sample values, these sample values can be filtered to select the more reliable and accurate ones.
[0094] In some embodiments, a possible implementation of S302 includes filtering multiple sampled values using a filtering algorithm. The filtering algorithm includes at least one of the following: extreme value removal method, arithmetic mean filtering method, first-order lag filtering method, and hysteresis filtering method. Therefore, by combining one or more filtering algorithms, the filtering effect of the sampled values is improved.
[0095] Among them, the extreme value removal method refers to filtering multiple sampled values by removing the maximum and minimum values from multiple filtered sampled values; the arithmetic mean filtering method refers to filtering multiple sampled values by calculating the arithmetic mean; the first-order lag filtering method refers to filtering sampled values by combining the sampled values obtained by analog-to-digital conversion of the sensor of the target parameter at the previous sampling time with the sampled values at the target time; and the hysteresis filtering method refers to filtering sampled values based on the deviation between the sampled values obtained by analog-to-digital conversion of the sensor of the target parameter at the previous sampling time and the sampled values at the target time.
[0096] In the process of filtering multiple sampled values by combining various filtering algorithms such as extremum removal, arithmetic mean filtering, first-order lag filtering, and backtracking filtering, one possible implementation is as follows: remove the maximum and minimum values from the multiple sampled values; determine the arithmetic mean of the multiple sampled values after removing the maximum and minimum values; determine the arithmetic mean and the weighted average of the historical sampled values; and determine the filtered sampled values based on the historical sampled values and the weighted average.
[0097] Among them, the historical sampling value is the sampling value obtained by performing analog-to-digital conversion sampling on the sensor of the target parameter before the target time. Furthermore, the historical sampling value is the sampling value obtained by performing analog-to-digital conversion sampling on the sensor of the target parameter at the sampling time before the target time.
[0098] Specifically, an extremum removal method is used to remove the maximum and minimum values from multiple samples, resulting in the remaining sampled values. An arithmetic mean filtering method is then used to calculate the arithmetic mean of the remaining sampled values. Next, a first-order lag filtering method is used to calculate a weighted average of the historical sampled values and the arithmetic mean. Finally, a lookup-based filtering algorithm is employed to determine the filtered sampled values based on the deviation between the historical sampled values and the weighted average.
[0099] Optionally, when determining the filtered sampled values based on the deviation between historical sampled values and the weighted average, if the absolute value of the difference between the historical sampled values and the weighted average is greater than a preset threshold, then the filtered sampled value is determined to be the weighted average; if the absolute value of the difference between the historical sampled values and the weighted average is less than or equal to the preset threshold, then the weighted average is discarded, and multiple sampled values at the next sampling time of the target time are filtered.
[0100] Therefore, considering that the change in the target parameter is also small when the change in the weighted average relative to the historical sample value is small, there is no need to calculate the parameter change rate. Through the hysteresis filtering algorithm, the weighted average is only retained when the change in the weighted average relative to the historical sample value meets the preset threshold, so as to calculate the parameter change rate of the target parameter based on the weighted average and improve the calculation efficiency of the parameter change rate.
[0101] Optionally, considering that the sampling circuit will lose previous sampling values after power failure, the sampling value obtained from the first analog-to-digital conversion sampling at the first sampling moment when the sampling circuit is powered on can be determined as the historical sampling value.
[0102] Optionally, after the sampling circuit is powered on, the sensor of the target parameter can be sampled by analog-to-digital conversion after the voltage of the sampling circuit stabilizes, thereby improving the accuracy of analog-to-digital conversion sampling.
[0103] In addition to the combination of multiple filtering algorithms provided above, the filtered sampled values can also be obtained by using one or a combination of two or three of the following methods: extremum removal method, arithmetic mean filtering method, first-order lag filtering method, and backtracking filtering method.
[0104] Taking the extreme value method as an example, the maximum and / or minimum values among multiple sampled values are removed. Then, based on the remaining sampled values, the filtered sampled values are determined. For example, a sampled value is randomly selected from the remaining sampled values as the filtered sampled value. Taking the arithmetic mean filtering method as an example, the filtered sampled value is determined as the arithmetic mean of multiple sampled values. Taking the first-order lag filtering algorithm as an example, multiple sampled values can be weighted and averaged with historical sampled values to determine the weighted average of the filtered sampled values. Taking the hysteresis filtering algorithm as an example, the filtered sampled values are determined as those whose absolute value of the deviation from historical sampled values is greater than a preset threshold.
[0105] Taking the extreme value method and arithmetic mean filtering method as an example, after filtering multiple sample values through the extreme value removal method, the final sample value is determined as the arithmetic mean of the remaining sample values. Taking the arithmetic mean filtering method and first-order lag filtering method as another example, the arithmetic mean of multiple sample values is determined, and then the weighted average of the arithmetic mean and historical sample values is determined as the filtered sample value. Here, the cases of combining two or three of the above filtering algorithms are not described in detail.
[0106] S303. Based on the filtered sampled values, determine the parameter values of the target parameters at the target time.
[0107] Specifically, after obtaining the filtered sampled values, the parameter value of the target parameter at the target time can be determined according to the characteristics of the sensor for the target parameter, corresponding to the parameter value of the filtered sampled values. The characteristics of the sensor can be referred to the description in the preceding embodiments.
[0108] In some embodiments, the characteristics of the sensor for the target parameter can be expressed as a formula for calculating the target parameter value, where the sampled value of the sensor for the target parameter is used as input and the target parameter value is used as output. Therefore, based on the formula for calculating the target parameter value, the parameter value corresponding to the filtered sampled values can be obtained.
[0109] In some embodiments, the sensor characteristics of the target parameter can be represented by a pre-set correspondence between reference sample values and reference parameter values, where each reference sample value corresponds to a specific reference parameter value. In this case, a possible implementation of S303 includes: determining the parameter value of the target parameter at the target time based on the correspondence between the reference sample values and reference parameter values and the filtered sample values. Specifically, based on the correspondence between the reference sample values and reference parameter values, the reference parameter value corresponding to the filtered sample value is determined, and the parameter value of the target parameter at the target time is determined to be the reference parameter value corresponding to the filtered sample value. Thus, based on the pre-set correspondence, the accuracy of the parameter value of the target parameter at the target time is improved.
[0110] Optionally, the filtered sampled values are smaller than the interval between adjacent reference sampled values in the correspondence between reference sampled values and reference parameter values. Similarly, the target parameter value at the target time determined based on the filtered parameter values is smaller than the interval between adjacent reference parameter values in the correspondence between reference sampled values and reference parameter values. Therefore, the accuracy of the target parameter value at the target time determined based on the filtered parameter values is higher than the accuracy of the reference parameter values.
[0111] Optionally, considering that the reference sample values may or may not contain filtered sample values, the following can be considered: If the reference sample values include filtered sample values, then the reference parameter value at the target time is determined based on the correspondence between the reference sample values and reference parameter values, corresponding to the filtered sample values; or, if the reference sample values do not include filtered sample values, then the target parameter value at the target time is determined based on the linear interpolation method, the correspondence between the reference sample values and reference parameter values, and the filtered sample values. Thus, different methods are used to determine the target parameter value at the target time depending on the specific circumstances, improving the accuracy of the target parameter value at the target time.
[0112] Furthermore, in the linear interpolation method, two reference sample values that are closest in magnitude to the filtered sample values can be determined from the reference sample values. Linear interpolation is then performed based on these two reference sample values and the reference parameter values corresponding to them to obtain the parameter values corresponding to the filtered sample values, which is to say, the parameter values of the target parameters at the target time.
[0113] As an example, the correspondence between reference sample values and reference parameter values is as follows: reference sample value a1 corresponds to reference parameter value b1, reference sample value a2 corresponds to reference parameter value b2, reference sample value a3 corresponds to reference parameter value b3, ..., reference sample value an corresponds to reference parameter value bn, and the filtered sample value is c. If the value of ai among the reference sample values a1 to an is equal to the value of c, then the parameter value of the target parameter at the target time is determined to be the reference parameter value bi corresponding to the reference sample value ai. If the reference sample values a1 to an do not contain a value equal to c, then the two reference sample values closest to the value of c are determined, and linear interpolation is performed based on these two reference sample values and the reference parameter values corresponding to these two reference sample values to obtain the parameter value of the target parameter at the target time.
[0114] Optionally, when the target parameter is temperature, the correspondence between the reference sampled values and the reference parameter values can be a table showing the correspondence between sampled values and temperature values. After filtering multiple sampled values at the target time, if a filtered sampled value exists in the table, the parameter value of the target parameter at the target time is determined to be the temperature value corresponding to the filtered sampled value. If no filtered sampled value exists in the table, the two closest sampled values are determined, and linear interpolation is performed based on these two closest sampled values and their corresponding temperature values to calculate the parameter value of the target parameter at the target time.
[0115] Optionally, the data type of the target parameter value at the target time can be floating-point to improve the accuracy of the target parameter value at the target time.
[0116] S304. Determine the rate of change of the target parameter at the target time based on the parameter value of the target parameter at the target time and the historical parameter values of the target parameter before the target time.
[0117] S304 can be referred to the description of the foregoing embodiments, and will not be repeated here.
[0118] In this embodiment, based on multiple analog-to-digital conversion samplings and one or more screenings, sampled values related to the target parameter are obtained, improving the accuracy of the sampled values. Based on these sampled values, the parameter value of the target parameter is determined, overcoming the limitation of the scale value on the parameter value during parameter display and improving the accuracy of the obtained target parameter value. Based on the parameter value and historical parameter values, the parameter change rate of the target parameter is determined, improving the accuracy of the parameter change rate, reflecting subtle changes in the target parameter, improving the real-time performance and sensitivity of the parameter change rate, and facilitating real-time control of the device based on the parameter change rate.
[0119] Figure 4 A flowchart illustrating a method for determining parameter change trends, provided in another embodiment of this application. Figure 4 As shown, the method includes:
[0120] S401. The sensor performs multiple analog-to-digital conversions to sample the target parameter, obtaining multiple sampled values.
[0121] S402. Based on multiple sampled values, determine the parameter value of the target parameter at the target time.
[0122] S401 and S402 can be referred to the description of the foregoing embodiments, and will not be repeated here.
[0123] S403. Determine the rate of change of the parameter based on the difference and time interval between the parameter value of the target parameter at the target time and at least two historical parameter values.
[0124] The historical parameter values are the values of the target parameter before the target time. There can be one or more historical parameter values: the target parameter value at the previous sampling time before the target time, the target parameter value at the two sampling times before the target time, and so on. For example, historical parameter values include: the target parameter value 2 seconds before the target time, the target parameter value 4 seconds before the target time, the target parameter value 6 seconds before the target time, and so on.
[0125] Specifically, the shorter the time interval between the sampling time corresponding to the historical parameter value and the target time, the better the difference between the historical parameter value and the target parameter value at the target time reflects the rate of change of the target parameter within a short period, thus improving the real-time performance of the parameter change rate. Conversely, the longer the time interval between the sampling time corresponding to the historical parameter value and the target time, the more accurately the difference between the historical parameter value and the target parameter value at the target time reflects the rate of change of the target parameter at a lower rate of change, thus increasing the stability of the parameter change rate. Therefore, at least two historical parameter values can be combined to determine the rate of change of the target parameter, thus balancing the real-time performance and stability of the parameter change rate.
[0126] Specifically, when determining the rate of change of the target parameter, for each of at least two historical parameter values: determine the difference between the target parameter value at the target time and the historical parameter value, which reflects the change in the target parameter from the sampling time corresponding to the historical parameter value to the target time; determine the time interval between the target time and the sampling time corresponding to the historical parameter value. Combining the difference between the target parameter value at the target time and the at least two historical parameter values, and the time interval, the rate of change of the target parameter is determined.
[0127] For example, if the temperature at the target time is T, the historical temperature value 2 seconds before the target time is T1, and the historical temperature value 4 seconds before the target time is T2, then the difference between the temperature at the target time and the historical temperature value 2 seconds before the target time is determined as T-T1, with a time interval of 2 seconds; the difference between the temperature at the target time and the historical temperature value 2 seconds before the target time is determined as T-T2, with a time interval of 4 seconds. Combining T-T1, 2 seconds, T-T2, and 4 seconds, the rate of temperature change is determined.
[0128] In this embodiment, sampled values are obtained based on multiple analog-to-digital conversions. Based on the sampled values, the parameter values of the target parameters are determined, which solves the limitation of the scale value on the parameter values when displaying the parameters and improves the accuracy of the obtained parameter values of the target parameters. Based on the parameter values and at least two historical parameter values, the parameter change rate of the target parameters is determined, which further improves the accuracy of the parameter change rate and enables the parameter change rate to reflect subtle changes in the target parameters.
[0129] In some embodiments, a possible implementation of S403 includes: weighted summing of the differences between the target parameter value at the target time and at least two historical parameter values to obtain the parameter change rate. Among the at least two historical parameter values in the weighted summation with the target parameter value at the target time, different historical parameter values correspond to different weights, and the sum of the weights corresponding to all historical parameter values is 1. Thus, by weighted summation, the differences between the target parameter value at the target time and at least two historical parameter values are combined. Furthermore, by adjusting the weights corresponding to the historical parameter values, parameter change rates with different emphases can be obtained. For example, if a more real-time parameter change rate is desired, the weights corresponding to historical parameter values closer to the target time are increased, and the weights corresponding to historical parameter values farther from the target time are decreased; if a more stable parameter change rate is desired, the weights corresponding to historical parameter values farther from the target time are increased.
[0130] Optionally, among the at least two historical parameter values participating in the weighted summation, the historical parameter value with the largest weight has the smallest difference between the time interval between its sampling time and the target time and the sensor's reaction time. In other words, among the at least two historical parameter values participating in the weighted summation, the time interval between each historical sample value and the target time is determined, and this time interval is compared with the sensor's reaction time. The weight of the historical sample value with the smallest difference between the time interval and the sensor's reaction time is set as the largest weight among all historical sample values. Among the at least two historical parameter values participating in the weighted summation, the historical parameter value whose time interval with the target time is closest to the sensor's reaction time can more accurately capture changes in the sensor, best reflects the sensor's sensing characteristics, and is beneficial for improving the accuracy of the parameter change rate.
[0131] Optionally, among the at least two historical parameter values participating in the weighted summation, the maximum time interval between the sampling time corresponding to the historical parameter value and the target time is at least a preset multiple of the minimum time interval between the sampling time corresponding to the historical parameter value and the target time. For example, if the preset multiple is 5, and the historical parameter value closest to the target time is the historical parameter value 2 seconds before the target time, then the historical parameter value farthest from the target time is the historical parameter value at least 10 seconds before the target time.
[0132] Optionally, in addition to historical parameter values where the time interval between the sampling time and the target time is less than the sensor's reaction time, and historical parameter values where the time interval between the sampling time and the target time is greater than the sensor's reaction time, the historical parameter values included in the weighted summation may also include historical parameter values where the time interval between the sampling time and the target time is equal to or close to the sensor's reaction time. Thus, while considering the real-time nature and stability of the parameter change rate, the sensor's reaction time, being the most characteristic feature, is taken into account, ensuring that the obtained parameter change rate closely matches the sensor's reaction time to a certain extent.
[0133] Optionally, among the at least two historical parameter values involved in the weighted summation, the sampling time corresponding to the historical parameter value with the largest time interval between it and the target time has a time interval between it and the target time that is greater than the sensor's reaction time, in order to improve the stability of the parameter change rate.
[0134] Furthermore, the formula for calculating the parameter change rate can be: Parameter change rate = (Parameter value at the target time - Historical parameter value before t1 at the target time) × (t / t1) × w1 + (Parameter value at the target time - Historical parameter value before t2 at the target time) × (t / t2) × w2 + (Parameter value at the target time - Historical parameter value before t3 at the target time) × (t / t3) × w3.
[0135] Where t1 is less than the sensor's reaction time, t2 is equal to or close to the sensor's reaction time, and t3 is greater than the sensor's reaction time. w1, w2, and w3 are the weights corresponding to the historical parameter values before t1, t2, and t3 of the target time, respectively, and w1 + w2 + w3 = 1, where t is the unit time. w1 is the response speed compensation; increasing w1 helps improve the timeliness of the parameter change rate, and increasing w3 helps increase the output response to lower parameter change rates, that is, it helps to obtain the parameter change rate under low parameter change rate conditions.
[0136] As an example, the temperature change rate is calculated every 2 seconds, with a unit time of 1 minute. The formula for calculating the temperature change rate is: Parameter change rate = (Temperature value at the target time - Temperature value 2 seconds before the target time) × 30 × w1 + (Temperature value at the target time - Temperature value 10 seconds before the target time) × 6 × w2 + (Temperature value at the target time - Temperature value 1 minute before the target time) × w3.
[0137] In some embodiments, if the parameter change rate is calculated at preset intervals, or if the target parameter value is calculated at preset intervals based on multiple sampled values obtained from modulus change sampling, then a historical parameter value sequence of the target parameter is constructed based on the parameter values of the target parameter at different sampling times. The constructed historical parameter value sequence includes the parameter values of the target parameter at multiple historical times. For example, if the preset interval is 2 seconds, the historical parameter value sequence includes 30 element values, which are the parameter values of the target parameter 2 seconds, 4 seconds, 6 seconds, ..., 60 seconds before the target time.
[0138] Optionally, the method for determining the parameter change trend further includes: updating the historical parameter value sequence of the target parameter based on the parameter value of the target parameter at the target time. Thus, after obtaining the parameter value of the target parameter at the target time, the parameter value of the target parameter at the target time is added to the historical parameter sequence to update the historical parameter sequence in a timely manner.
[0139] Optionally, the length of the historical parameter value sequence remains fixed. During the process of updating the historical parameter value sequence based on the target parameter's value at the target time, the parameter value with the furthest time interval from the target time can be deleted, and the target parameter's value at the target time can be added to the historical parameter value sequence in chronological order. In other words, each element in the historical parameter sequence is shifted one step further in time, and the target parameter's value at the target time is added as the most recent element in the historical parameter sequence.
[0140] Figure 5 A schematic diagram of a parameter change trend determination device provided in an embodiment of this application. Figure 5 As shown, the device for determining the parameter change trend includes:
[0141] The sampling module 501 is used to perform multiple analog-to-digital conversion sampling of the target parameter by the sensor to obtain multiple sampled values;
[0142] The first determining module 502 is used to determine the parameter value of the target parameter at the target time based on multiple sampled values;
[0143] The second determining module 503 is used to determine the rate of change of the target parameter at the target time based on the parameter value of the target parameter at the target time and the historical parameter values of the target parameter before the target time.
[0144] In one possible implementation, the first determining module 502 is specifically used to: filter multiple sampled values; and determine the parameter value of the target parameter at the target time based on the filtered sampled values.
[0145] In one possible implementation, the first determining module 502 is specifically used to: filter multiple sampled values through a filtering algorithm, the filtering algorithm including at least one of the following: extreme value removal method, arithmetic mean filtering method, first-order lag filtering method, and hysteresis filtering method.
[0146] In one possible implementation, the first determining module 502 is specifically used to: remove the maximum and minimum values from multiple sampled values; determine the arithmetic mean of the multiple sampled values after removing the maximum and minimum values; determine the weighted average of the arithmetic mean and the historical sampled values; and determine the filtered sampled values based on the historical sampled values and the weighted average, wherein the historical sampled values are sampled values before the target time.
[0147] In one possible implementation, the first determining module 502 is specifically used to: if the difference between the historical sample value and the weighted average is greater than a preset threshold, then determine the filtered sample value as the weighted average.
[0148] In one possible implementation, the first determining module 502 is specifically used to: determine the parameter value of the target parameter at the target time based on the correspondence between the reference sample value and the reference parameter value and the filtered sample value.
[0149] In one possible implementation, the first determining module 502 is specifically used to: if the reference sample value includes the filtered sample value, then determine the parameter value of the target parameter at the target time according to the correspondence relationship, which is the reference parameter value corresponding to the filtered sample value; or, if the reference sample value does not include the filtered sample value, then determine the parameter value of the target parameter at the target time according to the linear interpolation method, the correspondence relationship and the filtered sample value.
[0150] In one possible implementation, the target parameter has multiple historical parameter values before the target time, and the sampling time corresponding to different historical parameter values has a different time interval with the target time; the second determining module 503 is specifically used to: determine the parameter change rate based on the difference and time interval between the target parameter value at the target time and at least two historical parameter values.
[0151] In one possible implementation, the second determining module 503 is specifically used to: perform a weighted summation of the differences between the target parameter value at the target time and at least two historical parameter values to obtain the parameter change rate; wherein, different historical parameter values correspond to different weights, and among at least two historical parameter values, the time interval between the sampling time and the target time corresponding to the historical parameter value with the largest weight has the smallest difference with the sensor's reaction time.
[0152] In one possible implementation, the parameter change trend determination device further includes:
[0153] An update module (not shown) is used to update the historical parameter value sequence of the target parameter based on the parameter value of the target parameter at the target time. The historical parameter value sequence includes the parameter values of the target parameter at multiple historical times.
[0154] Figure 5 The provided parameter change trend determination device can execute the aforementioned corresponding method embodiments, and its implementation principle and technical effect are similar, so it will not be described again here.
[0155] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown below. Figure 6 As shown, the electronic device includes a processor 601 and a memory 602; the memory 602 stores a computer program; the processor 601 executes the computer program stored in the memory to implement the steps of the parameter change trend determination method in the above-described method embodiments.
[0156] In the aforementioned water heater, the memory 602 and the processor 601 are electrically connected directly or indirectly to enable data transmission or interaction. For example, these components can be electrically connected to each other via one or more communication buses or signal lines, such as a bus connection. The memory 602 stores computer execution instructions that implement data access control methods, including at least one software function module that can be stored in the memory 602 in the form of software or firmware. The processor 601 executes various functional applications and data processing by running the software programs and modules stored in the memory 602.
[0157] The memory 602 may be, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), etc. The memory 602 stores programs, which are executed by the processor 601 upon receiving execution instructions. Furthermore, the software programs and modules within the memory 602 may include an operating system, which may include various software components and / or drivers for managing system tasks (e.g., memory management, storage device control, power management, etc.) and can communicate with various hardware or software components to provide an operating environment for other software components.
[0158] Processor 601 can be an integrated circuit chip with signal processing capabilities. The aforementioned processor 601 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor.
[0159] An embodiment of this application also provides a chip, including: a processor and a memory; the memory stores a computer program, and when the processor executes the computer program stored in the memory, it implements the parameter change trend determination method provided in the above-described method embodiments.
[0160] An embodiment of this application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the parameter change trend determination method provided in the above-described method embodiments.
[0161] An embodiment of this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the parameter change trend determination method provided in the above-described method embodiments.
[0162] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0163] The technical solutions of this application have been described above with reference to the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of this application is obviously not limited to these specific embodiments. Without departing from the principles of this application, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the scope of protection of this application.
Claims
1. A method for determining the trend of parameter changes, characterized in that, include: The analog quantity corresponding to the target parameter of the sensor is sampled multiple times by analog-to-digital conversion to obtain multiple sampled values; Remove the maximum and minimum values from the multiple sampled values; Determine the arithmetic mean of multiple sample values after removing the maximum and minimum values; Determine the weighted average of the arithmetic mean and the historical sampled values; wherein the historical sampled values are the sampled values prior to the target time. If the absolute value of the difference between the historical sample value and the weighted average is greater than a preset threshold, then the filtered sample value is determined to be the weighted average. Based on the filtered sampled values, determine the parameter values of the target parameter at the target time; The rate of change of the target parameter is obtained by weighted summing the differences between the target parameter value at the target time and at least two historical parameter values; the target parameter has multiple historical parameter values before the target time, and the time interval between the sampling time corresponding to different historical parameter values and the target time is different; Different historical parameter values correspond to different weights. Among the at least two historical parameter values, the time interval between the sampling time and the target time corresponding to the historical parameter value with the largest weight has the smallest difference with the reaction time of the sensor.
2. The method for determining the parameter variation trend according to any one of claims 1, characterized in that, The step of determining the parameter value of the target parameter at the target time based on the filtered sampled values includes: Based on the correspondence between the reference sample value and the reference parameter value and the filtered sample value, the parameter value of the target parameter at the target time is determined.
3. The method for determining parameter change trends according to claim 2, characterized in that, The step of determining the parameter value of the target parameter at the target time based on the correspondence between the reference sample value and the reference parameter value and the filtered sample value includes: If the reference sample value includes the filtered sample value, then according to the correspondence, the parameter value of the target parameter at the target time is determined to be the reference parameter value corresponding to the filtered sample value; Alternatively, if the reference sample value does not include the filtered sample value, the parameter value of the target parameter at the target time is determined according to the linear interpolation method, the correspondence, and the filtered sample value.
4. The method for determining the parameter change trend according to any one of claims 1, characterized in that, The method for determining the parameter change trend also includes: Based on the parameter value of the target parameter at the target time, update the historical parameter value sequence of the target parameter, wherein the historical parameter value sequence includes the parameter values of the target parameter at multiple historical times.
5. A device for determining the trend of parameter changes, characterized in that, include: The sampling module is used to perform multiple analog-to-digital conversions on the analog quantity corresponding to the target parameter from the sensor to obtain multiple sampled values; The first determining module is used to remove the maximum and minimum values from multiple sampled values; Determine the arithmetic mean of multiple sample values after removing the maximum and minimum values; Determine the arithmetic mean and the weighted average of the historical sampled values; based on the historical sampled values and the weighted average, determine the filtered sampled values, where the historical sampled values are the sampled values before the target time. If the absolute value of the difference between the historical sample value and the weighted average is greater than a preset threshold, then the filtered sample value is determined to be the weighted average. Based on the filtered sampled values, determine the parameter values of the target parameter at the target time; The second determining module is used to determine the rate of change of the target parameter at the target time based on the parameter value of the target parameter at the target time and the historical parameter values of the target parameter before the target time. The second determining module is specifically used to perform a weighted summation of the differences between the target parameter value at the target time and at least two historical parameter values to obtain the parameter change rate; the target parameter has multiple historical parameter values before the target time, and the sampling time corresponding to different historical parameter values has a different time interval between the target time and the sampling time corresponding to the target time; wherein, different historical parameter values correspond to different weights, and among the at least two historical parameter values, the time interval between the sampling time corresponding to the historical parameter value with the largest weight and the target time has the smallest difference with the reaction time of the sensor.
6. An electronic device, characterized in that, include: Processor and memory; The memory stores computer programs; When the processor executes the computer program stored in the memory, it implements the parameter change trend determination method according to any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the parameter change trend determination method according to any one of claims 1 to 4.
8. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, is used to implement the parameter change trend determination method according to any one of claims 1 to 4.
Citation Information
Patent Citations
System and method for determining sensor accuracy of a portable electronic device
CN104111088A
Service index prediction method and device
CN111695791A
Sampling value obtaining method and device and air conditioner
CN112283882A
Control method and device of electronic expansion valve and electrical equipment
CN112484348A