<script lang="ts">
    import { A6BerechnungWaermeTransferMaxStroemeLueftungGesamt } from "#lib/Berechnungen/BedarfsausweisWohnen/A6BerechnungWaermeTransferMaxStroemeLueftungGesamt.js";
    import { BedarfsausweisWohnenClient, AufnahmeClient } from "#components/Ausweis/types.js";
  
    export let ausweis: BedarfsausweisWohnenClient;
    export let gebaeude_aufnahme: AufnahmeClient;

// Berechnete Werte aus A5
$: result = A6BerechnungWaermeTransferMaxStroemeLueftungGesamt();

</script>



<div class="overflow-x-auto mt-16">
    <table class="table-auto border-collapse border border-gray-300 w-full text-sm">
      <!-- Tabellenkopf -->
      <thead>
        <tr class="bg-gray-200 text-left">
          <th colspan="6" class="border border-gray-300 p-2">
            <h2>Tabelle A.6 – Gebäude – Berechnung Wärmetransferkoeffizienten und maximaler Wärmeströme</h2>
          </th>
        </tr>
        <tr class="bg-gray-200 text-left">
          <th colspan="6" class="border border-gray-300 p-2 text-xl">
            Wärmesenken - gesamt
          </th>
        </tr>
        <tr class="text-center">
          <th class="border border-gray-300 p-2">Bauteil</th>
          <th class="border border-gray-300 p-2">
            Luftwechsel<br>n [1/h]<br>aus Gleichung (33)
          </th>
          <th class="border border-gray-300 p-2">
            Volumen<br>V [m³]<br>aus Tabelle A.5
          </th>
          <th class="border border-gray-300 p-2">
            Wärmekapazität<br> c · ρ [Wh/(m³·K)]
          </th>
          <th class="border border-gray-300 p-2">
            H<sub>V,ges</sub> = n · c · ρ · V [W/K]
          </th>
          <th class="border border-gray-300 p-2">
            maximaler Wärmestrom<br>Q̇<sub>V</sub> = H<sub>V,ges</sub> · ΔΘ<sub>max</sub> [W]
          </th>
        </tr>
      </thead>
  
      <!-- Tabellenkörper -->
      <tbody>
        <!-- Zeile für Lüftung -->
        <tr>
          <td class="border border-gray-300 p-2 text-center">Lüftung</td>
          <td class="border border-gray-300 p-2 bg-blue-100 text-center">{Math.round(result.GesamtLuftwechselN*1000)/1000}</td>
          <td class="border border-gray-300 p-2 text-center bg-yellow-100">{Math.round(result.ObjektNettoVolumenAlternativ*10)/10}</td>
          <td class="border border-gray-300 p-2 text-center bg-gray-200">0,34</td>
          <td class="border-2 border-gray-600 p-2 text-center">{Math.round(result.WaermeTransferKoeffizientLueftungN*100)/100}</td>
          <td class="border-2 border-gray-600 p-2 text-center">{Math.round(result.maximalerWaermestromLueftungN)}</td>
        </tr>
        <!-- Summenzeile
        <tr class="">
          <td class="border border-gray-300 p-2 font-bold text-center">Summen</td>
          <td class="border border-gray-300 p-2"></td>
          <td class="border border-gray-300 p-2"></td>
          <td class="border border-gray-300 p-2"></td>
          <td class="border border-gray-300 p-2"></td>
          <td class="border border-gray-300 p-2"></td>
        </tr>  -->
      </tbody>
    </table>
<br>
        <table class="table-auto border-collapse border border-gray-300 w-full text-sm">
          <!-- Tabellenkopf -->
          <thead>
            <tr class="text-center">
              <th colspan="3" class="border border-gray-300 p-2">
                Gesamter Wärmetransferkoeffizient
              </th>
            </tr>
            <tr class="text-center">
              <th colspan="3" class="border border-gray-300 p-2">
                Wärmetransferkoeffizient H<sub>ges</sub> und maximaler Wärmestrom Q̇<sub>ges</sub>
              </th>
            </tr>
          </thead>
      
          <!-- Tabellenkörper -->
          <tbody>
            <tr>
              <td class="border border-gray-300 p-2 text-center"></td>
              <td class="border border-gray-300 p-2 text-center">H<sub>ges</sub> = H<sub>T,ges</sub> + H<sub>V,ges</sub> [W/K]</td>
              <td class="border border-gray-300 p-2 text-center">Q̇<sub>ges</sub> = H<sub>ges</sub> · ΔΘ<sub>max</sub> [W]</td>
            </tr>
            <tr>
              <td class="border border-gray-300 p-2 font-bold text-center">Gesamtsummen</td>
              <td class="border-2 border-gray-600 p-2 text-center">{Math.round(result.WaermeTransferKoeffizientGesamt*100)/100}</td>
              <td class="border-2 border-gray-600 p-2 text-center">{Math.round(result.maximalerWaermestromGesamt)}</td>
            </tr>
          </tbody>
        </table>
