diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2022-03-10 10:59:32 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2022-03-10 10:59:32 +0200 |
| commit | 45ffc481e15bab621b8d9b9f7eb84b51e9076269 (patch) | |
| tree | f742ffb2c7f5b2202bfe5d028519dfd0f16e2bc7 /Software/Visual_Studio/Tango.PMR | |
| parent | 8efb65bbc5b319ed57959d85caf1be81233cf840 (diff) | |
| download | Tango-45ffc481e15bab621b8d9b9f7eb84b51e9076269.tar.gz Tango-45ffc481e15bab621b8d9b9f7eb84b51e9076269.zip | |
TI Normalization Feature.
Diffstat (limited to 'Software/Visual_Studio/Tango.PMR')
| -rw-r--r-- | Software/Visual_Studio/Tango.PMR/ExtensionMethods.cs | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/Software/Visual_Studio/Tango.PMR/ExtensionMethods.cs b/Software/Visual_Studio/Tango.PMR/ExtensionMethods.cs index d6fdee50c..24f6a4534 100644 --- a/Software/Visual_Studio/Tango.PMR/ExtensionMethods.cs +++ b/Software/Visual_Studio/Tango.PMR/ExtensionMethods.cs @@ -10,6 +10,7 @@ using System.Threading.Tasks; using Tango.PMR.Common; using Tango.PMR.DataStore; using Tango.PMR.Integration; +using Tango.PMR.Printing; /// <summary> /// Contains PMR extension methods. @@ -65,7 +66,7 @@ public static class ExtensionMethods /// <returns></returns> public static bool RequiresPassword(this ExternalBridgeLoginIntent intent) { - return + return intent == ExternalBridgeLoginIntent.Diagnostics || intent == ExternalBridgeLoginIntent.FullControl; @@ -116,4 +117,37 @@ public static class ExtensionMethods { return segment.Segments != null && segment.Segments.Count > 0; } + + /// <summary> + /// Gets the total nanoliter per centimeter for this stop. + /// </summary> + /// <param name="stop">The stop.</param> + /// <returns></returns> + public static double GetTotalNanoliterPerCentimeter(this JobBrushStop stop) + { + return stop.Dispensers.Where(x => x.DispenserLiquidType != DispenserLiquidType.Lubricant && x.DispenserLiquidType != DispenserLiquidType.Cleaner).Sum(x => x.NanoliterPerCentimeter); + } + + /// <summary> + /// Sets the transparent ink nanoliter per centimeter. + /// </summary> + /// <param name="stop">The stop.</param> + /// <param name="nlPerCM">The nl per cm.</param> + /// <param name="minInkUptake">The minimum ink uptake.</param> + /// <param name="dyeingSpeed">The dyeing speed.</param> + /// <param name="nlPerStep">The nl per step.</param> + public static void NormalizeStop(this JobBrushStop stop, double nlPerCM, double minInkUptake, double dyeingSpeed) + { + double nlPcmSum = stop.Dispensers.Where(x => x.DispenserLiquidType != DispenserLiquidType.Cleaner && x.DispenserLiquidType != DispenserLiquidType.Lubricant && x.DispenserLiquidType != DispenserLiquidType.TransparentInk).Sum(x => x.NanoliterPerCentimeter); + + var ti = stop.Dispensers.FirstOrDefault(x => x.DispenserLiquidType == DispenserLiquidType.TransparentInk); + + if (ti == null) return; + if (Math.Max(0, minInkUptake - nlPcmSum) < minInkUptake * 0.02d) return; + + double newNlCM = Math.Max(0, nlPerCM - nlPcmSum); + + ti.NanoliterPerCentimeter = newNlCM; + ti.NanolitterPerSecond = newNlCM * dyeingSpeed; + } } |
