Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit f6f965f8 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

adding whr to gui (.vecto jobs in declaration and engineering mode)

parent 3d3adfdc
No related branches found
No related tags found
No related merge requests found
Showing
with 598 additions and 105 deletions
......@@ -103,6 +103,24 @@ Partial Class EngineForm
Me.Label18 = New System.Windows.Forms.Label()
Me.cbFuelType = New System.Windows.Forms.ComboBox()
Me.lblEngineCharacteristics = New System.Windows.Forms.Label()
Me.gbWHR = New System.Windows.Forms.GroupBox()
Me.pnWHRDeclaration = New System.Windows.Forms.Panel()
Me.tbWHRRegPer = New System.Windows.Forms.Label()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.Label21 = New System.Windows.Forms.Label()
Me.tbWHRColdHot = New System.Windows.Forms.TextBox()
Me.Label22 = New System.Windows.Forms.Label()
Me.Label23 = New System.Windows.Forms.Label()
Me.Label24 = New System.Windows.Forms.Label()
Me.Label25 = New System.Windows.Forms.Label()
Me.tbWHRMotorway = New System.Windows.Forms.TextBox()
Me.tbWHRUrban = New System.Windows.Forms.TextBox()
Me.tbWHRRural = New System.Windows.Forms.TextBox()
Me.pnWhrEngineering = New System.Windows.Forms.Panel()
Me.tbWHREngineering = New System.Windows.Forms.TextBox()
Me.Label26 = New System.Windows.Forms.Label()
Me.Label19 = New System.Windows.Forms.Label()
Me.cbWHRType = New System.Windows.Forms.ComboBox()
Me.ToolStrip1.SuspendLayout
Me.StatusStrip1.SuspendLayout
CType(Me.PictureBox1,System.ComponentModel.ISupportInitialize).BeginInit
......@@ -112,6 +130,9 @@ Partial Class EngineForm
Me.PnWhtcDeclaration.SuspendLayout
Me.PnWhtcEngineering.SuspendLayout
CType(Me.PicBox,System.ComponentModel.ISupportInitialize).BeginInit
Me.gbWHR.SuspendLayout
Me.pnWHRDeclaration.SuspendLayout
Me.pnWhrEngineering.SuspendLayout
Me.SuspendLayout
'
'TbNleerl
......@@ -132,7 +153,7 @@ Partial Class EngineForm
'
'TbInertia
'
Me.TbInertia.Location = New System.Drawing.Point(122, 4)
Me.TbInertia.Location = New System.Drawing.Point(111, 4)
Me.TbInertia.Name = "TbInertia"
Me.TbInertia.Size = New System.Drawing.Size(57, 20)
Me.TbInertia.TabIndex = 3
......@@ -140,7 +161,7 @@ Partial Class EngineForm
'Label41
'
Me.Label41.AutoSize = true
Me.Label41.Location = New System.Drawing.Point(185, 7)
Me.Label41.Location = New System.Drawing.Point(174, 7)
Me.Label41.Name = "Label41"
Me.Label41.Size = New System.Drawing.Size(36, 13)
Me.Label41.TabIndex = 24
......@@ -158,7 +179,7 @@ Partial Class EngineForm
'Label5
'
Me.Label5.AutoSize = true
Me.Label5.Location = New System.Drawing.Point(14, 7)
Me.Label5.Location = New System.Drawing.Point(3, 7)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(102, 13)
Me.Label5.TabIndex = 0
......@@ -168,7 +189,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, 440)
Me.ButCancel.Location = New System.Drawing.Point(898, 567)
Me.ButCancel.Name = "ButCancel"
Me.ButCancel.Size = New System.Drawing.Size(75, 23)
Me.ButCancel.TabIndex = 13
......@@ -178,7 +199,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, 440)
Me.ButOK.Location = New System.Drawing.Point(817, 567)
Me.ButOK.Name = "ButOK"
Me.ButOK.Size = New System.Drawing.Size(75, 23)
Me.ButOK.TabIndex = 12
......@@ -267,7 +288,7 @@ Partial Class EngineForm
'StatusStrip1
'
Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.LbStatus})
Me.StatusStrip1.Location = New System.Drawing.Point(0, 466)
Me.StatusStrip1.Location = New System.Drawing.Point(0, 593)
Me.StatusStrip1.Name = "StatusStrip1"
Me.StatusStrip1.Size = New System.Drawing.Size(985, 22)
Me.StatusStrip1.SizingGrip = false
......@@ -323,7 +344,7 @@ Partial Class EngineForm
'
'TbMAP
'
Me.TbMAP.Location = New System.Drawing.Point(12, 271)
Me.TbMAP.Location = New System.Drawing.Point(12, 282)
Me.TbMAP.Name = "TbMAP"
Me.TbMAP.Size = New System.Drawing.Size(434, 20)
Me.TbMAP.TabIndex = 5
......@@ -331,7 +352,7 @@ Partial Class EngineForm
'Label6
'
Me.Label6.AutoSize = true
Me.Label6.Location = New System.Drawing.Point(12, 255)
Me.Label6.Location = New System.Drawing.Point(12, 266)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(115, 13)
Me.Label6.TabIndex = 38
......@@ -340,7 +361,7 @@ Partial Class EngineForm
'BtMAP
'
Me.BtMAP.Image = Global.TUGraz.VECTO.My.Resources.Resources.Open_icon
Me.BtMAP.Location = New System.Drawing.Point(446, 269)
Me.BtMAP.Location = New System.Drawing.Point(446, 280)
Me.BtMAP.Name = "BtMAP"
Me.BtMAP.Size = New System.Drawing.Size(24, 24)
Me.BtMAP.TabIndex = 6
......@@ -378,7 +399,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, 269)
Me.BtMAPopen.Location = New System.Drawing.Point(469, 280)
Me.BtMAPopen.Name = "BtMAPopen"
Me.BtMAPopen.Size = New System.Drawing.Size(24, 24)
Me.BtMAPopen.TabIndex = 7
......@@ -390,21 +411,21 @@ Partial Class EngineForm
Me.PnInertia.Controls.Add(Me.Label5)
Me.PnInertia.Controls.Add(Me.Label41)
Me.PnInertia.Controls.Add(Me.TbInertia)
Me.PnInertia.Location = New System.Drawing.Point(258, 184)
Me.PnInertia.Location = New System.Drawing.Point(272, 188)
Me.PnInertia.Name = "PnInertia"
Me.PnInertia.Size = New System.Drawing.Size(229, 30)
Me.PnInertia.Size = New System.Drawing.Size(212, 30)
Me.PnInertia.TabIndex = 3
'
'GrWHTC
'
Me.GrWHTC.Controls.Add(Me.PnWhtcDeclaration)
Me.GrWHTC.Controls.Add(Me.PnWhtcEngineering)
Me.GrWHTC.Location = New System.Drawing.Point(12, 300)
Me.GrWHTC.Location = New System.Drawing.Point(12, 311)
Me.GrWHTC.Name = "GrWHTC"
Me.GrWHTC.Size = New System.Drawing.Size(481, 135)
Me.GrWHTC.TabIndex = 9
Me.GrWHTC.TabStop = false
Me.GrWHTC.Text = "Correction Factors"
Me.GrWHTC.Text = "Fuel Consumption Correction Factors"
'
'PnWhtcDeclaration
'
......@@ -551,7 +572,7 @@ Partial Class EngineForm
'
'TbFLD
'
Me.TbFLD.Location = New System.Drawing.Point(12, 228)
Me.TbFLD.Location = New System.Drawing.Point(12, 239)
Me.TbFLD.Name = "TbFLD"
Me.TbFLD.Size = New System.Drawing.Size(434, 20)
Me.TbFLD.TabIndex = 5
......@@ -559,7 +580,7 @@ Partial Class EngineForm
'Label14
'
Me.Label14.AutoSize = true
Me.Label14.Location = New System.Drawing.Point(12, 212)
Me.Label14.Location = New System.Drawing.Point(12, 223)
Me.Label14.Name = "Label14"
Me.Label14.Size = New System.Drawing.Size(128, 13)
Me.Label14.TabIndex = 38
......@@ -568,7 +589,7 @@ Partial Class EngineForm
'BtFLD
'
Me.BtFLD.Image = Global.TUGraz.VECTO.My.Resources.Resources.Open_icon
Me.BtFLD.Location = New System.Drawing.Point(446, 226)
Me.BtFLD.Location = New System.Drawing.Point(446, 237)
Me.BtFLD.Name = "BtFLD"
Me.BtFLD.Size = New System.Drawing.Size(24, 24)
Me.BtFLD.TabIndex = 6
......@@ -578,7 +599,7 @@ Partial Class EngineForm
'BtFLDopen
'
Me.BtFLDopen.Image = Global.TUGraz.VECTO.My.Resources.Resources.application_export_icon_small
Me.BtFLDopen.Location = New System.Drawing.Point(469, 226)
Me.BtFLDopen.Location = New System.Drawing.Point(469, 237)
Me.BtFLDopen.Name = "BtFLDopen"
Me.BtFLDopen.Size = New System.Drawing.Size(24, 24)
Me.BtFLDopen.TabIndex = 7
......@@ -685,13 +706,177 @@ Partial Class EngineForm
Me.lblEngineCharacteristics.Size = New System.Drawing.Size(0, 13)
Me.lblEngineCharacteristics.TabIndex = 52
'
'gbWHR
'
Me.gbWHR.Controls.Add(Me.pnWHRDeclaration)
Me.gbWHR.Controls.Add(Me.pnWhrEngineering)
Me.gbWHR.Location = New System.Drawing.Point(12, 452)
Me.gbWHR.Name = "gbWHR"
Me.gbWHR.Size = New System.Drawing.Size(481, 135)
Me.gbWHR.TabIndex = 53
Me.gbWHR.TabStop = false
Me.gbWHR.Text = "WHR Correction Factors"
'
'pnWHRDeclaration
'
Me.pnWHRDeclaration.Controls.Add(Me.tbWHRRegPer)
Me.pnWHRDeclaration.Controls.Add(Me.TextBox1)
Me.pnWHRDeclaration.Controls.Add(Me.Label21)
Me.pnWHRDeclaration.Controls.Add(Me.tbWHRColdHot)
Me.pnWHRDeclaration.Controls.Add(Me.Label22)
Me.pnWHRDeclaration.Controls.Add(Me.Label23)
Me.pnWHRDeclaration.Controls.Add(Me.Label24)
Me.pnWHRDeclaration.Controls.Add(Me.Label25)
Me.pnWHRDeclaration.Controls.Add(Me.tbWHRMotorway)
Me.pnWHRDeclaration.Controls.Add(Me.tbWHRUrban)
Me.pnWHRDeclaration.Controls.Add(Me.tbWHRRural)
Me.pnWHRDeclaration.Location = New System.Drawing.Point(4, 19)
Me.pnWHRDeclaration.Name = "pnWHRDeclaration"
Me.pnWHRDeclaration.Size = New System.Drawing.Size(472, 74)
Me.pnWHRDeclaration.TabIndex = 10
'
'tbWHRRegPer
'
Me.tbWHRRegPer.AutoSize = true
Me.tbWHRRegPer.Location = New System.Drawing.Point(307, 49)
Me.tbWHRRegPer.Name = "tbWHRRegPer"
Me.tbWHRRegPer.Size = New System.Drawing.Size(89, 13)
Me.tbWHRRegPer.TabIndex = 9
Me.tbWHRRegPer.Text = "Reg. Per. Corr. F."
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(402, 46)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(57, 20)
Me.TextBox1.TabIndex = 10
'
'Label21
'
Me.Label21.AutoSize = true
Me.Label21.Location = New System.Drawing.Point(47, 49)
Me.Label21.Name = "Label21"
Me.Label21.Size = New System.Drawing.Size(177, 13)
Me.Label21.TabIndex = 5
Me.Label21.Text = "Cold/Hot Emission Balancing Factor"
'
'tbWHRColdHot
'
Me.tbWHRColdHot.Location = New System.Drawing.Point(230, 46)
Me.tbWHRColdHot.Name = "tbWHRColdHot"
Me.tbWHRColdHot.Size = New System.Drawing.Size(57, 20)
Me.tbWHRColdHot.TabIndex = 6
'
'Label22
'
Me.Label22.AutoSize = true
Me.Label22.Location = New System.Drawing.Point(38, 23)
Me.Label22.Name = "Label22"
Me.Label22.Size = New System.Drawing.Size(36, 13)
Me.Label22.TabIndex = 0
Me.Label22.Text = "Urban"
'
'Label23
'
Me.Label23.AutoSize = true
Me.Label23.Location = New System.Drawing.Point(191, 27)
Me.Label23.Name = "Label23"
Me.Label23.Size = New System.Drawing.Size(32, 13)
Me.Label23.TabIndex = 0
Me.Label23.Text = "Rural"
'
'Label24
'
Me.Label24.AutoSize = true
Me.Label24.Location = New System.Drawing.Point(1, 1)
Me.Label24.Name = "Label24"
Me.Label24.Size = New System.Drawing.Size(242, 13)
Me.Label24.TabIndex = 3
Me.Label24.Text = "Correction Factors calculated with VECTO-Engine"
'
'Label25
'
Me.Label25.AutoSize = true
Me.Label25.Location = New System.Drawing.Point(342, 23)
Me.Label25.Name = "Label25"
Me.Label25.Size = New System.Drawing.Size(53, 13)
Me.Label25.TabIndex = 0
Me.Label25.Text = "Motorway"
Me.Label25.TextAlign = System.Drawing.ContentAlignment.TopRight
'
'tbWHRMotorway
'
Me.tbWHRMotorway.Location = New System.Drawing.Point(402, 20)
Me.tbWHRMotorway.Name = "tbWHRMotorway"
Me.tbWHRMotorway.Size = New System.Drawing.Size(57, 20)
Me.tbWHRMotorway.TabIndex = 2
'
'tbWHRUrban
'
Me.tbWHRUrban.Location = New System.Drawing.Point(81, 20)
Me.tbWHRUrban.Name = "tbWHRUrban"
Me.tbWHRUrban.Size = New System.Drawing.Size(57, 20)
Me.tbWHRUrban.TabIndex = 0
'
'tbWHRRural
'
Me.tbWHRRural.Location = New System.Drawing.Point(230, 20)
Me.tbWHRRural.Name = "tbWHRRural"
Me.tbWHRRural.Size = New System.Drawing.Size(57, 20)
Me.tbWHRRural.TabIndex = 1
'
'pnWhrEngineering
'
Me.pnWhrEngineering.Controls.Add(Me.tbWHREngineering)
Me.pnWhrEngineering.Controls.Add(Me.Label26)
Me.pnWhrEngineering.Location = New System.Drawing.Point(4, 99)
Me.pnWhrEngineering.Name = "pnWhrEngineering"
Me.pnWhrEngineering.Size = New System.Drawing.Size(472, 30)
Me.pnWhrEngineering.TabIndex = 9
'
'tbWHREngineering
'
Me.tbWHREngineering.Location = New System.Drawing.Point(194, 3)
Me.tbWHREngineering.Name = "tbWHREngineering"
Me.tbWHREngineering.Size = New System.Drawing.Size(57, 20)
Me.tbWHREngineering.TabIndex = 5
'
'Label26
'
Me.Label26.AutoSize = true
Me.Label26.Location = New System.Drawing.Point(125, 6)
Me.Label26.Name = "Label26"
Me.Label26.Size = New System.Drawing.Size(63, 13)
Me.Label26.TabIndex = 6
Me.Label26.Text = "Engineering"
'
'Label19
'
Me.Label19.AutoSize = true
Me.Label19.Location = New System.Drawing.Point(56, 194)
Me.Label19.Name = "Label19"
Me.Label19.Size = New System.Drawing.Size(61, 13)
Me.Label19.TabIndex = 54
Me.Label19.Text = "WHR Type"
'
'cbWHRType
'
Me.cbWHRType.FormattingEnabled = true
Me.cbWHRType.Location = New System.Drawing.Point(122, 191)
Me.cbWHRType.Name = "cbWHRType"
Me.cbWHRType.Size = New System.Drawing.Size(129, 21)
Me.cbWHRType.TabIndex = 55
'
'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, 488)
Me.ClientSize = New System.Drawing.Size(985, 615)
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)
......@@ -749,6 +934,11 @@ Partial Class EngineForm
Me.PnWhtcEngineering.ResumeLayout(false)
Me.PnWhtcEngineering.PerformLayout
CType(Me.PicBox,System.ComponentModel.ISupportInitialize).EndInit
Me.gbWHR.ResumeLayout(false)
Me.pnWHRDeclaration.ResumeLayout(false)
Me.pnWHRDeclaration.PerformLayout
Me.pnWhrEngineering.ResumeLayout(false)
Me.pnWhrEngineering.PerformLayout
Me.ResumeLayout(false)
Me.PerformLayout
......@@ -819,4 +1009,22 @@ End Sub
Friend WithEvents Label18 As System.Windows.Forms.Label
Friend WithEvents cbFuelType As System.Windows.Forms.ComboBox
Friend WithEvents lblEngineCharacteristics As System.Windows.Forms.Label
Friend WithEvents gbWHR As GroupBox
Friend WithEvents pnWHRDeclaration As Panel
Friend WithEvents tbWHRRegPer As Label
Friend WithEvents TextBox1 As TextBox
Friend WithEvents Label21 As Label
Friend WithEvents tbWHRColdHot As TextBox
Friend WithEvents Label22 As Label
Friend WithEvents Label23 As Label
Friend WithEvents Label24 As Label
Friend WithEvents Label25 As Label
Friend WithEvents tbWHRMotorway As TextBox
Friend WithEvents tbWHRUrban As TextBox
Friend WithEvents tbWHRRural As TextBox
Friend WithEvents pnWhrEngineering As Panel
Friend WithEvents tbWHREngineering As TextBox
Friend WithEvents Label26 As Label
Friend WithEvents Label19 As Label
Friend WithEvents cbWHRType As ComboBox
End Class
......@@ -52,6 +52,9 @@ Public Class EngineForm
PnWhtcDeclaration.Enabled = Cfg.DeclMode
PnWhtcEngineering.Enabled = Not Cfg.DeclMode
pnWHRDeclaration.Enabled = Cfg.DeclMode
pnWhrEngineering.Enabled = Not Cfg.DeclMode
cbFuelType.Items.Clear()
cbFuelType.ValueMember = "Value"
cbFuelType.DisplayMember = "Label"
......@@ -59,6 +62,11 @@ Public Class EngineForm
[Enum].GetValues(GetType(TUGraz.VectoCommon.Models.FuelType)).Cast (Of TUGraz.VectoCommon.Models.FuelType).Select(
Function(type) New With {Key .Value = type, .Label = type.GetLabel()}).ToList()
cbWHRType.Items.Clear()
cbWHRType.ValueMember = "Value"
cbWHRType.DisplayMember = "Label"
cbWHRType.DataSource = [Enum].GetValues(GetType(WHRType)).cast(Of WHRType).select(Function(type) new With {Key .Value = type, .Label = type.GetLabel()}).ToList()
_changed = False
NewEngine()
End Sub
......@@ -80,7 +88,7 @@ Public Class EngineForm
gbxType = gbx.Type
End If
End If
TbInertia.Text = DeclarationData.Engine.EngineInertia((TbDispl.Text.ToDouble(0.0)/1000.0/1000.0).SI (Of CubicMeter),
gbxType).ToGUIFormat()
End Sub
......@@ -160,6 +168,13 @@ Public Class EngineForm
TbWHTCrural.Text = ""
TbWHTCmw.Text = ""
tbWHREngineering.Text = ""
tbWHRColdHot.Text = ""
tbWHRRegPer.Text = ""
tbWHRRural.Text = ""
tbWHRUrban.Text = ""
tbWHRMotorway.Text = ""
DeclInit()
_engFile = ""
......@@ -214,6 +229,21 @@ Public Class EngineForm
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
If (Cfg.DeclMode) then
tbWHRRural.Text = whr.RuralCorrectionFactor.ToGUIFormat()
tbWHRUrban.Text = whr.UrbanCorrectionFactor.ToGUIFormat()
tbWHRMotorway.Text = whr.MotorwayCorrectionFactor.ToGUIFormat()
tbWHRColdHot.Text = whr.BFColdHot.ToGUIFormat()
tbWHRRegPer.Text = whr.CFRegPer.ToGUIFormat()
Else
tbWHREngineering.Text = whr.EngineeringCorrectionFactor.ToGUIFormat()
end if
End If
DeclInit()
EngineFileBrowser.UpdateHistory(file)
......@@ -260,13 +290,21 @@ Public Class EngineForm
engine.WHTCEngineeringInput = TbWHTCEngineering.Text.ToDouble(0)
engine.correctionFactorRegPerInput = tbRegPerCorrFactor.Text.ToDouble(0)
engine.WHRTypeInput = CType(cbWHRType.SelectedValue, WHRType)
engine.WHRUrbanInput = tbWHRUrban.Text.ToDouble(0)
engine.WHRRuralInput = tbWHRRural.Text.ToDouble(0)
engine.WHRMotorwayInput = tbWHRMotorway.Text.ToDouble(0)
engine.WHRColdHotInput = tbWHRColdHot.Text.ToDouble(0)
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, TUGraz.VectoCommon.Models.FuelType)
engine.FuelTypeInput = CType(cbFuelType.SelectedValue, FuelType)
If Not engine.SaveFile Then
MsgBox("Cannot safe to " & file, MsgBoxStyle.Critical)
......@@ -548,4 +586,7 @@ Public Class EngineForm
End If
End Sub
Private Sub cbWHRType_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbWHRType.SelectedIndexChanged
gbWHR.Enabled = CType(CType(sender, ComboBox).SelectedValue, WHRType).IsElectrical()
End Sub
End Class
......@@ -536,7 +536,7 @@ Public Class VectoJobForm
GetRelativePath(driver.Lookahead.CoastingDecisionFactorVelocityDropLookup.Source, _basePath))
End If
tbEngineStopStartThreshold.Text = driver.EngineOffStandStillThreshold.ToGUIFormat()
tbEngineStopStartThreshold.Text = If(driver.EngineOffStandStillThreshold?.ToGUIFormat(), DeclarationData.Driver.MaxEngineOffTimespan.ToGUIFormat())
tbEngineOffThreshold.Text = If(driver.MaxEngineOffTimespan?.ToGUIFormat(), DeclarationData.Driver.MaxEngineOffTimespan.ToGUIFormat())
tbEssUtility.Text = driver.EngineStopStartUtilityFactor.ToGUIFormat()
......
......@@ -93,20 +93,20 @@ Public Class VehicleForm
End If
cbEcoRoll.ValueMember = "Value"
cbEcoRoll.DisplayMember = "Label"
cbEcoRoll.DataSource = [Enum].GetValues(GetType(EcoRollType)).Cast(Of EcoRollType).Select(Function(ecoRoll) new With {Key .Value = ecoRoll, .Label = ecoRoll.GetName()}).ToList()
cbEcoRoll.DisplayMember = "Label"
cbEcoRoll.DataSource = [Enum].GetValues(GetType(EcoRollType)).Cast(Of EcoRollType).Select(Function(ecoRoll) new With {Key .Value = ecoRoll, .Label = ecoRoll.GetName()}).ToList()
cbPcc.ValueMember = "Value"
cbPcc.DisplayMember = "Label"
cbPcc.DataSource = [Enum].GetValues(GetType(PredictiveCruiseControlType)).Cast(Of PredictiveCruiseControlType).Select(Function(pcc) new With {Key .Value = pcc, .Label = pcc.GetName()}).ToList()
cbPcc.ValueMember = "Value"
cbPcc.DisplayMember = "Label"
cbPcc.DataSource = [Enum].GetValues(GetType(PredictiveCruiseControlType)).Cast(Of PredictiveCruiseControlType).Select(Function(pcc) new With {Key .Value = pcc, .Label = pcc.GetName()}).ToList()
cbTankSystem.ValueMember = "Value"
cbTankSystem.DisplayMember = "Label"
cbTankSystem.DataSource = {New With {Key .Value = CType(Nothing, TankSystem?), .Label = ""}}.Concat([Enum].GetValues(GetType(TankSystem)).Cast(Of TankSystem?).Select(Function(ts) New With {Key .Value = ts , .Label = ts.ToString()})).ToList()
cbTankSystem.ValueMember = "Value"
cbTankSystem.DisplayMember = "Label"
cbTankSystem.DataSource = {New With {Key .Value = CType(Nothing, TankSystem?), .Label = ""}}.Concat([Enum].GetValues(GetType(TankSystem)).Cast(Of TankSystem?).Select(Function(ts) New With {Key .Value = ts , .Label = ts.ToString()})).ToList()
tpADAS.Enabled = Cfg.DeclMode
'tpADAS.Enabled = Cfg.DeclMode
CbCat.ValueMember = "Value"
CbCat.DisplayMember = "Label"
......@@ -399,19 +399,16 @@ Public Class VehicleForm
TbRtRatio.Text = retarder.Ratio.ToGUIFormat()
TbRtPath.Text = If(retarder.LossMap Is Nothing, "", GetRelativePath(retarder.LossMap.Source, basePath))
if (vehicle.SavedInDeclarationMode) then
Dim declVehicle as IVehicleDeclarationInputData = vehicle
cbPcc.SelectedValue = declVehicle.ADAS.PredictiveCruiseControl
cbEcoRoll.SelectedValue = declvehicle.ADAS.EcoRoll
cbEngineStopStart.Checked = declVehicle.ADAS.EngineStopStart
if (declVehicle.TankSystem.HasValue) then
cbTankSystem.SelectedValue = declVehicle.TankSystem.Value
End If
Else
cbPcc.SelectedValue = PredictiveCruiseControlType.None
cbEcoRoll.SelectedValue = EcoRollType.None
cbEngineStopStart.Checked = False
End If
cbPcc.SelectedValue = vehicle.ADAS.PredictiveCruiseControl
cbEcoRoll.SelectedValue = vehicle.ADAS.EcoRoll
cbEngineStopStart.Checked = vehicle.ADAS.EngineStopStart
if (vehicle.SavedInDeclarationMode) then
Dim declVehicle as IVehicleDeclarationInputData = vehicle
if (declVehicle.TankSystem.HasValue) then
cbTankSystem.SelectedValue = declVehicle.TankSystem.Value
End If
End If
LvRRC.Items.Clear()
Dim i As Integer = 0
......@@ -539,11 +536,11 @@ Public Class VehicleForm
veh.torqueLimitsList.Add(tl)
Next
veh.EcoRollType = CType(cbEcoRoll.SelectedValue, EcoRollType)
veh.PCC = CType(cbPcc.SelectedValue, PredictiveCruiseControlType)
veh.EngineStop = cbEngineStopStart.Checked
veh.EcoRollType = CType(cbEcoRoll.SelectedValue, EcoRollType)
veh.PCC = CType(cbPcc.SelectedValue, PredictiveCruiseControlType)
veh.EngineStop = cbEngineStopStart.Checked
veh.VehicleTankSystem = CType(If(cbTankSystem.SelectedIndex > 0, cbTankSystem.SelectedValue, nothing), TankSystem?)
veh.VehicleTankSystem = CType(If(cbTankSystem.SelectedIndex > 0, cbTankSystem.SelectedValue, nothing), TankSystem?)
'---------------------------------------------------------------------------------
If Not veh.SaveFile Then
......
......@@ -29,7 +29,7 @@ Imports TUGraz.VectoCore.Utils
''' <remarks></remarks>
<CustomValidation(GetType(Engine), "ValidateEngine")>
Public Class Engine
Implements IEngineEngineeringInputData, IEngineDeclarationInputData, IEngineModeDeclarationInputData, IEngineFuelDelcarationInputData
Implements IEngineEngineeringInputData, IEngineDeclarationInputData, IEngineModeDeclarationInputData, IEngineFuelDelcarationInputData, IWHRData
''' <summary>
''' Current format version
......@@ -114,6 +114,14 @@ Public Class Engine
Public ratedSpeedInput As PerSecond
Public maxTorqueInput As NewtonMeter
public WHRTypeInput As WHRType
Public WHRUrbanInput as Double
public WHRRuralInput As Double
public WHRMotorwayInput As Double
public WHRColdHotInput As Double
public WHRRegPerInput As Double
public WHREngineeringInput As Double
''' <summary>
''' New instance. Initialise
......@@ -258,7 +266,7 @@ Public Class Engine
Else
Dim doa As EngineeringDataAdapter = New EngineeringDataAdapter()
dim dummyVehicle as IVehicleEngineeringInputData = New DummyVehicle() With {
.EngineInputData = engine
.IVehicleComponentsEngineering_EngineInputData = engine
}
engineData = doa.CreateEngineData(dummyVehicle, engine.EngineModes.First())
End If
......@@ -405,7 +413,7 @@ Public Class Engine
Public ReadOnly Property WasteHeatRecoveryData As IWHRData Implements IEngineModeDeclarationInputData.WasteHeatRecoveryData
Get
Return nothing
Return Me
End Get
End Property
......@@ -433,7 +441,13 @@ Public Class Engine
End Get
End Property
Public ReadOnly Property Inertia As KilogramSquareMeter Implements IEngineEngineeringInputData.Inertia
Public ReadOnly Property WHRType As WHRType Implements IEngineDeclarationInputData.WHRType
Get
Return WHRTypeInput
End Get
End Property
Public ReadOnly Property Inertia As KilogramSquareMeter Implements IEngineEngineeringInputData.Inertia
Get
Return EngineInertia.SI(Of KilogramSquareMeter)()
End Get
......@@ -452,10 +466,51 @@ Public Class Engine
End Property
#End Region
Public ReadOnly Property UrbanCorrectionFactor As Double Implements IWHRData.UrbanCorrectionFactor
Get
Return WHRUrbanInput
End Get
End Property
Public ReadOnly Property RuralCorrectionFactor As Double Implements IWHRData.RuralCorrectionFactor
Get
Return WHRRuralInput
End Get
End Property
Public ReadOnly Property MotorwayCorrectionFactor As Double Implements IWHRData.MotorwayCorrectionFactor
get
Return WHRMotorwayInput
End Get
End Property
Public ReadOnly Property BFColdHot As Double Implements IWHRData.BFColdHot
Get
Return WHRColdHotInput
End Get
End Property
Public ReadOnly Property CFRegPer As Double Implements IWHRData.CFRegPer
get
Return WHRRegPerInput
End Get
End Property
Public ReadOnly Property EngineeringCorrectionFactor As Double Implements IWHRData.EngineeringCorrectionFactor
Get
Return WHREngineeringInput
End Get
End Property
Public ReadOnly Property GeneratedElectricPower As TableData Implements IWHRData.GeneratedElectricPower
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
End Class
Public Class DummyVehicle
Implements IVehicleDeclarationInputData, IVehicleComponentsDeclaration, IVehicleEngineeringInputData
Implements IVehicleDeclarationInputData, IVehicleComponentsDeclaration, IVehicleEngineeringInputData, IVehicleComponentsEngineering
Public ReadOnly Property DataSource As DataSource Implements IComponentInputData.DataSource
Public ReadOnly Property SavedInDeclarationMode As Boolean Implements IComponentInputData.SavedInDeclarationMode
Public ReadOnly Property Manufacturer As String Implements IComponentInputData.Manufacturer
......@@ -484,6 +539,10 @@ Public Class DummyVehicle
Public ReadOnly Property TankSystem As TankSystem? Implements IVehicleDeclarationInputData.TankSystem
Public ReadOnly Property IVehicleEngineeringInputData_ADAS As IAdvancedDriverAssistantSystemsEngineering Implements IVehicleEngineeringInputData.ADAS
Public ReadOnly Property IVehicleEngineeringInputData_Components As IVehicleComponentsEngineering Implements IVehicleEngineeringInputData.Components
get
return me
End Get
End Property
Public ReadOnly Property ADAS As IAdvancedDriverAssistantSystemDeclarationInputData Implements IVehicleDeclarationInputData.ADAS
Public ReadOnly Property ZeroEmissionVehicle As Boolean Implements IVehicleDeclarationInputData.ZeroEmissionVehicle
Public ReadOnly Property HybridElectricHDV As Boolean Implements IVehicleDeclarationInputData.HybridElectricHDV
......@@ -502,15 +561,25 @@ Public Class DummyVehicle
End Property
Public ReadOnly Property AirdragInputData As IAirdragDeclarationInputData Implements IVehicleComponentsDeclaration.AirdragInputData
Public Property GearboxInputData As IGearboxDeclarationInputData Implements IVehicleComponentsDeclaration.GearboxInputData
Public ReadOnly Property TorqueConverterInputData As ITorqueConverterDeclarationInputData Implements IVehicleComponentsDeclaration.TorqueConverterInputData
Public ReadOnly Property AxleGearInputData As IAxleGearInputData Implements IVehicleComponentsDeclaration.AxleGearInputData
Public ReadOnly Property AngledriveInputData As IAngledriveInputData Implements IVehicleComponentsDeclaration.AngledriveInputData
Public Property EngineInputData As IEngineDeclarationInputData Implements IVehicleComponentsDeclaration.EngineInputData
Public ReadOnly Property AuxiliaryInputData As IAuxiliariesDeclarationInputData Implements IVehicleComponentsDeclaration.AuxiliaryInputData
Public ReadOnly Property RetarderInputData As IRetarderInputData Implements IVehicleComponentsDeclaration.RetarderInputData
Public ReadOnly Property PTOTransmissionInputData As IPTOTransmissionInputData Implements IVehicleComponentsDeclaration.PTOTransmissionInputData
Public ReadOnly Property AxleWheels As IAxlesDeclarationInputData Implements IVehicleComponentsDeclaration.AxleWheels
Public ReadOnly Property IVehicleComponentsEngineering_GearboxInputData As IGearboxEngineeringInputData Implements IVehicleComponentsEngineering.GearboxInputData
Public ReadOnly Property IVehicleComponentsEngineering_AirdragInputData As IAirdragEngineeringInputData Implements IVehicleComponentsEngineering.AirdragInputData
Public Property GearboxInputData As IGearboxDeclarationInputData Implements IVehicleComponentsDeclaration.GearboxInputData
Public ReadOnly Property IVehicleComponentsEngineering_TorqueConverterInputData As ITorqueConverterEngineeringInputData Implements IVehicleComponentsEngineering.TorqueConverterInputData
Public ReadOnly Property TorqueConverterInputData As ITorqueConverterDeclarationInputData Implements IVehicleComponentsDeclaration.TorqueConverterInputData
Public ReadOnly Property IVehicleComponentsEngineering_AxleGearInputData As IAxleGearInputData Implements IVehicleComponentsEngineering.AxleGearInputData
Public ReadOnly Property AxleGearInputData As IAxleGearInputData Implements IVehicleComponentsDeclaration.AxleGearInputData
Public ReadOnly Property IVehicleComponentsEngineering_AngledriveInputData As IAngledriveInputData Implements IVehicleComponentsEngineering.AngledriveInputData
Public ReadOnly Property AngledriveInputData As IAngledriveInputData Implements IVehicleComponentsDeclaration.AngledriveInputData
Public Property IVehicleComponentsEngineering_EngineInputData As IEngineEngineeringInputData Implements IVehicleComponentsEngineering.EngineInputData
Public Property EngineInputData As IEngineDeclarationInputData Implements IVehicleComponentsDeclaration.EngineInputData
Public ReadOnly Property IVehicleComponentsEngineering_AuxiliaryInputData As IAuxiliariesEngineeringInputData Implements IVehicleComponentsEngineering.AuxiliaryInputData
Public ReadOnly Property AuxiliaryInputData As IAuxiliariesDeclarationInputData Implements IVehicleComponentsDeclaration.AuxiliaryInputData
Public ReadOnly Property IVehicleComponentsEngineering_RetarderInputData As IRetarderInputData Implements IVehicleComponentsEngineering.RetarderInputData
Public ReadOnly Property RetarderInputData As IRetarderInputData Implements IVehicleComponentsDeclaration.RetarderInputData
Public ReadOnly Property IVehicleComponentsEngineering_PTOTransmissionInputData As IPTOTransmissionInputData Implements IVehicleComponentsEngineering.PTOTransmissionInputData
Public ReadOnly Property PTOTransmissionInputData As IPTOTransmissionInputData Implements IVehicleComponentsDeclaration.PTOTransmissionInputData
Public ReadOnly Property IVehicleComponentsEngineering_AxleWheels As IAxlesEngineeringInputData Implements IVehicleComponentsEngineering.AxleWheels
Public ReadOnly Property AxleWheels As IAxlesDeclarationInputData Implements IVehicleComponentsDeclaration.AxleWheels
End Class
......@@ -28,7 +28,7 @@ Imports TUGraz.VectoCore.Utils
<CustomValidation(GetType(Vehicle), "ValidateVehicle")>
Public Class Vehicle
Implements IVehicleEngineeringInputData, IVehicleDeclarationInputData, IRetarderInputData, IPTOTransmissionInputData,
IAngledriveInputData, IAirdragEngineeringInputData, IAdvancedDriverAssistantSystemDeclarationInputData,
IAngledriveInputData, IAirdragEngineeringInputData, IAdvancedDriverAssistantSystemDeclarationInputData, IAdvancedDriverAssistantSystemsEngineering,
IVehicleComponentsEngineering, IVehicleComponentsDeclaration, IAxlesEngineeringInputData, IAxlesDeclarationInputData
Private _filePath As String
......@@ -700,7 +700,7 @@ Public Class Vehicle
Public ReadOnly Property IVehicleEngineeringInputData_ADAS As IAdvancedDriverAssistantSystemsEngineering Implements IVehicleEngineeringInputData.ADAS
get
Return Nothing
Return me
End Get
End Property
......@@ -765,10 +765,18 @@ Public Class Vehicle
End Get
End Property
Public ReadOnly Property IAdvancedDriverAssistantSystemsEngineering_DataSource As DataSource Implements IAdvancedDriverAssistantSystemsEngineering.DataSource
get
Return New DataSource() With {.SourceType = DataSourceType.JSONFile}
End Get
End Property
Public ReadOnly Property IAxlesEngineeringInputData_DataSource As DataSource Implements IAxlesEngineeringInputData.DataSource
get
Return New DataSource() With {.SourceType = DataSourceType.JSONFile}
End Get
End Property
End Class
......@@ -12,7 +12,7 @@ Imports TUGraz.VectoCommon.Utils
Public Class JSONFileWriter
Implements IOutputFileWriter
Public Const EngineFormatVersion As Integer = 4
Public Const EngineFormatVersion As Integer = 5
Public Const GearboxFormatVersion As Integer = 6
......@@ -61,7 +61,21 @@ Public Class JSONFileWriter
body.Add("FuelMap", GetRelativePath(eng.EngineModes.First().Fuels.First().FuelConsumptionMap.Source, Path.GetDirectoryName(filename)))
WriteFile(header, body, filename)
body.add("WHRType", eng.WHRType.ToString())
If (eng.WHRType.IsElectrical()) then
Dim whr As Dictionary(Of String, Object) = New Dictionary(Of String,Object)
Dim whrInput As IWHRData = eng.EngineModes.First().WasteHeatRecoveryData
whr.Add("Urban", whrInput.UrbanCorrectionFactor)
whr.Add("Rural", whrInput.RuralCorrectionFactor)
whr.Add("Motorway", whrInput.MotorwayCorrectionFactor)
whr.Add("ColdHotBalancingFactor", whrInput.BFColdHot)
whr.Add("CFRegPer", whrInput.CFRegPer)
whr.Add("EngineeringCorrectionFactor", whrInput.EngineeringCorrectionFactor)
body.Add("WHRCorrectionFactors", whr)
End If
WriteFile(header, body, filename)
End Sub
Protected Function GetHeader(fileVersion As Integer) As Dictionary(Of String, Object)
......@@ -234,13 +248,11 @@ Public Class JSONFileWriter
If (vehicle.TankSystem.HasValue) Then
body("TankSystem") = vehicle.TankSystem.Value.ToString()
End If
if (Cfg.DeclMode) then
Dim declVehicle As IVehicleDeclarationInputData = vehicle
body("EngineStopStart") = declVehicle.ADAS.EngineStopStart
body("EcoRoll") = declVehicle.ADAS.EcoRoll.ToString()
body("PredictiveCruiseControl") = declVehicle.ADAS.PredictiveCruiseControl.ToString()
End If
body("EngineStopStart") = vehicle.ADAS.EngineStopStart
body("EcoRoll") = vehicle.ADAS.EcoRoll.ToString()
body("PredictiveCruiseControl") = vehicle.ADAS.PredictiveCruiseControl.ToString()
If (Not IsNothing(airdrag.AirDragArea)) Then
body("CdA") = airdrag.AirDragArea.Value()
End If
......
......@@ -36,6 +36,7 @@ using System.Net.NetworkInformation;
using TUGraz.VectoCommon.Exceptions;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Models.Declaration;
namespace TUGraz.VectoCommon.InputData
{
......@@ -493,6 +494,7 @@ namespace TUGraz.VectoCommon.InputData
NewtonMeter MaxTorqueDeclared { get; }
IList<IEngineModeDeclarationInputData> EngineModes { get; }
WHRType WHRType{ get; }
}
......@@ -529,6 +531,8 @@ namespace TUGraz.VectoCommon.InputData
double CFRegPer { get; }
double EngineeringCorrectionFactor { get; }
TableData GeneratedElectricPower { get; }
}
......
......@@ -81,7 +81,7 @@ namespace TUGraz.VectoCommon.InputData
new IAdvancedDriverAssistantSystemsEngineering ADAS { get; }
}
public interface IAdvancedDriverAssistantSystemsEngineering
public interface IAdvancedDriverAssistantSystemsEngineering : IAdvancedDriverAssistantSystemDeclarationInputData
{
DataSource DataSource { get; }
}
......
......@@ -21,5 +21,15 @@ namespace TUGraz.VectoCore.Models.Declaration {
default: throw new ArgumentOutOfRangeException(nameof(whrType), whrType, null);
}
}
public static string GetLabel(this WHRType whrType)
{
return ToXMLFormat(whrType);
}
public static bool IsElectrical(this WHRType whrType)
{
return whrType == WHRType.ElectricalOnly || whrType == WHRType.MechanicalAndElectrical;
}
}
}
\ No newline at end of file
......@@ -84,6 +84,7 @@
<Compile Include="Models\RetarderType.cs" />
<Compile Include="Models\SimulationType.cs" />
<Compile Include="Models\VehicleCategory.cs" />
<Compile Include="Models\WHRType.cs" />
<Compile Include="OutputData\IOutputFileWriter.cs" />
<Compile Include="OutputData\IOutputPlugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
......
......@@ -72,10 +72,84 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
/// }
/// }
/// </code>
public class JSONEngineDataV5 : JSONEngineDataV4, IWHRData
{
#region Overrides of JSONEngineDataV3
public override IWHRData WasteHeatRecoveryData
{
get { return this; }
}
public override WHRType WHRType
{
get { return Body.GetEx<string>("WHRType").ParseEnum<WHRType>(); }
}
#endregion
public JSONEngineDataV5(JObject data, string fileName, bool tolerateMissing = false) : base(
data, fileName, tolerateMissing) { }
#region Implementation of IWHRData
public double UrbanCorrectionFactor
{
get { return Body["WHRCorrectionFactors"]?["Urban"]?.ToString().ToDouble() ?? 1.0; }
}
public double RuralCorrectionFactor
{
get { return Body["WHRCorrectionFactors"]?["Rural"]?.ToString().ToDouble() ?? 1.0; }
}
public double MotorwayCorrectionFactor
{
get { return Body["WHRCorrectionFactors"]?["Motorway"]?.ToString().ToDouble() ?? 1.0; }
}
public double BFColdHot
{
get { return Body["WHRCorrectionFactors"]?["ColdHotBalancingFactor"]?.ToString().ToDouble() ?? 1.0; }
}
public double CFRegPer
{
get { return Body["WHRCorrectionFactors"]?["CFRegPer"]?.ToString().ToDouble() ?? 1.0; }
}
public double EngineeringCorrectionFactor
{
get { return Body["WHRCorrectionFactors"]?["EngineeringCorrectionFactor"]?.ToString().ToDouble() ?? 1.0; }
}
public TableData GeneratedElectricPower
{
get {
try {
return ReadTableData(Body.GetEx<string>(JsonKeys.Engine_FuelConsumptionMap), "FuelConsumptionMap");
} catch (Exception) {
if (!TolerateMissing) {
throw;
}
return
new TableData(
Path.Combine(BasePath, Body[JsonKeys.Engine_FuelConsumptionMap].ToString()) + MissingFileSuffix,
DataSourceType.Missing);
}
}
}
#endregion
}
public class JSONEngineDataV4 : JSONEngineDataV3
{
public JSONEngineDataV4(JObject data, string fileName, bool tolerateMissing = false)
: base(data, fileName, tolerateMissing) {}
: base(data, fileName, tolerateMissing) { }
public override Watt RatedPowerDeclared
{
......@@ -105,14 +179,16 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
}
public class JSONEngineDataV3 : JSONFile, IEngineEngineeringInputData, IEngineModeDeclarationInputData, IEngineFuelDelcarationInputData
public class JSONEngineDataV3 : JSONFile, IEngineEngineeringInputData, IEngineModeDeclarationInputData,
IEngineFuelDelcarationInputData
{
public JSONEngineDataV3(JObject data, string fileName, bool tolerateMissing = false)
: base(data, fileName, tolerateMissing) {}
: base(data, fileName, tolerateMissing) { }
public virtual CubicMeter Displacement
{
get { return Body.GetEx<double>(JsonKeys.Engine_Displacement).SI(Unit.SI.Cubic.Centi.Meter).Cast<CubicMeter>(); }
get { return Body.GetEx<double>(JsonKeys.Engine_Displacement).SI(Unit.SI.Cubic.Centi.Meter).Cast<CubicMeter>(); }
// convert vom ccm to m^3}
}
......@@ -136,8 +212,10 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
if (!TolerateMissing) {
throw;
}
return
new TableData(Path.Combine(BasePath, Body[JsonKeys.Engine_FuelConsumptionMap].ToString()) + MissingFileSuffix,
new TableData(
Path.Combine(BasePath, Body[JsonKeys.Engine_FuelConsumptionMap].ToString()) + MissingFileSuffix,
DataSourceType.Missing);
}
}
......@@ -152,6 +230,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
if (!TolerateMissing) {
throw;
}
return new TableData(
Path.Combine(BasePath, Body[JsonKeys.Engine_FullLoadCurveFile].ToString()) + MissingFileSuffix,
DataSourceType.Missing);
......@@ -159,9 +238,15 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
}
}
public virtual IList<IEngineFuelDelcarationInputData> Fuels { get { return new IEngineFuelDelcarationInputData[] { this }; } }
public virtual IList<IEngineFuelDelcarationInputData> Fuels
{
get { return new IEngineFuelDelcarationInputData[] { this }; }
}
public virtual IWHRData WasteHeatRecoveryData { get { return null; } }
public virtual IWHRData WasteHeatRecoveryData
{
get { return null; }
}
public virtual Watt RatedPowerDeclared
{
......@@ -178,7 +263,15 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
get { return 0.SI<NewtonMeter>(); }
}
public IList<IEngineModeDeclarationInputData> EngineModes { get { return new IEngineModeDeclarationInputData[] { this }; } }
public virtual IList<IEngineModeDeclarationInputData> EngineModes
{
get { return new IEngineModeDeclarationInputData[] { this }; }
}
public virtual WHRType WHRType
{
get { return WHRType.None; }
}
public virtual KilogramSquareMeter Inertia
{
......@@ -191,6 +284,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
if (Body["WHTC-Engineering"] == null) {
return 1;
}
return Body.GetEx<double>("WHTC-Engineering");
}
}
......@@ -221,6 +315,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
if (Body["ColdHotBalancingFactor"] == null) {
return 1.0;
}
return Body.GetEx<double>("ColdHotBalancingFactor");
}
}
......@@ -230,36 +325,36 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
get { return 1; }
}
public string Manufacturer
public virtual string Manufacturer
{
get { return Constants.NOT_AVailABLE; }
}
public string Model
public virtual string Model
{
get { return Body.GetEx<string>(JsonKeys.Engine_ModelName); }
}
public string Date
public virtual string Date
{
get { return Constants.NOT_AVailABLE; }
}
public CertificationMethod CertificationMethod
public virtual CertificationMethod CertificationMethod
{
get { return CertificationMethod.NotCertified; }
}
public string CertificationNumber
public virtual string CertificationNumber
{
get { return Constants.NOT_AVailABLE; }
}
public DigestData DigestValue
public virtual DigestData DigestValue
{
get { return null; }
}
}
}
\ No newline at end of file
}
......@@ -75,6 +75,8 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
return new JSONVTPInputDataV4(json, filename, tolerateMissing);
}
return new JSONInputDataV4(json, filename, tolerateMissing);
case 5:
return new JSONInputDataV5(json, filename, tolerateMissing);
default:
throw new VectoException("Job-File: Unsupported FileVersion. Got: {0} ", version);
}
......@@ -117,6 +119,8 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
return new JSONEngineDataV3(json, filename, tolerateMissing);
case 4:
return new JSONEngineDataV4(json, filename, tolerateMissing);
case 5:
return new JSONEngineDataV5(json, filename, tolerateMissing);
default:
throw new VectoException("Engine-File: Unsupported FileVersion. Got {0}", version);
}
......
......@@ -76,7 +76,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
public class JSONVehicleDataV7 : JSONFile, IVehicleEngineeringInputData, IRetarderInputData, IAngledriveInputData,
IPTOTransmissionInputData, IAirdragEngineeringInputData, IAdvancedDriverAssistantSystemDeclarationInputData, IVehicleComponentsDeclaration, IVehicleComponentsEngineering, IAxlesEngineeringInputData, IAxlesDeclarationInputData
IPTOTransmissionInputData, IAirdragEngineeringInputData, IAdvancedDriverAssistantSystemDeclarationInputData, IVehicleComponentsDeclaration, IVehicleComponentsEngineering, IAxlesEngineeringInputData, IAxlesDeclarationInputData, IAdvancedDriverAssistantSystemsEngineering
{
public JSONVehicleDataV7(JObject data, string fileName, IJSONVehicleComponents job, bool tolerateMissing = false)
: base(data, fileName, tolerateMissing)
......@@ -168,7 +168,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
IAdvancedDriverAssistantSystemsEngineering IVehicleEngineeringInputData.ADAS
{
get { return null; }
get { return this; }
}
public virtual AxleConfiguration AxleConfiguration
......
......@@ -10,6 +10,7 @@ using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Resources;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.InputData.FileIO.XML.Declaration.Interfaces;
using TUGraz.VectoCore.Models.Declaration;
using TUGraz.VectoCore.Utils;
namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider
......@@ -60,7 +61,9 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider
(_engineModes = new List<IEngineModeDeclarationInputData>() { new XMLSingleFuelEngineMode(BaseNode) });
}
}
public virtual WHRType WHRType { get { return WHRType.None; } }
public class XMLSingleFuelEngineMode : AbstractXMLType, IEngineModeDeclarationInputData
{
......@@ -243,6 +246,14 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider
}
}
public override WHRType WHRType
{
get { return GetString(XMLNames.Engine_WHRType).ParseEnum<WHRType>(); }
}
#endregion
public class XMLDualFuelEngineMode : XMLSingleFuelEngineMode
......@@ -348,13 +359,9 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider
{
protected TableData WHRPower;
public XMLWHRData(XmlNode whrFuelNode) : base(whrFuelNode)
{
}
public XMLWHRData(XmlNode whrFuelNode) : base(whrFuelNode) { }
public XMLWHRData() :base(null)
{
}
public XMLWHRData() :base(null) { }
#region Implementation of IWHRData
......@@ -363,6 +370,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider
public double MotorwayCorrectionFactor { get { return GetDouble(new[] { XMLNames.Engine_WHRCorrectionFactors, XMLNames.Engine_WHRCorrectionFactors_Motorway}, 1); } }
public double BFColdHot { get { return GetDouble(new[] { XMLNames.Engine_WHRCorrectionFactors, XMLNames.Engine_WHRCorrectionFactors_BFColdHot}, 1); } }
public double CFRegPer { get { return GetDouble(new[] { XMLNames.Engine_WHRCorrectionFactors, XMLNames.Engine_WHRCorrectionFactors_CFRegPer}, 1); } }
public double EngineeringCorrectionFactor { get { return 1.0; } }
public TableData GeneratedElectricPower
{
......
......@@ -2,6 +2,7 @@ using System;
using System.Data;
using System.Linq;
using TUGraz.VectoCommon.Exceptions;
using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine;
......@@ -20,18 +21,21 @@ namespace TUGraz.VectoCore.InputData.Reader.ComponentData {
}
}
public static WHRPowerMap Create(DataTable data)
public static WHRPowerMap Create(TableData data)
{
var headerValid = HeaderIsValid(data.Columns);
if (!headerValid) {
LoggingObject.Logger<FuelConsumptionMap>().Warn(
"FuelConsumptionMap: Header Line is not valid. Expected: '{0}, {1}, {2}', Got: {3}",
"WHRMap: Header Line is not valid. Expected: '{0}, {1}, {2}', Got: {3}",
Fields.EngineSpeed, Fields.Torque, Fields.ElectricPower,
string.Join(", ", data.Columns.Cast<DataColumn>().Select(c => c.ColumnName)));
}
var delaunayMap = new DelaunayMap("FuelConsumptionMap");
var delaunayMap = new DelaunayMap("WHRMap");
if (!headerValid) {
if (data.SourceType == DataSourceType.CSVFile && data.Columns.Count < 4) {
throw new VectoException("FC-Map has to contain at least 4 columns when WHR is used");
}
data.Columns[0].ColumnName = Fields.EngineSpeed;
data.Columns[1].ColumnName = Fields.Torque;
// column with idx==2 is fuel consumption in csv files
......
......@@ -61,6 +61,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
retVal.TrailerGrossVehicleWeight = 0.SI<Kilogram>();
retVal.Loading = data.Loading;
retVal.DynamicTyreRadius = data.DynamicTyreRadius;
retVal.ADAS = CreateADAS(data.ADAS);
var axles = data.Components.AxleWheels.AxlesEngineering;
retVal.AxleData = axles.Select(
......@@ -78,7 +79,15 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
return retVal;
}
private VehicleData.ADASData CreateADAS(IAdvancedDriverAssistantSystemsEngineering adas)
{
return new VehicleData.ADASData {
EngineStopStart = adas.EngineStopStart,
EcoRoll = adas.EcoRoll,
PredictiveCruiseControl = adas.PredictiveCruiseControl
};
}
public AirdragData CreateAirdragData(IAirdragEngineeringInputData airdragData, IVehicleEngineeringInputData data)
{
......@@ -185,12 +194,35 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
retVal.FullLoadCurves = fullLoadCurves;
var whr = CreateWHRData(engineMode.WasteHeatRecoveryData);
if (whr != null) {
whr.WHRCorrectionFactor = engineMode.WasteHeatRecoveryData.EngineeringCorrectionFactor;
}
retVal.WHRType = engine.WHRType;
retVal.WHRData = whr;
//foreach (var fuelEntry in retVal.Fuels) {
//retVal.Fuels[0].FuelConsumptionCorrectionFactor = engine.WHTCEngineering;
return retVal;
}
private WHRData CreateWHRData(IWHRData whrInputData)
{
if (whrInputData == null || whrInputData.GeneratedElectricPower == null) {
return null;
}
return new WHRData() {
CFUrban = 1,
CFRural = 1,
CFMotorway = 1,
CFColdHot = 1,
CFRegPer = 1,
WHRMap = WHRPowerReader.Create(whrInputData.GeneratedElectricPower)
};
}
internal CombustionEngineData CreateEngineData(IEngineEngineeringInputData engine, IEngineModeDeclarationInputData engineMode)
{
......
......@@ -254,7 +254,6 @@
<Compile Include="InputData\FileIO\XML\Declaration\IXMLDeclarationInputDataReader.cs" />
<Compile Include="InputData\FileIO\XML\IXMLInputDataReader.cs" />
<Compile Include="InputData\FileIO\XML\XMLInputDataNinjectModule.cs" />
<Compile Include="Models\Declaration\WHRType.cs" />
<Compile Include="Models\SimulationComponent\Data\Engine\WHRPowerMap.cs" />
<Compile Include="InputData\Reader\ComponentData\WHRPowerReader.cs" />
<Compile Include="Models\SimulationComponent\Impl\StopStartCombustionEngine.cs" />
......
......@@ -74,6 +74,7 @@ namespace TUGraz.VectoCore.Tests.Utils
public PerSecond RatedSpeedDeclared { get; set; }
public NewtonMeter MaxTorqueDeclared { get; set; }
public IList<IEngineModeDeclarationInputData> EngineModes { get { return new[] { this }.Cast<IEngineModeDeclarationInputData>().ToList(); } }
public WHRType WHRType { get; }
public KilogramSquareMeter Inertia { get; set; }
public double WHTCEngineering { get; set; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment