Matpower3 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 oﬀers to sell and bids to buy and use Matpower’s optimal
power ﬂow 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
PowerWeb^{65}
but has not been widely tested in other contexts.

The smart market algorithm consists of the following basic steps:

1.

Convert block oﬀers and bids into corresponding generator capacities and costs.

2.

Run an optimal power ﬂow with decommitment option (uopf) to ﬁnd generator
allocations and nodal prices ().

3.

Convert generator allocations and nodal prices into set of cleared oﬀers and
bids.

4.

Print results.

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

Oﬀer blocks must be in non-decreasing order of price and the oﬀer must correspond to
a generator with 0 PMINPMAX. A set of price limits can be speciﬁed via the lim
struct, e.g. and oﬀer price cap on real energy would be stored in lim.P.max_offer.
Capacity oﬀered 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 PMINPMAX 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 speciﬁed by a Matpowercase ﬁle, with the gen and gencost matrices
modiﬁed 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 oﬀer/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 oﬀer stacks and
ﬁnding the intersection point. The nodal prices () 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 oﬀer (LAO) or the last accepted bid (LAB), depending
which is the marginal block (i.e. the one that is split by intersection of the oﬀer
and bid stacks). There is often a gap between the last accepted bid and the last
accepted oﬀer. 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 oﬀer (bid) is equal to the oﬀered (bid)price

1

LAO

uniform price equal to the last accepted oﬀer

2

FRO

uniform price equal to the ﬁrst rejected oﬀer

3

LAB

uniform price equal to the last accepted bid

4

FRB

uniform price equal to the ﬁrst rejected bid

5

ﬁrst price

uniform price equal to the oﬀer/bid price of the marginalunit

6

second price

uniform price equal to min(FRO, LAB) if the marginal unitis an oﬀer, or max(FRB, LAO) if it is a bid

7

split-the-diﬀerence

uniform price equal to the average of the LAO and LAB

8

dual LAOB

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

Generalizing to a network with possible losses and congestion results in nodal prices
which vary according to location. These values can be used to normalize all bids
and oﬀers to a reference location by multiplying by a locational scale factor. For bids and
oﬀers at bus , this scale factor is , where is the nodal price at the
reference bus. The desired uniform pricing rule can then be applied to the adjusted oﬀers
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
oﬀers.^{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 oﬀer determined by
the above procedures can be less than the original oﬀer 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 oﬀer prices are clipped to be greater
than or equal to the oﬀer 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.