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) producer surplus
premium = sum E_i * max(0, price_i - wholesale)
A feed-in tariff sets the price and lets quantity follow: every project whose cost is below T gets built and is paid T, so cheap projects earn large rents, and if T is set too high the programme overshoots. An auction sets the quantity and lets competition discover the price: the marginal bid sets p*, and rent is limited to the gap between p* and each winner's own cost. Pay-as-bid removes that rent on paper, but in real auctions bidders then shade their bids up toward the price they expect others to bid, which brings the two formats close together.
Simplifications. Illustrative numbers, not market data. Each project knows its own levelised cost and bids it truthfully; costs are drawn uniformly around €55/MWh and capacities uniformly between 5 and 35 MW; one capacity factor for all projects (wind and solar icons are decorative). Not modelled: financing cost (a fixed tariff lowers investor risk, which in reality lowers cost), winners who never build, penalties, collusion, learning curves, grid and balancing costs, and one-off versus yearly policy dynamics. The ceiling price only removes bids; it never raises the clearing price.
Independent numerical checks compare the code with closed forms and brute force: a Monte-Carlo mean of FiT capacity against n·E[q]·(T−lo)/(hi−lo); the clearing price against an exhaustive search over 16 383 project subsets; the FiT/auction equivalence at p*; the payment = cost + rent identity; and the rent as an integral under the supply curve.
Not run yet.