Air-fuel ratio prediction model training method, air-fuel ratio delay compensation method, and apparatus

CN122707943APending Publication Date: 2026-09-08HUNAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611090673.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-22
Publication Date
2026-09-08

AI Technical Summary

Technical Problem

此类非物理解不仅造成空燃比控制精度显著劣化,还可能引发闭环系统的振荡甚至发散,进而影响转子发动机的可靠性和耐久性

Benefits of technology

[0014] The beneficial effects of this application are as follows: By introducing a mechanistic benchmark model and integrating physical constraints into the loss function during training, physical knowledge is actively incorporated into the model optimization objective. This enables the trained air-fuel ratio prediction model to not only accurately fit the training data, but more importantly, it maintains the physical rationality of the prediction results even when facing unseen operating conditions, avoiding non-physical interpretations, improving the robustness and reliability of the prediction, effectively preventing closed-loop system divergence, and significantly improving the accuracy of air-fuel ratio delay compensation in rotary engines. Therefore, by fusing the mechanistic benchmark model with the trained air-fuel ratio prediction model, air-fuel ratio prediction can avoid outputting predictions that violate physical laws under rapid load changes or extreme environmental conditions in rotary engines, thus improving the accuracy of air-fuel ratio prediction and the stability of the control system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122707943A_ABST
    Figure CN122707943A_ABST
Patent Text Reader

Abstract

This application relates to the field of engine control technology, and discloses a method for training an air-fuel ratio prediction model, an air-fuel ratio delay compensation method, and an apparatus. The training method includes: acquiring sample feature sequences and corresponding sample true air-fuel ratio values; calculating a sample baseline predicted value of the air-fuel ratio at a sample time based on a mechanistic baseline model of a rotary engine; inputting the sample feature sequences into a preset gated recurrent neural network model to obtain a sample model predicted value of the air-fuel ratio at the sample time; superimposing the sample baseline predicted value and the sample model predicted value to obtain a sample air-fuel ratio predicted value; determining the loss information between the sample air-fuel ratio predicted value and the sample true air-fuel ratio value based on a preset loss function; updating the parameters of the gated recurrent neural network model according to the loss information until a preset training termination condition is met, thus obtaining a trained air-fuel ratio prediction model. The embodiments of this application can improve the accuracy of air-fuel ratio prediction and the stability of the control system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of engine control technology, and in particular to a method for training an air-fuel ratio prediction model, a method for compensating for air-fuel ratio delay, and a device. Background Technology

[0002] Air-fuel ratio delay compensation is a crucial component of internal combustion engine control systems, directly impacting the combustion efficiency, emissions performance, and operational stability of rotary engines. Traditional control strategies primarily rely on physical models, but these struggle to accurately characterize the complex dynamic characteristics of rotary engines under transient conditions, limiting the effectiveness of compensation. In recent years, data-driven methods, such as gated recurrent neural network models, have been introduced into this field due to their superior temporal modeling capabilities. They can effectively capture long-distance temporal dependencies in historical data, improving prediction accuracy under normal operating conditions. However, purely data-driven models inherently suffer from a "black box" defect, lacking explicit constraints on physical laws. Under operating conditions outside the training data distribution, such as rapid load changes or extreme environmental conditions in rotary engines, the model may output predictions that violate physical laws. For example, with a constant throttle opening, an increase in fuel injection mass flow rate might lead to an abnormally high predicted air-fuel ratio, contradicting the fundamental causal logic of fuel combustion. Such non-physical interpretations not only significantly degrade air-fuel ratio control accuracy but may also trigger oscillations or even divergence in the closed-loop system, ultimately affecting the reliability and durability of the rotary engine. Summary of the Invention

[0003] The purpose of this application is to provide a training method for an air-fuel ratio prediction model, an air-fuel ratio delay compensation method and device, which can avoid outputting prediction values ​​that violate physical laws under rapid load changes or extreme environmental conditions of a rotary engine, thereby improving the accuracy of air-fuel ratio prediction and the stability of the control system.

[0004] This application provides a method for training an air-fuel ratio prediction model, including: Obtain sample feature sequences containing multiple sample data groups and the sample true air-fuel ratio values ​​corresponding to the sample data groups; the sample data groups include sample fuel injection mass flow rate values, sample intake air mass flow rate values, sample throttle opening values, and sample hysteresis air-fuel ratio measurement values; Based on the mechanistic baseline model of the rotary engine, the sample baseline predicted value of the air-fuel ratio at the sample time is calculated using the sample intake mass flow rate value and the sample fuel injection mass flow rate value. The sample feature sequence is input into a preset gated recurrent neural network model to predict the air-fuel ratio based on the sample feature sequence, thereby obtaining the sample model prediction value of the air-fuel ratio at the sample time. By superimposing the sample baseline prediction value and the sample model prediction value, the sample air-fuel ratio prediction value after lag compensation is obtained at the sample time. Based on a preset loss function, the loss information between the predicted air-fuel ratio of the sample and the actual air-fuel ratio of the sample is determined; the loss function includes a physical constraint term, which is used to force the predicted air-fuel ratio of the sample to meet preset physical boundary conditions and physical causal logic conditions. The parameters of the gated recurrent neural network model are updated based on the loss information until the preset training termination condition is met, thus obtaining a trained air-fuel ratio prediction model.

[0005] In some embodiments, the mechanistic baseline model includes a fuel system model, which describes the dynamic mapping relationship between the injected fuel quantity and the actual amount of fuel involved in combustion. The step of calculating the sample baseline predicted value of the air-fuel ratio at the sample time using the sample intake air mass flow rate value and the sample fuel injection mass flow rate value includes: The sample injection mass flow rate value is input into the fuel system model to solve for the sample effective fuel mass flow rate value. The ratio between the sample intake mass flow rate value and the sample effective fuel mass flow rate value is then calculated to obtain the sample baseline prediction value.

[0006] In some embodiments, the mechanistic baseline model further includes an air system model, a combustion torque and speed model, and an oxygen sensor composite hysteresis model. The air system model is used to describe the dynamic mapping relationship between the throttle opening and intake mass flow rate of the rotary engine. The combustion torque and speed model is used to describe the dynamic mapping relationship between the effective fuel mass flow rate and the ignition angle on the output torque and speed of the rotary engine. The oxygen sensor composite hysteresis model is used to describe the dynamic mapping relationship between the true air-fuel ratio and the hysteresis air-fuel ratio measurement.

[0007] In some embodiments, the air-fuel ratio prediction based on the sample feature sequence includes: The sample feature sequence is dynamically compensated to obtain the sample transient dynamic compensation value; The sample injection mass flow rate value is subjected to steady-state mapping processing to obtain the sample steady-state physical reference value; The transient dynamic compensation value and the steady-state physical baseline value of the sample are output as the predicted value of the sample model.

[0008] In some embodiments, the dynamic compensation processing of the sample feature sequence includes: Forgetting gating is performed on the measured values ​​of the hysteresis air-fuel ratio of the sample to generate a forgetting coefficient; Input gating processing is performed on the high-frequency variation components of the sample throttle opening value to generate input coefficients, and candidate network states are generated based on the sample data set; The historical network state of the gated recurrent neural network model is decayed using the forgetting coefficient, and the candidate network state is filtered using the input coefficient. The decayed historical network state is then fused with the filtered candidate network state to obtain the updated network state. The updated network state is subjected to output gating processing to generate output coefficients; The updated network state is modulated using the output coefficients, and the transient dynamic compensation value is generated based on the modulated network state.

[0009] In some embodiments, the steady-state mapping processing of the sample injection mass flow rate value includes: The sample fuel injection mass flow rate value is linearly mapped to the sample steady-state physical reference value using mapping weights that are constrained to be non-positive.

[0010] In some embodiments, the superposition of the sample baseline prediction value and the sample model prediction value includes: The sample baseline prediction value, the sample transient dynamic compensation value, and the sample steady-state physical baseline value are superimposed to obtain the sample intermediate air-fuel ratio prediction value. The sample intermediate air-fuel ratio prediction value is then truncated to obtain the sample air-fuel ratio prediction value.

[0011] In some embodiments, determining the loss information between the predicted air-fuel ratio of the sample and the actual air-fuel ratio of the sample based on a preset loss function includes: The difference between the predicted air-fuel ratio of the sample and the actual air-fuel ratio of the sample is measured to generate data fitting loss information. Boundary penalty processing is applied to the sample air-fuel ratio prediction values ​​that exceed the physical boundary conditions to generate boundary penalty loss information; A causal monotonicity penalty is applied to the sample air-fuel ratio prediction value that violates the physical causal logic condition, generating causal penalty loss information; the physical causal logic condition includes that when the throttle opening is constant, an increase in the sample fuel injection mass flow rate leads to a decrease in the sample air-fuel ratio prediction value. The deviation between the sample air-fuel ratio prediction value and the sample baseline prediction value is subjected to residual constraint processing to generate residual penalty loss information. The loss information is obtained by weighted summation of the data fitting loss information, the boundary penalty loss information, the causal penalty loss information, and the residual penalty loss information.

[0012] This application also provides an air-fuel ratio delay compensation method, including: The current time and multiple historical time values ​​of the rotary engine are obtained, including the injection mass flow rate, intake mass flow rate, throttle opening value, and hysteresis air-fuel ratio measurement value, to form an input feature sequence. Based on the mechanistic baseline model of the rotary engine, the physical baseline prediction value of the air-fuel ratio at the current moment is calculated using the intake mass flow rate value and the fuel injection mass flow rate value. The input feature sequence is input into a pre-trained air-fuel ratio prediction model to predict the air-fuel ratio based on the input feature sequence, thereby obtaining the model prediction value of the air-fuel ratio at the current time; the air-fuel ratio prediction model is trained using the above-described air-fuel ratio prediction model training method. By superimposing the physical baseline prediction value and the model prediction value, the real-time air-fuel ratio prediction value at the current moment after delay compensation is obtained.

