A transaction method and device for power contracts

Through the power contract trading method based on the JSON constraint modeling language, the complexity of power contracts is solved, the optimal power purchase combination solution and risk assessment are achieved, and the profit and risk management capabilities of power sales companies are improved.

CN112182964BActive Publication Date: 2024-11-29XINAO SHUNENG TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011017087.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-24
Publication Date
2024-11-29
Estimated Expiration
2040-09-24

AI Technical Summary

Technical Problem

The uncertainty of the number and time length of power contracts and the excessive contract parameters lead to the complexity of the contract, making it difficult for the power sales company to determine the optimal contract power or the total contract cost and conduct an effective risk assessment.

Method used

Based on the JSON constraint modeling language, an objective function is generated for the minimum contract cost and the closest contract power to the predicted power. By solving the constraint problem, the trading plan of the power contract is determined.

Benefits of technology

The optimal power purchase combination solution has been achieved, the risks have been reduced and the total returns have been maximized, which is of great significance to the risk management of power sales companies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure BDA0002699413400000021
    Figure BDA0002699413400000021
  • Figure BDA0002699413400000031
    Figure BDA0002699413400000031
  • Figure BDA0002699413400000032
    Figure BDA0002699413400000032
Patent Text Reader

Abstract

The present invention is applicable to the technical field of power market, and provides a trading method and device for power contracts, wherein the method includes obtaining a first objective function for minimizing the total cost of the contract and a second objective function for the contract quantity closest to the predicted quantity based on the original data of the power contract, constraints, load forecast data and spot price forecast data; generating a first constraint problem description for the first objective function and a second constraint problem description for the second objective function based on the constraint modeling language of json; solving the first constraint problem description to obtain a first optimal solution for the first objective function; solving the second constraint problem description to obtain a second optimal solution for the second objective function; and determining a trading plan for the power contract based on the first optimal solution and the second optimal solution. The present invention solves the complexity problem of contracts in the prior art very well.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of power market, and in particular relates to a transaction method and device for power contracts. Background Art

[0002] At present, China's power industry is developing rapidly. With the large-scale grid connection of electricity, more and more electricity will participate in the electricity market. In various markets, the day-ahead market electricity price fluctuates greatly. If electricity is only traded in the day-ahead market, the risk is relatively high. It is necessary to use the contract market to avoid the risk of day-ahead market transactions. The volatility and unpredictability of electricity prices in the electricity market have made more and more market designers and participants realize the importance of risk management in the electricity market. A good electricity market needs to develop various contracts to attract market participants while reducing transaction costs; allowing market participants to lock in electricity prices to ensure that they have the opportunity to make appropriate plans. In order to lock in electricity prices, it is necessary to establish forward, futures and options markets. Using these markets, market participants can predict the basis risk of the market.

[0003] Power contracts play an important role in market risk management in the power market. They can not only ensure that users get a stable power supply and bring stable income to power generation companies and power sales companies, but also lock in prices to avoid the risks brought by price fluctuations. Power markets in various countries around the world have adopted this trading model on a large scale. In the trial operation of power spot, the diversity of the uncertainty of the number and length of power contracts, too many contract parameters and other issues lead to the complexity of the contract. Therefore, how power sales companies determine the optimal contract volume or total contract cost, formulate the optimal power purchase combination plan, and conduct effective risk assessment to maximize total benefits and minimize risks is of great significance to the risk management of power sales companies. Summary of the invention

[0004] In view of this, the present invention provides a trading method and device for power contracts to solve the contract complexity problems caused by the diversity of uncertainties in the number and duration of power contracts, and too many contract parameters.

[0005] According to a first aspect of an embodiment of the present invention, a method for trading electricity contracts is provided, comprising: obtaining a first objective function for minimizing the total contract cost and a second objective function for ensuring that the contract electricity quantity is closest to the predicted electricity quantity based on original electricity contract data, constraints, load forecast data and spot price forecast data; generating a first constraint problem description for the first objective function based on a constraint modeling language of json; generating a second constraint problem description for the second objective function based on a constraint modeling language of json; solving the first constraint problem description to obtain a first optimal solution to the first objective function; solving the second constraint problem description to obtain a second optimal solution to the second objective function; and determining a trading plan for the electricity contract based on the first optimal solution and the second optimal solution.

[0006] In some embodiments, the first constraint problem description specifically includes:

[0007] Electricity fee for holding positions before trading tb:

[0008]

[0009] Among them, dc represents the vector of initial holding power, dc i represents the initial holding power at the i-th time point, dp represents the vector of initial holding power prices, dp i represents the initial holding electricity price at the i-th time point;

[0010] Electricity fee for holding a position after trading:

[0011]

[0012] Among them, cvl represents the vector of continuous variables to be optimized, dvl represents the vector of discrete variables to be optimized, CPL T *CCL T represents the matrix obtained by bitwise multiplication after matrix transposition, (CPL T *CCL T ) i The i-th row of this matrix represents the unit price list at the i-th time point when buying a unit divisible contract;

[0013] Time-sharing electricity deviation after transaction e i :

[0014] e i =lp i -(cvl·CCL T i +dvl·DCL T i +dc i ),

[0015] Where, lp represents the vector composed of load forecast power sequence, lp i represents the load forecast power at the i-th time point;

[0016] The maximum spot electricity fee sc for all periods of the contract after the transaction:

[0017] p min,i =spl i *spp min *e i ,

[0018] p max,i =spl i *spp max *e i ,

[0019]

[0020]

[0021] Among them, spl represents the vector composed of the predicted spot price series, spl i represents the spot price at the i-th time point, spp max Indicates the upper limit of spot price fluctuation ratio, spp min Indicates the lower limit of spot price fluctuation ratio, p min,i represents the spot electricity price at the i-th time point calculated according to the lower limit of the spot price fluctuation ratio, p max,i represents the spot electricity fee at the i-th time point calculated according to the upper limit of the spot price fluctuation ratio, msc i represents the maximum allowable electricity charge at the i-th time point;

[0022] The maximum allowable electricity fee constraint in the risk area is as follows:

[0023] tb+ta+sc≤tcsp max ,

[0024] Among them, tcsp max It indicates the maximum electricity cost that can be tolerated in all periods of the risk zone contract;

[0025] Among them, · represents the dot product of vectors, * represents the bitwise multiplication of numbers or vectors and matrices, and T represents the matrix transpose operator;

[0026] Let i, j, k represent the subscript set, where:

[0027] i∈{0, 1, 2, 3, ..., n-1} represents the i-th time point,

[0028] j∈{0, 1, 2, 3, ..., m1-1} represents the jth separable contract,

[0029] k∈{0, 1, 2, 3, ..., m2-1} represents the kth indivisible contract,

[0030] m1 and m2 are the number of divisible contracts and non-divisible contracts respectively, and n represents the number of contract time points.

[0031] Among them, CCL represents the splittable contract quantity matrix, and each row vector is defined as CCL j , CCL ji Represents the value of the j-th row and i-th column of the matrix CCL;

[0032] Where DCL represents the indivisible contract quantity matrix, and each row vector is defined as DCL k , DCL ki represents the value of the j-th row and i-th column of the matrix DCL;

[0033] Where CPL represents the splittable contract price matrix, and each row vector is defined as CPL j , CPL ji represents the value of the jth row and ith column of the matrix CPL;

