$ontext network of energy suppliers Reference: Steven A. Gabriel, Antonio J. Conejo, J. David Fuller, Benjamin F. Hobbs, Carlos Ruiz Complementarity Modeling in Energy Markets Springer 2012 $offtext Sets s 'producers (supplier)' /A,B,C,D/ n 'nodes in network' /node1,node2/ sn(s,n) 'network topology' / (A,B).node1 (C,D).node2 / exports(s,n,n) 'export links' /(A,B).node1.node2/ exporter(s) 'exporters are subset of suppliers' link(n,n) 'export flow' ; alias(n,n1,n2); * interesting: the next rhs are the same nut the calculate something * different exporter(s) = sum(exports(s,n1,n2),1); link(n1,n2) = sum(exports(s,n1,n2),1); display sn,exports,exporter,link; parameters tau_reg(n,n) 'regulated tariff for export (exogenous)' /node1.node2 0.5/ gamma(s) 'unit production cost for each supplier' / A 10, B 12, C 15, D 18 / a(n) 'coefficient for demand function' /node1 20, node2 40/ b(n) 'coefficient for demand function' /node1 1, node2 2/ q_max(s) 'upper bound on production (capacity)' /A 10, B 10, C 5, D 5 / g_max(n,n) 'max flow over link (capacity)' /node1.node2 5/ gamma_TSO 'unit cost for TSO' /1/ ; positive variables sell(s,n) 'quantity sold' q(s,n) 'quantity produced' f(s,n,n) 'quantity exported' lambda(s,n) 'dual on upper bound production' g(n,n) 'flows' veps(n,n) 'dual on transportation capacity condition' ; free variables delta(s,n) 'dual on sell=production-export' pi(n) 'prices' tau(n,n) 'congestion tariff (endogenous)' ; equations FOC_supplier_sell(s,n) 'derivative of Lagrangian wrt variable sell' FOC_supplier_q(s,n) 'derivative of Lagrangian wrt variable q' FOC_supplier_exp(s,n,n) 'derivative of Lagrangian wrt variable f' supplier_max_prod(s,n) 'capacity constraint' supplier_supply(s,n) 'supply is locally sold or exported' MC(n) 'market clearing' FOC_TSO_g(n,n) 'derivative of Lagragian wrt variable g' TSO_max(n,n) 'capacity constraint' TSO_sum(n,n) 'summation of flows' ; FOC_supplier_sell(sn(s,n)).. -pi(n)+delta(s,n) =g= 0; FOC_supplier_q(sn(s,n)).. gamma(s)+lambda(s,n)-delta(s,n) =g= 0; FOC_supplier_exp(exports(s,n1,n2)).. -pi(n2)+(tau_reg(n1,n2)+tau(n1,n2))+delta(s,n1) =g= 0; supplier_max_prod(sn(s,n)).. q_max(s)-q(s,n) =g= 0; supplier_supply(sn(s,n)).. sell(s,n)-q(s,n)+sum(exports(s,n,n2),f(s,n,n2))=e=0; MC(n).. sum(sn(s,n),sell(s,n)) + sum(exports(s,n1,n),f(s,n1,n)) -(a(n)-b(n)*pi(n)) =e= 0; FOC_TSO_g(link(n1,n2)).. -tau_reg(n1,n2) - tau(n1,n2) + gamma_TSO + veps(n1,n2) =g= 0; TSO_max(link(n1,n2)).. g_max(n1,n2) - g(n1,n2) =g= 0; TSO_sum(link(n1,n2)).. g(n1,n2) - sum(exports(s,n1,n2),f(s,n1,n2)) =e= 0; MODEL compl1 / FOC_supplier_sell.sell FOC_supplier_q.q FOC_supplier_exp.f supplier_max_prod.lambda supplier_supply.delta MC.pi FOC_TSO_g.g TSO_max.veps TSO_sum.tau /; solve compl1 using mcp; parameter results(*,*,*); $macro report(a) \ results(a,'unit cost', s) = gamma(s); \ results(a,'sell', s) = sum(n, sell.l(s,n)); \ results(a,'q', s) = sum(n, q.l(s,n)); \ results(a,'qmax', s) = q_max(s); \ results(a,'export',s) = sum((n1,n2),f.l(s,n1,n2)); \ results(a,'flow', n) = sum(n2, g.l(n,n2)); \ results(a,'maxflow',n) = sum(n2, g_max(n,n2)); \ results(a,'price', n) = pi.l(n); \ results(a,'exo.tariff',n) = sum(n2,tau_reg(n,n2)); \ results(a,'end.tariff',n) = sum(n2,tau.l(n,n2)); \ display results; report('base case') * make A,B more expensive gamma('A') = 15; gamma('B') = 17; solve compl1 using mcp; report('A,B expensive')
|
No comments:
Post a Comment