update to 8 inverter in the config file
This commit is contained in:
parent
a137ce67f8
commit
1e12bc708e
|
|
@ -79,7 +79,11 @@ internal static class Program
|
|||
CreateChannel(d.Inverter1),
|
||||
CreateChannel(d.Inverter2),
|
||||
CreateChannel(d.Inverter3),
|
||||
CreateChannel(d.Inverter4)
|
||||
CreateChannel(d.Inverter4),
|
||||
CreateChannel(d.Inverter5),
|
||||
CreateChannel(d.Inverter6),
|
||||
CreateChannel(d.Inverter7),
|
||||
CreateChannel(d.Inverter8)
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -112,9 +116,12 @@ internal static class Program
|
|||
StatusRecord? ReadStatus()
|
||||
{
|
||||
var config = Config.Load();
|
||||
var listOfInverterRecord = devices
|
||||
.Select(device => device.Read())
|
||||
.ToList();
|
||||
|
||||
var readTasks = devices
|
||||
.Select(device => Task.Run(() => device.Read()))
|
||||
.ToArray();
|
||||
|
||||
var listOfInverterRecord = Task.WhenAll(readTasks).GetAwaiter().GetResult().ToList();
|
||||
|
||||
InverterRecords? inverterRecords = InverterRecords.FromInverters(listOfInverterRecord);
|
||||
|
||||
|
|
@ -212,11 +219,7 @@ internal static class Program
|
|||
|
||||
// 1) Finalize previous hour if hour changed
|
||||
var hourlyData = EnergyAggregation.ProcessHourlyData(statusRecord, now);
|
||||
/*if (hourlyData != null)
|
||||
{
|
||||
AggregatedDataFileWriter.AppendHourlyData(hourlyData, baseFolder);
|
||||
}*/
|
||||
if (hourlyData != null)
|
||||
if (hourlyData != null)
|
||||
{
|
||||
AggregatedDataFileWriter.AppendHourlyData(hourlyData, baseFolder);
|
||||
|
||||
|
|
@ -313,6 +316,7 @@ internal static class Program
|
|||
{
|
||||
if (statusrecord?.InverterRecord?.Devices == null) return;
|
||||
|
||||
|
||||
// Compute once (same for all inverters)
|
||||
var config = statusrecord.Config;
|
||||
|
||||
|
|
@ -324,8 +328,11 @@ internal static class Program
|
|||
foreach (var inverter in statusrecord.InverterRecord.Devices)
|
||||
{
|
||||
// constants for every inverter
|
||||
inverter.Battery1BackupSoc = (float)config.MinSoc;
|
||||
inverter.Battery2BackupSoc = (float)config.MinSoc;
|
||||
inverter.Battery1BackupSoc = (Single)config.MinSoc;
|
||||
inverter.Battery2BackupSoc = (Single)config.MinSoc;
|
||||
|
||||
inverter.Battery1MinSoc = 5;
|
||||
inverter.Battery2MinSoc = 5;
|
||||
inverter.RepetitiveWeeks = SinexcelWeekDays.All;
|
||||
|
||||
var operatingMode = config.OperatingPriority switch
|
||||
|
|
@ -466,7 +473,7 @@ internal static class Program
|
|||
var returnedStatus = new StatusMessage
|
||||
{
|
||||
InstallationId = installationId,
|
||||
Product = 2,
|
||||
Product = 2, // 2 for Sodistorehome amd 5 for Sodistorepro
|
||||
Status = _sodiohomeAlarmState,
|
||||
Type = MessageType.AlarmOrWarning,
|
||||
Alarms = alarmList,
|
||||
|
|
@ -653,16 +660,15 @@ internal static class Program
|
|||
var result13 = ConvertToModbusRegisters((status.InverterRecord.TotalBatteryCurrent.Value * 10), "Int32", 31003);
|
||||
var result16 = ConvertToModbusRegisters((status.InverterRecord.AvgBatterySoc.Value * 100), "UInt16", 31005);
|
||||
var result9 = ConvertToModbusRegisters((status.InverterRecord.TotalBatteryPower.Value * 10), "Int32", 31006);
|
||||
|
||||
var result14 = ConvertToModbusRegisters((status.InverterRecord.MinSoc.Value * 100), "UInt16", 31008);
|
||||
var result55 = ConvertToModbusRegisters(100 * 100, "UInt16", 31009); //this is ignored as dosen't exist in Sinexcel
|
||||
var result5 = ConvertToModbusRegisters((status.InverterRecord.AvgBatterySoh.Value * 100), "UInt16", 31009);
|
||||
|
||||
|
||||
var result5 = ConvertToModbusRegisters((status.InverterRecord.AvgBatterySoh.Value * 100), "UInt16", 31010);
|
||||
var result7 = ConvertToModbusRegisters((status.InverterRecord.AvgBatteryTemp.Value * 100), "Int16", 31011);
|
||||
var result20 = ConvertToModbusRegisters((status.InverterRecord.MaxChargeCurrent.Value * 10), "UInt16", 31012);
|
||||
var result15 = ConvertToModbusRegisters((status.InverterRecord.MaxDischargingCurrent.Value * 10), "UInt16", 31013);
|
||||
|
||||
var result26 = ConvertToModbusRegisters(60 * 10, "UInt16", 31014); //this is ignored as dosen't exist in Sinexcel
|
||||
|
||||
var result18 = ConvertToModbusRegisters((status.InverterRecord.TotalPhotovoltaicPower.Value * 10), "UInt32", 32000);
|
||||
var result19 = ConvertToModbusRegisters((status.InverterRecord.TotalGridPower.Value * 10), "Int32", 33000);
|
||||
var result23 = ConvertToModbusRegisters((status.InverterRecord.GridFrequency.Value * 10), "UInt16", 33002);
|
||||
|
|
|
|||
|
|
@ -48,9 +48,13 @@ public class Config
|
|||
{
|
||||
Serial = new() {BaudRate = 115200, Parity = 0, StopBits = 1, DataBits = 8},
|
||||
Inverter1 = new() {DeviceState = DeviceState.Measured, Port = "/dev/ttyUSB0", SlaveId = 1},
|
||||
Inverter2 = new() {DeviceState = DeviceState.Measured, Port = "/dev/ttyUSB1", SlaveId = 1},
|
||||
Inverter3 = new() {DeviceState = DeviceState.Measured, Port = "/dev/ttyUSB3", SlaveId = 1},
|
||||
Inverter4 = new() {DeviceState = DeviceState.Measured, Port = "/dev/ttyUSB4", SlaveId = 1},
|
||||
Inverter2 = new() {DeviceState = DeviceState.Disabled, Port = "/dev/ttyUSB1", SlaveId = 1},
|
||||
Inverter3 = new() {DeviceState = DeviceState.Disabled, Port = "/dev/ttyUSB2", SlaveId = 1},
|
||||
Inverter4 = new() {DeviceState = DeviceState.Disabled, Port = "/dev/ttyUSB3", SlaveId = 1},
|
||||
Inverter5 = new() {DeviceState = DeviceState.Disabled, Port = "/dev/ttyUSB5", SlaveId = 1},
|
||||
Inverter6 = new() {DeviceState = DeviceState.Disabled, Port = "/dev/ttyUSB6", SlaveId = 1},
|
||||
Inverter7 = new() {DeviceState = DeviceState.Disabled, Port = "/dev/ttyUSB7", SlaveId = 1},
|
||||
Inverter8 = new() {DeviceState = DeviceState.Disabled, Port = "/dev/ttyUSB8", SlaveId = 1},
|
||||
},
|
||||
//DynamicPricingEnabled = false,
|
||||
//DynamicPricingMode = DynamicPricingMode.Disabled,
|
||||
|
|
|
|||
|
|
@ -8,4 +8,8 @@ public record DeviceConfig
|
|||
public required SodiDevice Inverter2 { get; init; }
|
||||
public required SodiDevice Inverter3 { get; init; }
|
||||
public required SodiDevice Inverter4 { get; init; }
|
||||
public required SodiDevice Inverter5 { get; init; }
|
||||
public required SodiDevice Inverter6 { get; init; }
|
||||
public required SodiDevice Inverter7 { get; init; }
|
||||
public required SodiDevice Inverter8 { get; init; }
|
||||
}
|
||||
Loading…
Reference in New Issue