<script lang="ts">
    import { A15BerechnungAufwandszahlenGesamtErzeugernutzWaerme } from "#lib/Berechnungen/BedarfsausweisWohnen/A15BerechnungAufwandszahlenGesamtErzeugernutzWaerme.js";
 
   $: result = A15BerechnungAufwandszahlenGesamtErzeugernutzWaerme();
 
 </script>


<div class="overflow-x-auto mt-16">
    <table class="table-auto border-collapse border border-gray-300 w-full text-sm">
      <thead>
        <tr class="bg-gray-200 text-left">
          <th colspan="7" class="border border-gray-300 p-2">
            <h2>Tabelle A.15 — Anlage gesamt</h2>
          </th>
          <tr class="text-center">
            <tr class="bg-gray-200 text-left">
              <th colspan="7" class="border border-gray-300 p-2 text-xl">
                Berechnung der Aufwandszahlen (gesamt) und Erzeugernutzwärmeabgabe
              </th>
            </tr> 
          <tr>
            <th class="border border-gray-300 px-4 py-2">Nutzenergie-<br>bedarf</th>  
            <th class="border border-gray-300 px-4 py-2">Übergabe</th>
            <th class="border border-gray-300 px-4 py-2">Verteilung</th>
            <th class="border border-gray-300 px-4 py-2">Speicherung</th>
            <th class="border border-gray-300 px-4 py-2">
              Flächenbezogene<br>Erzeugernutzwärmeabgabe
            </th>
            <th class="border border-gray-300 px-4 py-2">Erzeugung</th>
            <th class="border border-gray-300 px-4 py-2">Gesamt</th>
          </tr>
          <tr>
            <td class="border border-gray-300 px-4 py-2 text-center">Q<sub>h,nutz,m</sub> =<br>Q<sub>h,b</sub> · A<sub>h,m</sub><sub> / A</sub><br>[kWh/a]<br>aus Tabelle A.12, A.14</td>
            <th class="border border-gray-300 px-4 py-2">e<sub>ce</sub></th>
            <th class="border border-gray-300 px-4 py-2">e<sub>d</sub></th>
            <th class="border border-gray-300 px-4 py-2">e<sub>s</sub></th>
            <th class="border border-gray-300 px-4 py-2">
              q<sub>outg</sub><sup>a</sup> = Q<sub>nutz</sub> / A<sub>NGF</sub> &middot; e<sub>ce</sub> &middot; e<sub>d</sub> &middot; e<sub>s</sub>
            <br>[kWh/m²a]</th>
            <th class="border border-gray-300 px-4 py-2">e<sub>g</sub></th>
            <th class="border border-gray-300 px-4 py-2">
              e<sub>ges</sub> = e<sub>ce</sub> &middot; e<sub>d</sub> &middot; e<sub>s</sub> &middot; e<sub>g</sub>
            </th>
          </tr>
      </thead>
      
      <tbody>
        <tr class="h-10">
          <td class="border border-gray-300 px-4 py-2 bg-yellow-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-yellow-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-yellow-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-yellow-100"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2 bg-yellow-100"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
        </tr>
        <tr class="h-10">
          <td class="border border-gray-300 px-4 py-2 bg-yellow-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-yellow-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-yellow-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-yellow-100"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2 bg-yellow-100"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
        </tr>
        <tr class="h-10">
          <td class="border border-gray-300 px-4 py-2 bg-yellow-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-yellow-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-yellow-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-yellow-100"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2 bg-yellow-100"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
        </tr>
        <tr class="h-10">
          <td class="border border-gray-300 px-4 py-2 bg-yellow-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-yellow-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-yellow-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-yellow-100"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2 bg-yellow-100"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
        </tr>
      </tbody>

      <thead>
        <tr>
          <th colspan="7" class="border border-gray-300 px-4 py-2"></th>
        </tr>
        <tr>
          <th class="border border-gray-300 px-4 py-2"></th>
          <th class="border border-gray-300 px-4 py-2">Deckungsanteil erneuerbare Energie (Abschnitt 6.6.1.1)</th>
          <th class="border border-gray-300 px-4 py-2">Deckungsanteil Erzeuger (Tabelle 75)</th>
          <th class="border border-gray-300 px-4 py-2">Endenergie (brennwertbezogen)</th>
          <th class="border border-gray-300 px-4 py-2">Umrechnungsfaktor für die Endenergie</th>
          <th class="border border-gray-300 px-4 py-2">Primärenergiefaktor</th>
          <th class="border border-gray-300 px-4 py-2">Primärenergie (heizwertbezogen)</th>
        </tr>
        <tr>
          <th class="border border-gray-300 px-4 py-2"></th>
          <th class="border border-gray-300 px-4 py-2">K<sub>EE</sub></th>
          <th class="border border-gray-300 px-4 py-2">K<sub>g</sub></th>
          <th class="border border-gray-300 px-4 py-2">
            Q<sub>f</sub> = Q<sub>nutz</sub> · e<sub>ges</sub> · (1 - K<sub>EE</sub>) · K<sub>g</sub>
          </th>
          <th class="border border-gray-300 px-4 py-2">f<sub>HS/HI</sub></th>
          <th class="border border-gray-300 px-4 py-2">f<sub>p</sub></th>
          <th class="border border-gray-300 px-4 py-2">
            Q<sub>p</sub> = (Q<sub>f</sub> / f<sub>HS/HI</sub>) · f<sub>p</sub>
          </th>
        </tr>
      </thead>
      <tbody>
        <tr class="h-10">
          <td class="border border-gray-300 px-4 py-2"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
        </tr>
        <tr class="h-10">
          <td class="border border-gray-300 px-4 py-2"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
        </tr>
        <tr class="h-10">
          <td class="border border-gray-300 px-4 py-2"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
        </tr>
        <tr class="h-10">
          <td class="border border-gray-300 px-4 py-2"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
        </tr>
        <tr>
          <th colspan="7" class="border border-gray-300 px-4 py-2"></th>
        </tr>
      </tbody>

      <thead>
        <tr class="bg-gray-200 text-left">
          <tr class="text-center">
            <tr class="bg-gray-300 text-left">
              <th colspan="7" class="border border-gray-300 p-2 text-xl">
                Berechnung der Hilfsenergie
              </th>
            </tr> 
            <tr>
              <th class="border border-gray-300 px-4 py-2"></th>
              <th class="border border-gray-300 px-4 py-2">W<sub>ce</sub><br>[kWh/a]</th>
              <th class="border border-gray-300 px-4 py-2">W<sub>d</sub><br>[kWh/a]</th>
              <th class="border border-gray-300 px-4 py-2">W<sub>s</sub><br>[kWh/a]</th>
              <th class="border border-gray-300 px-4 py-2"></th>
              <th class="border border-gray-300 px-4 py-2">W<sub>g</sub><br>[kWh/a]</th>
              <th class="border border-gray-300 px-4 py-2">
                W<sub>ges</sub> = W<sub>ce</sub> + W<sub>d</sub> + W<sub>s</sub> + W<sub>g</sub><br>[kWh/a]
              </th>
            </tr>
      </thead>
      
      <tbody>
        <tr class="h-10">
          <th class="border border-gray-300 px-4 py-2"></th>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border border-gray-300 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
        </tr>
        <tr class="h-10">
          <th class="border border-gray-300 px-4 py-2"></th>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border border-gray-300 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
        </tr>
        <tr class="h-10">
          <th class="border border-gray-300 px-4 py-2"></th>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border border-gray-300 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
        </tr>
        <tr class="h-10">
          <th class="border border-gray-300 px-4 py-2"></th>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border border-gray-300 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
        </tr>
      </tbody>
      <thead>
        <tr>
          <th colspan="7" class="border border-gray-300 px-4 py-2"></th>
        </tr>
        <tr>
          <th class="border border-gray-300 px-4 py-2"></th>
          <th class="border border-gray-300 px-4 py-2"></th>
          <th class="border border-gray-300 px-4 py-2"></th>
          <th class="border border-gray-300 px-4 py-2">W<sub>f</sub> = W<sub>ges</sub></th>
          <th class="border border-gray-300 px-4 py-2">f<sub>HS/HI</sub></th>
          <th class="border border-gray-300 px-4 py-2">f<sub>p</sub></th>
          <th class="border border-gray-300 px-4 py-2">W<sub>p</sub> = (W<sub>f</sub> / f<sub>HS/HI</sub>) · f<sub>p</sub></th>
        </tr>
      </thead>
      <tbody>
        <tr class="h-10">
          <td class="border border-gray-300 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
        </tr>
        <tr class="h-10">
          <td class="border border-gray-300 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
        </tr>
        <tr class="h-10">
          <td class="border border-gray-300 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
        </tr>
        <tr class="h-10">
          <td class="border border-gray-300 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
        </tr>
      </tbody>
    </table>
  </div>
  <div class="overflow-x-auto mt-2">
    <table class="table-auto border-collapse border border-gray-300 w-full text-left text-sm">
      <thead class="bg-gray-300">
        <tr>
          <th colspan="6" class="border border-gray-300 p-2 text-xl">Berechnung der Kühlung</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td class="border border-gray-300 px-4 py-2 w-1/12">Gekühlte<br>Nutzfläche</td>
          <td class="border border-gray-300 px-4 py-2 w-1/12">A<sub>N,c</sub> [m²]</td>
          <td class="border border-gray-300 px-4 py-2 w-1/12 bg-yellow-100"></td>
          <td class="border border-gray-300 px-4 py-2 w-1/6">Flächenbezogener<br>Nutzenergiebedarf</td>
          <td class="border border-gray-300 px-4 py-2 w-1/6">q<sub>rc,b</sub> [kWh/m²a]</td>
          <td class="border border-gray-300 px-4 py-2 bg-yellow-100 w-1/6"></td>
        </tr>
        <tr>
          <td class="border border-gray-300 px-4 py-2">Teilkühlfaktor</td>
          <td class="border border-gray-300 px-4 py-2">
            f<sub>c,part</sub> =<br>A<sub>N,c</sub> / A<sub>NGF</sub> [-]
          </td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2">Flächenbezogener<br>Endenergiebedarf<br>mit Tabelle 144</td>
          <td class="border border-gray-300 px-4 py-2">q<sub>rc,f</sub> =<br>q<sub>rc,0</sub> · q<sub>rc,b</sub> / 5 kWh/(m²·a)<br>[kWh/m²a]</td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
        </tr>
        <tr>
          <td class="border border-gray-300 px-4 py-2">Ankühlfaktor<br>aus Tabelle 145</td>
          <td class="border border-gray-300 px-4 py-2">f<sub>c,limit</sub> [-]</td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
          <td class="border border-gray-300 px-4 py-2">Jährlicher<br>Endenergiebedarf</td>
          <td class="border border-gray-300 px-4 py-2">Q<sub>rc,f</sub> =<br>q<sub>rc,f</sub> · A<sub>N,c</sub> · f<sub>c,limit</sub><br>[kWh/m²a]</td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
        </tr>
        <tr>
          <td colspan="3" class="border border-gray-300 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2">Hilfsenergiebedarf<br>mit Tabelle 146</td>
          <td class="border border-gray-300 px-4 py-2">W<sub>rc</sub> = W<sub>pu</sub> + W<sub>fan</sub><br>+ W<sub>rc,ce</sub> + W<sub>c</sub> [kWh/a]</td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
        </tr>
        <tr>
          <td colspan="3" class="border border-gray-300 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2">Primärenergiefaktor</td>
          <td class="border border-gray-300 px-4 py-2">f<sub>p</sub> [-]</td>
          <td class="border border-gray-300 px-4 py-2 bg-blue-100"></td>
        </tr>
        <tr>
          <td colspan="3" class="border border-gray-300 px-4 py-2"></td>
          <td class="border border-gray-300 px-4 py-2">Primärenergiebedarf</td>
          <td class="border border-gray-300 px-4 py-2">Q<sub>P,rc</sub> =<br>(Q<sub>rc,f</sub> + W<sub>rc</sub>) · f<sub>p</sub> [kWh/a]</td>
          <td class="border-2 border-gray-600 px-4 py-2"></td>
        </tr>
      </tbody>
    </table>
  </div>