Interpolation
This commit is contained in:
@@ -1,39 +1,6 @@
|
||||
// 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
|
||||
): number {
|
||||
return (
|
||||
wertZwei -
|
||||
((wertZwei - wertEins) * (maxHeizlast - maxHeizlastEins)) /
|
||||
(maxHeizlastZwei - maxHeizlastEins)
|
||||
);
|
||||
}
|
||||
|
||||
// Beispielwerte
|
||||
const wertZwei = 0.541;
|
||||
const wertEins = 0.548;
|
||||
const maxHeizlast = 37.86;
|
||||
const maxHeizlastEins = 25;
|
||||
const maxHeizlastZwei = 50;
|
||||
|
||||
// Berechnung
|
||||
const monatlicherBelastungsgradT90 = monatlicherBelastungsGradT90(
|
||||
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 = {
|
||||
@@ -146,36 +113,42 @@ const datasetZeitkonstante130: MonthData[] = [
|
||||
// Für "Ohne Teilbeheizung" habe ich hier einfach 0 eingesetzt:
|
||||
const HeizLast = [0, 5, 10, 25, 50, 75, 100, 125, 150];
|
||||
|
||||
const interpolatedValuesZeitkonstante90 = datasetZeitkonstante90.map((data) => {
|
||||
|
||||
|
||||
// Um über die beiden Tabellen zu interpolieren können wir einfach zuerst über jede einzeln interpolieren und dann zwischen den Tabellen interpolieren.
|
||||
// Falls wir also den Wert an Stelle Heizlast: 120, Zeitkonstante 100, Monat: Januar haben wollen:
|
||||
|
||||
function crossInterpolate(heizlast: number, zeitkonstane: number, monat: string) {
|
||||
const interpolatedValuesZeitkonstante90 = datasetZeitkonstante90.filter(data => data.month === monat).map((data) => {
|
||||
const interpolate = nevillePolynomialInterpolation(
|
||||
data.values.map((value, i) => ({ x: HeizLast[i], y: value })),
|
||||
data.values.length
|
||||
);
|
||||
|
||||
return interpolate(heizlast)
|
||||
});
|
||||
|
||||
const interpolatedValuesZeitkonstante130 = datasetZeitkonstante130.filter(data => data.month === monat).map((data) => {
|
||||
const interpolate = nevillePolynomialInterpolation(
|
||||
data.values.map((value, i) => ({ x: HeizLast[i], y: value })),
|
||||
data.values.length
|
||||
);
|
||||
|
||||
return interpolate(heizlast)
|
||||
});
|
||||
|
||||
const interpolate = nevillePolynomialInterpolation(
|
||||
data.values.map((value, i) => ({ x: HeizLast[i], y: value })),
|
||||
data.values.length
|
||||
);
|
||||
[{
|
||||
x: 90,
|
||||
y: interpolatedValuesZeitkonstante90
|
||||
}, {
|
||||
x: 130,
|
||||
y: interpolatedValuesZeitkonstante130
|
||||
}],
|
||||
2
|
||||
)
|
||||
|
||||
return {
|
||||
month: data.month,
|
||||
interpolatedValue: interpolate(125),
|
||||
};
|
||||
});
|
||||
return interpolate(zeitkonstane)
|
||||
}
|
||||
|
||||
console.log(
|
||||
datasetZeitkonstante90[0].values.map((value, i) => ({
|
||||
x: HeizLast[i],
|
||||
y: value,
|
||||
}))
|
||||
);
|
||||
|
||||
const interpolatedValuesZeitkonstante130 = datasetZeitkonstante130.map((data) => {
|
||||
const interpolate = nevillePolynomialInterpolation(
|
||||
data.values.map((value, i) => ({ x: HeizLast[i], y: value })),
|
||||
data.values.length
|
||||
);
|
||||
|
||||
return {
|
||||
month: data.month,
|
||||
interpolatedValue: interpolate(125),
|
||||
};
|
||||
});
|
||||
|
||||
console.log(interpolatedValuesZeitkonstante90);
|
||||
// console.log(interpolatedValuesZeitkonstante130);
|
||||
console.log(crossInterpolate(0, 100, "Januar"));
|
||||
Reference in New Issue
Block a user