public void ProcessAnalysis(PackPalletAnalysis analysis)
 {
     _packProperties = analysis.PackProperties;
     _palletProperties = analysis.PalletProperties;
     _interlayerProperties = analysis.InterlayerProperties;
     _constraintSet = analysis.ConstraintSet;
     analysis.Solutions = GenerateSolutions();
 }
 public PackPalletAnalysis(
     PackProperties packProperties,
     PalletProperties palletProperties,
     InterlayerProperties interlayerProperties,
     PackPalletConstraintSet constraintSet)
     : base(packProperties.ParentDocument)
 {
     // sanity checks
     if (palletProperties.ParentDocument != ParentDocument
         || (interlayerProperties != null && interlayerProperties.ParentDocument != ParentDocument))
         throw new Exception("box, pallet, interlayer do not belong to the same document");
     // setting members
     this.PackProperties = packProperties;
     this.PalletProperties = palletProperties;
     this.InterlayerProperties = interlayerProperties;
     this.ConstraintSet = constraintSet;
 }
Beispiel #3
0
 public PackPalletAnalysis(
     PackProperties packProperties,
     PalletProperties palletProperties,
     InterlayerProperties interlayerProperties,
     PackPalletConstraintSet constraintSet)
     : base(packProperties.ParentDocument)
 {
     // sanity checks
     if (palletProperties.ParentDocument != ParentDocument ||
         (interlayerProperties != null && interlayerProperties.ParentDocument != ParentDocument))
     {
         throw new Exception("box, pallet, interlayer do not belong to the same document");
     }
     // setting members
     this.PackProperties       = packProperties;
     this.PalletProperties     = palletProperties;
     this.InterlayerProperties = interlayerProperties;
     this.ConstraintSet        = constraintSet;
 }
 private Layer2D BuildLayer(PackProperties packProperties, PalletProperties palletProperties, PackPalletConstraintSet constraintSet, HalfAxis.HAxis axisOrtho, bool swapped, bool inversed)
 {
     double forcedSpace = constraintSet.MinimumSpace.Value;
     return new Layer2D(
             new Vector3D(packProperties.Length + forcedSpace, packProperties.Width + forcedSpace, packProperties.Height)
             , new Vector2D(
                 palletProperties.Length + constraintSet.OverhangX + forcedSpace
                 , _palletProperties.Width + constraintSet.OverhangY + forcedSpace)
             , axisOrtho, swapped);
 }
Beispiel #5
0
 public PackPalletAnalysis CreateNewPackPalletAnalysis(
     string name, string description
     , PackProperties pack, PalletProperties pallet
     , InterlayerProperties interlayer
     , PackPalletConstraintSet constraintSet
     , List<PackPalletSolution> solutions)
 {
     PackPalletAnalysis analysis = new PackPalletAnalysis(
         pack
         , pallet
         , interlayer
         , constraintSet);
     analysis.Name = name;
     analysis.Description = description;
     // insert in list
     _packPalletAnalyses.Add(analysis);
     // set solutions
     analysis.Solutions = solutions;
     // notify listeners
     NotifyOnNewPackPalletAnalysisCreated(analysis);
     // set solution selected if it is unique
     if (solutions.Count == 1)
         analysis.SelectSolutionByIndex(0);
     return analysis;
 }
Beispiel #6
0
 public PackPalletAnalysis CreateNewPackPalletAnalysis(
     string name, string description
     , PackProperties pack, PalletProperties pallet
     , InterlayerProperties interlayer
     , PackPalletConstraintSet constraintSet
     , IPackPalletAnalysisSolver solver)
 {
     PackPalletAnalysis analysis = new PackPalletAnalysis(
         pack
         , pallet
         , interlayer
         , constraintSet);
     analysis.Name = name;
     analysis.Description = description;
     // insert in list
     _packPalletAnalyses.Add(analysis);
     // compute analysis
     solver.ProcessAnalysis(analysis);
     if (analysis.Solutions.Count < 1)
     {   // remove analysis from list if it has no valid solution
         _packPalletAnalyses.Remove(analysis);
         Modify();
         return null;
     }
     // notify listeners
     NotifyOnNewPackPalletAnalysisCreated(analysis);
     Modify();
     return analysis;
 }
Beispiel #7
0
 private PackPalletConstraintSet LoadPackPalletConstraintSet(XmlElement eltContraintSet)
 {
     PackPalletConstraintSet constraints = new PackPalletConstraintSet();
     if (eltContraintSet.HasAttribute("OverhangX"))
         constraints.OverhangX = UnitsManager.ConvertLengthFrom(double.Parse(eltContraintSet.Attributes["OverhangX"].Value), _unitSystem);
     if (eltContraintSet.HasAttribute("OverhangY"))
         constraints.OverhangY = UnitsManager.ConvertLengthFrom(double.Parse(eltContraintSet.Attributes["OverhangY"].Value), _unitSystem);
     constraints.MinOverhangX = LoadOptDouble(eltContraintSet, "MinOverhangX", UnitsManager.UnitType.UT_LENGTH);
     constraints.MinOverhangY = LoadOptDouble(eltContraintSet, "MinOverhangY", UnitsManager.UnitType.UT_LENGTH);
     constraints.MinimumSpace = LoadOptDouble(eltContraintSet, "MinimumSpace", UnitsManager.UnitType.UT_LENGTH);
     constraints.MaximumSpaceAllowed = LoadOptDouble(eltContraintSet, "MaximumSpaceAllowed", UnitsManager.UnitType.UT_LENGTH);
     constraints.MaximumPalletHeight = LoadOptDouble(eltContraintSet, "MaximumPalletHeight", UnitsManager.UnitType.UT_LENGTH);
     constraints.MaximumPalletWeight = LoadOptDouble(eltContraintSet, "MaximumPalletWeight", UnitsManager.UnitType.UT_MASS);
     constraints.LayerSwapPeriod = int.Parse( eltContraintSet.Attributes["LayerSwapPeriod"].Value );
     constraints.InterlayerPeriod = int.Parse( eltContraintSet.Attributes["InterlayerPeriod"].Value );
     if (!constraints.IsValid)
         throw new Exception("Invalid constraint set");
     return constraints;
 }