[0034] Where DPL represents the inseparable contract price matrix, and each row vector is defined as DPL k , DPL ki Represents the value of the j-th row and i-th column of the matrix DPL.

[0035] In some embodiments, the first objective function is:

[0036] The minimum total contract fee is:

[0037]

[0038] In some embodiments, the second constraint problem description specifically includes:

[0039] Electricity fee for holding a position before trading tb:

[0040]

[0041] Among them, dc represents the vector of initial holding power, dc i represents the initial holding power at the i-th time point, dp represents the vector of initial holding power prices, dp i represents the initial holding electricity price at the i-th time point;

[0042] Electricity fee for holding a position after trading:

[0043]

[0044] Among them, cvl represents the vector of continuous variables to be optimized, dvl represents the vector of discrete variables to be optimized, CPL T *CCL T represents the matrix obtained by bitwise multiplication after matrix transposition, (CPL T *CCL T ) i The i-th row of this matrix represents the unit price list at the i-th time point when buying a unit divisible contract;

[0045] Time-sharing electricity deviation after transaction e i :

[0046] e i =lp i -(cvl·CCL T i +dvl·DCL T i +dc i ),

[0047] Where, lp represents the vector composed of load forecast power sequence, lp i represents the load forecast power at the i-th time point;

[0048] Time-sharing position restriction: Taking the power constraint as an example, assuming that for each time-sharing point, the difference between the final position and the load forecast does not exceed dif1, then this is composed of n constraints.

[0049] |e i |≤dif1;

[0050] And / or, total position limit: Taking the power constraint as an example, assuming that the total deviation between the final position and the load forecast does not exceed dif2, this constraint can be expressed as:

[0051]

[0052] And / or, average holding price constraint, assuming that the average holding price does not exceed c max , then the average spot price constraint is as follows:

[0053]

[0054] The average price constraint of holding positions without considering spot is as follows:

[0055]

[0056] Among them, spl represents the vector composed of the predicted spot price series, spl i represents the spot price at the i-th time point;

[0057] And / or, the average price of intraday positions, assuming that the average price of positions does not exceed c m , then for each time point, there is a constraint as follows:

[0058]

[0059] Among them, · represents the dot product of vectors, * represents the bitwise multiplication of numbers or vectors and matrices, and T represents the matrix transpose operator;

[0060] Let i, j, k represent the subscript set, where:

[0061] i∈{0, 1, 2, 3, ..., n-1} represents the i-th time point,

[0062] j∈{0, 1, 2, 3, ..., m1-1} represents the jth separable contract,

[0063] k∈{0, 1, 2, 3, ..., m2-1} represents the kth indivisible contract,

[0064] m1 and m2 are the number of divisible contracts and non-divisible contracts respectively, and n represents the number of contract time points.

[0065] Among them, CCL represents the splittable contract quantity matrix, and each row vector is defined as CCL j , CCL ji Represents the value of the j-th row and i-th column of the matrix CCL;

[0066] Where DCL represents the indivisible contract quantity matrix, and each row vector is defined as DCL k , DCL ki represents the value of the j-th row and i-th column of the matrix DCL;

[0067] Where CPL represents the splittable contract price matrix, and each row vector is defined as CPL j , CPL ji represents the value of the jth row and ith column of the matrix CPL;

[0068] Where DPL represents the inseparable contract price matrix, and each row vector is defined as DPL k , DPL ki Represents the value of the j-th row and i-th column of the matrix DPL.

[0069] In some embodiments, the second objective function specifically includes:

[0070] The minimum deviation between the total power in the specified period and the total power forecasted by the load is:

[0071] (|∑ i∈T e i |) min;

[0072] Or, the minimum value of the sum of the absolute values ​​of the deviations between the power consumption in a specified period and the load forecast power consumption is:

[0073] (∑ i∈T |e i |) min ;

[0074] Or, the minimum deviation between the total power of all contract periods and the total power of load forecast is:

[0075]

[0076] Or, the minimum value of the sum of the absolute values ​​of the deviations between the power consumption in all contract periods and the load forecast power consumption is:

[0077]

[0078] In some embodiments, solving the first problem constraint description or solving the second constraint problem description specifically includes:

[0079] Enumerate possible combinations of discrete variable values;

[0080] For a certain discrete variable value combination, substitute the constraint problem description and the objective function corresponding to the constraint problem description to obtain the first constraint optimization problem based only on continuous variables;

[0081] Calling the SLSQP algorithm to solve the first constrained optimization problem and save the result;

[0082] Compare the objective function values ​​under different enumerations and find the optimal solution vector.

[0083] In some embodiments, solving the first problem description or solving the second problem description specifically includes:

[0084] Convert the problem description into a pyomo model;

[0085] Use the scipampl executable program to call pyomo's solution API for solving.

[0086] In some embodiments, solving the first problem description or solving the second problem description specifically includes:

[0087] Convert the problem description into a pyomo model;

[0088] Add restrictions i.e. .set file;

[0089] Call the scipampl executable file to solve.

[0090] In some embodiments, solving the first problem description or solving the second problem description specifically includes:

[0091] Convert the problem description into a geatpy Problem object;

[0092] Convert the objective function corresponding to the problem description into the aimFunc function;

[0093] Use the strategy template soea_DE_rand_1_L_templet to solve.

[0094] A second aspect of an embodiment of the present invention provides a transaction device for an electricity contract, including:

[0095] The objective function acquisition module is configured to acquire a first objective function for minimizing the total cost of the contract and a second objective function for making the contract power closest to the predicted power according to the original data of the power contract, the constraint conditions, the load forecast data and the spot price forecast data;

[0096] A first constraint problem description generating module is configured as a constraint modeling language based on JSON to generate a first constraint problem description for a first objective function;

[0097] A second constraint problem description generating module is configured as a constraint modeling language based on JSON to generate a second constraint problem description for a second objective function;

[0098] A first optimal solution acquisition module is configured to solve the first constraint problem description to obtain a first optimal solution of the first objective function;

[0099] A second optimal solution acquisition module is configured to solve the second constraint problem description to obtain a second optimal solution of the second objective function;

[0100] The transaction determination module of the power contract is configured to determine the transaction plan of the power contract according to the first optimal solution and the second optimal solution.

[0101] The beneficial effect of a transaction method for power contracts provided by an embodiment of the present invention is at least that: the embodiment of the present invention first obtains a first objective function for minimizing the total contract cost and a second objective function for the contract power closest to the predicted power according to the original data of the power contract, constraints, load forecast data and spot price forecast data; based on the json constraint modeling language, generates a first constraint problem description for the first objective function and a second constraint problem description for the second objective function; and obtains a first optimal solution for the first objective function and a second optimal solution for the second objective function by solving the first constraint problem description and the second constraint problem description. The power sales company formulates the optimal power purchase combination plan through the first optimal solution and the second optimal solution, and conducts an effective risk assessment to maximize the total benefit and minimize the risk, which is of great significance to the risk management of the power sales company. BRIEF DESCRIPTION OF THE DRAWINGS

[0102] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0103] Figure 1 It is a schematic diagram of the implementation flow of the transaction method of the power contract provided by the embodiment of the present invention;

[0104] Figure 2 is a flowchart of solving the first constraint problem description to obtain a first optimal solution of the first objective function provided by an embodiment of the present invention;

