diff --git a/VECTO/File Browser/FileBrowserModule.vb b/VECTO/File Browser/FileBrowserModule.vb index 896404162a94ae297a61af31c671c188572987c0..113469483b0475459d642992b54d5ae4ae140e6d 100644 --- a/VECTO/File Browser/FileBrowserModule.vb +++ b/VECTO/File Browser/FileBrowserModule.vb @@ -70,6 +70,7 @@ Public Module FileBrowserModule public EmADCLossMapFileBrowser As FileBrowser + Public IHPCFileBrowser As FileBrowser Public IHPCPowerMapFileBrowser As FileBrowser Public IHPCFullLoadCurveFileBrowser As FileBrowser public IHPCDragCurveFileBrowser As FileBrowser diff --git a/VECTO/GUI/IHPCForm.Designer.vb b/VECTO/GUI/IHPCForm.Designer.vb index 62d335a78dd87d64c34d807fcb1129db44236980..a72bf0ca60bb699c6c544042869f422e75906fcb 100644 --- a/VECTO/GUI/IHPCForm.Designer.vb +++ b/VECTO/GUI/IHPCForm.Designer.vb @@ -63,12 +63,12 @@ Partial Class IHPCForm Me.tbVoltage1 = New System.Windows.Forms.TextBox() Me.Label39 = New System.Windows.Forms.Label() Me.Label3 = New System.Windows.Forms.Label() - Me.tbContinousTorque1 = New System.Windows.Forms.TextBox() - Me.tbContinousTorqueSpeed1 = New System.Windows.Forms.TextBox() + Me.tbContinuousTorque1 = New System.Windows.Forms.TextBox() + Me.tbContinuousTorqueSpeed1 = New System.Windows.Forms.TextBox() Me.Label15 = New System.Windows.Forms.Label() Me.Label42 = New System.Windows.Forms.Label() Me.Label14 = New System.Windows.Forms.Label() - Me.tboverloadTorqueSpeed1 = New System.Windows.Forms.TextBox() + Me.tbOverloadTorqueSpeed1 = New System.Windows.Forms.TextBox() Me.Label41 = New System.Windows.Forms.Label() Me.tbOverloadTorque1 = New System.Windows.Forms.TextBox() Me.Label12 = New System.Windows.Forms.Label() @@ -96,8 +96,8 @@ Partial Class IHPCForm Me.tbVoltage2 = New System.Windows.Forms.TextBox() Me.Label20 = New System.Windows.Forms.Label() Me.Label21 = New System.Windows.Forms.Label() - Me.tbContinousTorque2 = New System.Windows.Forms.TextBox() - Me.tbContinousTorqueSpeed2 = New System.Windows.Forms.TextBox() + Me.tbContinuousTorque2 = New System.Windows.Forms.TextBox() + Me.tbContinuousTorqueSpeed2 = New System.Windows.Forms.TextBox() Me.Label27 = New System.Windows.Forms.Label() Me.Label23 = New System.Windows.Forms.Label() Me.tbOverloadTorqueSpeed2 = New System.Windows.Forms.TextBox() @@ -177,7 +177,7 @@ Partial Class IHPCForm Me.FlowLayoutPanel6.Controls.Add(Me.lblinertiaUnit) Me.FlowLayoutPanel6.Location = New System.Drawing.Point(12, 106) Me.FlowLayoutPanel6.Name = "FlowLayoutPanel6" - Me.FlowLayoutPanel6.Size = New System.Drawing.Size(158, 26) + Me.FlowLayoutPanel6.Size = New System.Drawing.Size(147, 26) Me.FlowLayoutPanel6.TabIndex = 72 ' 'Label51 @@ -213,7 +213,7 @@ Partial Class IHPCForm Me.FlowLayoutPanel8.Controls.Add(Me.Label52) Me.FlowLayoutPanel8.Controls.Add(Me.tbThermalOverload) Me.FlowLayoutPanel8.Controls.Add(Me.Label10) - Me.FlowLayoutPanel8.Location = New System.Drawing.Point(176, 106) + Me.FlowLayoutPanel8.Location = New System.Drawing.Point(162, 106) Me.FlowLayoutPanel8.Name = "FlowLayoutPanel8" Me.FlowLayoutPanel8.Size = New System.Drawing.Size(305, 26) Me.FlowLayoutPanel8.TabIndex = 74 @@ -223,7 +223,7 @@ Partial Class IHPCForm Me.Label52.Anchor = System.Windows.Forms.AnchorStyles.Right Me.Label52.AutoSize = true Me.Label52.Location = New System.Drawing.Point(3, 6) - Me.Label52.Margin = New System.Windows.Forms.Padding(3, 0, 10, 0) + Me.Label52.Margin = New System.Windows.Forms.Padding(3, 0, 0, 0) Me.Label52.Name = "Label52" Me.Label52.Size = New System.Drawing.Size(173, 13) Me.Label52.TabIndex = 50 @@ -232,8 +232,8 @@ Partial Class IHPCForm 'tbThermalOverload ' Me.tbThermalOverload.Anchor = System.Windows.Forms.AnchorStyles.Left - Me.tbThermalOverload.Location = New System.Drawing.Point(216, 3) - Me.tbThermalOverload.Margin = New System.Windows.Forms.Padding(30, 3, 3, 3) + Me.tbThermalOverload.Location = New System.Drawing.Point(181, 3) + Me.tbThermalOverload.Margin = New System.Windows.Forms.Padding(5, 3, 3, 3) Me.tbThermalOverload.Name = "tbThermalOverload" Me.tbThermalOverload.Size = New System.Drawing.Size(56, 20) Me.tbThermalOverload.TabIndex = 51 @@ -242,7 +242,8 @@ Partial Class IHPCForm ' Me.Label10.Anchor = System.Windows.Forms.AnchorStyles.None Me.Label10.AutoSize = true - Me.Label10.Location = New System.Drawing.Point(278, 6) + Me.Label10.Location = New System.Drawing.Point(242, 6) + Me.Label10.Margin = New System.Windows.Forms.Padding(2, 0, 3, 0) Me.Label10.Name = "Label10" Me.Label10.Size = New System.Drawing.Size(16, 13) Me.Label10.TabIndex = 67 @@ -468,12 +469,12 @@ Partial Class IHPCForm Me.TableLayoutPanel1.Controls.Add(Me.tbVoltage1, 1, 0) Me.TableLayoutPanel1.Controls.Add(Me.Label39, 0, 1) Me.TableLayoutPanel1.Controls.Add(Me.Label3, 0, 2) - Me.TableLayoutPanel1.Controls.Add(Me.tbContinousTorque1, 1, 1) - Me.TableLayoutPanel1.Controls.Add(Me.tbContinousTorqueSpeed1, 1, 2) + Me.TableLayoutPanel1.Controls.Add(Me.tbContinuousTorque1, 1, 1) + Me.TableLayoutPanel1.Controls.Add(Me.tbContinuousTorqueSpeed1, 1, 2) Me.TableLayoutPanel1.Controls.Add(Me.Label15, 2, 2) Me.TableLayoutPanel1.Controls.Add(Me.Label42, 3, 2) Me.TableLayoutPanel1.Controls.Add(Me.Label14, 5, 2) - Me.TableLayoutPanel1.Controls.Add(Me.tboverloadTorqueSpeed1, 4, 2) + Me.TableLayoutPanel1.Controls.Add(Me.tbOverloadTorqueSpeed1, 4, 2) Me.TableLayoutPanel1.Controls.Add(Me.Label41, 3, 1) Me.TableLayoutPanel1.Controls.Add(Me.tbOverloadTorque1, 4, 1) Me.TableLayoutPanel1.Controls.Add(Me.Label12, 5, 1) @@ -577,23 +578,23 @@ Partial Class IHPCForm Me.Label3.TabIndex = 6 Me.Label3.Text = "Continuous Torque Speed" ' - 'tbContinousTorque1 + 'tbContinuousTorque1 ' - Me.tbContinousTorque1.Anchor = System.Windows.Forms.AnchorStyles.None - Me.tbContinousTorque1.Location = New System.Drawing.Point(143, 30) - Me.tbContinousTorque1.Margin = New System.Windows.Forms.Padding(0) - Me.tbContinousTorque1.Name = "tbContinousTorque1" - Me.tbContinousTorque1.Size = New System.Drawing.Size(56, 20) - Me.tbContinousTorque1.TabIndex = 4 + Me.tbContinuousTorque1.Anchor = System.Windows.Forms.AnchorStyles.None + Me.tbContinuousTorque1.Location = New System.Drawing.Point(143, 30) + Me.tbContinuousTorque1.Margin = New System.Windows.Forms.Padding(0) + Me.tbContinuousTorque1.Name = "tbContinuousTorque1" + Me.tbContinuousTorque1.Size = New System.Drawing.Size(56, 20) + Me.tbContinuousTorque1.TabIndex = 4 ' - 'tbContinousTorqueSpeed1 + 'tbContinuousTorqueSpeed1 ' - Me.tbContinousTorqueSpeed1.Anchor = System.Windows.Forms.AnchorStyles.None - Me.tbContinousTorqueSpeed1.Location = New System.Drawing.Point(143, 58) - Me.tbContinousTorqueSpeed1.Margin = New System.Windows.Forms.Padding(0) - Me.tbContinousTorqueSpeed1.Name = "tbContinousTorqueSpeed1" - Me.tbContinousTorqueSpeed1.Size = New System.Drawing.Size(56, 20) - Me.tbContinousTorqueSpeed1.TabIndex = 6 + Me.tbContinuousTorqueSpeed1.Anchor = System.Windows.Forms.AnchorStyles.None + Me.tbContinuousTorqueSpeed1.Location = New System.Drawing.Point(143, 58) + Me.tbContinuousTorqueSpeed1.Margin = New System.Windows.Forms.Padding(0) + Me.tbContinuousTorqueSpeed1.Name = "tbContinuousTorqueSpeed1" + Me.tbContinuousTorqueSpeed1.Size = New System.Drawing.Size(56, 20) + Me.tbContinuousTorqueSpeed1.TabIndex = 6 ' 'Label15 ' @@ -627,13 +628,13 @@ Partial Class IHPCForm Me.Label14.TabIndex = 66 Me.Label14.Text = "[rpm]" ' - 'tboverloadTorqueSpeed1 + 'tbOverloadTorqueSpeed1 ' - Me.tboverloadTorqueSpeed1.Anchor = System.Windows.Forms.AnchorStyles.None - Me.tboverloadTorqueSpeed1.Location = New System.Drawing.Point(363, 58) - Me.tboverloadTorqueSpeed1.Name = "tboverloadTorqueSpeed1" - Me.tboverloadTorqueSpeed1.Size = New System.Drawing.Size(56, 20) - Me.tboverloadTorqueSpeed1.TabIndex = 10 + Me.tbOverloadTorqueSpeed1.Anchor = System.Windows.Forms.AnchorStyles.None + Me.tbOverloadTorqueSpeed1.Location = New System.Drawing.Point(363, 58) + Me.tbOverloadTorqueSpeed1.Name = "tbOverloadTorqueSpeed1" + Me.tbOverloadTorqueSpeed1.Size = New System.Drawing.Size(56, 20) + Me.tbOverloadTorqueSpeed1.TabIndex = 10 ' 'Label41 ' @@ -832,8 +833,8 @@ Partial Class IHPCForm Me.TableLayoutPanel4.Controls.Add(Me.tbVoltage2, 1, 0) Me.TableLayoutPanel4.Controls.Add(Me.Label20, 0, 1) Me.TableLayoutPanel4.Controls.Add(Me.Label21, 0, 2) - Me.TableLayoutPanel4.Controls.Add(Me.tbContinousTorque2, 1, 1) - Me.TableLayoutPanel4.Controls.Add(Me.tbContinousTorqueSpeed2, 1, 2) + Me.TableLayoutPanel4.Controls.Add(Me.tbContinuousTorque2, 1, 1) + Me.TableLayoutPanel4.Controls.Add(Me.tbContinuousTorqueSpeed2, 1, 2) Me.TableLayoutPanel4.Controls.Add(Me.Label27, 2, 2) Me.TableLayoutPanel4.Controls.Add(Me.Label23, 3, 2) Me.TableLayoutPanel4.Controls.Add(Me.tbOverloadTorqueSpeed2, 4, 2) @@ -939,21 +940,21 @@ Partial Class IHPCForm Me.Label21.TabIndex = 6 Me.Label21.Text = "Continuous Torque Speed" ' - 'tbContinousTorque2 + 'tbContinuousTorque2 ' - Me.tbContinousTorque2.Anchor = System.Windows.Forms.AnchorStyles.None - Me.tbContinousTorque2.Location = New System.Drawing.Point(143, 30) - Me.tbContinousTorque2.Name = "tbContinousTorque2" - Me.tbContinousTorque2.Size = New System.Drawing.Size(56, 20) - Me.tbContinousTorque2.TabIndex = 4 + Me.tbContinuousTorque2.Anchor = System.Windows.Forms.AnchorStyles.None + Me.tbContinuousTorque2.Location = New System.Drawing.Point(143, 30) + Me.tbContinuousTorque2.Name = "tbContinuousTorque2" + Me.tbContinuousTorque2.Size = New System.Drawing.Size(56, 20) + Me.tbContinuousTorque2.TabIndex = 4 ' - 'tbContinousTorqueSpeed2 + 'tbContinuousTorqueSpeed2 ' - Me.tbContinousTorqueSpeed2.Anchor = System.Windows.Forms.AnchorStyles.None - Me.tbContinousTorqueSpeed2.Location = New System.Drawing.Point(143, 58) - Me.tbContinousTorqueSpeed2.Name = "tbContinousTorqueSpeed2" - Me.tbContinousTorqueSpeed2.Size = New System.Drawing.Size(56, 20) - Me.tbContinousTorqueSpeed2.TabIndex = 6 + Me.tbContinuousTorqueSpeed2.Anchor = System.Windows.Forms.AnchorStyles.None + Me.tbContinuousTorqueSpeed2.Location = New System.Drawing.Point(143, 58) + Me.tbContinuousTorqueSpeed2.Name = "tbContinuousTorqueSpeed2" + Me.tbContinuousTorqueSpeed2.Size = New System.Drawing.Size(56, 20) + Me.tbContinuousTorqueSpeed2.TabIndex = 6 ' 'Label27 ' @@ -1253,12 +1254,12 @@ End Sub Friend WithEvents tbVoltage1 As TextBox Friend WithEvents Label39 As Label Friend WithEvents Label3 As Label - Friend WithEvents tbContinousTorque1 As TextBox - Friend WithEvents tbContinousTorqueSpeed1 As TextBox + Friend WithEvents tbContinuousTorque1 As TextBox + Friend WithEvents tbContinuousTorqueSpeed1 As TextBox Friend WithEvents Label15 As Label Friend WithEvents Label42 As Label Friend WithEvents Label14 As Label - Friend WithEvents tboverloadTorqueSpeed1 As TextBox + Friend WithEvents tbOverloadTorqueSpeed1 As TextBox Friend WithEvents Label41 As Label Friend WithEvents tbOverloadTorque1 As TextBox Friend WithEvents Label12 As Label @@ -1277,8 +1278,8 @@ End Sub Friend WithEvents tbVoltage2 As TextBox Friend WithEvents Label20 As Label Friend WithEvents Label21 As Label - Friend WithEvents tbContinousTorque2 As TextBox - Friend WithEvents tbContinousTorqueSpeed2 As TextBox + Friend WithEvents tbContinuousTorque2 As TextBox + Friend WithEvents tbContinuousTorqueSpeed2 As TextBox Friend WithEvents Label27 As Label Friend WithEvents Label23 As Label Friend WithEvents tbOverloadTorqueSpeed2 As TextBox diff --git a/VECTO/GUI/IHPCForm.vb b/VECTO/GUI/IHPCForm.vb index 9bcf0e163084e7fe28f8124c6c3236d8d492fb0f..86091c649a71f749529997dae126f12d4c01c817 100644 --- a/VECTO/GUI/IHPCForm.vb +++ b/VECTO/GUI/IHPCForm.vb @@ -1,14 +1,18 @@ -Imports TUGraz.VectoCommon.InputData +Imports System.IO +Imports TUGraz.VectoCommon.InputData Imports TUGraz.VectoCommon.Utils Imports TUGraz.VectoCore.InputData.FileIO.JSON Public Class IHPCForm + Public JobDir As String = "" + Private _ihpcFilePath as String = "" Private _changed as Boolean Private _dragCurveFilePath as String Private _flCurveFilePath1 as String Private _flCurveFilePath2 as String + #Region "Set JSON Data" Public Sub ReadIHPCFile(file As String) @@ -28,11 +32,11 @@ Public Class IHPCForm Private Sub SetVoltageLevelLow(voltageLevel as IElectricMotorVoltageLevel) tbVoltage1.Text = voltageLevel.VoltageLevel.ToGUIFormat() - tbContinousTorque1.Text = voltageLevel.ContinuousTorque.ToGUIFormat() - tbContinousTorqueSpeed1.Text = voltageLevel.ContinuousTorqueSpeed.AsRPM.ToGUIFormat() + tbContinuousTorque1.Text = voltageLevel.ContinuousTorque.ToGUIFormat() + tbContinuousTorqueSpeed1.Text = voltageLevel.ContinuousTorqueSpeed.AsRPM.ToGUIFormat() tbOverloadTime1.Text = voltageLevel.OverloadTime.ToGUIFormat() tbOverloadTorque1.Text = voltageLevel.OverloadTorque.ToGUIFormat() - tboverloadTorqueSpeed1.Text = voltageLevel.OverloadTestSpeed.AsRPM.ToGUIFormat() + tbOverloadTorqueSpeed1.Text = voltageLevel.OverloadTestSpeed.AsRPM.ToGUIFormat() tbFLCurve1.Text = voltageLevel.FullLoadCurve.Source SetPowerMapEntries(_lvPowerMap1, voltageLevel.PowerMap) @@ -41,11 +45,11 @@ Public Class IHPCForm Private Sub SetVoltageLevelHigh(voltageLevel as IElectricMotorVoltageLevel) tbVoltage2.Text = voltageLevel.VoltageLevel.ToGUIFormat() - tbContinousTorque2.Text = voltageLevel.ContinuousTorque.ToGUIFormat() - tbContinousTorqueSpeed2.Text = voltageLevel.ContinuousTorqueSpeed.AsRPM.ToGUIFormat() + tbContinuousTorque2.Text = voltageLevel.ContinuousTorque.ToGUIFormat() + tbContinuousTorqueSpeed2.Text = voltageLevel.ContinuousTorqueSpeed.AsRPM.ToGUIFormat() tbOverloadTime2.Text = voltageLevel.OverloadTime.ToGUIFormat() tbOverloadTorque2.Text = voltageLevel.OverloadTorque.ToGUIFormat() - tboverloadTorqueSpeed1.Text = voltageLevel.OverloadTestSpeed.AsRPM.ToGUIFormat() + tbOverloadTorqueSpeed2.Text = voltageLevel.OverloadTestSpeed.AsRPM.ToGUIFormat() tbFLCurve2.Text = voltageLevel.FullLoadCurve.Source SetPowerMapEntries(_lvPowerMap2, voltageLevel.PowerMap) @@ -75,20 +79,20 @@ Public Class IHPCForm tbDragCurve.Text = "" tbVoltage1.Text = "" - tbContinousTorque1.Text = "" - tbContinousTorqueSpeed1.Text = "" + tbContinuousTorque1.Text = "" + tbContinuousTorqueSpeed1.Text = "" tbOverloadTime1.Text = "" tbOverloadTorque1.Text = "" - tboverloadTorqueSpeed1.Text = "" + tbOverloadTorqueSpeed1.Text = "" tbFLCurve1.Text = "" RemoveAllListViewItems(_lvPowerMap1) tbVoltage2.Text = "" - tbContinousTorque2.Text = "" - tbContinousTorqueSpeed2.Text = "" + tbContinuousTorque2.Text = "" + tbContinuousTorqueSpeed2.Text = "" tbOverloadTime2.Text = "" tbOverloadTorque2.Text = "" - tboverloadTorqueSpeed1.Text = "" + tbOverloadTorqueSpeed1.Text = "" tbFLCurve2.Text = "" RemoveAllListViewItems(_lvPowerMap2) @@ -136,10 +140,13 @@ Public Class IHPCForm End Sub Private Sub AddListViewItem(listView As ListView) + IHPCPowerMapInputDialog.Clear() + If IHPCPowerMapInputDialog.ShowDialog() = DialogResult.OK Then Dim gear = Convert.ToInt32(IHPCPowerMapInputDialog.tbGear.Text) Dim filePath = IHPCPowerMapInputDialog.tbInputFile.Text listView.Items.Add(CreateListViewItem(gear, filePath)) + Change() End If End Sub @@ -156,6 +163,7 @@ Public Class IHPCForm Exit Sub Else listView.Items(listView.Items.Count - 1).Remove() + Change() End If End Sub @@ -166,8 +174,7 @@ Public Class IHPCForm Private Sub lvPowerMap2_DoubleClick(sender As Object, e As EventArgs) Handles lvPowerMap2.DoubleClick EditEntry(lvPowerMap2) End Sub - - + Private Sub EditEntry( listView As ListView) If listView.SelectedItems.Count = 0 Then Exit Sub Dim entry As ListViewItem = listView.SelectedItems(0) @@ -186,13 +193,375 @@ Public Class IHPCForm End Sub Private Sub btSave_Click(sender As Object, e As EventArgs) Handles btSave.Click - + SaveOrSaveAs(true) End Sub Private Sub btCancel_Click(sender As Object, e As EventArgs) Handles btCancel.Click + Close() + End Sub + Private Sub ToolStripBtNew_Click(sender As Object, e As EventArgs) Handles ToolStripBtNew.Click + ClearIHPC() End Sub + Private Sub ToolStripBtOpen_Click(sender As Object, e As EventArgs) Handles ToolStripBtOpen.Click + If IHPCFileBrowser.OpenDialog(_ihpcFilePath) Then + Try + ReadIHPCFile(IHPCFileBrowser.Files(0)) + Catch ex As Exception + MsgBox(ex.Message, MsgBoxStyle.OkOnly, $"Error loading IHPC(.{IHPCFileBrowser.Extensions}) File") + End Try + End If + End Sub + Private Sub ToolStripBtSave_Click(sender As Object, e As EventArgs) Handles ToolStripBtSave.Click + SaveOrSaveAs(False) + End Sub + + Private Sub ToolStripBtSaveAs_Click(sender As Object, e As EventArgs) Handles ToolStripBtSaveAs.Click + SaveOrSaveAs(True) + End Sub + Private Sub ToolStripBtSendTo_Click(sender As Object, e As EventArgs) Handles ToolStripBtSendTo.Click + If ChangeCheckCancel() Then Exit Sub + + If _ihpcFilePath= "" Then + If MsgBox("Save file now?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then + If Not SaveOrSaveAs(True) Then Exit Sub + Else + Exit Sub + End If + End If + + If Not VectoJobForm.Visible Then + JobDir = "" + VectoJobForm.Show() + VectoJobForm.VectoNew() + Else + VectoJobForm.WindowState = FormWindowState.Normal + End If + + VectoJobForm.TbENG.Text = GetFilenameWithoutDirectory(_ihpcFilePath, JobDir) + End Sub + + + Private Function ChangeCheckCancel() As Boolean + If _changed Then + Select Case MsgBox("Save changes ?", MsgBoxStyle.YesNoCancel) + Case MsgBoxResult.Yes + Return Not SaveOrSaveAs(False) + Case MsgBoxResult.Cancel + Return True + Case Else + _changed = False + Return False + End Select + Else + Return False + End If + End Function + + + Private Function SaveOrSaveAs(ByVal saveAs As Boolean) As Boolean + If ValidateData() = False Then _ + Return False + + If _ihpcFilePath = "" Or saveAs Then + If IHPCFileBrowser.SaveDialog(_ihpcFilePath) Then + _ihpcFilePath = IHPCFileBrowser.Files(0) + Else + Return False + End If + End If + Return SaveIHPCToFile(_ihpcFilePath) + End Function + + Private Function SaveIHPCToFile(ByVal ihpcFilePath As String) As Boolean + Dim ihpcInputData = New IHPCInputData + + ihpcInputData.SetCommonEntries(tbModel.Text, tbInertia.Text, tbDragCurve.Text, tbThermalOverload.Text) + ihpcInputData.SetVoltageLevelEntries(tbVoltage1.Text, tbContinuousTorque1.Text, tbContinuousTorqueSpeed1.Text, + tbOverloadTime1.Text, tbOverloadTorque1.Text, tbOverloadTorqueSpeed1.Text, + tbFLCurve1.Text, lvPowerMap1) + ihpcInputData.SetVoltageLevelEntries(tbVoltage2.Text, tbContinuousTorque2.Text, tbContinuousTorqueSpeed2.Text, + tbOverloadTime2.Text, tbOverloadTorque2.Text, tbOverloadTorqueSpeed2.Text, + tbFLCurve2.Text, lvPowerMap2) + + + If Not ihpcInputData.SaveFile(ihpcFilePath) Then + MsgBox("Cannot save to " & ihpcFilePath, MsgBoxStyle.Critical) + Return False + End If + + _changed = False + LbStatus.Text = "" + + Return True + End Function + + #End Region +#Region "Validation" + + Private Function ValidateData() As Boolean + + If ValidateModel() = False Then Return False + If ValidateInertia() = False Then Return False + If ValidateThermalOverloadFactor() = False Then Return False + If ValidateDragCurve() = False Then Return False + + If ValidateVoltage(tbVoltage1) = False Then Return False + If ValidateContinuousTorque(tbContinuousTorque1) = False Then Return False + If ValidateContinuousTorqueSpeed(tbContinuousTorqueSpeed1) = False Then Return False + If ValidateOverloadTime(tbOverloadTime1) = False Then Return False + If ValidateOverloadTorque(tbOverloadTime1) = False Then Return False + If ValidateOverloadTorqueSpeed(tbOverloadTorqueSpeed1) = False Then Return False + If ValidateFullLoadCurve(tbFLCurve1) = False Then Return False + If ValidatePowerMapEntry(lvPowerMap1) = False Then Return False + + If ValidateVoltage(tbVoltage2) = False Then Return False + If ValidateContinuousTorque(tbContinuousTorque2) = False Then Return False + If ValidateContinuousTorqueSpeed(tbContinuousTorqueSpeed2) = False Then Return False + If ValidateOverloadTime(tbOverloadTime2) = False Then Return False + If ValidateOverloadTorque(tbOverloadTime2) = False Then Return False + If ValidateOverloadTorqueSpeed(tbOverloadTorqueSpeed2) = False Then Return False + If ValidateFullLoadCurve(tbFLCurve2) = False Then Return False + If ValidatePowerMapEntry(lvPowerMap2) = False Then Return False + + Return True + End Function + + Private Function ValidateModel() As Boolean + If String.IsNullOrEmpty(tbModel.Text) Then + ShowErrorMessageBox("Model", tbModel) + Return False + End If + Return True + End Function + + Private Function ValidateInertia() As Boolean + If Not ValidDoubleValue(tbInertia.Text) Then + ShowErrorMessageBox("Inertia", tbInertia) + Return False + End If + Return True + End Function + + Private Function ValidateThermalOverloadFactor() As Boolean + If Not ValidDoubleValue(tbThermalOverload.Text) Then + ShowErrorMessageBox("Thermal Overload Recovery Factor", tbThermalOverload) + Return False + End If + Return True + End Function + + Private Function ValidateDragCurve() As Boolean + If Not File.Exists(tbDragCurve.Text) Then + ShowErrorMessageBox("No valid Drag Curve file path given", tbDragCurve, False) + Return False + End If + + Dim fileExtension = new FileInfo(tbFLCurve1.Text).Extension + If Not $".{IHPCDragCurveFileBrowser.Extensions.First()}" = fileExtension Then + ShowErrorMessageBox($"The selected Drag Curve file(.{IHPCDragCurveFileBrowser.Extensions.First()}) has the wrong extension", + tbDragCurve, False) + Return False + End If + Return True + End Function + + Private Function ValidateVoltage(tb As TextBox) As Boolean + If Not ValidDoubleValue(tb.Text) Then + ShowErrorMessageBox("Voltage", tb) + Return False + End If + Return True + End Function + + Private Function ValidateContinuousTorque(tb As TextBox) as Boolean + If Not ValidDoubleValue(tb.Text) Then + ShowErrorMessageBox("Continuous Torque", tb) + Return False + End If + Return True + End Function + + Private Function ValidateContinuousTorqueSpeed(tb As TextBox) As Boolean + If Not ValidDoubleValue(tb.Text) Then + ShowErrorMessageBox("Continuous Torque Speed", tb) + Return False + End If + Return True + End Function + + Private Function ValidateOverloadTime(tb As TextBox) As Boolean + If Not ValidDoubleValue(tb.Text) Then + ShowErrorMessageBox("Overload Time", tb) + Return False + End If + Return True + End Function + + Private Function ValidateOverloadTorque(tb As TextBox) As Boolean + If Not ValidDoubleValue(tb.Text) Then + ShowErrorMessageBox("Overload Torque", tb) + Return False + End If + Return True + End Function + + Private Function ValidateOverloadTorqueSpeed(tb As TextBox) As Boolean + If Not ValidDoubleValue(tb.Text) Then + ShowErrorMessageBox("Overload Torque Speed", tb) + Return False + End If + Return True + End Function + + Private Function ValidateFullLoadCurve(tb As TextBox) As Boolean + If Not File.Exists(tb.Text) Then + ShowErrorMessageBox("No valid Full Load Curve file path given", tb, False) + Return False + End If + + Dim fileExtension = new FileInfo(tb.Text).Extension + If Not $".{IHPCFullLoadCurveFileBrowser.Extensions.First()}" = fileExtension Then + ShowErrorMessageBox($"The selected Full Load file(.{IHPCFullLoadCurveFileBrowser.Extensions.First()}) has the wrong extension", + tb, False) + Return False + End If + Return True + End Function + + Private Function ValidatePowerMapEntry(tb As ListView) As Boolean + If tb.Items.Count = 0 Then + ShowErrorMessageBox("Invalid input missing Power Map files") + Return False + End If + Return True + End Function + + Private Function ValidDoubleValue(value As string) As Boolean + If String.IsNullOrEmpty(value) + Return false + End If + Return IsNumeric(value) + End Function + + + Private Sub ShowErrorMessageBox(message As string, textbox As TextBox, Optional defaultMessage As Boolean = True) + If Not message = Nothing And defaultMessage Then + MsgBox($"Invalid input for {message}") + textbox.Focus() + Return + Else + MsgBox($"{message}") + textbox.Focus() + Return + End If + End Sub + + Private Sub ShowErrorMessageBox(message As string) + If Not message = Nothing Then + MsgBox($"{message}") + Return + End If + End Sub + +#End Region + +#Region "Track Changes" + + Private Sub Change() + If Not _changed Then + LbStatus.Text = "Unsaved changes in current file" + _changed = True + End If + End Sub + + Private Sub tbModel_TextChanged(sender As Object, e As EventArgs) Handles tbModel.TextChanged + Change() + End Sub + + Private Sub tbInertia_TextChanged(sender As Object, e As EventArgs) Handles tbInertia.TextChanged + Change() + End Sub + Private Sub tbThermalOverload_TextChanged(sender As Object, e As EventArgs) Handles tbThermalOverload.TextChanged + Change() + End Sub + + Private Sub tbDragCurve_TextChanged(sender As Object, e As EventArgs) Handles tbDragCurve.TextChanged + Change() + End Sub + + Private Sub tbVoltage1_TextChanged(sender As Object, e As EventArgs) Handles tbVoltage1.TextChanged + Change() + End Sub + + Private Sub tbContinuousTorque1_TextChanged(sender As Object, e As EventArgs) Handles tbContinuousTorque1.TextChanged + Change() + End Sub + + Private Sub tbContinuousTorqueSpeed1_TextChanged(sender As Object, e As EventArgs) Handles tbContinuousTorqueSpeed1.TextChanged + Change() + End Sub + + Private Sub tbOverloadTime1_TextChanged(sender As Object, e As EventArgs) Handles tbOverloadTime1.TextChanged + Change() + End Sub + + Private Sub tbOverloadTorque1_TextChanged(sender As Object, e As EventArgs) Handles tbOverloadTorque1.TextChanged + Change() + End Sub + + Private Sub tbOverloadTorqueSpeed1_TextChanged(sender As Object, e As EventArgs) Handles tbOverloadTorqueSpeed1.TextChanged + Change() + End Sub + + Private Sub tbFLCurve1_TextChanged(sender As Object, e As EventArgs) Handles tbFLCurve1.TextChanged + Change() + End Sub + + Private Sub tbVoltage2_TextChanged(sender As Object, e As EventArgs) Handles tbVoltage2.TextChanged + Change() + End Sub + + Private Sub tbContinuousTorque2_TextChanged(sender As Object, e As EventArgs) Handles tbContinuousTorque2.TextChanged + Change() + End Sub + + Private Sub tbContinuousTorqueSpeed2_TextChanged(sender As Object, e As EventArgs) Handles tbContinuousTorqueSpeed2.TextChanged + Change() + End Sub + + Private Sub tbFLCurve2_TextChanged(sender As Object, e As EventArgs) Handles tbFLCurve2.TextChanged + Change() + End Sub + + Private Sub tbOverloadTime2_TextChanged(sender As Object, e As EventArgs) Handles tbOverloadTime2.TextChanged + Change() + End Sub + + Private Sub tbOverloadTorque2_TextChanged(sender As Object, e As EventArgs) Handles tbOverloadTorque2.TextChanged + Change() + End Sub + + Private Sub tbOverloadTorqueSpeed2_TextChanged(sender As Object, e As EventArgs) Handles tbOverloadTorqueSpeed2.TextChanged + Change() + End Sub + + Private Sub IHPCForm_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing + If e.CloseReason <> CloseReason.ApplicationExitCall And e.CloseReason <> CloseReason.WindowsShutDown Then + e.Cancel = ChangeCheckCancel() + End If + End Sub + + + + + + + + + +#End Region End Class \ No newline at end of file diff --git a/VECTO/GUI/MainForm.Designer.vb b/VECTO/GUI/MainForm.Designer.vb index 52bfb572e5bc82d36feac19dccdf143e96421825..ec469c5ea65f928034b358a5c5183199692deea7 100644 --- a/VECTO/GUI/MainForm.Designer.vb +++ b/VECTO/GUI/MainForm.Designer.vb @@ -732,94 +732,94 @@ Partial Class MainForm ' Me.GENEditorToolStripMenuItem1.Image = Global.TUGraz.VECTO.My.Resources.Resources.F_VECTO Me.GENEditorToolStripMenuItem1.Name = "GENEditorToolStripMenuItem1" - Me.GENEditorToolStripMenuItem1.Size = New System.Drawing.Size(262, 30) + Me.GENEditorToolStripMenuItem1.Size = New System.Drawing.Size(254, 22) Me.GENEditorToolStripMenuItem1.Text = "Job Editor - Conventional Vehicle" ' 'JobEditorSerialHybridVehicleToolStripMenuItem ' Me.JobEditorSerialHybridVehicleToolStripMenuItem.Image = Global.TUGraz.VECTO.My.Resources.Resources.F_VECTO Me.JobEditorSerialHybridVehicleToolStripMenuItem.Name = "JobEditorSerialHybridVehicleToolStripMenuItem" - Me.JobEditorSerialHybridVehicleToolStripMenuItem.Size = New System.Drawing.Size(262, 30) + Me.JobEditorSerialHybridVehicleToolStripMenuItem.Size = New System.Drawing.Size(254, 22) Me.JobEditorSerialHybridVehicleToolStripMenuItem.Text = "Job Editor - Serial Hybrid Vehicle" ' 'JobEditorParallelHybridVehicleToolStripMenuItem ' Me.JobEditorParallelHybridVehicleToolStripMenuItem.Image = Global.TUGraz.VECTO.My.Resources.Resources.F_VECTO Me.JobEditorParallelHybridVehicleToolStripMenuItem.Name = "JobEditorParallelHybridVehicleToolStripMenuItem" - Me.JobEditorParallelHybridVehicleToolStripMenuItem.Size = New System.Drawing.Size(262, 30) + Me.JobEditorParallelHybridVehicleToolStripMenuItem.Size = New System.Drawing.Size(254, 22) Me.JobEditorParallelHybridVehicleToolStripMenuItem.Text = "Job Editor - Parallel Hybrid Vehicle" ' 'JobEditorBatteryElectricVehicleToolStripMenuItem ' Me.JobEditorBatteryElectricVehicleToolStripMenuItem.Image = Global.TUGraz.VECTO.My.Resources.Resources.F_VECTO Me.JobEditorBatteryElectricVehicleToolStripMenuItem.Name = "JobEditorBatteryElectricVehicleToolStripMenuItem" - Me.JobEditorBatteryElectricVehicleToolStripMenuItem.Size = New System.Drawing.Size(262, 30) + Me.JobEditorBatteryElectricVehicleToolStripMenuItem.Size = New System.Drawing.Size(254, 22) Me.JobEditorBatteryElectricVehicleToolStripMenuItem.Text = "JobEditor - Battery Electric Vehicle" ' 'JobEditorIHPCVehicleToolStripMenuItem ' Me.JobEditorIHPCVehicleToolStripMenuItem.Image = Global.TUGraz.VECTO.My.Resources.Resources.F_VECTO Me.JobEditorIHPCVehicleToolStripMenuItem.Name = "JobEditorIHPCVehicleToolStripMenuItem" - Me.JobEditorIHPCVehicleToolStripMenuItem.Size = New System.Drawing.Size(262, 30) + Me.JobEditorIHPCVehicleToolStripMenuItem.Size = New System.Drawing.Size(254, 22) Me.JobEditorIHPCVehicleToolStripMenuItem.Text = "JobEditor - IHPC Vehicle" ' 'JobEditorEngineOnlyModeToolStripMenuItem ' Me.JobEditorEngineOnlyModeToolStripMenuItem.Image = Global.TUGraz.VECTO.My.Resources.Resources.F_VECTO Me.JobEditorEngineOnlyModeToolStripMenuItem.Name = "JobEditorEngineOnlyModeToolStripMenuItem" - Me.JobEditorEngineOnlyModeToolStripMenuItem.Size = New System.Drawing.Size(262, 30) + Me.JobEditorEngineOnlyModeToolStripMenuItem.Size = New System.Drawing.Size(254, 22) Me.JobEditorEngineOnlyModeToolStripMenuItem.Text = "Job Editor - Engine Only Mode" ' 'EPTPJobEditorToolStripMenuItem ' Me.EPTPJobEditorToolStripMenuItem.Image = Global.TUGraz.VECTO.My.Resources.Resources.F_VECTO Me.EPTPJobEditorToolStripMenuItem.Name = "EPTPJobEditorToolStripMenuItem" - Me.EPTPJobEditorToolStripMenuItem.Size = New System.Drawing.Size(262, 30) + Me.EPTPJobEditorToolStripMenuItem.Size = New System.Drawing.Size(254, 22) Me.EPTPJobEditorToolStripMenuItem.Text = "VTP Job Editor" ' 'VEHEditorToolStripMenuItem ' Me.VEHEditorToolStripMenuItem.Image = Global.TUGraz.VECTO.My.Resources.Resources.F_VEH Me.VEHEditorToolStripMenuItem.Name = "VEHEditorToolStripMenuItem" - Me.VEHEditorToolStripMenuItem.Size = New System.Drawing.Size(262, 30) + Me.VEHEditorToolStripMenuItem.Size = New System.Drawing.Size(254, 22) Me.VEHEditorToolStripMenuItem.Text = "Vehicle Editor" ' 'EngineEditorToolStripMenuItem ' Me.EngineEditorToolStripMenuItem.Image = Global.TUGraz.VECTO.My.Resources.Resources.F_ENG Me.EngineEditorToolStripMenuItem.Name = "EngineEditorToolStripMenuItem" - Me.EngineEditorToolStripMenuItem.Size = New System.Drawing.Size(262, 30) + Me.EngineEditorToolStripMenuItem.Size = New System.Drawing.Size(254, 22) Me.EngineEditorToolStripMenuItem.Text = "Engine Editor" ' 'GearboxEditorToolStripMenuItem ' Me.GearboxEditorToolStripMenuItem.Image = Global.TUGraz.VECTO.My.Resources.Resources.F_GBX Me.GearboxEditorToolStripMenuItem.Name = "GearboxEditorToolStripMenuItem" - Me.GearboxEditorToolStripMenuItem.Size = New System.Drawing.Size(262, 30) + Me.GearboxEditorToolStripMenuItem.Size = New System.Drawing.Size(254, 22) Me.GearboxEditorToolStripMenuItem.Text = "Gearbox Editor" ' 'GraphToolStripMenuItem ' Me.GraphToolStripMenuItem.Image = Global.TUGraz.VECTO.My.Resources.Resources.F_Graph Me.GraphToolStripMenuItem.Name = "GraphToolStripMenuItem" - Me.GraphToolStripMenuItem.Size = New System.Drawing.Size(262, 30) + Me.GraphToolStripMenuItem.Size = New System.Drawing.Size(254, 22) Me.GraphToolStripMenuItem.Text = "Graph" ' 'ToolStripSeparator6 ' Me.ToolStripSeparator6.Name = "ToolStripSeparator6" - Me.ToolStripSeparator6.Size = New System.Drawing.Size(259, 6) + Me.ToolStripSeparator6.Size = New System.Drawing.Size(251, 6) ' 'OpenLogToolStripMenuItem ' Me.OpenLogToolStripMenuItem.Name = "OpenLogToolStripMenuItem" - Me.OpenLogToolStripMenuItem.Size = New System.Drawing.Size(262, 30) + Me.OpenLogToolStripMenuItem.Size = New System.Drawing.Size(254, 22) Me.OpenLogToolStripMenuItem.Text = "Open Log" ' 'SettingsToolStripMenuItem ' Me.SettingsToolStripMenuItem.Name = "SettingsToolStripMenuItem" - Me.SettingsToolStripMenuItem.Size = New System.Drawing.Size(262, 30) + Me.SettingsToolStripMenuItem.Size = New System.Drawing.Size(254, 22) Me.SettingsToolStripMenuItem.Text = "Settings" ' 'ToolStripDrDnBtInfo diff --git a/VECTO/GUI/MainForm.vb b/VECTO/GUI/MainForm.vb index 5516da4e7761db1194dce49d2401ade32195a08c..adfcb141e4cbd463c86c086962de62e59e0962f9 100644 --- a/VECTO/GUI/MainForm.vb +++ b/VECTO/GUI/MainForm.vb @@ -157,6 +157,7 @@ Public Class MainForm PropulsionTorqueLimitFileBrowser = New FileBrowser("vtqp") ModalResultsFileBrowser = New FileBrowser("vmod") + IHPCFileBrowser = new FileBrowser("vem") IHPCPowerMapFileBrowser = new FileBrowser("vemo") IHPCFullLoadCurveFileBrowser = new FileBrowser("vemp") IHPCDragCurveFileBrowser = new FileBrowser("vemd") @@ -202,6 +203,7 @@ Public Class MainForm ModalResultsFileBrowser.Extensions = New String() {"vmod"} + IHPCFileBrowser.Extensions = New String(){"vem"} IHPCPowerMapFileBrowser.Extensions = New String(){"vemo"} IHPCFullLoadCurveFileBrowser.Extensions = New String(){"vemp"} IHPCDragCurveFileBrowser.Extensions = New String(){"vemd"} diff --git a/VECTO/GUI/VectoJobForm.vb b/VECTO/GUI/VectoJobForm.vb index 50b382bc2aec489410654f71bd0162de543fa4d7..618e6646f27aa75e1ff0db365b17c5f40cff4e61 100644 --- a/VECTO/GUI/VectoJobForm.vb +++ b/VECTO/GUI/VectoJobForm.vb @@ -115,6 +115,10 @@ Public Class VectoJobForm GrAuxMech.Enabled = True Case VectoSimulationJobType.EngineOnlySimulation lblTitle.Text = prefix + "Engine Only" + Case VectoSimulationJobType.IHPC + lblTitle.Text = prefix + "IHPC Vehicle" + gbElectricAux.Enabled = True + GrAuxMech.Enabled = False End Select End Sub @@ -1046,6 +1050,12 @@ Public Class VectoJobForm GrAuxMech.Enabled = False pnShiftParams.Enabled = True gbEngineStopStart.Visible = False + Case VectoSimulationJobType.IHPC + pnEngine.Enabled = False + pnGearbox.Enabled = True + GrAuxMech.Enabled = False + pnShiftParams.Enabled = True + gbEngineStopStart.Visible = False End Select End Sub diff --git a/VECTO/GUI/VehicleForm.Designer.vb b/VECTO/GUI/VehicleForm.Designer.vb index df870239864f3cd9e628ce70f7c1620f7c7a16bf..55a0b9798a396ce5f6825a103fc5243ac457580a 100644 --- a/VECTO/GUI/VehicleForm.Designer.vb +++ b/VECTO/GUI/VehicleForm.Designer.vb @@ -226,14 +226,14 @@ Partial Class VehicleForm Me.btPTOLossMapBrowse = New System.Windows.Forms.Button() Me.Label7 = New System.Windows.Forms.Label() Me.gbPTO = New System.Windows.Forms.GroupBox() - Me.cbLegislativeClass = New System.Windows.Forms.ComboBox() - Me.Label21 = New System.Windows.Forms.Label() - Me.lblTitle = New System.Windows.Forms.Label() Me.tbIHPC = New System.Windows.Forms.TabPage() Me.Panel2 = New System.Windows.Forms.Panel() Me.btIHPC = New System.Windows.Forms.Button() Me.btIHPCFile = New System.Windows.Forms.Button() Me.tbIHPCFilePath = New System.Windows.Forms.TextBox() + Me.cbLegislativeClass = New System.Windows.Forms.ComboBox() + Me.Label21 = New System.Windows.Forms.Label() + Me.lblTitle = New System.Windows.Forms.Label() Me.GroupBox6.SuspendLayout Me.ToolStrip1.SuspendLayout Me.gbRetarderLosses.SuspendLayout @@ -1136,12 +1136,12 @@ Partial Class VehicleForm ' Me.tcVehicleComponents.Controls.Add(Me.tpGeneral) Me.tcVehicleComponents.Controls.Add(Me.tpPowertrain) + Me.tcVehicleComponents.Controls.Add(Me.tbIHPC) Me.tcVehicleComponents.Controls.Add(Me.tpElectricComponents) Me.tcVehicleComponents.Controls.Add(Me.tpGensetComponents) Me.tcVehicleComponents.Controls.Add(Me.tpTorqueLimits) Me.tcVehicleComponents.Controls.Add(Me.tpADAS) Me.tcVehicleComponents.Controls.Add(Me.tpRoadSweeper) - Me.tcVehicleComponents.Controls.Add(Me.tbIHPC) Me.tcVehicleComponents.Location = New System.Drawing.Point(5, 173) Me.tcVehicleComponents.Name = "tcVehicleComponents" Me.tcVehicleComponents.SelectedIndex = 0 @@ -2152,37 +2152,6 @@ Partial Class VehicleForm Me.gbPTO.TabStop = false Me.gbPTO.Text = "PTO Design Variant" ' - 'cbLegislativeClass - ' - Me.cbLegislativeClass.DisplayMember = "Value" - Me.cbLegislativeClass.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList - Me.cbLegislativeClass.FormattingEnabled = true - Me.cbLegislativeClass.Location = New System.Drawing.Point(220, 140) - Me.cbLegislativeClass.Name = "cbLegislativeClass" - Me.cbLegislativeClass.Size = New System.Drawing.Size(52, 21) - Me.cbLegislativeClass.TabIndex = 4 - Me.cbLegislativeClass.ValueMember = "Key" - ' - 'Label21 - ' - Me.Label21.AutoSize = true - Me.Label21.Location = New System.Drawing.Point(32, 123) - Me.Label21.Name = "Label21" - Me.Label21.Size = New System.Drawing.Size(112, 13) - Me.Label21.TabIndex = 42 - Me.Label21.Text = "Maximum Laden Mass" - ' - 'lblTitle - ' - Me.lblTitle.AutoSize = true - Me.lblTitle.BackColor = System.Drawing.Color.White - Me.lblTitle.Font = New System.Drawing.Font("Microsoft Sans Serif", 18!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) - Me.lblTitle.Location = New System.Drawing.Point(117, 34) - Me.lblTitle.Name = "lblTitle" - Me.lblTitle.Size = New System.Drawing.Size(166, 29) - Me.lblTitle.TabIndex = 43 - Me.lblTitle.Text = "Vehicle TITLE" - ' 'tbIHPC ' Me.tbIHPC.Controls.Add(Me.Panel2) @@ -2232,6 +2201,37 @@ Partial Class VehicleForm Me.tbIHPCFilePath.Size = New System.Drawing.Size(300, 20) Me.tbIHPCFilePath.TabIndex = 1 ' + 'cbLegislativeClass + ' + Me.cbLegislativeClass.DisplayMember = "Value" + Me.cbLegislativeClass.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.cbLegislativeClass.FormattingEnabled = true + Me.cbLegislativeClass.Location = New System.Drawing.Point(220, 140) + Me.cbLegislativeClass.Name = "cbLegislativeClass" + Me.cbLegislativeClass.Size = New System.Drawing.Size(52, 21) + Me.cbLegislativeClass.TabIndex = 4 + Me.cbLegislativeClass.ValueMember = "Key" + ' + 'Label21 + ' + Me.Label21.AutoSize = true + Me.Label21.Location = New System.Drawing.Point(32, 123) + Me.Label21.Name = "Label21" + Me.Label21.Size = New System.Drawing.Size(112, 13) + Me.Label21.TabIndex = 42 + Me.Label21.Text = "Maximum Laden Mass" + ' + 'lblTitle + ' + Me.lblTitle.AutoSize = true + Me.lblTitle.BackColor = System.Drawing.Color.White + Me.lblTitle.Font = New System.Drawing.Font("Microsoft Sans Serif", 18!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) + Me.lblTitle.Location = New System.Drawing.Point(117, 34) + Me.lblTitle.Name = "lblTitle" + Me.lblTitle.Size = New System.Drawing.Size(166, 29) + Me.lblTitle.TabIndex = 43 + Me.lblTitle.Text = "Vehicle TITLE" + ' 'VehicleForm ' Me.AcceptButton = Me.ButOK diff --git a/VECTO/GUI/VehicleForm.vb b/VECTO/GUI/VehicleForm.vb index 0874ea85670253f6001fcad2b0eae888a3ed5e74..ec625d0da1b7df2957a4acb157a9a7d312c1d0a2 100644 --- a/VECTO/GUI/VehicleForm.vb +++ b/VECTO/GUI/VehicleForm.vb @@ -635,6 +635,9 @@ Public Class VehicleForm cbAtEcoRollReleaseLockupClutch.Visible = False pnEcoRoll.Visible = False cbEcoRoll.SelectedIndex = 0 + Case VectoSimulationJobType.IHPC + lblTitle.Text = "IHPC Vehicle" + Case Else If Not tcVehicleComponents.TabPages.Contains(tpElectricComponents) Then @@ -1470,6 +1473,7 @@ Public Class VehicleForm Private Sub btIHPC_Click(sender As Object, e As EventArgs) Handles btIHPC.Click Dim f = FileRepl(tbIHPCFilePath.Text, GetPath(_vehFile)) + IHPCForm.JobDir = GetPath(_vehFile) If Not IHPCForm.Visible Then IHPCForm.ClearIHPC() IHPCForm.Show() @@ -1488,5 +1492,11 @@ Public Class VehicleForm End Sub + + Private Sub btIHPCFile_Click(sender As Object, e As EventArgs) Handles btIHPCFile.Click + If IHPCFileBrowser.OpenDialog(FileRepl(tbIHPCFilePath.Text, GetPath(_vehFile))) Then + tbIHPCFilePath.Text = GetFilenameWithoutDirectory(IHPCFileBrowser.Files(0), GetPath(_vehFile)) + End If + End Sub End Class diff --git a/VECTO/Input Files/IHPCInputData.vb b/VECTO/Input Files/IHPCInputData.vb new file mode 100644 index 0000000000000000000000000000000000000000..e27553b31252de189b04d7962fcccd2f9a73f13a --- /dev/null +++ b/VECTO/Input Files/IHPCInputData.vb @@ -0,0 +1,191 @@ +Imports System.IO +Imports TUGraz.VectoCommon.Exceptions +Imports TUGraz.VectoCommon.InputData +Imports TUGraz.VectoCommon.Models +Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore.InputData.FileIO.JSON +Imports TUGraz.VectoCore.InputData.Impl +Imports TUGraz.VectoCore.Utils + +Public Class IHPCInputData + Implements IElectricMotorEngineeringInputData + + Private _model As String + Private _inertia As KilogramSquareMeter + Private _voltageLevels As IList(Of IElectricMotorVoltageLevel) + Private _dragCurve As TableData + Private _overloadRecoveryFactor As Double + private _filePath As String + + Public Function SaveFile(filePath As String) As Boolean + _filePath = filePath + + Try + Dim writer = New JSONFileWriter() + writer.SaveIHPC(Me, filePath, Cfg.DeclMode) + Catch ex As Exception + MsgBox("Failed to write IHPC file: " + ex.Message) + Return False + End Try + Return True + End Function + + + Public Sub SetCommonEntries(model As String, inertia As String, dragCurveFilePath As string, + thermalOverloadRecoverFactor As String ) + _model = model + _inertia = inertia.ToDouble().SI(Of KilogramSquareMeter) + If Not File.Exists(dragCurveFilePath) Then + Throw New VectoException("Drag Curve is missing or invalid") + Else + _dragCurve = VectoCSVFile.Read(dragCurveFilePath) + End If + + _overloadRecoveryFactor = thermalOverloadRecoverFactor.ToDouble() + End Sub + + Public Sub SetVoltageLevelEntries(voltage As String, continuousTorque As String, continuousTorqueSpeed As String, + overloadTime As String, overloadTorque As String, overloadTorqueSpeed As String, + fullLoadCurve As string, powerMap As ListView) + + + Dim level = New ElectricMotorVoltageLevel() + level.VoltageLevel = voltage.ToDouble().SI(Of Volt) + level.ContinuousTorque = continuousTorque.ToDouble().SI(Of NewtonMeter) + level.ContinuousTorqueSpeed = continuousTorqueSpeed.ToDouble().RPMtoRad() + level.OverloadTime = overloadTime.ToDouble().SI(Of Second) + level.OverloadTorque = overloadTorque.ToDouble().SI(Of NewtonMeter) + level.OverloadTestSpeed = overloadTorqueSpeed.ToDouble().RPMtoRad() + If Not File.Exists(fullLoadCurve) Then + Throw New VectoException("Full-Load Curve is missing or invalid") + Else + level.FullLoadCurve = VectoCSVFile.Read(fullLoadCurve) + End If + level.PowerMap = GetPowerMap(powerMap) + + _voltageLevels.Add(level) + + End Sub + + Private Function GetPowerMap(powerMap As ListView) As IList(of IElectricMotorPowerMap) + Dim powerMaps = new List(Of IElectricMotorPowerMap) + + For Each entry As ListViewItem In powerMap.Items + Dim currentEntry = New JSONElectricMotorPowerMap + currentEntry.Gear = entry.SubItems(0).Text.ToInt() + + If Not File.Exists(entry.SubItems(1).Text) Then + Throw New VectoException("Power Map is missing or invalid") + Else + currentEntry.PowerMap = VectoCSVFile.Read(entry.SubItems(1).Text) + End If + powerMaps.Add(currentEntry) + Next + + Return powerMaps + End Function + + + Public ReadOnly Property DataSource As DataSource Implements IComponentInputData.DataSource + Get + Dim retVal = New DataSource() + retVal.SourceType = DataSourceType.JSONFile + retVal.SourceFile = _filePath + Return retVal + End Get + End Property + + Public ReadOnly Property SavedInDeclarationMode As Boolean Implements IComponentInputData.SavedInDeclarationMode + Get + Return Cfg.DeclMode + End Get + End Property + + Public ReadOnly Property Manufacturer As String Implements IComponentInputData.Manufacturer + Get + Return Nothing + End Get + End Property + + Public ReadOnly Property Model As String Implements IComponentInputData.Model + Get + Return _model + End Get + End Property + + Public ReadOnly Property [Date] As Date Implements IComponentInputData.[Date] + Get + Return Now.ToUniversalTime() + End Get + End Property + + Public ReadOnly Property AppVersion As String Implements IComponentInputData.AppVersion + Get + Return "VECTO-GUI" + End Get + End Property + + Public ReadOnly Property CertificationMethod As CertificationMethod Implements IComponentInputData.CertificationMethod + Get + Return CertificationMethod.NotCertified + End Get + End Property + + Public ReadOnly Property CertificationNumber As String Implements IComponentInputData.CertificationNumber + Get + Return VectoCore.Configuration.Constants.NOT_AVAILABLE + End Get + End Property + + Public ReadOnly Property DigestValue As DigestData Implements IComponentInputData.DigestValue + Get + Return Nothing + End Get + End Property + + Public ReadOnly Property ElectricMachineType As ElectricMachineType Implements IElectricMotorDeclarationInputData.ElectricMachineType + Get + Return Nothing + End Get + End Property + + Public ReadOnly Property R85RatedPower As Watt Implements IElectricMotorDeclarationInputData.R85RatedPower + Get + Return Nothing + End Get + End Property + + Public ReadOnly Property Inertia As KilogramSquareMeter Implements IElectricMotorDeclarationInputData.Inertia + Get + Return _inertia + End Get + End Property + + Public ReadOnly Property DcDcConverterIncluded As Boolean Implements IElectricMotorDeclarationInputData.DcDcConverterIncluded + + Public ReadOnly Property IHPCType As String Implements IElectricMotorDeclarationInputData.IHPCType + + Public ReadOnly Property VoltageLevels As IList(Of IElectricMotorVoltageLevel) Implements IElectricMotorDeclarationInputData.VoltageLevels + Get + Return _voltageLevels + End Get + End Property + + Public ReadOnly Property DragCurve As TableData Implements IElectricMotorDeclarationInputData.DragCurve + Get + Return _dragCurve + End Get + End Property + + Public ReadOnly Property Conditioning As TableData Implements IElectricMotorDeclarationInputData.Conditioning + Get + Return Nothing + End Get + End Property + + Public ReadOnly Property OverloadRecoveryFactor As Double Implements IElectricMotorEngineeringInputData.OverloadRecoveryFactor + Get + Return _overloadRecoveryFactor + End Get + End Property +End Class