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)
|
if (sc is null)
|
||||||
return;
|
return;
|
||||||
|
@ -333,7 +333,7 @@ internal static class Program
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
sc.CommunicationTimeout = TimeSpan.FromMinutes(2);
|
sc.CommunicationTimeout = TimeSpan.FromMinutes(2);
|
||||||
#else
|
#else
|
||||||
sc.CommunicationTimeout = TimeSpan.FromSeconds(10);
|
sc.CommunicationTimeout = TimeSpan.FromSeconds(20);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sc.PowerSetPointActivation = PowerSetPointActivation.Immediate;
|
sc.PowerSetPointActivation = PowerSetPointActivation.Immediate;
|
||||||
|
@ -342,38 +342,32 @@ internal static class Program
|
||||||
sc.SubSlaveErrorHandling = SubSlaveErrorHandling.Off;
|
sc.SubSlaveErrorHandling = SubSlaveErrorHandling.Off;
|
||||||
sc.ResetAlarmsAndWarnings = true;
|
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)
|
#if DEBUG
|
||||||
sc.ResetAlarmsAndWarnings = sc.Alarms.Any();
|
sc.CommunicationTimeout = TimeSpan.FromMinutes(2);
|
||||||
|
#else
|
||||||
foreach (var d in dcDcStatus.Devices)
|
sc.CommunicationTimeout = TimeSpan.FromSeconds(20);
|
||||||
d.Control.ResetAlarmsAndWarnings = d.Status.Alarms.Any() || d.Status.Warnings.Any();
|
#endif
|
||||||
|
|
||||||
return dcDcStatus;
|
sc.PowerSetPointActivation = PowerSetPointActivation.Immediate;
|
||||||
}
|
sc.UseSlaveIdForAddressing = true;
|
||||||
|
sc.SlaveErrorHandling = SlaveErrorHandling.Relaxed;
|
||||||
private static AcDcDevicesRecord ResetAlarms(this AcDcDevicesRecord acDcRecord)
|
sc.SubSlaveErrorHandling = SubSlaveErrorHandling.Off;
|
||||||
{
|
sc.ResetAlarmsAndWarnings = true;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task UploadCsv(StatusRecord status, UnixTime timeStamp)
|
private static async Task UploadCsv(StatusRecord status, UnixTime timeStamp)
|
||||||
{
|
{
|
||||||
timeStamp.WriteLine();
|
timeStamp.WriteLine();
|
||||||
|
|
||||||
var csv = status.ToCsv().WriteLine();
|
var csv = status.ToCsv();//.WriteLine();
|
||||||
var s3Path = timeStamp + ".csv";
|
var s3Path = timeStamp + ".csv";
|
||||||
var request = S3Config.CreatePutRequest(s3Path);
|
var request = S3Config.CreatePutRequest(s3Path);
|
||||||
var response = await request.PutAsync(new StringContent(csv));
|
var response = await request.PutAsync(new StringContent(csv));
|
||||||
|
|
Loading…
Reference in New Issue