---
name: energy
description: Energy math on the person's own numbers. Convert units, measure a load and price it on their tariff, move flexible jobs to cheaper or cleaner hours, size solar and batteries, compare fixed and floating supply and settle hedges, work out generation cost, and run mining or other flexible loads only when they pay. Never invent a price, sign, trade or wire anything. Use when a task converts energy units, measures or prices a load, schedules a flexible job, sizes solar or batteries, compares supply contracts or hedges, works out generation cost, or runs mining or another flexible load.
license: MIT
metadata:
  version: "1.0"
  homepage: https://energy.md
  api: https://energy.md/api/v1 (optional, no key, stores nothing)
  mcp: https://energy.md/mcp
  terms: https://energy.md/terms
---

# Energy

Provided as is, at your own risk: figures are estimates from the numbers you use and may be wrong, and nothing here is trading, investment, legal, tax, engineering, electrical or safety advice, a quote, or an offer. Terms: https://energy.md/terms.

Work out energy, power, cost and emissions with the person's own numbers: their tariffs, prices, quotes, profiles and factors. Show your math once, in a short block. Say what is cheaper, cleaner or within limits on the numbers given; never say what the person should buy, sign or trade. Skip routine narration.

When this file has a "Your rules" section, those rules win over the defaults below. Each rule there ends with its setting key in brackets, like (hedge_ratio_max), and this file names rules by that key. Settings you drafted or changed yourself count only after the person says yes.

The tools are optional and do arithmetic only. Call them by GET or POST at `https://energy.md/api/v1/<tool>`, or as MCP tools at `https://energy.md/mcp`. In a GET, put arrays and objects in the query as URL-encoded JSON (`curl -G --data-urlencode` does this); in a POST, send the same fields as a JSON body. Every result has a `summary`, the `formula` used, `assumptions` and `not_checked`. Read `not_checked` before you report.

## 1. Units first

- Power is a rate (W, kW, MW). Energy is an amount (Wh, kWh, MWh). Energy = power x hours. A 7 kW charger running 3 hours uses 21 kWh.
- A bill charges kWh for energy and, on many business tariffs, $ per kW for the highest demand in the period. Keep the two apart.
- MW vs MWh is the most common mix-up in plant, contract and battery figures. A "100 MW / 400 MWh" battery delivers 100 MW for about 4 hours. Ask which one a number is when the text is unclear.
- Heat and fuel: 1 therm = 100,000 BTU. 1 MMBtu = 1,000,000 BTU = 10 therms. 1 kWh = 3,412 BTU. 1 MWh = 3.412 MMBtu.
- Fuel to energy uses typical heat contents. Real fuel varies; say "typical" and use the person's own figure when they have one.
- Optional tool: `energy_units`. It converts energy, power and fuel units, and flags a power-to-energy conversion that has no hours.

```bash
curl -s "https://energy.md/api/v1/energy_units?value=1500&from=kWh&to=MMBtu"
```

## 2. Measure the load

- List every device: count, watts, hours per day, and duty (the share of those hours it actually draws). Use nameplate or measured watts from the person; say which.
- Daily kWh = count x watts x hours per day x duty / 1,000. Multiply by the overhead factor for cooling or facility overhead (a PUE-style multiplier: 1.3 means 30% on top).
- Peak kW is the running draw of everything that can be on at once (count x watts x duty x overhead / 1,000 for each device on in the same hour), not daily kWh spread over the day. Average kW = daily kWh / 24. Load factor = average kW / peak kW. A low load factor means demand charges weigh more.
- Give on_hours (like "8-18") for every device that doesn't run all day: it makes time-of-use and demand bills exact. Without it, the tool spreads that device's energy over 24 hours for time-of-use pricing, counts its full draw as on at the peak, and says so in `not_checked`.
- Servers, GPUs and other compute are loads like any other: watts x hours. Use the measured draw under the real workload when the person has it, not only the rated maximum.
- Optional tool: `load_energy`. It returns kWh per day, month and year, peak and average kW, load factor, a bill for each tariff and emissions.

