Add Log {Led and Message} for Salimax status and alarm

This commit is contained in:
atef 2023-10-04 15:17:43 +02:00
parent 1afcbfbf4f
commit 04bfbfc8b9
2 changed files with 21 additions and 12 deletions

View File

@ -0,0 +1,8 @@
namespace InnovEnergy.App.SaliMax.Ess;
public enum LedState
{
Red,
Orange,
Green
}

View File

@ -114,24 +114,25 @@ internal static class Program
return new StatusRecord return new StatusRecord
{ {
AcDc = acDc, AcDc = acDc,
DcDc = dcDc, DcDc = dcDc,
Battery = battery, Battery = battery,
Relays = relays, Relays = relays,
GridMeter = gridMeter, GridMeter = gridMeter,
PvOnAcGrid = pvOnAcGrid, PvOnAcGrid = pvOnAcGrid,
PvOnAcIsland = pvOnAcIsland, PvOnAcIsland = pvOnAcIsland,
PvOnDc = pvOnDc, PvOnDc = pvOnDc,
AcGridToAcIsland = gridBusToIslandBus, AcGridToAcIsland = gridBusToIslandBus,
LoadOnAcGrid = gridBusLoad, LoadOnAcGrid = gridBusLoad,
LoadOnAcIsland = loadOnAcIsland, LoadOnAcIsland = loadOnAcIsland,
LoadOnDc = dcLoad, LoadOnDc = dcLoad,
StateMachine = StateMachine.Default, StateMachine = StateMachine.Default,
EssControl = EssControl.Default, EssControl = EssControl.Default,
Config = Config.Load() // load from disk every iteration, so config can be changed while running Log = new SystemLog{Led = LedState.Green, Message = null}, //TODO: Put real stuff
Config = Config.Load() // load from disk every iteration, so config can be changed while running
}; };
} }
@ -183,7 +184,7 @@ internal static class Program
record.ControlConstants(); record.ControlConstants();
record.ControlSystemState(); record.ControlSystemState();
$"{DateTime.Now} : {record.StateMachine.State}: {record.StateMachine.Message}".WriteLine().LogInfo(); $"{UnixTime.Now} : {record.StateMachine.State}: {record.StateMachine.Message}".WriteLine().LogInfo();
var essControl = record.ControlEss().WriteLine().LogInfo(); var essControl = record.ControlEss().WriteLine().LogInfo();