Beispiel #1
0
        private void ManufacturingResourcePlanning(Demands dbDemands)
        {
            if (dbDemands == null || dbDemands.Any() == false)
            {
                throw new MrpRunException(
                          "How could it happen, that no dbDemands are given to plan ?");
            }

            // MaterialRequirementsPlanning
            IMrp1 mrp1 = new Mrp1.impl.Mrp1(dbDemands);

            mrp1.StartMrp1();


            // BackwardForwardBackwardScheduling

            OrderOperationGraph orderOperationGraph = new OrderOperationGraph();

            ScheduleBackwardFirst(orderOperationGraph);
            AssertEveryDemandAndProviderIsScheduled();

            ScheduleForward(orderOperationGraph, _simulationInterval);
            ScheduleBackwardSecond(orderOperationGraph);

            // job shop scheduling
            JobShopScheduling(orderOperationGraph);
        }
Beispiel #2
0
        private void JobShopScheduling(OrderOperationGraph orderOperationGraph)
        {
            IDbTransactionData dbTransactionData =
                ZppConfiguration.CacheManager.GetDbTransactionData();
            IAggregator aggregator = ZppConfiguration.CacheManager.GetAggregator();

            // some validations
            if (dbTransactionData.ProductionOrderGetAll().Any() == false)
            {
                // no JobShopScheduling needed, all Demands were satisfied without the need for a productionOrder
                return;
            }

            foreach (var productionOrder in dbTransactionData.ProductionOrderGetAll())
            {
                List <ProductionOrderOperation> operations =
                    aggregator.GetProductionOrderOperationsOfProductionOrder(
                        (ProductionOrder)productionOrder);
                if (operations == null || operations.Any() == false)
                {
                    throw new MrpRunException(
                              "How could it happen, that a productionOrder without operations exists ?");
                }
            }

            // start !
            IDirectedGraph <INode> operationGraph =
                new OperationGraph(orderOperationGraph);

            _jobShopScheduler.ScheduleWithGifflerThompsonAsZaepfel(
                new PriorityRule(operationGraph), operationGraph);
        }
        /**
         * includes demandToProviderGraph, OrderOperationGraph and dbTransactionData
         * forcePrint: force printing even if in performanceMode
         */
        public static void PrintStateToFiles(SimulationInterval simulationInterval,
                                             IDbTransactionData dbTransactionData, string stageName, bool includeOrderOperationGraph,
                                             bool forcePrint = false)
        {
            if (Constants.IsWindows == false || ZppConfiguration.IsInPerformanceMode)
            {
                // skip this in the cloud/IsInPerformanceMode
                if (forcePrint == false)
                {
                    return;
                }
            }

            CleanupOldFiles();

            WriteToFile(
                $"{SimulationFolder}dbTransactionData_interval_{simulationInterval.StartAt}_{stageName}.txt",
                dbTransactionData.ToString());
            WriteToFile(
                $"{SimulationFolder}dbTransactionDataArchive_interval_{simulationInterval.StartAt}_{stageName}.txt",
                ZppConfiguration.CacheManager.GetDbTransactionDataArchive().ToString());
            DemandToProviderGraph demandToProviderGraph = new DemandToProviderGraph();

            WriteToFile(
                $"{SimulationFolder}demandToProviderGraph_interval_{simulationInterval.StartAt}_{stageName}.txt",
                demandToProviderGraph.ToString());
            if (includeOrderOperationGraph)
            {
                OrderOperationGraph orderOperationGraph = new OrderOperationGraph();
                WriteToFile(
                    $"orderOperationGraph_interval_{simulationInterval.StartAt}_{stageName}.log",
                    orderOperationGraph.ToString());
            }
        }
Beispiel #4
0
        public OperationGraph(OrderOperationGraph orderOperationGraph) : base()
        {
            IStackSet <IGraphNode> nodes = new StackSet <IGraphNode>(orderOperationGraph.GetNodes());

            foreach (var graphNode in nodes)
            {
                if (graphNode.GetNode().GetEntity().GetType() != typeof(ProductionOrderOperation))
                {
                    orderOperationGraph.RemoveNode(graphNode.GetNode(), true);
                }
            }

            _nodes = orderOperationGraph.GetNodes();
        }
Beispiel #5
0
        private void AssertGraphsAreNotEmpty(OrderOperationGraph orderOperationGraph)
        {
            if (ZppConfiguration.IsInPerformanceMode)
            {
                return;
            }

            DemandToProviderGraph demandToProviderGraph = new DemandToProviderGraph();

            if (demandToProviderGraph.IsEmpty())
            {
                throw new MrpRunException("How could the demandToProviderGraph be empty ?");
            }

            if (orderOperationGraph.IsEmpty())
            {
                throw new MrpRunException("How could the orderOperationGraph be empty ?");
            }
        }
        public void TestParentsDueTimeIsGreaterThanOrEqualToChildsDueTime(
            string testConfigurationFileName)
        {
            // init
            InitTestScenario(testConfigurationFileName);

            IZppSimulator zppSimulator = new ZppSimulator.impl.ZppSimulator();

            // TODO: set to true once dbPersist() has an acceptable time
            zppSimulator.StartTestCycle(false);

            // TODO: replace this by ReloadTransactionData() once shouldPersist is enabled
            ZppConfiguration.CacheManager.GetDbTransactionData();

            OrderOperationGraph orderOperationGraph = new OrderOperationGraph();

            foreach (var graphNode in orderOperationGraph.GetNodes())
            {
                INode  node       = graphNode.GetNode();
                INodes successors = orderOperationGraph.GetSuccessorNodes(node);
                if (successors != null)
                {
                    foreach (var successor in successors)
                    {
                        if (node.GetEntity().GetType() == typeof(CustomerOrderPart))
                        {
                            continue;
                        }
                        Assert.True(
                            node.GetEntity().GetStartTimeBackward()
                            .IsGreaterThanOrEqualTo(successor.GetEntity().GetEndTimeBackward()),
                            "Parent's StartTimeBackward must be greater or equal to than child's EndTimeBackward.");
                    }
                }
            }
        }
Beispiel #7
0
        private void ScheduleForward(OrderOperationGraph orderOperationGraph, SimulationInterval simulationInterval)
        {
            IForwardScheduler forwardScheduler = new ForwardScheduler(orderOperationGraph, simulationInterval);

            forwardScheduler.ScheduleForward();
        }