[0013] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described method.

[0014] The beneficial effects of this application are as follows: By introducing a mechanistic benchmark model and integrating physical constraints into the loss function during training, physical knowledge is actively incorporated into the model optimization objective. This enables the trained air-fuel ratio prediction model to not only accurately fit the training data, but more importantly, it maintains the physical rationality of the prediction results even when facing unseen operating conditions, avoiding non-physical interpretations, improving the robustness and reliability of the prediction, effectively preventing closed-loop system divergence, and significantly improving the accuracy of air-fuel ratio delay compensation in rotary engines. Therefore, by fusing the mechanistic benchmark model with the trained air-fuel ratio prediction model, air-fuel ratio prediction can avoid outputting predictions that violate physical laws under rapid load changes or extreme environmental conditions in rotary engines, thus improving the accuracy of air-fuel ratio prediction and the stability of the control system. Attached Figure Description

[0015] Figure 1 This diagram illustrates the application environment of the air-fuel ratio prediction model training method or the air-fuel ratio delay compensation method provided in the embodiments of this application.

[0016] Figure 2 This is a flowchart of the air-fuel ratio prediction model training method provided in the embodiments of this application.

[0017] Figure 3 This is a flowchart of a method for predicting air-fuel ratio based on sample feature sequences provided in an embodiment of this application.

[0018] Figure 4This is a flowchart of a method for determining the loss information between the predicted air-fuel ratio of a sample and the actual air-fuel ratio of a sample, provided in an embodiment of this application.

[0019] Figure 5 This is a flowchart of the air-fuel ratio delay compensation method provided in the embodiments of this application.

[0020] Figure 6 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0021] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0022] It should be noted that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, and drawings are used to distinguish similar objects and are not used to describe a specific order or sequence.

[0023] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application. Furthermore, the information, data, and signals involved in the embodiments of this application are all authorized by relevant parties or have been fully authorized by all parties, and the collection, use, and processing of related data comply with the relevant laws, regulations, and standards of the relevant countries and regions.

[0024] In traditional air-fuel ratio delay compensation technologies, gated recurrent neural network models based on pure data-driven approaches, lacking physical constraint mechanisms, are prone to outputting predictions that violate physical laws when operating outside the training distribution. Specifically, these models cannot effectively guarantee that the prediction results satisfy the physical boundary conditions and causal logic of the air-fuel ratio, leading to non-physical phenomena in the closed-loop control system and consequently reducing the accuracy of air-fuel ratio delay compensation. Furthermore, this problem stems from the model's insufficient implicit learning ability regarding physical laws. When the input data exceeds the training distribution range, the network state update process lacks mandatory constraints on physical conservation laws, causing the predicted values ​​to deviate from the theoretical feasible region. For example, under rapid acceleration conditions in a rotary engine, the throttle opening undergoes a step-like change, and the intake mass flow rate exhibits high-frequency oscillation characteristics. In this case, the gated recurrent neural network model in related technologies, relying solely on historical data patterns for prediction, lacks physical mechanism guidance for the transient response process caused by the sudden change in throttle opening, and the output air-fuel ratio prediction value may exceed the theoretical boundary range (e.g., below the lower limit of stoichiometry or above the lean-burn limit). This predicted value violates the causal logic that an increase in fuel injection mass flow rate at a constant throttle opening necessarily leads to a decrease in air-fuel ratio, causing an irreversible deviation between the oxygen sensor feedback signal and the predicted result. Consequently, the rotary engine control unit performs fuel injection corrections based on this non-physical reasoning, resulting in a continuous deviation of the actual air-fuel ratio from the target value and a significant deterioration in combustion process stability.

[0025] If the aforementioned problems are not addressed, the failure risk of the air-fuel ratio prediction model under distributed operating conditions will lead to a continuous accumulation of errors in the closed-loop control system. Specifically, the cumulative effect of non-physical processes will disrupt the convergence of the air-fuel ratio feedback control, causing the rotary engine's operating state to gradually deviate from the design operating point. Furthermore, this technical deficiency may trigger a chain reaction of combustion instability and abnormal fluctuations in emission concentrations, ultimately resulting in a decline in the rotary engine's power performance and the failure of the emission control system. As a preferred implementation method, a systematic solution to this technical problem is crucial for ensuring the control robustness of the internal combustion engine across the entire operating range.

[0026] Based on this, embodiments of this application provide an air-fuel ratio prediction model training method, an air-fuel ratio delay compensation method, and an apparatus. By integrating a neural network training framework that combines a mechanistic benchmark model with physical constraints, the prediction results are forced to meet physical boundary conditions and causal logic laws. This can avoid outputting prediction values ​​that violate physical laws under rapid load changes or extreme environmental conditions of a rotary engine, thereby improving the accuracy of air-fuel ratio prediction and the stability of the control system.

[0027] Figure 1 This diagram illustrates the application environment of the air-fuel ratio prediction model training method or the air-fuel ratio delay compensation method provided in the embodiments of this application. Figure 1As shown, the above method is applied to a system including terminal 101 and server 102. Terminal 101 and server 102 are connected via a network. Terminal 101 can be at least one of a mobile phone, tablet computer, laptop computer, and vehicle terminal. Server 102 can be implemented using a standalone server or a server cluster consisting of several servers. When implementing the air-fuel ratio prediction model training method, terminal 101 is used to send sample feature sequences of multiple sample data sets and the corresponding sample true air-fuel ratio values ​​to server 102. The sample data sets include sample fuel injection mass flow rate values, sample intake air mass flow rate values, sample throttle opening values, and sample hysteresis air-fuel ratio measurement values. Server 102 is used to obtain the sample feature sequences containing multiple sample data sets and the corresponding sample true air-fuel ratio values. Based on the mechanistic baseline model of the rotary engine, it calculates the sample baseline prediction value of the air-fuel ratio at the sample time using the sample intake air mass flow rate value and the sample fuel injection mass flow rate value, and inputs the sample feature sequences into a preset... A gated recurrent neural network model is used to predict the air-fuel ratio based on the sample feature sequence, obtaining the sample model prediction value of the air-fuel ratio at the sample time. The sample baseline prediction value and the sample model prediction value are superimposed to obtain the sample air-fuel ratio prediction value after hysteresis compensation at the sample time. Based on a preset loss function, the loss information between the sample air-fuel ratio prediction value and the sample true air-fuel ratio value is determined. The loss function includes a physical constraint term, which is used to force the sample air-fuel ratio prediction value to meet preset physical boundary conditions and physical causal logic conditions. The parameters of the gated recurrent neural network model are updated according to the loss information until the preset training termination condition is met, resulting in a trained air-fuel ratio prediction model. When implementing the air-fuel ratio delay compensation method, terminal 101 sends the current injection mass flow rate, intake air mass flow rate, throttle opening value, and hysteresis air-fuel ratio measurement value of the rotary engine at the current moment and at multiple historical moments to server 102. Server 102 acquires the current injection mass flow rate, intake air mass flow rate, throttle opening value, and hysteresis air-fuel ratio measurement value of the rotary engine at the current moment to form an input feature sequence. Based on the mechanistic benchmark model of the rotary engine, the physical benchmark prediction value of the air-fuel ratio at the current moment is calculated using the intake air mass flow rate and injection mass flow rate values. The input feature sequence is input into a pre-trained air-fuel ratio prediction model to predict the air-fuel ratio based on the input feature sequence, thereby obtaining the model prediction value of the air-fuel ratio at the current moment. The air-fuel ratio prediction model is trained using the above-mentioned air-fuel ratio prediction model training method. The physical benchmark prediction value and the model prediction value are superimposed to obtain the real-time air-fuel ratio prediction value at the current moment after delay compensation.

[0028] It should be understood that Figure 1The application scenarios shown are merely examples. In practical applications, the air-fuel ratio prediction model training method and air-fuel ratio delay compensation method provided in this application embodiment can also be applied to other scenarios. For example, the air-fuel ratio prediction model training method described above can be directly applied to terminal 101. Terminal 101 is used to obtain sample feature sequences containing multiple sample data groups and the sample true air-fuel ratio values ​​corresponding to the sample data groups. Based on the mechanistic baseline model of the rotary engine, the sample baseline predicted value of the air-fuel ratio at the sample time is calculated using the sample intake mass flow rate value and the sample fuel injection mass flow rate value. The sample feature sequence is input into a preset gated recurrent neural network model to predict the air-fuel ratio based on the sample feature sequence, thereby obtaining the sample model predicted value of the air-fuel ratio at the sample time. The sample baseline predicted value and the sample model predicted value are superimposed to obtain the sample air-fuel ratio predicted value at the sample time after hysteresis compensation. Based on a preset loss function, the loss information between the sample air-fuel ratio predicted value and the sample true air-fuel ratio value is determined. The loss function includes a physical constraint term, which is used to force the sample air-fuel ratio predicted value to meet preset physical boundary conditions and physical causal logic conditions. The parameters of the gated recurrent neural network model are updated according to the loss information until the preset training termination condition is met, thereby obtaining the trained air-fuel ratio prediction model. For example, the air-fuel ratio delay compensation method described above can also be directly applied to terminal 101. Terminal 101 is used to obtain the injection mass flow rate, intake mass flow rate, throttle opening value and hysteresis air-fuel ratio measurement value of the rotary engine at the current moment and at multiple historical moments, forming an input feature sequence. Based on the mechanistic benchmark model of the rotary engine, the physical benchmark prediction value of the air-fuel ratio at the current moment is calculated using the intake mass flow rate and injection mass flow rate values. The input feature sequence is input into a pre-trained air-fuel ratio prediction model to predict the air-fuel ratio based on the input feature sequence, thereby obtaining the model prediction value of the air-fuel ratio at the current moment. The air-fuel ratio prediction model is trained using the above-mentioned air-fuel ratio prediction model training method. The physical benchmark prediction value and the model prediction value are superimposed to obtain the real-time air-fuel ratio prediction value at the current moment after delay compensation.