[0105] Figure 3 is a flowchart of solving the second constraint problem description to obtain a second optimal solution of the second objective function provided by an embodiment of the present invention;

[0106] Figure 4 The process of solving the first problem description or solving the second problem description provided by the embodiment of the present invention is Figure 1 ;

[0107] Figure 5 The process of solving the first problem description or solving the second problem description provided by the embodiment of the present invention is Figure 2 ;

[0108] Figure 6 The process of solving the first problem description or solving the second problem description provided by the embodiment of the present invention is Figure 3 ;

[0109] Figure 7 It is a schematic diagram of the implementation flow of the transaction device of the power contract provided by the embodiment of the present invention. DETAILED DESCRIPTION

[0110] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present invention. However, it should be clear to those skilled in the art that the present invention may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present invention. Based on the described embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art are within the scope of protection of the present invention. Unless otherwise specified, the technical means used in the embodiments are conventional means well known to those skilled in the art.

[0111] In order to illustrate the technical solution of the present invention, a specific embodiment is provided below for illustration.

[0112] First embodiment

[0113] Figure 1 It is a schematic diagram of the implementation flow of the transaction method of the power contract provided in one embodiment of the present invention.

[0114] like Figure 1 As shown, the transaction method of the power contract includes steps S110-S160:

[0115] S110: According to the original data of the power contract, the constraints, the load forecast data and the spot price forecast data, a first objective function for minimizing the total contract cost and a second objective function for making the contract power closest to the forecast power are obtained.

[0116] In this embodiment, the power contract is a contract that takes power, electricity and various types of power services as the transaction objects and stipulates the rights and obligations of both parties to the transaction; the power contract is based on the principles of fair competition, openness and transparency, and is signed and executed by the market operation organization to organize the two parties to the transaction. The power contract essentially belongs to the category of sales contracts. In medium- and long-term power transactions and spot transactions, the contract is a core concept. Abstractly speaking, the contract contains the following elements: a vector representing the hourly electricity in a fixed time period, the total electricity of the contract, the total price of the contract, whether the contract is a purchase contract or a sale contract, and whether the contract can be split. At a certain point in time, there is a series of contracts with the same start and end times. What the decision maker needs to determine is how to determine the amount of a contract to buy / sell in order to meet the constraints of the business and optimize the objective function at the same time.

[0117] In this embodiment, the original data of the power contract includes: 1. The total amount of power of the contract, which is a floating point number in ten thousand kWh. 2. The total price of the contract, which is a floating point number in yuan. 3. The time-sharing power curve of the contract, which is a vector representing the power distribution ratio of the corresponding time series of the contract. The time interval of the corresponding time series is generally 1 hour or 15 minutes. 4. The time-sharing electricity price curve of the contract, which is also a vector with the same length as the time-sharing power curve, representing the time-sharing power price of this contract. 5. Whether the contract is a pending purchase contract or a pending sale contract, which is a bool value. When a pending purchase contract is delisted, the power owned will increase. Otherwise, when a pending sale contract is delisted, the power owned will decrease. 6. Whether the contract can be split, which is a bool value. In order to simplify the problem, we regard the delisting amount of the splittable contract as a continuous variable, while the non-splittable contract can only delist 0 or the total power of the contract. We regard it as a discrete variable. 7. Some types of contract enumeration values, such as centralized trading contracts, bilateral contracts, listed contracts, D1 curve contracts, D2 curve contracts, etc. These tags are generally used for constraints. The solution of the mathematical model represents the delisting volume of each contract. This solution satisfies specific constraints and is optimized according to a certain goal.

[0118] In this embodiment, the constraints include some general constraints, such as guarantee constraints and monthly constraints. These constraints generally stipulate the cost constraints of the total amount of electricity to be purchased and sold in the current contract, the quantity constraints for a certain period of time or a specific contract type, etc.

[0119] In this embodiment, the first objective function constraint condition for minimizing the total contract cost may include (1) when the spot price fluctuates up or down by a certain percentage, the worst possible situation, that is, the maximum total contract cost, does not exceed a certain value. (2) Time-sharing position restriction: Time-sharing position restriction is a type of constraint that represents the difference between the final position power and the load forecast time-sharing power. In practice, it is divided into two categories, power constraint and ratio constraint. The power constraint means that the contract power at each time point is within a certain power range, while the ratio constraint means that the ratio of the contract power at each time point to the load forecast power is within a certain range. The number of time-sharing position constraints is directly proportional to the length of the underlying contract curve. (3) Total position restriction: The total position restriction represents a type of constraint that represents the difference between the total amount of power held at the final position and the total amount of power forecasted by the load. In practice, it is also divided into two categories, power constraint and ratio constraint. The total position restriction has nothing to do with the length of the contract curve, and the number of constraints does not change with the length of the contract curve. (4) Position average price restriction: The position average price restriction is a restriction that the position average price does not exceed a certain constant. (5) Position time-sharing price limit: The position time-sharing average price is calculated according to the following method. First, the total cost of all time points (hourly or 15-minute level) of the contract is calculated independently, that is, the total cost and total electricity used at each time point are calculated independently, and then the total cost at each time point is divided by the total electricity to obtain the position average price at each time point. The number of such constraints is also positively correlated with the length of the contract curve.

[0120] In this embodiment, the second objective function constraint condition for the contract quantity to be closest to the predicted quantity may include (1) when the spot price fluctuates up or down by a certain percentage, the worst possible situation, that is, the maximum total contract cost, does not exceed a certain value. (1) Time-sharing position restriction: Time-sharing position restriction is a type of constraint that represents the difference between the final position quantity and the load forecast time-sharing quantity. In practice, it is divided into two categories, quantity constraint and ratio constraint. The quantity constraint means that the contract quantity at each time point is within a certain quantity range, while the ratio constraint means that the ratio of the contract quantity at each time point to the load forecast quantity is within a certain range. The number of time-sharing position constraints is directly proportional to the length of the underlying contract curve. (2) Total position restriction: The total position restriction represents a type of constraint that represents the difference between the total quantity of the final position and the total quantity of the load forecast. In practice, it is also divided into two categories, quantity constraint and ratio constraint. The total position restriction has nothing to do with the length of the contract curve, and the number of constraints does not change with the length of the contract curve. (3) Position average price restriction: The position average price restriction is a restriction that the position average price does not exceed a certain constant. (4) Position time-sharing price limit: The position time-sharing average price is calculated according to the following method. First, the total cost of all time points (hourly or 15-minute level) of the contract is calculated independently, that is, the total cost and total electricity used at each time point are calculated independently, and then the total cost at each time point is divided by the total electricity to obtain the position average price at each time point. The number of such constraints is also positively correlated with the length of the contract curve.

[0121] In this embodiment, the load forecast data is a load forecast power sequence, which is a vector with the same length as the time-sharing power curve vector, and the length of the spot price forecast sequence is the same as the length of the load forecast power sequence. The constraint data depends on the semantics of the constraint, which generally includes some constants such as the time range in which the constraint takes effect, the upper and lower bounds of the constraint, etc.

[0122] In this embodiment, the first objective function is to minimize the total contract cost, which is also the objective function for optimizing the electricity cost. The objective function for optimizing the electricity cost (minimizing the total contract cost) requires a prediction of the spot price. Settlement is performed according to the predicted load and predicted spot electricity price simulation. The calculated final electricity cost is an expression that includes the position amount of each contract.

