F “Smart Market” Code

Matpower 3 and later includes in the extras/smartmarket directory code that implements a “smart market” auction clearing mechanism. The purpose of this code is to take a set of offers to sell and bids to buy and use Matpower’s optimal power flow to compute the corresponding allocations and prices. It has been used extensively by the authors with the optional MINOPF package [32] in the context of PowerWeb65 but has not been widely tested in other contexts.

The smart market algorithm consists of the following basic steps:

1.
Convert block offers and bids into corresponding generator capacities and costs.
2.
Run an optimal power flow with decommitment option (uopf) to find generator allocations and nodal prices (λP  ).
3.
Convert generator allocations and nodal prices into set of cleared offers and bids.
4.
Print results.

For step 1, the offers and bids are supplied as two structs, offers and bids, each with fields P for real power and Q for reactive power (optional). Each of these is also a struct with matrix fields qty and prc, where the element in the i  -th row and j  -th column of qty and prc are the quantity and price, respectively of the j  -th block of capacity being offered/bid by the i  -th generator. These block offers/bids are converted to the equivalent piecewise linear generator costs and generator capacity limits by the off2case function. See help off2case for more information.

Offer blocks must be in non-decreasing order of price and the offer must correspond to a generator with 0 ≤  PMIN <   PMAX. A set of price limits can be specified via the lim struct, e.g. and offer price cap on real energy would be stored in lim.P.max_offer. Capacity offered above this price is considered to be withheld from the auction and is not included in the cost function produced. Bids must be in non-increasing order of price and correspond to a generator with PMIN <   PMAX ≤  0 (see Section 6.4.2 on page 164). A lower limit can be set for bids in lim.P.min_bid. See help pricelimits for more information.

The data specified by a Matpower case file, with the gen and gencost matrices modified according to step 1, are then used to run an OPF. A decommitment mechanism is used to shut down generators if doing so results in a smaller overall system cost (see Section 8).

In step 3 the OPF solution is used to determine for each offer/bid block, how much was cleared and at what price. These values are returned in co and cb, which have the same structure as offers and bids. The mkt parameter is a struct used to specify a number of things about the market, including the type of auction to use, type of OPF (AC or DC) to use and the price limits.

There are two basic types of pricing options available through mkt.auction_type, discriminative pricing and uniform pricing. The various uniform pricing options are best explained in the context of an unconstrained lossless network. In this context, the allocation is identical to what one would get by creating bid and offer stacks and finding the intersection point. The nodal prices (λP  ) computed by the OPF and returned in bus(:,LAM_P) are all equal to the price of the marginal block. This is either the last accepted offer (LAO) or the last accepted bid (LAB), depending which is the marginal block (i.e. the one that is split by intersection of the offer and bid stacks). There is often a gap between the last accepted bid and the last accepted offer. Since any price within this range is acceptable to all buyers and sellers, we end up with a number of options for how to set the price, as listed in Table F-1.

Table F-1:Auction Types
auction type name

description

0 discriminative

price of each cleared offer (bid) is equal to the offered (bid) price

1 LAO

uniform price equal to the last accepted offer

2 FRO

uniform price equal to the first rejected offer

3 LAB

uniform price equal to the last accepted bid

4 FRB

uniform price equal to the first rejected bid

5 first price

uniform price equal to the offer/bid price of the marginal unit

6 second price

uniform price equal to min(FRO, LAB) if the marginal unit is an offer, or max(FRB, LAO) if it is a bid

7 split-the-difference

uniform price equal to the average of the LAO and LAB

8 dual LAOB

uniform price for sellers equal to LAO, for buyers equal to LAB

Generalizing to a network with possible losses and congestion results in nodal prices λP  which vary according to location. These λP  values can be used to normalize all bids and offers to a reference location by multiplying by a locational scale factor. For bids and offers at bus i  , this scale factor is λrPef∕ λiP  , where λrPef  is the nodal price at the reference bus. The desired uniform pricing rule can then be applied to the adjusted offers and bids to get the appropriate uniform price at the reference bus. This uniform price is then adjusted for location by dividing by the locational scale factor. The appropriate locationally adjusted uniform price is then used for all cleared bids and offers.66 The relationships between the OPF results and the pricing rules of the various uniform price auctions are described in detail in [48].

There are certain circumstances under which the price of a cleared offer determined by the above procedures can be less than the original offer price, such as when a generator is dispatched at its minimum generation limit, or greater than the price cap lim.P.max_cleared_offer. For this reason, all cleared offer prices are clipped to be greater than or equal to the offer price but less than or equal to lim.P.max_cleared_offer. Likewise, cleared bid prices are less than or equal to the bid price but greater than or equal to lim.P.min_cleared_bid.

 F.1 Handling Supply Shortfall
 F.2 Example
 F.3 Smartmarket Files and Functions