Update Configuration from frontend

This commit is contained in:
Noe 2024-03-19 13:12:47 +01:00
parent 242969306b
commit a4e3683082
5 changed files with 7 additions and 7 deletions

View File

@ -4,7 +4,7 @@ public class Configuration
{ {
public Double MinimumSoC { get; set; } public Double MinimumSoC { get; set; }
public Double GridSetPoint { get; set; } public Double GridSetPoint { get; set; }
public CalibrationChargeType ForceCalibrationCharge { get; set; } public CalibrationChargeType CalibrationChargeState { get; set; }
public DateTime CalibrationChargeDate { get; set; } public DateTime CalibrationChargeDate { get; set; }
} }

View File

@ -6,7 +6,7 @@ public class Configuration
{ {
public Double MinimumSoC { get; set; } public Double MinimumSoC { get; set; }
public Double GridSetPoint { get; set; } public Double GridSetPoint { get; set; }
public CalibrationChargeType ForceCalibrationChargeState { get; set; } public CalibrationChargeType CalibrationChargeState { get; set; }
public DateTime CalibrationChargeDate { get; set; } public DateTime CalibrationChargeDate { get; set; }
} }

View File

@ -64,7 +64,7 @@ public static class MiddlewareAgent
Configuration? config = JsonSerializer.Deserialize<Configuration>(message); Configuration? config = JsonSerializer.Deserialize<Configuration>(message);
Console.WriteLine($"Received a configuration message: GridSetPoint is " + config.GridSetPoint + ", MinimumSoC is " + config.MinimumSoC + " and ForceCalibrationCharge is " + config.ForceCalibrationChargeState+ " and CalibrationChargeDate is " + config.CalibrationChargeDate); Console.WriteLine($"Received a configuration message: GridSetPoint is " + config.GridSetPoint + ", MinimumSoC is " + config.MinimumSoC + " and ForceCalibrationCharge is " + config.CalibrationChargeState+ " and CalibrationChargeDate is " + config.CalibrationChargeDate);
// Send the reply to the sender's endpoint // Send the reply to the sender's endpoint
UdpListener.Send(replyData, replyData.Length, serverEndpoint); UdpListener.Send(replyData, replyData.Length, serverEndpoint);

View File

@ -690,13 +690,13 @@ internal static class Program
{ {
status.Config.MinSoc = config.MinimumSoC; status.Config.MinSoc = config.MinimumSoC;
status.Config.GridSetPoint = config.GridSetPoint * 1000; // converted from kW to W status.Config.GridSetPoint = config.GridSetPoint * 1000; // converted from kW to W
status.Config.ForceCalibrationChargeState = config.ForceCalibrationChargeState; status.Config.ForceCalibrationChargeState = config.CalibrationChargeState;
if (config.ForceCalibrationChargeState == CalibrationChargeType.RepetitivelyEvery) if (config.CalibrationChargeState == CalibrationChargeType.RepetitivelyEvery)
{ {
status.Config.DayAndTimeForRepetitiveCalibration = config.CalibrationChargeDate; status.Config.DayAndTimeForRepetitiveCalibration = config.CalibrationChargeDate;
} }
else if (config.ForceCalibrationChargeState == CalibrationChargeType.AdditionallyOnce) else if (config.CalibrationChargeState == CalibrationChargeType.AdditionallyOnce)
{ {
status.Config.DayAndTimeForAdditionalCalibration = config.CalibrationChargeDate; status.Config.DayAndTimeForAdditionalCalibration = config.CalibrationChargeDate;
} }

View File

@ -5,4 +5,4 @@ public enum CalibrationChargeType
RepetitivelyEvery, RepetitivelyEvery,
AdditionallyOnce, AdditionallyOnce,
ChargePermanently ChargePermanently
} }