04 - Assignment_week4 SET3060_Answers
04 - Assignment_week4 SET3060_Answers
This assignment is structured in two blocks: individual tasks and group tasks.
The individual tasks are made of simple preliminary exercises that should be done individually before the
instruction session. These are necessary for completing the group tasks.
The group tasks involve the use of MATLAB and a complete optimization problem, which will be solved
during the instructions.
Individual tasks
1. (10 min)
An electricity producer estimates that its variable cost in €/hr for producing electricity in terms of
power produced in MW is given by the following expression:
Where C is the total cost and PG is the quantity produced in that hour.
𝑑𝐶(𝑃𝐺 ) €
𝑑𝑃𝐺
= 25 ∗ 2 ∗ 𝑃𝐺 + 2000 = 50𝑃𝐺 + 2000 [𝑀𝑊ℎ]
b) Derive an expression for the revenue and the profit when the power is sold at marginal cost.
Ans. Revenue would be the selling price (in this case marginal cost) times the power sold.
€
𝑅𝑒𝑣𝑒𝑛𝑢𝑒 = (50𝑃𝐺 + 2000) ∗ 𝑃𝐺 𝑠𝑜𝑙𝑑 [ ]
ℎ
𝑃𝑟𝑜𝑓𝑖𝑡 = 𝑅𝑒𝑣𝑒𝑛𝑢𝑒 − 𝐶𝑜𝑠𝑡 = (50𝑃𝐺 2𝑠𝑜𝑙𝑑 + 2000𝑃𝐺 𝑠𝑜𝑙𝑑 ) − (25𝑃𝐺 2𝑠𝑜𝑙𝑑 + 2000𝑃𝐺 𝑠𝑜𝑙𝑑 )
€
= 25𝑃𝐺 2𝑠𝑜𝑙𝑑 [ ]
ℎ
The market price is in this case equal to the marginal cost : 50𝑃𝐺 + 2000
c) Suppose that our electricity producer is a marginal producer. Present in the graph below its
marginal cost, revenue and profit.
Ans. To answer this question, it is important to realize that the total cost and marginal cost have
different dimensions, they cannot be drawn in the same graph. Revenue and profit have the same
dimensions as total cost.
If the marginal cost is known (50PG + 2000), then the total cost is equal to the integral of the
marginal cost (the result should be the same as the total cost mentioned above):
𝑃𝐺 𝑠𝑜𝑙𝑑
𝐶(𝑃𝐺𝑠𝑜𝑙𝑑 ) = ∫ (50𝑃𝐺 + 2000) 𝑑𝑃𝐺
0
= 25𝑃𝐺 2𝑠𝑜𝑙𝑑 + 2000𝑃𝐺 𝑠𝑜𝑙𝑑
Group tasks
1. (30 min)
(This question should be answered with MATLAB)
In week 2 you solved analytically the economic dispatch problem with a quadratic unit cost
functions characterized by the parameters provided as follows:
The specific system demand levels were 40, 250, 300, and resp. 600MW.
(a) Solve this problem numerically in Matlab and compare with the solutions obtained in week 2.
Use function “fmincon” from Matlab for non-linear optimization with constraints.
x = 233.3333 66.6667
lambda.eqlin
>> ans = -31.6667
(b) Reflect on the sensitivity of the solution by looking on the Lagrange multipliers.
Both units operate at identical incremental costs. The common incremental cost also
coincides with the system marginal cost, that is, the sensitivity of the total cost with
respect to the system demand. In this case the incremental cost (-Lagrange multiplier) is
31,67.
c) Do the power plants operate at identical marginal cost in all situations?
The power plants operate at identical marginal cost (incremental cost) for the case when
𝑃𝐺𝑚𝑖𝑛 < 𝑃𝐺 𝑖 < 𝑃𝐺𝑚𝑎𝑥
For the case when demand is 40 MW and 600 MW, the power plants do not operate at
identical marginal cost because
𝑃𝐺𝑖 = 𝑃𝐺𝑚𝑖𝑛 𝑎𝑛𝑑 𝑃𝐺 𝑖 = 𝑃𝐺𝑚𝑎𝑥
Consider now the ED as above but with elastic demand characterized as follows:
d) Should this Economic Dispatch Problem with elastic demand be solved, when chosen for
an analytical solution, by only Lagrange multipliers or by Lagrange and KKT multipliers?
Explain your answer.
The Economic Dispatch Problem with elastic demand contains inequality constraints; an
optimization problem with inequality constraints cannot be solved analytically just by using
Lagrange multipliers. For problems with inequality constraints Kuhn-Tucker conditions
should be satisfied.
e) What are the optimal results? Answer this question after the problem is numerically solved
in Matlab.
The optimization variables: PG1, PG2, PD1, PD2
SW (PG1, PG2 , PD1, PD2 ) = (55 − 0,2 * PD1 ) * PD1 + (50 − 0,1* PD2 ) * PD2 −
(100 + 20 * PG1 + 0,5 * 0,05PG1 * PG1 ) − (200 + 25 * PG2 + 0,5 * 0,10 * PG2 * PG2 )
Constraints:
1. ∑𝑚=2 𝑛=2
𝑗=1 𝑃𝐷 𝑗 = ∑𝑖=1 𝑃𝐺 𝑖 ; 𝑇ℎ𝑒 𝑠𝑦𝑠𝑡𝑒𝑚 𝑑𝑒𝑚𝑎𝑛𝑑 𝑠ℎ𝑜𝑢𝑙𝑑 𝑒𝑞𝑢𝑎𝑙 𝑠𝑦𝑠𝑡𝑒𝑚 𝑝𝑟𝑜𝑑𝑢𝑐𝑡𝑖𝑜𝑛
MATLAB implementation
To solve this problem in Matlab choose e.g
x(1)= PD1; x(2)= PD2; x(3)= PG1, x(4)= PG2
Here lower and upper bound constraints should be included; therefore we will
use x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub)
If you are not sure about the syntax you can always use documentation (doc) in Matlab by
typing in the Command Window: >> doc fmincon
Consider that MATLAB can only minimize an objective function, therefore we min (-SW):
(g) What can you say about the incremental utility? What does the incremental utility say?
The incremental utility (or benefit function / marginal utility) is equal to:
dU j (PDj )
IU j (PDj ) =
dPDj
It is equal to minus Lagrange multiplier, so = 27,67
It should be stressed that all generating units must operate at identical incremental costs
(marginal costs) and that all demands operate at identical marginal utilities. Moreover, single
marginal cost must be equal to single incremental utility.
>> lambda.eqlin
ans = 27.6667