From 3eaf08af30ed06ba64f7c5cc4bf0a9eb46ce3d55 Mon Sep 17 00:00:00 2001 From: Michael Krisper <michael.krisper@tugraz.at> Date: Tue, 28 Jul 2015 17:12:52 +0200 Subject: [PATCH] corrected many test files, mod file, sum file, auxiliaries --- VectoCore/Configuration/Constants.cs | 2 +- .../EngineeringDataAdapter.cs | 3 + .../FileIO/Reader/DrivingCycleDataReader.cs | 17 ---- .../DeclarationModeSimulationDataReader.cs | 13 +-- .../EngineeringModeSimulationDataReader.cs | 25 ++++-- VectoCore/Models/Declaration/Wheels.cs | 5 ++ .../Simulation/Data/IModalDataWriter.cs | 66 +++++++++++++- .../Models/Simulation/Data/ModalDataWriter.cs | 9 +- .../Models/Simulation/Data/ModalResult.cs | 31 ++++--- .../Simulation/Data/SummaryFileWriter.cs | 89 ++++++++++--------- VectoCore/Models/Simulation/Impl/TimeRun.cs | 2 +- .../Data/AuxSupplyPowerReader.cs | 2 +- .../SimulationComponent/Impl/Auxiliary.cs | 6 +- .../Impl/DistanceBasedDrivingCycle.cs | 8 +- .../Impl/EngineOnlyDrivingCycle.cs | 4 +- .../Impl/TimeBasedDrivingCycle.cs | 9 +- .../SimulationComponent/Impl/Vehicle.cs | 10 ++- .../Utils/IEnumberableExtensionMethods.cs | 5 ++ VectoCore/Utils/SI.cs | 9 +- .../FileIO/SimulationDataReaderTest.cs | 2 +- .../CombustionEngineTest.cs | 8 +- .../Models/SimulationComponent/VehicleTest.cs | 3 +- .../Cycles/LOT2_rural Engine Only.vmod | 2 +- .../TestData/Jobs/24t Coach EngineOnly.vecto | 2 +- .../TestData/Results/Auxiliaries.vmod | 24 ++--- .../Results/EngineOnlyCycles/24t Coach.vsum | 2 +- .../24t Coach_Engine Only1.vmod | 2 +- .../24t Coach_Engine Only2.vmod | 2 +- .../24t Coach_Engine Only3.vmod | 2 +- .../24tCoach_EngineOnly short.vmod | 2 +- .../EngineOnlyCycles/24tCoach_EngineOnly.vmod | 2 +- .../24tCoach_EngineOnlyFullLoad.vmod | 2 +- .../24tCoach_EngineOnlyPaux.vmod | 2 +- VectoCoreTest/Utils/MockModalDataWriter.cs | 14 +-- VectoCoreTest/Utils/ResultFileHelper.cs | 1 - VectoCoreTest/Utils/SITest.cs | 19 ++-- 36 files changed, 246 insertions(+), 160 deletions(-) diff --git a/VectoCore/Configuration/Constants.cs b/VectoCore/Configuration/Constants.cs index cf202c82ca..adf443b303 100644 --- a/VectoCore/Configuration/Constants.cs +++ b/VectoCore/Configuration/Constants.cs @@ -11,7 +11,7 @@ namespace TUGraz.VectoCore.Configuration public const string Fan = "FAN"; public const string SteeringPump = "STP"; public const string ElectricSystem = "ES"; - public const string HeatingVentilationAirCondition = "AS"; + public const string HeatingVentilationAirCondition = "AC"; public const string PneumaticSystem = "PS"; } diff --git a/VectoCore/FileIO/Reader/DataObjectAdaper/EngineeringDataAdapter.cs b/VectoCore/FileIO/Reader/DataObjectAdaper/EngineeringDataAdapter.cs index f798fd4e38..ad260766ed 100644 --- a/VectoCore/FileIO/Reader/DataObjectAdaper/EngineeringDataAdapter.cs +++ b/VectoCore/FileIO/Reader/DataObjectAdaper/EngineeringDataAdapter.cs @@ -1,6 +1,8 @@ using System; +using System.Collections.Generic; using System.IO; using System.Linq; +using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.Exceptions; using TUGraz.VectoCore.FileIO.EngineeringFile; using TUGraz.VectoCore.Models.Declaration; @@ -8,6 +10,7 @@ using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine; using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; +using TUGraz.VectoCore.Models.SimulationComponent.Impl; using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.FileIO.Reader.DataObjectAdaper diff --git a/VectoCore/FileIO/Reader/DrivingCycleDataReader.cs b/VectoCore/FileIO/Reader/DrivingCycleDataReader.cs index c12bbf92dd..6ba87f4d9d 100644 --- a/VectoCore/FileIO/Reader/DrivingCycleDataReader.cs +++ b/VectoCore/FileIO/Reader/DrivingCycleDataReader.cs @@ -223,23 +223,6 @@ namespace TUGraz.VectoCore.FileIO.Reader IEnumerable<DrivingCycleData.DrivingCycleEntry> Parse(DataTable table); } - /// <summary> - /// Reader for Auxiliary Supply Power. - /// </summary> - private static class AuxSupplyPowerReader - { - /// <summary> - /// [W]. Reads Auxiliary Supply Power (defined by Fields.AuxiliarySupplyPower-Prefix). - /// </summary> - public static Dictionary<string, Watt> Read(DataRow row) - { - return row.Table.Columns.Cast<DataColumn>(). - Where(col => col.ColumnName.StartsWith(Fields.AuxiliarySupplyPower)). - ToDictionary(col => col.ColumnName.Substring(Fields.AuxiliarySupplyPower.Length - 1), - col => row.ParseDouble(col).SI().Kilo.Watt.Cast<Watt>()); - } - } - internal class DistanceBasedDataParser : IDataParser { public IEnumerable<DrivingCycleData.DrivingCycleEntry> Parse(DataTable table) diff --git a/VectoCore/FileIO/Reader/Impl/DeclarationModeSimulationDataReader.cs b/VectoCore/FileIO/Reader/Impl/DeclarationModeSimulationDataReader.cs index a05d39e2c5..3a351b31af 100644 --- a/VectoCore/FileIO/Reader/Impl/DeclarationModeSimulationDataReader.cs +++ b/VectoCore/FileIO/Reader/Impl/DeclarationModeSimulationDataReader.cs @@ -35,8 +35,6 @@ namespace TUGraz.VectoCore.FileIO.Reader.Impl foreach (var mission in segment.Missions) { foreach (var loading in mission.Loadings) { var engineData = dao.CreateEngineData(Engine); - var parser = new DrivingCycleDataReader(); - var data = VectoCSVFile.ReadStream(mission.CycleFile); var simulationRunData = new VectoRunData { VehicleData = dao.CreateVehicleData(Vehicle, mission, loading), @@ -46,7 +44,7 @@ namespace TUGraz.VectoCore.FileIO.Reader.Impl Cycle = DrivingCycleDataReader.ReadFromStream(mission.CycleFile, DrivingCycleData.CycleType.DistanceBased), DriverData = driverdata, IsEngineOnly = IsEngineOnly, - JobFileName = Job.JobFile, + JobFileName = Job.JobFile }; simulationRunData.VehicleData.VehicleClass = segment.VehicleClass; yield return simulationRunData; @@ -132,28 +130,25 @@ namespace TUGraz.VectoCore.FileIO.Reader.Impl Gearbox.BasePath = Path.GetDirectoryName(file); break; default: - throw new UnsupportedFileVersionException("Unsopported Version of gearbox-file. Got version " + fileInfo.Version); + throw new UnsupportedFileVersionException("Unsupported Version of gearbox-file. Got version " + fileInfo.Version); } } private void ReadAuxiliary(IEnumerable<VectoJobFileV2Declaration.DataBodyDecl.AuxDataDecl> auxiliaries) { - // get all constant auxiliaries defined in Declaration mode - // todo: catch exception when auxiliaries are not found - // todo: catch exception when to much auxiliaries are present var aux = DeclarationData.AuxiliaryIDs().Select(id => { var a = auxiliaries.First(decl => decl.ID == id); return new VectoRunData.AuxData { ID = a.ID, Type = AuxiliaryTypeHelper.Parse(a.Type), Technology = a.Technology, - TechList = a.TechList.ToArray(), + TechList = a.TechList.DefaultIfNull(Enumerable.Empty<string>()).ToArray(), DemandType = AuxiliaryDemandType.Constant }; }); // add a direct auxiliary - aux = aux.Concat(new VectoRunData.AuxData { DemandType = AuxiliaryDemandType.Direct }.ToEnumerable()); + aux = aux.Concat(new VectoRunData.AuxData { ID = "", DemandType = AuxiliaryDemandType.Direct }.ToEnumerable()); Aux = aux.ToArray(); } diff --git a/VectoCore/FileIO/Reader/Impl/EngineeringModeSimulationDataReader.cs b/VectoCore/FileIO/Reader/Impl/EngineeringModeSimulationDataReader.cs index 2a71e8833f..df1a3a322d 100644 --- a/VectoCore/FileIO/Reader/Impl/EngineeringModeSimulationDataReader.cs +++ b/VectoCore/FileIO/Reader/Impl/EngineeringModeSimulationDataReader.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.CompilerServices; @@ -10,8 +9,6 @@ using TUGraz.VectoCore.FileIO.EngineeringFile; using TUGraz.VectoCore.FileIO.Reader.DataObjectAdaper; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.SimulationComponent.Data; -using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine; -using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; using TUGraz.VectoCore.Utils; [assembly: InternalsVisibleTo("VectoCoreTest")] @@ -50,8 +47,26 @@ namespace TUGraz.VectoCore.FileIO.Reader.Impl ReadEngine(Path.Combine(job.BasePath, job.Body.EngineFile)); ReadGearbox(Path.Combine(job.BasePath, job.Body.GearboxFile)); + + ReadAuxiliary(engineering.Body.Aux); } + private void ReadAuxiliary(IEnumerable<VectoJobFileV2Engineering.DataBodyEng.AuxDataEng> auxiliaries) + { + var aux = auxiliaries.Select(a => new VectoRunData.AuxData { + ID = a.ID, + Technology = a.Technology, + TechList = a.TechList.DefaultIfNull(Enumerable.Empty<string>()).ToArray(), + DemandType = AuxiliaryDemandType.Mapping + }); + + // add a direct auxiliary + aux = aux.Concat(new VectoRunData.AuxData { ID = "", DemandType = AuxiliaryDemandType.Direct }.ToEnumerable()); + + Aux = aux.ToArray(); + } + + protected override void ReadVehicle(string file) { var json = File.ReadAllText(file); @@ -89,7 +104,7 @@ namespace TUGraz.VectoCore.FileIO.Reader.Impl GearboxData = dao.CreateGearboxData(Gearbox, null), VehicleData = dao.CreateVehicleData(Vehicle), DriverData = driver, - //Aux = + Aux = Aux, // TODO: distance or time-based cycle! Cycle = DrivingCycleDataReader.ReadFromFile(Path.Combine(job.BasePath, cycle), DrivingCycleData.CycleType.DistanceBased), diff --git a/VectoCore/Models/Declaration/Wheels.cs b/VectoCore/Models/Declaration/Wheels.cs index e2678773e5..c6b92d7f56 100644 --- a/VectoCore/Models/Declaration/Wheels.cs +++ b/VectoCore/Models/Declaration/Wheels.cs @@ -13,6 +13,11 @@ namespace TUGraz.VectoCore.Models.Declaration ParseData(ReadCsvResource(ResourceId)); } + public override WheelsEntry Lookup(string key) + { + return base.Lookup(key.Replace(" ", "")); + } + protected override sealed void ParseData(DataTable table) { Data = (from DataRow row in table.Rows diff --git a/VectoCore/Models/Simulation/Data/IModalDataWriter.cs b/VectoCore/Models/Simulation/Data/IModalDataWriter.cs index a412fcae8e..34a4d2f9c8 100644 --- a/VectoCore/Models/Simulation/Data/IModalDataWriter.cs +++ b/VectoCore/Models/Simulation/Data/IModalDataWriter.cs @@ -1,5 +1,8 @@ +using System; using System.Collections.Generic; using System.Data; +using System.Linq; +using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.Simulation.Data { @@ -31,12 +34,71 @@ namespace TUGraz.VectoCore.Models.Simulation.Data /// </summary> void Finish(); - object Compute(string expression, string filter); - IEnumerable<T> GetValues<T>(ModalResultField key); + IEnumerable<T> GetValues<T>(DataColumn col); + + Dictionary<string, DataColumn> Auxiliaries { get; set; } void AddAuxiliary(string id); } + + public static class ModalDataWriterExtensions + { + public static double? Max(this IModalDataWriter data, ModalResultField field) + { + var val = data.GetValues<SI>(field).Max(); + if (val != null) { + return val.Value(); + } + return null; + } + + public static double? Average(this IModalDataWriter data, ModalResultField field, Func<SI, bool> filter = null) + { + var val = data.GetValues<SI>(field).Where(filter ?? (x => x != null)).ToList(); + if (val.Any()) { + return val.ToDouble().Average(); + } + return null; + } + + public static double? Sum(this IModalDataWriter data, ModalResultField field, Func<SI, bool> filter = null) + { + var val = data.GetValues<SI>(field).Where(filter ?? (x => x != null)).ToList(); + if (val.Any()) { + return val.ToDouble().Sum(); + } + return null; + } + + public static double? Sum(this IModalDataWriter data, DataColumn col, Func<SI, bool> filter = null) + { + var val = data.GetValues<SI>(col).Where(filter ?? (x => x != null)).ToList(); + if (val.Any()) { + return val.ToDouble().Sum(); + } + return null; + } + + public static double? Average(this IEnumerable<SI> self, Func<SI, bool> filter = null) + { + var val = self.Where(filter ?? (x => x != null)).ToList(); + if (val.Any()) { + return val.ToDouble().Average(); + } + return null; + } + + public static object DefaultIfNull(this object self) + { + return self ?? DBNull.Value; + } + + public static T DefaultIfNull<T>(this T self, T defaultValue) where T : class + { + return self ?? defaultValue; + } + } } \ No newline at end of file diff --git a/VectoCore/Models/Simulation/Data/ModalDataWriter.cs b/VectoCore/Models/Simulation/Data/ModalDataWriter.cs index fe3a21555f..1005327433 100644 --- a/VectoCore/Models/Simulation/Data/ModalDataWriter.cs +++ b/VectoCore/Models/Simulation/Data/ModalDataWriter.cs @@ -93,17 +93,16 @@ namespace TUGraz.VectoCore.Models.Simulation.Data } - public object Compute(string expression, string filter) + public IEnumerable<T> GetValues<T>(DataColumn col) { - return Data.Compute(expression, filter); + return Data.Rows.Cast<DataRow>().Select(x => x.Field<T>(col)); } public IEnumerable<T> GetValues<T>(ModalResultField key) { - return Data.Rows.Cast<DataRow>().Select(x => x.Field<T>((int)key)); + return GetValues<T>(Data.Columns[(int)key]); } - public object this[ModalResultField key] { get { return CurrentRow[(int)key]; } @@ -121,7 +120,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Data public void AddAuxiliary(string id) { - Auxiliaries[id] = Data.Columns.Add(ModalResultField.Paux_ + id, typeof(double)); + Auxiliaries[id] = Data.Columns.Add(ModalResultField.Paux_ + id, typeof(SI)); } } } \ No newline at end of file diff --git a/VectoCore/Models/Simulation/Data/ModalResult.cs b/VectoCore/Models/Simulation/Data/ModalResult.cs index a28d381dc4..69074f77c1 100644 --- a/VectoCore/Models/Simulation/Data/ModalResult.cs +++ b/VectoCore/Models/Simulation/Data/ModalResult.cs @@ -1,4 +1,5 @@ using System; +using System.CodeDom; using System.ComponentModel; using System.Data; using System.Reflection; @@ -39,10 +40,14 @@ namespace TUGraz.VectoCore.Models.Simulation.Data } if (col.ColumnName.StartsWith(ModalResultField.Paux_.ToString()) && !modalResults.Columns.Contains(col.ColumnName)) { - modalResults.Columns.Add(col.ColumnName, typeof(double)); + modalResults.Columns.Add(col.ColumnName, typeof(SI)); } - newRow.SetField(col.ColumnName, row.ParseDoubleOrGetDefault(col.ColumnName)); + if (typeof(SI).IsAssignableFrom(modalResults.Columns[col.ColumnName].DataType)) { + newRow.SetField(col.ColumnName, row.ParseDoubleOrGetDefault(col.ColumnName).SI()); + } else { + newRow.SetField(col.ColumnName, row.ParseDoubleOrGetDefault(col.ColumnName)); + } } modalResults.Rows.Add(newRow); } catch (VectoException ex) { @@ -123,7 +128,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Data /// <summary> /// [kW] Rotational acceleration power: Engine. /// </summary> - [ModalResultField(typeof(SI), caption: "Pa Eng [kW]")] PaEng, + [ModalResultField(typeof(SI), name: "Pa Eng", caption: "Pa Eng [kW]")] PaEng, /// <summary> /// [kW] Total auxiliary power demand . @@ -133,17 +138,17 @@ namespace TUGraz.VectoCore.Models.Simulation.Data /// <summary> /// [g/h] Fuel consumption from FC map.. /// </summary> - [ModalResultField(typeof(SI), caption: "FC-Map [g/h]")] FCMap, + [ModalResultField(typeof(SI), name: "FC-Map", caption: "FC-Map [g/h]")] FCMap, /// <summary> /// [g/h] Fuel consumption after Auxiliary-Start/Stop Correction. (Based on FC.) /// </summary> - [ModalResultField(typeof(SI), caption: "FC-AUXc [g/h]")] FCAUXc, + [ModalResultField(typeof(SI), name: "FC-AUXc", caption: "FC-AUXc [g/h]")] FCAUXc, /// <summary> /// [g/h] Fuel consumption after WHTC Correction. (Based on FC-AUXc.) /// </summary> - [ModalResultField(typeof(SI), caption: "FC-WHTCc [g/h]")] FCWHTCc, + [ModalResultField(typeof(SI), name: "FC-WHTCc", caption: "FC-WHTCc [g/h]")] FCWHTCc, /// <summary> /// [km] Travelled distance. @@ -179,27 +184,27 @@ namespace TUGraz.VectoCore.Models.Simulation.Data /// <summary> /// [kW] Gearbox losses. /// </summary> - [ModalResultField(typeof(SI), caption: "Ploss GB [kW]")] PlossGB, + [ModalResultField(typeof(SI), name: "Ploss GB", caption: "Ploss GB [kW]")] PlossGB, /// <summary> /// [kW] Losses in differential / axle transmission. /// </summary> - [ModalResultField(typeof(SI), caption: "Ploss Diff [kW]")] PlossDiff, + [ModalResultField(typeof(SI), name: "Ploss Diff", caption: "Ploss Diff [kW]")] PlossDiff, /// <summary> /// [kW] Retarder losses. /// </summary> - [ModalResultField(typeof(SI), caption: "Pa GB [kW]")] PlossRetarder, + [ModalResultField(typeof(SI), name: "Ploss Retarder", caption: "Ploss Retarder [kW]")] PlossRetarder, /// <summary> /// [kW] Rotational acceleration power: Gearbox. /// </summary> - [ModalResultField(typeof(SI), "Pa GB")] PaGB, + [ModalResultField(typeof(SI), name: "Pa GB", caption: "Pa GB [kW]")] PaGB, /// <summary> /// [kW] Vehicle acceleration power. /// </summary> - [ModalResultField(typeof(SI), caption: "Pa Veh [kW]")] PaVeh, + [ModalResultField(typeof(SI), name: "Pa Veh", caption: "Pa Veh [kW]")] PaVeh, /// <summary> /// [kW] Rolling resistance power demand. @@ -234,12 +239,12 @@ namespace TUGraz.VectoCore.Models.Simulation.Data /// <summary> /// [-] Torque converter speed ratio /// </summary> - [ModalResultField(typeof(SI))] TCv, + [ModalResultField(typeof(SI), name: "TCν")] TCv, /// <summary> /// [-] Torque converter torque ratio /// </summary> - [ModalResultField(typeof(SI), caption: "TCµ")] TCmu, + [ModalResultField(typeof(SI), name: "TCµ")] TCmu, /// <summary> /// [Nm] Torque converter output torque diff --git a/VectoCore/Models/Simulation/Data/SummaryFileWriter.cs b/VectoCore/Models/Simulation/Data/SummaryFileWriter.cs index 74ea46f3fc..f74c6e4971 100644 --- a/VectoCore/Models/Simulation/Data/SummaryFileWriter.cs +++ b/VectoCore/Models/Simulation/Data/SummaryFileWriter.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Data; using System.Globalization; using System.Linq; @@ -95,12 +96,12 @@ namespace TUGraz.VectoCore.Models.Simulation.Data row[JOB] = jobName; row[INPUTFILE] = jobFileName; row[CYCLE] = cycleFileName; - row[TIME] = data.Compute("Max(time)", ""); - row[PPOS] = data.Compute("Avg(Pe_eng)", "Pe_eng > 0"); - row[PNEG] = data.Compute("Avg(Pe_eng)", "Pe_eng < 0"); - row[FCMAP] = data.Compute("Avg(FC)", ""); - row[FCAUXC] = data.Compute("Avg([FC-AUXc])", ""); - row[FCWHTCC] = data.Compute("Avg([FC-WHTCc])", ""); + row[TIME] = data.GetValues<SI>(ModalResultField.time).Max(); + row[PPOS] = data.GetValues<SI>(ModalResultField.Pe_eng).Where(x => x > 0).ToDouble().Average(); + row[PNEG] = data.GetValues<SI>(ModalResultField.Pe_eng).Where(x => x < 0).ToDouble().Average(); + row[FCMAP] = data.GetValues<SI>(ModalResultField.FCMap).ToDouble().Average(); + row[FCAUXC] = data.GetValues<SI>(ModalResultField.FCAUXc).ToDouble().Average(); + row[FCWHTCC] = data.GetValues<SI>(ModalResultField.FCWHTCc).ToDouble().Average(); WriteAuxiliaries(data, row); @@ -111,14 +112,14 @@ namespace TUGraz.VectoCore.Models.Simulation.Data { _auxColumns = _auxColumns.Union(data.Auxiliaries.Select(kv => "Eaux_" + kv.Key + " [kwh]")).ToList(); - var sum = 0.0; + double? sum = 0.0; foreach (var aux in data.Auxiliaries) { var colName = "Eaux_" + aux.Key + " [kWh]"; if (!_table.Columns.Contains(colName)) { _table.Columns.Add(colName, typeof(double)); } - var currentSum = (double)data.Compute("Sum(" + aux.Value.ColumnName + ")", ""); + var currentSum = data.Sum(aux.Value); row[colName] = currentSum; sum += currentSum; } @@ -136,25 +137,25 @@ namespace TUGraz.VectoCore.Models.Simulation.Data row[JOB] = jobName; row[INPUTFILE] = jobFileName; row[CYCLE] = cycleFileName; - row[TIME] = data.Compute("Max(time)", ""); - row[DISTANCE] = data.Compute("Max(dist)", ""); - row[SPEED] = data.Compute("Avg(v_act)", ""); - row[PPOS] = data.Compute("Avg(Pe_eng)", "Pe_eng > 0"); - row[PNEG] = data.Compute("Avg(Pe_eng)", "Pe_eng < 0"); - row[FCMAP] = data.Compute("Avg(FCMap)", ""); - row[FCAUXC] = data.Compute("Avg(FCAUXc)", ""); - row[FCWHTCC] = data.Compute("Avg(FCWHTCc)", ""); - row[PBRAKE] = data.Compute("Avg(Pbrake)", ""); - row[EPOSICE] = data.Compute("Avg(Pe_eng)", "Pe_eng > 0"); - row[ENEGICE] = data.Compute("Avg(Pe_eng)", "Pe_eng < 0"); - row[EAIR] = data.Compute("Sum(Pair)", ""); - row[EROLL] = data.Compute("Sum(Proll)", ""); - row[EGRAD] = data.Compute("Sum(Pgrad)", ""); - row[EAUX] = data.Compute("Sum(Paux)", ""); - row[EBRAKE] = data.Compute("Sum(Pbrake)", ""); - row[ETRANSM] = data.Compute("Sum(PlossDiff) + Sum(PlossGB)", ""); - row[ERETARDER] = data.Compute("Sum(PlossRetarder)", ""); - row[EACC] = data.Compute("Sum(PaEng)+Sum(PaGB)", ""); + row[TIME] = data.Max(ModalResultField.time).DefaultIfNull(); + row[DISTANCE] = data.Max(ModalResultField.dist).DefaultIfNull(); + row[SPEED] = data.Average(ModalResultField.v_act).DefaultIfNull(); + row[PPOS] = data.Average(ModalResultField.Pe_eng, x => x > 0).DefaultIfNull(); + row[PNEG] = data.Average(ModalResultField.Pe_eng, x => x < 0).DefaultIfNull(); + row[FCMAP] = data.Average(ModalResultField.FCMap).DefaultIfNull(); + row[FCAUXC] = data.Average(ModalResultField.FCAUXc).DefaultIfNull(); + row[FCWHTCC] = data.Average(ModalResultField.FCWHTCc).DefaultIfNull(); + row[PBRAKE] = data.Average(ModalResultField.Pbrake).DefaultIfNull(); + row[EPOSICE] = data.Average(ModalResultField.Pe_eng, x => x > 0).DefaultIfNull(); + row[ENEGICE] = data.Average(ModalResultField.Pe_eng, x => x < 0).DefaultIfNull(); + row[EAIR] = data.Sum(ModalResultField.Pair).DefaultIfNull(); + row[EROLL] = data.Sum(ModalResultField.Proll).DefaultIfNull(); + row[EGRAD] = data.Sum(ModalResultField.Pgrad).DefaultIfNull(); + row[EAUX] = data.Sum(ModalResultField.Paux).DefaultIfNull(); + row[EBRAKE] = data.Sum(ModalResultField.Pbrake).DefaultIfNull(); + row[ETRANSM] = (data.Sum(ModalResultField.PlossDiff) + data.Sum(ModalResultField.PlossGB)).DefaultIfNull(); + row[ERETARDER] = data.Sum(ModalResultField.PlossRetarder).DefaultIfNull(); + row[EACC] = (data.Sum(ModalResultField.PaEng) + data.Sum(ModalResultField.PaGB)).DefaultIfNull(); //todo altitude - calculate when reading the cycle file, add column for altitude //row["∆altitude [m]"] = Data.Rows[Data.Rows.Count - 1].Field<double>("altitude") - @@ -166,32 +167,32 @@ namespace TUGraz.VectoCore.Models.Simulation.Data row[MASS] = vehicleMass == null ? "" : vehicleMass.Value().ToString(CultureInfo.InvariantCulture); row[LOADING] = vehicleLoading == null ? "" : vehicleLoading.Value().ToString(CultureInfo.InvariantCulture); - var dtValues = data.GetValues<double>(ModalResultField.simulationInterval).ToList(); - var accValues = data.GetValues<double?>(ModalResultField.acc); + var dtValues = data.GetValues<SI>(ModalResultField.simulationInterval).ToList(); + var accValues = data.GetValues<SI>(ModalResultField.acc); var accelerations = CalculateAverageOverSeconds(dtValues, accValues).ToList(); if (accelerations.Any()) { - row[A] = accelerations.Average(); + row[A] = accelerations.ToDouble().Average(); } var acceleration3SecondAverage = Calculate3SecondAverage(accelerations).ToList(); - row[APOS] = acceleration3SecondAverage.Where(x => x > 0.125).DefaultIfEmpty(0).Average(); - row[ANEG] = acceleration3SecondAverage.Where(x => x < -0.125).DefaultIfEmpty(0).Average(); + row[APOS] = acceleration3SecondAverage.Average(x => x > 0.125).DefaultIfNull(); + row[ANEG] = acceleration3SecondAverage.Average(x => x < -0.125).DefaultIfNull(); row[PACC] = 100.0 * acceleration3SecondAverage.Count(x => x > 0.125) / acceleration3SecondAverage.Count; row[PDEC] = 100.0 * acceleration3SecondAverage.Count(x => x < -0.125) / acceleration3SecondAverage.Count; row[PCRUISE] = 100.0 * acceleration3SecondAverage.Count(x => x < 0.125 && x > -0.125) / acceleration3SecondAverage.Count; - var pStopTime = data.GetValues<double?>(ModalResultField.v_act) + var pStopTime = data.GetValues<SI>(ModalResultField.v_act) .Zip(dtValues, (velocity, dt) => new { velocity, dt }) .Where(x => x.velocity < 0.1) - .Sum(x => x.dt); - row[PSTOP] = 100.0 * pStopTime / dtValues.Sum(); + .Sum(x => x.dt.Value()); + row[PSTOP] = 100.0 * pStopTime / dtValues.ToDouble().Sum(); _table.Rows.Add(row); } - private static IEnumerable<double> Calculate3SecondAverage(IReadOnlyList<double> accelerations) + private static IEnumerable<SI> Calculate3SecondAverage(IReadOnlyList<SI> accelerations) { if (accelerations.Count >= 3) { var runningAverage = (accelerations[0] + accelerations[1] + accelerations[2]) / 3.0; @@ -204,11 +205,11 @@ namespace TUGraz.VectoCore.Models.Simulation.Data } - private static IEnumerable<double> CalculateAverageOverSeconds(IEnumerable<double> dtValues, - IEnumerable<double?> accValues) + private static IEnumerable<SI> CalculateAverageOverSeconds(IEnumerable<SI> dtValues, + IEnumerable<SI> accValues) { - var dtSum = 0.0; - var accSum = 0.0; + var dtSum = 0.SI().Second; + var accSum = 0.SI().Meter.Per.Second; var acceleration = dtValues.Zip(accValues, (dt, acc) => new { dt, acc }).ToList(); foreach (var x in acceleration.ToList()) { var currentX = x; @@ -216,13 +217,13 @@ namespace TUGraz.VectoCore.Models.Simulation.Data while (dtSum + currentX.dt >= 1) { var splitX = new { dt = 1 - dtSum, currentX.acc }; yield return accSum; - accSum = 0.0; - dtSum = 0.0; + dtSum = 0.SI<Second>(); + accSum = 0.SI<MeterPerSecond>(); currentX = new { dt = currentX.dt - splitX.dt, currentX.acc }; } if (currentX.dt > 0) { - accSum += currentX.dt * currentX.acc ?? 0.0; + accSum += currentX.dt * currentX.acc ?? 0.SI(); dtSum += currentX.dt; } } diff --git a/VectoCore/Models/Simulation/Impl/TimeRun.cs b/VectoCore/Models/Simulation/Impl/TimeRun.cs index 2404ffaa42..b6356f42c9 100644 --- a/VectoCore/Models/Simulation/Impl/TimeRun.cs +++ b/VectoCore/Models/Simulation/Impl/TimeRun.cs @@ -24,7 +24,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl protected override IResponse Initialize() { - throw new System.NotImplementedException(); + return CyclePort.Initialize(); } } } \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/Data/AuxSupplyPowerReader.cs b/VectoCore/Models/SimulationComponent/Data/AuxSupplyPowerReader.cs index 7d95cb3903..fb85552b23 100644 --- a/VectoCore/Models/SimulationComponent/Data/AuxSupplyPowerReader.cs +++ b/VectoCore/Models/SimulationComponent/Data/AuxSupplyPowerReader.cs @@ -10,7 +10,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data /// </summary> public static class AuxSupplyPowerReader { - private const string AuxSupplyPowerField = "Paux_"; + private const string AuxSupplyPowerField = "Aux_"; /// <summary> /// [W]. Reads Auxiliary Supply Power (defined by Fields.AuxiliarySupplyPower-Prefix). diff --git a/VectoCore/Models/SimulationComponent/Impl/Auxiliary.cs b/VectoCore/Models/SimulationComponent/Impl/Auxiliary.cs index 74f7cebaf1..c3991053a2 100644 --- a/VectoCore/Models/SimulationComponent/Impl/Auxiliary.cs +++ b/VectoCore/Models/SimulationComponent/Impl/Auxiliary.cs @@ -66,7 +66,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public IResponse Initialize() { - throw new NotImplementedException(); + return _outPort.Initialize(); } #endregion @@ -80,10 +80,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl sum += kv.Value; // todo: aux write directauxiliary somewhere to moddata .... probably Padd column?? if (!string.IsNullOrWhiteSpace(kv.Key)) { - writer[kv.Key] = kv.Value.Value(); + writer[kv.Key] = kv.Value; } } - writer[ModalResultField.Paux] = sum.Value(); + writer[ModalResultField.Paux] = sum; } protected override void DoCommitSimulationStep() {} diff --git a/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs b/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs index 5fc85d6eb9..592e509cf3 100644 --- a/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs +++ b/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs @@ -292,8 +292,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public CycleData CycleData() { - // TODO DistanceBasedDrivingCycle.CycleData - throw new NotImplementedException(); + return new CycleData { + AbsTime = CurrentState.AbsTime, + AbsDistance = CurrentState.Distance, + LeftSample = CycleIntervalIterator.LeftSample, + RightSample = CycleIntervalIterator.RightSample + }; } } } \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/Impl/EngineOnlyDrivingCycle.cs b/VectoCore/Models/SimulationComponent/Impl/EngineOnlyDrivingCycle.cs index 55c6f7b844..f715fd7965 100644 --- a/VectoCore/Models/SimulationComponent/Impl/EngineOnlyDrivingCycle.cs +++ b/VectoCore/Models/SimulationComponent/Impl/EngineOnlyDrivingCycle.cs @@ -61,9 +61,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public IResponse Initialize() { - // nothing to initialize here... - // TODO: _outPort.initialize(); - throw new NotImplementedException(); + return _outPort.Initialize(); } #endregion diff --git a/VectoCore/Models/SimulationComponent/Impl/TimeBasedDrivingCycle.cs b/VectoCore/Models/SimulationComponent/Impl/TimeBasedDrivingCycle.cs index b5f976c824..0a97dbc49b 100644 --- a/VectoCore/Models/SimulationComponent/Impl/TimeBasedDrivingCycle.cs +++ b/VectoCore/Models/SimulationComponent/Impl/TimeBasedDrivingCycle.cs @@ -98,8 +98,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public CycleData CycleData() { - // Todo: TimeBasedDrivingCycle.CycleData - throw new NotImplementedException(); + //todo: leftsample, rightsample + return new CycleData { + AbsTime = 0.SI<Second>(), + AbsDistance = 0.SI<Meter>(), + LeftSample = null, + RightSample = null + }; } } } \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/Impl/Vehicle.cs b/VectoCore/Models/SimulationComponent/Impl/Vehicle.cs index b87e923ebf..f8d379ac04 100644 --- a/VectoCore/Models/SimulationComponent/Impl/Vehicle.cs +++ b/VectoCore/Models/SimulationComponent/Impl/Vehicle.cs @@ -50,6 +50,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { writer[ModalResultField.v_act] = (_previousState.Velocity + _currentState.Velocity) / 2; writer[ModalResultField.dist] = (_previousState.Distance - _currentState.Distance) / 2; + + // hint: take care to use correct velocity when writing the P... values in moddata } protected override void DoCommitSimulationStep() @@ -89,7 +91,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl protected Newton AirDragResistance() { - var vAir = _currentState.Velocity; + var vAverage = (_previousState.Velocity + _currentState.Velocity) / 2; + + var vAir = vAverage; // todo: different CdA in different file versions! var CdA = _data.CrossSectionArea * _data.DragCoefficient; @@ -101,12 +105,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl case CrossWindCorrectionMode.SpeedDependent: var values = DeclarationData.AirDrag.Lookup(_data.VehicleCategory); var curve = CalculateAirResistanceCurve(values); - CdA *= AirDragInterpolate(curve, _currentState.Velocity); + CdA *= AirDragInterpolate(curve, vAverage); break; // todo ask raphael: What is the air cd decl mode? //case tCdMode.CdOfVdecl - // CdA = AirDragInterpolate(curve, _currentState.Velocity); + // CdA = AirDragInterpolate(curve, vAverage); // break; case CrossWindCorrectionMode.VAirBeta: diff --git a/VectoCore/Utils/IEnumberableExtensionMethods.cs b/VectoCore/Utils/IEnumberableExtensionMethods.cs index a619cf6642..137d2a6d96 100644 --- a/VectoCore/Utils/IEnumberableExtensionMethods.cs +++ b/VectoCore/Utils/IEnumberableExtensionMethods.cs @@ -11,6 +11,11 @@ namespace TUGraz.VectoCore.Utils return self.Select(StringExtensionMethods.ToDouble); } + public static IEnumerable<double> ToDouble(this IEnumerable<SI> self) + { + return self.Select(x => x.Value()); + } + /// <summary> /// Wraps this object instance into an IEnumerable. /// </summary> diff --git a/VectoCore/Utils/SI.cs b/VectoCore/Utils/SI.cs index e4185ca0c8..4cf19a34df 100644 --- a/VectoCore/Utils/SI.cs +++ b/VectoCore/Utils/SI.cs @@ -889,25 +889,25 @@ namespace TUGraz.VectoCore.Utils public static bool operator <(SI si1, double d) { Contract.Requires(si1 != null); - return si1.Val < d; + return si1 != null && si1.Val < d; } public static bool operator >(SI si1, double d) { Contract.Requires(si1 != null); - return si1.Val > d; + return si1 != null && si1.Val > d; } public static bool operator <=(SI si1, double d) { Contract.Requires(si1 != null); - return si1.Val <= d; + return si1 != null && si1.Val <= d; } public static bool operator >=(SI si1, double d) { Contract.Requires(si1 != null); - return si1.Val >= d; + return si1 != null && si1.Val >= d; } #endregion @@ -1057,7 +1057,6 @@ namespace TUGraz.VectoCore.Utils #endregion - public Scalar Scalar() { var si = ToBasicUnits(); diff --git a/VectoCoreTest/FileIO/SimulationDataReaderTest.cs b/VectoCoreTest/FileIO/SimulationDataReaderTest.cs index e1474aab93..bc599d4846 100644 --- a/VectoCoreTest/FileIO/SimulationDataReaderTest.cs +++ b/VectoCoreTest/FileIO/SimulationDataReaderTest.cs @@ -32,7 +32,7 @@ namespace TUGraz.VectoCore.Tests.FileIO Assert.AreEqual(AxleConfiguration.AxleConfig_4x2, runData.VehicleData.AxleConfiguration); Assert.AreEqual(0.4069297458, runData.VehicleData.DynamicTyreRadius.Value(), Tolerance); - Assert.AreEqual("2", runData.VehicleData.VehicleClass); + Assert.AreEqual(VehicleClass.Class2, runData.VehicleData.VehicleClass); Assert.AreEqual(2, runData.VehicleData.AxleData.Count); Assert.AreEqual(6, runData.VehicleData.AxleData[0].Inertia.Value(), Tolerance); diff --git a/VectoCoreTest/Models/SimulationComponent/CombustionEngineTest.cs b/VectoCoreTest/Models/SimulationComponent/CombustionEngineTest.cs index 8d566a40e5..2c0f9b9517 100644 --- a/VectoCoreTest/Models/SimulationComponent/CombustionEngineTest.cs +++ b/VectoCoreTest/Models/SimulationComponent/CombustionEngineTest.cs @@ -103,7 +103,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent port.Request(absTime, dt, Formulas.PowerToTorque(2329.973.SI<Watt>(), engineSpeed), engineSpeed); engine.CommitSimulationStep(dataWriter); - Assert.AreEqual(1152.40304, dataWriter.GetDouble(ModalResultField.PaEng), 0.001); + Assert.AreEqual(1152.40304, ((SI)dataWriter[ModalResultField.PaEng]).Value(), 0.001); dataWriter.CommitSimulationStep(absTime, dt); absTime += dt; @@ -122,7 +122,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent engine.CommitSimulationStep(dataWriter); - Assert.AreEqual(7108.32, dataWriter.GetDouble(ModalResultField.PaEng), 0.001); + Assert.AreEqual(7108.32, ((SI)dataWriter[ModalResultField.PaEng]).Value(), 0.001); dataWriter.CommitSimulationStep(absTime, dt); absTime += dt; @@ -130,7 +130,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent port.Request(absTime, dt, Formulas.PowerToTorque(1351.656.SI<Watt>(), engineSpeed), engineSpeed); engine.CommitSimulationStep(dataWriter); - Assert.AreEqual(-7108.32, dataWriter.GetDouble(ModalResultField.PaEng), 0.001); + Assert.AreEqual(-7108.32, ((SI)dataWriter[ModalResultField.PaEng]).Value(), 0.001); dataWriter.CommitSimulationStep(absTime, dt); absTime += dt; @@ -187,7 +187,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent engine.CommitSimulationStep(modalData); // todo: compare results... Assert.AreEqual(expectedResults.Rows[i].ParseDouble(0), t.Value(), 0.001, "Time"); - Assert.AreEqual(expectedResults.Rows[i].ParseDouble(1), modalData.GetDouble(ModalResultField.Pe_full), 0.1, + Assert.AreEqual(expectedResults.Rows[i].ParseDouble(1), ((SI)modalData[ModalResultField.Pe_full]).Value(), 0.1, String.Format("Load in timestep {0}", t)); modalData.CommitSimulationStep(); } diff --git a/VectoCoreTest/Models/SimulationComponent/VehicleTest.cs b/VectoCoreTest/Models/SimulationComponent/VehicleTest.cs index b046f24051..a7b08e178f 100644 --- a/VectoCoreTest/Models/SimulationComponent/VehicleTest.cs +++ b/VectoCoreTest/Models/SimulationComponent/VehicleTest.cs @@ -2,6 +2,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCore.FileIO.Reader.Impl; using TUGraz.VectoCore.Models.Simulation.Impl; +using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Models.SimulationComponent.Impl; using TUGraz.VectoCore.Tests.Utils; using TUGraz.VectoCore.Utils; @@ -39,7 +40,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var retVal = requestPort.Request(absTime, dt, accell, gradient); Assert.AreEqual(-2549.07832743748, mockPort.Force.Value(), 0.0001); - Assert.AreEqual(17.0824194205, mockPort.Velocity.Value(), 0.0001); + Assert.AreEqual(16.954303841, mockPort.Velocity.Value(), 0.0001); } } } \ No newline at end of file diff --git a/VectoCoreTest/TestData/Cycles/LOT2_rural Engine Only.vmod b/VectoCoreTest/TestData/Cycles/LOT2_rural Engine Only.vmod index f54768522d..ff9bc2b350 100644 --- a/VectoCoreTest/TestData/Cycles/LOT2_rural Engine Only.vmod +++ b/VectoCoreTest/TestData/Cycles/LOT2_rural Engine Only.vmod @@ -1,4 +1,4 @@ -time [s],n [1/min],Tq_eng [Nm],Tq_clutch [Nm],Tq_full [Nm],Tq_drag [Nm],Pe_eng [kW],Pe_full [kW],Pe_drag [kW],Pe_clutch [kW],Pa [Eng],Paux [kW],FC [g/h],FC-AUXc [g/h],FC-WHTCc [g/h] +time [s],n [1/min],Tq_eng [Nm],Tq_clutch [Nm],Tq_full [Nm],Tq_drag [Nm],Pe_eng [kW],Pe_full [kW],Pe_drag [kW],Pe_clutch [kW],Pa Eng [kW],Paux [kW],FC-Map [g/h],FC-AUXc [g/h],FC-WHTCc [g/h] 1,600,0,0,1282,-148,0,80.55044,-9.299114,0,0,0,1459,-,- 2,600,0,0,801.2501,-148,0,50.34402,-9.299114,0,0,0,1459,-,- 3,600,0,0,801.2501,-148,0,50.34402,-9.299114,0,0,0,1459,-,- diff --git a/VectoCoreTest/TestData/Jobs/24t Coach EngineOnly.vecto b/VectoCoreTest/TestData/Jobs/24t Coach EngineOnly.vecto index 66ab341bfc..08f76774e5 100644 --- a/VectoCoreTest/TestData/Jobs/24t Coach EngineOnly.vecto +++ b/VectoCoreTest/TestData/Jobs/24t Coach EngineOnly.vecto @@ -15,7 +15,7 @@ "../Cycles/Engine Only2.vdri", "../Cycles/Engine Only3.vdri" ], - "VACC": "TestData/Components/Coach.vacc", + "VACC": "../Components/Coach.vacc", "EngineOnlyMode": true, "StartStop": { "Enabled": false, diff --git a/VectoCoreTest/TestData/Results/Auxiliaries.vmod b/VectoCoreTest/TestData/Results/Auxiliaries.vmod index dfd5c6f735..808cd27532 100644 --- a/VectoCoreTest/TestData/Results/Auxiliaries.vmod +++ b/VectoCoreTest/TestData/Results/Auxiliaries.vmod @@ -1,12 +1,12 @@ -time [s],dist [m],v_act [km/h],v_targ [km/h],acc [m/s²],grad [%],n [1/min],Tq_eng [Nm],Tq_clutch [Nm],Tq_full [Nm],Tq_drag [Nm],Pe_eng [kW],Pe_full [kW],Pe_drag [kW],Pe_clutch [kW],Pa Eng [kW],Paux [kW],Gear [-],Ploss GB [kW],Ploss Diff [kW],Ploss Retarder [kW],Pa GB [kW],Pa Veh [kW],Proll [kW],Pair [kW],Pgrad [kW],Pwheel [kW],Pbrake [kW],Paux_FAN [kW],Paux_STP [kW],Paux_AC [kW],Paux_ES [kW],Paux_PS [kW],FC-Map [g/h],FC-AUXc [g/h],FC-WHTCc [g/h] -1.5,0,0,0,0,-0.0007722848,600,62.55471,0,586,-44,3.930429,36.81947,-2.764601,0,0,3.930429,0,0,0,0,0,0,0,0,0,0,0,0.883,0.186,0.15,1.391429,1.32,1387.543,-,1374.777 -2.5,0,0,0,0,-0.0007722848,600,62.55471,0,586,-44,3.930429,36.81947,-2.764601,0,0,3.930429,0,0,0,0,0,0,0,0,0,0,0,0.883,0.186,0.15,1.391429,1.32,1387.543,-,1374.777 -3.5,0.5,1.8,5.99999985694885,1,-0.0007722848,644.4445,180.6473,105.3896,623.5555,-46.22222,12.19117,42.08131,-3.119356,7.112333,1.148414,3.930429,1,0.2287433,0.2998479,0,0,6.058701,0.5250318,0.0004589302,-0.0004507788,6.583741,0,0.883,0.186,0.15,1.391429,1.32,2806.615,-,2780.795 -4.5,2,5.4,11.9999997138977,1,-0.0007722848,950.4012,357.0731,215.7814,851.2568,-60.01605,35.53798,84.72199,-5.973144,21.47582,10.13173,3.930429,1,0.8138651,0.8997127,0,0,18.1761,1.575095,0.01239111,-0.001352336,19.76224,0,0.883,0.186,0.15,1.391429,1.32,7234.365,-,7167.809 -5.5,3.95612859725952,7.04206295013428,11.9999997138977,-0.08774281,-0.0007722848,950.4012,39.49156,0,851.2568,-60.01605,3.930429,84.72199,-5.973144,0,0,3.930429,0,0,0,0,0,-2.079785,2.05406,0.02748076,-0.001763563,-8.086558E-06,0,0.883,0.186,0.15,1.391429,1.32,1621.283,-,1606.367 -6.5,5.82456469535828,6.72636995315552,40.0000019073486,-0.08764219,-0.0007722848,844.9327,-0.01361027,0,783.757,-55.79731,-0.001204252,69.34772,-4.93701,0,-3.931633,3.930429,0,0,0,0,0,-1.984271,1.961977,0.02394811,-0.001684503,-3.083143E-05,-3.083143E-05,0.883,0.186,0.15,1.391429,1.32,963.1212,-,954.2604 -7.5,8.14917969703674,8.36861400604248,68.0000015258789,1,-0.0007722848,785.5349,424.4827,401.148,742.777,-53.27674,34.91838,61.10159,-4.382599,32.99884,-2.01089,3.930429,2,0.9507985,1.394731,0,0,28.16829,2.440994,0.04612004,-0.002095774,30.65331,0,0.883,0.186,0.15,1.391429,1.32,7152.386,-,7086.584 -8.5,11.4737946987152,11.9686140060425,68.0000015258789,1,-0.0007722848,1123.455,549.6978,402.4379,892.8764,-69.40732,64.67083,105.0451,-8.165629,47.346,13.3944,3.930429,2,1.441564,1.995763,0,0,40.2857,3.491057,0.1349151,-0.002997332,43.90867,0,0.883,0.186,0.15,1.391429,1.32,12777.98,-,12660.43 -9.5,15.7984097003937,15.5686140060425,68.0000015258789,1,-0.0007722848,1461.376,548.1378,403.9429,899,-90.06879,83.88422,137.5784,-13.78367,61.81736,18.13643,3.930429,2,1.982165,2.597918,0,0,52.4031,4.541121,0.296947,-0.003898889,57.23727,0,0.883,0.186,0.15,1.391429,1.32,16443.65,-,16292.37 -10.5,20.5762746334076,17.2003137588501,68.0000015258789,-0.09350014,-0.0007722848,1461.376,25.68322,0,899,-90.06879,3.930429,137.5784,-13.78367,0,0,3.930429,0,0,0,0,0,-5.41322,5.017062,0.4004407,-0.00430752,-2.456876E-05,-2.456876E-05,0.883,0.186,0.15,1.391429,1.32,2521.462,-,2498.265 -11.5,25.260773897171,16.8641973495483,68.0000015258789,-0.0932312,-0.0007722848,1308.973,-35.28123,0,899,-80.62812,-4.836187,123.2307,-11.05213,0,-8.766616,3.930429,0,0,0,0,0,-5.292172,4.919023,0.3774211,-0.004223346,4.768465E-05,0,0.883,0.186,0.15,1.391429,1.32,973.7392,-,964.7808 +time [s],dt [s], dist [m],v_act [km/h],v_targ [km/h],acc [m/s²],grad [%],n [1/min],Tq_eng [Nm],Tq_clutch [Nm],Tq_full [Nm],Tq_drag [Nm],Pe_eng [kW],Pe_full [kW],Pe_drag [kW],Pe_clutch [kW],Pa Eng [kW],Paux [kW],Gear [-],Ploss GB [kW],Ploss Diff [kW],Ploss Retarder [kW],Pa GB [kW],Pa Veh [kW],Proll [kW],Pair [kW],Pgrad [kW],Pwheel [kW],Pbrake [kW],Paux_FAN [kW],Paux_STP [kW],Paux_AC [kW],Paux_ES [kW],Paux_PS [kW],FC-Map [g/h],FC-AUXc [g/h],FC-WHTCc [g/h] +1.5,1,0,0,0,0,-0.0007722848,600,62.55471,0,586,-44,3.930429,36.81947,-2.764601,0,0,3.930429,0,0,0,0,0,0,0,0,0,0,0,0.883,0.186,0.15,1.391429,1.32,1387.543,-,1374.777 +2.5,1,0,0,0,0,-0.0007722848,600,62.55471,0,586,-44,3.930429,36.81947,-2.764601,0,0,3.930429,0,0,0,0,0,0,0,0,0,0,0,0.883,0.186,0.15,1.391429,1.32,1387.543,-,1374.777 +3.5,1,0.5,1.8,5.99999985694885,1,-0.0007722848,644.4445,180.6473,105.3896,623.5555,-46.22222,12.19117,42.08131,-3.119356,7.112333,1.148414,3.930429,1,0.2287433,0.2998479,0,0,6.058701,0.5250318,0.0004589302,-0.0004507788,6.583741,0,0.883,0.186,0.15,1.391429,1.32,2806.615,-,2780.795 +4.5,1,2,5.4,11.9999997138977,1,-0.0007722848,950.4012,357.0731,215.7814,851.2568,-60.01605,35.53798,84.72199,-5.973144,21.47582,10.13173,3.930429,1,0.8138651,0.8997127,0,0,18.1761,1.575095,0.01239111,-0.001352336,19.76224,0,0.883,0.186,0.15,1.391429,1.32,7234.365,-,7167.809 +5.5,1,3.95612859725952,7.04206295013428,11.9999997138977,-0.08774281,-0.0007722848,950.4012,39.49156,0,851.2568,-60.01605,3.930429,84.72199,-5.973144,0,0,3.930429,0,0,0,0,0,-2.079785,2.05406,0.02748076,-0.001763563,-8.086558E-06,0,0.883,0.186,0.15,1.391429,1.32,1621.283,-,1606.367 +6.5,1,5.82456469535828,6.72636995315552,40.0000019073486,-0.08764219,-0.0007722848,844.9327,-0.01361027,0,783.757,-55.79731,-0.001204252,69.34772,-4.93701,0,-3.931633,3.930429,0,0,0,0,0,-1.984271,1.961977,0.02394811,-0.001684503,-3.083143E-05,-3.083143E-05,0.883,0.186,0.15,1.391429,1.32,963.1212,-,954.2604 +7.5,1,8.14917969703674,8.36861400604248,68.0000015258789,1,-0.0007722848,785.5349,424.4827,401.148,742.777,-53.27674,34.91838,61.10159,-4.382599,32.99884,-2.01089,3.930429,2,0.9507985,1.394731,0,0,28.16829,2.440994,0.04612004,-0.002095774,30.65331,0,0.883,0.186,0.15,1.391429,1.32,7152.386,-,7086.584 +8.5,1,11.4737946987152,11.9686140060425,68.0000015258789,1,-0.0007722848,1123.455,549.6978,402.4379,892.8764,-69.40732,64.67083,105.0451,-8.165629,47.346,13.3944,3.930429,2,1.441564,1.995763,0,0,40.2857,3.491057,0.1349151,-0.002997332,43.90867,0,0.883,0.186,0.15,1.391429,1.32,12777.98,-,12660.43 +9.5,1,15.7984097003937,15.5686140060425,68.0000015258789,1,-0.0007722848,1461.376,548.1378,403.9429,899,-90.06879,83.88422,137.5784,-13.78367,61.81736,18.13643,3.930429,2,1.982165,2.597918,0,0,52.4031,4.541121,0.296947,-0.003898889,57.23727,0,0.883,0.186,0.15,1.391429,1.32,16443.65,-,16292.37 +10.5,1,20.5762746334076,17.2003137588501,68.0000015258789,-0.09350014,-0.0007722848,1461.376,25.68322,0,899,-90.06879,3.930429,137.5784,-13.78367,0,0,3.930429,0,0,0,0,0,-5.41322,5.017062,0.4004407,-0.00430752,-2.456876E-05,-2.456876E-05,0.883,0.186,0.15,1.391429,1.32,2521.462,-,2498.265 +11.5,1,25.260773897171,16.8641973495483,68.0000015258789,-0.0932312,-0.0007722848,1308.973,-35.28123,0,899,-80.62812,-4.836187,123.2307,-11.05213,0,-8.766616,3.930429,0,0,0,0,0,-5.292172,4.919023,0.3774211,-0.004223346,4.768465E-05,0,0.883,0.186,0.15,1.391429,1.32,973.7392,-,964.7808 diff --git a/VectoCoreTest/TestData/Results/EngineOnlyCycles/24t Coach.vsum b/VectoCoreTest/TestData/Results/EngineOnlyCycles/24t Coach.vsum index 2fac7223e5..a2f10c7f2d 100644 --- a/VectoCoreTest/TestData/Results/EngineOnlyCycles/24t Coach.vsum +++ b/VectoCoreTest/TestData/Results/EngineOnlyCycles/24t Coach.vsum @@ -1,4 +1,4 @@ -Job [-],Input File [-],Cycle [-],time [s],Ppos [kW],Pneg [kW],FC [g/h],FC-AUXc [g/h],FC-WHTCc [g/h] +Job [-],Input File [-],Cycle [-],time [s],Ppos [kW],Pneg [kW],FC-Map [g/h],FC-AUXc [g/h],FC-WHTCc [g/h] 1,24t Coach.vecto,Engine Only1.vdri,3951,29.5999634846317,-1.63579455196953,ERROR,-,- 1,24t Coach.vecto,Engine Only2.vdri,3951,29.5999634846317,-1.63579455196953,ERROR,-,- 1,24t Coach.vecto,Engine Only3.vdri,3951,29.5999634846317,-1.63579455196953,ERROR,-,- diff --git a/VectoCoreTest/TestData/Results/EngineOnlyCycles/24t Coach_Engine Only1.vmod b/VectoCoreTest/TestData/Results/EngineOnlyCycles/24t Coach_Engine Only1.vmod index fc91d4a342..c09a3f1951 100644 --- a/VectoCoreTest/TestData/Results/EngineOnlyCycles/24t Coach_Engine Only1.vmod +++ b/VectoCoreTest/TestData/Results/EngineOnlyCycles/24t Coach_Engine Only1.vmod @@ -1,4 +1,4 @@ -time [s],n [1/min],Tq_eng [Nm],Tq_clutch [Nm],Tq_full [Nm],Tq_drag [Nm],Pe_eng [kW],Pe_full [kW],Pe_drag [kW],Pe_clutch [kW],Pa [Eng],Paux [kW],FC [g/h],FC-AUXc [g/h],FC-WHTCc [g/h] +time [s],n [1/min],Tq_eng [Nm],Tq_clutch [Nm],Tq_full [Nm],Tq_drag [Nm],Pe_eng [kW],Pe_full [kW],Pe_drag [kW],Pe_clutch [kW],Pa Eng [kW],Paux [kW],FC-Map [g/h],FC-AUXc [g/h],FC-WHTCc [g/h] 1,600,0,0,1282,-148,0,80.55044,-9.299114,0,0,0,1459,-,- 2,600,0,0,801.2501,-148,0,50.34402,-9.299114,0,0,0,1459,-,- 3,600,0,0,801.2501,-148,0,50.34402,-9.299114,0,0,0,1459,-,- diff --git a/VectoCoreTest/TestData/Results/EngineOnlyCycles/24t Coach_Engine Only2.vmod b/VectoCoreTest/TestData/Results/EngineOnlyCycles/24t Coach_Engine Only2.vmod index c5c06eec70..28724c8bed 100644 --- a/VectoCoreTest/TestData/Results/EngineOnlyCycles/24t Coach_Engine Only2.vmod +++ b/VectoCoreTest/TestData/Results/EngineOnlyCycles/24t Coach_Engine Only2.vmod @@ -1,4 +1,4 @@ -time [s],n [1/min],Tq_eng [Nm],Tq_clutch [Nm],Tq_full [Nm],Tq_drag [Nm],Pe_eng [kW],Pe_full [kW],Pe_drag [kW],Pe_clutch [kW],Pa [Eng],Paux [kW],FC [g/h],FC-AUXc [g/h],FC-WHTCc [g/h] +time [s],n [1/min],Tq_eng [Nm],Tq_clutch [Nm],Tq_full [Nm],Tq_drag [Nm],Pe_eng [kW],Pe_full [kW],Pe_drag [kW],Pe_clutch [kW],Pa Eng [kW],Paux [kW],FC-Map [g/h],FC-AUXc [g/h],FC-WHTCc [g/h] 1,600,0,0,1282,-148,0,80.55044,-9.299114,0,0,0,1459,-,- 2,600,0,0,801.2501,-148,0,50.34402,-9.299114,0,0,0,1459,-,- 3,600,0,0,801.2501,-148,0,50.34402,-9.299114,0,0,0,1459,-,- diff --git a/VectoCoreTest/TestData/Results/EngineOnlyCycles/24t Coach_Engine Only3.vmod b/VectoCoreTest/TestData/Results/EngineOnlyCycles/24t Coach_Engine Only3.vmod index b1e185358d..7268071c75 100644 --- a/VectoCoreTest/TestData/Results/EngineOnlyCycles/24t Coach_Engine Only3.vmod +++ b/VectoCoreTest/TestData/Results/EngineOnlyCycles/24t Coach_Engine Only3.vmod @@ -1,4 +1,4 @@ -time [s],n [1/min],Tq_eng [Nm],Tq_clutch [Nm],Tq_full [Nm],Tq_drag [Nm],Pe_eng [kW],Pe_full [kW],Pe_drag [kW],Pe_clutch [kW],Pa [Eng],Paux [kW],FC [g/h],FC-AUXc [g/h],FC-WHTCc [g/h] +time [s],n [1/min],Tq_eng [Nm],Tq_clutch [Nm],Tq_full [Nm],Tq_drag [Nm],Pe_eng [kW],Pe_full [kW],Pe_drag [kW],Pe_clutch [kW],Pa Eng [kW],Paux [kW],FC-Map [g/h],FC-AUXc [g/h],FC-WHTCc [g/h] 1,600,0,0,1282,-148,0,80.55044,-9.299114,0,0,0,1459,-,- 2,600,0,0,801.2501,-148,0,50.34402,-9.299114,0,0,0,1459,-,- 3,600,0,0,801.2501,-148,0,50.34402,-9.299114,0,0,0,1459,-,- diff --git a/VectoCoreTest/TestData/Results/EngineOnlyCycles/24tCoach_EngineOnly short.vmod b/VectoCoreTest/TestData/Results/EngineOnlyCycles/24tCoach_EngineOnly short.vmod index ad97f71a13..75b305bfdb 100644 --- a/VectoCoreTest/TestData/Results/EngineOnlyCycles/24tCoach_EngineOnly short.vmod +++ b/VectoCoreTest/TestData/Results/EngineOnlyCycles/24tCoach_EngineOnly short.vmod @@ -1,4 +1,4 @@ -time [s],n [1/min],Tq_eng [Nm],Tq_clutch [Nm],Tq_full [Nm],Tq_drag [Nm],Pe_eng [kW],Pe_full [kW],Pe_drag [kW],Pe_clutch [kW],Pa [Eng],Paux [kW],FC [g/h],FC-AUXc [g/h],FC-WHTCc [g/h] +time [s],n [1/min],Tq_eng [Nm],Tq_clutch [Nm],Tq_full [Nm],Tq_drag [Nm],Pe_eng [kW],Pe_full [kW],Pe_drag [kW],Pe_clutch [kW],Pa Eng [kW],Paux [kW],FC-Map [g/h],FC-AUXc [g/h],FC-WHTCc [g/h] 1,600,0,0,1282,-148,0,80.55044,-9.299114,0,0,0,1459,-,- 2,600,0,0,801.2501,-148,0,50.34402,-9.299114,0,0,0,1459,-,- 3,600,0,0,801.2501,-148,0,50.34402,-9.299114,0,0,0,1459,-,- diff --git a/VectoCoreTest/TestData/Results/EngineOnlyCycles/24tCoach_EngineOnly.vmod b/VectoCoreTest/TestData/Results/EngineOnlyCycles/24tCoach_EngineOnly.vmod index 81407558c5..a048eb3da7 100644 --- a/VectoCoreTest/TestData/Results/EngineOnlyCycles/24tCoach_EngineOnly.vmod +++ b/VectoCoreTest/TestData/Results/EngineOnlyCycles/24tCoach_EngineOnly.vmod @@ -1,4 +1,4 @@ -time [s], simulation_interval [s], n [1/min], Tq_eng [Nm], Tq_clutch [Nm], Tq_full [Nm], Tq_drag [Nm], Pe_eng [kW], Pe_full [kW], Pe_drag [kW], Pe_clutch [kW], Pa [Eng], Paux [kW], FC [g/h], FC-AUXc [g/h], FC-WHTCc [g/h], dist, v_act, v_targ, acc, grad, Gear, Ploss GB, Ploss Diff, Ploss Retarder, Pa GB, Pa Veh, Proll, Pair, Pgrad, Pwheel, Pbrake, Paux_xxx, TCν, TCµ, TC_M_Out, TC_n_Out +time [s], simulation_interval [s], n [1/min], Tq_eng [Nm], Tq_clutch [Nm], Tq_full [Nm], Tq_drag [Nm], Pe_eng [kW], Pe_full [kW], Pe_drag [kW], Pe_clutch [kW], Pa Eng [kW], Paux [kW], FC-Map [g/h], FC-AUXc [g/h], FC-WHTCc [g/h], dist, v_act, v_targ, acc, grad, Gear, Ploss GB, Ploss Diff, Ploss Retarder, Pa GB, Pa Veh, Proll, Pair, Pgrad, Pwheel, Pbrake, Paux_xxx, TCν, TCµ, TC_M_Out, TC_n_Out 0.5,1,600,15.386822685582,,196.810428690233,-148,966.782582222265,12365.9639384619,-9299.11425462579,,966.782582222265,0,1605.0978813996,,,,,,,,,,,,,,,,,,,,,,, 1.5,1,600,0,,1042.76767257274,-148,0,65519.0251911089,-9299.11425462579,,0,0,1459,,,,,,,,,,,,,,,,,,,,,,, 2.5,1,600,0,,1039.86147716225,-148,0,65336.4235480788,-9299.11425462579,,0,0,1459,,,,,,,,,,,,,,,,,,,,,,, diff --git a/VectoCoreTest/TestData/Results/EngineOnlyCycles/24tCoach_EngineOnlyFullLoad.vmod b/VectoCoreTest/TestData/Results/EngineOnlyCycles/24tCoach_EngineOnlyFullLoad.vmod index 39d3753e92..6ad0f0ea06 100644 --- a/VectoCoreTest/TestData/Results/EngineOnlyCycles/24tCoach_EngineOnlyFullLoad.vmod +++ b/VectoCoreTest/TestData/Results/EngineOnlyCycles/24tCoach_EngineOnlyFullLoad.vmod @@ -1,4 +1,4 @@ -time [s], simulation_interval [s], n [1/min], Tq_eng [Nm], Tq_clutch [Nm], Tq_full [Nm], Tq_drag [Nm], Pe_eng [kW], Pe_full [kW], Pe_drag [kW], Pe_clutch [kW], Pa [Eng], Paux [kW], FC [g/h], FC-AUXc [g/h], FC-WHTCc [g/h], dist, v_act, v_targ, acc, grad, Gear, Ploss GB, Ploss Diff, Ploss Retarder, Pa GB, Pa Veh, Proll, Pair, Pgrad, Pwheel, Pbrake, Paux_xxx, TCν, TCµ, TC_M_Out, TC_n_Out +time [s], simulation_interval [s], n [1/min], Tq_eng [Nm], Tq_clutch [Nm], Tq_full [Nm], Tq_drag [Nm], Pe_eng [kW], Pe_full [kW], Pe_drag [kW], Pe_clutch [kW], Pa Eng [kW], Paux [kW], FC-Map [g/h], FC-AUXc [g/h], FC-WHTCc [g/h], dist, v_act, v_targ, acc, grad, Gear, Ploss GB, Ploss Diff, Ploss Retarder, Pa GB, Pa Veh, Proll, Pair, Pgrad, Pwheel, Pbrake, Paux_xxx, TCν, TCµ, TC_M_Out, TC_n_Out 0.5,1,600,15.386822685582,,196.810428690233,-148,966.782582222265,12365.9639384619,-9299.11425462579,,966.782582222265,0,1605.0978813996,,,,,,,,,,,,,,,,,,,,,,, 1.5,1,600,0,,1042.76767257274,-148,0,65519.0251911089,-9299.11425462579,,0,0,1459,,,,,,,,,,,,,,,,,,,,,,, 2.5,1,600,0,,1039.86147716225,-148,0,65336.4235480788,-9299.11425462579,,0,0,1459,,,,,,,,,,,,,,,,,,,,,,, diff --git a/VectoCoreTest/TestData/Results/EngineOnlyCycles/24tCoach_EngineOnlyPaux.vmod b/VectoCoreTest/TestData/Results/EngineOnlyCycles/24tCoach_EngineOnlyPaux.vmod index cab76f5c82..ff1877ec88 100644 --- a/VectoCoreTest/TestData/Results/EngineOnlyCycles/24tCoach_EngineOnlyPaux.vmod +++ b/VectoCoreTest/TestData/Results/EngineOnlyCycles/24tCoach_EngineOnlyPaux.vmod @@ -1,4 +1,4 @@ -time [s], simulation_interval [s], n [1/min], Tq_eng [Nm], Tq_clutch [Nm], Tq_full [Nm], Tq_drag [Nm], Pe_eng [kW], Pe_full [kW], Pe_drag [kW], Pe_clutch [kW], Pa [Eng], Paux [kW], FC [g/h], FC-AUXc [g/h], FC-WHTCc [g/h], dist, v_act, v_targ, acc, grad, Gear, Ploss GB, Ploss Diff, Ploss Retarder, Pa GB, Pa Veh, Proll, Pair, Pgrad, Pwheel, Pbrake, Paux_xxx, TCν, TCµ, TC_M_Out, TC_n_Out +time [s], simulation_interval [s], n [1/min], Tq_eng [Nm], Tq_clutch [Nm], Tq_full [Nm], Tq_drag [Nm], Pe_eng [kW], Pe_full [kW], Pe_drag [kW], Pe_clutch [kW], Pa Eng [kW], Paux [kW], FC-Map [g/h], FC-AUXc [g/h], FC-WHTCc [g/h], dist, v_act, v_targ, acc, grad, Gear, Ploss GB, Ploss Diff, Ploss Retarder, Pa GB, Pa Veh, Proll, Pair, Pgrad, Pwheel, Pbrake, Paux_xxx, TCν, TCµ, TC_M_Out, TC_n_Out 0.5,1,600,47.2178113039611,,196.810428690233,-148,2966.78258222226,12365.9639384619,-9299.11425462579,,966.782582222265,2000,1907.33311833111,,,,,,,,,,,,,,,,,,,,,,, 1.5,1,600,31.8309886183791,,1048.77976973695,-148,2000,65896.776396784,-9299.11425462579,,0,2000,1761.23523693151,,,,,,,,,,,,,,,,,,,,,,, 2.5,1,600,31.8309886183791,,1045.87357432646,-148,2000,65714.174753754,-9299.11425462579,,0,2000,1761.23523693151,,,,,,,,,,,,,,,,,,,,,,, diff --git a/VectoCoreTest/Utils/MockModalDataWriter.cs b/VectoCoreTest/Utils/MockModalDataWriter.cs index c29bdc773d..cefabc8ffe 100644 --- a/VectoCoreTest/Utils/MockModalDataWriter.cs +++ b/VectoCoreTest/Utils/MockModalDataWriter.cs @@ -38,21 +38,25 @@ namespace TUGraz.VectoCore.Tests.Utils public void Finish() {} - public object Compute(string expression, string filter) + public IEnumerable<T> GetValues<T>(ModalResultField key) { - return Data.Compute(expression, filter); + return Data.Rows.Cast<DataRow>().Select(x => x.Field<T>((int)key)); } - public IEnumerable<T> GetValues<T>(ModalResultField key) + public IEnumerable<T> GetValues<T>(DataColumn col) { - return Data.Rows.Cast<DataRow>().Select(x => x.Field<T>((int)key)); + return Data.Rows.Cast<DataRow>().Select(x => x.Field<T>(col)); } public Dictionary<string, DataColumn> Auxiliaries { get; set; } public void AddAuxiliary(string id) { - Auxiliaries[id] = Data.Columns.Add(ModalResultField.Paux_ + id, typeof(double)); + var auxColName = ModalResultField.Paux_ + id; + if (!Data.Columns.Contains(auxColName)) { + Auxiliaries[id] = Data.Columns.Add(auxColName, typeof(Watt)); + } + Auxiliaries[id] = Data.Columns[auxColName]; } public object this[ModalResultField key] diff --git a/VectoCoreTest/Utils/ResultFileHelper.cs b/VectoCoreTest/Utils/ResultFileHelper.cs index cc4b997853..08a81b8571 100644 --- a/VectoCoreTest/Utils/ResultFileHelper.cs +++ b/VectoCoreTest/Utils/ResultFileHelper.cs @@ -3,7 +3,6 @@ using System.Data; using System.IO; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; -using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Tests.Utils diff --git a/VectoCoreTest/Utils/SITest.cs b/VectoCoreTest/Utils/SITest.cs index 64c15c7e5d..a98b038e5d 100644 --- a/VectoCoreTest/Utils/SITest.cs +++ b/VectoCoreTest/Utils/SITest.cs @@ -106,32 +106,32 @@ namespace TUGraz.VectoCore.Tests.Utils { var si = new SI(); Assert.AreEqual(0.0, si.Value()); - Assert.AreEqual("0 [-]", si.ToString()); + Assert.AreEqual("0.0000 [-]", si.ToString()); Assert.IsTrue(si.HasEqualUnit(new SI())); var si2 = 5.SI().Watt; - Assert.AreEqual("5 [W]", si2.ToString()); + Assert.AreEqual("5.0000 [W]", si2.ToString()); var si3 = 2.SI().Radian.Per.Second; - Assert.AreEqual("2 [1/s]", si3.ToString()); + Assert.AreEqual("2.0000 [1/s]", si3.ToString()); var si4 = si2 * si3; - Assert.AreEqual("10 [W/s]", si4.ToString()); + Assert.AreEqual("10.0000 [W/s]", si4.ToString()); Assert.IsTrue(si4.HasEqualUnit(new SI().Watt.Per.Second)); - Assert.AreEqual("10 [kgmm/ssss]", si4.ToBasicUnits().ToString()); + Assert.AreEqual("10.0000 [kgmm/ssss]", si4.ToBasicUnits().ToString()); var kg = 5.SI().Kilo.Gramm; Assert.AreEqual(5.0, kg.Value()); - Assert.AreEqual("5 [kg]", kg.ToString()); + Assert.AreEqual("5.0000 [kg]", kg.ToString()); kg = kg.ConvertTo().Kilo.Gramm.Clone(); Assert.AreEqual(5.0, kg.Value()); - Assert.AreEqual("5 [kg]", kg.ToString()); + Assert.AreEqual("5.0000 [kg]", kg.ToString()); kg = kg.ConvertTo().Gramm.Clone(); Assert.AreEqual(5000, kg.Value()); - Assert.AreEqual("5000 [g]", kg.ToString()); + Assert.AreEqual("5000.0000 [g]", kg.ToString()); var x = 5.SI(); Assert.AreEqual((2.0 / 5.0).SI(), 2 / x); @@ -156,7 +156,6 @@ namespace TUGraz.VectoCore.Tests.Utils } [TestMethod] - [SuppressMessage("ReSharper", "SuggestVarOrType_SimpleTypes")] public void SI_Test_Addition_Subtraction() { var v1 = 600.SI<NewtonMeter>(); @@ -173,7 +172,7 @@ namespace TUGraz.VectoCore.Tests.Utils Assert.IsFalse(v2 >= v1); Assert.AreEqual(1, new SI().CompareTo(null)); - Assert.AreEqual(1, new SI().CompareTo("bla")); + Assert.AreEqual(1, new SI().CompareTo("not an SI")); Assert.AreEqual(-1, new SI().Meter.CompareTo(new SI().Kilo.Meter.Per.Hour)); Assert.AreEqual(1, new SI().Newton.Meter.CompareTo(new SI().Meter)); -- GitLab