[0029] See Figure 2 In one embodiment, an air-fuel ratio prediction model training method is provided. The execution subject of the method is a terminal or a server, including but not limited to steps S201 to S206.

[0030] Step S201: Obtain the sample feature sequence containing multiple sample data groups and the sample true air-fuel ratio value corresponding to the sample data groups.

[0031] The sample data set includes sample fuel injection mass flow rate values, sample intake air mass flow rate values, sample throttle opening values, and sample hysteresis air-fuel ratio measurements. It can be understood that the sample feature sequence is the input data sequence used for model training. During training, it simulates the fuel injection mass flow rate, intake air mass flow rate, throttle opening, and hysteresis air-fuel ratio of the rotary engine over a period of time. The sample data sets in the sample feature sequence are used to simulate the fuel injection mass flow rate value, intake air mass flow rate value, throttle opening value, and hysteresis air-fuel ratio measurement value of the rotary engine at a specific moment. Each sample data set corresponds to a single sample true air-fuel ratio value.

[0032] In one implementation, sensors are installed on a rotary engine test bench, and these parameters are recorded in real time during rotary engine operation using a data acquisition system. For example, the fuel injection mass flow rate can be calculated from the pulse width and flow characteristics of the fuel injector; the intake air mass flow rate can be measured by an intake air flow sensor; the throttle opening value can be obtained by a throttle position sensor; and the hysteresis air-fuel ratio can be measured in the exhaust pipe by an oxygen sensor. After acquisition, this data is organized into a time series, forming a sample feature sequence. Simultaneously, a high-precision broadband oxygen sensor can provide the corresponding sample real air-fuel ratio values ​​as training targets.

[0033] Step S202: Based on the mechanistic baseline model of the rotary engine, the sample baseline predicted value of the air-fuel ratio at the sample time is calculated using the sample intake mass flow rate and the sample fuel injection mass flow rate.

[0034] The mechanistic baseline model is a mathematical model built upon the physical mechanisms and engineering experience of rotary engines. Its function is to calculate a physically accurate air-fuel ratio baseline prediction based on the rotary engine's input parameters (such as intake air mass flow rate and fuel injection mass flow rate). This model provides physical constraints and references for data-driven predictions, helping to avoid non-physical predictions.

[0035] In one implementation, the baseline model of this mechanism can be a simplified steady-state air-fuel ratio calculation model, which directly divides the intake air mass flow rate by the fuel injection mass flow rate to obtain an ideal air-fuel ratio. This model provides an initial prediction based on fundamental physical principles, but may not fully capture the complex dynamic characteristics of the rotary engine under transient conditions.

[0036] Step S203: Input the sample feature sequence into a preset gated recurrent neural network model to predict the air-fuel ratio based on the sample feature sequence, and obtain the sample model prediction value of the air-fuel ratio at the sample time.

[0037] Gated recurrent neural network (RNN) models are a special type of RNN that effectively handles long-term dependencies in sequential data by introducing gating mechanisms (such as forget gates, input gates, and output gates). In air-fuel ratio prediction, this model can capture the complex dynamic characteristics of rotary engine operating parameters changing over time, thus enabling more accurate predictions.

[0038] In one implementation, the gated recurrent neural network model can be a Long Short-Term Memory (LSTM) network model, which learns temporal dependencies by processing multiple sets of sample data in a sample feature sequence. The model receives the sample feature sequence as input and outputs a data-driven, time-stamped air-fuel ratio prediction.

[0039] Step S204: Superimpose the sample baseline prediction value and the sample model prediction value to obtain the sample air-fuel ratio prediction value after lag compensation at the sample time.

[0040] In one implementation, the superposition process can be to directly add the sample baseline predictions of the mechanistic baseline model to the sample model predictions of the gated recurrent neural network model, which can combine the robustness of the physical model and the flexibility of the data-driven model to obtain a more comprehensive prediction.

[0041] Step S205: Based on a preset loss function, determine the loss information between the predicted air-fuel ratio of the sample and the actual air-fuel ratio of the sample.

[0042] The loss function includes a physical constraint term, which forces the predicted air-fuel ratio of the samples to meet preset physical boundary conditions and physical causal logic conditions. In essence, the physical constraint term is a component of the loss function, its role being to introduce physical knowledge into the model training process. Through this physical constraint term, the gated recurrent neural network model is guided to learn mapping relationships that conform to physical laws, avoiding predictions that violate physical common sense under operating conditions outside the training data distribution. This term helps improve the model's generalization ability and physical rationality.

[0043] In one implementation, the loss function can be a mean squared error (MSE) function, which calculates the square of the difference between the predicted and the true values. In this loss function, the physical constraint term can be implemented as an additional penalty term when the predicted value exceeds a preset physical upper or lower limit, or when the predicted value violates a known physical causal relationship (e.g., increasing the fuel injection quantity should lead to a decrease in the air-fuel ratio, all other things being equal).

[0044] Step S206: Update the parameters of the gated recurrent neural network model based on the loss information until the preset training termination condition is met, and obtain the trained air-fuel ratio prediction model.

[0045] In one implementation, the parameter update process can employ a gradient descent optimization algorithm, such as the Adam optimizer. This algorithm iteratively adjusts the model's weights and biases based on the gradient information of the loss function with respect to the model parameters, in order to minimize the loss function. Training termination conditions may include reaching a preset number of training epochs, the loss function converging below a certain threshold, or performance on the validation set no longer improving.

[0046] The following example will provide a more detailed explanation of the above technical solution: Suppose we are in a rotary engine development environment and need to train a high-precision air-fuel ratio prediction model. First, by running the rotary engine on a test bench and subjecting it to various operating conditions (e.g., acceleration, deceleration, steady-state operation), a large amount of sample data is acquired using high-precision sensors and a data acquisition system. Specifically, at each sampling moment, sample injection mass flow rate, sample intake air mass flow rate, sample throttle opening value, and sample hysteresis air-fuel ratio measurement are recorded. These data are organized into a sample feature sequence. Simultaneously, a high-response broadband oxygen sensor is used to acquire the corresponding sample true air-fuel ratio value.

[0047] Next, for each sample time point, the obtained sample intake air mass flow rate and sample fuel injection mass flow rate are input into a pre-established rotary engine mechanistic baseline model. This mechanistic baseline model may include a fuel film dynamic model and an air path dynamic model, which calculates a sample baseline prediction value based on the physical characteristics of the rotary engine. This baseline prediction value reflects the air-fuel ratio corresponding to the current intake air quantity and fuel injection quantity under ideal physical conditions.

[0048] Simultaneously, a sample feature sequence containing all features is input into a gated recurrent neural network model. This model is designed to capture the complex nonlinear relationships and time dependencies between the operating parameters of the rotary engine, thereby outputting a sample model prediction. This model prediction can be regarded as a correction or supplement to the mechanistic baseline prediction, especially under transient conditions.

[0049] Subsequently, the baseline prediction value of the sample is superimposed with the prediction value of the sample model to obtain the sample air-fuel ratio prediction value after hysteresis compensation at the sample time. This superposition operation aims to combine the robustness of the physical model and the adaptability of the data-driven model to obtain more accurate and comprehensive prediction results.

[0050] During model training, a pre-defined loss function is used to evaluate the difference between the predicted air-fuel ratio of the sample and the actual air-fuel ratio. This loss function not only calculates the prediction error but also includes a physical constraint term. For example, if the predicted air-fuel ratio exceeds the physical boundaries of the rotary engine's actual operation (e.g., the predicted value is much lower than the theoretical minimum air-fuel ratio or much higher than the theoretical maximum air-fuel ratio), or if the prediction violates physical causal logic (e.g., with a constant throttle opening, an increase in the fuel injection mass flow rate results in an increase in the predicted air-fuel ratio), then this physical constraint term will impose a significant penalty. Thus, this loss function can generate loss information that includes data fitting error and physical violation penalties.

[0051] Finally, based on this loss information, an optimization algorithm (e.g., backpropagation combined with the Adam optimizer) is used to iteratively update the internal parameters of the gated recurrent neural network model. This update process continues until the loss information converges to below a preset threshold, or the model exhibits stable performance on an independent validation set, thus obtaining a well-trained air-fuel ratio prediction model. This model not only accurately predicts the air-fuel ratio, but its predictions are also physically reasonable, avoiding the non-physical interpretations that might arise from "black box" models.

[0052] The technical concept of this embodiment makes a significant contribution to the prior art. In the prior art, although the purely data-driven gated recurrent neural network model has shown strong capabilities in air-fuel ratio prediction, its "black box" characteristic may lead to the output of prediction values ​​that violate physical laws under operating conditions outside the training distribution, thereby causing the closed-loop system to diverge and reducing the accuracy of air-fuel ratio delay compensation in rotary engines.

[0053] This embodiment effectively solves the aforementioned technical problems by introducing a mechanistic baseline model and integrating physical constraint terms into the loss function. Specifically, in the example above, the mechanistic baseline model provides a baseline predicted air-fuel ratio based on the physical principles of a rotary engine, laying the physical foundation for the entire prediction process. More importantly, the physical constraint terms included in the loss function, such as penalizing predicted values ​​that exceed physical boundaries and penalizing predicted values ​​that violate physical causal logic, force the gated recurrent neural network model to learn mapping relationships that conform to physical laws during training.

