public void Generate_Output_Snapshot() { foreach (var assets in new Testbed.Statics[] { General_Test_Samples.Sample1(), new Testbed.Statics(SimpleRCQs_Samples.Sample1()), new Testbed.Statics(SimpleRCQs_Samples.Sample2()), }) { var sim = assets.Sandbox(); var dir = Guid.NewGuid().ToString(); for (int i = 0; i < 5; i++) { sim.Run(TimeSpan.FromHours(2)); sim.RCQsModel.Output_Snapshot_CSVs(sim.ClockTime, dir); } foreach (var file in Directory.GetFiles(dir)) { /// clear the directory File.Delete(file); } Directory.Delete(dir); if (sim.RCQsModel.CountOfLoads_Exited == 0) { Assert.Fail(); } } }
public void Statistics_On_Resources() { foreach (var assets in new Testbed.Statics[] { General_Test_Samples.Sample1(), new Testbed.Statics(SimpleRCQs_Samples.Sample1()), new Testbed.Statics(SimpleRCQs_Samples.Sample2()), }) { var sim = assets.Sandbox(); sim.Run(TimeSpan.FromDays(1)); var stats_resources = sim.RCQsModel.Assets.Resources.Select(res => new List <double> { sim.RCQsModel.ResourceHC_Pending[res].AverageCount, sim.RCQsModel.ResourceHC_Active[res].AverageCount, sim.RCQsModel.ResourceHC_Passive[res].AverageCount, }).ToList(); foreach (var d in stats_resources.SelectMany(l => l)) { if (double.IsNaN(d) || d < 0) { Assert.Fail(); } } if (sim.RCQsModel.CountOfLoads_Exited == 0) { Assert.Fail(); } } }
public void Read_SimpleRCQ_From_CSVs() { var sim = SimpleRCQs_Samples.Sample1().Sandbox(); sim.Run(TimeSpan.FromDays(7)); if (sim.RCQsModel.AllLoads.Count > 29) { Assert.Fail("Need to check if the RCQ is stationary."); } sim.RCQsModel.Output_Statistics_CSVs(); if (sim.RCQsModel.CountOfLoads_Exited == 0) { Assert.Fail(); } }
public void Generate_Ouput_Statistics() { foreach (var assets in new Testbed.Statics[] { General_Test_Samples.Sample1(), new Testbed.Statics(SimpleRCQs_Samples.Sample1()), new Testbed.Statics(SimpleRCQs_Samples.Sample2()), }) { var sim = assets.Sandbox(); sim.Run(TimeSpan.FromDays(1)); var dir = Guid.NewGuid().ToString(); var file1 = dir + "\\" + "Statistics_Activities.csv"; var file2 = dir + "\\" + "Statistics_Resources.csv"; sim.RCQsModel.Output_Statistics_CSVs(dir); if (!File.Exists(file1)) { Assert.Fail(); } if (!File.Exists(file2)) { Assert.Fail(); } /// clear the directory File.Delete(file1); File.Delete(file2); Directory.Delete(dir); if (sim.RCQsModel.CountOfLoads_Exited == 0) { Assert.Fail(); } } }