diff options
| author | Roy <Roy.mail.net@gmail.com> | 2023-06-27 13:16:21 +0300 |
|---|---|---|
| committer | Roy <Roy.mail.net@gmail.com> | 2023-06-27 13:16:21 +0300 |
| commit | c267a46b14ebb3babe8a0378bd403346ca182354 (patch) | |
| tree | a7d69a29c00c9b2976168bf42d7ad228e1f91680 /Software/Visual_Studio/PPC/Tango.PPC.UI/Models | |
| parent | 0f150c98978332377ee6aad3eac8c8a08553a8e7 (diff) | |
| parent | a5de87ea9863c6e7053e09ed1c2eabf58285af48 (diff) | |
| download | Tango-c267a46b14ebb3babe8a0378bd403346ca182354.tar.gz Tango-c267a46b14ebb3babe8a0378bd403346ca182354.zip | |
Merge branch 'eureka' of https://twinetfs.visualstudio.com/Tango/_git/Tango into eureka
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Models')
4 files changed, 153 insertions, 19 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorItem.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorItem.cs new file mode 100644 index 000000000..3925a1752 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorItem.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; + +namespace Tango.PPC.UI.Models +{ + public class MachineOverviewErrorItem : ExtendedObject + { + private bool _isErrorState; + + public bool IsErrorState + { + get { return _isErrorState; } + set { _isErrorState = value; RaisePropertyChangedAuto();} + } + + public MachineOverviewErrorItem() + { + IsErrorState = false; + } + + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorStates.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorStates.cs new file mode 100644 index 000000000..1863b01e1 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorStates.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; + +namespace Tango.PPC.UI.Models +{ + public class MachineOverviewErrorStates : ExtendedObject + { + public ObservableCollection<MachineOverviewErrorItem> Winders { get; set; } + + public ObservableCollection<MachineOverviewErrorItem> Dancers { get; set; } + + public ObservableCollection<MachineOverviewErrorItem> BTSRs { get; set; } + + public MachineOverviewErrorStates() + { + Winders = new ObservableCollection<MachineOverviewErrorItem>(); + Dancers = new ObservableCollection<MachineOverviewErrorItem>(); + BTSRs = new ObservableCollection<MachineOverviewErrorItem>(); + for ( int i = 0; i < 4 ; i++) + { + Winders.Add( new MachineOverviewErrorItem()); + Dancers.Add(new MachineOverviewErrorItem()); + BTSRs.Add(new MachineOverviewErrorItem()); + } + } + + public void UpdateWinders(List<bool> updates) + { + if(!UpdateCollection(Winders, updates)) + { + LogManager.Log("Error in display Winders Errors. Number of Winders In Error is less then 4!"); + } + } + public void UpdateDancers(List<bool> updates) + { + if(!UpdateCollection(Dancers, updates)) + { + LogManager.Log("Error in display Dancers Errors. Number of Dancers In Error is less then 4!"); + } + } + public void UpdateBTSRs(List<bool> updates) + { + if(!UpdateCollection(BTSRs, updates)) + { + LogManager.Log("Error in display BTSRs Errors. Number of BTSRs In Error is less then 4!"); + } + } + + private bool UpdateCollection(ObservableCollection<MachineOverviewErrorItem> collection, List<bool> updates ) + { + if (collection.Count == updates.Count) + { + for (int i = 0; i < collection.Count; i++) + { + collection[i].IsErrorState = updates[i]; + } + return true; + } + return false; + + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewItem.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewItem.cs index ded7e33e8..42f6bd180 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewItem.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewItem.cs @@ -17,6 +17,13 @@ namespace Tango.PPC.UI.Models set { _displayValue = value; RaisePropertyChangedAuto(); } } + private String _displayMaxValue; + public String DisplayMaxValue + { + get { return _displayMaxValue; } + set { _displayMaxValue = value; RaisePropertyChangedAuto(); } + } + private String _status; public String Status { @@ -53,6 +60,7 @@ namespace Tango.PPC.UI.Models DisplayValue = "--"; Value = 0; MaxValue = 100; + DisplayMaxValue = ""; } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewModel.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewModel.cs index bd34122c6..beba47246 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewModel.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewModel.cs @@ -56,7 +56,7 @@ namespace Tango.PPC.UI.Models public void Update(StartDiagnosticsResponse diagnostics, Rml rml, ProcessParametersTable processParameters) { //Dryer Zone 3 - var dryerZone3State = diagnostics.HeatersStates.FirstOrDefault(x => x.HeaterType == HeaterType.HeaterZone3); + var dryerZone3State = diagnostics.HeatersStates.FirstOrDefault(x => x.HeaterType == HeaterType.EDryerHeater3); UpdateHeaterItem(DryerZone3, dryerZone3State); //Dryer Air @@ -70,11 +70,29 @@ namespace Tango.PPC.UI.Models UpdateHeaterItem(Tunnel, tunnelState); //Pumps Pressure - if (diagnostics.Monitors.EuInkLinesPressure.Count > 0 && diagnostics.Monitors.EuInkLinesPressure.Any(x => x.Data.Count > 0)) - { - var pumpsPressuerValue = diagnostics.Monitors.EuInkLinesPressure.SelectMany(x => x.Data).Max(); - UpdatePumpsPressureItem(pumpsPressuerValue); - } + + //EuDispenser1Pressure + List<double> EuDispensersPressure = new List<double>(); + var EuDispenser1PressureValue = diagnostics.Monitors.EuDispenser1Pressure.FirstOrDefault(); + EuDispensersPressure.Add(EuDispenser1PressureValue); + var EuDispenser2PressureValue = diagnostics.Monitors.EuDispenser2Pressure.FirstOrDefault(); + EuDispensersPressure.Add(EuDispenser2PressureValue); + var EuDispenser3PressureValue = diagnostics.Monitors.EuDispenser3Pressure.FirstOrDefault(); + EuDispensersPressure.Add(EuDispenser3PressureValue); + var EuDispenser4PressureValue = diagnostics.Monitors.EuDispenser4Pressure.FirstOrDefault(); + EuDispensersPressure.Add(EuDispenser4PressureValue); + var EuDispenser5PressureValue = diagnostics.Monitors.EuDispenser5Pressure.FirstOrDefault(); + EuDispensersPressure.Add(EuDispenser5PressureValue); + var EuDispenser6PressureValue = diagnostics.Monitors.EuDispenser6Pressure.FirstOrDefault(); + EuDispensersPressure.Add(EuDispenser6PressureValue); + var EuDispenser7PressureValue = diagnostics.Monitors.EuDispenser7Pressure.FirstOrDefault(); + EuDispensersPressure.Add(EuDispenser7PressureValue); + var EuDispenser8PressureValue = diagnostics.Monitors.EuDispenser8Pressure.FirstOrDefault(); + EuDispensersPressure.Add(EuDispenser8PressureValue); + + var pumpsPressuerValue = EuDispensersPressure.Max();// diagnostics.Monitors.EuInkLinesPressure.SelectMany(x => x.Data).Max(); + UpdatePumpsPressureItem(pumpsPressuerValue); + //Lubricant var lubricantValue = diagnostics.Monitors.EuLubricantCurrent.FirstOrDefault(); @@ -92,23 +110,33 @@ namespace Tango.PPC.UI.Models { item.Status = "Heating Up"; item.Color = Colors.Orange; - item.DisplayValue = $"{state.CurrentValue} / {state.SetPoint}"; + item.DisplayValue = $"{state.CurrentValue.ToString("N1")}"; + item.DisplayMaxValue = $"/{state.SetPoint}"; item.MaxValue = state.SetPoint; item.Value = state.CurrentValue; } - else if (state.SetPoint == 0 || (state.CurrentValue >= (state.SetPoint - 10) || state.CurrentValue <= (state.SetPoint + 10))) + else if (state.SetPoint == 0 || (state.CurrentValue >= (state.SetPoint - 10) && state.CurrentValue <= (state.SetPoint + 10))) { item.Status = "Operational"; item.Color = Colors.Green; item.DisplayValue = $" {state.SetPoint}"; - item.MaxValue = state.SetPoint; + item.DisplayMaxValue = ""; + if(state.SetPoint == 0 && state.CurrentValue == 0) + { + item.MaxValue = 10; + } + else + { + item.MaxValue = state.SetPoint; + } item.Value = state.CurrentValue; } else if (!state.IsRampingUp && (state.CurrentValue < (state.SetPoint - 10) || state.CurrentValue > (state.SetPoint + 10))) { item.Status = "Over-temperature"; item.Color = Colors.Red; - item.DisplayValue = $"{state.CurrentValue} / {state.SetPoint}"; + item.DisplayValue = $"{state.CurrentValue.ToString("N1")}"; + item.DisplayMaxValue = $"/{state.SetPoint}"; item.MaxValue = state.SetPoint; item.Value = state.CurrentValue > state.SetPoint? state.SetPoint : state.CurrentValue; } @@ -117,6 +145,7 @@ namespace Tango.PPC.UI.Models item.Color = Colors.Gray; item.MaxValue = 100; item.Value = 0; + item.DisplayMaxValue = ""; } } } @@ -127,13 +156,13 @@ namespace Tango.PPC.UI.Models { DryerAir.Status = "Heating Up"; DryerAir.Color = Colors.Orange; - DryerAir.DisplayValue = $"{currentvalue}"; + DryerAir.DisplayValue = currentvalue.ToString("N1"); } else if (currentvalue >= DryerAirMaxValue) { DryerAir.Status = "Operational"; DryerAir.Color = Colors.Green; - DryerAir.DisplayValue = $"{currentvalue}"; + DryerAir.DisplayValue = currentvalue.ToString("N1"); } DryerAir.Value = currentvalue; } @@ -144,13 +173,13 @@ namespace Tango.PPC.UI.Models { PumpsPressure.Status = "Overpressure"; PumpsPressure.Color = Colors.Red; - PumpsPressure.DisplayValue = maxValue.ToString(); + PumpsPressure.DisplayValue = maxValue.ToString("N1"); } else { PumpsPressure.Status = "Operational"; PumpsPressure.Color = Colors.Green; - PumpsPressure.DisplayValue = maxValue.ToString(); + PumpsPressure.DisplayValue = maxValue.ToString("N1"); } PumpsPressure.Value = maxValue; } @@ -170,13 +199,16 @@ namespace Tango.PPC.UI.Models return; } Lubricant.Status = "Active"; - Lubricant.DisplayValue = lubricantValue.ToString(); + Lubricant.DisplayValue = lubricantValue.ToString("N1"); Lubricant.Color = Colors.Green; + return; + } + else + { + Lubricant.Status = "NotActive"; + Lubricant.DisplayValue = "None"; + Lubricant.Color = Colors.Gray; } - - Lubricant.Status = "NotActive"; - Lubricant.DisplayValue = "None"; - Lubricant.Color = Colors.Gray; } } } |
