Beispiel #1
0
        /**
         * no confirmations are created and applied
         */
        private void StartTestCycle(SimulationInterval simulationInterval, bool shouldPersist)
        {
            Quantity customerOrderQuantity = new Quantity(ZppConfiguration.CacheManager
                                                          .GetTestConfiguration().CustomerOrderPartQuantity);


            // init transactionData
            ZppConfiguration.CacheManager.ReloadTransactionData();

            _customerOrderCreator = new CustomerOrderCreator(customerOrderQuantity);
            _customerOrderCreator.CreateCustomerOrders(simulationInterval, customerOrderQuantity);

            // execute mrp2
            Mrp2.impl.Mrp2 mrp2 = new Mrp2.impl.Mrp2(_performanceMonitors, simulationInterval);
            mrp2.StartMrp2();

            DebuggingTools.PrintStateToFiles(simulationInterval,
                                             ZppConfiguration.CacheManager.GetDbTransactionData(), "", true);

            // no confirmations

            // persisting cached/created data
            if (shouldPersist)
            {
                ZppConfiguration.CacheManager.Persist();
            }
        }
Beispiel #2
0
        public void StartOneCycle(SimulationInterval simulationInterval,
                                  Quantity customerOrderQuantity)
        {
            IDbTransactionData dbTransactionData =
                ZppConfiguration.CacheManager.GetDbTransactionData();

            _performanceMonitors.Start(InstanceToTrack.CreateCustomerOrders);
            _customerOrderCreator.CreateCustomerOrders(simulationInterval, customerOrderQuantity);
            _performanceMonitors.Stop(InstanceToTrack.CreateCustomerOrders);

            // Mrp2
            _performanceMonitors.Start(InstanceToTrack.Mrp2);
            Mrp2.impl.Mrp2 mrp2 = new Mrp2.impl.Mrp2(_performanceMonitors, simulationInterval);
            mrp2.StartMrp2();
            _performanceMonitors.Stop(InstanceToTrack.Mrp2);
            DebuggingTools.PrintStateToFiles(simulationInterval, dbTransactionData, "1_after_mrp2",
                                             true);

            // CreateConfirmations
            _performanceMonitors.Start(InstanceToTrack.CreateConfirmations);
            _confirmationManager.CreateConfirmations(simulationInterval);
            _performanceMonitors.Stop(InstanceToTrack.CreateConfirmations);
            DebuggingTools.PrintStateToFiles(simulationInterval, dbTransactionData,
                                             "2_after_create_confirmations", false);

            // ApplyConfirmations
            // TODO: disable these two lines

            /*DemandToProviderGraph demandToProviderGraph = new DemandToProviderGraph();
             * string demandToProviderGraphString = demandToProviderGraph.ToString();
             * ZppConfiguration.CacheManager.UseArchiveForGetters();
             * DemandToProviderGraph demandToProviderGraphArchive = new DemandToProviderGraph();
             * string demandToProviderGraphArchiveString = demandToProviderGraphArchive.ToString();
             * ZppConfiguration.CacheManager.UseArchiveForGettersRevert();*/

            _performanceMonitors.Start(InstanceToTrack.ApplyConfirmations);
            _confirmationManager.ApplyConfirmations();
            _performanceMonitors.Stop(InstanceToTrack.ApplyConfirmations);

            DebuggingTools.PrintStateToFiles(simulationInterval, dbTransactionData,
                                             "3_after_apply_confirmations", false);

            // TODO: disable following lines

            /* DemandToProviderGraph demandToProviderGraph2 = new DemandToProviderGraph();
             * string demandToProviderGraphString2 = demandToProviderGraph2.ToString();
             * /*ZppConfiguration.CacheManager.UseArchiveForGetters();
             * DemandToProviderGraph demandToProviderGraphArchive2 = new DemandToProviderGraph();
             * string demandToProviderGraphArchiveString2 = demandToProviderGraphArchive2.ToString();
             * ZppConfiguration.CacheManager.UseArchiveForGettersRevert();*/
        }
Beispiel #3
0
        /**
         * without confirmations
         */
        public void StartMultipleTestCycles()
        {
            const int maxSimulatingTime = 5000;
            int       defaultInterval   =
                ZppConfiguration.CacheManager.GetTestConfiguration().SimulationInterval;

            // for (int i = 0; i * _interval < maxSimulatingTime; i++)
            for (int i = 0; i *defaultInterval < maxSimulatingTime; i++)
            {
                SimulationInterval simulationInterval =
                    new SimulationInterval(i * defaultInterval, defaultInterval - 1);
                StartTestCycle(simulationInterval, true);
            }
        }
Beispiel #4
0
        public void StartPerformanceStudy(bool shouldPersist)
        {
            ZppConfiguration.IsInPerformanceMode = true;

            int maxSimulatingTime = ZppConfiguration.CacheManager.GetTestConfiguration()
                                    .SimulationMaximumDuration;
            int defaultInterval =
                ZppConfiguration.CacheManager.GetTestConfiguration().SimulationInterval;
            Quantity customerOrderQuantity = new Quantity(ZppConfiguration.CacheManager
                                                          .GetTestConfiguration().CustomerOrderPartQuantity);

            _customerOrderCreator = new CustomerOrderCreator(customerOrderQuantity);

            string performanceLogCycles = "[";

            _performanceMonitors.Start(InstanceToTrack.Global);

            for (int i = 0; i *defaultInterval <= maxSimulatingTime; i++)
            {
                SimulationInterval simulationInterval =
                    new SimulationInterval(i * defaultInterval, defaultInterval - 1);

                StartOneCycle(simulationInterval, customerOrderQuantity);

                if (ZppConfiguration.CacheManager.GetDbTransactionDataArchive()
                    .CustomerOrderPartGetAll().Count() > customerOrderQuantity.GetValue())
                {
                    break;
                }

                performanceLogCycles += _performanceMonitors.ToString() + ",";
            }

            _performanceMonitors.Stop(InstanceToTrack.Global);
            performanceLogCycles += $"{_performanceMonitors.ToString()}]";

            // DebuggingTools.PrintStateToFiles(dbTransactionData, true);
            DebuggingTools.WritePerformanceLog(performanceLogCycles);

            // persisting cached/created data
            if (shouldPersist)
            {
                ZppConfiguration.CacheManager.Persist();
            }
        }
Beispiel #5
0
 public void StartOneCycle(SimulationInterval simulationInterval)
 {
     StartOneCycle(simulationInterval, null);
 }