Calculate Power Plant Economics and Renewable Breakeven
Math & Bit ManipulationAuto-graded · 15 test casesLast updated
Tests break-even analysis, contribution margin calculations, capacity constraints, and financial comparison of energy generation alternatives.
A power generation company operates a conventional plant and is evaluating renewable alternatives. You must calculate the production volume needed to meet profit targets, assess policy constraints, and compare two renewable test facilities.
Write a function that takes the financial parameters of a conventional power plant and two renewable test plants (solar and ethanol), then returns:
-
Required production volume: How many MWh the conventional plant must generate annually to achieve a target profit equal to a specified fraction of its initial capital investment.
-
Capacity checks: Whether the required volume fits within the plant's maximum capacity and within a regulatory generation cap.
-
Solar test plant metrics: Expected annual output (accounting for weather variability), annual profit, and payback period in years.
-
Ethanol test plant metrics: Annual profit and payback period in years.
-
Recommendation: Which test plant to pursue if capital is unlimited, based on annual profit.
Conventional Plant Economics
The plant has:
- Maximum annual capacity (MWh)
- Monthly lease payment (millions of dollars)
- Annual fixed operating costs (millions of dollars)
- Variable cost per MWh generated
- Revenue per MWh sold
- Initial capital investment (millions of dollars)
The target annual profit is a fraction of the initial investment (e.g., 0.1 means 10% return).
To find required volume, solve:
Volume × (Revenue - Variable Cost) = Annual Lease + Annual Fixed Costs + Target Profit
Annual lease cost = Monthly lease × 12
Solar Test Plant
The solar facility has:
- Capital expenditure (millions of dollars)
- Probability of sunny conditions
- Annual output during sunny conditions (MWh)
- Annual output during cloudy conditions (MWh)
- Revenue per MWh (no variable costs)
Expected annual output = (Sunny Probability × Sunny Output) + ((1 - Sunny Probability) × Cloudy Output)
Annual profit = Expected Output × Revenue per MWh (converted to millions)
Payback period = Capital expenditure / Annual profit
Ethanol Test Plant
The ethanol facility has:
- Capital expenditure (millions of dollars)
- Fixed annual output capacity (MWh)
- Variable cost per MWh
- Revenue per MWh
Annual profit = Output × (Revenue - Variable Cost) (converted to millions)
Payback period = Capital expenditure / Annual profit
Recommendation Logic
Choose the test plant with higher annual profit. If profits are equal, prefer solar.
Constraints
- All monetary inputs in millions except per-MWh costs/revenues (in dollars)
- 0 < capacity ≤ 10,000,000 MWh
- 0 < investment_recovery_fraction ≤ 1
- 0 ≤ solar_sunny_probability ≤ 1
- All costs, revenues, and outputs are positive
- Payback periods are computed assuming profits remain constant
Examples
Example 1
Input: calculate_power_economics(8800000, 5, 25, 20, 40, 400, 0.1, 5000000, 12.5, 0.75, 150000, 50000, 40, 2.5, 100000, 30, 40)
Output: {'required_fossil_mwh': 6250000, 'within_capacity': True, 'within_policy_cap': False, 'solar_expected_annual_output_mwh': 125000, 'solar_annual_profit_m': 5, 'solar_payback_years': 2.5, 'ethanol_annual_profit_m': 1, 'ethanol_payback_years': 2.5, 'recommended_test_plant': 'solar'}
Hints
Hint 1
Calculate total annual fixed costs by combining the annualized lease with other fixed costs
Hint 2
Use contribution margin (revenue minus variable cost) to find the volume needed for target profit
Hint 3
Compare renewable options on annual profit, not just payback period, when capital is unlimited
Worked solution
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Approach
This problem requires computing financial metrics for power generation facilities using standard break-even and payback formulas.
Conventional plant volume requirement:
First, determine total annual fixed costs by converting the monthly lease to annual (multiply by 12) and adding other fixed costs. The target annual profit is the initial investment multiplied by the recovery fraction.
Use the contribution margin approach: each MWh sold contributes (revenue - variable cost) toward covering fixed costs and profit. The required volume solves:
Volume = (Total Annual Fixed Costs + Target Profit) / Contribution Margin
Check this volume against both the physical capacity limit and any regulatory generation cap.
Solar test plant:
Solar output depends on weather. Calculate expected annual output as the probability-weighted average of sunny and cloudy scenarios. Since solar has no variable costs, all revenue is profit. Divide capital expenditure by annual profit to get the payback period.
Ethanol test plant:
Ethanol runs at a fixed annual output with a variable cost per MWh. Annual profit is the output multiplied by the margin (revenue - variable cost). Payback period is capital expenditure divided by annual profit.
Recommendation:
When capital is unlimited, total value matters more than payback speed. Choose the plant with higher annual profit, as it generates more absolute return. If profits are equal, default to solar.
Complexity
- Time complexity: O(1) — all operations are arithmetic calculations
- Space complexity: O(1) — fixed-size output dictionary
Solution
from typing import Dict
def calculate_power_economics(capacity_mwh, monthly_lease_m, yearly_fixed_cost_m, variable_cost_per_mwh, revenue_per_mwh, initial_investment_m, investment_recovery_fraction, fossil_generation_cap_mwh, solar_capex_m, solar_sunny_probability, solar_sunny_output_mwh, solar_cloudy_output_mwh, solar_price_per_mwh, ethanol_capex_m, ethanol_output_mwh, ethanol_variable_cost_per_mwh, ethanol_price_per_mwh):
# Calculate annual lease cost from monthly payments
lease_cost_m = monthly_lease_m * 12
# Target profit as fraction of initial investment
annual_recovery_m = initial_investment_m * investment_recovery_fraction
# Contribution margin per MWh
contribution_per_mwh = revenue_per_mwh - variable_cost_per_mwh
# Required volume: (Fixed Costs + Target Profit) / Contribution Margin
# Convert millions to dollars for calculation
required_fossil_mwh = (lease_cost_m + yearly_fixed_cost_m + annual_recovery_m) * 1_000_000 / contribution_per_mwh
# Solar calculations
solar_output = solar_sunny_probability * solar_sunny_output_mwh + (1 - solar_sunny_probability) * solar_cloudy_output_mwh
solar_annual_profit_m = solar_output * solar_price_per_mwh / 1_000_000
solar_payback_years = solar_capex_m / solar_annual_profit_m
# Ethanol calculations
ethanol_annual_profit_m = ethanol_output_mwh * (ethanol_price_per_mwh - ethanol_variable_cost_per_mwh) / 1_000_000
ethanol_payback_years = ethanol_capex_m / ethanol_annual_profit_m
return {
"required_fossil_mwh": required_fossil_mwh,
"within_capacity": required_fossil_mwh <= capacity_mwh,
"within_policy_cap": required_fossil_mwh <= fossil_generation_cap_mwh,
"solar_expected_annual_output_mwh": solar_output,
"solar_annual_profit_m": solar_annual_profit_m,
"solar_payback_years": solar_payback_years,
"ethanol_annual_profit_m": ethanol_annual_profit_m,
"ethanol_payback_years": ethanol_payback_years,
"recommended_test_plant": "solar" if solar_annual_profit_m >= ethanol_annual_profit_m else "ethanol"
}