reduce debug clutter
This commit is contained in:
parent
bf4bd20efa
commit
2d6c6b6140
|
@ -31,8 +31,6 @@ namespace InnovEnergy.App.SaliMax;
|
||||||
|
|
||||||
internal static class Program
|
internal static class Program
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
private static readonly UnixTimeSpan UpdateInterval = UnixTimeSpan.FromSeconds(2);
|
private static readonly UnixTimeSpan UpdateInterval = UnixTimeSpan.FromSeconds(2);
|
||||||
|
|
||||||
private static readonly IReadOnlyList<Byte> BatteryNodes;
|
private static readonly IReadOnlyList<Byte> BatteryNodes;
|
||||||
|
@ -100,25 +98,12 @@ internal static class Program
|
||||||
|
|
||||||
StatusRecord ReadStatus()
|
StatusRecord ReadStatus()
|
||||||
{
|
{
|
||||||
"Reading battery".LogInfo();
|
|
||||||
var battery = batteryDevices.Read().WriteLine();
|
var battery = batteryDevices.Read().WriteLine();
|
||||||
|
|
||||||
"Reading AcDC".LogInfo();
|
|
||||||
var acDc = acDcDevices.Read();
|
var acDc = acDcDevices.Read();
|
||||||
|
|
||||||
"Reading DcDc".LogInfo();
|
|
||||||
var dcDc = dcDcDevices.Read();
|
var dcDc = dcDcDevices.Read();
|
||||||
|
|
||||||
"Reading relays".LogInfo();
|
|
||||||
var relays = saliMaxRelaysDevice.Read();
|
var relays = saliMaxRelaysDevice.Read();
|
||||||
|
|
||||||
"Reading loadOnAcIsland".LogInfo();
|
|
||||||
var loadOnAcIsland = acIslandLoadMeter.Read();
|
var loadOnAcIsland = acIslandLoadMeter.Read();
|
||||||
|
|
||||||
"Reading gridMeter".LogInfo();
|
|
||||||
var gridMeter = gridMeterDevice.Read();
|
var gridMeter = gridMeterDevice.Read();
|
||||||
|
|
||||||
"Reading pvOnDc".LogInfo();
|
|
||||||
var pvOnDc = amptDevice.Read();
|
var pvOnDc = amptDevice.Read();
|
||||||
|
|
||||||
var pvOnAcGrid = AcPowerDevice.Null;
|
var pvOnAcGrid = AcPowerDevice.Null;
|
||||||
|
@ -214,7 +199,6 @@ internal static class Program
|
||||||
|
|
||||||
(t + "\n").LogInfo();
|
(t + "\n").LogInfo();
|
||||||
$"{record.StateMachine.State}: {record.StateMachine.Message}".LogInfo();
|
$"{record.StateMachine.State}: {record.StateMachine.Message}".LogInfo();
|
||||||
$"Batteries SOC: {record.Battery.Soc}".LogInfo();
|
|
||||||
|
|
||||||
var essControl = record.ControlEss().LogInfo();
|
var essControl = record.ControlEss().LogInfo();
|
||||||
|
|
||||||
|
@ -339,24 +323,23 @@ internal static class Program
|
||||||
if (s.GridMeter is not null)
|
if (s.GridMeter is not null)
|
||||||
{
|
{
|
||||||
totalBoxes = TextBlock.AlignCenterVertical(gridBox,
|
totalBoxes = TextBlock.AlignCenterVertical(gridBox,
|
||||||
gridBusFlow,
|
gridBusFlow,
|
||||||
gridBusColumn,
|
gridBusColumn,
|
||||||
flowGridBusToIslandBus,
|
flowGridBusToIslandBus,
|
||||||
islandBusColumn,
|
islandBusColumn,
|
||||||
flowIslandBusToInverter,
|
flowIslandBusToInverter,
|
||||||
inverterBox,
|
inverterBox,
|
||||||
flowInverterToDcBus,
|
flowInverterToDcBus,
|
||||||
dcBusColumn,
|
dcBusColumn,
|
||||||
flowDcBusToDcDc,
|
flowDcBusToDcDc,
|
||||||
dcDcBox,
|
dcDcBox,
|
||||||
flowDcDcToBattery,
|
flowDcDcToBattery,
|
||||||
batteryAvgBox,
|
batteryAvgBox,
|
||||||
individualBatteries);
|
individualBatteries);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
totalBoxes = TextBlock.AlignCenterVertical(
|
totalBoxes = TextBlock.AlignCenterVertical(islandBusColumn,
|
||||||
islandBusColumn,
|
|
||||||
flowIslandBusToInverter,
|
flowIslandBusToInverter,
|
||||||
inverterBox,
|
inverterBox,
|
||||||
flowInverterToDcBus,
|
flowInverterToDcBus,
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
using InnovEnergy.App.SaliMax.Ess;
|
using InnovEnergy.App.SaliMax.Ess;
|
||||||
using InnovEnergy.App.SaliMax.SaliMaxRelays;
|
using InnovEnergy.App.SaliMax.SaliMaxRelays;
|
||||||
using InnovEnergy.Lib.Devices.Trumpf.TruConvertAc;
|
using InnovEnergy.Lib.Devices.Trumpf.TruConvertAc;
|
||||||
using InnovEnergy.Lib.Devices.Trumpf.TruConvertAc.DataTypes;
|
|
||||||
using InnovEnergy.Lib.Devices.Trumpf.TruConvertDc;
|
using InnovEnergy.Lib.Devices.Trumpf.TruConvertDc;
|
||||||
using InnovEnergy.Lib.Utils;
|
|
||||||
using static InnovEnergy.Lib.Devices.Trumpf.SystemControl.DataTypes.GridType;
|
using static InnovEnergy.Lib.Devices.Trumpf.SystemControl.DataTypes.GridType;
|
||||||
|
|
||||||
namespace InnovEnergy.App.SaliMax.System;
|
namespace InnovEnergy.App.SaliMax.System;
|
||||||
|
@ -22,42 +20,17 @@ public static class Controller
|
||||||
if (acDcs.NotAvailable())
|
if (acDcs.NotAvailable())
|
||||||
return 102;
|
return 102;
|
||||||
|
|
||||||
var i = 0;
|
|
||||||
|
|
||||||
foreach (var s in acDcs.Devices)
|
|
||||||
{
|
|
||||||
i++;
|
|
||||||
s.Control.PowerStageEnable.WriteLine(" Inverter "+ i + ": Power Stage");
|
|
||||||
String.Join(Environment.NewLine + i, s.Status.Alarms).LogInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
var allDisabled = acDcs.AllDisabled();
|
var k4 = acDcs.AllGridTied() ? 0
|
||||||
var allEnabled = acDcs.AllEnabled();
|
: acDcs.AllIsland() ? 1
|
||||||
var allGridTied = acDcs.AllGridTied();
|
|
||||||
var allIsland = acDcs.AllIsland();
|
|
||||||
|
|
||||||
|
|
||||||
var k4 = allGridTied ? 0
|
|
||||||
: allIsland ? 1
|
|
||||||
: 4;
|
: 4;
|
||||||
|
|
||||||
var k5 = allDisabled ? 0
|
var k5 = acDcs.AllDisabled() ? 0
|
||||||
: allEnabled ? 1
|
: acDcs.AllEnabled() ? 1
|
||||||
: 4;
|
: 4;
|
||||||
|
|
||||||
// After testing this, It looks it more messing up the system and get stuck in a cycle of open one inverter and close the other one.
|
|
||||||
// The solution is always to send the open/close command in every cycle, if one open before the other(s) , the next cycle will open the other inverter(s).
|
|
||||||
|
|
||||||
//if (!acDcs.AllTheSame())
|
|
||||||
//{
|
|
||||||
// k4 = 4;
|
|
||||||
// "Panic: ACDCs have unequal power stage".LogError();
|
|
||||||
//}
|
|
||||||
|
|
||||||
if (k4 == 4 || k5 == 4)
|
if (k4 == 4 || k5 == 4)
|
||||||
{
|
|
||||||
return 103; //Message = "Panic: ACDCs have unequal grid types or power stage",
|
return 103; //Message = "Panic: ACDCs have unequal grid types or power stage",
|
||||||
}
|
|
||||||
|
|
||||||
var nInverters = r.AcDc.Devices.Count;
|
var nInverters = r.AcDc.Devices.Count;
|
||||||
|
|
||||||
|
@ -66,12 +39,11 @@ public static class Controller
|
||||||
var k3 = relays.K3InverterIsConnectedToIslandBus.Take(nInverters).Any(c => c) ? 1 : 0;
|
var k3 = relays.K3InverterIsConnectedToIslandBus.Take(nInverters).Any(c => c) ? 1 : 0;
|
||||||
|
|
||||||
// states as defined in states excel sheet
|
// states as defined in states excel sheet
|
||||||
return
|
return 1 * k1
|
||||||
1*k1
|
+ 2 * k2
|
||||||
+ 2*k2
|
+ 4 * k3
|
||||||
+ 4*k3
|
+ 8 * k4
|
||||||
+ 8*k4
|
+ 16 * k5;
|
||||||
+ 16*k5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean ControlSystemState(this StatusRecord s)
|
public static Boolean ControlSystemState(this StatusRecord s)
|
||||||
|
@ -322,7 +294,6 @@ public static class Controller
|
||||||
return s.EnableSafeDefaults();
|
return s.EnableSafeDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static Boolean State103(StatusRecord s)
|
private static Boolean State103(StatusRecord s)
|
||||||
{
|
{
|
||||||
s.StateMachine.Message = "Panic: ACDCs have unequal grid types or PowerStage";
|
s.StateMachine.Message = "Panic: ACDCs have unequal grid types or PowerStage";
|
||||||
|
|
Loading…
Reference in New Issue