Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
da7f75c55c
|
@ -1,3 +1,4 @@
|
||||||
|
using InnovEnergy.App.SaliMax.SystemConfig;
|
||||||
using InnovEnergy.Lib.Devices.Battery48TL;
|
using InnovEnergy.Lib.Devices.Battery48TL;
|
||||||
using InnovEnergy.Lib.Devices.Battery48TL.DataTypes;
|
using InnovEnergy.Lib.Devices.Battery48TL.DataTypes;
|
||||||
using InnovEnergy.Lib.Devices.Trumpf.TruConvertAc.DataTypes;
|
using InnovEnergy.Lib.Devices.Trumpf.TruConvertAc.DataTypes;
|
||||||
|
@ -187,18 +188,24 @@ public static class Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Boolean MustDoCalibrationCharge(this StatusRecord statusRecord)
|
private static Boolean MustDoCalibrationCharge(this StatusRecord statusRecord)
|
||||||
{
|
{
|
||||||
var calibrationChargeForced = statusRecord.Config.ForceCalibrationCharge;
|
var calibrationChargeForced = statusRecord.Config.ForceCalibrationCharge;
|
||||||
|
|
||||||
var batteryCalibrationChargeRequested = statusRecord.Battery?.CalibrationChargeRequested?? false ;
|
var batteryCalibrationChargeRequested = statusRecord.Battery?.CalibrationChargeRequested?? false ;
|
||||||
|
|
||||||
var mustDoCalibrationCharge = batteryCalibrationChargeRequested || calibrationChargeForced;
|
var mustDoCalibrationCharge = batteryCalibrationChargeRequested || calibrationChargeForced == CalibrationChargeType.Yes || calibrationChargeForced == CalibrationChargeType.UntilEoc ;
|
||||||
|
|
||||||
|
if (statusRecord.Battery is not null)
|
||||||
|
{
|
||||||
|
if (calibrationChargeForced == CalibrationChargeType.UntilEoc && statusRecord.Battery.Eoc )
|
||||||
|
{
|
||||||
|
statusRecord.Config.ForceCalibrationCharge = CalibrationChargeType.No;
|
||||||
|
}
|
||||||
|
}
|
||||||
return mustDoCalibrationCharge;
|
return mustDoCalibrationCharge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static Double ControlGridPower(this StatusRecord status, Double targetPower)
|
private static Double ControlGridPower(this StatusRecord status, Double targetPower)
|
||||||
{
|
{
|
||||||
return ControlPower
|
return ControlPower
|
||||||
(
|
(
|
||||||
|
|
|
@ -25,7 +25,7 @@ public record StatusRecord
|
||||||
public required DcPowerDevice? LoadOnDc { get; init; }
|
public required DcPowerDevice? LoadOnDc { get; init; }
|
||||||
public required RelaysRecord? Relays { get; init; }
|
public required RelaysRecord? Relays { get; init; }
|
||||||
public required AmptStatus? PvOnDc { get; init; }
|
public required AmptStatus? PvOnDc { get; init; }
|
||||||
public required Config Config { get; init; }
|
public required Config Config { get; set; }
|
||||||
public required SystemLog Log { get; set; } // TODO: init only
|
public required SystemLog Log { get; set; } // TODO: init only
|
||||||
|
|
||||||
public required EssControl EssControl { get; set; } // TODO: init only
|
public required EssControl EssControl { get; set; } // TODO: init only
|
||||||
|
|
|
@ -59,7 +59,7 @@ internal static class Program
|
||||||
private static IModel? _channel;
|
private static IModel? _channel;
|
||||||
private static Boolean _subscribedToQueue = false;
|
private static Boolean _subscribedToQueue = false;
|
||||||
private static Boolean _subscribeToQueueForTheFirstTime = false;
|
private static Boolean _subscribeToQueueForTheFirstTime = false;
|
||||||
private static SalimaxAlarmState _prevSalimaxState = SalimaxAlarmState.Green;
|
private static SalimaxAlarmState _prevSalimaxState = SalimaxAlarmState.Green;
|
||||||
private static Int32 _heartBitInterval = 0;
|
private static Int32 _heartBitInterval = 0;
|
||||||
|
|
||||||
static Program()
|
static Program()
|
||||||
|
@ -247,7 +247,7 @@ internal static class Program
|
||||||
|
|
||||||
(record.Relays is null ? "No relay Data available" : record.Relays.FiWarning ? "Alert: Fi Warning Detected" : "No Fi Warning Detected").WriteLine();
|
(record.Relays is null ? "No relay Data available" : record.Relays.FiWarning ? "Alert: Fi Warning Detected" : "No Fi Warning Detected").WriteLine();
|
||||||
(record.Relays is null ? "No relay Data available" : record.Relays.FiError ? "Alert: Fi Error Detected" : "No Fi Error Detected") .WriteLine();
|
(record.Relays is null ? "No relay Data available" : record.Relays.FiError ? "Alert: Fi Error Detected" : "No Fi Error Detected") .WriteLine();
|
||||||
|
|
||||||
record.Config.Save();
|
record.Config.Save();
|
||||||
|
|
||||||
"===========================================".LogInfo();
|
"===========================================".LogInfo();
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
namespace InnovEnergy.App.SaliMax.SystemConfig;
|
||||||
|
|
||||||
|
public enum CalibrationChargeType
|
||||||
|
{
|
||||||
|
No,
|
||||||
|
UntilEoc,
|
||||||
|
Yes
|
||||||
|
}
|
|
@ -14,25 +14,25 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
|
||||||
|
|
||||||
private static readonly JsonSerializerOptions JsonOptions = new() { WriteIndented = true };
|
private static readonly JsonSerializerOptions JsonOptions = new() { WriteIndented = true };
|
||||||
|
|
||||||
public required Double MinSoc { get; set; }
|
public required Double MinSoc { get; set; }
|
||||||
public required Boolean ForceCalibrationCharge { get; set; }
|
public required CalibrationChargeType ForceCalibrationCharge { get; set; }
|
||||||
public required Boolean DisplayIndividualBatteries { get; set; }
|
public required Boolean DisplayIndividualBatteries { get; set; }
|
||||||
public required Double PConstant { get; set; }
|
public required Double PConstant { get; set; }
|
||||||
public required Double GridSetPoint { get; set; }
|
public required Double GridSetPoint { get; set; }
|
||||||
public required Double BatterySelfDischargePower { get; set; }
|
public required Double BatterySelfDischargePower { get; set; }
|
||||||
public required Double HoldSocZone { get; set; }
|
public required Double HoldSocZone { get; set; }
|
||||||
public required DevicesConfig IslandMode { get; set; }
|
public required DevicesConfig IslandMode { get; set; }
|
||||||
public required DevicesConfig GridTie { get; set; }
|
public required DevicesConfig GridTie { get; set; }
|
||||||
|
|
||||||
public required Double MaxBatteryChargingCurrent { get; set; }
|
public required Double MaxBatteryChargingCurrent { get; set; }
|
||||||
public required Double MaxBatteryDischargingCurrent { get; set; }
|
public required Double MaxBatteryDischargingCurrent { get; set; }
|
||||||
public required Double MaxDcPower { get; set; }
|
public required Double MaxDcPower { get; set; }
|
||||||
|
|
||||||
public required Double MaxChargeBatteryVoltage { get; set; }
|
public required Double MaxChargeBatteryVoltage { get; set; }
|
||||||
public required Double MinDischargeBatteryVoltage { get; set; }
|
public required Double MinDischargeBatteryVoltage { get; set; }
|
||||||
|
|
||||||
public required DeviceConfig Devices { get; set; }
|
public required DeviceConfig Devices { get; set; }
|
||||||
public required S3Config? S3 { get; set; }
|
public required S3Config? S3 { get; set; }
|
||||||
|
|
||||||
private static String? LastSavedData { get; set; }
|
private static String? LastSavedData { get; set; }
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
|
||||||
public static Config Default => new()
|
public static Config Default => new()
|
||||||
{
|
{
|
||||||
MinSoc = 20,
|
MinSoc = 20,
|
||||||
ForceCalibrationCharge = false,
|
ForceCalibrationCharge = CalibrationChargeType.No,
|
||||||
DisplayIndividualBatteries = false,
|
DisplayIndividualBatteries = false,
|
||||||
PConstant = .5,
|
PConstant = .5,
|
||||||
GridSetPoint = 0,
|
GridSetPoint = 0,
|
||||||
|
@ -117,7 +117,7 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
|
||||||
public static Config Default => new()
|
public static Config Default => new()
|
||||||
{
|
{
|
||||||
MinSoc = 20,
|
MinSoc = 20,
|
||||||
ForceCalibrationCharge = false,
|
ForceCalibrationCharge = CalibrationChargeType.No,
|
||||||
DisplayIndividualBatteries = false,
|
DisplayIndividualBatteries = false,
|
||||||
PConstant = .5,
|
PConstant = .5,
|
||||||
GridSetPoint = 0,
|
GridSetPoint = 0,
|
||||||
|
|
Loading…
Reference in New Issue