[0054] Compared to traditional methods that rely solely on data fitting, the approach in this embodiment actively incorporates physical knowledge into the model optimization objective during training. This enables the trained air-fuel ratio prediction model to not only accurately fit the training data, but more importantly, to maintain the physical plausibility of its predictions even under unseen operating conditions. Consequently, the model avoids non-physical interpretations, improves the robustness and reliability of predictions, effectively prevents closed-loop system divergence, and significantly enhances the accuracy of air-fuel ratio delay compensation in rotary engines. This technical concept, by combining the advantages of physical models and data-driven models, provides a more robust and reliable air-fuel ratio prediction solution.

[0055] In some embodiments, the mechanistic baseline model includes a fuel system model, which describes the dynamic mapping relationship between the injected fuel quantity and the actual amount of fuel involved in combustion.

[0056] The sample baseline prediction value of the air-fuel ratio at the sample time point is calculated using the sample intake air mass flow rate value and the sample fuel injection mass flow rate value. This includes: inputting the sample fuel injection mass flow rate value into the fuel system model, solving for the sample effective fuel mass flow rate value, solving for the ratio between the sample intake air mass flow rate value and the sample effective fuel mass flow rate value, and obtaining the sample baseline prediction value.

[0057] The fuel system model, as a component of the mechanistic baseline model, is specifically designed to simulate the processes of fuel injection, atomization, wall adhesion, evaporation, and final combustion within a rotary engine. Its role is to accurately characterize the dynamic relationship between the injected fuel quantity and the effective amount of fuel actually participating in combustion. The core task of the fuel system is to describe the dynamic difference between the injected fuel and the actual fuel participating in combustion, namely the wall wetting effect. This effect is particularly significant under transient conditions and is one of the main causes of air-fuel ratio control failure, especially in the unique annular intake structure of a rotary engine, where the fuel wall wetting effect exhibits stronger nonlinearity and time-varying characteristics. This fuel system model can employ first-order or second-order inertial element models to describe the fuel wall adhesion and evaporation processes. For example, a time constant can be used to simulate the delay from fuel injection to complete evaporation and combustion; alternatively, a more complex physical model can be used, such as a model based on fuel film kinetics equations, considering the influence of factors such as fuel droplet size, wall temperature, and airflow velocity on fuel evaporation and wall adhesion.

[0058] This application's solution explicitly introduces a fuel system model into the mechanistic baseline model and uses this model to accurately describe the dynamic mapping relationship between the injected fuel quantity and the actual amount of fuel participating in combustion, thereby enabling accurate calculation of the sample effective fuel mass flow rate. When the sample injection mass flow rate is input into the fuel system model, the model dynamically processes these inputs, considering transient effects such as fuel film formation and evaporation, and outputs a more realistic sample effective fuel mass flow rate. Subsequently, by comparing the sample intake air mass flow rate with this dynamically compensated sample effective fuel mass flow rate, the obtained sample baseline prediction value can more accurately reflect the actual physical combustion process of the rotary engine. This method effectively compensates for prediction errors caused by dynamic effects such as fuel adhesion and evaporation, providing a more reliable physical basis for the subsequent training of the gated recurrent neural network model. This allows the trained air-fuel ratio prediction model to more accurately capture the transient characteristics of the rotary engine, thereby improving the overall prediction accuracy and robustness.

[0059] In one specific embodiment, the fuel system model is a mean volumetric model (MVEM).

[0060] In one specific embodiment, the fuel system model employs a variable parameter wall wetting model, which incorporates the injection mass flow rate. It is divided into two parts: vapor phase fuel (X) that directly enters the cylinder. (1-X) and fuel that forms a liquid film on the intake manifold walls. ).

[0061] The dynamic equation for the liquid film mass is: , Effective fuel mass flow rate of intake cylinder for: , Where X is the gasification rate. is the liquid film evaporation time constant.

[0062] The vaporization rate X is modeled as the inlet gas velocity. With wall temperature The model is a bivariate function. Under rapid acceleration conditions, the surge in intake air velocity leads to increased airflow shear force, which should theoretically promote oil film stripping. However, simultaneously, the injection of large amounts of low-temperature fuel causes a momentary drop in wall temperature (flash effect), which inhibits evaporation. This model estimates the evaporation in real time by introducing a heat balance equation. The dynamic changes of X value can be accurately captured to precisely capture the dramatic fluctuations in X value caused by this competitive mechanism.

[0063] For evaporation time constant The model considers the differences in the volatility of fuel components and the dissolution and absorption effect of gasoline by the lubricating oil film on the inner wall of the rotary engine. The lubricating oil film at the apex seal of the rotary engine significantly alters the evaporative boundary layer characteristics of the fuel, leading to... Under specific operating conditions, the fuel exhibits non-monotonic changes. To reproduce this complex process in simulation, a simplified wall thermal dynamics submodule is embedded within the model. This module updates the wall state in real time based on intake air temperature, coolant temperature, and latent heat of fuel. This allows the model to simulate not only conventional "lean spikes" and "rich mixture overshoots," but also the prolonged air-fuel ratio-rich deviation caused by wall condensation during cold starts, as well as the secondary evaporation effect during sudden deceleration after engine warm-up. This fuel dynamics description provides physically rich training data for subsequent gated recurrent neural network models to learn complex fuel film inverse dynamics. Research on the basic injection strategy of rotary engines also emphasizes that feedforward compensation of the injection quantity is necessary under transient operating conditions to offset the air-fuel ratio deviation caused by the wall wetting effect, which further verifies the necessity of using a variable parameter wall wetting model.

[0064] Baseline predicted air-fuel ratio Defined as: , in, This refers to the intake air mass flow rate.

[0065] This represents the baseline predicted value of the air-fuel ratio obtained by solving the ratio between the intake air mass flow rate and the effective fuel mass flow rate based on the fuel system model. Therefore, the sample baseline predicted value of the air-fuel ratio can be obtained by solving the sample intake air mass flow rate value and the sample effective fuel mass flow rate value based on the fuel system model, and then solving the ratio between the sample intake air mass flow rate value and the sample effective fuel mass flow rate value.

[0066] In some embodiments, the mechanistic baseline model further includes an air system model, a combustion torque and speed model, and an oxygen sensor composite hysteresis model.

[0067] An air system model is used to describe the dynamic mapping relationship between the throttle opening and the intake air mass flow rate of a rotary engine. The air system model is a mathematical model characterizing the dynamic characteristics of the intake path of a rotary engine, its core being to accurately reflect how the throttle opening affects the intake air mass flow rate entering the rotary engine. This model can be a dynamic model based on physical principles, such as a system of differential equations including parameters such as intake manifold volume, throttle flow coefficient, pressure sensors, and temperature sensors. By solving these equations, the intake air volume can be estimated in real time.

[0068] The combustion torque and speed model describes the dynamic mapping relationship between the effective fuel mass flow rate and ignition angle of a rotary engine on its output torque and speed. This model aims to characterize the efficiency and output characteristics of the combustion process within the rotary engine, specifically how the effective fuel mass flow rate and ignition angle jointly determine the engine's output torque and speed. This model can be established based on the thermodynamic cycle and combustion kinetics principles of the rotary engine, considering factors such as combustion chamber geometry, fuel characteristics, and ignition timing. Another approach is to use an empirical model, fitting the relationship between effective fuel mass flow rate, ignition angle, torque, and speed using rotary engine bench test data, for example, by constructing a multidimensional lookup table or regression model.

[0069] The oxygen sensor composite hysteresis model is used to describe the dynamic mapping relationship between the actual air-fuel ratio and the hysteresis air-fuel ratio measurement. This model focuses on compensating for the inherent response delay of the oxygen sensor when measuring the air-fuel ratio. It describes the dynamic relationship between the actual air-fuel ratio and the hysteresis air-fuel ratio measurement output by the sensor. Its implementation can be a cascaded model containing a pure hysteresis element and a first-order inertial element. The pure hysteresis element simulates the time it takes for exhaust gas to travel from the combustion chamber to the sensor, while the first-order inertial element simulates the sensor's own response time. Alternatively, it can be a more complex adaptive model, such as one based on Kalman filtering or neural networks, to dynamically adjust the hysteresis compensation parameters.

[0070] In one specific embodiment, the air system model, the combustion torque and speed model, and the oxygen sensor composite hysteresis model are all mean volumetric models (MVEM).

[0071] In one specific embodiment, the core of the air system model lies in describing the intake manifold pressure. The dynamic changes in air-fuel ratio follow the law of conservation of mass. The accuracy of this model directly determines the baseline accuracy of air-fuel ratio control, especially under transient conditions, where rapid changes in intake airflow are the main source of air-fuel ratio fluctuations. Throttle mass flow rate The isentropic flow equation is used for calculation, which describes the compressible flow characteristics of gas passing through a throttling orifice: , in, The effective flow area of ​​the throttle valve is the opening degree. Nonlinear functions.

[0072] Unlike the simple linear assumption, this application will The model is a high-order polynomial function of throttle opening to capture the extremely high sensitivity of flow rate to changes in opening at small openings. This characteristic is particularly critical under idling and low-load cruising conditions. It is a pressure ratio function that distinguishes between subsonic and choked flow states.

[0073] For rotary engines, the intake manifold is typically short, resulting in a weaker pressure wave propagation effect and allowing for a high degree of accuracy in the quasi-steady-state assumption. However, under high-frequency excitation, it still requires correction using analytical formulas. The intake manifold pressure dynamics are determined by the mass difference between the inflow and outflow, following the differential form of the ideal gas law: , in, For manifold volume, The value is the manifold temperature. This equation shows that the rate of change of manifold pressure directly depends on the difference between the throttle inflow and the cylinder intake flow, which is a key dynamic link connecting the intake and combustion processes.

