public async void RunGanttSimulation(Configuration simConfig) { GanttPlanDBContext.ClearDatabase(GanttPlanCtxString); //Synchronisation GanttPlan GanttPlanOptRunner.Inizialize(); var simContext = new GanttSimulation(GanttPlanCtxString, _context.Database.GetDbConnection().ConnectionString, messageHub: _messageHub); simConfig.ReplaceOption(new SimulationKind(value: SimulationType.Central)); simConfig.ReplaceOption(new DebugSystem(value: false)); var simulation = await simContext.InitializeSimulation(configuration : simConfig); //emtpyResultDBbySimulationNumber(simNr: simConfig.GetOption<SimulationNumber>()); if (simulation.IsReady()) { // Start simulation var sim = simulation.RunAsync(); simContext.StateManager.ContinueExecution(simulation); await sim; } }
//[InlineData(SimulationType.DefaultSetup, 1, Int32.MaxValue, 1920, 169, ModelSize.Small, ModelSize.Small)] public async Task CentralSystemTest() { //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, TargetNames.LOG_AGENTS, LogLevel.Warn, LogLevel.Warn); var simtulationType = SimulationType.Central; var seed = 169; var throughput = 1920; var arrivalRate = 0.015; //Create Master40Data var masterPlanContext = ProductionDomainContext.GetContext(masterCtxString); masterPlanContext.Database.EnsureDeleted(); masterPlanContext.Database.EnsureCreated(); MasterDBInitializerTruck.DbInitialize(masterPlanContext, ModelSize.Medium, ModelSize.Medium, ModelSize.Small, 3, false); //CreateMaster40Result var masterPlanResultContext = ResultContext.GetContext(masterResultCtxString); masterPlanResultContext.Database.EnsureDeleted(); masterPlanResultContext.Database.EnsureCreated(); ResultDBInitializerBasic.DbInitialize(masterPlanResultContext); //Reset GanttPLan DB? var ganttPlanContext = GanttPlanDBContext.GetContext(GanttPlanCtxString); ganttPlanContext.Database.ExecuteSqlRaw("EXEC sp_MSforeachtable 'DELETE FROM ? '"); //Synchronisation GanttPlan GanttPlanOptRunner.RunOptAndExport("Init"); var simContext = new GanttSimulation(GanttPlanCtxString, masterCtxString, messageHub: new ConsoleHub()); var simConfig = ArgumentConverter.ConfigurationConverter(masterPlanResultContext, 1); // update customized Items simConfig.AddOption(new DBConnectionString(masterResultCtxString)); simConfig.ReplaceOption(new KpiTimeSpan(240)); simConfig.ReplaceOption(new TimeConstraintQueueLength(480)); simConfig.ReplaceOption(new SimulationKind(value: simtulationType)); simConfig.ReplaceOption(new OrderArrivalRate(value: arrivalRate)); simConfig.ReplaceOption(new OrderQuantity(value: 141)); simConfig.ReplaceOption(new EstimatedThroughPut(value: throughput)); simConfig.ReplaceOption(new TimePeriodForThroughputCalculation(value: 4000)); simConfig.ReplaceOption(new Seed(value: seed)); simConfig.ReplaceOption(new SettlingStart(value: 2880)); simConfig.ReplaceOption(new SimulationEnd(value: 10080)); simConfig.ReplaceOption(new SaveToDB(value: true)); simConfig.ReplaceOption(new DebugSystem(value: false)); simConfig.ReplaceOption(new WorkTimeDeviation(0.2)); 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); }