If you call runmarket as ...

define_constants;
[QUANTITY, PRICE, FCOST, VCOST, SCOST, PENALTY] = idx_disp;
[r, co, cb, f, dispatch, success, et] = runmarket(mpc, offers, bids, mkt, 
mpopt);

There are two equivalent ways to get the cost ...

cost = totcost(r.gencost, r.gen(:, PG));
cost = dispatch(:, FCOST) + dispatch(:, VCOST);

And the profit (for generators) or benefit (for loads) is simply the revenue 
minus the cost ...

profit = dispatch(:, QUANTITY) .* dispatch(:, PRICE) - cost;

Regarding the transformer, I had in mind something like ...

voltage_not_ok = 1;
while voltage_not_ok
    r = runpf(mpc, mpopt);  % or runmarket or whatever
    if <voltage in r.bus(k, VM) too low>
        <increase tap in mpc.branch(i, TAP)>
    elseif  <voltage in r.bus(k, VM) too high>
        <decrease tap in mpc.branch(i, TAP)>
    else
        voltage_not_ok = 0;  % exit the loop
    end
end

That's just the overall idea. Obviously, you would have to make sure that your 
tap update scheme does not result in cycling, etc.

Hope this helps,

-- 
Ray Zimmerman
Senior Research Associate
419A Warren Hall, Cornell University, Ithaca, NY 14853
phone: (607) 255-9645




On Oct 21, 2011, at 9:10 AM, Dailan Xu wrote:

> Thank you.But my mean is this: where can I find the generator costs, profit 
> and benefits in the runmarket results? I don't have problem in MATLAB 
> programming.
> 
> Could you please explain clearer the following sentence: you could call the 
> power flow in a loop that adjusts the taps based on the voltages in the 
> solution.
> 
> 
> Best Regards
> 
> D. Xu
> 
> 
> 
> On Fri, Oct 21, 2011 at 15:03, Ray Zimmerman <[email protected]> wrote:
> 1. This is a very general question. Since I can't guess exactly what you are 
> having trouble with, it comes across as a general Matlab programming question 
> to me. If so, go find a good book on Matlab programming and spend some time 
> with it. If you have a specific MATPOWER-related question (for example, where 
> can I find the generator cost in the OPF results?), then check the manual 
> first and if you can't find the answer I'll be happy to try to answer it for 
> you.
> 
> 2. The power flow routine in MATPOWER does not automatically control the taps 
> on transformers to regulate voltage (see the last sentence before section 4.1 
> in the manual). However, you could call the power flow in a loop that adjusts 
> the taps based on the voltages in the solution.
> 
> Best regards,
> 
> -- 
> Ray Zimmerman
> Senior Research Associate
> 419A Warren Hall, Cornell University, Ithaca, NY 14853
> phone: (607) 255-9645
> 
> 
> 
> On Oct 21, 2011, at 7:52 AM, Dailan Xu wrote:
> 
>> Dear Dr. Zimmerman
>> 
>> 1. I have different kinds of loads and generations and I want to have 
>> profit, cost and Lamba (or market summary) in a separate matrix (each of 
>> them). Could you please let me know how can I do it?
>> 
>> 2. I want to use an OLTC to centrally control the voltage of the slack bus. 
>> Is it possible in MATPOWER?
>> 
>> Best Regards
>> 
>> D. Xu
>> 
>> 
> 
> 

Reply via email to