[0074] Sample inlet mass flow rate It is a key variable connecting the air and combustion subsystems. Considering the special power frequency of the rotary engine, where the eccentric shaft completes one full intake stroke per revolution, its calculation formula is equivalently modified as follows: , in, For inflation efficiency, The equivalent basic displacement of a single rotor, according to the principles of rotor geometry, is determined by the generating radius. The eccentricity e and rotor thickness b determine (i.e.) =3 Unlike reciprocating engines, rotary engines... Although the engine's unique "short-path" intake structure has a weaker pressure wave propagation effect, under high-frequency throttle sudden opening / closing conditions, the intake manifold is significantly affected by leakage and backflow in the low-speed range, exhibiting strong nonlinearity. Based on the above air system model, the corresponding sample intake mass flow rate can be generated from the sample throttle mass flow rate value.

[0075] In one specific embodiment, in a rotary engine, due to the elongated combustion chamber and long flame propagation distance, the generation process of indicated torque exhibits significant nonlinear characteristics. This application decouples the combustion torque and speed model into two parts: "combustion efficiency mapping" and "friction loss compensation," ultimately solving for the speed response using rigid body dynamics equations.

[0076] 1. Indicative torque generation model: Indicated torque The torque generation mechanism is primarily determined by the amount of air entering the cylinder, the fuel injection rate, the ignition advance angle, and the rotary engine speed. Unlike the traditional single-zone Weber function exothermic model, this application employs an empirical analytical model based on multidimensional polynomial fitting to describe the torque generation mechanism in order to improve computational efficiency and facilitate parameter identification while ensuring physical interpretability. This model can accurately reproduce the coupled effects of airflow, air-fuel ratio, and ignition timing on the output torque.

[0077] The formula for calculating indicated torque is as follows: , in, A polynomial function characterizing the work capacity of combustion. To advance the ignition timing, Engine speed, This represents the internal flow and thermodynamic loss terms. The specific expansion follows the construction method of higher-order empirical regression models, with input variables normalized before processing. ; in, , , , , , , , , and These are all undetermined coefficients of the model. These coefficients have clear physical meanings (e.g., The work capacity representing a unit of intake air volume. The coefficient of mechanical friction at high speed can be determined by least squares method using bench test data or high-fidelity CFD simulation data. This application adopts the empirical formula in the general mean model.

[0078] 2. Effective torque and friction loss model: Effective torque output by rotary engine The mechanical friction torque needs to be subtracted from the indicated torque. And pumping losses. The frictional characteristics of a rotary engine are dominated by the sliding friction of the apex seal and the rotational friction of the eccentric shaft bearing, and increase non-linearly with rotational speed. Effective torque The calculation formula is: , Friction loss It is simplified to a polynomial function of rotational speed to capture the viscous friction in the low-speed region and the turbulent friction and centrifugal force effect of the sealing strip in the high-speed region: , in, It is the static friction constant. and These represent the viscosity and the coefficient of fluid friction, respectively. The model has a simple structure and is sufficient to cover the frictional loss characteristics within the commonly used operating range of rotary engines.

[0079] 3. Dynamic equation for rotational speed: The rotational motion of the eccentric shaft of the rotary engine follows the laws of rigid body rotation. The rotary engine can be considered as having an equivalent moment of inertia. A rigid rotor, whose rotational speed is dynamically determined by the effective torque and the external load torque. Difference-driven: , in, Including the inertia of rotating components such as rotors, eccentric shafts, and flywheels. For external load.

[0080] This differential equation constitutes the core dynamic element of the entire power system. The equation is solved using an integrator module, and the output real-time rotational speed *n* is fed back to the air system model as a feedback signal (affecting the air filling efficiency). ) and combustion system model (affecting friction) (and combustion duration), forming a complete closed-loop dynamic system.

[0081] In one specific embodiment, the oxygen sensor composite hysteresis model includes a transport pure delay model, a sensor response inertia model, and a combined mathematical model of the two models.

[0082] 1. Pure delay model for transportation: It takes a certain amount of time for exhaust gas to exit from the exhaust valve and flow through the exhaust pipe to reach the sensor installation location, resulting in a pure delay. This delay time depends primarily on the exhaust pipe volume. With instantaneous exhaust mass flow rate They are approximately inversely proportional: , in, For exhaust density, Let be the transmission delay constant. This equation shows that under high load and high flow rate conditions, the gas flow rate is fast and the transmission delay is short; conversely, under idling or low load conditions, the delay increases significantly.

[0083] 2. Sensor response inertial model: The electrochemical reactions and signal conditioning circuitry within the oxygen sensor exhibit thermal and chemical inertia, causing its output to fail to instantaneously follow input changes. This dynamic process is modeled as a first-order inertial element with a time constant... Due to the influence of the oxygen sensor's operating temperature and exhaust conditions, this model simplifies the equation to a function of exhaust flow rate. , in, This is the sensor's inherent minimum response time. This is the flow rate correction factor. At low flow rates, the sensor cooling effect is enhanced and exhaust gas turnover is slow, resulting in a slower response. (Increase).

[0084] 3. Comprehensive mathematical model: Combining the above two steps, the oxygen sensor outputs... The dynamic equations are described as follows: , This equation clearly expresses the generation mechanism of the measured signal: the true air-fuel ratio. First, it undergoes a time-varying delay. The intermediate signal is obtained, and then the signal undergoes a time constant of... The first-order low-pass filter outputs the final value of the hysteresis air-fuel ratio. Based on the aforementioned sensor response inertial model, the corresponding sample hysteresis air-fuel ratio measurement value can be generated from the sample's true air-fuel ratio value.

[0085] See Figure 3 In one embodiment, the method for predicting the air-fuel ratio based on the sample feature sequence includes, but is not limited to, steps S301 to S303.

[0086] Step S301: Perform dynamic compensation processing on the sample feature sequence to obtain the sample transient dynamic compensation value.

[0087] Step S302: Perform steady-state mapping processing on the sample injection mass flow rate value to obtain the sample steady-state physical reference value.

[0088] Step S303: Output the transient dynamic compensation value and the steady-state physical baseline value of the sample as the predicted value of the sample model.

[0089] Dynamic compensation processing refers to extracting and quantifying dynamic information related to transient changes in the air-fuel ratio from the input feature sequence. Dynamic compensation processing can capture the nonlinear, time-varying response of the air-fuel ratio during the operation of a rotary engine, when parameters such as throttle opening and fuel injection quantity change rapidly. For example, dynamic compensation processing can employ time-series analysis methods, such as using techniques like differencing, moving averages, or exponential smoothing to highlight the changing trends in the sequence; alternatively, it can utilize specially designed neural network layers, such as convolutional neural networks or attention mechanisms, to identify and learn patterns related to the transient response in the sample feature sequence.

[0090] Steady-state mapping refers to the process of establishing a correspondence between sample fuel injection mass flow rate values ​​and steady-state physical reference values ​​for the air-fuel ratio. This process focuses on reflecting the direct physical impact of fuel injection quantity on the air-fuel ratio under steady-state operating conditions. For example, steady-state mapping can directly convert the fuel injection mass flow rate value into a theoretical steady-state air-fuel ratio value based on predefined physical formulas or empirical curves; alternatively, it can utilize a simple feedforward neural network to fit the mapping relationship between the fuel injection mass flow rate value and the steady-state air-fuel ratio by learning from a large amount of steady-state operating condition data.

[0091] The proposed solution decomposes the traditional single prediction mode into two parallel and complementary processing paths when predicting air-fuel ratio based on sample feature sequences. First, by dynamically compensating the sample feature sequences, dynamic information related to transient changes in air-fuel ratio can be effectively extracted from complex time-series data, generating sample transient dynamic compensation values. This allows the model to focus on capturing the nonlinear, time-varying response of the rotary engine under rapidly changing operating conditions. Second, by performing steady-state mapping on the sample injection mass flow rate values, a steady-state correspondence between injection quantity and air-fuel ratio based on physical laws can be established, generating sample steady-state physical benchmark values. This ensures that the model follows basic physical principles during prediction, avoiding prediction results that contradict common physical sense. Finally, these two components—sample transient dynamic compensation values ​​and sample steady-state physical benchmark values—are output, together constituting the sample model prediction value. This decomposition and integration strategy enables the gated recurrent neural network model to not only flexibly adapt to rapid changes in transient operating conditions when predicting air-fuel ratio, but also to robustly anchor itself to a physical steady-state benchmark, thereby improving the accuracy and robustness of the prediction. In this way, the model can more accurately understand and predict the complex behavior of the air-fuel ratio, effectively solving the problem that a single model cannot simultaneously take into account both dynamic and steady-state characteristics.

[0092] In some embodiments, dynamic compensation processing of the sample feature sequence includes: performing forgetting gating processing on the sample hysteresis air-fuel ratio measurement value to generate a forgetting coefficient; performing input gating processing on the high-frequency variation component of the sample throttle opening value to generate input coefficients, and generating candidate network states based on the sample data set; using the forgetting coefficient to attenuate the historical network states of the gated recurrent neural network model, and using the input coefficients to filter the candidate network states, fusing the attenuated historical network states with the filtered candidate network states to obtain the updated network states; performing output gating processing on the updated network states to generate output coefficients; using the output coefficients to modulate the updated network states, and generating transient dynamic compensation values ​​based on the modulated network states.

[0093] Forgetting gating is a technique in recurrent neural networks used to selectively retain or discard historical information. Its function is to dynamically determine, based on the current input and the historical network state, the extent to which the memory units (historical network states) from the previous time step should be "forgotten" or retained, thereby filtering out irrelevant or outdated historical information. Applying forgetting gating to sample hysteresis air-fuel ratio measurements can be done by using a fully connected layer that takes the current sample hysteresis air-fuel ratio measurement and the previous network state as input, and then using an activation function to map its output to a range of 0 to 1, thus generating a forgetting coefficient.

