GTB: - life time in low level tools, - register store design
This commit is contained in:
+26
-13
@@ -70,6 +70,8 @@
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.saveConfigFile = new System.Windows.Forms.SaveFileDialog();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.btnReadStatus = new System.Windows.Forms.Button();
|
||||
this.btnReadPowCorr = new System.Windows.Forms.Button();
|
||||
this.btnUploadPWFile = new System.Windows.Forms.Button();
|
||||
this.ddlLocation = new System.Windows.Forms.ComboBox();
|
||||
this.btnReadBatAndLog = new System.Windows.Forms.Button();
|
||||
@@ -81,7 +83,6 @@
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.tbxFileToEraseDrive = new System.Windows.Forms.TextBox();
|
||||
this.btnEraseFile = new System.Windows.Forms.Button();
|
||||
this.btnReadPowCorr = new System.Windows.Forms.Button();
|
||||
this.grpSetup.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.groupBox1.SuspendLayout();
|
||||
@@ -490,6 +491,7 @@
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.btnReadStatus);
|
||||
this.groupBox2.Controls.Add(this.btnReadPowCorr);
|
||||
this.groupBox2.Controls.Add(this.btnUploadPWFile);
|
||||
this.groupBox2.Controls.Add(this.ddlLocation);
|
||||
@@ -499,11 +501,31 @@
|
||||
this.groupBox2.Controls.Add(this.btnUploadConfig);
|
||||
this.groupBox2.Location = new System.Drawing.Point(417, 69);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(136, 223);
|
||||
this.groupBox2.Size = new System.Drawing.Size(136, 259);
|
||||
this.groupBox2.TabIndex = 37;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Log";
|
||||
//
|
||||
// btnReadStatus
|
||||
//
|
||||
this.btnReadStatus.Location = new System.Drawing.Point(10, 207);
|
||||
this.btnReadStatus.Name = "btnReadStatus";
|
||||
this.btnReadStatus.Size = new System.Drawing.Size(116, 25);
|
||||
this.btnReadStatus.TabIndex = 44;
|
||||
this.btnReadStatus.Text = "Life Time Info";
|
||||
this.btnReadStatus.UseVisualStyleBackColor = true;
|
||||
this.btnReadStatus.Click += new System.EventHandler(this.btnReadStatus_Click);
|
||||
//
|
||||
// btnReadPowCorr
|
||||
//
|
||||
this.btnReadPowCorr.Location = new System.Drawing.Point(10, 175);
|
||||
this.btnReadPowCorr.Name = "btnReadPowCorr";
|
||||
this.btnReadPowCorr.Size = new System.Drawing.Size(116, 25);
|
||||
this.btnReadPowCorr.TabIndex = 43;
|
||||
this.btnReadPowCorr.Text = "Read Power Corr";
|
||||
this.btnReadPowCorr.UseVisualStyleBackColor = true;
|
||||
this.btnReadPowCorr.Click += new System.EventHandler(this.btnReadPowCorr_Click);
|
||||
//
|
||||
// btnUploadPWFile
|
||||
//
|
||||
this.btnUploadPWFile.Location = new System.Drawing.Point(10, 145);
|
||||
@@ -524,7 +546,7 @@
|
||||
"AfterTestBench",
|
||||
"EOL",
|
||||
"R&D",
|
||||
"Other"});
|
||||
"Actual"});
|
||||
this.ddlLocation.Location = new System.Drawing.Point(10, 116);
|
||||
this.ddlLocation.Name = "ddlLocation";
|
||||
this.ddlLocation.Size = new System.Drawing.Size(52, 21);
|
||||
@@ -619,16 +641,6 @@
|
||||
this.btnEraseFile.UseVisualStyleBackColor = true;
|
||||
this.btnEraseFile.Click += new System.EventHandler(this.btnEraseFile_Click);
|
||||
//
|
||||
// btnReadPowCorr
|
||||
//
|
||||
this.btnReadPowCorr.Location = new System.Drawing.Point(10, 175);
|
||||
this.btnReadPowCorr.Name = "btnReadPowCorr";
|
||||
this.btnReadPowCorr.Size = new System.Drawing.Size(116, 25);
|
||||
this.btnReadPowCorr.TabIndex = 43;
|
||||
this.btnReadPowCorr.Text = "Read Power Corr";
|
||||
this.btnReadPowCorr.UseVisualStyleBackColor = true;
|
||||
this.btnReadPowCorr.Click += new System.EventHandler(this.btnReadPowCorr_Click);
|
||||
//
|
||||
// FrmLowLevelTools
|
||||
//
|
||||
this.AccessibleRole = System.Windows.Forms.AccessibleRole.Sound;
|
||||
@@ -727,5 +739,6 @@
|
||||
private System.Windows.Forms.Button btnReadBatAndLog;
|
||||
private System.Windows.Forms.Button btnUploadPWFile;
|
||||
private System.Windows.Forms.Button btnReadPowCorr;
|
||||
private System.Windows.Forms.Button btnReadStatus;
|
||||
}
|
||||
}
|
||||
@@ -109,7 +109,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
private void FrmLowLevelTools_Load(Object sender, EventArgs e)
|
||||
{
|
||||
var version = Assembly.GetExecutingAssembly().GetName().Version;
|
||||
lblFwUpdateInfo.Text = $@"Version: {version.Major}.{version.Minor}.{version.Build}";
|
||||
lblFwUpdateInfo.Text = $"Version: {version.Major}.{version.Minor}.{version.Build}";
|
||||
_resetTimeMeasurement = true;
|
||||
Init();
|
||||
|
||||
@@ -173,6 +173,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
tbxFileToEraseName.Enabled = false;
|
||||
tbxFileToEraseDrive.Enabled = false;
|
||||
btnUploadPWFile.Enabled = false;
|
||||
btnReadStatus.Enabled = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -197,6 +198,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
tbxFileToEraseName.Enabled = true;
|
||||
tbxFileToEraseDrive.Enabled = true;
|
||||
btnUploadPWFile.Enabled = true;
|
||||
btnReadStatus.Enabled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -258,8 +260,8 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
return;
|
||||
}
|
||||
|
||||
lblOverall.Text = @"Login to Cordonel...";
|
||||
lblActualProcess.Text = @"Establish data base connection...";
|
||||
lblOverall.Text = "Login to Cordonel...";
|
||||
lblActualProcess.Text = "Establish data base connection...";
|
||||
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
@@ -279,12 +281,12 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
_currentGenesis.Configuration.UseRegisterWatchService = false;
|
||||
_currentGenesis.Configuration.UseMinMaxCheck = false;
|
||||
|
||||
Invoke(new Action(() => { lblActualProcess.Text = @"Connecting to PCB..."; }));
|
||||
Invoke(new Action(() => { lblActualProcess.Text = "Connecting to PCB..."; }));
|
||||
_meterBatch.MetersLogin();
|
||||
|
||||
if (!_currentGenesis.IsLoggedOn)
|
||||
{
|
||||
//this is needed from meter as an unsuccessfully login requires a delay for the next trial
|
||||
//this is needed from meter as an unsuccessful login requires a delay for the next trial
|
||||
Thread.Sleep(2000);
|
||||
_meterBatch.MetersLogin();
|
||||
}
|
||||
@@ -311,7 +313,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
LogText("Meter Region: " + _currentGenesis.Region);
|
||||
if (_currentGenesis.RadioFrequencyMhz != null)
|
||||
{
|
||||
tbxRadio.Text = $@"{_currentGenesis.RadioFrequencyMhz}";
|
||||
tbxRadio.Text = $"{_currentGenesis.RadioFrequencyMhz}";
|
||||
LogText($"Meter radio frequency [MHz]: {_currentGenesis.RadioFrequencyMhz}");
|
||||
}
|
||||
|
||||
@@ -343,7 +345,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
return;
|
||||
}
|
||||
|
||||
SetActualProcessAndLog(@"Update Applications and Restart Meter");
|
||||
SetActualProcessAndLog("Update Applications and Restart Meter");
|
||||
ViewProcessControl(true);
|
||||
|
||||
//wait until meter update is completed and meter is re-booted
|
||||
@@ -422,9 +424,9 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
}
|
||||
else
|
||||
{
|
||||
var msg = @"Reboot failed!";
|
||||
var msg = "Reboot failed!";
|
||||
LogText(msg);
|
||||
MessageBoxShow(msg, @"FAILED", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBoxShow(msg, "FAILED", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
|
||||
}
|
||||
}));
|
||||
@@ -570,8 +572,8 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
_currentGenesis.ReLogin();
|
||||
|
||||
var dt = DateTime.UtcNow;
|
||||
var msg = $@"{dt:yyyy-MM-dd HH:mm:ss} UTC";
|
||||
LogText($@"PC date time: {msg}");
|
||||
var msg = $"{dt:yyyy-MM-dd HH:mm:ss} UTC";
|
||||
LogText($"PC date time: {msg}");
|
||||
|
||||
CalculateMeterDateTime(RegisterConverter.ByteArrayToValue<Int32>(
|
||||
_currentGenesis.ReadRegister("SYSTEM_CalendarSeconds")));
|
||||
@@ -596,7 +598,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
var meterDateTime = new TimeT { SecondsSince2000 = secSince2000 };
|
||||
var msg = meterDateTime.ToString();
|
||||
Invoke(new Action(() => { tbxDateTime.Text = msg; }));
|
||||
LogText($@"Meter date time: {msg}");
|
||||
LogText($"Meter date time: {msg}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -711,11 +713,11 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
/// </remarks>
|
||||
private List<String> ListMeterFiles()
|
||||
{
|
||||
SetActualProcessAndLog(@"List meter files drive 0");
|
||||
SetActualProcessAndLog("List meter files drive 0");
|
||||
_meterFile.ReadMeterFileCatalog(out var fileNamesDrive0, MeterFile.StrMeterDrive0);
|
||||
if (fileNamesDrive0.Count == 0)
|
||||
{
|
||||
LogText(@"Could not read drive 0");
|
||||
LogText("Could not read drive 0");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -725,12 +727,12 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
}
|
||||
}
|
||||
|
||||
SetActualProcessAndLog(@"List meter files drive 1");
|
||||
SetActualProcessAndLog("List meter files drive 1");
|
||||
_meterFile.ReadMeterFileCatalog(out var fileNamesDrive1, MeterFile.StrMeterDrive1);
|
||||
|
||||
if (fileNamesDrive1.Count == 0)
|
||||
{
|
||||
LogText(@"Could not read drive 1");
|
||||
LogText("Could not read drive 1");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -789,7 +791,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
var rawDic = new List<Tuple<string, string>>();
|
||||
foreach (var fileName in fileNames)
|
||||
{
|
||||
SetActualProcessAndLog($@"Reading and analyzing {fileName}", logFileName);
|
||||
SetActualProcessAndLog($"Reading and analyzing {fileName}", logFileName);
|
||||
var success = _meterFile.ReadMeterFile(fileName, out var data);
|
||||
|
||||
if (!success)
|
||||
@@ -901,13 +903,13 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
/// </remarks>
|
||||
private List<String> ListLogFiles(String logFileName = null)
|
||||
{
|
||||
SetActualProcessAndLog(@"Flushing the logger");
|
||||
SetActualProcessAndLog("Flushing the logger");
|
||||
_currentGenesis.WriteRegister("LOGGER_TriggerLogFlush", 1);
|
||||
|
||||
CalculateMeterDateTime(RegisterConverter.ByteArrayToValue<Int32>(
|
||||
_currentGenesis.ReadRegister("SYSTEM_CalendarSeconds")));
|
||||
|
||||
SetActualProcessAndLog(@"Reading log index file");
|
||||
SetActualProcessAndLog("Reading log index file");
|
||||
_meterFile.ReadMeterFile(MeterFile.StrMeterEngLogIndexFile, out var data);
|
||||
|
||||
var fileNames = new List<String>();
|
||||
@@ -946,12 +948,12 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
LogText("Analyzing meter files");
|
||||
foreach (var fileName in meterFiles)
|
||||
{
|
||||
Invoke(new Action(() => { lblActualProcess.Text = $@"Analyze file {fileName}"; }));
|
||||
Invoke(new Action(() => { lblActualProcess.Text = $"Analyze file {fileName}"; }));
|
||||
var success = _meterFile.GetFileSize(fileName, out var fileSize);
|
||||
|
||||
LogText(success
|
||||
? $@"File name: {fileName}, File size: {fileSize} byte"
|
||||
: $@"File name: {fileName} Unable to access file");
|
||||
? $"File name: {fileName}, File size: {fileSize} byte"
|
||||
: $"File name: {fileName} Unable to access file");
|
||||
if (success)
|
||||
{
|
||||
continue;
|
||||
@@ -961,6 +963,51 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
_currentGenesis.ReLogin();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read status
|
||||
/// </summary>
|
||||
/// <param name="msg"></param>
|
||||
/// <remarks date="2025-Mar-15" author="Thomas Wiedebusch">
|
||||
/// - Initial
|
||||
/// </remarks>
|
||||
private Boolean BuildGenesisStatus(out String msg)
|
||||
{
|
||||
msg = "";
|
||||
if (_currentGenesis == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_meterFile == null)
|
||||
{
|
||||
_meterFile = new MeterFile(_currentGenesis);
|
||||
}
|
||||
|
||||
_currentGenesis.ReLogin();
|
||||
var sbMSG = new StringBuilder();
|
||||
|
||||
var genesisStatus = new GenesisStatus();
|
||||
if (GenesisStatusHandler.BuildLifeTimeInformation(_currentGenesis, genesisStatus))
|
||||
{
|
||||
sbMSG.AppendLine($"POWERMON_TotalUsedSeconds = {genesisStatus.ExceededLifeTime_s}");
|
||||
sbMSG.AppendLine($"POWERMON_TotalUsedCharge = {genesisStatus.DrainedBatteryLoad_uAs}");
|
||||
sbMSG.AppendLine($"POWERMON_BatteryQuantity = {genesisStatus.BatteryQuantity}");
|
||||
sbMSG.AppendLine($"POWERMON_BatteryMilliAHrRating = {genesisStatus.InitialBatteryLoad_mAh}");
|
||||
sbMSG.AppendLine("");
|
||||
//sbMSG.AppendLine($"Actual storage months: {genesisStatus.StorageMonths:F1}");
|
||||
sbMSG.AppendLine($"Remaining life time in years: {genesisStatus.RemainingLifeTimeYears:F2}");
|
||||
sbMSG.AppendLine($"Totally drained battery load in %: {genesisStatus.DrainedBatteryLoadPercent:F2}");
|
||||
|
||||
msg = sbMSG.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
_currentGenesis.Logout();
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
@@ -1014,7 +1061,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
{
|
||||
var time = DateTimeOffset.UtcNow;
|
||||
var timeSpan = time - _startTime;
|
||||
lblUpdateTime.Text = $@"{(UInt32)timeSpan.TotalMinutes}:{timeSpan.Seconds:00}";
|
||||
lblUpdateTime.Text = $"{(UInt32)timeSpan.TotalMinutes}:{timeSpan.Seconds:00}";
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -1098,7 +1145,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
return;
|
||||
}
|
||||
|
||||
SetActualProcessAndLog(@"Set display of meter to normal operation");
|
||||
SetActualProcessAndLog("Set display of meter to normal operation");
|
||||
|
||||
LowLevelActionControl(true);
|
||||
_currentGenesis.ReLogin();
|
||||
@@ -1121,9 +1168,6 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
/// <remarks date="2022-Dec-20" author="Roland Drabesch">
|
||||
/// - Initial
|
||||
/// </remarks>
|
||||
/// <remarks date="2024-Aug-15" author="Roland Drabesch">
|
||||
/// - Store configuration of POWERMON.
|
||||
/// </remarks>
|
||||
private void btnFixBattery_Click(Object sender, EventArgs e)
|
||||
{
|
||||
if (_currentGenesis == null)
|
||||
@@ -1134,29 +1178,26 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
//reset timer
|
||||
_startTime = DateTimeOffset.UtcNow;
|
||||
|
||||
var msg = @"Fix battery settings";
|
||||
var msg = "Fix battery settings";
|
||||
LogText(msg);
|
||||
lblOverall.Text = msg;
|
||||
|
||||
LowLevelActionControl(true);
|
||||
_currentGenesis.ReLogin();
|
||||
|
||||
SetActualProcessAndLog(@"Seal display for time of setup");
|
||||
SetActualProcessAndLog("Seal display for time of setup");
|
||||
_currentGenesis.WriteRegister("GENESISFLOW_SealDisplay", (UInt32)0);
|
||||
|
||||
SetActualProcessAndLog(@"Reset alarms in meter");
|
||||
SetActualProcessAndLog("Reset alarms in meter");
|
||||
_currentGenesis.ResetAlarm(GenesisMeter.Alarm.ALL);
|
||||
|
||||
SetActualProcessAndLog(@"Set project end time to meter");
|
||||
SetActualProcessAndLog("Set project end time to meter");
|
||||
_currentGenesis.WriteRegister("POWERMON_WarnFromClamp", (UInt32)630720000); // 20 years in seconds
|
||||
|
||||
SetActualProcessAndLog(@"Set meter battery quantity to 2");
|
||||
SetActualProcessAndLog("Set meter battery quantity to 2");
|
||||
_currentGenesis.WriteRegister("POWERMON_BatteryQuantity", (UInt32)2);
|
||||
|
||||
SetActualProcessAndLog(@"Store configuration POWERMON");
|
||||
_currentGenesis.WriteRegister("POWERMON_StoreConfiguration", (UInt32)1);
|
||||
|
||||
SetActualProcessAndLog(@"Trigger idle to release function to normal operation");
|
||||
SetActualProcessAndLog("Trigger idle to release function to normal operation");
|
||||
_currentGenesis.WriteRegister("GENESISFLOW_TriggerIdle", (UInt32)0);
|
||||
|
||||
//add a blank line to separate next operation
|
||||
@@ -1186,7 +1227,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
//reset timer
|
||||
_startTime = DateTimeOffset.UtcNow;
|
||||
|
||||
var msg = @"Store all configurations in meter";
|
||||
var msg = "Store all configurations in meter";
|
||||
LogText(msg);
|
||||
lblActualProcess.Text = msg;
|
||||
|
||||
@@ -1220,7 +1261,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
//reset timer
|
||||
_startTime = DateTimeOffset.UtcNow;
|
||||
|
||||
var msg = @"Reboot meter with pseudo FW update";
|
||||
var msg = "Reboot meter with pseudo FW update";
|
||||
LogText(msg);
|
||||
lblOverall.Text = msg;
|
||||
|
||||
@@ -1274,10 +1315,10 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
|
||||
LowLevelActionControl(true);
|
||||
|
||||
var msg = @"Upload configuration file from meter";
|
||||
var msg = "Upload configuration file from meter";
|
||||
LogText(msg);
|
||||
lblOverall.Text = msg;
|
||||
lblActualProcess.Text = @"Read config file";
|
||||
lblActualProcess.Text = "Read config file";
|
||||
|
||||
var rawData = new List<Byte>();
|
||||
|
||||
@@ -1333,10 +1374,10 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
|
||||
LowLevelActionControl(true);
|
||||
|
||||
var msg = @"Upload power correction file from meter";
|
||||
var msg = "Upload power correction file from meter";
|
||||
LogText(msg);
|
||||
lblOverall.Text = msg;
|
||||
lblActualProcess.Text = @"Read power correction file";
|
||||
lblActualProcess.Text = "Read power correction file";
|
||||
|
||||
|
||||
Task.Factory.StartNew(() =>
|
||||
@@ -1351,7 +1392,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
}
|
||||
else
|
||||
{
|
||||
LogText(@"Power correction file not existing!");
|
||||
LogText("Power correction file not existing!");
|
||||
}
|
||||
}).ContinueWith(delegate
|
||||
{
|
||||
@@ -1388,10 +1429,10 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
|
||||
LowLevelActionControl(true);
|
||||
|
||||
var msg = @"Upload hashed password file from meter:";
|
||||
var msg = "Upload hashed password file from meter:";
|
||||
LogText(msg);
|
||||
lblOverall.Text = msg;
|
||||
lblActualProcess.Text = @"Read password file";
|
||||
lblActualProcess.Text = "Read password file";
|
||||
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
@@ -1415,7 +1456,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
}
|
||||
else
|
||||
{
|
||||
LogText(@"Password file not existing!");
|
||||
LogText("Password file not existing!");
|
||||
}
|
||||
}).ContinueWith(delegate
|
||||
{
|
||||
@@ -1441,11 +1482,11 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
return;
|
||||
}
|
||||
|
||||
var msg = @"Set actual PC date and time in UTC";
|
||||
var msg = "Set actual PC date and time in UTC";
|
||||
LogText(msg);
|
||||
lblOverall.Text = msg;
|
||||
|
||||
SetActualProcessAndLog(@"Set seconds since 2000-01-01 00:00:00 to meter");
|
||||
SetActualProcessAndLog("Set seconds since 2000-01-01 00:00:00 to meter");
|
||||
|
||||
LowLevelActionControl(true);
|
||||
_currentGenesis.ReLogin();
|
||||
@@ -1499,7 +1540,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
|
||||
LowLevelActionControl(true);
|
||||
|
||||
var msg = @"Upload engineering log file from meter";
|
||||
var msg = "Upload engineering log file from meter";
|
||||
LogText(msg);
|
||||
lblOverall.Text = msg;
|
||||
|
||||
@@ -1508,7 +1549,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Collect life time information and production status.
|
||||
/// Collect lifetime information and production status.
|
||||
/// </summary>
|
||||
/// <remarks date="2023-Jan-04" author="Roland Drabesch/Thomas Wiedebusch">
|
||||
/// - Initial
|
||||
@@ -1530,8 +1571,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
|
||||
LowLevelActionControl(true);
|
||||
|
||||
|
||||
var msg = @"Collect all information";
|
||||
var msg = "Collect all information";
|
||||
LogText(msg);
|
||||
lblOverall.Text = msg;
|
||||
|
||||
@@ -1539,29 +1579,9 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
File.AppendAllLines(filename, _frmHistory.rtbHistory.Lines);
|
||||
|
||||
LogText($"Station: {ddlLocation.Items[ddlLocation.SelectedIndex]}", filename);
|
||||
var dt = DateTime.UtcNow;
|
||||
msg = $@"{dt:yyyy-MM-dd HH:mm:ss} UTC";
|
||||
|
||||
LogText($@"PC date time: {msg}", filename);
|
||||
|
||||
_currentGenesis.ReLogin();
|
||||
|
||||
var genesisStatus = new GenesisStatus();
|
||||
if (GenesisStatusHandler.BuildLifeTimeInformation(_currentGenesis, genesisStatus))
|
||||
if (BuildGenesisStatus(out msg))
|
||||
{
|
||||
|
||||
var sbMSG = new StringBuilder();
|
||||
sbMSG.AppendLine($"Pcb = {_currentGenesis.PcbId}");
|
||||
|
||||
sbMSG.AppendLine($"POWERMON_TotalUsedSeconds = {genesisStatus.ExceededLifeTime_s}");
|
||||
sbMSG.AppendLine($"POWERMON_TotalUsedCharge = {genesisStatus.DrainedBatteryLoad_uAs}");
|
||||
sbMSG.AppendLine($"POWERMON_BatteryQuantity = {genesisStatus.BatteryQuantity}");
|
||||
sbMSG.AppendLine($"POWERMON_BatteryMilliAHrRating = {genesisStatus.InitialBatteryLoad_mAh}");
|
||||
sbMSG.AppendLine("");
|
||||
sbMSG.AppendLine($"Remaining life time in years {genesisStatus.RemainingLifeTimeYears:F2}");
|
||||
sbMSG.AppendLine($"Totally drained battery load in % {genesisStatus.DrainedBatteryLoadPercent:F2}");
|
||||
|
||||
LogText(sbMSG.ToString(), filename);
|
||||
LogText(msg, filename);
|
||||
}
|
||||
|
||||
ReadLogFiles(filename);
|
||||
@@ -1573,24 +1593,24 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
LogText(resp, filename);
|
||||
var sbRegister = new StringBuilder();
|
||||
|
||||
var Ledmode = RegisterConverter.ByteArrayToValue<UInt16>(_currentGenesis.ReadRegister("GENESISFLOW_LedMode"));
|
||||
var LedMode = RegisterConverter.ByteArrayToValue<UInt16>(_currentGenesis.ReadRegister("GENESISFLOW_LedMode"));
|
||||
var SampleRate = RegisterConverter.ByteArrayToValue<UInt16>(_currentGenesis.ReadRegister("GENESISFLOW_SampleRate"));
|
||||
sbRegister.AppendLine($"LedMode is {Ledmode}");
|
||||
sbRegister.AppendLine($"LedMode is {LedMode}");
|
||||
|
||||
|
||||
sbRegister.AppendLine($"SampelRate is {SampleRate}");
|
||||
sbRegister.AppendLine($"SampleRate is {SampleRate}");
|
||||
|
||||
if (Ledmode != 0)
|
||||
if (LedMode != 0)
|
||||
{
|
||||
_currentGenesis.WriteRegister("GENESISFLOW_LedMode", 0);
|
||||
sbRegister.AppendLine($"Change Led mode to Customermode (0)");
|
||||
sbRegister.AppendLine($"Change Led mode to CustomerMode (0)");
|
||||
}
|
||||
|
||||
|
||||
if (SampleRate != 2)
|
||||
{
|
||||
_currentGenesis.WriteRegister("GENESISFLOW_SampleRate", 2);
|
||||
sbRegister.AppendLine($"Change SampleRate mode to Customermode (2)");
|
||||
sbRegister.AppendLine($"Change SampleRate mode to CustomerMode (2)");
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
@@ -1623,7 +1643,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
|
||||
LowLevelActionControl(true);
|
||||
|
||||
var msg = @"List file details of meter";
|
||||
var msg = "List file details of meter";
|
||||
LogText(msg);
|
||||
lblOverall.Text = msg;
|
||||
|
||||
@@ -1671,7 +1691,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
|
||||
LowLevelActionControl(true);
|
||||
|
||||
var msg = @"Tidy file system";
|
||||
var msg = "Tidy file system";
|
||||
LogText(msg);
|
||||
lblOverall.Text = msg;
|
||||
|
||||
@@ -1680,7 +1700,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
_currentGenesis.ReLogin();
|
||||
|
||||
// catalogue before cleaning
|
||||
SetActualProcessAndLog(@"List meter files before cleaning");
|
||||
SetActualProcessAndLog("List meter files before cleaning");
|
||||
|
||||
// build file erase candidates for all releases
|
||||
var fileEraseCandidates = new List<String>();
|
||||
@@ -1734,13 +1754,13 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
// erase files
|
||||
foreach (var fileToErase in fileEraseCandidates)
|
||||
{
|
||||
Invoke(new Action(() => { lblActualProcess.Text = $@"Erase {fileToErase}"; }));
|
||||
Invoke(new Action(() => { lblActualProcess.Text = $"Erase {fileToErase}"; }));
|
||||
_meterFile.UnlockEraseWriteMeterFile(fileToErase);
|
||||
var success = _meterFile.EraseMeterFile(fileToErase);
|
||||
|
||||
LogText(success
|
||||
? $@"File {fileToErase} successfully erased"
|
||||
: $@"File {fileToErase} erasure failed");
|
||||
? $"File {fileToErase} successfully erased"
|
||||
: $"File {fileToErase} erasure failed");
|
||||
|
||||
if (success)
|
||||
{
|
||||
@@ -1751,7 +1771,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
_currentGenesis.ReLogin();
|
||||
}
|
||||
// catalogue after cleaning
|
||||
SetActualProcessAndLog(@"List meter files after cleaning");
|
||||
SetActualProcessAndLog("List meter files after cleaning");
|
||||
ListMeterFiles();
|
||||
|
||||
LogText("File system is cleaned up");
|
||||
@@ -1791,7 +1811,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
LowLevelActionControl(true);
|
||||
|
||||
var file = $@"{tbxFileToEraseDrive.Text}\{tbxFileToEraseName.Text}";
|
||||
var msg = $@"Erase file {file}";
|
||||
var msg = $"Erase file {file}";
|
||||
LogText(msg);
|
||||
lblOverall.Text = msg;
|
||||
|
||||
@@ -1804,11 +1824,11 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
var success = _meterFile.EraseMeterFile(file);
|
||||
|
||||
LogText(success
|
||||
? $@"File {file} successfully erased"
|
||||
: $@"File {file} erasure failed");
|
||||
? $"File {file} successfully erased"
|
||||
: $"File {file} erasure failed");
|
||||
|
||||
// catalogue after cleaning
|
||||
SetActualProcessAndLog(@"List meter files");
|
||||
SetActualProcessAndLog("List meter files");
|
||||
ListMeterFiles();
|
||||
|
||||
}).ContinueWith(delegate
|
||||
@@ -1848,7 +1868,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
//reset timer
|
||||
_startTime = DateTimeOffset.UtcNow;
|
||||
|
||||
var msg = @"Switch pulse mode OFF";
|
||||
var msg = "Switch pulse mode OFF";
|
||||
LogText(msg);
|
||||
lblActualProcess.Text = msg;
|
||||
|
||||
@@ -1864,6 +1884,22 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
LowLevelActionControl(false);
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Read status
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
/// <remarks date="2025-Mar-15" author="Thomas Wiedebusch">
|
||||
/// - Initial
|
||||
/// </remarks>
|
||||
private void btnReadStatus_Click(Object sender, EventArgs e)
|
||||
{
|
||||
if (BuildGenesisStatus(out var msg))
|
||||
{
|
||||
LogText(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -78,7 +78,7 @@
|
||||
//
|
||||
// btnRead
|
||||
//
|
||||
this.btnRead.Location = new System.Drawing.Point(205, 55);
|
||||
this.btnRead.Location = new System.Drawing.Point(205, 48);
|
||||
this.btnRead.Name = "btnRead";
|
||||
this.btnRead.Size = new System.Drawing.Size(185, 30);
|
||||
this.btnRead.TabIndex = 2;
|
||||
@@ -246,7 +246,7 @@
|
||||
//
|
||||
// button3
|
||||
//
|
||||
this.button3.Location = new System.Drawing.Point(114, 55);
|
||||
this.button3.Location = new System.Drawing.Point(34, 80);
|
||||
this.button3.Name = "button3";
|
||||
this.button3.Size = new System.Drawing.Size(85, 30);
|
||||
this.button3.TabIndex = 63;
|
||||
|
||||
Reference in New Issue
Block a user