Exemple #1
0
        /// <summary>
        /// Constructor.
        ///
        /// Generates a list of laminations based on the given parameters.
        /// As of 03/15/2019 <paramref name="yokeRange"/> does nothing as the standard laminations have a supplied dimension and cut to length laminations will determine the yoke size using <see cref="Data.Constants.DetermineYoke(CoreShape, Phase, double)"/>
        /// </summary>
        /// <param name="rangeLams">RangeLaminationDetails representing the range of laminations to iterate with.</param>
        /// <param name="phase">Which phase to create for.</param>
        /// <param name="tongueRange">IterableRange representing the range of tongues to create with.</param>
        /// <param name="yokeRange">IterableRange representing the range of yokes to create with.</param>
        /// <param name="windowWidthRange">IterableRange representing the range of window widths to create with.</param>
        /// <param name="windowHeightRange">IterableRange representing the range of window heights to create with.</param>
        /// <param name="func">Optional parameter, a function delegate that returns a boolean, and takes two integer inputs. As of 03/15/2019 only used with <see cref="Optimizer.IncrementCurrentProcessProgress(int, int)"/>.</param>
        protected internal LaminationFactory(RangeLaminationDetails rangeLams, Phase phase, RangeDouble tongueRange, RangeDouble yokeRange, RangeDouble windowWidthRange, RangeDouble windowHeightRange, Func <int, int, bool> func = null)
        {
            int i             = 0;
            int maxIterations = rangeLams.Iterations * tongueRange.Iterations * yokeRange.Iterations * windowWidthRange.Iterations * windowHeightRange.Iterations;

            Laminations = new List <Lamination>();
            windowHeightRange.NextRange = windowWidthRange;
            windowWidthRange.NextRange  = yokeRange;
            yokeRange.NextRange         = tongueRange;
            tongueRange.NextRange       = rangeLams;

            while (true)
            {
                try
                {
                    if (rangeLams.CurrentValue.IsStandard)
                    {
                        Laminations.AddRange(GetLaminations(rangeLams.CurrentValue.Shape, phase, rangeLams.CurrentValue.Grade, rangeLams.CurrentValue.Thickness, tongueRange.MinValue, tongueRange.MaxValue));
                        windowHeightRange.CurrentValue = windowHeightRange.MaxValue;
                        windowWidthRange.CurrentValue  = windowWidthRange.MaxValue;
                        yokeRange.CurrentValue         = yokeRange.MaxValue;
                        tongueRange.CurrentValue       = tongueRange.MaxValue;
                    }
                    else
                    {
                        Laminations.Add(new Lamination(false, "Cut-to-length", rangeLams.CurrentValue.Shape, phase, rangeLams.CurrentValue.Grade, rangeLams.CurrentValue.Thickness, tongueRange.CurrentValue,
                                                       DetermineYoke(rangeLams.CurrentValue.Shape, phase, tongueRange.CurrentValue), windowWidthRange.CurrentValue, windowHeightRange.CurrentValue, 1, 1, 1, (double)GetMaterialDollarsPerPound(rangeLams.CurrentValue.Grade), 0));
                    }
                    func?.Invoke(++i, maxIterations);
                    windowHeightRange.IncrementValue();
                }
                catch (IterationFinishedException) { break; }
            }
        }
Exemple #2
0
        /// <summary>
        /// Initialize the parameter ranges.
        /// </summary>
        private void Initialize()
        {
            this.Specification = new Specification();
            this.Failure       = new FailureParameters();
            this.stopwatch     = new Stopwatch();

            //Core Parameters
            parameters.Add("FluxDensity", new RangeDouble("FluxDensity", 0, 0, 0));
            parameters.Add("Tongue", new RangeDouble("Tongue", 0, 0, 0));
            parameters.Add("Yoke", new RangeDouble("Yoke", 0, 0, 0));
            parameters.Add("Stack", new RangeDouble("Stack", 0, 0, 0));
            parameters.Add("Width", new RangeDouble("Width", 0, 0, 0));
            parameters.Add("Height", new RangeDouble("Height", 0, 0, 0));
            parameters.Add("StdLamination", new RangeInteger("StdLamination", 0, 0, 0));
            parameters.Add("LamShape", new RangeInteger("LamShape", 0, 0, 0));
            parameters.Add("LamGrade", new RangeInteger("LamGrade", 0, 0, 0));
            parameters.Add("LamThickness", new RangeInteger("LamThickness", 0, 0, 0));
            parameters.Add("UI_Styles", new RangeInteger("UI_Styles", 0, 0, 0));
            laminationSkips   = new RangeCombinationSkips <int>();
            laminationDetails = new RangeLaminationDetails("LaminationDetails", null);
            //parameters.Add("LamDetails", new CoreRange("LamDetails", null));
        }