diff --git a/VECTO/GUI/GearboxForm.Designer.vb b/VECTO/GUI/GearboxForm.Designer.vb index 901b8a8908c683148be57dca90c603fa3cc064d9..6181ea768631ef36e69778e3963e5de0102bb544 100644 --- a/VECTO/GUI/GearboxForm.Designer.vb +++ b/VECTO/GUI/GearboxForm.Designer.vb @@ -57,6 +57,7 @@ Partial Class GearboxForm Me.ColumnHeader3 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) Me.ColumnHeader5 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) Me.ColumnHeader6 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) + Me.ColumnHeader7 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) Me.TBI_getr = New System.Windows.Forms.TextBox() Me.Label49 = New System.Windows.Forms.Label() Me.Label33 = New System.Windows.Forms.Label() @@ -99,22 +100,10 @@ Partial Class GearboxForm Me.OpenWithToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ShowInFolderToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.gbTC = New System.Windows.Forms.GroupBox() - Me.Label26 = New System.Windows.Forms.Label() - Me.TBTCShiftPolygon = New System.Windows.Forms.TextBox() - Me.tbTCmaxSpeed = New System.Windows.Forms.TextBox() - Me.TbTCrefrpm = New System.Windows.Forms.TextBox() Me.BtTCfileOpen = New System.Windows.Forms.Button() Me.TbTCfile = New System.Windows.Forms.TextBox() - Me.Label27 = New System.Windows.Forms.Label() Me.BtTCfileBrowse = New System.Windows.Forms.Button() - Me.Label14 = New System.Windows.Forms.Label() - Me.BtTCShiftFileBrowse = New System.Windows.Forms.Button() - Me.Label1 = New System.Windows.Forms.Label() - Me.TbTCinertia = New System.Windows.Forms.TextBox() Me.Label17 = New System.Windows.Forms.Label() - Me.Label15 = New System.Windows.Forms.Label() - Me.Label18 = New System.Windows.Forms.Label() - Me.LblTCShiftFile = New System.Windows.Forms.Label() Me.tbTCLUpshiftMinAcceleration = New System.Windows.Forms.TextBox() Me.Label30 = New System.Windows.Forms.Label() Me.Label31 = New System.Windows.Forms.Label() @@ -136,7 +125,19 @@ Partial Class GearboxForm Me.lblGbxInfo = New System.Windows.Forms.Label() Me.btnExportXML = New System.Windows.Forms.Button() Me.btnExportAxlGearXML = New System.Windows.Forms.Button() - Me.ColumnHeader7 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) + Me.pnTcEngineering = New System.Windows.Forms.Panel() + Me.Label26 = New System.Windows.Forms.Label() + Me.TBTCShiftPolygon = New System.Windows.Forms.TextBox() + Me.tbTCmaxSpeed = New System.Windows.Forms.TextBox() + Me.TbTCrefrpm = New System.Windows.Forms.TextBox() + Me.Label27 = New System.Windows.Forms.Label() + Me.Label14 = New System.Windows.Forms.Label() + Me.BtTCShiftFileBrowse = New System.Windows.Forms.Button() + Me.Label1 = New System.Windows.Forms.Label() + Me.TbTCinertia = New System.Windows.Forms.TextBox() + Me.Label15 = New System.Windows.Forms.Label() + Me.Label18 = New System.Windows.Forms.Label() + Me.LblTCShiftFile = New System.Windows.Forms.Label() Me.ToolStrip1.SuspendLayout() Me.StatusStrip1.SuspendLayout() CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit() @@ -151,6 +152,7 @@ Partial Class GearboxForm CType(Me.PicBox, System.ComponentModel.ISupportInitialize).BeginInit() Me.gbPowershiftLosses.SuspendLayout() Me.gbTCAccMin.SuspendLayout() + Me.pnTcEngineering.SuspendLayout() Me.SuspendLayout() ' 'ToolStrip1 @@ -316,6 +318,11 @@ Partial Class GearboxForm Me.ColumnHeader6.Text = "Max Torque" Me.ColumnHeader6.Width = 78 ' + 'ColumnHeader7 + ' + Me.ColumnHeader7.Text = "Max Speed" + Me.ColumnHeader7.Width = 76 + ' 'TBI_getr ' Me.TBI_getr.Location = New System.Drawing.Point(78, 3) @@ -692,22 +699,11 @@ Partial Class GearboxForm ' 'gbTC ' - Me.gbTC.Controls.Add(Me.Label26) - Me.gbTC.Controls.Add(Me.TBTCShiftPolygon) - Me.gbTC.Controls.Add(Me.tbTCmaxSpeed) - Me.gbTC.Controls.Add(Me.TbTCrefrpm) + Me.gbTC.Controls.Add(Me.pnTcEngineering) Me.gbTC.Controls.Add(Me.BtTCfileOpen) Me.gbTC.Controls.Add(Me.TbTCfile) - Me.gbTC.Controls.Add(Me.Label27) Me.gbTC.Controls.Add(Me.BtTCfileBrowse) - Me.gbTC.Controls.Add(Me.Label14) - Me.gbTC.Controls.Add(Me.BtTCShiftFileBrowse) - Me.gbTC.Controls.Add(Me.Label1) - Me.gbTC.Controls.Add(Me.TbTCinertia) Me.gbTC.Controls.Add(Me.Label17) - Me.gbTC.Controls.Add(Me.Label15) - Me.gbTC.Controls.Add(Me.Label18) - Me.gbTC.Controls.Add(Me.LblTCShiftFile) Me.gbTC.Location = New System.Drawing.Point(459, 377) Me.gbTC.Name = "gbTC" Me.gbTC.Size = New System.Drawing.Size(414, 162) @@ -715,39 +711,6 @@ Partial Class GearboxForm Me.gbTC.TabStop = False Me.gbTC.Text = "Torque Converter" ' - 'Label26 - ' - Me.Label26.AutoSize = True - Me.Label26.Location = New System.Drawing.Point(6, 93) - Me.Label26.Name = "Label26" - Me.Label26.Size = New System.Drawing.Size(64, 13) - Me.Label26.TabIndex = 38 - Me.Label26.Text = "Max. Speed" - ' - 'TBTCShiftPolygon - ' - Me.TBTCShiftPolygon.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.TBTCShiftPolygon.Location = New System.Drawing.Point(9, 134) - Me.TBTCShiftPolygon.Name = "TBTCShiftPolygon" - Me.TBTCShiftPolygon.Size = New System.Drawing.Size(349, 20) - Me.TBTCShiftPolygon.TabIndex = 37 - ' - 'tbTCmaxSpeed - ' - Me.tbTCmaxSpeed.Location = New System.Drawing.Point(80, 90) - Me.tbTCmaxSpeed.Name = "tbTCmaxSpeed" - Me.tbTCmaxSpeed.Size = New System.Drawing.Size(57, 20) - Me.tbTCmaxSpeed.TabIndex = 40 - ' - 'TbTCrefrpm - ' - Me.TbTCrefrpm.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.TbTCrefrpm.Location = New System.Drawing.Point(301, 64) - Me.TbTCrefrpm.Name = "TbTCrefrpm" - Me.TbTCrefrpm.Size = New System.Drawing.Size(57, 20) - Me.TbTCrefrpm.TabIndex = 4 - ' 'BtTCfileOpen ' Me.BtTCfileOpen.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) @@ -768,15 +731,6 @@ Partial Class GearboxForm Me.TbTCfile.Size = New System.Drawing.Size(349, 20) Me.TbTCfile.TabIndex = 0 ' - 'Label27 - ' - Me.Label27.AutoSize = True - Me.Label27.Location = New System.Drawing.Point(143, 93) - Me.Label27.Name = "Label27" - Me.Label27.Size = New System.Drawing.Size(30, 13) - Me.Label27.TabIndex = 39 - Me.Label27.Text = "[rpm]" - ' 'BtTCfileBrowse ' Me.BtTCfileBrowse.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) @@ -788,43 +742,6 @@ Partial Class GearboxForm Me.BtTCfileBrowse.TabStop = False Me.BtTCfileBrowse.UseVisualStyleBackColor = True ' - 'Label14 - ' - Me.Label14.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.Label14.AutoSize = True - Me.Label14.Location = New System.Drawing.Point(362, 67) - Me.Label14.Name = "Label14" - Me.Label14.Size = New System.Drawing.Size(40, 13) - Me.Label14.TabIndex = 0 - Me.Label14.Text = "[1/min]" - ' - 'BtTCShiftFileBrowse - ' - Me.BtTCShiftFileBrowse.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.BtTCShiftFileBrowse.Image = Global.TUGraz.VECTO.My.Resources.Resources.Open_icon - Me.BtTCShiftFileBrowse.Location = New System.Drawing.Point(359, 132) - Me.BtTCShiftFileBrowse.Name = "BtTCShiftFileBrowse" - Me.BtTCShiftFileBrowse.Size = New System.Drawing.Size(24, 24) - Me.BtTCShiftFileBrowse.TabIndex = 5 - Me.BtTCShiftFileBrowse.TabStop = False - Me.BtTCShiftFileBrowse.UseVisualStyleBackColor = True - ' - 'Label1 - ' - Me.Label1.AutoSize = True - Me.Label1.Location = New System.Drawing.Point(143, 67) - Me.Label1.Name = "Label1" - Me.Label1.Size = New System.Drawing.Size(36, 13) - Me.Label1.TabIndex = 2 - Me.Label1.Text = "[kgm²]" - ' - 'TbTCinertia - ' - Me.TbTCinertia.Location = New System.Drawing.Point(80, 64) - Me.TbTCinertia.Name = "TbTCinertia" - Me.TbTCinertia.Size = New System.Drawing.Size(57, 20) - Me.TbTCinertia.TabIndex = 3 - ' 'Label17 ' Me.Label17.AutoSize = True @@ -834,34 +751,6 @@ Partial Class GearboxForm Me.Label17.TabIndex = 0 Me.Label17.Text = "Torque converter characteristics file (.vtcc)" ' - 'Label15 - ' - Me.Label15.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.Label15.AutoSize = True - Me.Label15.Location = New System.Drawing.Point(218, 67) - Me.Label15.Name = "Label15" - Me.Label15.Size = New System.Drawing.Size(77, 13) - Me.Label15.TabIndex = 0 - Me.Label15.Text = "Reference rpm" - ' - 'Label18 - ' - Me.Label18.AutoSize = True - Me.Label18.Location = New System.Drawing.Point(6, 67) - Me.Label18.Name = "Label18" - Me.Label18.Size = New System.Drawing.Size(36, 13) - Me.Label18.TabIndex = 2 - Me.Label18.Text = "Inertia" - ' - 'LblTCShiftFile - ' - Me.LblTCShiftFile.AutoSize = True - Me.LblTCShiftFile.Location = New System.Drawing.Point(6, 119) - Me.LblTCShiftFile.Name = "LblTCShiftFile" - Me.LblTCShiftFile.Size = New System.Drawing.Size(207, 13) - Me.LblTCShiftFile.TabIndex = 5 - Me.LblTCShiftFile.Text = "Torque converter shift polygons file (.vgbs)" - ' 'tbTCLUpshiftMinAcceleration ' Me.tbTCLUpshiftMinAcceleration.Location = New System.Drawing.Point(78, 19) @@ -1062,10 +951,131 @@ Partial Class GearboxForm Me.btnExportAxlGearXML.Text = "Exp. AxlGear as XML" Me.btnExportAxlGearXML.UseVisualStyleBackColor = True ' - 'ColumnHeader7 + 'pnTcEngineering + ' + Me.pnTcEngineering.Controls.Add(Me.Label26) + Me.pnTcEngineering.Controls.Add(Me.TBTCShiftPolygon) + Me.pnTcEngineering.Controls.Add(Me.tbTCmaxSpeed) + Me.pnTcEngineering.Controls.Add(Me.TbTCrefrpm) + Me.pnTcEngineering.Controls.Add(Me.Label27) + Me.pnTcEngineering.Controls.Add(Me.Label14) + Me.pnTcEngineering.Controls.Add(Me.BtTCShiftFileBrowse) + Me.pnTcEngineering.Controls.Add(Me.Label1) + Me.pnTcEngineering.Controls.Add(Me.TbTCinertia) + Me.pnTcEngineering.Controls.Add(Me.Label15) + Me.pnTcEngineering.Controls.Add(Me.Label18) + Me.pnTcEngineering.Controls.Add(Me.LblTCShiftFile) + Me.pnTcEngineering.Location = New System.Drawing.Point(7, 63) + Me.pnTcEngineering.Name = "pnTcEngineering" + Me.pnTcEngineering.Size = New System.Drawing.Size(399, 93) + Me.pnTcEngineering.TabIndex = 3 ' - Me.ColumnHeader7.Text = "Max Speed" - Me.ColumnHeader7.Width = 76 + 'Label26 + ' + Me.Label26.AutoSize = True + Me.Label26.Location = New System.Drawing.Point(1, 29) + Me.Label26.Name = "Label26" + Me.Label26.Size = New System.Drawing.Size(64, 13) + Me.Label26.TabIndex = 50 + Me.Label26.Text = "Max. Speed" + ' + 'TBTCShiftPolygon + ' + Me.TBTCShiftPolygon.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.TBTCShiftPolygon.Location = New System.Drawing.Point(4, 70) + Me.TBTCShiftPolygon.Name = "TBTCShiftPolygon" + Me.TBTCShiftPolygon.Size = New System.Drawing.Size(349, 20) + Me.TBTCShiftPolygon.TabIndex = 49 + ' + 'tbTCmaxSpeed + ' + Me.tbTCmaxSpeed.Location = New System.Drawing.Point(75, 26) + Me.tbTCmaxSpeed.Name = "tbTCmaxSpeed" + Me.tbTCmaxSpeed.Size = New System.Drawing.Size(57, 20) + Me.tbTCmaxSpeed.TabIndex = 52 + ' + 'TbTCrefrpm + ' + Me.TbTCrefrpm.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.TbTCrefrpm.Location = New System.Drawing.Point(296, 0) + Me.TbTCrefrpm.Name = "TbTCrefrpm" + Me.TbTCrefrpm.Size = New System.Drawing.Size(57, 20) + Me.TbTCrefrpm.TabIndex = 46 + ' + 'Label27 + ' + Me.Label27.AutoSize = True + Me.Label27.Location = New System.Drawing.Point(138, 29) + Me.Label27.Name = "Label27" + Me.Label27.Size = New System.Drawing.Size(30, 13) + Me.Label27.TabIndex = 51 + Me.Label27.Text = "[rpm]" + ' + 'Label14 + ' + Me.Label14.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.Label14.AutoSize = True + Me.Label14.Location = New System.Drawing.Point(357, 3) + Me.Label14.Name = "Label14" + Me.Label14.Size = New System.Drawing.Size(40, 13) + Me.Label14.TabIndex = 41 + Me.Label14.Text = "[1/min]" + ' + 'BtTCShiftFileBrowse + ' + Me.BtTCShiftFileBrowse.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.BtTCShiftFileBrowse.Image = Global.TUGraz.VECTO.My.Resources.Resources.Open_icon + Me.BtTCShiftFileBrowse.Location = New System.Drawing.Point(354, 68) + Me.BtTCShiftFileBrowse.Name = "BtTCShiftFileBrowse" + Me.BtTCShiftFileBrowse.Size = New System.Drawing.Size(24, 24) + Me.BtTCShiftFileBrowse.TabIndex = 47 + Me.BtTCShiftFileBrowse.TabStop = False + Me.BtTCShiftFileBrowse.UseVisualStyleBackColor = True + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Location = New System.Drawing.Point(138, 3) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(36, 13) + Me.Label1.TabIndex = 43 + Me.Label1.Text = "[kgm²]" + ' + 'TbTCinertia + ' + Me.TbTCinertia.Location = New System.Drawing.Point(75, 0) + Me.TbTCinertia.Name = "TbTCinertia" + Me.TbTCinertia.Size = New System.Drawing.Size(57, 20) + Me.TbTCinertia.TabIndex = 45 + ' + 'Label15 + ' + Me.Label15.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.Label15.AutoSize = True + Me.Label15.Location = New System.Drawing.Point(213, 3) + Me.Label15.Name = "Label15" + Me.Label15.Size = New System.Drawing.Size(77, 13) + Me.Label15.TabIndex = 42 + Me.Label15.Text = "Reference rpm" + ' + 'Label18 + ' + Me.Label18.AutoSize = True + Me.Label18.Location = New System.Drawing.Point(1, 3) + Me.Label18.Name = "Label18" + Me.Label18.Size = New System.Drawing.Size(36, 13) + Me.Label18.TabIndex = 44 + Me.Label18.Text = "Inertia" + ' + 'LblTCShiftFile + ' + Me.LblTCShiftFile.AutoSize = True + Me.LblTCShiftFile.Location = New System.Drawing.Point(1, 55) + Me.LblTCShiftFile.Name = "LblTCShiftFile" + Me.LblTCShiftFile.Size = New System.Drawing.Size(207, 13) + Me.LblTCShiftFile.TabIndex = 48 + Me.LblTCShiftFile.Text = "Torque converter shift polygons file (.vgbs)" ' 'GearboxForm ' @@ -1124,6 +1134,8 @@ Partial Class GearboxForm Me.gbPowershiftLosses.PerformLayout() Me.gbTCAccMin.ResumeLayout(False) Me.gbTCAccMin.PerformLayout() + Me.pnTcEngineering.ResumeLayout(False) + Me.pnTcEngineering.PerformLayout() Me.ResumeLayout(False) Me.PerformLayout() @@ -1179,9 +1191,6 @@ Partial Class GearboxForm Friend WithEvents TbTCfile As TextBox Friend WithEvents BtTCfileBrowse As Button Friend WithEvents BtTCfileOpen As Button - Friend WithEvents TbTCrefrpm As TextBox - Friend WithEvents Label14 As Label - Friend WithEvents Label15 As Label Friend WithEvents Label16 As Label Friend WithEvents CbGStype As ComboBox Friend WithEvents Label17 As Label @@ -1193,9 +1202,6 @@ Partial Class GearboxForm Friend WithEvents PnInertiaTI As Panel Friend WithEvents ColumnHeader5 As ColumnHeader Friend WithEvents PicBox As PictureBox - Friend WithEvents TbTCinertia As TextBox - Friend WithEvents Label1 As Label - Friend WithEvents Label18 As Label Friend WithEvents ColumnHeader6 As ColumnHeader Friend WithEvents GroupBox1 As GroupBox Friend WithEvents tbUpshiftMinAcceleration As TextBox @@ -1207,13 +1213,7 @@ Partial Class GearboxForm Friend WithEvents Label21 As Label Friend WithEvents Label20 As Label Friend WithEvents Label19 As Label - Friend WithEvents BtTCShiftFileBrowse As Button - Friend WithEvents LblTCShiftFile As Label - Friend WithEvents TBTCShiftPolygon As TextBox Friend WithEvents Label25 As System.Windows.Forms.Label - Friend WithEvents Label26 As System.Windows.Forms.Label - Friend WithEvents tbTCmaxSpeed As System.Windows.Forms.TextBox - Friend WithEvents Label27 As System.Windows.Forms.Label Friend WithEvents gbPowershiftLosses As System.Windows.Forms.GroupBox Friend WithEvents Label28 As System.Windows.Forms.Label Friend WithEvents tbATShiftTime As System.Windows.Forms.TextBox @@ -1229,4 +1229,17 @@ Partial Class GearboxForm Friend WithEvents btnExportXML As System.Windows.Forms.Button Friend WithEvents btnExportAxlGearXML As System.Windows.Forms.Button Friend WithEvents ColumnHeader7 As System.Windows.Forms.ColumnHeader + Friend WithEvents pnTcEngineering As System.Windows.Forms.Panel + Friend WithEvents Label26 As System.Windows.Forms.Label + Friend WithEvents TBTCShiftPolygon As System.Windows.Forms.TextBox + Friend WithEvents tbTCmaxSpeed As System.Windows.Forms.TextBox + Friend WithEvents TbTCrefrpm As System.Windows.Forms.TextBox + Friend WithEvents Label27 As System.Windows.Forms.Label + Friend WithEvents Label14 As System.Windows.Forms.Label + Friend WithEvents BtTCShiftFileBrowse As System.Windows.Forms.Button + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents TbTCinertia As System.Windows.Forms.TextBox + Friend WithEvents Label15 As System.Windows.Forms.Label + Friend WithEvents Label18 As System.Windows.Forms.Label + Friend WithEvents LblTCShiftFile As System.Windows.Forms.Label End Class diff --git a/VECTO/GUI/GearboxForm.vb b/VECTO/GUI/GearboxForm.vb index e3595d6bfcc1a3a9c7c455c5980a6dc293d70a83..d2e992bdec8dd65118bf8bfd028db0993fcf1885 100644 --- a/VECTO/GUI/GearboxForm.vb +++ b/VECTO/GUI/GearboxForm.vb @@ -73,18 +73,17 @@ Public Class GearboxForm CbGStype.ValueMember = "Value" CbGStype.DisplayMember = "Label" - If Cfg.DeclMode Then + If (Cfg.DeclMode) Then CbGStype.DataSource = [Enum].GetValues(GetType(GearboxType)) _ .Cast(Of GearboxType)() _ - .Where(Function(type) type.ManualTransmission()) _ + .Where(Function(type) type.ManualTransmission() OrElse type = GearboxType.ATSerial) _ .Select(Function(type) New With {Key .Value = type, .Label = type.GetLabel()}).ToList() Else CbGStype.DataSource = [Enum].GetValues(GetType(GearboxType)) _ - .Cast(Of GearboxType) _ - .Where(Function(type) type.AutomaticTransmission() OrElse type.ManualTransmission()) _ + .Cast(Of GearboxType)() _ + .Where(Function(type) type.ManualTransmission() OrElse type.AutomaticTransmission()) _ .Select(Function(type) New With {Key .Value = type, .Label = type.GetLabel()}).ToList() End If - DeclInit() _changed = False @@ -106,7 +105,7 @@ Public Class GearboxForm TbMinTimeBetweenShifts.Text = DeclarationData.Gearbox.MinTimeBetweenGearshifts.ToGUIFormat() 'cDeclaration.MinTimeBetweenGearshift(GStype) - TbTqResv.Text = (DeclarationData.Gearbox.TorqueReserve * 100).ToGUIFormat() ' cDeclaration.TqResv + TbTqResv.Text = (DeclarationData.Gearbox.TorqueReserve * 100).ToGUIFormat() ' cDeclaration.TqResv TbTqResvStart.Text = (DeclarationData.Gearbox.TorqueReserveStart * 100).ToGUIFormat() 'cDeclaration.TqResvStart TbStartSpeed.Text = DeclarationData.Gearbox.StartSpeed.ToGUIFormat() 'cDeclaration.StartSpeed TbStartAcc.Text = DeclarationData.Gearbox.StartAcceleration.ToGUIFormat() ' cDeclaration.StartAcc @@ -480,7 +479,7 @@ Public Class GearboxForm Private Sub TbName_TextChanged(sender As Object, e As EventArgs) _ Handles TbName.TextChanged, TBI_getr.TextChanged, TbTracInt.TextChanged, TbTqResv.TextChanged, TbMinTimeBetweenShifts.TextChanged, TbTqResvStart.TextChanged, TbStartSpeed.TextChanged, TbStartAcc.TextChanged, - TbTCfile.TextChanged, TbTCrefrpm.TextChanged, TbTCinertia.TextChanged, tbTCmaxSpeed.TextChanged, + TbTCfile.TextChanged, tbTCCUpshiftMinAcceleration.TextChanged, tbTCLUpshiftMinAcceleration.TextChanged Change() End Sub @@ -506,8 +505,9 @@ Public Class GearboxForm 'ChTCon.Enabled = (GStype.AutomaticTransmission()) gbTC.Enabled = gStype.AutomaticTransmission() - gbTCAccMin.Enabled = gStype.AutomaticTransmission() - gbPowershiftLosses.Enabled = gStype.AutomaticTransmission() + pnTcEngineering.Enabled = Not Cfg.DeclMode AndAlso gStype.AutomaticTransmission() + gbTCAccMin.Enabled = Not Cfg.DeclMode AndAlso gStype.AutomaticTransmission() + gbPowershiftLosses.Enabled = Not Cfg.DeclMode AndAlso gStype.AutomaticTransmission() TbStartAcc.Enabled = Not gStype.AutomaticTransmission() TbStartSpeed.Enabled = Not gStype.AutomaticTransmission() TbTqResv.Enabled = Not gStype.AutomaticTransmission() @@ -826,7 +826,7 @@ Public Class GearboxForm 'Dim fullLoadCurve As FullLoadCurve = ConvertToFullLoadCurve(FLD0.LnU, FLD0.LTq) Dim gears As IList(Of ITransmissionInputData) = ConvertToGears(LvGears.Items) Dim shiftLines As ShiftPolygon = GetShiftLines(engine.IdleSpeed, engineFld, vehicle, gears, gear) - If (CType(CbGStype.SelectedValue, GearboxType).ManualTransmission() AndAlso Not IsNothing(shiftLines)) Then + If (Not IsNothing(shiftLines)) Then s = New Series @@ -897,8 +897,9 @@ Public Class GearboxForm Private Function GetShiftLines(ByVal idleSpeed As PerSecond, engineFullLoadCurve As EngineFullLoadCurve, vehicle As IVehicleEngineeringInputData, gears As IList(Of ITransmissionInputData), ByVal gear As Integer) _ As ShiftPolygon + Dim maxTqStr As String = LvGears.Items(gear).SubItems(GearboxTbl.MaxTorque).Text Dim engine As CombustionEngineData = ConvertToEngineData(engineFullLoadCurve, idleSpeed, gear, - LvGears.Items(gear).SubItems(GearboxTbl.MaxTorque).Text.ToDouble(0).SI(Of NewtonMeter)) + If(String.IsNullOrWhiteSpace(maxTqStr), Nothing, maxTqStr.ToDouble(0).SI(Of NewtonMeter))) If gears.Count <= 1 Then Return Nothing End If @@ -912,7 +913,7 @@ Public Class GearboxForm If (rDyn.IsEqual(0)) Then Return Nothing End If - Dim shiftLines As ShiftPolygon = DeclarationData.Gearbox.ComputeShiftPolygon(gear - 1, + Dim shiftLines As ShiftPolygon = DeclarationData.Gearbox.ComputeShiftPolygon(CType(CbGStype.SelectedValue, GearboxType), gear - 1, engine.FullLoadCurves(CType(gear, UInteger)), gears, engine, Double.Parse(LvGears.Items(0).SubItems(GearboxTbl.Ratio).Text, CultureInfo.InvariantCulture), (rDyn)) @@ -966,7 +967,7 @@ Public Class GearboxForm ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu. End Sub - Private Sub BtTCShiftFileBrowse_Click(sender As Object, e As EventArgs) Handles BtTCShiftFileBrowse.Click + Private Sub BtTCShiftFileBrowse_Click(sender As Object, e As EventArgs) If TorqueConverterShiftPolygonFileBrowser.OpenDialog(FileRepl(TBTCShiftPolygon.Text, GetPath(_gbxFile))) Then TBTCShiftPolygon.Text = GetFilenameWithoutDirectory(TorqueConverterShiftPolygonFileBrowser.Files(0), GetPath(_gbxFile)) diff --git a/VECTO/Input Files/Gearbox.vb b/VECTO/Input Files/Gearbox.vb index 91f5efc722648579e64eb23481158f704f04cc49..c25999ffe0b93fd107e43a7574b56f535e8ec515 100644 --- a/VECTO/Input Files/Gearbox.vb +++ b/VECTO/Input Files/Gearbox.vb @@ -368,6 +368,13 @@ Public Class Gearbox End Get End Property + Public ReadOnly Property IGearboxDeclarationInputData_TorqueConverter As ITorqueConverterDeclarationInputData _ + Implements IGearboxDeclarationInputData.TorqueConverter + Get + Return Me + End Get + End Property + Public ReadOnly Property ReferenceRPM As PerSecond Implements ITorqueConverterEngineeringInputData.ReferenceRPM Get Return TorqueConverterReferenceRpm.RPMtoRad() diff --git a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs index f73c2afac6677a2f348d7ee25faa550f79f26b5d..862f5604db5742afa7dfad1d028f9578b3b76eca 100644 --- a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs +++ b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs @@ -211,6 +211,12 @@ namespace TUGraz.VectoCommon.InputData /// cf. VECTO Input Parameters.xlsx /// </summary> IList<ITransmissionInputData> Gears { get; } + + /// <summary> + /// P090, P091, P092, P127 + /// cf. VECTO Input Parameters.xlsx + /// </summary> + ITorqueConverterDeclarationInputData TorqueConverter { get; } } diff --git a/VectoCommon/VectoCommon/InputData/EngineeringInputData.cs b/VectoCommon/VectoCommon/InputData/EngineeringInputData.cs index c8db80a6d093c4986f7d6c8cc6ccea64c03b47c5..6ef698ff641aa6892519363d3c418a906b5a7d59 100644 --- a/VectoCommon/VectoCommon/InputData/EngineeringInputData.cs +++ b/VectoCommon/VectoCommon/InputData/EngineeringInputData.cs @@ -183,12 +183,6 @@ namespace TUGraz.VectoCommon.InputData ///// </summary> //bool SkipGears { get; } - /// <summary> - /// P090, P091, P092, P127 - /// cf. VECTO Input Parameters.xlsx - /// </summary> - ITorqueConverterEngineeringInputData TorqueConverter { get; } - Second DownshiftAfterUpshiftDelay { get; } Second UpshiftAfterDownshiftDelay { get; } @@ -196,6 +190,8 @@ namespace TUGraz.VectoCommon.InputData MeterPerSquareSecond UpshiftMinAcceleration { get; } Second PowershiftShiftTime { get; } + + new ITorqueConverterEngineeringInputData TorqueConverter { get; } } public interface ITorqueConverterEngineeringInputData : ITorqueConverterDeclarationInputData diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs index c3bc053dba707c141392f961aceb4b742bba76f4..cefd8c1086532aba7b75c9a672fc5a92e90d0b24 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs @@ -348,6 +348,11 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON get { return Body.GetEx<double>(JsonKeys.Gearbox_StartTorqueReserve) / 100.0; } } + ITorqueConverterDeclarationInputData IGearboxDeclarationInputData.TorqueConverter + { + get { return TorqueConverter; } + } + public virtual ITorqueConverterEngineeringInputData TorqueConverter { get { return this; } @@ -494,7 +499,10 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON get { return "N/A"; } } - public CertificationMethod CertificationMethod { get { return CertificationMethod.NotCertified; } } + public CertificationMethod CertificationMethod + { + get { return CertificationMethod.NotCertified; } + } public string CertificationNumber { diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationGearboxDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationGearboxDataProvider.cs index 5ed7d6a5dda28f0f25956c207aadf1f0d599dda9..a620842e1e2f73b09a44cc6f1cc83fa41ca57703 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationGearboxDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationGearboxDataProvider.cs @@ -63,6 +63,13 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration } } + public ITorqueConverterDeclarationInputData TorqueConverter + { + get { + return new XMLDeclarationTorqueConverterDataProvider(InputData); + } + } + protected ITransmissionInputData ReadGear(string gearNr) { var retVal = new TransmissionInputData(); diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringGearboxDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringGearboxDataProvider.cs index f0554c6be31fcc26661e97c25798220ff1755837..f756df129aa2ea700aac69fb50a135e83fdbc391 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringGearboxDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringGearboxDataProvider.cs @@ -104,6 +104,12 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering get { return InputData.XMLEngineeringJobData.StartTorqueReserve; } } + + ITorqueConverterDeclarationInputData IGearboxDeclarationInputData.TorqueConverter + { + get { return TorqueConverter; } + } + public ITorqueConverterEngineeringInputData TorqueConverter { get diff --git a/VectoCore/VectoCore/InputData/Reader/ComponentData/TorqueConverterDataReader.cs b/VectoCore/VectoCore/InputData/Reader/ComponentData/TorqueConverterDataReader.cs index 136400b61ca88e633423c5b28311dd8021e67d34..b9c20ed06c1330ea9010f540a3d2f013ac69634a 100644 --- a/VectoCore/VectoCore/InputData/Reader/ComponentData/TorqueConverterDataReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/ComponentData/TorqueConverterDataReader.cs @@ -60,8 +60,9 @@ namespace TUGraz.VectoCore.InputData.Reader.ComponentData public static TorqueConverterData Create(DataTable data, PerSecond referenceRpm, PerSecond maxRpm, ExecutionMode mode, double ratio, MeterPerSquareSecond lcMinAcceleration, MeterPerSquareSecond ccMinAcceleration) { - if (data == null) + if (data == null) { throw new VectoException("TorqueConverter Characteristics data is missing."); + } if (data.Columns.Count != 3) { throw new VectoException("TorqueConverter Characteristics data must consist of 3 columns"); @@ -74,30 +75,31 @@ namespace TUGraz.VectoCore.InputData.Reader.ComponentData if (HeaderIsValid(data.Columns)) { characteristicTorque = (from DataRow row in data.Rows select - new TorqueConverterEntry() { - SpeedRatio = row.ParseDouble(Fields.SpeedRatio), - Torque = row.ParseDouble(Fields.CharacteristicTorque).SI<NewtonMeter>(), - TorqueRatio = row.ParseDouble(Fields.TorqueRatio) - }).ToArray(); + new TorqueConverterEntry() { + SpeedRatio = row.ParseDouble(Fields.SpeedRatio), + Torque = row.ParseDouble(Fields.CharacteristicTorque).SI<NewtonMeter>(), + TorqueRatio = row.ParseDouble(Fields.TorqueRatio) + }).ToArray(); } else { characteristicTorque = (from DataRow row in data.Rows select - new TorqueConverterEntry() { - SpeedRatio = row.ParseDouble(0), - Torque = row.ParseDouble(2).SI<NewtonMeter>(), - TorqueRatio = row.ParseDouble(1) - }).ToArray(); + new TorqueConverterEntry() { + SpeedRatio = row.ParseDouble(0), + Torque = row.ParseDouble(2).SI<NewtonMeter>(), + TorqueRatio = row.ParseDouble(1) + }).ToArray(); } if (mode == ExecutionMode.Declaration) { + var tcDrag = DeclarationData.TorqueConverter.GetTorqueConverterDragCurve(ratio).Last(); characteristicTorque = characteristicTorque.Where(x => x.SpeedRatio < ratio) - .Concat(DeclarationData.Gearbox.GetTorqueConverterDragCurve(ratio)) + .Concat(DeclarationData.TorqueConverter.GetTorqueConverterDragCurve(ratio)) .ToArray(); } else { if (!characteristicTorque.Any(x => x.SpeedRatio > ratio)) { characteristicTorque = characteristicTorque.Where(x => x.SpeedRatio < ratio) - .Concat(DeclarationData.Gearbox.GetTorqueConverterDragCurve(ratio)) + .Concat(DeclarationData.TorqueConverter.GetTorqueConverterDragCurve(ratio)) .ToArray(); } } diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/AbstractSimulationDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/AbstractSimulationDataAdapter.cs index 035586c46647f9d78cd25156af95c515a85239f7..4bd060470e0c18a4d2bb33434fca5171c0b6e0d9 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/AbstractSimulationDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/AbstractSimulationDataAdapter.cs @@ -153,6 +153,41 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter }; } + protected TransmissionLossMap CreateGearLossMap(ITransmissionInputData gear, uint i, bool useEfficiencyFallback, bool extendLossMap) + { + if (gear.LossMap != null) { + return TransmissionLossMapReader.Create(gear.LossMap, gear.Ratio, string.Format("Gear {0}", i + 1), extendLossMap); + } + if (useEfficiencyFallback) { + return TransmissionLossMapReader.Create(gear.Efficiency, gear.Ratio, string.Format("Gear {0}", i + 1)); + } + throw new InvalidFileFormatException("Gear {0} LossMap missing.", i + 1); + } + + protected static void CreateTCSecondGearATSerial(IGearboxDeclarationInputData gearbox, GearData gearData, + ShiftPolygon shiftPolygon) + { + gearData.TorqueConverterRatio = gearData.Ratio; + gearData.TorqueConverterGearLossMap = gearData.LossMap; + gearData.TorqueConverterShiftPolygon = shiftPolygon; + } + + protected static void CreateTCFirstGearATSerial(IGearboxDeclarationInputData gearbox, GearData gearData, + ShiftPolygon shiftPolygon) + { + gearData.TorqueConverterRatio = gearData.Ratio; + gearData.TorqueConverterGearLossMap = gearData.LossMap; + gearData.TorqueConverterShiftPolygon = shiftPolygon; + } + + protected static void CretateTCFirstGearATPowerSplit(IGearboxDeclarationInputData gearbox, GearData gearData, uint i, + ShiftPolygon shiftPolygon) + { + gearData.TorqueConverterRatio = 1; + gearData.TorqueConverterGearLossMap = TransmissionLossMapReader.Create(1, 1, string.Format("TCGear {0}", i + 1)); + gearData.TorqueConverterShiftPolygon = shiftPolygon; + } + public AxleGearData CreateAxleGearData(IAxleGearInputData data, bool useEfficiencyFallback) { var retVal = SetCommonAxleGearData(data); diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs index b0eae3f194b31f4bdd94ee3ed9032736bc51ea61..d89d57385921b2dad75aac7040118b97083b2b2b 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs @@ -217,61 +217,86 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter WarnDeclarationMode("GearboxData"); } var retVal = SetCommonGearboxData(gearbox); - switch (retVal.Type) { + switch (gearbox.Type) { + case GearboxType.DrivingCycle: case GearboxType.ATPowerSplit: - case GearboxType.ATSerial: throw new VectoSimulationException( - "Automatic Transmission currently not supported in DeclarationMode!"); + "Unsupported gearbox type: {0}!", retVal.Type); //case GearboxType.Custom: // throw new VectoSimulationException("Custom Transmission not supported in DeclarationMode!"); } - var gears = gearbox.Gears; - if (gears.Count < 1) { + var gearsInput = gearbox.Gears; + if (gearsInput.Count < 1) { throw new VectoSimulationException( "At least one Gear-Entry must be defined in Gearbox!"); } - retVal.Inertia = DeclarationData.Gearbox.Inertia; - retVal.TractionInterruption = retVal.Type.TractionInterruption(); + SetDeclarationData(retVal); - retVal.TorqueReserve = DeclarationData.Gearbox.TorqueReserve; - retVal.StartTorqueReserve = DeclarationData.Gearbox.TorqueReserveStart; - retVal.ShiftTime = DeclarationData.Gearbox.MinTimeBetweenGearshifts; - retVal.StartSpeed = DeclarationData.Gearbox.StartSpeed; - retVal.StartAcceleration = DeclarationData.Gearbox.StartAcceleration; + var gearDifferenceRatio = gearbox.Type.AutomaticTransmission() && gearbox.Gears.Count > 2 + ? gearbox.Gears[0].Ratio / gearbox.Gears[1].Ratio + : 1.0; - TransmissionLossMap gearLossMap; - retVal.Gears = gears.Select((gear, i) => { - uint gearNbr = (uint)(i + 1); - try { - if (gear.LossMap == null) { - throw new InvalidFileFormatException(string.Format("LossMap for Gear {0} is missing.", i + 1)); + var gears = new Dictionary<uint, GearData>(); + var tcShiftPolygon = DeclarationData.TorqueConverter.ComputeShiftPolygon(engine.FullLoadCurves[0]); + for (uint i = 0; i < gearsInput.Count; i++) { + var gear = gearsInput[(int)i]; + var lossMap = CreateGearLossMap(gear, i, useEfficiencyFallback, true); + + var shiftPolygon = DeclarationData.Gearbox.ComputeShiftPolygon(gearbox.Type, (int)i, engine.FullLoadCurves[i+1], gearsInput, engine, + axlegearRatio, dynamicTyreRadius); + + var gearData = new GearData { + ShiftPolygon = shiftPolygon, + MaxSpeed = gear.MaxInputSpeed, + Ratio = gear.Ratio, + LossMap = lossMap, + }; + + if (gearbox.Type == GearboxType.ATPowerSplit && i == 0) { + // powersplit transmission: torque converter already contains ratio and losses + CretateTCFirstGearATPowerSplit(gearbox, gearData, i, tcShiftPolygon); + } + if (gearbox.Type == GearboxType.ATSerial) { + if (i == 0) { + // torqueconverter is active in first gear - duplicate ratio and lossmap for torque converter mode + CreateTCFirstGearATSerial(gearbox, gearData, tcShiftPolygon); } - gearLossMap = TransmissionLossMapReader.Create(gear.LossMap, gear.Ratio, string.Format("Gear {0}", i + 1), true); - } catch (InvalidFileFormatException) { - if (useEfficiencyFallback) { - gearLossMap = TransmissionLossMapReader.Create(gear.Efficiency, gear.Ratio, string.Format("Gear {0}", i + 1)); - } else { - throw; + if (i == 1 && gearDifferenceRatio >= DeclarationData.Gearbox.TorqueConverterSecondGearThreshold) { + // ratio between first and second gear is above threshold, torqueconverter is active in second gear as well + // -> duplicate ratio and lossmap for torque converter mode, remove locked transmission for previous gear + CreateTCSecondGearATSerial(gearbox, gearData, tcShiftPolygon); + // NOTE: the lower gear in 'gears' dictionary has index i !! + gears[i].Ratio = double.NaN; + gears[i].LossMap = null; } } + gears.Add(i + 1, gearData); + } + retVal.Gears = gears; + if (retVal.Type.AutomaticTransmission()) { + var ratio = double.IsNaN(retVal.Gears[1].Ratio) ? 1 : retVal.Gears[1].TorqueConverterRatio / retVal.Gears[1].Ratio; + retVal.PowershiftShiftTime = DeclarationData.Gearbox.PowershiftShiftTime; + retVal.TorqueConverterData = TorqueConverterDataReader.Create(gearbox.TorqueConverter.TCData, + DeclarationData.TorqueConverter.ReferenceRPM, DeclarationData.TorqueConverter.MaxInputSpeed, ExecutionMode.Declaration, ratio, + DeclarationData.TorqueConverter.CLUpshiftMinAcceleration, DeclarationData.TorqueConverter.CCUpshiftMinAcceleration); + } - var shiftPolygon = DeclarationData.Gearbox.ComputeShiftPolygon(i, engine.FullLoadCurves[gearNbr], gears, engine, - axlegearRatio, dynamicTyreRadius); - - return new KeyValuePair<uint, GearData>(gearNbr, - new GearData { - LossMap = gearLossMap, - ShiftPolygon = shiftPolygon, - MaxSpeed = gear.MaxInputSpeed, - Ratio = gear.Ratio, - }); - }).ToDictionary(kv => kv.Key, kv => kv.Value); + return retVal; + } + private static void SetDeclarationData(GearboxData retVal) + { + retVal.Inertia = DeclarationData.Gearbox.Inertia; + retVal.TractionInterruption = retVal.Type.TractionInterruption(); + retVal.TorqueReserve = DeclarationData.Gearbox.TorqueReserve; + retVal.StartTorqueReserve = DeclarationData.Gearbox.TorqueReserveStart; + retVal.ShiftTime = DeclarationData.Gearbox.MinTimeBetweenGearshifts; + retVal.StartSpeed = DeclarationData.Gearbox.StartSpeed; + retVal.StartAcceleration = DeclarationData.Gearbox.StartAcceleration; retVal.DownshiftAfterUpshiftDelay = DeclarationData.Gearbox.DownshiftAfterUpshiftDelay; retVal.UpshiftAfterDownshiftDelay = DeclarationData.Gearbox.UpshiftAfterDownshiftDelay; retVal.UpshiftMinAcceleration = DeclarationData.Gearbox.UpshiftMinAcceleration; - return retVal; } public IList<VectoRunData.AuxData> CreateAuxiliaryData(IAuxiliariesDeclarationInputData auxInputData, diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs index c5c5727ba905e0148f7b86f14987e925395c7f74..8a0aceacc4728a9d68a0b15079a5e1093ef21cdf 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs @@ -172,40 +172,28 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter throw new VectoSimulationException("At least two Gear-Entries must be defined in Gearbox!"); } - retVal.Inertia = gearbox.Type.ManualTransmission() ? gearbox.Inertia : 0.SI<KilogramSquareMeter>(); - retVal.TractionInterruption = gearbox.TractionInterruption; - retVal.TorqueReserve = gearbox.TorqueReserve; - retVal.StartTorqueReserve = gearbox.StartTorqueReserve; - retVal.ShiftTime = gearbox.MinTimeBetweenGearshift; - retVal.StartSpeed = gearbox.StartSpeed; - retVal.StartAcceleration = gearbox.StartAcceleration; + SetEngineeringData(gearbox, retVal); var gearDifferenceRatio = gearbox.Type.AutomaticTransmission() && gearbox.Gears.Count > 2 ? gearbox.Gears[0].Ratio / gearbox.Gears[1].Ratio : 1.0; var gears = new Dictionary<uint, GearData>(); - + ShiftPolygon tcShiftPolygon = null; + if (gearbox.Type.AutomaticTransmission()) { + tcShiftPolygon = gearbox.TorqueConverter.ShiftPolygon != null + ? ShiftPolygonReader.Create(gearbox.TorqueConverter.ShiftPolygon) + : DeclarationData.TorqueConverter.ComputeShiftPolygon(engineData.FullLoadCurves[0]); + } for (uint i = 0; i < gearbox.Gears.Count; i++) { var gear = gearbox.Gears[(int)i]; - TransmissionLossMap lossMap; - if (gear.LossMap != null) { - lossMap = TransmissionLossMapReader.Create(gear.LossMap, gear.Ratio, string.Format("Gear {0}", i + 1)); - } else if (useEfficiencyFallback) { - lossMap = TransmissionLossMapReader.Create(gear.Efficiency, gear.Ratio, string.Format("Gear {0}", i + 1)); - } else { - throw new InvalidFileFormatException("Gear {0} LossMap or Efficiency missing.", i + 1); - } + var lossMap = CreateGearLossMap(gear, i, useEfficiencyFallback, false); - //var fullLoadCurve = IntersectFullLoadCurves(engineData.FullLoadCurve, gear.MaxTorque); - if (gearbox.Type.AutomaticTransmission() && gear.ShiftPolygon == null) { - throw new VectoException("Shiftpolygons are required for AT Gearboxes!"); - } var shiftPolygon = gear.ShiftPolygon != null && gear.ShiftPolygon.SourceType != DataSourceType.Missing ? ShiftPolygonReader.Create(gear.ShiftPolygon) - : DeclarationData.Gearbox.ComputeShiftPolygon((int)i, engineData.FullLoadCurves[i + 1], gearbox.Gears, engineData, - axlegearRatio, - dynamicTyreRadius); + : DeclarationData.Gearbox.ComputeShiftPolygon(gearbox.Type, (int)i, engineData.FullLoadCurves[i + 1], gearbox.Gears, + engineData, + axlegearRatio, dynamicTyreRadius); var gearData = new GearData { ShiftPolygon = shiftPolygon, MaxSpeed = gear.MaxInputSpeed, @@ -213,33 +201,19 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter LossMap = lossMap, }; - if (gearbox.Type == GearboxType.ATPowerSplit) { - if (i == 0) { - // powersplit transmission: torque converter already contains ratio and losses - gearData.TorqueConverterRatio = 1; - gearData.TorqueConverterGearLossMap = TransmissionLossMapReader.Create(1, 1, string.Format("TCGear {0}", i + 1)); - gearData.TorqueConverterShiftPolygon = gearbox.TorqueConverter.ShiftPolygon == null - ? null - : ShiftPolygonReader.Create(gearbox.TorqueConverter.ShiftPolygon); - } + if (gearbox.Type == GearboxType.ATPowerSplit && i == 0) { + // powersplit transmission: torque converter already contains ratio and losses + CretateTCFirstGearATPowerSplit(gearbox, gearData, i, tcShiftPolygon); } if (gearbox.Type == GearboxType.ATSerial) { if (i == 0) { // torqueconverter is active in first gear - duplicate ratio and lossmap for torque converter mode - gearData.TorqueConverterRatio = gearData.Ratio; - gearData.TorqueConverterGearLossMap = gearData.LossMap; - gearData.TorqueConverterShiftPolygon = gearbox.TorqueConverter.ShiftPolygon == null - ? null - : ShiftPolygonReader.Create(gearbox.TorqueConverter.ShiftPolygon); + CreateTCFirstGearATSerial(gearbox, gearData, tcShiftPolygon); } if (i == 1 && gearDifferenceRatio >= DeclarationData.Gearbox.TorqueConverterSecondGearThreshold) { // ratio between first and second gear is above threshold, torqueconverter is active in second gear as well // -> duplicate ratio and lossmap for torque converter mode, remove locked transmission for previous gear - gearData.TorqueConverterRatio = gearData.Ratio; - gearData.TorqueConverterGearLossMap = gearData.LossMap; - gearData.TorqueConverterShiftPolygon = gearbox.TorqueConverter.ShiftPolygon == null - ? null - : ShiftPolygonReader.Create(gearbox.TorqueConverter.ShiftPolygon); + CreateTCSecondGearATSerial(gearbox, gearData, tcShiftPolygon); // NOTE: the lower gear in 'gears' dictionary has index i !! gears[i].Ratio = double.NaN; gears[i].LossMap = null; @@ -249,30 +223,33 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter } retVal.Gears = gears; - if (retVal.Gears.Any(g => g.Value.HasTorqueConverter)) { - if (!retVal.Type.AutomaticTransmission()) { - throw new VectoException("Torque Converter can only be used with AT gearbox model"); - } + if (retVal.Type.AutomaticTransmission()) { var ratio = double.IsNaN(retVal.Gears[1].Ratio) ? 1 : retVal.Gears[1].TorqueConverterRatio / retVal.Gears[1].Ratio; + retVal.PowershiftShiftTime = gearbox.PowershiftShiftTime; retVal.TorqueConverterData = TorqueConverterDataReader.Create(gearbox.TorqueConverter.TCData, gearbox.TorqueConverter.ReferenceRPM, gearbox.TorqueConverter.MaxInputSpeed, ExecutionMode.Engineering, ratio, gearbox.TorqueConverter.CLUpshiftMinAcceleration, gearbox.TorqueConverter.CCUpshiftMinAcceleration); - } else { - if (retVal.Type.AutomaticTransmission()) { - throw new VectoException("AT gearbox model requires torque converter"); - } } - if (retVal.Type.AutomaticTransmission()) { - retVal.PowershiftShiftTime = gearbox.PowershiftShiftTime; - } + return retVal; + } + + private static void SetEngineeringData(IGearboxEngineeringInputData gearbox, GearboxData retVal) + { + retVal.Inertia = gearbox.Type.ManualTransmission() ? gearbox.Inertia : 0.SI<KilogramSquareMeter>(); + retVal.TractionInterruption = gearbox.TractionInterruption; + retVal.TorqueReserve = gearbox.TorqueReserve; + retVal.StartTorqueReserve = gearbox.StartTorqueReserve; + retVal.ShiftTime = gearbox.MinTimeBetweenGearshift; + retVal.StartSpeed = gearbox.StartSpeed; + retVal.StartAcceleration = gearbox.StartAcceleration; retVal.DownshiftAfterUpshiftDelay = gearbox.DownshiftAfterUpshiftDelay; retVal.UpshiftAfterDownshiftDelay = gearbox.UpshiftAfterDownshiftDelay; retVal.UpshiftMinAcceleration = gearbox.UpshiftMinAcceleration; - return retVal; } + public IList<VectoRunData.AuxData> CreateAuxiliaryData(IAuxiliariesEngineeringInputData auxInputData) { var auxList = new List<VectoRunData.AuxData>(auxInputData.Auxiliaries.Count + 1) { diff --git a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs index c9cd23536a493c489e5512ab4562302639c0a21e..6944fad5cf8b921816506a2f5e670bf9f0150fe4 100644 --- a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs +++ b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs @@ -177,10 +177,12 @@ namespace TUGraz.VectoCore.Models.Declaration //public static readonly PerSecond TorqueConverterSpeedLimit = 1600.RPMtoRad(); public static readonly double TorqueConverterSecondGearThreshold = 1.8; + public static readonly Second PowershiftShiftTime = 0.8.SI<Second>(); /// <summary> /// computes the shift polygons for a single gear according to the whitebook 2016 /// </summary> + /// <param name="type"></param> /// <param name="gearIdx">index of the gear to compute the shift polygons for -- gear number - 1!</param> /// <param name="fullLoadCurve">engine full load curve, potentially limited by the gearbox</param> /// <param name="gears">list of gears</param> @@ -188,7 +190,16 @@ namespace TUGraz.VectoCore.Models.Declaration /// <param name="axlegearRatio"></param> /// <param name="dynamicTyreRadius"></param> /// <returns></returns> - public static ShiftPolygon ComputeShiftPolygon(int gearIdx, EngineFullLoadCurve fullLoadCurve, + public static ShiftPolygon ComputeShiftPolygon(GearboxType type, int gearIdx, EngineFullLoadCurve fullLoadCurve, + IList<ITransmissionInputData> gears, CombustionEngineData engine, double axlegearRatio, Meter dynamicTyreRadius) + { + return type.AutomaticTransmission() + ? TorqueConverter.ComputeShiftPolygon(fullLoadCurve, gearIdx == 0, gearIdx >= gears.Count - 1) + // That's the same for all gears, so call the same method... + : ComputeManualTransmissionShiftPolygon(gearIdx, fullLoadCurve, gears, engine, axlegearRatio, dynamicTyreRadius); + } + + public static ShiftPolygon ComputeManualTransmissionShiftPolygon(int gearIdx, EngineFullLoadCurve fullLoadCurve, IList<ITransmissionInputData> gears, CombustionEngineData engine, double axlegearRatio, Meter dynamicTyreRadius) { if (gears.Count < 2) { @@ -209,8 +220,7 @@ namespace TUGraz.VectoCore.Models.Declaration var p3 = new Point(nVHigh.Value() * 0.9, fullLoadCurve.FullLoadStationaryTorque(nVHigh * 0.9).Value()); - var p4 = - new Point((nVHigh * (1 + diffRatio / 3)).Value(), 0); + var p4 = new Point((nVHigh * (1 + diffRatio / 3)).Value(), 0); var p5 = new Point(fullLoadCurve.N95hSpeed.Value(), fullLoadCurve.MaxTorque.Value()); var p6 = new Point(p2.X, VectoMath.Interpolate(p1, p3, p2.X)); @@ -247,7 +257,7 @@ namespace TUGraz.VectoCore.Models.Declaration var p3pExt = new Point((1.1 * p5.Y - edgeP6pP3p.OffsetXY) / edgeP6pP3p.SlopeXY, 1.1 * p5.Y); // ReSharper restore InconsistentNaming - upShift = IntersectShiftPolygon(new[] { p4, p7, p5 }.ToList(), new[] { p2p, p6p, p3pExt }.ToList()) + upShift = IntersectShiftPolygon(new[] { p4, p7, p5 }, new[] { p2p, p6p, p3pExt }) .Select(point => new ShiftPolygon.ShiftPolygonEntry() { AngularSpeed = point.X.SI<PerSecond>(), Torque = point.Y.SI<NewtonMeter>() @@ -284,12 +294,10 @@ namespace TUGraz.VectoCore.Models.Declaration internal static IEnumerable<Point> ShiftPolygonFldMargin(List<FullLoadCurve.FullLoadCurveEntry> fullLoadCurve, PerSecond rpmLimit) { - return - fullLoadCurve.TakeWhile(fldEntry => fldEntry.EngineSpeed < rpmLimit) - .Select( - fldEntry => - new Point(fldEntry.EngineSpeed.Value(), fldEntry.TorqueFullLoad.Value() * ShiftPolygonEngineFldMargin)) - .ToList(); + return fullLoadCurve.TakeWhile(fldEntry => fldEntry.EngineSpeed < rpmLimit) + .Select(fldEntry => + new Point(fldEntry.EngineSpeed.Value(), fldEntry.TorqueFullLoad.Value() * ShiftPolygonEngineFldMargin)) + .ToList(); } // ReSharper disable once InconsistentNaming @@ -300,7 +308,7 @@ namespace TUGraz.VectoCore.Models.Declaration return engineSpeed; } - internal static List<Point> IntersectShiftPolygon(List<Point> orig, List<Point> transformedDownshift) + internal static List<Point> IntersectShiftPolygon(Point[] orig, Point[] transformedDownshift) { var intersections = new List<Point>(); // compute all intersection points between both line segments @@ -352,7 +360,7 @@ namespace TUGraz.VectoCore.Models.Declaration return shiftPolygon.OrderBy(pt => pt.X).ThenBy(pt => pt.Y).ToList(); } - private static List<Point> ProjectPointsToLineSegments(List<Point> lineSegments, List<Point> points) + private static IEnumerable<Point> ProjectPointsToLineSegments(IEnumerable<Point> lineSegments, Point[] points) { var pointSet = new List<Point>(); foreach (var segment in lineSegments.Pairwise(Edge.Create)) { @@ -365,6 +373,40 @@ namespace TUGraz.VectoCore.Models.Declaration } return pointSet; } + } + + public static class TorqueConverter + { + public static readonly PerSecond ReferenceRPM = 1000.RPMtoRad(); + public static readonly PerSecond MaxInputSpeed = 5000.RPMtoRad(); + public static readonly MeterPerSquareSecond CLUpshiftMinAcceleration = 0.1.SI<MeterPerSquareSecond>(); + public static readonly MeterPerSquareSecond CCUpshiftMinAcceleration = 0.1.SI<MeterPerSquareSecond>(); + + private static PerSecond DownshiftPRM = 700.RPMtoRad(); + private static PerSecond UpshiftLowRPM = 900.RPMtoRad(); + private static PerSecond UpshiftHighRPM = 1150.RPMtoRad(); + + public static ShiftPolygon ComputeShiftPolygon(EngineFullLoadCurve fullLoadCurve, bool first = false, bool last = false) + { + var maxDragTorque = fullLoadCurve.MaxDragTorque * 1.1; + var maxTorque = fullLoadCurve.MaxTorque * 1.1; + var p0 = new Point(UpshiftLowRPM.Value(), maxDragTorque.Value()); + var p1 = new Point(UpshiftLowRPM.Value(), 0); + var p2 = new Point(UpshiftHighRPM.Value(), fullLoadCurve.FullLoadStationaryTorque(UpshiftHighRPM).Value()); + var edge = new Edge(p1, p2); + var p2corr = new Point((maxTorque.Value() - edge.OffsetXY) / edge.SlopeXY, maxTorque.Value()); + + var downshift = new[] { + new ShiftPolygon.ShiftPolygonEntry { AngularSpeed = DownshiftPRM, Torque = maxDragTorque }, + new ShiftPolygon.ShiftPolygonEntry { AngularSpeed = DownshiftPRM, Torque = maxTorque } + }; + var upshift = new[] { p0, p1, p2corr }.Select( + pt => + new ShiftPolygon.ShiftPolygonEntry { AngularSpeed = pt.X.SI<PerSecond>(), Torque = pt.Y.SI<NewtonMeter>() }); + + return new ShiftPolygon(first ? new List<ShiftPolygon.ShiftPolygonEntry>() : downshift.ToList(), + last ? new List<ShiftPolygon.ShiftPolygonEntry>() : upshift.ToList()); + } public static IEnumerable<TorqueConverterEntry> GetTorqueConverterDragCurve(double ratio) { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/GearboxData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/GearboxData.cs index 580bdab56eb932786bc7c60c3befcfa5e92de9e7..1d33219f7beee704a921d036f88849c3556ee61e 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/GearboxData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/GearboxData.cs @@ -109,6 +109,16 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data var emsMission = GetEmsMode(validationContext); var result = new List<ValidationResult>(); + + if (gearboxData.Gears.Any(g => g.Value.HasTorqueConverter)) { + if (!gearboxData.Type.AutomaticTransmission()) { + return new ValidationResult("Torque Converter can only be used with AT gearbox model"); + } + } else { + if (gearboxData.Type.AutomaticTransmission()) { + return new ValidationResult("AT gearbox model requires torque converter"); + } + } if (gearboxData.Type.AutomaticTransmission()) { gearboxData.TorqueConverterData.RequiredSpeedRatio = Math.Round(gearboxData.Gears[1].TorqueConverterRatio / gearboxData.Gears[1].Ratio, 4) * 0.95; diff --git a/VectoCore/VectoCore/Resources/XSD/VectoDeclarationDefinitions.1.0.xsd b/VectoCore/VectoCore/Resources/XSD/VectoDeclarationDefinitions.1.0.xsd index 7478f0cfcdfad2d4f0e46bf156ac73edc35bc57a..9871aac1d6a1f527a3b3e8713fa7df721c29702d 100644 --- a/VectoCore/VectoCore/Resources/XSD/VectoDeclarationDefinitions.1.0.xsd +++ b/VectoCore/VectoCore/Resources/XSD/VectoDeclarationDefinitions.1.0.xsd @@ -1511,27 +1511,27 @@ INVALID: 1.2345, .1234, 01.23 ToDo: -0.00 </xs:documentation> </xs:annotation> - <xs:restriction base="xs:double"> + <xs:restriction base="xs:decimal"> <xs:pattern value="[-]?([1-9][0-9]*|0)\.[0-9]{2}"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="Double3"> - <xs:restriction base="xs:double"> + <xs:restriction base="xs:decimal"> <xs:pattern value="[-]?([1-9][0-9]*|0)\.[0-9]{3}"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="Double4"> - <xs:restriction base="xs:double"> + <xs:restriction base="xs:decimal"> <xs:pattern value="[-]?([1-9][0-9]*|0)\.[0-9]{4}"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="Double5"> - <xs:restriction base="xs:double"> + <xs:restriction base="xs:decimal"> <xs:pattern value="[-]?([1-9][0-9]*|0)\.[0-9]{5}"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="Double6"> - <xs:restriction base="xs:double"> + <xs:restriction base="xs:decimal"> <xs:pattern value="[-]?([1-9][0-9]*|0)\.[0-9]{6}"/> </xs:restriction> </xs:simpleType> diff --git a/VectoCore/VectoCoreTest/Models/Declaration/ShiftPolygonTest.cs b/VectoCore/VectoCoreTest/Models/Declaration/ShiftPolygonTest.cs index fb3ae089a1bcb9088b1a67017bad810e88cc5984..c2249114939f526752c2d284fa49f26c25363f3f 100644 --- a/VectoCore/VectoCoreTest/Models/Declaration/ShiftPolygonTest.cs +++ b/VectoCore/VectoCoreTest/Models/Declaration/ShiftPolygonTest.cs @@ -73,7 +73,7 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration new Point(20, 20), }; - var result = DeclarationData.Gearbox.IntersectShiftPolygon(upShift.ToList(), transformed.ToList()); + var result = DeclarationData.Gearbox.IntersectShiftPolygon(upShift, transformed); Assert.AreEqual(expected.Length, result.Count); @@ -104,7 +104,7 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration new Point(20, 15.6), }; - var result = DeclarationData.Gearbox.IntersectShiftPolygon(upShift.ToList(), transformed.ToList()); + var result = DeclarationData.Gearbox.IntersectShiftPolygon(upShift, transformed); Assert.AreEqual(expected.Length, result.Count); @@ -113,7 +113,7 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration Assert.AreEqual(tuple.Item1.Y, tuple.Item2.Y); } - result = DeclarationData.Gearbox.IntersectShiftPolygon(transformed.ToList(), upShift.ToList()); + result = DeclarationData.Gearbox.IntersectShiftPolygon(transformed, upShift); Assert.AreEqual(expected.Length, result.Count); @@ -145,7 +145,7 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration new Point(20, 20), }; - var result = DeclarationData.Gearbox.IntersectShiftPolygon(upShift.ToList(), transformed.ToList()); + var result = DeclarationData.Gearbox.IntersectShiftPolygon(upShift, transformed); Assert.AreEqual(expected.Length, result.Count); @@ -154,7 +154,7 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration Assert.AreEqual(tuple.Item1.Y, tuple.Item2.Y); } - result = DeclarationData.Gearbox.IntersectShiftPolygon(transformed.ToList(), upShift.ToList()); + result = DeclarationData.Gearbox.IntersectShiftPolygon(transformed, upShift); Assert.AreEqual(expected.Length, result.Count); @@ -186,7 +186,7 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration new Point(20, 16.8), }; - var result = DeclarationData.Gearbox.IntersectShiftPolygon(upShift.ToList(), transformed.ToList()); + var result = DeclarationData.Gearbox.IntersectShiftPolygon(upShift, transformed); Assert.AreEqual(expected.Length, result.Count); @@ -195,7 +195,7 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration Assert.AreEqual(tuple.Item1.Y, tuple.Item2.Y, 1e-3); } - result = DeclarationData.Gearbox.IntersectShiftPolygon(transformed.ToList(), upShift.ToList()); + result = DeclarationData.Gearbox.IntersectShiftPolygon(transformed, upShift); Assert.AreEqual(expected.Length, result.Count); @@ -343,28 +343,81 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration var dao = new DeclarationDataAdapter(); var gearboxData = new JSONGearboxDataV5(JSONInputDataFactory.ReadFile(gearboxFile), gearboxFile); - var engineData = dao.CreateEngineData(new JSONEngineDataV3(JSONInputDataFactory.ReadFile(engineFile), engineFile), null, + var engineData = dao.CreateEngineData(new JSONEngineDataV3(JSONInputDataFactory.ReadFile(engineFile), engineFile), + null, gearboxData, new List<ITorqueLimitInputData>()); var shiftPolygons = new List<ShiftPolygon>(); for (var i = 0; i < gearboxData.Gears.Count; i++) { - shiftPolygons.Add(DeclarationData.Gearbox.ComputeShiftPolygon(i, engineData.FullLoadCurves[(uint)(i + 1)], + shiftPolygons.Add(DeclarationData.Gearbox.ComputeShiftPolygon(GearboxType.AMT, i, + engineData.FullLoadCurves[(uint)(i + 1)], gearboxData.Gears, engineData, axlegearRatio, rdyn)); } for (var i = 0; i < Math.Min(gearboxData.Gears.Count, expectedDownshift.Length); i++) { foreach (var tuple in expectedDownshift[i].Zip(shiftPolygons[i].Downshift, Tuple.Create)) { - Assert.AreEqual(tuple.Item1.X, tuple.Item2.AngularSpeed.Value(), 1e-3, "gear: {0} entry: {1}", i, tuple); + Assert.AreEqual(tuple.Item1.X, tuple.Item2.AngularSpeed.Value(), 1e-3, "gear: {0} entry: {1}", i + 1, tuple); Assert.AreEqual(tuple.Item1.Y, tuple.Item2.Torque.Value(), 1e-3, "gear: {0} entry: {1}", i + 1, tuple); } foreach (var tuple in expectedUpshift[i].Zip(shiftPolygons[i].Upshift, Tuple.Create)) { - Assert.AreEqual(tuple.Item1.X, tuple.Item2.AngularSpeed.Value(), 1e-3, "gear: {0} entry: {1}", i, tuple); + Assert.AreEqual(tuple.Item1.X, tuple.Item2.AngularSpeed.Value(), 1e-3, "gear: {0} entry: {1}", i + 1, tuple); Assert.AreEqual(tuple.Item1.Y, tuple.Item2.Torque.Value(), 1e-3, "gear: {0} entry: {1}", i + 1, tuple); } } + Assert.AreEqual(0, shiftPolygons.First().Downshift.Count); + Assert.AreEqual(0, shiftPolygons.Last().Upshift.Count); + } + + + [TestCase] + public void CompueShiftPolygonATDeclarationTest() + { + var engineFile = @"TestData\Components\40t_Long_Haul_Truck.veng"; + var gearboxFile = @"TestData\Components\40t_Long_Haul_Truck.vgbx"; + + var rdyn = 0.4882675.SI<Meter>(); + var axlegearRatio = 2.59; + + var expectedDownshift = new[] { + new Point(73.3038, -352), + new Point(73.3038, 2530), + }; + var expectedUpshift = new[] { + new Point(94.2478, -352), + new Point(94.2478, 0), + new Point(123.0457, 2530), + }; + + var dao = new DeclarationDataAdapter(); + var gearboxData = new JSONGearboxDataV5(JSONInputDataFactory.ReadFile(gearboxFile), gearboxFile); + var engineData = dao.CreateEngineData(new JSONEngineDataV3(JSONInputDataFactory.ReadFile(engineFile), engineFile), + null, + gearboxData, new List<ITorqueLimitInputData>()); + + var shiftPolygons = new List<ShiftPolygon>(); + for (var i = 0; i < gearboxData.Gears.Count; i++) { + shiftPolygons.Add(DeclarationData.Gearbox.ComputeShiftPolygon(GearboxType.ATSerial, i, + engineData.FullLoadCurves[(uint)(i + 1)], + gearboxData.Gears, + engineData, axlegearRatio, rdyn)); + } + + for (var i = 0; i < gearboxData.Gears.Count; i++) { + foreach (var tuple in expectedDownshift.Zip(shiftPolygons[i].Downshift, Tuple.Create)) { + Assert.AreEqual(tuple.Item1.X, tuple.Item2.AngularSpeed.Value(), 1e-3, "gear: {0} entry: {1}", i + 1, tuple); + Assert.AreEqual(tuple.Item1.Y, tuple.Item2.Torque.Value(), 1e-3, "gear: {0} entry: {1}", i + 1, tuple); + } + + foreach (var tuple in expectedUpshift.Zip(shiftPolygons[i].Upshift, Tuple.Create)) { + Assert.AreEqual(tuple.Item1.X, tuple.Item2.AngularSpeed.Value(), 1e-3, "gear: {0} entry: {1}", i + 1, tuple); + Assert.AreEqual(tuple.Item1.Y, tuple.Item2.Torque.Value(), 1e-3, "gear: {0} entry: {1}", i + 1, tuple); + } + } + + Assert.AreEqual(0, shiftPolygons.First().Downshift.Count); Assert.AreEqual(0, shiftPolygons.Last().Upshift.Count); } @@ -405,7 +458,8 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration var downshiftOrig = new List<List<Point>>(); var upshiftOrig = new List<List<Point>>(); for (var i = 0; i < gearboxData.Gears.Count; i++) { - shiftPolygons.Add(DeclarationData.Gearbox.ComputeShiftPolygon(i, fullLoadCurves[(uint)(i + 1)], gearboxData.Gears, + shiftPolygons.Add(DeclarationData.Gearbox.ComputeShiftPolygon(GearboxType.AMT, i, fullLoadCurves[(uint)(i + 1)], + gearboxData.Gears, engineData, axlegearRatio, rdyn)); List<Point> tmp1, tmp2, tmp3; @@ -491,7 +545,7 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration var upshiftOrig = new List<List<Point>>(); for (var i = 0; i < gearboxData.Gears.Count; i++) { shiftPolygons.Add( - DeclarationData.Gearbox.ComputeShiftPolygon(i, fullLoadCurves[(uint)(i + 1)], gearboxData.Gears, + DeclarationData.Gearbox.ComputeShiftPolygon(gearboxData.Type, i, fullLoadCurves[(uint)(i + 1)], gearboxData.Gears, engineData, axlegearRatio, rdyn.SI<Meter>()) ); List<Point> tmp1, tmp2, tmp3; diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponentData/ValidationTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponentData/ValidationTest.cs index b45c8b4acb582a0081302961c02e19ddb9a67255..b1f96980a878cacd8159fb39efdcb28c4d2d4236 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponentData/ValidationTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponentData/ValidationTest.cs @@ -627,6 +627,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData public string DigestValue { get; set; } public GearboxType Type { get; set; } public IList<ITransmissionInputData> Gears { get; set; } + ITorqueConverterDeclarationInputData IGearboxDeclarationInputData.TorqueConverter { get { return TorqueConverter; } } public KilogramSquareMeter Inertia { get; set; } public Second TractionInterruption { get; set; } public Second MinTimeBetweenGearshift { get; set; }