diff --git a/VECTO/GUI/F_VEH.Designer.vb b/VECTO/GUI/F_VEH.Designer.vb index 8ea7b75c4ec3fbae682fac4614b642973bc05e43..714812e65d6d55f682be377ef4fca402b83847e6 100644 --- a/VECTO/GUI/F_VEH.Designer.vb +++ b/VECTO/GUI/F_VEH.Designer.vb @@ -103,10 +103,6 @@ Partial Class F_VEH Me.PnLoad = New System.Windows.Forms.Panel() Me.GrAirRes = New System.Windows.Forms.GroupBox() Me.PnCdATrTr = New System.Windows.Forms.Panel() - Me.LbCdATr = New System.Windows.Forms.Label() - Me.PnCdARig = New System.Windows.Forms.Panel() - Me.LbCdARig = New System.Windows.Forms.Label() - Me.TBcdA2 = New System.Windows.Forms.TextBox() Me.Label38 = New System.Windows.Forms.Label() Me.PictureBox1 = New System.Windows.Forms.PictureBox() Me.CmOpenFile = New System.Windows.Forms.ContextMenuStrip(Me.components) @@ -126,7 +122,6 @@ Partial Class F_VEH Me.PnLoad.SuspendLayout() Me.GrAirRes.SuspendLayout() Me.PnCdATrTr.SuspendLayout() - Me.PnCdARig.SuspendLayout() CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit() Me.CmOpenFile.SuspendLayout() Me.PnAll.SuspendLayout() @@ -168,7 +163,7 @@ Partial Class F_VEH 'Label3 ' Me.Label3.AutoSize = True - Me.Label3.Location = New System.Drawing.Point(36, 52) + Me.Label3.Location = New System.Drawing.Point(3, 6) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(37, 13) Me.Label3.TabIndex = 8 @@ -176,9 +171,7 @@ Partial Class F_VEH ' 'TBcdA ' - Me.TBcdA.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.TBcdA.Location = New System.Drawing.Point(2, 24) + Me.TBcdA.Location = New System.Drawing.Point(46, 3) Me.TBcdA.Name = "TBcdA" Me.TBcdA.Size = New System.Drawing.Size(57, 20) Me.TBcdA.TabIndex = 0 @@ -743,9 +736,6 @@ Partial Class F_VEH 'GrAirRes ' Me.GrAirRes.Controls.Add(Me.PnCdATrTr) - Me.GrAirRes.Controls.Add(Me.PnCdARig) - Me.GrAirRes.Controls.Add(Me.Label3) - Me.GrAirRes.Controls.Add(Me.Label38) Me.GrAirRes.Location = New System.Drawing.Point(278, 3) Me.GrAirRes.Name = "GrAirRes" Me.GrAirRes.Size = New System.Drawing.Size(266, 124) @@ -755,51 +745,19 @@ Partial Class F_VEH ' 'PnCdATrTr ' - Me.PnCdATrTr.Controls.Add(Me.LbCdATr) Me.PnCdATrTr.Controls.Add(Me.TBcdA) - Me.PnCdATrTr.Location = New System.Drawing.Point(79, 25) + Me.PnCdATrTr.Controls.Add(Me.Label38) + Me.PnCdATrTr.Controls.Add(Me.Label3) + Me.PnCdATrTr.Dock = System.Windows.Forms.DockStyle.Fill + Me.PnCdATrTr.Location = New System.Drawing.Point(3, 16) Me.PnCdATrTr.Name = "PnCdATrTr" - Me.PnCdATrTr.Size = New System.Drawing.Size(64, 78) + Me.PnCdATrTr.Size = New System.Drawing.Size(260, 105) Me.PnCdATrTr.TabIndex = 0 ' - 'LbCdATr - ' - Me.LbCdATr.AutoSize = True - Me.LbCdATr.Location = New System.Drawing.Point(3, 3) - Me.LbCdATr.Name = "LbCdATr" - Me.LbCdATr.Size = New System.Drawing.Size(58, 13) - Me.LbCdATr.TabIndex = 25 - Me.LbCdATr.Text = "Tr && Trailer" - ' - 'PnCdARig - ' - Me.PnCdARig.Controls.Add(Me.LbCdARig) - Me.PnCdARig.Controls.Add(Me.TBcdA2) - Me.PnCdARig.Location = New System.Drawing.Point(146, 25) - Me.PnCdARig.Name = "PnCdARig" - Me.PnCdARig.Size = New System.Drawing.Size(64, 78) - Me.PnCdARig.TabIndex = 1 - ' - 'LbCdARig - ' - Me.LbCdARig.AutoSize = True - Me.LbCdARig.Location = New System.Drawing.Point(10, 3) - Me.LbCdARig.Name = "LbCdARig" - Me.LbCdARig.Size = New System.Drawing.Size(31, 13) - Me.LbCdARig.TabIndex = 25 - Me.LbCdARig.Text = "Rigid" - ' - 'TBcdA2 - ' - Me.TBcdA2.Location = New System.Drawing.Point(3, 24) - Me.TBcdA2.Name = "TBcdA2" - Me.TBcdA2.Size = New System.Drawing.Size(57, 20) - Me.TBcdA2.TabIndex = 0 - ' 'Label38 ' Me.Label38.AutoSize = True - Me.Label38.Location = New System.Drawing.Point(212, 52) + Me.Label38.Location = New System.Drawing.Point(109, 6) Me.Label38.Name = "Label38" Me.Label38.Size = New System.Drawing.Size(24, 13) Me.Label38.TabIndex = 24 @@ -910,11 +868,8 @@ Partial Class F_VEH Me.PnLoad.ResumeLayout(False) Me.PnLoad.PerformLayout() Me.GrAirRes.ResumeLayout(False) - Me.GrAirRes.PerformLayout() Me.PnCdATrTr.ResumeLayout(False) Me.PnCdATrTr.PerformLayout() - Me.PnCdARig.ResumeLayout(False) - Me.PnCdARig.PerformLayout() CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit() Me.CmOpenFile.ResumeLayout(False) Me.PnAll.ResumeLayout(False) @@ -989,19 +944,15 @@ Partial Class F_VEH Friend WithEvents ColumnHeader1 As System.Windows.Forms.ColumnHeader Friend WithEvents ColumnHeader2 As System.Windows.Forms.ColumnHeader Friend WithEvents PnLoad As System.Windows.Forms.Panel - Friend WithEvents LbCdARig As System.Windows.Forms.Label - Friend WithEvents LbCdATr As System.Windows.Forms.Label - Friend WithEvents TBcdA2 As System.Windows.Forms.TextBox - Friend WithEvents PnCdARig As System.Windows.Forms.Panel - Friend WithEvents PnAll As System.Windows.Forms.Panel - Friend WithEvents Label6 As System.Windows.Forms.Label - Friend WithEvents ColumnHeader3 As System.Windows.Forms.ColumnHeader - Friend WithEvents ColumnHeader4 As System.Windows.Forms.ColumnHeader - Friend WithEvents Label7 As System.Windows.Forms.Label - Friend WithEvents CbRim As System.Windows.Forms.ComboBox - Friend WithEvents PnWheelDiam As System.Windows.Forms.Panel - Friend WithEvents PicVehicle As System.Windows.Forms.PictureBox - Friend WithEvents Label8 As System.Windows.Forms.Label + Friend WithEvents PnAll As System.Windows.Forms.Panel + Friend WithEvents Label6 As System.Windows.Forms.Label + Friend WithEvents ColumnHeader3 As System.Windows.Forms.ColumnHeader + Friend WithEvents ColumnHeader4 As System.Windows.Forms.ColumnHeader + Friend WithEvents Label7 As System.Windows.Forms.Label + Friend WithEvents CbRim As System.Windows.Forms.ComboBox + Friend WithEvents PnWheelDiam As System.Windows.Forms.Panel + Friend WithEvents PicVehicle As System.Windows.Forms.PictureBox + Friend WithEvents Label8 As System.Windows.Forms.Label Friend WithEvents PnCdATrTr As System.Windows.Forms.Panel Friend WithEvents Label38 As System.Windows.Forms.Label End Class diff --git a/VECTO/GUI/F_VEH.vb b/VECTO/GUI/F_VEH.vb index bef991990d6702aaaace58d81ab3e4f73938c598..7a6d2de178c6a3a7e8e77bb87f5899fe7164ce41 100644 --- a/VECTO/GUI/F_VEH.vb +++ b/VECTO/GUI/F_VEH.vb @@ -9,6 +9,8 @@ ' ' See the LICENSE.txt for the specific language governing permissions and limitations. Imports System.Collections.Generic +Imports System.IO +Imports System.Text.RegularExpressions ''' <summary> ''' Vehicle Editor. @@ -24,7 +26,7 @@ Public Class F_VEH 'Close - Check for unsaved changes - Private Sub F_VEH_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) _ + Private Sub F_VEH_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs) _ Handles Me.FormClosing If e.CloseReason <> CloseReason.ApplicationExitCall And e.CloseReason <> CloseReason.WindowsShutDown Then e.Cancel = ChangeCheckCancel() @@ -32,29 +34,27 @@ Public Class F_VEH End Sub 'Initialise form - Private Sub F05_VEH_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + Private Sub F05_VEH_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load Dim txt As String - Me.TbLoadingMax.Text = "-" - Me.PnLoad.Enabled = Not Cfg.DeclMode - Me.ButAxlAdd.Enabled = Not Cfg.DeclMode - Me.ButAxlRem.Enabled = Not Cfg.DeclMode - Me.CbCdMode.Enabled = Not Cfg.DeclMode - Me.PnCdARig.Visible = Cfg.DeclMode - Me.LbCdATr.Visible = Cfg.DeclMode - Me.PnWheelDiam.Enabled = Not Cfg.DeclMode + TbLoadingMax.Text = "-" + PnLoad.Enabled = Not Cfg.DeclMode + ButAxlAdd.Enabled = Not Cfg.DeclMode + ButAxlRem.Enabled = Not Cfg.DeclMode + CbCdMode.Enabled = Not Cfg.DeclMode + PnWheelDiam.Enabled = Not Cfg.DeclMode If Cfg.DeclMode Then - Me.PnCdATrTr.Width = 64 + PnCdATrTr.Width = 64 Else - Me.PnCdATrTr.Width = 132 + PnCdATrTr.Width = 132 End If AxlDlog = New F_VEH_Axle - Me.CbRim.Items.Add("-") + CbRim.Items.Add("-") For Each txt In Declaration.RimsList - Me.CbRim.Items.Add(txt) + CbRim.Items.Add(txt) Next Changed = False @@ -70,11 +70,11 @@ Public Class F_VEH Dim MaxMass As Single Dim HDVclass As String - VehC = CType(Me.CbCat.SelectedIndex, tVehCat) + VehC = CType(CbCat.SelectedIndex, tVehCat) - AxlC = CType(Me.CbAxleConfig.SelectedIndex, tAxleConf) + AxlC = CType(CbAxleConfig.SelectedIndex, tAxleConf) - MaxMass = CSng(fTextboxToNumString(Me.TbMassMass.Text)) + MaxMass = CSng(fTextboxToNumString(TbMassMass.Text)) If Declaration.SegmentTable.SetRef(s0, VehC, AxlC, MaxMass) Then HDVclass = s0.HDVclass @@ -82,9 +82,9 @@ Public Class F_VEH HDVclass = "-" End If - Me.TbHDVclass.Text = HDVclass + TbHDVclass.Text = HDVclass - Me.PicVehicle.Image = Image.FromFile(Declaration.ConvPicPath(HDVclass, False)) + PicVehicle.Image = Image.FromFile(Declaration.ConvPicPath(HDVclass, False)) End Sub @@ -103,11 +103,11 @@ Public Class F_VEH If Not Cfg.DeclMode Then Exit Sub - VehC = CType(Me.CbCat.SelectedIndex, tVehCat) + VehC = CType(CbCat.SelectedIndex, tVehCat) - AxlC = CType(Me.CbAxleConfig.SelectedIndex, tAxleConf) + AxlC = CType(CbAxleConfig.SelectedIndex, tAxleConf) - MaxMass = CSng(fTextboxToNumString(Me.TbMassMass.Text)) + MaxMass = CSng(fTextboxToNumString(TbMassMass.Text)) If Declaration.SegmentTable.SetRef(s0, VehC, AxlC, MaxMass) Then HDVclass = s0.HDVclass @@ -135,38 +135,28 @@ Public Class F_VEH Next End If - If s0.TrailerOnlyInLongHaul Then - Me.PnCdATrTr.Width = 64 - Me.PnCdARig.Visible = True - Me.LbCdATr.Visible = True - Else - Me.PnCdATrTr.Width = 132 - Me.PnCdARig.Visible = False - Me.LbCdATr.Visible = False - End If - - Me.PnAll.Enabled = True + PnAll.Enabled = True Else - Me.PnAll.Enabled = False + PnAll.Enabled = False HDVclass = "-" End If - Me.TbMassExtra.Text = "-" - Me.TbLoad.Text = "-" - Me.CbCdMode.SelectedIndex = CType(tCdMode.CdOfVdecl, Integer) - Me.TbCdFile.Text = "" + TbMassExtra.Text = "-" + TbLoad.Text = "-" + CbCdMode.SelectedIndex = CType(tCdMode.CdOfVdecl, Integer) + TbCdFile.Text = "" - If Me.LvRRC.Items.Count > 0 Then - rdyn = Declaration.rdyn(Me.LvRRC.Items(1).SubItems(5).Text, Me.CbRim.Text) + If LvRRC.Items.Count > 0 Then + rdyn = Declaration.rdyn(LvRRC.Items(1).SubItems(5).Text, CbRim.Text) Else - rdyn = - 1 + rdyn = -1 End If If rdyn < 0 Then - Me.TBrdyn.Text = "-" + TBrdyn.Text = "-" Else - Me.TBrdyn.Text = rdyn + TBrdyn.Text = rdyn End If End Sub @@ -174,27 +164,27 @@ Public Class F_VEH #Region "Toolbar" 'New - Private Sub ToolStripBtNew_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripBtNew.Click + Private Sub ToolStripBtNew_Click(sender As Object, e As EventArgs) Handles ToolStripBtNew.Click newVEH() End Sub 'Open - Private Sub ToolStripBtOpen_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripBtOpen.Click + Private Sub ToolStripBtOpen_Click(sender As Object, e As EventArgs) Handles ToolStripBtOpen.Click If fbVEH.OpenDialog(VehFile) Then openVEH(fbVEH.Files(0)) End Sub 'Save - Private Sub ToolStripBtSave_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripBtSave.Click + Private Sub ToolStripBtSave_Click(sender As Object, e As EventArgs) Handles ToolStripBtSave.Click SaveOrSaveAs(False) End Sub 'Save As - Private Sub ToolStripBtSaveAs_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripBtSaveAs.Click + Private Sub ToolStripBtSaveAs_Click(sender As Object, e As EventArgs) Handles ToolStripBtSaveAs.Click SaveOrSaveAs(True) End Sub 'Send to VECTO Editor - Private Sub ToolStripBtSendTo_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripBtSendTo.Click + Private Sub ToolStripBtSendTo_Click(sender As Object, e As EventArgs) Handles ToolStripBtSendTo.Click If ChangeCheckCancel() Then Exit Sub @@ -219,14 +209,14 @@ Public Class F_VEH End Sub 'Help - Private Sub ToolStripButton1_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripButton1.Click - If IO.File.Exists(MyAppPath & "User Manual\help.html") Then + Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles ToolStripButton1.Click + If File.Exists(MyAppPath & "User Manual\help.html") Then Dim BrowserRegistryString As String = My.Computer.Registry.ClassesRoot.OpenSubKey("\http\shell\open\command\").GetValue("").ToString Dim DefaultBrowserPath As String = - System.Text.RegularExpressions.Regex.Match(BrowserRegistryString, "(\"".*?\"")").Captures(0).ToString - System.Diagnostics.Process.Start(DefaultBrowserPath, - String.Format("""{0}{1}""", MyAppPath, "User Manual\help.html#vehicle-editor")) + Regex.Match(BrowserRegistryString, "(\"".*?\"")").Captures(0).ToString + Process.Start(DefaultBrowserPath, + String.Format("""{0}{1}""", MyAppPath, "User Manual\help.html#vehicle-editor")) Else MsgBox("User Manual not found!", MsgBoxStyle.Critical) End If @@ -235,13 +225,13 @@ Public Class F_VEH #End Region 'Save and Close - Private Sub ButOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButOK.Click - If SaveOrSaveAs(False) Then Me.Close() + Private Sub ButOK_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ButOK.Click + If SaveOrSaveAs(False) Then Close() End Sub 'Cancel - Private Sub ButCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButCancel.Click - Me.Close() + Private Sub ButCancel_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ButCancel.Click + Close() End Sub 'Save or Save As function = true if file is saved @@ -261,36 +251,35 @@ Public Class F_VEH If ChangeCheckCancel() Then Exit Sub - Me.TbMass.Text = "" - Me.TbLoad.Text = "" - Me.TBrdyn.Text = "" - Me.TBcdA.Text = "" - Me.TBcdA2.Text = "" + TbMass.Text = "" + TbLoad.Text = "" + TBrdyn.Text = "" + TBcdA.Text = "" - Me.CbCdMode.SelectedIndex = 0 - Me.TbCdFile.Text = "" + CbCdMode.SelectedIndex = 0 + TbCdFile.Text = "" - Me.CbRtType.SelectedIndex = 0 - Me.TbRtRatio.Text = "1" - Me.TbRtPath.Text = "" + CbRtType.SelectedIndex = 0 + TbRtRatio.Text = "1" + TbRtPath.Text = "" - Me.CbCat.SelectedIndex = 0 + CbCat.SelectedIndex = 0 - Me.LvRRC.Items.Clear() + LvRRC.Items.Clear() - Me.TbMassMass.Text = "" - Me.TbMassExtra.Text = "" - Me.CbAxleConfig.SelectedIndex = 0 + TbMassMass.Text = "" + TbMassExtra.Text = "" + CbAxleConfig.SelectedIndex = 0 - Me.CbRim.SelectedIndex = 0 + CbRim.SelectedIndex = 0 DeclInit() VehFile = "" - Me.Text = "VEH Editor" - Me.LbStatus.Text = "" + Text = "VEH Editor" + LbStatus.Text = "" Changed = False End Sub @@ -318,35 +307,35 @@ Public Class F_VEH If Cfg.DeclMode <> VEH0.SavedInDeclMode Then Select Case WrongMode() Case 1 - Me.Close() + Close() F_MAINForm.RbDecl.Checked = Not F_MAINForm.RbDecl.Checked F_MAINForm.OpenVectoFile(file) - Case - 1 + Case -1 Exit Sub Case Else '0 'Continue... End Select End If - Me.TbMass.Text = VEH0.Mass - Me.TbMassExtra.Text = VEH0.MassExtra - Me.TbLoad.Text = VEH0.Loading - Me.TBrdyn.Text = VEH0.rdyn - Me.CbRim.Text = VEH0.Rim + TbMass.Text = VEH0.Mass + TbMassExtra.Text = VEH0.MassExtra + TbLoad.Text = VEH0.Loading + TBrdyn.Text = VEH0.rdyn + CbRim.Text = VEH0.Rim - Me.CbCdMode.SelectedIndex = CType(VEH0.CdMode, Integer) - Me.TbCdFile.Text = VEH0.CdFile.OriginalPath + CbCdMode.SelectedIndex = CType(VEH0.CdMode, Integer) + TbCdFile.Text = VEH0.CdFile.OriginalPath - Me.CbRtType.SelectedIndex = CType(VEH0.RtType, Integer) - Me.TbRtRatio.Text = CStr(VEH0.RtRatio) - Me.TbRtPath.Text = CStr(VEH0.RtFile.OriginalPath) + CbRtType.SelectedIndex = CType(VEH0.RtType, Integer) + TbRtRatio.Text = CStr(VEH0.RtRatio) + TbRtPath.Text = CStr(VEH0.RtFile.OriginalPath) - Me.CbCat.SelectedIndex = CType(VEH0.VehCat, Integer) + CbCat.SelectedIndex = CType(VEH0.VehCat, Integer) - Me.LvRRC.Items.Clear() + LvRRC.Items.Clear() i = 0 For Each a0 In VEH0.Axles i += 1 @@ -382,21 +371,20 @@ Public Class F_VEH LvRRC.Items.Add(lvi) Next - Me.TbMassMass.Text = VEH0.MassMax - Me.TbMassExtra.Text = VEH0.MassExtra + TbMassMass.Text = VEH0.MassMax + TbMassExtra.Text = VEH0.MassExtra - Me.CbAxleConfig.SelectedIndex = CType(VEH0.AxleConf, Integer) + CbAxleConfig.SelectedIndex = CType(VEH0.AxleConf, Integer) - Me.TBcdA.Text = VEH0.CdA0 - Me.TBcdA2.Text = VEH0.CdA02 + TBcdA.Text = VEH0.CdA0 DeclInit() fbVEH.UpdateHistory(file) - Me.Text = fFILE(file, True) - Me.LbStatus.Text = "" + Text = fFILE(file, True) + LbStatus.Text = "" VehFile = file - Me.Activate() + Activate() Changed = False End Sub @@ -410,29 +398,25 @@ Public Class F_VEH VEH0 = New cVEH VEH0.FilePath = file - VEH0.Mass = CSng(fTextboxToNumString(Me.TbMass.Text)) - VEH0.MassExtra = CSng(fTextboxToNumString(Me.TbMassExtra.Text)) - VEH0.Loading = CSng(fTextboxToNumString(Me.TbLoad.Text)) - - VEH0.CdA0 = CSng(fTextboxToNumString(Me.TBcdA.Text)) - - If Me.PnCdARig.Visible Then - VEH0.CdA02 = CSng(fTextboxToNumString(Me.TBcdA2.Text)) - End If + VEH0.Mass = CSng(fTextboxToNumString(TbMass.Text)) + VEH0.MassExtra = CSng(fTextboxToNumString(TbMassExtra.Text)) + VEH0.Loading = CSng(fTextboxToNumString(TbLoad.Text)) - VEH0.Rim = Me.CbRim.Text + VEH0.CdA0 = CSng(fTextboxToNumString(TBcdA.Text)) + VEH0.CdA02 = VEH0.CdA0 + VEH0.Rim = CbRim.Text - VEH0.rdyn = CSng(fTextboxToNumString(Me.TBrdyn.Text)) + VEH0.rdyn = CSng(fTextboxToNumString(TBrdyn.Text)) - VEH0.CdMode = CType(Me.CbCdMode.SelectedIndex, tCdMode) - VEH0.CdFile.Init(fPATH(file), Me.TbCdFile.Text) + VEH0.CdMode = CType(CbCdMode.SelectedIndex, tCdMode) + VEH0.CdFile.Init(fPATH(file), TbCdFile.Text) - VEH0.RtType = CType(Me.CbRtType.SelectedIndex, tRtType) - VEH0.RtRatio = CSng(fTextboxToNumString(Me.TbRtRatio.Text)) - VEH0.RtFile.Init(fPATH(file), Me.TbRtPath.Text) + VEH0.RtType = CType(CbRtType.SelectedIndex, tRtType) + VEH0.RtRatio = CSng(fTextboxToNumString(TbRtRatio.Text)) + VEH0.RtFile.Init(fPATH(file), TbRtPath.Text) - VEH0.VehCat = CType(Me.CbCat.SelectedIndex, tVehCat) + VEH0.VehCat = CType(CbCat.SelectedIndex, tVehCat) Dim axleShareCheck As Double For Each LV0 In LvRRC.Items @@ -456,9 +440,9 @@ Public Class F_VEH Return False End If - VEH0.MassMax = CSng(fTextboxToNumString(Me.TbMassMass.Text)) - VEH0.MassExtra = CSng(fTextboxToNumString(Me.TbMassExtra.Text)) - VEH0.AxleConf = CType(Me.CbAxleConfig.SelectedIndex, tAxleConf) + VEH0.MassMax = CSng(fTextboxToNumString(TbMassMass.Text)) + VEH0.MassExtra = CSng(fTextboxToNumString(TbMassExtra.Text)) + VEH0.AxleConf = CType(CbAxleConfig.SelectedIndex, tAxleConf) '--------------------------------------------------------------------------------- @@ -475,8 +459,8 @@ Public Class F_VEH End If fbVEH.UpdateHistory(file) - Me.Text = fFILE(file, True) - Me.LbStatus.Text = "" + Text = fFILE(file, True) + LbStatus.Text = "" Changed = False @@ -486,52 +470,52 @@ Public Class F_VEH #Region "Cd" 'Cd Mode Change - Private Sub CbCdMode_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) _ + Private Sub CbCdMode_SelectedIndexChanged(sender As Object, e As EventArgs) _ Handles CbCdMode.SelectedIndexChanged Dim bEnabled As Boolean - Select Case CType(Me.CbCdMode.SelectedIndex, tCdMode) + Select Case CType(CbCdMode.SelectedIndex, tCdMode) Case tCdMode.CdOfBeta bEnabled = True - Me.LbCdMode.Text = "Input file: Yaw Angle [°], Cd Scaling Factor [-]" + LbCdMode.Text = "Input file: Yaw Angle [°], Cd Scaling Factor [-]" Case tCdMode.CdOfVeng bEnabled = True - Me.LbCdMode.Text = "Input file: Vehicle Speed [km/h], Cd Scaling Factor [-]" + LbCdMode.Text = "Input file: Vehicle Speed [km/h], Cd Scaling Factor [-]" Case Else ' tCdMode.ConstCd0, tCdMode.CdOfVdecl bEnabled = False - Me.LbCdMode.Text = "" + LbCdMode.Text = "" End Select If Not Cfg.DeclMode Then - Me.TbCdFile.Enabled = bEnabled - Me.BtCdFileBrowse.Enabled = bEnabled - Me.BtCdFileOpen.Enabled = bEnabled + TbCdFile.Enabled = bEnabled + BtCdFileBrowse.Enabled = bEnabled + BtCdFileOpen.Enabled = bEnabled End If Change() End Sub 'Cd File Browse - Private Sub BtCdFileBrowse_Click(sender As System.Object, e As System.EventArgs) Handles BtCdFileBrowse.Click + Private Sub BtCdFileBrowse_Click(sender As Object, e As EventArgs) Handles BtCdFileBrowse.Click Dim ex As String - If Me.CbCdMode.SelectedIndex = 1 Then + If CbCdMode.SelectedIndex = 1 Then ex = "vcdv" Else ex = "vcdb" End If - If fbCDx.OpenDialog(fFileRepl(Me.TbCdFile.Text, fPATH(VehFile)), False, ex) Then _ + If fbCDx.OpenDialog(fFileRepl(TbCdFile.Text, fPATH(VehFile)), False, ex) Then _ TbCdFile.Text = fFileWoDir(fbCDx.Files(0), fPATH(VehFile)) End Sub 'Open Cd File - Private Sub BtCdFileOpen_Click(sender As System.Object, e As System.EventArgs) Handles BtCdFileOpen.Click - OpenFiles(fFileRepl(Me.TbCdFile.Text, fPATH(VehFile))) + Private Sub BtCdFileOpen_Click(sender As Object, e As EventArgs) Handles BtCdFileOpen.Click + OpenFiles(fFileRepl(TbCdFile.Text, fPATH(VehFile))) End Sub #End Region @@ -539,33 +523,33 @@ Public Class F_VEH #Region "Retarder" 'Rt Type Change - Private Sub CbRtType_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) _ + Private Sub CbRtType_SelectedIndexChanged(sender As Object, e As EventArgs) _ Handles CbRtType.SelectedIndexChanged - Select Case Me.CbRtType.SelectedIndex + Select Case CbRtType.SelectedIndex Case 1 'Primary - Me.LbRtRatio.Text = "Ratio to engine speed" - Me.TbRtPath.Enabled = True - Me.BtRtBrowse.Enabled = True - Me.PnRt.Enabled = True + LbRtRatio.Text = "Ratio to engine speed" + TbRtPath.Enabled = True + BtRtBrowse.Enabled = True + PnRt.Enabled = True Case 2 'Secondary - Me.LbRtRatio.Text = "Ratio to cardan shaft speed" - Me.TbRtPath.Enabled = True - Me.BtRtBrowse.Enabled = True - Me.PnRt.Enabled = True + LbRtRatio.Text = "Ratio to cardan shaft speed" + TbRtPath.Enabled = True + BtRtBrowse.Enabled = True + PnRt.Enabled = True Case Else '0 None - Me.LbRtRatio.Text = "Ratio" - Me.TbRtPath.Enabled = False - Me.BtRtBrowse.Enabled = False - Me.PnRt.Enabled = False + LbRtRatio.Text = "Ratio" + TbRtPath.Enabled = False + BtRtBrowse.Enabled = False + PnRt.Enabled = False End Select Change() End Sub 'Rt File Browse - Private Sub BtRtBrowse_Click(sender As System.Object, e As System.EventArgs) Handles BtRtBrowse.Click + Private Sub BtRtBrowse_Click(sender As Object, e As EventArgs) Handles BtRtBrowse.Click - If fbRLM.OpenDialog(fFileRepl(Me.TbRtPath.Text, fPATH(VehFile))) Then _ + If fbRLM.OpenDialog(fFileRepl(TbRtPath.Text, fPATH(VehFile))) Then _ TbRtPath.Text = fFileWoDir(fbRLM.Files(0), fPATH(VehFile)) End Sub @@ -575,7 +559,7 @@ Public Class F_VEH Private Sub Change() If Not Changed Then - Me.LbStatus.Text = "Unsaved changes in current file" + LbStatus.Text = "Unsaved changes in current file" Changed = True End If End Sub @@ -601,67 +585,43 @@ Public Class F_VEH End If End Function - Private Sub TBmass_TextChanged(sender As System.Object, e As System.EventArgs) Handles TbMass.TextChanged + Private Sub TBmass_TextChanged(sender As Object, e As EventArgs) Handles TbMass.TextChanged SetMaxLoad() Change() End Sub - Private Sub TBston_TextChanged(sender As System.Object, e As System.EventArgs) Handles TbLoad.TextChanged - Change() - End Sub - - Private Sub TBDreifen_TextChanged(sender As System.Object, e As System.EventArgs) Handles TBrdyn.TextChanged - Change() - End Sub - - Private Sub CbRim_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) _ + Private Sub CbRim_SelectedIndexChanged(sender As Object, e As EventArgs) _ Handles CbRim.SelectedIndexChanged Change() DeclInit() End Sub - Private Sub TBcw_TextChanged(sender As System.Object, e As System.EventArgs) _ - Handles TBcdA.TextChanged, TBcdA2.TextChanged - Change() - End Sub - - Private Sub TBAquers_TextChanged(sender As System.Object, e As System.EventArgs) - Change() - End Sub - - - Private Sub TbCdFile_TextChanged(sender As System.Object, e As System.EventArgs) Handles TbCdFile.TextChanged - Change() - End Sub - - Private Sub TbRtPath_TextChanged(sender As System.Object, e As System.EventArgs) Handles TbRtPath.TextChanged + Private Sub TBcw_TextChanged(sender As Object, e As EventArgs) _ + Handles TbLoad.TextChanged, TBrdyn.TextChanged, TBcdA.TextChanged, TbCdFile.TextChanged, TbRtPath.TextChanged, + TbRtRatio.TextChanged Change() End Sub - Private Sub TbRtRatio_TextChanged(sender As System.Object, e As System.EventArgs) Handles TbRtRatio.TextChanged - Change() - End Sub - - Private Sub CbCat_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) _ + Private Sub CbCat_SelectedIndexChanged(sender As Object, e As EventArgs) _ Handles CbCat.SelectedIndexChanged Change() SetHDVclass() DeclInit() End Sub - Private Sub TbMassTrailer_TextChanged(sender As System.Object, e As System.EventArgs) Handles TbMassExtra.TextChanged + Private Sub TbMassTrailer_TextChanged(sender As Object, e As EventArgs) Handles TbMassExtra.TextChanged SetMaxLoad() Change() End Sub - Private Sub TbMassMax_TextChanged(sender As System.Object, e As System.EventArgs) Handles TbMassMass.TextChanged + Private Sub TbMassMax_TextChanged(sender As Object, e As EventArgs) Handles TbMassMass.TextChanged SetMaxLoad() Change() SetHDVclass() DeclInit() End Sub - Private Sub CbAxleConfig_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) _ + Private Sub CbAxleConfig_SelectedIndexChanged(sender As Object, e As EventArgs) _ Handles CbAxleConfig.SelectedIndexChanged Change() SetHDVclass() @@ -673,25 +633,25 @@ Public Class F_VEH 'Update maximum load when truck/trailer mass was changed Private Sub SetMaxLoad() If Not Cfg.DeclMode Then - If IsNumeric(Me.TbMass.Text) And IsNumeric(Me.TbMassExtra.Text) And IsNumeric(Me.TbMassMass.Text) Then - Me.TbLoadingMax.Text = CStr(CSng(Me.TbMassMass.Text)*1000 - CSng(Me.TbMass.Text) - CSng(Me.TbMassExtra.Text)) + If IsNumeric(TbMass.Text) And IsNumeric(TbMassExtra.Text) And IsNumeric(TbMassMass.Text) Then + TbLoadingMax.Text = CStr(CSng(TbMassMass.Text) * 1000 - CSng(TbMass.Text) - CSng(TbMassExtra.Text)) Else - Me.TbLoadingMax.Text = "" + TbLoadingMax.Text = "" End If End If End Sub #Region "Axle Configuration" - Private Sub ButAxlAdd_Click(sender As System.Object, e As System.EventArgs) Handles ButAxlAdd.Click + Private Sub ButAxlAdd_Click(sender As Object, e As EventArgs) Handles ButAxlAdd.Click Dim lv0 As ListViewItem AxlDlog.Clear() - If AxlDlog.ShowDialog = Windows.Forms.DialogResult.OK Then + If AxlDlog.ShowDialog = DialogResult.OK Then lv0 = New ListViewItem - lv0.SubItems(0).Text = Me.LvRRC.Items.Count + 1 + lv0.SubItems(0).Text = LvRRC.Items.Count + 1 lv0.SubItems.Add(Trim(AxlDlog.TbAxleShare.Text)) If AxlDlog.CbTwinT.Checked Then lv0.SubItems.Add("yes") @@ -703,7 +663,7 @@ Public Class F_VEH lv0.SubItems.Add(Trim(AxlDlog.CbWheels.Text)) lv0.SubItems.Add(Trim(AxlDlog.TbI_wheels.Text)) - Me.LvRRC.Items.Add(lv0) + LvRRC.Items.Add(lv0) Change() DeclInit() @@ -711,15 +671,15 @@ Public Class F_VEH End If End Sub - Private Sub ButAxlRem_Click(sender As System.Object, e As System.EventArgs) Handles ButAxlRem.Click + Private Sub ButAxlRem_Click(sender As Object, e As EventArgs) Handles ButAxlRem.Click RemoveAxleItem() End Sub - Private Sub LvAxle_DoubleClick(sender As Object, e As System.EventArgs) Handles LvRRC.DoubleClick + Private Sub LvAxle_DoubleClick(sender As Object, e As EventArgs) Handles LvRRC.DoubleClick EditAxleItem() End Sub - Private Sub LvAxle_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles LvRRC.KeyDown + Private Sub LvAxle_KeyDown(sender As Object, e As KeyEventArgs) Handles LvRRC.KeyDown Select Case e.KeyCode Case Keys.Delete, Keys.Back If Not Cfg.DeclMode Then RemoveAxleItem() @@ -771,7 +731,7 @@ Public Class F_VEH AxlDlog.TbI_wheels.Text = LV0.SubItems(6).Text AxlDlog.CbWheels.Text = LV0.SubItems(5).Text - If AxlDlog.ShowDialog = Windows.Forms.DialogResult.OK Then + If AxlDlog.ShowDialog = DialogResult.OK Then LV0.SubItems(1).Text = AxlDlog.TbAxleShare.Text If AxlDlog.CbTwinT.Checked Then LV0.SubItems(2).Text = "yes" @@ -806,16 +766,16 @@ Public Class F_VEH CmOpenFile.Show(Cursor.Position) End Sub - Private Sub OpenWithToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) _ + Private Sub OpenWithToolStripMenuItem_Click(sender As Object, e As EventArgs) _ Handles OpenWithToolStripMenuItem.Click If Not FileOpenAlt(CmFiles(0)) Then MsgBox("Failed to open file!") End Sub - Private Sub ShowInFolderToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) _ + Private Sub ShowInFolderToolStripMenuItem_Click(sender As Object, e As EventArgs) _ Handles ShowInFolderToolStripMenuItem.Click - If IO.File.Exists(CmFiles(0)) Then + If File.Exists(CmFiles(0)) Then Try - System.Diagnostics.Process.Start("explorer", "/select,""" & CmFiles(0) & "") + Process.Start("explorer", "/select,""" & CmFiles(0) & "") Catch ex As Exception MsgBox("Failed to open file!") End Try @@ -825,4 +785,7 @@ Public Class F_VEH End Sub #End Region + + Private Sub Label3_Click(sender As Object, e As EventArgs) Handles Label3.Click + End Sub End Class diff --git a/VECTO/Input Files/cVEH.vb b/VECTO/Input Files/cVEH.vb index eee1b8beeaa945734c8d6c6a61e6e03b386f70ec..ebc8bffa42213ea56dd8b49f167665ecdb95f945 100644 --- a/VECTO/Input Files/cVEH.vb +++ b/VECTO/Input Files/cVEH.vb @@ -11,167 +11,161 @@ Imports System.Collections.Generic Public Class cVEH - - 'V2 MassMax is now saved in [t] instead of [kg] + 'V2 MassMax is now saved in [t] instead of [kg] Private Const FormatVersion As Short = 7 - Private FileVersion As Short + Private FileVersion As Short - Private sFilePath As String - Private MyPath As String + Private sFilePath As String + Private MyPath As String - Public Mass As Single - Public Loading As Single - Private siFr0 As Single + Public Mass As Single + Public Loading As Single + Private siFr0 As Single Public CdA0 As Single Public CdA02 As Single Private CdA0Act As Single - Public CdMode As tCdMode - Public CdFile As cSubPath - Private CdX As List(Of Single) - Private CdY As List(Of Single) - Private CdDim As Integer - - Public RtType As tRtType '0=None, 1=Primary, 2=Secondary - Public RtRatio As Single = 0 - Public RtFile As cSubPath - Private RtDim As Integer - Private RtnU As List(Of Single) - Private RtM As List(Of Single) + Public CdMode As tCdMode + Public CdFile As cSubPath + Private CdX As List(Of Single) + Private CdY As List(Of Single) + Private CdDim As Integer - Public rdyn As Single - Public Axles As List(Of cAxle) - Public Rim As String - Private m_red0 As Single + Public RtType As tRtType '0=None, 1=Primary, 2=Secondary + Public RtRatio As Single = 0 + Public RtFile As cSubPath + Private RtDim As Integer + Private RtnU As List(Of Single) + Private RtM As List(Of Single) - Public VehCat As tVehCat - Public MassExtra As Single - Public MassMax As Single - Public AxleConf As tAxleConf + Public rdyn As Single + Public Axles As List(Of cAxle) + Public Rim As String + Private m_red0 As Single - Private MyFileList As List(Of String) + Public VehCat As tVehCat + Public MassExtra As Single + Public MassMax As Single + Public AxleConf As tAxleConf - Public SavedInDeclMode As Boolean + Private MyFileList As List(Of String) + Public SavedInDeclMode As Boolean - Public Class cAxle - Public RRC As Single - Public Share As Single - Public TwinTire As Boolean - Public FzISO As Single - Public Wheels As String - Public Inertia As Single - End Class + Public Class cAxle + Public RRC As Single + Public Share As Single + Public TwinTire As Boolean + Public FzISO As Single + Public Wheels As String + Public Inertia As Single + End Class - Public Function CreateFileList() As Boolean + Public Function CreateFileList() As Boolean - MyFileList = New List(Of String) + MyFileList = New List(Of String) - '.vcdv / .vcdb + '.vcdv / .vcdb If Me.CdMode = tCdMode.CdOfVeng Or Me.CdMode = tCdMode.CdOfBeta Then MyFileList.Add(Me.CdFile.FullPath) - 'Retarder - If Me.RtType <> tRtType.None Then MyFileList.Add(Me.RtFile.FullPath) - - Return True - - End Function - + 'Retarder + If Me.RtType <> tRtType.None Then MyFileList.Add(Me.RtFile.FullPath) + Return True + End Function - Public Sub New() - MyPath = "" - sFilePath = "" - CdFile = New cSubPath - CdX = New List(Of Single) - CdY = New List(Of Single) - RtFile = New cSubPath - RtnU = New List(Of Single) - RtM = New List(Of Single) - Axles = New List(Of cAxle) - SetDefault() - End Sub - Private Sub SetDefault() - Mass = 0 - MassExtra = 0 - Loading = 0 + Public Sub New() + MyPath = "" + sFilePath = "" + CdFile = New cSubPath + CdX = New List(Of Single) + CdY = New List(Of Single) + RtFile = New cSubPath + RtnU = New List(Of Single) + RtM = New List(Of Single) + Axles = New List(Of cAxle) + SetDefault() + End Sub + + Private Sub SetDefault() + Mass = 0 + MassExtra = 0 + Loading = 0 CdA0 = 0 CdA0Act = CdA0 CdA02 = 0 - CdFile.Clear() - CdMode = tCdMode.ConstCd0 - CdX.Clear() - CdY.Clear() - CdDim = -1 - - siFr0 = 0 - rdyn = 0 - Rim = "" - - RtType = tRtType.None - RtRatio = 0 - RtnU.Clear() - RtM.Clear() - RtFile.Clear() - Axles.Clear() - VehCat = tVehCat.Undef - MassMax = 0 - AxleConf = tAxleConf.Undef + CdFile.Clear() + CdMode = tCdMode.ConstCd0 + CdX.Clear() + CdY.Clear() + CdDim = -1 - SavedInDeclMode = False + siFr0 = 0 + rdyn = 0 + Rim = "" - End Sub + RtType = tRtType.None + RtRatio = 0 + RtnU.Clear() + RtM.Clear() + RtFile.Clear() + Axles.Clear() + VehCat = tVehCat.Undef + MassMax = 0 + AxleConf = tAxleConf.Undef - Public Function Validate() As Boolean - Dim MsgSrc As String - Dim Check As Boolean = True + SavedInDeclMode = False + End Sub - MsgSrc = "VEH/Validate" + Public Function Validate() As Boolean + Dim MsgSrc As String + Dim Check As Boolean = True - If rdyn < 100 Then - WorkerMsg(tMsgID.Err, "Parameter 'Dynamic Tire Radius' is invalid (" & rdyn & "mm).", MsgSrc, sFilePath) - Check = False - End If + MsgSrc = "VEH/Validate" - Return Check + If rdyn < 100 Then + WorkerMsg(tMsgID.Err, "Parameter 'Dynamic Tire Radius' is invalid (" & rdyn & "mm).", MsgSrc, sFilePath) + Check = False + End If - End Function + Return Check + End Function - Public Function ReadFile(Optional ByVal ShowMsg As Boolean = True) As Boolean - Dim Itemp As Single - Dim a0 As cAxle - Dim JSON As New JSON - Dim dic As Object + Public Function ReadFile(Optional ByVal ShowMsg As Boolean = True) As Boolean + Dim Itemp As Single + Dim a0 As cAxle + Dim JSON As New JSON + Dim dic As Object - Dim MsgSrc As String + Dim MsgSrc As String - MsgSrc = "VEH/ReadFile" + MsgSrc = "VEH/ReadFile" - SetDefault() + SetDefault() - If Not JSON.ReadFile(sFilePath) Then Return False + If Not JSON.ReadFile(sFilePath) Then Return False - Try + Try - FileVersion = JSON.Content("Header")("FileVersion") + FileVersion = JSON.Content("Header")("FileVersion") - If FileVersion > 4 Then - SavedInDeclMode = JSON.Content("Body")("SavedInDeclMode") - Else - SavedInDeclMode = Cfg.DeclMode - End If + If FileVersion > 4 Then + SavedInDeclMode = JSON.Content("Body")("SavedInDeclMode") + Else + SavedInDeclMode = Cfg.DeclMode + End If - Mass = JSON.Content("Body")("CurbWeight") - MassExtra = JSON.Content("Body")("CurbWeightExtra") - Loading = JSON.Content("Body")("Loading") - MassMax = JSON.Content("Body")("MassMax") - If FileVersion < 2 Then MassMax /= 1000 + Mass = JSON.Content("Body")("CurbWeight") + MassExtra = JSON.Content("Body")("CurbWeightExtra") + Loading = JSON.Content("Body")("Loading") + MassMax = JSON.Content("Body")("MassMax") + If FileVersion < 2 Then MassMax /= 1000 If FileVersion < 7 Then CdA0 = CSng(JSON.Content("Body")("Cd")) * CSng(JSON.Content("Body")("CrossSecArea")) @@ -182,7 +176,8 @@ Public Class cVEH CdA02 = CdA0 If FileVersion < 4 Then - If Not JSON.Content("Body")("CdRigid") Is Nothing AndAlso Not JSON.Content("Body")("CrossSecAreaRigid") Is Nothing Then + If Not JSON.Content("Body")("CdRigid") Is Nothing AndAlso Not JSON.Content("Body")("CrossSecAreaRigid") Is Nothing _ + Then CdA02 = CSng(JSON.Content("Body")("CdRigid")) * CSng(JSON.Content("Body")("CrossSecAreaRigid")) End If ElseIf FileVersion < 7 Then @@ -195,101 +190,98 @@ Public Class cVEH CdA0Act = CdA0 - If FileVersion < 3 Then - Itemp = JSON.Content("Body")("WheelsInertia") - rdyn = 1000 * JSON.Content("Body")("WheelsDiaEff") / 2 - Rim = "-" - Else - Rim = JSON.Content("Body")("Rim") - rdyn = JSON.Content("Body")("rdyn") - End If - - CdMode = CdModeConv(JSON.Content("Body")("CdCorrMode").ToString) - If Not JSON.Content("Body")("CdCorrFile") Is Nothing Then CdFile.Init(MyPath, JSON.Content("Body")("CdCorrFile")) - - If JSON.Content("Body")("Retarder") Is Nothing Then - RtType = tRtType.None - Else - RtType = RtTypeConv(JSON.Content("Body")("Retarder")("Type").ToString) - If Not JSON.Content("Body")("Retarder")("Ratio") Is Nothing Then RtRatio = JSON.Content("Body")("Retarder")("Ratio") - If Not JSON.Content("Body")("Retarder")("File") Is Nothing Then RtFile.Init(MyPath, JSON.Content("Body")("Retarder")("File")) - End If - - VehCat = ConvVehCat(JSON.Content("Body")("VehCat").ToString) - AxleConf = ConvAxleConf(JSON.Content("Body")("AxleConfig")("Type").ToString) - - For Each dic In JSON.Content("Body")("AxleConfig")("Axles") - - a0 = New cAxle - - If FileVersion < 3 Then - a0.Wheels = "-" - Else - a0.Inertia = CSng(dic("Inertia")) - a0.Wheels = CStr(dic("Wheels")) - If FileVersion < 6 Then a0.Wheels = a0.Wheels.Replace("R ", "R") - End If + If FileVersion < 3 Then + Itemp = JSON.Content("Body")("WheelsInertia") + rdyn = 1000 * JSON.Content("Body")("WheelsDiaEff") / 2 + Rim = "-" + Else + Rim = JSON.Content("Body")("Rim") + rdyn = JSON.Content("Body")("rdyn") + End If + + CdMode = CdModeConv(JSON.Content("Body")("CdCorrMode").ToString) + If Not JSON.Content("Body")("CdCorrFile") Is Nothing Then CdFile.Init(MyPath, JSON.Content("Body")("CdCorrFile")) + + If JSON.Content("Body")("Retarder") Is Nothing Then + RtType = tRtType.None + Else + RtType = RtTypeConv(JSON.Content("Body")("Retarder")("Type").ToString) + If Not JSON.Content("Body")("Retarder")("Ratio") Is Nothing Then RtRatio = JSON.Content("Body")("Retarder")("Ratio") + If Not JSON.Content("Body")("Retarder")("File") Is Nothing Then _ + RtFile.Init(MyPath, JSON.Content("Body")("Retarder")("File")) + End If - a0.Share = CSng(dic("AxleWeightShare")) - a0.TwinTire = CBool(dic("TwinTyres")) - a0.RRC = CSng(dic("RRCISO")) - a0.FzISO = CSng(dic("FzISO")) + VehCat = ConvVehCat(JSON.Content("Body")("VehCat").ToString) + AxleConf = ConvAxleConf(JSON.Content("Body")("AxleConfig")("Type").ToString) - Axles.Add(a0) + For Each dic In JSON.Content("Body")("AxleConfig")("Axles") - Next + a0 = New cAxle - If FileVersion < 3 Then - For Each a0 In Axles - If a0.TwinTire Then - a0.Inertia = Itemp / (4 * Axles.Count) - Else - a0.Inertia = Itemp / (2 * Axles.Count) - End If - Next - End If + If FileVersion < 3 Then + a0.Wheels = "-" + Else + a0.Inertia = CSng(dic("Inertia")) + a0.Wheels = CStr(dic("Wheels")) + If FileVersion < 6 Then a0.Wheels = a0.Wheels.Replace("R ", "R") + End If + a0.Share = CSng(dic("AxleWeightShare")) + a0.TwinTire = CBool(dic("TwinTyres")) + a0.RRC = CSng(dic("RRCISO")) + a0.FzISO = CSng(dic("FzISO")) + Axles.Add(a0) - Catch ex As Exception - If ShowMsg Then WorkerMsg(tMsgID.Err, "Failed to read Vehicle file! " & ex.Message, MsgSrc) - Return False - End Try + Next - Return True + If FileVersion < 3 Then + For Each a0 In Axles + If a0.TwinTire Then + a0.Inertia = Itemp / (4 * Axles.Count) + Else + a0.Inertia = Itemp / (2 * Axles.Count) + End If + Next + End If + Catch ex As Exception + If ShowMsg Then WorkerMsg(tMsgID.Err, "Failed to read Vehicle file! " & ex.Message, MsgSrc) + Return False + End Try - End Function + Return True + End Function - Public Function SaveFile() As Boolean - Dim dic As Dictionary(Of String, Object) - Dim dic0 As Dictionary(Of String, Object) - Dim ls As List(Of Dictionary(Of String, Object)) - Dim a0 As cAxle - Dim JSON As New JSON + Public Function SaveFile() As Boolean + Dim dic As Dictionary(Of String, Object) + Dim dic0 As Dictionary(Of String, Object) + Dim ls As List(Of Dictionary(Of String, Object)) + Dim a0 As cAxle + Dim JSON As New JSON - 'Header - dic = New Dictionary(Of String, Object) - dic.Add("CreatedBy", Lic.LicString & " (" & Lic.GUID & ")") - dic.Add("Date", Now.ToString) - dic.Add("AppVersion", VECTOvers) - dic.Add("FileVersion", FormatVersion) - JSON.Content.Add("Header", dic) + 'Header + dic = New Dictionary(Of String, Object) + dic.Add("CreatedBy", Lic.LicString & " (" & Lic.GUID & ")") + dic.Add("Date", Now.ToString) + dic.Add("AppVersion", VECTOvers) + dic.Add("FileVersion", FormatVersion) + JSON.Content.Add("Header", dic) - 'Body - dic = New Dictionary(Of String, Object) + 'Body + dic = New Dictionary(Of String, Object) - dic.Add("SavedInDeclMode", Cfg.DeclMode) - SavedInDeclMode = Cfg.DeclMode + dic.Add("SavedInDeclMode", Cfg.DeclMode) + SavedInDeclMode = Cfg.DeclMode - dic.Add("VehCat", ConvVehCat(VehCat, False)) + dic.Add("VehCat", ConvVehCat(VehCat, False)) - dic.Add("CurbWeight", Mass) - dic.Add("CurbWeightExtra", MassExtra) - dic.Add("Loading", Loading) - dic.Add("MassMax", MassMax) + dic.Add("CurbWeight", Mass) + dic.Add("CurbWeightExtra", MassExtra) + dic.Add("Loading", Loading) + dic.Add("MassMax", MassMax) dic.Add("CdA", CdA0) @@ -297,43 +289,41 @@ Public Class cVEH dic.Add("CdA2", CdA02) End If - dic.Add("rdyn", rdyn) - dic.Add("Rim", Rim) - - - dic.Add("CdCorrMode", CdModeConv(CdMode)) - dic.Add("CdCorrFile", CdFile.PathOrDummy) - - dic0 = New Dictionary(Of String, Object) - dic0.Add("Type", RtTypeConv(RtType)) - dic0.Add("Ratio", RtRatio) - dic0.Add("File", RtFile.PathOrDummy) - dic.Add("Retarder", dic0) + dic.Add("rdyn", rdyn) + dic.Add("Rim", Rim) - ls = New List(Of Dictionary(Of String, Object)) - For Each a0 In Axles - dic0 = New Dictionary(Of String, Object) - dic0.Add("Inertia", a0.Inertia) - dic0.Add("Wheels", a0.Wheels) - dic0.Add("AxleWeightShare", a0.Share) - dic0.Add("TwinTyres", a0.TwinTire) - dic0.Add("RRCISO", a0.RRC) - dic0.Add("FzISO", a0.FzISO) - ls.Add(dic0) - Next + dic.Add("CdCorrMode", CdModeConv(CdMode)) + dic.Add("CdCorrFile", CdFile.PathOrDummy) - dic0 = New Dictionary(Of String, Object) - dic0.Add("Type", ConvAxleConf(AxleConf)) - dic0.Add("Axles", ls) - dic.Add("AxleConfig", dic0) + dic0 = New Dictionary(Of String, Object) + dic0.Add("Type", RtTypeConv(RtType)) + dic0.Add("Ratio", RtRatio) + dic0.Add("File", RtFile.PathOrDummy) + dic.Add("Retarder", dic0) - JSON.Content.Add("Body", dic) + ls = New List(Of Dictionary(Of String, Object)) + For Each a0 In Axles + dic0 = New Dictionary(Of String, Object) + + dic0.Add("Inertia", a0.Inertia) + dic0.Add("Wheels", a0.Wheels) + dic0.Add("AxleWeightShare", a0.Share) + dic0.Add("TwinTyres", a0.TwinTire) + dic0.Add("RRCISO", a0.RRC) + dic0.Add("FzISO", a0.FzISO) + ls.Add(dic0) + Next - Return JSON.WriteFile(sFilePath) + dic0 = New Dictionary(Of String, Object) + dic0.Add("Type", ConvAxleConf(AxleConf)) + dic0.Add("Axles", ls) + dic.Add("AxleConfig", dic0) + JSON.Content.Add("Body", dic) - End Function + Return JSON.WriteFile(sFilePath) + End Function Public Function DeclInitCycle() As Boolean @@ -433,154 +423,148 @@ Public Class cVEH End If Return True - End Function - Public Function DeclInitLoad(ByVal LoadingID As tLoading) As Boolean - Dim lmax As Single - Dim MissionID As tMission - Dim MsgSrc As String - - MsgSrc = "VEH/DeclInit" - - MissionID = Declaration.CurrentMission.MissionID - - - lmax = MassMax * 1000 - Mass - MassExtra - - Select Case LoadingID - Case tLoading.FullLoaded - Loading = lmax + Public Function DeclInitLoad(ByVal LoadingID As tLoading) As Boolean + Dim lmax As Single + Dim MissionID As tMission + Dim MsgSrc As String - Case tLoading.RefLoaded - Loading = Declaration.SegRef.GetLoading(MissionID, MassMax) - If Loading < 0 Then - WorkerMsg(tMsgID.Err, "Invalid loading in segement table!", MsgSrc) - Return False - End If + MsgSrc = "VEH/DeclInit" - If Loading > lmax Then - WorkerMsg(tMsgID.Warn, "Reference loading > Max. loading! Using max. loading.", MsgSrc) - Loading = lmax - End If + MissionID = Declaration.CurrentMission.MissionID - Case tLoading.EmptyLoaded - Loading = 0 - Case Else ' tLoading.EmptyLoaded - WorkerMsg(tMsgID.Err, "tLoading.UserDefLoaded not allowed!", MsgSrc) - Return False + lmax = MassMax * 1000 - Mass - MassExtra - End Select + Select Case LoadingID + Case tLoading.FullLoaded + Loading = lmax - Return True + Case tLoading.RefLoaded + Loading = Declaration.SegRef.GetLoading(MissionID, MassMax) + If Loading < 0 Then + WorkerMsg(tMsgID.Err, "Invalid loading in segement table!", MsgSrc) + Return False + End If - End Function + If Loading > lmax Then + WorkerMsg(tMsgID.Warn, "Reference loading > Max. loading! Using max. loading.", MsgSrc) + Loading = lmax + End If + Case tLoading.EmptyLoaded + Loading = 0 - Public Function VehmodeInit() As Boolean + Case Else ' tLoading.EmptyLoaded + WorkerMsg(tMsgID.Err, "tLoading.UserDefLoaded not allowed!", MsgSrc) + Return False - Dim MsgSrc As String - Dim a0 As cAxle - Dim ShareSum As Double - Dim RRC As Double - Dim nrwheels As Single + End Select - MsgSrc = "VEH/Init" + Return True + End Function - 'Cd-Init - If Not CdInit() Then Return False - 'Transmission Loss Maps - If Not GBX.TrLossMapInit Then - WorkerMsg(tMsgID.Err, "Failed to initialize Transmission Loss Maps!", MsgSrc) - Return False - End If + Public Function VehmodeInit() As Boolean - 'Retarder - If Not RtInit() Then Return False + Dim MsgSrc As String + Dim a0 As cAxle + Dim ShareSum As Double + Dim RRC As Double + Dim nrwheels As Single - 'Fr0 - If Axles.Count < 2 Then - WorkerMsg(tMsgID.Err, "At least 2 axle configurations are required!", MsgSrc, "<GUI>" & sFilePath) - Return False - End If + MsgSrc = "VEH/Init" - 'Check if sum=100% - ShareSum = 0 - For Each a0 In Axles - ShareSum += a0.Share - Next + 'Cd-Init + If Not CdInit() Then Return False - If Math.Abs(ShareSum - 1) > 0.0001 Then - WorkerMsg(tMsgID.Err, "Sum of relative axle shares is not 100%!", MsgSrc, "<GUI>" & sFilePath) - Return False - End If + 'Transmission Loss Maps + If Not GBX.TrLossMapInit Then + WorkerMsg(tMsgID.Err, "Failed to initialize Transmission Loss Maps!", MsgSrc) + Return False + End If - If rdyn <= 0 Then - WorkerMsg(tMsgID.Err, "rdyn is invalid!", MsgSrc, "<GUI>" & sFilePath) - Return False - End If + 'Retarder + If Not RtInit() Then Return False - RRC = 0 - m_red0 = 0 - For Each a0 In Axles + 'Fr0 + If Axles.Count < 2 Then + WorkerMsg(tMsgID.Err, "At least 2 axle configurations are required!", MsgSrc, "<GUI>" & sFilePath) + Return False + End If - If a0.RRC < -0.000001 Then - WorkerMsg(tMsgID.Err, "Invalid RRC value! (" & a0.RRC & ")", MsgSrc, "<GUI>" & sFilePath) - Return False - End If + 'Check if sum=100% + ShareSum = 0 + For Each a0 In Axles + ShareSum += a0.Share + Next - If a0.FzISO < 0.00001 Then - WorkerMsg(tMsgID.Err, "Invalid FzISO value! (" & a0.FzISO & ")", MsgSrc, "<GUI>" & sFilePath) - Return False - End If + If Math.Abs(ShareSum - 1) > 0.0001 Then + WorkerMsg(tMsgID.Err, "Sum of relative axle shares is not 100%!", MsgSrc, "<GUI>" & sFilePath) + Return False + End If - If a0.TwinTire Then - nrwheels = 4 - Else - nrwheels = 2 - End If + If rdyn <= 0 Then + WorkerMsg(tMsgID.Err, "rdyn is invalid!", MsgSrc, "<GUI>" & sFilePath) + Return False + End If - RRC += a0.Share * (a0.RRC * ((Loading + Mass + MassExtra) * a0.Share * 9.81 / (a0.FzISO * nrwheels)) ^ (0.9 - 1)) 'Beta=0.9 + RRC = 0 + m_red0 = 0 + For Each a0 In Axles - m_red0 += nrwheels * a0.Inertia / ((rdyn / 1000) ^ 2) + If a0.RRC < -0.000001 Then + WorkerMsg(tMsgID.Err, "Invalid RRC value! (" & a0.RRC & ")", MsgSrc, "<GUI>" & sFilePath) + Return False + End If - Next + If a0.FzISO < 0.00001 Then + WorkerMsg(tMsgID.Err, "Invalid FzISO value! (" & a0.FzISO & ")", MsgSrc, "<GUI>" & sFilePath) + Return False + End If - siFr0 = RRC + If a0.TwinTire Then + nrwheels = 4 + Else + nrwheels = 2 + End If - Return True + RRC += a0.Share * (a0.RRC * ((Loading + Mass + MassExtra) * a0.Share * 9.81 / (a0.FzISO * nrwheels)) ^ (0.9 - 1)) 'Beta=0.9 - End Function + m_red0 += nrwheels * a0.Inertia / ((rdyn / 1000) ^ 2) - + Next + siFr0 = RRC + Return True + End Function #Region "Cd Funktionen" - Private Function CdInit() As Boolean - Dim file As cFile_V3 - Dim MsgSrc As String - Dim line As String() + Private Function CdInit() As Boolean + Dim file As cFile_V3 + Dim MsgSrc As String + Dim line As String() - MsgSrc = "VEH/CdInit" + MsgSrc = "VEH/CdInit" - 'Warn If Vair specified in DRI but CdType != CdOfBeta - If DRI.VairVorg Xor CdMode = tCdMode.CdOfBeta Then + 'Warn If Vair specified in DRI but CdType != CdOfBeta + If DRI.VairVorg Xor CdMode = tCdMode.CdOfBeta Then - If DRI.VairVorg Then - WorkerMsg(tMsgID.Warn, "Vair input in driving cycle will be irgnored! (Side wind correction disabled in .veh file)", MsgSrc) - Else - WorkerMsg(tMsgID.Err, "No Vair input in driving cycle defined! Vres and Beta is required!", MsgSrc) - Return False - End If + If DRI.VairVorg Then + WorkerMsg(tMsgID.Warn, "Vair input in driving cycle will be irgnored! (Side wind correction disabled in .veh file)", + MsgSrc) + Else + WorkerMsg(tMsgID.Err, "No Vair input in driving cycle defined! Vres and Beta is required!", MsgSrc) + Return False + End If - End If + End If - 'If Cd-value is constant then do nothing + 'If Cd-value is constant then do nothing If CdMode = tCdMode.ConstCd0 Then Return True 'Declaration Mode @@ -610,7 +594,8 @@ Public Class cVEH CdX.Add(CSng(line(0))) CdY.Add(CSng(line(1))) Catch ex As Exception - WorkerMsg(tMsgID.Err, "Error during file read! Line number: " & CdDim + 1 & " (" & CdFile.FullPath & ")", MsgSrc, CdFile.FullPath) + WorkerMsg(tMsgID.Err, "Error during file read! Line number: " & CdDim + 1 & " (" & CdFile.FullPath & ")", MsgSrc, + CdFile.FullPath) file.Close() Return False End Try @@ -620,12 +605,12 @@ Public Class cVEH file.Close() If CdDim < 1 Then - WorkerMsg(tMsgID.Err, "Cd input file invalid! Two or more lines required! (" & CdFile.FullPath & ")", MsgSrc, CdFile.FullPath) + WorkerMsg(tMsgID.Err, "Cd input file invalid! Two or more lines required! (" & CdFile.FullPath & ")", MsgSrc, + CdFile.FullPath) Return False End If Return True - End Function Private Function CdofVdeclInit() As Boolean @@ -720,8 +705,6 @@ Public Class cVEH CdDim = CdX.Count - 1 Return True - - End Function Public Function CdA_Y(ByVal x As Single) As Single @@ -766,158 +749,146 @@ Public Class cVEH lbInt: 'Interpolation Return (x - CdX(i - 1)) * (CdY(i) - CdY(i - 1)) / (CdX(i) - CdX(i - 1)) + CdY(i - 1) - End Function #End Region #Region "Retarder" - Private Function RtInit() As Boolean - Dim file As cFile_V3 - Dim MsgSrc As String - Dim line As String() - - MsgSrc = "VEH/RtInit" - - If RtType = tRtType.None Then Return True + Private Function RtInit() As Boolean + Dim file As cFile_V3 + Dim MsgSrc As String + Dim line As String() - 'Read Inputfile - file = New cFile_V3 - If Not file.OpenRead(RtFile.FullPath) Then - WorkerMsg(tMsgID.Err, "Failed to read Retarder input file! (" & RtFile.FullPath & ")", MsgSrc) - Return False - End If + MsgSrc = "VEH/RtInit" - 'Skip Header - file.ReadLine() + If RtType = tRtType.None Then Return True - RtDim = -1 - Do While Not file.EndOfFile + 'Read Inputfile + file = New cFile_V3 + If Not file.OpenRead(RtFile.FullPath) Then + WorkerMsg(tMsgID.Err, "Failed to read Retarder input file! (" & RtFile.FullPath & ")", MsgSrc) + Return False + End If - RtDim += 1 - line = file.ReadLine + 'Skip Header + file.ReadLine() - Try - RtnU.Add(CSng(line(0))) - RtM.Add(CSng(line(1))) - Catch ex As Exception - WorkerMsg(tMsgID.Err, "Error during file read! Line number: " & RtDim + 1 & " (" & RtFile.FullPath & ")", MsgSrc, RtFile.FullPath) - file.Close() - Return False - End Try + RtDim = -1 + Do While Not file.EndOfFile - Loop + RtDim += 1 + line = file.ReadLine - file.Close() + Try + RtnU.Add(CSng(line(0))) + RtM.Add(CSng(line(1))) + Catch ex As Exception + WorkerMsg(tMsgID.Err, "Error during file read! Line number: " & RtDim + 1 & " (" & RtFile.FullPath & ")", MsgSrc, + RtFile.FullPath) + file.Close() + Return False + End Try - If RtDim < 1 Then - WorkerMsg(tMsgID.Err, "Retarder input file invalid! Two or more lines required! (" & RtFile.FullPath & ")", MsgSrc, RtFile.FullPath) - Return False - End If + Loop - Return True + file.Close() - End Function + If RtDim < 1 Then + WorkerMsg(tMsgID.Err, "Retarder input file invalid! Two or more lines required! (" & RtFile.FullPath & ")", MsgSrc, + RtFile.FullPath) + Return False + End If + Return True + End Function - Public Function RtPeLoss(ByVal v As Single, ByVal Gear As Integer) As Single - Dim M As Single - Dim nU As Single - Select Case RtType + Public Function RtPeLoss(ByVal v As Single, ByVal Gear As Integer) As Single + Dim M As Single + Dim nU As Single - Case tRtType.Primary - nU = (60 * v) / (2 * VEH.rdyn * Math.PI / 1000) * GBX.Igetr(0) * GBX.Igetr(Gear) * RtRatio + Select Case RtType - Case tRtType.Secondary - nU = (60 * v) / (2 * VEH.rdyn * Math.PI / 1000) * GBX.Igetr(0) * RtRatio + Case tRtType.Primary + nU = (60 * v) / (2 * VEH.rdyn * Math.PI / 1000) * GBX.Igetr(0) * GBX.Igetr(Gear) * RtRatio - Case Else 'tRtType.None - Return 0 + Case tRtType.Secondary + nU = (60 * v) / (2 * VEH.rdyn * Math.PI / 1000) * GBX.Igetr(0) * RtRatio - End Select + Case Else 'tRtType.None + Return 0 - M = RtIntpol(nU) + End Select - Return M * nU * 2 * Math.PI / 60 / 1000 + M = RtIntpol(nU) - End Function + Return M * nU * 2 * Math.PI / 60 / 1000 + End Function - Private Function RtIntpol(ByVal nU As Single) As Single - Dim i As Int32 + Private Function RtIntpol(ByVal nU As Single) As Single + Dim i As Int32 - 'Extrapolation for x < x(1) - If RtnU(0) >= nU Then - If RtnU(0) > nU Then MODdata.ModErrors.RtExtrapol = "n= " & nU & " [1/min]" - i = 1 - GoTo lbInt - End If + 'Extrapolation for x < x(1) + If RtnU(0) >= nU Then + If RtnU(0) > nU Then MODdata.ModErrors.RtExtrapol = "n= " & nU & " [1/min]" + i = 1 + GoTo lbInt + End If - i = 0 - Do While RtnU(i) < nU And i < RtDim - i += 1 - Loop + i = 0 + Do While RtnU(i) < nU And i < RtDim + i += 1 + Loop - 'Extrapolation for x> x(imax) - If RtnU(i) < nU Then MODdata.ModErrors.RtExtrapol = "n= " & nU & " [1/min]" + 'Extrapolation for x> x(imax) + If RtnU(i) < nU Then MODdata.ModErrors.RtExtrapol = "n= " & nU & " [1/min]" lbInt: - 'Interpolation - Return (nU - RtnU(i - 1)) * (RtM(i) - RtM(i - 1)) / (RtnU(i) - RtnU(i - 1)) + RtM(i - 1) - - End Function + 'Interpolation + Return (nU - RtnU(i - 1)) * (RtM(i) - RtM(i - 1)) / (RtnU(i) - RtnU(i - 1)) + RtM(i - 1) + End Function #End Region #Region "Properties" - Public ReadOnly Property FileList As List(Of String) - Get - Return MyFileList - End Get - End Property - - Public ReadOnly Property m_red As Single - Get - Return m_red0 - End Get - End Property - - Public Property Fr0 As Single - Get - Return siFr0 - End Get - Set(ByVal value As Single) - siFr0 = value - End Set - End Property - - Public Property FilePath() As String - Get - Return sFilePath - End Get - Set(ByVal value As String) - sFilePath = value - If sFilePath = "" Then - MyPath = "" - Else - MyPath = IO.Path.GetDirectoryName(sFilePath) & "\" - End If - End Set - End Property - - - - - - - - + Public ReadOnly Property FileList As List(Of String) + Get + Return MyFileList + End Get + End Property + + Public ReadOnly Property m_red As Single + Get + Return m_red0 + End Get + End Property + + Public Property Fr0 As Single + Get + Return siFr0 + End Get + Set(ByVal value As Single) + siFr0 = value + End Set + End Property + + Public Property FilePath() As String + Get + Return sFilePath + End Get + Set(ByVal value As String) + sFilePath = value + If sFilePath = "" Then + MyPath = "" + Else + MyPath = IO.Path.GetDirectoryName(sFilePath) & "\" + End If + End Set + End Property #End Region - - End Class diff --git a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs index c88fec806e0f6dd944eb55058ce314fe73231672..3f101c0fa89ff5659b35cc36a98923b71f638400 100644 --- a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs +++ b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs @@ -91,16 +91,10 @@ namespace TUGraz.VectoCommon.InputData Kilogram GrossVehicleMassRating { get; } /// <summary> - /// P146 DragCoefficient * Cross Section Area - Truck & Trailer + /// P146, P147 DragCoefficient * Cross Section Area - Rigid /// cf. VECTO Input Parameters.xlsx /// </summary> - SquareMeter AirDragArea { get; } - - /// <summary> - /// P147 DragCoefficient * Cross Section Area - Rigid - /// cf. VECTO Input Parameters.xlsx - /// </summary> - SquareMeter AirDragAreaRigidTruck { get; } // without trailer + SquareMeter AirDragArea { get; } // without trailer /// <summary> /// P117 Powered axle tyres/rims diff --git a/VectoCore/VectoCore/VectoCore.csproj b/VectoCore/VectoCore/VectoCore.csproj index ce908c61962e92bdedd8c51a94cbab7bf5efa6a1..6d06ca210134d73c406036c781c1b34e755e3264 100644 --- a/VectoCore/VectoCore/VectoCore.csproj +++ b/VectoCore/VectoCore/VectoCore.csproj @@ -139,7 +139,7 @@ <Compile Include="Models\Declaration\PT1.cs" /> <Compile Include="Models\Declaration\Rims.cs" /> <Compile Include="Models\Declaration\Segments.cs" /> - <Compile Include="Models\Declaration\StandardWeigths.cs" /> + <Compile Include="Models\Declaration\StandardWeights.cs" /> <Compile Include="Models\Declaration\SteeringPump.cs" /> <Compile Include="Models\Declaration\TorqueConverter.cs" /> <Compile Include="Models\Declaration\VehicleClass.cs" /> @@ -317,7 +317,7 @@ </None> <EmbeddedResource Include="Resources\Declaration\LAC-DF-Vdrop.csv" /> <EmbeddedResource Include="Resources\Declaration\LAC-DF-Vtarget.csv" /> - <EmbeddedResource Include="Resources\Declaration\StandardWeights.csv" /> + <EmbeddedResource Include="Resources\Declaration\Body_Trailers_Weights.csv" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Resources\Declaration\Report\4x2r.png" /> diff --git a/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs b/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs index 72d9cc4c15c52c84fdade4de0a85884fc254373a..b568b7c0752f36769bdee49a5080e5f2ac60690e 100644 --- a/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs +++ b/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs @@ -557,14 +557,14 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration Assert.IsTrue(new[] { 0.4, 0.6 }.SequenceEqual(longHaulMission.AxleWeightDistribution)); Assert.IsTrue(new double[] { }.SequenceEqual(longHaulMission.TrailerAxleWeightDistribution)); - Assert.AreEqual(1900.SI<Kilogram>(), longHaulMission.MassExtra); + Assert.AreEqual(1900.SI<Kilogram>(), longHaulMission.BodyCurbWeight); Assert.IsNotNull(longHaulMission.CycleFile); Assert.IsTrue(!string.IsNullOrEmpty(new StreamReader(longHaulMission.CycleFile).ReadLine())); Assert.AreEqual(0.SI<Kilogram>(), longHaulMission.MinLoad); Assert.AreEqual(4150, longHaulMission.RefLoad.Value()); - Assert.AreEqual(vehicleData.GrossVehicleMassRating - longHaulMission.MassExtra - vehicleData.CurbWeight, + Assert.AreEqual(vehicleData.GrossVehicleMassRating - longHaulMission.BodyCurbWeight - vehicleData.CurbWeight, longHaulMission.MaxLoad); var regionalDeliveryMission = segment.Missions[1]; @@ -574,7 +574,7 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration Assert.IsTrue(new[] { 0.45, 0.55 }.SequenceEqual(regionalDeliveryMission.AxleWeightDistribution)); Assert.IsTrue(new double[] { }.SequenceEqual(regionalDeliveryMission.TrailerAxleWeightDistribution)); - Assert.AreEqual(1900.SI<Kilogram>(), regionalDeliveryMission.MassExtra); + Assert.AreEqual(1900.SI<Kilogram>(), regionalDeliveryMission.BodyCurbWeight); Assert.IsNotNull(regionalDeliveryMission.CycleFile); Assert.IsTrue(!string.IsNullOrEmpty(new StreamReader(regionalDeliveryMission.CycleFile).ReadLine())); @@ -583,7 +583,7 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration Assert.AreEqual(0.3941 * vehicleData.GrossVehicleMassRating - 1705.9.SI<Kilogram>(), regionalDeliveryMission.RefLoad); Assert.AreEqual( - vehicleData.GrossVehicleMassRating - regionalDeliveryMission.MassExtra - vehicleData.CurbWeight, + vehicleData.GrossVehicleMassRating - regionalDeliveryMission.BodyCurbWeight - vehicleData.CurbWeight, regionalDeliveryMission.MaxLoad); var urbanDeliveryMission = segment.Missions[2]; @@ -593,7 +593,7 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration Assert.IsTrue(new[] { 0.45, 0.55 }.SequenceEqual(urbanDeliveryMission.AxleWeightDistribution)); Assert.IsTrue(new double[] { }.SequenceEqual(urbanDeliveryMission.TrailerAxleWeightDistribution)); - Assert.AreEqual(1900.SI<Kilogram>(), urbanDeliveryMission.MassExtra); + Assert.AreEqual(1900.SI<Kilogram>(), urbanDeliveryMission.BodyCurbWeight); Assert.IsNotNull(urbanDeliveryMission.CycleFile); Assert.IsTrue(!string.IsNullOrEmpty(new StreamReader(urbanDeliveryMission.CycleFile).ReadLine())); @@ -602,7 +602,7 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration Assert.AreEqual(0.3941 * vehicleData.GrossVehicleMassRating - 1705.9.SI<Kilogram>(), urbanDeliveryMission.RefLoad); Assert.AreEqual( - vehicleData.GrossVehicleMassRating - urbanDeliveryMission.MassExtra - vehicleData.CurbWeight, + vehicleData.GrossVehicleMassRating - urbanDeliveryMission.BodyCurbWeight - vehicleData.CurbWeight, urbanDeliveryMission.MaxLoad); } diff --git a/VectoCore/VectoCoreTest/VectoCoreTest.csproj b/VectoCore/VectoCoreTest/VectoCoreTest.csproj index 948f90711028002ba081f171073b63c437178f4a..0087d1e5dcd63344372e8f158ba6759084f9f0fd 100644 --- a/VectoCore/VectoCoreTest/VectoCoreTest.csproj +++ b/VectoCore/VectoCoreTest/VectoCoreTest.csproj @@ -156,7 +156,6 @@ <Compile Include="Utils\DelauneyMapTest.cs" /> <Compile Include="Utils\MockModalDataContainer.cs" /> <Compile Include="Utils\DoubleExtensionMethodTest.cs" /> - <Compile Include="Utils\VectoCSVTest.cs" /> <Compile Include="Utils\VectoMathTest.cs" /> </ItemGroup> <ItemGroup>