[0123] In this embodiment, the second objective function is that the contracted electricity is closest to the predicted electricity. From different perspectives, there are four methods to measure the closeness between the contracted electricity and the load electricity, including: (1) the deviation between the total electricity of the specified period and the total electricity of the load prediction; (2) the sum of the absolute values ​​of the deviations between the electricity of the specified period and the load prediction; (3) the deviation between the total electricity of all contract periods and the total electricity of the load prediction; (4) the sum of the absolute values ​​of the deviations between the electricity of all contract periods and the load prediction. The specified period can be very flexible, such as several fixed time periods every day, or several fixed time periods overall.

[0124] S120: Generate a first constraint problem description for the first objective function based on the json constraint modeling language.

[0125] In this embodiment, a JSON-based constraint optimization problem modeling language is referred to as SCOL (Simple Constraint Optimization Language). This modeling language has the following advantages: 1. Easy to read and programmatic modeling. Since the modeling language is a language based on JSON strings and only contains the most important and necessary elements in constraint optimization, it is easy to understand; and SCOL is based on a binary tree structure, which makes it easy to generate in the program; 2. Easy to evaluate and check errors. The JSON of the modeling language is actually a binary tree representation of arithmetic expressions, so it is easy to calculate the values ​​of each part of the expression, so expression evaluation and error checking can be conveniently performed; 3. Strong expressiveness and extensibility. The current modeling language can directly represent the four arithmetic operations of scalars, vectors, and so on. Bitwise arithmetic operations, dot product of vectors, absolute value, and five kinds of scalar size judgments such as equality, greater than and less than. Through these basic operations, new operations can be further constructed, such as using dot product to represent vector summation operations, using absolute value and arithmetic operations to represent maximum and minimum value operations. Moreover, when new operators are needed, operators can be expanded to obtain new symbolic operation capabilities; 4. It can be seamlessly connected with the object-oriented modeling method pyomo, so that the solver supported by pyomo can be used for convenient solution; 5. It can be connected to the genetic algorithm geatpy framework and use genetic algorithm to solve the model.

[0126] In this embodiment, the basic composition of SCOL is as follows: SCOL converts the constrained optimization mathematical problem into JSON representation. SCOL represents the constrained optimization problem with the following keys: "c_vars", "d_vars", "c_var_bounds", "d_var_enum", "constraints", "obj", "target_expression_list".

[0127] In this embodiment, the value of the "c_vars" key corresponds to an integer representing the number of continuous variables; similarly, the "d_vars" key corresponds to an integer representing the number of discrete variables. The value of the "c_var_bounds" key is a list, each element of which is a list of length 2, representing the lower and upper bounds of the continuous variable at the corresponding position. The value of "d_var_enum" corresponds to a list, in which each element of the list is also a list, representing the possible values ​​of the discrete variable at the corresponding position. When the number of values ​​of all discrete variables is 2, the pyomo framework and the genetic algorithm framework can be seamlessly connected.

[0128] In this embodiment, the value corresponding to the "constraints" key is a list, and each element in the list represents a constraint. The "obj" key corresponds to a single target object. Both a single constraint and a target are expressions of a fixed form, and this expression is represented by a binary tree data structure. Next, we will recursively describe the expression tree we define here. First, the defined expression tree is based on vector calculations, and the variables are represented by fixed keywords "c_var" and "d_var". "c_var" represents a vector composed of continuous variables to be optimized, which is a vector of positions of contracts to be solved that can be split in the electricity spot contract optimization scenario; "d_var" represents a vector composed of discrete variables to be optimized, which is an inseparable vector of positions with contracts to be solved in the electricity spot contract optimization scenario. The expression tree consists of "c_var", "d_var", a constant vector, and an operator. Operators include unary operators and binary operators. If the operator is a unary operator, the subtree uses the "input" keyword as the key; if the operator is a binary operator, the subtree uses "left" and "right" to represent the first operation expression (such as the dividend) and the second operation expression (such as the divisor) respectively.

[0129] In this embodiment, the unary operator is only "abs", which is used to represent the absolute value operation of a vector or scalar. The binary operators are shown in the following table:

[0130]

[0131]

[0132] The first five operators are generally used for calculations, and the last five operators are generally used to express constraints. These operators can also express other operations, such as calculating the sum of vectors, using all-1 vectors and the dot operator; calculating max, using abs and the basic four operators.

[0133] For example, a constraint is defined in JSON and is written as follows:

[0134]

[0135]

[0136] Written as an expression,

[0137] In this embodiment, the most complex is the risk constraint in the problem of optimal electricity cost (minimum total contract cost). In addition to this constraint, the semantics of other constraints is that only a set of solutions need to be found, and this set of solutions satisfies this constraint. The variables of the risk constraint in the problem of optimal electricity cost (minimum total contract cost) include not only the contracted electricity quantity as an unknown quantity, but also the spot price at each moment that fluctuates. Since the objective function in the optimal electricity cost (minimum total contract cost) is a linear function, the maximum electricity cost must be obtained at the maximum or minimum value of the time-sharing spot price. Therefore, this constraint can be constructed using the max keyword. And because So this constraint can also be constructed using SCOL.

[0138] In this embodiment, the value corresponding to the "obj" key is the objective function of the constraint optimization, which is also an expression and is essentially the same as the constraint. It should be additionally explained that the goal of solving the constraint optimization problem is to minimize the objective function. If the problem is to be maximized, it must be multiplied by -1 in advance.

[0139] In this example, the value corresponding to the "target_expression_list" key is a list, and the elements in the list are expressions with "c_var" and "d_var" as variables. This is an auxiliary function, that is, when giving the optimal solution, the values ​​of some expressions need to be calculated additionally.

[0140] In this embodiment, generating a first constraint problem description for the first objective function specifically includes:

[0141] Electricity fee for holding a position before trading tb:

[0142]

[0143] Among them, dc represents the vector of initial holding power, dc i represents the initial holding power at the i-th time point, dp represents the vector of initial holding power prices, dp i Represents the initial holding electricity price at the i-th time point.

[0144] Electricity fee for holding a position after trading:

[0145]

[0146] Among them, cvl represents a vector of continuous variables to be optimized, which is a vector of positions of contracts to be solved that can be split in the power spot contract optimization scenario. dvl represents a vector of discrete variables to be optimized, which is a vector of positions of contracts to be solved that cannot be split in the power spot contract optimization scenario. If the quantity to be optimized is positive, it means buying, and if it is negative, it means selling. CPL T *CCL Trepresents the matrix obtained by bitwise multiplication after matrix transposition, (CPL T *CCL T ) i The i-th row of this matrix represents the unit price list at the i-th time point when buying a unit divisible contract.

[0147] Time-sharing electricity deviation after transaction e i :

[0148] e i =lp i -(cvl·CCL T i +dvl·DCL T i +dc i ),

[0149] Where, lp represents the vector composed of load forecast power sequence, lp i represents the load forecast power at the i-th time point;

[0150] The maximum spot electricity fee sc for all periods of the contract after the transaction:

[0151] p min,i =spl i *spp min *e i ,

[0152] p max,i =spl i *spp max *e i ,

[0153]

[0154]