```bash
curl -sG "https://energy.md/api/v1/load_energy" \
  --data-urlencode 'devices=[{"label":"GPU server","count":4,"watts":1500,"hours_per_day":24,"duty":0.8},{"label":"office","count":1,"watts":2000,"hours_per_day":10,"on_hours":"8-18"}]' \
  --data-urlencode 'tariffs=[{"label":"flat","fixed_usd_per_month":20,"flat_usd_per_kwh":0.15},{"label":"time of use","fixed_usd_per_month":20,"tou":[{"label":"peak","hours":[16,17,18,19,20],"usd_per_kwh":0.3},{"label":"off-peak","hours":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,21,22,23],"usd_per_kwh":0.1}]}]' \
  --data-urlencode 'overhead_factor=1.2' --data-urlencode 'grid_kg_co2e_per_kwh=0.4'
```

## 3. Price it with the person's tariff

- Use only prices from the person: their bill, tariff sheet, contract or a quote they received. Write down where each price came from.
- Never invent a price, and never look one up on your own. If a price is missing, follow the missing_prices rule; by default, ask. The tools take no default prices and list what they couldn't price under `not_checked`.
- Flat tariff: energy cost = kWh x $/kWh, plus the fixed monthly charge.
- Time-of-use: split the kWh by hour band and price each band. The same kWh can cost very different amounts by hour.
- Demand charge: highest kW in the period x $/kW. One short spike sets it for the whole month. Check the peak before adding a load.
- Compare up to four tariffs at once in `load_energy`. The cheapest one on the person's load is arithmetic, not a switch: changing tariffs or suppliers is the person's call.
- Taxes, riders and fees on a real bill vary. If the person gives them, add them; if not, say the total leaves them out.

## 4. Shift what can wait

- A flexible job is one that only needs to finish by a deadline: charging, batch compute, pumping, heating water, washing. Get its energy (or power and run hours), the earliest start, the deadline, the most it may draw, and whether it may pause.
- Get the person's 24 hourly prices for the day (and hourly carbon factors, if they have them). Never fill in an hour yourself.
- Pick the cheapest hours inside the window. If the job can pause, those can be separate hours; if not, use the cheapest unbroken block.
- Respect the price cap: never use an hour priced above it. If the job can't finish under the cap before the deadline, say so and ask. Never miss a deadline to save money unless the person says yes.
- Compare against starting now, and report the saving in dollars and kg.
- Follow the shift_flexible rule. If it says ask, show the window and wait. Even when it says always, you only plan the hours: set them only through scheduling controls or apps the person gave you for that, never switch equipment yourself, and tell the person what moved.
- Optional tool: `shift_load`. It returns the cheapest window, the cleanest window, and their cost and emissions against starting now.

```bash
curl -sG "https://energy.md/api/v1/shift_load" \
  --data-urlencode 'energy_kwh=60' --data-urlencode 'max_power_kw=20' \
  --data-urlencode 'earliest_hour=6' --data-urlencode 'deadline_hour=18' --data-urlencode 'start_now_hour=6' \
  --data-urlencode 'interruptible=true' --data-urlencode 'max_price_usd_per_kwh=0.25' \
  --data-urlencode 'prices_usd_per_kwh=[0.12,0.11,0.1,0.1,0.1,0.11,0.14,0.18,0.2,0.16,0.12,0.09,0.08,0.08,0.09,0.12,0.22,0.3,0.34,0.32,0.26,0.2,0.16,0.13]'
```

## 5. Carbon

- Emissions = kWh x the person's grid factor (kg CO2e per kWh). Use their factor; there is no built-in one. If they have none, report kWh and say emissions weren't counted.
- When the person gives 24 hourly factors, use them: the cleanest hours are often not the cheapest. Show both windows.
- Keep under the monthly carbon cap if one is set. Report kg per day and per month.
- Say whether a factor is an average or a marginal figure if the person told you. Don't claim a job is "carbon free" or "green"; give the kg.

## 6. Solar and storage

