Add off-grid sizing to the Solar calculator

A new "Off-grid sizing" tab sizes a battery system for the darkest month
from a list of devices (watts x hours per day):

- Battery bank for a number of days without sun, for LiFePO4 or lead-acid,
  at 12, 24 or 48 V.  Outdoor lead-acid is enlarged for the cold; outdoor
  lithium warns against charging below 0 C.
- Panels needed, from the worst month's DC production per kW at the chosen
  angle, with a button to apply the count.  A PWM controller's loss (battery
  voltage over the panel's Vmp) raises the count.
- Charge controller current, and the string voltage on the coldest morning
  against the controller's limit, since cold panels exceed their rated Voc.
  The coldest morning defaults to 25 C below the coldest monthly average.

All inputs live in the URL like the rest of the calculator.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Roland 2026-10-04 17:33:55 -06:00
parent b5ea2054c1
commit dfdf3d8166
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
5 changed files with 843 additions and 4 deletions

View file

@ -15,6 +15,7 @@ import {
Statistic,
StatisticGroup,
Table,
Tabs,
TextInput,
Toggle,
} from "../ui";
@ -36,6 +37,7 @@ import {
TRACKING,
} from "./solar";
import {CLIMATOLOGY_SOURCE, lookupClimatology, useClimatology} from "./solarData";
import {SolarOffGrid} from "./SolarOffGrid";
// Every input lives in the URL query so the Share button (which shares window.location.href) shares
// the whole configuration. Values equal to their default are left out to keep the URL, and its QR
@ -526,6 +528,12 @@ export function SolarCalculator() {
() => (ready ? estimateProduction(modelInputs(s, sunlight)) : null),
// eslint-disable-next-line react-hooks/exhaustive-deps
[s, sunlight, ready]);
// Off-grid sizing works from DC production per kW of panels, whatever the inverter setting.
const worstPerKwp = React.useMemo(
() => (ready ? estimateProduction({...modelInputs(s, sunlight), kwp: 1, inverter: null}).worst : null),
// eslint-disable-next-line react-hooks/exhaustive-deps
[s, sunlight, ready]);
const tab = get('tab') === 'offgrid' ? 'offgrid' : 'estimate';
const angleTitle = s.tracking === 'fixed'
? `Panel angle: ${s.tilt}° tilt, facing ${compassLabel(s.azimuth)}`
@ -544,10 +552,23 @@ export function SolarCalculator() {
<LocationSection get={get} set={set} s={s} climatology={climatology}/>
<PanelsSection setNumber={setNumber} s={s}/>
{ready && <Results result={result} s={s}/>}
{!ready && !waitingForData && <div style={{marginTop: '1em'}}>
<Message kind='info' title='Almost there'>Enter {missing.join(', ')} to see an estimate.</Message>
</div>}
<Tabs value={tab} onChange={v => set({tab: v === 'offgrid' ? v : null})} keepMounted={false}
style={{marginTop: '1.5em'}}>
<Tabs.List>
<Tabs.Tab value='estimate'>Estimate</Tabs.Tab>
<Tabs.Tab value='offgrid'>Off-grid sizing</Tabs.Tab>
</Tabs.List>
<Tabs.Panel value='estimate'>
{ready && <Results result={result} s={s}/>}
{!ready && !waitingForData && <div style={{marginTop: '1em'}}>
<Message kind='info' title='Almost there'>Enter {missing.join(', ')} to see an estimate.</Message>
</div>}
</Tabs.Panel>
<Tabs.Panel value='offgrid'>
<SolarOffGrid get={get} set={set} setNumber={setNumber} s={s} worst={worstPerKwp}
temperatures={sunlight?.temperature}/>
</Tabs.Panel>
</Tabs>
<Header as='h3' style={{marginTop: '1.5em'}}>Fine-tune (optional)</Header>
<Accordion multiple>