diff --git a/VECTO/GUI/EngineForm.Designer.vb b/VECTO/GUI/EngineForm.Designer.vb index 663766c1c38b295ae7bc3f753dab2f4217c9def5..91a0a19ca83081a4248af307a160fe050e797830 100644 --- a/VECTO/GUI/EngineForm.Designer.vb +++ b/VECTO/GUI/EngineForm.Designer.vb @@ -88,6 +88,8 @@ Partial Class EngineForm Me.Label14 = New System.Windows.Forms.Label() Me.BtFLD = New System.Windows.Forms.Button() Me.BtFLDopen = New System.Windows.Forms.Button() + Me.lblColdHotFactor = New System.Windows.Forms.Label() + Me.TbColdHotFactor = New System.Windows.Forms.TextBox() Me.ToolStrip1.SuspendLayout() Me.StatusStrip1.SuspendLayout() CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit() @@ -386,13 +388,15 @@ Partial Class EngineForm Me.GrWHTC.Controls.Add(Me.PnWhtcEngineering) Me.GrWHTC.Location = New System.Drawing.Point(12, 300) Me.GrWHTC.Name = "GrWHTC" - Me.GrWHTC.Size = New System.Drawing.Size(481, 120) + Me.GrWHTC.Size = New System.Drawing.Size(481, 153) Me.GrWHTC.TabIndex = 9 Me.GrWHTC.TabStop = False Me.GrWHTC.Text = "WHTC Correction" ' 'PnWhtcDeclaration ' + Me.PnWhtcDeclaration.Controls.Add(Me.lblColdHotFactor) + Me.PnWhtcDeclaration.Controls.Add(Me.TbColdHotFactor) Me.PnWhtcDeclaration.Controls.Add(Me.BtWHTCimport) Me.PnWhtcDeclaration.Controls.Add(Me.Label4) Me.PnWhtcDeclaration.Controls.Add(Me.Label7) @@ -403,7 +407,7 @@ Partial Class EngineForm Me.PnWhtcDeclaration.Controls.Add(Me.TbWHTCrural) Me.PnWhtcDeclaration.Location = New System.Drawing.Point(3, 19) Me.PnWhtcDeclaration.Name = "PnWhtcDeclaration" - Me.PnWhtcDeclaration.Size = New System.Drawing.Size(472, 60) + Me.PnWhtcDeclaration.Size = New System.Drawing.Size(472, 87) Me.PnWhtcDeclaration.TabIndex = 8 ' 'BtWHTCimport @@ -427,7 +431,7 @@ Partial Class EngineForm 'Label7 ' Me.Label7.AutoSize = True - Me.Label7.Location = New System.Drawing.Point(149, 37) + Me.Label7.Location = New System.Drawing.Point(156, 37) Me.Label7.Name = "Label7" Me.Label7.Size = New System.Drawing.Size(32, 13) Me.Label7.TabIndex = 0 @@ -467,7 +471,7 @@ Partial Class EngineForm ' 'TbWHTCrural ' - Me.TbWHTCrural.Location = New System.Drawing.Point(187, 34) + Me.TbWHTCrural.Location = New System.Drawing.Point(194, 34) Me.TbWHTCrural.Name = "TbWHTCrural" Me.TbWHTCrural.Size = New System.Drawing.Size(57, 20) Me.TbWHTCrural.TabIndex = 1 @@ -476,14 +480,14 @@ Partial Class EngineForm ' Me.PnWhtcEngineering.Controls.Add(Me.TbWHTCEngineering) Me.PnWhtcEngineering.Controls.Add(Me.lblWhtcEngineering) - Me.PnWhtcEngineering.Location = New System.Drawing.Point(3, 85) + Me.PnWhtcEngineering.Location = New System.Drawing.Point(3, 112) Me.PnWhtcEngineering.Name = "PnWhtcEngineering" Me.PnWhtcEngineering.Size = New System.Drawing.Size(472, 30) Me.PnWhtcEngineering.TabIndex = 7 ' 'TbWHTCEngineering ' - Me.TbWHTCEngineering.Location = New System.Drawing.Point(187, 3) + Me.TbWHTCEngineering.Location = New System.Drawing.Point(194, 3) Me.TbWHTCEngineering.Name = "TbWHTCEngineering" Me.TbWHTCEngineering.Size = New System.Drawing.Size(57, 20) Me.TbWHTCEngineering.TabIndex = 5 @@ -491,7 +495,7 @@ Partial Class EngineForm 'lblWhtcEngineering ' Me.lblWhtcEngineering.AutoSize = True - Me.lblWhtcEngineering.Location = New System.Drawing.Point(118, 6) + Me.lblWhtcEngineering.Location = New System.Drawing.Point(125, 6) Me.lblWhtcEngineering.Name = "lblWhtcEngineering" Me.lblWhtcEngineering.Size = New System.Drawing.Size(63, 13) Me.lblWhtcEngineering.TabIndex = 6 @@ -542,6 +546,22 @@ Partial Class EngineForm Me.BtFLDopen.TabStop = False Me.BtFLDopen.UseVisualStyleBackColor = True ' + 'lblColdHotFactor + ' + Me.lblColdHotFactor.AutoSize = True + Me.lblColdHotFactor.Location = New System.Drawing.Point(3, 63) + Me.lblColdHotFactor.Name = "lblColdHotFactor" + Me.lblColdHotFactor.Size = New System.Drawing.Size(185, 13) + Me.lblColdHotFactor.TabIndex = 5 + Me.lblColdHotFactor.Text = "Cold/Hot Emmission Balancing Factor" + ' + 'TbColdHotFactor + ' + Me.TbColdHotFactor.Location = New System.Drawing.Point(194, 60) + Me.TbColdHotFactor.Name = "TbColdHotFactor" + Me.TbColdHotFactor.Size = New System.Drawing.Size(57, 20) + Me.TbColdHotFactor.TabIndex = 6 + ' 'EngineForm ' Me.AcceptButton = Me.ButOK @@ -645,4 +665,6 @@ Partial Class EngineForm Friend WithEvents lblWhtcEngineering As System.Windows.Forms.Label Friend WithEvents PnWhtcDeclaration As System.Windows.Forms.Panel Friend WithEvents PnWhtcEngineering As System.Windows.Forms.Panel + Friend WithEvents lblColdHotFactor As System.Windows.Forms.Label + Friend WithEvents TbColdHotFactor As System.Windows.Forms.TextBox End Class diff --git a/VECTO/GUI/EngineForm.vb b/VECTO/GUI/EngineForm.vb index 473c333d487e8e862282d90260975d35aba77641..c4f1bca0adacc46a2eabf32deaeb844420ed55f2 100644 --- a/VECTO/GUI/EngineForm.vb +++ b/VECTO/GUI/EngineForm.vb @@ -182,6 +182,7 @@ Public Class EngineForm TbWHTCrural.Text = engine.WHTCRural.ToGUIFormat() TbWHTCmw.Text = engine.WHTCMotorway.ToGUIFormat() TbWHTCEngineering.Text = engine.WHTCEngineering.ToGUIFormat() + TbColdHotFactor.Text = engine.ColdHotBalancingFactor.ToGUIFormat() DeclInit() @@ -395,7 +396,7 @@ Public Class EngineForm series = New Series series.Points.DataBindXY(fullLoadCurve.FullLoadEntries.Select(Function(x) x.EngineSpeed.AsRPM).ToArray(), - fullLoadCurve.FullLoadEntries.Select(Function(x) x.TorqueFullLoad.Value()).ToArray()) + fullLoadCurve.FullLoadEntries.Select(Function(x) x.TorqueFullLoad.Value()).ToArray()) series.ChartType = SeriesChartType.FastLine series.BorderWidth = 2 series.Color = Color.DarkBlue @@ -404,7 +405,7 @@ Public Class EngineForm series = New Series series.Points.DataBindXY(fullLoadCurve.FullLoadEntries.Select(Function(x) x.EngineSpeed.AsRPM).ToArray(), - fullLoadCurve.FullLoadEntries.Select(Function(x) x.TorqueDrag.Value()).ToArray()) + fullLoadCurve.FullLoadEntries.Select(Function(x) x.TorqueDrag.Value()).ToArray()) series.ChartType = SeriesChartType.FastLine series.BorderWidth = 2 series.Color = Color.Blue @@ -414,7 +415,7 @@ Public Class EngineForm series = New Series series.Points.DataBindXY(fcMap.Entries.Select(Function(x) x.EngineSpeed.AsRPM).ToArray(), - fcMap.Entries.Select(Function(x) x.Torque.Value()).ToArray()) + fcMap.Entries.Select(Function(x) x.Torque.Value()).ToArray()) series.ChartType = SeriesChartType.Point series.MarkerSize = 3 series.Color = Color.Red @@ -526,10 +527,8 @@ Public Class EngineForm End Sub Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TbWHTCEngineering.TextChanged - End Sub Private Sub Label9_Click(sender As Object, e As EventArgs) Handles lblWhtcEngineering.Click - End Sub End Class diff --git a/VECTO/Input Files/Engine.vb b/VECTO/Input Files/Engine.vb index 090b168b99371299a49c54535278a23c4aa15bef..b101bb10615fe167b424cccd28738dc5ddbdd7f5 100644 --- a/VECTO/Input Files/Engine.vb +++ b/VECTO/Input Files/Engine.vb @@ -113,7 +113,7 @@ Public Class Engine Public WHTCEngineeringInput As Double - Public SavedInDeclMode As Boolean + Private ColdHotBalancingFactorInput As Double ''' <summary> @@ -145,8 +145,6 @@ Public Class Engine WHTCurbanInput = 0 WHTCruralInput = 0 WHTCmotorwayInput = 0 - - SavedInDeclMode = False End Sub ''' <summary> @@ -180,7 +178,6 @@ Public Class Engine Dim body As Dictionary(Of String, Object) = New Dictionary(Of String, Object) body.Add("SavedInDeclMode", Cfg.DeclMode) - SavedInDeclMode = Cfg.DeclMode body.Add("ModelName", ModelName) @@ -195,6 +192,7 @@ Public Class Engine body.Add("WHTC-Urban", WHTCurbanInput) body.Add("WHTC-Rural", WHTCruralInput) body.Add("WHTC-Motorway", WHTCmotorwayInput) + body.Add("ColdHotBalancingFactor", ColdHotBalancingFactorInput) json.Content = JToken.FromObject(New Dictionary(Of String, Object) From {{"Header", header}, {"Body", body}}) @@ -367,6 +365,12 @@ Public Class Engine End Get End Property + Public ReadOnly Property ColdHotBalancingFactor As Double Implements IEngineDeclarationInputData.ColdHotBalancingFactor + Get + Return ColdHotBalancingFactorInput + End Get + End Property + Public ReadOnly Property FuelConsumptionMap As TableData Implements IEngineDeclarationInputData.FuelConsumptionMap Get Return VectoCSVFile.Read(_fuelConsumptionMapPath.OriginalPath) diff --git a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs index 1eb58e359feaacb619834676b502339b763f67fb..3b79def2f7d7072f73ad87109880792f1ce344fc 100644 --- a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs +++ b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs @@ -313,6 +313,11 @@ namespace TUGraz.VectoCommon.InputData /// </summary> double WHTCUrban { get; } + /// <summary> + /// P159 + /// </summary> + double ColdHotBalancingFactor { get; } + /// <summary> /// P067 /// P072, P073, P074 diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONEngineData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONEngineData.cs index 6f1486e4e21527c7c06d65bf8d34878863297a78..a5262b4ca36c2633ce4efd170ea7f04b3d5dbe3f 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONEngineData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONEngineData.cs @@ -81,6 +81,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON get { return Body.GetEx<double>(JsonKeys.Engine_IdleSpeed).RPMtoRad(); } } + public virtual TableData FuelConsumptionMap { get { return ReadTableData(Body.GetEx<string>(JsonKeys.Engine_FuelConsumptionMap), "FuelConsumptionMap"); } @@ -116,6 +117,17 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON get { return Body.GetEx<double>(JsonKeys.Engine_WHTC_Urban); } } + public double ColdHotBalancingFactor + { + get + { + if (Body["ColdHotBalancingFactor"] == null) { + return 1.0; + } + return Body.GetEx<double>("ColdHotBalancingFactor"); + } + } + public string Vendor { get { return "N/A"; } diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs index 4bb0ef3a468bf75b0d913cf96a40b652484935d2..62b441e563d31c9c88d9036a46c5b65218e9e4f9 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs @@ -151,6 +151,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter retVal.WHTCUrban = engine.WHTCUrban; retVal.WHTCMotorway = engine.WHTCMotorway; retVal.WHTCRural = engine.WHTCRural; + retVal.ColdHotCorrectionFactor = engine.ColdHotBalancingFactor; retVal.Inertia = DeclarationData.Engine.EngineInertia(retVal.Displacement, gearboxType); retVal.FullLoadCurve = EngineFullLoadCurve.Create(engine.FullLoadCurve, true); retVal.FullLoadCurve.EngineData = retVal; diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeVectoRunDataFactory.cs b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeVectoRunDataFactory.cs index 8220d9731d6fdf09cea324e94a5ae2060dafaa7e..475f40b4b69fc0ad8d4790d9a1db8e9eb482bbef 100644 --- a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeVectoRunDataFactory.cs +++ b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeVectoRunDataFactory.cs @@ -122,7 +122,7 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl Mission = mission, }; simulationRunData.EngineData.WHTCCorrectionFactor = DeclarationData.WHTCCorrection.Lookup(mission.MissionType, - engineData.WHTCRural, engineData.WHTCUrban, engineData.WHTCMotorway); + engineData.WHTCRural, engineData.WHTCUrban, engineData.WHTCMotorway) * engineData.ColdHotCorrectionFactor; simulationRunData.Cycle.Name = mission.MissionType.ToString(); simulationRunData.VehicleData.VehicleClass = segment.VehicleClass; yield return simulationRunData; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/CombustionEngineData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/CombustionEngineData.cs index 0dccb0c3258c56791a14f95005e7f0778f06d666..843925cacfcbd8223b25c91469852a94a1c86398 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/CombustionEngineData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/CombustionEngineData.cs @@ -29,6 +29,7 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ +using System; using System.ComponentModel.DataAnnotations; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; @@ -62,6 +63,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data [Required, ValidateObject] public EngineFullLoadCurve FullLoadCurve { get; internal set; } + [Required, Range(double.MinValue, double.MaxValue)] + public double ColdHotCorrectionFactor { get; internal set; } + internal double WHTCCorrectionFactor = 1; public CombustionEngineData() diff --git a/VectoCore/VectoCoreTest/Utils/MockEngineDataProvider.cs b/VectoCore/VectoCoreTest/Utils/MockEngineDataProvider.cs index 71378f9ded333e596b41e75374865cf665f380d5..8df9a84d060c6754c2456000e9ae7a8d80e4bb01 100644 --- a/VectoCore/VectoCoreTest/Utils/MockEngineDataProvider.cs +++ b/VectoCore/VectoCoreTest/Utils/MockEngineDataProvider.cs @@ -50,6 +50,7 @@ namespace TUGraz.VectoCore.Tests.Utils public double WHTCMotorway { get; set; } public double WHTCRural { get; set; } public double WHTCUrban { get; set; } + public double ColdHotBalancingFactor { get; set; } public TableData FuelConsumptionMap { get; set; } public TableData FullLoadCurve { get; set; } public KilogramSquareMeter Inertia { get; set; }