Ok, I found a bug ... but I'm not certain it was causing the issue you first
mentioned (dispatchable load cost being positive or negative depending which
way it was computed).
In any case, the bug has to do with the fact that the gencost matrix returned
in r is not the original gencost, but rather the one that was used to run the
OPF, that is, the one formed from the offers and bids. So, if you compute cost1
as ...
cost1 = totcost(mpc.gencost, r.gen(:, PG));
... you should get the same answer for cost1 and cost2.
And I'll fix the code in smartmkt.m so that r.gencost will be equal to
mpc.gencost.
Ray
On Mar 26, 2012, at 4:32 PM, Roberto Carvalini wrote:
> Thank you.Please see the following code:
>
> clear all;
> define_constants;
> mpc = loadcase('t_auction_case');
> mkt.OPF = 'AC';
> mkt.auction_type = 0;
> offers.P.qty = [ ...
> 12 24 24;
> 12 24 24;
> 12 24 24;
> 12 24 24;
> 12 24 24;
> 12 24 24 ];
> offers.P.prc = [ ...
> 20 50 60;
> 20 40 70;
> 20 42 80;
> 20 44 90;
> 20 46 75;
> 20 48 60 ];
> bids.P.qty = [ ...
> 10 10 10;
> 10 10 10;
> 10 10 10 ];
> bids.P.prc = [ ...
> 100 70 60;
> 100 50 20;
> 100 60 50 ];
>
> %++++++++++++++++++++++++
> [QUANTITY, PRICE, FCOST, VCOST, SCOST, PENALTY] = idx_disp;
>
> [r, co, cb, f, dispatch, success, et] = runmarket(mpc, offers, bids, mkt);
> cost1 = totcost(r.gencost, r.gen(:, PG));
> cost2 = dispatch(:, FCOST) + dispatch(:, VCOST);
> [cost1 cost2]
>
> Best Wishes
>
> Roberto
>
> On Mon, Mar 26, 2012 at 21:53, Ray Zimmerman <[email protected]> wrote:
> Oh ... well ... the number of hours is an input value. The default is 1 hour
> (see help runmarket). Ok, I have actually gone back and looked at some
> examples, and, I do not see the difference in sign that you are referring to.
> In my examples, the cost for generators is positive and for dispatchable
> loads it is negative (as expected) for both ways of computing it.
>
> Can you give me an example where they are different for me to look into?
>
> --
> Ray Zimmerman
> Senior Research Associate
> 419A Warren Hall, Cornell University, Ithaca, NY 14853
> phone: (607) 255-9645
>
>
>
>
> On Mar 26, 2012, at 11:44 AM, Roberto Carvalini wrote:
>
>> I didn't want to clarify. I wanted to ask you what is the reason?
>>
>> How you have determined the number of hours and why for the first one is
>> negative and for the second one is positive. I don't understand. If it is
>> possible, please explain.
>>
>> Best Wishes
>>
>> Roberto
>>
>>
>> On Mon, Mar 26, 2012 at 14:59, Ray Zimmerman <[email protected]> wrote:
>> On Mar 24, 2012, at 10:56 PM, Roberto Carvalini wrote:
>>
>>> 1. When I do a runmarket, in the results, what is the difference between
>>> PRICE in MARKET SUMMARY and LAMBDA in System summary? Usually they have the
>>> same value and sometimes they are different? What is the reason?
>>
>> PRICE depends on the auction type chosen. For a first price auction, they
>> should be the same except in cases where a generator is dispatched at PMIN,
>> in which case the LAMBDA may go lower than the offer price, but the cleared
>> price is still set to the offer price. See MATPOWER Tech Note 1 on Uniform
>> Price Auctions and Optimal Power Flow for more details.
>>
>>
>>> 2. According to your reply to one of the posts as follows, what is the
>>> difference between these two costs? They get different values?
>>>
>>> cost = totcost(r.gencost, r.gen(:, PG));
>>> cost = dispatch(:, FCOST) + dispatch(:, VCOST);
>>
>> The first is a cost in $/hr. The second is multiplied by the number of hours
>> in a market period (mkt.t) and so is expressed in $. For the default of 1
>> hour periods, they should give the same number.
>>
>>
>> --
>> Ray Zimmerman
>> Senior Research Associate
>> 419A Warren Hall, Cornell University, Ithaca, NY 14853
>> phone: (607) 255-9645
>>
>>
>
>