From 3bd99a57091f650d6b4a3c6498534540f3267657 Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Thu, 7 Sep 2017 13:50:12 +0200 Subject: [PATCH] cherry pick 3957a --- VECTO/GUI/MainForm.Designer.vb | 83 +++++++++++++++++++ VECTO/GUI/MainForm.vb | 4 + .../Reader/DrivingCycleDataReader.cs | 8 +- .../Models/Declaration/DeclarationData.cs | 5 +- .../VectoCore/Models/Declaration/Segments.cs | 23 +++-- 5 files changed, 110 insertions(+), 13 deletions(-) diff --git a/VECTO/GUI/MainForm.Designer.vb b/VECTO/GUI/MainForm.Designer.vb index 6308e8eb09..91b103bd50 100644 --- a/VECTO/GUI/MainForm.Designer.vb +++ b/VECTO/GUI/MainForm.Designer.vb @@ -123,6 +123,13 @@ Partial Class MainForm Me.TabPgOptions.SuspendLayout Me.PanelOptAllg.SuspendLayout Me.GroupBox3.SuspendLayout + Me.GroupBox4 = New System.Windows.Forms.GroupBox() + Me.Label2 = New System.Windows.Forms.Label() + Me.tbTrailerRRC = New System.Windows.Forms.TextBox() + Me.Label3 = New System.Windows.Forms.Label() + Me.Label4 = New System.Windows.Forms.Label() + Me.tbCycleSpeedLimit = New System.Windows.Forms.TextBox() + Me.Label5 = New System.Windows.Forms.Label() Me.GroupBox2.SuspendLayout Me.GroupBox1.SuspendLayout Me.TabPageDEV.SuspendLayout @@ -134,6 +141,7 @@ Partial Class MainForm Me.ToolStrip1.SuspendLayout Me.CmOpenFile.SuspendLayout Me.SuspendLayout + Me.GroupBox4.SuspendLayout() ' 'StatusBAR ' @@ -375,6 +383,7 @@ Partial Class MainForm ' 'PanelOptAllg ' + Me.PanelOptAllg.Controls.Add(Me.GroupBox4) Me.PanelOptAllg.Controls.Add(Me.GroupBox3) Me.PanelOptAllg.Controls.Add(Me.GroupBox2) Me.PanelOptAllg.Controls.Add(Me.GroupBox1) @@ -820,6 +829,71 @@ Partial Class MainForm Me.ShowInFolderToolStripMenuItem.Size = New System.Drawing.Size(173, 22) Me.ShowInFolderToolStripMenuItem.Text = "Show in Folder" ' + 'GroupBox4 + ' + Me.GroupBox4.Controls.Add(Me.Label4) + Me.GroupBox4.Controls.Add(Me.tbCycleSpeedLimit) + Me.GroupBox4.Controls.Add(Me.Label5) + Me.GroupBox4.Controls.Add(Me.Label3) + Me.GroupBox4.Controls.Add(Me.tbTrailerRRC) + Me.GroupBox4.Controls.Add(Me.Label2) + Me.GroupBox4.Location = New System.Drawing.Point(200, 4) + Me.GroupBox4.Name = "GroupBox4" + Me.GroupBox4.Size = New System.Drawing.Size(281, 100) + Me.GroupBox4.TabIndex = 19 + Me.GroupBox4.TabStop = False + Me.GroupBox4.Text = "Custom Declaration Values" + ' + 'Label2 + ' + Me.Label2.AutoSize = True + Me.Label2.Location = New System.Drawing.Point(7, 20) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(65, 13) + Me.Label2.TabIndex = 0 + Me.Label2.Text = "RRC Trailer:" + ' + 'tbTrailerRRC + ' + Me.tbTrailerRRC.Location = New System.Drawing.Point(105, 17) + Me.tbTrailerRRC.Name = "tbTrailerRRC" + Me.tbTrailerRRC.Size = New System.Drawing.Size(59, 20) + Me.tbTrailerRRC.TabIndex = 1 + ' + 'Label3 + ' + Me.Label3.AutoSize = True + Me.Label3.Location = New System.Drawing.Point(170, 20) + Me.Label3.Name = "Label3" + Me.Label3.Size = New System.Drawing.Size(34, 13) + Me.Label3.TabIndex = 2 + Me.Label3.Text = "[N/N]" + ' + 'Label4 + ' + Me.Label4.AutoSize = True + Me.Label4.Location = New System.Drawing.Point(170, 46) + Me.Label4.Name = "Label4" + Me.Label4.Size = New System.Drawing.Size(38, 13) + Me.Label4.TabIndex = 5 + Me.Label4.Text = "[km/h]" + ' + 'tbCycleSpeedLimit + ' + Me.tbCycleSpeedLimit.Location = New System.Drawing.Point(105, 43) + Me.tbCycleSpeedLimit.Name = "tbCycleSpeedLimit" + Me.tbCycleSpeedLimit.Size = New System.Drawing.Size(59, 20) + Me.tbCycleSpeedLimit.TabIndex = 4 + ' + 'Label5 + ' + Me.Label5.AutoSize = True + Me.Label5.Location = New System.Drawing.Point(7, 46) + Me.Label5.Name = "Label5" + Me.Label5.Size = New System.Drawing.Size(94, 13) + Me.Label5.TabIndex = 3 + Me.Label5.Text = "Cycle Speed Limit:" + ' 'MainForm ' Me.AcceptButton = Me.btStartV3 @@ -860,6 +934,8 @@ Partial Class MainForm Me.CmOpenFile.ResumeLayout(false) Me.ResumeLayout(false) Me.PerformLayout + Me.GroupBox4.ResumeLayout(False) + Me.GroupBox4.PerformLayout() End Sub Friend WithEvents StatusBAR As StatusStrip @@ -951,5 +1027,12 @@ End Sub Friend WithEvents cbValidateRunData As System.Windows.Forms.CheckBox Friend WithEvents cbActVmod As System.Windows.Forms.CheckBox Friend WithEvents EPTPJobEditorToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem + Friend WithEvents GroupBox4 As System.Windows.Forms.GroupBox + Friend WithEvents Label3 As System.Windows.Forms.Label + Friend WithEvents tbTrailerRRC As System.Windows.Forms.TextBox + Friend WithEvents Label2 As System.Windows.Forms.Label + Friend WithEvents Label4 As System.Windows.Forms.Label + Friend WithEvents tbCycleSpeedLimit As System.Windows.Forms.TextBox + Friend WithEvents Label5 As System.Windows.Forms.Label End Class diff --git a/VECTO/GUI/MainForm.vb b/VECTO/GUI/MainForm.vb index a7ea1eb1f6..9b5e2987f1 100644 --- a/VECTO/GUI/MainForm.vb +++ b/VECTO/GUI/MainForm.vb @@ -48,6 +48,7 @@ Imports TUGraz.VectoCommon.Resources Imports TUGraz.VectoCommon.Utils Imports TUGraz.VectoCore.InputData.FileIO.XML.Declaration Imports TUGraz.VectoCore.InputData.FileIO.XML.Engineering +Imports TUGraz.VectoCore.Models.Declaration Imports TUGraz.VectoCore.OutputData Imports TUGraz.VectoCore.OutputData.FileIO Imports TUGraz.VectoCore.Utils @@ -947,6 +948,9 @@ Imports TUGraz.VectoCore.Utils Physics.AirDensity = Cfg.AirDensity.SI (Of KilogramPerCubicMeter)() End If + DeclarationData.Trailer.RollResistanceCoefficient = tbTrailerRRC.Text.ToDouble(0.0055) + DeclarationData.CycleSpeedLimit = _tbCycleSpeedLimit.Text.ToDouble(200).KMPHtoMeterPerSecond() + 'dictionary of run-identifiers to fileWriters (used for output directory of modfile) Dim fileWriters As Dictionary(Of Integer, FileOutputWriter) = New Dictionary(Of Integer, FileOutputWriter) diff --git a/VectoCore/VectoCore/InputData/Reader/DrivingCycleDataReader.cs b/VectoCore/VectoCore/InputData/Reader/DrivingCycleDataReader.cs index 9f3ab47966..064226aed6 100644 --- a/VectoCore/VectoCore/InputData/Reader/DrivingCycleDataReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/DrivingCycleDataReader.cs @@ -38,6 +38,7 @@ using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; +using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Utils; @@ -414,7 +415,10 @@ namespace TUGraz.VectoCore.InputData.Reader return table.Rows.Cast<DataRow>().Select(row => new DrivingCycleData.DrivingCycleEntry { Distance = row.ParseDouble(Fields.Distance).SI<Meter>(), - VehicleTargetSpeed = row.ParseDouble(Fields.VehicleSpeed).KMPHtoMeterPerSecond(), + VehicleTargetSpeed = + DeclarationData.CycleSpeedLimit != null + ? VectoMath.Min(DeclarationData.CycleSpeedLimit, row.ParseDouble(Fields.VehicleSpeed).KMPHtoMeterPerSecond()) + : row.ParseDouble(Fields.VehicleSpeed).KMPHtoMeterPerSecond(), RoadGradient = VectoMath.InclinationToAngle(row.ParseDoubleOrGetDefault(Fields.RoadGradient) / 100.0), StoppingTime = row.ParseDouble(Fields.StoppingTime).SI<Second>(), AdditionalAuxPowerDemand = row.ParseDoubleOrGetDefault(Fields.AdditionalAuxPowerDemand).SI(Unit.SI.Kilo.Watt).Cast<Watt>(), @@ -787,4 +791,4 @@ namespace TUGraz.VectoCore.InputData.Reader } #endregion -} \ No newline at end of file +} diff --git a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs index 8ea40119da..c3043cbd6b 100644 --- a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs +++ b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs @@ -77,6 +77,7 @@ namespace TUGraz.VectoCore.Models.Declaration public static readonly StandardBodies StandardBodies = new StandardBodies(); public static readonly Payloads Payloads = new Payloads(); public static readonly PTOTransmission PTOTransmission = new PTOTransmission(); + public static MeterPerSecond CycleSpeedLimit; /// <summary> @@ -144,7 +145,7 @@ namespace TUGraz.VectoCore.Models.Declaration public static class Trailer { - public const double RollResistanceCoefficient = 0.0055; + public static double RollResistanceCoefficient = 0.0055; public const double TyreTestLoad = 37500; public const bool TwinTyres = false; @@ -547,4 +548,4 @@ namespace TUGraz.VectoCore.Models.Declaration public static readonly Second FCAccumulationWindow = 10.SI(Unit.SI.Minute).Cast<Second>(); } } -} \ No newline at end of file +} diff --git a/VectoCore/VectoCore/Models/Declaration/Segments.cs b/VectoCore/VectoCore/Models/Declaration/Segments.cs index 53a29d8f79..3f20ec470c 100644 --- a/VectoCore/VectoCore/Models/Declaration/Segments.cs +++ b/VectoCore/VectoCore/Models/Declaration/Segments.cs @@ -32,11 +32,15 @@ using System; using System.Collections.Generic; using System.Data; +using System.IO; using System.Linq; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; +using TUGraz.VectoCore.InputData.Reader; +using TUGraz.VectoCore.InputData.Reader.Impl; +using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.Utils; @@ -104,7 +108,8 @@ namespace TUGraz.VectoCore.Models.Declaration VehicleHeight = LookupHeight(vehicleCategory, axleConfiguration, grossVehicleMassRating), DesignSpeed = row.ParseDouble("designspeed").KMPHtoMeterPerSecond(), GrossVehicleMassRating = grossVehicleMassRating, - CdADefault = string.IsNullOrEmpty(row["cdxa_default"].ToString()) ? null : row.ParseDouble("cdxa_default").SI<SquareMeter>(), + CdADefault = + string.IsNullOrEmpty(row["cdxa_default"].ToString()) ? null : row.ParseDouble("cdxa_default").SI<SquareMeter>(), CdAConstruction = string.IsNullOrEmpty(row["cdxa_construction"].ToString()) ? null : row.ParseDouble("cdxa_construction").SI<SquareMeter>(), @@ -137,7 +142,7 @@ namespace TUGraz.VectoCore.Models.Declaration var errorMessage = string.Format(ErrorMessage, vehicleCategory, axleConfiguration.GetName(), grossVehicleMassRating); Log.Fatal(errorMessage); - throw new VectoException(errorMessage, e); + throw new VectoException(errorMessage, e); } return row; } @@ -229,10 +234,10 @@ namespace TUGraz.VectoCore.Models.Declaration var mission = new Mission { MissionType = missionType, CrossWindCorrectionParameters = row.Field<string>("crosswindcorrection" + GetMissionSuffix(missionType, true)), - CycleFile = - RessourceHelper.ReadStream(DeclarationData.DeclarationDataResourcePrefix + ".MissionCycles." + - missionType.ToString().Replace("EMS", "") + - Constants.FileExtensions.CycleFile), + CycleFile = File.OpenRead(Path.Combine("DeclarationMissions", missionType.ToString().Replace("EMS", "") + ".vdri")), + //RessourceHelper.ReadStream(DeclarationData.DeclarationDataResourcePrefix + ".MissionCycles." + + // missionType.ToString().Replace("EMS", "") + + // Constants.FileExtensions.CycleFile), AxleWeightDistribution = GetAxleWeightDistribution(row, missionType), BodyCurbWeight = body.CurbWeight, Trailer = trailers, @@ -257,7 +262,7 @@ namespace TUGraz.VectoCore.Models.Declaration var trailerPayload = trailers.Sum( t => DeclarationData.GetPayloadForTrailerWeight(t.TrailerGrossVehicleWeight, t.TrailerCurbWeight, lowLoading)) .DefaultIfNull(0); - return vehiclePayload + trailerPayload; + return vehiclePayload + trailerPayload; } return refLoadValue.SI<Kilogram>(); } @@ -284,7 +289,7 @@ namespace TUGraz.VectoCore.Models.Declaration { var axleDistribution = row.Field<string>("truckaxles" + GetMissionSuffix(missionType)); if (string.IsNullOrWhiteSpace(axleDistribution)) { - return new double[]{}; + return new double[] { }; } return axleDistribution.Split('/').ToDouble().Select(x => x / 100.0).ToArray(); } @@ -313,4 +318,4 @@ namespace TUGraz.VectoCore.Models.Declaration }; } } -} \ No newline at end of file +} -- GitLab