public async Task <IActionResult> Edit(decimal id, [Bind("id,MODELTYPE,MSIZE,TOPTUBE,CHAINSTAY,TOTALLENGTH,GROUNDCLEARANCE,HEADTUBEANGLE,SEATTUBEANGEL")] ModelSize modelSize)
        {
            if (id != modelSize.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(modelSize);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ModelSizeExists(modelSize.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(modelSize));
        }
Ejemplo n.º 2
0
        public static void DbInitialize(MasterDBContext context, ModelSize resourceModelSize, ModelSize setupModelSize, ModelSize operatorsModelSize, int numberOfWorkersForProcessing, bool secondResource, bool distributeSetupsExponentially = false)
        {
            context.Database.EnsureCreated();

            // Look for any Entrys.
            if (context.Articles.Any())
            {
                return;   // DB has been seeded
            }
            var resourceCapabilities = MasterTableResourceCapability(context, resourceModelSize, setupModelSize, operatorsModelSize, numberOfWorkersForProcessing, secondResource);

            // Article Definitions
            var units = new MasterTableUnit();

            units.Init(context);
            var articleTypes = new MasterTableArticleType();

            articleTypes.Init(context);

            // requires Units and Article Types
            var articleTable = new MasterTableArticle(articleTypes, units);
            var articles     = articleTable.Init(context);

            MasterTableStock.Init(context, articles);

            var operations = new MasterTableOperation(articleTable, resourceCapabilities, distributeSetupsExponentially);

            operations.Init(context);

            var boms = new MasterTableBom();

            boms.Init(context, articleTable, operations);

            var businessPartner = new MasterTableBusinessPartner();

            businessPartner.Init(context);

            context.SaveChanges();

            var articleToBusinessPartner = new MasterTableArticleToBusinessPartner();

            articleToBusinessPartner.Init(context, businessPartner, articleTable);

            var updateArticleLotSize = context.Articles
                                       .Include(x => x.ArticleType)
                                       .Include(x => x.ArticleToBusinessPartners)
                                       .ToList();

            // TODO noch gemogelt LotSize != PackSize
            foreach (var article in updateArticleLotSize)
            {
                if (article.ToPurchase)
                {
                    article.LotSize = article.ArticleToBusinessPartners.First().PackSize;
                }
            }
            DbUtils.InsertOrUpdateRange(updateArticleLotSize, context.Articles, context);
            context.SaveChanges();
        }
Ejemplo n.º 3
0
        private static string GetModelName(ModelSize modelSize, Language lang)
        {
            var modelName = Shortcuts[lang == Language.Any ? "xx" : Languages.EnumToCode(lang)].Replace("_sm", "");
            var size      = modelSize == ModelSize.Small ? "sm" : modelSize == ModelSize.Medium ? "md" : "lg";

            modelName += $"_{ size}";
            return(modelName);
        }
        public async Task <IActionResult> Create([Bind("id,MODELTYPE,MSIZE,TOPTUBE,CHAINSTAY,TOTALLENGTH,GROUNDCLEARANCE,HEADTUBEANGLE,SEATTUBEANGEL")] ModelSize modelSize)
        {
            if (ModelState.IsValid)
            {
                _context.Add(modelSize);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(modelSize));
        }
Ejemplo n.º 5
0
        public static FftBuffer GetBuffer(OmegaModel model)
        {
            var modelSize = new ModelSize(model.Nx, model.Ny, model.Nz);

            if (!Buffers.ContainsKey(modelSize))
            {
                throw new InvalidOperationException("Fft buffer does not created for this model size");
            }

            return(Buffers[modelSize]);
        }
Ejemplo n.º 6
0
        public void CalculateExtents()
        {
            if (modelNode == null)
            {
                return;
            }

            modelSize         = modelNode.CalculateMinMax(transformNode.GetTransformationMatrix());
            OriginalModelSize = modelNode.CalculateMinMax();
            size = Math.Max(modelSize.Ext.X, modelSize.Ext.Y);
            size = Math.Max(modelSize.Ext.Z, size);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 保存切片结果
        /// </summary>
        /// <param name="slices">切片结果集</param>
        /// <param name="size">3维图原始大小</param>
        static void SaveSlices(Dictionary <ArrayDefine, List <SlicedPlane> > slices, ModelSize size)
        {
            Console.WriteLine("请选择切片保存模式");
            Console.WriteLine("1.图片\t2.机器语言\t3.图片与机器语言");
            var saveType = Console.ReadLine();
            var prefix   = 0;

            foreach (var key in slices.Keys)
            {
                Console.WriteLine("正在保存第" + (prefix + 1) + "组切片...");
                Console.WriteLine("请输入图片尺寸");
                Console.WriteLine("长:");
                int width = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("宽:");
                int height = Convert.ToInt32(Console.ReadLine());

                var filename = AppDomain.CurrentDomain.BaseDirectory + prefix + "_frame.h";
                System.IO.File.Delete(filename);

                var code       = "";
                var frameTable = new List <string>();

                var images = SliceImage.ToImage(slices[key], size, width, height, 0, 0);
                for (int i = 0; i < images.Count; i++)
                {
                    var bmp = images[i];
                    if (saveType == "1" || saveType == "3")
                    {
                        bmp.Save(AppDomain.CurrentDomain.BaseDirectory + "/" + prefix + "_" + i + ".bmp", ImageFormat.Bmp);
                    }


                    if (saveType == "2" || saveType == "3")
                    {
                        IImageMould im = new SSD1306();
                        code += "static unsigned char _" + prefix + "_frame_" + i + "[] = { " + im.GetMould(bmp) + " }; \n";
                        frameTable.Add("_" + prefix + "_frame_" + i);
                    }
                }
                if (saveType == "2" || saveType == "3")
                {
                    code += "unsigned char* _" + prefix + "_frames_table[] = { " + string.Join(",", frameTable.ToArray()) + " };";
                    System.IO.File.AppendAllText(filename, code);
                }
                Console.WriteLine("第" + (prefix + 1) + "组切片保存完成");
                prefix++;
            }
            Console.WriteLine("所有切片保存完成。");
        }
Ejemplo n.º 8
0
        private static void LoadModelsData(ModelSize modelSize, params Language[] languages)
        {
            if (SpacyVersion is null)
            {
                SpacyVersion = GetSpacyVersion();
            }

            foreach (var lang in languages)
            {
                string modelName = GetModelName(modelSize, lang);

                var modelVersion = CompatibilityData["spacy"][SpacyVersion][modelName][0];

                var url = $"{DownloadURL}/{modelName}-{modelVersion}/{modelName}-{modelVersion}.tar.gz#egg={modelName}=={modelVersion}";
                Console.WriteLine(url);
                Installer.PipInstallModule(url);
            }
        }
Ejemplo n.º 9
0
        public static async Task <PythonLock> Initialize(ModelSize modelSize, params Language[] languages)
        {
            await Installer.SetupPython();

            Installer.TryInstallPip();
            Installer.PipInstallModule("spacy");
            Installer.PipInstallModule("spacy-lookups-data");
            PythonEngine.Initialize();

            _threadState = PythonEngine.BeginAllowThreads();

            TestPythonVersion();

            await LoadModelsDataAsync();

            LoadModelsData(modelSize, languages);

            return(new PythonLock());
        }
Ejemplo n.º 10
0
        public static Pipeline For(ModelSize modelSize, Language language)
        {
            using (Py.GIL())
            {
                var key = $"{language}-{modelSize}";

                if (_pipelines.TryGetValue(key, out var pipeline))
                {
                    return(pipeline);
                }

                dynamic spacy     = Py.Import("spacy");
                var     modelName = GetModelName(modelSize, language);
                var     nlp       = spacy.load(modelName);
                pipeline = new Pipeline(language, modelSize, nlp);

                _pipelines[key] = pipeline;

                return(pipeline);
            }
        }
Ejemplo n.º 11
0
        private static void PrepareBuffersForModel(ModelSize ms, INativeMemoryProvider memoryProvider, Mpi mpi, IProfiler profiler)
        {
            if (Buffers.ContainsKey(ms))
            {
                throw new InvalidOperationException("Buffer for such model size is already created");
            }

            using (profiler?.StartAuto(ProfilerEvent.FftwPlanCalculation))
            {
                var buffer = new FftBuffer(memoryProvider, profiler);

                if (IsParallel(mpi))
                {
                    buffer.AllocateBuffersAndCreatePlansParallel(ms.Nx, ms.Ny, ms.Nz, mpi);
                }
                else
                {
                    buffer.AllocateBuffersAndCreatePlansLocal(ms.Nx, ms.Ny, ms.Nz);
                }

                Buffers.Add(ms, buffer);
            }
        }
Ejemplo n.º 12
0
        private static Rectangle GetScreenMinMax(Model3DNode model)
        {
            int[]    numArray = new int[4];
            double[] data1    = new double[16];
            double[] data2    = new double[16];
            GL.GetInteger(GetPName.Viewport, numArray);
            GL.GetDouble(GetPName.Modelview0MatrixExt, data1);
            GL.GetDouble(GetPName.ProjectionMatrix, data2);
            var       right      = new Matrix4((float)data2[0], (float)data2[1], (float)data2[2], (float)data2[3], (float)data2[4], (float)data2[5], (float)data2[6], (float)data2[7], (float)data2[8], (float)data2[9], (float)data2[10], (float)data2[11], (float)data2[12], (float)data2[13], (float)data2[14], (float)data2[15]);
            var       left       = new Matrix4((float)data1[0], (float)data1[1], (float)data1[2], (float)data1[3], (float)data1[4], (float)data1[5], (float)data1[6], (float)data1[7], (float)data1[8], (float)data1[9], (float)data1[10], (float)data1[11], (float)data1[12], (float)data1[13], (float)data1[14], (float)data1[15]);
            var       screen_max = new M3D.Model.Utils.Vector3(float.MinValue, float.MinValue, float.MinValue);
            var       screen_min = new M3D.Model.Utils.Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
            ModelSize minMax     = model.CalculateMinMax();

            M3D.Model.Utils.Vector3 min = minMax.Min;
            M3D.Model.Utils.Vector3 max = minMax.Max;
            M3D.Model.Utils.Vector3 ext = minMax.Ext;
            var coord1 = new M3D.Model.Utils.Vector3(min);

            ImageCapture.UpdateScreenMinMax(coord1, ref screen_min, ref screen_max, Matrix4.Mult(left, right), numArray);
            coord1.X = max.X;
            ImageCapture.UpdateScreenMinMax(coord1, ref screen_min, ref screen_max, Matrix4.Mult(left, right), numArray);
            coord1.Z = max.Z;
            ImageCapture.UpdateScreenMinMax(coord1, ref screen_min, ref screen_max, Matrix4.Mult(left, right), numArray);
            coord1.X = min.X;
            ImageCapture.UpdateScreenMinMax(coord1, ref screen_min, ref screen_max, Matrix4.Mult(left, right), numArray);
            var coord2 = new M3D.Model.Utils.Vector3(max);

            ImageCapture.UpdateScreenMinMax(coord2, ref screen_min, ref screen_max, Matrix4.Mult(left, right), numArray);
            coord2.X = min.X;
            ImageCapture.UpdateScreenMinMax(coord2, ref screen_min, ref screen_max, Matrix4.Mult(left, right), numArray);
            coord2.Z = min.Z;
            ImageCapture.UpdateScreenMinMax(coord2, ref screen_min, ref screen_max, Matrix4.Mult(left, right), numArray);
            coord2.X = max.X;
            ImageCapture.UpdateScreenMinMax(coord2, ref screen_min, ref screen_max, Matrix4.Mult(left, right), numArray);
            return(new Rectangle((int)screen_min.X, (int)screen_min.Y, (int)(screen_max.X - (double)screen_min.X), (int)(screen_max.Y - (double)screen_min.Y)));
        }
Ejemplo n.º 13
0
        public static void PrepareBuffersForModel(CartesianModel model, INativeMemoryProvider memoryProvider, Mpi mpi = null, IProfiler profiler = null)
        {
            var modelSize = new ModelSize(model.Nx, model.Ny, model.Nz);

            PrepareBuffersForModel(modelSize, memoryProvider, mpi, profiler);
        }
Ejemplo n.º 14
0
 public Resource(ModelSize size)
 {
     Value = size;
 }
Ejemplo n.º 15
0
 public bool Equals(ModelSize other)
 {
     return(Nx == other.Nx && Ny == other.Ny && Nz == other.Nz);
 }
Ejemplo n.º 16
0
 public Setup(ModelSize size)
 {
     Value = size;
 }
Ejemplo n.º 17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="context">Database context, the results are written to</param>
        /// <param name="resourceModelSize">Determines the number of resources for reach resource group </param>
        /// <param name="setupModelSize">Determines the number of possible setups for each resource group </param>
        /// <param name="operatorsModelSize">Add Operator that is required for setup</param>
        /// <param name="numberOfWorkersForProcessing">Add a required resource for Processing</param>
        /// <param name="secondResource">Add a second primary resource that is required for setup and processing</param>
        /// <returns></returns>
        public static MasterTableResourceCapability MasterTableResourceCapability(MasterDBContext context,
                                                                                  ModelSize resourceModelSize, ModelSize setupModelSize, ModelSize operatorsModelSize,
                                                                                  int numberOfWorkersForProcessing = 0, bool secondResource = false)
        {
            // requires Tools and Resources
            var resourceCapabilities = new MasterTableResourceCapability();

            resourceCapabilities.InitBasicCapabilities(context);
            switch (setupModelSize)
            {
            case ModelSize.Small:
                resourceCapabilities.CreateToolingCapabilities(context, 2, 2, 2);
                break;

            case ModelSize.Medium:
                resourceCapabilities.CreateToolingCapabilities(context, 4, 4, 7);
                break;

            case ModelSize.Large:
                resourceCapabilities.CreateToolingCapabilities(context, 8, 8, 14);
                break;

            case ModelSize.TestModel:
                resourceCapabilities.CreateToolingCapabilities(context, 4, 4, 7);
                break;

            default: throw new ArgumentException();
            }

            var resources = new MasterTableResource(resourceCapabilities);

            switch (resourceModelSize)
            {
            case ModelSize.Small:
                resources.InitSmall(context);
                break;

            case ModelSize.Medium:
                resources.InitMedium(context);

                break;

            case ModelSize.Large:
                resources.InitLarge(context);
                break;

            case ModelSize.XLarge:
                resources.InitXLarge(context);
                break;

            case ModelSize.TestModel:
                resources.InitMediumTest(context);
                break;

            default: throw new ArgumentException();
            }

            var operatorModel = new int[] { 0, 0, 0 };

            switch (operatorsModelSize)
            {
            case ModelSize.None:
                operatorModel = new int[] { 0, 0, 0 };
                break;

            case ModelSize.Small:
                operatorModel = new int[] { 1, 0, 1 };
                break;

            case ModelSize.Medium:
                operatorModel = new int[] { 1, 1, 1 };
                break;

            default: throw new ArgumentException();
            }

            resources.CreateResourceTools(setupTimeCutting: 10, setupTimeDrilling: 15, setupTimeAssembling: 20, operatorModel,
                                          numberOfWorkers: numberOfWorkersForProcessing, secondResource);
            resources.SaveToDB(context);
            return(resourceCapabilities);
        }
Ejemplo n.º 18
0
 public Operator(ModelSize size)
 {
     Value = size;
 }
Ejemplo n.º 19
0
 internal Pipeline(Language language, ModelSize modelSize, dynamic pipeline)
 {
     _nlp      = pipeline;
     Language  = language;
     ModelSize = modelSize;
 }
Ejemplo n.º 20
0
        public void RunProduction(int uniqueSimNum, int orderQuantity, ModelSize resourceModelSize,
                                  ModelSize setupModelSize, ModelSize operatorModelSize, int numberOfWorkers, bool secondResource)
        {
            LogConfiguration.LogTo(TargetTypes.Debugger, TargetNames.LOG_AGENTS, LogLevel.Info, LogLevel.Info);
            LogConfiguration.LogTo(TargetTypes.Debugger, TargetNames.LOG_AGENTS, LogLevel.Debug, LogLevel.Debug);
            _testOutputHelper.WriteLine("DatabaseString: " + _contextDataBase.ConnectionString.Value);

            _testOutputHelper.WriteLine("ResultDatabaseString: " + _resultContextDataBase.ConnectionString.Value);
            //Handle this one in our Resource Model?
            MasterDBInitializerTruck.DbInitialize(_contextDataBase.DbContext, resourceModelSize, setupModelSize,
                                                  operatorModelSize, numberOfWorkers, secondResource);
            _testOutputHelper.WriteLine("MasterDBInitialized finished");
            ResultDBInitializerBasic.DbInitialize(_resultContextDataBase.DbContext);
            _testOutputHelper.WriteLine("ResultDBInitializerBasic finished");
            var messageHub = new ConsoleHub();
            var simContext = new AgentSimulation(DBContext: _contextDataBase.DbContext, messageHub: messageHub);
            var simConfig  = ArgumentConverter.ConfigurationConverter(_resultContextDataBase.DbContext, 1);

            _testOutputHelper.WriteLine("ArgumentConverter finished");

            simConfig.ReplaceOption(new DBConnectionString(_resultContextDataBase.ConnectionString.Value));
            simConfig.ReplaceOption(new TimeToAdvance(new TimeSpan(0L)));
            simConfig.ReplaceOption(new KpiTimeSpan(240));
            simConfig.ReplaceOption(new DebugAgents(true));
            simConfig.ReplaceOption(new MinDeliveryTime(1440));
            simConfig.ReplaceOption(new MaxDeliveryTime(2880));
            simConfig.ReplaceOption(new TransitionFactor(3));
            simConfig.ReplaceOption(new SimulationKind(value: SimulationType.Default));
            simConfig.ReplaceOption(new OrderArrivalRate(value: 0.15));
            simConfig.ReplaceOption(new OrderQuantity(value: orderQuantity));
            simConfig.ReplaceOption(new EstimatedThroughPut(value: 1920));
            simConfig.ReplaceOption(new TimePeriodForThroughputCalculation(value: 2880));
            simConfig.ReplaceOption(new Seed(value: 1337));
            simConfig.ReplaceOption(new SettlingStart(value: 0));
            simConfig.ReplaceOption(new SimulationEnd(value: 4380));
            simConfig.ReplaceOption(new SaveToDB(value: true));
            simConfig.ReplaceOption(new MaxBucketSize(value: 480));
            simConfig.ReplaceOption(new SimulationNumber(value: uniqueSimNum));
            simConfig.ReplaceOption(new DebugSystem(value: true));
            simConfig.ReplaceOption(new WorkTimeDeviation(0.0));
            simConfig.ReplaceOption(new TimeConstraintQueueLength(480));

            var simulation = simContext.InitializeSimulation(configuration: simConfig).Result;

            _testOutputHelper.WriteLine("simContext.InitializeSimulation finished");

            var sim = simulation.RunAsync();

            _testOutputHelper.WriteLine("simulation.RunAsync() finished");
            Within(TimeSpan.FromSeconds(120), async() =>
            {
                simContext.StateManager.ContinueExecution(simulation);
                await sim;
            }).Wait();

            var processedOrders =
                _resultContextDataBase.DbContext.Kpis
                .Single(x => x.IsFinal.Equals(true) && x.Name.Equals("OrderProcessed")).Value;

            Assert.Equal(orderQuantity, processedOrders);

            Assert.False(AnyOverlappingTaskItemsExistsOnOneMachine());

            foreach (var obj in messageHub.Logs)
            {
                dynamic guardChildCounter = JsonConvert.DeserializeObject(obj);
                Assert.Equal(0, int.Parse(guardChildCounter[1].Value));
            }

            _contextDataBase.DbContext.Dispose();
            _resultContextDataBase.DbContext.Dispose();
        }
Ejemplo n.º 21
0
        private byte[] GetFrameBuff(Model3DGroup meshGroup, AxisAngleRotation3D rotation = null)
        {
            var frame  = ",";
            var facets = new List <Facet>();
            var size   = new ModelSize(64, 64, 32);

            var axis  = new System.Windows.Media.Media3D.Vector3D();
            var angle = 0d;

            if (rotation != null)
            {
                axis  = rotation.Axis;
                angle = rotation.Angle;
            }

            Dispatcher.Invoke(new Action(() =>
            {
                var cloneMeshGroup = meshGroup.Clone();

                var transform = myViewport3D.Children[myViewport3D.Children.Count - 1].Transform.Clone() as Transform3DGroup;

                foreach (GeometryModel3D geo in cloneMeshGroup.Children)
                {
                    var mesh = geo.Geometry as MeshGeometry3D;

                    for (int i = 0; i < mesh.TriangleIndices.Count; i += 3)
                    {
                        var p  = mesh.Positions[mesh.TriangleIndices[i]];
                        var p0 = transform.Transform(p);

                        p      = mesh.Positions[mesh.TriangleIndices[i + 1]];
                        var p1 = transform.Transform(p);

                        p      = mesh.Positions[mesh.TriangleIndices[i + 2]];
                        var p2 = transform.Transform(p);

                        facets.Add(new Facet(p0, p1, p2));
                    }
                }
            }));

            //facets.RemoveAll(m => m.TooSmall);

            var results = SlicerHelper.DoCircleSlice(facets.ToArray(), new CircleArrayDefine[] {
                new CircleArrayDefine(new System.Numerics.Plane(0, 0, 1, 0), 200, 360)
            });

            IImageMould im = new LED6432P();

            foreach (var key in results.Keys)
            {
                var images = CircleSlicer.ToImage(results[key], size, 64, 32, 0, 0);
                for (int i = 0; i < images.Count; i++)
                {
                    var bmp = images[i];
                    //bmp.Save(AppDomain.CurrentDomain.BaseDirectory + i + ".bmp");
                    frame += "," + im.GetMould(bmp);
                }
            }

            frame = frame.TrimStart(',');
            return(frame.Split(',').Select(m => Byte.Parse(m.Replace("0x", ""), System.Globalization.NumberStyles.AllowHexSpecifier)).ToArray());
        }
Ejemplo n.º 22
0
        public async Task SystemTestAsync(SimulationType simulationType, int simNr, int maxBucketSize, long throughput,
                                          int seed
                                          , ModelSize resourceModelSize, ModelSize setupModelSize
                                          , double arrivalRate, bool distributeSetupsExponentially)
        {
            LogConfiguration.LogTo(TargetTypes.Debugger, TargetNames.LOG_AGENTS, LogLevel.Trace, LogLevel.Trace);
            LogConfiguration.LogTo(TargetTypes.Debugger, TargetNames.LOG_AGENTS, LogLevel.Info, LogLevel.Info);
            LogConfiguration.LogTo(TargetTypes.Debugger, TargetNames.LOG_AGENTS, LogLevel.Debug, LogLevel.Debug);
            //LogConfiguration.LogTo(TargetTypes.Debugger, CustomLogger.PRIORITY, LogLevel.Warn, LogLevel.Warn);
            //LogConfiguration.LogTo(TargetTypes.File, CustomLogger.SCHEDULING, LogLevel.Warn, LogLevel.Warn);
            //LogConfiguration.LogTo(TargetTypes.File, CustomLogger.DISPOPRODRELATION, LogLevel.Debug, LogLevel.Debug);
            //LogConfiguration.LogTo(TargetTypes.Debugger, CustomLogger.PROPOSAL, LogLevel.Warn, LogLevel.Warn);
            //LogConfiguration.LogTo(TargetTypes.Debugger, CustomLogger.INITIALIZE, LogLevel.Warn, LogLevel.Warn);
            LogConfiguration.LogTo(TargetTypes.Debugger, CustomLogger.JOB, LogLevel.Warn, LogLevel.Warn);
            //LogConfiguration.LogTo(TargetTypes.File, CustomLogger.ENQUEUE, LogLevel.Warn, LogLevel.Warn);
            //LogConfiguration.LogTo(TargetTypes.Debugger, CustomLogger.JOBSTATE, LogLevel.Warn, LogLevel.Warn);
            //LogConfiguration.LogTo(TargetTypes.File, TargetNames.LOG_AKKA, LogLevel.Trace, LogLevel.Trace);
            //LogConfiguration.LogTo(TargetTypes.Debugger, TargetNames.LOG_AKKA, LogLevel.Warn);

            var masterCtx = ProductionDomainContext.GetContext(testCtxString);

            masterCtx.Database.EnsureDeleted();
            masterCtx.Database.EnsureCreated();
            MasterDBInitializerTruck.DbInitialize(masterCtx, resourceModelSize, setupModelSize, ModelSize.Small, 3, distributeSetupsExponentially);
            //InMemoryContext.LoadData(source: _masterDBContext, target: _ctx);
            var simContext = new AgentSimulation(DBContext: masterCtx, messageHub: new ConsoleHub());
            var simConfig  = Simulation.CLI.ArgumentConverter.ConfigurationConverter(_ctxResult, 1);

            // update customized Items
            simConfig.AddOption(new DBConnectionString(testResultCtxString));
            simConfig.ReplaceOption(new TimeConstraintQueueLength(480));
            simConfig.ReplaceOption(new SimulationKind(value: simulationType));
            simConfig.ReplaceOption(new OrderArrivalRate(value: arrivalRate));
            simConfig.ReplaceOption(new OrderQuantity(value: 5));
            simConfig.ReplaceOption(new EstimatedThroughPut(value: throughput));
            simConfig.ReplaceOption(new TimePeriodForThroughputCalculation(value: 2880));
            simConfig.ReplaceOption(new Seed(value: seed));
            simConfig.ReplaceOption(new SettlingStart(value: 0));
            simConfig.ReplaceOption(new SimulationEnd(value: 2880));
            simConfig.ReplaceOption(new SaveToDB(value: true));
            simConfig.ReplaceOption(new MaxBucketSize(value: maxBucketSize));
            simConfig.ReplaceOption(new SimulationNumber(value: simNr));
            simConfig.ReplaceOption(new DebugSystem(value: true));
            simConfig.ReplaceOption(new WorkTimeDeviation(0.0));

            var simulation = await simContext.InitializeSimulation(configuration : simConfig);

            emtpyResultDBbySimulationNumber(simNr: simConfig.GetOption <SimulationNumber>());


            var simWasReady = false;

            if (simulation.IsReady())
            {
                // set for Assert
                simWasReady = true;
                // Start simulation
                var sim = simulation.RunAsync();
                simContext.StateManager.ContinueExecution(simulation);
                await sim;
            }

            Assert.True(condition: simWasReady);
        }