Align project devices with circuit model
This commit is contained in:
@@ -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>
|
||||
))}
|
||||
|
||||
+16
-5
@@ -91,8 +91,17 @@ export interface ProjectDeviceDto {
|
||||
projectId: string;
|
||||
name: string;
|
||||
displayName: string;
|
||||
phaseType: "single_phase" | "three_phase";
|
||||
connectionKind: string | null;
|
||||
costGroup: string | null;
|
||||
category: string | null;
|
||||
quantity: number;
|
||||
powerPerUnit: number;
|
||||
simultaneityFactor: number;
|
||||
totalPower: number;
|
||||
cosPhi: number | null;
|
||||
remark: string | null;
|
||||
// Legacy aliases retained until the old Consumer editor is removed.
|
||||
installedPowerPerUnitKw: number;
|
||||
demandFactor: number;
|
||||
voltageV: number | null;
|
||||
@@ -159,14 +168,16 @@ export interface CreateGlobalDeviceInput {
|
||||
export interface CreateProjectDeviceInput {
|
||||
name: string;
|
||||
displayName: string;
|
||||
phaseType: "single_phase" | "three_phase";
|
||||
connectionKind?: string;
|
||||
costGroup?: string;
|
||||
category?: string;
|
||||
quantity: number;
|
||||
installedPowerPerUnitKw: number;
|
||||
demandFactor: number;
|
||||
powerPerUnit: number;
|
||||
simultaneityFactor: number;
|
||||
cosPhi?: number;
|
||||
remark?: string;
|
||||
voltageV?: number;
|
||||
phaseCount?: 1 | 3;
|
||||
powerFactor?: number;
|
||||
note?: string;
|
||||
}
|
||||
|
||||
export interface CircuitTreeDeviceRowDto {
|
||||
|
||||
Reference in New Issue
Block a user