[0094] Input gating controls how much new information from the current moment is written into the network state. Its role is to filter the portion of the current input that is useful for updating the network state, particularly for the high-frequency variation components of the sample throttle opening value, selectively introducing these crucial transient information. Input gating is performed on the high-frequency variation components of the sample throttle opening value. This can be achieved by receiving the high-frequency variation components of the current sample throttle opening value and the network state from the previous moment through a fully connected layer, and generating input coefficients through an activation function. Simultaneously, the candidate network state is a potential new network state generated based on the current input information and the network state from the previous moment. Its role is to provide an unfiltered version of the network state containing all possible new information from the current moment. For example, a fully connected layer can receive the sample data set from the current moment and the network state from the previous moment, and generate candidate network states through an activation function.

[0095] Output gating controls how much information from the updated network state is output to the current hidden state or as the final prediction result. Its purpose is to extract the most relevant parts from the complex internal network state, avoiding the output of irrelevant internal information. To perform output gating on the updated network state, a fully connected layer receives the current sample data set and the updated network state, and an activation function is used to generate output coefficients.

[0096] The updated network state is modulated using the output coefficients, and transient dynamic compensation values ​​are generated based on the modulated network state. The modulated network state can be obtained by multiplying the output coefficients element-wise with the updated network state processed by the activation function, and this modulated network state is used as the transient dynamic compensation value.

[0097] This application's solution employs a refined gating mechanism to effectively process different types of information in sample feature sequences, generating accurate transient dynamic compensation values. Specifically, when the gated recurrent neural network model receives a sample feature sequence, it first performs forgetting gating on the sample hysteresis air-fuel ratio measurement value, which exhibits hysteresis characteristics, generating a forgetting coefficient. This forgetting coefficient dynamically assesses which information in the historical network state remains valid for prediction at the current moment, thus selectively attenuating the historical network state and preventing outdated or irrelevant information from interfering with the current judgment. Simultaneously, for the high-frequency variation component of the sample throttle opening value, which is sensitive to transient changes, input gating is performed to generate input coefficients. These input coefficients are then combined with candidate network states generated based on the entire sample data set, ensuring that only effectively filtered new information is integrated. Subsequently, the historical network state attenuated by the forgetting coefficient is fused with the candidate network state filtered by the input coefficients, resulting in an updated network state that retains necessary historical memory while incorporating key current information. Finally, output gating is performed on the updated network state to generate output coefficients. These output coefficients further modulate the updated network state to extract the information that best represents the current transient dynamic characteristics, and based on this, transient dynamic compensation values ​​are generated. Through this step-by-step and fine-grained gating process, the gated recurrent neural network model can effectively distinguish and process the dynamic effects of different input features, thereby more accurately capturing the transient response of the rotary engine and providing high-quality dynamic compensation for subsequent air-fuel ratio prediction.

[0098] In one specific embodiment, the gated recurrent neural network model internally constructs a sophisticated temporal information filtering and state update mechanism. This mechanism can essentially be viewed as a dynamic system with multiple nonlinear "regulating valves": it uses cell states as the main information flow throughout the entire system, and through the coordinated control of three independent gating units (forget gate, input gate, and output gate), it dynamically adjusts the retention ratio of historical data and the integration degree of new states, thereby achieving selective memorization of complex time-varying signals. The specific physical meaning and mathematical representation of each core component in this architecture are as follows: 1. Cell State ): Cell states, or network states, operate sequentially and involve only a small number of linear interactions (primarily element-wise addition and multiplication). This linear network state structure allows gradients to be maintained for extended periods during backpropagation without significant decay, effectively addressing long-term dependency issues. In rotary engine compensation tasks, cell states can be viewed as storing the "cumulative intake-injection effect over a past period" and "current delay phase information," serving as a carrier for the network's long-term dynamic characteristics.

[0099] 2. Forget Gate ): The forgetting gate determines the cell's state at the previous moment. How much information is retained up to the current moment? Its mathematical expression is: , in, Forgetting coefficient, It is the hidden state from the previous moment. It is a vector obtained by processing the measured values ​​of the hysteresis air-fuel ratio of the samples. and These are learnable parameters. It's a sigmoid activation function, with an output value between 0 and 1. An output close to 0 indicates "complete forgetting," while a output close to 1 indicates "complete retention." Physical meaning: The forget gate is the core mechanism for variable delay compensation. When the engine is operating at high RPMs, the exhaust gas delivery delay is short, and the model needs to focus on recent input information. In this case, the forget gate tends to output a smaller value, quickly "forgetting" distant historical information. Conversely, under low RPM and large delay conditions, the forget gate tends to output a larger value, retaining distant intake and injection information in the cellular state.

[0100] 3. Input Gate ): The input gate determines how much new information from the current input needs to be written to the cell state. It consists of two parts: first, the sigmoid layer determines which values ​​are updated. , Secondly Using the input coefficients, a new candidate network state is created through the Tanh layer. This includes new information that may be added to the state: , Physical meaning analysis: During the instant of rapid acceleration of a rotary engine, the intake air flow rate... The throttle opening (TPS) undergoes a sharp change, representing a high-frequency variation in the sample throttle opening value. The input gate can sensitively detect this change and, through... Opening the "valve" will reveal the candidate network state representing this mutation. Write the cell state. This ensures that the network can respond quickly to transient disturbances, rather than being bound by past steady-state information.

[0101] 4. Output Gate ): Old cell state With the new candidate network state Merge according to the instructions of the forget gate and the input gate: , in, For the updated network status, This indicates element-wise multiplication.

[0102] Finally, the output gate performs output gating on the updated network state to generate output coefficients. These output coefficients are then used to modulate the updated network state to obtain the modulated network state. : , , After obtaining the modulated network state, transient dynamic compensation values ​​are generated based on the modulated network state.

[0103] In some embodiments, the steady-state mapping processing of the sample fuel injection mass flow rate value includes: performing linear mapping processing on the sample fuel injection mass flow rate value to map the sample fuel injection mass flow rate value to a sample steady-state physical reference value using mapping weights that are constrained to be non-positive.

[0104] The mapping weights constrained to be non-positive refer to the weighting coefficients used in the linear mapping process described above to convert the sample injection mass flow rate values ​​into sample steady-state physical baseline values, which are limited to being less than or equal to zero. This constraint directly introduces a physical causal relationship into the rotary engine: under otherwise unchanged conditions, increasing the injection mass flow rate generally leads to a decrease in the air-fuel ratio (a richer mixture). The non-positive weights ensure that this inverse relationship is reflected in the model. This constraint can be implemented in several ways. For example, during model training, the weight values ​​can be truncated after each weight update to ensure they do not exceed zero. Alternatively, parameter reparameterization techniques can be used to represent the weights as a negative exponential or negative soft-additive function of an unconstrained variable, thus ensuring that they are always non-positive.

[0105] The proposed solution linearly maps sample fuel injection mass flow rates to sample steady-state physical baseline values ​​using non-positive mapping weights. This approach directly embeds the physical causal logic of the rotary engine when generating the sample steady-state physical baseline values; that is, an increase in fuel injection mass flow rate leads to a decrease in air-fuel ratio. By constraining the mapping weights to non-positive values, it ensures that the model avoids physically unreasonable positive correlations when learning the relationship between fuel injection quantity and the steady-state components of air-fuel ratio. This allows the sample steady-state physical baseline values ​​to accurately reflect the steady-state impact of fuel injection quantity on air-fuel ratio, providing a solid physical foundation for subsequent air-fuel ratio prediction. The introduction of this physical constraint allows the gated recurrent neural network model to focus on capturing more complex dynamic characteristics when learning transient dynamic compensation, without needing to correct physical errors in the steady-state part, thereby improving the model's training efficiency and the physical rationality of the predictions.

[0106] In one specific embodiment, after each gradient update, the mapping weights of the gated recurrent neural network model, which perform linear mapping processing on the sample fuel injection mass flow rate values, are constrained to non-positive values. These mapping weights then perform the following projection operation: , in, These are the projected mapping weights. These are the mapping weights before projection.

[0107] After constraining the mapping weight to a non-positive value, the sample injection mass flow rate value is linearly mapped using the projected mapping weight to obtain the sample steady-state physical reference value.

[0108] In some embodiments, superimposing the sample baseline prediction value and the sample model prediction value includes: superimposing the sample baseline prediction value, the sample transient dynamic compensation value and the sample steady-state physical baseline value to obtain the sample air-fuel ratio intermediate prediction value, and performing boundary truncation processing on the sample air-fuel ratio intermediate prediction value to obtain the sample air-fuel ratio prediction value.

[0109] In the training process of the air-fuel ratio prediction model, a sample baseline prediction value is first calculated based on the mechanistic baseline model of the rotary engine. This value reflects the air-fuel ratio of the rotary engine under ideal physical conditions. Simultaneously, a gated recurrent neural network model predicts the air-fuel ratio based on the sample feature sequence. The output sample model prediction value is further decomposed into sample transient dynamic compensation values ​​and sample steady-state physical baseline values. The sample transient dynamic compensation values ​​are used to correct the deficiencies of the mechanistic model under dynamic operating conditions, while the sample steady-state physical baseline values ​​provide additional physical constraints by performing a steady-state mapping of the injection mass flow rate. To obtain a comprehensive and accurate air-fuel ratio prediction, this application superimposes the above sample baseline prediction values, sample transient dynamic compensation values, and sample steady-state physical baseline values ​​to obtain an intermediate predicted value for the sample air-fuel ratio. This superposition operation effectively integrates information from multiple aspects such as physical mechanism, dynamic compensation, and steady-state correction, enabling the intermediate predicted value to more comprehensively reflect the actual air-fuel ratio. However, due to the complexity of model training and the uncertainty of data, the directly superimposed intermediate predicted value may still exceed the actual physical range. Therefore, this application further performs boundary truncation on the intermediate predicted values ​​of the sample air-fuel ratio. This processing ensures that the final predicted value of the sample air-fuel ratio always remains within a reasonable physical range by limiting the intermediate predicted value within a preset physical upper and lower limit. Through this combination of superposition and boundary truncation, the solution of this application can not only make full use of multi-source information to improve prediction accuracy, but also effectively avoid unreasonable predictions, thereby significantly enhancing the robustness and practicality of the air-fuel ratio prediction model.

