From 2efb691f6ae87eb58a5d26056d0d4133fee922d0 Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Tue, 9 May 2017 16:56:38 +0200 Subject: [PATCH] reading and writing of torque limits (vehicle) implemented --- VECTO/GUI/VehicleForm.vb | 95 +++++++++++++------ VECTO/GUI/VehicleTorqueLimitsDialog.vb | 12 +++ VECTO/Input Files/VectoJob.vb | 7 -- VECTO/Input Files/Vehicle.vb | 31 +++--- VECTO/OutputData/JSONFileWriter.vb | 6 ++ .../InputData/DeclarationInputData.cs | 11 ++- .../InputData/FileIO/JSON/JSONInputData.cs | 13 --- .../InputData/FileIO/JSON/JSONVehicleData.cs | 17 ++++ .../XMLDeclarationVehicleDataProvider.cs | 16 ++++ .../XMLEngineeringVehicleDataProvider.cs | 16 ++++ .../VectoCore/InputData/Impl/InputData.cs | 6 ++ .../DeclarationDataAdapter.cs | 7 -- .../Models/Declaration/DeclarationData.cs | 12 +-- .../VectoCore/Resources/XMLNames.Designer.cs | 27 ++++++ VectoCore/VectoCore/Resources/XMLNames.resx | 9 ++ .../VectoCoreTest/Integration/ATPowerTrain.cs | 3 - 16 files changed, 206 insertions(+), 82 deletions(-) diff --git a/VECTO/GUI/VehicleForm.vb b/VECTO/GUI/VehicleForm.vb index 5de38f5bc3..dce33f4738 100644 --- a/VECTO/GUI/VehicleForm.vb +++ b/VECTO/GUI/VehicleForm.vb @@ -17,6 +17,7 @@ Imports TUGraz.VectoCommon.InputData Imports TUGraz.VectoCommon.Models Imports TUGraz.VectoCommon.Utils Imports TUGraz.VectoCore.InputData.FileIO.JSON +Imports TUGraz.VectoCore.InputData.Impl Imports TUGraz.VectoCore.Models.Declaration ''' <summary> @@ -33,6 +34,11 @@ Public Class VehicleForm Inertia = 6 End Enum + Private Enum TorqueLimitsTbl + Gear = 0 + MaxTorque = 1 + End Enum + Private _axlDlog As VehicleAxleDialog Private _hdVclass As String Private _vehFile As String @@ -63,31 +69,31 @@ Public Class VehicleForm CbCdMode.ValueMember = "Value" CbCdMode.DisplayMember = "Label" CbCdMode.DataSource = [Enum].GetValues(GetType(CrossWindCorrectionMode)) _ - .Cast (Of CrossWindCorrectionMode) _ + .Cast(Of CrossWindCorrectionMode) _ .Select(Function(mode) New With {Key .Value = mode, .Label = mode.GetLabel()}).ToList() CbRtType.ValueMember = "Value" CbRtType.DisplayMember = "Label" CbRtType.DataSource = [Enum].GetValues(GetType(RetarderType)) _ - .Cast (Of RetarderType) _ + .Cast(Of RetarderType) _ .Select(Function(type) New With {Key .Value = type, .Label = type.GetLabel()}).ToList() CbAxleConfig.ValueMember = "Value" CbAxleConfig.DisplayMember = "Label" CbAxleConfig.DataSource = [Enum].GetValues(GetType(AxleConfiguration)) _ - .Cast (Of AxleConfiguration) _ + .Cast(Of AxleConfiguration) _ .Select(Function(category) New With {Key .Value = category, .Label = category.GetName()}).ToList() CbCat.ValueMember = "Value" CbCat.DisplayMember = "Label" CbCat.DataSource = [Enum].GetValues(GetType(VehicleCategory)) _ - .Cast (Of VehicleCategory) _ + .Cast(Of VehicleCategory) _ .Select(Function(category) New With {Key .Value = category, .label = category.GetLabel()}).ToList() cbAngledriveType.ValueMember = "Value" cbAngledriveType.DisplayMember = "Label" cbAngledriveType.DataSource = [Enum].GetValues(GetType(AngledriveType)) _ - .Cast (Of AngledriveType).Select(Function(type) New With {Key .Value = type, .Label = type.GetLabel()}).ToList() + .Cast(Of AngledriveType).Select(Function(type) New With {Key .Value = type, .Label = type.GetLabel()}).ToList() _axlDlog = New VehicleAxleDialog _torqueLimitDlog = New VehicleTorqueLimitDialog() @@ -110,12 +116,12 @@ Public Class VehicleForm End If Dim vehC As VehicleCategory = CType(CbCat.SelectedValue, VehicleCategory) Dim axlC As AxleConfiguration = CType(CbAxleConfig.SelectedValue, AxleConfiguration) - Dim maxMass As Kilogram = (TbMassMass.Text.ToDouble()*1000).SI (Of Kilogram)() + Dim maxMass As Kilogram = (TbMassMass.Text.ToDouble() * 1000).SI(Of Kilogram)() _hdVclass = "-" Dim s0 As Segment = Nothing Try - s0 = DeclarationData.Segments.Lookup(vehC, axlC, maxMass, 0.SI (Of Kilogram), True) + s0 = DeclarationData.Segments.Lookup(vehC, axlC, maxMass, 0.SI(Of Kilogram), True) Catch ' no segment found - ignore @@ -126,7 +132,7 @@ Public Class VehicleForm TbHDVclass.Text = _hdVclass - PicVehicle.Image = ConvPicPath(If(s0 Is Nothing, - 1, _hdVclass.ToInt()), False) + PicVehicle.Image = ConvPicPath(If(s0 Is Nothing, -1, _hdVclass.ToInt()), False) End Sub @@ -140,11 +146,11 @@ Public Class VehicleForm End If Dim vehC As VehicleCategory = CType(CbCat.SelectedValue, VehicleCategory) Dim axlC As AxleConfiguration = CType(CbAxleConfig.SelectedValue, AxleConfiguration) - Dim maxMass As Kilogram = (TbMassMass.Text.ToDouble()*1000).SI (Of Kilogram)() + Dim maxMass As Kilogram = (TbMassMass.Text.ToDouble() * 1000).SI(Of Kilogram)() Dim s0 As Segment = Nothing Try - s0 = DeclarationData.Segments.Lookup(vehC, axlC, maxMass, 0.SI (Of Kilogram), True) + s0 = DeclarationData.Segments.Lookup(vehC, axlC, maxMass, 0.SI(Of Kilogram), True) Catch ' no segment found - ignore End Try @@ -179,7 +185,7 @@ Public Class VehicleForm TbCdFile.Text = "" Dim rdyn As Double - rdyn = - 1 + rdyn = -1 If rdyn < 0 Then TBrdyn.Text = "-" @@ -324,7 +330,7 @@ Public Class VehicleForm If ChangeCheckCancel() Then Exit Sub - Dim inputData As IEngineeringInputDataProvider = TryCast(JSONInputDataFactory.ReadComponentData(file), + Dim inputData As IEngineeringInputDataProvider = TryCast(JSONInputDataFactory.ReadComponentData(file), IEngineeringInputDataProvider) Dim vehicle As IVehicleEngineeringInputData = inputData.VehicleInputData Dim airdrag As IAirdragEngineeringInputData = inputData.AirdragInputData @@ -338,7 +344,7 @@ Public Class VehicleForm Close() MainForm.RbDecl.Checked = Not MainForm.RbDecl.Checked MainForm.OpenVectoFile(file) - Case - 1 + Case -1 Exit Sub End Select End If @@ -347,12 +353,12 @@ Public Class VehicleForm Dim basePath As String = Path.GetDirectoryName(file) CbCat.SelectedValue = vehicle.VehicleCategory CbAxleConfig.SelectedValue = vehicle.AxleConfiguration - TbMassMass.Text = (vehicle.GrossVehicleMassRating.Value()/1000).ToGUIFormat() + TbMassMass.Text = (vehicle.GrossVehicleMassRating.Value() / 1000).ToGUIFormat() TbMass.Text = vehicle.CurbMassChassis.ToGUIFormat() TbMassExtra.Text = vehicle.CurbMassExtra.ToGUIFormat() TbLoad.Text = vehicle.Loading.ToGUIFormat() - TBrdyn.Text = (vehicle.DynamicTyreRadius.Value()*1000).ToGUIFormat() + TBrdyn.Text = (vehicle.DynamicTyreRadius.Value() * 1000).ToGUIFormat() CbCdMode.SelectedValue = airdrag.CrossWindCorrectionMode TbCdFile.Text = @@ -367,8 +373,6 @@ Public Class VehicleForm Dim a0 As IAxleEngineeringInputData For Each a0 In vehicle.Axles i += 1 - - If Cfg.DeclMode Then Dim inertia As Double = DeclarationData.Wheels.Lookup(a0.Wheels).Inertia.Value() LvRRC.Items.Add(CreateListViewItem(i, Double.NaN, a0.TwinTyres, a0.RollResistanceCoefficient, @@ -378,9 +382,12 @@ Public Class VehicleForm a0.TyreTestLoad.Value(), a0.Wheels, a0.Inertia.Value())) End If - Next + lvTorqueLimits.Items.Clear() + For Each entry As ITorqueLimitInputData In vehicle.TorqueLimits + lvTorqueLimits.Items.Add(CreateMaxTorqueListViewItem(entry.Gear(), entry.MaxTorque.Value())) + Next 'TbMassExtra.Text = veh.MassExtra.ToGUIFormat() @@ -454,13 +461,13 @@ Public Class VehicleForm veh.VehicleCategory = CType(CbCat.SelectedValue, VehicleCategory) 'CType(CbCat.SelectedIndex, tVehCat) For Each entry As ListViewItem In LvRRC.Items - Dim a0 As Vehicle.Axle = New Vehicle.Axle - a0.Share = entry.SubItems(AxleTbl.RelativeLoad).Text.ToDouble(0) - a0.TwinTire = (entry.SubItems(AxleTbl.TwinTyres).Text = "yes") - a0.RRC = entry.SubItems(AxleTbl.RRC).Text.ToDouble(0) - a0.FzISO = entry.SubItems(AxleTbl.FzISO).Text.ToDouble(0) + Dim a0 As AxleInputData = New AxleInputData() + a0.AxleWeightShare = entry.SubItems(AxleTbl.RelativeLoad).Text.ToDouble(0) + a0.TwinTyres = (entry.SubItems(AxleTbl.TwinTyres).Text = "yes") + a0.RollResistanceCoefficient = entry.SubItems(AxleTbl.RRC).Text.ToDouble(0) + a0.TyreTestLoad = entry.SubItems(AxleTbl.FzISO).Text.ToDouble(0).SI(Of Newton)() a0.Wheels = entry.SubItems(AxleTbl.WheelsDimension).Text - a0.Inertia = entry.SubItems(AxleTbl.Inertia).Text.ToDouble(0) + a0.Inertia = entry.SubItems(AxleTbl.Inertia).Text.ToDouble(0).SI(Of KilogramSquareMeter)() veh.Axles.Add(a0) Next @@ -472,6 +479,13 @@ Public Class VehicleForm veh.MassExtra = TbMassExtra.Text.ToDouble(0) veh.AxleConfiguration = CType(CbAxleConfig.SelectedValue, AxleConfiguration) + For Each item As ListViewItem In lvTorqueLimits.Items + Dim tl As TorqueLimitInputData = New TorqueLimitInputData() + tl.Gear() = item.SubItems(TorqueLimitsTbl.Gear).Text.ToInt(0) + tl.MaxTorque = item.SubItems(TorqueLimitsTbl.MaxTorque).Text.ToDouble(0).SI(Of NewtonMeter)() + veh.torqueLimitsList.Add(tl) + Next + '--------------------------------------------------------------------------------- If Not veh.SaveFile Then @@ -653,7 +667,7 @@ Public Class VehicleForm Private Sub SetMaxLoad() If Not Cfg.DeclMode Then If IsNumeric(TbMass.Text) And IsNumeric(TbMassExtra.Text) And IsNumeric(TbMassMass.Text) Then - TbLoadingMax.Text = CStr(CSng(TbMassMass.Text)*1000 - CSng(TbMass.Text) - CSng(TbMassExtra.Text)) + TbLoadingMax.Text = CStr(CSng(TbMassMass.Text) * 1000 - CSng(TbMass.Text) - CSng(TbMassExtra.Text)) Else TbLoadingMax.Text = "" End If @@ -834,8 +848,17 @@ Public Class VehicleForm Private Sub btAddMaxTorqueEntry_Click(sender As Object, e As EventArgs) Handles btAddMaxTorqueEntry.Click _torqueLimitDlog.Clear() If _torqueLimitDlog.ShowDialog() = DialogResult.OK Then - lvTorqueLimits.Items.Add(CreateMaxTorqueListViewItem(_torqueLimitDlog.tbGear.Text.ToInt(0), - _torqueLimitDlog.tbMaxTorque.Text.ToDouble(0))) + Dim gear As Integer = _torqueLimitDlog.tbGear.Text.ToInt(0) + For Each entry As ListViewItem In lvTorqueLimits.Items + If entry.SubItems(TorqueLimitsTbl.Gear).Text.ToInt() = gear Then + entry.SubItems(TorqueLimitsTbl.MaxTorque).Text = _torqueLimitDlog.tbMaxTorque.Text.ToDouble(0).ToGUIFormat + Change() + Return + End If + Next + + lvTorqueLimits.Items.Add(CreateMaxTorqueListViewItem(gear, _torqueLimitDlog.tbMaxTorque.Text.ToDouble(0))) + Change() End If @@ -865,5 +888,23 @@ Public Class VehicleForm Change() End Sub + + Private Sub lvTorqueLimits_DoubleClick(sender As Object, e As EventArgs) Handles lvTorqueLimits.DoubleClick + EditMaxTorqueEntry() + End Sub + + Private Sub EditMaxTorqueEntry() + If lvTorqueLimits.SelectedItems.Count = 0 Then Exit Sub + + Dim entry As ListViewItem = lvTorqueLimits.SelectedItems(0) + _torqueLimitDlog.tbGear.Text = entry.SubItems(TorqueLimitsTbl.Gear).Text + _torqueLimitDlog.tbGear.ReadOnly = True + _torqueLimitDlog.tbMaxTorque.Text = entry.SubItems(TorqueLimitsTbl.MaxTorque).Text + _torqueLimitDlog.tbMaxTorque.Focus() + If (_torqueLimitDlog.ShowDialog() = DialogResult.OK) Then + entry.SubItems(TorqueLimitsTbl.MaxTorque).Text = _torqueLimitDlog.tbMaxTorque.Text + End If + _torqueLimitDlog.tbGear.ReadOnly = False + End Sub End Class diff --git a/VECTO/GUI/VehicleTorqueLimitsDialog.vb b/VECTO/GUI/VehicleTorqueLimitsDialog.vb index 44558819d2..c2f8822062 100644 --- a/VECTO/GUI/VehicleTorqueLimitsDialog.vb +++ b/VECTO/GUI/VehicleTorqueLimitsDialog.vb @@ -27,6 +27,7 @@ Public Class VehicleTorqueLimitDialog tbGear.Text = "" tbMaxTorque.Text = "" + tbGear.Focus() End Sub 'Initialise @@ -36,6 +37,17 @@ Public Class VehicleTorqueLimitDialog 'Save and close Private Sub OK_Button_Click(sender As Object, e As EventArgs) Handles OK_Button.Click + If Not IsNumeric(tbGear.Text) Then + MsgBox("Invalid input for Gear") + tbGear.Focus() + Return + End If + If Not IsNumeric(tbMaxTorque.Text) Then + MsgBox("Invalid max. torque") + tbMaxTorque.Focus() + Return + End If + DialogResult = DialogResult.OK Close() End Sub diff --git a/VECTO/Input Files/VectoJob.vb b/VECTO/Input Files/VectoJob.vb index 34cd7d75d4..7515a9d9c0 100644 --- a/VECTO/Input Files/VectoJob.vb +++ b/VECTO/Input Files/VectoJob.vb @@ -593,13 +593,6 @@ Public Class VectoJob End Property - Public ReadOnly Property IDriverDeclarationInputData_StartStop As IStartStopDeclarationInputData _ - Implements IDriverDeclarationInputData.StartStop - Get - Return IDriverEngineeringInputData_StartStop - End Get - End Property - Public ReadOnly Property IEngineeringJobInputData_Vehicle As IVehicleEngineeringInputData _ Implements IEngineeringJobInputData.Vehicle Get diff --git a/VECTO/Input Files/Vehicle.vb b/VECTO/Input Files/Vehicle.vb index 6fc311dcb5..01b05bcd15 100644 --- a/VECTO/Input Files/Vehicle.vb +++ b/VECTO/Input Files/Vehicle.vb @@ -45,7 +45,7 @@ Public Class Vehicle Public ReadOnly RetarderLossMapFile As SubPath Public DynamicTyreRadius As Double - Public ReadOnly Axles As List(Of Axle) + Public ReadOnly Axles As List(Of AxleInputData) Public VehicleCategory As VehicleCategory @@ -61,6 +61,7 @@ Public Class Vehicle Public PtoType As String Public ReadOnly PtoLossMap As SubPath Public ReadOnly PtoCycle As SubPath + Public torqueLimitsList As List(Of ITorqueLimitInputData) Public Class Axle Public RRC As Double @@ -80,7 +81,8 @@ Public Class Vehicle RetarderLossMapFile = New SubPath AngledriveLossMapFile = New SubPath() - Axles = New List(Of Axle) + Axles = New List(Of AxleInputData) + torqueLimitsList = new List(Of ITorqueLimitInputData) PtoLossMap = New SubPath() PtoCycle = New SubPath() SetDefault() @@ -96,7 +98,7 @@ Public Class Vehicle Dim angledriveData As AngledriveData Dim modeService As VectoValidationModeServiceContainer = - TryCast(validationContext.GetService(GetType(VectoValidationModeServiceContainer)), + TryCast(validationContext.GetService(GetType(VectoValidationModeServiceContainer)), VectoValidationModeServiceContainer) Dim mode As ExecutionMode = If(modeService Is Nothing, ExecutionMode.Declaration, modeService.Mode) Dim emsCycle As Boolean = (modeService IsNot Nothing) AndAlso modeService.IsEMSCycle @@ -332,6 +334,13 @@ Public Class Vehicle End Get End Property + Public ReadOnly Property TorqueLimits As IList(Of ITorqueLimitInputData) _ + Implements IVehicleDeclarationInputData.TorqueLimits + Get + Return torqueLimitsList + End Get + End Property + Public ReadOnly Property AirDragArea As SquareMeter Implements IAirdragEngineeringInputData.AirDragArea Get Return CdA0.SI(Of SquareMeter)() @@ -341,29 +350,17 @@ Public Class Vehicle Public ReadOnly Property IVehicleEngineeringInputData_Axles As IList(Of IAxleEngineeringInputData) _ Implements IVehicleEngineeringInputData.Axles Get - Return AxleWheels().Cast(Of IAxleEngineeringInputData)().ToList() + Return Axles.Cast(Of IAxleEngineeringInputData)().ToList() End Get End Property Public ReadOnly Property IVehicleDeclarationInputData_Axles As IList(Of IAxleDeclarationInputData) _ Implements IVehicleDeclarationInputData.Axles Get - Return AxleWheels().Cast(Of IAxleDeclarationInputData)().ToList() + Return Axles.Cast(Of IAxleDeclarationInputData)().ToList() End Get End Property - Private Function AxleWheels() As IEnumerable(Of AxleInputData) - Return Axles.Select(Function(axle) New AxleInputData With { - .SourceType = DataSourceType.JSONFile, - .Source = FilePath, - .Inertia = axle.Inertia.SI(Of KilogramSquareMeter)(), - .Wheels = axle.Wheels, - .AxleWeightShare = axle.Share, - .TwinTyres = axle.TwinTire, - .RollResistanceCoefficient = axle.RRC, - .TyreTestLoad = axle.FzISO.SI(Of Newton)() - }) - End Function Public ReadOnly Property CurbMassExtra As Kilogram Implements IVehicleEngineeringInputData.CurbMassExtra Get diff --git a/VECTO/OutputData/JSONFileWriter.vb b/VECTO/OutputData/JSONFileWriter.vb index c2c10de71f..b1e38fe83a 100644 --- a/VECTO/OutputData/JSONFileWriter.vb +++ b/VECTO/OutputData/JSONFileWriter.vb @@ -187,6 +187,11 @@ Public Class JSONFileWriter (angledrive.Type = AngledriveType.SeparateAngledrive AndAlso Not angledrive.LossMap Is Nothing, GetRelativePath(angledrive.LossMap.Source, basePath), "")}} + Dim torqueLimits As Dictionary(Of String, String) = New Dictionary(Of String, String) + For Each entry As ITorqueLimitInputData In vehicle.TorqueLimits + torqueLimits.Add(entry.Gear().ToString(), entry.MaxTorque.Value().ToString()) + Next + Dim body As Dictionary(Of String, Object) = New Dictionary(Of String, Object) From { {"SavedInDeclMode", Cfg.DeclMode}, {"VehCat", vehicle.VehicleCategory.ToString()}, @@ -206,6 +211,7 @@ Public Class JSONFileWriter {"Retarder", retarderOut}, {"Angledrive", angledriveOut}, {"PTO", ptoOut}, + {"TorqueLimits", torqueLimits}, {"AxleConfig", New Dictionary(Of String, Object) From { {"Type", vehicle.AxleConfiguration.GetName()}, {"Axles", From axle In vehicle.Axles Select New Dictionary(Of String, Object) From { diff --git a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs index 9ff6c1234f..68a4ee4d96 100644 --- a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs +++ b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs @@ -101,6 +101,8 @@ namespace TUGraz.VectoCommon.InputData ///// </summary> //string Rim { get; } // deprecated + IList<ITorqueLimitInputData> TorqueLimits { get; } + /// <summary> /// parameters for every axle /// P044, P045, P046, P047, P048, P108 @@ -364,8 +366,6 @@ namespace TUGraz.VectoCommon.InputData { bool SavedInDeclarationMode { get; } - //IStartStopDeclarationInputData StartStop { get; } - IOverSpeedEcoRollDeclarationInputData OverSpeedEcoRoll { get; } } @@ -392,4 +392,11 @@ namespace TUGraz.VectoCommon.InputData /// </summary> IList<string> Technology { get; } } + + public interface ITorqueLimitInputData + { + int Gear { get; } + + NewtonMeter MaxTorque { get; } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs index 9b7e2118c9..b56eb792ed 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs @@ -415,19 +415,6 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON #region DriverInputData - public virtual IStartStopEngineeringInputData StartStop - { - get { - var startStop = Body.GetEx(JsonKeys.DriverData_StartStop); - return new StartStopInputData { - Enabled = startStop.GetEx<bool>(JsonKeys.DriverData_StartStop_Enabled), - Delay = startStop.GetEx<double>(JsonKeys.DriverData_StartStop_Delay).SI<Second>(), - MaxSpeed = startStop.GetEx<double>(JsonKeys.DriverData_StartStop_MaxSpeed).KMPHtoMeterPerSecond(), - MinTime = startStop.GetEx<double>(JsonKeys.DriverData_StartStop_MinTime).SI<Second>(), - }; - } - } - IOverSpeedEcoRollDeclarationInputData IDriverDeclarationInputData.OverSpeedEcoRoll { get { diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs index a235de9368..0ff7981068 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs @@ -72,6 +72,23 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON get { return Body.GetEx<double>(JsonKeys.Vehicle_GrossVehicleMassRating).SI().Ton.Cast<Kilogram>(); } } + public IList<ITorqueLimitInputData> TorqueLimits + { + get { + var retVal = new List<ITorqueLimitInputData>(); + if (Body["TorqueLimits"] == null) { + return retVal; + } + foreach (var entry in (JObject)Body["TorqueLimits"]) { + retVal.Add(new TorqueLimitInputData() { + Gear = entry.Key.ToInt(), + MaxTorque = entry.Value.ToString().ToDouble(0).SI<NewtonMeter>() + }); + } + return retVal; + } + } + public virtual Kilogram Loading { get { return Body.GetEx<double>(JsonKeys.Vehicle_Loading).SI<Kilogram>(); } diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationVehicleDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationVehicleDataProvider.cs index 08bfd2f41d..fc4273b987 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationVehicleDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationVehicleDataProvider.cs @@ -40,6 +40,22 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration get { return GetDoubleElementValue(XMLNames.Vehicle_GrossVehicleMass).SI<Kilogram>(); } } + public IList<ITorqueLimitInputData> TorqueLimits + { + get { + var retVal = new List<ITorqueLimitInputData>(); + var limits = Navigator.Select(Helper.Query(VehiclePath, XMLNames.Vehicle_TorqueLimits, "Entry")); + while (limits.MoveNext()) { + retVal.Add(new TorqueLimitInputData() { + Gear = limits.Current.GetAttribute(XMLNames.Vehicle_TorqueLimits_Entry_Gear_Attr, "").ToInt(), + MaxTorque = + limits.Current.GetAttribute(XMLNames.Vehicle_TorqueLimits_Entry_MaxTorque_Attr, "").ToDouble().SI<NewtonMeter>() + }); + } + return retVal; + } + } + public SquareMeter AirDragArea { diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringVehicleDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringVehicleDataProvider.cs index 545f51795c..6c4eebd7fb 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringVehicleDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringVehicleDataProvider.cs @@ -50,6 +50,22 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering get { return GetDoubleElementValue(XMLNames.Vehicle_GrossVehicleMass).SI<Kilogram>(); } } + public IList<ITorqueLimitInputData> TorqueLimits + { + get { + var retVal = new List<ITorqueLimitInputData>(); + var limits = Navigator.Select(Helper.Query(VehiclePath, XMLNames.Vehicle_TorqueLimits, "Entry")); + while (limits.MoveNext()) { + retVal.Add(new TorqueLimitInputData() { + Gear = limits.Current.GetAttribute(XMLNames.Vehicle_TorqueLimits_Entry_Gear_Attr, "").ToInt(), + MaxTorque = + limits.Current.GetAttribute(XMLNames.Vehicle_TorqueLimits_Entry_MaxTorque_Attr, "").ToDouble().SI<NewtonMeter>() + }); + } + return retVal; + } + } + public Kilogram Loading { get { return GetDoubleElementValue(XMLNames.Vehicle_Loading).SI<Kilogram>(); } diff --git a/VectoCore/VectoCore/InputData/Impl/InputData.cs b/VectoCore/VectoCore/InputData/Impl/InputData.cs index 3c1a581f2d..929d3f7e1e 100644 --- a/VectoCore/VectoCore/InputData/Impl/InputData.cs +++ b/VectoCore/VectoCore/InputData/Impl/InputData.cs @@ -157,4 +157,10 @@ namespace TUGraz.VectoCore.InputData.Impl public Watt ConstantPowerDemand { get; internal set; } } + + public class TorqueLimitInputData : ITorqueLimitInputData + { + public int Gear { get; internal set; } + public NewtonMeter MaxTorque { get; internal set; } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs index af8a4f9a80..62edaf670a 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs @@ -73,16 +73,9 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter "Specified Overspeed/EcoRoll Mode not allowed in declaration mode! {0}", overspeedData.Mode); } - var startstopData = new VectoRunData.StartStopData { - Enabled = data.StartStop.Enabled, - Delay = DeclarationData.Driver.StartStop.Delay, - MinTime = DeclarationData.Driver.StartStop.MinTime, - MaxSpeed = DeclarationData.Driver.StartStop.MaxSpeed - }; var retVal = new DriverData { LookAheadCoasting = lookAheadData, OverSpeedEcoRoll = overspeedData, - StartStop = startstopData }; return retVal; } diff --git a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs index 76fc148372..d48e4cce70 100644 --- a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs +++ b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs @@ -139,12 +139,12 @@ namespace TUGraz.VectoCore.Models.Declaration public static readonly MeterPerSecond UnderSpeed = 5.KMPHtoMeterPerSecond(); } - public static class StartStop - { - public static readonly MeterPerSecond MaxSpeed = 5.KMPHtoMeterPerSecond(); - public static readonly Second Delay = 5.SI<Second>(); - public static readonly Second MinTime = 5.SI<Second>(); - } + //public static class StartStop + //{ + // public static readonly MeterPerSecond MaxSpeed = 5.KMPHtoMeterPerSecond(); + // public static readonly Second Delay = 5.SI<Second>(); + // public static readonly Second MinTime = 5.SI<Second>(); + //} } public static class Trailer diff --git a/VectoCore/VectoCore/Resources/XMLNames.Designer.cs b/VectoCore/VectoCore/Resources/XMLNames.Designer.cs index 04faa1a128..1b93b10cdf 100644 --- a/VectoCore/VectoCore/Resources/XMLNames.Designer.cs +++ b/VectoCore/VectoCore/Resources/XMLNames.Designer.cs @@ -1950,6 +1950,33 @@ namespace TUGraz.VectoCore.Resources { } } + /// <summary> + /// Looks up a localized string similar to TorqueLimits. + /// </summary> + public static string Vehicle_TorqueLimits { + get { + return ResourceManager.GetString("Vehicle_TorqueLimits", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to gear. + /// </summary> + public static string Vehicle_TorqueLimits_Entry_Gear_Attr { + get { + return ResourceManager.GetString("Vehicle_TorqueLimits_Entry_Gear_Attr", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to maxTorque. + /// </summary> + public static string Vehicle_TorqueLimits_Entry_MaxTorque_Attr { + get { + return ResourceManager.GetString("Vehicle_TorqueLimits_Entry_MaxTorque_Attr", resourceCulture); + } + } + /// <summary> /// Looks up a localized string similar to VehicleCategory. /// </summary> diff --git a/VectoCore/VectoCore/Resources/XMLNames.resx b/VectoCore/VectoCore/Resources/XMLNames.resx index bbfeacc197..eeb9fdb5e0 100644 --- a/VectoCore/VectoCore/Resources/XMLNames.resx +++ b/VectoCore/VectoCore/Resources/XMLNames.resx @@ -752,5 +752,14 @@ </data> <data name="Component_ManufacturerAddress" xml:space="preserve"> <value>ManufacturerAddress</value> + </data> + <data name="Vehicle_TorqueLimits" xml:space="preserve"> + <value>TorqueLimits</value> + </data> + <data name="Vehicle_TorqueLimits_Entry_Gear_Attr" xml:space="preserve"> + <value>gear</value> + </data> + <data name="Vehicle_TorqueLimits_Entry_MaxTorque_Attr" xml:space="preserve"> + <value>maxTorque</value> </data> </root> \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Integration/ATPowerTrain.cs b/VectoCore/VectoCoreTest/Integration/ATPowerTrain.cs index ecfb707bd3..22c107008b 100644 --- a/VectoCore/VectoCoreTest/Integration/ATPowerTrain.cs +++ b/VectoCore/VectoCoreTest/Integration/ATPowerTrain.cs @@ -234,9 +234,6 @@ namespace TUGraz.VectoCore.Tests.Integration : new DriverData.OverSpeedEcoRollData { Mode = DriverMode.Off }, - StartStop = new VectoRunData.StartStopData { - Enabled = false - } }; } } -- GitLab