<br>
            <table class="table-auto border-collapse border border-gray-300 w-full text-sm">
              <!-- Tabellenkopf -->
              <thead>
                <tr class="text-center">
                  <th colspan="3" class="border border-gray-300 p-2">Maximale Heizlast und flächenbezugene Heizlast</th>
                </tr>
                <tr class="text-center">
                  <th class="border border-gray-300 p-2">Beschreibung</th>
                  <th colspan="2" class="border border-gray-300 p-2">Werte</th>
                </tr>
              </thead>
          
              <!-- Tabellenkörper -->
              <tbody>
                <tr>
                  <td class="border border-gray-300 p-4">
                    <strong>Ohne mechanische Lüftung:</strong><br>
                    H<sup>*</sup><sub>ges</sub> = H<sub>T,ges</sub> + 0,5 · H<sub>V,ges</sub><br>
                    Φ<sub>h,max</sub> = H<sup>*</sup><sub>ges</sub> · ΔΘ<sub>max</sub> <br>
                    = (H<sub>T,ges</sub> + 0,5 · H<sub>V,ges</sub>) · ΔΘ<sub>max</sub>
                  </td>
                  <td colspan="2" class="border border-gray-300 p-4 text-center">Φ<sub>h,max</sub> (W)</td>
                </tr>
                <tr>
                  <td class="border border-gray-300 p-4">
                    <strong>Mit mechanischer Lüftung:</strong><br>
                    H<sup>*</sup><sub>ges</sub> = H<sub>T,ges</sub> + H<sub>V,ges</sub> - 0,5 · V · c · ρ · (n<sub>WRG=0%</sub> - n<sub>Anl</sub>)<br>
                    Φ<sub>h,max</sub> = H<sup>*</sup><sub>ges</sub> · ΔΘ<sub>max</sub><br>
                    = (H<sub>T,ges</sub> + H<sub>V,ges</sub> - 0,5 · V · c · ρ · (n<sub>WRG=0%</sub> - n<sub>Anl</sub>)) · ΔΘ<sub>max</sub>
                  </td>
                  <td colspan="2" class="border border-gray-300 p-4 text-center">Φ<sub>h,max</sub> (W)</td>
                </tr>
                <tr>
                  <td class="border border-gray-300 p-4 text-left font-bold w-1/3">Maximale Heizlast</td>
                  <td class="border border-gray-300 p-2 text-center w-1/3"></td>
                  <td class="border-2 border-gray-600 p-2 text-center w-1/3">{Math.round(result.maximaleHeizlast)}</td>
                </tr>
                <tr>
                  <td class="p-2 text-left font-bold w-1/3"></td>
                  <td class="p-2 text-center w-1/3"></td>
                  <td class="p-2 text-center w-1/3"></td>
                </tr>
                <tr>
                  <td class="border border-gray-300 p-4 text-left font-bold w-1/3">Flächenbezogene Heizlast</td>
                  <td class="border border-gray-300 p-2 text-center w-1/3"> φ<sub>h,max</sub> = Φ<sub>h,max</sub> / A<sub>NGF</sub> (W/m²)</td>
                  <td class="border-2 border-gray-600 p-2 text-center w-1/3">{Math.round(result.FlaechgenbezogeneHeizlast*100)/100}</td>
                </tr>
              </tbody>
            </table>
<br>
            <table class="table-auto border-collapse border border-gray-300 w-full text-sm">
                <!-- Tabellenkopf -->
                <thead>
                  <tr class="text-center">
                    <th colspan="3" class="border border-gray-300 p-2">Zeitkonstante des Gebäudes</th>
                  </tr>
                  <tr class="text-center">
                    <th class="border border-gray-300 p-2">Gebäudeschwere</th>
                    <th class="border border-gray-300 p-2">C<sub>wirk</sub> <br> Wh/(m²·K)</th>
                    <th class="border border-gray-300 p-2">τ = C<sub>wirk</sub> · A<sub>NGF</sub> / H<sub>ges</sub> <br>[h]</th>
                  </tr>
                </thead>
            
                <!-- Tabellenkörper -->
                <tbody>
                  <tr>
                    <td class="border border-gray-300 p-2 text-center">leicht</td>
                    <td class="border border-gray-300 p-2 text-center bg-gray-100">50</td>
                    <td class="border border-gray-300 p-2 text-center"></td>
                  </tr>
                  <tr>
                    <td class="border border-gray-300 p-2 text-center">mittelschwer</td>
                    <td class="border border-gray-300 p-2 text-center bg-gray-100 ">90</td>
                    <td class="border border-gray-300 p-2 text-center"></td>
                  </tr>
                  <tr>
                    <td class="border border-gray-300 p-2 text-center">schwer</td>
                    <td class="border border-gray-300 p-2 text-center bg-gray-100">130</td>
                    <td class="border border-gray-300 p-2 text-center"></td>
                  </tr>
                  <tr class="h-10">
                    <td class="p-2"></td>
                    <td class="p-2"></td>
                    <td class="border-2 border-gray-600 p-2 text-center">{Math.round(result.ZeitKonstante*100)/100}</td>
                  </tr>
                </tbody>
              </table>

  </div>
<br>
  <div class="flex flex-row items-start p-4">

    <div class="mr-8">
      <p class="text-2xl font-semibold">
       
      </p>
    </div>

    <div>
        <p class="text-lg font-semibold text-left">
          
        </p>
      </div>

    </div>