diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdaper/EngineeringDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdaper/EngineeringDataAdapter.cs index 505d9ebfd81cac1a28f34f12220cd755019af5b4..64f0e0f054f62c95ffa99553526dd96ee8a294e1 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdaper/EngineeringDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdaper/EngineeringDataAdapter.cs @@ -155,7 +155,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdaper : null; var fullLoadCurve = IntersectFullLoadCurves(engineData.FullLoadCurve, gearFullLoad); var shiftPolygon = gear.ShiftPolygon != null - ? ShiftPolygon.Create(gear.ShiftPolygon) + ? ShiftPolygonReader.Create(gear.ShiftPolygon) : DeclarationData.Gearbox.ComputeShiftPolygon(i, fullLoadCurve, gears, engineData, axlegearRatio, dynamicTyreRadius); return new KeyValuePair<uint, GearData>((uint)(i + 1), new GearData { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/FullLoadCurve.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/FullLoadCurve.cs index 5940745414d5bac5b531ad8b5e87b96ad69505d9..226f448d3e589d312a48c43e4fc078d022baa272 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/FullLoadCurve.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/FullLoadCurve.cs @@ -48,11 +48,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data { private Watt _maxPower; private PerSecond _ratedSpeed; + private NewtonMeter _maxTorque; [Required, ValidateObject] internal List<FullLoadCurveEntry> FullLoadEntries; [Required] internal LookupData<PerSecond, Second> PT1Data; - private NewtonMeter _maxTorque; /// <summary> /// Get the rated speed from the given full-load curve (i.e. speed with max. power) @@ -77,87 +77,26 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data get { return _maxTorque ?? FindMaxTorque(); } } - private NewtonMeter FindMaxTorque() - { - _maxTorque = FullLoadEntries.Max(x => x.TorqueFullLoad); - return _maxTorque; - } - - public static FullLoadCurve ReadFromFile(string fileName, bool declarationMode = false, bool engineFld = false) - { - try { - var data = VectoCSVFile.Read(fileName); - return Create(data, declarationMode, engineFld); - } catch (Exception ex) { - throw new VectoException("ERROR while reading FullLoadCurve File: " + ex.Message); - } - } - - - public static FullLoadCurve Create(DataTable data, bool declarationMode = false, bool engineFld = false) - { - if (engineFld) { - if (data.Columns.Count < 3) { - throw new VectoException("Engine FullLoadCurve Data File must consist of at least 3 columns."); - } - } else { - if (data.Columns.Count < 2) { - throw new VectoException("Gearbox FullLoadCurve Data File must consist of at least 2 columns."); - } - } - - if (data.Rows.Count < 2) { - throw new VectoException( - "FullLoadCurve must consist of at least two lines with numeric values (below file header)"); - } - - List<FullLoadCurveEntry> entriesFld; - if (HeaderIsValid(data.Columns, engineFld)) { - entriesFld = CreateFromColumnNames(data, engineFld); - } else { - Logger<FullLoadCurve>().Warn( - "FullLoadCurve: Header Line is not valid. Expected: '{0}, {1}, {2}', Got: '{3}'. Falling back to column index.", - Fields.EngineSpeed, Fields.TorqueFullLoad, - Fields.TorqueDrag, ", ".Join(data.Columns.Cast<DataColumn>().Select(c => c.ColumnName))); - - entriesFld = CreateFromColumnIndizes(data, engineFld); - } - - LookupData<PerSecond, Second> tmp; - if (declarationMode) { - tmp = new PT1(); - } else { - tmp = PT1Curve.Create(data); - } - entriesFld.Sort((entry1, entry2) => entry1.EngineSpeed.Value().CompareTo(entry2.EngineSpeed.Value())); - return new FullLoadCurve { FullLoadEntries = entriesFld, PT1Data = tmp }; - } - - private static bool HeaderIsValid(DataColumnCollection columns, bool engineFld) + public virtual NewtonMeter FullLoadStationaryTorque(PerSecond angularVelocity) { - return columns.Contains(Fields.EngineSpeed) - && columns.Contains(Fields.TorqueFullLoad) - && (!engineFld || columns.Contains(Fields.TorqueDrag)); + var idx = FindIndex(angularVelocity); + return VectoMath.Interpolate(FullLoadEntries[idx - 1].EngineSpeed, FullLoadEntries[idx].EngineSpeed, + FullLoadEntries[idx - 1].TorqueFullLoad, FullLoadEntries[idx].TorqueFullLoad, + angularVelocity); } - private static List<FullLoadCurveEntry> CreateFromColumnNames(DataTable data, bool engineFld) + public virtual NewtonMeter DragLoadStationaryTorque(PerSecond angularVelocity) { - return (from DataRow row in data.Rows - select new FullLoadCurveEntry { - EngineSpeed = row.ParseDouble(Fields.EngineSpeed).RPMtoRad(), - TorqueFullLoad = row.ParseDouble(Fields.TorqueFullLoad).SI<NewtonMeter>(), - TorqueDrag = (engineFld ? row.ParseDouble(Fields.TorqueDrag).SI<NewtonMeter>() : null) - }).ToList(); + var idx = FindIndex(angularVelocity); + return VectoMath.Interpolate(FullLoadEntries[idx - 1].EngineSpeed, FullLoadEntries[idx].EngineSpeed, + FullLoadEntries[idx - 1].TorqueDrag, FullLoadEntries[idx].TorqueDrag, + angularVelocity); } - private static List<FullLoadCurveEntry> CreateFromColumnIndizes(DataTable data, bool engineFld) + private NewtonMeter FindMaxTorque() { - return (from DataRow row in data.Rows - select new FullLoadCurveEntry { - EngineSpeed = row.ParseDouble(0).RPMtoRad(), - TorqueFullLoad = row.ParseDouble(1).SI<NewtonMeter>(), - TorqueDrag = (engineFld ? row.ParseDouble(2).SI<NewtonMeter>() : null) - }).ToList(); + _maxTorque = FullLoadEntries.Max(x => x.TorqueFullLoad); + return _maxTorque; } /// <summary> @@ -208,21 +147,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data return Tuple.Create(engineSpeedMaxPower, engineTorqueMaxPower * engineSpeedMaxPower); } - public virtual NewtonMeter FullLoadStationaryTorque(PerSecond angularVelocity) - { - var idx = FindIndex(angularVelocity); - return VectoMath.Interpolate(FullLoadEntries[idx - 1].EngineSpeed, FullLoadEntries[idx].EngineSpeed, - FullLoadEntries[idx - 1].TorqueFullLoad, FullLoadEntries[idx].TorqueFullLoad, - angularVelocity); - } - - public virtual NewtonMeter DragLoadStationaryTorque(PerSecond angularVelocity) - { - var idx = FindIndex(angularVelocity); - return VectoMath.Interpolate(FullLoadEntries[idx - 1].EngineSpeed, FullLoadEntries[idx].EngineSpeed, - FullLoadEntries[idx - 1].TorqueDrag, FullLoadEntries[idx].TorqueDrag, - angularVelocity); - } /// <summary> /// Get item index for the segment of the full-load curve where the angularVelocity lies within. @@ -291,23 +215,5 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data #endregion } - - private static class Fields - { - /// <summary> - /// [rpm] engine speed - /// </summary> - public const string EngineSpeed = "engine speed"; - - /// <summary> - /// [Nm] full load torque - /// </summary> - public const string TorqueFullLoad = "full load torque"; - - /// <summary> - /// [Nm] motoring torque - /// </summary> - public const string TorqueDrag = "motoring torque"; - } } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/ShiftPolygon.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/ShiftPolygon.cs index 6f5c4a992eb0880344ae41e846bd4c63a4f06a9f..5c50170cc42919bfc0baa5becd15939e798afcaa 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/ShiftPolygon.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/ShiftPolygon.cs @@ -55,42 +55,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox } - public static ShiftPolygon ReadFromFile(string fileName) - { - try { - var data = VectoCSVFile.Read(fileName); - return Create(data); - } catch (Exception ex) { - throw new VectoException("ERROR while reading ShiftPolygon: " + ex.Message); - } - } - - public static ShiftPolygon Create(DataTable data) - { - if (data.Columns.Count != 3) { - throw new VectoException("ShiftPolygon Data File must contain exactly 3 columns."); - } - - if (data.Rows.Count < 2) { - throw new VectoException("ShiftPolygon must have at least two entries"); - } - - List<ShiftPolygonEntry> entriesDown, entriesUp; - if (HeaderIsValid(data.Columns)) { - entriesDown = CreateFromColumnNames(data, Fields.AngularSpeedDown); - entriesUp = CreateFromColumnNames(data, Fields.AngularSpeedUp); - } else { - Logger<ShiftPolygon>() - .Warn( - "ShiftPolygon: Header Line is not valid. Expected: '{0}, {1}, {2}', Got: '{3}'. Falling back to column index", - Fields.Torque, Fields.AngularSpeedUp, Fields.AngularSpeedDown, - ", ".Join(data.Columns.Cast<DataColumn>().Select(c => c.ColumnName).Reverse())); - entriesDown = CreateFromColumnIndizes(data, 1); - entriesUp = CreateFromColumnIndizes(data, 2); - } - return new ShiftPolygon(entriesDown, entriesUp); - } - public ReadOnlyCollection<ShiftPolygonEntry> Upshift { get { return _upShiftPolygon.AsReadOnly(); } @@ -141,31 +105,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox return z.IsSmaller(0); } - private static bool HeaderIsValid(DataColumnCollection columns) - { - return columns.Contains(Fields.Torque) && columns.Contains(Fields.AngularSpeedUp) && - columns.Contains((Fields.AngularSpeedDown)); - } - - private static List<ShiftPolygonEntry> CreateFromColumnNames(DataTable data, string columnName) - { - return (from DataRow row in data.Rows - select new ShiftPolygonEntry { - Torque = row.ParseDouble(Fields.Torque).SI<NewtonMeter>(), - AngularSpeed = row.ParseDouble(columnName).RPMtoRad(), - }).ToList(); - } - - private static List<ShiftPolygonEntry> CreateFromColumnIndizes(DataTable data, int column) - { - return (from DataRow row in data.Rows - select - new ShiftPolygonEntry { - Torque = row.ParseDouble(0).SI<NewtonMeter>(), - AngularSpeed = row.ParseDouble(column).RPMtoRad(), - }).ToList(); - } - public static ValidationResult ValidateShiftPolygon(ShiftPolygon shiftPolygon, ValidationContext validationContext) { return shiftPolygon.Downshift.Pairwise(Tuple.Create) @@ -176,23 +115,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox : ValidationResult.Success; } - private static class Fields - { - /// <summary> - /// [Nm] torque - /// </summary> - public const string Torque = "engine torque"; - - /// <summary> - /// [rpm] threshold for upshift - /// </summary> - public const string AngularSpeedUp = "upshift rpm"; - - /// <summary> - /// [rpm] threshold for downshift - /// </summary> - public const string AngularSpeedDown = "downshift rpm"; - } [DebuggerDisplay("{Torque}, {AngularSpeed}")] public class ShiftPolygonEntry diff --git a/VectoCore/VectoCore/VectoCore.csproj b/VectoCore/VectoCore/VectoCore.csproj index c4cda35b753a4632514f1811a6b33d1f77b919c8..c64dbaf57a35d68f4d54d0c8c1cfd9998e3d957b 100644 --- a/VectoCore/VectoCore/VectoCore.csproj +++ b/VectoCore/VectoCore/VectoCore.csproj @@ -118,10 +118,12 @@ <Compile Include="InputData\Reader\DataObjectAdaper\DeclarationDataAdapter.cs" /> <Compile Include="InputData\Reader\DataObjectAdaper\EngineeringDataAdapter.cs" /> <Compile Include="InputData\Reader\DrivingCycleDataReader.cs" /> + <Compile Include="InputData\Reader\FullLoadCurveReader.cs" /> <Compile Include="InputData\Reader\Impl\AbstractVectoRunDataFactory.cs" /> <Compile Include="InputData\Reader\Impl\DeclarationModeVectoRunDataFactory.cs" /> <Compile Include="InputData\Reader\Impl\EngineeringModeVectoRunDataFactory.cs" /> <Compile Include="InputData\Reader\Impl\EngineOnlyVectoRunDataFactory.cs" /> + <Compile Include="InputData\Reader\ShiftPolygonReader.cs" /> <Compile Include="Models\Connector\Ports\IDriverDemandPort.cs" /> <Compile Include="Models\Connector\Ports\IDrivingCyclePort.cs" /> <Compile Include="Models\Connector\Ports\Impl\Response.cs" /> diff --git a/VectoCore/VectoCoreTest/Integration/CoachAdvancedAuxPowertrain.cs b/VectoCore/VectoCoreTest/Integration/CoachAdvancedAuxPowertrain.cs index 94c6b69784943c3975a4a279536bf934e1922856..adb23aec1ff8d9a3bfd3cfa28dd592e2210832a3 100644 --- a/VectoCore/VectoCoreTest/Integration/CoachAdvancedAuxPowertrain.cs +++ b/VectoCore/VectoCoreTest/Integration/CoachAdvancedAuxPowertrain.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.InputData.Reader; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.Impl; @@ -92,7 +93,7 @@ namespace TUGraz.VectoCore.Tests.Integration : TransmissionLossMap.ReadFromFile(GearboxDirectLoss, ratio, string.Format("Gear {0}", i)), Ratio = ratio, - ShiftPolygon = ShiftPolygon.ReadFromFile(GearboxShiftPolygonFile) + ShiftPolygon = ShiftPolygonReader.ReadFromFile(GearboxShiftPolygonFile) })) .ToDictionary(k => k.Item1 + 1, v => v.Item2), ShiftTime = 2.SI<Second>(), diff --git a/VectoCore/VectoCoreTest/Integration/CoachPowerTrain.cs b/VectoCore/VectoCoreTest/Integration/CoachPowerTrain.cs index 6a2252962fedfdd04d6771bfa2ba141a7d53c7ba..3afa5d6a470a06c913dfa1c2ad223fc2b2336fb1 100644 --- a/VectoCore/VectoCoreTest/Integration/CoachPowerTrain.cs +++ b/VectoCore/VectoCoreTest/Integration/CoachPowerTrain.cs @@ -34,6 +34,7 @@ using System.Collections.Generic; using System.Linq; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.InputData.Reader; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.Impl; @@ -120,7 +121,7 @@ namespace TUGraz.VectoCore.Tests.Integration : TransmissionLossMap.ReadFromFile(GearboxDirectLoss, ratio, string.Format("Gear {0}", i)), Ratio = ratio, - ShiftPolygon = ShiftPolygon.ReadFromFile(GearboxShiftPolygonFile) + ShiftPolygon = ShiftPolygonReader.ReadFromFile(GearboxShiftPolygonFile) })) .ToDictionary(k => k.Item1 + 1, v => v.Item2), ShiftTime = 2.SI<Second>(), diff --git a/VectoCore/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs b/VectoCore/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs index 159e7b4ded3df6e971730b506797a1a4ec2e9025..e43ddae43b4b7f5b46a7249dd0519c50caf083e0 100644 --- a/VectoCore/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs +++ b/VectoCore/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs @@ -312,7 +312,7 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns LossMap = TransmissionLossMap.ReadFromFile(GearboxLossMap, ratio, string.Format("Gear {0}", i)), Ratio = ratio, - ShiftPolygon = ShiftPolygon.ReadFromFile(GearboxShiftPolygonFile) + ShiftPolygon = ShiftPolygonReader.ReadFromFile(GearboxShiftPolygonFile) })) .ToDictionary(k => k.Item1 + 1, v => v.Item2), ShiftTime = 2.SI<Second>(), @@ -346,7 +346,7 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns FullLoadCurve = null, LossMap = TransmissionLossMap.ReadFromFile(GearboxLossMap, ratio, "Gear 1"), Ratio = ratio, - ShiftPolygon = ShiftPolygon.ReadFromFile(GearboxShiftPolygonFile) + ShiftPolygon = ShiftPolygonReader.ReadFromFile(GearboxShiftPolygonFile) } } }, diff --git a/VectoCore/VectoCoreTest/Integration/Truck40tPowerTrain.cs b/VectoCore/VectoCoreTest/Integration/Truck40tPowerTrain.cs index 833ef248999885eb52c8f55f522b528297b9dd57..3d6bc4f8dd5b5fa062ba2f13ca51917b415ffc1d 100644 --- a/VectoCore/VectoCoreTest/Integration/Truck40tPowerTrain.cs +++ b/VectoCore/VectoCoreTest/Integration/Truck40tPowerTrain.cs @@ -34,6 +34,7 @@ using System.Collections.Generic; using System.Linq; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.InputData.Reader; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.Impl; @@ -128,7 +129,7 @@ namespace TUGraz.VectoCore.Tests.Integration LossMap = TransmissionLossMap.ReadFromFile(ratio != 1.0 ? GearboxIndirectLoss : GearboxDirectLoss, ratio, string.Format("Gear {0}", i)), Ratio = ratio, - ShiftPolygon = ShiftPolygon.ReadFromFile(ShiftPolygonFile) + ShiftPolygon = ShiftPolygonReader.ReadFromFile(ShiftPolygonFile) })) .ToDictionary(k => k.Item1 + 1, v => v.Item2), ShiftTime = 2.SI<Second>(), @@ -199,7 +200,9 @@ namespace TUGraz.VectoCore.Tests.Integration AxleConfiguration = AxleConfiguration.AxleConfig_4x2, //AerodynamicDragAera = 6.2985.SI<SquareMeter>(), //CrossWindCorrectionMode = CrossWindCorrectionMode.NoCorrection, - CrossWindCorrectionCurve = new CrosswindCorrectionCdxALookup(CrossWindCorrectionCurveReader.GetNoCorrectionCurve(6.2985.SI<SquareMeter>()),CrossWindCorrectionMode.NoCorrection), + CrossWindCorrectionCurve = + new CrosswindCorrectionCdxALookup(CrossWindCorrectionCurveReader.GetNoCorrectionCurve(6.2985.SI<SquareMeter>()), + CrossWindCorrectionMode.NoCorrection), CurbWeight = 7100.SI<Kilogram>(), CurbWeigthExtra = massExtra, Loading = loading, diff --git a/VectoCore/VectoCoreTest/Models/Simulation/LossMapRangeValidationTest.cs b/VectoCore/VectoCoreTest/Models/Simulation/LossMapRangeValidationTest.cs index 547e30c56a50d33511c814ab0ff89b9d86e8fd00..a330749febaf60c91115a23c38dc67e97344ec7f 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/LossMapRangeValidationTest.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/LossMapRangeValidationTest.cs @@ -33,6 +33,7 @@ using System; using System.ComponentModel.DataAnnotations; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; +using TUGraz.VectoCore.InputData.Reader; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; @@ -140,7 +141,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation LossMap = TransmissionLossMap.ReadFromFile(ratio != 1.0 ? directlossMap : indirectLossMap, ratio, string.Format("Gear {0}", i)), Ratio = ratio, - ShiftPolygon = ShiftPolygon.ReadFromFile(ShiftPolygonFile) + ShiftPolygon = ShiftPolygonReader.ReadFromFile(ShiftPolygonFile) })) .ToDictionary(k => k.Item1 + 1, v => v.Item2) }; diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxTest.cs index 9846166b92322edaa281ac81afa89c317807eece..a83fce3b300050ea0635e8e389102486b179e586 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxTest.cs @@ -34,6 +34,7 @@ using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.InputData.Reader; using TUGraz.VectoCore.Models.Connector.Ports.Impl; using TUGraz.VectoCore.Models.Simulation.Impl; using TUGraz.VectoCore.Models.SimulationComponent.Data; @@ -76,7 +77,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent LossMap = TransmissionLossMap.ReadFromFile(i != 6 ? IndirectLossMap : DirectLossMap, ratio, string.Format("Gear {0}", i)), Ratio = ratio, - ShiftPolygon = ShiftPolygon.ReadFromFile(GearboxShiftPolygonFile) + ShiftPolygon = ShiftPolygonReader.ReadFromFile(GearboxShiftPolygonFile) })) .ToDictionary(k => k.Item1 + 1, v => v.Item2), ShiftTime = 2.SI<Second>(), diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponentData/ValidationTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponentData/ValidationTest.cs index 8f0107f17a5d88978f5d5e86b9c0cea0e72d69b5..4f1cb111be209c5735cb548e814270015dc06cee 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponentData/ValidationTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponentData/ValidationTest.cs @@ -35,6 +35,7 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.InputData.Reader; using TUGraz.VectoCore.InputData.Reader.DataObjectAdaper; using TUGraz.VectoCore.InputData.Reader.Impl; using TUGraz.VectoCore.Models.Simulation.Data; @@ -233,7 +234,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData }; var shiftPolygon = - ShiftPolygon.Create( + ShiftPolygonReader.Create( VectoCSVFile.ReadStream( InputDataHelper.InputDataAsStream("engine torque,downshift rpm [rpm],upshift rpm [rpm] ", vgbs))); @@ -241,7 +242,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData Assert.IsFalse(results.Any()); shiftPolygon = - ShiftPolygon.Create( + ShiftPolygonReader.Create( VectoCSVFile.ReadStream( InputDataHelper.InputDataAsStream("engine torque,upshift rpm [rpm], downshift rpm [rpm] ", vgbs))); diff --git a/VectoCore/VectoCoreTest/Utils/ShiftPolygonDrawer.cs b/VectoCore/VectoCoreTest/Utils/ShiftPolygonDrawer.cs index 8b16d06df1468e1624403377522d444d1bff9065..90cf13e8015ed49d0cd4810f216559af845dc62d 100644 --- a/VectoCore/VectoCoreTest/Utils/ShiftPolygonDrawer.cs +++ b/VectoCore/VectoCoreTest/Utils/ShiftPolygonDrawer.cs @@ -281,80 +281,70 @@ namespace TUGraz.VectoCore.Tests.Utils private static void AddLegend(Chart chart) { - var legend = new Legend() - { + var legend = new Legend() { Docking = Docking.Bottom, Alignment = StringAlignment.Center, IsDockedInsideChartArea = false, Font = LegendFont, //Title = "Legend", }; - legend.CustomItems.Add(new LegendItem() - { + legend.CustomItems.Add(new LegendItem() { Color = Color.DarkBlue, Name = "Engine Full Load Curve", MarkerStyle = MarkerStyle.None, ImageStyle = LegendImageStyle.Line, BorderWidth = 3, }); - legend.CustomItems.Add(new LegendItem() - { + legend.CustomItems.Add(new LegendItem() { Color = Color.DarkRed, Name = "Upshift / Downshift", MarkerStyle = MarkerStyle.None, ImageStyle = LegendImageStyle.Line, BorderWidth = 3, }); - legend.CustomItems.Add(new LegendItem() - { + legend.CustomItems.Add(new LegendItem() { Color = Color.DeepSkyBlue, Name = "n_pref", MarkerStyle = MarkerStyle.None, ImageStyle = LegendImageStyle.Line, BorderWidth = 3, }); - legend.CustomItems.Add(new LegendItem() - { + legend.CustomItems.Add(new LegendItem() { Color = Color.Coral, Name = "n_Pmax", MarkerStyle = MarkerStyle.None, ImageStyle = LegendImageStyle.Line, BorderWidth = 3, }); - legend.CustomItems.Add(new LegendItem() - { + legend.CustomItems.Add(new LegendItem() { Color = Color.Red, Name = "n_95h", MarkerStyle = MarkerStyle.None, ImageStyle = LegendImageStyle.Line, BorderWidth = 3, }); - legend.CustomItems.Add(new LegendItem() - { + legend.CustomItems.Add(new LegendItem() { Color = Color.LimeGreen, Name = "n_85km/h", MarkerStyle = MarkerStyle.None, ImageStyle = LegendImageStyle.Line, BorderWidth = 3, }); - legend.CustomItems.Add(new LegendItem() - { + legend.CustomItems.Add(new LegendItem() { Color = Color.BlueViolet, Name = "Downshift next gear", MarkerStyle = MarkerStyle.None, ImageStyle = LegendImageStyle.Line, BorderWidth = 3, }); - legend.CustomItems.Add(new LegendItem() - { + legend.CustomItems.Add(new LegendItem() { Color = Color.Gray, Name = "Upshift orig.", MarkerStyle = MarkerStyle.None, ImageStyle = LegendImageStyle.Line, BorderWidth = 3, }); - legend.CustomItems.Add(new LegendItem() - { + legend.CustomItems.Add(new LegendItem() { Color = Color.DarkGoldenrod, Name = "P", MarkerStyle = MarkerStyle.None,