diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-02-07 13:08:53 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-02-07 13:08:53 +0200 |
| commit | 942a428f90587a9ffdafaa593b780fb6ad06aabc (patch) | |
| tree | 4dd27cc98c494a57b8366b7beb9d9b4477b41409 /Software/Visual_Studio/Tango.Integration/Formulation | |
| parent | ccacf23ab2f33f830a830dd2c938f1863335f01d (diff) | |
| download | Tango-942a428f90587a9ffdafaa593b780fb6ad06aabc.tar.gz Tango-942a428f90587a9ffdafaa593b780fb6ad06aabc.zip | |
Refactored dispensing formula naming.
Added code comments for integration & Dispensing namespaces.
Diffstat (limited to 'Software/Visual_Studio/Tango.Integration/Formulation')
8 files changed, 0 insertions, 213 deletions
diff --git a/Software/Visual_Studio/Tango.Integration/Formulation/FormulaAttribute.cs b/Software/Visual_Studio/Tango.Integration/Formulation/FormulaAttribute.cs deleted file mode 100644 index 521c12ea3..000000000 --- a/Software/Visual_Studio/Tango.Integration/Formulation/FormulaAttribute.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.Integration.Observables; - -namespace Tango.Integration.Formulation -{ - public class FormulaAttribute : Attribute - { - public IdsPackFormulas Formula { get; set; } - - public FormulaAttribute(IdsPackFormulas formula) - { - Formula = formula; - } - } -} diff --git a/Software/Visual_Studio/Tango.Integration/Formulation/FormulaCalculatorBase.cs b/Software/Visual_Studio/Tango.Integration/Formulation/FormulaCalculatorBase.cs deleted file mode 100644 index ca186bf62..000000000 --- a/Software/Visual_Studio/Tango.Integration/Formulation/FormulaCalculatorBase.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.Integration.Printing; - -namespace Tango.Integration.Formulation -{ - public abstract class FormulaCalculatorBase : IFormulaCalculator - { - public virtual double CalculateNanoliterPerCentimeter(LiquidVolume liquidVolume) - { - if (liquidVolume.Configuration != null && liquidVolume.RML != null && liquidVolume.ProcessParametersTable != null) - { - return (liquidVolume.Volume / 100d) * (liquidVolume.LiquidMaxNanoliterPerCentimeter); - } - else - { - return 0d; - } - } - - public virtual double CalculateNanoliterPerSecond(LiquidVolume liquidVolume) - { - if (liquidVolume.ProcessParametersTable != null) - { - return CalculateNanoliterPerCentimeter(liquidVolume) * liquidVolume.ProcessParametersTable.DyeingSpeed; - } - else - { - return 0d; - } - } - - public virtual double CalculatePulsePerSecond(LiquidVolume liquidVolume) - { - return CalculateNanoliterPerSecond(liquidVolume) / liquidVolume.IdsPack.DispenserType.NlPerPulse; - } - - public virtual double CoerceVolume(LiquidVolume liquidVolume) - { - return liquidVolume.Volume; - } - } -} diff --git a/Software/Visual_Studio/Tango.Integration/Formulation/FormulaResolver.cs b/Software/Visual_Studio/Tango.Integration/Formulation/FormulaResolver.cs deleted file mode 100644 index d30d077b8..000000000 --- a/Software/Visual_Studio/Tango.Integration/Formulation/FormulaResolver.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.Integration.Observables; -using Tango.Integration.Printing; -using System.Reflection; - -namespace Tango.Integration.Formulation -{ - public static class FormulaResolver - { - private static List<KeyValuePair<IdsPackFormulas, IFormulaCalculator>> _calculators { get; set; } - - static FormulaResolver() - { - _calculators = new List<KeyValuePair<IdsPackFormulas, IFormulaCalculator>>(); - - foreach (var type in typeof(FormulaResolver).Assembly.GetTypes().Where(x => x.GetCustomAttribute<FormulaAttribute>() != null)) - { - _calculators.Add(new KeyValuePair<IdsPackFormulas, IFormulaCalculator>(type.GetCustomAttribute<FormulaAttribute>().Formula, Activator.CreateInstance(type) as IFormulaCalculator)); - } - } - - public static IFormulaCalculator Resolve(LiquidVolume liquidVolume) - { - return _calculators.SingleOrDefault(x => x.Key == (IdsPackFormulas)liquidVolume.IdsPack.IdsPackFormula.Code).Value; - } - - public static IFormulaCalculator Resolve(IdsPackFormulas formulaCode) - { - return _calculators.SingleOrDefault(x => x.Key == formulaCode).Value; - } - } -} diff --git a/Software/Visual_Studio/Tango.Integration/Formulation/FormulasCalculationService.cs b/Software/Visual_Studio/Tango.Integration/Formulation/FormulasCalculationService.cs deleted file mode 100644 index 6cbf8aebd..000000000 --- a/Software/Visual_Studio/Tango.Integration/Formulation/FormulasCalculationService.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.Integration.Printing; - -namespace Tango.Integration.Formulation -{ - public static class FormulasCalculationService - { - public static double CalculateNanoliterPerCentimeter(LiquidVolume liquidVolume) - { - IFormulaCalculator formula = FormulaResolver.Resolve(liquidVolume); - return formula.CalculateNanoliterPerCentimeter(liquidVolume); - } - - public static double CalculateNanoliterPerSecond(LiquidVolume liquidVolume) - { - IFormulaCalculator formula = FormulaResolver.Resolve(liquidVolume); - return formula.CalculateNanoliterPerSecond(liquidVolume); - } - - public static double CalculatePulsePerSecond(LiquidVolume liquidVolume) - { - IFormulaCalculator formula = FormulaResolver.Resolve(liquidVolume); - return formula.CalculatePulsePerSecond(liquidVolume); - } - - public static double CoerceVolume(LiquidVolume liquidVolume) - { - IFormulaCalculator formula = FormulaResolver.Resolve(liquidVolume); - return formula.CoerceVolume(liquidVolume); - } - } -} diff --git a/Software/Visual_Studio/Tango.Integration/Formulation/IFormulaCalculator.cs b/Software/Visual_Studio/Tango.Integration/Formulation/IFormulaCalculator.cs deleted file mode 100644 index 89894f334..000000000 --- a/Software/Visual_Studio/Tango.Integration/Formulation/IFormulaCalculator.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Tango.Integration.Printing; - -namespace Tango.Integration.Formulation -{ - public interface IFormulaCalculator - { - double CalculateNanoliterPerSecond(LiquidVolume liquidVolume); - - double CalculateNanoliterPerCentimeter(LiquidVolume liquidVolume); - - double CalculatePulsePerSecond(LiquidVolume liquidVolume); - - double CoerceVolume(LiquidVolume liquidVolume); - } -} diff --git a/Software/Visual_Studio/Tango.Integration/Formulation/LubricantFormulaCalculator.cs b/Software/Visual_Studio/Tango.Integration/Formulation/LubricantFormulaCalculator.cs deleted file mode 100644 index 3d75c9748..000000000 --- a/Software/Visual_Studio/Tango.Integration/Formulation/LubricantFormulaCalculator.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.Integration.Observables; - -namespace Tango.Integration.Formulation -{ - [Formula(IdsPackFormulas.Lubricant)] - public class LubricantFormulaCalculator : FormulaCalculatorBase - { - - } -} diff --git a/Software/Visual_Studio/Tango.Integration/Formulation/StandardColorFormulaCalculator.cs b/Software/Visual_Studio/Tango.Integration/Formulation/StandardColorFormulaCalculator.cs deleted file mode 100644 index 8b40f45e8..000000000 --- a/Software/Visual_Studio/Tango.Integration/Formulation/StandardColorFormulaCalculator.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.Integration.Observables; -using Tango.Integration.Printing; -using static Tango.Integration.Observables.BrushStop; - -namespace Tango.Integration.Formulation -{ - [Formula(IdsPackFormulas.StandardColor)] - public class StandardColorFormulaCalculator : FormulaCalculatorBase - { - - } -} diff --git a/Software/Visual_Studio/Tango.Integration/Formulation/TransparentLiquidFormulaCalculator.cs b/Software/Visual_Studio/Tango.Integration/Formulation/TransparentLiquidFormulaCalculator.cs deleted file mode 100644 index bad40f7f8..000000000 --- a/Software/Visual_Studio/Tango.Integration/Formulation/TransparentLiquidFormulaCalculator.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.Integration.Observables; -using Tango.Integration.Printing; - -namespace Tango.Integration.Formulation -{ - [Formula(IdsPackFormulas.TransparentLiquid)] - public class TransparentLiquidFormulaCalculator : FormulaCalculatorBase - { - public override double CoerceVolume(LiquidVolume liquidVolume) - { - if (liquidVolume.ProcessParametersTable != null) - { - double nlPcmSum = liquidVolume.BrushStop.LiquidVolumes.Where(x => (IdsPackFormulas)x.IdsPack.IdsPackFormula.Code == IdsPackFormulas.StandardColor).Sum(x => x.NanoliterPerCentimeter); - double minInkUpdate = liquidVolume.ProcessParametersTable.MinInkUptake; - double volume = ((minInkUpdate - nlPcmSum) / minInkUpdate) * 100d; - return Math.Max(volume, 0); - } - else - { - return liquidVolume.Volume; - } - } - } -} |
