Align project devices with circuit model

This commit is contained in:
2026-07-22 19:31:08 +02:00
parent 689cfd3c65
commit 9d07ed9856
16 changed files with 301 additions and 106 deletions
+18 -14
View File
@@ -1696,10 +1696,7 @@ export function CircuitTreeEditor(props: { projectId: string; circuitListId: str
}
function resolvePhaseType(device: ProjectDeviceDto): string {
if (device.phaseCount === 3) {
return "three_phase";
}
return "single_phase";
return device.phaseType;
}
function resolveSelectedProjectDevice() {
@@ -1819,11 +1816,14 @@ export function CircuitTreeEditor(props: { projectId: string; circuitListId: str
name: device.name,
displayName: device.displayName,
phaseType: resolvePhaseType(device),
connectionKind: device.connectionKind ?? undefined,
costGroup: device.costGroup ?? undefined,
quantity: device.quantity,
powerPerUnit: device.installedPowerPerUnitKw,
simultaneityFactor: device.demandFactor,
cosPhi: device.powerFactor ?? undefined,
powerPerUnit: device.powerPerUnit,
simultaneityFactor: device.simultaneityFactor,
cosPhi: device.cosPhi ?? undefined,
category: device.category ?? undefined,
remark: device.remark ?? undefined,
})) as { id: string };
setActiveSectionId(sectionId);
@@ -1837,11 +1837,14 @@ export function CircuitTreeEditor(props: { projectId: string; circuitListId: str
name: device.name,
displayName: device.displayName,
phaseType: resolvePhaseType(device),
connectionKind: device.connectionKind ?? undefined,
costGroup: device.costGroup ?? undefined,
quantity: device.quantity,
powerPerUnit: device.installedPowerPerUnitKw,
simultaneityFactor: device.demandFactor,
cosPhi: device.powerFactor ?? undefined,
powerPerUnit: device.powerPerUnit,
simultaneityFactor: device.simultaneityFactor,
cosPhi: device.cosPhi ?? undefined,
category: device.category ?? undefined,
remark: device.remark ?? undefined,
})) as { id: string };
return { rowId: createdRow.id };
}
@@ -2700,11 +2703,12 @@ export function CircuitTreeEditor(props: { projectId: string; circuitListId: str
>
<strong>{device.displayName || device.name}</strong>
<span>Name: {device.name}</span>
<span>Phase: {device.phaseCount === 3 ? "three_phase" : "single_phase"}</span>
<span>Phase: {device.phaseType}</span>
<span>Qty: {device.quantity}</span>
<span>P/unit: {device.installedPowerPerUnitKw}</span>
<span>g: {device.demandFactor}</span>
<span>Cost group: -</span>
<span>P/unit: {device.powerPerUnit}</span>
<span>g: {device.simultaneityFactor}</span>
<span>Total: {device.totalPower}</span>
<span>Cost group: {device.costGroup || "-"}</span>
<span>Category: {device.category || "-"}</span>
</button>
))}