Create an apply Default settings for dc
This commit is contained in:
parent
8455bb64e3
commit
f1c03ad333
|
@ -322,7 +322,7 @@ internal static class Program
|
|||
});
|
||||
}
|
||||
|
||||
private static void ApplyDefaultSettings(this SystemControlRegisters? sc)
|
||||
private static void ApplyDefaultSettingsAc(this SystemControlRegisters? sc)
|
||||
{
|
||||
if (sc is null)
|
||||
return;
|
||||
|
@ -333,7 +333,7 @@ internal static class Program
|
|||
#if DEBUG
|
||||
sc.CommunicationTimeout = TimeSpan.FromMinutes(2);
|
||||
#else
|
||||
sc.CommunicationTimeout = TimeSpan.FromSeconds(10);
|
||||
sc.CommunicationTimeout = TimeSpan.FromSeconds(20);
|
||||
#endif
|
||||
|
||||
sc.PowerSetPointActivation = PowerSetPointActivation.Immediate;
|
||||
|
@ -342,38 +342,32 @@ internal static class Program
|
|||
sc.SubSlaveErrorHandling = SubSlaveErrorHandling.Off;
|
||||
sc.ResetAlarmsAndWarnings = true;
|
||||
}
|
||||
|
||||
private static DcDcDevicesRecord ResetAlarms(this DcDcDevicesRecord dcDcStatus)
|
||||
|
||||
private static void ApplyDefaultSettingsDc(this SystemControlRegisters? sc)
|
||||
{
|
||||
var sc = dcDcStatus.SystemControl;
|
||||
if (sc is null)
|
||||
return;
|
||||
|
||||
sc.SystemConfig = DcDcOnly;
|
||||
|
||||
if (sc is not null)
|
||||
sc.ResetAlarmsAndWarnings = sc.Alarms.Any();
|
||||
|
||||
foreach (var d in dcDcStatus.Devices)
|
||||
d.Control.ResetAlarmsAndWarnings = d.Status.Alarms.Any() || d.Status.Warnings.Any();
|
||||
|
||||
return dcDcStatus;
|
||||
}
|
||||
|
||||
private static AcDcDevicesRecord ResetAlarms(this AcDcDevicesRecord acDcRecord)
|
||||
{
|
||||
var sc = acDcRecord.SystemControl;
|
||||
|
||||
if (sc is not null)
|
||||
sc.ResetAlarmsAndWarnings = sc.Alarms.Any() || sc.Warnings.Any();
|
||||
|
||||
foreach (var d in acDcRecord.Devices)
|
||||
d.Control.ResetAlarmsAndWarnings = d.Status.Alarms.Any() || d.Status.Warnings.Any();
|
||||
|
||||
return acDcRecord;
|
||||
#if DEBUG
|
||||
sc.CommunicationTimeout = TimeSpan.FromMinutes(2);
|
||||
#else
|
||||
sc.CommunicationTimeout = TimeSpan.FromSeconds(20);
|
||||
#endif
|
||||
|
||||
sc.PowerSetPointActivation = PowerSetPointActivation.Immediate;
|
||||
sc.UseSlaveIdForAddressing = true;
|
||||
sc.SlaveErrorHandling = SlaveErrorHandling.Relaxed;
|
||||
sc.SubSlaveErrorHandling = SubSlaveErrorHandling.Off;
|
||||
sc.ResetAlarmsAndWarnings = true;
|
||||
}
|
||||
|
||||
private static async Task UploadCsv(StatusRecord status, UnixTime timeStamp)
|
||||
{
|
||||
timeStamp.WriteLine();
|
||||
|
||||
var csv = status.ToCsv().WriteLine();
|
||||
var csv = status.ToCsv();//.WriteLine();
|
||||
var s3Path = timeStamp + ".csv";
|
||||
var request = S3Config.CreatePutRequest(s3Path);
|
||||
var response = await request.PutAsync(new StringContent(csv));
|
||||
|
|
Loading…
Reference in New Issue