diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-11-06 15:49:22 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-11-06 15:49:22 +0200 |
| commit | 0b8ce9dd355873283ffbb644fbad5c46084f895e (patch) | |
| tree | 4693f8648bf733258ce5c9998b361a3074c7f1c2 /Software | |
| parent | a2f88e964e640537bb56db6bafeb2961d950c552 (diff) | |
| download | Tango-0b8ce9dd355873283ffbb644fbad5c46084f895e.tar.gz Tango-0b8ce9dd355873283ffbb644fbad5c46084f895e.zip | |
Fixed a bug with job colorspace is null when entering job summery on catalog.
Added ContinuousRequestTimeout to MachineOperator and machine studio external bridge connection.
Fixed dispensing nl\sec calculation.
Fixed job brush stops liquid volumes setting by correct process parameters.
Diffstat (limited to 'Software')
6 files changed, 96 insertions, 80 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs index c307a8e33..1831d5aa3 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs @@ -135,6 +135,11 @@ namespace Tango.MachineStudio.Common public TimeSpan ExternalBridgeRequestTimeout { get; set; } /// <summary> + /// Gets or sets the external bridge continuous request timeout. + /// </summary> + public TimeSpan ExternalBridgeContinuousRequestTimeout { get; set; } + + /// <summary> /// Gets the machine service address. /// </summary> public String MachineServiceAddress @@ -173,6 +178,7 @@ namespace Tango.MachineStudio.Common Theme = MachineStudioTheme.Light; JobUnitsMethod = JobUnitsMethods.Operator; ExternalBridgeRequestTimeout = TimeSpan.FromSeconds(5); + ExternalBridgeContinuousRequestTimeout = TimeSpan.FromSeconds(5); } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index 90fe25c8f..c7fd7a525 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -460,6 +460,7 @@ namespace Tango.MachineStudio.UI.ViewModels { x.SelectedMachine.As<ExternalBridgeTcpClient>().EnableApplicationLogs = x.EnableApplicationLogs; x.SelectedMachine.RequestTimeout = _settings.ExternalBridgeRequestTimeout; + x.SelectedMachine.ContinuousRequestTimeout = _settings.ExternalBridgeContinuousRequestTimeout; } if (x.SelectedMachine.RequiresAuthentication) diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs index bff6beff5..365075d4a 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs @@ -130,16 +130,6 @@ namespace Tango.PPC.Jobs.ViewModels _context = obj.Context; Job = obj.Job; - if (Job.ColorSpace.Space == BL.Enumerations.ColorSpaces.Catalog) - { - if (_context.ColorCatalogs.SingleOrDefault(x => x.Guid == Job.ColorCatalogGuid) == null) - { - await NotificationProvider.ShowError("The selected color catalog for this job could not be found.\nCannot load job."); - await NavigationManager.NavigateBack(); - return; - } - } - IsPreparingJob = true; Job = await new JobBuilder(_context).Set(Job.Guid) @@ -150,7 +140,15 @@ namespace Tango.PPC.Jobs.ViewModels .WithBrushStops() .BuildAsync(); - await Task.Delay(2000); + if (Job.ColorSpace.Space == BL.Enumerations.ColorSpaces.Catalog) + { + if (_context.ColorCatalogs.SingleOrDefault(x => x.Guid == Job.ColorCatalogGuid) == null) + { + await NotificationProvider.ShowError("The selected color catalog for this job could not be found.\nCannot load job."); + await NavigationManager.NavigateBack(); + return; + } + } await Task.Factory.StartNew(() => { diff --git a/Software/Visual_Studio/Tango.BL/Dispensing/DispensingCalcBase.cs b/Software/Visual_Studio/Tango.BL/Dispensing/DispensingCalcBase.cs index cceabb571..e0f16d4d4 100644 --- a/Software/Visual_Studio/Tango.BL/Dispensing/DispensingCalcBase.cs +++ b/Software/Visual_Studio/Tango.BL/Dispensing/DispensingCalcBase.cs @@ -53,7 +53,7 @@ namespace Tango.BL.Dispensing /// <returns></returns> public virtual double CalculatePulsePerSecond(LiquidVolume liquidVolume) { - return CalculateNanoliterPerSecond(liquidVolume) / liquidVolume.NanoliterPerStep * 8d; + return CalculateNanoliterPerSecond(liquidVolume) / liquidVolume.NanoliterPerStep / (double)liquidVolume.DispenserStepDivision; } /// <summary> diff --git a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs index 733f7a981..0168320c0 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs @@ -99,6 +99,11 @@ namespace Tango.Integration.Operation bool CanPrint { get; } /// <summary> + /// Gets or sets the general continuous request timeout. + /// </summary> + TimeSpan ContinuousRequestTimeout { get; set; } + + /// <summary> /// Occurs when the machine <see cref="Status"/> has changed. /// </summary> event EventHandler<MachineStatuses> StatusChanged; diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index ac9ee93ec..66f8d551c 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -102,6 +102,7 @@ namespace Tango.Integration.Operation EmergencyNotificationProvider = new UsbEmergencyNotificationProvider("COM1"); EnableJobLiquidQuantityValidation = true; FailsWithAdapter = true; + ContinuousRequestTimeout = TimeSpan.FromSeconds(2); } /// <summary> @@ -461,6 +462,11 @@ namespace Tango.Integration.Operation /// </summary> public IEmergencyNotificationProvider EmergencyNotificationProvider { get; set; } + /// <summary> + /// Gets or sets the general continuous request timeout. + /// </summary> + public TimeSpan ContinuousRequestTimeout { get; set; } + #endregion #region Virtual Methods @@ -1113,7 +1119,7 @@ namespace Tango.Integration.Operation Thread.Sleep(500); //Just wait maybe Shlomo is getting this message to fast after restart ? bool completed = false; - SendContinuousRequest<ResumeCurrentJobRequest, ResumeCurrentJobResponse>(request, null, TimeSpan.FromSeconds(2)).Subscribe((response) => + SendContinuousRequest<ResumeCurrentJobRequest, ResumeCurrentJobResponse>(request, null, ContinuousRequestTimeout).Subscribe((response) => { if (!completed) { @@ -1339,7 +1345,7 @@ namespace Tango.Integration.Operation var previous_segments_length = job.Segments.Where(x => x.SegmentIndex < segment.SegmentIndex).Sum(x => x.Length); - SendContinuousRequest<JobRequest, JobResponse>(request, null, TimeSpan.FromSeconds(2)).Subscribe((response) => + SendContinuousRequest<JobRequest, JobResponse>(request, null, ContinuousRequestTimeout).Subscribe((response) => { response.Message.Status.Progress += previous_segments_length; @@ -1518,100 +1524,100 @@ namespace Tango.Integration.Operation //Perform color correction foreach (var stop in jobSegments.SelectMany(x => x.BrushStops)) { - if (stop.LiquidVolumes == null) + //if (stop.LiquidVolumes == null || stop.BrushColorSpace == ColorSpaces.Volume) + //{ + if (stop.BrushColorSpace == ColorSpaces.RGB || stop.BrushColorSpace == ColorSpaces.LAB) { - if (stop.BrushColorSpace == ColorSpaces.RGB || stop.BrushColorSpace == ColorSpaces.LAB) + var output = converter.Convert(stop, false); + + //TODO: Restore this when Mirta conversion is working as expected. + //if (suggestions.OutOfGamut) + //{ + // throw new InvalidOperationException("Cannot print a brush stop which is out of gamut."); + //} + + stop.SetLiquidVolumes(job.Machine.Configuration, job.Rml, processParameters); + + foreach (var outputLiquid in output.SingleCoordinates.OutputLiquids) { - var output = converter.Convert(stop, false); + var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack.LiquidType.Code == outputLiquid.LiquidType.ToInt32()); - //TODO: Restore this when Mirta conversion is working as expected. - //if (suggestions.OutOfGamut) - //{ - // throw new InvalidOperationException("Cannot print a brush stop which is out of gamut."); - //} + if (liquidVolume == null) + { + throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + outputLiquid.LiquidType + "'."); + } + liquidVolume.Volume = outputLiquid.Volume; + } + } + else if (stop.BrushColorSpace == ColorSpaces.Catalog) + { + if (stop.ColorCatalogsItem != null) + { stop.SetLiquidVolumes(job.Machine.Configuration, job.Rml, processParameters); - foreach (var outputLiquid in output.SingleCoordinates.OutputLiquids) + if (stop.ColorCatalogsItem.Cyan > 0) { - var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack.LiquidType.Code == outputLiquid.LiquidType.ToInt32()); + var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack.LiquidType.Code == LiquidTypes.Cyan.ToInt32()); if (liquidVolume == null) { - throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + outputLiquid.LiquidType + "'."); + throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + LiquidTypes.Cyan + "'."); } - liquidVolume.Volume = outputLiquid.Volume; + liquidVolume.Volume = stop.ColorCatalogsItem.Cyan; } - } - else if (stop.BrushColorSpace == ColorSpaces.Catalog) - { - if (stop.ColorCatalogsItem != null) + + if (stop.ColorCatalogsItem.Magenta > 0) { - stop.SetLiquidVolumes(job.Machine.Configuration, job.Rml, processParameters); + var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack.LiquidType.Code == LiquidTypes.Magenta.ToInt32()); - if (stop.ColorCatalogsItem.Cyan > 0) + if (liquidVolume == null) { - var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack.LiquidType.Code == LiquidTypes.Cyan.ToInt32()); - - if (liquidVolume == null) - { - throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + LiquidTypes.Cyan + "'."); - } - - liquidVolume.Volume = stop.ColorCatalogsItem.Cyan; + throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + LiquidTypes.Magenta + "'."); } - if (stop.ColorCatalogsItem.Magenta > 0) - { - var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack.LiquidType.Code == LiquidTypes.Magenta.ToInt32()); - - if (liquidVolume == null) - { - throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + LiquidTypes.Magenta + "'."); - } + liquidVolume.Volume = stop.ColorCatalogsItem.Magenta; + } - liquidVolume.Volume = stop.ColorCatalogsItem.Magenta; - } + if (stop.ColorCatalogsItem.Yellow > 0) + { + var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack.LiquidType.Code == LiquidTypes.Yellow.ToInt32()); - if (stop.ColorCatalogsItem.Yellow > 0) + if (liquidVolume == null) { - var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack.LiquidType.Code == LiquidTypes.Yellow.ToInt32()); - - if (liquidVolume == null) - { - throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + LiquidTypes.Yellow + "'."); - } - - liquidVolume.Volume = stop.ColorCatalogsItem.Yellow; + throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + LiquidTypes.Yellow + "'."); } - if (stop.ColorCatalogsItem.Black > 0) - { - var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack.LiquidType.Code == LiquidTypes.Black.ToInt32()); + liquidVolume.Volume = stop.ColorCatalogsItem.Yellow; + } - if (liquidVolume == null) - { - throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + LiquidTypes.Black + "'."); - } + if (stop.ColorCatalogsItem.Black > 0) + { + var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack.LiquidType.Code == LiquidTypes.Black.ToInt32()); - liquidVolume.Volume = stop.ColorCatalogsItem.Black; + if (liquidVolume == null) + { + throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + LiquidTypes.Black + "'."); } + + liquidVolume.Volume = stop.ColorCatalogsItem.Black; } - else - { - throw new InvalidOperationException($"No catalog item specified for segment color."); - } - } - else if (stop.BrushColorSpace == ColorSpaces.Volume) - { - stop.SetLiquidVolumes(job.Machine.Configuration, job.Rml, processParameters); } else { - throw new InvalidOperationException($"Unsupported color space {stop.BrushColorSpace}."); + throw new InvalidOperationException($"No catalog item specified for segment color."); } } + else if (stop.BrushColorSpace == ColorSpaces.Volume) + { + stop.SetLiquidVolumes(job.Machine.Configuration, job.Rml, processParameters); + } + else + { + throw new InvalidOperationException($"Unsupported color space {stop.BrushColorSpace}."); + } + //} if (job.EnableLubrication) { @@ -1909,7 +1915,7 @@ namespace Tango.Integration.Operation bool responseLogged = false; bool completed = false; //Use this in case Shlomo is sending progress after completion. - SendContinuousRequest<JobRequest, JobResponse>(request, null, TimeSpan.FromSeconds(2)).Subscribe((response) => + SendContinuousRequest<JobRequest, JobResponse>(request, null, ContinuousRequestTimeout).Subscribe((response) => { if (!completed) { @@ -2182,7 +2188,7 @@ namespace Tango.Integration.Operation LogRequestSent(request); bool responseLogged = false; - SendContinuousRequest<StubJobRequest, StubJobResponse>(request, null, TimeSpan.FromSeconds(2)).Subscribe((response) => + SendContinuousRequest<StubJobRequest, StubJobResponse>(request, null, ContinuousRequestTimeout).Subscribe((response) => { handler.RaiseStatusReceived(response.Message.Status); @@ -2403,7 +2409,7 @@ namespace Tango.Integration.Operation public IObservable<MotorHomingResponse> StartMotorHoming(MotorHomingRequest request) { LogRequestSent(request); - return SendContinuousRequest<MotorHomingRequest, MotorHomingResponse>(request, null, TimeSpan.FromSeconds(5)).Select(x => x.Message); + return SendContinuousRequest<MotorHomingRequest, MotorHomingResponse>(request, null, ContinuousRequestTimeout).Select(x => x.Message); } /// <summary> @@ -2447,7 +2453,7 @@ namespace Tango.Integration.Operation public IObservable<DispenserHomingResponse> StartDispenserHoming(DispenserHomingRequest request) { LogRequestSent(request); - return SendContinuousRequest<DispenserHomingRequest, DispenserHomingResponse>(request, null, TimeSpan.FromSeconds(5)).Select(x => x.Message); + return SendContinuousRequest<DispenserHomingRequest, DispenserHomingResponse>(request, null, ContinuousRequestTimeout).Select(x => x.Message); } /// <summary> |
