Update the Print Display

This commit is contained in:
atef 2023-06-23 10:41:20 +02:00
parent b5f025dc69
commit 3a2050dcbc
1 changed files with 35 additions and 16 deletions

View File

@ -226,9 +226,29 @@ internal static class Program
// Power Calculated Values // Power Calculated Values
var islandToGridBusPower = inverterPower + islandLoadPower; var islandToGridBusPower = inverterPower + islandLoadPower;
var gridLoadPower = gridPower - islandToGridBusPower; var gridLoadPower = s.LoadOnAcGrid is null ? 0: s.LoadOnAcGrid.Power.Active;
var gridPowerByPhase = TextBlock.AlignLeft(s.GridMeter.Ac.L1.Power.Active.ToStringRounded(),
s.GridMeter.Ac.L2.Power.Active.ToStringRounded(),
s.GridMeter.Ac.L3.Power.Active.ToStringRounded());
var gridVoltageByPhase = TextBlock.AlignLeft(s.GridMeter.Ac.L1.Voltage.ToStringRounded(),
s.GridMeter.Ac.L2.Voltage.ToStringRounded(),
s.GridMeter.Ac.L3.Voltage.ToStringRounded());
var inverterPowerByPhase = TextBlock.AlignLeft(s.AcDc.Ac.L1.Power.Active.ToStringRounded(),
s.AcDc.Ac.L2.Power.Active.ToStringRounded(),
s.AcDc.Ac.L3.Power.Active.ToStringRounded());
// ReSharper disable once CoVariantArrayConversion
var inverterPowerByAcDc = TextBlock.AlignLeft(s.AcDc.Devices
.Select(s1 => s1.Status.Ac.Power)
.ToArray());
var dcLinkVoltage = TextBlock.CenterHorizontal("",
s.DcDc.Dc.Link.Voltage.ToStringRounded(),
"");
var gridPowerByPhase = s.GridMeter.Ac.L1.Power.Active.ToString()+ "," + s.GridMeter.Ac.L2.Power.Active + s.GridMeter.Ac.L3.Power.Active;
//var inverterPowerByPhase = new ActivePower[(Int32)s.AcDc.Ac.L1.Power.Active, (Int32)s.AcDc.Ac.L2.Power.Active, (Int32)s.AcDc.Ac.L3.Power.Active]; //var inverterPowerByPhase = new ActivePower[(Int32)s.AcDc.Ac.L1.Power.Active, (Int32)s.AcDc.Ac.L2.Power.Active, (Int32)s.AcDc.Ac.L3.Power.Active];
// Voltage Measurement Values // Voltage Measurement Values
@ -240,21 +260,20 @@ internal static class Program
var batteryCurrent = s.Battery.Dc.Current; var batteryCurrent = s.Battery.Dc.Current;
var batteryTemp = s.Battery.Temperature; var batteryTemp = s.Battery.Temperature;
gridPowerByPhase.Split(","); var gridBusColumn = ColumnBox("Pv", "Grid Bus", "Load" , gridVoltageByPhase , gridLoadPower);
var gridBusColumn = ColumnBox("Pv", "Grid Bus", "Load" , "Voltage", gridLoadPower); var islandBusColumn = ColumnBox("Pv", "Island Bus", "Load" , inverterPowerByPhase, islandLoadPower);
var islandBusColumn = ColumnBox("Pv", "Island Bus", "Load" , "Voltage", islandLoadPower); var dcBusColumn = ColumnBox("Pv", "Dc Bus", "Load" , dcLinkVoltage, 0, pvOnDcPower);
var dcBusColumn = ColumnBox("Pv", "Dc Bus", "Load" , "DC Link V", 0, pvOnDcPower);
var gridBusFlow = Flow.Horizontal(gridPower); var gridBusFlow = Flow.Horizontal(gridPower);
var flowGridBusToIslandBus = Flow.Horizontal((ActivePower)islandToGridBusPower); var flowGridBusToIslandBus = Flow.Horizontal((ActivePower)islandToGridBusPower);
var flowIslandBusToInverter = Flow.Horizontal(inverterPower); var flowIslandBusToInverter = Flow.Horizontal(inverterPower);
var flowInverterToDcBus = Flow.Horizontal(inverterPower); var flowInverterToDcBus = Flow.Horizontal(inverterPower);
var flowDcBusToDcDc = Flow.Horizontal(-dcdcPower); var flowDcBusToDcDc = Flow.Horizontal(dcdcPower);
var flowDcDcToBattery = Flow.Horizontal(-dcBatteryPower); var flowDcDcToBattery = Flow.Horizontal(dcBatteryPower);
var gridBox = TextBlock.AlignLeft("none","none", "none").TitleBox("Grid"); var gridBox = TextBlock.AlignLeft(gridPowerByPhase).TitleBox("Grid");
var inverterBox = TextBlock.AlignLeft("none","none", "none").TitleBox("Inverter"); var inverterBox = TextBlock.AlignLeft(inverterPowerByAcDc).TitleBox("Inverter");
var dcDcBox = TextBlock.AlignLeft(dc48Voltage).TitleBox("DC/DC"); var dcDcBox = TextBlock.AlignLeft(dc48Voltage).TitleBox("DC/DC");
var batteryBox = TextBlock.AlignLeft(batteryVoltage, batterySoc, batteryCurrent, batteryTemp).TitleBox("Battery"); var batteryBox = TextBlock.AlignLeft(batteryVoltage.ToStringRounded(), batterySoc.ToStringRounded(), batteryCurrent.ToStringRounded(), batteryTemp.ToStringRounded()).TitleBox("Battery");
@ -275,17 +294,17 @@ internal static class Program
totalBoxes.WriteLine(); totalBoxes.WriteLine();
} }
private static TextBlock ColumnBox(String pvTitle, String busTitle, String loadTitle, String dataBox) private static TextBlock ColumnBox(String pvTitle, String busTitle, String loadTitle, TextBlock dataBox)
{ {
return ColumnBox(pvTitle, busTitle, loadTitle, dataBox, 0); return ColumnBox(pvTitle, busTitle, loadTitle, dataBox, 0);
} }
private static TextBlock ColumnBox(String pvTitle, String busTitle, String loadTitle, String dataBox, ActivePower loadPower) private static TextBlock ColumnBox(String pvTitle, String busTitle, String loadTitle, TextBlock dataBox, ActivePower loadPower)
{ {
return ColumnBox(pvTitle, busTitle, loadTitle, dataBox, loadPower, 0); return ColumnBox(pvTitle, busTitle, loadTitle, dataBox, loadPower, 0);
} }
private static TextBlock ColumnBox(String pvTitle, String busTitle, String loadTitle, String dataBox, ActivePower loadPower, ActivePower pvPower) private static TextBlock ColumnBox(String pvTitle, String busTitle, String loadTitle, TextBlock dataBox, ActivePower loadPower, ActivePower pvPower)
{ {
var pvBox = TextBlock.AlignLeft("").TitleBox(pvTitle); var pvBox = TextBlock.AlignLeft("").TitleBox(pvTitle);
var pvToBus = Flow.Vertical(pvPower); var pvToBus = Flow.Vertical(pvPower);