[0110] The following example illustrates this. Suppose that at a certain sample time, the sample baseline prediction value calculated by the mechanistic baseline model is 14.7. Simultaneously, the sample transient dynamic compensation value obtained by the gated recurrent neural network model after dynamic compensation processing is -0.3, and the sample steady-state physical baseline value obtained after steady-state mapping processing is 0.1. These three values ​​are then summed: 14.7 + (-0.3) + 0.1, resulting in an intermediate predicted value of 14.5 for the sample air-fuel ratio. Subsequently, this intermediate predicted value of the sample air-fuel ratio is truncated. For example, the preset physical boundary conditions for the air-fuel ratio are a minimum air-fuel ratio of 10.0 and a maximum air-fuel ratio of 20.0. Since 14.5 lies between 10.0 and 20.0, the final predicted value of the sample air-fuel ratio remains 14.5 after boundary truncation. If the calculated intermediate predicted value of the sample air-fuel ratio is 21.0, then during boundary truncation, this value will be truncated to 20.0 to conform to the maximum physical boundary. Conversely, if the intermediate prediction value is 9.5, it will be truncated to 10.0 to conform to the minimum physical boundary.

[0111] See Figure 4In one embodiment, the method for determining the loss information between the predicted air-fuel ratio of the sample and the actual air-fuel ratio of the sample includes, but is not limited to, steps S401 to S405.

[0112] Step S401: Perform difference measurement processing on the predicted air-fuel ratio of the sample and the actual air-fuel ratio of the sample to generate data fitting loss information.

[0113] Step S402: Perform boundary penalty processing on the sample air-fuel ratio prediction values ​​that exceed the physical boundary conditions to generate boundary penalty loss information.

[0114] Step S403: Perform causal monotonicity penalty processing on the sample air-fuel ratio prediction values ​​that violate the physical causal logic conditions to generate causal penalty loss information.

[0115] The physical causal logic condition includes that when the throttle opening is constant, an increase in the sample fuel injection mass flow rate leads to a decrease in the sample air-fuel ratio prediction.

[0116] Step S404: Perform residual constraint processing on the deviation between the sample air-fuel ratio prediction value and the sample baseline prediction value to generate residual penalty loss information.

[0117] Step S405: The data fitting loss information, boundary penalty loss information, causal penalty loss information, and residual penalty loss information are weighted and summed to obtain the loss information.

[0118] The difference between the predicted and actual air-fuel ratios of the samples can be measured by either calculating the mean squared error (MSE), which is the average of the squared differences between the predicted and actual values, or by using the mean absolute error (MAE), which is the average of the absolute differences between the predicted and actual values. These metrics directly reflect the model's fit to the training data and are commonly used loss calculation methods in supervised learning.

[0119] Boundary penalty processing can be applied to the predicted air-fuel ratio values ​​of samples that exceed physical boundary conditions. A quadratic penalty function can be used, where the penalty term increases with the square of the degree of exceedance when the predicted value exceeds the boundary, thereby effectively suppressing the model from generating extreme predictions that do not conform to physical common sense.

[0120] Applying causal monotonicity penalty to sample air-fuel ratio predictions that violate physical causal logic conditions can be achieved by imposing a penalty when the model's prediction (sample air-fuel ratio prediction) violates a preset physical causal logic condition. For example, in rotary engine operation, when the throttle opening is constant, increasing the injection mass flow rate usually leads to a decrease in the air-fuel ratio (a richer mixture). If the model's prediction violates this monotonicity relationship, a penalty is imposed. This processing can be implemented by introducing a term into the loss function that produces a non-zero value when a violation of monotonicity is detected. For example, the direction of change in the air-fuel ratio predicted by the model under small perturbations (such as a slight increase in injection quantity) can be compared to see if it is consistent with physical laws; if not, a penalty is imposed.

[0121] Applying residual constraints to the deviation between the sample air-fuel ratio prediction and the sample baseline prediction can be achieved by assigning different weights to each loss term. This allows for adjusting the model training focus based on actual needs and the importance of each loss term. For example, a higher weight can be assigned to the data fitting loss to ensure accurate model fitting of the data, while appropriate weights can be assigned to the physical constraint term to ensure the physical reasonableness of the prediction. This weighted summation approach allows the model to balance data-driven learning with the integration of physical knowledge during the optimization process.

[0122] This application's solution constructs a multi-objective, physically-enhanced loss function that organically combines data fitting, physical boundary constraints, physical causal logic constraints, and residual constraints from the mechanistic baseline model. During training, the gated recurrent neural network model is not only guided to minimize the difference between the predicted and actual values, but is also required to meet preset physical boundary and causal logic conditions. Simultaneously, through residual constraints, the neural network is encouraged to learn complex dynamic characteristics that the mechanistic baseline model fails to fully capture, rather than making predictions entirely independently. This comprehensive loss function design allows the neural network to fully utilize the prior physical knowledge of the mechanistic model, thereby achieving a more physically plausible and robust air-fuel ratio prediction capability based on data-driven learning.

[0123] In a specific embodiment, the expression for the loss function is: , in, For the loss of information, To penalize the loss of information at the boundary, To fit loss information to the data, For causal punishment of information loss, For residual penalty loss information, , , and All weights are adaptive. Since the physical penalty terms and data error terms differ significantly in size and magnitude, all errors substituted into the total loss formula have been pre-normalized. Regarding the penalty weight configuration strategy, this application adopts a course-learning-style dynamic weighting strategy. In the initial training phase, the weights are set... A larger initial value allows the model to quickly learn the basic distribution characteristics of the data; as training progresses, the value gradually increases. , and This forces the model to continuously correct parameter directions that violate physical laws during convergence. This strategy effectively balances the contradiction between "data fitting accuracy" and "physical consistency," especially when transient data is scarce. The physical constraint term acts as a regularization term, preventing overfitting noise and significantly improving generalization performance. The dynamic evolution law of each weight coefficient with the number of iterations k is defined as: , , in, The decay rate of the weights of the data error term. Unified representation of the weights of each physical constraint (i.e. , , ), The maximum steady-state gain of the physical constraint term. As an incremental growth factor, This is the threshold for preheating iteration.

[0124] The above mechanism indicates that: In the initial stage, the optimization direction was dominated by pure data-driven approaches. This approach rapidly establishes a basic dynamic mapping; after exceeding the preheating threshold, a physical constraint penalty term is smoothly introduced in an exponential form. This progressive coupling strategy effectively balances the optimization trade-off between "data fit approximation" and "consistency with physical laws." Particularly under the hard constraint architecture of dynamic-static decoupling, the dynamically introduced soft penalty term acts as a high-order regularization factor with clear thermodynamic significance, effectively suppressing the model's overfitting tendency to local high-frequency noise and significantly improving the robustness of the compensation algorithm under the full envelope condition.

[0125] See Figure 5 In one embodiment, an air-fuel ratio delay compensation method is provided. The execution subject of the method is a terminal or a server, including but not limited to steps S501 to S504.

[0126] Step S501: Obtain the injection mass flow rate, intake mass flow rate, throttle opening value, and hysteresis air-fuel ratio measurement value of the rotary engine at the current moment and at multiple historical moments to form an input feature sequence.

[0127] Step S502: Based on the mechanistic benchmark model of the rotary engine, calculate the physical benchmark prediction value of the air-fuel ratio at the current moment using the intake air mass flow rate value and the fuel injection mass flow rate value.

[0128] Step S503: Input the input feature sequence into the pre-trained air-fuel ratio prediction model to predict the air-fuel ratio based on the input feature sequence, and obtain the model prediction value of the air-fuel ratio at the current time.

[0129] The air-fuel ratio prediction model was trained using the aforementioned air-fuel ratio prediction model training method.

[0130] Step S504: Superimpose the physical baseline prediction value and the model prediction value to obtain the real-time air-fuel ratio prediction value at the current moment after delay compensation.

[0131] This embodiment predicts the air-fuel ratio based on the current and multiple historical values ​​of the rotary engine's injection mass flow rate, intake mass flow rate, throttle opening, and hysteresis air-fuel ratio. Based on the rotary engine's mechanistic baseline model, the physical baseline prediction of the air-fuel ratio at the current moment is calculated using the intake mass flow rate and injection mass flow rate. A pre-trained air-fuel ratio prediction model then predicts the air-fuel ratio based on the input feature sequence, yielding the model prediction value for the current moment. Finally, the physical baseline prediction value output by the mechanistic baseline model is superimposed with the model prediction value output by the air-fuel ratio prediction model to obtain the real-time air-fuel ratio prediction value after delay compensation. Since the mechanistic baseline model provides reliable baseline predictions based on the rotary engine's physical mechanism, and the data-driven model is trained through physical constraints to ensure that its predictions are within physical boundaries and conform to causal logic—for example, an increase in injection mass flow rate at a constant throttle opening leads to a decrease in the predicted air-fuel ratio—this method is effective. Therefore, this method can maintain the physical rationality of the prediction results even under operating conditions outside the training distribution, avoid the generation of non-physical solutions, effectively prevent the closed-loop system from diverging, and significantly improve the accuracy of air-fuel ratio delay compensation and system robustness.

