aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
diff options
context:
space:
mode:
authorAvi Levkovich <avi@twine-s.com>2019-11-19 13:33:51 +0200
committerAvi Levkovich <avi@twine-s.com>2019-11-19 13:33:51 +0200
commitb5ea623d1ea2cef2e117c12eaf4cd66351c42cce (patch)
treeff15a121e57afc6cf4f017bcc2d4d6a7cc7dd78d /Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
parentd87f59593916413b747ebe15f409ec09007747a3 (diff)
parentd50797ddb8c3d886d38a56a09dfe34540512e331 (diff)
downloadTango-b5ea623d1ea2cef2e117c12eaf4cd66351c42cce.tar.gz
Tango-b5ea623d1ea2cef2e117c12eaf4cd66351c42cce.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs')
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs55
1 files changed, 28 insertions, 27 deletions
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
index d6d926800..6b90ef393 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
@@ -40,6 +40,7 @@ using Tango.Integration.Emergency;
using Tango.PMR.MachineStatus;
using Newtonsoft.Json;
using Tango.PMR.Integration;
+using System.Globalization;
namespace Tango.Integration.Operation
{
@@ -1425,9 +1426,9 @@ namespace Tango.Integration.Operation
{
var segment = job.Segments[segmentIndex];
var segment_length_cm = segment.Length * 100d;
-
+
List<BrushStop> orderedBrushCollection = segment.BrushStops.OrderBy(x => x.OffsetMeters).ToList();
-
+
int solid_gradient_oeff = orderedBrushCollection.Count == 1 ? 1 : 2;
double prev_offset_cm = 0;
for (int brushIndex = 0; brushIndex < orderedBrushCollection.Count; brushIndex++)
@@ -1450,7 +1451,7 @@ namespace Tango.Integration.Operation
brush_length_centimeters -= resolution;
}
prev_offset_cm = brush_offset_cm;
-
+
foreach (var liquidVolumes in brush.LiquidVolumes)
{
liquidQuantities[liquidVolumes.IdsPack.PackIndex] += liquidVolumes.NanoliterPerCentimeter * (brush_length_centimeters / solid_gradient_oeff);
@@ -1477,12 +1478,21 @@ namespace Tango.Integration.Operation
{
IdsPack = idsPack,
Current = packLevel.DispenserLevel,
- Required = (int)liquidQuantities[index]
+ Required = (int)liquidQuantities[index],
+ Maximum = MAX_DISPENSER_NANOLITER,
};
- if (liquidQuantities[index] > packLevel.DispenserLevel)
+ if (idsLevel.Required > idsLevel.Current)
{
shouldThrow = true;
+ string display_value = (((double)(idsLevel.Required - idsLevel.Current) / 1000000000)).ToString("N2", CultureInfo.InvariantCulture);
+ idsLevel.Message = $"Missing {display_value} liters to complete the job.";
+
+ if (idsLevel.Required > idsLevel.Maximum)
+ {
+ display_value = (((double)(idsLevel.Required - idsLevel.Maximum)) / 1000000000).ToString("N2", CultureInfo.InvariantCulture);
+ idsLevel.Message = $"Required ink exceeds the maximum capacity of the dispenser by {display_value} liters. Please reduce the segment length.";
+ }
}
exception.IdsPackLevels.Add(idsLevel);
@@ -1561,7 +1571,8 @@ namespace Tango.Integration.Operation
{
IdsPack = idsPack,
Current = packLevel.DispenserLevel,
- Required = (int)liquidQuantities[index]
+ Required = (int)liquidQuantities[index],
+ Maximum = MAX_DISPENSER_NANOLITER,
};
if (liquidQuantities[index] > packLevel.DispenserLevel)
@@ -1623,7 +1634,16 @@ namespace Tango.Integration.Operation
throw new NullReferenceException("Could not locate an active process parameters tables group for RML " + job.Rml.Name);
}
- var processParameters = converter.GetRecommendedProcessParameters(job);
+ ProcessParametersTable processParameters = null;
+
+ try
+ {
+ processParameters = converter.GetRecommendedProcessParameters(job);
+ }
+ catch (Exception ex)
+ {
+ throw LogManager.Log(new InvalidOperationException($"An error occurred while trying to resolve the recommended process parameters.\n{ex.Message}"));
+ }
if (processParameters == null)
{
@@ -1769,7 +1789,7 @@ namespace Tango.Integration.Operation
if (EnableJobLiquidQuantityValidation)
{
- ValidateJobLiquidQuantity(job, processParameters, job.Machine.Configuration);
+ ValidateJobLiquidQuantity(job, processParameters, job.Machine.Configuration);
}
var originalJob = job;
@@ -1916,25 +1936,6 @@ namespace Tango.Integration.Operation
return;
}
- if (EnableJobLiquidQuantityValidation)
- {
- try
- {
- //ValidateJobLiquidQuantity(originalJob, processParameters, job.Machine.Configuration);
- var ticketForValidation = ticket.Clone();
- ticketForValidation.NumberOfUnits = (uint)originalJob.NumberOfUnits;
- ValidateJobLiquidQuantity(ticketForValidation, processParameters, job.Machine.Configuration);
- }
- catch (Exception ex)
- {
- Status = MachineStatuses.ReadyToDye;
- PrintingFailed?.Invoke(this, new PrintingFailedEventArgs(handler, clonedJob, ex));
- PrintingEnded?.Invoke(this, new PrintingEventArgs(handler, clonedJob));
- handler.RaiseFailed(ex);
- return;
- }
- }
-
var segs = new List<JobSegment>();
if (JobUnitsMethod == JobUnitsMethods.Operator)