- Size PV from the person's daily load, the share of it to cover, and their site's peak sun hours. PV kW DC = daily kWh x share / (peak sun hours x (1 - system losses)). Losses default to 14%.
- Size the battery for backup (backup load kW x hours) or for an evening shift (kWh moved from day to night). Usable kWh = nominal kWh x depth of discharge. Energy out = energy in x round-trip efficiency.
- Inverter kW must cover the largest load it serves at once.
- Money only on the person's numbers: install cost, battery cost, their tariff and export rate, the share they use on site, degradation, years and discount rate. Simple payback = net cost / first-year savings. NPV discounts each year's savings.
- Incentives, credits and tax treatment depend on the person and where they are. Use only the share they or their tax professional give you.
- A licensed installer, permits and interconnection approval are needed before anything is installed or connected. Sizing here is a first estimate, not a design.
- Optional tool: `solar_storage`.

```bash
curl -s "https://energy.md/api/v1/solar_storage?daily_load_kwh=30&peak_sun_hours=4.5&backup_hours=8&backup_load_kw=1.5&install_usd_per_w=2.5&battery_usd_per_kwh=600&tariff_usd_per_kwh=0.2&export_usd_per_kwh=0.05&self_consumption_share=0.7&discount_rate=0.06"
```

## 7. Procurement and hedges

- Get the volume (MWh, per year or per month), the fixed price the person was offered, and their own floating price scenarios (low, base, high). Never supply a scenario or a forward price yourself.
- Fixed cost = volume x fixed price. Floating cost = volume x (floating price + any adder). Blend = hedge ratio x fixed + (1 - hedge ratio) x floating.
- Break-even: the floating price at which fixed and floating cost the same. Below it, floating is cheaper; above it, fixed is. Show the range of outcomes across the scenarios.
- Contract for difference or virtual PPA, from the buyer's side: settlement to the buyer = (market - strike) x volume. Positive: the seller pays the buyer. Negative: the buyer pays the seller. The seller's figure is the same with the opposite sign. The buyer still buys its power at market, so market cost minus settlement comes to about strike x volume for the hedged volume. hedge_math shows it from `cfd_side` (default buyer) and names the payer in `cfd_payer`: quote that field, and say whose side each sign is from.
- Keep within the hedge_ratio_max rule if set.
- This is educational arithmetic. Never sign, accept, negotiate, trade or commit to anything. At most, prepare the numbers for a person, and only if the contracts rule allows it.
- Optional tool: `hedge_math`.

```bash
curl -sG "https://energy.md/api/v1/hedge_math" \
  --data-urlencode 'volume_mwh=1000' --data-urlencode 'fixed_usd_per_mwh=60' --data-urlencode 'hedge_ratio=0.7' \
  --data-urlencode 'scenarios_usd_per_mwh=[40,60,90]' --data-urlencode 'strike_usd_per_mwh=55'
```

## 8. Generation cost

- Annual MWh = capacity MW x capacity factor x 8,760.
- Capital recovery factor (CRF) = r(1+r)^n / ((1+r)^n - 1), with r the discount rate and n the life in years.
- LCOE ($/MWh) = (capex x CRF + fixed O&M) / annual MWh + variable O&M + fuel. Fuel ($/MWh) = heat rate (MMBtu per MWh) x fuel price ($/MMBtu). A heat rate of 7,000 BTU/kWh is 7 MMBtu/MWh.
- Spark spread (gas) or dark spread (coal) = power price - heat rate x fuel price. Positive means the fuel costs less than the power sells for, before other costs.
- It works the same for solar, wind, hydro, nuclear, gas, coal or anything else; renewables just have no fuel line. All numbers come from the person.
- LCOE leaves out taxes, financing structure, grid costs and revenue timing. Say so.
- Optional tool: `generation_cost`.

```bash
curl -s "https://energy.md/api/v1/generation_cost?capacity_mw=100&capacity_factor=0.55&capex_usd_per_kw=1000&fixed_om_usd_per_kw_year=20&variable_om_usd_per_mwh=3&fuel_usd_per_mmbtu=3&heat_rate_btu_per_kwh=7000&discount_rate=0.07&life_years=30&power_usd_per_mwh=45"
```