[0132] This application also provides an electronic device. (See appendix.) Figure 6 , Figure 6 This is a schematic diagram of the main structure of an electronic device according to an embodiment of this application. Figure 6 As shown, the electronic device in this embodiment mainly includes a processor 601 and a memory 602. The memory 602 can be configured to store a program for executing the methods of the above-described method embodiments, and the processor 601 can be configured to execute the program in the memory 602. This program includes, but is not limited to, a program for executing the methods of the above-described method embodiments. For ease of explanation, only the parts related to the embodiments of this application are shown. For specific technical details not disclosed, please refer to the method section of the embodiments of this application.

[0133] In some possible embodiments of this application, the electronic device may include multiple processors 601 and multiple memories 602. The program executing the methods of the above method embodiments may be divided into multiple subroutines, each of which may be loaded and run by a processor 601 to perform different steps of the methods of the above method embodiments. Specifically, each subroutine may be stored in a different memory 602, and each processor 601 may be configured to execute programs in one or more memories 602 to jointly implement the methods of the above method embodiments; that is, each processor 601 executes different steps of the methods of the above method embodiments to jointly implement the methods of the above method embodiments.

[0134] The aforementioned multiple processors 601 can be processors deployed on the same device. For example, the aforementioned electronic device can be a high-performance device composed of multiple processors, and the aforementioned multiple processors 601 can be processors configured on that high-performance device. Alternatively, the aforementioned multiple processors 601 can also be processors deployed on different devices. For example, the aforementioned electronic device can be a server cluster, and the aforementioned multiple processors 601 can be processors on different servers within the server cluster.

[0135] This application also provides a computer-readable storage medium. In one embodiment of the computer-readable storage medium according to this application, the computer-readable storage medium can be configured to store a program that performs the methods of the above-described method embodiments, the program of which can be loaded and run by a processor to implement the above-described methods. For ease of explanation, only the parts related to the embodiments of this application are shown; for specific technical details not disclosed, please refer to the method section of the embodiments of this application. The computer-readable storage medium can be a memory formed by various electronic devices. Optionally, in the embodiments of this application, the computer-readable storage medium is a non-transitory computer-readable storage medium.

[0136] The air-fuel ratio prediction model training method, air-fuel ratio delay compensation method, and device provided in this application actively incorporate physical knowledge into the model optimization objective by introducing a mechanistic benchmark model and integrating physical constraint terms into the loss function during the training process. This enables the trained air-fuel ratio prediction model to not only accurately fit the training data, but more importantly, it can maintain the physical rationality of the prediction results when facing unseen operating conditions, avoiding non-physical interpretations, improving the robustness and reliability of the prediction, effectively preventing closed-loop system divergence, and significantly improving the accuracy of air-fuel ratio delay compensation for rotary engines. Therefore, by fusing the mechanistic benchmark model with the trained air-fuel ratio prediction model for air-fuel ratio prediction, it can avoid outputting prediction values ​​that violate physical laws under rapid load changes or extreme environmental conditions of the rotary engine, thus improving the accuracy of air-fuel ratio prediction and the stability of the control system.

[0137] Exemplary embodiments of this disclosure have been specifically shown and described above. It should be understood that this disclosure is not limited to the detailed structures, arrangements, or implementations described herein; rather, this disclosure is intended to cover various modifications and equivalent arrangements contained within the spirit and scope of the appended claims.

Claims

1. A method for training an air-fuel ratio prediction model, characterized in that, include: Obtain sample feature sequences containing multiple sample data groups and the sample true air-fuel ratio values ​​corresponding to the sample data groups; the sample data groups include sample fuel injection mass flow rate values, sample intake air mass flow rate values, sample throttle opening values, and sample hysteresis air-fuel ratio measurement values; Based on the mechanistic baseline model of the rotary engine, the sample baseline predicted value of the air-fuel ratio at the sample time is calculated using the sample intake mass flow rate value and the sample fuel injection mass flow rate value. The sample feature sequence is input into a preset gated recurrent neural network model to predict the air-fuel ratio based on the sample feature sequence, thereby obtaining the sample model prediction value of the air-fuel ratio at the sample time. By superimposing the sample baseline prediction value and the sample model prediction value, the sample air-fuel ratio prediction value after lag compensation is obtained at the sample time. Based on a preset loss function, the loss information between the predicted air-fuel ratio of the sample and the actual air-fuel ratio of the sample is determined; the loss function includes a physical constraint term, which is used to force the predicted air-fuel ratio of the sample to meet preset physical boundary conditions and physical causal logic conditions. The parameters of the gated recurrent neural network model are updated based on the loss information until the preset training termination condition is met, thus obtaining a trained air-fuel ratio prediction model.

2. The air-fuel ratio prediction model training method according to claim 1, characterized in that, The mechanistic baseline model includes a fuel system model, which describes the dynamic mapping relationship between the injected fuel quantity and the actual amount of fuel participating in combustion. The calculation of the sample baseline predicted value of the air-fuel ratio at the sample time using the sample intake air mass flow rate and the sample fuel injection mass flow rate includes: The sample injection mass flow rate value is input into the fuel system model to solve for the sample effective fuel mass flow rate value. The ratio between the sample intake mass flow rate value and the sample effective fuel mass flow rate value is then calculated to obtain the sample baseline prediction value.

3. The air-fuel ratio prediction model training method according to claim 2, characterized in that, The mechanistic baseline model also includes an air system model, a combustion torque and speed model, and an oxygen sensor composite hysteresis model. The air system model is used to describe the dynamic mapping relationship between the throttle opening and intake air mass flow rate of the rotary engine. The combustion torque and speed model is used to describe the dynamic mapping relationship between the effective fuel mass flow rate and the ignition angle on the output torque and speed of the rotary engine. The oxygen sensor composite hysteresis model is used to describe the dynamic mapping relationship between the true air-fuel ratio and the hysteresis air-fuel ratio measurement.

4. The air-fuel ratio prediction model training method according to claim 1, characterized in that, The step of predicting the air-fuel ratio based on the sample feature sequence includes: The sample feature sequence is dynamically compensated to obtain the sample transient dynamic compensation value; The sample injection mass flow rate value is subjected to steady-state mapping processing to obtain the sample steady-state physical reference value; The transient dynamic compensation value and the steady-state physical baseline value of the sample are output as the predicted value of the sample model.

5. The air-fuel ratio prediction model training method according to claim 4, characterized in that, The dynamic compensation processing of the sample feature sequence includes: Forgetting gating is performed on the measured values ​​of the hysteresis air-fuel ratio of the sample to generate a forgetting coefficient; Input gating processing is performed on the high-frequency variation components of the sample throttle opening value to generate input coefficients, and candidate network states are generated based on the sample data set; The historical network state of the gated recurrent neural network model is decayed using the forgetting coefficient, and the candidate network state is filtered using the input coefficient. The decayed historical network state is then fused with the filtered candidate network state to obtain the updated network state. The updated network state is subjected to output gating processing to generate output coefficients; The updated network state is modulated using the output coefficients, and the transient dynamic compensation value is generated based on the modulated network state.

6. The air-fuel ratio prediction model training method according to claim 4, characterized in that, The steady-state mapping process for the sample injection mass flow rate value includes: The sample fuel injection mass flow rate value is linearly mapped to the sample steady-state physical reference value using mapping weights that are constrained to be non-positive.

7. The air-fuel ratio prediction model training method according to claim 4, characterized in that, The superposition of the sample baseline prediction value and the sample model prediction value includes: The sample baseline prediction value, the sample transient dynamic compensation value, and the sample steady-state physical baseline value are superimposed to obtain the sample intermediate air-fuel ratio prediction value. The sample intermediate air-fuel ratio prediction value is then truncated to obtain the sample air-fuel ratio prediction value.

8. The air-fuel ratio prediction model training method according to claim 1, characterized in that, The method of determining the loss information between the predicted air-fuel ratio of the sample and the actual air-fuel ratio of the sample based on a preset loss function includes: The difference between the predicted air-fuel ratio of the sample and the actual air-fuel ratio of the sample is measured to generate data fitting loss information. Boundary penalty processing is applied to the sample air-fuel ratio prediction values ​​that exceed the physical boundary conditions to generate boundary penalty loss information; A causal monotonicity penalty is applied to the sample air-fuel ratio prediction value that violates the physical causal logic condition, generating causal penalty loss information; the physical causal logic condition includes that when the throttle opening is constant, an increase in the sample fuel injection mass flow rate leads to a decrease in the sample air-fuel ratio prediction value. The deviation between the sample air-fuel ratio prediction value and the sample baseline prediction value is subjected to residual constraint processing to generate residual penalty loss information. The loss information is obtained by weighted summation of the data fitting loss information, the boundary penalty loss information, the causal penalty loss information, and the residual penalty loss information.

9. A method for air-fuel ratio delay compensation, characterized in that, include: The current time and multiple historical time values ​​of the rotary engine are obtained, including the injection mass flow rate, intake mass flow rate, throttle opening value, and hysteresis air-fuel ratio measurement value, to form an input feature sequence. Based on the mechanistic benchmark model of the rotary engine, the physical benchmark prediction value of the air-fuel ratio at the current moment is calculated using the intake mass flow rate value and the fuel injection mass flow rate value. The input feature sequence is input into a pre-trained air-fuel ratio prediction model to predict the air-fuel ratio based on the input feature sequence, thereby obtaining the model prediction value of the air-fuel ratio at the current time; the air-fuel ratio prediction model is trained using the air-fuel ratio prediction model training method according to any one of claims 1 to 8. By superimposing the physical baseline prediction value and the model prediction value, the real-time air-fuel ratio prediction value at the current moment after delay compensation is obtained.

10. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method according to any one of claims 1 to 9.