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
{
AcDc = acDc,
DcDc = dcDc,
Battery = battery,
Relays = relays,
GridMeter = gridMeter,
AcDc = acDc,
DcDc = dcDc,
Battery = battery,
Relays = relays,
GridMeter = gridMeter,
PvOnAcGrid = pvOnAcGrid,
PvOnAcIsland = pvOnAcIsland,
PvOnDc = pvOnDc,
PvOnAcGrid = pvOnAcGrid,
PvOnAcIsland = pvOnAcIsland,
PvOnDc = pvOnDc,
AcGridToAcIsland = gridBusToIslandBus,
LoadOnAcGrid = gridBusLoad,
LoadOnAcIsland = loadOnAcIsland,
LoadOnDc = dcLoad,
StateMachine = StateMachine.Default,
EssControl = EssControl.Default,
Config = Config.Load() // load from disk every iteration, so config can be changed while running
StateMachine = StateMachine.Default,
EssControl = EssControl.Default,
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.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();