[0155] Among them, spl represents the vector composed of the predicted spot price series, spl i represents the spot price at the i-th time point, spp max Indicates the upper limit of spot price fluctuation ratio, spp min Indicates the lower limit of spot price fluctuation ratio, p min,i represents the spot electricity price at the i-th time point calculated according to the lower limit of the spot price fluctuation ratio, p max,i represents the spot electricity fee at the i-th time point calculated according to the upper limit of the spot price fluctuation ratio, msc i represents the maximum allowable electricity charge at the i-th time point.

[0156] The maximum allowable electricity fee constraint in the risk area is as follows:

[0157] tb+ta+sc≤tcsp max ,

[0158] Among them, tcsp max Indicates the maximum electricity cost that can be tolerated in all periods of the risk zone contract; because it is impossible to predict e i Is it a positive number? So we need to find max(p min,i ,p max,i ), the formula tb+ta+sc≤tcsp max The left part is a linear function of the variables to be optimized, cvl and dvl. We only need to find max(p min,i ,p max,i ), the maximum point must be at max(p min,i ,p max,i ) asked for.

[0159] For example, suppose there are two divisible contracts and two non-divisible contracts, and both are pending purchase contracts. Each contract has four time points, i.e., i=4, j=2, k=2;

[0160] The example parameters are as follows: the unit of electricity price is cents / kWh, the unit of electricity is 10,000 kWh;

[0161] The splittable contract quantity matrix:

[0162] The non-divisible contract quantity matrix:

[0163] The splittable contract price matrix:

[0164] Indivisible contract price matrix:

[0165] The vector of initial position power:

[0166] The vector of initial holding electricity prices:

[0167] A vector of continuous variables to be optimized: cvl = [c_var0, c_var1], with "c_var" replacing cvl in the constraint;

[0168] A vector of discrete variables to be optimized: dvl = [d_var0, d_var1], with "d_var" replacing dvl in the constraints;

[0169]

[0170]

[0171] The vector of load forecast power sequence:

[0172] The vector of predicted spot price series:

[0173] Spot price fluctuation ratio lower limit spp min =0.8, upper limit of spot price fluctuation ratio spp max =1.2,

[0174]

[0175]

[0176] The maximum electricity price that can be tolerated in all periods of the risk zone contract is tcsp max =300 (ten thousand yuan);

[0177] Electricity fee for holding a position before trading:

[0178] tb=4.5*256.0+5.5*255.0+6.0*260.0+7.0*259.0=5927.5 (ten yuan)=59275 (yuan).

[0179] Among them, · represents the dot product of vectors, * represents the bitwise multiplication of vectors and matrices, and T represents the matrix transpose operator.

[0180] Let i, j, k represent the subscript set, where:

[0181] i∈{0, 1, 2, 3, ..., n-1} represents the i-th time point,

[0182] j∈{0, 1, 2, 3, ..., m1-1} represents the jth separable contract,

[0183] k∈{0, 1, 2, 3, ..., m2-1} represents the kth indivisible contract,

[0184] m1 and m2 are the number of divisible contracts and non-divisible contracts respectively, and n represents the number of contract time points.

[0185] Among them, CCL represents the splittable contract power matrix, which is a matrix composed of the time-sharing power curves of all splittable contracts. The time-sharing power curve of each contract is a row vector of the matrix. Each row vector is defined as CCL j ; These row vectors are all normalized, that is, for any j, they satisfy CCL ji It represents the value of the j-th row and i-th column of the matrix CCL, that is, the proportion of the electricity consumption at the i-th time point of the j-th decomposable contract to all time periods.

[0186] Among them, DCL represents the inseparable contract power matrix, which is a matrix composed of the time-sharing power curves of all inseparable contracts. The time-sharing power curve of each contract is a row vector of the matrix. Each row vector is defined as DCL k And meet DCL ki It represents the value of the j-th row and i-th column of the matrix DCL, that is, the proportion of the electricity consumption at the i-th time point of the k-th indivisible contract to all time periods.

[0187] Among them, CPL represents the splittable contract price matrix, which is a matrix composed of the time-of-use price curves of all splittable contracts. The time-of-use price curve of each contract is a row vector of the matrix. Each row vector is defined as CPL j , CPL ji It represents the value of the j-th row and i-th column of the matrix CPL, that is, the electricity price at the i-th time point of the j-th decomposable contract.

[0188] Where DPL represents the inseparable contract price matrix, and each row vector is defined as DPL k , is a matrix composed of the time-of-use electricity price curves of all inseparable contracts. The time-of-use electricity price curve of each contract is a row vector of the matrix. Each row vector is defined as DPL k , DPL ki It represents the value of the j-th row and i-th column of the matrix DPL, that is, the electricity price of the k-th non-separable contract at the i-th time point.

[0189] In this embodiment, the minimum total contract cost of the first objective function is:

[0190]

[0191] S130: Generate a second constraint problem description for the second objective function based on the json constraint modeling language.

[0192] In this embodiment, generating a second constraint problem description for the second objective function specifically includes:

[0193] Electricity fee for holding a position before trading tb:

[0194]

[0195] Among them, dc represents the vector of initial holding power, dc i represents the initial holding power at the i-th time point, dp represents the vector of initial holding power prices, dp i represents the initial holding electricity price at the i-th time point;

[0196] Electricity fee for holding a position after trading:

[0197]

[0198] Among them, cvl represents the vector of continuous variables to be optimized, dvl represents the vector of discrete variables to be optimized, CPL T *CCL T represents the matrix obtained by bitwise multiplication after matrix transposition, (CPL T *CCL T ) i represents the i-th row of this matrix;

[0199] Time-sharing electricity deviation after transaction e i :

[0200] e i =lp i -(cvl·CCL T i +dvl·DCL T i +dc i ),

[0201] Where, lp represents the vector composed of load forecast power sequence, lp i represents the load forecast power at the i-th time point;

[0202] Time-sharing position restriction: Taking the power constraint as an example, assuming that for each time-sharing point, the difference between the final position and the load forecast does not exceed dif1, then this is composed of n constraints.

[0203] |e i |≤dif1;

[0204] And / or, total position limit: Taking the power constraint as an example, assuming that the total deviation between the final position and the load forecast does not exceed dif2, this constraint can be expressed as:

[0205]

[0206] And / or, average holding price constraint, assuming that the average holding price does not exceed c max , then the average spot price constraint is as follows:

[0207]

[0208] The average price constraint of holding positions without considering spot is as follows:

[0209]

[0210] Among them, spl represents the vector composed of the predicted spot price series, spl i represents the spot price at the i-th time point;

[0211] And / or, the average price of intraday positions, assuming that the average price of positions does not exceed c m , then for each time point, there is a constraint as follows:

[0212]

[0213] Among them, · represents the dot product of vectors, * represents the bitwise multiplication of vectors and matrices, and T represents the matrix transpose operator.

[0214] Let i, j, k represent the subscript set, where:

[0215] i∈{0, 1, 2, 3, ..., n-1} represents the i-th time point,

[0216] j∈{0, 1, 2, 3, ..., m1-1} represents the jth separable contract,

[0217] k∈{0, 1, 2, 3, ..., m2-1} represents the kth indivisible contract,

[0218] m1 and m2 are the number of divisible contracts and non-divisible contracts respectively, and n represents the number of contract time points.

