Ansichtsausweis
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
|
||||
// Funktion zur Berechnung des monatlichen Belastungsgrades aus Tabelle 9 EFH (Januar, Zeitkonstante 90)
|
||||
|
||||
import { nevillePolynomialInterpolation, lagrangeInterpolation } from "js-interpolate";
|
||||
|
||||
function monatlicherBelastungsGradT90(
|
||||
wertZwei: number,
|
||||
wertEins: number,
|
||||
maxHeizlast: number,
|
||||
maxHeizlastEins: number,
|
||||
maxHeizlastZwei: number
|
||||
wertZwei: number,
|
||||
wertEins: number,
|
||||
maxHeizlast: number,
|
||||
maxHeizlastEins: number,
|
||||
maxHeizlastZwei: number
|
||||
): number {
|
||||
return (
|
||||
wertZwei -
|
||||
((wertZwei - wertEins) * (maxHeizlast - maxHeizlastEins)) /
|
||||
(maxHeizlastZwei - maxHeizlastEins)
|
||||
);
|
||||
return (
|
||||
wertZwei -
|
||||
((wertZwei - wertEins) * (maxHeizlast - maxHeizlastEins)) /
|
||||
(maxHeizlastZwei - maxHeizlastEins)
|
||||
);
|
||||
}
|
||||
|
||||
// Beispielwerte
|
||||
@@ -24,94 +25,157 @@ const maxHeizlastZwei = 50;
|
||||
|
||||
// Berechnung
|
||||
const monatlicherBelastungsgradT90 = monatlicherBelastungsGradT90(
|
||||
wertZwei,
|
||||
wertEins,
|
||||
maxHeizlast,
|
||||
maxHeizlastEins,
|
||||
maxHeizlastZwei
|
||||
wertZwei,
|
||||
wertEins,
|
||||
maxHeizlast,
|
||||
maxHeizlastEins,
|
||||
maxHeizlastZwei
|
||||
);
|
||||
|
||||
console.log("Monatlicher Belastungsgrad T90:", monatlicherBelastungsgradT90);
|
||||
|
||||
|
||||
|
||||
// Funktion zur Berechnung des monatlichen Belastungsgrades aus Tabelle 9 EFH (Zeitkonstante 90,130)
|
||||
|
||||
type MonthData = {
|
||||
month: string;
|
||||
values: number[];
|
||||
month: string;
|
||||
values: number[];
|
||||
};
|
||||
|
||||
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.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] }
|
||||
{
|
||||
month: "Januar",
|
||||
values: [0.562, 0.559, 0.555, 0.548, 0.541, 0.538, 0.536, 0.535, 0.535],
|
||||
},
|
||||
{
|
||||
month: "Februar",
|
||||
values: [0.536, 0.532, 0.529, 0.522, 0.515, 0.512, 0.51, 0.51, 0.509],
|
||||
},
|
||||
{
|
||||
month: "März",
|
||||
values: [0.453, 0.45, 0.447, 0.441, 0.436, 0.433, 0.431, 0.431, 0.43],
|
||||
},
|
||||
{
|
||||
month: "April",
|
||||
values: [0.32, 0.318, 0.316, 0.311, 0.307, 0.306, 0.305, 0.304, 0.304],
|
||||
},
|
||||
{
|
||||
month: "Mai",
|
||||
values: [0.175, 0.173, 0.172, 0.17, 0.168, 0.167, 0.166, 0.166, 0.166],
|
||||
},
|
||||
{
|
||||
month: "Juni",
|
||||
values: [0.098, 0.097, 0.096, 0.095, 0.094, 0.093, 0.093, 0.093, 0.093],
|
||||
},
|
||||
{
|
||||
month: "Juli",
|
||||
values: [0.03, 0.029, 0.029, 0.029, 0.028, 0.028, 0.028, 0.028, 0.028],
|
||||
},
|
||||
{
|
||||
month: "August",
|
||||
values: [0.041, 0.041, 0.041, 0.04, 0.04, 0.04, 0.039, 0.039, 0.039],
|
||||
},
|
||||
{
|
||||
month: "September",
|
||||
values: [0.169, 0.168, 0.167, 0.164, 0.162, 0.161, 0.161, 0.161, 0.16],
|
||||
},
|
||||
{
|
||||
month: "Oktober",
|
||||
values: [0.311, 0.309, 0.307, 0.303, 0.299, 0.297, 0.296, 0.296, 0.295],
|
||||
},
|
||||
{
|
||||
month: "November",
|
||||
values: [0.471, 0.467, 0.465, 0.459, 0.453, 0.45, 0.448, 0.448, 0.447],
|
||||
},
|
||||
{
|
||||
month: "Dezember",
|
||||
values: [0.565, 0.562, 0.558, 0.551, 0.544, 0.54, 0.539, 0.538, 0.537],
|
||||
},
|
||||
];
|
||||
|
||||
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] },
|
||||
{
|
||||
month: "Januar",
|
||||
values: [0.567, 0.563, 0.56, 0.553, 0.545, 0.542, 0.54, 0.539, 0.539],
|
||||
},
|
||||
{
|
||||
month: "Februar",
|
||||
values: [0.54, 0.537, 0.533, 0.526, 0.52, 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.32, 0.318, 0.314, 0.31, 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.03, 0.03, 0.029, 0.029, 0.028, 0.028, 0.028, 0.028, 0.028],
|
||||
},
|
||||
{
|
||||
month: "August",
|
||||
values: [0.042, 0.041, 0.041, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04],
|
||||
},
|
||||
{
|
||||
month: "September",
|
||||
values: [0.17, 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.3, 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.57, 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 eingesetzt:
|
||||
// Für "Ohne Teilbeheizung" habe ich hier einfach 0 eingesetzt:
|
||||
const HeizLast = [0, 5, 10, 25, 50, 75, 100, 125, 150];
|
||||
|
||||
/**
|
||||
* Linearly interpolates a value for the given x.
|
||||
* @param x 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(x: number, values: number[], loads: number[]): number {
|
||||
if (x <= loads[0]) return values[0];
|
||||
if (x >= loads[loads.length - 1]) return values[values.length - 1];
|
||||
const interpolatedValuesZeitkonstante90 = datasetZeitkonstante90.map((data) => {
|
||||
const interpolate = nevillePolynomialInterpolation(
|
||||
data.values.map((value, i) => ({ x: HeizLast[i], y: value })),
|
||||
data.values.length
|
||||
);
|
||||
|
||||
for (let i = 0; i < loads.length - 1; i++) {
|
||||
if (x >= loads[i] && x <= loads[i + 1]) {
|
||||
const x1 = loads[i];
|
||||
const x2 = loads[i + 1];
|
||||
const y1 = values[i];
|
||||
const y2 = values[i + 1];
|
||||
return {
|
||||
month: data.month,
|
||||
interpolatedValue: interpolate(125),
|
||||
};
|
||||
});
|
||||
|
||||
return y1 + ((x - x1) * (y2 - y1)) / (x2 - x1);
|
||||
}
|
||||
}
|
||||
throw new Error("Interpolation error: Value is out of bounds.");
|
||||
}
|
||||
console.log(
|
||||
datasetZeitkonstante90[0].values.map((value, i) => ({
|
||||
x: HeizLast[i],
|
||||
y: value,
|
||||
}))
|
||||
);
|
||||
|
||||
// Example: Interpolate for x = 82 und Zeitkonstante zwischen 90-130
|
||||
const x = 82;
|
||||
const interpolatedValuesZeitkonstante90 = datasetZeitkonstante90.map(data => ({
|
||||
month: data.month,
|
||||
interpolatedValue: interpolate(x, data.values, HeizLast)
|
||||
}));
|
||||
const interpolatedValuesZeitkonstante130 = datasetZeitkonstante130.map((data) => {
|
||||
const interpolate = nevillePolynomialInterpolation(
|
||||
data.values.map((value, i) => ({ x: HeizLast[i], y: value })),
|
||||
data.values.length
|
||||
);
|
||||
|
||||
// Example: Interpolate for x = 82 und Zeitkonstante >= 130
|
||||
const x = 82;
|
||||
const interpolatedValuesZeitkonstante130 = datasetZeitkonstante130.map(data => ({
|
||||
month: data.month,
|
||||
interpolatedValue: interpolate(x, data.values, HeizLast)
|
||||
}));
|
||||
return {
|
||||
month: data.month,
|
||||
interpolatedValue: interpolate(125),
|
||||
};
|
||||
});
|
||||
|
||||
console.log(interpolatedValuesZeitkonstante90);
|
||||
console.log(interpolatedValuesZeitkonstante130);
|
||||
// console.log(interpolatedValuesZeitkonstante130);
|
||||
|
||||
Reference in New Issue
Block a user