[71][111] U-Werte aus dem Schichtaufbau (SIA 180) und lebendige Tabellen auf Layout-Blättern

[71] Kern u_value.rs: R = Rsi + Σ d/λ + Rse, hinterlüftete Schichten, Luftschicht, unvollständig ohne λ; Objekt-Info,
Ressourcen-Manager, Bauteilliste (CSV/PDF, CLI --elements), IFC ThermalTransmittance in Wand/Decke/Dach.
[111] Layout.tables: Fenster-/Türliste, Flächen SIA 416, Raumprogramm, Bauteile mit U-Wert als Tabelle auf dem Blatt
(Spaltenwahl, Schrift, Zeilenhöhe, Linien, Aufteilen auf mehrere Rahmen); Blattansicht, PDF (Vektortext), DXF.
This commit is contained in:
Claude committed 2026-10-30 06:09:50 +00:00
1 parent b2f66c777c
commit a3bc168f2d
31 files changed
+2274 -14

No files matched your search

+75
View File
@@ -0,0 +1,75 @@
// Bauteilliste und U-Werte ([71], SIA 180 / EN ISO 6946): je Wand, Decke und Dach Typ, Fläche und U-Wert aus
// dem Schichtaufbau (λ je Bauteil). Gerechnet wird im Kern (`src-tauri/core/src/u_value.rs`, Abfragen
// `elementSchedule` und `uValue`); hier nur Beschriftung mit `t()` und das Berichtsmodell für CSV/SVG/PDF
// (wie die Fenster-/Türliste, `openingSchedule.ts`).
import type { Layer, Project } from "../model/types";
import { t } from "../i18n";
import { documentFor } from "../core/document";
import type { AreaReport, Cell, ReportRow } from "./areaReport";
export type ElementKind = "wall" | "ceiling" | "roof";
/** Eine Zeile der Bauteilliste (Form wie `ElementRow` im Kern). */
export interface ElementScheduleRow {
kind: ElementKind;
id: string;
typeName: string;
floor: string;
floorId: string;
/** m². */
area: number;
/** Aufbaudicke in Metern. */
thickness: number;
/** `null` = unvollständig (Schicht ohne λ) oder kein Aufbau. */
u: number | null;
complete: boolean;
external: boolean | null;
}
/** Ergebnis der U-Wert-Rechnung (Form wie `UValue` im Kern). */
export interface UValueResult {
/** Gesamtwiderstand m²K/W (Teilsumme, wenn unvollständig). */
r: number;
u: number | null;
complete: boolean;
/** Schichten ohne λ. */
missing: number;
/** Hinterlüftete Schicht: Aussenseite zählt nicht. */
ventilated: boolean;
}
export function elementSchedule(project: Project): ElementScheduleRow[] {
return documentFor(project).query<ElementScheduleRow[]>("elementSchedule");
}
/** U-Wert eines Typs (`typeId`) oder eines Schichtaufbaus (`layers`, z. B. beim Bearbeiten). `null` = unbekannter Typ. */
export function uValueOf(project: Project, kind: ElementKind, source: { typeId: string } | { layers: readonly Layer[] }): UValueResult | null {
return documentFor(project).query<UValueResult | null>("uValue", [], JSON.stringify({ kind, ...source }));
}
/** „0.21" bzw. „–" (unvollständig). */
export function uValueText(u: UValueResult | null): string {
return u && u.u !== null ? u.u.toFixed(2) : "–";
}
const num = (n: number | null, d: number): Cell => ({ n: n !== null && Number.isFinite(n) ? n : null, d });
function externalText(e: boolean | null): string {
return e === null ? "" : e ? t("openings.external") : t("openings.internal");
}
/** Bericht „Bauteilliste": ein Abschnitt je Art (nur wenn vorhanden). */
export function buildElementReport(project: Project): AreaReport {
const rows = elementSchedule(project);
const sections = (["wall", "ceiling", "roof"] as const)
.map((kind) => ({ kind, list: rows.filter((r) => r.kind === kind) }))
.filter((g) => g.list.length > 0)
.map((g) => ({
heading: t(`elemSchedule.kind.${g.kind}`),
columns: [t("elemSchedule.col.type"), t("openings.col.floor"), t("elemSchedule.col.area"), t("elemSchedule.col.thickness"), t("openings.col.u"), t("openings.col.ext")],
widths: [4, 1.6, 1.4, 1.3, 1.3, 1.4],
rows: g.list.map((r): ReportRow => ({ cells: [r.typeName, r.floor, num(r.area, 2), num(r.thickness * 100, 1), r.u === null ? t("elemSchedule.incomplete") : num(r.u, 2), externalText(r.external)] })),
}));
return { title: t("elemSchedule.title"), projectName: project.name ?? "", sections, notes: [t("elemSchedule.foot")] };
}