<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Mosaic Solutions]]></title><description><![CDATA[Mosaic Solutions]]></description><link>https://mosaicsolutions.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 19:03:24 GMT</lastBuildDate><atom:link href="https://mosaicsolutions.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Sizing a home battery with 8,760 hours of open data (and ~30 lines of TypeScript)]]></title><description><![CDATA[Most "how big should my home battery be?" calculators online use one rule of thumb, something like "take your daily consumption and multiply by 1.5". We…]]></description><link>https://mosaicsolutions.hashnode.dev/sizing-a-home-battery-with-8-760-hours-of-open-data-and-30-lines-of-typescript</link><guid isPermaLink="true">https://mosaicsolutions.hashnode.dev/sizing-a-home-battery-with-8-760-hours-of-open-data-and-30-lines-of-typescript</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[open data]]></category><category><![CDATA[Energy]]></category><category><![CDATA[webdev]]></category><dc:creator><![CDATA[Mosaic Solutions]]></dc:creator><pubDate>Wed, 11 Nov 2026 14:28:35 GMT</pubDate><content:encoded><![CDATA[<p>Most "how big should my home battery be?" calculators online use one rule of thumb, something like <em>"take your daily consumption and multiply by 1.5"</em>. We wanted to replace that with a real year: every hour of household demand and every hour of solar output, run through a simple battery model. It runs client-side in the browser, the input data is public, and the result has a clear knee in the curve.</p>
<p>Some context on why this matters right now: the Netherlands ends net metering (<em>salderingsregeling</em>) on 1 January 2027. From then on, solar power you export is no longer offset 1:1 against power you import. That makes every kWh you consume yourself worth more, which is exactly what a battery is for. (<a href="https://opslagraad.nl/saldering-stopt-2027">What changes on 1 January 2027</a> has the legal references.)</p>
<h2>The data</h2>
<p>Two open sources, both hourly:</p>
<ol>
<li><strong>Demand:</strong> the NEDU / Energiedatawijzer standard profile for 2026 (v1.00), column <code>E1B_AZI_A</code>. This is a small consumer with a smart meter and no feed-in, so it describes gross household demand without solar. The profile comes in 15-minute fractions. We sum those into 8,760 hourly fractions that add up to 1, then scale them to any annual consumption.</li>
<li><strong>Solar:</strong> PVGIS v5.3 <code>seriescalc</code> from the EU Joint Research Centre, database PVGIS-SARAH3, location De Bilt (52.101, 5.178), 1 kWp, 14% system loss. We have two orientations: south at 35°, and east-west at 15° (the average of 0.5 kWp east plus 0.5 kWp west). There are three weather years, 2021, 2022 and 2023, and all timestamps are converted from UTC to CET.</li>
</ol>
<pre><code class="language-text">https://re.jrc.ec.europa.eu/api/v5_3/seriescalc?lat=52.101&amp;lon=5.178&amp;peakpower=1&amp;loss=14
  &amp;angle=35&amp;aspect=0&amp;startyear=2021&amp;endyear=2023&amp;pvcalculation=1&amp;outputformat=json
  &amp;raddatabase=PVGIS-SARAH3
