diff --git a/VECTO/GUI/VehicleAxleDialog.Designer.vb b/VECTO/GUI/VehicleAxleDialog.Designer.vb index e52ce1856dbf713453287ca26dc0225ae40e70c2..fccfd299c47df79b5bd4a178c574ad533e06a968 100644 --- a/VECTO/GUI/VehicleAxleDialog.Designer.vb +++ b/VECTO/GUI/VehicleAxleDialog.Designer.vb @@ -58,6 +58,7 @@ Partial Class VehicleAxleDialog Me.CbWheels = New System.Windows.Forms.ComboBox() Me.cbAxleType = New System.Windows.Forms.ComboBox() Me.Label11 = New System.Windows.Forms.Label() + Me.Label12 = New System.Windows.Forms.Label() Me.TableLayoutPanel1.SuspendLayout() Me.PnAxle.SuspendLayout() Me.SuspendLayout() @@ -149,7 +150,7 @@ Partial Class VehicleAxleDialog 'Label5 ' Me.Label5.AutoSize = True - Me.Label5.Location = New System.Drawing.Point(67, 119) + Me.Label5.Location = New System.Drawing.Point(67, 120) Me.Label5.Name = "Label5" Me.Label5.Size = New System.Drawing.Size(39, 13) Me.Label5.TabIndex = 1 @@ -158,7 +159,7 @@ Partial Class VehicleAxleDialog 'Label6 ' Me.Label6.AutoSize = True - Me.Label6.Location = New System.Drawing.Point(202, 91) + Me.Label6.Location = New System.Drawing.Point(202, 120) Me.Label6.Name = "Label6" Me.Label6.Size = New System.Drawing.Size(21, 13) Me.Label6.TabIndex = 1 @@ -273,6 +274,15 @@ Partial Class VehicleAxleDialog Me.Label11.TabIndex = 9 Me.Label11.Text = "Configuration" ' + 'Label12 + ' + Me.Label12.AutoSize = True + Me.Label12.Location = New System.Drawing.Point(202, 94) + Me.Label12.Name = "Label12" + Me.Label12.Size = New System.Drawing.Size(16, 13) + Me.Label12.TabIndex = 10 + Me.Label12.Text = "[-]" + ' 'VehicleAxleDialog ' Me.AcceptButton = Me.OK_Button @@ -280,6 +290,7 @@ Partial Class VehicleAxleDialog Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.CancelButton = Me.Cancel_Button Me.ClientSize = New System.Drawing.Size(467, 202) + Me.Controls.Add(Me.Label12) Me.Controls.Add(Me.Label11) Me.Controls.Add(Me.cbAxleType) Me.Controls.Add(Me.CbWheels) @@ -332,5 +343,6 @@ Partial Class VehicleAxleDialog Friend WithEvents CbWheels As ComboBox Friend WithEvents cbAxleType As System.Windows.Forms.ComboBox Friend WithEvents Label11 As System.Windows.Forms.Label + Friend WithEvents Label12 As System.Windows.Forms.Label End Class diff --git a/VectoCommon/VectoCommon/Models/AxleConfiguration.cs b/VectoCommon/VectoCommon/Models/AxleConfiguration.cs index 19d6524dce6fbccbf49c362d0c4b673609e97fe1..c03fdd32d0404d68137a5da18f8d45679506ebd4 100644 --- a/VectoCommon/VectoCommon/Models/AxleConfiguration.cs +++ b/VectoCommon/VectoCommon/Models/AxleConfiguration.cs @@ -29,81 +29,101 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using System; -using System.Diagnostics.CodeAnalysis; -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCommon.Models -{ - [SuppressMessage("ReSharper", "InconsistentNaming")] - public enum AxleConfiguration - { - AxleConfig_4x2, - AxleConfig_4x4, - AxleConfig_6x2, - AxleConfig_6x4, - AxleConfig_6x6, - AxleConfig_8x2, - AxleConfig_8x4, - AxleConfig_8x6, - AxleConfig_8x8, - } - - public enum AxleType - { - VehicleDriven, - VehicleNonDriven, - Trailer - } - - public static class AxleTypeHelper - { - public static string GetLabel(this AxleType self) - { - switch (self) { - case AxleType.VehicleDriven: - return "Vehicle driven"; - case AxleType.VehicleNonDriven: - return "Vehicle non-driven"; - case AxleType.Trailer: - return "Trailer"; - default: - throw new ArgumentOutOfRangeException("self", self, null); - } - } - } - - public static class AxleConfigurationHelper - { - private const string Prefix = "AxleConfig_"; - - public static string GetName(this AxleConfiguration self) - { - return self.ToString().Replace(Prefix, ""); - } - - public static AxleConfiguration Parse(string typeString) - { - return (Prefix + typeString).ParseEnum<AxleConfiguration>(); - } - - public static int NumAxles(this AxleConfiguration self) - { - switch (self) { - case AxleConfiguration.AxleConfig_4x2: - case AxleConfiguration.AxleConfig_4x4: - return 2; - case AxleConfiguration.AxleConfig_6x2: - case AxleConfiguration.AxleConfig_6x4: - case AxleConfiguration.AxleConfig_6x6: - return 3; - case AxleConfiguration.AxleConfig_8x2: - case AxleConfiguration.AxleConfig_8x4: - case AxleConfiguration.AxleConfig_8x6: - case AxleConfiguration.AxleConfig_8x8: - return 4; - } - return 0; - } - } +using System; +using System.Diagnostics.CodeAnalysis; +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCommon.Models +{ + [SuppressMessage("ReSharper", "InconsistentNaming")] + public enum AxleConfiguration + { + AxleConfig_4x2, + AxleConfig_4x4, + AxleConfig_6x2, + AxleConfig_6x4, + AxleConfig_6x6, + AxleConfig_8x2, + AxleConfig_8x4, + AxleConfig_8x6, + AxleConfig_8x8, + } + + public enum AxleType + { + VehicleDriven, + VehicleNonDriven, + Trailer + } + + public static class AxleTypeHelper + { + public static string GetLabel(this AxleType self) + { + switch (self) { + case AxleType.VehicleDriven: + return "Vehicle driven"; + case AxleType.VehicleNonDriven: + return "Vehicle non-driven"; + case AxleType.Trailer: + return "Trailer"; + default: + throw new ArgumentOutOfRangeException("self", self, null); + } + } + } + + public static class AxleConfigurationHelper + { + private const string Prefix = "AxleConfig_"; + + public static string GetName(this AxleConfiguration self) + { + return self.ToString().Replace(Prefix, ""); + } + + public static AxleConfiguration Parse(string typeString) + { + return (Prefix + typeString).ParseEnum<AxleConfiguration>(); + } + + public static int NumAxles(this AxleConfiguration self) + { + switch (self) { + case AxleConfiguration.AxleConfig_4x2: + case AxleConfiguration.AxleConfig_4x4: + return 2; + case AxleConfiguration.AxleConfig_6x2: + case AxleConfiguration.AxleConfig_6x4: + case AxleConfiguration.AxleConfig_6x6: + return 3; + case AxleConfiguration.AxleConfig_8x2: + case AxleConfiguration.AxleConfig_8x4: + case AxleConfiguration.AxleConfig_8x6: + case AxleConfiguration.AxleConfig_8x8: + return 4; + } + return 0; + } + + public static int NumDrivenAxles(this AxleConfiguration self) + { + switch (self) { + case AxleConfiguration.AxleConfig_4x2: + case AxleConfiguration.AxleConfig_6x2: + case AxleConfiguration.AxleConfig_8x2: + return 1; + case AxleConfiguration.AxleConfig_4x4: + case AxleConfiguration.AxleConfig_6x4: + case AxleConfiguration.AxleConfig_8x4: + return 2; + case AxleConfiguration.AxleConfig_6x6: + case AxleConfiguration.AxleConfig_8x6: + return 3; + case AxleConfiguration.AxleConfig_8x8: + return 4; + } + return 0; + } + } } \ 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 5ef3caa5f2b15e4c4f454754327171707f918bff..d135c2e77348e2cd98e7c537d0a4c11db7e54d1a 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs @@ -96,12 +96,12 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter retVal.BodyAndTrailerWeight = (mission.MissionType == MissionType.MunicipalUtility ? municipalBodyWeight : mission.BodyCurbWeight) + mission.Trailer.Sum(t => t.TrailerCurbWeight).DefaultIfNull(0); - //retVal.CurbWeight += retVal.BodyAndTrailerWeight; retVal.Loading = loading; - var drivenIndex = DrivenAxleIndex(data.Axles); retVal.DynamicTyreRadius = - DeclarationData.Wheels.Lookup(data.Axles[drivenIndex].Wheels).DynamicTyreRadius; + data.Axles.Where(axle => axle.AxleType == AxleType.VehicleDriven) + .Select(da => DeclarationData.Wheels.Lookup(da.Wheels).DynamicTyreRadius) + .Average(); retVal.CargoVolume = mission.MissionType != MissionType.Construction ? mission.TotalCargoVolume : 0.SI<CubicMeter>(); @@ -139,16 +139,6 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter return retVal; } - private static int DrivenAxleIndex(IList<IAxleDeclarationInputData> axles) - { - for (var i = 0; i < axles.Count; i++) { - if (axles[i].AxleType != AxleType.VehicleDriven) { - continue; - } - return i; - } - return DeclarationData.PoweredAxle(); - } internal CombustionEngineData CreateEngineData(IEngineDeclarationInputData engine, PerSecond vehicleEngineIdleSpeed, IGearboxDeclarationInputData gearbox, IEnumerable<ITorqueLimitInputData> torqueLimits) diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/VehicleData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/VehicleData.cs index 308a3112abab7dfae8e48d0d1096140880d41ff7..2422a84ff6faa1154fef0106916db14c0267ee7c 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/VehicleData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/VehicleData.cs @@ -56,9 +56,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data public static ValidationResult ValidateAirDragData(AirdragData airDragData, ValidationContext validationContext) { if (airDragData.CrossWindCorrectionMode != CrossWindCorrectionMode.DeclarationModeCorrection && - airDragData.CrossWindCorrectionCurve.AirDragArea == null) + airDragData.CrossWindCorrectionCurve.AirDragArea == null) { return new ValidationResult( "AirDrag Area (CdxA) must not be empty when the cross wind correction mode is not \"Speed dependent (Declaration Mode)\""); + } return ValidationResult.Success; } @@ -280,8 +281,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data } var numDrivenAxles = vehicleData._axleData.Count(x => x.AxleType == AxleType.VehicleDriven); - if (numDrivenAxles != 1) { - return new ValidationResult("Exactly one axle has to be defined as driven!"); + if (numDrivenAxles != vehicleData.AxleConfiguration.NumDrivenAxles()) { + return + new ValidationResult(string.Format( + vehicleData.AxleConfiguration.NumAxles() == 1 + ? "Exactly {0} axle has to be defined as driven, given {1}!" + : "Exactly {0} axles have to be defined as driven, given {1}!", vehicleData.AxleConfiguration.NumDrivenAxles(), + numDrivenAxles)); } return ValidationResult.Success; diff --git a/VectoCore/VectoCore/OutputData/SummaryDataContainer.cs b/VectoCore/VectoCore/OutputData/SummaryDataContainer.cs index 10225212bc94339cc8e7f6b1b6c2abd1b0028e3b..1e514478daf2189cb6adeb5e73b36615ed3faff7 100644 --- a/VectoCore/VectoCore/OutputData/SummaryDataContainer.cs +++ b/VectoCore/VectoCore/OutputData/SummaryDataContainer.cs @@ -168,7 +168,7 @@ namespace TUGraz.VectoCore.OutputData public const string CRUISE_TIMESHARE = "CruiseTimeShare [%]"; public const string STOP_TIMESHARE = "StopTimeShare [%]"; - public const string MAX_SPEED = "max. speed [km/h"; + public const string MAX_SPEED = "max. speed [km/h]"; public const string MAX_ACCELERATION = "max. acc [m/s²]"; public const string MAX_DECELERATION = "max. dec [m/s²]"; public const string AVG_ENGINE_SPEED = "n_eng_avg [rpm]";