[0219] Among them, CCL represents the splittable contract power matrix, which is a matrix composed of the time-sharing power curves of all splittable contracts. The time-sharing power curve of each contract is a row vector of the matrix. Each row vector is defined as CCL j ; These row vectors are all normalized, that is, for any j, they satisfy CCL ji It represents the value of the j-th row and i-th column of the matrix CCL, that is, the proportion of the electricity consumption at the i-th time point of the j-th decomposable contract to all time periods.

[0220] Among them, DCL represents the inseparable contract power matrix, which is a matrix composed of the time-sharing power curves of all inseparable contracts. The time-sharing power curve of each contract is a row vector of the matrix. Each row vector is defined as DCL k And meet DCL ki It represents the value of the j-th row and i-th column of the matrix DCL, that is, the proportion of the electricity consumption at the i-th time point of the k-th non-divisible contract to all time periods.

[0221] Among them, CPL represents the splittable contract price matrix, which is a matrix composed of the time-of-use price curves of all splittable contracts. The time-of-use price curve of each contract is a row vector of the matrix. Each row vector is defined as CPL j , CPL ji It represents the value of the j-th row and i-th column of the matrix CPL, that is, the electricity price at the i-th time point of the j-th decomposable contract.

[0222] Where DPL represents the inseparable contract price matrix, each row vector is defined as DPL k , is a matrix composed of the time-of-use electricity price curves of all inseparable contracts. The time-of-use electricity price curve of each contract is a row vector of the matrix. Each row vector is defined as DPL k , DPL ki It represents the value of the j-th row and i-th column of the matrix DPL, that is, the electricity price at the i-th time point of the k-th non-separable contract.

[0223] In this embodiment, the second objective function specifically includes:

[0224] The minimum deviation between the total power in the specified period and the total power forecasted by the load is:

[0225] (|∑ i∈T e i |) min ;

[0226] Or, the minimum value of the sum of the absolute values ​​of the deviations between the power consumption in a specified period and the load forecast power consumption is:

[0227] (∑ i∈T |e i |) min ;

[0228] Or, the minimum deviation between the total power of all contract periods and the total power of load forecast is:

[0229]

[0230] Or, the minimum value of the sum of the absolute values ​​of the deviations between the power consumption in all contract periods and the load forecast power consumption is:

[0231]

[0232] S140: Solve the first constraint problem description to obtain a first optimal solution of the first objective function.

[0233] S150: Solve the second constraint problem description to obtain a second optimal solution of the second objective function.

[0234] S160: Determine a transaction plan for the electricity contract based on the first optimal solution and the second optimal solution.

[0235] In this embodiment, firstly, according to the original data of the power contract, the constraint conditions, the load forecast data and the spot price forecast data, the first objective function for minimizing the total contract cost and the second objective function for the contract quantity closest to the forecast quantity are obtained; based on the json constraint modeling language, the first constraint problem description for the first objective function and the second constraint problem description for the second objective function are generated; and by solving the first constraint problem description and the second constraint problem description, the first optimal solution of the first objective function and the second optimal solution of the second objective function are obtained. The power sales company formulates the optimal power purchase combination plan through the first optimal solution and the second optimal solution, and conducts effective risk assessment to maximize the total benefit and minimize the risk, which is of great significance to the risk management of the power sales company.

[0236] Figure 2 A flowchart for solving the first constraint problem description to obtain a first optimal solution of the first objective function is provided in one embodiment of the present invention.

[0237] like Figure 2 As shown, solving the first constraint problem description to obtain a first optimal solution of the first objective function includes steps S210-S240:

[0238] S210: Enumerate possible discrete variable value combinations.

[0239] S220: Substitute a first constraint problem description and a first objective function into a certain discrete variable value combination to obtain a first constraint optimization problem based only on continuous variables.

[0240] S230: Calling the SLSQP algorithm to solve the first constrained optimization problem and save the result.

[0241] S240: Compare the objective function values ​​under different enumerations to find the optimal solution vector.

[0242] Figure 3 A flowchart of solving the second constraint problem description to obtain a second optimal solution of the second objective function is provided in one embodiment of the present invention.

[0243] like Figure 3 As shown, solving the second constraint problem description to obtain a first optimal solution of the second objective function includes steps S310-S340:

[0244] S310: Enumerate possible discrete variable value combinations.

[0245] S320: Substitute a second constraint problem description and a second objective function into a certain discrete variable value combination to obtain a second constraint optimization problem based only on continuous variables.

[0246] S330: Call the SLSQP algorithm to solve the second constrained optimization problem and save the result.

[0247] S340: Compare the objective function values ​​under different enumerations to find the optimal solution vector.

[0248] Figure 4 A process for solving the first problem description or solving the second problem description provided in one embodiment of the present invention Figure 1 .

[0249] like Figure 4 As shown, solving the first problem description or solving the second problem description includes steps S410-S420:

[0250] S410: Convert the problem description into a pyomo model.

[0251] In this embodiment, the constrained optimization problem represented by SCOL is converted into a pyomo model, but the discrete variables of pyomo can only support 0-1 variables, so a linear transformation is required.

[0252] S420: Use the scipampl executable program to call the pyomo solution API for solution.

[0253] In this embodiment, the scipampl executable program is used to call the pyomo solution API to solve the problem. This solution can only support the case where the discrete variable takes two values, which is basically met in the power spot scenario.

[0254] Figure 5 The process of solving the first problem description or solving the second problem description provided by the embodiment of the present invention is Figure 2 .

[0255] like Figure 5 As shown, solving the first problem description or solving the second problem description includes steps S510-S530:

[0256] S510: Convert the problem description into a pyomo model.

[0257] S520: Add restrictions, i.e., .set files.

[0258] In this embodiment, since the scip solver encapsulated by pyomo will only output the solution when it is sure that the optimal solution has been found, we use the method of adding restrictions, i.e., .set files, to obtain a feasible solution under certain computing resources by calling the scipampl executable file with a similar command line. A typical configuration is as follows:

[0259] limits / time=20,

[0260] limits / totalnodes=20000,

[0261] limits / bestsol=30.

[0262] S530: Call the scipampl executable file to solve.

[0263] Figure 6 The process of solving the first problem description or solving the second problem description provided by the embodiment of the present invention is Figure 3 ;

[0264] like Figure 6 As shown, solving the first problem description or solving the second problem description includes steps S610-S630:

[0265] S610: Convert the problem description into a Problem object of geatpy.

[0266] S620: Convert the objective function corresponding to the problem description into an aimFunc function.

[0267] S630: Solve using the strategy template soea_DE_rand_1_L_templet.

[0268] In this embodiment, the genetic algorithm geatpy framework is connected and the model is solved using the genetic algorithm.

[0269] The embodiment of the present invention first obtains the first objective function for minimizing the total contract cost and the second objective function for the contract quantity closest to the predicted quantity according to the original data of the power contract, the constraint conditions, the load forecast data and the spot price forecast data; based on the json constraint modeling language, generates the first constraint problem description for the first objective function and the second constraint problem description for the second objective function; and obtains the first optimal solution of the first objective function and the second optimal solution of the second objective function by solving the first constraint problem description and the second constraint problem description. The power sales company formulates the optimal power purchase combination plan through the first optimal solution and the second optimal solution, and conducts effective risk assessment to maximize the total benefit and minimize the risk, which is of great significance to the risk management of the power sales company.

[0270] Second embodiment