</code></pre>
<p>One kWp in De Bilt produced 959 kWh (2021), 1,128 kWh (2022) and 1,006 kWh (2023) facing south. Facing east-west it produced 802, 918 and 851 kWh. The preprocessed files are small JSON arrays of integers and are publicly served by the site (<code>/data/batterij/profiel-2026.json</code>, <code>/data/batterij/pv-2023.json</code>).</p>
<h2>The model</h2>
<p>The rules are deliberately simple. The battery only charges from solar surplus and only discharges into the house's own demand. There's no grid charging and no trading. Round-trip efficiency is split evenly over charge and discharge (√η each way), and there's a power limit in kW.</p>
<pre><code class="language-ts">export function simulate({ demandKWh, solarKWh, profile, pv, cap, power, efficiency }: SimIn) {
  const kPv = solarKWh / pv.reduce((a, b) =&gt; a + b, 0);
  const kL = demandKWh / profile.reduce((a, b) =&gt; a + b, 0);
  const eta = Math.sqrt(efficiency);
  let soc = 0, direct = 0, fromBattery = 0, exported = 0, imported = 0;

  for (let h = 0; h &lt; 8760; h++) {
    const load = profile[h] * kL, gen = pv[h] * kPv;
    const d = Math.min(load, gen);
    let surplus = gen - d, deficit = load - d, out = 0;
    if (cap &gt; 0) {
      const charge = Math.min(surplus, power, (cap - soc) / eta);
      soc += charge * eta; surplus -= charge;
      out = Math.min(deficit, power, soc * eta);
      soc -= out / eta; deficit -= out;
    }
    direct += d; fromBattery += out; exported += surplus; imported += deficit;
  }
  return { direct, fromBattery, exported, imported,
           selfConsumption: (direct + fromBattery) / solarKWh,
           cycles: cap &gt; 0 ? fromBattery / cap : 0 };
}
</code></pre>
<p>A full year is only 8,760 loop iterations, cheap enough in a browser that we can simulate every capacity from 0 to 20 kWh on each slider move and draw the full curve, not just one point.</p>
<h2>Results for a typical Dutch household</h2>
<p>Inputs: 3,500 kWh demand, 3,500 kWh solar yield, a 3 kW battery, 90% round-trip efficiency. The battery sizes are usable capacity.</p>
<table>
<thead>
<tr>
<th>Weather year / orientation</th>
<th>No battery</th>
<th>5 kWh</th>
<th>8 kWh</th>
<th>20 kWh</th>
<th>"Knee" (90% of max gain)</th>
</tr>
</thead>
<tbody><tr>
<td>2021, south</td>
<td>36.8%</td>
<td>65.7%</td>
<td>69.1%</td>
<td>72.7%</td>
<td>8 kWh</td>
</tr>
<tr>
<td>2022, south</td>
<td>36.6%</td>
<td>66.6%</td>
<td>69.5%</td>
<td>71.5%</td>
<td>6 kWh</td>
</tr>
<tr>
<td>2023, south</td>
<td>36.2%</td>
<td>64.1%</td>
<td>67.2%</td>
<td>69.7%</td>
<td>7 kWh</td>
</tr>
<tr>
<td>2023, east-west</td>
<td>38.0%</td>
<td>61.8%</td>
<td>63.2%</td>
<td>63.9%</td>
<td>5 kWh</td>
</tr>
</tbody></table>
<p><em>Share of solar output consumed on site. Recomputed on 11 Nov 2026 from the public data files.</em></p>
<p>Three takeaways:</p>
<ul>
<li><strong>The first kWh are worth a lot, the later ones barely anything.</strong> In 2023 with south-facing panels, going from 5 to 6 kWh adds about 51 kWh per year of self-consumed solar. Going from 10 to 11 kWh adds about 10 kWh.</li>
<li><strong>The knee sits at 5-8 kWh.</strong> Above it, all the extra capacity up to 20 kWh adds only the last ~10% of the possible gain. The reason: a battery charged only from solar cycles at most about once a day, the evening and night demand of a 3,500 kWh household is limited, and in winter there's hardly any surplus to store.</li>
<li><strong>East-west panels need less storage.</strong> Their output is spread more evenly over the day, so more is used directly (38% vs 36%) and there's less surplus to shift. The knee falls at 5 kWh.</li>
</ul>
<p>One number that sanity-checks the model: a 5 kWh battery does about 196 full cycles a year in this setup. That's far below the several thousand cycles LFP battery datasheets typically quote. For home use, calendar ageing will usually matter more than cycle ageing.</p>
<h2>Limitations (we say so on the page too)</h2>
<ul>
<li>A standard profile is an average. A household with a heat pump or an EV has a different shape, especially in winter.</li>
<li>There's no dynamic tariffs and no grid charging. Those strategies can earn money with a battery even without solar surplus, and this model ignores them on purpose.</li>
<li>It uses one location (De Bilt). For the Netherlands that's a reasonable proxy, but it's not your roof.</li>
</ul>
<h2>Try it / reuse it</h2>
<p>The interactive version, with sliders for demand, yield, orientation, weather year, power and efficiency, runs on Opslagraad: <a href="https://opslagraad.nl/thuisbatterij-capaciteit-berekenen">home battery capacity simulator (Dutch)</a>. The data files are open, so you can rebuild them from NEDU and PVGIS with the steps above.</p>
<p><em>Written by Mosaic Solutions, the Dutch publisher of Opslagraad and other independent comparison sites. Opslagraad earns from installer quote requests. The simulator works the same whether or not you request a quote.</em></p>
]]></content:encoded></item></channel></rss>