Beispiel #8
0
        public PackPalletAnalysis CreateNewPackPalletAnalysisUI()
        {
            if (!CanCreatePackPalletAnalysis) return null;

            FormNewAnalysisPackPallet form = new FormNewAnalysisPackPallet(this, null);
            form.Packs = ListByType(typeof(PackProperties)).ToArray();
            form.Pallets = ListByType(typeof(PalletProperties)).ToArray();
            form.Interlayers = ListByType(typeof(InterlayerProperties)).ToArray();

            if (DialogResult.OK == form.ShowDialog())
            {
                PackPalletConstraintSet constraintSet = new PackPalletConstraintSet();
                constraintSet.MaximumPalletHeight = form.MaximumPalletHeight;
                constraintSet.MaximumPalletWeight = form.MaximumPalletWeight;
                constraintSet.MaximumLayerWeight = form.MaximumLayerWeight;
                constraintSet.OverhangX = form.OverhangX;
                constraintSet.OverhangY = form.OverhangY;
                constraintSet.MinOverhangX = form.MinimumOverhangX;
                constraintSet.MinOverhangY = form.MinimumOverhangY;
                constraintSet.MinimumSpace = form.MinimumSpace;
                constraintSet.MaximumSpaceAllowed = form.MaximumSpace;
                constraintSet.HasFirstInterlayer = form.HasFirstInterlayer;
                constraintSet.InterlayerPeriod = form.InterlayerPeriod;
                constraintSet.LayerSwapPeriod = form.LayerSwapPeriod;

                PackPalletAnalysis analysis = CreateNewPackPalletAnalysis(
                    form.ItemName, form.ItemDescription,
                    form.PackProperties, form.PalletProperties,
                    form.InterlayerProperties,
                    constraintSet,
                    new PackPalletSolver());
                if (null == analysis)
                    MessageBox.Show(Properties.Resources.ID_ANALYSISHASNOSOLUTION, Application.ProductName, MessageBoxButtons.OK);
                return analysis;
            }
            return null;
        }
 private void btAddPackPalletAnalysis_Click(object sender, EventArgs e)
 {
     try
     {
         // get selected box
         BoxProperties boxProperties = SelectedBox;
         // get selected pallet
         PalletProperties palletProperties = SelectedPallet;
         // get selected caseOptimSolution
         CaseOptimSolution sol = SelectedSolution;
         PackArrangement arrangement = sol.CaseDefinition.Arrangement;
         // build new case name
         string name = string.Format("{0}_{1}*{2}*{3}_{4}{5}"
             , boxProperties.Name
             , arrangement._iLength
             , arrangement._iWidth
             , arrangement._iHeight
             , sol.CaseDefinition.Dim0
             , sol.CaseDefinition.Dim1);
         // build new case description
         string description = string.Format("Case generated by case optimization for box {0} and pallet {1}"
             , boxProperties.Name
             , palletProperties.Name);
         // analysis name/description
         string analysisName = string.Format("OptimAnalysis{0}_{1}*{2}*{3}_{4}{5}"
             , boxProperties.Name
             , boxProperties.Name
             , arrangement._iLength
             , arrangement._iWidth
             , arrangement._iHeight
             , sol.CaseDefinition.Dim0
             , sol.CaseDefinition.Dim1);
         string analysisDescription = string.Format("Pallet analysis generated by case optimisation for box {0} and pallet {1}"
             , boxProperties.Name
             , palletProperties.Name);
         // create PackProperties
         HalfAxis.HAxis axis = PackProperties.Orientation(sol.CaseDefinition.Dim0, sol.CaseDefinition.Dim1);
         double wrapperWeight =  WrapperCardboard.EstimateWeight(
                     SelectedBox
                     , arrangement
                     , axis
                     , NoWalls
                     , WallThickness
                     , WallSurfaceMass);
         // cardboard wrapper
         WrapperCardboard wrapper = new WrapperCardboard(WallThickness, wrapperWeight, Color.Chocolate);
         wrapper.SetNoWalls(NoWalls[0], NoWalls[1], NoWalls[2]);
         // pack
         PackProperties pack = _document.CreateNewPack(
             name, description
             , boxProperties, arrangement, axis
             , wrapper);
         // constraint set
         PackPalletConstraintSet constraintSet = new PackPalletConstraintSet();
         constraintSet.OverhangX = OverhangX;
         constraintSet.OverhangY = OverhangY;
         constraintSet.MaximumPalletHeight = new OptDouble(true, MaximumPalletHeight);
         // create analysis
         _document.CreateNewPackPalletAnalysis(
             analysisName
             , analysisDescription
             , pack
             , palletProperties
             , null
             , constraintSet
             , new PackPalletSolver());
     }
     catch (Exception ex)
     {
         _log.Error(ex.ToString());
     }
 }