[0271] Based on the same inventive concept as the method in the first embodiment, this embodiment also provides a transaction device for an electricity contract.

[0272] Figure 7 A schematic diagram of the implementation flow of the transaction device for the electricity contract provided by the present invention.

[0273] like Figure 7 As shown, the device 7 includes:

[0274] The objective function acquisition module 71 is configured to acquire a first objective function for minimizing the total contract cost and a second objective function for the contract power closest to the predicted power according to the original data of the power contract, the constraint conditions, the load forecast data and the spot price forecast data;

[0275] A first constraint problem description generating module 72 is configured to generate a first constraint problem description for a first objective function based on a json-based constraint modeling language;

[0276] A second constraint problem description generating module 73 is configured to generate a second constraint problem description for a second objective function based on a json-based constraint modeling language;

[0277] A first optimal solution acquisition module 74 is configured to solve the first constraint problem description to obtain a first optimal solution of the first objective function;

[0278] A second optimal solution obtaining module 75 is configured to solve the second constraint problem description to obtain a second optimal solution of the second objective function;

[0279] The power contract transaction determination module 76 is configured to determine a transaction plan for the power contract based on the first optimal solution and the second optimal solution.

[0280] In some exemplary embodiments, the first optimal solution acquisition module specifically includes:

[0281] A first discrete variable enumeration unit is configured to enumerate possible discrete variable value combinations;

[0282] The first constrained optimization problem generating unit is configured to substitute a first constrained problem description and a first objective function into a certain discrete variable value combination to obtain a first constrained optimization problem based only on continuous variables;

[0283] A first constrained optimization problem solving unit is configured to call the SLSQP algorithm to solve the first constrained optimization problem and save the result;

[0284] The first optimal solution vector solving unit is configured to compare the objective function values ​​under different enumerations to find the optimal solution vector.

[0285] In some exemplary embodiments, the first optimal solution acquisition module further includes:

[0286] A first pyomo model conversion unit, configured to convert a problem description into a pyomo model;

[0287] The first optimal solution solving unit is configured to use the scipampl executable program to call the pyomo solution API for solving.

[0288] In some exemplary embodiments, the first optimal solution acquisition module further includes:

[0289] The second pyomo model unit is configured to convert the problem description into a pyomo model;

[0290] A first restriction condition setting unit is configured to add restrictions, i.e., a .set file;

[0291] The first calling scipampl solving unit is configured to call the scipampl executable file for solving.

[0292] In some exemplary embodiments, the first optimal solution acquisition module further includes:

[0293] A first Problem object conversion unit is configured to convert the problem description into a Problem object of geatpy;

[0294] A first aimFunc function conversion unit is configured to convert the objective function corresponding to the problem description into an aimFunc function;

[0295] The first strategy template solving unit uses the strategy template soea_DE_rand_1_L_templet to solve.

[0296] In some exemplary embodiments, the second optimal solution acquisition module specifically includes:

[0297] A second discrete variable enumeration unit is configured to enumerate possible discrete variable value combinations;

[0298] The second constrained optimization problem generating unit is configured to substitute a discrete variable value combination into the first constraint problem description and the first objective function to obtain a first constrained optimization problem based only on continuous variables;

[0299] A second constrained optimization problem solving unit is configured to call the SLSQP algorithm to solve the first constrained optimization problem and save the result;

[0300] The second optimal solution vector solving unit is configured to compare the objective function values ​​under different enumerations to find the optimal solution vector.

[0301] In some exemplary embodiments, the second optimal solution acquisition module further includes:

[0302] A third pyomo model conversion unit, configured to convert the problem description into a pyomo model;

[0303] The second optimal solution solving unit is configured to use the scipampl executable program to call the pyomo solution API for solving.

[0304] In some exemplary embodiments, the second optimal solution acquisition module further includes:

[0305] The fourth pyomo model unit is configured to convert the problem description into a pyomo model;

[0306] A second restriction condition setting unit is configured to add restrictions, i.e., a .set file;

[0307] The second scipampl solving unit is configured to call the scipampl executable file for solving.

[0308] In some exemplary embodiments, the second optimal solution acquisition module further includes:

[0309] The second Problem object conversion unit is configured to convert the problem description into a Problem object of geatpy;

[0310] A second aimFunc function conversion unit is configured to convert the objective function corresponding to the problem description into an aimFunc function;

[0311] The second strategy template solving unit uses the strategy template soea_DE_rand_1_L_templet to solve.

[0312] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A method for determining an electricity contract, characterized in that: The electricity contract includes a contracted electricity quantity and a contracted total fee, and the method includes: According to the original data of the power contract, the constraint conditions, the load forecast data and the spot price forecast data, a first objective function for minimizing the total contract cost and a second objective function for the contract quantity to be closest to the forecast quantity are obtained, wherein the load forecast data is a load forecast quantity sequence, and the sequence length of the spot price forecast is the same as the length of the load forecast power sequence; Based on the json constraint modeling language, generate a first constraint problem description for the first objective function, wherein the first constraint problem description includes the pre-transaction holding electricity fee, the post-transaction holding electricity fee, the post-transaction time-sharing electricity deviation, and the maximum spot electricity fee for all periods of the post-transaction contract; Based on the json constraint modeling language, generate a second constraint problem description for the second objective function, wherein the second constraint problem description includes the pre-transaction holding electricity fee, the post-transaction holding electricity fee, and the post-transaction time-sharing electricity deviation; Solving the first constraint problem description to obtain a first optimal solution of the first objective function; Solving the second constraint problem description to obtain a second optimal solution of the second objective function; A transaction plan for the electricity contract is determined according to the first optimal solution and the second optimal solution.

2. The method according to claim 1, characterized in that The electricity fee for holding a position before the transaction is tb: Among them, dc represents the vector of initial holding power, dc i represents the initial holding power at the i-th time point, dp represents the vector of initial holding power prices, dp i represents the initial holding electricity price at the i-th time point; The electricity fee for holding the position after the transaction is ta: Among them, cvl represents the vector of continuous variables to be optimized, dvl represents the vector of discrete variables to be optimized, CPL T *CCL T represents the matrix obtained by bitwise multiplication after matrix transposition, (CPL T *CCL T ) i represents the i-th row of this matrix; The time-sharing power deviation after the transaction is e i : e i =lp i -(cvl·CCL T i +dvl·DCL T i +dc i ), Where, lp represents the vector composed of load forecast power sequence, lp i represents the load forecast power at the i-th time point; The maximum spot electricity cost for all periods of the contract after the transaction is sc: p min,i =spl i *spp min *e i , p max,i =spl i *spp max *e i , Among them, spl represents the vector composed of the predicted spot price series, spl i represents the spot price at the i-th time point, spp max Indicates the upper limit of spot price fluctuation ratio, spp min Indicates the lower limit of spot price fluctuation ratio, p min,i represents the spot electricity price at the i-th time point calculated according to the lower limit of the spot price fluctuation ratio, p max,i represents the spot electricity fee at the i-th time point calculated according to the upper limit of the spot price fluctuation ratio, msc i represents the maximum allowable electricity charge at the i-th time point; The maximum allowable electricity fee constraint in the risk area is as follows: tb+ta+sc≤tcsp max , Among them, tcsp max It indicates the maximum electricity cost that can be tolerated in all periods of the risk zone contract; Among them, · represents the dot product of vectors, * represents the bitwise multiplication of numbers or vectors and matrices, and T represents the matrix transpose operator; Let i, j, k represent the subscript set, where: i∈{0, 1, 2, 3, ..., n-1} represents the i-th time point, j∈{0, 1, 2, 3, ..., m1-1} represents the jth separable contract, k∈{0, 1, 2, 3, ..., m2-1} represents the kth indivisible contract, m1 and m2 are the number of divisible contracts and non-divisible contracts respectively, and n represents the number of contract time points. Among them, CCL represents the splittable contract quantity matrix, and each row vector is defined as CCL j , CCL ji represents the value of the j-th row and i-th column of the matrix CCL; Where DCL represents the indivisible contract quantity matrix, and each row vector is defined as DCL k , DCL ki represents the value of the j-th row and i-th column of the matrix DCL; Where CPL represents the splittable contract price matrix, and each row vector is defined as CPL j , CPL ji represents the value of the jth row and ith column of the matrix CPL; Where DPL represents the inseparable contract price matrix, and each row vector is defined as DPL k , DPL ki Represents the value of the j-th row and i-th column of the matrix DPL.