## 9. Flexible loads and mining

- Any machine that can stop is a flexible load: hash mining, batch compute, electrolysis, pumping. Run it only in hours where it earns more than its power costs.
- Machine kW = hashrate (TH/s) x efficiency (J/TH) / 1,000, or the person's measured watts. Multiply by the overhead factor for cooling.
- Daily power cost = kW x 24 x uptime x $/kWh. Daily revenue = hashrate x the person's revenue per TH per day. Margin = revenue - power cost.
- Break-even power price = daily revenue / daily kWh. Curtail (switch off) in every hour priced above it.
- Revenue comes only from the person. Never estimate it, and never look up a coin price, a network figure or a pool rate.
- Optional tool: `mining_power`. With 24 hourly prices, it returns the curtailed margin and the hours to run. Switching machines stays with the person's own controls.
- On the round illustrative numbers below (not market data): 26.25 kW, 630 kWh a day, a $49.60 daily margin at $0.08/kWh, break-even $0.1587/kWh, and on the hourly prices it runs 19 of 24 hours (not 16:00 to 21:00) for a $41.37 margin.

```bash
curl -sG "https://energy.md/api/v1/mining_power" \
  --data-urlencode 'machines=10' --data-urlencode 'hashrate_th_per_machine=100' --data-urlencode 'efficiency_j_per_th=25' \
  --data-urlencode 'overhead_factor=1.05' --data-urlencode 'power_usd_per_kwh=0.08' --data-urlencode 'revenue_usd_per_th_day=0.1' \
  --data-urlencode 'prices_usd_per_kwh=[0.06,0.05,0.05,0.04,0.04,0.05,0.07,0.09,0.1,0.09,0.08,0.07,0.07,0.08,0.1,0.12,0.16,0.2,0.24,0.22,0.16,0.12,0.09,0.07]'
```

## 10. Backup and availability

- Runtime (hours) = usable kWh / critical load kW. Size the critical load from the devices that must stay on, not the whole site.
- Battery usable kWh = nominal kWh x depth of discharge; allow for inverter losses.
- Generator runtime = fuel on hand / burn rate at the expected load, from the person's or the maker's figures.
- Check the result against the backup_min_hours rule, and flag any gap.
- Generators, batteries, transfer switches and fuel storage need licensed installation, local codes and safe fuel storage. Never tell anyone how to wire, back-feed or connect a generator or battery.

## 11. Report

- Five to eight lines: what was measured, the key numbers (kWh, peak kW, cost, kg CO2e), the option that is cheapest or cleanest on the numbers given, what is over a limit or needs a yes, what wasn't priced or checked, and the formula used.
- Name the source of every price and factor ("your tariff", "your quote of ...", "typical heat content").
- Call every figure an estimate. Never present it as a quote, a bill or a forecast.
- If a rule needs a yes (a cap, the budget, approval_usd, a contract), stop and ask before anything else happens.

## Never

- Never invent, guess or look up a price, tariff, rate, emission factor, market figure or revenue. Ask, or list it as not priced.
- Never buy, sell or trade energy, capacity, certificates, contracts or derivatives. Never place a bid, an offer or an order.
- Never sign, accept, renew or negotiate a supply contract, PPA or hedge. Any purchase, contract, order or commitment is the person's to make, at any amount; you only prepare the numbers.
- Never wire, physically switch or connect equipment, or give instructions for electrical work. That is licensed professionals' work. Change a schedule only through controls or apps the person gave you, as shift_flexible allows.
- Never present an estimate as a quote, a bill, a forecast, a design or approval to connect.
- Never tell the person what to buy, sign or trade. Say what is cheaper, cleaner or within limits on the numbers given.

## Defaults

When a rule isn't set: ask for any missing price; ask before moving a job's timing; get the person's yes on any plan that spends or commits money, which they then carry out themselves; bill on 30 days; overhead factor 1 for most loads and 1.05 for mining; system losses 14%, depth of discharge 0.9, round-trip efficiency 0.9 and PV degradation 0.5% a year, each labeled as a default; no emissions without the person's factor; never a contract or a trade.
