monatlicher Belastungsgrad
This commit is contained in:
@@ -6,12 +6,12 @@
|
|||||||
|
|
||||||
import { BerechnungMonatlicherBelastungsgradT9 } from "#lib/Berechnungen/BedarfsausweisWohnen/BerechnungMonatlicherBelastungsgradT9.js";
|
import { BerechnungMonatlicherBelastungsgradT9 } from "#lib/Berechnungen/BedarfsausweisWohnen/BerechnungMonatlicherBelastungsgradT9.js";
|
||||||
|
|
||||||
let interpolatedValuesZeitkonstante90: any
|
let interpolatedValues: { month: string, interpolatedValue: number }[] = [];
|
||||||
|
|
||||||
$: {
|
$: {
|
||||||
const result = BerechnungMonatlicherBelastungsgradT9(ausweis, gebaeude_aufnahme)
|
const result = BerechnungMonatlicherBelastungsgradT9();
|
||||||
interpolatedValuesZeitkonstante90 = result.interpolatedValuesZeitkonstante90
|
interpolatedValues = result;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
@@ -63,10 +63,10 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-gray-100">31</td>
|
<td class="border border-gray-300 px-2 py-1 bg-gray-100">31</td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-blue-100"></td>
|
<td class="border border-gray-300 px-2 py-1 bg-blue-100">{interpolatedValues[1]?.month}</td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-gray-100">1,0</td>
|
<td class="border border-gray-300 px-2 py-1 bg-gray-100">1,0</td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-blue-100">
|
<td class="border border-gray-300 px-2 py-1 bg-blue-100">
|
||||||
{Math.round(interpolatedValuesZeitkonstante90[0].interpolatedValue*1000)/1000}
|
{interpolatedValues[1]?.interpolatedValue}
|
||||||
</td>
|
</td>
|
||||||
<td class="border-2 border-gray-600 px-2 py-1"></td>
|
<td class="border-2 border-gray-600 px-2 py-1"></td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-yellow-100"></td>
|
<td class="border border-gray-300 px-2 py-1 bg-yellow-100"></td>
|
||||||
@@ -82,7 +82,7 @@
|
|||||||
<td class="border border-gray-300 px-2 py-1 bg-blue-100"></td>
|
<td class="border border-gray-300 px-2 py-1 bg-blue-100"></td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-gray-100">1,9</td>
|
<td class="border border-gray-300 px-2 py-1 bg-gray-100">1,9</td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-blue-100">
|
<td class="border border-gray-300 px-2 py-1 bg-blue-100">
|
||||||
{Math.round(interpolatedValuesZeitkonstante90[1].interpolatedValue*1000)/1000}
|
|
||||||
</td>
|
</td>
|
||||||
<td class="border-2 border-gray-600 px-2 py-1"></td>
|
<td class="border-2 border-gray-600 px-2 py-1"></td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-yellow-100"></td>
|
<td class="border border-gray-300 px-2 py-1 bg-yellow-100"></td>
|
||||||
@@ -98,7 +98,7 @@
|
|||||||
<td class="border border-gray-300 px-2 py-1 bg-blue-100"></td>
|
<td class="border border-gray-300 px-2 py-1 bg-blue-100"></td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-gray-100">4,7</td>
|
<td class="border border-gray-300 px-2 py-1 bg-gray-100">4,7</td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-blue-100">
|
<td class="border border-gray-300 px-2 py-1 bg-blue-100">
|
||||||
{Math.round(interpolatedValuesZeitkonstante90[2].interpolatedValue*1000)/1000}
|
|
||||||
</td>
|
</td>
|
||||||
<td class="border-2 border-gray-600 px-2 py-1"></td>
|
<td class="border-2 border-gray-600 px-2 py-1"></td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-yellow-100"></td>
|
<td class="border border-gray-300 px-2 py-1 bg-yellow-100"></td>
|
||||||
@@ -114,7 +114,7 @@
|
|||||||
<td class="border border-gray-300 px-2 py-1 bg-blue-100"></td>
|
<td class="border border-gray-300 px-2 py-1 bg-blue-100"></td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-gray-100">9,2</td>
|
<td class="border border-gray-300 px-2 py-1 bg-gray-100">9,2</td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-blue-100">
|
<td class="border border-gray-300 px-2 py-1 bg-blue-100">
|
||||||
{Math.round(interpolatedValuesZeitkonstante90[3].interpolatedValue*1000)/1000}
|
|
||||||
</td>
|
</td>
|
||||||
<td class="border-2 border-gray-600 px-2 py-1"></td>
|
<td class="border-2 border-gray-600 px-2 py-1"></td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-yellow-100"></td>
|
<td class="border border-gray-300 px-2 py-1 bg-yellow-100"></td>
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
<td class="border border-gray-300 px-2 py-1 bg-blue-100"></td>
|
<td class="border border-gray-300 px-2 py-1 bg-blue-100"></td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-gray-100">14,1</td>
|
<td class="border border-gray-300 px-2 py-1 bg-gray-100">14,1</td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-blue-100">
|
<td class="border border-gray-300 px-2 py-1 bg-blue-100">
|
||||||
{Math.round(interpolatedValuesZeitkonstante90[4].interpolatedValue*1000)/1000}
|
|
||||||
</td>
|
</td>
|
||||||
<td class="border-2 border-gray-600 px-2 py-1"></td>
|
<td class="border-2 border-gray-600 px-2 py-1"></td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-yellow-100"></td>
|
<td class="border border-gray-300 px-2 py-1 bg-yellow-100"></td>
|
||||||
@@ -146,7 +146,7 @@
|
|||||||
<td class="border border-gray-300 px-2 py-1 bg-blue-100"></td>
|
<td class="border border-gray-300 px-2 py-1 bg-blue-100"></td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-gray-100">16,7</td>
|
<td class="border border-gray-300 px-2 py-1 bg-gray-100">16,7</td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-blue-100">
|
<td class="border border-gray-300 px-2 py-1 bg-blue-100">
|
||||||
{Math.round(interpolatedValuesZeitkonstante90[5].interpolatedValue*1000)/1000}
|
|
||||||
</td>
|
</td>
|
||||||
<td class="border-2 border-gray-600 px-2 py-1"></td>
|
<td class="border-2 border-gray-600 px-2 py-1"></td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-yellow-100"></td>
|
<td class="border border-gray-300 px-2 py-1 bg-yellow-100"></td>
|
||||||
@@ -162,7 +162,7 @@
|
|||||||
<td class="border border-gray-300 px-2 py-1 bg-blue-100"></td>
|
<td class="border border-gray-300 px-2 py-1 bg-blue-100"></td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-gray-100">19,0</td>
|
<td class="border border-gray-300 px-2 py-1 bg-gray-100">19,0</td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-blue-100">
|
<td class="border border-gray-300 px-2 py-1 bg-blue-100">
|
||||||
{Math.round(interpolatedValuesZeitkonstante90[6].interpolatedValue*1000)/1000}
|
|
||||||
</td>
|
</td>
|
||||||
<td class="border-2 border-gray-600 px-2 py-1"></td>
|
<td class="border-2 border-gray-600 px-2 py-1"></td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-yellow-100"></td>
|
<td class="border border-gray-300 px-2 py-1 bg-yellow-100"></td>
|
||||||
@@ -178,7 +178,7 @@
|
|||||||
<td class="border border-gray-300 px-2 py-1 bg-blue-100"></td>
|
<td class="border border-gray-300 px-2 py-1 bg-blue-100"></td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-gray-100">18,6</td>
|
<td class="border border-gray-300 px-2 py-1 bg-gray-100">18,6</td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-blue-100">
|
<td class="border border-gray-300 px-2 py-1 bg-blue-100">
|
||||||
{Math.round(interpolatedValuesZeitkonstante90[7].interpolatedValue*1000)/1000}
|
|
||||||
</td>
|
</td>
|
||||||
<td class="border-2 border-gray-600 px-2 py-1"></td>
|
<td class="border-2 border-gray-600 px-2 py-1"></td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-yellow-100"></td>
|
<td class="border border-gray-300 px-2 py-1 bg-yellow-100"></td>
|
||||||
@@ -194,7 +194,7 @@
|
|||||||
<td class="border border-gray-300 px-2 py-1 bg-blue-100"></td>
|
<td class="border border-gray-300 px-2 py-1 bg-blue-100"></td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-gray-100">14,3</td>
|
<td class="border border-gray-300 px-2 py-1 bg-gray-100">14,3</td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-blue-100">
|
<td class="border border-gray-300 px-2 py-1 bg-blue-100">
|
||||||
{Math.round(interpolatedValuesZeitkonstante90[8].interpolatedValue*1000)/1000}
|
|
||||||
</td>
|
</td>
|
||||||
<td class="border-2 border-gray-600 px-2 py-1"></td>
|
<td class="border-2 border-gray-600 px-2 py-1"></td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-yellow-100"></td>
|
<td class="border border-gray-300 px-2 py-1 bg-yellow-100"></td>
|
||||||
@@ -210,7 +210,7 @@
|
|||||||
<td class="border border-gray-300 px-2 py-1 bg-blue-100"></td>
|
<td class="border border-gray-300 px-2 py-1 bg-blue-100"></td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-gray-100">9,4</td>
|
<td class="border border-gray-300 px-2 py-1 bg-gray-100">9,4</td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-blue-100">
|
<td class="border border-gray-300 px-2 py-1 bg-blue-100">
|
||||||
{Math.round(interpolatedValuesZeitkonstante90[9].interpolatedValue*1000)/1000}
|
|
||||||
</td>
|
</td>
|
||||||
<td class="border-2 border-gray-600 px-2 py-1"></td>
|
<td class="border-2 border-gray-600 px-2 py-1"></td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-yellow-100"></td>
|
<td class="border border-gray-300 px-2 py-1 bg-yellow-100"></td>
|
||||||
@@ -226,7 +226,7 @@
|
|||||||
<td class="border border-gray-300 px-2 py-1 bg-blue-100"></td>
|
<td class="border border-gray-300 px-2 py-1 bg-blue-100"></td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-gray-100">4,1</td>
|
<td class="border border-gray-300 px-2 py-1 bg-gray-100">4,1</td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-blue-100">
|
<td class="border border-gray-300 px-2 py-1 bg-blue-100">
|
||||||
{Math.round(interpolatedValuesZeitkonstante90[10].interpolatedValue*1000)/1000}
|
|
||||||
</td>
|
</td>
|
||||||
<td class="border-2 border-gray-600 px-2 py-1"></td>
|
<td class="border-2 border-gray-600 px-2 py-1"></td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-yellow-100"></td>
|
<td class="border border-gray-300 px-2 py-1 bg-yellow-100"></td>
|
||||||
@@ -242,7 +242,7 @@
|
|||||||
<td class="border border-gray-300 px-2 py-1 bg-blue-100"></td>
|
<td class="border border-gray-300 px-2 py-1 bg-blue-100"></td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-gray-100">0,9</td>
|
<td class="border border-gray-300 px-2 py-1 bg-gray-100">0,9</td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-blue-100">
|
<td class="border border-gray-300 px-2 py-1 bg-blue-100">
|
||||||
{Math.round(interpolatedValuesZeitkonstante90[11].interpolatedValue*1000)/1000}
|
|
||||||
</td>
|
</td>
|
||||||
<td class="border-2 border-gray-600 px-2 py-1"></td>
|
<td class="border-2 border-gray-600 px-2 py-1"></td>
|
||||||
<td class="border border-gray-300 px-2 py-1 bg-yellow-100"></td>
|
<td class="border border-gray-300 px-2 py-1 bg-yellow-100"></td>
|
||||||
|
|||||||
@@ -1,127 +1,132 @@
|
|||||||
import { BedarfsausweisWohnenClient, GebaeudeAufnahmeClient } from "#components/Ausweis/types.js";
|
import { BedarfsausweisWohnenClient, GebaeudeAufnahmeClient } from "#components/Ausweis/types.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
// Berechnung des monatlichen Belastungsgrades aus Tabelle 9 EFH (Zeitkonstante 90,130)
|
* Berechnung des monatlichen Belastungsgrades aus Tabelle 9 EFH (Zeitkonstante 90,130)
|
||||||
* @see 18599-Tabellenverfahren-Wohngebaeude.pdf
|
* @see 18599-Tabellenverfahren-Wohngebaeude.pdf
|
||||||
* @export
|
* @export
|
||||||
* @param {BedarfsausweisWohnenClient} ausweis
|
* @param {BedarfsausweisWohnenClient} ausweis
|
||||||
* @param {GebaeudeAufnahmeClient} gebaeude_aufnahme
|
* @param {GebaeudeAufnahmeClient} gebaeude_aufnahme
|
||||||
*/
|
*/
|
||||||
|
export function BerechnungMonatlicherBelastungsgradT9() {
|
||||||
|
let Zeitkonstante = 40;
|
||||||
|
let heizlastGebaeude = 5;
|
||||||
|
|
||||||
export function BerechnungMonatlicherBelastungsgradT9(ausweis: BedarfsausweisWohnenClient, gebaeude_aufnahme: GebaeudeAufnahmeClient) {
|
type MonthData = {
|
||||||
|
month: string;
|
||||||
|
values: number[];
|
||||||
|
};
|
||||||
|
|
||||||
let bezugsflaeche = gebaeude_aufnahme.nutzflaeche ?? 0;
|
// Zeitkonstante bis 50
|
||||||
let heizlastGebaeude = 2000 / bezugsflaeche;
|
const datasetZeitkonstante50: MonthData[] = [
|
||||||
|
{ month: "Januar", values: [0.557, 0.554, 0.550, 0.543, 0.536, 0.533, 0.531, 0.530] },
|
||||||
|
{ month: "Februar", values: [0.531, 0.527, 0.524, 0.517, 0.510, 0.507, 0.505, 0.504] },
|
||||||
|
{ month: "März", values: [0.448, 0.445, 0.443, 0.437, 0.431, 0.427, 0.427, 0.426] },
|
||||||
|
{ month: "April", values: [0.317, 0.314, 0.313, 0.308, 0.305, 0.303, 0.302, 0.301] },
|
||||||
|
{ month: "Mai", values: [0.173, 0.172, 0.171, 0.169, 0.166, 0.165, 0.165, 0.164] },
|
||||||
|
{ month: "Juni", values: [0.097, 0.096, 0.096, 0.094, 0.093, 0.092, 0.092, 0.092] },
|
||||||
|
{ month: "Juli", values: [0.029, 0.029, 0.029, 0.029, 0.028, 0.028, 0.028, 0.028] },
|
||||||
|
{ month: "August", values: [0.041, 0.041, 0.041, 0.040, 0.040, 0.040, 0.039, 0.039] },
|
||||||
|
{ month: "September", values: [0.167, 0.166, 0.165, 0.164, 0.162, 0.161, 0.161, 0.161] },
|
||||||
|
{ month: "Oktober", values: [0.308, 0.306, 0.304, 0.300, 0.296, 0.293, 0.293, 0.293] },
|
||||||
|
{ month: "November", values: [0.466, 0.463, 0.460, 0.454, 0.448, 0.445, 0.444, 0.443] },
|
||||||
|
{ month: "Dezember", values: [0.560, 0.557, 0.553, 0.546, 0.539, 0.536, 0.534, 0.533] }
|
||||||
|
];
|
||||||
|
|
||||||
//let heizlastGebaeude = 17.5
|
// Zeitkonstante 90
|
||||||
|
const datasetZeitkonstante90: MonthData[] = [
|
||||||
|
{ month: "Januar", values: [0.562, 0.559, 0.555, 0.548, 0.541, 0.538, 0.536, 0.535] },
|
||||||
|
{ month: "Februar", values: [0.536, 0.532, 0.529, 0.522, 0.515, 0.512, 0.510, 0.510] },
|
||||||
|
{ month: "März", values: [0.453, 0.450, 0.447, 0.441, 0.436, 0.433, 0.431, 0.431] },
|
||||||
|
{ month: "April", values: [0.320, 0.318, 0.316, 0.311, 0.307, 0.306, 0.305, 0.304] },
|
||||||
|
{ month: "Mai", values: [0.175, 0.173, 0.172, 0.170, 0.168, 0.167, 0.166, 0.166] },
|
||||||
|
{ month: "Juni", values: [0.098, 0.097, 0.096, 0.095, 0.094, 0.093, 0.093, 0.093] },
|
||||||
|
{ month: "Juli", values: [0.030, 0.029, 0.029, 0.029, 0.028, 0.028, 0.028, 0.028] },
|
||||||
|
{ month: "August", values: [0.041, 0.041, 0.041, 0.040, 0.040, 0.040, 0.040, 0.040] },
|
||||||
|
{ month: "September", values: [0.169, 0.168, 0.167, 0.164, 0.162, 0.161, 0.161, 0.161] },
|
||||||
|
{ month: "Oktober", values: [0.311, 0.309, 0.307, 0.303, 0.299, 0.297, 0.296, 0.296] },
|
||||||
|
{ month: "November", values: [0.471, 0.467, 0.465, 0.459, 0.453, 0.450, 0.448, 0.448] },
|
||||||
|
{ month: "Dezember", values: [0.565, 0.562, 0.558, 0.551, 0.544, 0.540, 0.539, 0.538] }
|
||||||
|
];
|
||||||
|
|
||||||
type MonthData = {
|
// Zeitkonstante größer oder gleich 130
|
||||||
month: string;
|
const datasetZeitkonstante130: MonthData[] = [
|
||||||
values: number[];
|
{ month: "Januar", values: [0.567, 0.563, 0.560, 0.553, 0.545, 0.542, 0.540, 0.539, 0.539] },
|
||||||
};
|
{ month: "Februar", values: [0.540, 0.537, 0.533, 0.526, 0.520, 0.516, 0.515, 0.514, 0.513] },
|
||||||
|
{ month: "März", values: [0.457, 0.454, 0.451, 0.445, 0.439, 0.435, 0.435, 0.434, 0.434] },
|
||||||
|
{ month: "April", values: [0.322, 0.320, 0.318, 0.314, 0.310, 0.308, 0.307, 0.307, 0.306] },
|
||||||
|
{ month: "Mai", values: [0.176, 0.175, 0.174, 0.172, 0.169, 0.168, 0.168, 0.168, 0.167] },
|
||||||
|
{ month: "Juni", values: [0.098, 0.097, 0.096, 0.095, 0.094, 0.094, 0.094, 0.094, 0.094] },
|
||||||
|
{ month: "Juli", values: [0.030, 0.030, 0.029, 0.029, 0.028, 0.028, 0.028, 0.028, 0.028] },
|
||||||
|
{ month: "August", values: [0.042, 0.041, 0.041, 0.040, 0.040, 0.040, 0.040, 0.040, 0.040] },
|
||||||
|
{ month: "September", values: [0.170, 0.169, 0.168, 0.166, 0.164, 0.163, 0.162, 0.162, 0.162] },
|
||||||
|
{ month: "Oktober", values: [0.313, 0.311, 0.309, 0.305, 0.301, 0.300, 0.299, 0.298, 0.298] },
|
||||||
|
{ month: "November", values: [0.474, 0.471, 0.469, 0.462, 0.456, 0.454, 0.453, 0.451, 0.451] },
|
||||||
|
{ month: "Dezember", values: [0.570, 0.566, 0.563, 0.555, 0.548, 0.545, 0.543, 0.542, 0.542] },
|
||||||
|
];
|
||||||
|
|
||||||
// Zeitkonstante bis 50
|
// Für "Ohne Teilbeheizung" habe ich hier einfach 0 genommen. Prakmatisch würde ich sagen.
|
||||||
|
const HeizLastTabelle = [0, 5, 10, 25, 50, 75, 100, 125, 150];
|
||||||
|
|
||||||
const datasetZeitkonstante50: MonthData[] = [
|
/**
|
||||||
{ month: "Januar", values: [0.557, 0.554, 0.550, 0.543, 0.536, 0.533, 0.531, 0.530] },
|
* Linearly interpolates a value for the given x.
|
||||||
{ month: "Februar", values: [0.531, 0.527, 0.524, 0.517, 0.510, 0.507, 0.505, 0.504] },
|
* @param x The x value to interpolate.
|
||||||
{ month: "März", values: [0.448, 0.445, 0.443, 0.437, 0.431, 0.427, 0.427, 0.426] },
|
* @param xValues The array of x-values.
|
||||||
{ month: "April", values: [0.317, 0.314, 0.313, 0.308, 0.305, 0.303, 0.302, 0.301] },
|
* @param yValues The array of y-values corresponding to x-values.
|
||||||
{ month: "Mai", values: [0.173, 0.172, 0.171, 0.169, 0.166, 0.165, 0.165, 0.164] },
|
* @returns The interpolated value.
|
||||||
{ month: "Juni", values: [0.097, 0.096, 0.096, 0.094, 0.093, 0.092, 0.092, 0.092] },
|
*/
|
||||||
{ month: "Juli", values: [0.029, 0.029, 0.029, 0.029, 0.028, 0.028, 0.028, 0.028] },
|
function interpolate(x: number, xValues: number[], yValues: number[]): number {
|
||||||
{ month: "August", values: [0.041, 0.041, 0.041, 0.040, 0.040, 0.040, 0.039, 0.039] },
|
if (x <= xValues[0]) return yValues[0];
|
||||||
{ month: "September", values: [0.167, 0.166, 0.165, 0.164, 0.162, 0.161, 0.161, 0.161] },
|
if (x >= xValues[xValues.length - 1]) return yValues[yValues.length - 1];
|
||||||
{ month: "Oktober", values: [0.308, 0.306, 0.304, 0.300, 0.296, 0.293, 0.293, 0.293] },
|
|
||||||
{ month: "November", values: [0.466, 0.463, 0.460, 0.454, 0.448, 0.445, 0.444, 0.443] },
|
|
||||||
{ month: "Dezember", values: [0.560, 0.557, 0.553, 0.546, 0.539, 0.536, 0.534, 0.533] }
|
|
||||||
];
|
|
||||||
|
|
||||||
// Zeitkonstante 90
|
for (let i = 0; i < xValues.length - 1; i++) {
|
||||||
|
if (x >= xValues[i] && x <= xValues[i + 1]) {
|
||||||
const datasetZeitkonstante90: MonthData[] = [
|
const x1 = xValues[i];
|
||||||
{ month: "Januar", values: [0.562, 0.559, 0.555, 0.548, 0.541, 0.538, 0.536, 0.535] },
|
const x2 = xValues[i + 1];
|
||||||
{ month: "Februar", values: [0.536, 0.532, 0.529, 0.522, 0.515, 0.512, 0.510, 0.510] },
|
const y1 = yValues[i];
|
||||||
{ month: "März", values: [0.453, 0.450, 0.447, 0.441, 0.436, 0.433, 0.431, 0.431] },
|
const y2 = yValues[i + 1];
|
||||||
{ month: "April", values: [0.320, 0.318, 0.316, 0.311, 0.307, 0.306, 0.305, 0.304] },
|
return y1 + ((x - x1) * (y2 - y1)) / (x2 - x1);
|
||||||
{ month: "Mai", values: [0.175, 0.173, 0.172, 0.170, 0.168, 0.167, 0.166, 0.166] },
|
}
|
||||||
{ month: "Juni", values: [0.098, 0.097, 0.096, 0.095, 0.094, 0.093, 0.093, 0.093] },
|
|
||||||
{ month: "Juli", values: [0.030, 0.029, 0.029, 0.029, 0.028, 0.028, 0.028, 0.028] },
|
|
||||||
{ month: "August", values: [0.041, 0.041, 0.041, 0.040, 0.040, 0.040, 0.039, 0.039] },
|
|
||||||
{ month: "September", values: [0.169, 0.168, 0.167, 0.164, 0.162, 0.161, 0.161, 0.161] },
|
|
||||||
{ month: "Oktober", values: [0.311, 0.309, 0.307, 0.303, 0.299, 0.297, 0.296, 0.296] },
|
|
||||||
{ month: "November", values: [0.471, 0.467, 0.465, 0.459, 0.453, 0.450, 0.448, 0.448] },
|
|
||||||
{ month: "Dezember", values: [0.565, 0.562, 0.558, 0.551, 0.544, 0.540, 0.539, 0.538] }
|
|
||||||
];
|
|
||||||
|
|
||||||
// Zeitkonstante größer oder gleich 130
|
|
||||||
|
|
||||||
const datasetZeitkonstante130: MonthData[] = [
|
|
||||||
{ month: "Januar", values: [0.567, 0.563, 0.560, 0.553, 0.545, 0.542, 0.540, 0.539, 0.539] },
|
|
||||||
{ month: "Februar", values: [0.540, 0.537, 0.533, 0.526, 0.520, 0.516, 0.515, 0.514, 0.513] },
|
|
||||||
{ month: "März", values: [0.457, 0.454, 0.451, 0.445, 0.439, 0.435, 0.435, 0.434, 0.434] },
|
|
||||||
{ month: "April", values: [0.322, 0.320, 0.318, 0.314, 0.310, 0.308, 0.307, 0.307, 0.306] },
|
|
||||||
{ month: "Mai", values: [0.176, 0.175, 0.174, 0.172, 0.169, 0.168, 0.168, 0.168, 0.167] },
|
|
||||||
{ month: "Juni", values: [0.098, 0.097, 0.096, 0.095, 0.094, 0.094, 0.094, 0.094, 0.094] },
|
|
||||||
{ month: "Juli", values: [0.030, 0.030, 0.029, 0.029, 0.028, 0.028, 0.028, 0.028, 0.028] },
|
|
||||||
{ month: "August", values: [0.042, 0.041, 0.041, 0.040, 0.040, 0.040, 0.040, 0.040, 0.040] },
|
|
||||||
{ month: "September", values: [0.170, 0.169, 0.168, 0.166, 0.164, 0.163, 0.162, 0.162, 0.162] },
|
|
||||||
{ month: "Oktober", values: [0.313, 0.311, 0.309, 0.305, 0.301, 0.300, 0.299, 0.298, 0.298] },
|
|
||||||
{ month: "November", values: [0.474, 0.471, 0.469, 0.462, 0.456, 0.454, 0.453, 0.451, 0.451] },
|
|
||||||
{ month: "Dezember", values: [0.570, 0.566, 0.563, 0.555, 0.548, 0.545, 0.543, 0.542, 0.542] },
|
|
||||||
];
|
|
||||||
|
|
||||||
// Für "Ohne Teilbeheizung" habe ich hier einfach 0 genommen. Prakmatisch würde ich sagen.
|
|
||||||
const HeizLastTabelle = [0, 5, 10, 25, 50, 75, 100, 125, 150];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Linearly interpolates a value for the given x.
|
|
||||||
* @param heizlastGebaeude The heating load value (e.g., 82).
|
|
||||||
* @param values The array of y-values corresponding to heating loads.
|
|
||||||
* @param loads The array of heating load values (x-axis).
|
|
||||||
* @returns The interpolated value.
|
|
||||||
*/
|
|
||||||
function interpolate(heizlastGebaeude: number, values: number[], loads: number[]): number {
|
|
||||||
if (heizlastGebaeude <= loads[0]) return values[0];
|
|
||||||
if (heizlastGebaeude >= loads[loads.length - 1]) return values[values.length - 1];
|
|
||||||
|
|
||||||
for (let i = 0; i < loads.length - 1; i++) {
|
|
||||||
if (heizlastGebaeude >= loads[i] && heizlastGebaeude <= loads[i + 1]) {
|
|
||||||
const x1 = loads[i];
|
|
||||||
const x2 = loads[i + 1];
|
|
||||||
const y1 = values[i];
|
|
||||||
const y2 = values[i + 1];
|
|
||||||
|
|
||||||
return y1 + ((heizlastGebaeude - x1) * (y2 - y1)) / (x2 - x1);
|
|
||||||
}
|
}
|
||||||
|
throw new Error("Interpolation error: Value is out of bounds.");
|
||||||
}
|
}
|
||||||
throw new Error("Interpolation error: Value is out of bounds.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Zeitkonstante bis 50
|
let interpolatedValues: { month: string, interpolatedValue: number }[] = [];
|
||||||
|
|
||||||
const interpolatedValuesZeitkonstante1 = datasetZeitkonstante50.map(data => ({
|
if (Zeitkonstante < 50) {
|
||||||
month: data.month,
|
interpolatedValues = datasetZeitkonstante50.map(data => ({
|
||||||
interpolatedValue: interpolate(heizlastGebaeude, data.values, HeizLastTabelle)
|
month: data.month,
|
||||||
}));
|
interpolatedValue: interpolate(heizlastGebaeude, HeizLastTabelle, data.values)
|
||||||
|
}));
|
||||||
// Zeitkonstante 90
|
} else if (Zeitkonstante < 90) {
|
||||||
|
interpolatedValues = datasetZeitkonstante50.map((data, index) => {
|
||||||
const interpolatedValuesZeitkonstante2 = datasetZeitkonstante90.map(data => ({
|
if (datasetZeitkonstante90[index] && datasetZeitkonstante90[index].values) {
|
||||||
month: data.month,
|
const interpolatedValue = interpolate(Zeitkonstante, [50, 90], [datasetZeitkonstante50[index].values[0], datasetZeitkonstante90[index].values[0]]);
|
||||||
interpolatedValue: interpolate(heizlastGebaeude, data.values, HeizLastTabelle)
|
return {
|
||||||
}));
|
month: data.month,
|
||||||
|
interpolatedValue: interpolate(heizlastGebaeude, HeizLastTabelle, [data.values[0], interpolatedValue])
|
||||||
// Zeitkonstante größer oder gleich 130
|
};
|
||||||
|
} else {
|
||||||
const interpolatedValuesZeitkonstante3 = datasetZeitkonstante130.map(data => ({
|
throw new Error(`Data for index ${index} is undefined in datasetZeitkonstante90.`);
|
||||||
month: data.month,
|
}
|
||||||
interpolatedValue: interpolate(heizlastGebaeude, data.values, HeizLastTabelle)
|
});
|
||||||
}));
|
} else if (Zeitkonstante < 130) {
|
||||||
|
interpolatedValues = datasetZeitkonstante90.map((data, index) => {
|
||||||
|
if (datasetZeitkonstante130[index] && datasetZeitkonstante130[index].values) {
|
||||||
return {
|
const interpolatedValue = interpolate(Zeitkonstante, [90, 130], [datasetZeitkonstante90[index].values[0], datasetZeitkonstante130[index].values[0]]);
|
||||||
interpolatedValuesZeitkonstante1
|
return {
|
||||||
}
|
month: data.month,
|
||||||
|
interpolatedValue: interpolate(heizlastGebaeude, HeizLastTabelle, [data.values[0], interpolatedValue])
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
throw new Error(`Data for index ${index} is undefined in datasetZeitkonstante130.`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
interpolatedValues = datasetZeitkonstante130.map(data => ({
|
||||||
|
month: data.month,
|
||||||
|
interpolatedValue: interpolate(heizlastGebaeude, HeizLastTabelle, data.values)
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
return interpolatedValues;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user