diff --git a/VECTO/GUI/VectoJobForm.Designer.vb b/VECTO/GUI/VectoJobForm.Designer.vb index e71d2036e9d4aad2d661212f8df2c818c324e416..c9cc49876c5ed6d527610b1b0702c97c21ba97c1 100644 --- a/VECTO/GUI/VectoJobForm.Designer.vb +++ b/VECTO/GUI/VectoJobForm.Designer.vb @@ -35,6 +35,9 @@ Partial Class VectoJobForm Me.BtDRIrem = New System.Windows.Forms.Button() Me.BtDRIadd = New System.Windows.Forms.Button() Me.GrAux = New System.Windows.Forms.GroupBox() + Me.Label9 = New System.Windows.Forms.Label() + Me.TbAuxPAdd = New System.Windows.Forms.TextBox() + Me.Label8 = New System.Windows.Forms.Label() Me.btnAAUXOpen = New System.Windows.Forms.Button() Me.Label1 = New System.Windows.Forms.Label() Me.btnBrowseAAUXFile = New System.Windows.Forms.Button() @@ -136,9 +139,6 @@ Partial Class VectoJobForm Me.TbGbxTxt = New System.Windows.Forms.TextBox() Me.TbMass = New System.Windows.Forms.TextBox() Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components) - Me.Label8 = New System.Windows.Forms.Label() - Me.TbAuxPAdd = New System.Windows.Forms.TextBox() - Me.Label9 = New System.Windows.Forms.Label() Me.TabPgGen.SuspendLayout() Me.GrCycles.SuspendLayout() Me.GrAux.SuspendLayout() @@ -277,6 +277,31 @@ Partial Class VectoJobForm Me.GrAux.TabStop = False Me.GrAux.Text = "Auxiliaries" ' + 'Label9 + ' + Me.Label9.AutoSize = True + Me.Label9.Location = New System.Drawing.Point(191, 76) + Me.Label9.Name = "Label9" + Me.Label9.Size = New System.Drawing.Size(24, 13) + Me.Label9.TabIndex = 44 + Me.Label9.Text = "[W]" + ' + 'TbAuxPAdd + ' + Me.TbAuxPAdd.Location = New System.Drawing.Point(119, 73) + Me.TbAuxPAdd.Name = "TbAuxPAdd" + Me.TbAuxPAdd.Size = New System.Drawing.Size(66, 20) + Me.TbAuxPAdd.TabIndex = 43 + ' + 'Label8 + ' + Me.Label8.AutoSize = True + Me.Label8.Location = New System.Drawing.Point(7, 76) + Me.Label8.Name = "Label8" + Me.Label8.Size = New System.Drawing.Size(97, 13) + Me.Label8.TabIndex = 42 + Me.Label8.Text = "Constant Aux Load" + ' 'btnAAUXOpen ' Me.btnAAUXOpen.Image = Global.TUGraz.VECTO.My.Resources.Resources.application_export_icon_small @@ -1220,31 +1245,6 @@ Partial Class VectoJobForm Me.TbMass.Size = New System.Drawing.Size(50, 20) Me.TbMass.TabIndex = 3 ' - 'Label8 - ' - Me.Label8.AutoSize = True - Me.Label8.Location = New System.Drawing.Point(7, 76) - Me.Label8.Name = "Label8" - Me.Label8.Size = New System.Drawing.Size(97, 13) - Me.Label8.TabIndex = 42 - Me.Label8.Text = "Constant Aux Load" - ' - 'TbAuxPAdd - ' - Me.TbAuxPAdd.Location = New System.Drawing.Point(119, 73) - Me.TbAuxPAdd.Name = "TbAuxPAdd" - Me.TbAuxPAdd.Size = New System.Drawing.Size(66, 20) - Me.TbAuxPAdd.TabIndex = 43 - ' - 'Label9 - ' - Me.Label9.AutoSize = True - Me.Label9.Location = New System.Drawing.Point(191, 76) - Me.Label9.Name = "Label9" - Me.Label9.Size = New System.Drawing.Size(24, 13) - Me.Label9.TabIndex = 44 - Me.Label9.Text = "[W]" - ' 'VectoJobForm ' Me.AcceptButton = Me.ButOK diff --git a/VECTO/GUI/VectoJobForm.resx b/VECTO/GUI/VectoJobForm.resx index a0374993bdab050d63efa7d5540333feb880ad7f..86bda0298ff9d20a16e9cd1ffc9613b4baff4457 100644 --- a/VECTO/GUI/VectoJobForm.resx +++ b/VECTO/GUI/VectoJobForm.resx @@ -124,7 +124,7 @@ <data name="ButtonVEH.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value> iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADr0AAA69AUf7kK0AAALVSURBVDhPhZJrSJNhGIYXOs1Nc8o8gJWZ+UNEEupPxDAw + YQUAAAAJcEhZcwAADrwAAA68AZW8ckkAAALVSURBVDhPhZJrSJNhGIYXOs1Nc8o8gJWZ+UNEEupPxDAw 0kIrs5JsTOcKRANNEs0827KM0BA1MlSo0G3o1DxkEsso1JqH8rBUSlPzPOfSeajkbu+7NSl/9MD147u/ 776eF96P0VbB7+6Q8tFZJcCH2gj01wsx0BD5F5+aRFA1iTR99ZERjH+HlKHLxexgEoZao0Geh96mY2FC AkBpYlX7HL3PhBpjbXNIYWP5DjaWDKwv3MKMKomKMHIXGDWikaGu5gw8n3LhUWKXZ6wbBL+0tyk/Fwk5 @@ -142,7 +142,7 @@ <data name="ButtonGBX.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value> iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADr0AAA69AUf7kK0AAALVSURBVDhPhZJrSJNhGIYXOs1Nc8o8gJWZ+UNEEupPxDAw + YQUAAAAJcEhZcwAADrwAAA68AZW8ckkAAALVSURBVDhPhZJrSJNhGIYXOs1Nc8o8gJWZ+UNEEupPxDAw 0kIrs5JsTOcKRANNEs0827KM0BA1MlSo0G3o1DxkEsso1JqH8rBUSlPzPOfSeajkbu+7NSl/9MD147u/ 776eF96P0VbB7+6Q8tFZJcCH2gj01wsx0BD5F5+aRFA1iTR99ZERjH+HlKHLxexgEoZao0Geh96mY2FC AkBpYlX7HL3PhBpjbXNIYWP5DjaWDKwv3MKMKomKMHIXGDWikaGu5gw8n3LhUWKXZ6wbBL+0tyk/Fwk5 @@ -160,7 +160,7 @@ <data name="ButtonMAP.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value> iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADr0AAA69AUf7kK0AAALVSURBVDhPhZJrSJNhGIYXOs1Nc8o8gJWZ+UNEEupPxDAw + YQUAAAAJcEhZcwAADrwAAA68AZW8ckkAAALVSURBVDhPhZJrSJNhGIYXOs1Nc8o8gJWZ+UNEEupPxDAw 0kIrs5JsTOcKRANNEs0827KM0BA1MlSo0G3o1DxkEsso1JqH8rBUSlPzPOfSeajkbu+7NSl/9MD147u/ 776eF96P0VbB7+6Q8tFZJcCH2gj01wsx0BD5F5+aRFA1iTR99ZERjH+HlKHLxexgEoZao0Geh96mY2FC AkBpYlX7HL3PhBpjbXNIYWP5DjaWDKwv3MKMKomKMHIXGDWikaGu5gw8n3LhUWKXZ6wbBL+0tyk/Fwk5 diff --git a/VECTO/GUI/VectoJobForm.vb b/VECTO/GUI/VectoJobForm.vb index fa1cf369582efca7eb2aa02b3c5f41eb0f3ed391..73e5f4513c5f1d191589b8284018051758d0e103 100644 --- a/VECTO/GUI/VectoJobForm.vb +++ b/VECTO/GUI/VectoJobForm.vb @@ -42,6 +42,12 @@ Public Class VectoJobForm Private _auxDialog As VehicleAuxiliariesDialog + Enum AuxViewColumns + AuxID = 0 + AuxType = 1 + AuxInputOrTech = 2 + End Enum + 'AA-TB 'Populate Advanced Auxiliaries Private Sub PopulateAdvancedAuxiliaries() @@ -65,13 +71,13 @@ Public Class VectoJobForm TabControl1.TabPages(x).Show() Next - LvAux.Columns(2).Width = -2 + LvAux.Columns(AuxViewColumns.AuxInputOrTech).Width = -2 'Declaration Mode If Cfg.DeclMode Then - LvAux.Columns(2).Text = "Technology" + LvAux.Columns(AuxViewColumns.AuxInputOrTech).Text = "Technology" Else - LvAux.Columns(2).Text = "Input File" + LvAux.Columns(AuxViewColumns.AuxInputOrTech).Text = "Input File" End If TbAuxPAdd.Enabled = Not Cfg.DeclMode @@ -441,11 +447,8 @@ Public Class VectoJobForm For Each entry In auxInput.Auxiliaries 'If entry.AuxiliaryType = AuxiliaryDemandType.Constant Then Continue For Try - Dim lv0 As ListViewItem = New ListViewItem - lv0.SubItems(0).Text = AuxiliaryTypeHelper.GetAuxKey(entry.Type) - lv0.SubItems.Add(AuxiliaryTypeHelper.ToString(entry.Type)) - lv0.SubItems.Add(String.Join(", ", entry.Technology)) - LvAux.Items.Add(lv0) + LvAux.Items.Add(CreateAuxListEntry(AuxiliaryTypeHelper.GetAuxKey(entry.Type), + AuxiliaryTypeHelper.ToString(entry.Type), String.Join("; ", entry.Technology))) Catch ex As Exception End Try Next @@ -479,11 +482,8 @@ Public Class VectoJobForm Continue For End If - Dim lv0 As ListViewItem = New ListViewItem - lv0.SubItems(0).Text = entry.ID - lv0.SubItems.Add(entry.AuxiliaryType.ToString()) - lv0.SubItems.Add(If(entry.DemandMap Is Nothing, "", entry.DemandMap.Source)) - LvAux.Items.Add(lv0) + LvAux.Items.Add(CreateAuxListEntry(entry.ID, entry.AuxiliaryType.ToString(), + If(entry.DemandMap Is Nothing, "", entry.DemandMap.Source))) Next End If @@ -497,7 +497,7 @@ Public Class VectoJobForm Next Catch ex As Exception End Try - + If driver.OverSpeedEcoRoll.Mode = DriverMode.EcoRoll Then RdEcoRoll.Checked = True ElseIf driver.OverSpeedEcoRoll.Mode = DriverMode.Overspeed Then @@ -544,6 +544,13 @@ Public Class VectoJobForm '------------------------------------------------------------- End Sub + Private Function CreateAuxListEntry(auxKey As String, type As String, technology As String) As ListViewItem + Dim lv0 As ListViewItem = New ListViewItem + lv0.SubItems(AuxViewColumns.AuxID).Text = auxKey + lv0.SubItems.Add(type) + lv0.SubItems.Add(technology) + Return lv0 + End Function 'Save file @@ -608,13 +615,14 @@ Public Class VectoJobForm If Cfg.DeclMode Then auxEntry.TechnologyList.Clear() - auxEntry.TechnologyList.Add(lv0.SubItems(2).Text) + auxEntry.TechnologyList.AddRange(lv0.SubItems(AuxViewColumns.AuxInputOrTech).Text.Split(";"c).Select( + Function(x) Trim(x))) Else - auxEntry.Path.Init(GetPath(file), lv0.SubItems(2).Text) + auxEntry.Path.Init(GetPath(file), lv0.SubItems(AuxViewColumns.AuxInputOrTech).Text) End If - auxEntry.Type = lv0.SubItems(1).Text - vectoJob.AuxPaths.Add(lv0.SubItems(0).Text, auxEntry) + auxEntry.Type = lv0.SubItems(AuxViewColumns.AuxType).Text + vectoJob.AuxPaths.Add(lv0.SubItems(AuxViewColumns.AuxID).Text, auxEntry) Next vectoJob.AuxPAdd = TbAuxPAdd.Text.ToDouble(0) @@ -813,19 +821,15 @@ lbDlog: Dim lv0 As ListViewItem For Each lv0 In LvAux.Items - If lv0.SubItems(0).Text = id Then + If lv0.SubItems(AuxViewColumns.AuxID).Text = id Then MsgBox("ID '" & id & "' already defined!", MsgBoxStyle.Critical) _auxDialog.TbID.SelectAll() _auxDialog.TbID.Focus() GoTo lbDlog End If Next - - lv0 = New ListViewItem - lv0.SubItems(0).Text = UCase(Trim(_auxDialog.TbID.Text)) - lv0.SubItems.Add(Trim(_auxDialog.CbType.Text)) - lv0.SubItems.Add(Trim(_auxDialog.TbPath.Text)) - LvAux.Items.Add(lv0) + LvAux.Items.Add(CreateAuxListEntry(UCase(Trim(_auxDialog.TbID.Text)), Trim(_auxDialog.CbType.Text), + Trim(_auxDialog.TbPath.Text))) Change() End If End Sub @@ -856,25 +860,47 @@ lbDlog: _auxDialog.VehPath = GetPath(VectoFile) _auxDialog.CbType.SelectedIndex = -1 - _auxDialog.CbType.Text = selItem.SubItems(1).Text - _auxDialog.TbID.Text = selItem.SubItems(0).Text 'After Type-set! + _auxDialog.CbType.Text = selItem.SubItems(AuxViewColumns.AuxType).Text + _auxDialog.NumAxles = AxleConfigurationHelper.Parse(TbAxleConf.Text).NumAxles() + _auxDialog.TbID.Text = selItem.SubItems(AuxViewColumns.AuxID).Text ' last call, updates GUI If Cfg.DeclMode Then - _auxDialog.CbTech.Text = selItem.SubItems(2).Text - _auxDialog.TbPath.Text = "" + If _auxDialog.TbID.Text = AuxiliaryTypeHelper.GetAuxKey(AuxiliaryType.SteeringPump) Then + Dim parts As String() = selItem.SubItems(AuxViewColumns.AuxInputOrTech).Text.Split(";"c) + _auxDialog.CbTech2.SelectedItem = VehicleAuxiliariesDialog.AxleNotSteered + _auxDialog.CbTech3.SelectedItem = VehicleAuxiliariesDialog.AxleNotSteered + _auxDialog.CbTech4.SelectedItem = VehicleAuxiliariesDialog.AxleNotSteered + If parts.Length > 0 Then _auxDialog.CbTech.SelectedValue = Trim(parts(0)) + If parts.Length > 1 Then _auxDialog.CbTech2.SelectedValue = Trim(parts(1)) + If parts.Length > 2 Then _auxDialog.CbTech3.SelectedValue = Trim(parts(2)) + If parts.Length > 3 Then _auxDialog.CbTech4.SelectedValue = Trim(parts(3)) + Else + _auxDialog.CbTech.SelectedItem = selItem.SubItems(AuxViewColumns.AuxInputOrTech).Text + _auxDialog.TbPath.Text = "" + End If Else _auxDialog.CbTech.SelectedIndex = -1 - _auxDialog.TbPath.Text = selItem.SubItems(2).Text + _auxDialog.TbPath.Text = selItem.SubItems(AuxViewColumns.AuxInputOrTech).Text End If If _auxDialog.ShowDialog = DialogResult.OK Then - selItem.SubItems(0).Text = UCase(Trim(_auxDialog.TbID.Text)) - selItem.SubItems(1).Text = Trim(_auxDialog.CbType.Text) + selItem.SubItems(AuxViewColumns.AuxID).Text = UCase(Trim(_auxDialog.TbID.Text)) + selItem.SubItems(AuxViewColumns.AuxType).Text = Trim(_auxDialog.CbType.Text) If Cfg.DeclMode Then - selItem.SubItems(2).Text = Trim(_auxDialog.CbTech.Text) + If _auxDialog.TbID.Text = AuxiliaryTypeHelper.GetAuxKey(AuxiliaryType.SteeringPump) Then + Dim techlist As List(Of String) = New List(Of String) + techlist.Add(_auxDialog.CbTech.Text) + If _auxDialog.CbTech2.Text <> VehicleAuxiliariesDialog.AxleNotSteered Then techlist.Add(_auxDialog.CbTech2.Text) + If _auxDialog.CbTech3.Text <> VehicleAuxiliariesDialog.AxleNotSteered Then techlist.Add(_auxDialog.CbTech3.Text) + If _auxDialog.CbTech4.Text <> VehicleAuxiliariesDialog.AxleNotSteered Then techlist.Add(_auxDialog.CbTech4.Text) + selItem.SubItems(AuxViewColumns.AuxInputOrTech).Text = String.Join("; ", techlist) + Else + selItem.SubItems(AuxViewColumns.AuxInputOrTech).Text = Trim(_auxDialog.CbTech.Text) + End If + Else - selItem.SubItems(2).Text = Trim(_auxDialog.TbPath.Text) + selItem.SubItems(AuxViewColumns.AuxInputOrTech).Text = Trim(_auxDialog.TbPath.Text) End If Change() diff --git a/VECTO/GUI/VehicleAuxiliariesDialog.Designer.vb b/VECTO/GUI/VehicleAuxiliariesDialog.Designer.vb index 11ae33217fcf1e69e35eca648de6061d7e404fd1..a9258e01aa17770ed070e2a8322c64144c0408e5 100644 --- a/VECTO/GUI/VehicleAuxiliariesDialog.Designer.vb +++ b/VECTO/GUI/VehicleAuxiliariesDialog.Designer.vb @@ -36,21 +36,27 @@ Partial Class VehicleAuxiliariesDialog 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. <DebuggerStepThrough()> _ Private Sub InitializeComponent() - Me.TableLayoutPanel1 = New TableLayoutPanel() - Me.OK_Button = New Button() - Me.Cancel_Button = New Button() - Me.Label1 = New Label() - Me.Label2 = New Label() - Me.Label3 = New Label() - Me.TbID = New TextBox() - Me.TbPath = New TextBox() - Me.BtBrowse = New Button() - Me.CbType = New ComboBox() - Me.LbIDhelp = New Label() - Me.Label4 = New Label() - Me.CbTech = New ComboBox() - Me.PnTech = New Panel() - Me.PnFile = New Panel() + Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel() + Me.OK_Button = New System.Windows.Forms.Button() + Me.Cancel_Button = New System.Windows.Forms.Button() + Me.Label1 = New System.Windows.Forms.Label() + Me.Label2 = New System.Windows.Forms.Label() + Me.Label3 = New System.Windows.Forms.Label() + Me.TbID = New System.Windows.Forms.TextBox() + Me.TbPath = New System.Windows.Forms.TextBox() + Me.BtBrowse = New System.Windows.Forms.Button() + Me.CbType = New System.Windows.Forms.ComboBox() + Me.LbIDhelp = New System.Windows.Forms.Label() + Me.Label4 = New System.Windows.Forms.Label() + Me.CbTech = New System.Windows.Forms.ComboBox() + Me.PnTech = New System.Windows.Forms.Panel() + Me.CbTech4 = New System.Windows.Forms.ComboBox() + Me.CbTech3 = New System.Windows.Forms.ComboBox() + Me.CbTech2 = New System.Windows.Forms.ComboBox() + Me.PnFile = New System.Windows.Forms.Panel() + Me.lbAxl2 = New System.Windows.Forms.Label() + Me.LbAxl3 = New System.Windows.Forms.Label() + Me.LbAxl4 = New System.Windows.Forms.Label() Me.TableLayoutPanel1.SuspendLayout() Me.PnTech.SuspendLayout() Me.PnFile.SuspendLayout() @@ -58,135 +64,168 @@ Partial Class VehicleAuxiliariesDialog ' 'TableLayoutPanel1 ' - Me.TableLayoutPanel1.Anchor = CType((AnchorStyles.Bottom Or AnchorStyles.Right), AnchorStyles) + Me.TableLayoutPanel1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.TableLayoutPanel1.ColumnCount = 2 - Me.TableLayoutPanel1.ColumnStyles.Add(New ColumnStyle(SizeType.Percent, 50.0!)) - Me.TableLayoutPanel1.ColumnStyles.Add(New ColumnStyle(SizeType.Percent, 50.0!)) + Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) + Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) Me.TableLayoutPanel1.Controls.Add(Me.OK_Button, 0, 0) Me.TableLayoutPanel1.Controls.Add(Me.Cancel_Button, 1, 0) - Me.TableLayoutPanel1.Location = New Point(301, 100) + Me.TableLayoutPanel1.Location = New System.Drawing.Point(301, 133) Me.TableLayoutPanel1.Name = "TableLayoutPanel1" Me.TableLayoutPanel1.RowCount = 1 - Me.TableLayoutPanel1.RowStyles.Add(New RowStyle(SizeType.Percent, 50.0!)) - Me.TableLayoutPanel1.Size = New Size(146, 29) + Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) + Me.TableLayoutPanel1.Size = New System.Drawing.Size(146, 29) Me.TableLayoutPanel1.TabIndex = 25 ' 'OK_Button ' - Me.OK_Button.Anchor = AnchorStyles.None - Me.OK_Button.DialogResult = DialogResult.OK - Me.OK_Button.Location = New Point(3, 3) + Me.OK_Button.Anchor = System.Windows.Forms.AnchorStyles.None + Me.OK_Button.DialogResult = System.Windows.Forms.DialogResult.OK + Me.OK_Button.Location = New System.Drawing.Point(3, 3) Me.OK_Button.Name = "OK_Button" - Me.OK_Button.Size = New Size(67, 23) + Me.OK_Button.Size = New System.Drawing.Size(67, 23) Me.OK_Button.TabIndex = 0 Me.OK_Button.Text = "OK" ' 'Cancel_Button ' - Me.Cancel_Button.Anchor = AnchorStyles.None - Me.Cancel_Button.DialogResult = DialogResult.Cancel - Me.Cancel_Button.Location = New Point(76, 3) + Me.Cancel_Button.Anchor = System.Windows.Forms.AnchorStyles.None + Me.Cancel_Button.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.Cancel_Button.Location = New System.Drawing.Point(76, 3) Me.Cancel_Button.Name = "Cancel_Button" - Me.Cancel_Button.Size = New Size(67, 23) + Me.Cancel_Button.Size = New System.Drawing.Size(67, 23) Me.Cancel_Button.TabIndex = 1 Me.Cancel_Button.Text = "Cancel" ' 'Label1 ' Me.Label1.AutoSize = True - Me.Label1.Location = New Point(171, 10) + Me.Label1.Location = New System.Drawing.Point(171, 10) Me.Label1.Name = "Label1" - Me.Label1.Size = New Size(18, 13) + Me.Label1.Size = New System.Drawing.Size(18, 13) Me.Label1.TabIndex = 1 Me.Label1.Text = "ID" ' 'Label2 ' Me.Label2.AutoSize = True - Me.Label2.Location = New Point(9, 10) + Me.Label2.Location = New System.Drawing.Point(9, 10) Me.Label2.Name = "Label2" - Me.Label2.Size = New Size(31, 13) + Me.Label2.Size = New System.Drawing.Size(31, 13) Me.Label2.TabIndex = 1 Me.Label2.Text = "Type" ' 'Label3 ' Me.Label3.AutoSize = True - Me.Label3.Location = New Point(7, 39) + Me.Label3.Location = New System.Drawing.Point(7, 39) Me.Label3.Name = "Label3" - Me.Label3.Size = New Size(50, 13) + Me.Label3.Size = New System.Drawing.Size(50, 13) Me.Label3.TabIndex = 1 Me.Label3.Text = "Input File" ' 'TbID ' - Me.TbID.Location = New Point(195, 7) + Me.TbID.Location = New System.Drawing.Point(195, 7) Me.TbID.Name = "TbID" - Me.TbID.Size = New Size(39, 20) + Me.TbID.Size = New System.Drawing.Size(39, 20) Me.TbID.TabIndex = 5 ' 'TbPath ' - Me.TbPath.Location = New Point(7, 55) + Me.TbPath.Location = New System.Drawing.Point(7, 55) Me.TbPath.Name = "TbPath" - Me.TbPath.Size = New Size(401, 20) + Me.TbPath.Size = New System.Drawing.Size(401, 20) Me.TbPath.TabIndex = 10 ' 'BtBrowse ' - Me.BtBrowse.Image = Open_icon - Me.BtBrowse.Location = New Point(408, 53) + Me.BtBrowse.Image = Global.TUGraz.VECTO.My.Resources.Resources.Open_icon + Me.BtBrowse.Location = New System.Drawing.Point(408, 53) Me.BtBrowse.Name = "BtBrowse" - Me.BtBrowse.Size = New Size(24, 24) + Me.BtBrowse.Size = New System.Drawing.Size(24, 24) Me.BtBrowse.TabIndex = 15 Me.BtBrowse.UseVisualStyleBackColor = True ' 'CbType ' Me.CbType.FormattingEnabled = True - Me.CbType.Location = New Point(46, 7) + Me.CbType.Location = New System.Drawing.Point(46, 7) Me.CbType.Name = "CbType" - Me.CbType.Size = New Size(109, 21) + Me.CbType.Size = New System.Drawing.Size(109, 21) Me.CbType.TabIndex = 0 ' 'LbIDhelp ' Me.LbIDhelp.AutoSize = True - Me.LbIDhelp.Location = New Point(240, 10) + Me.LbIDhelp.Location = New System.Drawing.Point(240, 10) Me.LbIDhelp.Name = "LbIDhelp" - Me.LbIDhelp.Size = New Size(0, 13) + Me.LbIDhelp.Size = New System.Drawing.Size(0, 13) Me.LbIDhelp.TabIndex = 26 ' 'Label4 ' Me.Label4.AutoSize = True - Me.Label4.Location = New Point(6, 9) + Me.Label4.Location = New System.Drawing.Point(6, 9) Me.Label4.Name = "Label4" - Me.Label4.Size = New Size(63, 13) + Me.Label4.Size = New System.Drawing.Size(63, 13) Me.Label4.TabIndex = 1 Me.Label4.Text = "Technology" ' 'CbTech ' - Me.CbTech.DropDownStyle = ComboBoxStyle.DropDownList + Me.CbTech.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList Me.CbTech.FormattingEnabled = True - Me.CbTech.Location = New Point(75, 6) + Me.CbTech.Location = New System.Drawing.Point(75, 6) Me.CbTech.Name = "CbTech" - Me.CbTech.Size = New Size(352, 21) + Me.CbTech.Size = New System.Drawing.Size(352, 21) Me.CbTech.TabIndex = 27 ' 'PnTech ' + Me.PnTech.Controls.Add(Me.LbAxl4) + Me.PnTech.Controls.Add(Me.LbAxl3) + Me.PnTech.Controls.Add(Me.lbAxl2) + Me.PnTech.Controls.Add(Me.CbTech4) + Me.PnTech.Controls.Add(Me.CbTech3) + Me.PnTech.Controls.Add(Me.CbTech2) Me.PnTech.Controls.Add(Me.CbTech) Me.PnTech.Controls.Add(Me.Label4) - Me.PnTech.Location = New Point(12, 12) + Me.PnTech.Location = New System.Drawing.Point(12, 12) Me.PnTech.Name = "PnTech" - Me.PnTech.Size = New Size(435, 34) + Me.PnTech.Size = New System.Drawing.Size(435, 119) Me.PnTech.TabIndex = 28 ' + 'CbTech4 + ' + Me.CbTech4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.CbTech4.FormattingEnabled = True + Me.CbTech4.Location = New System.Drawing.Point(75, 87) + Me.CbTech4.Name = "CbTech4" + Me.CbTech4.Size = New System.Drawing.Size(352, 21) + Me.CbTech4.TabIndex = 30 + ' + 'CbTech3 + ' + Me.CbTech3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.CbTech3.FormattingEnabled = True + Me.CbTech3.Location = New System.Drawing.Point(75, 60) + Me.CbTech3.Name = "CbTech3" + Me.CbTech3.Size = New System.Drawing.Size(352, 21) + Me.CbTech3.TabIndex = 29 + ' + 'CbTech2 + ' + Me.CbTech2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.CbTech2.FormattingEnabled = True + Me.CbTech2.Location = New System.Drawing.Point(75, 33) + Me.CbTech2.Name = "CbTech2" + Me.CbTech2.Size = New System.Drawing.Size(352, 21) + Me.CbTech2.TabIndex = 28 + ' 'PnFile ' - Me.PnFile.Anchor = CType((AnchorStyles.Bottom Or AnchorStyles.Left), AnchorStyles) + Me.PnFile.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) Me.PnFile.Controls.Add(Me.LbIDhelp) Me.PnFile.Controls.Add(Me.BtBrowse) Me.PnFile.Controls.Add(Me.CbType) @@ -195,27 +234,51 @@ Partial Class VehicleAuxiliariesDialog Me.PnFile.Controls.Add(Me.Label2) Me.PnFile.Controls.Add(Me.Label3) Me.PnFile.Controls.Add(Me.Label1) - Me.PnFile.Location = New Point(12, 8) + Me.PnFile.Location = New System.Drawing.Point(12, 12) Me.PnFile.Name = "PnFile" - Me.PnFile.Size = New Size(435, 89) + Me.PnFile.Size = New System.Drawing.Size(435, 118) Me.PnFile.TabIndex = 29 ' - 'F_VEH_AuxDlog + 'lbAxl2 + ' + Me.lbAxl2.AutoSize = True + Me.lbAxl2.Location = New System.Drawing.Point(30, 36) + Me.lbAxl2.Name = "lbAxl2" + Me.lbAxl2.Size = New System.Drawing.Size(39, 13) + Me.lbAxl2.TabIndex = 31 + Me.lbAxl2.Text = "2. Axle" + ' + 'LbAxl3 + ' + Me.LbAxl3.AutoSize = True + Me.LbAxl3.Location = New System.Drawing.Point(30, 63) + Me.LbAxl3.Name = "LbAxl3" + Me.LbAxl3.Size = New System.Drawing.Size(39, 13) + Me.LbAxl3.TabIndex = 32 + Me.LbAxl3.Text = "3. Axle" + ' + 'LbAxl4 + ' + Me.LbAxl4.AutoSize = True + Me.LbAxl4.Location = New System.Drawing.Point(30, 90) + Me.LbAxl4.Name = "LbAxl4" + Me.LbAxl4.Size = New System.Drawing.Size(39, 13) + Me.LbAxl4.TabIndex = 33 + Me.LbAxl4.Text = "4. Axle" + ' + 'VehicleAuxiliariesDialog ' Me.AcceptButton = Me.OK_Button - Me.AutoScaleDimensions = New SizeF(6.0!, 13.0!) - Me.AutoScaleMode = AutoScaleMode.Font Me.CancelButton = Me.Cancel_Button - Me.ClientSize = New Size(459, 141) + Me.ClientSize = New System.Drawing.Size(459, 174) Me.Controls.Add(Me.PnFile) Me.Controls.Add(Me.PnTech) Me.Controls.Add(Me.TableLayoutPanel1) - Me.FormBorderStyle = FormBorderStyle.FixedDialog Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "VehicleAuxiliariesDialog" Me.ShowInTaskbar = False - Me.StartPosition = FormStartPosition.CenterParent + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent Me.Text = "Auxiliary" Me.TableLayoutPanel1.ResumeLayout(False) Me.PnTech.ResumeLayout(False) @@ -240,5 +303,11 @@ Partial Class VehicleAuxiliariesDialog Friend WithEvents CbTech As ComboBox Friend WithEvents PnTech As Panel Friend WithEvents PnFile As Panel + Friend WithEvents CbTech4 As System.Windows.Forms.ComboBox + Friend WithEvents CbTech3 As System.Windows.Forms.ComboBox + Friend WithEvents CbTech2 As System.Windows.Forms.ComboBox + Friend WithEvents LbAxl4 As System.Windows.Forms.Label + Friend WithEvents LbAxl3 As System.Windows.Forms.Label + Friend WithEvents lbAxl2 As System.Windows.Forms.Label End Class diff --git a/VECTO/GUI/VehicleAuxiliariesDialog.vb b/VECTO/GUI/VehicleAuxiliariesDialog.vb index 3e25d287e0604a46f01216acb4d4437e8f561e1c..36b8857ac27d24cca277b2b20cff8228fe5ca81e 100644 --- a/VECTO/GUI/VehicleAuxiliariesDialog.vb +++ b/VECTO/GUI/VehicleAuxiliariesDialog.vb @@ -10,7 +10,9 @@ ' See the LICENSE.txt for the specific language governing permissions and limitations. Option Infer On +Imports System.Linq Imports System.Windows.Forms +Imports TUGraz.VectoCommon.Utils Imports TUGraz.VectoCore.Models.Declaration @@ -19,6 +21,8 @@ Imports TUGraz.VectoCore.Models.Declaration ''' </summary> Public Class VehicleAuxiliariesDialog Public VehPath As String = "" + Public NumAxles As Integer + Public Const AxleNotSteered As String = "Not steered" Public Sub New() InitializeComponent() @@ -29,6 +33,15 @@ Public Class VehicleAuxiliariesDialog CbType.Items.Add("Electric System") PnTech.Visible = Cfg.DeclMode PnFile.Visible = Not Cfg.DeclMode + + CbTech.DisplayMember = "Caption" + CbTech.ValueMember = "Value" + CbTech2.DisplayMember = "Caption" + CbTech2.ValueMember = "Value" + CbTech3.DisplayMember = "Caption" + CbTech3.ValueMember = "Value" + CbTech4.DisplayMember = "Caption" + CbTech4.ValueMember = "Value" End Sub 'Initialise form @@ -38,21 +51,38 @@ Public Class VehicleAuxiliariesDialog 'Set generic values for Declaration mode Private Sub DeclInit() - CbTech.Items.Clear() + + CbTech2.Visible = NumAxles > 1 + CbTech3.Visible = NumAxles > 2 + CbTech4.Visible = NumAxles > 3 + lbAxl2.Visible = NumAxles > 1 + LbAxl3.Visible = NumAxles > 2 + LbAxl4.Visible = NumAxles > 3 Select Case TbID.Text Case VectoCore.Configuration.Constants.Auxiliaries.IDs.Fan - CbTech.Items.AddRange(DeclarationData.Fan.GetTechnologies()) + CbTech.DataSource = + DeclarationData.Fan.GetTechnologies().Select(Function(x) New With {.Caption = x, .Value = x}).ToArray() Case VectoCore.Configuration.Constants.Auxiliaries.IDs.SteeringPump - CbTech.Items.AddRange(DeclarationData.SteeringPump.GetTechnologies()) + Dim notSteered = (New String() {AxleNotSteered}).Concat(DeclarationData.SteeringPump.GetTechnologies()).ToArray() + CbTech.DataSource = + DeclarationData.SteeringPump.GetTechnologies().Select(Function(x) New With {.Caption = x, .Value = x}).ToArray() + + CbTech2.DataSource = notSteered.Select(Function(x) New With {.Caption = x, .Value = x}).ToArray() + CbTech3.DataSource = notSteered.Select(Function(x) New With {.Caption = x, .Value = x}).ToArray() + CbTech4.DataSource = notSteered.Select(Function(x) New With {.Caption = x, .Value = x}).ToArray() Case VectoCore.Configuration.Constants.Auxiliaries.IDs.HeatingVentilationAirCondition - CbTech.Items.AddRange(DeclarationData.HeatingVentilationAirConditioning.GetTechnologies()) + CbTech.DataSource = + DeclarationData.HeatingVentilationAirConditioning.GetTechnologies().Select( + Function(x) New With {.Caption = x, .Value = x}).ToArray() Case VectoCore.Configuration.Constants.Auxiliaries.IDs.ElectricSystem - CbTech.Items.AddRange(DeclarationData.ElectricSystem.GetTechnologies()) + CbTech.DataSource = + DeclarationData.ElectricSystem.GetTechnologies().Select(Function(x) New With {.Caption = x, .Value = x}).ToArray() Case VectoCore.Configuration.Constants.Auxiliaries.IDs.PneumaticSystem - CbTech.Items.AddRange(DeclarationData.PneumaticSystem.GetTechnologies()) + CbTech.DataSource = + DeclarationData.PneumaticSystem.GetTechnologies().Select(Function(x) New With {.Caption = x, .Value = x}).ToArray() End Select If CbTech.Items.Count > 0 Then - CbTech.SelectedIndex = 0 + 'CbTech.SelectedIndex = 0 PnTech.Enabled = True Else PnTech.Enabled = False @@ -132,4 +162,17 @@ Public Class VehicleAuxiliariesDialog LbIDhelp.Text = String.Format("Header in Driving cycle: <AUX_{1}>", Trim(TbID.Text)) End If End Sub + + Private Sub CbTech_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CbTech.SelectedIndexChanged + End Sub + + Private Sub CbTech2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CbTech2.SelectedIndexChanged + CbTech3.Enabled = Not (CbTech2.SelectedValue.ToString() = AxleNotSteered) + If Not CbTech3.Enabled Then CbTech3.SelectedValue = AxleNotSteered + End Sub + + Private Sub CbTech3_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CbTech3.SelectedIndexChanged + CbTech4.Enabled = Not (CbTech3.SelectedValue.ToString() = AxleNotSteered) + If Not CbTech4.Enabled Then CbTech4.SelectedValue = AxleNotSteered + End Sub End Class diff --git a/VECTO/Input Files/VectoJob.vb b/VECTO/Input Files/VectoJob.vb index 7d0837fde7c4eee5753a663182aefd832caf3599..6540f6f7daf9b221e70045fdcda75acd8589f755 100644 --- a/VECTO/Input Files/VectoJob.vb +++ b/VECTO/Input Files/VectoJob.vb @@ -15,6 +15,7 @@ Imports System.Collections.Generic Imports System.ComponentModel.DataAnnotations Imports System.IO Imports System.Linq +Imports System.Text Imports Newtonsoft.Json.Linq Imports TUGraz.VECTO.Input_Files Imports TUGraz.VectoCommon.Exceptions @@ -24,13 +25,15 @@ Imports TUGraz.VectoCommon.Utils Imports TUGraz.VectoCore.InputData.FileIO.JSON Imports TUGraz.VectoCore.InputData.Impl Imports TUGraz.VectoCore.InputData.Reader.Impl +Imports TUGraz.VectoCore.Models.Declaration Imports TUGraz.VectoCore.Models.Simulation.Data Imports TUGraz.VectoCore.Utils <CustomValidation(GetType(VectoJob), "ValidateJob")> Public Class VectoJob Implements IEngineeringInputDataProvider, IDeclarationInputDataProvider, IEngineeringJobInputData, - IDeclarationJobInputData, IDriverEngineeringInputData, IDriverDeclarationInputData + IDeclarationJobInputData, IDriverEngineeringInputData, IDriverDeclarationInputData, IAuxiliariesEngineeringInputData, + IAuxiliariesDeclarationInputData Private Const FormatVersion As Short = 3 @@ -638,7 +641,7 @@ Public Class VectoJob Private Shared Function ValidateVehicleJob(vectoJob As VectoJob, mode As ExecutionMode) As ValidationResult - Dim jobData As IEnumerable(Of VectoRunData) + Dim jobData As VectoRunData vectoJob._vehicleInputData = New JSONComponentInputData(vectoJob._vehicleFile.FullPath) vectoJob._engineInputData = New JSONComponentInputData(vectoJob._engineFile.FullPath) @@ -676,7 +679,7 @@ Public Class VectoJob Dim dataFactory As DeclarationModeVectoRunDataFactory = New DeclarationModeVectoRunDataFactory(vectoJob, Nothing) - jobData = dataFactory.NextRun() + jobData = dataFactory.NextRun().First() Else If vectoJob._vehicleInputData.VehicleInputData.SavedInDeclarationMode Then result.Add(New ValidationResult("Vehicle File is not in Engineering Mode")) @@ -692,11 +695,11 @@ Public Class VectoJob New ValidationResult("Vecto Job Configuration is invalid. ", result.Select(Function(r) r.ErrorMessage).ToList()) End If Dim dataFactory As EngineeringModeVectoRunDataFactory = New EngineeringModeVectoRunDataFactory(vectoJob) - jobData = dataFactory.NextRun() + jobData = dataFactory.NextRun().First() End If - jobData.Validate(If(Cfg.DeclMode, ExecutionMode.Declaration, ExecutionMode.Engineering)) + result = jobData.Validate(If(Cfg.DeclMode, ExecutionMode.Declaration, ExecutionMode.Engineering)) If result.Any() Then Return _ New ValidationResult("Vecto Job Configuration is invalid. ", result.Select(Function(r) r.ErrorMessage).ToList()) @@ -730,7 +733,7 @@ Public Class VectoJob Public Function IDeclarationInputDataProvider_JobInputData() As IDeclarationJobInputData _ Implements IDeclarationInputDataProvider.JobInputData - Throw New NotImplementedException + Return Me End Function Public ReadOnly Property VehicleInputData As IVehicleEngineeringInputData _ @@ -813,7 +816,13 @@ Public Class VectoJob Public Function AuxiliaryInputData() As IAuxiliariesEngineeringInputData _ Implements IEngineeringInputDataProvider.AuxiliaryInputData - Throw New NotImplementedException + Return _vehicleInputData.AuxiliaryInputData() + End Function + + Public Function IDeclarationInputDataProvider_AuxiliaryInputData() As IAuxiliariesDeclarationInputData _ + Implements IDeclarationInputDataProvider.AuxiliaryInputData + + Return Me End Function Public ReadOnly Property IDeclarationInputDataProvider_RetarderInputData As IRetarderInputData _ @@ -823,11 +832,6 @@ Public Class VectoJob End Get End Property - Public Function IDeclarationInputDataProvider_AuxiliaryInputData() As IAuxiliariesDeclarationInputData _ - Implements IDeclarationInputDataProvider.AuxiliaryInputData - Throw New NotImplementedException - End Function - Public ReadOnly Property RetarderInputData As IRetarderInputData _ Implements IEngineeringInputDataProvider.RetarderInputData Get @@ -863,6 +867,7 @@ Public Class VectoJob End Get End Property + Public ReadOnly Property IDriverDeclarationInputData_StartStop As IStartStopDeclarationInputData _ Implements IDriverDeclarationInputData.StartStop Get @@ -924,6 +929,72 @@ Public Class VectoJob Public Property AuxPAdd As Double + Public ReadOnly Property IAuxiliariesDeclarationInputData_SavedInDeclarationMode As Boolean _ + Implements IAuxiliariesDeclarationInputData.SavedInDeclarationMode + Get + Return SavedInDeclMode + End Get + End Property + + Public ReadOnly Property Auxiliaries As IList(Of IAuxiliaryEngineeringInputData) _ + Implements IAuxiliariesEngineeringInputData.Auxiliaries + Get + Return AuxData().Cast(Of IAuxiliaryEngineeringInputData).ToList() + End Get + End Property + + Public ReadOnly Property IAuxiliariesEngineeringInputData_AdvancedAuxiliaryFilePath As String _ + Implements IAuxiliariesEngineeringInputData.AdvancedAuxiliaryFilePath + Get + Return AdvancedAuxiliaryFilePath + End Get + End Property + + Public ReadOnly Property IAuxiliariesEngineeringInputData_AuxiliaryVersion As String _ + Implements IAuxiliariesEngineeringInputData.AuxiliaryVersion + Get + Return AuxiliaryVersion + End Get + End Property + + Public ReadOnly Property IAuxiliariesEngineeringInputData_AuxiliaryAssembly As AuxiliaryModel _ + Implements IAuxiliariesEngineeringInputData.AuxiliaryAssembly + Get + Return AuxiliaryModelHelper.Parse(AuxiliaryAssembly) + End Get + End Property + + Public ReadOnly Property IAuxiliariesDeclarationInputData_Auxiliaries As IList(Of IAuxiliaryDeclarationInputData) _ + Implements IAuxiliariesDeclarationInputData.Auxiliaries + Get + Return AuxData().Cast(Of IAuxiliaryDeclarationInputData).ToList() + End Get + End Property + + Protected Function AuxData() As IList(Of AuxiliaryDataInputData) + Dim retVal As List(Of AuxiliaryDataInputData) = New List(Of AuxiliaryDataInputData) + + For Each auxEntry As KeyValuePair(Of String, AuxEntry) In AuxPaths + Dim theAuxData As AuxiliaryDataInputData = New AuxiliaryDataInputData() With { + .Type = AuxiliaryTypeHelper.Parse(auxEntry.Value.Type), + .Technology = auxEntry.Value.TechnologyList, + .ID = auxEntry.Key + } + retVal.Add(theAuxData) + If Not File.Exists(auxEntry.Value.Path.FullPath) Then Continue For + + Dim stream As StreamReader = New StreamReader(auxEntry.Value.Path.FullPath) + stream.ReadLine() ' skip header "Transmission ration to engine rpm [-]" + theAuxData.TransmissionRatio = stream.ReadLine().IndulgentParse() + stream.ReadLine() ' skip header "Efficiency to engine [-]" + theAuxData.EfficiencyToEngine = stream.ReadLine().IndulgentParse() + stream.ReadLine() ' skip header "Efficiency auxiliary to supply [-]" + theAuxData.EfficiencyToSupply = stream.ReadLine().IndulgentParse() + theAuxData.DemandMap = VectoCSVFile.ReadStream(New MemoryStream(Encoding.UTF8.GetBytes(stream.ReadToEnd()))) + Next + + Return retVal + End Function #End Region End Class diff --git a/VectoCore/VectoCore/Models/Simulation/Data/VectoRunData.cs b/VectoCore/VectoCore/Models/Simulation/Data/VectoRunData.cs index 6be166a35328a5fc4b8456d363dbbf40f2cc8d18..52f4d456a618408f8f453cae091583e715967287 100644 --- a/VectoCore/VectoCore/Models/Simulation/Data/VectoRunData.cs +++ b/VectoCore/VectoCore/Models/Simulation/Data/VectoRunData.cs @@ -102,12 +102,8 @@ namespace TUGraz.VectoCore.Models.Simulation.Data // ReSharper disable once InconsistentNaming public string ID; - [Required] public AuxiliaryType Type; - public IList<string> Technology; - public string[] TechList; - [SIRange(0, 100 * Constants.Kilo)] public Watt PowerDemand; [Required] public AuxiliaryDemandType DemandType;