Home > matpower6.0 > extras > smartmarket > pricelimits.m

pricelimits

PURPOSE ^

PRICELIMITS Fills in a struct with default values for offer/bid limits.

SYNOPSIS ^

function lim = pricelimits(lim, haveQ)

DESCRIPTION ^

PRICELIMITS  Fills in a struct with default values for offer/bid limits.
   LIM = PRICELIMITS(LIM, HAVEQ)
   The final structure looks like:
       LIM.P.min_bid           - bids below this are withheld
            .max_offer         - offers above this are withheld
            .min_cleared_bid   - cleared bid prices below this are clipped
            .max_cleared_offer - cleared offer prices above this are clipped
          .Q       (optional, same structure as P)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function lim = pricelimits(lim, haveQ)
0002 %PRICELIMITS  Fills in a struct with default values for offer/bid limits.
0003 %   LIM = PRICELIMITS(LIM, HAVEQ)
0004 %   The final structure looks like:
0005 %       LIM.P.min_bid           - bids below this are withheld
0006 %            .max_offer         - offers above this are withheld
0007 %            .min_cleared_bid   - cleared bid prices below this are clipped
0008 %            .max_cleared_offer - cleared offer prices above this are clipped
0009 %          .Q       (optional, same structure as P)
0010 
0011 %   MATPOWER
0012 %   Copyright (c) 2005-2016, Power Systems Engineering Research Center (PSERC)
0013 %   by Ray Zimmerman, PSERC Cornell
0014 %
0015 %   This file is part of MATPOWER.
0016 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0017 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0018 
0019 if isempty(lim)
0020     if haveQ
0021         lim = struct( 'P', fill_lim([]), 'Q', fill_lim([]) );
0022     else
0023         lim = struct( 'P', fill_lim([]) );
0024     end
0025 else
0026     if ~isfield(lim, 'P')
0027         lim.P = [];
0028     end
0029     lim.P = fill_lim(lim.P);
0030     if haveQ
0031         if ~isfield(lim, 'Q')
0032             lim.Q = [];
0033         end
0034         lim.Q = fill_lim(lim.Q);
0035     end
0036 end
0037 
0038 
0039 
0040 function lim = fill_lim(lim)
0041 if isempty(lim)
0042     lim = struct( 'max_offer', [], 'min_bid', [], ...
0043                   'max_cleared_offer', [], 'min_cleared_bid', [] );
0044 else
0045     if ~isfield(lim, 'max_offer'),         lim.max_offer = [];         end
0046     if ~isfield(lim, 'min_bid'),           lim.min_bid = [];           end
0047     if ~isfield(lim, 'max_cleared_offer'), lim.max_cleared_offer = []; end
0048     if ~isfield(lim, 'min_cleared_bid'),   lim.min_cleared_bid = [];   end
0049 end

Generated on Fri 16-Dec-2016 12:45:37 by m2html © 2005