Update naming and space

This commit is contained in:
atef 2024-02-05 15:36:45 +01:00
parent 63a9df5826
commit 7be2fd1fcc
1 changed files with 100 additions and 100 deletions

View File

@ -211,29 +211,29 @@ internal static class Program
/******************************************** For Debug Display *************************************/
int nodeIndex = 2; // Starting node number
//foreach (var batteryNodeRecord in record.Battery.Devices)
//{
// var ioStates = batteryNodeRecord.IoStates;
// var strings = batteryNodeRecord.BatteryStrings;
// batteryNodeRecord.FwVersion.WriteLine(" FwVersion ");
// Convert.ToString(ioStates, 2).PadLeft(16, '0').WriteLine($" IoStates Battery node {nodeIndex}");
// batteryNodeRecord.Dc.Current.WriteLine($" Current Battery node {nodeIndex}");
// batteryNodeRecord.Dc.Voltage.WriteLine($" Voltage Battery node {nodeIndex}");
// var stringsString1Active = strings.String1Active;
// stringsString1Active.WriteLine(" BatteryString1");
// strings.String2Active.WriteLine(" BatteryString2");
// strings.String3Active.WriteLine(" BatteryString3");
// strings.String4Active.WriteLine(" BatteryString4");
// strings.String5Active.WriteLine(" BatteryString5");
//
// ("********************************************************").WriteLine();
// nodeIndex++;
//}
// record.GridMeter?.ActivePowerExportT1.WriteLine("kWh Import 7008");
// record.GridMeter?.ActivePowerImportT1.WriteLine("kWh Export 7028");
// record.GridMeter?.ActivePowerExportT2.WriteLine("Wh Import 6008");
// record.GridMeter?.ActivePowerImportT2.WriteLine("Wh Export 6028");
// record.GridMeter?.ActivePowerExportT3.WriteLine("Kwh Import 8004");
// record.GridMeter?.ActivePowerImportT3.WriteLine("kWh Export 8014");
// record.GridMeter?.ActivePowerExportT4.WriteLine("port 5906");
// record.GridMeter?.ActivePowerImportT4.WriteLine("port 5914");
//record.GridMeter?.ActivePowerExportT1.WriteLine("kWh Export 5910");
//record.GridMeter?.ActivePowerImportT1.WriteLine("kWh Import 5902");
//record.GridMeter?.ActivePowerExportT2.WriteLine("Wh Export 6008");
//record.GridMeter?.ActivePowerImportT2.WriteLine("Wh Import 6028");
//record.GridMeter?.ActivePowerExportT3.WriteLine("Kwh Import 8004");
//record.GridMeter?.ActivePowerImportT3.WriteLine("kWh Export 8014");
//record.GridMeter?.ActivePowerExportT4.WriteLine("port 5906");
//record.GridMeter?.ActivePowerImportT4.WriteLine("port 5914");
var currentSalimaxState = GetSalimaxStateAlarm(record);
@ -334,85 +334,85 @@ internal static class Program
});
}
foreach (var alarm in record.AcDc.Alarms)
{
alarmList.Add(new AlarmOrWarning
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
CreatedBy = "AcDc",
Description = alarm.ToString()
});
}
foreach (var alarm in record.AcDc.Alarms)
{
alarmList.Add(new AlarmOrWarning
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
CreatedBy = "AcDc",
Description = alarm.ToString()
});
}
foreach (var alarm in record.DcDc.Alarms)
{
alarmList.Add(new AlarmOrWarning
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
CreatedBy = "DcDc",
Description = alarm.ToString()
});
}
foreach (var alarm in record.DcDc.Alarms)
{
alarmList.Add(new AlarmOrWarning
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
CreatedBy = "DcDc",
Description = alarm.ToString()
});
}
if (record.Battery != null)
{
var i = 0;
if (record.Battery != null)
{
var i = 0;
foreach (var battery in record.Battery.Devices)
{
foreach (var alarm in battery.Alarms)
{
alarmList.Add(new AlarmOrWarning
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
CreatedBy = "Battery node" + record.Config.Devices.BatteryNodes[i],
Description = alarm
});
i++;
}
}
foreach (var battery in record.Battery.Devices)
{
foreach (var alarm in battery.Alarms)
{
alarmList.Add(new AlarmOrWarning
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
CreatedBy = "Battery node" + record.Config.Devices.BatteryNodes[i],
Description = alarm
});
i++;
}
}
}
}
foreach (var warning in record.AcDc.Warnings)
{
warningList.Add(new AlarmOrWarning
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
CreatedBy = "AcDc",
Description = warning.ToString()
});
}
foreach (var warning in record.AcDc.Warnings)
{
warningList.Add(new AlarmOrWarning
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
CreatedBy = "AcDc",
Description = warning.ToString()
});
}
foreach (var warning in record.DcDc.Warnings)
{
warningList.Add(new AlarmOrWarning
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
CreatedBy = "DcDc",
Description = warning.ToString()
});
}
foreach (var warning in record.DcDc.Warnings)
{
warningList.Add(new AlarmOrWarning
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
CreatedBy = "DcDc",
Description = warning.ToString()
});
}
if (record.Battery != null)
{
var i = 0;
foreach (var warning in record.Battery.Warnings)
{
warningList.Add(new AlarmOrWarning
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
CreatedBy = "Battery node" + record.Config.Devices.BatteryNodes[i],
Description = warning
});
}
}
if (record.Battery != null)
{
var i = 0;
foreach (var warning in record.Battery.Warnings)
{
warningList.Add(new AlarmOrWarning
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
CreatedBy = "Battery node" + record.Config.Devices.BatteryNodes[i],
Description = warning
});
}
}
var salimaxAlarmsState = (record.Battery is not null && record.Battery.Warnings.Any())
| record.AcDc.Warnings.Any()
@ -429,18 +429,18 @@ internal static class Program
? SalimaxAlarmState.Red
: salimaxAlarmsState; // this will be replaced by LedState
int.TryParse(s3Bucket?.Split("-")[0], out var installationId);
int.TryParse(s3Bucket?.Split("-")[0], out var installationId);
var returnedStatus = new StatusMessage
{
InstallationId = installationId,
Status = salimaxAlarmsState,
Type = MessageType.AlarmOrWarning,
Alarms = alarmList,
Warnings = warningList
};
var returnedStatus = new StatusMessage
{
InstallationId = installationId,
Status = salimaxAlarmsState,
Type = MessageType.AlarmOrWarning,
Alarms = alarmList,
Warnings = warningList
};
return returnedStatus;
return returnedStatus;
}
private static String? DetectAlarmStates(this StatusRecord r) => r.Relays switch
@ -493,7 +493,7 @@ internal static class Program
r.AcDc.ResetAlarms();
}
// This is will be used for provider throtling
// This is will be used for provider throttling
private static void ControlPvPower(this StatusRecord r, Int16 exportLimit = 100)
{
var inverters = r.AcDc.Devices;