Method for predicting occupancy rate, air conditioner control method, electronic equipment and air conditioner
By constructing an occupancy prediction model of LSTM and attention mechanism, and extracting hidden states and context vectors based on historical timing feature data, the problem of occupancy prediction delay in air conditioning control is solved, and accurate occupancy prediction and air conditioning parameter adjustment is achieved, reducing energy consumption and improving comfort.
Patent Information
- Application Number
- CN202510732010.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-03
- Publication Date
- 2025-08-01
AI Technical Summary
Existing air conditioning control technology relies on real-time data, resulting in delays in occupancy prediction and inability to accurately predict occupancy in advance.
By obtaining the timing feature data of multiple historical moments, using LSTM and attention mechanisms to build an occupancy prediction model, extracting hidden states and context vectors, performing feature mapping to predict the occupancy rate at the target moment, and adjusting the air conditioner operating parameters according to the prediction results.
It achieves accurate prediction of occupancy rates in advance, reduces energy consumption, improves air conditioning control accuracy and comfort, and reduces energy waste.
Smart Images

Figure CN120403067A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of air conditioners, and in particular, to a method for predicting occupancy rate, an air conditioner control method, an electronic device, and an air conditioner. Background Art
[0002] In the existing control technology of air conditioners, there have been studies attempting to optimize the operation of air conditioners by using sensors to monitor the occupancy rate in real time. However, these methods rely on instant data and thus need to perform regulation based on the instant data. From obtaining the instant data to performing regulation and then completing the regulation, there is a certain time delay. Accordingly, how to accurately predict the occupancy rate in advance has become a topic that needs attention. Summary of the Invention
[0003] Embodiments of this application provide a method for predicting occupancy rate, an air conditioner control method, an electronic device, and an air conditioner, so as to at least solve the technical problem of accurately predicting the occupancy rate in advance.
[0004] According to a first aspect of the embodiments of this application, a method for predicting occupancy rate is provided, and the method includes:
[0005] Obtain time series feature data at multiple historical moments, where the time series feature data at the historical moments includes the occupancy rate corresponding to the historical moments, and also includes at least one of the time feature and the environmental feature corresponding to the historical moments;
[0006] Determine the hidden state of each historical moment according to the time series feature data at the multiple historical moments;
[0007] Determine a context vector according to the hidden state of each historical moment and the weighted information of the hidden state of each historical moment;
[0008] Perform feature mapping according to the context vector to obtain the occupancy rate at the target moment.
[0009] Optionally, in an implementation manner of this embodiment, the environmental feature includes at least one of the outdoor environment and the indoor environment corresponding to the historical moment, and the time feature includes the time feature corresponding to the historical moment.
[0010] Optionally, in an implementation manner of this embodiment, the determining the hidden state of each historical moment according to the time series feature data at the multiple historical moments includes:
[0011] Input the time series feature data at the multiple historical moments into a prediction module of an occupancy rate prediction model to obtain the hidden state of each historical moment, where the prediction module takes the time series feature data at the multiple historical moments as input and the hidden state of each historical moment as output; and / or,
[0012] Determining a context vector according to the hidden state at each historical moment and the weighted information of the hidden state at each historical moment includes:
[0013] Inputting the temporal feature data of the hidden state at each historical moment into the attention module of the occupancy rate prediction model to obtain the context vector, where the attention module takes the hidden state at each historical moment as input and the context vector as output; and / or,
[0014] Obtaining the occupancy rate at the target moment according to the context vector includes:
[0015] Inputting the context vector into the fully connected layer of the occupancy rate prediction model to obtain the occupancy rate at the target moment, where the fully connected layer takes the context vector as input and the occupancy rate at the target moment as output.
[0016] Optionally, in an implementation manner of this embodiment, the occupancy rate prediction model includes the prediction module, the attention module, and the fully connected layer through which the feature data flows in sequence.
[0017] Optionally, in an implementation manner of this embodiment, the prediction module includes 1 input layer and 2 LSTM layers, the attention module includes 1 attention layer, and the number of feature dimensions output by the 2 LSTM layers is the same as that of the 1 attention layer.
[0018] Optionally, in an implementation manner of this embodiment, the number of the multiple historical moments is the same as the number of the target moments.
[0019] In a second aspect of the embodiments of the present application, a method for predicting the occupancy rate is provided, and the method includes:
[0020] Obtaining the temporal feature data of multiple historical moments, where the temporal feature data of the historical moment includes the occupancy rate corresponding to the historical moment, and also includes at least one of the time feature and the environmental feature corresponding to the historical moment;
[0021] Inputting the temporal feature data of the multiple historical moments into the occupancy rate prediction model to obtain the occupancy rate at the target moment;
[0022] Wherein, the occupancy rate prediction model is used to predict the occupancy rate at the target moment according to the hidden state at each historical moment and the weighted information of the hidden state at each historical moment, wherein the hidden state at each historical moment is determined according to the temporal feature data at each historical moment.
[0023] Optionally, in an implementation of this embodiment, the environmental feature includes at least one of the outdoor environment and the indoor environment corresponding to a historical moment, and the time feature includes the time feature corresponding to the historical moment.
[0024] Optionally, in an implementation of this embodiment, the occupancy rate prediction model includes a prediction module, an attention module, and a fully connected layer through which the feature data flows in sequence.
[0025] Optionally, in an implementation of this embodiment, the prediction module takes the time series feature data of the multiple historical moments as input and outputs the hidden state of each historical moment.
[0026] The attention module takes the hidden state of each historical moment as input and outputs a context vector, which is determined according to the hidden state of each historical moment and the weighted information of the hidden state of each historical moment.
[0027] The fully connected layer takes the context vector as input and outputs the occupancy rate at the target moment.
[0028] Optionally, in an implementation of this embodiment, the prediction module includes a 1-layer input layer and 2-layer LSTM layers, the attention module includes a 1-layer attention layer, and the number of characteristic dimensions output by the 2-layer LSTM layers and the 1-layer attention layer is the same.
[0029] Optionally, in an implementation of this embodiment, the number of the multiple historical moments is the same as the number of the target moments.
[0030] A third aspect of the embodiments of the present application provides an air conditioner control method, and the method includes:
[0031] Predicting the occupancy rate at the target moment by using the method according to any one of the first aspect or the second aspect;
[0032] Adjusting the operating parameters of the air conditioner according to the occupancy rate at the target moment.
[0033] Optionally, in an implementation of this embodiment, the operating parameters of the air conditioner include at least one of a set temperature, a wind speed, and a fresh air volume.
[0034] Optionally, in an implementation of this embodiment, the adjusting the operating parameters of the air conditioner according to the occupancy rate at the target moment includes:
[0035] Adjusting the set temperature and / or the wind speed in the operating parameters of the air conditioner at the nearest moment according to the occupancy rate at the nearest moment in the target moments, where the higher the occupancy rate at the nearest moment is, the lower the set temperature is, or the higher the wind speed is;
[0036] and / or
[0037] Adjust the fresh air volume in the operating parameters of the air conditioner at the nearest moment according to the occupancy rate at the nearest moment among the target moments and the indoor air quality at the nearest moment.
[0038] Optionally, in an implementation manner of this embodiment, the adjusting the operating parameters of the air conditioner according to the occupancy rate at the target moment includes:
[0039] Compare the occupancy rate at the nearest moment among the target moments with the actual occupancy rate at the nearest moment;
[0040] Adjust the operating parameters of the air conditioner according to the magnitude relationship between the occupancy rate at the nearest moment and the actual occupancy rate at the nearest moment.
[0041] Optionally, in an implementation manner of this embodiment, the adjusting the operating parameters of the air conditioner according to the magnitude relationship between the occupancy rate at the nearest moment and the actual occupancy rate at the nearest moment includes:
[0042] In the case where the occupancy rate at the nearest moment is greater than the actual occupancy rate at the nearest moment and the difference is within a set range, perform at least one of raising the set temperature, lowering the wind speed, and reducing the fresh air volume; and / or
[0043] In the case where the actual occupancy rate at the nearest moment is greater than the occupancy rate at the nearest moment and the difference is within a set range, perform at least one of lowering the set temperature, increasing the wind speed, and increasing the fresh air volume; and / or
[0044] In the case where the absolute value of the difference between the actual occupancy rate at the nearest moment and the actual occupancy rate at the nearest moment exceeds a range not less than the set range, control the operating parameters of the air conditioner according to the actual occupancy rate at the nearest moment.
[0045] Fourthly, an embodiment of the present application provides an electronic device, which includes a memory and a processor. Among them, the memory is used to store computer instructions, and the processor is used to implement the method of the first aspect, the second aspect or the third aspect according to the computer instructions.
[0046] Fifthly, an embodiment of the present application provides an air conditioner, which adopts the method of any one of the first aspect, the second aspect or the third aspect, or the air conditioner includes the electronic device of the fourth aspect.
[0047] By using the method provided by the embodiment of the present application, the occupancy rate can be predicted relatively accurately in advance, and then the air conditioner can be controlled according to the predicted occupancy rate to reduce energy consumption. Description of the Drawings
[0048] Figure 1 It is a schematic flowchart of a method for predicting occupancy rate provided by an embodiment of the present application;
[0049] Figure 2 It is a schematic flowchart of a method for predicting occupancy rate provided by an embodiment of the present application;
[0050] Figure 3 It is a schematic flowchart of an air conditioner control method provided by an embodiment of the present application;
[0051] Figure 4 It is a schematic structural diagram of an occupancy rate prediction model provided by an embodiment of the present application;
[0052] Figure 5 It is a schematic diagram of the content of data recording provided by an embodiment of the present application. Detailed implementation manners
[0053] In order to enable those skilled in the art to better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0054] It should be understood that the "multiple" mentioned herein means two or more. In the description of the embodiments of the present application, unless otherwise specified, " / " means "or", for example, A / B may mean A or B; the "and / or" herein is only a description of the association relationship of the associated objects, indicating that there can be three relationships, for example, A and / or B may mean: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in order to clearly describe the technical solutions of the embodiments of the present application, in the embodiments of the present application, terms such as "first" and "second" are used to distinguish the same items or similar items with basically the same functions and effects. Those skilled in the art can understand that the terms "first" and "second" do not limit the quantity and execution order, and the terms "first" and "second" do not necessarily mean different
[0055] In addition, the terms "comprise" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that comprises a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or are inherent to these process, method, product or device.
[0056] Figure 1It is a schematic flowchart of a method for predicting occupancy rate according to an embodiment of the present application. Refer to Figure 1 , the method includes the following processing procedures.
[0057] 100: Obtain the time series feature data of multiple historical moments. The time series feature data of the historical moments includes the occupancy rate corresponding to the historical moment, and at least one of the time feature and the environmental feature corresponding to the historical moment.
[0058] In this embodiment, the data corresponding to the historical moment is actual data. Among them, the actual occupancy rate can be estimated through access control data or sensor (such as image acquisition camera, people counting sensor, etc.) data. The environmental feature includes at least one of the outdoor environment and the indoor environment corresponding to the historical moment, and the time feature includes the time feature corresponding to the historical moment. The outdoor environment includes parameters such as outdoor temperature, outdoor humidity, and wind speed, which can be obtained through the meteorological service application structure. The indoor environment includes parameters such as indoor temperature, indoor humidity, and indoor carbon dioxide concentration, which can be collected through sensors built in the air conditioning system or sensors arranged indoors.
[0059] 102: Determine the hidden state of each historical moment according to the time series feature data of the multiple historical moments. Among them, the hidden state is used to represent the context feature from the past to the current time step in the sequence, reflects the dynamic pattern changing with time in the data, and can be directly used for subsequent tasks, which is beneficial to making the prediction result more accurate.
[0060] 104: Determine the context vector according to the hidden state of each historical moment and the weighted information of the hidden state of each historical moment. The context vector here is used to represent the dynamic aggregation of the historical time series key information required for the current time step task. Exemplarily, the context vector contains both short-term patterns adjacent to the current moment (such as the recent memory of LSTM) and long-term dependencies at a long distance (such as time series periodic features).
[0061] 106: Obtain the occupancy rate of the target moment through feature mapping according to the context vector.
[0062] By using the method provided in this embodiment, the hidden state is extracted based on the time series feature data of the historical moment, and then the context vector is determined according to the hidden state and its corresponding weighted information, and then the occupancy rate of the target moment is obtained through feature mapping according to the context vector, which can predict the occupancy rate in advance and relatively accurately.
[0063] Optionally, in an implementation manner of this embodiment, the above processing 102 may be implemented in the following manner: input the time series feature data of the multiple historical moments into the prediction module of the occupancy rate prediction model to obtain the hidden state of each historical moment. The prediction module takes the time series feature data of the multiple historical moments as input and outputs the hidden state of each historical moment. By adopting this implementation manner, the hidden state corresponding to the time series feature data can be efficiently and accurately extracted.
[0064] Optionally, in an implementation manner of this embodiment, the above processing 104 may be implemented in the following manner: input the time series feature data of the hidden state of each historical moment into the attention module of the occupancy rate prediction model to obtain the context vector. The attention module takes the hidden state of each historical moment as input and outputs the context vector. By adopting this implementation manner, a context vector combined with the attention pattern can be obtained. Through the attention mechanism, the model assigns weights to the hidden states of each historical moment. The higher the weight, the more important the moment is for the current prediction task. The context vector contains both short-term patterns adjacent to the current moment (such as the recent memory of LSTM) and long-term dependencies at a distance. Moreover, the context vectors at different time steps will adaptively adjust the semantic focus according to the task requirements.
[0065] Optionally, in an implementation manner of this embodiment, the above processing 106 may be implemented in the following manner: input the context vector into the fully connected layer of the occupancy rate prediction model to obtain the occupancy rate at the target moment. The fully connected layer takes the context vector as input and outputs the occupancy rate at the target moment. By adopting this implementation manner, a relatively accurate occupancy rate at the target moment can be obtained.
[0066] Optionally, in an implementation manner of this embodiment, the occupancy rate prediction model includes the prediction module, the attention module, and the fully connected layer through which the feature data flows in sequence. By adopting this occupancy rate prediction model, the occupancy rate at the target moment can be obtained based on the time series feature data of the historical moments.
[0067] Optionally, in an implementation manner of this embodiment, the prediction module includes 1 input layer and 2 LSTM layers, the attention module includes 1 attention layer, and the number of feature dimensions output by the 2 LSTM layers and the 1 attention layer is the same.
[0068] Optionally, in an implementation manner of this embodiment, the number of the multiple historical moments is the same as the number of the target moments. For example, the number of multiple historical moments is 24, and the number of target moments is also 24.
[0069] Figure 2is a schematic flowchart of a method for predicting occupancy rate according to this embodiment. Refer to Figure 2 , the method includes the following processing procedures.
[0070] 200: Obtain the time series feature data of multiple historical moments. The time series feature data of the historical moments includes the occupancy rate corresponding to the historical moment, and also includes at least one of the time feature and the environmental feature corresponding to the historical moment.
[0071] In this embodiment, the data corresponding to the historical moment is actual data. Among them, the actual occupancy rate can be estimated through access control data or sensor (such as, image acquisition camera, people counting sensor, etc.) data. The environmental feature includes at least one of the outdoor environment and the indoor environment corresponding to the historical moment, and the time feature includes the time feature corresponding to the historical moment. The outdoor environment includes parameters such as outdoor temperature, outdoor humidity, wind speed, etc., which can be obtained through the meteorological service application structure. The indoor environment includes parameters such as indoor temperature, indoor humidity, indoor carbon dioxide concentration, etc., which can be collected through the sensors built in the air conditioning system or the sensors arranged indoors.
[0072] 202: Input the time series feature data of the multiple historical moments into the occupancy rate prediction model to obtain the occupancy rate of the target moment. Among them, the occupancy rate prediction model is used to predict the occupancy rate of the target moment according to the hidden state of each historical moment and the weighted information of the hidden state of each historical moment, where the hidden state of each historical moment is determined according to the time series feature data of each historical moment.
[0073] Using the method provided in this embodiment, the hidden state is extracted based on the time series feature data of the historical moment, and then the context vector is determined according to the hidden state and its corresponding weighted information, and then the occupancy rate of the target moment is obtained through feature mapping according to the context vector, which can predict the occupancy rate in advance and relatively accurately.
[0074] Optionally, in an implementation manner of this embodiment, the occupancy rate prediction model includes a prediction module, an attention module, and a fully connected layer through which the feature data flows in sequence.
[0075] Optionally, in an implementation manner of this embodiment, the prediction module takes the time series feature data of the multiple historical moments as input and outputs the hidden state of each historical moment; the attention module takes the hidden state of each historical moment as input and outputs the context vector, and the context vector is determined according to the hidden state of each historical moment and the weighted information of the hidden state of each historical moment; the fully connected layer takes the context vector as input and outputs the occupancy rate of the target moment.
[0076] Optionally, in one implementation of this embodiment, the prediction module includes 1 input layer and 2 LSTM layers, and the attention module includes 1 attention layer. The number of feature dimensions output by the 2 LSTM layers is the same as that of the 1 attention layer. By combining LSTM with the attention mechanism, the time series features of the occupancy rate can be accurately captured, while the prior art lacks the ability to predict the future occupancy rate trend.
[0077] Optionally, in one implementation of this embodiment, the number of the multiple historical moments is the same as the number of the target moments.
[0078] Figure 3 is a schematic flowchart of an air conditioner control method according to an embodiment of the present application. Referring to Figure 3 , the method includes the following processing procedures.
[0079] 300: Predict the occupancy rate at the target moment. For the specific method of predicting the occupancy rate, reference can be made to the method shown in Figure 1 or Figure 2 .
[0080] 302: Adjust the operating parameters of the air conditioner according to the occupancy rate at the target moment. Exemplarily, the operating parameters of the air conditioner include at least one of the set temperature, wind speed, and fresh air volume.
[0081] By using the method provided in this embodiment, the air conditioner can be controlled in advance according to the predicted occupancy rate, solving the dependence on real-time data in the prior art.
[0082] Optionally, in one implementation of this embodiment, 302 is implemented in the following manner: According to the occupancy rate at the nearest moment among the target moments, adjust the set temperature and / or wind speed in the operating parameters of the air conditioner at the nearest moment, where the higher the occupancy rate at the nearest moment, the lower the set temperature or the higher the wind speed; and / or, according to the occupancy rate at the nearest moment among the target moments and the indoor air quality at the nearest moment, perform hierarchical adjustment on the fresh air volume in the operating parameters of the air conditioner at the nearest moment.
[0083] Among them, exemplarily, the indoor air quality includes the carbon dioxide concentration. The hierarchical adjustment includes: When the indoor carbon dioxide concentration reaches the first concentration threshold and the occupancy rate reaches the first occupancy rate threshold, control the fresh air volume at the first fresh air volume; when the indoor carbon dioxide concentration reaches the second concentration threshold and the occupancy rate reaches the second occupancy rate threshold, control the fresh air volume at the second fresh air volume; the first concentration threshold is less than the second concentration threshold, the first occupancy rate threshold is less than the second occupancy rate threshold, and the first fresh air volume is less than the second fresh air volume.
[0084] Optionally, in an implementation manner of this embodiment, according to the magnitude relationship between the occupancy rate at the nearest moment and the actual occupancy rate at the nearest moment, the operating parameters of the air conditioner are adjusted, including: when the occupancy rate at the nearest moment is greater than the actual occupancy rate at the nearest moment and the difference is within a set range, at least one of raising the set temperature, lowering the wind speed, and reducing the fresh air volume is executed; when the actual occupancy rate at the nearest moment is greater than the occupancy rate at the nearest moment and the difference is within a set range, at least one of lowering the set temperature, increasing the wind speed, and increasing the fresh air volume is executed; when the absolute value of the difference between the actual occupancy rate at the nearest moment and the actual occupancy rate at the nearest moment exceeds a set range, the operating parameters of the air conditioner are controlled according to the actual occupancy rate at the nearest moment. Among them, exemplarily, the adjustment benchmarks for temperature, wind speed, and fresh air volume are all relative to the default values (for example, the default parameters when starting up).
[0085] In an embodiment of the present application, as Figure 4 shown, the occupancy rate prediction model includes an input layer, an LSTM layer 1, an LSTM layer 2, an attention layer, and a fully connected layer. The following combines Figure 4 to elaborate on an embodiment of the present application in detail.
[0086] In this embodiment, it mainly includes the following processing procedures.
[0087] First, data collection and preprocessing are performed.
[0088] Among them, the data sources include:
[0089] Historical occupancy rate data: The number of card swipes recorded by the access control system, the number of Wi-Fi connected devices, or the number of people counted by the camera, reflecting the occupancy situation in the past period of time.
[0090] Weather data: including parameters such as temperature, humidity, and wind speed, which can be obtained through the meteorological service API (such as the interface of the China Meteorological Administration).
[0091] Time features: including day of the week (1-7), whether it is a holiday (0 or 1), working day status (0 or 1), etc.
[0092] Real-time sensor data: Environmental parameters such as indoor temperature, humidity, and CO2 concentration collected by the sensors built into the air conditioning system.
[0093] For the data obtained through the above data sources, the following data processing can be performed:
[0094] Data cleaning: Abnormal values (such as occupancy rates exceeding the building capacity or negative values) are removed, and missing values are filled using the linear interpolation method.
[0095] Feature engineering: Convert dates into numerical features, for example, encoding "Monday" as 1.
[0096] Normalize weather data (such as temperature and humidity), shrinking the range to [0, 1].
[0097] Data integration: Integrate the above data and sensor data at corresponding times into a multi-dimensional time series dataset at an hourly granularity. Each record contains a timestamp (hourly granularity), occupancy rate, weather parameters (temperature, humidity, wind speed, etc.), time features (day of the week, whether it is a holiday, working day status, etc.), and real-time sensor data (indoor temperature, humidity, CO2 concentration, etc.). The dimension is 24×n (n is the number of features). Among them, if the acquisition frequency of sensor data is higher than once per hour (for example, once every 5 minutes), it can be aggregated (for example, taking the average) to match the hourly time granularity.
[0098] An exemplary data record is as Figure 5 shown and will not be elaborated here.
[0099] Next, build a prediction model. It mainly includes the following processing procedures.
[0100] Regarding model selection, the embodiment of this application uses a long short-term memory network (LSTM) combined with an attention mechanism to build a prediction model: LSTM is suitable for time series and can capture the long-term dependence relationship of the occupancy rate. It controls the information flow through a gating mechanism (input gate, forget gate, output gate). The attention mechanism enhances the model's attention to key time steps and features, improving the prediction accuracy.
[0101] Regarding the model structure. Input layer: Receive multi-dimensional data for the past 24 hours (N = 24), including occupancy rate, weather, and time features, with an input dimension of 24×n.
[0102] LSTM layer:
[0103] It contains 2 layers, with 128 units in each layer, capturing the dynamic patterns of time series.
[0104] At each time step t, the LSTM unit receives the input x_t, the hidden state h_{t - 1} of the previous time step, and the cell state c_{t - 1}, and outputs h_t and c_t.
[0105] Calculation formula:
[0106] f_t = sigmoid(W_f * [h_{t - 1}, x_t] + b_f) / / Forget gate
[0107] i_t = sigmoid(W_i * [h_{t - 1}, x_t] + b_i) / / Input gate
[0108] $c_{\widetilde{t}}=\tanh(W_c \cdot [h_{t - 1}, x_t] + b_c)$ / / Candidate cell state
[0109] $c_t = f_t \cdot c_{t - 1}+i_t \cdot c_{\widetilde{t}}$ / / Cell state update
[0110] $o_t=\sigma(W_o \cdot [h_{t - 1}, x_t] + b_o)$ / / Output gate
[0111] $h_t = o_t \cdot \tanh(c_t)$ / / Hidden state
[0112] Note:
[0113] $f_t$: Forget gate, controlling how much information from the previous time step is forgotten.
[0114] $i_t$: Input gate, controlling the degree of update of the current input.
[0115] $c_{\widetilde{t}}$: Candidate cell state, the potential update value at the current time step.
[0116] $c_t$: Cell state, the updated long - term memory.
[0117] $o_t$: Output gate, controlling the amount of information output.
[0118] $h_t$: Hidden state, serving as the output at the current time step.
[0119] $W_f, W_i, W_c, W_o$: Weight matrices.
[0120] $b_f, b_i, b_c, b_o$: Bias vectors.
[0121] $\sigma$: Activation function, $\sigma(x)=\frac{1}{1 + e^{-x}}$.
[0122] $\tanh$: Hyperbolic tangent function, $\tanh(x)=\frac{e^x - e^{-x}}{e^x + e^{-x}}$.
[0123] Output dimension: $24\times128$ (each LSTM layer outputs 128 - dimensional features).
[0124] Attention layer:
[0125] Receives the LSTM output ($24\times128$ matrix) and calculates the attention weights for each time step.
[0126] Adopts the Bahdanau attention mechanism, with the calculation formula:
[0127] score_t = v_a^T * tanh(W_a * h_t + b_a) / / Attention score
[0128] alpha_t = softmax(score_t) / / Attention weight
[0129] c = sum(alpha_t * h_t) / / Context vector
[0130] Note:
[0131] score_t: Attention score, measuring the importance of time step t.
[0132] alpha_t: Attention weight, normalized by softmax, where softmax(x_i) = exp(x_i) / sum(exp(x_j)).
[0133] c: Context vector, the weighted feature representation.
[0134] v_a^T: Weight vector (transpose form) of the attention layer.
[0135] W_a: Weight matrix.
[0136] b_a: Bias vector.
[0137] Output: Context vector c (128 - dimensional). [[ID=3,2]]
[0138] Fully - connected layer:
[0139] Map the context vector to the predicted occupancy rate for the next 24 hours. The calculation formula (in numerical text format):
[0140] y_hat = W_fc * c + b_fc
[0141] Note:
[0142] y_hat: Predicted output, with a dimension of 24×1, representing the hourly occupancy rate for the next 24 hours.
[0143] W_fc: Weight matrix of the fully - connected layer.
[0144] b_fc: Bias vector
[0145] Regarding model training. Training data: Use historical data for 3 consecutive months, with 80% as the training set and 20% as the validation set. Loss function: Mean Squared Error (MSE), and the calculation formula is:
[0146] where yi is the actual occupancy rate, is the predicted value, and N is the number of samples.
[0147] Optimizer: Adam optimizer with an initial learning rate of 0.001.
[0148] Training parameters: Train for 100 epochs, and adopt the early stopping mechanism (stop if the validation set loss does not decrease for 10 consecutive rounds).
[0149] Regarding the control logic, it mainly includes the following content.
[0150] Occupancy rate prediction: For example, run the occupancy rate prediction model once per hour to predict the hourly occupancy rate for the next 24 hours.
[0151] Output format: Occupancy rate values for 24 time steps, in percentage (0% - 100%).
[0152] Regarding the adjustment of air conditioner parameters, according to the predicted occupancy rate, dynamically adjust the operating parameters of the air conditioning system. The specific rules are as follows:
[0153] Temperature control: Occupancy rate > 50%: Set the temperature to 22°C. Occupancy rate 20% - 50%: Set the temperature to 24°C. Occupancy rate < 20%: Set the temperature to 26°C.
[0154] Wind speed control: Occupancy rate > 50%: Set the wind speed to high. Occupancy rate 20% - 50%: Set the wind speed to medium. Occupancy rate < 20%: Set the wind speed to low.
[0155] Fresh air volume control: When the indoor CO2 concentration > 800 ppm or the occupancy rate > 30%, increase the fresh air volume to 50% of the maximum value; when the indoor CO2 concentration > 1600 ppm or the occupancy rate > 80%, increase the fresh air volume to 100% of the maximum value.
[0156] Regarding real-time feedback and adjustment.
[0157] Real-time sensor monitoring: Collect the indoor temperature, humidity, and CO2 concentration every 5 minutes.
[0158] Deviation correction: In the case where the occupancy rate at the most recent moment is greater than the actual occupancy rate at the most recent moment and the difference is within a set range (for example, the difference is less than 10%), perform at least one of raising the set temperature, lowering the wind speed, and reducing the fresh air volume; and / or,
[0159] In the case where the actual occupancy rate at the most recent moment is greater than the occupancy rate at the most recent moment and the difference is within a set range (for example, the difference is less than 10%), perform at least one of lowering the set temperature, increasing the wind speed, and increasing the fresh air volume; and / or,
[0160] When the absolute value of the difference between the actual occupancy rate at the most recent moment and the actual occupancy rate at the most recent moment exceeds a set range of not less than (for example, the difference is greater than or equal to 10%), control the operating parameters of the air conditioner according to the actual occupancy rate at the most recent moment.
[0161] Regarding experimental verification. The building type that can be selected for the experimental environment is a 100-square-meter high-rise home living room equipped with an air conditioning system. For data collection, it can be continuously collected for 3 months, covering weekdays and holidays.
[0162] Regarding the performance evaluation of adopting this embodiment. Prediction accuracy: It is evaluated by the root mean square error (RMSE), and the formula is:
[0163] The experimental results show that RMSE < 5%.
[0164] Energy efficiency improvement: Compared with traditional timing control, the energy consumption is reduced by 15%.
[0165] Comfort index: The temperature fluctuation is controlled within ±1°C, and the CO2 concentration is maintained below 800 ppm.
[0166] If the above effects are achieved, it can pass the acceptance and proceed with actual mass production development and deployment.
[0167] Regarding actual application. In actual application, system integration: Embed the prediction model and control logic into the air conditioner control main board, and communicate with sensors and actuators through the API. User interface: Develop a visual interface to display real-time occupancy rate prediction, air conditioner operating status, and energy consumption statistics. Applicable scenarios: This method can be extended to building types such as homes, shopping malls, hotels, and schools. It should be noted that in the various embodiments of this application, parameter settings (such as temperature, wind speed threshold) can be adjusted according to the actual scenario / model, with a certain degree of flexibility.
[0168] The embodiment of the present application also provides an electronic device, which includes a memory and a processor. Among them, the memory is used to store computer instructions, and the processor is used to implement as Figure 1 、 Figure 2 or Figure 3 shown method.
[0169] The embodiment of the present application also provides an air conditioner that adopts the method provided by the method embodiment of the present application, or has the electronic device provided by the embodiment of the present application.
[0170] Adopting the method provided by the embodiment of the present application has at least one of the following effects: Significantly reducing energy consumption: By predicting the occupancy rate in advance and dynamically adjusting the air conditioner parameters, it avoids the energy waste caused by the lack of prediction ability in the prior art.
[0171] Improve comfort: Adjust the air conditioner operation parameters according to the predicted occupancy rate grading to ensure the indoor environmental quality, solving the problem of insufficient comfort in the prior art due to relying on instant data.
[0172] Improve control accuracy: Combine sensor data to correct prediction deviations and ensure the accuracy of the air conditioner system operation parameters, making up for the deficiency of the prior art in lacking a prediction deviation correction mechanism.
[0173] The serial numbers of the embodiments of this application or the order of introduction are only for description and do not represent the superiority or inferiority of the embodiments.
[0174] In several embodiments provided by this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only illustrative. For example, the division of units can be a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point, the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces. The indirect coupling or communication connection of units or modules can be in an electrical or other form.
[0175] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0176] In addition, in each embodiment of this application, each functional unit can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.
[0177] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. For example, the computer program product includes one or more computer instructions, which when executed implement following the regularization leader algorithm to thus implement Figure 3The method provided by the illustrated embodiment. When computer instructions are loaded and executed on a computer, the process or function according to the embodiments of the present application is fully or partially generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center in a wired manner (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or a wireless manner (such as infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be accessed by the computer, or a data storage device such as a server or data center that includes one or more integrated available media. The available medium may be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a digital versatile disc (DVD)), or a semiconductor medium (such as a solid state disk (SSD)). It should be noted that the computer-readable storage medium mentioned in the embodiments of the present application may be a non-volatile storage medium, in other words, a non-transitory storage medium.
[0178] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data for analysis, stored data, displayed data, etc.), and signals involved in the embodiments of the present application are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions. For example, the scene data of the current frame in the three-dimensional virtual scene, the device information of the client, and the scene interaction information involved in the embodiments of the present application are all obtained under full authorization. [[ID=5]]
[0179] The above are only the preferred embodiments of the present application. It should be pointed out that for those of ordinary skill in the art, without departing from the principle of the present application, several improvements and refinements can still be made, and these improvements and refinements should also be regarded as the protection scope of the present application.
Claims
1. A method for predicting occupancy rate, characterized in that, The method includes: Obtaining time series feature data of multiple historical moments, where the time series feature data of the historical moments includes the occupancy rate corresponding to the historical moment, and also includes at least one of the time feature and the environmental feature corresponding to the historical moment; Determining the hidden state of each historical moment according to the time series feature data of the multiple historical moments; Determining a context vector according to the hidden state of each historical moment and the weighted information of the hidden state of each historical moment; Performing feature mapping according to the context vector to obtain the occupancy rate at the target moment.
2. The method for predicting the occupancy rate according to claim 1, wherein The environmental feature includes at least one of the outdoor environment and the indoor environment corresponding to the historical moment, and the time feature includes the time feature corresponding to the historical moment.
3. The method for predicting occupancy rate according to claim 1, wherein the determining the hidden state of each historical moment according to the time series feature data of the multiple historical moments includes: Inputting the time series feature data of the multiple historical moments into the prediction module of the occupancy rate prediction model to obtain the hidden state of each historical moment, where the prediction module takes the time series feature data of the multiple historical moments as input and the hidden state of each historical moment as output; and / or, the determining the context vector according to the hidden state of each historical moment and the weighted information of the hidden state of each historical moment includes: Inputting the time series feature data of the hidden state of each historical moment into the attention module of the occupancy rate prediction model to obtain the context vector, where the attention module takes the hidden state of each historical moment as input and the context vector as output; and / or, performing feature mapping according to the context vector to obtain the occupancy rate at the target moment includes: Inputting the context vector into the fully connected layer of the occupancy rate prediction model to obtain the occupancy rate at the target moment, where the fully connected layer takes the context vector as input and the occupancy rate at the target moment as output.
4. The method for predicting the occupancy rate according to claim 3, characterized in that The occupancy rate prediction model includes the prediction module, the attention module, and the fully connected layer through which the feature data flows in sequence.
5. The method for predicting the occupancy rate according to claim 4, characterized in that, The prediction module includes 1 input layer and 2 LSTM layers, the attention module includes 1 attention layer, and the number of feature dimensions output by the 2 LSTM layers and the 1 attention layer is the same.
6. The method for predicting occupancy rate according to claim 1, wherein The number of the multiple historical moments is the same as the number of the target moments.
7. A method for predicting occupancy rate, characterized in that, The method includes: Obtaining time series feature data of multiple historical moments, where the time series feature data of the historical moments includes the occupancy rate corresponding to the historical moment, and also includes at least one of the time feature and the environmental feature corresponding to the historical moment; Inputting the time series feature data of the multiple historical moments into the occupancy rate prediction model to obtain the occupancy rate at the target moment; wherein, the occupancy rate prediction model is used to predict the occupancy rate at the target moment according to the hidden state of each historical moment and the weighted information of the hidden state of each historical moment, and wherein the hidden state of each historical moment is determined according to the time series feature data of each historical moment.
8. The method according to claim 7, wherein The environmental features include at least one of the outdoor environment and the indoor environment corresponding to the historical moment, and the time features include the time features corresponding to the historical moment.
9. The method according to claim 7, wherein The occupancy prediction model includes a prediction module, an attention module, and a fully connected layer through which the feature data flows in sequence.
10. The method according to claim 9, wherein The prediction module takes the time series feature data of the multiple historical moments as input and outputs the hidden state of each historical moment; The attention module takes the hidden state of each historical moment as input and outputs a context vector, which is determined according to the hidden state of each historical moment and the weighted information of the hidden state of each historical moment; The fully connected layer takes the context vector as input and outputs the occupancy rate at the target moment.
11. The method according to claim 9 or 10, characterized in that, The prediction module includes a 1-layer input layer and a 2-layer LSTM layer, the attention module includes a 1-layer attention layer, and the number of feature dimensions output by the 2-layer LSTM layer and the 1-layer attention layer is the same.
12. The method according to claim 1, characterized in that, The number of the multiple historical moments is the same as the number of the target moments.
13. An air conditioner control method, characterized in that, The method includes: Predicting the occupancy rate at the target moment by using the method according to any one of claims 1-12; Adjusting the operating parameters of the air conditioner according to the occupancy rate at the target moment.
14. The air conditioner control method according to claim 13, wherein The operating parameters of the air conditioner include at least one of a set temperature, a wind speed, and a fresh air volume.
15. The air conditioner control method according to claim 13, characterized in that, The adjusting the operating parameters of the air conditioner according to the occupancy rate at the target moment includes: Adjusting the set temperature and / or the wind speed in the operating parameters of the air conditioner at the nearest moment according to the occupancy rate at the nearest moment among the target moments, wherein the higher the occupancy rate at the nearest moment, the lower the set temperature or the higher the wind speed; and / or Hierarchically adjusting the fresh air volume in the operating parameters of the air conditioner at the nearest moment according to the occupancy rate at the nearest moment among the target moments and the indoor air quality at the nearest moment.
16. The air conditioner control method according to claim 13, wherein The adjusting the operating parameters of the air conditioner according to the occupancy rate at the target moment includes: Comparing the occupancy rate at the nearest moment among the target moments with the actual occupancy rate at the nearest moment; Adjusting the operating parameters of the air conditioner according to the magnitude relationship between the occupancy rate at the nearest moment and the actual occupancy rate at the nearest moment.
17. The air conditioner control method according to claim 16, characterized in that, The adjusting the operating parameters of the air conditioner according to the magnitude relationship between the occupancy rate at the nearest moment and the actual occupancy rate at the nearest moment includes: In the case where the occupancy rate at the nearest moment is greater than the actual occupancy rate at the nearest moment and the difference is within a set range, performing at least one of raising the set temperature, lowering the wind speed, and reducing the fresh air volume; and / or In the case where the actual occupancy rate at the nearest moment is greater than the occupancy rate at the nearest moment and the difference is within a set range, performing at least one of lowering the set temperature, raising the wind speed, and increasing the fresh air volume; and / or In the case where the absolute value of the difference between the actual occupancy rate at the nearest moment and the actual occupancy rate at the nearest moment exceeds a set range that is not less than, controlling the operating parameters of the air conditioner according to the actual occupancy rate at the nearest moment.
18. An electronic device, characterized in that, The electronic device includes a memory and a processor. Among them, the memory is used to store computer instructions, and the processor is used to implement the method described in any one of claims 1-17 according to the computer instructions.
19. An air conditioner, characterized in that, The air conditioner adopts the method described in any one of claims 1-17, or the air conditioner includes the electronic device described in claim 18.