...
Power grid: power plants, power connections, cities
Market: bid/ask-based market for trading resources and power
Order: bid/ask order to buy/sell resources or power
Merit order: a special kind of order created every tick for every power plant to resolve grid balancing and spot price
Spot price: the highest price offered by merit orders, which were used to satisfy demand
Power Grid
Every city has its own power demand based on its population and percentage of people connected to power. Power demand is calculated for every tick.
Every power plant in city creates merit orders as candidates to satisfy power demand. Some power plants create more than one merit order to create different offers based on produced quantity.
Example:
Power demand is 10 MWh.
Solar power plant creates merit order for 4MWh@$150
Result: Solar power plant will produce 4MWh if weather is sunny and sell energy on market at $150 per MWh which is also spot price for this city for current tick. City is missing 6MWh so it will reduce its population and demand in future ticks.
Example2:
Power demand is 10 MWh.
Solar power plant creates merit order for 4MWh@$150
Coal power plant creates merit order for 8MWh@$230
Result: Solar power plant will produce 4MWh, coal power plant will produce 6 MWh. Tick algorithm will favor offer from Solar power plant because its cheaper. Spot price will by $230 because merit order from coal power plant was at least partially used so maximum price from used orders is $230.
Solar plant owner will receive 4 * 230 = $920
Coal plant owner will receive 6 * 230 = $1380 and also damage for causing overload (2MWh)
City will grow in future ticks because demand was satisfied.