diff --git a/VECTO/GUI/F_MAINForm.vb b/VECTO/GUI/F_MAINForm.vb index 09fa1e4f57f5cadb0609c8974699df34f4c2accf..5d43a699dddddab43deeea5e9b99a45fab8910ab 100644 --- a/VECTO/GUI/F_MAINForm.vb +++ b/VECTO/GUI/F_MAINForm.vb @@ -1570,10 +1570,10 @@ Imports TUGraz.VectoCore.Models.Simulation Return End If - Dim progress As Dictionary(Of String, Double) = jobContainer.GetProgress() + Dim progress As Dictionary(Of String, JobContainer.ProgressEntry) = jobContainer.GetProgress() Dim NumLines As Double = progress.Count - Dim sumProgress As Double = progress.Sum(Function(pair) pair.Value) + Dim sumProgress As Double = progress.Sum(Function(pair) pair.Value.Progress) If sumProgress > 0 And start = DateTime.MinValue Then diff --git a/VectoConsole/Program.cs b/VectoConsole/Program.cs index 556a810ff171d6034c70e646d7e31857fa091c03..2a3b1eb21c613ba71b7326b7d45e382267086c0d 100644 --- a/VectoConsole/Program.cs +++ b/VectoConsole/Program.cs @@ -105,6 +105,9 @@ Examples: stopWatch.Start(); foreach (var file in fileList.Where(f => Path.GetExtension(f) == Constants.FileExtensions.VectoJobFile)) { var runsFactory = new SimulatorFactory(SimulatorFactory.FactoryMode.DeclarationMode, file); + if (args.Contains("-mod")) { + runsFactory.WriteModalResults = true; + } jobContainer.AddRuns(runsFactory); } stopWatch.Stop(); @@ -112,7 +115,12 @@ Examples: stopWatch.Reset(); Console.WriteLine("Starting simulation runs"); - + if (debugEnabled) { + Console.ForegroundColor = ConsoleColor.White; + Console.WriteLine("Debug-Output is enabled, executing simulation runs sequentially"); + Console.ResetColor(); + } + Console.WriteLine(); stopWatch.Start(); jobContainer.Execute(!debugEnabled); @@ -177,7 +185,7 @@ Examples: Console.WriteLine(); Console.WriteLine("---- timing information ----"); foreach (var timing in timings) { - Console.Write("{0,-20}: {1:F2}s", timing.Key, timing.Value / 1000); + Console.WriteLine("{0,-20}: {1:F2}s", timing.Key, timing.Value / 1000); } } } diff --git a/VectoCore/Models/Simulation/Data/IModalDataWriter.cs b/VectoCore/Models/Simulation/Data/IModalDataWriter.cs index 18af7ab6eb323ed3fa81d84d0de1bd0b43a1aff5..a77cb630e084aed663391c212a0ac89712edea62 100644 --- a/VectoCore/Models/Simulation/Data/IModalDataWriter.cs +++ b/VectoCore/Models/Simulation/Data/IModalDataWriter.cs @@ -34,6 +34,8 @@ namespace TUGraz.VectoCore.Models.Simulation.Data /// </summary> void Finish(); + bool WriteModalResults { get; set; } + IEnumerable<T> GetValues<T>(ModalResultField key); IEnumerable<T> GetValues<T>(DataColumn col); diff --git a/VectoCore/Models/Simulation/Data/ModalDataWriter.cs b/VectoCore/Models/Simulation/Data/ModalDataWriter.cs index 4ef22cbfa0a3e84fc1cb069600c81f67f69e888e..cfc9e766e2466c7a62a01fd91d43348e93f657cd 100644 --- a/VectoCore/Models/Simulation/Data/ModalDataWriter.cs +++ b/VectoCore/Models/Simulation/Data/ModalDataWriter.cs @@ -15,6 +15,9 @@ namespace TUGraz.VectoCore.Models.Simulation.Data private DataRow CurrentRow { get; set; } private string ModFileName { get; set; } + public bool WriteModalResults { get; set; } + + public ModalDataWriter(string modFileName, SimulatorFactory.FactoryMode mode = SimulatorFactory.FactoryMode.EngineeringMode) : this(modFileName, _ => {}, mode) {} @@ -96,7 +99,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Data .Concat((Auxiliaries.Values.Select(c => c.ColumnName))) .Concat(new[] { ModalResultField.FCMap, ModalResultField.FCAUXc, ModalResultField.FCWHTCc }.Select(x => x.GetName())); - if (_mode != SimulatorFactory.FactoryMode.DeclarationMode) { + if (_mode != SimulatorFactory.FactoryMode.DeclarationMode || WriteModalResults) { VectoCSVFile.Write(ModFileName, new DataView(Data).ToTable(false, strCols.ToArray())); } @@ -105,7 +108,6 @@ namespace TUGraz.VectoCore.Models.Simulation.Data } } - public IEnumerable<T> GetValues<T>(DataColumn col) { return Data.Rows.Cast<DataRow>().Select(x => x.Field<T>(col)); diff --git a/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs b/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs index 655f14e2117cb1fff5287786162477cff738d250..393b5693d5040a7bbc7bc5b696a47dc3ae40281d 100644 --- a/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs +++ b/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs @@ -48,6 +48,8 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl public int JobNumber { get; set; } + public bool WriteModalResults { get; set; } + /// <summary> /// Creates powertrain and initializes it with the component's data. /// </summary> @@ -63,6 +65,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl IModalDataWriter modWriter = new ModalDataWriter(string.Format(modFileName, data.Cycle.Name, data.ModFileSuffix ?? ""), writer => d.Report.AddResult(d.Loading, d.Mission, writer), _mode); + modWriter.WriteModalResults = WriteModalResults; var jobName = string.Format("{0}-{1}", JobNumber, i++); var sumWriterDecorator = DecorateSumWriter(data.IsEngineOnly, SumWriter, data.JobFileName, jobName, data.Cycle.Name); var builder = new PowertrainBuilder(modWriter, sumWriterDecorator, DataReader.IsEngineOnly); diff --git a/VectoCoreTest/Integration/FullCycleDeclarationTest.cs b/VectoCoreTest/Integration/FullCycleDeclarationTest.cs index fd00c6030c2fa30b87cba6d55e7f1c1b468985cc..4f072b84ea094e130959fcd29f6f3ebc66bc909a 100644 --- a/VectoCoreTest/Integration/FullCycleDeclarationTest.cs +++ b/VectoCoreTest/Integration/FullCycleDeclarationTest.cs @@ -123,10 +123,10 @@ namespace TUGraz.VectoCore.Tests.Integration LogManager.DisableLogging(); var factory = new SimulatorFactory(SimulatorFactory.FactoryMode.DeclarationMode, TruckDeclarationJob); + factory.WriteModalResults = true; var sumFileName = Path.GetFileNameWithoutExtension(TruckDeclarationJob) + Constants.FileExtensions.SumFile; var sumWriter = new SummaryFileWriter(sumFileName); var jobContainer = new JobContainer(sumWriter); - jobContainer.AddRuns(factory); jobContainer.Execute(); diff --git a/VectoCoreTest/Utils/MockModalDataWriter.cs b/VectoCoreTest/Utils/MockModalDataWriter.cs index ddad107d872ad4b00685902bf1e8f86e2ee47405..19d073b91c6fdf3a9db3486eabe77674b3ae3761 100644 --- a/VectoCoreTest/Utils/MockModalDataWriter.cs +++ b/VectoCoreTest/Utils/MockModalDataWriter.cs @@ -37,6 +37,8 @@ namespace TUGraz.VectoCore.Tests.Utils public void Finish() {} + public bool WriteModalResults { get; set; } + public IEnumerable<T> GetValues<T>(ModalResultField key) { return Data.Rows.Cast<DataRow>().Select(x => x.Field<T>((int)key));