A method and device for measuring direct carbon emission factor of a generator set and electronic equipment
By constructing a carbon emission factor prediction model that includes trend and disturbance terms, and using a swarm intelligence optimization algorithm for global parameter optimization, the accuracy problem of the generator carbon emission factor calculation model is solved, supporting low-carbon dispatching and carbon trading of the power grid.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGDONG POWER GRID CO LTD
- Filing Date
- 2026-03-27
- Publication Date
- 2026-06-09
AI Technical Summary
Existing models for calculating the direct carbon emission factor of generator units are unable to take into account both the macroeconomic evolution trend of carbon emissions and local nonlinear fluctuations. Furthermore, the solution of complex model parameters is prone to getting trapped in local optima, leading to inaccurate calculations.
A carbon emission factor prediction model is constructed. By combining a trend term function and a disturbance term function, a swarm intelligence optimization algorithm is used to perform global optimization within the parameter constraint boundary to determine the optimal model parameters and generate real-time carbon emission factors.
It enables accurate calculation of carbon emission factors during variable load operation, avoids premature convergence, improves the accuracy and stability of calculation results, and supports low-carbon dispatching of power grids and carbon trading quota settlement.
Smart Images

Figure CN122175456A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of carbon accounting technology for power systems, specifically to a method, apparatus, and electronic equipment for calculating the direct carbon emission factor of generator sets. Background Technology
[0002] In the refined carbon accounting and low-carbon optimized dispatching of power systems, the direct carbon emission factor of generating units is a core physical parameter characterizing the level of direct greenhouse gas emissions per unit of generated energy. This factor is not a static constant but dynamically changes with the actual power generation, fuel consumption, and other operating conditions of the generating units. Therefore, accurately calculating the direct carbon emission factor of generating units based on real operating data is not only the foundation for power companies to settle carbon quotas but also a crucial prerequisite for supporting the grid's low-carbon dispatching.
[0003] However, existing methods for calculating the direct carbon emission factor of generator units have limitations in terms of model structure and parameter solution. The main reason for this problem is that during variable load operation, the carbon emission intensity and power generation of generator units exhibit a complex mapping relationship, encompassing both the overall macroscopic evolution trend and local nonlinear fluctuations caused by changes in operating conditions such as the unit's valve point effect. Most current calculation models can only fit a single overall trend that varies with power, making it difficult to mathematically account for the nonlinear fluctuations of local operating conditions. Furthermore, introducing complex nonlinear functions into the model to characterize such fluctuations transforms the solution of model parameters into a complex nonconvex optimization problem. Traditional parameter solution methods are prone to premature convergence and getting trapped in local optima when dealing with such objective functions. Summary of the Invention
[0004] This invention provides a method, apparatus, and electronic device for calculating the direct carbon emission factor of generator sets. It can solve the problems in the prior art where the direct carbon emission factor calculation model of generator sets is difficult to take into account both the macroeconomic evolution trend of carbon emissions and local nonlinear fluctuations, and the solution of complex model parameters is prone to getting trapped in local optima, resulting in inaccurate carbon emission factor calculation.
[0005] An embodiment of the present invention provides a method for calculating the direct carbon emission factor of a generator set, comprising: Obtain the current real-time power output of the generator set; The real-time power generation is input into a pre-built carbon emission factor prediction model to calculate and generate the real-time carbon emission factor of the generator set. The carbon emission factor prediction model is constructed using the following methods: Obtain the historical power generation and historical fuel consumption of the generator set within a preset sampling window; Based on historical fuel consumption, historical power generation, preset sampling duration, preset carbon content, preset carbon oxidation rate, and preset molar mass parameters, the historical actual carbon emission factor is calculated and generated. A trend term function with power generation as the independent variable and a disturbance term function to characterize the nonlinear fluctuations of the generator set's operating conditions are established; both the trend term function and the disturbance term function contain the model parameters to be optimized. The trend term function and the disturbance term function are combined to construct an initial carbon emission factor prediction model; Based on historical power generation, historical actual carbon emission factors, and initial carbon emission factor prediction models, a fitness function is constructed with the goal of minimizing the sum of squared errors. Within the preset parameter constraints, a swarm intelligence optimization algorithm is used to globally optimize the parameters of the model to be optimized so that the fitness function reaches its minimum value, and the optimal model parameters are obtained. The optimal model parameters are substituted into the initial carbon emission factor prediction model to generate the pre-built carbon emission factor prediction model.
[0006] Furthermore, obtain the current real-time power generation of the generator set, including: Obtain the current raw real-time power output of the generator set, as well as the corresponding historical maximum and minimum power outputs of the generator set; The original real-time power generation is cleaned to remove invalid data with values of zero and negative, thus obtaining the effective real-time power generation. Based on the historical maximum and minimum power values, the effective real-time power generation is normalized by range processing to calculate the current real-time power generation of the generator set.
[0007] Furthermore, the preset molar mass parameters include the molar mass of carbon dioxide and the molar mass of carbon. Based on historical fuel consumption, historical power generation, preset sampling duration, preset carbon content, preset carbon oxidation rate, and preset molar mass parameters, the historical actual carbon emission factor is calculated and generated, including: Based on historical fuel consumption, historical power generation, and a preset sampling duration, the fuel consumption per unit of electricity is calculated and generated. The molar mass conversion factor is calculated based on the molar mass of carbon dioxide and the molar mass of carbon. Based on preset carbon content, preset carbon oxidation rate, molar mass conversion factor, and fuel consumption per unit of electricity, the historical actual carbon emission factor is calculated and generated.
[0008] Furthermore, the model parameters to be optimized include quadratic coefficients, linear coefficients, constant terms, perturbation amplitude parameters, and perturbation frequency parameters; Establish a trend term function with power generation as the independent variable, and establish a disturbance term function to characterize the nonlinear fluctuations of generator unit operating conditions, including: Using power generation as the independent variable, a quadratic polynomial function is constructed based on the coefficients of the quadratic term, the coefficients of the linear term, and the constant term, and the quadratic polynomial function is used as the trend term function. Using power generation as the independent variable, and based on the disturbance amplitude parameter, disturbance frequency parameter, and preset reference power, a sinusoidal absolute value function is constructed with the difference between power generation and preset reference power as the input, and the sinusoidal absolute value function is used as the disturbance term function.
[0009] Furthermore, based on historical power generation, historical actual carbon emission factors, and initial carbon emission factor prediction models, a fitness function is constructed with the goal of minimizing the sum of squared errors, including: Historical power generation is input into the initial carbon emission factor prediction model so that the initial carbon emission factor prediction model can calculate and generate the corresponding historical predicted carbon emission factor based on the historical power generation. The model prediction bias is calculated based on historical predicted carbon emission factors and corresponding historical actual carbon emission factors. The sum of squared errors is calculated based on the model prediction bias and then configured as the fitness function.
[0010] Furthermore, within the preset parameter constraint boundaries, a swarm intelligence optimization algorithm is used to globally optimize the parameters of the model to be optimized, so as to minimize the fitness function and obtain the optimal model parameters, including: The parameters of the model to be optimized are used as individuals in the swarm intelligence optimization algorithm. They are initialized within the preset parameter constraint boundary to generate an initial population containing multiple individuals. Each individual in the population corresponds to a set of parameters of the model to be optimized. The fitness value of each individual in the initial population is calculated based on the fitness function, and the initial global best individual is selected from multiple individuals based on the fitness value. Repeat the iterative optimization steps until the preset iteration termination condition is met, and generate the optimal model parameters; The iterative optimization steps include: Based on a preset individual evolution strategy, the parameters of each individual in the current population are updated to generate candidate individuals corresponding to each individual in the current population; wherein, the initial population is the initial population. By using preset parameter constraints, boundary exceedance corrections are performed on each candidate individual to generate legal candidate individuals corresponding to each individual in the current population. For each individual in the current population, the candidate fitness value of the legal candidate individual corresponding to the current population individual is calculated based on the fitness function. When the candidate fitness value is better than the fitness value of the current population individual, the legal candidate individual corresponding to the current population individual is used to replace the current population individual, so as to update the current population. After comparing and replacing the fitness values of all individuals in the current population, and updating the current population, the current global best individual is re-selected and updated from the current population based on the fitness values of each individual in the current population; wherein, the initial global best individual is the initial global best individual. When the preset iteration termination condition is met, the iterative optimization step ends, the current global optimal individual is output, and the current global optimal individual is determined as the optimal model parameters.
[0011] Furthermore, based on a preset individual evolution strategy, the parameters of each individual in the current population are updated separately to generate candidate individuals corresponding to each individual in the current population, including: For each individual in the current population, according to preset probability conditions, the current individual is updated between global exploration mode and local development mode to generate candidate individuals corresponding to the current individual. In the global exploration mode, the exploration increment is determined by using a preset exploration step size coefficient and a randomly generated exploration perturbation term, and the exploration increment is superimposed on the current population individual to generate a candidate individual corresponding to the current population individual. In the local development mode, a convergence guidance amount is determined based on the difference characteristics between the current global optimal individual and the current population individual, and a development increment is determined using a preset guidance coefficient, a randomly generated local perturbation term, and the convergence guidance amount. The development increment is then superimposed on the current population individual to generate a candidate individual corresponding to the current population individual; wherein, the initial global optimal individual is the initial global optimal individual.
[0012] Based on the above method embodiments, the present invention provides corresponding apparatus embodiments.
[0013] One embodiment of the present invention provides a device for calculating the direct carbon emission factor of a generator set, comprising: a real-time power acquisition module, a real-time factor calculation module, and a model building module; The real-time power acquisition module is used to acquire the current real-time power generation of the generator set; The real-time factor calculation module is used to input the real-time power generation into the pre-built carbon emission factor prediction model to calculate and generate the real-time carbon emission factor of the generator set. The model building module is used to acquire the historical power generation and historical fuel consumption of the generator set within a preset sampling window; calculate and generate the historical actual carbon emission factor based on the historical fuel consumption, historical power generation, preset sampling duration, preset carbon content, preset carbon oxidation rate, and preset molar mass parameters; establish a trend term function with power generation as the independent variable, and establish a disturbance term function to characterize the nonlinear fluctuations of the generator set's operating conditions; wherein both the trend term function and the disturbance term function contain the model parameters to be optimized; combine the trend term function and the disturbance term function to construct an initial carbon emission factor prediction model; based on the historical power generation, historical actual carbon emission factor, and the initial carbon emission factor prediction model, construct a fitness function with the minimum sum of squared errors as the optimization objective; within the preset parameter constraint boundary, use a swarm intelligence optimization algorithm to globally optimize the model parameters to be optimized so that the fitness function reaches its minimum value, and solve for the optimal model parameters; substitute the optimal model parameters into the initial carbon emission factor prediction model to generate the pre-built carbon emission factor prediction model.
[0014] Furthermore, the real-time power acquisition module acquires the current real-time power generation of the generator set, including: Obtain the current raw real-time power output of the generator set, as well as the corresponding historical maximum and minimum power outputs of the generator set; The original real-time power generation is cleaned to remove invalid data with values of zero and negative, thus obtaining the effective real-time power generation. Based on the historical maximum and minimum power values, the effective real-time power generation is normalized by range processing to calculate the current real-time power generation of the generator set.
[0015] Based on the above method embodiments, the present invention provides corresponding electronic device embodiments.
[0016] An embodiment of the present invention provides an electronic device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the direct carbon emission factor calculation method for generator sets according to any one of the above-described method embodiments.
[0017] Compared with the prior art, the present invention has the following beneficial effects: This invention provides a method, apparatus, and electronic device for calculating the direct carbon emission factor of a generator set. The method acquires the real-time power generation of the generator set and inputs it into a pre-constructed carbon emission factor prediction model to obtain the corresponding real-time carbon emission factor. Specifically, it calculates historical actual carbon emission factors using historical power generation and fuel consumption, constructs an initial model including trend and disturbance terms, and uses a swarm intelligence optimization algorithm to optimize within parameter constraints, aiming to minimize the sum of squared errors, thereby determining the optimal model parameters and forming the carbon emission factor prediction model.
[0018] To address the shortcomings of existing models in simultaneously considering both macroeconomic trends and local nonlinear fluctuations in carbon emissions, this scheme constructs a prediction model by combining trend and disturbance functions, each containing parameters to be optimized. This provides a mathematical foundation for simultaneously representing both overall evolution and local fluctuations. Furthermore, to address the issue of complex combined models easily getting trapped in local optima during parameter solving, this scheme constructs a fitness function based on historical real-world data and utilizes a swarm intelligence optimization algorithm for global optimization within the parameter constraints. This effectively avoids premature convergence common in traditional methods, ensuring that the final prediction model can accurately calculate and output real-time carbon emission factors when receiving real-time power generation input. Attached Figure Description
[0019] Figure 1 This is a flowchart illustrating a method for calculating the direct carbon emission factor of a generator set according to an embodiment of the present invention.
[0020] Figure 2 This is a schematic diagram of the structure of a generator set direct carbon emission factor calculation device provided in an embodiment of the present invention. Detailed Implementation
[0021] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0022] like Figure 1 As shown, to address the problem that existing models for calculating the direct carbon emission factor of generator sets struggle to simultaneously consider both the macroscopic evolution trend of carbon emissions and local nonlinear fluctuations, and that solving complex model parameters easily leads to local optima and inaccurate carbon emission factor calculations, an embodiment of the present invention provides a method for calculating the direct carbon emission factor of generator sets, comprising at least the following steps: It is understood that the direct carbon emission factor calculation method for generator sets provided in this embodiment can be executed by an electronic device with data processing capabilities, such as an edge computing gateway deployed at the generator set site, a local server of a distributed control system (DCS), or a low-carbon scheduling and management platform in the cloud. This invention does not impose specific limitations on this.
[0023] Step S1: Obtain the current real-time power generation of the generator set; In a preferred embodiment, obtaining the current real-time power generation of the generator set includes: Obtain the current raw real-time power output of the generator set, as well as the corresponding historical maximum and minimum power outputs of the generator set; The original real-time power generation is cleaned to remove invalid data with values of zero and negative, thus obtaining the effective real-time power generation. Based on the historical maximum and minimum power values, the effective real-time power generation is normalized by range processing to calculate the current real-time power generation of the generator set.
[0024] Specifically, obtaining the current real-time power generation of the generator set includes acquiring the current raw real-time power generation, as well as the corresponding historical maximum and minimum power values. During grid-connected operation, the generator set continuously outputs electrical energy. Power acquisition devices deployed at the generator set's grid connection point can collect the instantaneous power output value of the generator set in real time, using this collected power value as the raw real-time power generation. Simultaneously, to eliminate the influence of data dimensions, it is necessary to extract the maximum and minimum power boundary values recorded within past continuous operating cycles from the generator set's historical operating database, and set these as the historical maximum and minimum power values, respectively.
[0025] After obtaining the raw real-time power generation, a validity cleaning process is performed to remove invalid data with values of zero or negative, yielding the valid real-time power generation. When the generator unit is shut down or the power acquisition equipment experiences a communication failure, the acquired raw real-time power generation often appears as zero or negative values. Zero and negative values lack physical meaning in characterizing the carbon emission characteristics of a generator unit under normal operation, and introducing zero and negative values can lead to deviations in subsequent carbon emission factor prediction model calculations. Therefore, by setting a filtering condition of values greater than zero, values equal to or less than zero in the raw real-time power generation are directly filtered out, retaining values greater than zero as valid real-time power generation, ensuring that the power data used in subsequent calculations has a true physical basis.
[0026] Next, based on the historical maximum and minimum power values, range standardization is performed on the effective real-time power generation to calculate the current real-time power generation of the generator unit. The specific mathematical logic of range standardization is as follows: In the formula, This represents the current real-time power generation of the generator set. Represents effective real-time power generation. Represents the historical minimum power. This represents the historical maximum power output. Through the aforementioned range standardization calculation, the effective real-time power generation can be mapped to a fixed numerical range between zero and one.
[0027] By performing a combined process of raw data acquisition, invalid data removal, and range standardization, interference from dirty data caused by abnormal shutdown conditions and sensor failures is effectively eliminated. The dimensional differences caused by different generator unit capacities are also eliminated, resulting in a high degree of consistency and stability of the real-time power generation input into the prediction model. This significantly improves the accuracy and reliability of the model's prediction of real-time carbon emission factors.
[0028] Step S2: Input the real-time power generation into the pre-built carbon emission factor prediction model to calculate and generate the real-time carbon emission factor of the generator set; In a preferred embodiment, the carbon emission factor prediction model is constructed as follows: Obtain the historical power generation and historical fuel consumption of the generator set within a preset sampling window; Based on historical fuel consumption, historical power generation, preset sampling duration, preset carbon content, preset carbon oxidation rate, and preset molar mass parameters, the historical actual carbon emission factor is calculated and generated. A trend term function with power generation as the independent variable and a disturbance term function to characterize the nonlinear fluctuations of the generator set's operating conditions are established; both the trend term function and the disturbance term function contain the model parameters to be optimized. The trend term function and the disturbance term function are combined to construct an initial carbon emission factor prediction model; Based on historical power generation, historical actual carbon emission factors, and initial carbon emission factor prediction models, a fitness function is constructed with the goal of minimizing the sum of squared errors. Within the preset parameter constraints, a swarm intelligence optimization algorithm is used to globally optimize the parameters of the model to be optimized so that the fitness function reaches its minimum value, and the optimal model parameters are obtained. The optimal model parameters are substituted into the initial carbon emission factor prediction model to generate the pre-built carbon emission factor prediction model.
[0029] In a preferred embodiment, the preset molar mass parameter includes the molar mass of carbon dioxide and the molar mass of carbon. Based on historical fuel consumption, historical power generation, preset sampling duration, preset carbon content, preset carbon oxidation rate, and preset molar mass parameters, the historical actual carbon emission factor is calculated and generated, including: Based on historical fuel consumption, historical power generation, and a preset sampling duration, the fuel consumption per unit of electricity is calculated and generated. The molar mass conversion factor is calculated based on the molar mass of carbon dioxide and the molar mass of carbon. Based on preset carbon content, preset carbon oxidation rate, molar mass conversion factor, and fuel consumption per unit of electricity, the historical actual carbon emission factor is calculated and generated.
[0030] In a preferred embodiment, the model parameters to be optimized include quadratic coefficients, linear coefficients, constant terms, perturbation amplitude parameters, and perturbation frequency parameters; Establish a trend term function with power generation as the independent variable, and establish a disturbance term function to characterize the nonlinear fluctuations of generator unit operating conditions, including: Using power generation as the independent variable, a quadratic polynomial function is constructed based on the coefficients of the quadratic term, the coefficients of the linear term, and the constant term, and the quadratic polynomial function is used as the trend term function. Using power generation as the independent variable, and based on the disturbance amplitude parameter, disturbance frequency parameter, and preset reference power, a sinusoidal absolute value function is constructed with the difference between power generation and preset reference power as the input, and the sinusoidal absolute value function is used as the disturbance term function.
[0031] In a preferred embodiment, based on historical power generation, historical actual carbon emission factors, and an initial carbon emission factor prediction model, a fitness function is constructed with the goal of minimizing the sum of squared errors, including: Historical power generation is input into the initial carbon emission factor prediction model so that the initial carbon emission factor prediction model can calculate and generate the corresponding historical predicted carbon emission factor based on the historical power generation. The model prediction bias is calculated based on historical predicted carbon emission factors and corresponding historical actual carbon emission factors. The sum of squared errors is calculated based on the model prediction bias and then configured as the fitness function.
[0032] In a preferred embodiment, within a preset parameter constraint boundary, a swarm intelligence optimization algorithm is used to globally optimize the parameters of the model to be optimized, so as to minimize the fitness function and obtain the optimal model parameters, including: The parameters of the model to be optimized are used as individuals in the swarm intelligence optimization algorithm. They are initialized within the preset parameter constraint boundary to generate an initial population containing multiple individuals. Each individual in the population corresponds to a set of parameters of the model to be optimized. The fitness value of each individual in the initial population is calculated based on the fitness function, and the initial global best individual is selected from multiple individuals based on the fitness value. Repeat the iterative optimization steps until the preset iteration termination condition is met, and generate the optimal model parameters; The iterative optimization steps include: Based on a preset individual evolution strategy, the parameters of each individual in the current population are updated to generate candidate individuals corresponding to each individual in the current population; wherein, the initial population is the initial population. By using preset parameter constraints, boundary exceedance corrections are performed on each candidate individual to generate legal candidate individuals corresponding to each individual in the current population. For each individual in the current population, the candidate fitness value of the legal candidate individual corresponding to the current population individual is calculated based on the fitness function. When the candidate fitness value is better than the fitness value of the current population individual, the legal candidate individual corresponding to the current population individual is used to replace the current population individual, so as to update the current population. After comparing and replacing the fitness values of all individuals in the current population, and updating the current population, the current global best individual is re-selected and updated from the current population based on the fitness values of each individual in the current population; wherein, the initial global best individual is the initial global best individual. When the preset iteration termination condition is met, the iterative optimization step ends, the current global optimal individual is output, and the current global optimal individual is determined as the optimal model parameters.
[0033] In a preferred embodiment, parameters of each individual in the current population are updated based on a preset individual evolution strategy to generate candidate individuals corresponding to each individual in the current population, including: For each individual in the current population, according to preset probability conditions, the current individual is updated between global exploration mode and local development mode to generate candidate individuals corresponding to the current individual. In the global exploration mode, the exploration increment is determined by using a preset exploration step size coefficient and a randomly generated exploration perturbation term, and the exploration increment is superimposed on the current population individual to generate a candidate individual corresponding to the current population individual. In the local development mode, a convergence guidance amount is determined based on the difference characteristics between the current global optimal individual and the current population individual, and a development increment is determined using a preset guidance coefficient, a randomly generated local perturbation term, and the convergence guidance amount. The development increment is then superimposed on the current population individual to generate a candidate individual corresponding to the current population individual; wherein, the initial global optimal individual is the initial global optimal individual.
[0034] Specifically, the historical power generation and fuel consumption of the generator set within a preset sampling window are obtained. During long-term grid-connected operation, the generator set accumulates a massive amount of operating parameters. To ensure the accuracy and timeliness of the prediction model in the time dimension, a fixed time segment closest to the current moment is selected as the preset sampling window. From the operating database contained within the preset sampling window, the historical power generation and historical fuel consumption corresponding to the generator set are extracted. In specific implementations, the historical power generation and historical fuel consumption can be retrieved from the historical database of the plant-level monitoring information system (SIS) or distributed control system (DCS) connected to the generator set, thereby ensuring that the extracted data accurately and objectively reflects the past physical operating conditions of the unit.
[0035] After extracting the basic historical operating data, the historical actual carbon emission factor is calculated based on historical fuel consumption, historical power generation, preset sampling duration, preset carbon content, preset carbon oxidation rate, and preset molar mass parameters. The preset molar mass parameters include the molar mass of carbon dioxide and the molar mass of carbon. The specific calculation process consists of several related pre- and post-calendar steps. First, based on historical fuel consumption, historical power generation, and the preset sampling duration, the fuel consumption per unit of electricity is calculated. The corresponding mathematical expression is as follows: In the formula, Fuel consumption per unit of electricity Represents historical fuel consumption. Represents historical power generation capacity. This represents the preset sampling duration.
[0036] After obtaining the fuel consumption per unit of electricity, the molar mass conversion factor is calculated based on the molar mass of carbon dioxide and the molar mass of carbon. The corresponding mathematical expression is as follows: In the formula, Represents the molar mass conversion factor. Represents the molar mass of carbon dioxide. Represents the molar mass of carbon.
[0037] Finally, based on preset carbon content, preset carbon oxidation rate, molar mass conversion factor, and fuel consumption per unit of electricity, the historical actual carbon emission factor is calculated. The corresponding mathematical expression is as follows: In the formula, Represents historical actual carbon emission factors. This represents the preset carbon content. This represents the preset carbon oxidation rate.
[0038] After obtaining historical actual carbon emission factors, a trend term function with power generation as the independent variable and a disturbance term function to characterize the nonlinear fluctuations of generator unit operating conditions are established. Both the trend term function and the disturbance term function contain the parameters of the model to be optimized. These parameters include quadratic coefficients, linear coefficients, a constant term, disturbance amplitude parameters, and disturbance frequency parameters. Specifically, power generation is used as the independent variable, and a quadratic polynomial function is constructed based on the quadratic coefficients, linear coefficients, and the constant term. This quadratic polynomial function is then used as the trend term function. The corresponding mathematical expression for the trend term function is as follows: In the formula, The result of the trend term function calculation. Represents the coefficient of the quadratic term. Represents the coefficient of the linear term. Represents a constant term.
[0039] Simultaneously, power generation is used as the independent variable. Based on the disturbance amplitude parameter, disturbance frequency parameter, and a preset reference power, a sine absolute value function is constructed with the difference between power generation and the preset reference power as input. This sine absolute value function is then used as the disturbance term function. The corresponding mathematical expression for the disturbance term function is as follows: In the formula, The result of the calculation of the disturbance term function. The parameter representing the disturbance amplitude, This represents the perturbation frequency parameter. This represents the preset reference power.
[0040] After setting the basic functions, the trend term function and the disturbance term function are combined to construct the initial carbon emission factor prediction model. This initial carbon emission factor prediction model mathematically integrates the macroscopic evolution trend of generator units with local nonlinear fluctuations. The corresponding mathematical expression for the model combination is as follows: In the formula, This represents the historical predicted carbon emission factor calculated from the initial carbon emission factor prediction model.
[0041] After constructing the initial prediction model architecture, a fitness function is built based on historical power generation, historical actual carbon emission factors, and the initial carbon emission factor prediction model, with the optimization objective of minimizing the sum of squared errors. Specifically, historical power generation is input into the initial carbon emission factor prediction model, enabling the model to forward calculate and generate the corresponding historical predicted carbon emission factors based on historical power generation. Based on the historical predicted carbon emission factors and the corresponding historical actual carbon emission factors, the model prediction bias is calculated. Then, the sum of squared errors is calculated based on the model prediction bias and configured as the fitness function. The mathematical expression of the corresponding fitness function is as follows: In the formula, This represents the sum of squared errors and the result of the fitness function calculation. This represents the total number of data samples contained within the preset sampling window. Represents the data sample sequence number. This represents the historical predicted carbon emission factor for the sample corresponding to the sequence number. This represents the historical actual carbon emission factor of the sample corresponding to the sequence number.
[0042] After establishing the fitness function, within the preset parameter constraints, a swarm optimization algorithm is used to globally optimize the parameters of the model to be optimized, minimizing the fitness function and thus obtaining the optimal model parameters. The optimization process first uses the model parameters to be optimized as individuals in the swarm optimization algorithm population. Random values are selected and initialized within the preset parameter constraints, generating an initial population containing multiple individuals. Each individual in the population corresponds to a set of model parameters to be optimized. The fitness value of each individual in the initial population is calculated based on the fitness function, and the initial globally optimal individual with the best fitness value is selected from the multiple individuals.
[0043] The iterative optimization process is then repeated until the preset iteration termination condition is met, generating the optimal model parameters. The iterative optimization process includes multiple operation instructions. First, based on a preset individual evolution strategy, the parameters of each individual in the current population are updated, generating candidate individuals corresponding to each individual in the current population. The initial population is the first individual. For each individual in the current population, according to preset probability conditions, the current individual is updated either in global exploration mode or local development mode, generating candidate individuals corresponding to the current individual.
[0044] In global exploration mode, the exploration increment is determined using a preset exploration step size coefficient and a randomly generated exploration perturbation term. This exploration increment is then added to the current population individuals to generate candidate individuals corresponding to the current population individuals. The corresponding parameter update mathematical expression is as follows: In the formula, This represents the combination of parameters included in a candidate individual. This represents the combination of parameters contained in the current population of individuals. This represents the preset exploration step size coefficient. This represents a randomly generated exploration perturbation term.
[0045] In the local development mode, a convergence guide is determined based on the differences between the current global optimal individual and the current population individuals. The development increment is then determined using a preset guide coefficient, a randomly generated local perturbation term, and the convergence guide. This development increment is then added to the current population individuals to generate candidate individuals corresponding to the current population individuals. The initial global optimal individual is the first global optimal individual. The corresponding parameter update mathematical expression is as follows: In the formula, This represents the preset guiding coefficient. This represents a randomly generated local perturbation term. This represents the combination of parameters contained in the current globally optimal individual.
[0046] After obtaining candidate individuals, each candidate individual is corrected for exceeding the boundary using preset parameter constraints, forcibly pulling back values that exceed the boundary, thus generating legal candidate individuals corresponding to each individual in the current population. For each individual in the current population, the candidate fitness value of the legal candidate individual corresponding to the current population individual is calculated based on the fitness function. When the candidate fitness value is better than the fitness value of the current population individual, the legal candidate individual corresponding to the current population individual replaces the current population individual, thereby updating the current population. After the fitness value comparison and replacement of each individual in the current population are completed, and the current population is updated, the current global optimal individual is re-selected and updated based on the fitness values of each individual in the current population. When the preset iteration termination condition is reached, the iterative optimization step ends, the current global optimal individual is output, and the current global optimal individual is determined as the optimal model parameters. As an optional embodiment of the present invention, the swarm intelligence optimization algorithm specifically includes, but is not limited to, Particle Swarm Optimization (PSO), Genetic Algorithm (GA), Grey Wolf Optimization (GWO), Whale Optimization (WOA), or Sparrow Search Algorithm (SSA). In practical applications, a specific population initialization and iteration framework of any of the above algorithms can be selected, and combined with the preset exploration step size coefficient, guiding coefficient, and perturbation term mechanism in this embodiment, fast and stable convergence of the parameters of the model to be optimized can be achieved.
[0047] Finally, the optimal model parameters are substituted into the initial carbon emission factor prediction model to solidify the internal mathematical logic of the prediction model, generating a pre-built carbon emission factor prediction model. The current real-time power generation of the generating units is then input into the pre-built carbon emission factor prediction model to directly calculate the real-time carbon emission factors of the generating units. After calculating the current real-time carbon emission factors of the generating units, this data can be further sent to the power company's carbon accounting management system or the grid-side low-carbon dispatch cloud platform. By continuously outputting dynamic and accurate carbon emission factors, reliable data support is provided for the grid to perform real-time low-carbon economic dispatch, optimize unit power generation load allocation, and subsequently settle carbon trading quotas.
[0048] By combining a quadratic polynomial function that includes the evolution of macroscopic trends with a sinusoidal absolute value function that represents local nonlinear fluctuations to construct a prediction model, and by performing goal-oriented global parameter optimization based on a swarm intelligence optimization algorithm within the parameter constraint boundary, the problem of complex non-convex optimization mathematical problems easily getting trapped in local optima is completely avoided. This fundamentally overcomes the defect that a single model architecture cannot accurately capture the complex emission characteristics of generator units during the variable load operation phase, and significantly improves the accuracy and numerical stability of real-time carbon emission factor calculation results under dynamic operating conditions.
[0049] Based on the above method embodiments, the present invention provides corresponding apparatus embodiments.
[0050] like Figure 2 As shown, an embodiment of the present invention provides a device for calculating the direct carbon emission factor of a generator set, including: a real-time power acquisition module, a real-time factor calculation module, and a model building module; The real-time power acquisition module is used to acquire the current real-time power generation of the generator set; The real-time factor calculation module is used to input the real-time power generation into the pre-built carbon emission factor prediction model to calculate and generate the real-time carbon emission factor of the generator set. The model building module is used to acquire the historical power generation and historical fuel consumption of the generator set within a preset sampling window; calculate and generate the historical actual carbon emission factor based on the historical fuel consumption, historical power generation, preset sampling duration, preset carbon content, preset carbon oxidation rate, and preset molar mass parameters; establish a trend term function with power generation as the independent variable, and establish a disturbance term function to characterize the nonlinear fluctuations of the generator set's operating conditions; wherein both the trend term function and the disturbance term function contain the model parameters to be optimized; combine the trend term function and the disturbance term function to construct an initial carbon emission factor prediction model; based on the historical power generation, historical actual carbon emission factor, and the initial carbon emission factor prediction model, construct a fitness function with the minimum sum of squared errors as the optimization objective; within the preset parameter constraint boundary, use a swarm intelligence optimization algorithm to globally optimize the model parameters to be optimized so that the fitness function reaches its minimum value, and solve for the optimal model parameters; substitute the optimal model parameters into the initial carbon emission factor prediction model to generate the pre-built carbon emission factor prediction model.
[0051] In a preferred embodiment, the real-time power acquisition module acquires the current real-time power generation of the generator set, including: Obtain the current raw real-time power output of the generator set, as well as the corresponding historical maximum and minimum power outputs of the generator set; The original real-time power generation is cleaned to remove invalid data with values of zero and negative, thus obtaining the effective real-time power generation. Based on the historical maximum and minimum power values, the effective real-time power generation is normalized by range processing to calculate the current real-time power generation of the generator set.
[0052] In a preferred embodiment, the model building module includes preset molar mass parameters including the molar mass of carbon dioxide and the molar mass of carbon. Based on historical fuel consumption, historical power generation, preset sampling duration, preset carbon content, preset carbon oxidation rate, and preset molar mass parameters, the historical actual carbon emission factor is calculated and generated, including: Based on historical fuel consumption, historical power generation, and a preset sampling duration, the fuel consumption per unit of electricity is calculated and generated. The molar mass conversion factor is calculated based on the molar mass of carbon dioxide and the molar mass of carbon. Based on preset carbon content, preset carbon oxidation rate, molar mass conversion factor, and fuel consumption per unit of electricity, the historical actual carbon emission factor is calculated and generated.
[0053] In a preferred embodiment, the real-time power acquisition module includes the following model parameters to be optimized: quadratic coefficients, linear coefficients, constant term, disturbance amplitude parameters, and disturbance frequency parameters. Establish a trend term function with power generation as the independent variable, and establish a disturbance term function to characterize the nonlinear fluctuations of generator unit operating conditions, including: Using power generation as the independent variable, a quadratic polynomial function is constructed based on the coefficients of the quadratic term, the coefficients of the linear term, and the constant term, and the quadratic polynomial function is used as the trend term function. Using power generation as the independent variable, and based on the disturbance amplitude parameter, disturbance frequency parameter, and preset reference power, a sinusoidal absolute value function is constructed with the difference between power generation and preset reference power as the input, and the sinusoidal absolute value function is used as the disturbance term function.
[0054] In a preferred embodiment, the model building module, based on historical power generation, historical actual carbon emission factors, and an initial carbon emission factor prediction model, constructs a fitness function with the optimization objective of minimizing the sum of squared errors, including: Historical power generation is input into the initial carbon emission factor prediction model so that the initial carbon emission factor prediction model can calculate and generate the corresponding historical predicted carbon emission factor based on the historical power generation. The model prediction bias is calculated based on historical predicted carbon emission factors and corresponding historical actual carbon emission factors. The sum of squared errors is calculated based on the model prediction bias and then configured as the fitness function.
[0055] In a preferred embodiment, the model building module, within a preset parameter constraint boundary, uses a swarm intelligence optimization algorithm to globally optimize the parameters of the model to be optimized, so as to minimize the fitness function and obtain the optimal model parameters, including: The parameters of the model to be optimized are used as individuals in the swarm intelligence optimization algorithm. They are initialized within the preset parameter constraint boundary to generate an initial population containing multiple individuals. Each individual in the population corresponds to a set of parameters of the model to be optimized. The fitness value of each individual in the initial population is calculated based on the fitness function, and the initial global best individual is selected from multiple individuals based on the fitness value. Repeat the iterative optimization steps until the preset iteration termination condition is met, and generate the optimal model parameters; The iterative optimization steps include: Based on a preset individual evolution strategy, the parameters of each individual in the current population are updated to generate candidate individuals corresponding to each individual in the current population; wherein, the initial population is the initial population. By using preset parameter constraints, boundary exceedance corrections are performed on each candidate individual to generate legal candidate individuals corresponding to each individual in the current population. For each individual in the current population, the candidate fitness value of the legal candidate individual corresponding to the current population individual is calculated based on the fitness function. When the candidate fitness value is better than the fitness value of the current population individual, the legal candidate individual corresponding to the current population individual is used to replace the current population individual, so as to update the current population. After comparing and replacing the fitness values of all individuals in the current population, and updating the current population, the current global best individual is re-selected and updated from the current population based on the fitness values of each individual in the current population; wherein, the initial global best individual is the initial global best individual. When the preset iteration termination condition is met, the iterative optimization step ends, the current global optimal individual is output, and the current global optimal individual is determined as the optimal model parameters.
[0056] In a preferred embodiment, the model building module updates the parameters of each individual in the current population based on a preset individual evolution strategy, generating candidate individuals corresponding to each individual in the current population, including: For each individual in the current population, according to preset probability conditions, the current individual is updated between global exploration mode and local development mode to generate candidate individuals corresponding to the current individual. In the global exploration mode, the exploration increment is determined by using a preset exploration step size coefficient and a randomly generated exploration perturbation term, and the exploration increment is superimposed on the current population individual to generate a candidate individual corresponding to the current population individual. In the local development mode, a convergence guidance amount is determined based on the difference characteristics between the current global optimal individual and the current population individual, and a development increment is determined using a preset guidance coefficient, a randomly generated local perturbation term, and the convergence guidance amount. The development increment is then superimposed on the current population individual to generate a candidate individual corresponding to the current population individual; wherein, the initial global optimal individual is the initial global optimal individual.
[0057] Specifically, one embodiment of the present invention provides a device for calculating the direct carbon emission factor of a generator set, including a real-time power acquisition module, a real-time factor calculation module, and a model building module. The real-time power acquisition module is used to acquire the current real-time power generation of the generator set. The real-time factor calculation module is used to input the real-time power generation into a pre-built carbon emission factor prediction model to calculate and generate the real-time carbon emission factor of the generator set. The model building module is used to obtain the historical power generation and historical fuel consumption of the generator set within a preset sampling window; based on the historical fuel consumption, historical power generation, preset sampling duration, preset carbon content, preset carbon oxidation rate, and preset molar mass parameters, it calculates and generates the historical actual carbon emission factor; it establishes a trend term function with power generation as the independent variable and a disturbance term function to characterize the nonlinear fluctuations of the generator set's operating conditions; both the trend term function and the disturbance term function contain the model parameters to be optimized; the trend term function and the disturbance term function are combined to construct an initial carbon emission factor prediction model; based on the historical power generation, historical actual carbon emission factor, and the initial carbon emission factor prediction model, a fitness function is constructed with the minimum sum of squared errors as the optimization objective; within the preset parameter constraint boundary, a swarm intelligence optimization algorithm is used to globally optimize the model parameters to be optimized so that the fitness function reaches its minimum value, and the optimal model parameters are obtained; the optimal model parameters are substituted into the initial carbon emission factor prediction model to generate the pre-constructed carbon emission factor prediction model.
[0058] In a preferred embodiment, the real-time power acquisition module acquires the current real-time power output of the generator set, including acquiring the current raw real-time power output of the generator set, as well as the corresponding historical maximum and minimum power values. During grid-connected operation, the generator set continuously outputs electrical energy. The measuring device collects the instantaneous power output value of the generator set and uses this collected power value as the raw real-time power output. Simultaneously, the maximum and minimum power boundary values recorded within past continuous operating cycles are extracted from the generator set's historical operating database and set as the historical maximum and minimum power values, respectively. The raw real-time power output is then effectively cleaned, removing invalid data with values of zero or negative to obtain the effective real-time power output. When encountering shutdown conditions or communication failures, the acquired raw real-time power output often presents zero or negative values. Zero and negative values do not possess the physical meaning of characterizing the carbon emission characteristics of the generator set during normal operation. Therefore, by setting a filtering condition of values greater than zero, values equal to or less than zero in the raw real-time power output are directly filtered out, retaining values greater than zero as the effective real-time power output. Based on the historical maximum and minimum power values, the effective real-time power generation is normalized using a range standardization process to calculate the current real-time power generation of the generator unit. This range standardization mapping maps the effective real-time power generation to a fixed numerical range between zero and one.
[0059] In a preferred embodiment, the preset molar mass parameters in the model building module include the molar mass of carbon dioxide and the molar mass of carbon. Based on historical fuel consumption, historical power generation, a preset sampling duration, a preset carbon content, a preset carbon oxidation rate, and the preset molar mass parameters, the historical actual carbon emission factor is calculated, including calculating the fuel consumption per unit of electricity based on historical fuel consumption, historical power generation, and the preset sampling duration. After obtaining the fuel consumption per unit of electricity, the molar mass conversion coefficient is calculated based on the molar mass of carbon dioxide and the molar mass of carbon. Finally, based on the preset carbon content, the preset carbon oxidation rate, the molar mass conversion coefficient, and the fuel consumption per unit of electricity, the historical actual carbon emission factor is calculated.
[0060] In a preferred embodiment, the model parameters to be optimized in the model building module include quadratic coefficients, linear coefficients, a constant term, a disturbance amplitude parameter, and a disturbance frequency parameter. Establishing a trend term function with power generation as the independent variable, and establishing a disturbance term function to characterize the nonlinear fluctuations of the generator unit's operating condition, includes using power generation as the independent variable, constructing a quadratic polynomial function based on the quadratic coefficients, linear coefficients, and a constant term, and using this quadratic polynomial function as the trend term function. Simultaneously, using power generation as the independent variable, based on the disturbance amplitude parameter, the disturbance frequency parameter, and a preset reference power, constructing a sine absolute value function with the difference between the power generation and the preset reference power as input, and using this sine absolute value function as the disturbance term function.
[0061] In a preferred embodiment, the model building module constructs a fitness function with the optimization objective of minimizing the sum of squared errors, based on historical power generation, historical actual carbon emission factors, and an initial carbon emission factor prediction model. This includes inputting historical power generation into the initial carbon emission factor prediction model so that the initial carbon emission factor prediction model calculates and generates corresponding historical predicted carbon emission factors based on historical power generation. The initial carbon emission factor prediction model is composed of a trend term function and a disturbance term function. Based on the historical predicted carbon emission factors and the corresponding historical actual carbon emission factors, the model prediction bias is calculated. Based on the model prediction bias, the sum of squared errors is calculated and configured as the fitness function.
[0062] In a preferred embodiment, the model building module, within a preset parameter constraint boundary, uses a swarm intelligence optimization algorithm to globally optimize the parameters of the model to be optimized, minimizing the fitness function. The optimal model parameters are obtained by initializing the parameters as individuals in a swarm intelligence optimization algorithm population within the preset parameter constraint boundary, generating an initial population containing multiple individuals, each corresponding to a set of model parameters to be optimized. The fitness value of each individual in the initial population is calculated based on the fitness function, and the initial globally optimal individual is selected from the multiple individuals based on the fitness value. The iterative optimization steps are repeated until a preset iteration termination condition is met, generating the optimal model parameters. The iterative optimization steps include updating the parameters of each individual in the current population based on a preset individual evolution strategy, generating candidate individuals corresponding to each individual in the current population; the initial population is the initial population. Boundary correction is performed on each candidate individual using the preset parameter constraint boundary, forcibly pulling back values exceeding the boundary, generating legal candidate individuals corresponding to each individual in the current population. For each individual in the current population, the candidate fitness value of the corresponding legitimate candidate individual is calculated based on the fitness function. If the candidate fitness value is better than the fitness value of the current individual, the current individual is replaced by the legitimate candidate individual, thus updating the current population. After the fitness value comparison and replacement of each individual in the current population are completed, and the current population is updated, the global optimal individual is re-selected and updated based on the fitness values of each individual in the current population. The initial global optimal individual is then identified. When the preset iteration termination condition is met, the iterative optimization step ends, the current global optimal individual is output, and the current global optimal individual is determined as the optimal model parameter.
[0063] In a preferred embodiment, the model building module updates the parameters of each individual in the current population based on a preset individual evolution strategy, generating candidate individuals corresponding to each individual in the current population. This includes updating each individual in the current population, according to preset probability conditions, between a global exploration mode and a local development mode, to generate candidate individuals corresponding to the current population individual. In the global exploration mode, an exploration increment is determined using a preset exploration step size coefficient and a randomly generated exploration perturbation term, and this exploration increment is added to the current population individual to generate candidate individuals corresponding to the current population individual. In the local development mode, a convergence guidance quantity is determined based on the difference characteristics between the current global optimal individual and the current population individual, and a development increment is determined using a preset guidance coefficient, a randomly generated local perturbation term, and the convergence guidance quantity. This development increment is added to the current population individual to generate candidate individuals corresponding to the current population individual.
[0064] The aforementioned generator set direct carbon emission factor calculation device, built based on modular design, achieves accurate capture of the dynamic operating characteristics of complex generator sets and comprehensive consideration of macro trends and local fluctuations in carbon emissions through the coordinated operation of the real-time power acquisition module, model building module, and real-time factor calculation module. It completely avoids the problem of easily getting trapped in local optima in the parameter solution of a single prediction model, and significantly improves the accuracy and operating efficiency of automated calculation of real-time carbon emission factors.
[0065] It should be noted that the embodiments of the device described above correspond to the embodiments of the present invention described above, and can realize the direct carbon emission factor calculation method for generator sets described in any one of the above embodiments of the present invention. Furthermore, the embodiments of the device described above are merely illustrative. The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the accompanying drawings of the device embodiments provided by the present invention, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without creative effort.
[0066] Based on the above-described method embodiments of the present invention, a corresponding embodiment of an electronic device is provided.
[0067] An embodiment of the present invention provides an electronic device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the direct carbon emission factor calculation method for generator sets according to any one of the present invention, or the processor executes the computer program to implement the functions of each module in the above-described device embodiments.
[0068] For example, the computer program may be divided into one or more modules, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules may be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program in the terminal device.
[0069] The terminal device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The terminal device may include, but is not limited to, a processor and memory.
[0070] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the terminal device, connecting all parts of the terminal device via various interfaces and lines.
[0071] The memory can be used to store the computer programs and / or modules. The processor implements various functions of the terminal device by running or executing the computer programs and / or modules stored in the memory and by calling data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function, etc.; the data storage area may store data created based on the use of the mobile phone, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital card (SD card), flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0072] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of those different embodiments or examples.
[0073] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for calculating the direct carbon emission factor of a generator set, characterized in that, include: Obtain the current real-time power output of the generator set; The real-time power generation is input into a pre-built carbon emission factor prediction model to calculate and generate the real-time carbon emission factor of the generator set. The carbon emission factor prediction model is constructed using the following methods: Obtain the historical power generation and historical fuel consumption of the generator set within a preset sampling window; Based on historical fuel consumption, historical power generation, preset sampling duration, preset carbon content, preset carbon oxidation rate, and preset molar mass parameters, the historical actual carbon emission factor is calculated and generated. A trend term function with power generation as the independent variable and a disturbance term function to characterize the nonlinear fluctuations of the generator set's operating conditions are established; both the trend term function and the disturbance term function contain the model parameters to be optimized. The trend term function and the disturbance term function are combined to construct an initial carbon emission factor prediction model; Based on historical power generation, historical actual carbon emission factors, and initial carbon emission factor prediction models, a fitness function is constructed with the goal of minimizing the sum of squared errors. Within the preset parameter constraints, a swarm intelligence optimization algorithm is used to globally optimize the parameters of the model to be optimized so that the fitness function reaches its minimum value, and the optimal model parameters are obtained. The optimal model parameters are substituted into the initial carbon emission factor prediction model to generate the pre-built carbon emission factor prediction model.
2. The method for calculating the direct carbon emission factor of a generator set as described in claim 1, characterized in that, Obtain the current real-time power generation of the generator set, including: Obtain the current raw real-time power output of the generator set, as well as the corresponding historical maximum and minimum power outputs of the generator set; The original real-time power generation is cleaned to remove invalid data with values of zero and negative, thus obtaining the effective real-time power generation. Based on the historical maximum and minimum power values, the effective real-time power generation is normalized by range processing to calculate the current real-time power generation of the generator set.
3. The method for calculating the direct carbon emission factor of a generator set as described in claim 2, characterized in that, The preset molar mass parameters include the molar mass of carbon dioxide and the molar mass of carbon. Based on historical fuel consumption, historical power generation, preset sampling duration, preset carbon content, preset carbon oxidation rate, and preset molar mass parameters, the historical actual carbon emission factor is calculated and generated, including: Based on historical fuel consumption, historical power generation, and a preset sampling duration, the fuel consumption per unit of electricity is calculated and generated. The molar mass conversion factor is calculated based on the molar mass of carbon dioxide and the molar mass of carbon. Based on preset carbon content, preset carbon oxidation rate, molar mass conversion factor, and fuel consumption per unit of electricity, the historical actual carbon emission factor is calculated and generated.
4. The method for calculating the direct carbon emission factor of a generator set as described in claim 3, characterized in that, The parameters of the model to be optimized include quadratic coefficients, linear coefficients, constant terms, perturbation amplitude parameters, and perturbation frequency parameters; Establish a trend term function with power generation as the independent variable, and establish a disturbance term function to characterize the nonlinear fluctuations of generator unit operating conditions, including: Using power generation as the independent variable, a quadratic polynomial function is constructed based on the coefficients of the quadratic term, the coefficients of the linear term, and the constant term, and the quadratic polynomial function is used as the trend term function. Using power generation as the independent variable, and based on the disturbance amplitude parameter, disturbance frequency parameter, and preset reference power, a sinusoidal absolute value function is constructed with the difference between power generation and preset reference power as the input, and the sinusoidal absolute value function is used as the disturbance term function.
5. The method for calculating the direct carbon emission factor of a generator set as described in claim 4, characterized in that, Based on historical power generation, historical actual carbon emission factors, and initial carbon emission factor prediction models, a fitness function is constructed with the goal of minimizing the sum of squared errors, including: Historical power generation is input into the initial carbon emission factor prediction model so that the initial carbon emission factor prediction model can calculate and generate the corresponding historical predicted carbon emission factor based on the historical power generation. The model prediction bias is calculated based on historical predicted carbon emission factors and corresponding historical actual carbon emission factors. The sum of squared errors is calculated based on the model prediction bias and then configured as the fitness function.
6. The method for calculating the direct carbon emission factor of a generator set as described in claim 5, characterized in that, Within the preset parameter constraints, a swarm intelligence optimization algorithm is used to globally optimize the parameters of the model to be optimized, so as to minimize the fitness function and obtain the optimal model parameters, including: The parameters of the model to be optimized are used as individuals in the swarm intelligence optimization algorithm. They are initialized within the preset parameter constraint boundary to generate an initial population containing multiple individuals. Each individual in the population corresponds to a set of parameters of the model to be optimized. The fitness value of each individual in the initial population is calculated based on the fitness function, and the initial global best individual is selected from multiple individuals based on the fitness value. Repeat the iterative optimization steps until the preset iteration termination condition is met, and generate the optimal model parameters; The iterative optimization steps include: Based on a preset individual evolution strategy, the parameters of each individual in the current population are updated to generate candidate individuals corresponding to each individual in the current population; wherein, the initial population is the initial population. By using preset parameter constraints, boundary exceedance corrections are performed on each candidate individual to generate legal candidate individuals corresponding to each individual in the current population. For each individual in the current population, the candidate fitness value of the legal candidate individual corresponding to the current population individual is calculated based on the fitness function. When the candidate fitness value is better than the fitness value of the current population individual, the legal candidate individual corresponding to the current population individual is used to replace the current population individual, so as to update the current population. After comparing and replacing the fitness values of all individuals in the current population, and updating the current population, the current global best individual is re-selected and updated from the current population based on the fitness values of each individual in the current population; wherein, the initial global best individual is the initial global best individual. When the preset iteration termination condition is met, the iterative optimization step ends, the current global optimal individual is output, and the current global optimal individual is determined as the optimal model parameters.
7. The method for calculating the direct carbon emission factor of a generator set as described in claim 6, characterized in that, Based on a preset individual evolution strategy, the parameters of each individual in the current population are updated to generate candidate individuals corresponding to each individual in the current population, including: For each individual in the current population, according to preset probability conditions, the current individual is updated between global exploration mode and local development mode to generate candidate individuals corresponding to the current individual. In the global exploration mode, the exploration increment is determined by using a preset exploration step size coefficient and a randomly generated exploration perturbation term, and the exploration increment is superimposed on the current population individual to generate a candidate individual corresponding to the current population individual. In the local development mode, a convergence guidance amount is determined based on the difference characteristics between the current global optimal individual and the current population individual, and a development increment is determined using a preset guidance coefficient, a randomly generated local perturbation term, and the convergence guidance amount. The development increment is then superimposed on the current population individual to generate a candidate individual corresponding to the current population individual; wherein, the initial global optimal individual is the initial global optimal individual.
8. A device for calculating the direct carbon emission factor of a generator set, characterized in that, include: Real-time power acquisition module, real-time factor calculation module, and model building module; The real-time power acquisition module is used to acquire the current real-time power generation of the generator set; The real-time factor calculation module is used to input the real-time power generation into the pre-built carbon emission factor prediction model to calculate and generate the real-time carbon emission factor of the generator set. The model building module is used to acquire the historical power generation and historical fuel consumption of the generator set within a preset sampling window; calculate and generate the historical actual carbon emission factor based on the historical fuel consumption, historical power generation, preset sampling duration, preset carbon content, preset carbon oxidation rate, and preset molar mass parameters; establish a trend term function with power generation as the independent variable, and establish a disturbance term function to characterize the nonlinear fluctuations of the generator set's operating conditions; wherein both the trend term function and the disturbance term function contain the model parameters to be optimized; combine the trend term function and the disturbance term function to construct an initial carbon emission factor prediction model; based on the historical power generation, historical actual carbon emission factor, and the initial carbon emission factor prediction model, construct a fitness function with the minimum sum of squared errors as the optimization objective; within the preset parameter constraint boundary, use a swarm intelligence optimization algorithm to globally optimize the model parameters to be optimized so that the fitness function reaches its minimum value, and solve for the optimal model parameters; substitute the optimal model parameters into the initial carbon emission factor prediction model to generate the pre-built carbon emission factor prediction model.
9. The generator set direct carbon emission factor calculation device as described in claim 8, characterized in that, The real-time power acquisition module acquires the current real-time power generation of the generator set, including: Obtain the current raw real-time power output of the generator set, as well as the corresponding historical maximum and minimum power outputs of the generator set; The original real-time power generation is cleaned to remove invalid data with values of zero and negative, thus obtaining the effective real-time power generation. Based on the historical maximum and minimum power values, the effective real-time power generation is normalized by range processing to calculate the current real-time power generation of the generator set.
10. An electronic device, characterized in that, The method includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor, when executing the computer program, implements the method for calculating the direct carbon emission factor of a generator set as described in any one of claims 1 to 7.