diff --git a/VECTO/GUI/VehicleForm.Designer.vb b/VECTO/GUI/VehicleForm.Designer.vb index 55dacc3f792b787179936d17d7959afa0294d563..a272f91ddaa529261c16197b2b738eb585020666 100644 --- a/VECTO/GUI/VehicleForm.Designer.vb +++ b/VECTO/GUI/VehicleForm.Designer.vb @@ -147,6 +147,13 @@ Partial Class VehicleForm Me.btAddMaxTorqueEntry = New System.Windows.Forms.Button() Me.cbLegislativeClass = New System.Windows.Forms.ComboBox() Me.Label21 = New System.Windows.Forms.Label() + Me.tpADAS = New System.Windows.Forms.TabPage() + Me.GroupBox5 = New System.Windows.Forms.GroupBox() + Me.lblPCC = New System.Windows.Forms.Label() + Me.cbEngineStopStart = New System.Windows.Forms.CheckBox() + Me.Label22 = New System.Windows.Forms.Label() + Me.cbEcoRoll = New System.Windows.Forms.ComboBox() + Me.cbPcc = New System.Windows.Forms.ComboBox() Me.GroupBox6.SuspendLayout Me.ToolStrip1.SuspendLayout Me.GroupBox7.SuspendLayout @@ -172,6 +179,8 @@ Partial Class VehicleForm Me.Panel1.SuspendLayout Me.TabPage2.SuspendLayout Me.TabPage3.SuspendLayout + Me.tpADAS.SuspendLayout + Me.GroupBox5.SuspendLayout Me.SuspendLayout ' 'Label1 @@ -1050,6 +1059,7 @@ Partial Class VehicleForm Me.TabControl1.Controls.Add(Me.TabPage1) Me.TabControl1.Controls.Add(Me.TabPage2) Me.TabControl1.Controls.Add(Me.TabPage3) + Me.TabControl1.Controls.Add(Me.tpADAS) Me.TabControl1.Location = New System.Drawing.Point(6, 173) Me.TabControl1.Name = "TabControl1" Me.TabControl1.SelectedIndex = 0 @@ -1216,6 +1226,75 @@ Partial Class VehicleForm Me.Label21.TabIndex = 42 Me.Label21.Text = "Maximum Laden Mass" ' + 'tpADAS + ' + Me.tpADAS.Controls.Add(Me.GroupBox5) + Me.tpADAS.Location = New System.Drawing.Point(4, 22) + Me.tpADAS.Name = "tpADAS" + Me.tpADAS.Padding = New System.Windows.Forms.Padding(3) + Me.tpADAS.Size = New System.Drawing.Size(579, 355) + Me.tpADAS.TabIndex = 3 + Me.tpADAS.Text = "ADAS" + Me.tpADAS.UseVisualStyleBackColor = true + ' + 'GroupBox5 + ' + Me.GroupBox5.Controls.Add(Me.cbPcc) + Me.GroupBox5.Controls.Add(Me.cbEcoRoll) + Me.GroupBox5.Controls.Add(Me.Label22) + Me.GroupBox5.Controls.Add(Me.cbEngineStopStart) + Me.GroupBox5.Controls.Add(Me.lblPCC) + Me.GroupBox5.Location = New System.Drawing.Point(6, 6) + Me.GroupBox5.Name = "GroupBox5" + Me.GroupBox5.Size = New System.Drawing.Size(565, 136) + Me.GroupBox5.TabIndex = 0 + Me.GroupBox5.TabStop = false + Me.GroupBox5.Text = "ADAS Options" + ' + 'lblPCC + ' + Me.lblPCC.AutoSize = true + Me.lblPCC.Location = New System.Drawing.Point(6, 88) + Me.lblPCC.Name = "lblPCC" + Me.lblPCC.Size = New System.Drawing.Size(122, 13) + Me.lblPCC.TabIndex = 3 + Me.lblPCC.Text = "Predictive Cruise Control" + ' + 'cbEngineStopStart + ' + Me.cbEngineStopStart.AutoSize = true + Me.cbEngineStopStart.Location = New System.Drawing.Point(6, 19) + Me.cbEngineStopStart.Name = "cbEngineStopStart" + Me.cbEngineStopStart.Size = New System.Drawing.Size(203, 17) + Me.cbEngineStopStart.TabIndex = 4 + Me.cbEngineStopStart.Text = "Engine Stop/Start during vehicle stop" + Me.cbEngineStopStart.UseVisualStyleBackColor = true + ' + 'Label22 + ' + Me.Label22.AutoSize = true + Me.Label22.Location = New System.Drawing.Point(6, 42) + Me.Label22.Name = "Label22" + Me.Label22.Size = New System.Drawing.Size(47, 13) + Me.Label22.TabIndex = 6 + Me.Label22.Text = "Eco-Roll" + ' + 'cbEcoRoll + ' + Me.cbEcoRoll.FormattingEnabled = true + Me.cbEcoRoll.Location = New System.Drawing.Point(18, 58) + Me.cbEcoRoll.Name = "cbEcoRoll" + Me.cbEcoRoll.Size = New System.Drawing.Size(179, 21) + Me.cbEcoRoll.TabIndex = 7 + ' + 'cbPcc + ' + Me.cbPcc.FormattingEnabled = true + Me.cbPcc.Location = New System.Drawing.Point(18, 104) + Me.cbPcc.Name = "cbPcc" + Me.cbPcc.Size = New System.Drawing.Size(179, 21) + Me.cbPcc.TabIndex = 8 + ' 'VehicleForm ' Me.AcceptButton = Me.ButOK @@ -1283,6 +1362,9 @@ Partial Class VehicleForm Me.TabPage2.ResumeLayout(false) Me.TabPage3.ResumeLayout(false) Me.TabPage3.PerformLayout + Me.tpADAS.ResumeLayout(false) + Me.GroupBox5.ResumeLayout(false) + Me.GroupBox5.PerformLayout Me.ResumeLayout(false) Me.PerformLayout @@ -1400,4 +1482,11 @@ End Sub Friend WithEvents Label11 As System.Windows.Forms.Label Friend WithEvents Label20 As System.Windows.Forms.Label Friend WithEvents Label21 As Label + Friend WithEvents tpADAS As TabPage + Friend WithEvents GroupBox5 As GroupBox + Friend WithEvents cbEngineStopStart As CheckBox + Friend WithEvents lblPCC As Label + Friend WithEvents Label22 As Label + Friend WithEvents cbPcc As ComboBox + Friend WithEvents cbEcoRoll As ComboBox End Class diff --git a/VECTO/GUI/VehicleForm.vb b/VECTO/GUI/VehicleForm.vb index 3e0ef9e67b02b403c71e1d62a8626b6a5e3fb035..e5f26c3e02176d07255e9101f55f867f0716e21a 100644 --- a/VECTO/GUI/VehicleForm.vb +++ b/VECTO/GUI/VehicleForm.vb @@ -91,13 +91,22 @@ Public Class VehicleForm .Select(Function(category) New With {Key .Value = category, .Label = category.GetName()}).ToList() End If - + cbEcoRoll.ValueMember = "Value" + cbEcoRoll.DisplayMember = "Label" + cbEcoRoll.DataSource = [Enum].GetValues(GetType(EcoRollType)).Cast(Of EcoRollType).Select(Function(ecoRoll) new With {Key .Value = ecoRoll, .Label = ecoRoll.GetName()}).ToList() + + + cbPcc.ValueMember = "Value" + cbPcc.DisplayMember = "Label" + cbPcc.DataSource = [Enum].GetValues(GetType(PredictiveCruiseControlType)).Cast(Of PredictiveCruiseControlType).Select(Function(pcc) new With {Key .Value = pcc, .Label = pcc.GetName()}).ToList() + + tpADAS.Enabled = Cfg.DeclMode CbCat.ValueMember = "Value" CbCat.DisplayMember = "Label" CbCat.DataSource = [Enum].GetValues(GetType(VehicleCategory)) _ .Cast(Of VehicleCategory) _ - .Select(Function(category) New With {Key .Value = category, .label = category.GetLabel()}).ToList() + .Select(Function(category) New With {Key .Value = category, .Label = category.GetLabel()}).ToList() cbAngledriveType.ValueMember = "Value" cbAngledriveType.DisplayMember = "Label" @@ -384,6 +393,17 @@ Public Class VehicleForm TbRtRatio.Text = retarder.Ratio.ToGUIFormat() TbRtPath.Text = If(retarder.LossMap Is Nothing, "", GetRelativePath(retarder.LossMap.Source, basePath)) + if (vehicle.SavedInDeclarationMode) then + Dim declVehicle as IVehicleDeclarationInputData = vehicle + cbPcc.SelectedValue = declVehicle.ADAS.PredictiveCruiseControl + cbEcoRoll.SelectedValue = declvehicle.ADAS.EcoRoll + cbEngineStopStart.Checked = declVehicle.ADAS.EngineStopStart + Else + cbPcc.SelectedValue = PredictiveCruiseControlType.None + cbEcoRoll.SelectedValue = EcoRollType.None + cbEngineStopStart.Checked = False + End If + LvRRC.Items.Clear() Dim i As Integer = 0 Dim a0 As IAxleEngineeringInputData @@ -510,6 +530,9 @@ Public Class VehicleForm veh.torqueLimitsList.Add(tl) Next + veh.EcoRollType = CType(cbEcoRoll.SelectedValue, EcoRollType) + veh.PCC = CType(cbPcc.SelectedValue, PredictiveCruiseControlType) + veh.EngineStop = cbEngineStopStart.Checked '--------------------------------------------------------------------------------- If Not veh.SaveFile Then diff --git a/VECTO/Input Files/Vehicle.vb b/VECTO/Input Files/Vehicle.vb index df9637d45c880633089fbc1341b3c5bf3da76c23..78fa5bedffda5e775c6aae9aff166769ae571412 100644 --- a/VECTO/Input Files/Vehicle.vb +++ b/VECTO/Input Files/Vehicle.vb @@ -68,6 +68,10 @@ Public Class Vehicle Public legClass As LegislativeClass Public VehicleHeight As Double + public EcoRolltype as EcoRollType + public PCC as PredictiveCruiseControlType + public EngineStop as Boolean + Public Sub New() _path = "" @@ -408,6 +412,10 @@ Public Class Vehicle End Property Public ReadOnly Property IVehicleEngineeringInputData_Components As IVehicleComponentsEngineering Implements IVehicleEngineeringInputData.Components + get + Return me + End Get + End Property Public ReadOnly Property CrosswindCorrectionMap As TableData _ Implements IAirdragEngineeringInputData.CrosswindCorrectionMap @@ -739,25 +747,20 @@ Public Class Vehicle Public ReadOnly Property EngineStopStart As Boolean Implements IAdvancedDriverAssistantSystemDeclarationInputData.EngineStopStart get - return DeclarationData.Vehicle.ADAS.EngineStopStartDefault - End Get - End Property - - Public ReadOnly Property EcoRollWitoutEngineStop As Boolean Implements IAdvancedDriverAssistantSystemDeclarationInputData.EcoRollWitoutEngineStop - get - return DeclarationData.Vehicle.ADAS.EcoRollWitoutEngineStop + return EngineStop End Get End Property - Public ReadOnly Property EcoRollWithEngineStop As Boolean Implements IAdvancedDriverAssistantSystemDeclarationInputData.EcoRollWithEngineStop + Public ReadOnly Property EcoRoll As EcoRollType Implements IAdvancedDriverAssistantSystemDeclarationInputData.EcoRoll get - Return DeclarationData.Vehicle.ADAS.EcoRollWithEngineStop + return EcoRolltype End Get End Property + Public ReadOnly Property PredictiveCruiseControl As PredictiveCruiseControlType Implements IAdvancedDriverAssistantSystemDeclarationInputData.PredictiveCruiseControl get - Return DeclarationData.Vehicle.ADAS.PredictiveCruiseControlDefault + Return PCC End Get End Property diff --git a/VECTO/OutputData/JSONFileWriter.vb b/VECTO/OutputData/JSONFileWriter.vb index 0212e6da074a7fe722ffd8e85c9f7e6545d8ee0e..a1a735399feafd43e953c8fe2184ceaf30426c10 100644 --- a/VECTO/OutputData/JSONFileWriter.vb +++ b/VECTO/OutputData/JSONFileWriter.vb @@ -16,7 +16,7 @@ Public Class JSONFileWriter Public Const GearboxFormatVersion As Integer = 6 - Public Const VehicleFormatVersion As Integer = 7 + Public Const VehicleFormatVersion As Integer = 8 Private Const VectoJobFormatVersion As Integer = 4 @@ -229,9 +229,16 @@ Public Class JSONFileWriter {"TwinTyres", axle.TwinTyres}, {"RRCISO", axle.Tyre.RollResistanceCoefficient}, {"FzISO", axle.Tyre.TyreTestLoad.Value()}, - {"Type", axle.AxleType.ToString()} + {"Type", axle.AxleType.ToString()} }}}}} + if (Cfg.DeclMode) then + Dim declVehicle As IVehicleDeclarationInputData = vehicle + body("EngineStopStart") = declVehicle.ADAS.EngineStopStart + body("EcoRoll") = declVehicle.ADAS.EcoRoll.ToString() + body("PredictiveCruiseControl") = declVehicle.ADAS.PredictiveCruiseControl.ToString() + End If + If (Not IsNothing(airdrag.AirDragArea)) Then body("CdA") = airdrag.AirDragArea.Value() End If diff --git a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs index ac9c2e42eca64c3aaad5a68de8accfa88cdd8b66..c32b74e64f87ebf3f0dda956950ecda317d2f756 100644 --- a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs +++ b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs @@ -33,6 +33,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Net.NetworkInformation; +using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; @@ -199,9 +200,7 @@ namespace TUGraz.VectoCommon.InputData { bool EngineStopStart { get; } - bool EcoRollWitoutEngineStop { get; } - - bool EcoRollWithEngineStop { get; } + EcoRollType EcoRoll { get; } PredictiveCruiseControlType PredictiveCruiseControl { get; } } @@ -231,8 +230,64 @@ namespace TUGraz.VectoCommon.InputData { return pcc.ToString().Replace(Prefix, "").Replace(SeparatorEnum, SeparatorXML); } + + public static string GetName(this PredictiveCruiseControlType pcc) + { + return pcc.ToString().Replace(Prefix, Prefix.Replace(SeparatorEnum, " ")).Replace(SeparatorEnum, "&"); + } + } + + public enum EcoRollType + { + None, + WithoutEngineStop, + WithEngineStop } + public static class EcorollTypeHelper + { + public static EcoRollType Get(bool ecoRollWithoutEngineStop, bool ecoRollWithEngineStop) + { + if (ecoRollWithEngineStop && ecoRollWithoutEngineStop) { + throw new VectoException("invalid combination or EcoRoll"); + } + + if (ecoRollWithoutEngineStop) { + return EcoRollType.WithoutEngineStop; + } + + if (ecoRollWithEngineStop) { + return EcoRollType.WithEngineStop; + } + + return EcoRollType.None; + } + + public static EcoRollType Parse(string ecoRoll) + { + return ecoRoll.ParseEnum<EcoRollType>(); + } + + public static bool WithoutEngineStop(this EcoRollType ecoRoll) + { + return ecoRoll == EcoRollType.WithoutEngineStop; + } + + public static bool WithEngineStop(this EcoRollType ecoRoll) + { + return ecoRoll == EcoRollType.WithEngineStop; + } + + public static string GetName(this EcoRollType ecoRoll) + { + switch (ecoRoll) { + case EcoRollType.None: return "None"; + case EcoRollType.WithoutEngineStop: return "without engine stop"; + case EcoRollType.WithEngineStop: return "with engine stop"; + default: throw new ArgumentOutOfRangeException(nameof(ecoRoll), ecoRoll, null); + } + } + } public enum TankSystem { diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs index e2e4e9563f4faecfecbd5d7fbc7b4bfd4d186a49..4da2a5e537f85dc1fc3ca0a9ed98d0b1fbc232e5 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs @@ -404,14 +404,9 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON get { return DeclarationData.Vehicle.ADAS.EngineStopStartDefault; } } - public bool EcoRollWitoutEngineStop + public EcoRollType EcoRoll { - get { return DeclarationData.Vehicle.ADAS.EcoRollWitoutEngineStop; } - } - - public bool EcoRollWithEngineStop - { - get { return DeclarationData.Vehicle.ADAS.EcoRollWithEngineStop; } + get { return DeclarationData.Vehicle.ADAS.EcoRoll; } } public PredictiveCruiseControlType PredictiveCruiseControl diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputDataFactory.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputDataFactory.cs index bd4e03f44da2d76b6bf150dd163e8d491752a28b..2c174f12e5eda71fbb22e96f96c65a904f04d381 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputDataFactory.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputDataFactory.cs @@ -71,9 +71,9 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON case 3: return new JSONInputDataV3(json, filename, tolerateMissing); case 4: - if (json["Body"]["DeclarationVehicle"] != null) { - return new JSONVTPInputDataV4(json, filename, tolerateMissing); - } + if (json["Body"]["DeclarationVehicle"] != null) { + return new JSONVTPInputDataV4(json, filename, tolerateMissing); + } return new JSONInputDataV4(json, filename, tolerateMissing); default: throw new VectoException("Job-File: Unsupported FileVersion. Got: {0} ", version); @@ -87,6 +87,8 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON switch (version) { case 7: return new JSONVehicleDataV7(json, filename, job,tolerateMissing); + case 8: + return new JSONVehicleDataV8(json, filename, job, tolerateMissing); default: throw new VectoException("Vehicle-File: Unsupported FileVersion. Got {0}", version); } diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs index 2275f00a4d0b2e162b96b0bdc544cf223f20b7d5..e2fa7641765825cee5130fe46a6f12bbab2c0456 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs @@ -44,6 +44,27 @@ using TUGraz.VectoCore.Models.Declaration; namespace TUGraz.VectoCore.InputData.FileIO.JSON { + + public class JSONVehicleDataV8 : JSONVehicleDataV7 + { + public JSONVehicleDataV8(JObject data, string fileName, IJSONVehicleComponents job, bool tolerateMissing = false) : base(data, fileName, job, tolerateMissing) { } + + #region Implementation of IAdvancedDriverAssistantSystemDeclarationInputData + + public override bool EngineStopStart { get { return Body.GetEx<bool>("EngineStopStart"); } } + public override EcoRollType EcoRoll { get { return EcorollTypeHelper.Parse(Body.GetEx<string>("EcoRoll")); } } + + public override PredictiveCruiseControlType PredictiveCruiseControl + { + get { + return Body.GetEx<string>("PredictiveCruiseControl").ParseEnum<PredictiveCruiseControlType>(); + } + } + + #endregion + } + + public class JSONVehicleDataV7 : JSONFile, IVehicleEngineeringInputData, IRetarderInputData, IAngledriveInputData, IPTOTransmissionInputData, IAirdragEngineeringInputData, IAdvancedDriverAssistantSystemDeclarationInputData, IVehicleComponentsDeclaration, IVehicleComponentsEngineering, IAxlesEngineeringInputData, IAxlesDeclarationInputData { @@ -57,16 +78,16 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON #region IVehicleInputData - public string Identifier { get { return Path.GetFileNameWithoutExtension(_sourceFile); } } + public virtual string Identifier { get { return Path.GetFileNameWithoutExtension(_sourceFile); } } - public bool ExemptedVehicle { get { return false; } } + public virtual bool ExemptedVehicle { get { return false; } } - public string VIN + public virtual string VIN { get { return Constants.NOT_AVailABLE; } } - public LegislativeClass LegislativeClass + public virtual LegislativeClass LegislativeClass { get { return Body["LegislativeClass"] != null @@ -75,7 +96,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON } } - public VehicleCategory VehicleCategory + public virtual VehicleCategory VehicleCategory { get { return @@ -98,7 +119,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON get { return Body.GetEx<double>(JsonKeys.Vehicle_GrossVehicleMassRating).SI(Unit.SI.Ton).Cast<Kilogram>(); } } - public IList<ITorqueLimitInputData> TorqueLimits + public virtual IList<ITorqueLimitInputData> TorqueLimits { get { var retVal = new List<ITorqueLimitInputData>(); @@ -125,7 +146,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON get { return Body.GetEx<double>(JsonKeys.Vehicle_DynamicTyreRadius).SI(Unit.SI.Milli.Meter).Cast<Meter>(); } } - public Meter Height + public virtual Meter Height { get { return Body["VehicleHeight"] == null ? null : Body.GetEx<double>("VehicleHeight").SI<Meter>(); } } @@ -154,12 +175,12 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON get { return AxleWheels().Cast<IAxleEngineeringInputData>().ToList(); } } - public string ManufacturerAddress + public virtual string ManufacturerAddress { get { return Constants.NOT_AVailABLE; } } - public PerSecond EngineIdleSpeed + public virtual PerSecond EngineIdleSpeed { get { return Body["IdlingSpeed"] != null ? Body.GetEx<double>("IdlingSpeed").RPMtoRad() : null; } } @@ -213,7 +234,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON get { return Job.Gearbox; } } - public ITorqueConverterDeclarationInputData TorqueConverter { get { return Job.TorqueConverter; } } + public virtual ITorqueConverterDeclarationInputData TorqueConverter { get { return Job.TorqueConverter; } } IGearboxEngineeringInputData IVehicleComponentsEngineering.GearboxInputData { @@ -240,7 +261,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON get { return this; } } - public IEngineEngineeringInputData EngineInputData + public virtual IEngineEngineeringInputData EngineInputData { get { return Job.Engine; } } @@ -285,22 +306,22 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON get { return this; } } - public bool VocationalVehicle { get { return DeclarationData.Vehicle.VocationalVehicleDefault; } } + public virtual bool VocationalVehicle { get { return DeclarationData.Vehicle.VocationalVehicleDefault; } } - public bool SleeperCab { get { return DeclarationData.Vehicle.SleeperCabDefault; } } + public virtual bool SleeperCab { get { return DeclarationData.Vehicle.SleeperCabDefault; } } - public TankSystem? TankSystem { get { return DeclarationData.Vehicle.TankSystemDefault; } } - public IAdvancedDriverAssistantSystemDeclarationInputData ADAS { get { return this; } } + public virtual TankSystem? TankSystem { get { return DeclarationData.Vehicle.TankSystemDefault; } } + public virtual IAdvancedDriverAssistantSystemDeclarationInputData ADAS { get { return this; } } - public bool ZeroEmissionVehicle { get { return DeclarationData.Vehicle.ZeroEmissionVehicleDefault; } } + public virtual bool ZeroEmissionVehicle { get { return DeclarationData.Vehicle.ZeroEmissionVehicleDefault; } } - public bool HybridElectricHDV { get { return DeclarationData.Vehicle.HybridElectricHDVDefault; } } + public virtual bool HybridElectricHDV { get { return DeclarationData.Vehicle.HybridElectricHDVDefault; } } - public bool DualFuelVehicle { get { return DeclarationData.Vehicle.DualFuelVehicleDefault; } } + public virtual bool DualFuelVehicle { get { return DeclarationData.Vehicle.DualFuelVehicleDefault; } } - public Watt MaxNetPower1 { get { return null; } } + public virtual Watt MaxNetPower1 { get { return null; } } - public Watt MaxNetPower2 { get { return null; } } + public virtual Watt MaxNetPower2 { get { return null; } } IVehicleComponentsDeclaration IVehicleDeclarationInputData.Components { @@ -491,7 +512,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON } } - public TableData PTOCycle + public virtual TableData PTOCycle { get { var pto = Body[JsonKeys.Vehicle_PTO]; @@ -515,17 +536,17 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON #endregion - public string Manufacturer + public virtual string Manufacturer { get { return Constants.NOT_AVailABLE; } } - public string Model + public virtual string Model { get { return Constants.NOT_AVailABLE; } } - public string Date + public virtual string Date { get { return Constants.NOT_AVailABLE; } } @@ -535,27 +556,28 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON get { return CertificationMethod.NotCertified; } } - public string CertificationNumber + public virtual string CertificationNumber { get { return Constants.NOT_AVailABLE; } } - public DigestData DigestValue + public virtual DigestData DigestValue { get { return null; } } #region Implementation of IAdvancedDriverAssistantSystemDeclarationInputData - public bool EngineStopStart { get { return DeclarationData.Vehicle.ADAS.EngineStopStartDefault; } } - public bool EcoRollWitoutEngineStop { get { return DeclarationData.Vehicle.ADAS.EcoRollWitoutEngineStop; } } - public bool EcoRollWithEngineStop { get { return DeclarationData.Vehicle.ADAS.EcoRollWithEngineStop; } } - public PredictiveCruiseControlType PredictiveCruiseControl { get { + public virtual bool EngineStopStart { get { return DeclarationData.Vehicle.ADAS.EngineStopStartDefault; } } + public virtual EcoRollType EcoRoll { get { return DeclarationData.Vehicle.ADAS.EcoRoll; } } + + public virtual PredictiveCruiseControlType PredictiveCruiseControl { get { return DeclarationData.Vehicle.ADAS.PredictiveCruiseControlDefault; } } #endregion - - + } + + } diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationADASDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationADASDataProvider.cs index e0fa06b48bd56f4a6d4d90695e471386b61cabfd..d3079bbbe9b8fe31255af8608c9237b7467a9c4f 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationADASDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationADASDataProvider.cs @@ -41,14 +41,13 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider get { return XmlConvert.ToBoolean(GetString(XMLNames.Vehicle_ADAS_EngineStopStart)); } } - public virtual bool EcoRollWitoutEngineStop + public virtual EcoRollType EcoRoll { - get { return XmlConvert.ToBoolean(GetString(XMLNames.Vehicle_ADAS_EcoRollWithoutEngineStop)); } - } - - public virtual bool EcoRollWithEngineStop - { - get { return XmlConvert.ToBoolean(GetString(XMLNames.Vehicle_ADAS_EcoRollWithEngineStopStart)); } + get { + return EcorollTypeHelper.Get( + XmlConvert.ToBoolean(GetString(XMLNames.Vehicle_ADAS_EcoRollWithoutEngineStop)), + XmlConvert.ToBoolean(GetString(XMLNames.Vehicle_ADAS_EcoRollWithEngineStopStart))); + } } public virtual PredictiveCruiseControlType PredictiveCruiseControl diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs index e1e7b469663f6b14f6b4fc271f3718f82d8470ce..6db977c721951a882b9e3bc74d7553f69f85a625 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs @@ -365,14 +365,9 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider get { return false; } } - public bool EcoRollWitoutEngineStop + public EcoRollType EcoRoll { - get { return false; } - } - - public bool EcoRollWithEngineStop - { - get { return false; } + get { return EcoRollType.None; } } public PredictiveCruiseControlType PredictiveCruiseControl diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs index 66a932a5ff1d9a8c9de7efcd39b061ce23a1260a..098b5d1e511a1c205ee0f9f451b71860c4147928 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs @@ -160,8 +160,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter { return new VehicleData.ADASData { EngineStopStart = adas.EngineStopStart, - EcoRollWithoutEngineStop = adas.EcoRollWitoutEngineStop, - EcoRollWithEngineStop = adas.EcoRollWithEngineStop, + EcoRoll = adas.EcoRoll, PredictiveCruiseControl = adas.PredictiveCruiseControl }; } diff --git a/VectoCore/VectoCore/Models/Declaration/ADASCombinations.cs b/VectoCore/VectoCore/Models/Declaration/ADASCombinations.cs index 6e4d47051083a968cfd807a9cb7878983eef96d6..f76826c7cde3426b14dcb39febd95a0db92bb44c 100644 --- a/VectoCore/VectoCore/Models/Declaration/ADASCombinations.cs +++ b/VectoCore/VectoCore/Models/Declaration/ADASCombinations.cs @@ -45,21 +45,21 @@ namespace TUGraz.VectoCore.Models.Declaration { public string ID; } - public sealed class ADASCombinations : LookupData<bool, bool, bool, PredictiveCruiseControlType, ADASCombination> + public sealed class ADASCombinations : LookupData<bool, EcoRollType, PredictiveCruiseControlType, ADASCombination> { private readonly List<Entry> _combinations = new List<Entry>(); #region Overrides of LookupData - public override ADASCombination Lookup(bool enginestopstart, bool ecorollwithoutenginestop, bool ecorollwithenginestop, PredictiveCruiseControlType pcc) + public override ADASCombination Lookup(bool enginestopstart, EcoRollType ecoRoll, PredictiveCruiseControlType pcc) { try { var entry = _combinations.First( - x => x.EngineStopStart == enginestopstart && x.EcoRollWithoutEngineStop == ecorollwithoutenginestop && - x.EcorollWithEngineStop == ecorollwithenginestop && x.PCCType == pcc); + x => x.EngineStopStart == enginestopstart && x.EcoRoll == ecoRoll && + x.PCCType == pcc); return new ADASCombination {ID = entry.ADASCombination}; } catch (Exception ) { - throw new VectoException(string.Format(ErrorMessage, enginestopstart, ecorollwithoutenginestop, ecorollwithenginestop, pcc)); + throw new VectoException(string.Format(ErrorMessage, enginestopstart, ecoRoll, pcc)); } } @@ -72,7 +72,7 @@ namespace TUGraz.VectoCore.Models.Declaration { get { return - "ADAS Combination Lookup Error: No entry found for engine stop/start: {0}, eco roll w/o engine stop: {1}, eco roll w engine stop: {2}, PCC: {3}"; + "ADAS Combination Lookup Error: No entry found for engine stop/start: {0}, eco roll: {1}, PCC: {2}"; } } @@ -81,8 +81,7 @@ namespace TUGraz.VectoCore.Models.Declaration foreach (DataRow row in table.Rows) { _combinations.Add(new Entry() { EngineStopStart = row.ParseBoolean("enginestopstart"), - EcoRollWithoutEngineStop = row.ParseBoolean("ecorollwithoutenginestop"), - EcorollWithEngineStop = row.ParseBoolean("ecorollwithenginestop"), + EcoRoll = EcorollTypeHelper.Get(row.ParseBoolean("ecorollwithoutenginestop"), row.ParseBoolean("ecorollwithenginestop")), PCCType = PredictiveCruiseControlTypeHelper.Parse(row.Field<string>("predictivecruisecontrol")), ADASCombination = row.Field<string>("adascombination") }); @@ -94,8 +93,7 @@ namespace TUGraz.VectoCore.Models.Declaration public struct Entry { public bool EngineStopStart; - public bool EcoRollWithoutEngineStop; - public bool EcorollWithEngineStop; + public EcoRollType EcoRoll; public PredictiveCruiseControlType PCCType; public string ADASCombination; @@ -104,13 +102,13 @@ namespace TUGraz.VectoCore.Models.Declaration public ADASCombination Lookup(IAdvancedDriverAssistantSystemDeclarationInputData adas) { return Lookup( - adas.EngineStopStart, adas.EcoRollWitoutEngineStop, adas.EcoRollWithEngineStop, adas.PredictiveCruiseControl); + adas.EngineStopStart, adas.EcoRoll, adas.PredictiveCruiseControl); } internal ADASCombination Lookup(VehicleData.ADASData adas) { return Lookup( - adas.EngineStopStart, adas.EcoRollWithoutEngineStop, adas.EcoRollWithEngineStop, adas.PredictiveCruiseControl); + adas.EngineStopStart, adas.EcoRoll, adas.PredictiveCruiseControl); } } } diff --git a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs index d6780113b21702921046a34ff32318c4523e2044..31010b77dc19219c5b8d7ce36a54d3b0d442940b 100644 --- a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs +++ b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs @@ -543,8 +543,7 @@ namespace TUGraz.VectoCore.Models.Declaration public static class ADAS { public const PredictiveCruiseControlType PredictiveCruiseControlDefault = PredictiveCruiseControlType.None; - public const bool EcoRollWithEngineStop = false; - public const bool EcoRollWitoutEngineStop = false; + public const EcoRollType EcoRoll = EcoRollType.None; public const bool EngineStopStartDefault = false; } } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/VehicleData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/VehicleData.cs index 4bdc942f181a239ed5327332cb84ea6e1d4873eb..65bcb06ab18aca87d9f66ddd7dab1ccefcfb83b0 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/VehicleData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/VehicleData.cs @@ -219,8 +219,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data public class ADASData { public bool EngineStopStart { get; internal set; } - public bool EcoRollWithoutEngineStop { get; internal set; } - public bool EcoRollWithEngineStop { get; internal set; } + public EcoRollType EcoRoll { get; internal set; } public PredictiveCruiseControlType PredictiveCruiseControl { get; internal set; } } diff --git a/VectoCore/VectoCore/OutputData/XML/XMLCustomerReport.cs b/VectoCore/VectoCore/OutputData/XML/XMLCustomerReport.cs index d3cc68d1c3783157c394e0e803b8b49ab2d37a29..b2b00935e63b03369da9ac2139a051fc2b2cf3b3 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLCustomerReport.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLCustomerReport.cs @@ -120,8 +120,8 @@ namespace TUGraz.VectoCore.OutputData.XML { return new XElement(tns + XMLNames.Vehicle_ADAS, new XElement(tns + XMLNames.Vehicle_ADAS_EngineStopStart, adasData.EngineStopStart), - new XElement(tns + XMLNames.Vehicle_ADAS_EcoRollWithoutEngineStop, adasData.EcoRollWithoutEngineStop), - new XElement(tns + XMLNames.Vehicle_ADAS_EcoRollWithEngineStopStart, adasData.EcoRollWithEngineStop), + new XElement(tns + XMLNames.Vehicle_ADAS_EcoRollWithoutEngineStop, adasData.EcoRoll.WithoutEngineStop()), + new XElement(tns + XMLNames.Vehicle_ADAS_EcoRollWithEngineStopStart, adasData.EcoRoll.WithEngineStop()), new XElement(tns + XMLNames.Vehicle_ADAS_PCC, adasData.PredictiveCruiseControl != PredictiveCruiseControlType.None) ); } diff --git a/VectoCore/VectoCore/OutputData/XML/XMLManufacturerReport.cs b/VectoCore/VectoCore/OutputData/XML/XMLManufacturerReport.cs index 1f7f252fdb249bf90ccacd06f2e782154964dc69..59cad7f46a28d1e64b1270abceef73cd20a52e35 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLManufacturerReport.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLManufacturerReport.cs @@ -112,8 +112,8 @@ namespace TUGraz.VectoCore.OutputData.XML { return new XElement(tns + XMLNames.Vehicle_ADAS, new XElement(tns + XMLNames.Vehicle_ADAS_EngineStopStart, adasData.EngineStopStart), - new XElement(tns + XMLNames.Vehicle_ADAS_EcoRollWithoutEngineStop, adasData.EcoRollWithoutEngineStop), - new XElement(tns + XMLNames.Vehicle_ADAS_EcoRollWithEngineStopStart, adasData.EcoRollWithEngineStop), + new XElement(tns + XMLNames.Vehicle_ADAS_EcoRollWithoutEngineStop, adasData.EcoRoll.WithoutEngineStop()), + new XElement(tns + XMLNames.Vehicle_ADAS_EcoRollWithEngineStopStart, adasData.EcoRoll.WithEngineStop()), new XElement(tns + XMLNames.Vehicle_ADAS_PCC, adasData.PredictiveCruiseControl != PredictiveCruiseControlType.None) ); } diff --git a/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs b/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs index 0d46021d6bacd47fdbfe781968f69fa1d40cea52..e9eb84f86ff0a413b8875a406b3b906d77af638c 100644 --- a/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs +++ b/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs @@ -1996,7 +1996,7 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration bool engineStopStart, bool ecoRollWOEngineStop, bool ecoRollWEngineStop, PredictiveCruiseControlType pcc, string expectedADASGroup) { - var adas = DeclarationData.ADASCombinations.Lookup(engineStopStart, ecoRollWOEngineStop, ecoRollWEngineStop, pcc); + var adas = DeclarationData.ADASCombinations.Lookup(engineStopStart, EcorollTypeHelper.Get(ecoRollWOEngineStop, ecoRollWEngineStop), pcc); Assert.AreEqual(adas.ID, expectedADASGroup); } @@ -2006,7 +2006,7 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration bool engineStopStart, bool ecoRollWOEngineStop, bool ecoRollWEngineStop, PredictiveCruiseControlType pcc) { AssertHelper.Exception<VectoException>(() => { - DeclarationData.ADASCombinations.Lookup(engineStopStart, ecoRollWOEngineStop, ecoRollWEngineStop, pcc); + DeclarationData.ADASCombinations.Lookup(engineStopStart, EcorollTypeHelper.Get(ecoRollWOEngineStop, ecoRollWEngineStop), pcc); }); } diff --git a/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/vecto_vehicle-sample_FULL_updated.xml b/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/vecto_vehicle-sample_FULL_updated.xml index 8e11505a1864c7573a15b77d5ceb31a2b836c485..74fb70c4626c2a4e8c8f22f3fb60edc4c6b2da16 100644 --- a/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/vecto_vehicle-sample_FULL_updated.xml +++ b/VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration/vecto_vehicle-sample_FULL_updated.xml @@ -29,7 +29,7 @@ <SleeperCab>false</SleeperCab> <ADAS> <EngineStopStart>true</EngineStopStart> - <EcoRollWithoutEngineStop>true</EcoRollWithoutEngineStop> + <EcoRollWithoutEngineStop>false</EcoRollWithoutEngineStop> <EcoRollWithEngineStop>true</EcoRollWithEngineStop> <PredictiveCruiseControl>1,2</PredictiveCruiseControl> </ADAS> diff --git a/VectoCore/VectoCoreTest/XML/XMLDeclarationInputTest.cs b/VectoCore/VectoCoreTest/XML/XMLDeclarationInputTest.cs index 5e286578728b92e120dbf80ca50230219c300e27..b1e25edcaff1d0597f168d23a8c1eb8cbb270fea 100644 --- a/VectoCore/VectoCoreTest/XML/XMLDeclarationInputTest.cs +++ b/VectoCore/VectoCoreTest/XML/XMLDeclarationInputTest.cs @@ -995,7 +995,7 @@ namespace TUGraz.VectoCore.Tests.XML } [TestCase(SampleVehicleDecl, false, false, false, PredictiveCruiseControlType.None), - TestCase(SampleVehicleFullDeclUpdated, true, true, true, PredictiveCruiseControlType.Option_1_2)] + TestCase(SampleVehicleFullDeclUpdated, true, false, true, PredictiveCruiseControlType.Option_1_2)] public void TestReadingAdasParameters( string file, bool engineStopStart, bool ecoRollWithout, bool ecoRollWith, PredictiveCruiseControlType pcc) { @@ -1008,8 +1008,8 @@ namespace TUGraz.VectoCore.Tests.XML Assert.IsFalse(vehicle.ExemptedVehicle); Assert.AreEqual(engineStopStart, adas.EngineStopStart); - Assert.AreEqual(ecoRollWith, adas.EcoRollWithEngineStop); - Assert.AreEqual(ecoRollWithout, adas.EcoRollWitoutEngineStop); + Assert.AreEqual(ecoRollWith, adas.EcoRoll.WithEngineStop()); + Assert.AreEqual(ecoRollWithout, adas.EcoRoll.WithoutEngineStop()); Assert.AreEqual(pcc, adas.PredictiveCruiseControl); }