3. The method according to claim 2, characterized in that The first objective function is: The minimum total contract fee is:

4. The method according to claim 1, characterized in that: The electricity fee for holding a position before the transaction is tb: Among them, dc represents the vector of initial holding power, dc i represents the initial holding power at the i-th time point, dp represents the vector of initial holding power prices, dp i represents the initial holding electricity price at the i-th time point; The electricity fee for holding the position after the transaction is ta: Among them, cvl represents the vector of continuous variables to be optimized, dvl represents the vector of discrete variables to be optimized, CPL T *CCL T represents the matrix obtained by bitwise multiplication after matrix transposition, (CPL T *CCL T ) i represents the i-th row of this matrix; The time-sharing power deviation after the transaction is e i ; e i =lp i -(cvl·CCL T i +dvl·DCL T i +dc i ), Where, lp represents the vector composed of load forecast power sequence, lp i represents the load forecast power at the i-th time point; Time-sharing position restriction: Taking the power constraint as an example, assuming that for each time-sharing point, the difference between the final position and the load forecast does not exceed dif1, then this is composed of n constraints. |and i |≤dif1; And / or, total position limit: Taking the power constraint as an example, assuming that the total deviation between the final position and the load forecast does not exceed dif2, this constraint can be expressed as: And / or, average holding price constraint, assuming that the average holding price does not exceed c max , then the average spot price constraint is as follows: The average price constraint of holding positions without considering spot is as follows: Among them, spl represents the vector composed of the predicted spot price series, spl i represents the spot price at the i-th time point; And / or, the average price of intraday positions, assuming that the average price of positions does not exceed c m , then for each time point, there is a constraint as follows: Among them, · represents the dot product of vectors, * represents the bitwise multiplication of numbers or vectors and matrices, and T represents the matrix transpose operator; Let i, j, k represent the subscript set, where: i∈{0, 1, 2, 3, ..., n-1} represents the i-th time point, j∈{0, 1, 2, 3, ..., m1-1} represents the jth separable contract, k∈{0, 1, 2, 3, ..., m2-1} represents the kth indivisible contract, m1 and m2 are the number of divisible contracts and non-divisible contracts respectively, and n represents the number of contract time points. Among them, CCL represents the splittable contract quantity matrix, and each row vector is defined as CCL j , CCL ji represents the value of the j-th row and i-th column of the matrix CCL; Where DCL represents the indivisible contract quantity matrix, and each row vector is defined as DCL k , DCL ki represents the value of the j-th row and i-th column of the matrix DCL; Where CPL represents the splittable contract price matrix, and each row vector is defined as CPL j , CPL ji represents the value of the jth row and ith column of the matrix CPL; Where DPL represents the inseparable contract price matrix, and each row vector is defined as DPL k , DPL ki Represents the value of the j-th row and i-th column of the matrix DPL.

5. The method according to claim 4, characterized in that The second objective function specifically includes: The minimum deviation between the total power in the specified period and the total power forecasted by the load is: (|∑ i∈T e i |) min ; Or, the minimum value of the sum of the absolute values ​​of the deviations between the power consumption in a specified period and the load forecast power consumption is: (∑ i∈T |e i |) min ; Or, the minimum deviation between the total power of all contract periods and the total power of load forecast is: Or, the minimum value of the sum of the absolute values ​​of the deviations between the power consumption in all contract periods and the load forecast power consumption is:

6. The method according to any one of claims 3 or 5, characterized in that Solving the first constraint problem description or solving the second constraint problem description specifically includes: Enumerate possible combinations of discrete variable values; For a certain discrete variable value combination, bring in the constraint problem description and the objective function corresponding to the constraint problem description to obtain the first constraint optimization problem based only on continuous variables; Calling the SLSQP algorithm to solve the first constrained optimization problem and save the result; Compare the objective function values ​​under different enumerations and find the optimal solution vector.

7. The method according to any one of claims 3 or 5, characterized in that Solving the first constraint problem description or solving the second constraint problem description specifically includes: Convert the problem description into a pyomo model; Use the scipampl executable program to call pyomo's solution API for solving.

8. The method according to any one of claims 3 or 5, characterized in that Solving the first constraint problem description or solving the second constraint problem description specifically includes: Convert the problem description into a pyomo model; Add restrictions i.e. .set file; Call the scipampl executable file to solve.

9. The method according to any one of claims 3 or 5, characterized in that Solving the first constraint problem description or solving the second constraint problem description specifically includes: Convert the problem description into a geatpy Problem object; Convert the objective function corresponding to the problem description into the aimFunc function; Use the strategy template soea_DE_rand_1_L_templet to solve.

10. A device for determining an electricity contract, characterized in that: The electricity contract includes the contracted electricity quantity and the contracted total fee, and the device includes: The objective function acquisition module is configured to acquire a first objective function for minimizing the total contract cost and a second objective function for the contract power closest to the predicted power according to the original data of the power contract, the constraint conditions, the load forecast data and the spot price forecast data, wherein the load forecast data is a load forecast power sequence, and the sequence length of the spot price forecast is the same as the load forecast power sequence length; A first constraint problem description generating module is configured as a json-based constraint modeling language to generate a first constraint problem description for a first objective function, wherein the first constraint problem description includes a pre-transaction holding electricity fee, a post-transaction holding electricity fee, a post-transaction time-sharing electricity deviation, and a maximum spot electricity fee for all periods of the post-transaction contract; A second constraint problem description generating module is configured as a json-based constraint modeling language to generate a second constraint problem description for a second objective function, wherein the second constraint problem description includes a pre-transaction holding electricity fee, a post-transaction holding electricity fee, and a post-transaction time-sharing electricity deviation; A first optimal solution acquisition module is configured to solve the first constraint problem description to obtain a first optimal solution of the first objective function; A second optimal solution acquisition module is configured to solve the second constraint problem description to obtain a second optimal solution of the second objective function; The transaction determination module of the power contract is configured to determine the transaction plan of the power contract according to the first optimal solution and the second optimal solution.

Citation Information

Patent Citations

  • Strategy determination method and device for medium-and-long-term electricity purchasing and selling

    CN111027770A

  • Method of analyzing determinant for contract price in electric power transaction market and computer program for analysis

    JP2006195848A