The science
E_i = q_i * CF * 8760 annual energy of project i (MWh)
FiT: build i iff c_i <= T; pays T for every MWh
Auction: accept cheapest bids until sum q_i >= target
p* = c of the last accepted bid (clearing price)
pay-as-clear: price p* to all; pay-as-bid: price c_i
payment = sum E_i * price_i
rent = sum E_i * (price_i - c_i) = CF*8760 * area between
the price line and the supply curve (gold area)
premium = sum E_i * max(0, price_i - wholesale)
In this view the economics is geometry. Blocks sorted by cost form the merit-order supply curve. A feed-in tariff is a horizontal line you set: everything below it is built and paid the line's height, so the gold area between line and blocks is pure rent. An auction is a vertical line you set (the target): the height of the last block it touches becomes the price, so the line drops as competition gets denser (more projects, narrower spread). The ledger below buys the same megawatts three ways: at the tariff, at the auction's uniform price, and pay-as-bid.
Simplifications. Illustrative numbers, not market data. Each project knows its own levelised cost and bids it truthfully; costs are uniform around €55/MWh, capacities uniform 5–35 MW; one capacity factor for all projects (wind and solar icons are decorative). Not modelled: financing cost and investor risk (a fixed tariff lowers risk, which in reality lowers cost), winners who never build, penalties, collusion, learning curves, grid and balancing costs. In real pay-as-bid auctions bidders shade their bids toward the expected clearing price, so the two auction formats end up closer than this model shows.
Independent numerical checks compare the code with closed forms and brute force: Monte-Carlo FiT capacity vs n·E[q]·(T−lo)/(hi−lo); clearing price vs an exhaustive search over 16 383 subsets; FiT/auction equivalence at p*; payment = cost + rent; rent as the integral under the supply curve; and (specific to this view) the ledger saving at equal MW vs E·(T−p*).
Not run yet.