create and update toplogy for kaco installation

This commit is contained in:
atef 2026-04-10 15:23:26 +02:00
parent 94c9a7b28f
commit b7742ac937
1 changed files with 48 additions and 45 deletions

View File

@ -22,14 +22,14 @@ namespace InnovEnergy.App.KacoCommunication;
// │ -3205 W │<<<<<<<<<│ -6646 W │<<<<<<<<<<├────────┤>>>>>>>>>>├───────┤>>>>>>>>>>│ 490 mA │ │ 490 mA │ │ 490 mA │
// │ -3507 W │ (a) │ -5071 W │ (h) │ 776 V │ (k) │ 56 V │ (l) │ 250 °C │ │ 250 °C │ │ 250 °C │
// │ -3605 W │ └─────────┘ └────────┘ └───────┘ │ 445 A │ │ 445 A │ │ 445 A │
// └─────────┘ V │ │ │ │ │ │
// V │ │ │ │ │ │
// (j) 0 W └────────────┘ └────────────┘ └────────────┘
// V
// V
// ┌──────┐
// │ Load │
// └──────┘
// └─────────┘ V │ │ │ │ │ │
// V │ │ │ │ │ │
// (j) 0 W └────────────┘ └────────────┘ └────────────┘
// V
// V
// ┌──────┐
// │ Load │
// └──────┘
//
@ -44,7 +44,7 @@ public static class SimpleTopology
var h = status.InverterRecord?.ActivePowerW;
var i = 0;
var j = 0;
var j = h - a;
var k = status.DcDc?.Dc.Battery.Power.Value;
@ -53,8 +53,8 @@ public static class SimpleTopology
var l = status.ListOfBatteriesRecord?.Sum(r => r.Power);
var grid = status.CreateGridColumn(a);
var acdc = status.CreateAcDcColumn(h);
var dcBus = status.CreateDcBusColumn(i, j, k);
var acdc = status.CreateAcDcColumn(h,j);
var dcBus = status.CreateDcBusColumn( k);
var dcdc = status.CreateDcDcColumn(l);
var batteries = status.CreateBatteriesRow();
@ -94,7 +94,7 @@ public static class SimpleTopology
return TextBlock.AlignCenterVertical(gridBox, flow);
}
private static TextBlock CreateAcDcColumn(this StatusRecord status, ActivePower? h)
private static TextBlock CreateAcDcColumn(this StatusRecord status, ActivePower? h, ActivePower? j)
{
// ┌─────────┐
// │ AC/DC │
@ -102,33 +102,6 @@ public static class SimpleTopology
// │ dev1 P │
// │ dev2 P │
// └─────────┘ (h) flow to DC Bus
var acdcBox = TextBlock
.AlignLeft(status.InverterRecord?.ActivePowerW.ToString() ?? "???")
.TitleBox("AC/DC");
var flowToDcBus = Flow.Horizontal(h);
return TextBlock.AlignCenterVertical(acdcBox, flowToDcBus);
}
private static TextBlock CreateDcBusColumn(
this StatusRecord status,
ActivePower? i,
ActivePower? j,
ActivePower? k)
{
// ┌────┐
// │ PV │
// └────┘
// V
// (i) 13.2 kW
// V
// ┌────────┐ (k) >>>>>>>>> to DC/DC
// │ Dc Bus │>>>>>>>>>>>>>>>>>>>
// ├────────┤
// │ 776 V │
// └────────┘
// V
// (j) 0 W
// V
@ -136,9 +109,42 @@ public static class SimpleTopology
// │ Load │
// └──────┘
var acdcBox = TextBlock
.AlignLeft(status.InverterRecord?.ActivePowerW.ToString() ?? "???")
.TitleBox("AC/DC");
////////////// top //////////////
ActivePower i = 0;
var pvBox = TextBlock.FromString("PV").Box();
var pvFlow = Flow.Vertical(i);
// Load box + vertical flow
var busToLoad = Flow.Vertical(j);
var loadBox = TextBlock.FromString("Load").Box();
var flowToDcBus = Flow.Horizontal(h);
return TextBlock.AlignCenterVertical (
TextBlock.AlignCenterHorizontal(pvBox, pvFlow, acdcBox, busToLoad, loadBox),
flowToDcBus
);
}
private static TextBlock CreateDcBusColumn(
this StatusRecord status,
ActivePower? k)
{
// ┌────────┐ (k) >>>>>>>>> to DC/DC
// │ Dc Bus │>>>>>>>>>>>>>>>>>>>
// ├────────┤
// │ 776 V │
// └────────┘
// PV box + vertical flow
var pvBox = TextBlock.FromString("PV").Box();
var pvToBus = Flow.Vertical(i);
// var pvBox = TextBlock.FromString("PV").Box();
// var pvToBus = Flow.Vertical(i);
// DC bus box (voltage from your DcDc record matches your existing code)
var dcBusVoltage = status.DcDc.Dc.Link.Voltage.Value;
@ -150,13 +156,10 @@ public static class SimpleTopology
// Horizontal flow from DC Bus to DC/DC
var busToDcDc = Flow.Horizontal(k);
// Load box + vertical flow
var busToLoad = Flow.Vertical(j);
var loadBox = TextBlock.FromString("Load").Box();
// Assemble: put PV above DC Bus, Load below DC Bus, and the (k) flow beside the bus.
return TextBlock.AlignCenterVertical(
TextBlock.AlignCenterHorizontal(pvBox, pvToBus, dcBusBox, busToLoad, loadBox),
TextBlock.AlignCenterHorizontal( dcBusBox),
busToDcDc
);
}