Add an config input to display iundvidual batteries
This commit is contained in:
parent
1d6aafec60
commit
71fb914c41
|
@ -16,6 +16,7 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
|
||||||
|
|
||||||
public required Double MinSoc { get; set; }
|
public required Double MinSoc { get; set; }
|
||||||
public required Boolean ForceCalibrationCharge { get; set; }
|
public required Boolean ForceCalibrationCharge { 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; }
|
||||||
|
@ -40,6 +41,7 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
|
||||||
{
|
{
|
||||||
MinSoc = 20,
|
MinSoc = 20,
|
||||||
ForceCalibrationCharge = false,
|
ForceCalibrationCharge = false,
|
||||||
|
DisplayIndividualBatteries = false,
|
||||||
PConstant = .5,
|
PConstant = .5,
|
||||||
GridSetPoint = 0,
|
GridSetPoint = 0,
|
||||||
BatterySelfDischargePower = 200,
|
BatterySelfDischargePower = 200,
|
||||||
|
@ -115,7 +117,8 @@ 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 = false,
|
||||||
|
DisplayIndividualBatteries = false,
|
||||||
PConstant = .5,
|
PConstant = .5,
|
||||||
GridSetPoint = 0,
|
GridSetPoint = 0,
|
||||||
BatterySelfDischargePower = 200,
|
BatterySelfDischargePower = 200,
|
||||||
|
|
|
@ -368,27 +368,22 @@ public static class Topology
|
||||||
var bat = status.Battery;
|
var bat = status.Battery;
|
||||||
var batteryAvgBox = CreateAveragedBatteryBox(bat);
|
var batteryAvgBox = CreateAveragedBatteryBox(bat);
|
||||||
|
|
||||||
return batteryAvgBox; // TODO: individualBatteries hidden atm
|
|
||||||
|
|
||||||
|
|
||||||
#pragma warning disable CS0162
|
|
||||||
var batteryBoxes = bat
|
var batteryBoxes = bat
|
||||||
.Devices
|
.Devices
|
||||||
.Select(CreateBatteryBox)
|
.Select(CreateBatteryBox)
|
||||||
.ToReadOnlyList();
|
.ToReadOnlyList();
|
||||||
|
|
||||||
var individualBatteries = batteryBoxes.Any()
|
|
||||||
? TextBlock.AlignLeft(batteryBoxes)
|
|
||||||
: TextBlock.Empty;
|
|
||||||
|
|
||||||
return TextBlock
|
var individualWithAvgBox = TextBlock
|
||||||
.AlignCenterVertical
|
.AlignCenterVertical
|
||||||
(
|
(
|
||||||
batteryAvgBox ,
|
batteryAvgBox ,
|
||||||
individualBatteries
|
batteryBoxes.Any()
|
||||||
);
|
? TextBlock.AlignLeft(batteryBoxes)
|
||||||
|
: TextBlock.Empty
|
||||||
#pragma warning enable CS0162
|
);
|
||||||
|
|
||||||
|
return status.Config.DisplayIndividualBatteries ? individualWithAvgBox : batteryAvgBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TextBlock CreateAveragedBatteryBox(Battery48TlRecords? bat)
|
private static TextBlock CreateAveragedBatteryBox(Battery48TlRecords? bat)
|
||||||
|
|
Loading…
Reference in New Issue