temporary implemented new battery calculations and requirements checks
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Logic.ProductionToProductMapper.Cordonel;
|
||||
using LaaPackages.Features.Cordonel.Models;
|
||||
using Logic.ProductionToProductMapper.Cordonel;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -569,10 +570,10 @@ namespace CordonelAssemblyLine.Model
|
||||
meter.SetProcessState(DisplayCodes.PickingStarted);
|
||||
var ret = RunCheck(checkAppsIdVersion, frequency, meterSize, pressurePresent, meter);
|
||||
lblS08Color = _progressWaiting;
|
||||
var sbMSG = new StringBuilder();
|
||||
|
||||
if (ret)
|
||||
{
|
||||
|
||||
|
||||
if (!meter.WriteRegister("POWERMON_BatteryQuantity", 2, true, true))
|
||||
{
|
||||
lblS08Text = "1";
|
||||
@@ -582,55 +583,157 @@ namespace CordonelAssemblyLine.Model
|
||||
|
||||
meter.WriteRegister("POWERMON_StoreConfiguration", 1, true);
|
||||
|
||||
|
||||
|
||||
|
||||
var genesisStatus = new GenesisStatus();
|
||||
var requirements = new CordonelRequirements();
|
||||
|
||||
// this calculates all life time values
|
||||
if (!GenesisStatusHandler.BuildLifeTimeInformation(meter, genesisStatus, out _))
|
||||
if (GenesisStatusHandler.GetCordonelRequirementInfoFromDbByFANr(_order, requirements, out var error))
|
||||
{
|
||||
meter.WriteLog("Batterie nicht lesbar");
|
||||
lblS08Text = "Batterie nicht lesbar";
|
||||
lblS08Color = _progressError;
|
||||
ret = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
var sbMSG = new StringBuilder();
|
||||
sbMSG.AppendLine($"Pcb = {meter.PcbId}");
|
||||
genesisStatus.QuiescentCurrent_uA = requirements.QuiescentCurrent_uA;
|
||||
genesisStatus.EstimatedProductionBatteryLoadPercent = requirements.EstimatedProductionBatteryLoadPercent;
|
||||
|
||||
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}");
|
||||
|
||||
if (genesisStatus.RemainingLifeTimeYears >= 21 || genesisStatus.DrainedBatteryLoadPercent <= 1)
|
||||
if (GenesisStatusHandler.BuildLifeTimeInformation(meter, genesisStatus, out _))
|
||||
{
|
||||
lblS08Text = $"{genesisStatus.RemainingLifeTimeYears} Jahre";
|
||||
sbMSG.AppendLine($"Pcb = {meter.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}");
|
||||
|
||||
//restlaufzeit monate -RequiredLifeTimeYearsAssembly
|
||||
|
||||
|
||||
var hasFehlern = false;
|
||||
|
||||
// restlaufzeit monate - RequiredLifeTimeYearsAssembly
|
||||
if (genesisStatus.RemainingLifeTimeYears < requirements.RequiredLifeTimeYearsAssembly)
|
||||
{
|
||||
lblS08Text = $"{nameof(genesisStatus.RemainingLifeTimeYears)}: " +
|
||||
$"{genesisStatus.RemainingLifeTimeYears} < " +
|
||||
$"{requirements.RequiredLifeTimeYearsAssembly}";
|
||||
lblS08Color = _progressError;
|
||||
ret = false;
|
||||
sbMSG.AppendLine($"{nameof(genesisStatus.RemainingLifeTimeYears)}: " +
|
||||
$"{genesisStatus.RemainingLifeTimeYears} < " +
|
||||
$"{requirements.RequiredLifeTimeYearsAssembly}");
|
||||
}
|
||||
else sbMSG.AppendLine($"Restlaufzeit i.O.");
|
||||
|
||||
|
||||
|
||||
|
||||
if (genesisStatus.AlternativeRequiredBatteryLoadPercent != null &&
|
||||
genesisStatus.AlternativeRequiredBatteryLoadPercent > requirements.MaxDrainedBatteryLoadPercentAssembly)
|
||||
{
|
||||
sbMSG.AppendLine($"{nameof(genesisStatus.AlternativeRequiredBatteryLoadPercent)}: " +
|
||||
$"{genesisStatus.AlternativeRequiredBatteryLoadPercent} > " +
|
||||
$"{requirements.MaxDrainedBatteryLoadPercentAssembly}");
|
||||
ret = false;
|
||||
}
|
||||
else sbMSG.AppendLine($"Alternative Batterieverbrauch Montage i.O.");
|
||||
// max bat verbrauch - MaxDrainedBatteryLoadPercentAssembly
|
||||
|
||||
if (genesisStatus.DrainedBatteryLoadPercent > requirements.MaxDrainedBatteryLoadPercentAssembly)
|
||||
{
|
||||
lblS08Text = $"{nameof(genesisStatus.DrainedBatteryLoadPercent)}: " +
|
||||
$"{genesisStatus.DrainedBatteryLoadPercent} > " +
|
||||
$"{requirements.MaxDrainedBatteryLoadPercentAssembly}";
|
||||
lblS08Color = _progressError;
|
||||
ret = false;
|
||||
sbMSG.AppendLine($"{nameof(genesisStatus.DrainedBatteryLoadPercent)}: " +
|
||||
$"{genesisStatus.DrainedBatteryLoadPercent} > " +
|
||||
$"{requirements.MaxDrainedBatteryLoadPercentAssembly}");
|
||||
}
|
||||
else sbMSG.AppendLine($"Maximaler Batterieverbrauch Montage i.O.");
|
||||
// lagerzeit - MaxStorageMonths
|
||||
if (genesisStatus.StorageMonths > requirements.MaxStorageMonths)
|
||||
{
|
||||
lblS08Text = $"{nameof(genesisStatus.DrainedBatteryLoadPercent)}: " +
|
||||
$"{genesisStatus.DrainedBatteryLoadPercent} > " +
|
||||
$"{requirements.MaxDrainedBatteryLoadPercentAssembly}";
|
||||
lblS08Color = _progressError;
|
||||
ret = false;
|
||||
sbMSG.AppendLine($"{nameof(genesisStatus.StorageMonths)}: " +
|
||||
$"{genesisStatus.StorageMonths} > " +
|
||||
$"{requirements.MaxStorageMonths}");
|
||||
}
|
||||
|
||||
else sbMSG.AppendLine($"Maximallagerzeit i.O.");
|
||||
meter.WriteLog(sbMSG.ToString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
lblS08Text = $"{genesisStatus.RemainingLifeTimeYears} Jahre";
|
||||
meter.WriteLog("Batterie nicht lesbar");
|
||||
lblS08Text = "Batterie nicht lesbar";
|
||||
lblS08Color = _progressError;
|
||||
ret = false;
|
||||
}
|
||||
if (_orderDetails.FrequencyIndicator == 0)
|
||||
{
|
||||
if ((342000000 + (genesisStatus.ExceededLifeTime_s * 77.7)) <= genesisStatus.DrainedBatteryLoad_uAs)
|
||||
{
|
||||
lblS08Text = $"UNT Limit überschritten";
|
||||
lblS08Color = _progressError;
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
meter.WriteLog(sbMSG.ToString());
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(error)) error = "Fehler beim laden von Cordonel Freigaben";
|
||||
|
||||
|
||||
meter.WriteLog(error);
|
||||
lblS08Text = error;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
lblS08Color = _progressError;
|
||||
ret = false;
|
||||
}
|
||||
|
||||
// this calculates all life time values
|
||||
}
|
||||
|
||||
if (!ret)
|
||||
sbMSG.AppendLine($"Battery lifetime limits sind Übreschritten");
|
||||
else
|
||||
sbMSG.AppendLine($"Battery lifetime limits sind OK");
|
||||
|
||||
if (_skipProcessSteps == null || !_skipProcessSteps.SkipLUT)
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user