diff --git a/Generic Vehicles/Engineering Mode/Class5_Tractor_4x2/Class5_Tractor_ENG_WHR_ESS_DF.vecto b/Generic Vehicles/Engineering Mode/Class5_Tractor_4x2/Class5_Tractor_ENG_WHR_ESS_DF.vecto index 197999b3e6ca9acd822ac3d6725b8368c0b42797..0eef057b1d2f6b7b5e1f9b087643a292891c6507 100644 --- a/Generic Vehicles/Engineering Mode/Class5_Tractor_4x2/Class5_Tractor_ENG_WHR_ESS_DF.vecto +++ b/Generic Vehicles/Engineering Mode/Class5_Tractor_4x2/Class5_Tractor_ENG_WHR_ESS_DF.vecto @@ -1,7 +1,7 @@ { "Header": { "CreatedBy": "", - "Date": "2019-08-07T15:08:52.7145424Z", + "Date": "2019-08-07T15:15:30.9500516Z", "AppVersion": "3", "FileVersion": 5 }, diff --git a/VECTO/GUI/EngineForm.Designer.vb b/VECTO/GUI/EngineForm.Designer.vb index bdcf3f19c06eb563a106e684c80a0b07a2f46199..fc83f75f3457c52251dc75f763afe33021955eef 100644 --- a/VECTO/GUI/EngineForm.Designer.vb +++ b/VECTO/GUI/EngineForm.Designer.vb @@ -37,7 +37,7 @@ Partial Class EngineForm Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(EngineForm)) - Me.TbNleerl = New System.Windows.Forms.TextBox() + Me.TbIdleSpeed = New System.Windows.Forms.TextBox() Me.Label11 = New System.Windows.Forms.Label() Me.TbInertia = New System.Windows.Forms.TextBox() Me.Label41 = New System.Windows.Forms.Label() @@ -121,6 +121,32 @@ Partial Class EngineForm Me.Label26 = New System.Windows.Forms.Label() Me.Label19 = New System.Windows.Forms.Label() Me.cbWHRType = New System.Windows.Forms.ComboBox() + Me.tbDualFuel = New System.Windows.Forms.TabControl() + Me.tpPrimaryfuel = New System.Windows.Forms.TabPage() + Me.tpSecondaryFuel = New System.Windows.Forms.TabPage() + Me.GroupBox1 = New System.Windows.Forms.GroupBox() + Me.pnWhtcFuel2 = New System.Windows.Forms.Panel() + Me.Label27 = New System.Windows.Forms.Label() + Me.tbRegPerFuel2 = New System.Windows.Forms.TextBox() + Me.Label28 = New System.Windows.Forms.Label() + Me.tbColdHotFuel2 = New System.Windows.Forms.TextBox() + Me.Label29 = New System.Windows.Forms.Label() + Me.Label30 = New System.Windows.Forms.Label() + Me.Label31 = New System.Windows.Forms.Label() + Me.Label32 = New System.Windows.Forms.Label() + Me.tbWhtcMotorwayFuel2 = New System.Windows.Forms.TextBox() + Me.tbWhtcUrbanFuel2 = New System.Windows.Forms.TextBox() + Me.tbWhtcRuralFuel2 = New System.Windows.Forms.TextBox() + Me.pnEngCFFuel2 = New System.Windows.Forms.Panel() + Me.tbEngineeringCFFuel2 = New System.Windows.Forms.TextBox() + Me.Label33 = New System.Windows.Forms.Label() + Me.tbMapFuel2 = New System.Windows.Forms.TextBox() + Me.Label34 = New System.Windows.Forms.Label() + Me.btMapFuel2 = New System.Windows.Forms.Button() + Me.btMapOpenFuel2 = New System.Windows.Forms.Button() + Me.cbFuelType2 = New System.Windows.Forms.ComboBox() + Me.Label35 = New System.Windows.Forms.Label() + Me.cbDualFuel = New System.Windows.Forms.CheckBox() Me.ToolStrip1.SuspendLayout Me.StatusStrip1.SuspendLayout CType(Me.PictureBox1,System.ComponentModel.ISupportInitialize).BeginInit @@ -133,14 +159,20 @@ Partial Class EngineForm Me.gbWHR.SuspendLayout Me.pnWHRDeclaration.SuspendLayout Me.pnWhrEngineering.SuspendLayout + Me.tbDualFuel.SuspendLayout + Me.tpPrimaryfuel.SuspendLayout + Me.tpSecondaryFuel.SuspendLayout + Me.GroupBox1.SuspendLayout + Me.pnWhtcFuel2.SuspendLayout + Me.pnEngCFFuel2.SuspendLayout Me.SuspendLayout ' - 'TbNleerl + 'TbIdleSpeed ' - Me.TbNleerl.Location = New System.Drawing.Point(123, 108) - Me.TbNleerl.Name = "TbNleerl" - Me.TbNleerl.Size = New System.Drawing.Size(57, 20) - Me.TbNleerl.TabIndex = 1 + Me.TbIdleSpeed.Location = New System.Drawing.Point(123, 108) + Me.TbIdleSpeed.Name = "TbIdleSpeed" + Me.TbIdleSpeed.Size = New System.Drawing.Size(57, 20) + Me.TbIdleSpeed.TabIndex = 1 ' 'Label11 ' @@ -189,7 +221,7 @@ Partial Class EngineForm ' Me.ButCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles) Me.ButCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel - Me.ButCancel.Location = New System.Drawing.Point(898, 567) + Me.ButCancel.Location = New System.Drawing.Point(916, 533) Me.ButCancel.Name = "ButCancel" Me.ButCancel.Size = New System.Drawing.Size(75, 23) Me.ButCancel.TabIndex = 13 @@ -199,7 +231,7 @@ Partial Class EngineForm 'ButOK ' Me.ButOK.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles) - Me.ButOK.Location = New System.Drawing.Point(817, 567) + Me.ButOK.Location = New System.Drawing.Point(835, 533) Me.ButOK.Name = "ButOK" Me.ButOK.Size = New System.Drawing.Size(75, 23) Me.ButOK.TabIndex = 12 @@ -212,7 +244,7 @@ Partial Class EngineForm Me.ToolStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripBtNew, Me.ToolStripBtOpen, Me.ToolStripBtSave, Me.ToolStripBtSaveAs, Me.ToolStripSeparator3, Me.ToolStripBtSendTo, Me.ToolStripSeparator1, Me.ToolStripButton1}) Me.ToolStrip1.Location = New System.Drawing.Point(0, 0) Me.ToolStrip1.Name = "ToolStrip1" - Me.ToolStrip1.Size = New System.Drawing.Size(985, 25) + Me.ToolStrip1.Size = New System.Drawing.Size(1003, 25) Me.ToolStrip1.TabIndex = 30 Me.ToolStrip1.Text = "ToolStrip1" ' @@ -288,9 +320,9 @@ Partial Class EngineForm 'StatusStrip1 ' Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.LbStatus}) - Me.StatusStrip1.Location = New System.Drawing.Point(0, 593) + Me.StatusStrip1.Location = New System.Drawing.Point(0, 559) Me.StatusStrip1.Name = "StatusStrip1" - Me.StatusStrip1.Size = New System.Drawing.Size(985, 22) + Me.StatusStrip1.Size = New System.Drawing.Size(1003, 22) Me.StatusStrip1.SizingGrip = false Me.StatusStrip1.TabIndex = 37 Me.StatusStrip1.Text = "StatusStrip1" @@ -344,15 +376,15 @@ Partial Class EngineForm ' 'TbMAP ' - Me.TbMAP.Location = New System.Drawing.Point(12, 282) + Me.TbMAP.Location = New System.Drawing.Point(6, 54) Me.TbMAP.Name = "TbMAP" - Me.TbMAP.Size = New System.Drawing.Size(434, 20) + Me.TbMAP.Size = New System.Drawing.Size(406, 20) Me.TbMAP.TabIndex = 5 ' 'Label6 ' Me.Label6.AutoSize = true - Me.Label6.Location = New System.Drawing.Point(12, 266) + Me.Label6.Location = New System.Drawing.Point(6, 38) Me.Label6.Name = "Label6" Me.Label6.Size = New System.Drawing.Size(115, 13) Me.Label6.TabIndex = 38 @@ -361,7 +393,7 @@ Partial Class EngineForm 'BtMAP ' Me.BtMAP.Image = Global.TUGraz.VECTO.My.Resources.Resources.Open_icon - Me.BtMAP.Location = New System.Drawing.Point(446, 280) + Me.BtMAP.Location = New System.Drawing.Point(418, 52) Me.BtMAP.Name = "BtMAP" Me.BtMAP.Size = New System.Drawing.Size(24, 24) Me.BtMAP.TabIndex = 6 @@ -399,7 +431,7 @@ Partial Class EngineForm 'BtMAPopen ' Me.BtMAPopen.Image = Global.TUGraz.VECTO.My.Resources.Resources.application_export_icon_small - Me.BtMAPopen.Location = New System.Drawing.Point(469, 280) + Me.BtMAPopen.Location = New System.Drawing.Point(441, 52) Me.BtMAPopen.Name = "BtMAPopen" Me.BtMAPopen.Size = New System.Drawing.Size(24, 24) Me.BtMAPopen.TabIndex = 7 @@ -420,9 +452,9 @@ Partial Class EngineForm ' Me.GrWHTC.Controls.Add(Me.PnWhtcDeclaration) Me.GrWHTC.Controls.Add(Me.PnWhtcEngineering) - Me.GrWHTC.Location = New System.Drawing.Point(12, 311) + Me.GrWHTC.Location = New System.Drawing.Point(3, 85) Me.GrWHTC.Name = "GrWHTC" - Me.GrWHTC.Size = New System.Drawing.Size(481, 135) + Me.GrWHTC.Size = New System.Drawing.Size(462, 135) Me.GrWHTC.TabIndex = 9 Me.GrWHTC.TabStop = false Me.GrWHTC.Text = "Fuel Consumption Correction Factors" @@ -442,13 +474,13 @@ 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, 74) + Me.PnWhtcDeclaration.Size = New System.Drawing.Size(455, 74) Me.PnWhtcDeclaration.TabIndex = 8 ' 'Label20 ' Me.Label20.AutoSize = true - Me.Label20.Location = New System.Drawing.Point(307, 49) + Me.Label20.Location = New System.Drawing.Point(296, 49) Me.Label20.Name = "Label20" Me.Label20.Size = New System.Drawing.Size(89, 13) Me.Label20.TabIndex = 9 @@ -456,7 +488,7 @@ Partial Class EngineForm ' 'tbRegPerCorrFactor ' - Me.tbRegPerCorrFactor.Location = New System.Drawing.Point(402, 46) + Me.tbRegPerCorrFactor.Location = New System.Drawing.Point(391, 46) Me.tbRegPerCorrFactor.Name = "tbRegPerCorrFactor" Me.tbRegPerCorrFactor.Size = New System.Drawing.Size(57, 20) Me.tbRegPerCorrFactor.TabIndex = 10 @@ -464,7 +496,7 @@ Partial Class EngineForm 'lblColdHotFactor ' Me.lblColdHotFactor.AutoSize = true - Me.lblColdHotFactor.Location = New System.Drawing.Point(47, 49) + Me.lblColdHotFactor.Location = New System.Drawing.Point(42, 49) Me.lblColdHotFactor.Name = "lblColdHotFactor" Me.lblColdHotFactor.Size = New System.Drawing.Size(177, 13) Me.lblColdHotFactor.TabIndex = 5 @@ -472,7 +504,7 @@ Partial Class EngineForm ' 'TbColdHotFactor ' - Me.TbColdHotFactor.Location = New System.Drawing.Point(230, 46) + Me.TbColdHotFactor.Location = New System.Drawing.Point(225, 46) Me.TbColdHotFactor.Name = "TbColdHotFactor" Me.TbColdHotFactor.Size = New System.Drawing.Size(57, 20) Me.TbColdHotFactor.TabIndex = 6 @@ -489,7 +521,7 @@ Partial Class EngineForm 'Label7 ' Me.Label7.AutoSize = true - Me.Label7.Location = New System.Drawing.Point(156, 23) + Me.Label7.Location = New System.Drawing.Point(151, 23) Me.Label7.Name = "Label7" Me.Label7.Size = New System.Drawing.Size(68, 13) Me.Label7.TabIndex = 0 @@ -507,7 +539,7 @@ Partial Class EngineForm 'Label8 ' Me.Label8.AutoSize = true - Me.Label8.Location = New System.Drawing.Point(307, 23) + Me.Label8.Location = New System.Drawing.Point(296, 23) Me.Label8.Name = "Label8" Me.Label8.Size = New System.Drawing.Size(89, 13) Me.Label8.TabIndex = 0 @@ -516,7 +548,7 @@ Partial Class EngineForm ' 'TbWHTCmw ' - Me.TbWHTCmw.Location = New System.Drawing.Point(402, 20) + Me.TbWHTCmw.Location = New System.Drawing.Point(391, 20) Me.TbWHTCmw.Name = "TbWHTCmw" Me.TbWHTCmw.Size = New System.Drawing.Size(57, 20) Me.TbWHTCmw.TabIndex = 2 @@ -530,7 +562,7 @@ Partial Class EngineForm ' 'TbWHTCrural ' - Me.TbWHTCrural.Location = New System.Drawing.Point(230, 20) + Me.TbWHTCrural.Location = New System.Drawing.Point(225, 20) Me.TbWHTCrural.Name = "TbWHTCrural" Me.TbWHTCrural.Size = New System.Drawing.Size(57, 20) Me.TbWHTCrural.TabIndex = 1 @@ -541,12 +573,12 @@ Partial Class EngineForm Me.PnWhtcEngineering.Controls.Add(Me.lblWhtcEngineering) Me.PnWhtcEngineering.Location = New System.Drawing.Point(3, 99) Me.PnWhtcEngineering.Name = "PnWhtcEngineering" - Me.PnWhtcEngineering.Size = New System.Drawing.Size(472, 30) + Me.PnWhtcEngineering.Size = New System.Drawing.Size(455, 30) Me.PnWhtcEngineering.TabIndex = 7 ' 'TbWHTCEngineering ' - Me.TbWHTCEngineering.Location = New System.Drawing.Point(194, 3) + Me.TbWHTCEngineering.Location = New System.Drawing.Point(225, 3) Me.TbWHTCEngineering.Name = "TbWHTCEngineering" Me.TbWHTCEngineering.Size = New System.Drawing.Size(57, 20) Me.TbWHTCEngineering.TabIndex = 5 @@ -554,7 +586,7 @@ Partial Class EngineForm 'lblWhtcEngineering ' Me.lblWhtcEngineering.AutoSize = true - Me.lblWhtcEngineering.Location = New System.Drawing.Point(125, 6) + Me.lblWhtcEngineering.Location = New System.Drawing.Point(156, 6) Me.lblWhtcEngineering.Name = "lblWhtcEngineering" Me.lblWhtcEngineering.Size = New System.Drawing.Size(63, 13) Me.lblWhtcEngineering.TabIndex = 6 @@ -564,9 +596,9 @@ Partial Class EngineForm ' Me.PicBox.BackColor = System.Drawing.Color.LightGray Me.PicBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - Me.PicBox.Location = New System.Drawing.Point(499, 28) + Me.PicBox.Location = New System.Drawing.Point(503, 28) Me.PicBox.Name = "PicBox" - Me.PicBox.Size = New System.Drawing.Size(474, 387) + Me.PicBox.Size = New System.Drawing.Size(482, 336) Me.PicBox.TabIndex = 40 Me.PicBox.TabStop = false ' @@ -684,7 +716,7 @@ Partial Class EngineForm 'Label18 ' Me.Label18.AutoSize = true - Me.Label18.Location = New System.Drawing.Point(63, 164) + Me.Label18.Location = New System.Drawing.Point(11, 9) Me.Label18.Name = "Label18" Me.Label18.Size = New System.Drawing.Size(54, 13) Me.Label18.TabIndex = 50 @@ -693,7 +725,7 @@ Partial Class EngineForm 'cbFuelType ' Me.cbFuelType.FormattingEnabled = true - Me.cbFuelType.Location = New System.Drawing.Point(123, 161) + Me.cbFuelType.Location = New System.Drawing.Point(71, 6) Me.cbFuelType.Name = "cbFuelType" Me.cbFuelType.Size = New System.Drawing.Size(143, 21) Me.cbFuelType.TabIndex = 51 @@ -701,7 +733,7 @@ Partial Class EngineForm 'lblEngineCharacteristics ' Me.lblEngineCharacteristics.AutoSize = true - Me.lblEngineCharacteristics.Location = New System.Drawing.Point(500, 418) + Me.lblEngineCharacteristics.Location = New System.Drawing.Point(505, 370) Me.lblEngineCharacteristics.Name = "lblEngineCharacteristics" Me.lblEngineCharacteristics.Size = New System.Drawing.Size(0, 13) Me.lblEngineCharacteristics.TabIndex = 52 @@ -710,7 +742,7 @@ Partial Class EngineForm ' Me.gbWHR.Controls.Add(Me.pnWHRDeclaration) Me.gbWHR.Controls.Add(Me.pnWhrEngineering) - Me.gbWHR.Location = New System.Drawing.Point(12, 452) + Me.gbWHR.Location = New System.Drawing.Point(504, 392) Me.gbWHR.Name = "gbWHR" Me.gbWHR.Size = New System.Drawing.Size(481, 135) Me.gbWHR.TabIndex = 53 @@ -853,7 +885,7 @@ Partial Class EngineForm 'Label19 ' Me.Label19.AutoSize = true - Me.Label19.Location = New System.Drawing.Point(56, 194) + Me.Label19.Location = New System.Drawing.Point(57, 160) Me.Label19.Name = "Label19" Me.Label19.Size = New System.Drawing.Size(61, 13) Me.Label19.TabIndex = 54 @@ -862,24 +894,275 @@ Partial Class EngineForm 'cbWHRType ' Me.cbWHRType.FormattingEnabled = true - Me.cbWHRType.Location = New System.Drawing.Point(122, 191) + Me.cbWHRType.Location = New System.Drawing.Point(123, 157) Me.cbWHRType.Name = "cbWHRType" Me.cbWHRType.Size = New System.Drawing.Size(129, 21) Me.cbWHRType.TabIndex = 55 ' + 'tbDualFuel + ' + Me.tbDualFuel.Controls.Add(Me.tpPrimaryfuel) + Me.tbDualFuel.Controls.Add(Me.tpSecondaryFuel) + Me.tbDualFuel.Location = New System.Drawing.Point(12, 268) + Me.tbDualFuel.Name = "tbDualFuel" + Me.tbDualFuel.SelectedIndex = 0 + Me.tbDualFuel.Size = New System.Drawing.Size(481, 259) + Me.tbDualFuel.TabIndex = 56 + ' + 'tpPrimaryfuel + ' + Me.tpPrimaryfuel.Controls.Add(Me.GrWHTC) + Me.tpPrimaryfuel.Controls.Add(Me.TbMAP) + Me.tpPrimaryfuel.Controls.Add(Me.Label6) + Me.tpPrimaryfuel.Controls.Add(Me.BtMAP) + Me.tpPrimaryfuel.Controls.Add(Me.BtMAPopen) + Me.tpPrimaryfuel.Controls.Add(Me.cbFuelType) + Me.tpPrimaryfuel.Controls.Add(Me.Label18) + Me.tpPrimaryfuel.Location = New System.Drawing.Point(4, 22) + Me.tpPrimaryfuel.Name = "tpPrimaryfuel" + Me.tpPrimaryfuel.Padding = New System.Windows.Forms.Padding(3) + Me.tpPrimaryfuel.Size = New System.Drawing.Size(473, 233) + Me.tpPrimaryfuel.TabIndex = 0 + Me.tpPrimaryfuel.Text = "Primary Fuel" + Me.tpPrimaryfuel.UseVisualStyleBackColor = true + ' + 'tpSecondaryFuel + ' + Me.tpSecondaryFuel.Controls.Add(Me.GroupBox1) + Me.tpSecondaryFuel.Controls.Add(Me.tbMapFuel2) + Me.tpSecondaryFuel.Controls.Add(Me.Label34) + Me.tpSecondaryFuel.Controls.Add(Me.btMapFuel2) + Me.tpSecondaryFuel.Controls.Add(Me.btMapOpenFuel2) + Me.tpSecondaryFuel.Controls.Add(Me.cbFuelType2) + Me.tpSecondaryFuel.Controls.Add(Me.Label35) + Me.tpSecondaryFuel.Location = New System.Drawing.Point(4, 22) + Me.tpSecondaryFuel.Name = "tpSecondaryFuel" + Me.tpSecondaryFuel.Padding = New System.Windows.Forms.Padding(3) + Me.tpSecondaryFuel.Size = New System.Drawing.Size(473, 233) + Me.tpSecondaryFuel.TabIndex = 1 + Me.tpSecondaryFuel.Text = "Secondary Fuel" + Me.tpSecondaryFuel.UseVisualStyleBackColor = true + ' + 'GroupBox1 + ' + Me.GroupBox1.Controls.Add(Me.pnWhtcFuel2) + Me.GroupBox1.Controls.Add(Me.pnEngCFFuel2) + Me.GroupBox1.Location = New System.Drawing.Point(3, 85) + Me.GroupBox1.Name = "GroupBox1" + Me.GroupBox1.Size = New System.Drawing.Size(462, 135) + Me.GroupBox1.TabIndex = 55 + Me.GroupBox1.TabStop = false + Me.GroupBox1.Text = "Fuel Consumption Correction Factors" + ' + 'pnWhtcFuel2 + ' + Me.pnWhtcFuel2.Controls.Add(Me.Label27) + Me.pnWhtcFuel2.Controls.Add(Me.tbRegPerFuel2) + Me.pnWhtcFuel2.Controls.Add(Me.Label28) + Me.pnWhtcFuel2.Controls.Add(Me.tbColdHotFuel2) + Me.pnWhtcFuel2.Controls.Add(Me.Label29) + Me.pnWhtcFuel2.Controls.Add(Me.Label30) + Me.pnWhtcFuel2.Controls.Add(Me.Label31) + Me.pnWhtcFuel2.Controls.Add(Me.Label32) + Me.pnWhtcFuel2.Controls.Add(Me.tbWhtcMotorwayFuel2) + Me.pnWhtcFuel2.Controls.Add(Me.tbWhtcUrbanFuel2) + Me.pnWhtcFuel2.Controls.Add(Me.tbWhtcRuralFuel2) + Me.pnWhtcFuel2.Location = New System.Drawing.Point(3, 19) + Me.pnWhtcFuel2.Name = "pnWhtcFuel2" + Me.pnWhtcFuel2.Size = New System.Drawing.Size(455, 74) + Me.pnWhtcFuel2.TabIndex = 8 + ' + 'Label27 + ' + Me.Label27.AutoSize = true + Me.Label27.Location = New System.Drawing.Point(296, 49) + Me.Label27.Name = "Label27" + Me.Label27.Size = New System.Drawing.Size(89, 13) + Me.Label27.TabIndex = 9 + Me.Label27.Text = "Reg. Per. Corr. F." + ' + 'tbRegPerFuel2 + ' + Me.tbRegPerFuel2.Location = New System.Drawing.Point(391, 46) + Me.tbRegPerFuel2.Name = "tbRegPerFuel2" + Me.tbRegPerFuel2.Size = New System.Drawing.Size(57, 20) + Me.tbRegPerFuel2.TabIndex = 10 + ' + 'Label28 + ' + Me.Label28.AutoSize = true + Me.Label28.Location = New System.Drawing.Point(42, 49) + Me.Label28.Name = "Label28" + Me.Label28.Size = New System.Drawing.Size(177, 13) + Me.Label28.TabIndex = 5 + Me.Label28.Text = "Cold/Hot Emission Balancing Factor" + ' + 'tbColdHotFuel2 + ' + Me.tbColdHotFuel2.Location = New System.Drawing.Point(225, 46) + Me.tbColdHotFuel2.Name = "tbColdHotFuel2" + Me.tbColdHotFuel2.Size = New System.Drawing.Size(57, 20) + Me.tbColdHotFuel2.TabIndex = 6 + ' + 'Label29 + ' + Me.Label29.AutoSize = true + Me.Label29.Location = New System.Drawing.Point(3, 23) + Me.Label29.Name = "Label29" + Me.Label29.Size = New System.Drawing.Size(72, 13) + Me.Label29.TabIndex = 0 + Me.Label29.Text = "WHTC Urban" + ' + 'Label30 + ' + Me.Label30.AutoSize = true + Me.Label30.Location = New System.Drawing.Point(151, 23) + Me.Label30.Name = "Label30" + Me.Label30.Size = New System.Drawing.Size(68, 13) + Me.Label30.TabIndex = 0 + Me.Label30.Text = "WHTC Rural" + ' + 'Label31 + ' + Me.Label31.AutoSize = true + Me.Label31.Location = New System.Drawing.Point(1, 1) + Me.Label31.Name = "Label31" + Me.Label31.Size = New System.Drawing.Size(242, 13) + Me.Label31.TabIndex = 3 + Me.Label31.Text = "Correction Factors calculated with VECTO-Engine" + ' + 'Label32 + ' + Me.Label32.AutoSize = true + Me.Label32.Location = New System.Drawing.Point(296, 23) + Me.Label32.Name = "Label32" + Me.Label32.Size = New System.Drawing.Size(89, 13) + Me.Label32.TabIndex = 0 + Me.Label32.Text = "WHTC Motorway" + Me.Label32.TextAlign = System.Drawing.ContentAlignment.TopRight + ' + 'tbWhtcMotorwayFuel2 + ' + Me.tbWhtcMotorwayFuel2.Location = New System.Drawing.Point(391, 20) + Me.tbWhtcMotorwayFuel2.Name = "tbWhtcMotorwayFuel2" + Me.tbWhtcMotorwayFuel2.Size = New System.Drawing.Size(57, 20) + Me.tbWhtcMotorwayFuel2.TabIndex = 2 + ' + 'tbWhtcUrbanFuel2 + ' + Me.tbWhtcUrbanFuel2.Location = New System.Drawing.Point(81, 20) + Me.tbWhtcUrbanFuel2.Name = "tbWhtcUrbanFuel2" + Me.tbWhtcUrbanFuel2.Size = New System.Drawing.Size(57, 20) + Me.tbWhtcUrbanFuel2.TabIndex = 0 + ' + 'tbWhtcRuralFuel2 + ' + Me.tbWhtcRuralFuel2.Location = New System.Drawing.Point(225, 20) + Me.tbWhtcRuralFuel2.Name = "tbWhtcRuralFuel2" + Me.tbWhtcRuralFuel2.Size = New System.Drawing.Size(57, 20) + Me.tbWhtcRuralFuel2.TabIndex = 1 + ' + 'pnEngCFFuel2 + ' + Me.pnEngCFFuel2.Controls.Add(Me.tbEngineeringCFFuel2) + Me.pnEngCFFuel2.Controls.Add(Me.Label33) + Me.pnEngCFFuel2.Location = New System.Drawing.Point(3, 99) + Me.pnEngCFFuel2.Name = "pnEngCFFuel2" + Me.pnEngCFFuel2.Size = New System.Drawing.Size(455, 30) + Me.pnEngCFFuel2.TabIndex = 7 + ' + 'tbEngineeringCFFuel2 + ' + Me.tbEngineeringCFFuel2.Location = New System.Drawing.Point(225, 3) + Me.tbEngineeringCFFuel2.Name = "tbEngineeringCFFuel2" + Me.tbEngineeringCFFuel2.Size = New System.Drawing.Size(57, 20) + Me.tbEngineeringCFFuel2.TabIndex = 5 + ' + 'Label33 + ' + Me.Label33.AutoSize = true + Me.Label33.Location = New System.Drawing.Point(156, 6) + Me.Label33.Name = "Label33" + Me.Label33.Size = New System.Drawing.Size(63, 13) + Me.Label33.TabIndex = 6 + Me.Label33.Text = "Engineering" + ' + 'tbMapFuel2 + ' + Me.tbMapFuel2.Location = New System.Drawing.Point(6, 54) + Me.tbMapFuel2.Name = "tbMapFuel2" + Me.tbMapFuel2.Size = New System.Drawing.Size(406, 20) + Me.tbMapFuel2.TabIndex = 52 + ' + 'Label34 + ' + Me.Label34.AutoSize = true + Me.Label34.Location = New System.Drawing.Point(6, 38) + Me.Label34.Name = "Label34" + Me.Label34.Size = New System.Drawing.Size(115, 13) + Me.Label34.TabIndex = 56 + Me.Label34.Text = "Fuel Consumption Map" + ' + 'btMapFuel2 + ' + Me.btMapFuel2.Image = Global.TUGraz.VECTO.My.Resources.Resources.Open_icon + Me.btMapFuel2.Location = New System.Drawing.Point(418, 52) + Me.btMapFuel2.Name = "btMapFuel2" + Me.btMapFuel2.Size = New System.Drawing.Size(24, 24) + Me.btMapFuel2.TabIndex = 53 + Me.btMapFuel2.TabStop = false + Me.btMapFuel2.UseVisualStyleBackColor = true + ' + 'btMapOpenFuel2 + ' + Me.btMapOpenFuel2.Image = Global.TUGraz.VECTO.My.Resources.Resources.application_export_icon_small + Me.btMapOpenFuel2.Location = New System.Drawing.Point(441, 52) + Me.btMapOpenFuel2.Name = "btMapOpenFuel2" + Me.btMapOpenFuel2.Size = New System.Drawing.Size(24, 24) + Me.btMapOpenFuel2.TabIndex = 54 + Me.btMapOpenFuel2.TabStop = false + Me.btMapOpenFuel2.UseVisualStyleBackColor = true + ' + 'cbFuelType2 + ' + Me.cbFuelType2.FormattingEnabled = true + Me.cbFuelType2.Location = New System.Drawing.Point(71, 6) + Me.cbFuelType2.Name = "cbFuelType2" + Me.cbFuelType2.Size = New System.Drawing.Size(143, 21) + Me.cbFuelType2.TabIndex = 58 + ' + 'Label35 + ' + Me.Label35.AutoSize = true + Me.Label35.Location = New System.Drawing.Point(11, 9) + Me.Label35.Name = "Label35" + Me.Label35.Size = New System.Drawing.Size(54, 13) + Me.Label35.TabIndex = 57 + Me.Label35.Text = "Fuel Type" + ' + 'cbDualFuel + ' + Me.cbDualFuel.AutoSize = true + Me.cbDualFuel.Location = New System.Drawing.Point(123, 191) + Me.cbDualFuel.Name = "cbDualFuel" + Me.cbDualFuel.Size = New System.Drawing.Size(107, 17) + Me.cbDualFuel.TabIndex = 58 + Me.cbDualFuel.Text = "Dual Fuel Engine" + Me.cbDualFuel.UseVisualStyleBackColor = true + ' 'EngineForm ' Me.AcceptButton = Me.ButOK Me.AutoScaleDimensions = New System.Drawing.SizeF(6!, 13!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.CancelButton = Me.ButCancel - Me.ClientSize = New System.Drawing.Size(985, 615) + Me.ClientSize = New System.Drawing.Size(1003, 581) + Me.Controls.Add(Me.cbDualFuel) + Me.Controls.Add(Me.tbDualFuel) Me.Controls.Add(Me.cbWHRType) Me.Controls.Add(Me.Label19) Me.Controls.Add(Me.gbWHR) Me.Controls.Add(Me.lblEngineCharacteristics) - Me.Controls.Add(Me.cbFuelType) - Me.Controls.Add(Me.Label18) Me.Controls.Add(Me.tbMaxTorque) Me.Controls.Add(Me.Label16) Me.Controls.Add(Me.Label17) @@ -890,16 +1173,12 @@ Partial Class EngineForm Me.Controls.Add(Me.Label9) Me.Controls.Add(Me.Label10) Me.Controls.Add(Me.PicBox) - Me.Controls.Add(Me.GrWHTC) Me.Controls.Add(Me.PnInertia) Me.Controls.Add(Me.BtFLDopen) - Me.Controls.Add(Me.BtMAPopen) Me.Controls.Add(Me.PictureBox1) Me.Controls.Add(Me.BtFLD) - Me.Controls.Add(Me.BtMAP) Me.Controls.Add(Me.Label14) - Me.Controls.Add(Me.Label6) - Me.Controls.Add(Me.TbNleerl) + Me.Controls.Add(Me.TbIdleSpeed) Me.Controls.Add(Me.StatusStrip1) Me.Controls.Add(Me.Label11) Me.Controls.Add(Me.ToolStrip1) @@ -908,7 +1187,6 @@ Partial Class EngineForm Me.Controls.Add(Me.ButCancel) Me.Controls.Add(Me.TbFLD) Me.Controls.Add(Me.ButOK) - Me.Controls.Add(Me.TbMAP) Me.Controls.Add(Me.Label3) Me.Controls.Add(Me.Label40) Me.Controls.Add(Me.Label1) @@ -939,11 +1217,21 @@ Partial Class EngineForm Me.pnWHRDeclaration.PerformLayout Me.pnWhrEngineering.ResumeLayout(false) Me.pnWhrEngineering.PerformLayout + Me.tbDualFuel.ResumeLayout(false) + Me.tpPrimaryfuel.ResumeLayout(false) + Me.tpPrimaryfuel.PerformLayout + Me.tpSecondaryFuel.ResumeLayout(false) + Me.tpSecondaryFuel.PerformLayout + Me.GroupBox1.ResumeLayout(false) + Me.pnWhtcFuel2.ResumeLayout(false) + Me.pnWhtcFuel2.PerformLayout + Me.pnEngCFFuel2.ResumeLayout(false) + Me.pnEngCFFuel2.PerformLayout Me.ResumeLayout(false) Me.PerformLayout End Sub - Friend WithEvents TbNleerl As TextBox + Friend WithEvents TbIdleSpeed As TextBox Friend WithEvents Label11 As Label Friend WithEvents TbInertia As TextBox Friend WithEvents Label41 As Label @@ -1027,4 +1315,30 @@ End Sub Friend WithEvents Label26 As Label Friend WithEvents Label19 As Label Friend WithEvents cbWHRType As ComboBox + Friend WithEvents tbDualFuel As TabControl + Friend WithEvents tpPrimaryfuel As TabPage + Friend WithEvents tpSecondaryFuel As TabPage + Friend WithEvents GroupBox1 As GroupBox + Friend WithEvents pnWhtcFuel2 As Panel + Friend WithEvents Label27 As Label + Friend WithEvents tbRegPerFuel2 As TextBox + Friend WithEvents Label28 As Label + Friend WithEvents tbColdHotFuel2 As TextBox + Friend WithEvents Label29 As Label + Friend WithEvents Label30 As Label + Friend WithEvents Label31 As Label + Friend WithEvents Label32 As Label + Friend WithEvents tbWhtcMotorwayFuel2 As TextBox + Friend WithEvents tbWhtcUrbanFuel2 As TextBox + Friend WithEvents tbWhtcRuralFuel2 As TextBox + Friend WithEvents pnEngCFFuel2 As Panel + Friend WithEvents tbEngineeringCFFuel2 As TextBox + Friend WithEvents Label33 As Label + Friend WithEvents tbMapFuel2 As TextBox + Friend WithEvents Label34 As Label + Friend WithEvents btMapFuel2 As Button + Friend WithEvents btMapOpenFuel2 As Button + Friend WithEvents cbFuelType2 As ComboBox + Friend WithEvents Label35 As Label + Friend WithEvents cbDualFuel As CheckBox End Class diff --git a/VECTO/GUI/EngineForm.vb b/VECTO/GUI/EngineForm.vb index af5d09c44d1076dbf8c05317a87ca1826c4700bc..c3e757f688f010e2f5a6d2f8a9a204c1f3a044db 100644 --- a/VECTO/GUI/EngineForm.vb +++ b/VECTO/GUI/EngineForm.vb @@ -37,6 +37,10 @@ Public Class EngineForm Public JobDir As String = "" Private _changed As Boolean = False + Private _contextMenuFiles As String() + Private SecondFuelTab As TabPage + + 'Before closing Editor: Check if file was changed and ask to save. Private Sub F_ENG_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing @@ -55,11 +59,21 @@ Public Class EngineForm pnWHRDeclaration.Enabled = Cfg.DeclMode pnWhrEngineering.Enabled = Not Cfg.DeclMode + pnWhtcFuel2.Enabled = cfg.DeclMode + pnEngCFFuel2.Enabled = not cfg.DeclMode + cbFuelType.Items.Clear() cbFuelType.ValueMember = "Value" cbFuelType.DisplayMember = "Label" cbFuelType.DataSource = - [Enum].GetValues(GetType(TUGraz.VectoCommon.Models.FuelType)).Cast (Of TUGraz.VectoCommon.Models.FuelType).Select( + [Enum].GetValues(GetType(FuelType)).Cast (Of FuelType).Select( + Function(type) New With {Key .Value = type, .Label = type.GetLabel()}).ToList() + + cbFuelType2.Items.Clear() + cbFuelType2.ValueMember = "Value" + cbFuelType2.DisplayMember = "Label" + cbFuelType2.DataSource = + [Enum].GetValues(GetType(FuelType)).Cast (Of FuelType).Select( Function(type) New With {Key .Value = type, .Label = type.GetLabel()}).ToList() cbWHRType.Items.Clear() @@ -68,6 +82,10 @@ Public Class EngineForm cbWHRType.DataSource = [Enum].GetValues(GetType(WHRType)).cast(Of WHRType).select(Function(type) new With {Key .Value = type, .Label = type.GetLabel()}).ToList() _changed = False + + SecondFuelTab = tbDualFuel.TabPages(1) + tbDualFuel.TabPages.Remove(SecondFuelTab) + NewEngine() End Sub @@ -161,7 +179,7 @@ Public Class EngineForm TbName.Text = "" TbDispl.Text = "" TbInertia.Text = "" - TbNleerl.Text = "" + TbIdleSpeed.Text = "" TbMAP.Text = "" TbFLD.Text = "" TbWHTCurban.Text = "" @@ -213,26 +231,56 @@ Public Class EngineForm TbName.Text = engine.Model TbDispl.Text = (engine.Displacement*1000*1000).ToGUIFormat() TbInertia.Text = engine.Inertia.ToGUIFormat() - TbNleerl.Text = engine.EngineModes.First().IdleSpeed.AsRPM.ToGUIFormat() - - TbMAP.Text = GetRelativePath(engine.EngineModes.First().Fuels.First().FuelConsumptionMap.Source, basePath) - TbFLD.Text = GetRelativePath(engine.EngineModes.First().FullLoadCurve.Source, basePath) - TbWHTCurban.Text = engine.EngineModes.First().Fuels.First().WHTCUrban.ToGUIFormat() - TbWHTCrural.Text = engine.EngineModes.First().Fuels.First().WHTCRural.ToGUIFormat() - TbWHTCmw.Text = engine.EngineModes.First().Fuels.First().WHTCMotorway.ToGUIFormat() - TbWHTCEngineering.Text = engine.WHTCEngineering.ToGUIFormat() - TbColdHotFactor.Text = engine.EngineModes.First().Fuels.First().ColdHotBalancingFactor.ToGUIFormat() - tbRegPerCorrFactor.Text = engine.EngineModes.First().Fuels.First().CorrectionFactorRegPer.ToGUIFormat() + + + Dim enginemode As IEngineModeEngineeringInputData = engine.engineModes.First() + + TbIdleSpeed.Text = enginemode.IdleSpeed.AsRPM.ToGUIFormat() + TbFLD.Text = GetRelativePath(enginemode.FullLoadCurve.Source, basePath) + tbMaxTorque.Text = engine.MaxTorqueDeclared.ToGUIFormat() tbRatedPower.Text = (engine.RatedPowerDeclared.Value()/1000).ToGUIFormat() tbRatedSpeed.Text = engine.RatedSpeedDeclared.AsRPM.ToGUIFormat() + + dim fuel1 As IEngineFuelEngineeringInputData = enginemode.Fuels.First() + + TbMAP.Text = GetRelativePath(fuel1.FuelConsumptionMap.Source, basePath) + TbWHTCurban.Text = fuel1.WHTCUrban.ToGUIFormat() + TbWHTCrural.Text = fuel1.WHTCRural.ToGUIFormat() + TbWHTCmw.Text = fuel1.WHTCMotorway.ToGUIFormat() + TbWHTCEngineering.Text = fuel1.WHTCEngineering.ToGUIFormat() + TbColdHotFactor.Text = fuel1.ColdHotBalancingFactor.ToGUIFormat() + tbRegPerCorrFactor.Text = fuel1.CorrectionFactorRegPer.ToGUIFormat() + cbFuelType.SelectedValue = fuel1.FuelType + + If (enginemode.Fuels.Count > 1) Then + cbDualFuel.Checked = True + If (tbDualFuel.TabPages.Count < 2) then + tbDualFuel.TabPages.Add(SecondFuelTab) + End If + + Dim fuel2 As IEngineFuelEngineeringInputData = enginemode.Fuels(1) + + tbMapFuel2.Text = GetRelativePath(fuel2.FuelConsumptionMap.Source, basePath) + tbWhtcUrbanFuel2.Text = fuel2.WHTCUrban.ToGUIFormat() + tbWhtcRuralFuel2.Text = fuel2.WHTCRural.ToGUIFormat() + tbWhtcMotorwayFuel2.Text = fuel2.WHTCMotorway.ToGUIFormat() + tbEngineeringCFFuel2.Text = fuel2.WHTCEngineering.ToGUIFormat() + tbColdHotFuel2.Text = fuel2.ColdHotBalancingFactor.ToGUIFormat() + tbRegPerFuel2.Text = fuel2.CorrectionFactorRegPer.ToGUIFormat() + cbFuelType2.SelectedValue = fuel2.FuelType + Else + cbDualFuel.Checked = False + If (tbDualFuel.TabPages.Count >1) then + tbDualFuel.TabPages.Remove(SecondFuelTab) + End If + End If - cbFuelType.SelectedValue = engine.EngineModes.First().Fuels.First().FuelType cbWHRType.SelectedValue = engine.WHRType gbWHR.Enabled = engine.WHRType.IsElectrical() If (engine.WHRType.IsElectrical()) Then - Dim whr As IWHRData = engine.enginemodes.first().Wasteheatrecoverydata + Dim whr As IWHRData = enginemode.Wasteheatrecoverydata If (Cfg.DeclMode) then tbWHRRural.Text = whr.RuralCorrectionFactor.ToGUIFormat() tbWHRUrban.Text = whr.UrbanCorrectionFactor.ToGUIFormat() @@ -278,19 +326,33 @@ Public Class EngineForm If Trim(engine.ModelName) = "" Then engine.ModelName = "Undefined" engine.Displacement = TbDispl.Text.ToDouble(0) engine.EngineInertia = TbInertia.Text.ToDouble(0) - engine.IdleSpeed = TbNleerl.Text.ToDouble(0) + engine.IdleSpeed = TbIdleSpeed.Text.ToDouble(0) engine.PathFld = TbFLD.Text - engine.PathMap = TbMAP.Text - - engine.WHTCUrbanInput = TbWHTCurban.Text.ToDouble(0) - engine.WHTCRuralInput = TbWHTCrural.Text.ToDouble(0) - engine.WHTCMotorwayInput = TbWHTCmw.Text.ToDouble(0) - engine.WHTCEngineeringInput = TbWHTCEngineering.Text.ToDouble(0) - engine.correctionFactorRegPerInput = tbRegPerCorrFactor.Text.ToDouble(0) - - engine.WHRTypeInput = CType(cbWHRType.SelectedValue, WHRType) + engine.PrimaryEngineFuel.PathMap = TbMAP.Text + engine.PrimaryEngineFuel.WHTCUrbanInput = TbWHTCurban.Text.ToDouble(0) + engine.PrimaryEngineFuel.WHTCRuralInput = TbWHTCrural.Text.ToDouble(0) + engine.PrimaryEngineFuel.WHTCMotorwayInput = TbWHTCmw.Text.ToDouble(0) + engine.PrimaryEngineFuel.WHTCEngineeringInput = TbWHTCEngineering.Text.ToDouble(0) + engine.PrimaryEngineFuel.correctionFactorRegPerInput = tbRegPerCorrFactor.Text.ToDouble(0) + engine.PrimaryEngineFuel.ColdHotBalancingFactorInput = TbColdHotFactor.Text.ToDouble(0) + engine.PrimaryEngineFuel.FuelTypeInput = CType(cbFuelType.SelectedValue, FuelType) + + If (cbDualFuel.Checked) Then + engine.DualFuelInput = True + + engine.SecondaryEngineFuel.PathMap = tbMapFuel2.Text + engine.SecondaryEngineFuel.WHTCUrbanInput = tbWhtcUrbanFuel2.Text.ToDouble(0) + engine.SecondaryEngineFuel.WHTCRuralInput = tbWhtcRuralFuel2.Text.ToDouble(0) + engine.SecondaryEngineFuel.WHTCMotorwayInput = tbWhtcMotorwayFuel2.Text.ToDouble(0) + engine.SecondaryEngineFuel.WHTCEngineeringInput = tbEngineeringCFFuel2.Text.ToDouble(0) + engine.SecondaryEngineFuel.correctionFactorRegPerInput = tbRegPerFuel2.Text.ToDouble(0) + engine.SecondaryEngineFuel.ColdHotBalancingFactorInput = tbColdHotFuel2.Text.ToDouble(0) + engine.SecondaryEngineFuel.FuelTypeInput = CType(cbFuelType2.SelectedValue, FuelType) + End If + + engine.WHRTypeInput = CType(cbWHRType.SelectedValue, WHRType) engine.WHRUrbanInput = tbWHRUrban.Text.ToDouble(0) engine.WHRRuralInput = tbWHRRural.Text.ToDouble(0) engine.WHRMotorwayInput = tbWHRMotorway.Text.ToDouble(0) @@ -298,14 +360,10 @@ Public Class EngineForm engine.WHRRegPerInput = tbWHRRegPer.Text.ToDouble(0) engine.WHREngineeringInput = tbWHREngineering.Text.ToDouble(0) - engine.ColdHotBalancingFactorInput = TbColdHotFactor.Text.ToDouble(0) - engine.ratedPowerInput = (tbRatedPower.Text.ToDouble(0)*1000).SI (Of Watt)() engine.ratedSpeedInput = tbRatedSpeed.Text.ToDouble(0).RPMtoRad() engine.maxTorqueInput = tbMaxTorque.Text.ToDouble(0).SI (Of NewtonMeter)() - engine.FuelTypeInput = CType(cbFuelType.SelectedValue, FuelType) - If Not engine.SaveFile Then MsgBox("Cannot safe to " & file, MsgBoxStyle.Critical) Return False @@ -374,7 +432,7 @@ Public Class EngineForm Change() End Sub - Private Sub TbNleerl_TextChanged(sender As Object, e As EventArgs) Handles TbNleerl.TextChanged + Private Sub TbNleerl_TextChanged(sender As Object, e As EventArgs) Handles TbIdleSpeed.TextChanged UpdatePic() Change() End Sub @@ -434,6 +492,7 @@ Public Class EngineForm Private Sub UpdatePic() Dim fullLoadCurve As EngineFullLoadCurve = Nothing Dim fcMap As FuelConsumptionMap = Nothing + Dim fcMap2 As FuelConsumptionMap = Nothing Dim engineCharacteristics As String = "" @@ -456,7 +515,17 @@ Public Class EngineForm Catch ex As Exception End Try - If fullLoadCurve Is Nothing AndAlso fcMap Is Nothing Then Exit Sub + Try + If (cbDualFuel.Checked) then + Dim fcFile As String = + If(Not String.IsNullOrWhiteSpace(_engFile), Path.Combine(Path.GetDirectoryName(_engFile), tbMapFuel2.Text), tbMapFuel2.Text) + If File.Exists(fcFile) Then fcMap2 = FuelConsumptionMapReader.Create(VectoCSVFile.Read(fcFile)) + End if + Catch ex As Exception + + End Try + + If fullLoadCurve Is Nothing AndAlso fcMap Is Nothing AndAlso fcmap2 Is nothing Then Exit Sub 'Create plot @@ -491,6 +560,17 @@ Public Class EngineForm fullLoadCurve.N95hSpeed.AsRPM) End If + If Not fcMap2 Is Nothing Then + Dim series As Series = New Series + series.Points.DataBindXY(fcMap2.Entries.Select(Function(x) x.EngineSpeed.AsRPM).ToArray(), + fcMap2.Entries.Select(Function(x) x.Torque.Value()).ToArray()) + series.ChartType = SeriesChartType.Point + series.MarkerSize = 3 + series.Color = Color.Green + series.Name = "Map 2" + chart.Series.Add(series) + End If + If Not fcMap Is Nothing Then Dim series As Series = New Series series.Points.DataBindXY(fcMap.Entries.Select(Function(x) x.EngineSpeed.AsRPM).ToArray(), @@ -537,9 +617,8 @@ Public Class EngineForm #Region "Open File Context Menu" - Private _contextMenuFiles As String() - Private Sub OpenFiles(ParamArray files() As String) + Private Sub OpenFiles(ParamArray files() As String) If files.Length = 0 Then Exit Sub @@ -589,4 +668,34 @@ Public Class EngineForm Private Sub cbWHRType_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbWHRType.SelectedIndexChanged gbWHR.Enabled = CType(CType(sender, ComboBox).SelectedValue, WHRType).IsElectrical() End Sub + + Private Sub btMapFuel2_Click(sender As Object, e As EventArgs) Handles btMapFuel2.Click + If FuelConsumptionMapFileBrowser.OpenDialog(FileRepl(tbMapFuel2.Text, GetPath(_engFile))) Then _ + tbMapFuel2.Text = GetFilenameWithoutDirectory(FuelConsumptionMapFileBrowser.Files(0), GetPath(_engFile)) + + End Sub + + Private Sub btMapOpenFuel2_Click(sender As Object, e As EventArgs) Handles btMapOpenFuel2.Click + Dim fldfile As String + + fldfile = FileRepl(TbFLD.Text, GetPath(_engFile)) + + If fldfile <> NoFile AndAlso File.Exists(fldfile) Then + OpenFiles(FileRepl(tbMapFuel2.Text, GetPath(_engFile)), fldfile) + Else + OpenFiles(FileRepl(tbMapFuel2.Text, GetPath(_engFile))) + End If + End Sub + + Private Sub cbDuaFuel_CheckedChanged(sender As Object, e As EventArgs) Handles cbDualFuel.CheckedChanged + If (cbDualFuel.Checked) Then + If (tbDualFuel.TabPages.Count < 2) then + tbDualFuel.TabPages.Add(SecondFuelTab) + End If + Else + If (tbDualFuel.TabPages.Count > 1) then + tbDualFuel.TabPages.Remove(SecondFuelTab) + End If + End If + End Sub End Class diff --git a/VECTO/GUI/VectoJobForm.vb b/VECTO/GUI/VectoJobForm.vb index 7b09eebef128e200c5d6b5b27dd9dfe0b882fe20..1f5db220d3140632b7a41da75a71d4bd9065c52b 100644 --- a/VECTO/GUI/VectoJobForm.vb +++ b/VECTO/GUI/VectoJobForm.vb @@ -1290,7 +1290,22 @@ lbDlog: s.MarkerSize = 3 s.Color = Color.Red s.Name = "Map" - chart.Series.Add(s) + + + If (engine.EngineModes.First().Fuels.Count > 1) then + Dim fcMap2 As FuelConsumptionMap = FuelConsumptionMapReader.Create(engine.EngineModes.First().Fuels(1).FuelConsumptionMap) + + Dim s2 As Series = New Series + s2.Points.DataBindXY(fcMap2.Entries.Select(Function(x) x.EngineSpeed.AsRPM).ToArray(), + fcMap2.Entries.Select(Function(x) x.Torque.Value()).ToArray()) + s2.ChartType = SeriesChartType.Point + s2.MarkerSize = 3 + s2.Color = Color.Green + s2.Name = "Map 2" + chart.Series.Add(s2) + End If + + chart.Series.Add(s) Dim engineCharacteristics As String = String.Format("Max. Torque: {0:F0} Nm; Max. Power: {1:F1} kW; n_rated: {2:F0} rpm; n_95h: {3:F0} rpm", diff --git a/VECTO/Input Files/Engine.vb b/VECTO/Input Files/Engine.vb index c3840bd2d66a1c3db2c1f6e5f84f9522b410f1fd..533191a9f553c0287107dc568c49d565dd5c0304 100644 --- a/VECTO/Input Files/Engine.vb +++ b/VECTO/Input Files/Engine.vb @@ -29,7 +29,7 @@ Imports TUGraz.VectoCore.Utils ''' <remarks></remarks> <CustomValidation(GetType(Engine), "ValidateEngine")> Public Class Engine - Implements IEngineEngineeringInputData, IEngineDeclarationInputData, IEngineModeDeclarationInputData, IEngineFuelDelcarationInputData, IWHRData + Implements IEngineEngineeringInputData, IEngineDeclarationInputData, IEngineModeDeclarationInputData, IWHRData, IEngineModeEngineeringInputData ''' <summary> ''' Current format version @@ -67,17 +67,13 @@ Public Class Engine ''' <remarks></remarks> Private ReadOnly _fullLoadCurvePath As SubPath - ''' <summary> - ''' Path to fuel consumption map - ''' </summary> - ''' <remarks></remarks> - Private ReadOnly _fuelConsumptionMapPath As SubPath + ''' <summary> ''' Directory of engine file. Defined in FilePath property (Set) ''' </summary> ''' <remarks></remarks> - Private _myPath As String + Friend _myPath As String ''' <summary> ''' Full file path. Needs to be defined via FilePath property before calling ReadFile or SaveFile. @@ -86,30 +82,7 @@ Public Class Engine Private _filePath As String - ''' <summary> - ''' WHTC Urban test results. Saved in input file. - ''' </summary> - ''' <remarks></remarks> - Public WHTCUrbanInput As Double - - ''' <summary> - ''' WHTC Rural test results. Saved in input file. - ''' </summary> - ''' <remarks></remarks> - Public WHTCRuralInput As Double - - ''' <summary> - ''' WHTC Motorway test results. Saved in input file. - ''' </summary> - ''' <remarks></remarks> - Public WHTCMotorwayInput As Double - - Public WHTCEngineeringInput As Double - - Public ColdHotBalancingFactorInput As Double - Public correctionFactorRegPerInput As Double - Public FuelTypeInput As FuelType Public ratedPowerInput As Watt Public ratedSpeedInput As PerSecond Public maxTorqueInput As NewtonMeter @@ -122,16 +95,24 @@ Public Class Engine public WHRRegPerInput As Double public WHREngineeringInput As Double + Public PrimaryEngineFuel As EngineFuel + Public SecondaryEngineFuel as EngineFuel - ''' <summary> + public DualFuelInput As Boolean + + + ''' <summary> ''' New instance. Initialise ''' </summary> ''' <remarks></remarks> Public Sub New() _myPath = "" _filePath = "" - _fuelConsumptionMapPath = New SubPath + _fullLoadCurvePath = New SubPath + + PrimaryEngineFuel = New EngineFuel(me) + SecondaryEngineFuel = New EngineFuel(me) SetDefault() End Sub @@ -146,13 +127,8 @@ Public Class Engine EngineInertia = 0 - _fuelConsumptionMapPath.Clear() _fullLoadCurvePath.Clear() - WHTCUrbanInput = 0 - WHTCRuralInput = 0 - WHTCMotorwayInput = 0 - WHTCEngineeringInput = 1 End Sub ''' <summary> @@ -217,25 +193,7 @@ Public Class Engine End Set End Property - ''' <summary> - ''' Get or set file path (cSubPath) to FC map (.vmap) - ''' </summary> - ''' <param name="original">True= (relative) file path as saved in file; False= full file path</param> - ''' <value></value> - ''' <returns>Relative or absolute file path to FC map</returns> - ''' <remarks></remarks> - Public Property PathMap(Optional ByVal original As Boolean = False) As String - Get - If original Then - Return _fuelConsumptionMapPath.OriginalPath - Else - Return _fuelConsumptionMapPath.FullPath - End If - End Get - Set(ByVal value As String) - _fuelConsumptionMapPath.Init(_myPath, value) - End Set - End Property + ' ReSharper disable once UnusedMember.Global -- used for Validation @@ -268,7 +226,7 @@ Public Class Engine dim dummyVehicle as IVehicleEngineeringInputData = New DummyVehicle() With { .IVehicleComponentsEngineering_EngineInputData = engine } - engineData = doa.CreateEngineData(dummyVehicle, engine.EngineModes.First()) + engineData = doa.CreateEngineData(dummyVehicle, CType(engine.EngineModes.First(), IEngineModeEngineeringInputData)) End If Dim result As IList(Of ValidationResult) = @@ -353,49 +311,7 @@ Public Class Engine End Get End Property - Public ReadOnly Property WHTCMotorway As Double Implements IEngineFuelDelcarationInputData.WHTCMotorway - Get - Return WHTCMotorwayInput - End Get - End Property - - Public ReadOnly Property WHTCRural As Double Implements IEngineFuelDelcarationInputData.WHTCRural - Get - Return WHTCRuralInput - End Get - End Property - - Public ReadOnly Property WHTCUrban As Double Implements IEngineFuelDelcarationInputData.WHTCUrban - Get - Return WHTCUrbanInput - End Get - End Property - - Public ReadOnly Property ColdHotBalancingFactor As Double Implements IEngineFuelDelcarationInputData.ColdHotBalancingFactor - Get - Return ColdHotBalancingFactorInput - End Get - End Property - - Public ReadOnly Property CorrectionFactorRegPer As Double Implements IEngineFuelDelcarationInputData.CorrectionFactorRegPer - Get - Return correctionFactorRegPerInput - End Get - End Property - - Public ReadOnly Property FuelType As FuelType Implements IEngineFuelDelcarationInputData.FuelType - Get - Return FuelTypeInput - End Get - End Property - - Public ReadOnly Property FuelConsumptionMap As TableData Implements IEngineFuelDelcarationInputData.FuelConsumptionMap - Get - If Not File.Exists(_fuelConsumptionMapPath.FullPath) Then _ - Throw New VectoException("FuelConsumptionMap is missing or invalid") - Return VectoCSVFile.Read(_fuelConsumptionMapPath.FullPath) - End Get - End Property + Public ReadOnly Property FullLoadCurve As TableData Implements IEngineModeDeclarationInputData.FullLoadCurve Get @@ -405,9 +321,23 @@ Public Class Engine End Get End Property - Public ReadOnly Property Fuels As IList(Of IEngineFuelDelcarationInputData) Implements IEngineModeDeclarationInputData.Fuels + Public ReadOnly Property IEngineModeEngineeringInputData_Fuels As IList(Of IEngineFuelEngineeringInputData) Implements IEngineModeEngineeringInputData.Fuels + Get + Dim retval As List(Of IEngineFuelEngineeringInputData) = new List(Of IEngineFuelEngineeringInputData)({PrimaryEngineFuel}) + If (DualFuelInput) Then + retval.Add(SecondaryEngineFuel) + End If + Return retval + End Get + End Property + + Public ReadOnly Property Fuels As IList(Of IEngineFuelDelcarationInputData) Implements IEngineModeDeclarationInputData.Fuels Get - Return new List(Of IEngineFuelDelcarationInputData)({me}) + Dim retval As List(Of IEngineFuelDelcarationInputData) = new List(Of IEngineFuelDelcarationInputData)({PrimaryEngineFuel}) + If (DualFuelInput) Then + retval.Add(SecondaryEngineFuel) + End If + Return retval End Get End Property @@ -435,7 +365,13 @@ Public Class Engine End Get End Property - Public ReadOnly Property EngineModes As IList(Of IEngineModeDeclarationInputData) Implements IEngineDeclarationInputData.EngineModes + Public ReadOnly Property IEngineEngineeringInputData_EngineModes As IList(Of IEngineModeEngineeringInputData) Implements IEngineEngineeringInputData.EngineModes + get + Return New List(Of IEngineModeEngineeringInputData)({me}) + End Get + End Property + + Public ReadOnly Property EngineModes As IList(Of IEngineModeDeclarationInputData) Implements IEngineDeclarationInputData.EngineModes get Return New List(Of IEngineModeDeclarationInputData)({me}) End Get @@ -453,11 +389,6 @@ Public Class Engine End Get End Property - Public ReadOnly Property WHTCEngineering As Double Implements IEngineEngineeringInputData.WHTCEngineering - Get - Return WHTCEngineeringInput - End Get - End Property Public ReadOnly Property EngineStartTime As Second Implements IEngineEngineeringInputData.EngineStartTime Get @@ -501,9 +432,137 @@ Public Class Engine Public ReadOnly Property GeneratedElectricPower As TableData Implements IWHRData.GeneratedElectricPower get - If Not File.Exists(_fuelConsumptionMapPath.FullPath) Then _ + If Not File.Exists(PrimaryEngineFuel._fuelConsumptionMapPath.FullPath) Then _ Throw New VectoException("FuelConsumptionMap is missing or invalid") - Return VectoCSVFile.Read(_fuelConsumptionMapPath.FullPath) + Return VectoCSVFile.Read(PrimaryEngineFuel._fuelConsumptionMapPath.FullPath) + End Get + End Property +End Class + +Public Class EngineFuel + Implements IEngineFuelDelcarationInputData, IEngineFuelEngineeringInputData + + ''' <summary> + ''' WHTC Urban test results. Saved in input file. + ''' </summary> + ''' <remarks></remarks> + Public WHTCUrbanInput As Double + + ''' <summary> + ''' WHTC Rural test results. Saved in input file. + ''' </summary> + ''' <remarks></remarks> + Public WHTCRuralInput As Double + + ''' <summary> + ''' WHTC Motorway test results. Saved in input file. + ''' </summary> + ''' <remarks></remarks> + Public WHTCMotorwayInput As Double + + Public WHTCEngineeringInput As Double + + ''' <summary> + ''' Path to fuel consumption map + ''' </summary> + ''' <remarks></remarks> + + Friend ReadOnly _fuelConsumptionMapPath As SubPath + + + Public ColdHotBalancingFactorInput As Double + Public correctionFactorRegPerInput As Double + Public FuelTypeInput As FuelType + Private engineData As Engine + + Public Sub New(engine As Engine) + + engineData = engine + _fuelConsumptionMapPath = New SubPath + + SetDefault() + End Sub + + ''' <summary> + ''' Set default values + ''' </summary> + ''' <remarks></remarks> + Private Sub SetDefault() + _fuelConsumptionMapPath.Clear() + + WHTCUrbanInput = 0 + WHTCRuralInput = 0 + WHTCMotorwayInput = 0 + WHTCEngineeringInput = 1 + End Sub + + Public ReadOnly Property WHTCMotorway As Double Implements IEngineFuelDelcarationInputData.WHTCMotorway + Get + Return WHTCMotorwayInput + End Get + End Property + + Public ReadOnly Property WHTCRural As Double Implements IEngineFuelDelcarationInputData.WHTCRural + Get + Return WHTCRuralInput + End Get + End Property + + Public ReadOnly Property WHTCUrban As Double Implements IEngineFuelDelcarationInputData.WHTCUrban + Get + Return WHTCUrbanInput + End Get + End Property + + Public ReadOnly Property ColdHotBalancingFactor As Double Implements IEngineFuelDelcarationInputData.ColdHotBalancingFactor + Get + Return ColdHotBalancingFactorInput + End Get + End Property + + Public ReadOnly Property CorrectionFactorRegPer As Double Implements IEngineFuelDelcarationInputData.CorrectionFactorRegPer + Get + Return correctionFactorRegPerInput + End Get + End Property + + Public ReadOnly Property FuelType As FuelType Implements IEngineFuelDelcarationInputData.FuelType + Get + Return FuelTypeInput + End Get + End Property + + ''' <summary> + ''' Get or set file path (cSubPath) to FC map (.vmap) + ''' </summary> + ''' <param name="original">True= (relative) file path as saved in file; False= full file path</param> + ''' <value></value> + ''' <returns>Relative or absolute file path to FC map</returns> + ''' <remarks></remarks> + Public Property PathMap(Optional ByVal original As Boolean = False) As String + Get + If original Then + Return _fuelConsumptionMapPath.OriginalPath + Else + Return _fuelConsumptionMapPath.FullPath + End If + End Get + Set(ByVal value As String) + _fuelConsumptionMapPath.Init(engineData._myPath, value) + End Set + End Property + + Public ReadOnly Property FuelConsumptionMap As TableData Implements IEngineFuelDelcarationInputData.FuelConsumptionMap + Get + If Not File.Exists(_fuelConsumptionMapPath.FullPath) Then _ + Throw New VectoException("FuelConsumptionMap is missing or invalid") + Return VectoCSVFile.Read(_fuelConsumptionMapPath.FullPath) + End Get + End Property + + Public ReadOnly Property WHTCEngineering As Double Implements IEngineFuelEngineeringInputData.WHTCEngineering + Get + Return WHTCEngineeringInput End Get End Property End Class diff --git a/VECTO/OutputData/JSONFileWriter.vb b/VECTO/OutputData/JSONFileWriter.vb index d0ccbb22bf40c81f8edfca19039a785829669b26..86e7923bbee0b9b66f6fb631490b09610e7af83b 100644 --- a/VECTO/OutputData/JSONFileWriter.vb +++ b/VECTO/OutputData/JSONFileWriter.vb @@ -46,20 +46,31 @@ Public Class JSONFileWriter body.Add("IdlingSpeed", eng.EngineModes.First().IdleSpeed.AsRPM) body.Add("Inertia", eng.Inertia.Value()) - body.Add("WHTC-Urban", eng.EngineModes.First().Fuels.First().WHTCUrban) - body.Add("WHTC-Rural", eng.EngineModes.First().Fuels.First().WHTCRural) - body.Add("WHTC-Motorway", eng.EngineModes.First().Fuels.First().WHTCMotorway) - body.Add("WHTC-Engineering", eng.WHTCEngineering) - body.Add("ColdHotBalancingFactor", eng.EngineModes.First().Fuels.First().ColdHotBalancingFactor) - body.Add("CFRegPer", eng.EngineModes.First().Fuels.First().CorrectionFactorRegPer) + Dim fuels As List(Of Object) = New List(Of Object)() + + For Each fuel As IEngineFuelEngineeringInputData In eng.EngineModes.First().Fuels + Dim entry as Dictionary(Of string, object) = New Dictionary(Of String,Object)() + entry.Add("WHTC-Urban", fuel.WHTCUrban) + entry.Add("WHTC-Rural", fuel.WHTCRural) + entry.Add("WHTC-Motorway", fuel.WHTCMotorway) + entry.Add("WHTC-Engineering", fuel.WHTCEngineering) + entry.Add("ColdHotBalancingFactor", fuel.ColdHotBalancingFactor) + entry.Add("CFRegPer", fuel.CorrectionFactorRegPer) + entry.Add("FuelMap", GetRelativePath(fuel.FuelConsumptionMap.Source, Path.GetDirectoryName(filename))) + entry.Add("FuelType", fuel.FuelType.ToString()) + + fuels.Add(entry) + Next + + body.Add("Fuels", fuels) + body.Add("RatedPower", eng.RatedPowerDeclared.Value()) body.Add("RatedSpeed", eng.RatedSpeedDeclared.AsRPM) body.Add("MaxTorque", eng.MaxTorqueDeclared.Value()) - body.Add("FuelType", eng.EngineModes.First().Fuels.First().FuelType.ToString()) + body.Add("FullLoadCurve", GetRelativePath(eng.EngineModes.First().FullLoadCurve.Source, Path.GetDirectoryName(filename))) - body.Add("FuelMap", GetRelativePath(eng.EngineModes.First().Fuels.First().FuelConsumptionMap.Source, Path.GetDirectoryName(filename))) body.add("WHRType", eng.WHRType.ToString()) diff --git a/VectoCommon/VectoCommon/InputData/EngineeringInputData.cs b/VectoCommon/VectoCommon/InputData/EngineeringInputData.cs index a642ffcbdfb0cdc1044c813ae9301ba8e4d41ff3..7886258c6e6486dc762a15d5422874569b550dd6 100644 --- a/VectoCommon/VectoCommon/InputData/EngineeringInputData.cs +++ b/VectoCommon/VectoCommon/InputData/EngineeringInputData.cs @@ -296,12 +296,22 @@ namespace TUGraz.VectoCommon.InputData /// </summary> KilogramSquareMeter Inertia { get; } + new IList<IEngineModeEngineeringInputData> EngineModes { get; } + + Second EngineStartTime { get; } + } + + public interface IEngineModeEngineeringInputData : IEngineModeDeclarationInputData + { + new IList<IEngineFuelEngineeringInputData> Fuels { get; } + } + + public interface IEngineFuelEngineeringInputData : IEngineFuelDelcarationInputData + { /// <summary> /// P170 /// </summary> double WHTCEngineering { get; } - - Second EngineStartTime { get; } } public interface IAuxiliariesEngineeringInputData diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONEngineData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONEngineData.cs index ec7f267cee1163a2a25dbb6793889439e4268bad..fdfb46e6568f386aac7af07a162e9eea0210f6f9 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONEngineData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONEngineData.cs @@ -72,8 +72,10 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON /// } /// } /// </code> - public class JSONEngineDataV5 : JSONEngineDataV4, IWHRData + public class JSONEngineDataV5 : JSONEngineDataV4, IWHRData, IEngineModeEngineeringInputData { + + #region Overrides of JSONEngineDataV3 public override IWHRData WasteHeatRecoveryData @@ -92,6 +94,64 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON public JSONEngineDataV5(JObject data, string fileName, bool tolerateMissing = false) : base( data, fileName, tolerateMissing) { } + #region Overrides of JSONEngineDataV3 + + protected override IList<IEngineFuelEngineeringInputData> ReadFuels() + { + var retVal = new List<IEngineFuelEngineeringInputData>(); + TableData fuelMap = null; + foreach (var jsonFuel in Body["Fuels"]) { + try { + fuelMap = ReadTableData(jsonFuel.GetEx<string>(JsonKeys.Engine_FuelConsumptionMap), "FuelConsumptionMap"); + } catch (Exception) { + if (!TolerateMissing) { + throw; + } + + fuelMap = new TableData( + Path.Combine(BasePath, jsonFuel[JsonKeys.Engine_FuelConsumptionMap].ToString()) + MissingFileSuffix, + DataSourceType.Missing); + } + + retVal.Add(new JSONFuelInputData { + FuelType = jsonFuel.GetEx<string>("FuelType").ParseEnum<FuelType>(), + ColdHotBalancingFactor = jsonFuel.GetEx<double>("ColdHotBalancingFactor"), + CorrectionFactorRegPer = jsonFuel.GetEx<double>("CFRegPer"), + WHTCUrban = jsonFuel.GetEx<double>(JsonKeys.Engine_WHTC_Urban), + WHTCRural = jsonFuel.GetEx<double>(JsonKeys.Engine_WHTC_Rural), + WHTCMotorway = jsonFuel.GetEx<double>(JsonKeys.Engine_WHTC_Motorway), + WHTCEngineering = jsonFuel.GetEx<double>("WHTC-Engineering"), + FuelConsumptionMap = fuelMap + }); + } + + return retVal; + } + + #endregion + + public class JSONFuelInputData : IEngineFuelEngineeringInputData { + #region Implementation of IEngineFuelDelcarationInputData + + public FuelType FuelType { get; set; } + public double WHTCMotorway { get; set; } + public double WHTCRural { get; set; } + public double WHTCUrban { get; set; } + public double ColdHotBalancingFactor { get; set; } + public double CorrectionFactorRegPer { get; set; } + public TableData FuelConsumptionMap { get; set; } + + #endregion + + #region Implementation of IEngineFuelEngineeringInputData + + public double WHTCEngineering { get; set; } + + #endregion + } + + + #region Implementation of IWHRData public double UrbanCorrectionFactor @@ -128,7 +188,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON { get { try { - return ReadTableData(Body.GetEx<string>(JsonKeys.Engine_FuelConsumptionMap), "FuelConsumptionMap"); + return ReadTableData(Body["Fuels"][0].GetEx<string>(JsonKeys.Engine_FuelConsumptionMap), "FuelConsumptionMap"); } catch (Exception) { if (!TolerateMissing) { throw; @@ -179,9 +239,11 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON } - public class JSONEngineDataV3 : JSONFile, IEngineEngineeringInputData, IEngineModeDeclarationInputData, - IEngineFuelDelcarationInputData + public class JSONEngineDataV3 : JSONFile, IEngineEngineeringInputData, IEngineModeEngineeringInputData, + IEngineFuelEngineeringInputData { + protected IList<IEngineFuelEngineeringInputData> _fuels; + public JSONEngineDataV3(JObject data, string fileName, bool tolerateMissing = false) : base(data, fileName, tolerateMissing) { } @@ -238,9 +300,19 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON } } + IList<IEngineFuelEngineeringInputData> IEngineModeEngineeringInputData.Fuels + { + get { return _fuels ?? (_fuels = ReadFuels()); } + } + public virtual IList<IEngineFuelDelcarationInputData> Fuels { - get { return new IEngineFuelDelcarationInputData[] { this }; } + get { return (_fuels ?? (_fuels = ReadFuels())).Cast<IEngineFuelDelcarationInputData>().ToList(); } + } + + protected virtual IList<IEngineFuelEngineeringInputData> ReadFuels() + { + return new IEngineFuelEngineeringInputData[] { this }; } public virtual IWHRData WasteHeatRecoveryData @@ -263,6 +335,11 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON get { return 0.SI<NewtonMeter>(); } } + IList<IEngineModeEngineeringInputData> IEngineEngineeringInputData.EngineModes + { + get { return new IEngineModeEngineeringInputData[] { this }; } + } + public virtual IList<IEngineModeDeclarationInputData> EngineModes { get { return new IEngineModeDeclarationInputData[] { this }; } diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/DataProvider/XMLEngineeringEngineDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/DataProvider/XMLEngineeringEngineDataProvider.cs index fe4d8e3273cbfddab5d0cd1f820e08240923d345..51ca1f7cfca9ff88b33d532f0849ed53d157b3b8 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/DataProvider/XMLEngineeringEngineDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/DataProvider/XMLEngineeringEngineDataProvider.cs @@ -46,15 +46,14 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering.DataProvider { internal class XMLEngineeringEngineDataProviderV07 : AbstractEngineeringXMLComponentDataProvider, - IXMLEngineData, IEngineModeDeclarationInputData, IEngineFuelDelcarationInputData + IXMLEngineData, IEngineModeEngineeringInputData, IEngineFuelEngineeringInputData { public static readonly XNamespace NAMESPACE_URI = XMLDefinitions.ENGINEERING_DEFINITONS_NAMESPACE_V07; public const string XSD_TYPE = "EngineDataEngineeringType"; public static readonly string QUALIFIED_XSD_TYPE = XMLHelper.CombineNamespace(NAMESPACE_URI.NamespaceName, XSD_TYPE); - - + public XMLEngineeringEngineDataProviderV07( IXMLEngineeringVehicleData vehicle, XmlNode vehicleNode, string fsBasePath) @@ -83,6 +82,11 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering.DataProvider get { return GetDouble(XMLNames.Engine_WHTCEngineering); } } + IList<IEngineModeEngineeringInputData> IEngineEngineeringInputData.EngineModes + { + get { return new[] { this }.Cast<IEngineModeEngineeringInputData>().ToList(); } + } + public virtual Second EngineStartTime { get { return null; } @@ -147,6 +151,11 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering.DataProvider } } + IList<IEngineFuelEngineeringInputData> IEngineModeEngineeringInputData.Fuels + { + get { return new[] { this }.Cast<IEngineFuelEngineeringInputData>().ToList(); } + } + public virtual IList<IEngineFuelDelcarationInputData> Fuels { get { return new[] { this }.Cast<IEngineFuelDelcarationInputData>().ToList(); } } diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs index 2fe263830bbfa9a0b0d6f3e991c496547ab72fec..ccca196d8fbd03704aaf1611a71412ef1e5fe3a3 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs @@ -153,7 +153,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter } internal CombustionEngineData CreateEngineData( - IVehicleEngineeringInputData vehicle, IEngineModeDeclarationInputData engineMode) + IVehicleEngineeringInputData vehicle, IEngineModeEngineeringInputData engineMode) { var engine = vehicle.Components.EngineInputData; var gbx = vehicle.Components.GearboxInputData; @@ -173,7 +173,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter new CombustionEngineFuelData() { FuelData = DeclarationData.FuelData.Lookup(fuel.FuelType, tankSystem), ConsumptionMap = FuelConsumptionMapReader.Create(fuel.FuelConsumptionMap), - FuelConsumptionCorrectionFactor = engine.WHTCEngineering, + FuelConsumptionCorrectionFactor = fuel.WHTCEngineering, }); } @@ -224,7 +224,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter } - internal CombustionEngineData CreateEngineData(IEngineEngineeringInputData engine, IEngineModeDeclarationInputData engineMode) + internal CombustionEngineData CreateEngineData(IEngineEngineeringInputData engine, IEngineModeEngineeringInputData engineMode) { if (engine.SavedInDeclarationMode) { WarnEngineeringMode("EngineData"); @@ -237,7 +237,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter new CombustionEngineFuelData() { FuelData = DeclarationData.FuelData.Lookup(fuel.FuelType, null), ConsumptionMap = FuelConsumptionMapReader.Create(fuel.FuelConsumptionMap), - FuelConsumptionCorrectionFactor = engine.WHTCEngineering, + FuelConsumptionCorrectionFactor = fuel.WHTCEngineering, }); } diff --git a/VectoCore/VectoCore/OutputData/XML/Engineering/Writer/XMLEngineeringEngineWriter.cs b/VectoCore/VectoCore/OutputData/XML/Engineering/Writer/XMLEngineeringEngineWriter.cs index 14c2a807d012b96c3ebb64f4a93ff595823b132f..e55f0fa7259d6f3e3ba9b251c5ba8d02739d62ae 100644 --- a/VectoCore/VectoCore/OutputData/XML/Engineering/Writer/XMLEngineeringEngineWriter.cs +++ b/VectoCore/VectoCore/OutputData/XML/Engineering/Writer/XMLEngineeringEngineWriter.cs @@ -31,7 +31,7 @@ namespace TUGraz.VectoCore.OutputData.XML.Engineering.Writer new XElement(ns + XMLNames.Engine_Displacement, (data.Displacement.Value() * 1000 * 1000).ToXMLFormat(0)), new XElement(ns + XMLNames.Engine_IdlingSpeed, data.EngineModes.First().IdleSpeed.AsRPM.ToXMLFormat(0)), data.Inertia != null ? new XElement(ns + XMLNames.Engine_Inertia, data.Inertia.Value()) : null, - new XElement(ns + XMLNames.Engine_FCCorrection, data.WHTCEngineering.ToXMLFormat(4)), + new XElement(ns + XMLNames.Engine_FCCorrection, data.EngineModes.First().Fuels.First().WHTCEngineering.ToXMLFormat(4)), new XElement(ns + XMLNames.Engine_FuelType, data.EngineModes.First().Fuels.First().FuelType.ToXMLFormat()), new XElement(ns + XMLNames.Engine_FuelConsumptionMap, GetFuelConsumptionMap(ns, data)), new XElement(ns + XMLNames.Engine_FullLoadAndDragCurve, GetFullLoadDragCurve(ns, data)) @@ -86,7 +86,7 @@ namespace TUGraz.VectoCore.OutputData.XML.Engineering.Writer new XElement(v10 + XMLNames.Engine_Displacement, (data.Displacement.Value() * 1000 * 1000).ToXMLFormat(0)), new XElement(v10 + XMLNames.Engine_IdlingSpeed, data.EngineModes.First().IdleSpeed.AsRPM.ToXMLFormat(0)), data.Inertia != null ? new XElement(v10 + XMLNames.Engine_Inertia, data.Inertia.Value()) : null, - new XElement(v10 + XMLNames.Engine_FCCorrection, data.WHTCEngineering.ToXMLFormat(4)), + new XElement(v10 + XMLNames.Engine_FCCorrection, data.EngineModes.First().Fuels.First().WHTCEngineering.ToXMLFormat(4)), new XElement(v10 + XMLNames.Engine_FuelType, data.EngineModes.First().Fuels.First().FuelType.ToXMLFormat()), new XElement(v10 + XMLNames.Engine_FuelConsumptionMap, GetFuelConsumptionMap(v10, data)), new XElement(v10 + XMLNames.Engine_FullLoadAndDragCurve, GetFullLoadDragCurve(v10, data)), diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponentData/ValidationTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponentData/ValidationTest.cs index 420cb5956a476157f29186b458bfa766f9aeb954..ddc28ba6b8e4e8ec8e5d8c318ce691e2b4ca7517 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponentData/ValidationTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponentData/ValidationTest.cs @@ -122,7 +122,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData fullLoad.Columns.Add("PT1"); fullLoad.Rows.Add("3", "3", "-3", "3"); fullLoad.Rows.Add("4", "3", "-3", "3"); - var data = new MockEngineDataProvider { + IEngineEngineeringInputData data = new MockEngineDataProvider { Model = "asdf", Displacement = 6374.SI(Unit.SI.Cubic.Centi.Meter).Cast<CubicMeter>(), IdleSpeed = 560.RPMtoRad(), diff --git a/VectoCore/VectoCoreTest/Utils/MockEngineDataProvider.cs b/VectoCore/VectoCoreTest/Utils/MockEngineDataProvider.cs index 20222ab464e558555d808c5d12c5af7acd0d08b3..0495bebbb22e05e9ec807a64288ce81716c49922 100644 --- a/VectoCore/VectoCoreTest/Utils/MockEngineDataProvider.cs +++ b/VectoCore/VectoCoreTest/Utils/MockEngineDataProvider.cs @@ -39,8 +39,10 @@ using TUGraz.VectoCore.Models.Declaration; namespace TUGraz.VectoCore.Tests.Utils { - public class MockEngineDataProvider : IEngineEngineeringInputData, IEngineModeDeclarationInputData, IEngineFuelDelcarationInputData + public class MockEngineDataProvider : IEngineEngineeringInputData, IEngineModeEngineeringInputData, IEngineFuelEngineeringInputData { + private IList<IEngineModeEngineeringInputData> _engineModes; + private IList<IEngineFuelEngineeringInputData> _fuels; public DataSource DataSource { get; set; } public string Source { get; set; } public bool SavedInDeclarationMode { get; set; } @@ -63,6 +65,11 @@ namespace TUGraz.VectoCore.Tests.Utils public TableData FuelConsumptionMap { get; set; } public TableData FullLoadCurve { get; set; } + IList<IEngineFuelEngineeringInputData> IEngineModeEngineeringInputData.Fuels + { + get { return new[] { this }.Cast<IEngineFuelEngineeringInputData>().ToList(); } + } + public IList<IEngineFuelDelcarationInputData> Fuels { get { return new[] { this }.Cast<IEngineFuelDelcarationInputData>().ToList(); } @@ -73,6 +80,12 @@ namespace TUGraz.VectoCore.Tests.Utils public Watt RatedPowerDeclared { get; set; } public PerSecond RatedSpeedDeclared { get; set; } public NewtonMeter MaxTorqueDeclared { get; set; } + + IList<IEngineModeEngineeringInputData> IEngineEngineeringInputData.EngineModes + { + get { return new[] { this }.Cast<IEngineModeEngineeringInputData>().ToList(); } + } + public IList<IEngineModeDeclarationInputData> EngineModes { get { return new[] { this }.Cast<IEngineModeDeclarationInputData>().ToList(); } } public WHRType WHRType { get; } diff --git a/VectoCore/VectoCoreTest/XML/XMLEngineeringInputSingleTest.cs b/VectoCore/VectoCoreTest/XML/XMLEngineeringInputSingleTest.cs index 1eba37d4bc6f17fb7c5930259cfaccd6931455bf..b0b6b7916c1fdf857055e8ff3442fb9697efaeb2 100644 --- a/VectoCore/VectoCoreTest/XML/XMLEngineeringInputSingleTest.cs +++ b/VectoCore/VectoCoreTest/XML/XMLEngineeringInputSingleTest.cs @@ -894,7 +894,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.NotNull(inputDataProvider); Assert.AreEqual("Generic Eninge", inputDataProvider.JobInputData.Vehicle.Components.EngineInputData.Model); - Assert.AreEqual(1.0, inputDataProvider.JobInputData.Vehicle.Components.EngineInputData.WHTCEngineering, 1e-6); + Assert.AreEqual(1.0, inputDataProvider.JobInputData.Vehicle.Components.EngineInputData.EngineModes.First().Fuels.First().WHTCEngineering, 1e-6); } @@ -912,7 +912,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.NotNull(inputDataProvider); Assert.AreEqual("Generic Eninge", inputDataProvider.JobInputData.Vehicle.Components.EngineInputData.Model); - Assert.AreEqual(1.0, inputDataProvider.JobInputData.Vehicle.Components.EngineInputData.WHTCEngineering, 1e-6); + Assert.AreEqual(1.0, inputDataProvider.JobInputData.Vehicle.Components.EngineInputData.EngineModes.First().Fuels.First().WHTCEngineering, 1e-6); Assert.AreEqual(2200, inputDataProvider.JobInputData.Vehicle.Components.EngineInputData.RatedSpeedDeclared.AsRPM, 1e-6);