diff --git a/Declaration/Source/Report Tempalte.pdf b/Declaration/Source/Report Tempalte.pdf new file mode 100644 index 0000000000000000000000000000000000000000..4e0c05cd588c14f870f9aa8da148c0f86ba1fc79 Binary files /dev/null and b/Declaration/Source/Report Tempalte.pdf differ diff --git a/Declaration/Source/Report Tempalte.xlsx b/Declaration/Source/Report Tempalte.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..c0449863d12f9cd869ae2f70841aa74e59964b16 Binary files /dev/null and b/Declaration/Source/Report Tempalte.xlsx differ diff --git a/Declaration/Source/Source.pptx b/Declaration/Source/Source.pptx new file mode 100644 index 0000000000000000000000000000000000000000..781e192ca0c1975fe5de42b3ca321e929eecccce Binary files /dev/null and b/Declaration/Source/Source.pptx differ diff --git a/Third Party Libraries/itextsharp/itextsharp.dll b/Third Party Libraries/itextsharp/itextsharp.dll new file mode 100644 index 0000000000000000000000000000000000000000..530401ad430afd43389cbb1f54a5ea675972e82d Binary files /dev/null and b/Third Party Libraries/itextsharp/itextsharp.dll differ diff --git a/User Manual Source/Declaration Results TEMPLATE.docx b/User Manual Source/Declaration Results TEMPLATE.docx new file mode 100644 index 0000000000000000000000000000000000000000..5e77fb11052cda283f1e1a89b5f332761b90b6d9 Binary files /dev/null and b/User Manual Source/Declaration Results TEMPLATE.docx differ diff --git a/User Manual/GUI/GBX-Editor.html b/User Manual/GUI/GBX-Editor.html index aaeb15e2a53747a3d2b22f10753effe0fdb8c1a6..4c180f01197881a6ba75ba437bae23d3d9161106 100644 --- a/User Manual/GUI/GBX-Editor.html +++ b/User Manual/GUI/GBX-Editor.html @@ -118,9 +118,10 @@ gear shift event.<br> </ul>Use the <img style="width: 16px; height: 16px;" alt="add" src="../pics/icons/plus-circle-icon.png"> and <img style="width: 16px; height: 16px;" alt="remove" src="../pics/icons/minus-circle-icon.png"> buttons to add or remove gears form the vehicle. Doubleclick entries to edit existing gears.<br><ul> <li>Gear "A" defines the ratio of the axle transmission / -differential.</li><li>Column "TC" (AT only) defines which gears are using the torque converter (lock-up clutch open). Details <a href="#tcon">below</a>.</li><li>Column "Loss Map or Efficiency" allows to define either a constant efficiency value or a loss map in the following format:</li></ul> -<div style="margin-left: 40px;"><span style="font-weight: bold;">Torque Loss -Map Format</span> (comma-separated, dot = decimal-mark):</div></div> +differential.</li><li>Column "TC" (AT only) defines which gears are using the torque converter (lock-up clutch open). Details <a href="#tcon">below</a>.</li><li>Column +"Loss Map or Efficiency" allows to define either a constant efficiency +value or a loss map (.vtlm) in the following format:</li></ul> +<div style="margin-left: 40px;"><span style="font-weight: bold;">.vtlm Format</span> (comma-separated, dot = decimal-mark):</div></div> <table style="background-color: white; text-align: left; height: 115px; width: 481px; margin-left: 80px;" border="1" cellpadding="2" cellspacing="1"> <tbody> <tr> diff --git a/User Manual/GUI/VEH-Editor.html b/User Manual/GUI/VEH-Editor.html index 63c350630975b6c663b7bd9d6f8832d401ec2b4d..9627c47e7cd3af6c12de2d36cd6f892335e9eccf 100644 --- a/User Manual/GUI/VEH-Editor.html +++ b/User Manual/GUI/VEH-Editor.html @@ -116,7 +116,7 @@ axle configurations.<br><br>Rolling Resistance Coefficients (RRC<sub>ISO</sub>) are configured per axle. <span style="font-weight: bold;">Relative axle load [-]</span> is used to weighten each RRC<sub>ISO</sub> value. RRC<sub>ISO</sub> is normalized (Resistance Force [N] / (m [kg] * g [m/s²]) with m being the sum of Curb Weight Vehicle, -Curb Weight Extra Trailer/Body and Loading).<br>The total RRC value depends on the vehicle loading and is calculated using the following formula:<br><img style="width: 378px; height: 71px;" alt="" src="pics/VEH-RRC_formula.png"><br>with:<br><div style="margin-left: 40px;"><br><table style="text-align: left; width: 909px; height: 195px;" border="0" cellpadding="2" cellspacing="2"><tbody><tr><td style="width: 76px;">RRC</td><td style="width: 75px;">[-]</td><td style="width: 539px;">...Total rolling resistance coefficient used for calculation</td><td>[calculated]</td></tr><tr><td>s<sub>(i)</sub></td><td>[-]</td><td>...Relative axle load</td><td>[user input]</td></tr><tr><td style="width: 76px;">RRC<sub>ISO(i)</sub></td><td style="width: 75px;">[-]</td><td style="width: 539px;">...Tyre RRC according to ISO 28580</td><td>[user input]</td></tr><tr><td style="width: 76px;">m<sub></sub></td><td style="width: 75px;">[N]</td><td style="width: 539px;">...Vehicle mass plus loading (see <a href="#load">Weight / Loading</a>)</td><td>[calculated]</td></tr><tr><td>g</td><td>[m/s²]</td><td>...Earth gravity acceleration (constant = 9.81)</td><td>[constant model parameter]</td></tr><tr><td>w<sub>(i)</sub></td><td>[-]</td><td>...Number of tyres (4 if Twin Tyres, else 2)</td><td>[user input]</td></tr><tr><td style="width: 76px;">F<sub>zISO(i)</sub></td><td style="width: 75px;">[N]</td><td style="width: 539px;">...Tyre test load according to ISO 28580 (85% of max. load capacity)</td><td>[user input]</td></tr><tr><td style="width: 76px;"><span style="font-size: 12pt; font-family: "Times New Roman","serif";" lang="DE-AT">β</span></td><td style="width: 75px;">[-]</td><td style="width: 539px;">...Constant parameter = 0.9</td><td>[constant model parameter]</td></tr></tbody></table></div><br>For each axle the parameters <span style="font-weight: bold;">Relative axle load</span>, <span style="font-weight: bold;">RRC</span><sub style="font-weight: bold;">ISO</sub> and <span style="font-weight: bold;">F</span><sub style="font-weight: bold;">zISO</sub> have to be defined. Axles with twin tyres have to be marked using the respective checkbox.<br> +Curb Weight Extra Trailer/Body and Loading).<br>The total RRC value depends on the vehicle loading and is calculated using the following formula:<br><img style="width: 378px; height: 71px;" alt="" src="pics/VEH-RRC_formula.png"><br>with:<br><div style="margin-left: 40px;"><br><table style="text-align: left; width: 909px; height: 195px;" border="0" cellpadding="2" cellspacing="2"><tbody><tr><td style="width: 76px;">RRC</td><td style="width: 75px;">[-]</td><td style="width: 539px;">...Total rolling resistance coefficient used for calculation</td><td>[calculated]</td></tr><tr><td>s<sub>(i)</sub></td><td>[-]</td><td>...Relative axle load</td><td>[user input]</td></tr><tr><td style="width: 76px;">RRC<sub>ISO(i)</sub></td><td style="width: 75px;">[-]</td><td style="width: 539px;">...Tyre RRC according to ISO 28580</td><td>[user input]</td></tr><tr><td style="width: 76px;">m<sub></sub></td><td style="width: 75px;">[kg]</td><td style="width: 539px;">...Vehicle mass plus loading (see <a href="#load">Weight / Loading</a>)</td><td>[calculated]</td></tr><tr><td>g</td><td>[m/s²]</td><td>...Earth gravity acceleration (constant = 9.81)</td><td>[constant model parameter]</td></tr><tr><td>w<sub>(i)</sub></td><td>[-]</td><td>...Number of tyres (4 if Twin Tyres, else 2)</td><td>[user input]</td></tr><tr><td style="width: 76px;">F<sub>zISO(i)</sub></td><td style="width: 75px;">[N]</td><td style="width: 539px;">...Tyre test load according to ISO 28580 (85% of max. load capacity)</td><td>[user input]</td></tr><tr><td style="width: 76px;"><span style="font-size: 12pt; font-family: "Times New Roman","serif";" lang="DE-AT">β</span></td><td style="width: 75px;">[-]</td><td style="width: 539px;">...Constant parameter = 0.9</td><td>[constant model parameter]</td></tr></tbody></table></div><br>For each axle the parameters <span style="font-weight: bold;">Relative axle load</span>, <span style="font-weight: bold;">RRC</span><sub style="font-weight: bold;">ISO</sub> and <span style="font-weight: bold;">F</span><sub style="font-weight: bold;">zISO</sub> have to be defined. Axles with twin tyres have to be marked using the respective checkbox.<br> <span style="font-weight: bold;"></span></div> <br><br> <span style="font-weight: bold;"><a name="inertia"></a>Wheels @@ -244,10 +244,10 @@ engine speed</li> <li>Secondary (after gearbox): The rpm ratio is relative to the cardan shaft speed</li> </ul> -Both, primary and secondary retarders, require an input file defining +Both, primary and secondary retarders, require an input file (.vrlm) defining the Retarder Loss Torque:<br> <span style="font-weight: bold;"><br> -Format</span> +.vrlm Format</span> (comma-separated, dot = decimal-mark): </div> <table style="background-color: white; text-align: left; margin-right: auto; height: 116px; width: 542px; margin-left: 40px;" border="1" cellpadding="2" cellspacing="1"> diff --git a/User Manual/usermanual.html b/User Manual/usermanual.html index 92f6cc268b57704f7a8c5d3e3ca18b4b7d4fdd8e..d2efff00100a937544078a303f15b91b872fbf8d 100644 --- a/User Manual/usermanual.html +++ b/User Manual/usermanual.html @@ -29,7 +29,7 @@ Interface</big></li> <li style="font-family: Calibri;"><big><a href="GUI/GBX-Editor.html">Gearbox Editor</a></big></li><li style="font-family: Calibri;"><big><a href="../GRAPHi/documentation/HTML%20Manual/mainwindow.html">GRAPHi (2D Visualiser)</a><br></big></li> </ul><li style="font-family: Calibri;"><big>Functions</big></li><ul><li style="font-family: Calibri;"><a href="GUI/VECTO-Editor_Aux.html"><big>Auxiliaries</big></a></li><li style="font-family: Calibri;"><a href="GUI/VEH-Editor.html#wind"><big>Cross Wind Correction</big></a></li><li style="font-family: Calibri;"><a href="GUI/mainform_options.html#CycleDistCor"><big>Cycle Distance Correction</big></a></li><li style="font-family: Calibri;"><a href="GUI/VECTO-Editor_Driver.html#eco"><big>Eco-Roll</big></a></li><li style="font-family: Calibri;"><a href="GUI/VECTO-Editor.html#engonly"><big>Engine Only Mode</big></a></li><li style="font-family: Calibri;"><a href="GUI/VECTO-Editor_Driver.html#startstop"><big>Engine Start/Stop</big></a></li><li style="font-family: Calibri;"><a href="GUI/ENG-Editor.html#map"><big>Fuel Map Interpolation</big></a></li><li style="font-family: Calibri;"><a href="GUI/ENG-Editor.html#fld"><big>Full Load and Drag Curve (incl. PT1 approach)</big></a></li><li style="font-family: Calibri;"><a href="GUI/GBX-Editor.html#polyfile"><big>Gear shift model</big></a></li><li style="font-family: Calibri;"><big><a href="GUI/VECTO-Editor_Driver.html#vacc">Limit acceleration and deceleration</a> </big></li><li style="font-family: Calibri;"><a href="GUI/VECTO-Editor_Driver.html#look"><big>Look-Ahead Coasting</big></a></li><li style="font-family: Calibri;"><a href="GUI/VECTO-Editor_Driver.html#eco"><big>Overspeed</big></a></li><li style="font-family: Calibri;"><a href="GUI/VEH-Editor.html#retard"><big>Retarder Losses</big></a></li><li style="font-family: Calibri;"><a href="GUI/GBX-Editor.html#tcon"><big>Torque Converter</big></a></li><li style="font-family: Calibri;"><big><a href="GUI/GBX-Editor.html#gears">Transmission Loss Maps</a><br></big></li><li style="font-family: Calibri;"><big><a href="GUI/mainform_options.html#UseGears">Use gears/rpm's form driving cycle</a><br></big></li></ul> <li style="font-family: Calibri;"><big><a href="general/cmd.html">Command line arguments<br></a></big></li> -<li style="font-family: Calibri;"><big><a href="fileformat/index.html">Input and Output Files</a></big></li><ul><li style="font-family: Calibri;"><a href="fileformat/index.html"><big>CSV Format</big></a></li><li style="font-family: Calibri;"><big>Input Files</big></li><ul style="font-family: Calibri;"><li><font size="+1"><a href="GUI/VECTO-Editor.html">Job File (.vecto)</a></font></li><li><font size="+1"><a href="GUI/VEH-Editor.html">Vehicle File (.vveh)</a></font></li><li><font size="+1"><a href="GUI/ENG-Editor.html">Engine File (.veng)</a></font></li><li><font size="+1"><a href="GUI/GBX-Editor.html">Gearbox File (.vgbx)</a></font></li><li><font size="+1"><a href="fileformat/VDRI.html">Driving Cycle (.vdri)</a></font></li><li><font size="+1"><a href="GUI/VEH-Editor.html#cdv">Speed dependent Cross Wind Correction Input File (.vcdv)</a></font></li><li><font size="+1"><a href="GUI/VEH-Editor.html#cdb">Cross Wind Correction via Vair & Beta Input File (.vcdb)</a></font></li><li><font size="+1"><a href="GUI/VEH-Editor.html#retard">Retarder Torque Loss Map</a></font></li><li><font size="+1"><a href="GUI/ENG-Editor.html#fld">Full Load and Drag Torque (.vfld)</a></font></li><li><font size="+1"><a href="GUI/ENG-Editor.html#map">Fuel Consumption Map (.vmap)</a></font></li><li><font size="+1"><a href="GUI/GBX-Editor.html#gears">Transmission Loss Map</a></font></li><li><font size="+1"><a href="GUI/VECTO-Editor_Aux.html#file">Auxiliary (.vaux)</a></font></li><li><font size="+1"><a href="GUI/VECTO-Editor_Driver.html#vacc">Max. acceleration and brake curves (.vacc)</a></font></li><li><font size="+1"><a href="GUI/GBX-Editor.html#polyfile">Shift polygons (.vgbs)</a></font></li><li><font size="+1"><a href="GUI/GBX-Editor.html#tcfile">Torque Converter Characteristics (.vtcc)</a></font></li></ul><li style="font-family: Calibri;"><big>Output Files</big></li><ul style="font-family: Calibri;"><li><big><a href="fileformat/VMOD.html">Modal Results (.vmod)</a></big></li><li><big><a href="fileformat/VSUM.html">Summary Results (.vsum)</a></big></li></ul></ul><li style="font-family: Calibri;"><big><a href="contact.html">Contact & Support</a></big></li> +<li style="font-family: Calibri;"><big><a href="fileformat/index.html">Input and Output Files</a></big></li><ul><li style="font-family: Calibri;"><a href="fileformat/index.html"><big>CSV Format</big></a></li><li style="font-family: Calibri;"><big>Input Files</big></li><ul style="font-family: Calibri;"><li><font size="+1"><a href="GUI/VECTO-Editor.html">Job File (.vecto)</a></font></li><li><font size="+1"><a href="GUI/VEH-Editor.html">Vehicle File (.vveh)</a></font></li><li><font size="+1"><a href="GUI/ENG-Editor.html">Engine File (.veng)</a></font></li><li><font size="+1"><a href="GUI/GBX-Editor.html">Gearbox File (.vgbx)</a></font></li><li><font size="+1"><a href="fileformat/VDRI.html">Driving Cycle (.vdri)</a></font></li><li><font size="+1"><a href="GUI/VEH-Editor.html#cdv">Speed dependent Cross Wind Correction Input File (.vcdv)</a></font></li><li><font size="+1"><a href="GUI/VEH-Editor.html#cdb">Cross Wind Correction via Vair & Beta Input File (.vcdb)</a></font></li><li><font size="+1"><a href="GUI/VEH-Editor.html#retard">Retarder Torque Loss Map (.vrlm)</a></font></li><li><font size="+1"><a href="GUI/ENG-Editor.html#fld">Full Load and Drag Torque (.vfld)</a></font></li><li><font size="+1"><a href="GUI/ENG-Editor.html#map">Fuel Consumption Map (.vmap)</a></font></li><li><font size="+1"><a href="GUI/GBX-Editor.html#gears">Transmission Loss Map (.vtlm)</a></font></li><li><font size="+1"><a href="GUI/VECTO-Editor_Aux.html#file">Auxiliary (.vaux)</a></font></li><li><font size="+1"><a href="GUI/VECTO-Editor_Driver.html#vacc">Max. acceleration and brake curves (.vacc)</a></font></li><li><font size="+1"><a href="GUI/GBX-Editor.html#polyfile">Shift polygons (.vgbs)</a></font></li><li><font size="+1"><a href="GUI/GBX-Editor.html#tcfile">Torque Converter Characteristics (.vtcc)</a></font></li></ul><li style="font-family: Calibri;"><big>Output Files</big></li><ul style="font-family: Calibri;"><li><big><a href="fileformat/VMOD.html">Modal Results (.vmod)</a></big></li><li><big><a href="fileformat/VSUM.html">Summary Results (.vsum)</a></big></li></ul></ul><li style="font-family: Calibri;"><big><a href="contact.html">Contact & Support</a></big></li> </ul> <br> <br> diff --git a/VECTO/ApplicationEvents.vb b/VECTO/ApplicationEvents.vb index 9fa4e2cece85dbfb6e91ad61f396f6f09caf5d36..76c33475b5ea54877acc69cac724e7542d420100 100644 --- a/VECTO/ApplicationEvents.vb +++ b/VECTO/ApplicationEvents.vb @@ -14,19 +14,22 @@ Namespace My 'Initialization Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup - Dim logfDetail As IO.FileInfo - Dim BackUpError As Boolean Dim s As String Dim i As Int16 Dim file As cFile_V3 'Paths MyAppPath = My.Application.Info.DirectoryPath & "\" - MyConfPath = MyAppPath & "config\" + MyConfPath = MyAppPath & "Config\" MyDeclPath = MyAppPath & "Declaration\" - FB_FilHisDir = MyAppPath & "FileHistory\" + FB_FilHisDir = MyConfPath & "FileHistory\" - StartLogfile() + 'Log + LogFile = New cLogFile + If Not LogFile.StartLog() Then + MsgBox("Error! Can't access log file. Application folder needs read/write permissions!") + e.Cancel = True + End If 'If folder does not exist: Create! If Not IO.Directory.Exists(MyConfPath) Then @@ -34,7 +37,7 @@ Namespace My IO.Directory.CreateDirectory(MyConfPath) Catch ex As Exception MsgBox("Failed to create directory '" & MyConfPath & "'!", MsgBoxStyle.Critical) - LOGfile.WriteLine("Failed to create directory '" & MyConfPath & "'!") + LogFile.WriteToLog(tMsgID.Err, "Failed to create directory '" & MyConfPath & "'!") e.Cancel = True End Try IO.File.Create(MyConfPath & "joblist.txt") @@ -65,7 +68,7 @@ Namespace My Catch ex As Exception MsgBox("Failed to create directory '" & FB_FilHisDir & "'!", MsgBoxStyle.Critical) - LOGfile.WriteLine("Failed to create directory '" & FB_FilHisDir & "'!") + LogFile.WriteToLog(tMsgID.Err, "Failed to create directory '" & FB_FilHisDir & "'!") e.Cancel = True End Try End If @@ -83,7 +86,7 @@ Namespace My End Try End If - 'Initialize Classes + 'Initialise Classes sKey = New csKey JobFileList = New List(Of String) JobCycleList = New List(Of String) @@ -91,45 +94,16 @@ Namespace My Declaration = New cDeclaration Cfg = New cConfig 'ACHTUNG: cConfig.New löst cConfig.SetDefault aus welches sKey benötigt dehalb muss sKey schon vorher initialisiert werden!! + Cfg.FilePath = MyConfPath & "settings.json" ProgBarCtrl = New cProgBarCtrl 'Config Cfg.ConfigLOAD() - - 'Start Log - If IO.File.Exists(MyAppPath & "LOG.txt") Then - - 'File size check - logfDetail = My.Computer.FileSystem.GetFileInfo(MyAppPath & "LOG.txt") - - 'If Log too large: Delete - If logfDetail.Length / (2 ^ 20) > Cfg.LogSize Then - - LOGfile.WriteLine("Starting new logfile") - LOGfile.Close() - - BackUpError = False - - Try - If IO.File.Exists(MyAppPath & "LOG_backup.txt") Then IO.File.Delete(MyAppPath & "LOG_backup.txt") - IO.File.Move(MyAppPath & "LOG.txt", MyAppPath & "LOG_backup.txt") - Catch ex As Exception - BackUpError = True - End Try - - StartLogfile() - - If BackUpError Then - MsgBox("Failed to backup logfile! (" & MyAppPath & "LOG_backup.txt)") - Else - LOGfile.WriteLine("Logfile restarted. Old log saved to LOG_backup.txt") - End If - - End If - - End If + 'Restart log if log file too large + LogFile.SizeCheck() + 'License initialization Lic = New vectolic.cLicense @@ -141,7 +115,7 @@ Namespace My Private Sub MyApplication_UnhandledException(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException e.ExitApplication = True MsgBox("ERROR!" & ChrW(10) & ChrW(10) & e.Exception.Message.ToString, MsgBoxStyle.Critical, "Unexpected Error") - LOGfile.WriteLine(">>>Unexpected Error:" & e.Exception.ToString()) + LogFile.WriteToLog(tMsgID.Err, ">>>Unexpected Error:" & e.Exception.ToString()) End Sub End Class diff --git a/VECTO/File Browser/FB_Dialog.designer.vb b/VECTO/File Browser/FB_Dialog.designer.vb index f285c349e8ed3b8946a7ffa5a38b92204e16abda..3a64946c9b668bb270879b4e646e55c3aee742ea 100644 --- a/VECTO/File Browser/FB_Dialog.designer.vb +++ b/VECTO/File Browser/FB_Dialog.designer.vb @@ -26,7 +26,6 @@ Partial Class FB_Dialog Me.SplitContainer1 = New System.Windows.Forms.SplitContainer() Me.ButtonNewDir = New System.Windows.Forms.Button() Me.ButtonDesktop = New System.Windows.Forms.Button() - Me.ButtonWorkDir = New System.Windows.Forms.Button() Me.ButtonHisFolder = New System.Windows.Forms.Button() Me.ButtonFolderBack = New System.Windows.Forms.Button() Me.TextBoxSearchFolder = New System.Windows.Forms.TextBox() @@ -49,6 +48,7 @@ Partial Class FB_Dialog Me.ButtonOK = New System.Windows.Forms.Button() Me.ButtonCancel = New System.Windows.Forms.Button() Me.TextBoxCurrent = New System.Windows.Forms.TextBox() + CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SplitContainer1.Panel1.SuspendLayout() Me.SplitContainer1.Panel2.SuspendLayout() Me.SplitContainer1.SuspendLayout() @@ -68,7 +68,6 @@ Partial Class FB_Dialog ' Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonNewDir) Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonDesktop) - Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonWorkDir) Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonHisFolder) Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonFolderBack) Me.SplitContainer1.Panel1.Controls.Add(Me.TextBoxSearchFolder) @@ -91,7 +90,7 @@ Partial Class FB_Dialog 'ButtonNewDir ' Me.ButtonNewDir.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ButtonNewDir.Location = New System.Drawing.Point(139, 3) + Me.ButtonNewDir.Location = New System.Drawing.Point(202, 3) Me.ButtonNewDir.Name = "ButtonNewDir" Me.ButtonNewDir.Size = New System.Drawing.Size(38, 21) Me.ButtonNewDir.TabIndex = 21 @@ -102,7 +101,7 @@ Partial Class FB_Dialog 'ButtonDesktop ' Me.ButtonDesktop.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ButtonDesktop.Location = New System.Drawing.Point(183, 3) + Me.ButtonDesktop.Location = New System.Drawing.Point(246, 3) Me.ButtonDesktop.Name = "ButtonDesktop" Me.ButtonDesktop.Size = New System.Drawing.Size(57, 21) Me.ButtonDesktop.TabIndex = 22 @@ -110,17 +109,6 @@ Partial Class FB_Dialog Me.ButtonDesktop.Text = "Desktop" Me.ButtonDesktop.UseVisualStyleBackColor = True ' - 'ButtonWorkDir - ' - Me.ButtonWorkDir.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ButtonWorkDir.Location = New System.Drawing.Point(246, 3) - Me.ButtonWorkDir.Name = "ButtonWorkDir" - Me.ButtonWorkDir.Size = New System.Drawing.Size(57, 21) - Me.ButtonWorkDir.TabIndex = 23 - Me.ButtonWorkDir.TabStop = False - Me.ButtonWorkDir.Text = "Work-Dir" - Me.ButtonWorkDir.UseVisualStyleBackColor = True - ' 'ButtonHisFolder ' Me.ButtonHisFolder.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) @@ -255,18 +243,18 @@ Partial Class FB_Dialog ' Me.ContextMenuFile.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.RenameFileToolStripMenuItem, Me.DeleteFileToolStripMenuItem}) Me.ContextMenuFile.Name = "ContextMenuFile" - Me.ContextMenuFile.Size = New System.Drawing.Size(156, 48) + Me.ContextMenuFile.Size = New System.Drawing.Size(148, 48) ' 'RenameFileToolStripMenuItem ' Me.RenameFileToolStripMenuItem.Name = "RenameFileToolStripMenuItem" - Me.RenameFileToolStripMenuItem.Size = New System.Drawing.Size(155, 22) + Me.RenameFileToolStripMenuItem.Size = New System.Drawing.Size(147, 22) Me.RenameFileToolStripMenuItem.Text = "Rename File..." ' 'DeleteFileToolStripMenuItem ' Me.DeleteFileToolStripMenuItem.Name = "DeleteFileToolStripMenuItem" - Me.DeleteFileToolStripMenuItem.Size = New System.Drawing.Size(155, 22) + Me.DeleteFileToolStripMenuItem.Size = New System.Drawing.Size(147, 22) Me.DeleteFileToolStripMenuItem.Text = "Delete File..." ' 'TextBoxPath @@ -345,6 +333,7 @@ Partial Class FB_Dialog Me.SplitContainer1.Panel1.PerformLayout() Me.SplitContainer1.Panel2.ResumeLayout(False) Me.SplitContainer1.Panel2.PerformLayout() + CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).EndInit() Me.SplitContainer1.ResumeLayout(False) Me.ContextMenuFile.ResumeLayout(False) Me.ResumeLayout(False) @@ -368,7 +357,6 @@ Partial Class FB_Dialog Friend WithEvents ButtonCancel As System.Windows.Forms.Button Friend WithEvents ComboBoxExt As System.Windows.Forms.ComboBox Friend WithEvents TextBoxCurrent As System.Windows.Forms.TextBox - Friend WithEvents ButtonWorkDir As System.Windows.Forms.Button Friend WithEvents ColumnHeader3 As System.Windows.Forms.ColumnHeader Friend WithEvents LabelFileAnz As System.Windows.Forms.Label Friend WithEvents ButtonDesktop As System.Windows.Forms.Button diff --git a/VECTO/File Browser/FB_Dialog.resx b/VECTO/File Browser/FB_Dialog.resx index 8c55e6dcef17e82ff507aaf9d5038ffe7b81137b..c0ab97fd04e368655c17ab97574ebaacff5583cb 100644 --- a/VECTO/File Browser/FB_Dialog.resx +++ b/VECTO/File Browser/FB_Dialog.resx @@ -112,18 +112,18 @@ <value>2.0</value> </resheader> <resheader name="reader"> - <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> - <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> - <metadata name="ContextMenuFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <metadata name="ContextMenuFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>329, 17</value> </metadata> - <metadata name="ContextMenuHisFolder.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <metadata name="ContextMenuHisFolder.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </metadata> - <metadata name="ContextMenuHisFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <metadata name="ContextMenuHisFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>180, 17</value> </metadata> </root> \ No newline at end of file diff --git a/VECTO/File Browser/FB_Dialog.vb b/VECTO/File Browser/FB_Dialog.vb index a28f8c7ef3908f44dcfd81b02c7cd5a70be79f76..513f43724b0fc622a3970f83e006fd6429034752 100644 --- a/VECTO/File Browser/FB_Dialog.vb +++ b/VECTO/File Browser/FB_Dialog.vb @@ -1,4 +1,8 @@ -Public Class FB_Dialog +''' <summary> +''' File Browser dialog. Entirely controlled by cFilebrowser class. +''' </summary> +''' <remarks></remarks> +Public Class FB_Dialog Private MyFolder As String Private MyFiles() As String @@ -23,10 +27,6 @@ Private Const EmptyText As String = " " Private Const NoFavString As String = "<undefined>" - - ''<SORTER> - ''Private lvwColumnSorter As ListViewColumnSorter - 'New Public Sub New(ByVal LightMode As Boolean) ' This call is required by the Windows Form Designer. @@ -167,7 +167,7 @@ End Sub 'Browse - Custom Dialog - Public Function Browse(ByVal path As String, ByVal FileMustExist As Boolean, ByVal OverwriteCheck As Boolean, ByVal ExtMode As eExtMode, ByVal MultiFile As Boolean, ByVal Ext As String, ByVal Title As String) As Boolean + Public Function Browse(ByVal path As String, ByVal FileMustExist As Boolean, ByVal OverwriteCheck As Boolean, ByVal ExtMode As tFbExtMode, ByVal MultiFile As Boolean, ByVal Ext As String, ByVal Title As String) As Boolean Dim x As Int16 If Not Initialized Then Init() @@ -183,7 +183,7 @@ 'Options bOverwriteCheck = OverwriteCheck bFileMustExist = FileMustExist - bForceExt = (ExtMode = eExtMode.ForceExt) + bForceExt = (ExtMode = tFbExtMode.ForceExt) 'Form Config Me.ListViewFiles.MultiSelect = MultiFile @@ -197,13 +197,13 @@ Me.ComboBoxExt.SelectedIndex = 0 Else Select Case ExtMode - Case eExtMode.ForceExt + Case tFbExtMode.ForceExt If Ext = "" Then Ext = ExtListSingle(0).ToString Me.ComboBoxExt.Items.AddRange(ExtListSingle.ToArray) Me.ComboBoxExt.Text = Ext Me.ComboBoxExt.Enabled = False - Case eExtMode.MultiExt, eExtMode.SingleExt - If ExtMode = eExtMode.MultiExt Then + Case tFbExtMode.MultiExt, tFbExtMode.SingleExt + If ExtMode = tFbExtMode.MultiExt Then Me.ComboBoxExt.Items.AddRange(ExtListMulti.ToArray) Else Me.ComboBoxExt.Items.AddRange(ExtListSingle.ToArray) @@ -425,7 +425,7 @@ If Not UpdateLock Then SetFolder(Me.ComboBoxDrive.SelectedItem.ToString) End Sub - + 'ButtonFolderBack_Click Private Sub ButtonFolderBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonFolderBack.Click FolderUp() @@ -710,11 +710,6 @@ SetFolder(newpath) End Sub - 'ButtonWorkDir_Click - Private Sub ButtonWorkDir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonWorkDir.Click - SetFolder(Cfg.WorkDPath) - End Sub - 'ButtonDesktop_Click Private Sub ButtonDesktop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonDesktop.Click SetFolder(FileIO.SpecialDirectories.Desktop.ToString) @@ -998,5 +993,5 @@ lb10: End Set End Property - + End Class diff --git a/VECTO/File Browser/FB_FavDlog.vb b/VECTO/File Browser/FB_FavDlog.vb index 13c57673beb836aeadee9456e949a70d1ffb6932..48618152fc25f9214932581bee8b1a03b04aeddc 100644 --- a/VECTO/File Browser/FB_FavDlog.vb +++ b/VECTO/File Browser/FB_FavDlog.vb @@ -1,5 +1,9 @@ Imports System.Windows.Forms +''' <summary> +''' Sub-dialog for File Browser. Entirely controlled by cFilebrowser class (via FB_Dialog). +''' </summary> +''' <remarks></remarks> Public Class FB_FavDlog Private Const NoFavString As String = "<undefined>" diff --git a/VECTO/File Browser/FB_Global.vb b/VECTO/File Browser/FB_Global.vb index adc85a3c02f1d6da0f386e96deb9e5e49848205d..dfebdca17fd3149f66d1185fcd1898f54a88a384 100644 --- a/VECTO/File Browser/FB_Global.vb +++ b/VECTO/File Browser/FB_Global.vb @@ -1,42 +1,35 @@ -Module FB_Global +''' <summary> +''' Global File Brower properties and cFilebrowser instances. +''' </summary> +''' <remarks></remarks> +Module FB_Global Public FB_FolderHistory(19) As String Public FB_Drives() As String Public FB_Init As Boolean Public FB_FilHisDir As String '----------------------------- - Public fbWorkDir As cFileBrowser - Public fbGEN As cFileBrowser + Public fbFolder As cFileBrowser + Public fbVECTO As cFileBrowser Public fbFileLists As cFileBrowser Public fbVEH As cFileBrowser Public fbDRI As cFileBrowser Public fbMAP As cFileBrowser Public fbFLD As cFileBrowser - Public fbTRS As cFileBrowser - Public fbMAA As cFileBrowser - Public fbMAC As cFileBrowser - Public fbWUA As cFileBrowser - Public fbWUC As cFileBrowser - Public fbCDW As cFileBrowser - Public fbATC As cFileBrowser - Public fbBAT As cFileBrowser - Public fbEMO As cFileBrowser - Public fbEAN As cFileBrowser - Public fbGET As cFileBrowser - Public fbSTE As cFileBrowser - Public fbEKF As cFileBrowser - Public fbEXS As cFileBrowser - Public fbFZP As cFileBrowser - Public fbFLT As cFileBrowser - Public fbTEM As cFileBrowser - Public fbSTR As cFileBrowser Public fbENG As cFileBrowser - Public fbWHTC As cFileBrowser Public fbGBX As cFileBrowser Public fbACC As cFileBrowser Public fbAUX As cFileBrowser + Public fbGBS As cFileBrowser + Public fbTLM As cFileBrowser + Public fbRLM As cFileBrowser + Public fbTCC As cFileBrowser + Public fbCDx As cFileBrowser + + Public fbVMOD As cFileBrowser + End Module diff --git a/VECTO/File Browser/cFileBrowser.vb b/VECTO/File Browser/cFileBrowser.vb index 641153f5a79abc590404c964e812d68ae5ed55f3..b38e6b2c543853d604a133d9ee0c6d2feb4fdb28 100644 --- a/VECTO/File Browser/cFileBrowser.vb +++ b/VECTO/File Browser/cFileBrowser.vb @@ -1,41 +1,18 @@ Imports System.Collections -'Imports System.Windows.Forms - -'V1.0 10.12.2010 -'V1.1 12.01.2011 -'V1.2 08.03.2011 -'V1.3 17.03.2011 -'V1.4 30.03.2011 -'V1.5 10.06.2011 -'V2.0 23.11.2011 -' - Dir-Favorites -'V2.0.1 01.12.2011 -' - Fav-Dlog: "Abbrechen" => "Cancel" -' - Fav-Dlog: Statt leeren Items in Fav-Liste "<undefined>" |@@| Fav-Dlog: Empty Items in Fav list Instead "<undefined>" - - - -'**Application -'Dim fbTXT As cFileBrowser -'fbTXT = New cFileBrowser("TXT") -'fbTXT.Extensions = New String() {"txt,log", "csv"} -'... -'fbTXT.Close() - -'**Required Global variables (default): -'Public FB_Drives() As String -'Public FB_Init As Boolean = False -'Public FB_FilHisDir As String -'Public FB_FolderHistory(9) As String -'Public FB_WorkDir As String - -Public Enum eExtMode As Integer - ForceExt = 0 - MultiExt = 1 - SingleExt = 2 -End Enum + +''' <summary> +''' File Browser for Open/Save File dialogs and Folder Browser. Features File History and Favorite Folders. +''' </summary> +''' <remarks> +''' Usage: +''' 1. Create new instance, preferably in FB_Global, e.g. fbTXT = New cFileBrowser("txt") +''' 2. Define extensions, e.g. fbTXT.Extensions = New String() {"txt","log"} +''' 3. Use OpenDialog, SaveDialog, etc. +''' 4. Call Close method when closing application to write file history, e.g. fbTXT.Close +''' File history is unique for each ID. Folder history is global. +''' </remarks> Public Class cFileBrowser Private Initialized As Boolean @@ -46,7 +23,13 @@ Public Class cFileBrowser Private bFolderBrowser As Boolean Private bLightMode As Boolean - 'New Instance - define ID, switch to FolderBrowser + ''' <summary> + ''' New cFileBrowser instance + ''' </summary> + ''' <param name="ID">Needed to save the file history when not using LightMode.</param> + ''' <param name="FolderBrowser">Browse folders instead of files.</param> + ''' <param name="LightMode">If enabled file history is not saved.</param> + ''' <remarks></remarks> Public Sub New(ByVal ID As String, Optional ByVal FolderBrowser As Boolean = False, Optional ByVal LightMode As Boolean = False) Initialized = False MyID = ID @@ -55,35 +38,68 @@ Public Class cFileBrowser bLightMode = LightMode End Sub - 'OpenDialog Return True when Dialog ended with OK + ''' <summary> + ''' Opens dialog for OPENING files. Selected file must exist. Returns False if cancelled by user, else True. + ''' </summary> + ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> + ''' <param name="MultiFile">Allow selecting multiple files.</param> + ''' <param name="Ext">Set extension. If not defined the first predefined extension is used.</param> + ''' <returns></returns> + ''' <remarks></remarks> Public Function OpenDialog(ByVal path As String, Optional ByVal MultiFile As Boolean = False, Optional ByVal Ext As String = "") As Boolean - Return CustomDialog(path, True, False, eExtMode.MultiExt, MultiFile, Ext, "Open") + Return CustomDialog(path, True, False, tFbExtMode.MultiExt, MultiFile, Ext, "Open") End Function - 'SaveDialog - Returns True when Dialog ended with OK + ''' <summary> + ''' Opens dialog for SAVING files. If file already exists user will be asked to overwrite. Returns False if cancelled by user, else True. + ''' </summary> + ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> + ''' <param name="ForceExt">Force predefined file extension.</param> + ''' <param name="Ext">Set extension. If not defined the first predefined extension is used.</param> + ''' <returns></returns> + ''' <remarks></remarks> Public Function SaveDialog(ByVal path As String, Optional ByVal ForceExt As Boolean = True, Optional ByVal Ext As String = "") As Boolean - Dim x As eExtMode + Dim x As tFbExtMode If ForceExt Then - x = eExtMode.ForceExt + x = tFbExtMode.ForceExt Else - x = eExtMode.SingleExt + x = tFbExtMode.SingleExt End If Return CustomDialog(path, False, True, x, False, Ext, "Save As") End Function - 'Open dialogue - Return True if Dialogue ended with OK - Public Function CustomDialog(ByVal path As String, ByVal FileMustExist As Boolean, ByVal OverwriteCheck As Boolean, ByVal ExtMode As eExtMode, ByVal MultiFile As Boolean, ByVal Ext As String, Optional Title As String = "File Browser") As Boolean + ''' <summary> + ''' Custom open/save dialog. Returns False if cancelled by user, else True. + ''' </summary> + ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> + ''' <param name="FileMustExist">Selected file must exist.</param> + ''' <param name="OverwriteCheck">If file already exists user will be asked to overwrite.</param> + ''' <param name="ExtMode">ForceExt= First predefined extension (or Ext parameter) will be forced (Default for SaveDialog), MultiExt= All files with predefined extensions are shown (Default for OpenDialog), SingleExt= All files with the first predefined extension will be shown.</param> + ''' <param name="MultiFile">Allow to select multiple files.</param> + ''' <param name="Ext">Set extension. If not defined the first predefined extension is used.</param> + ''' <param name="Title">Dialog title.</param> + ''' <returns></returns> + ''' <remarks></remarks> + Public Function CustomDialog(ByVal path As String, ByVal FileMustExist As Boolean, ByVal OverwriteCheck As Boolean, ByVal ExtMode As tFbExtMode, ByVal MultiFile As Boolean, ByVal Ext As String, Optional Title As String = "File Browser") As Boolean If Not Initialized Then Init() Return Dlog.Browse(path, FileMustExist, OverwriteCheck, ExtMode, MultiFile, Ext, Title) End Function 'Manually update File History + ''' <summary> + ''' Add file to file history. + ''' </summary> + ''' <param name="Path">File to be added to file history.</param> + ''' <remarks></remarks> Public Sub UpdateHistory(ByVal Path As String) If Not Initialized Then Init() Dlog.UpdateHistory(Path) End Sub - 'File / Folder History speichen und Speicher freigeben |@@| File / Folder History spokes and Release memory + ''' <summary> + ''' Save file history (if not LightMode) and global folder history. + ''' </summary> + ''' <remarks></remarks> Public Sub Close() If Initialized Then Dlog.SaveAndClose() @@ -92,7 +108,6 @@ Public Class cFileBrowser Dlog = Nothing End Sub - Private Sub Init() Dlog = New FB_Dialog(bLightMode) Dlog.ID = MyID @@ -101,7 +116,12 @@ Public Class cFileBrowser Initialized = True End Sub - 'Define File-Extensions + ''' <summary> + ''' Predefined file extensions. Must be set before Open/Save dialog is used for the first time. + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> Public Property Extensions() As String() Get Return MyExt @@ -112,7 +132,12 @@ Public Class cFileBrowser End Set End Property - 'Ask for Files + ''' <summary> + ''' Selected file(s) oder folder (if FolderBrowser) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> Public ReadOnly Property Files() As String() Get If Initialized Then diff --git a/VECTO/GUI/F_AboutBox.vb b/VECTO/GUI/F_AboutBox.vb index 6f0502ab216bf149732bcde0a43200f6b2643fe0..03135f40337def37bda9ea17da259158c80a632d 100644 --- a/VECTO/GUI/F_AboutBox.vb +++ b/VECTO/GUI/F_AboutBox.vb @@ -1,4 +1,8 @@ -Public Class F_AboutBox +''' <summary> +''' About Dialog. Shows Licence and contact/support information +''' </summary> +''' <remarks></remarks> +Public Class F_AboutBox 'Initialize diff --git a/VECTO/GUI/F_ENG.Designer.vb b/VECTO/GUI/F_ENG.Designer.vb index 946f19183df10fc4330ea0a92a4c62d7a54a8de6..aa74576d1a067d08b1298ac9ebf11c28c06e4509 100644 --- a/VECTO/GUI/F_ENG.Designer.vb +++ b/VECTO/GUI/F_ENG.Designer.vb @@ -53,7 +53,6 @@ Partial Class F_ENG Me.BtMAP = New System.Windows.Forms.Button() Me.PictureBox1 = New System.Windows.Forms.PictureBox() Me.CmOpenFile = New System.Windows.Forms.ContextMenuStrip(Me.components) - Me.OpenWithGRAPHiToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.OpenWithToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ShowInFolderToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.BtMAPopen = New System.Windows.Forms.Button() @@ -75,6 +74,7 @@ Partial Class F_ENG Me.Label9 = New System.Windows.Forms.Label() Me.Label7 = New System.Windows.Forms.Label() Me.Label4 = New System.Windows.Forms.Label() + Me.PicBox = New System.Windows.Forms.PictureBox() Me.ToolStrip1.SuspendLayout() Me.StatusStrip1.SuspendLayout() CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit() @@ -82,6 +82,7 @@ Partial Class F_ENG Me.GroupBox1.SuspendLayout() Me.PnInertia.SuspendLayout() Me.GrWHTC.SuspendLayout() + CType(Me.PicBox, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'TbNleerl @@ -138,7 +139,7 @@ Partial Class F_ENG ' Me.ButCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.ButCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel - Me.ButCancel.Location = New System.Drawing.Point(418, 469) + Me.ButCancel.Location = New System.Drawing.Point(898, 469) Me.ButCancel.Name = "ButCancel" Me.ButCancel.Size = New System.Drawing.Size(75, 23) Me.ButCancel.TabIndex = 13 @@ -148,7 +149,7 @@ Partial Class F_ENG 'ButOK ' Me.ButOK.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ButOK.Location = New System.Drawing.Point(337, 469) + Me.ButOK.Location = New System.Drawing.Point(817, 469) Me.ButOK.Name = "ButOK" Me.ButOK.Size = New System.Drawing.Size(75, 23) Me.ButOK.TabIndex = 12 @@ -161,7 +162,7 @@ Partial Class F_ENG Me.ToolStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripBtNew, Me.ToolStripBtOpen, Me.ToolStripBtSave, Me.ToolStripBtSaveAs, Me.ToolStripSeparator3, Me.ToolStripBtSendTo, Me.ToolStripSeparator1, Me.ToolStripButton1}) Me.ToolStrip1.Location = New System.Drawing.Point(0, 0) Me.ToolStrip1.Name = "ToolStrip1" - Me.ToolStrip1.Size = New System.Drawing.Size(505, 25) + Me.ToolStrip1.Size = New System.Drawing.Size(985, 25) Me.ToolStrip1.TabIndex = 30 Me.ToolStrip1.Text = "ToolStrip1" ' @@ -217,8 +218,8 @@ Partial Class F_ENG Me.ToolStripBtSendTo.ImageTransparentColor = System.Drawing.Color.Magenta Me.ToolStripBtSendTo.Name = "ToolStripBtSendTo" Me.ToolStripBtSendTo.Size = New System.Drawing.Size(23, 22) - Me.ToolStripBtSendTo.Text = "Send to GEN Editor" - Me.ToolStripBtSendTo.ToolTipText = "Send to GEN Editor" + Me.ToolStripBtSendTo.Text = "Send to Job Editor" + Me.ToolStripBtSendTo.ToolTipText = "Send to Job Editor" ' 'ToolStripSeparator1 ' @@ -239,7 +240,7 @@ Partial Class F_ENG Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.LbStatus}) Me.StatusStrip1.Location = New System.Drawing.Point(0, 495) Me.StatusStrip1.Name = "StatusStrip1" - Me.StatusStrip1.Size = New System.Drawing.Size(505, 22) + Me.StatusStrip1.Size = New System.Drawing.Size(985, 22) Me.StatusStrip1.SizingGrip = False Me.StatusStrip1.TabIndex = 37 Me.StatusStrip1.Text = "StatusStrip1" @@ -329,26 +330,20 @@ Partial Class F_ENG ' 'CmOpenFile ' - Me.CmOpenFile.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.OpenWithGRAPHiToolStripMenuItem, Me.OpenWithToolStripMenuItem, Me.ShowInFolderToolStripMenuItem}) + Me.CmOpenFile.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.OpenWithToolStripMenuItem, Me.ShowInFolderToolStripMenuItem}) Me.CmOpenFile.Name = "CmOpenFile" - Me.CmOpenFile.Size = New System.Drawing.Size(175, 70) - ' - 'OpenWithGRAPHiToolStripMenuItem - ' - Me.OpenWithGRAPHiToolStripMenuItem.Name = "OpenWithGRAPHiToolStripMenuItem" - Me.OpenWithGRAPHiToolStripMenuItem.Size = New System.Drawing.Size(174, 22) - Me.OpenWithGRAPHiToolStripMenuItem.Text = "Open with GRAPHi" + Me.CmOpenFile.Size = New System.Drawing.Size(153, 48) ' 'OpenWithToolStripMenuItem ' Me.OpenWithToolStripMenuItem.Name = "OpenWithToolStripMenuItem" - Me.OpenWithToolStripMenuItem.Size = New System.Drawing.Size(174, 22) + Me.OpenWithToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.OpenWithToolStripMenuItem.Text = "Open with ..." ' 'ShowInFolderToolStripMenuItem ' Me.ShowInFolderToolStripMenuItem.Name = "ShowInFolderToolStripMenuItem" - Me.ShowInFolderToolStripMenuItem.Size = New System.Drawing.Size(174, 22) + Me.ShowInFolderToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.ShowInFolderToolStripMenuItem.Text = "Show in Folder" ' 'BtMAPopen @@ -530,13 +525,23 @@ Partial Class F_ENG Me.Label4.TabIndex = 0 Me.Label4.Text = "Urb" ' + 'PicBox + ' + Me.PicBox.BackColor = System.Drawing.Color.LightGray + Me.PicBox.Location = New System.Drawing.Point(499, 28) + Me.PicBox.Name = "PicBox" + Me.PicBox.Size = New System.Drawing.Size(474, 425) + Me.PicBox.TabIndex = 40 + Me.PicBox.TabStop = False + ' 'F_ENG ' Me.AcceptButton = Me.ButOK Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.CancelButton = Me.ButCancel - Me.ClientSize = New System.Drawing.Size(505, 517) + Me.ClientSize = New System.Drawing.Size(985, 517) + Me.Controls.Add(Me.PicBox) Me.Controls.Add(Me.GrWHTC) Me.Controls.Add(Me.PnInertia) Me.Controls.Add(Me.GroupBox1) @@ -575,6 +580,7 @@ Partial Class F_ENG Me.PnInertia.PerformLayout() Me.GrWHTC.ResumeLayout(False) Me.GrWHTC.PerformLayout() + CType(Me.PicBox, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) Me.PerformLayout() @@ -608,7 +614,6 @@ Partial Class F_ENG Friend WithEvents ToolStripSeparator1 As System.Windows.Forms.ToolStripSeparator Friend WithEvents ToolStripButton1 As System.Windows.Forms.ToolStripButton Friend WithEvents CmOpenFile As System.Windows.Forms.ContextMenuStrip - Friend WithEvents OpenWithGRAPHiToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents OpenWithToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents ShowInFolderToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents BtMAPopen As System.Windows.Forms.Button @@ -630,4 +635,5 @@ Partial Class F_ENG Friend WithEvents Label9 As System.Windows.Forms.Label Friend WithEvents Label7 As System.Windows.Forms.Label Friend WithEvents Label4 As System.Windows.Forms.Label + Friend WithEvents PicBox As System.Windows.Forms.PictureBox End Class diff --git a/VECTO/GUI/F_ENG.vb b/VECTO/GUI/F_ENG.vb index d088e4d13f4471613780f281185b509b77acafdf..09b6deed7a18ccc9363d17b43b34f92f7b493a8a 100644 --- a/VECTO/GUI/F_ENG.vb +++ b/VECTO/GUI/F_ENG.vb @@ -1,44 +1,46 @@ -Public Class F_ENG +''' <summary> +''' Engine Editor. Open and save .VENG files. +''' </summary> +''' <remarks></remarks> +Public Class F_ENG Private EngFile As String = "" Public AutoSendTo As Boolean = False - Public GenDir As String = "" + Public JobDir As String = "" Private Changed As Boolean = False - Private FLDdia As F_FLD - + 'Before closing Editor: Check if file was changed and ask to save. Private Sub F_ENG_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing If e.CloseReason <> CloseReason.ApplicationExitCall And e.CloseReason <> CloseReason.WindowsShutDown Then e.Cancel = ChangeCheckCancel() End If End Sub + 'Initialise. Private Sub F_ENG_Load(sender As Object, e As System.EventArgs) Handles Me.Load FLDdia = New F_FLD - If Declaration.Active Then - Me.PnInertia.Enabled = False - Me.GrWHTC.Enabled = True - Else - Me.GrWHTC.Enabled = False - End If + Me.PnInertia.Enabled = Not Cfg.DeclMode + Me.GrWHTC.Enabled = Cfg.DeclMode Changed = False newENG() End Sub + 'Set generic values for Declaration mode. Private Sub DeclInit() - If Not Declaration.Active Then Exit Sub + If Not Cfg.DeclMode Then Exit Sub - Me.TbInertia.Text = CStr(Declaration.GetEngInertia(fTextboxToNumString(Me.TbDispl.Text))) + Me.TbInertia.Text = CStr(Declaration.EngInertia(fTextboxToNumString(Me.TbDispl.Text))) End Sub -#Region "ToolStrip" + +#Region "Toolbar" Private Sub ToolStripBtNew_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripBtNew.Click newENG() @@ -69,14 +71,14 @@ End If If Not F_VECTO.Visible Then - GenDir = "" + JobDir = "" F_VECTO.Show() - F_VECTO.GENnew() + F_VECTO.VECTOnew() Else F_VECTO.WindowState = FormWindowState.Normal End If - F_VECTO.TbENG.Text = fFileWoDir(EngFile, GenDir) + F_VECTO.TbENG.Text = fFileWoDir(EngFile, JobDir) End Sub @@ -90,6 +92,7 @@ #End Region + 'Create new empty Engine file. Private Sub newENG() If ChangeCheckCancel() Then Exit Sub @@ -114,8 +117,11 @@ Changed = False + UpdatePic() + End Sub + 'Open VENG file Public Sub openENG(ByVal file As String) Dim ENG0 As cENG Dim i As Integer @@ -153,7 +159,6 @@ DeclInit() - fbENG.UpdateHistory(file) Me.Text = fFILE(file, True) Me.LbStatus.Text = "" @@ -161,6 +166,7 @@ Me.Activate() Changed = False + UpdatePic() If ENG0.NoJSON Then If MsgBox("File is not in JSON format!" & vbCrLf & vbCrLf & "Convert now?" & vbCrLf & "(Backup will be created with '.ORIG' extension)", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then @@ -183,7 +189,7 @@ Return saveENG(EngFile) End Function - 'Save ENG + 'Save VENG file to given filepath. Called by SaveOrSaveAs. Private Function saveENG(ByVal file As String) As Boolean Dim ENG0 As cENG Dim i As Int16 @@ -218,8 +224,11 @@ Return False End If - If Not GenDir = "" Or AutoSendTo Then - If F_VECTO.Visible And UCase(fFileRepl(F_VECTO.TbENG.Text, GenDir)) <> UCase(file) Then F_VECTO.TbENG.Text = fFileWoDir(file, GenDir) + If AutoSendTo Then + If F_VECTO.Visible Then + If UCase(fFileRepl(F_VECTO.TbENG.Text, JobDir)) <> UCase(file) Then F_VECTO.TbENG.Text = fFileWoDir(file, JobDir) + F_VECTO.UpdatePic() + End If End If fbENG.UpdateHistory(file) @@ -233,9 +242,9 @@ End Function -#Region "Change Events" +#Region "Track changes" - 'Change Status ändern |@@| Change Status change + 'Flags current file as modified. Private Sub Change() If Not Changed Then Me.LbStatus.Text = "Unsaved changes in current file" @@ -243,7 +252,7 @@ End If End Sub - ' "Save changes ?" ...liefert True wenn User Vorgang abbricht |@@| Save changes? "... Return True if User aborts + ' "Save changes ?" .... Returns True if User aborts Private Function ChangeCheckCancel() As Boolean If Changed Then @@ -284,6 +293,7 @@ End Sub Private Sub TbNleerl_TextChanged(sender As System.Object, e As System.EventArgs) Handles TbNleerl.TextChanged + UpdatePic() Change() End Sub @@ -292,6 +302,7 @@ End Sub Private Sub TbMAP_TextChanged(sender As System.Object, e As System.EventArgs) Handles TbMAP.TextChanged + UpdatePic() Change() End Sub @@ -307,10 +318,15 @@ Change() End Sub + Private Sub LvFLDs_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles LvFLDs.SelectedIndexChanged + UpdatePic() + End Sub + #End Region +#Region "Add/Remove/Edit VFLD entries" Private Sub LvFLDs_DoubleClick(sender As Object, e As System.EventArgs) Handles LvFLDs.DoubleClick EditFLD() @@ -366,6 +382,8 @@ Me.LvFLDs.SelectedItems(0).SubItems(1).Text = FLDdia.NumGearFrom.Value & "-" & FLDdia.NumGearTo.Value End If + UpdatePic() + Change() Else @@ -388,7 +406,7 @@ Me.LvFLDs.Focus() - 'Change() => NO! Change + 'Change() => NO! Already in EditFLD End Sub @@ -409,18 +427,23 @@ End If Me.LvFLDs.Focus() + UpdatePic() + If Not NoChange Then Change() + End Sub +#End Region -#Region "Browse Buttons" + 'Browse for VMAP file Private Sub BtMAP_Click(sender As System.Object, e As System.EventArgs) Handles BtMAP.Click If fbMAP.OpenDialog(fFileRepl(Me.TbMAP.Text, fPATH(EngFile))) Then Me.TbMAP.Text = fFileWoDir(fbMAP.Files(0), fPATH(EngFile)) End Sub + 'Open VMAP file Private Sub BtMAPopen_Click(sender As System.Object, e As System.EventArgs) Handles BtMAPopen.Click Dim fldfile As String @@ -439,17 +462,150 @@ End Sub -#End Region - + 'Save and close Private Sub ButOK_Click(sender As System.Object, e As System.EventArgs) Handles ButOK.Click If SaveOrSaveAs(False) Then Me.Close() End Sub + 'Close without saving (see FormClosing Event) Private Sub ButCancel_Click(sender As System.Object, e As System.EventArgs) Handles ButCancel.Click Me.Close() End Sub + Private Sub UpdatePic() + + Dim fldOK As Boolean = False + Dim mapOK As Boolean = False + Dim fp As String + Dim FLD0 As New cFLD + Dim MAP0 As New cMAP + Dim Shiftpoly As cGBX.cShiftPolygon + Dim MyChart As System.Windows.Forms.DataVisualization.Charting.Chart + Dim s As System.Windows.Forms.DataVisualization.Charting.Series + Dim a As System.Windows.Forms.DataVisualization.Charting.ChartArea + Dim img As Image + + Me.PicBox.Image = Nothing + + Try + + 'Read Files + If Me.LvFLDs.Items.Count > 0 Then + If Me.LvFLDs.SelectedItems.Count > 0 Then + fp = fFileRepl(Me.LvFLDs.SelectedItems(0).Text, fPATH(EngFile)) + Else + fp = fFileRepl(Me.LvFLDs.Items(0).Text, fPATH(EngFile)) + End If + FLD0.FilePath = fp + fldOK = FLD0.ReadFile(False) + End If + + MAP0.FilePath = fFileRepl(Me.TbMAP.Text, fPATH(EngFile)) + mapOK = MAP0.ReadFile(False) + + Catch ex As Exception + + End Try + + If Not fldOK And Not mapOK Then Exit Sub + + + 'Create plot + MyChart = New System.Windows.Forms.DataVisualization.Charting.Chart + MyChart.Width = Me.PicBox.Width + MyChart.Height = Me.PicBox.Height + + a = New System.Windows.Forms.DataVisualization.Charting.ChartArea + + If fldOK Then + + s = New System.Windows.Forms.DataVisualization.Charting.Series + s.Points.DataBindXY(FLD0.LnU, FLD0.LTq) + s.ChartType = DataVisualization.Charting.SeriesChartType.FastLine + s.BorderWidth = 2 + s.Color = Color.DarkBlue + s.Name = "Full load (" & fFILE(FLD0.FilePath, True) & ")" + MyChart.Series.Add(s) + + s = New System.Windows.Forms.DataVisualization.Charting.Series + s.Points.DataBindXY(FLD0.LnU, FLD0.LTqDrag) + s.ChartType = DataVisualization.Charting.SeriesChartType.FastLine + s.BorderWidth = 2 + s.Color = Color.Blue + s.Name = "Motoring (" & fFILE(FLD0.FilePath, True) & ")" + MyChart.Series.Add(s) + + If IsNumeric(Me.TbNleerl.Text) AndAlso Me.TbNleerl.Text > 0 Then + + FLD0.Init(CSng(Me.TbNleerl.Text)) + + Shiftpoly = New cGBX.cShiftPolygon("", 0) + Shiftpoly.SetGenericShiftPoly(FLD0, Me.TbNleerl.Text) + + s = New System.Windows.Forms.DataVisualization.Charting.Series + s.Points.DataBindXY(Shiftpoly.gs_nUup, Shiftpoly.gs_Mup) + s.ChartType = DataVisualization.Charting.SeriesChartType.FastLine + s.BorderWidth = 2 + s.Color = Color.DarkRed + s.Name = "Upshift curve" + MyChart.Series.Add(s) + + s = New System.Windows.Forms.DataVisualization.Charting.Series + s.Points.DataBindXY(Shiftpoly.gs_nUdown, Shiftpoly.gs_Mdown) + s.ChartType = DataVisualization.Charting.SeriesChartType.FastLine + s.BorderWidth = 2 + s.Color = Color.DarkRed + s.Name = "Downshift curve" + MyChart.Series.Add(s) + + End If + + End If + + If mapOK Then + s = New System.Windows.Forms.DataVisualization.Charting.Series + s.Points.DataBindXY(MAP0.nU, MAP0.Tq) + s.ChartType = DataVisualization.Charting.SeriesChartType.Point + s.MarkerSize = 3 + s.Color = Color.Red + s.Name = "Map" + MyChart.Series.Add(s) + End If + + a.Name = "main" + + a.AxisX.Title = "engine speed [1/min]" + a.AxisX.TitleFont = New Font("Helvetica", 10) + a.AxisX.LabelStyle.Font = New Font("Helvetica", 8) + a.AxisX.LabelAutoFitStyle = DataVisualization.Charting.LabelAutoFitStyles.None + a.AxisX.MajorGrid.LineDashStyle = DataVisualization.Charting.ChartDashStyle.Dot + + a.AxisY.Title = "engine torque [Nm]" + a.AxisY.TitleFont = New Font("Helvetica", 10) + a.AxisY.LabelStyle.Font = New Font("Helvetica", 8) + a.AxisY.LabelAutoFitStyle = DataVisualization.Charting.LabelAutoFitStyles.None + a.AxisY.MajorGrid.LineDashStyle = DataVisualization.Charting.ChartDashStyle.Dot + + a.AxisX.Minimum = 300 + a.BorderDashStyle = DataVisualization.Charting.ChartDashStyle.Solid + a.BorderWidth = 1 + + a.BackColor = Color.GhostWhite + + MyChart.ChartAreas.Add(a) + + MyChart.Update() + + img = New Bitmap(MyChart.Width, MyChart.Height, Imaging.PixelFormat.Format32bppArgb) + MyChart.DrawToBitmap(img, New Rectangle(0, 0, Me.PicBox.Width, Me.PicBox.Height)) + + + Me.PicBox.Image = img + + + End Sub + #Region "Open File Context Menu" @@ -468,10 +624,6 @@ End Sub - Private Sub OpenWithGRAPHiToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles OpenWithGRAPHiToolStripMenuItem.Click - If Not FileOpenGRAPHi(CmFiles) Then MsgBox("Failed to open file!") - End Sub - Private Sub OpenWithToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles OpenWithToolStripMenuItem.Click If Not FileOpenAlt(CmFiles(0)) Then MsgBox("Failed to open file!") End Sub @@ -490,5 +642,6 @@ #End Region - + + End Class diff --git a/VECTO/GUI/F_FLD.Designer.vb b/VECTO/GUI/F_FLD.Designer.vb index c17317b64f711be96dc1dab3eacc5e8cbefda835..2440b0c317702f642e19c6b0e80403f37264e413 100644 --- a/VECTO/GUI/F_FLD.Designer.vb +++ b/VECTO/GUI/F_FLD.Designer.vb @@ -30,7 +30,6 @@ Partial Class F_FLD Me.BtFLD = New System.Windows.Forms.Button() Me.TbFLD = New System.Windows.Forms.TextBox() Me.CmOpenFile = New System.Windows.Forms.ContextMenuStrip(Me.components) - Me.OpenWithGRAPHiToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.OpenWithToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ShowInFolderToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.Label4 = New System.Windows.Forms.Label() @@ -110,26 +109,20 @@ Partial Class F_FLD ' 'CmOpenFile ' - Me.CmOpenFile.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.OpenWithGRAPHiToolStripMenuItem, Me.OpenWithToolStripMenuItem, Me.ShowInFolderToolStripMenuItem}) + Me.CmOpenFile.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.OpenWithToolStripMenuItem, Me.ShowInFolderToolStripMenuItem}) Me.CmOpenFile.Name = "CmOpenFile" - Me.CmOpenFile.Size = New System.Drawing.Size(175, 70) - ' - 'OpenWithGRAPHiToolStripMenuItem - ' - Me.OpenWithGRAPHiToolStripMenuItem.Name = "OpenWithGRAPHiToolStripMenuItem" - Me.OpenWithGRAPHiToolStripMenuItem.Size = New System.Drawing.Size(174, 22) - Me.OpenWithGRAPHiToolStripMenuItem.Text = "Open with GRAPHi" + Me.CmOpenFile.Size = New System.Drawing.Size(153, 70) ' 'OpenWithToolStripMenuItem ' Me.OpenWithToolStripMenuItem.Name = "OpenWithToolStripMenuItem" - Me.OpenWithToolStripMenuItem.Size = New System.Drawing.Size(174, 22) + Me.OpenWithToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.OpenWithToolStripMenuItem.Text = "Open with ..." ' 'ShowInFolderToolStripMenuItem ' Me.ShowInFolderToolStripMenuItem.Name = "ShowInFolderToolStripMenuItem" - Me.ShowInFolderToolStripMenuItem.Size = New System.Drawing.Size(174, 22) + Me.ShowInFolderToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.ShowInFolderToolStripMenuItem.Text = "Show in Folder" ' 'Label4 @@ -235,7 +228,6 @@ Partial Class F_FLD Friend WithEvents BtFLD As System.Windows.Forms.Button Friend WithEvents TbFLD As System.Windows.Forms.TextBox Friend WithEvents CmOpenFile As System.Windows.Forms.ContextMenuStrip - Friend WithEvents OpenWithGRAPHiToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents OpenWithToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents ShowInFolderToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents Label4 As System.Windows.Forms.Label diff --git a/VECTO/GUI/F_FLD.vb b/VECTO/GUI/F_FLD.vb index 7a74c0518a3c4925e4eb32527f506668061e2b18..920f5df05c797003f32d97ddc9c1edd5ba29a4b9 100644 --- a/VECTO/GUI/F_FLD.vb +++ b/VECTO/GUI/F_FLD.vb @@ -1,9 +1,15 @@ Imports System.Windows.Forms +''' <summary> +''' Dialog for selecting VFLD files and assign Gears. +''' </summary> +''' <remarks></remarks> Public Class F_FLD + 'Parent Engine file Public EngFile As String = "" + 'Save and close Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click If Trim(Me.TbFLD.Text) = "" Then @@ -22,15 +28,18 @@ Public Class F_FLD Me.Close() End Sub + 'Cancel Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click Me.DialogResult = System.Windows.Forms.DialogResult.Cancel Me.Close() End Sub + 'Browse for VFLD file Private Sub BtFLD_Click(sender As System.Object, e As System.EventArgs) Handles BtFLD.Click If fbFLD.OpenDialog(fFileRepl(Me.TbFLD.Text, fPATH(EngFile))) Then Me.TbFLD.Text = fFileWoDir(fbFLD.Files(0), fPATH(EngFile)) End Sub + 'Open VFLD file Private Sub BtFLDOpen_Click(sender As System.Object, e As System.EventArgs) Handles BtFLDOpen.Click OpenFiles(fFileRepl(Me.TbFLD.Text, fPATH(EngFile))) End Sub @@ -51,10 +60,6 @@ Public Class F_FLD End Sub - Private Sub OpenWithGRAPHiToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles OpenWithGRAPHiToolStripMenuItem.Click - If Not FileOpenGRAPHi(CmFiles) Then MsgBox("Failed to open file!") - End Sub - Private Sub OpenWithToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles OpenWithToolStripMenuItem.Click If Not FileOpenAlt(CmFiles(0)) Then MsgBox("Failed to open file!") End Sub diff --git a/VECTO/GUI/F_FileSign.vb b/VECTO/GUI/F_FileSign.vb index 174e78d17b658303bb2975d43be3f3f4ea4c7a77..525569a4634a6ae7c4cb2fce4a2c22718df87d73 100644 --- a/VECTO/GUI/F_FileSign.vb +++ b/VECTO/GUI/F_FileSign.vb @@ -1,7 +1,12 @@ Imports System.Windows.Forms +''' <summary> +''' Create/Verify signature files (.vsig). +''' </summary> +''' <remarks></remarks> Public Class F_FileSign + 'Create signature file Private Sub BtSign_Click(sender As System.Object, e As System.EventArgs) Handles BtSign.Click Dim lv0 As ListViewItem Dim MainDir As String @@ -64,6 +69,7 @@ Public Class F_FileSign End Sub + 'Verify existing signature file Public Sub VerifySigFile() Dim lv0 As ListViewItem Dim i As Integer @@ -106,6 +112,7 @@ Public Class F_FileSign End Sub + 'Clear form Private Sub ClearForm(ByVal ClearFileList As Boolean) If ClearFileList Then lvFiles.Items.Clear() Me.TbLicStr.Text = "" @@ -120,17 +127,13 @@ Public Class F_FileSign End Sub - - - - #Region "GUI Controls" Private Sub BtBrowse_Click(sender As System.Object, e As System.EventArgs) Handles BtBrowse.Click Dim fb As New cFileBrowser("sig", False, True) fb.Extensions = New String() {"vsig"} - If fb.CustomDialog(Me.TbSigFile.Text, False, False, eExtMode.ForceExt, False, "vsig") Then + If fb.CustomDialog(Me.TbSigFile.Text, False, False, tFbExtMode.ForceExt, False, "vsig") Then Me.TbSigFile.Text = fb.Files(0) End If diff --git a/VECTO/GUI/F_GBX.Designer.vb b/VECTO/GUI/F_GBX.Designer.vb index e6b9de385140c00b479b6dbe79b031f391e191c3..93210a25b6389fab230bbfd432f49694a98fe7cd 100644 --- a/VECTO/GUI/F_GBX.Designer.vb +++ b/VECTO/GUI/F_GBX.Designer.vb @@ -43,6 +43,7 @@ Partial Class F_GBX Me.ColumnHeader4 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) Me.ColumnHeader2 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) Me.ColumnHeader3 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) + Me.ColumnHeader5 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) Me.TBI_getr = New System.Windows.Forms.TextBox() Me.Label49 = New System.Windows.Forms.Label() Me.Label33 = New System.Windows.Forms.Label() @@ -57,7 +58,6 @@ Partial Class F_GBX Me.Label2 = New System.Windows.Forms.Label() Me.Label4 = New System.Windows.Forms.Label() Me.TbTqResv = New System.Windows.Forms.TextBox() - Me.BtShiftPolyOpen = New System.Windows.Forms.Button() Me.ChShiftInside = New System.Windows.Forms.CheckBox() Me.TbShiftTime = New System.Windows.Forms.TextBox() Me.Label12 = New System.Windows.Forms.Label() @@ -73,11 +73,7 @@ Partial Class F_GBX Me.Label8 = New System.Windows.Forms.Label() Me.Label5 = New System.Windows.Forms.Label() Me.Label7 = New System.Windows.Forms.Label() - Me.TbShiftPolyFile = New System.Windows.Forms.TextBox() - Me.BtShiftPolyBrowse = New System.Windows.Forms.Button() - Me.Label1 = New System.Windows.Forms.Label() Me.CmOpenFile = New System.Windows.Forms.ContextMenuStrip(Me.components) - Me.OpenWithGRAPHiToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.OpenWithToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ShowInFolderToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.GroupBox3 = New System.Windows.Forms.GroupBox() @@ -96,6 +92,7 @@ Partial Class F_GBX Me.GroupBox4 = New System.Windows.Forms.GroupBox() Me.Label32 = New System.Windows.Forms.Label() Me.PnInertiaTI = New System.Windows.Forms.Panel() + Me.PicBox = New System.Windows.Forms.PictureBox() Me.ToolStrip1.SuspendLayout() Me.StatusStrip1.SuspendLayout() CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit() @@ -107,6 +104,7 @@ Partial Class F_GBX Me.PnTC.SuspendLayout() Me.GroupBox4.SuspendLayout() Me.PnInertiaTI.SuspendLayout() + CType(Me.PicBox, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'ToolStrip1 @@ -115,7 +113,7 @@ Partial Class F_GBX Me.ToolStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripBtNew, Me.ToolStripBtOpen, Me.ToolStripBtSave, Me.ToolStripBtSaveAs, Me.ToolStripSeparator3, Me.ToolStripBtSendTo, Me.ToolStripSeparator1, Me.ToolStripButton1}) Me.ToolStrip1.Location = New System.Drawing.Point(0, 0) Me.ToolStrip1.Name = "ToolStrip1" - Me.ToolStrip1.Size = New System.Drawing.Size(465, 25) + Me.ToolStrip1.Size = New System.Drawing.Size(877, 25) Me.ToolStrip1.TabIndex = 30 Me.ToolStrip1.Text = "ToolStrip1" ' @@ -171,8 +169,8 @@ Partial Class F_GBX Me.ToolStripBtSendTo.ImageTransparentColor = System.Drawing.Color.Magenta Me.ToolStripBtSendTo.Name = "ToolStripBtSendTo" Me.ToolStripBtSendTo.Size = New System.Drawing.Size(23, 22) - Me.ToolStripBtSendTo.Text = "Send to GEN Editor" - Me.ToolStripBtSendTo.ToolTipText = "Send to GEN Editor" + Me.ToolStripBtSendTo.Text = "Send to Job Editor" + Me.ToolStripBtSendTo.ToolTipText = "Send to Job Editor" ' 'ToolStripSeparator1 ' @@ -191,9 +189,9 @@ Partial Class F_GBX 'StatusStrip1 ' Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.LbStatus}) - Me.StatusStrip1.Location = New System.Drawing.Point(0, 764) + Me.StatusStrip1.Location = New System.Drawing.Point(0, 595) Me.StatusStrip1.Name = "StatusStrip1" - Me.StatusStrip1.Size = New System.Drawing.Size(465, 22) + Me.StatusStrip1.Size = New System.Drawing.Size(877, 22) Me.StatusStrip1.SizingGrip = False Me.StatusStrip1.TabIndex = 37 Me.StatusStrip1.Text = "StatusStrip1" @@ -208,7 +206,7 @@ Partial Class F_GBX ' Me.ButCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.ButCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel - Me.ButCancel.Location = New System.Drawing.Point(378, 738) + Me.ButCancel.Location = New System.Drawing.Point(790, 569) Me.ButCancel.Name = "ButCancel" Me.ButCancel.Size = New System.Drawing.Size(75, 23) Me.ButCancel.TabIndex = 9 @@ -218,7 +216,7 @@ Partial Class F_GBX 'ButOK ' Me.ButOK.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ButOK.Location = New System.Drawing.Point(297, 738) + Me.ButOK.Location = New System.Drawing.Point(709, 569) Me.ButOK.Name = "ButOK" Me.ButOK.Size = New System.Drawing.Size(75, 23) Me.ButOK.TabIndex = 8 @@ -234,14 +232,14 @@ Partial Class F_GBX ' 'LvGears ' - Me.LvGears.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader1, Me.ColumnHeader4, Me.ColumnHeader2, Me.ColumnHeader3}) + Me.LvGears.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader1, Me.ColumnHeader4, Me.ColumnHeader2, Me.ColumnHeader3, Me.ColumnHeader5}) Me.LvGears.FullRowSelect = True Me.LvGears.GridLines = True Me.LvGears.HideSelection = False Me.LvGears.Location = New System.Drawing.Point(6, 18) Me.LvGears.MultiSelect = False Me.LvGears.Name = "LvGears" - Me.LvGears.Size = New System.Drawing.Size(429, 150) + Me.LvGears.Size = New System.Drawing.Size(429, 183) Me.LvGears.TabIndex = 2 Me.LvGears.TabStop = False Me.LvGears.UseCompatibleStateImageBehavior = False @@ -260,12 +258,17 @@ Partial Class F_GBX 'ColumnHeader2 ' Me.ColumnHeader2.Text = "Ratio" - Me.ColumnHeader2.Width = 62 + Me.ColumnHeader2.Width = 55 ' 'ColumnHeader3 ' Me.ColumnHeader3.Text = "Loss Map or Efficiency [-]" - Me.ColumnHeader3.Width = 275 + Me.ColumnHeader3.Width = 137 + ' + 'ColumnHeader5 + ' + Me.ColumnHeader5.Text = "Shift polygons" + Me.ColumnHeader5.Width = 97 ' 'TBI_getr ' @@ -339,7 +342,7 @@ Partial Class F_GBX 'BtRemGear ' Me.BtRemGear.Image = Global.VECTO.My.Resources.Resources.minus_circle_icon - Me.BtRemGear.Location = New System.Drawing.Point(41, 174) + Me.BtRemGear.Location = New System.Drawing.Point(41, 207) Me.BtRemGear.Name = "BtRemGear" Me.BtRemGear.Size = New System.Drawing.Size(29, 23) Me.BtRemGear.TabIndex = 3 @@ -348,19 +351,15 @@ Partial Class F_GBX 'GrGearShift ' Me.GrGearShift.Controls.Add(Me.PnTorqRes) - Me.GrGearShift.Controls.Add(Me.BtShiftPolyOpen) Me.GrGearShift.Controls.Add(Me.ChShiftInside) Me.GrGearShift.Controls.Add(Me.TbShiftTime) Me.GrGearShift.Controls.Add(Me.Label12) Me.GrGearShift.Controls.Add(Me.Label13) Me.GrGearShift.Controls.Add(Me.ChSkipGears) Me.GrGearShift.Controls.Add(Me.GroupBox2) - Me.GrGearShift.Controls.Add(Me.TbShiftPolyFile) - Me.GrGearShift.Controls.Add(Me.BtShiftPolyBrowse) - Me.GrGearShift.Controls.Add(Me.Label1) Me.GrGearShift.Location = New System.Drawing.Point(12, 377) Me.GrGearShift.Name = "GrGearShift" - Me.GrGearShift.Size = New System.Drawing.Size(441, 230) + Me.GrGearShift.Size = New System.Drawing.Size(441, 182) Me.GrGearShift.TabIndex = 6 Me.GrGearShift.TabStop = False Me.GrGearShift.Text = "Gear shift parameters" @@ -370,15 +369,16 @@ Partial Class F_GBX Me.PnTorqRes.Controls.Add(Me.Label2) Me.PnTorqRes.Controls.Add(Me.Label4) Me.PnTorqRes.Controls.Add(Me.TbTqResv) - Me.PnTorqRes.Location = New System.Drawing.Point(235, 66) + Me.PnTorqRes.Location = New System.Drawing.Point(230, 19) Me.PnTorqRes.Name = "PnTorqRes" - Me.PnTorqRes.Size = New System.Drawing.Size(200, 32) + Me.PnTorqRes.Size = New System.Drawing.Size(190, 32) Me.PnTorqRes.TabIndex = 5 ' 'Label2 ' + Me.Label2.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.Label2.AutoSize = True - Me.Label2.Location = New System.Drawing.Point(20, 9) + Me.Label2.Location = New System.Drawing.Point(10, 9) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(79, 13) Me.Label2.TabIndex = 0 @@ -386,8 +386,9 @@ Partial Class F_GBX ' 'Label4 ' + Me.Label4.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.Label4.AutoSize = True - Me.Label4.Location = New System.Drawing.Point(168, 9) + Me.Label4.Location = New System.Drawing.Point(158, 9) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(21, 13) Me.Label4.TabIndex = 0 @@ -395,27 +396,18 @@ Partial Class F_GBX ' 'TbTqResv ' - Me.TbTqResv.Location = New System.Drawing.Point(105, 6) + Me.TbTqResv.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.TbTqResv.Location = New System.Drawing.Point(95, 6) Me.TbTqResv.Name = "TbTqResv" Me.TbTqResv.Size = New System.Drawing.Size(57, 20) Me.TbTqResv.TabIndex = 3 ' - 'BtShiftPolyOpen - ' - Me.BtShiftPolyOpen.Image = Global.VECTO.My.Resources.Resources.application_export_icon_small - Me.BtShiftPolyOpen.Location = New System.Drawing.Point(412, 40) - Me.BtShiftPolyOpen.Name = "BtShiftPolyOpen" - Me.BtShiftPolyOpen.Size = New System.Drawing.Size(23, 23) - Me.BtShiftPolyOpen.TabIndex = 2 - Me.BtShiftPolyOpen.TabStop = False - Me.BtShiftPolyOpen.UseVisualStyleBackColor = True - ' 'ChShiftInside ' Me.ChShiftInside.AutoSize = True Me.ChShiftInside.Checked = True Me.ChShiftInside.CheckState = System.Windows.Forms.CheckState.Checked - Me.ChShiftInside.Location = New System.Drawing.Point(9, 74) + Me.ChShiftInside.Location = New System.Drawing.Point(9, 27) Me.ChShiftInside.Name = "ChShiftInside" Me.ChShiftInside.Size = New System.Drawing.Size(195, 17) Me.ChShiftInside.TabIndex = 3 @@ -424,7 +416,7 @@ Partial Class F_GBX ' 'TbShiftTime ' - Me.TbShiftTime.Location = New System.Drawing.Point(340, 98) + Me.TbShiftTime.Location = New System.Drawing.Point(325, 51) Me.TbShiftTime.Name = "TbShiftTime" Me.TbShiftTime.Size = New System.Drawing.Size(57, 20) Me.TbShiftTime.TabIndex = 6 @@ -432,7 +424,7 @@ Partial Class F_GBX 'Label12 ' Me.Label12.AutoSize = True - Me.Label12.Location = New System.Drawing.Point(403, 101) + Me.Label12.Location = New System.Drawing.Point(388, 54) Me.Label12.Name = "Label12" Me.Label12.Size = New System.Drawing.Size(18, 13) Me.Label12.TabIndex = 9 @@ -441,16 +433,16 @@ Partial Class F_GBX 'Label13 ' Me.Label13.AutoSize = True - Me.Label13.Location = New System.Drawing.Point(149, 101) + Me.Label13.Location = New System.Drawing.Point(227, 54) Me.Label13.Name = "Label13" - Me.Label13.Size = New System.Drawing.Size(185, 13) + Me.Label13.Size = New System.Drawing.Size(92, 13) Me.Label13.TabIndex = 8 - Me.Label13.Text = "Minimum time between two gear shifts" + Me.Label13.Text = "Minimum shift time" ' 'ChSkipGears ' Me.ChSkipGears.AutoSize = True - Me.ChSkipGears.Location = New System.Drawing.Point(9, 100) + Me.ChSkipGears.Location = New System.Drawing.Point(9, 53) Me.ChSkipGears.Name = "ChSkipGears" Me.ChSkipGears.Size = New System.Drawing.Size(132, 17) Me.ChSkipGears.TabIndex = 4 @@ -468,7 +460,7 @@ Partial Class F_GBX Me.GroupBox2.Controls.Add(Me.Label8) Me.GroupBox2.Controls.Add(Me.Label5) Me.GroupBox2.Controls.Add(Me.Label7) - Me.GroupBox2.Location = New System.Drawing.Point(6, 124) + Me.GroupBox2.Location = New System.Drawing.Point(6, 77) Me.GroupBox2.Name = "GroupBox2" Me.GroupBox2.Size = New System.Drawing.Size(429, 99) Me.GroupBox2.TabIndex = 7 @@ -550,63 +542,31 @@ Partial Class F_GBX Me.Label7.TabIndex = 0 Me.Label7.Text = "[%]" ' - 'TbShiftPolyFile - ' - Me.TbShiftPolyFile.Location = New System.Drawing.Point(6, 42) - Me.TbShiftPolyFile.Name = "TbShiftPolyFile" - Me.TbShiftPolyFile.Size = New System.Drawing.Size(362, 20) - Me.TbShiftPolyFile.TabIndex = 0 - ' - 'BtShiftPolyBrowse - ' - Me.BtShiftPolyBrowse.Location = New System.Drawing.Point(374, 40) - Me.BtShiftPolyBrowse.Name = "BtShiftPolyBrowse" - Me.BtShiftPolyBrowse.Size = New System.Drawing.Size(32, 23) - Me.BtShiftPolyBrowse.TabIndex = 1 - Me.BtShiftPolyBrowse.TabStop = False - Me.BtShiftPolyBrowse.Text = "..." - Me.BtShiftPolyBrowse.UseVisualStyleBackColor = True - ' - 'Label1 - ' - Me.Label1.AutoSize = True - Me.Label1.Location = New System.Drawing.Point(6, 26) - Me.Label1.Name = "Label1" - Me.Label1.Size = New System.Drawing.Size(89, 13) - Me.Label1.TabIndex = 0 - Me.Label1.Text = "Shift polygons file" - ' 'CmOpenFile ' - Me.CmOpenFile.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.OpenWithGRAPHiToolStripMenuItem, Me.OpenWithToolStripMenuItem, Me.ShowInFolderToolStripMenuItem}) + Me.CmOpenFile.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.OpenWithToolStripMenuItem, Me.ShowInFolderToolStripMenuItem}) Me.CmOpenFile.Name = "CmOpenFile" - Me.CmOpenFile.Size = New System.Drawing.Size(175, 70) - ' - 'OpenWithGRAPHiToolStripMenuItem - ' - Me.OpenWithGRAPHiToolStripMenuItem.Name = "OpenWithGRAPHiToolStripMenuItem" - Me.OpenWithGRAPHiToolStripMenuItem.Size = New System.Drawing.Size(174, 22) - Me.OpenWithGRAPHiToolStripMenuItem.Text = "Open with GRAPHi" + Me.CmOpenFile.Size = New System.Drawing.Size(153, 48) ' 'OpenWithToolStripMenuItem ' Me.OpenWithToolStripMenuItem.Name = "OpenWithToolStripMenuItem" - Me.OpenWithToolStripMenuItem.Size = New System.Drawing.Size(174, 22) + Me.OpenWithToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.OpenWithToolStripMenuItem.Text = "Open with ..." ' 'ShowInFolderToolStripMenuItem ' Me.ShowInFolderToolStripMenuItem.Name = "ShowInFolderToolStripMenuItem" - Me.ShowInFolderToolStripMenuItem.Size = New System.Drawing.Size(174, 22) + Me.ShowInFolderToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.ShowInFolderToolStripMenuItem.Text = "Show in Folder" ' 'GroupBox3 ' Me.GroupBox3.Controls.Add(Me.PnTC) Me.GroupBox3.Controls.Add(Me.ChTCon) - Me.GroupBox3.Location = New System.Drawing.Point(12, 613) + Me.GroupBox3.Location = New System.Drawing.Point(459, 440) Me.GroupBox3.Name = "GroupBox3" - Me.GroupBox3.Size = New System.Drawing.Size(441, 119) + Me.GroupBox3.Size = New System.Drawing.Size(414, 119) Me.GroupBox3.TabIndex = 7 Me.GroupBox3.TabStop = False Me.GroupBox3.Text = "Torque Converter" @@ -622,7 +582,7 @@ Partial Class F_GBX Me.PnTC.Controls.Add(Me.TbTCrefrpm) Me.PnTC.Location = New System.Drawing.Point(6, 39) Me.PnTC.Name = "PnTC" - Me.PnTC.Size = New System.Drawing.Size(429, 72) + Me.PnTC.Size = New System.Drawing.Size(402, 72) Me.PnTC.TabIndex = 36 ' 'Label17 @@ -636,8 +596,9 @@ Partial Class F_GBX ' 'Label15 ' + Me.Label15.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.Label15.AutoSize = True - Me.Label15.Location = New System.Drawing.Point(98, 50) + Me.Label15.Location = New System.Drawing.Point(71, 50) Me.Label15.Name = "Label15" Me.Label15.Size = New System.Drawing.Size(191, 13) Me.Label15.TabIndex = 0 @@ -645,8 +606,9 @@ Partial Class F_GBX ' 'Label14 ' + Me.Label14.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.Label14.AutoSize = True - Me.Label14.Location = New System.Drawing.Point(368, 50) + Me.Label14.Location = New System.Drawing.Point(341, 50) Me.Label14.Name = "Label14" Me.Label14.Size = New System.Drawing.Size(40, 13) Me.Label14.TabIndex = 0 @@ -654,7 +616,8 @@ Partial Class F_GBX ' 'BtTCfileBrowse ' - Me.BtTCfileBrowse.Location = New System.Drawing.Point(368, 19) + Me.BtTCfileBrowse.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.BtTCfileBrowse.Location = New System.Drawing.Point(341, 19) Me.BtTCfileBrowse.Name = "BtTCfileBrowse" Me.BtTCfileBrowse.Size = New System.Drawing.Size(32, 23) Me.BtTCfileBrowse.TabIndex = 1 @@ -664,15 +627,18 @@ Partial Class F_GBX ' 'TbTCfile ' + Me.TbTCfile.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.TbTCfile.Location = New System.Drawing.Point(0, 21) Me.TbTCfile.Name = "TbTCfile" - Me.TbTCfile.Size = New System.Drawing.Size(362, 20) + Me.TbTCfile.Size = New System.Drawing.Size(335, 20) Me.TbTCfile.TabIndex = 0 ' 'BtTCfileOpen ' + Me.BtTCfileOpen.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.BtTCfileOpen.Image = Global.VECTO.My.Resources.Resources.application_export_icon_small - Me.BtTCfileOpen.Location = New System.Drawing.Point(406, 19) + Me.BtTCfileOpen.Location = New System.Drawing.Point(379, 19) Me.BtTCfileOpen.Name = "BtTCfileOpen" Me.BtTCfileOpen.Size = New System.Drawing.Size(23, 23) Me.BtTCfileOpen.TabIndex = 2 @@ -681,7 +647,8 @@ Partial Class F_GBX ' 'TbTCrefrpm ' - Me.TbTCrefrpm.Location = New System.Drawing.Point(295, 47) + Me.TbTCrefrpm.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.TbTCrefrpm.Location = New System.Drawing.Point(268, 47) Me.TbTCrefrpm.Name = "TbTCrefrpm" Me.TbTCrefrpm.Size = New System.Drawing.Size(67, 20) Me.TbTCrefrpm.TabIndex = 3 @@ -711,7 +678,6 @@ Partial Class F_GBX ' Me.CbGStype.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList Me.CbGStype.FormattingEnabled = True - Me.CbGStype.Items.AddRange(New Object() {"Manual Transmission (MT)", "Automated Manual Transmission (AMT)", "Automatic Transmission (AT)", "Custom"}) Me.CbGStype.Location = New System.Drawing.Point(119, 108) Me.CbGStype.Name = "CbGStype" Me.CbGStype.Size = New System.Drawing.Size(227, 21) @@ -720,7 +686,7 @@ Partial Class F_GBX 'BtAddGear ' Me.BtAddGear.Image = Global.VECTO.My.Resources.Resources.plus_circle_icon - Me.BtAddGear.Location = New System.Drawing.Point(6, 174) + Me.BtAddGear.Location = New System.Drawing.Point(6, 207) Me.BtAddGear.Name = "BtAddGear" Me.BtAddGear.Size = New System.Drawing.Size(29, 23) Me.BtAddGear.TabIndex = 3 @@ -734,7 +700,7 @@ Partial Class F_GBX Me.GroupBox4.Controls.Add(Me.BtAddGear) Me.GroupBox4.Location = New System.Drawing.Point(12, 135) Me.GroupBox4.Name = "GroupBox4" - Me.GroupBox4.Size = New System.Drawing.Size(441, 209) + Me.GroupBox4.Size = New System.Drawing.Size(441, 236) Me.GroupBox4.TabIndex = 46 Me.GroupBox4.TabStop = False Me.GroupBox4.Text = "Gears" @@ -742,7 +708,7 @@ Partial Class F_GBX 'Label32 ' Me.Label32.AutoSize = True - Me.Label32.Location = New System.Drawing.Point(312, 179) + Me.Label32.Location = New System.Drawing.Point(312, 212) Me.Label32.Name = "Label32" Me.Label32.Size = New System.Drawing.Size(123, 13) Me.Label32.TabIndex = 35 @@ -756,18 +722,28 @@ Partial Class F_GBX Me.PnInertiaTI.Controls.Add(Me.Label48) Me.PnInertiaTI.Controls.Add(Me.Label49) Me.PnInertiaTI.Controls.Add(Me.TbTracInt) - Me.PnInertiaTI.Location = New System.Drawing.Point(49, 347) + Me.PnInertiaTI.Location = New System.Drawing.Point(469, 406) Me.PnInertiaTI.Name = "PnInertiaTI" Me.PnInertiaTI.Size = New System.Drawing.Size(398, 30) Me.PnInertiaTI.TabIndex = 47 ' + 'PicBox + ' + Me.PicBox.BackColor = System.Drawing.Color.LightGray + Me.PicBox.Location = New System.Drawing.Point(459, 28) + Me.PicBox.Name = "PicBox" + Me.PicBox.Size = New System.Drawing.Size(406, 372) + Me.PicBox.TabIndex = 48 + Me.PicBox.TabStop = False + ' 'F_GBX ' Me.AcceptButton = Me.ButOK Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.CancelButton = Me.ButCancel - Me.ClientSize = New System.Drawing.Size(465, 786) + Me.ClientSize = New System.Drawing.Size(877, 617) + Me.Controls.Add(Me.PicBox) Me.Controls.Add(Me.PnInertiaTI) Me.Controls.Add(Me.GroupBox4) Me.Controls.Add(Me.CbGStype) @@ -807,6 +783,7 @@ Partial Class F_GBX Me.GroupBox4.PerformLayout() Me.PnInertiaTI.ResumeLayout(False) Me.PnInertiaTI.PerformLayout() + CType(Me.PicBox, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) Me.PerformLayout() @@ -839,9 +816,6 @@ Partial Class F_GBX Friend WithEvents ToolStripSeparator1 As System.Windows.Forms.ToolStripSeparator Friend WithEvents ToolStripButton1 As System.Windows.Forms.ToolStripButton Friend WithEvents GrGearShift As System.Windows.Forms.GroupBox - Friend WithEvents Label1 As System.Windows.Forms.Label - Friend WithEvents BtShiftPolyBrowse As System.Windows.Forms.Button - Friend WithEvents TbShiftPolyFile As System.Windows.Forms.TextBox Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents TbTqResvStart As System.Windows.Forms.TextBox Friend WithEvents TbTqResv As System.Windows.Forms.TextBox @@ -861,10 +835,8 @@ Partial Class F_GBX Friend WithEvents ChSkipGears As System.Windows.Forms.CheckBox Friend WithEvents ChShiftInside As System.Windows.Forms.CheckBox Friend WithEvents CmOpenFile As System.Windows.Forms.ContextMenuStrip - Friend WithEvents OpenWithGRAPHiToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents OpenWithToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents ShowInFolderToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem - Friend WithEvents BtShiftPolyOpen As System.Windows.Forms.Button Friend WithEvents GroupBox3 As System.Windows.Forms.GroupBox Friend WithEvents TbTCfile As System.Windows.Forms.TextBox Friend WithEvents ChTCon As System.Windows.Forms.CheckBox @@ -883,4 +855,6 @@ Partial Class F_GBX Friend WithEvents GroupBox4 As System.Windows.Forms.GroupBox Friend WithEvents Label32 As System.Windows.Forms.Label Friend WithEvents PnInertiaTI As System.Windows.Forms.Panel + Friend WithEvents ColumnHeader5 As System.Windows.Forms.ColumnHeader + Friend WithEvents PicBox As System.Windows.Forms.PictureBox End Class diff --git a/VECTO/GUI/F_GBX.resx b/VECTO/GUI/F_GBX.resx index b55d85516f8b870af14eddb6f3fdc6408754f720..331f1c170ba66d33ace1e6a3daf0b47bb3e96014 100644 --- a/VECTO/GUI/F_GBX.resx +++ b/VECTO/GUI/F_GBX.resx @@ -124,7 +124,7 @@ <value>117, 20</value> </metadata> <metadata name="CmOpenFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>1101, 12</value> + <value>227, 22</value> </metadata> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> diff --git a/VECTO/GUI/F_GBX.vb b/VECTO/GUI/F_GBX.vb index 99ebf791b9733dbab04436d2b93282e2ab274f62..f48d1589af4000fd8753e1e7c815683181051833 100644 --- a/VECTO/GUI/F_GBX.vb +++ b/VECTO/GUI/F_GBX.vb @@ -1,29 +1,42 @@ -Public Class F_GBX +Imports System.Collections.Generic +''' <summary> +''' Gearbox Editor +''' </summary> +''' <remarks></remarks> +Public Class F_GBX Private GbxFile As String = "" Public AutoSendTo As Boolean = False - Public GenDir As String = "" - Private GearDia As F_VEH_GearDlog + Public JobDir As String = "" + Private GearDia As F_GBX_GearDlog Private Init As Boolean = False Private Changed As Boolean = False + 'Before closing Editor: Check if file was changed and ask to save. Private Sub F_GBX_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing If e.CloseReason <> CloseReason.ApplicationExitCall And e.CloseReason <> CloseReason.WindowsShutDown Then e.Cancel = ChangeCheckCancel() End If End Sub + 'Initialise. Private Sub F_GBX_Load(sender As Object, e As System.EventArgs) Handles Me.Load Init = False - GearDia = New F_VEH_GearDlog - - If Declaration.Active Then - Me.PnInertiaTI.Enabled = False - Me.GrGearShift.Enabled = False - Me.ChTCon.Enabled = False + GearDia = New F_GBX_GearDlog + + Me.PnInertiaTI.Enabled = Not Cfg.DeclMode + Me.GrGearShift.Enabled = Not Cfg.DeclMode + Me.ChTCon.Enabled = Not Cfg.DeclMode + + Me.CbGStype.Items.Clear() + Me.CbGStype.Items.Add("Manual Transmission (MT)") + Me.CbGStype.Items.Add("Automated Manual Transmission (AMT)") + If Not Cfg.DeclMode Then + Me.CbGStype.Items.Add("Automatic Transmission (AT)") + Me.CbGStype.Items.Add("Custom") End If Init = True @@ -35,13 +48,14 @@ End Sub + 'Set generic values for Declaration mode. Private Sub DeclInit() Dim GStype As tGearbox + Dim lv0 As ListViewItem - If Not Declaration.Active Then Exit Sub + If Not Cfg.DeclMode Then Exit Sub Me.TBI_getr.Text = cDeclaration.GbInertia - Me.TbShiftPolyFile.Text = "" GStype = CType(Me.CbGStype.SelectedIndex, tGearbox) @@ -53,11 +67,14 @@ Me.TbStartSpeed.Text = cDeclaration.StartSpeed Me.TbStartAcc.Text = cDeclaration.StartAcc + For Each lv0 In Me.LvGears.Items + lv0.SubItems(4).Text = "-" + Next End Sub -#Region "ToolStrip" +#Region "Toolbar" Private Sub ToolStripBtNew_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripBtNew.Click newGBX() @@ -88,14 +105,14 @@ End If If Not F_VECTO.Visible Then - GenDir = "" + JobDir = "" F_VECTO.Show() - F_VECTO.GENnew() + F_VECTO.VECTOnew() Else F_VECTO.WindowState = FormWindowState.Normal End If - F_VECTO.TbGBX.Text = fFileWoDir(GbxFile, GenDir) + F_VECTO.TbGBX.Text = fFileWoDir(GbxFile, JobDir) End Sub @@ -110,6 +127,7 @@ #End Region + 'New file Private Sub newGBX() Dim lvi As ListViewItem @@ -127,9 +145,9 @@ lvi.SubItems.Add("-") lvi.SubItems.Add("0") lvi.SubItems.Add("0") + lvi.SubItems.Add("") Me.LvGears.Items.Add(lvi) - Me.TbShiftPolyFile.Text = "" 'Me.ChSkipGears.Checked = False 'set by CbGStype.SelectedIndexChanged 'Me.ChShiftInside.Checked = False 'set by CbGStype.SelectedIndexChanged Me.TbTqResv.Text = "" @@ -149,9 +167,11 @@ Me.LbStatus.Text = "" Changed = False + UpdatePic() End Sub + 'Open file Public Sub openGBX(ByVal file As String) Dim GBX0 As cGBX Dim i As Integer @@ -176,7 +196,7 @@ Me.LvGears.Items.Clear() - For i = 0 To GBX0.GetrI.Count - 1 + For i = 0 To GBX0.Igetr.Count - 1 If i = 0 Then lv0 = New ListViewItem("Axle") @@ -193,14 +213,13 @@ Else lv0.SubItems.Add("-") End If - lv0.SubItems.Add(GBX0.GetrI(i)) + lv0.SubItems.Add(GBX0.Igetr(i)) lv0.SubItems.Add(GBX0.GetrMap(i, True)) - + lv0.SubItems.Add(GBX0.gsFile(i, True)) Me.LvGears.Items.Add(lv0) Next - Me.TbShiftPolyFile.Text = GBX0.gsFile(True) Me.ChSkipGears.Checked = GBX0.gs_SkipGears Me.TbTqResv.Text = GBX0.gs_TorqueResv.ToString Me.TbShiftTime.Text = GBX0.gs_ShiftTime.ToString @@ -212,8 +231,11 @@ Me.TbTCfile.Text = GBX0.TCfile(True) Me.TbTCrefrpm.Text = GBX0.TCrefrpm - Me.CbGStype.SelectedIndex = CType(GBX0.gs_Type, Integer) - + If CType(GBX0.gs_Type, Integer) <= Me.CbGStype.Items.Count - 1 Then + Me.CbGStype.SelectedIndex = CType(GBX0.gs_Type, Integer) + Else + Me.CbGStype.SelectedIndex = 0 + End If DeclInit() @@ -225,6 +247,7 @@ Me.Activate() Changed = False + UpdatePic() If GBX0.NoJSON Then If MsgBox("File is not in JSON format!" & vbCrLf & vbCrLf & "Convert now?" & vbCrLf & "(Backup will be created with '.ORIG' extension)", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then @@ -247,6 +270,7 @@ Return saveGBX(GbxFile) End Function + 'Save file Private Function saveGBX(ByVal file As String) As Boolean Dim GBX0 As cGBX Dim i As Int16 @@ -262,12 +286,13 @@ For i = 0 To Me.LvGears.Items.Count - 1 GBX0.IsTCgear.Add(Me.LvGears.Items(i).SubItems(1).Text = "on" And i > 0) - GBX0.GetrI.Add(CSng(Me.LvGears.Items(i).SubItems(2).Text)) + GBX0.Igetr.Add(CSng(Me.LvGears.Items(i).SubItems(2).Text)) GBX0.GetrMaps.Add(New cSubPath) GBX0.GetrMap(i) = Me.LvGears.Items(i).SubItems(3).Text + GBX0.gs_files.Add(New cSubPath) + GBX0.gsFile(i) = Me.LvGears.Items(i).SubItems(4).Text Next - GBX0.gsFile = Me.TbShiftPolyFile.Text GBX0.gs_TorqueResv = fTextboxToNumString(Me.TbTqResv.Text) GBX0.gs_SkipGears = Me.ChSkipGears.Checked GBX0.gs_ShiftTime = fTextboxToNumString(Me.TbShiftTime.Text) @@ -288,8 +313,11 @@ Return False End If - If Not GenDir = "" Or AutoSendTo Then - If F_VECTO.Visible And UCase(fFileRepl(F_VECTO.TbGBX.Text, GenDir)) <> UCase(file) Then F_VECTO.TbGBX.Text = fFileWoDir(file, GenDir) + If AutoSendTo Then + If F_VECTO.Visible Then + If UCase(fFileRepl(F_VECTO.TbGBX.Text, JobDir)) <> UCase(file) Then F_VECTO.TbGBX.Text = fFileWoDir(file, JobDir) + F_VECTO.UpdatePic() + End If End If fbGBX.UpdateHistory(file) @@ -346,10 +374,6 @@ Change() End Sub - Private Sub TbShiftPolyFile_TextChanged(sender As System.Object, e As System.EventArgs) Handles TbShiftPolyFile.TextChanged - Change() - End Sub - Private Sub ChSkipGears_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles ChSkipGears.CheckedChanged CheckEnableTorqRes() Change() @@ -402,60 +426,40 @@ #End Region + 'Save and close Private Sub ButOK_Click(sender As System.Object, e As System.EventArgs) Handles ButOK.Click If SaveOrSaveAs(False) Then Me.Close() End Sub + 'Cancel Private Sub ButCancel_Click(sender As System.Object, e As System.EventArgs) Handles ButCancel.Click Me.Close() End Sub - 'Enable/Disable settings for specific transmission types Private Sub CbGStype_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles CbGStype.SelectedIndexChanged Dim GStype As tGearbox - If Me.CbGStype.SelectedIndex = 3 Then Me.CbGStype.SelectedIndex = 0 - Change() GStype = CType(Me.CbGStype.SelectedIndex, tGearbox) - Select Case GStype - Case tGearbox.Manual - Me.ChShiftInside.Enabled = False - Me.ChShiftInside.Checked = False - Me.ChSkipGears.Enabled = False - Me.ChSkipGears.Checked = True - Me.ChTCon.Enabled = False - Me.ChTCon.Checked = False - - Case tGearbox.SemiAutomatic - Me.ChShiftInside.Enabled = False - Me.ChShiftInside.Checked = True - Me.ChSkipGears.Enabled = False - Me.ChSkipGears.Checked = True - Me.ChTCon.Enabled = False - Me.ChTCon.Checked = False - - Case tGearbox.Automatic - Me.ChShiftInside.Enabled = False - Me.ChShiftInside.Checked = False - Me.ChSkipGears.Enabled = False - Me.ChSkipGears.Checked = False - Me.ChTCon.Enabled = False - Me.ChTCon.Checked = True - - Case tGearbox.Custom - Me.ChShiftInside.Enabled = True - Me.ChSkipGears.Enabled = True - Me.ChTCon.Enabled = True + Me.ChShiftInside.Enabled = (GStype = tGearbox.Custom) + Me.ChSkipGears.Enabled = (GStype = tGearbox.Custom) + Me.ChTCon.Enabled = (GStype = tGearbox.Custom) - End Select + If GStype <> tGearbox.Custom Then + Me.ChShiftInside.Checked = Declaration.ShiftInside(GStype) + Me.ChSkipGears.Checked = Declaration.SkipGears(GStype) + Me.ChTCon.Checked = (GStype = tGearbox.Automatic) + End If End Sub + Private Sub LvGears_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles LvGears.SelectedIndexChanged + UpdatePic() + End Sub #Region "Gears" @@ -479,7 +483,7 @@ RemoveGear(False) End Sub - + 'Add Gear button Private Sub BtAddGear_Click(sender As System.Object, e As System.EventArgs) Handles BtAddGear.Click AddGear() Me.LvGears.Items(Me.LvGears.Items.Count - 1).Selected = True @@ -492,12 +496,18 @@ Do GearDia.ChIsTCgear.Enabled = (Me.ChTCon.Checked And Me.LvGears.SelectedIndices(0) > 0) - + GearDia.PnShiftPoly.Enabled = (Not Cfg.DeclMode And Me.LvGears.SelectedIndices(0) > 0) GearDia.GbxPath = fPATH(GbxFile) GearDia.TbGear.Text = Me.LvGears.SelectedItems(0).SubItems(0).Text - GearDia.ChIsTCgear.Checked = (Me.ChTCon.Checked And Me.LvGears.SelectedItems(0).SubItems(1).Text = "on") GearDia.TbRatio.Text = Me.LvGears.SelectedItems(0).SubItems(2).Text GearDia.TbMapPath.Text = Me.LvGears.SelectedItems(0).SubItems(3).Text + If Me.LvGears.SelectedIndices(0) > 0 Then + GearDia.ChIsTCgear.Checked = (Me.ChTCon.Checked And Me.LvGears.SelectedItems(0).SubItems(1).Text = "on") + GearDia.TbShiftPolyFile.Text = Me.LvGears.SelectedItems(0).SubItems(4).Text + Else + GearDia.ChIsTCgear.Checked = False + GearDia.TbShiftPolyFile.Text = "" + End If If GearDia.ShowDialog = Windows.Forms.DialogResult.OK Then @@ -513,8 +523,9 @@ Me.LvGears.SelectedItems(0).SubItems(2).Text = GearDia.TbRatio.Text Me.LvGears.SelectedItems(0).SubItems(3).Text = GearDia.TbMapPath.Text - + Me.LvGears.SelectedItems(0).SubItems(4).Text = GearDia.TbShiftPolyFile.Text + UpdatePic() Change() Else @@ -545,6 +556,7 @@ End If lvi.SubItems.Add("") lvi.SubItems.Add("") + lvi.SubItems.Add("") Me.LvGears.Items.Add(lvi) lvi.EnsureVisible() @@ -584,6 +596,7 @@ End If Me.LvGears.Focus() + UpdatePic() If Not NoChange Then Change() @@ -592,21 +605,6 @@ #End Region - 'Browse Shift Polygon File - Private Sub BtShiftPolyBrowse_Click(sender As System.Object, e As System.EventArgs) Handles BtShiftPolyBrowse.Click - Dim fb As cFileBrowser - fb = New cFileBrowser("ShiftPolygon", False, True) - fb.Extensions = New String() {"vgbs"} - If fb.OpenDialog(fFileRepl(Me.TbShiftPolyFile.Text, fPATH(GbxFile))) Then - Me.TbShiftPolyFile.Text = fFileWoDir(fb.Files(0), fPATH(GbxFile)) - End If - End Sub - - - Private Sub BtShiftPolyOpen_Click(sender As System.Object, e As System.EventArgs) Handles BtShiftPolyOpen.Click - OpenFiles(fFileRepl(Me.TbShiftPolyFile.Text, fPATH(GbxFile))) - End Sub - #Region "Open File Context Menu" @@ -624,10 +622,6 @@ End Sub - Private Sub OpenWithGRAPHiToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles OpenWithGRAPHiToolStripMenuItem.Click - If Not FileOpenGRAPHi(CmFiles) Then MsgBox("Failed to open file!") - End Sub - Private Sub OpenWithToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles OpenWithToolStripMenuItem.Click If Not FileOpenAlt(CmFiles(0)) Then MsgBox("Failed to open file!") End Sub @@ -646,6 +640,131 @@ #End Region + + Private Sub UpdatePic() + + Dim f As cFile_V3 = Nothing + Dim path As String + Dim lM As List(Of Single) + Dim lup As List(Of Single) + Dim ldown As List(Of Single) + Dim line As String() = Nothing + Dim MyChart As System.Windows.Forms.DataVisualization.Charting.Chart + Dim s As System.Windows.Forms.DataVisualization.Charting.Series + Dim a As System.Windows.Forms.DataVisualization.Charting.ChartArea + Dim img As Image + Dim Gear As Integer + + Me.PicBox.Image = Nothing + + Try + + 'Read Files + If Me.LvGears.Items.Count > 1 Then + + If Me.LvGears.SelectedItems.Count > 0 Then + path = fFileRepl(Me.LvGears.SelectedItems(0).SubItems(4).Text, fPATH(GbxFile)) + Gear = Me.LvGears.SelectedIndices(0) + Else + path = fFileRepl(Me.LvGears.Items(1).SubItems(4).Text, fPATH(GbxFile)) + Gear = 1 + End If + + f = New cFile_V3 + If Not f.OpenRead(path) Then Exit Sub + + Else + + Exit Sub + + End If + + Catch ex As Exception + Exit Sub + + End Try + + Try + lM = New List(Of Single) + lup = New List(Of Single) + ldown = New List(Of Single) + + Do While Not f.EndOfFile + line = f.ReadLine + lM.Add(CSng(line(0))) + lup.Add(CSng(line(1))) + ldown.Add(CSng(line(2))) + Loop + + f.Close() + + Catch ex As Exception + f.Close() + Exit Sub + End Try + + If lM.Count < 2 Then Exit Sub + + 'Create plot + MyChart = New System.Windows.Forms.DataVisualization.Charting.Chart + MyChart.Width = Me.PicBox.Width + MyChart.Height = Me.PicBox.Height + + a = New System.Windows.Forms.DataVisualization.Charting.ChartArea + + s = New System.Windows.Forms.DataVisualization.Charting.Series + s.Points.DataBindXY(lup, lM) + s.ChartType = DataVisualization.Charting.SeriesChartType.FastLine + s.BorderWidth = 2 + s.Color = Color.DarkRed + s.Name = "Upshift curve" + MyChart.Series.Add(s) + + s = New System.Windows.Forms.DataVisualization.Charting.Series + s.Points.DataBindXY(ldown, lM) + s.ChartType = DataVisualization.Charting.SeriesChartType.FastLine + s.BorderWidth = 2 + s.Color = Color.DarkRed + s.Name = "Downshift curve" + MyChart.Series.Add(s) + + a.Name = "main" + + a.AxisX.Title = "engine speed [1/min]" + a.AxisX.TitleFont = New Font("Helvetica", 10) + a.AxisX.LabelStyle.Font = New Font("Helvetica", 8) + a.AxisX.LabelAutoFitStyle = DataVisualization.Charting.LabelAutoFitStyles.None + a.AxisX.MajorGrid.LineDashStyle = DataVisualization.Charting.ChartDashStyle.Dot + + a.AxisY.Title = "engine torque [Nm]" + a.AxisY.TitleFont = New Font("Helvetica", 10) + a.AxisY.LabelStyle.Font = New Font("Helvetica", 8) + a.AxisY.LabelAutoFitStyle = DataVisualization.Charting.LabelAutoFitStyles.None + a.AxisY.MajorGrid.LineDashStyle = DataVisualization.Charting.ChartDashStyle.Dot + + a.AxisX.Minimum = 300 + a.BorderDashStyle = DataVisualization.Charting.ChartDashStyle.Solid + a.BorderWidth = 1 + + a.BackColor = Color.GhostWhite + + MyChart.ChartAreas.Add(a) + + MyChart.Titles.Add("Gear " & Gear & " shift polygons") + MyChart.Titles(0).Font = New Font("Helvetica", 12) + + MyChart.Update() + + img = New Bitmap(MyChart.Width, MyChart.Height, Imaging.PixelFormat.Format32bppArgb) + MyChart.DrawToBitmap(img, New Rectangle(0, 0, Me.PicBox.Width, Me.PicBox.Height)) + + Me.PicBox.Image = img + + + End Sub + + + #Region "Torque Converter" 'TC on/off @@ -657,11 +776,8 @@ 'Browse TC file Private Sub BtTCfileBrowse_Click(sender As System.Object, e As System.EventArgs) Handles BtTCfileBrowse.Click - Dim fb As cFileBrowser - fb = New cFileBrowser("TCfile", False, True) - fb.Extensions = New String() {"vtcc"} - If fb.OpenDialog(fFileRepl(Me.TbTCfile.Text, fPATH(GbxFile))) Then - Me.TbTCfile.Text = fFileWoDir(fb.Files(0), fPATH(GbxFile)) + If fbTCC.OpenDialog(fFileRepl(Me.TbTCfile.Text, fPATH(GbxFile))) Then + Me.TbTCfile.Text = fFileWoDir(fbTCC.Files(0), fPATH(GbxFile)) End If End Sub @@ -695,6 +811,5 @@ #End Region - End Class diff --git a/VECTO/GUI/F_VEH_GearDlog.Designer.vb b/VECTO/GUI/F_GBX_GearDlog.Designer.vb similarity index 76% rename from VECTO/GUI/F_VEH_GearDlog.Designer.vb rename to VECTO/GUI/F_GBX_GearDlog.Designer.vb index 0fc8f275082961bfb26692d29a15647176b150bd..12eb5b715cbccddfdad42e5b3909cb6574a5657b 100644 --- a/VECTO/GUI/F_VEH_GearDlog.Designer.vb +++ b/VECTO/GUI/F_GBX_GearDlog.Designer.vb @@ -1,5 +1,5 @@ <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ -Partial Class F_VEH_GearDlog +Partial Class F_GBX_GearDlog Inherits System.Windows.Forms.Form 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. @@ -34,7 +34,12 @@ Partial Class F_VEH_GearDlog Me.BtBrowse = New System.Windows.Forms.Button() Me.BtNext = New System.Windows.Forms.Button() Me.ChIsTCgear = New System.Windows.Forms.CheckBox() + Me.TbShiftPolyFile = New System.Windows.Forms.TextBox() + Me.BtShiftPolyBrowse = New System.Windows.Forms.Button() + Me.Label4 = New System.Windows.Forms.Label() + Me.PnShiftPoly = New System.Windows.Forms.Panel() Me.TableLayoutPanel1.SuspendLayout() + Me.PnShiftPoly.SuspendLayout() Me.SuspendLayout() ' 'TableLayoutPanel1 @@ -45,7 +50,7 @@ Partial Class F_VEH_GearDlog Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) Me.TableLayoutPanel1.Controls.Add(Me.OK_Button, 0, 0) Me.TableLayoutPanel1.Controls.Add(Me.Cancel_Button, 1, 0) - Me.TableLayoutPanel1.Location = New System.Drawing.Point(380, 89) + Me.TableLayoutPanel1.Location = New System.Drawing.Point(380, 146) Me.TableLayoutPanel1.Name = "TableLayoutPanel1" Me.TableLayoutPanel1.RowCount = 1 Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) @@ -135,7 +140,7 @@ Partial Class F_VEH_GearDlog 'BtNext ' Me.BtNext.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) - Me.BtNext.Location = New System.Drawing.Point(307, 92) + Me.BtNext.Location = New System.Drawing.Point(307, 149) Me.BtNext.Name = "BtNext" Me.BtNext.Size = New System.Drawing.Size(67, 23) Me.BtNext.TabIndex = 9 @@ -152,13 +157,50 @@ Partial Class F_VEH_GearDlog Me.ChIsTCgear.Text = "Torque Conveter active (lock-up clutch open)" Me.ChIsTCgear.UseVisualStyleBackColor = True ' - 'F_VEH_GearDlog + 'TbShiftPolyFile + ' + Me.TbShiftPolyFile.Location = New System.Drawing.Point(2, 17) + Me.TbShiftPolyFile.Name = "TbShiftPolyFile" + Me.TbShiftPolyFile.Size = New System.Drawing.Size(476, 20) + Me.TbShiftPolyFile.TabIndex = 12 + ' + 'BtShiftPolyBrowse + ' + Me.BtShiftPolyBrowse.Location = New System.Drawing.Point(484, 15) + Me.BtShiftPolyBrowse.Name = "BtShiftPolyBrowse" + Me.BtShiftPolyBrowse.Size = New System.Drawing.Size(32, 23) + Me.BtShiftPolyBrowse.TabIndex = 13 + Me.BtShiftPolyBrowse.TabStop = False + Me.BtShiftPolyBrowse.Text = "..." + Me.BtShiftPolyBrowse.UseVisualStyleBackColor = True + ' + 'Label4 + ' + Me.Label4.AutoSize = True + Me.Label4.Location = New System.Drawing.Point(2, 1) + Me.Label4.Name = "Label4" + Me.Label4.Size = New System.Drawing.Size(89, 13) + Me.Label4.TabIndex = 11 + Me.Label4.Text = "Shift polygons file" + ' + 'PnShiftPoly + ' + Me.PnShiftPoly.Controls.Add(Me.TbShiftPolyFile) + Me.PnShiftPoly.Controls.Add(Me.BtShiftPolyBrowse) + Me.PnShiftPoly.Controls.Add(Me.Label4) + Me.PnShiftPoly.Location = New System.Drawing.Point(10, 90) + Me.PnShiftPoly.Name = "PnShiftPoly" + Me.PnShiftPoly.Size = New System.Drawing.Size(525, 46) + Me.PnShiftPoly.TabIndex = 14 + ' + 'F_GBX_GearDlog ' Me.AcceptButton = Me.OK_Button Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.CancelButton = Me.Cancel_Button - Me.ClientSize = New System.Drawing.Size(538, 130) + Me.ClientSize = New System.Drawing.Size(538, 187) + Me.Controls.Add(Me.PnShiftPoly) Me.Controls.Add(Me.ChIsTCgear) Me.Controls.Add(Me.BtNext) Me.Controls.Add(Me.BtBrowse) @@ -172,11 +214,13 @@ Partial Class F_VEH_GearDlog Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog Me.MaximizeBox = False Me.MinimizeBox = False - Me.Name = "F_VEH_GearDlog" + Me.Name = "F_GBX_GearDlog" Me.ShowInTaskbar = False Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent Me.Text = "Edit Gears" Me.TableLayoutPanel1.ResumeLayout(False) + Me.PnShiftPoly.ResumeLayout(False) + Me.PnShiftPoly.PerformLayout() Me.ResumeLayout(False) Me.PerformLayout() @@ -193,5 +237,9 @@ Partial Class F_VEH_GearDlog Friend WithEvents BtBrowse As System.Windows.Forms.Button Friend WithEvents BtNext As System.Windows.Forms.Button Friend WithEvents ChIsTCgear As System.Windows.Forms.CheckBox + Friend WithEvents TbShiftPolyFile As System.Windows.Forms.TextBox + Friend WithEvents BtShiftPolyBrowse As System.Windows.Forms.Button + Friend WithEvents Label4 As System.Windows.Forms.Label + Friend WithEvents PnShiftPoly As System.Windows.Forms.Panel End Class diff --git a/VECTO/GUI/F_VEH_GearDlog.resx b/VECTO/GUI/F_GBX_GearDlog.resx similarity index 100% rename from VECTO/GUI/F_VEH_GearDlog.resx rename to VECTO/GUI/F_GBX_GearDlog.resx diff --git a/VECTO/GUI/F_VEH_GearDlog.vb b/VECTO/GUI/F_GBX_GearDlog.vb similarity index 62% rename from VECTO/GUI/F_VEH_GearDlog.vb rename to VECTO/GUI/F_GBX_GearDlog.vb index 3a41344b89d450016f1797617ac54ee3d0b12a13..2a3d60d54649ae2fdd89d6db4b7c0099f7332a4f 100644 --- a/VECTO/GUI/F_VEH_GearDlog.vb +++ b/VECTO/GUI/F_GBX_GearDlog.vb @@ -1,10 +1,15 @@ Imports System.Windows.Forms -Public Class F_VEH_GearDlog +''' <summary> +''' Gear Editor (Vehicle Editor sub-dialog) +''' </summary> +''' <remarks></remarks> +Public Class F_GBX_GearDlog Public NextGear As Boolean Public GbxPath As String + 'Save and Close Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click If Not IsNumeric(Me.TbRatio.Text) Then @@ -19,12 +24,14 @@ Public Class F_VEH_GearDlog Me.Close() End Sub + 'Cancel Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click NextGear = False Me.DialogResult = System.Windows.Forms.DialogResult.Cancel Me.Close() End Sub + 'Next Gear button - Close dialog and open for next gear Private Sub BtNext_Click(sender As System.Object, e As System.EventArgs) Handles BtNext.Click If Not IsNumeric(Me.TbRatio.Text) Then @@ -39,11 +46,17 @@ Public Class F_VEH_GearDlog Me.Close() End Sub + 'Browse for transmission loss map Private Sub BtBrowse_Click(sender As System.Object, e As System.EventArgs) Handles BtBrowse.Click - Dim fb As cFileBrowser - fb = New cFileBrowser("GetrMap", False, True) - If fb.OpenDialog(fFileRepl(Me.TbMapPath.Text, GbxPath)) Then - Me.TbMapPath.Text = fFileWoDir(fb.Files(0), GbxPath) + If fbTLM.OpenDialog(fFileRepl(Me.TbMapPath.Text, GbxPath)) Then + Me.TbMapPath.Text = fFileWoDir(fbTLM.Files(0), GbxPath) + End If + End Sub + + 'Browse for shift polygons file + Private Sub BtShiftPolyBrowse_Click(sender As System.Object, e As System.EventArgs) Handles BtShiftPolyBrowse.Click + If fbGBS.OpenDialog(fFileRepl(Me.TbShiftPolyFile.Text, GbxPath)) Then + Me.TbShiftPolyFile.Text = fFileWoDir(fbGBS.Files(0), GbxPath) End If End Sub diff --git a/VECTO/GUI/F_Graph.Designer.vb b/VECTO/GUI/F_Graph.Designer.vb new file mode 100644 index 0000000000000000000000000000000000000000..8e1780ed1393d5b223ec112d3b061d11c9e35b78 --- /dev/null +++ b/VECTO/GUI/F_Graph.Designer.vb @@ -0,0 +1,286 @@ +<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ +Partial Class F_Graph + Inherits System.Windows.Forms.Form + + 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. + <System.Diagnostics.DebuggerNonUserCode()> _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Wird vom Windows Form-Designer benötigt. + Private components As System.ComponentModel.IContainer + + 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. + 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. + 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. + <System.Diagnostics.DebuggerStepThrough()> _ + Private Sub InitializeComponent() + Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(F_Graph)) + Me.PictureBox1 = New System.Windows.Forms.PictureBox() + Me.GroupBox1 = New System.Windows.Forms.GroupBox() + Me.BtRemCh = New System.Windows.Forms.Button() + Me.BtAddCh = New System.Windows.Forms.Button() + Me.ListView1 = New System.Windows.Forms.ListView() + Me.ColumnHeader1 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) + Me.ColumnHeader2 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) + Me.ColumnHeader3 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) + Me.GroupBox2 = New System.Windows.Forms.GroupBox() + Me.CbXaxis = New System.Windows.Forms.ComboBox() + Me.GroupBox3 = New System.Windows.Forms.GroupBox() + Me.GroupBox4 = New System.Windows.Forms.GroupBox() + Me.ToolStrip1 = New System.Windows.Forms.ToolStrip() + Me.ToolStripBtOpen = New System.Windows.Forms.ToolStripButton() + Me.ToolStripButton2 = New System.Windows.Forms.ToolStripButton() + Me.ToolStripSeparator1 = New System.Windows.Forms.ToolStripSeparator() + Me.ToolStripButton1 = New System.Windows.Forms.ToolStripButton() + Me.BtZoomIn = New System.Windows.Forms.Button() + Me.BtZoomOut = New System.Windows.Forms.Button() + Me.BtLeft = New System.Windows.Forms.Button() + Me.BtRight = New System.Windows.Forms.Button() + CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit() + Me.GroupBox1.SuspendLayout() + Me.GroupBox2.SuspendLayout() + Me.ToolStrip1.SuspendLayout() + Me.SuspendLayout() + ' + 'PictureBox1 + ' + Me.PictureBox1.BackColor = System.Drawing.Color.LightGray + Me.PictureBox1.Location = New System.Drawing.Point(262, 28) + Me.PictureBox1.Name = "PictureBox1" + Me.PictureBox1.Size = New System.Drawing.Size(984, 208) + Me.PictureBox1.TabIndex = 0 + Me.PictureBox1.TabStop = False + ' + 'GroupBox1 + ' + Me.GroupBox1.Controls.Add(Me.BtRemCh) + Me.GroupBox1.Controls.Add(Me.BtAddCh) + Me.GroupBox1.Controls.Add(Me.ListView1) + Me.GroupBox1.Location = New System.Drawing.Point(12, 28) + Me.GroupBox1.Name = "GroupBox1" + Me.GroupBox1.Size = New System.Drawing.Size(244, 237) + Me.GroupBox1.TabIndex = 1 + Me.GroupBox1.TabStop = False + Me.GroupBox1.Text = "Channels" + ' + 'BtRemCh + ' + Me.BtRemCh.Image = Global.VECTO.My.Resources.Resources.minus_circle_icon + Me.BtRemCh.Location = New System.Drawing.Point(43, 209) + Me.BtRemCh.Name = "BtRemCh" + Me.BtRemCh.Size = New System.Drawing.Size(29, 23) + Me.BtRemCh.TabIndex = 4 + Me.BtRemCh.UseVisualStyleBackColor = True + ' + 'BtAddCh + ' + Me.BtAddCh.Image = Global.VECTO.My.Resources.Resources.plus_circle_icon + Me.BtAddCh.Location = New System.Drawing.Point(6, 209) + Me.BtAddCh.Name = "BtAddCh" + Me.BtAddCh.Size = New System.Drawing.Size(29, 23) + Me.BtAddCh.TabIndex = 3 + Me.BtAddCh.UseVisualStyleBackColor = True + ' + 'ListView1 + ' + Me.ListView1.BackColor = System.Drawing.Color.GhostWhite + Me.ListView1.CheckBoxes = True + Me.ListView1.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader1, Me.ColumnHeader2, Me.ColumnHeader3}) + Me.ListView1.FullRowSelect = True + Me.ListView1.GridLines = True + Me.ListView1.Location = New System.Drawing.Point(6, 19) + Me.ListView1.Name = "ListView1" + Me.ListView1.Size = New System.Drawing.Size(232, 184) + Me.ListView1.TabIndex = 0 + Me.ListView1.UseCompatibleStateImageBehavior = False + Me.ListView1.View = System.Windows.Forms.View.Details + ' + 'ColumnHeader1 + ' + Me.ColumnHeader1.Text = "Channel" + Me.ColumnHeader1.Width = 121 + ' + 'ColumnHeader2 + ' + Me.ColumnHeader2.Text = "Unit" + Me.ColumnHeader2.Width = 45 + ' + 'ColumnHeader3 + ' + Me.ColumnHeader3.Text = "Y Axis" + Me.ColumnHeader3.Width = 42 + ' + 'GroupBox2 + ' + Me.GroupBox2.Controls.Add(Me.CbXaxis) + Me.GroupBox2.Location = New System.Drawing.Point(16, 309) + Me.GroupBox2.Name = "GroupBox2" + Me.GroupBox2.Size = New System.Drawing.Size(146, 101) + Me.GroupBox2.TabIndex = 4 + Me.GroupBox2.TabStop = False + Me.GroupBox2.Text = "X Axis" + ' + 'CbXaxis + ' + Me.CbXaxis.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.CbXaxis.FormattingEnabled = True + Me.CbXaxis.Items.AddRange(New Object() {"Distance", "Time"}) + Me.CbXaxis.Location = New System.Drawing.Point(6, 19) + Me.CbXaxis.Name = "CbXaxis" + Me.CbXaxis.Size = New System.Drawing.Size(121, 21) + Me.CbXaxis.TabIndex = 0 + ' + 'GroupBox3 + ' + Me.GroupBox3.Location = New System.Drawing.Point(222, 310) + Me.GroupBox3.Name = "GroupBox3" + Me.GroupBox3.Size = New System.Drawing.Size(200, 100) + Me.GroupBox3.TabIndex = 4 + Me.GroupBox3.TabStop = False + Me.GroupBox3.Text = "Left Y Axis" + ' + 'GroupBox4 + ' + Me.GroupBox4.Location = New System.Drawing.Point(428, 310) + Me.GroupBox4.Name = "GroupBox4" + Me.GroupBox4.Size = New System.Drawing.Size(200, 100) + Me.GroupBox4.TabIndex = 4 + Me.GroupBox4.TabStop = False + Me.GroupBox4.Text = "Right Y Axis" + ' + 'ToolStrip1 + ' + Me.ToolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden + Me.ToolStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripBtOpen, Me.ToolStripButton2, Me.ToolStripSeparator1, Me.ToolStripButton1}) + Me.ToolStrip1.Location = New System.Drawing.Point(0, 0) + Me.ToolStrip1.Name = "ToolStrip1" + Me.ToolStrip1.Size = New System.Drawing.Size(1258, 25) + Me.ToolStrip1.TabIndex = 31 + Me.ToolStrip1.Text = "ToolStrip1" + ' + 'ToolStripBtOpen + ' + Me.ToolStripBtOpen.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image + Me.ToolStripBtOpen.Image = Global.VECTO.My.Resources.Resources.Open_icon + Me.ToolStripBtOpen.ImageTransparentColor = System.Drawing.Color.Magenta + Me.ToolStripBtOpen.Name = "ToolStripBtOpen" + Me.ToolStripBtOpen.Size = New System.Drawing.Size(23, 22) + Me.ToolStripBtOpen.Text = "ToolStripButton1" + Me.ToolStripBtOpen.ToolTipText = "Open..." + ' + 'ToolStripButton2 + ' + Me.ToolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image + Me.ToolStripButton2.Image = Global.VECTO.My.Resources.Resources.Refresh_icon + Me.ToolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta + Me.ToolStripButton2.Name = "ToolStripButton2" + Me.ToolStripButton2.Size = New System.Drawing.Size(23, 22) + Me.ToolStripButton2.Text = "ToolStripButton2" + ' + 'ToolStripSeparator1 + ' + Me.ToolStripSeparator1.Name = "ToolStripSeparator1" + Me.ToolStripSeparator1.Size = New System.Drawing.Size(6, 25) + ' + 'ToolStripButton1 + ' + Me.ToolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image + Me.ToolStripButton1.Image = Global.VECTO.My.Resources.Resources.Help_icon + Me.ToolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta + Me.ToolStripButton1.Name = "ToolStripButton1" + Me.ToolStripButton1.Size = New System.Drawing.Size(23, 22) + Me.ToolStripButton1.Text = "Help" + ' + 'BtZoomIn + ' + Me.BtZoomIn.Location = New System.Drawing.Point(634, 242) + Me.BtZoomIn.Name = "BtZoomIn" + Me.BtZoomIn.Size = New System.Drawing.Size(75, 23) + Me.BtZoomIn.TabIndex = 32 + Me.BtZoomIn.Text = "In" + Me.BtZoomIn.UseVisualStyleBackColor = True + ' + 'BtZoomOut + ' + Me.BtZoomOut.Location = New System.Drawing.Point(715, 242) + Me.BtZoomOut.Name = "BtZoomOut" + Me.BtZoomOut.Size = New System.Drawing.Size(75, 23) + Me.BtZoomOut.TabIndex = 32 + Me.BtZoomOut.Text = "Out" + Me.BtZoomOut.UseVisualStyleBackColor = True + ' + 'BtLeft + ' + Me.BtLeft.Location = New System.Drawing.Point(262, 242) + Me.BtLeft.Name = "BtLeft" + Me.BtLeft.Size = New System.Drawing.Size(180, 23) + Me.BtLeft.TabIndex = 33 + Me.BtLeft.Text = "<" + Me.BtLeft.UseVisualStyleBackColor = True + ' + 'BtRight + ' + Me.BtRight.Location = New System.Drawing.Point(448, 242) + Me.BtRight.Name = "BtRight" + Me.BtRight.Size = New System.Drawing.Size(180, 23) + Me.BtRight.TabIndex = 33 + Me.BtRight.Text = ">" + Me.BtRight.UseVisualStyleBackColor = True + ' + 'F_Graph + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(1258, 454) + Me.Controls.Add(Me.BtRight) + Me.Controls.Add(Me.BtLeft) + Me.Controls.Add(Me.BtZoomOut) + Me.Controls.Add(Me.BtZoomIn) + Me.Controls.Add(Me.ToolStrip1) + Me.Controls.Add(Me.GroupBox4) + Me.Controls.Add(Me.GroupBox3) + Me.Controls.Add(Me.GroupBox2) + Me.Controls.Add(Me.GroupBox1) + Me.Controls.Add(Me.PictureBox1) + Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) + Me.Name = "F_Graph" + Me.Text = "Graph" + CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit() + Me.GroupBox1.ResumeLayout(False) + Me.GroupBox2.ResumeLayout(False) + Me.ToolStrip1.ResumeLayout(False) + Me.ToolStrip1.PerformLayout() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox + Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox + Friend WithEvents ListView1 As System.Windows.Forms.ListView + Friend WithEvents BtRemCh As System.Windows.Forms.Button + Friend WithEvents BtAddCh As System.Windows.Forms.Button + Friend WithEvents ColumnHeader1 As System.Windows.Forms.ColumnHeader + Friend WithEvents ColumnHeader2 As System.Windows.Forms.ColumnHeader + Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox + Friend WithEvents GroupBox3 As System.Windows.Forms.GroupBox + Friend WithEvents GroupBox4 As System.Windows.Forms.GroupBox + Friend WithEvents ToolStrip1 As System.Windows.Forms.ToolStrip + Friend WithEvents ToolStripBtOpen As System.Windows.Forms.ToolStripButton + Friend WithEvents ToolStripSeparator1 As System.Windows.Forms.ToolStripSeparator + Friend WithEvents ToolStripButton1 As System.Windows.Forms.ToolStripButton + Friend WithEvents ToolStripButton2 As System.Windows.Forms.ToolStripButton + Friend WithEvents CbXaxis As System.Windows.Forms.ComboBox + Friend WithEvents ColumnHeader3 As System.Windows.Forms.ColumnHeader + Friend WithEvents BtZoomIn As System.Windows.Forms.Button + Friend WithEvents BtZoomOut As System.Windows.Forms.Button + Friend WithEvents BtLeft As System.Windows.Forms.Button + Friend WithEvents BtRight As System.Windows.Forms.Button +End Class diff --git a/VECTO/GUI/F_Graph.resx b/VECTO/GUI/F_Graph.resx new file mode 100644 index 0000000000000000000000000000000000000000..00d5747812b4f7179bf229f0ebf34d438a04312a --- /dev/null +++ b/VECTO/GUI/F_Graph.resx @@ -0,0 +1,200 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <metadata name="ToolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> + <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> + <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value> + AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP39 + /QLg6NsG/v7+Av///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD+/v4B1uDQEIildi319/MQ////Af///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP7+/gudtI5FRHEmhMbUvS7+/v4C////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8B7PDpJmOJS5s4aBnEjal8Wf39/A////8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP7+/ga3ya0+PGsexzdnGO9Vfjut4OfcLP///wL///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8B+vv6Fn+ea3E2ZhfeN2cY/DhnGc+nvJpJ/v7+Cf// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP/+/gLU3s0vSHQstTZmF/Y2Zhf+NmYX6G2Q + V4zy9fAg////Af///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A/v7+DJqyilI1ZhbTNmYW/TZm + F/82Zhf5P20hwMDPtzj+/v4E////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wLr7+cpX4ZFpTVm + FfA2ZhX/NmYW/zZmFv42ZhfZh6N0ZPz9/BL+/v4B////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A/v7+B7TG + qEI6ahnMNmcV/DZnFf82ZhX/NmYV/zVlF/RPeTOw2+TWLf7+/gL///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wH4+vgZeppleTVmFOE2ZxX+NmcV/zZnFf82ZhX/NmYV/TZmFtGhuJNO/v7+Cv///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A/v7+As/byDBGcyi3NWYU9zVmFP82ZxX/NmcV/zZnFf82ZxX+NWYV7GeMT5fv8+0k////Af// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD+/v4Mlq+FVDRlE9Q1ZhT9NWYU/zVmFP82ZxX/NmcV/zZnFf82ZxX7PWwdxbzM + sTz+/v4F////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////Auju5Stbg0GqNWUU8jVmFP81ZhT/NWYU/zVmFP82ZxX/NmcV/zZn + Ff41ZhTdgqBubfv8+hX///8B////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD+/v4HscOlRThoGM41ZhT9NWYU/zVmFP81ZhT/NWYU/zVm + FP82ZxX/NmcV/zVmFPVLdy6z1+DQL/7+/gL///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////Afj59xt2l2F+NGUT4zVmFP41ZhT/NWYU/zVm + FP81ZhT/NWYU/zVmFP82ZxX/NmcV/TVmFdOctI1R/v7+C////wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD+/v4CzdnFMURxJbo1ZhT4NWYU/zVm + FP81ZhT/NWYU/zVmFP81ZhT/NWYU/zVmFP82ZxX/NWYU7mKISZ/s8ekn////Af///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP7+/gyUroNUNGUT1DVm + FP01ZhT/NWYU/zVmFP81ZhT/NWYU/zVmFP81ZhT/NWYU/zVmFP82ZxX8O2obybfIq0L+/v4I/v7+Av39 + /QL9/v0C/f79Av3+/QL9/v0C/f79Av3+/QL9/v0C/f79Av///wD///8A////AP///wD///8C5uziK1mB + Pqs0ZRPzNWYU/zVmFP81ZhT/NWYU/zVmFP81ZhT/NWYU/zVmFP81ZhT/NWYU/zZnFf41ZhThepplhNTe + zUPZ4tM12eLTNdni0zXZ4tM12eLTNdni1DXZ4tQ12eLUNdrj1DXa49U1////AP///wD///8A////AP7+ + /givwqJGN2cWzjVmFP01ZhT/NWYU/zVmFP81ZhT/NGYT/zVmFP41ZhT/NWYU/zVmFP81ZhT/NWYU/zZn + Ffg1ZhThRHImz0RxJspEcSfKRXEoykVyKMpFcinKRnMqykd0K8pIdCvKSXUsykt3Lsr///8A////AP// + /wD//v8B9vj1HXSWXoM0ZRPlNWYU/jVmFP81ZhT/NWYU/zVmFP82ZhX0U3w34DRlE/Q1ZhT/NWYU/zVm + FP81ZhT/NWYU/zZnFf42ZxX9NmYV/TZmFv02Zhf9NmYX/TdnGP03Zxj9OWgZ/TppGv06ahv9PGwd/f// + /wD///8A////AP7//gLK1sIyQnAkuzRlE/g1ZhT/NWYU/zVmFP81ZhT/NWYU+0dzKc2gt5GGP24g0zVm + FP01ZhT/NWYU/zVmFP81ZhT/NmcV/zZnFf82ZxX/NmYW/zZmF/82Zhf/N2cY/zdnGP84aBn/Omka/zpq + G/87axz/////AP///wD///8A/f79DY+qflc0ZRPVNWYU/TVmFP81ZhT/NWYU/zVmFP41ZRTraY1RluLp + 3k1fhkWnNGUT8TVmFP81ZhT/NWYU/zVmFP81ZhT/NmcV/zZnFf82ZhX/NmYW/zZmF/83Zxf/N2cY/zho + Gf85aRr/Omob/ztrHP////8A////AP///gLj6t8rVn88rDRlFPM1ZhT/NWYU/zVmFP81ZhT/NWYU/jRl + E9KWr4VN/f39F5CqflU0ZRPVNWYU/jVmFP81ZhT/NWYU/zVmFP82ZxX/NmcV/zZmFf82Zhb/NmYX/zZm + F/83Zxj/N2cY/zlpGv86ahv/O2sc/////wD///8A/v7+CKzAn0c3ZxbPNWYU/TVmFP81ZhT/NWYU/zVm + FP81ZhT9PWwdycPSujb+/v4EwtC4Nz1sHco1ZhT9NWYU/zVmFP81ZhT/NWYU/zZnFf82ZxX/NmYV/zZm + Fv82Zhf/NmYX/zdnGP83Zxj/OWka/zpqG/86ahv/////AP///wH1+PQecpRchjRlE+Y1ZhT+NWYU/zVm + FP81ZhT/NWYU/zVmFPZXgDyz6e7mLv///wPp7uYsWYE+rzVmFPQ1ZhT/NWYU/zVmFP81ZhT/NmcV/zZn + Ff82ZhT/NmYV/zZmF/82Zhf/N2cX/zdnGP85aRr/Omob/zpqG/////8A/v7+AsjVvzFBbyK6NGUU9jVm + FP01ZhT9NWYU/TVmFP01ZhT8NGUT3IGgbW78/PwW////Af39/RGJpXZiNGUT2DVmFPw1ZhT9NGUT/TVm + FP02ZxX9NmcV/TZmFf02ZhX9NmYX/TZmF/03Zxf9N2cY/ThoGf06aRr9Omob/f///wD9/v0Dj6p9LjZn + FaE2ZxXINmcVyjZnFco2ZxXKNmcVyjZnFck4aBijr8KiNP7+/gX///8A/v7+A7rKrzA7ahuiNmcVyTZn + Fco2ZxXKN2cWyjdoFso3aBbKN2gWyjdnF8o3ZxjKOGcZyjhoGco5aBrKOmobyjtrHMo8ax3K////APr7 + +gHB0LcMscSkKrHEpDWxxKQ1scSkNbHEpDWxxKQ1scSkNbTGqCru8uwM///+Af///wD///8A8/bxC7bH + qiqxxKQ1scSkNbHEpDWxxKQ1scSlNbHEpTWxxKU1scSlNbHEpTWxxKU1scSmNbLEpjWyxaY1s8WnNbPF + pzX5+vgA////AP///wD///8C////Av///wL///8C////Av///wL///8C////Av///wD///8A////AP// + /wD///8A////Av///wL///8C////Av///wL///8C////Av///wL///8C////Av///wL///8C////Av// + /wL///8C////Av///wD4+vcA+Pr3APj69wD9/fwA////APj69wD4+vcA+Pr3APj69wD4+vcA+fr4APn6 + +AD5+vgA+fr4APn7+QD6+/kA+/v6APv7+wD7/PsA/Pz8AP39/AD9/v0A/v/+APr6+gD6+voA+vr6APr6 + +gD6+voA////AP///wD///8A//////////////////v////z////8f////H////g////4P///8D////A + f///wH///4A///+AP///AD///wAf//8AH//+AA///gAP//wAB//8AAAA+AAAAPgAAAD4BAAA8A4AAPAO + AADgDgAA4B8AAOAfAAD///////////////8= +</value> + </data> +</root> \ No newline at end of file diff --git a/VECTO/GUI/F_Graph.vb b/VECTO/GUI/F_Graph.vb new file mode 100644 index 0000000000000000000000000000000000000000..ff74ec38fbc7d40de7b635cafa5742a590d7f919 --- /dev/null +++ b/VECTO/GUI/F_Graph.vb @@ -0,0 +1,485 @@ +Imports System.Collections.Generic + +Public Class F_Graph + + Private Filepath As String + Private Channels As List(Of cChannel) + Private DistList As List(Of Single) + Private TimeList As List(Of Single) + + Private xMin As Single? + Private xMax As Single? + + Private xMax0 As Single + + + Public Sub New() + + ' Dieser Aufruf ist für den Designer erforderlich. + InitializeComponent() + + ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu. + Channels = New List(Of cChannel) + + Clear() + + Me.CbXaxis.SelectedIndex = 0 + + + End Sub + + Private Sub ToolStripBtOpen_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripBtOpen.Click + + If fbVMOD.OpenDialog(Filepath) Then + + Clear() + + Filepath = fbVMOD.Files(0) + + LoadFile() + + End If + + End Sub + + Private Sub LoadFile() + Dim file As cFile_V3 + Dim i As Integer + Dim sDim As Integer + Dim line As String() + Dim c0 As cChannel + Dim l0 As List(Of String) + + + file = New cFile_V3 + + If file.OpenRead(Filepath) Then + + Try + + For i = 1 To 4 + file.ReadLine() + Next + + 'Header + line = file.ReadLine + + sDim = UBound(line) + + For i = 0 To sDim + c0 = New cChannel + c0.Name = line(i) + c0.Values = New List(Of String) + Channels.Add(c0) + Next + + 'Units + line = file.ReadLine + + For i = 0 To sDim + Channels(i).Unit = line(i) + Next + + 'Values + Do While Not file.EndOfFile + line = file.ReadLine + For i = 0 To sDim + Channels(i).Values.Add(line(i)) + Next + Loop + + file.Close() + + l0 = Channels(0).Values + TimeList = New List(Of Single) + For i = 0 To l0.Count - 1 + TimeList.Add(CSng(l0(i))) + Next + + l0 = Channels(1).Values + DistList = New List(Of Single) + For i = 0 To l0.Count - 1 + DistList.Add(CSng(l0(i))) + Next + + If Me.CbXaxis.SelectedIndex = 0 Then + xMax0 = DistList(DistList.Count - 1) + Else + xMax0 = TimeList(TimeList.Count - 1) + End If + + Catch ex As Exception + file.Close() + Exit Sub + End Try + + End If + + UpdateGraph() + + End Sub + + + Private Sub UpdateGraph() + Dim lv0 As ListViewItem + Dim MyChart As System.Windows.Forms.DataVisualization.Charting.Chart + Dim s As System.Windows.Forms.DataVisualization.Charting.Series + Dim a As System.Windows.Forms.DataVisualization.Charting.ChartArea + Dim OverDist As Boolean + Dim leftaxis As New List(Of String) + Dim rightaxis As New List(Of String) + Dim IsLeft As Boolean + Dim txt As String + Dim i As Integer + Dim img As Image + + If Me.ListView1.CheckedItems.Count = 0 Then + Me.PictureBox1.Image = Nothing + xMin = Nothing + xMax = Nothing + Exit Sub + End If + + OverDist = (Me.CbXaxis.SelectedIndex = 0) + + If OverDist Then + xMax0 = DistList(DistList.Count - 1) + Else + xMax0 = TimeList(TimeList.Count - 1) + End If + + + MyChart = New System.Windows.Forms.DataVisualization.Charting.Chart + MyChart.Width = Me.PictureBox1.Width + MyChart.Height = Me.PictureBox1.Height + + a = New System.Windows.Forms.DataVisualization.Charting.ChartArea + + + For Each lv0 In Me.ListView1.CheckedItems + + IsLeft = (lv0.SubItems(2).Text = "Left") + + s = New System.Windows.Forms.DataVisualization.Charting.Series + + If OverDist Then + s.Points.DataBindXY(DistList, Channels(lv0.Tag).Values) + Else + s.Points.DataBindXY(TimeList, Channels(lv0.Tag).Values) + End If + + s.ChartType = DataVisualization.Charting.SeriesChartType.FastLine + s.Name = lv0.Text + s.BorderWidth = 2 + + If IsLeft Then + If Not leftaxis.Contains(lv0.SubItems(1).Text) Then leftaxis.Add(lv0.SubItems(1).Text) + Else + If Not rightaxis.Contains(lv0.SubItems(1).Text) Then rightaxis.Add(lv0.SubItems(1).Text) + s.YAxisType = DataVisualization.Charting.AxisType.Secondary + End If + + MyChart.Series.Add(s) + + Next + + + a.Name = "main" + + If OverDist Then + a.AxisX.Title = "distance [km]" + Else + a.AxisX.Title = "time [s]" + End If + a.AxisX.TitleFont = New Font("Helvetica", 10) + a.AxisX.LabelStyle.Font = New Font("Helvetica", 8) + a.AxisX.LabelAutoFitStyle = DataVisualization.Charting.LabelAutoFitStyles.None + a.AxisX.MajorGrid.LineDashStyle = DataVisualization.Charting.ChartDashStyle.Dot + + If xMin Is Nothing Or xMax Is Nothing Then + xMin = 0 + If OverDist Then + xMax = DistList(DistList.Count - 1) + Else + xMax = TimeList(TimeList.Count - 1) + End If + End If + + a.AxisX.Minimum = xMin + a.AxisX.Maximum = xMax + + If leftaxis.Count > 0 Then + + txt = leftaxis(0) + For i = 1 To leftaxis.Count - 1 + txt &= ", " & leftaxis(i) + Next + + a.AxisY.Title = txt + a.AxisY.TitleFont = New Font("Helvetica", 10) + a.AxisY.LabelStyle.Font = New Font("Helvetica", 8) + a.AxisY.LabelAutoFitStyle = DataVisualization.Charting.LabelAutoFitStyles.None + + End If + + If rightaxis.Count > 0 Then + + txt = rightaxis(0) + For i = 1 To rightaxis.Count - 1 + txt &= ", " & rightaxis(i) + Next + + a.AxisY2.Title = txt + a.AxisY2.TitleFont = New Font("Helvetica", 10) + a.AxisY2.LabelStyle.Font = New Font("Helvetica", 8) + a.AxisY2.LabelAutoFitStyle = DataVisualization.Charting.LabelAutoFitStyles.None + a.AxisY2.MinorGrid.Enabled = False + a.AxisY2.MajorGrid.Enabled = False + + End If + + a.BackColor = Color.GhostWhite + + a.BorderDashStyle = DataVisualization.Charting.ChartDashStyle.Solid + a.BorderWidth = 1 + + MyChart.ChartAreas.Add(a) + + With MyChart.ChartAreas(0) + .Position.X = 0 + .Position.Y = 0 + .Position.Width = 85 + .Position.Height = 100 + End With + + MyChart.Legends.Add("main") + MyChart.Legends(0).Font = New Font("Helvetica", 8) + MyChart.Legends(0).BorderColor = Color.Black + MyChart.Legends(0).BorderWidth = 1 + MyChart.Legends(0).Position.X = 87 + MyChart.Legends(0).Position.Y = 3 + MyChart.Legends(0).Position.Width = 10 + MyChart.Legends(0).Position.Height = 40 + + MyChart.Update() + + img = New Bitmap(MyChart.Width, MyChart.Height, Imaging.PixelFormat.Format32bppArgb) + MyChart.DrawToBitmap(img, New Rectangle(0, 0, Me.PictureBox1.Width, Me.PictureBox1.Height)) + + Me.PictureBox1.Image = img + + End Sub + + + Private Sub Clear() + + Filepath = "" + + Me.ListView1.Items.Clear() + + Channels.Clear() + + xMin = Nothing + xMax = Nothing + + Me.PictureBox1.Image = Nothing + End Sub + + Private Class cChannel + Public Name As String + Public Unit As String + Public Values As List(Of String) + + End Class + + Private Sub BtAddCh_Click(sender As System.Object, e As System.EventArgs) Handles BtAddCh.Click + Dim dlog As New F_Graph_ChEdit + Dim i As Integer + Dim lv0 As ListViewItem + + If Channels.Count = 0 Then Exit Sub + + For i = 0 To Channels.Count - 1 + dlog.ComboBox1.Items.Add(Channels(i).Name & " " & Channels(i).Unit) + Next + + dlog.RbLeft.Checked = True + + dlog.ComboBox1.SelectedIndex = 0 + + If dlog.ShowDialog = Windows.Forms.DialogResult.OK Then + lv0 = New ListViewItem + i = dlog.ComboBox1.SelectedIndex + lv0.Text = Channels(i).Name + lv0.SubItems.Add(Channels(i).Unit) + lv0.Tag = i + lv0.Checked = True + If dlog.RbLeft.Checked Then + lv0.SubItems.Add("Left") + Else + lv0.SubItems.Add("Right") + End If + + Me.ListView1.Items.Add(lv0) + + UpdateGraph() + + End If + + End Sub + + Private Sub EditChannel() + Dim dlog As New F_Graph_ChEdit + Dim i As Integer + Dim lv0 As ListViewItem + + If Me.ListView1.SelectedItems.Count = 0 Or Channels.Count = 0 Then Exit Sub + + lv0 = Me.ListView1.SelectedItems(0) + + For i = 0 To Channels.Count - 1 + dlog.ComboBox1.Items.Add(Channels(i).Name & " " & Channels(i).Unit) + Next + + If lv0.SubItems(2).Text = "Left" Then + dlog.RbLeft.Checked = True + Else + dlog.RbRight.Checked = True + End If + + dlog.ComboBox1.SelectedIndex = lv0.Tag + + If dlog.ShowDialog = Windows.Forms.DialogResult.OK Then + i = dlog.ComboBox1.SelectedIndex + lv0.Text = Channels(i).Name + lv0.SubItems(1).Text = Channels(i).Unit + lv0.Tag = i + lv0.Checked = True + If dlog.RbLeft.Checked Then + lv0.SubItems(2).Text = "Left" + Else + lv0.SubItems(2).Text = "Right" + End If + + UpdateGraph() + + End If + + End Sub + + Private Sub RemoveChannel() + Dim i0 As Int16 + + If Me.ListView1.Items.Count = 0 Then Exit Sub + + If Me.ListView1.SelectedItems.Count = 0 Then Me.ListView1.Items(Me.ListView1.Items.Count - 1).Selected = True + + i0 = Me.ListView1.SelectedItems(0).Index + + Me.ListView1.SelectedItems(0).Remove() + + If i0 < Me.ListView1.Items.Count Then + Me.ListView1.Items(i0).Selected = True + Me.ListView1.Items(i0).EnsureVisible() + End If + + UpdateGraph() + + End Sub + + Private Sub ListView1_DoubleClick(sender As Object, e As System.EventArgs) Handles ListView1.DoubleClick + If Me.ListView1.SelectedItems.Count > 0 Then + Me.ListView1.SelectedItems(0).Checked = Not Me.ListView1.SelectedItems(0).Checked + EditChannel() + End If + End Sub + + Private Sub BtRemCh_Click(sender As System.Object, e As System.EventArgs) Handles BtRemCh.Click + RemoveChannel() + End Sub + + Private Sub ListView1_ItemChecked(sender As Object, e As System.Windows.Forms.ItemCheckedEventArgs) Handles ListView1.ItemChecked + UpdateGraph() + End Sub + + Private Sub ListView1_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles ListView1.KeyDown + Select Case e.KeyCode + Case Keys.Delete, Keys.Back + RemoveChannel() + Case Keys.Enter + EditChannel() + End Select + End Sub + + Private Sub CbXaxis_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles CbXaxis.SelectedIndexChanged + UpdateGraph() + End Sub + + + Private Sub BtZoomIn_Click(sender As System.Object, e As System.EventArgs) Handles BtZoomIn.Click + Dim d As Single + + If Channels.Count = 0 OrElse Me.ListView1.CheckedItems.Count = 0 Then Exit Sub + + d = (xMax - xMin) / 10 + + xMin += 2 * 0.5 * d + xMax -= 2 * (1 - 0.5) * d + + UpdateGraph() + + End Sub + + Private Sub BtZoomOut_Click(sender As System.Object, e As System.EventArgs) Handles BtZoomOut.Click + Dim d As Single + + If Channels.Count = 0 OrElse Me.ListView1.CheckedItems.Count = 0 Then Exit Sub + + d = (xMax - xMin) / 10 + + xMin -= 2 * 0.5 * d + xMax += 2 * (1 - 0.5) * d + + If Me.CbXaxis.SelectedIndex = 0 Then + xMax = Math.Min(CSng(xMax), DistList(DistList.Count - 1)) + Else + xMax = Math.Min(CSng(xMax), TimeList(TimeList.Count - 1)) + End If + + xMin = Math.Max(0, CSng(xMin)) + + UpdateGraph() + + End Sub + + + Private Sub BtLeft_Click(sender As System.Object, e As System.EventArgs) Handles BtLeft.Click + Dim d As Single + + d = (xMax - xMin) / 10 + + If xMin - d < 0 Then d = xMin + + xMin -= d + xMax -= d + + UpdateGraph() + + + End Sub + + Private Sub BtRight_Click(sender As System.Object, e As System.EventArgs) Handles BtRight.Click + Dim d As Single + + d = (xMax - xMin) / 10 + + If xMax + d > xMax0 Then d = xMax0 - xMax + + xMin += d + xMax += d + + UpdateGraph() + + + End Sub +End Class \ No newline at end of file diff --git a/VECTO/GUI/F_Graph_ChEdit.Designer.vb b/VECTO/GUI/F_Graph_ChEdit.Designer.vb new file mode 100644 index 0000000000000000000000000000000000000000..346ac497e15f75151a983b0df73fe6932f1b4a5c --- /dev/null +++ b/VECTO/GUI/F_Graph_ChEdit.Designer.vb @@ -0,0 +1,143 @@ +<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ +Partial Class F_Graph_ChEdit + Inherits System.Windows.Forms.Form + + 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. + <System.Diagnostics.DebuggerNonUserCode()> _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Wird vom Windows Form-Designer benötigt. + Private components As System.ComponentModel.IContainer + + 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. + 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. + 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. + <System.Diagnostics.DebuggerStepThrough()> _ + Private Sub InitializeComponent() + Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel() + Me.OK_Button = New System.Windows.Forms.Button() + Me.Cancel_Button = New System.Windows.Forms.Button() + Me.ComboBox1 = New System.Windows.Forms.ComboBox() + Me.GroupBox1 = New System.Windows.Forms.GroupBox() + Me.RbLeft = New System.Windows.Forms.RadioButton() + Me.RbRight = New System.Windows.Forms.RadioButton() + Me.TableLayoutPanel1.SuspendLayout() + Me.GroupBox1.SuspendLayout() + Me.SuspendLayout() + ' + 'TableLayoutPanel1 + ' + Me.TableLayoutPanel1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.TableLayoutPanel1.ColumnCount = 2 + Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) + Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) + Me.TableLayoutPanel1.Controls.Add(Me.OK_Button, 0, 0) + Me.TableLayoutPanel1.Controls.Add(Me.Cancel_Button, 1, 0) + Me.TableLayoutPanel1.Location = New System.Drawing.Point(58, 110) + Me.TableLayoutPanel1.Name = "TableLayoutPanel1" + Me.TableLayoutPanel1.RowCount = 1 + Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) + Me.TableLayoutPanel1.Size = New System.Drawing.Size(146, 29) + Me.TableLayoutPanel1.TabIndex = 0 + ' + 'OK_Button + ' + Me.OK_Button.Anchor = System.Windows.Forms.AnchorStyles.None + Me.OK_Button.Location = New System.Drawing.Point(3, 3) + Me.OK_Button.Name = "OK_Button" + Me.OK_Button.Size = New System.Drawing.Size(67, 23) + Me.OK_Button.TabIndex = 0 + Me.OK_Button.Text = "OK" + ' + 'Cancel_Button + ' + Me.Cancel_Button.Anchor = System.Windows.Forms.AnchorStyles.None + Me.Cancel_Button.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.Cancel_Button.Location = New System.Drawing.Point(76, 3) + Me.Cancel_Button.Name = "Cancel_Button" + Me.Cancel_Button.Size = New System.Drawing.Size(67, 23) + Me.Cancel_Button.TabIndex = 1 + Me.Cancel_Button.Text = "Abbrechen" + ' + 'ComboBox1 + ' + Me.ComboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.ComboBox1.FormattingEnabled = True + Me.ComboBox1.Location = New System.Drawing.Point(12, 12) + Me.ComboBox1.Name = "ComboBox1" + Me.ComboBox1.Size = New System.Drawing.Size(188, 21) + Me.ComboBox1.TabIndex = 1 + ' + 'GroupBox1 + ' + Me.GroupBox1.Controls.Add(Me.RbRight) + Me.GroupBox1.Controls.Add(Me.RbLeft) + Me.GroupBox1.Location = New System.Drawing.Point(12, 39) + Me.GroupBox1.Name = "GroupBox1" + Me.GroupBox1.Size = New System.Drawing.Size(188, 55) + Me.GroupBox1.TabIndex = 2 + Me.GroupBox1.TabStop = False + Me.GroupBox1.Text = "Y Axis" + ' + 'RbLeft + ' + Me.RbLeft.AutoSize = True + Me.RbLeft.Location = New System.Drawing.Point(16, 19) + Me.RbLeft.Name = "RbLeft" + Me.RbLeft.Size = New System.Drawing.Size(43, 17) + Me.RbLeft.TabIndex = 3 + Me.RbLeft.TabStop = True + Me.RbLeft.Text = "Left" + Me.RbLeft.UseVisualStyleBackColor = True + ' + 'RbRight + ' + Me.RbRight.AutoSize = True + Me.RbRight.Location = New System.Drawing.Point(80, 19) + Me.RbRight.Name = "RbRight" + Me.RbRight.Size = New System.Drawing.Size(50, 17) + Me.RbRight.TabIndex = 3 + Me.RbRight.TabStop = True + Me.RbRight.Text = "Right" + Me.RbRight.UseVisualStyleBackColor = True + ' + 'F_Graph_ChEdit + ' + Me.AcceptButton = Me.OK_Button + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.CancelButton = Me.Cancel_Button + Me.ClientSize = New System.Drawing.Size(216, 151) + Me.Controls.Add(Me.GroupBox1) + Me.Controls.Add(Me.ComboBox1) + Me.Controls.Add(Me.TableLayoutPanel1) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog + Me.MaximizeBox = False + Me.MinimizeBox = False + Me.Name = "F_Graph_ChEdit" + Me.ShowInTaskbar = False + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent + Me.Text = "Edit Channel" + Me.TableLayoutPanel1.ResumeLayout(False) + Me.GroupBox1.ResumeLayout(False) + Me.GroupBox1.PerformLayout() + Me.ResumeLayout(False) + + End Sub + Friend WithEvents TableLayoutPanel1 As System.Windows.Forms.TableLayoutPanel + Friend WithEvents OK_Button As System.Windows.Forms.Button + Friend WithEvents Cancel_Button As System.Windows.Forms.Button + Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox + Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox + Friend WithEvents RbRight As System.Windows.Forms.RadioButton + Friend WithEvents RbLeft As System.Windows.Forms.RadioButton + +End Class diff --git a/VECTO/GUI/F_Graph_ChEdit.resx b/VECTO/GUI/F_Graph_ChEdit.resx new file mode 100644 index 0000000000000000000000000000000000000000..29dcb1b3a353ba227f65e11fbe3d6f0766e84292 --- /dev/null +++ b/VECTO/GUI/F_Graph_ChEdit.resx @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root> \ No newline at end of file diff --git a/VECTO/GUI/F_Graph_ChEdit.vb b/VECTO/GUI/F_Graph_ChEdit.vb new file mode 100644 index 0000000000000000000000000000000000000000..0f4177047d511522101295fd63701c09509763eb --- /dev/null +++ b/VECTO/GUI/F_Graph_ChEdit.vb @@ -0,0 +1,15 @@ +Imports System.Windows.Forms + +Public Class F_Graph_ChEdit + + Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click + Me.DialogResult = System.Windows.Forms.DialogResult.OK + Me.Close() + End Sub + + Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click + Me.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.Close() + End Sub + +End Class diff --git a/VECTO/GUI/F_MAINForm.Designer.vb b/VECTO/GUI/F_MAINForm.Designer.vb index ddbf0eb4e867ee23c0f3e9c8ee38d3eee3630f03..9a1f50da2992347de7a01604847f69442443fa07 100644 --- a/VECTO/GUI/F_MAINForm.Designer.vb +++ b/VECTO/GUI/F_MAINForm.Designer.vb @@ -30,6 +30,7 @@ Partial Class F_MAINForm Me.ToolStripProgBarOverall = New System.Windows.Forms.ToolStripProgressBar() Me.TabControl1 = New System.Windows.Forms.TabControl() Me.TabPageGEN = New System.Windows.Forms.TabPage() + Me.LbDecl = New System.Windows.Forms.Label() Me.PictureBox1 = New System.Windows.Forms.PictureBox() Me.BtGENdown = New System.Windows.Forms.Button() Me.BtGENup = New System.Windows.Forms.Button() @@ -62,6 +63,8 @@ Partial Class F_MAINForm Me.TbBOpath = New System.Windows.Forms.TextBox() Me.ChBoxAutoSD = New System.Windows.Forms.CheckBox() Me.PanelOptAllg = New System.Windows.Forms.Panel() + Me.CbDecl = New System.Windows.Forms.CheckBox() + Me.PnDeclOpt = New System.Windows.Forms.Panel() Me.Label1 = New System.Windows.Forms.Label() Me.ChBoxCyclDistCor = New System.Windows.Forms.CheckBox() Me.ChBoxUseGears = New System.Windows.Forms.CheckBox() @@ -80,8 +83,6 @@ Partial Class F_MAINForm Me.LoadListToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.LoadDefaultListToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ClearListToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() - Me.ToolStripSeparator5 = New System.Windows.Forms.ToolStripSeparator() - Me.RemovePathsToolStripMenuItem2 = New System.Windows.Forms.ToolStripMenuItem() Me.BackgroundWorker1 = New System.ComponentModel.BackgroundWorker() Me.LvMsg = New System.Windows.Forms.ListView() Me.ColumnHeader1 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) @@ -97,12 +98,10 @@ Partial Class F_MAINForm Me.VEHEditorToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.EngineEditorToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.GearboxEditorToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() - Me.GRAPHiToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator6 = New System.Windows.Forms.ToolStripSeparator() Me.SignOrVerifyFilesToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator4 = New System.Windows.Forms.ToolStripSeparator() Me.OpenLogToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() - Me.ChangeWorkingDirectoryToolStripMenuItem1 = New System.Windows.Forms.ToolStripMenuItem() Me.SettingsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripDrDnBtInfo = New System.Windows.Forms.ToolStripDropDownButton() Me.UserManualToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -111,14 +110,13 @@ Partial Class F_MAINForm Me.SupportToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator3 = New System.Windows.Forms.ToolStripSeparator() Me.CreateActivationFileToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() - Me.AboutPHEMToolStripMenuItem1 = New System.Windows.Forms.ToolStripMenuItem() + Me.AboutVECTOToolStripMenuItem1 = New System.Windows.Forms.ToolStripMenuItem() Me.CmDEV = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.TmProgSec = New System.Windows.Forms.Timer(Me.components) Me.CmOpenFile = New System.Windows.Forms.ContextMenuStrip(Me.components) - Me.OpenWithGRAPHiToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.OpenWithToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ShowInFolderToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() - Me.PnDeclOpt = New System.Windows.Forms.Panel() + Me.GraphToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.StatusBAR.SuspendLayout() Me.TabControl1.SuspendLayout() Me.TabPageGEN.SuspendLayout() @@ -127,6 +125,7 @@ Partial Class F_MAINForm Me.TabPgOptions.SuspendLayout() Me.GrBoxBATCH.SuspendLayout() Me.PanelOptAllg.SuspendLayout() + Me.PnDeclOpt.SuspendLayout() Me.TabPageDEV.SuspendLayout() Me.ConMenFilelist.SuspendLayout() CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).BeginInit() @@ -135,7 +134,6 @@ Partial Class F_MAINForm Me.SplitContainer1.SuspendLayout() Me.ToolStrip1.SuspendLayout() Me.CmOpenFile.SuspendLayout() - Me.PnDeclOpt.SuspendLayout() Me.SuspendLayout() ' 'StatusBAR @@ -192,6 +190,7 @@ Partial Class F_MAINForm ' 'TabPageGEN ' + Me.TabPageGEN.Controls.Add(Me.LbDecl) Me.TabPageGEN.Controls.Add(Me.PictureBox1) Me.TabPageGEN.Controls.Add(Me.BtGENdown) Me.TabPageGEN.Controls.Add(Me.BtGENup) @@ -210,6 +209,17 @@ Partial Class F_MAINForm Me.TabPageGEN.Text = "Job Files" Me.TabPageGEN.UseVisualStyleBackColor = True ' + 'LbDecl + ' + Me.LbDecl.AutoSize = True + Me.LbDecl.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.LbDecl.Location = New System.Drawing.Point(6, 97) + Me.LbDecl.Name = "LbDecl" + Me.LbDecl.Size = New System.Drawing.Size(107, 13) + Me.LbDecl.TabIndex = 19 + Me.LbDecl.Text = "Declaration Mode" + Me.LbDecl.Visible = False + ' 'PictureBox1 ' Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image) @@ -522,7 +532,7 @@ Partial Class F_MAINForm ' Me.CbBOmode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList Me.CbBOmode.FormattingEnabled = True - Me.CbBOmode.Items.AddRange(New Object() {"Working Directory", "Directory of .vecto File", "Custom Directory"}) + Me.CbBOmode.Items.AddRange(New Object() {"Directory of .vecto File", "Custom Directory"}) Me.CbBOmode.Location = New System.Drawing.Point(81, 19) Me.CbBOmode.Name = "CbBOmode" Me.CbBOmode.Size = New System.Drawing.Size(140, 21) @@ -540,7 +550,7 @@ Partial Class F_MAINForm 'ChBoxAutoSD ' Me.ChBoxAutoSD.AutoSize = True - Me.ChBoxAutoSD.Location = New System.Drawing.Point(575, 19) + Me.ChBoxAutoSD.Location = New System.Drawing.Point(246, 16) Me.ChBoxAutoSD.Name = "ChBoxAutoSD" Me.ChBoxAutoSD.Size = New System.Drawing.Size(169, 17) Me.ChBoxAutoSD.TabIndex = 13 @@ -549,13 +559,35 @@ Partial Class F_MAINForm ' 'PanelOptAllg ' + Me.PanelOptAllg.Controls.Add(Me.CbDecl) Me.PanelOptAllg.Controls.Add(Me.PnDeclOpt) Me.PanelOptAllg.Controls.Add(Me.ChBoxModOut) Me.PanelOptAllg.Location = New System.Drawing.Point(6, 6) Me.PanelOptAllg.Name = "PanelOptAllg" - Me.PanelOptAllg.Size = New System.Drawing.Size(563, 170) + Me.PanelOptAllg.Size = New System.Drawing.Size(220, 170) Me.PanelOptAllg.TabIndex = 0 ' + 'CbDecl + ' + Me.CbDecl.AutoSize = True + Me.CbDecl.Location = New System.Drawing.Point(14, 10) + Me.CbDecl.Name = "CbDecl" + Me.CbDecl.Size = New System.Drawing.Size(110, 17) + Me.CbDecl.TabIndex = 15 + Me.CbDecl.Text = "Declaration Mode" + Me.CbDecl.UseVisualStyleBackColor = True + ' + 'PnDeclOpt + ' + Me.PnDeclOpt.Controls.Add(Me.Label1) + Me.PnDeclOpt.Controls.Add(Me.ChBoxCyclDistCor) + Me.PnDeclOpt.Controls.Add(Me.ChBoxUseGears) + Me.PnDeclOpt.Controls.Add(Me.CBoxMODE) + Me.PnDeclOpt.Location = New System.Drawing.Point(8, 38) + Me.PnDeclOpt.Name = "PnDeclOpt" + Me.PnDeclOpt.Size = New System.Drawing.Size(202, 93) + Me.PnDeclOpt.TabIndex = 13 + ' 'Label1 ' Me.Label1.AutoSize = True @@ -601,7 +633,7 @@ Partial Class F_MAINForm Me.ChBoxModOut.AutoSize = True Me.ChBoxModOut.Checked = True Me.ChBoxModOut.CheckState = System.Windows.Forms.CheckState.Checked - Me.ChBoxModOut.Location = New System.Drawing.Point(252, 48) + Me.ChBoxModOut.Location = New System.Drawing.Point(14, 137) Me.ChBoxModOut.Name = "ChBoxModOut" Me.ChBoxModOut.Size = New System.Drawing.Size(115, 17) Me.ChBoxModOut.TabIndex = 0 @@ -667,9 +699,9 @@ Partial Class F_MAINForm ' 'ConMenFilelist ' - Me.ConMenFilelist.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.SaveListToolStripMenuItem, Me.LoadListToolStripMenuItem, Me.LoadDefaultListToolStripMenuItem, Me.ClearListToolStripMenuItem, Me.ToolStripSeparator5, Me.RemovePathsToolStripMenuItem2}) + Me.ConMenFilelist.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.SaveListToolStripMenuItem, Me.LoadListToolStripMenuItem, Me.LoadDefaultListToolStripMenuItem, Me.ClearListToolStripMenuItem}) Me.ConMenFilelist.Name = "ConMenFilelist" - Me.ConMenFilelist.Size = New System.Drawing.Size(176, 120) + Me.ConMenFilelist.Size = New System.Drawing.Size(176, 92) ' 'SaveListToolStripMenuItem ' @@ -695,17 +727,6 @@ Partial Class F_MAINForm Me.ClearListToolStripMenuItem.Size = New System.Drawing.Size(175, 22) Me.ClearListToolStripMenuItem.Text = "Clear List" ' - 'ToolStripSeparator5 - ' - Me.ToolStripSeparator5.Name = "ToolStripSeparator5" - Me.ToolStripSeparator5.Size = New System.Drawing.Size(172, 6) - ' - 'RemovePathsToolStripMenuItem2 - ' - Me.RemovePathsToolStripMenuItem2.Name = "RemovePathsToolStripMenuItem2" - Me.RemovePathsToolStripMenuItem2.Size = New System.Drawing.Size(175, 22) - Me.RemovePathsToolStripMenuItem2.Text = "Remove Paths" - ' 'BackgroundWorker1 ' ' @@ -801,7 +822,7 @@ Partial Class F_MAINForm ' 'ToolStripDrDnBtTools ' - Me.ToolStripDrDnBtTools.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.GENEditorToolStripMenuItem1, Me.VEHEditorToolStripMenuItem, Me.EngineEditorToolStripMenuItem, Me.GearboxEditorToolStripMenuItem, Me.GRAPHiToolStripMenuItem, Me.ToolStripSeparator6, Me.SignOrVerifyFilesToolStripMenuItem, Me.ToolStripSeparator4, Me.OpenLogToolStripMenuItem, Me.ChangeWorkingDirectoryToolStripMenuItem1, Me.SettingsToolStripMenuItem}) + Me.ToolStripDrDnBtTools.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.GENEditorToolStripMenuItem1, Me.VEHEditorToolStripMenuItem, Me.EngineEditorToolStripMenuItem, Me.GearboxEditorToolStripMenuItem, Me.ToolStripSeparator6, Me.GraphToolStripMenuItem, Me.SignOrVerifyFilesToolStripMenuItem, Me.ToolStripSeparator4, Me.OpenLogToolStripMenuItem, Me.SettingsToolStripMenuItem}) Me.ToolStripDrDnBtTools.Image = Global.VECTO.My.Resources.Resources.Misc_Tools_icon Me.ToolStripDrDnBtTools.ImageTransparentColor = System.Drawing.Color.Magenta Me.ToolStripDrDnBtTools.Name = "ToolStripDrDnBtTools" @@ -811,72 +832,60 @@ Partial Class F_MAINForm 'GENEditorToolStripMenuItem1 ' Me.GENEditorToolStripMenuItem1.Name = "GENEditorToolStripMenuItem1" - Me.GENEditorToolStripMenuItem1.Size = New System.Drawing.Size(214, 22) + Me.GENEditorToolStripMenuItem1.Size = New System.Drawing.Size(170, 22) Me.GENEditorToolStripMenuItem1.Text = "VECTO Editor" ' 'VEHEditorToolStripMenuItem ' Me.VEHEditorToolStripMenuItem.Name = "VEHEditorToolStripMenuItem" - Me.VEHEditorToolStripMenuItem.Size = New System.Drawing.Size(214, 22) + Me.VEHEditorToolStripMenuItem.Size = New System.Drawing.Size(170, 22) Me.VEHEditorToolStripMenuItem.Text = "Vehicle Editor" ' 'EngineEditorToolStripMenuItem ' Me.EngineEditorToolStripMenuItem.Name = "EngineEditorToolStripMenuItem" - Me.EngineEditorToolStripMenuItem.Size = New System.Drawing.Size(214, 22) + Me.EngineEditorToolStripMenuItem.Size = New System.Drawing.Size(170, 22) Me.EngineEditorToolStripMenuItem.Text = "Engine Editor" ' 'GearboxEditorToolStripMenuItem ' Me.GearboxEditorToolStripMenuItem.Name = "GearboxEditorToolStripMenuItem" - Me.GearboxEditorToolStripMenuItem.Size = New System.Drawing.Size(214, 22) + Me.GearboxEditorToolStripMenuItem.Size = New System.Drawing.Size(170, 22) Me.GearboxEditorToolStripMenuItem.Text = "Gearbox Editor" ' - 'GRAPHiToolStripMenuItem - ' - Me.GRAPHiToolStripMenuItem.Name = "GRAPHiToolStripMenuItem" - Me.GRAPHiToolStripMenuItem.Size = New System.Drawing.Size(214, 22) - Me.GRAPHiToolStripMenuItem.Text = "GRAPHi" - ' 'ToolStripSeparator6 ' Me.ToolStripSeparator6.Name = "ToolStripSeparator6" - Me.ToolStripSeparator6.Size = New System.Drawing.Size(211, 6) + Me.ToolStripSeparator6.Size = New System.Drawing.Size(167, 6) ' 'SignOrVerifyFilesToolStripMenuItem ' Me.SignOrVerifyFilesToolStripMenuItem.Image = Global.VECTO.My.Resources.Resources.Status_dialog_password_icon Me.SignOrVerifyFilesToolStripMenuItem.Name = "SignOrVerifyFilesToolStripMenuItem" - Me.SignOrVerifyFilesToolStripMenuItem.Size = New System.Drawing.Size(214, 22) + Me.SignOrVerifyFilesToolStripMenuItem.Size = New System.Drawing.Size(170, 22) Me.SignOrVerifyFilesToolStripMenuItem.Text = "Sign or Verify Files" ' 'ToolStripSeparator4 ' Me.ToolStripSeparator4.Name = "ToolStripSeparator4" - Me.ToolStripSeparator4.Size = New System.Drawing.Size(211, 6) + Me.ToolStripSeparator4.Size = New System.Drawing.Size(167, 6) Me.ToolStripSeparator4.Visible = False ' 'OpenLogToolStripMenuItem ' Me.OpenLogToolStripMenuItem.Name = "OpenLogToolStripMenuItem" - Me.OpenLogToolStripMenuItem.Size = New System.Drawing.Size(214, 22) + Me.OpenLogToolStripMenuItem.Size = New System.Drawing.Size(170, 22) Me.OpenLogToolStripMenuItem.Text = "Open Log" ' - 'ChangeWorkingDirectoryToolStripMenuItem1 - ' - Me.ChangeWorkingDirectoryToolStripMenuItem1.Name = "ChangeWorkingDirectoryToolStripMenuItem1" - Me.ChangeWorkingDirectoryToolStripMenuItem1.Size = New System.Drawing.Size(214, 22) - Me.ChangeWorkingDirectoryToolStripMenuItem1.Text = "Change Working Directory" - ' 'SettingsToolStripMenuItem ' Me.SettingsToolStripMenuItem.Name = "SettingsToolStripMenuItem" - Me.SettingsToolStripMenuItem.Size = New System.Drawing.Size(214, 22) + Me.SettingsToolStripMenuItem.Size = New System.Drawing.Size(170, 22) Me.SettingsToolStripMenuItem.Text = "Settings" ' 'ToolStripDrDnBtInfo ' - Me.ToolStripDrDnBtInfo.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.UserManualToolStripMenuItem, Me.QuickStartGuideToolStripMenuItem, Me.UpdateNotesToolStripMenuItem, Me.SupportToolStripMenuItem, Me.ToolStripSeparator3, Me.CreateActivationFileToolStripMenuItem, Me.AboutPHEMToolStripMenuItem1}) + Me.ToolStripDrDnBtInfo.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.UserManualToolStripMenuItem, Me.QuickStartGuideToolStripMenuItem, Me.UpdateNotesToolStripMenuItem, Me.SupportToolStripMenuItem, Me.ToolStripSeparator3, Me.CreateActivationFileToolStripMenuItem, Me.AboutVECTOToolStripMenuItem1}) Me.ToolStripDrDnBtInfo.Image = Global.VECTO.My.Resources.Resources.Help_icon Me.ToolStripDrDnBtInfo.ImageTransparentColor = System.Drawing.Color.Magenta Me.ToolStripDrDnBtInfo.Name = "ToolStripDrDnBtInfo" @@ -918,11 +927,11 @@ Partial Class F_MAINForm Me.CreateActivationFileToolStripMenuItem.Size = New System.Drawing.Size(186, 22) Me.CreateActivationFileToolStripMenuItem.Text = "Create Activation File" ' - 'AboutPHEMToolStripMenuItem1 + 'AboutVECTOToolStripMenuItem1 ' - Me.AboutPHEMToolStripMenuItem1.Name = "AboutPHEMToolStripMenuItem1" - Me.AboutPHEMToolStripMenuItem1.Size = New System.Drawing.Size(186, 22) - Me.AboutPHEMToolStripMenuItem1.Text = "About VECTO" + Me.AboutVECTOToolStripMenuItem1.Name = "AboutVECTOToolStripMenuItem1" + Me.AboutVECTOToolStripMenuItem1.Size = New System.Drawing.Size(186, 22) + Me.AboutVECTOToolStripMenuItem1.Text = "About VECTO" ' 'CmDEV ' @@ -935,38 +944,27 @@ Partial Class F_MAINForm ' 'CmOpenFile ' - Me.CmOpenFile.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.OpenWithGRAPHiToolStripMenuItem, Me.OpenWithToolStripMenuItem, Me.ShowInFolderToolStripMenuItem}) + Me.CmOpenFile.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.OpenWithToolStripMenuItem, Me.ShowInFolderToolStripMenuItem}) Me.CmOpenFile.Name = "CmOpenFile" - Me.CmOpenFile.Size = New System.Drawing.Size(175, 70) - ' - 'OpenWithGRAPHiToolStripMenuItem - ' - Me.OpenWithGRAPHiToolStripMenuItem.Name = "OpenWithGRAPHiToolStripMenuItem" - Me.OpenWithGRAPHiToolStripMenuItem.Size = New System.Drawing.Size(174, 22) - Me.OpenWithGRAPHiToolStripMenuItem.Text = "Open with GRAPHi" + Me.CmOpenFile.Size = New System.Drawing.Size(153, 48) ' 'OpenWithToolStripMenuItem ' Me.OpenWithToolStripMenuItem.Name = "OpenWithToolStripMenuItem" - Me.OpenWithToolStripMenuItem.Size = New System.Drawing.Size(174, 22) + Me.OpenWithToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.OpenWithToolStripMenuItem.Text = "Open with ..." ' 'ShowInFolderToolStripMenuItem ' Me.ShowInFolderToolStripMenuItem.Name = "ShowInFolderToolStripMenuItem" - Me.ShowInFolderToolStripMenuItem.Size = New System.Drawing.Size(174, 22) + Me.ShowInFolderToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.ShowInFolderToolStripMenuItem.Text = "Show in Folder" ' - 'PnDeclOpt + 'GraphToolStripMenuItem ' - Me.PnDeclOpt.Controls.Add(Me.Label1) - Me.PnDeclOpt.Controls.Add(Me.ChBoxCyclDistCor) - Me.PnDeclOpt.Controls.Add(Me.ChBoxUseGears) - Me.PnDeclOpt.Controls.Add(Me.CBoxMODE) - Me.PnDeclOpt.Location = New System.Drawing.Point(8, 7) - Me.PnDeclOpt.Name = "PnDeclOpt" - Me.PnDeclOpt.Size = New System.Drawing.Size(202, 93) - Me.PnDeclOpt.TabIndex = 13 + Me.GraphToolStripMenuItem.Name = "GraphToolStripMenuItem" + Me.GraphToolStripMenuItem.Size = New System.Drawing.Size(210, 22) + Me.GraphToolStripMenuItem.Text = "Open new Graph Window" ' 'F_MAINForm ' @@ -994,6 +992,8 @@ Partial Class F_MAINForm Me.GrBoxBATCH.PerformLayout() Me.PanelOptAllg.ResumeLayout(False) Me.PanelOptAllg.PerformLayout() + Me.PnDeclOpt.ResumeLayout(False) + Me.PnDeclOpt.PerformLayout() Me.TabPageDEV.ResumeLayout(False) Me.ConMenFilelist.ResumeLayout(False) Me.SplitContainer1.Panel1.ResumeLayout(False) @@ -1003,8 +1003,6 @@ Partial Class F_MAINForm Me.ToolStrip1.ResumeLayout(False) Me.ToolStrip1.PerformLayout() Me.CmOpenFile.ResumeLayout(False) - Me.PnDeclOpt.ResumeLayout(False) - Me.PnDeclOpt.PerformLayout() Me.ResumeLayout(False) Me.PerformLayout() @@ -1026,8 +1024,6 @@ Partial Class F_MAINForm Friend WithEvents SaveListToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents LoadListToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents LoadDefaultListToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem - Friend WithEvents ToolStripSeparator5 As System.Windows.Forms.ToolStripSeparator - Friend WithEvents RemovePathsToolStripMenuItem2 As System.Windows.Forms.ToolStripMenuItem Friend WithEvents ClearListToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents BackgroundWorker1 As System.ComponentModel.BackgroundWorker Friend WithEvents ToolStripProgBarOverall As System.Windows.Forms.ToolStripProgressBar @@ -1077,11 +1073,10 @@ Partial Class F_MAINForm Friend WithEvents VEHEditorToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents ToolStripSeparator4 As System.Windows.Forms.ToolStripSeparator Friend WithEvents OpenLogToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem - Friend WithEvents ChangeWorkingDirectoryToolStripMenuItem1 As System.Windows.Forms.ToolStripMenuItem Friend WithEvents SettingsToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents ToolStripDrDnBtInfo As System.Windows.Forms.ToolStripDropDownButton Friend WithEvents CreateActivationFileToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem - Friend WithEvents AboutPHEMToolStripMenuItem1 As System.Windows.Forms.ToolStripMenuItem + Friend WithEvents AboutVECTOToolStripMenuItem1 As System.Windows.Forms.ToolStripMenuItem Friend WithEvents ToolStripSeparator2 As System.Windows.Forms.ToolStripSeparator Friend WithEvents ToolStripProgBarJob As System.Windows.Forms.ToolStripProgressBar Friend WithEvents TmProgSec As System.Windows.Forms.Timer @@ -1092,10 +1087,8 @@ Partial Class F_MAINForm Friend WithEvents QuickStartGuideToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents ToolStripSeparator3 As System.Windows.Forms.ToolStripSeparator Friend WithEvents CmOpenFile As System.Windows.Forms.ContextMenuStrip - Friend WithEvents OpenWithGRAPHiToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents OpenWithToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents ShowInFolderToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem - Friend WithEvents GRAPHiToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents ColumnHeader8 As System.Windows.Forms.ColumnHeader Friend WithEvents ColumnHeader9 As System.Windows.Forms.ColumnHeader Friend WithEvents UpdateNotesToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem @@ -1104,5 +1097,8 @@ Partial Class F_MAINForm Friend WithEvents ToolStripSeparator6 As System.Windows.Forms.ToolStripSeparator Friend WithEvents GrBoxSTD As System.Windows.Forms.GroupBox Friend WithEvents PnDeclOpt As System.Windows.Forms.Panel + Friend WithEvents LbDecl As System.Windows.Forms.Label + Friend WithEvents CbDecl As System.Windows.Forms.CheckBox + Friend WithEvents GraphToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem End Class diff --git a/VECTO/GUI/F_MAINForm.resx b/VECTO/GUI/F_MAINForm.resx index 9d5467eac926d0a9179e7d725463851145a61c56..a6eebc7f69c312620548cd048cf44a719fb45279 100644 --- a/VECTO/GUI/F_MAINForm.resx +++ b/VECTO/GUI/F_MAINForm.resx @@ -209,13 +209,13 @@ <value>357, 12</value> </metadata> <metadata name="ToolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>654, 13</value> + <value>524, 13</value> </metadata> <metadata name="CmDEV.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>126, 9</value> </metadata> <metadata name="TmProgSec.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>752, 12</value> + <value>619, 13</value> </metadata> <metadata name="CmOpenFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>865, 12</value> diff --git a/VECTO/GUI/F_MAINForm.vb b/VECTO/GUI/F_MAINForm.vb index 25866a968a69ecfa6faa4bfd6581952fb3b8f2e2..cdc1501891dec546a4a91fe2d2b38b6f183873dc 100644 --- a/VECTO/GUI/F_MAINForm.vb +++ b/VECTO/GUI/F_MAINForm.vb @@ -1,21 +1,24 @@ Imports System.Collections.Generic +''' <summary> +''' Main application form. Loads at application start. Closing form ends application. +''' </summary> +''' <remarks></remarks> Public Class F_MAINForm - Private GenList As cFileListView - Private DriList As cFileListView - Private BatchGenList As cFileListView + Private JobListView As cFileListView + Private CycleListView As cFileListView Private LastModeIndex As Int16 Private LastModeName As String Private ConMenTarget As ListView - Private ConMenTarGEN As Boolean + Private ConMenTarJob As Boolean Private MODpath As String Private MODVehList As Int32() - Private DRIpage As TabPage - Private DRIpageHere As Boolean + Private CycleTabPage As TabPage + Private CycleTabPageVisible As Boolean Private ComLineShutDown As Boolean @@ -32,7 +35,10 @@ Public Class F_MAINForm Private GENcheckAllLock As Boolean Private DRIcheckAllLock As Boolean -#Region "SLEEP Steuerung" + Private CbDeclLock As Boolean = False + + +#Region "SLEEP Control - Prevent sleep while VECTO is running" Private Declare Function SetThreadExecutionState Lib "kernel32" (ByVal esFlags As Long) As Long @@ -44,7 +50,7 @@ Public Class F_MAINForm Private Sub AllowSleepON() #If Not PLATFORM = "x86" Then - SetThreadExecutionState(tEXECUTION_STATE.ES_CONTINUOUS) + SetThreadExecutionState(tEXECUTION_STATE.ES_CONTINUOUS) #End If End Sub @@ -62,117 +68,78 @@ Public Class F_MAINForm #Region "FileBrowser Init/Close" Private Sub FB_Initialize() FB_Init = False - fbWorkDir = New cFileBrowser("WorkDir", True) + fbFolder = New cFileBrowser("WorkDir", True) fbFileLists = New cFileBrowser("FileLists") - fbGEN = New cFileBrowser("gen") + fbVECTO = New cFileBrowser("vecto") fbVEH = New cFileBrowser("vveh") fbMAP = New cFileBrowser("vmap") fbDRI = New cFileBrowser("vdri") fbFLD = New cFileBrowser("vfld") - fbTRS = New cFileBrowser("trs") - fbMAA = New cFileBrowser("maa") - fbMAC = New cFileBrowser("mac") - fbWUA = New cFileBrowser("wua") - fbWUC = New cFileBrowser("wuc") - fbCDW = New cFileBrowser("cdw") - fbATC = New cFileBrowser("atc") - fbBAT = New cFileBrowser("bat") - fbEMO = New cFileBrowser("emo") - fbEAN = New cFileBrowser("ean") - fbGET = New cFileBrowser("get") - fbSTE = New cFileBrowser("ste") - fbEKF = New cFileBrowser("ekf") - fbEXS = New cFileBrowser("exs") - fbFZP = New cFileBrowser("fzp") - fbFLT = New cFileBrowser("flt") - fbTEM = New cFileBrowser("tem") - fbSTR = New cFileBrowser("str") - fbENG = New cFileBrowser("veng") - fbWHTC = New cFileBrowser("vwhtc") fbGBX = New cFileBrowser("vgbx") fbACC = New cFileBrowser("vacc") fbAUX = New cFileBrowser("vaux") + fbGBS = New cFileBrowser("vgbs") + fbRLM = New cFileBrowser("vrlm") + fbTLM = New cFileBrowser("vtlm") + fbTCC = New cFileBrowser("vtcc") + fbCDx = New cFileBrowser("vcdx") + + fbVMOD = New cFileBrowser("vmod") '------------------------------------------------------- fbFileLists.Extensions = New String() {"txt"} - fbGEN.Extensions = New String() {"vecto"} + fbVECTO.Extensions = New String() {"vecto"} fbVEH.Extensions = New String() {"vveh"} fbMAP.Extensions = New String() {"vmap"} fbDRI.Extensions = New String() {"vdri"} fbFLD.Extensions = New String() {"vfld"} - fbTRS.Extensions = New String() {"trs"} - fbMAA.Extensions = New String() {"maa"} - fbMAC.Extensions = New String() {"mac"} - fbWUA.Extensions = New String() {"wua"} - fbWUC.Extensions = New String() {"wuc"} - fbCDW.Extensions = New String() {"cdw"} - fbATC.Extensions = New String() {"atc"} - fbBAT.Extensions = New String() {"bat"} - fbEMO.Extensions = New String() {"emo"} - fbEAN.Extensions = New String() {"ean"} - fbGET.Extensions = New String() {"get"} - fbSTE.Extensions = New String() {"ste"} - fbEKF.Extensions = New String() {"ekf"} - fbEXS.Extensions = New String() {"exs"} - fbFZP.Extensions = New String() {"fzp"} - fbFLT.Extensions = New String() {"flt"} - fbTEM.Extensions = New String() {"tem"} - fbSTR.Extensions = New String() {"str"} - fbENG.Extensions = New String() {"veng"} - fbWHTC.Extensions = New String() {"vwhtc"} fbGBX.Extensions = New String() {"vgbx"} fbACC.Extensions = New String() {"vacc"} fbAUX.Extensions = New String() {"vaux"} + fbGBS.Extensions = New String() {"vgbs"} + fbRLM.Extensions = New String() {"vrlm"} + fbTLM.Extensions = New String() {"vtlm"} + fbTCC.Extensions = New String() {"vtcc"} + fbCDx.Extensions = New String() {"vcdv", "vcdb"} + + fbVMOD.Extensions = New String() {"vmod"} + End Sub Private Sub FB_Close() - fbWorkDir.Close() + fbFolder.Close() fbFileLists.Close() - fbGEN.Close() + fbVECTO.Close() fbVEH.Close() fbMAP.Close() fbDRI.Close() fbFLD.Close() - fbTRS.Close() - fbMAA.Close() - fbMAC.Close() - fbWUA.Close() - fbWUC.Close() - fbCDW.Close() - fbATC.Close() - fbBAT.Close() - fbEMO.Close() - fbEAN.Close() - fbGET.Close() - fbSTE.Close() - fbEKF.Close() - fbEXS.Close() - fbFZP.Close() - fbFLT.Close() - fbTEM.Close() - fbSTR.Close() - fbENG.Close() - fbWHTC.Close() fbGBX.Close() fbACC.Close() fbAUX.Close() - + fbGBS.Close() + fbRLM.Close() + fbTLM.Close() + fbTCC.Close() + fbCDx.Close() + fbVMOD.Close() End Sub + #End Region -#Region "PHEM-Worker" +#Region "VECTO-Worker" - 'PHEM-Launcher - Public Sub PHEM_Launcher() + 'VECTO-Launcher + Public Sub VECTO_Launcher() Dim ProgOverall As Boolean Dim GEN0 As cVECTO - 'Called when PHEM already running - If PHEMworker.IsBusy Then + 'Called when VECTO already running + If VECTOworker.IsBusy Then GUImsg(tMsgID.Err, "VECTO is already running!") Exit Sub End If @@ -183,14 +150,14 @@ Public Class F_MAINForm 'Set Mode Select Case LastModeIndex Case 0 - PHEMmode = tPHEMmode.ModeSTANDARD + CalcMode = tCalcMode.ModeSTANDARD Case 1 - PHEMmode = tPHEMmode.ModeBATCH + CalcMode = tCalcMode.ModeBATCH End Select - 'Wenn mehr als 100 Kombinationen in Batch fragen ob sekündliche Ausgabe |@@| When Batch resulting in more than 100 combinations per second, ask whether to dump-output per second - If (PHEMmode = tPHEMmode.ModeBATCH) And ((Me.LvGEN.CheckedItems.Count) * (Me.LvDRI.CheckedItems.Count) > 100) And Me.ChBoxModOut.Checked Then - Select Case MsgBox("You are about to run BATCH Mode with " & (Me.LvGEN.CheckedItems.Count) * (Me.LvDRI.CheckedItems.Count) & " calculations!" & ChrW(10) & "Do you still want to write second-by-second results?", MsgBoxStyle.YesNoCancel) + 'If more than 100 calculations, ask whether to write by-second results + If (CalcMode = tCalcMode.ModeBATCH) And ((Me.LvGEN.CheckedItems.Count) * (Me.LvDRI.CheckedItems.Count) > 100) And Me.ChBoxModOut.Checked Then + Select Case MsgBox("You are about to run BATCH Mode with " & (Me.LvGEN.CheckedItems.Count) * (Me.LvDRI.CheckedItems.Count) & " calculations!" & ChrW(10) & "Do you still want to write modal results?", MsgBoxStyle.YesNoCancel) Case MsgBoxResult.No Me.ChBoxModOut.Checked = False Case MsgBoxResult.Cancel @@ -217,7 +184,7 @@ Public Class F_MAINForm End If 'Check whether Overall-progbar is needed - If PHEMmode = tPHEMmode.ModeBATCH Or JobFileList.Count > 1 Or Declaration.Active Then + If CalcMode = tCalcMode.ModeBATCH Or JobFileList.Count > 1 Or Cfg.DeclMode Then ProgOverall = True Else GEN0 = New cVECTO @@ -234,6 +201,7 @@ Public Class F_MAINForm End Sub + 'Lock certain GUI elements while VECTO is running Private Sub LockGUI(ByVal Lock As Boolean) GUIlocked = Lock @@ -261,7 +229,7 @@ Public Class F_MAINForm End Sub - 'Define File-lists + 'Define job file list Private Sub SetJobList() Dim LV0 As ListViewItem Dim x As Integer @@ -275,19 +243,20 @@ Public Class F_MAINForm LV0.SubItems(1).Text = "" CheckedItems.Add(LV0) SetCheckedItemColor(x, tJobStatus.Queued) - JobFileList.Add(fFileRepl(LV0.SubItems(0).Text, Cfg.WorkDPath)) + JobFileList.Add(fFileRepl(LV0.SubItems(0).Text)) Next End Sub + 'Define cycle list (BATCH mode only) Private Sub SetCycleList() Dim LV0 As ListViewItem JobCycleList.Clear() - If PHEMmode = tPHEMmode.ModeBATCH Then + If CalcMode = tCalcMode.ModeBATCH Then For Each LV0 In Me.LvDRI.CheckedItems - JobCycleList.Add(fFileRepl(LV0.SubItems(0).Text, Cfg.WorkDPath)) + JobCycleList.Add(fFileRepl(LV0.SubItems(0).Text)) Next End If @@ -296,7 +265,7 @@ Public Class F_MAINForm 'Job Launcher Private Sub Job_Launcher(ByVal ProgOverallEnabled As Boolean) - If PHEMworker.IsBusy Then Exit Sub + If VECTOworker.IsBusy Then Exit Sub 'Load Options from Options Tab SetOptions() @@ -327,7 +296,7 @@ Public Class F_MAINForm ProgSecStart() 'BG-Worker start - PHEMworker.RunWorkerAsync() + VECTOworker.RunWorkerAsync() End Sub @@ -336,13 +305,13 @@ Public Class F_MAINForm Me.Button1.Enabled = False Me.Button1.Text = "Aborting..." Me.Button1.Image = My.Resources.Play_icon_gray - PHEMworker.CancelAsync() + VECTOworker.CancelAsync() End Sub -#Region "BackgroundWorker1" +#Region "BackgroundWorker Events" - 'Begin work + 'DoWork - Start Calculations Private Sub BackgroundWorker1_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork 'Prevent SLEEP @@ -361,7 +330,7 @@ Public Class F_MAINForm End Sub - 'Progress Report + 'Progress Report - Progressbar, Messages, etc. Private Sub BackgroundWorker1_ProgressChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles BackgroundWorker1.ProgressChanged Dim x As cWorkProg x = e.UserState @@ -375,13 +344,7 @@ Public Class F_MAINForm Case tWorkMsgType.ProgBars Me.ToolStripProgBarOverall.Value = e.ProgressPercentage - 'At x.ProgSec = -1 no update of ProgBarSec - If x.ProgSec = 0 Then - ProgSecStart() - ElseIf x.ProgSec > 0 Then - ProgBarCtrl.ProgJobInt = x.ProgSec - ProgSecUpdate(False) - End If + ProgSecStart() Case tWorkMsgType.JobStatus CheckedItems(x.FileIndex).SubItems(1).Text = x.Msg @@ -422,7 +385,7 @@ Public Class F_MAINForm If e.Error IsNot Nothing Then MsgBox("An Unexpected Error occurred!" & ChrW(10) & ChrW(10) & _ e.Error.Message.ToString, MsgBoxStyle.Critical, "Unexpected Error") - LOGfile.WriteLine(">>>Unexpected Error:" & e.Error.ToString()) + LogFile.WriteToLog(tMsgID.Err, ">>>Unexpected Error:" & e.Error.ToString()) Me.Close() End If @@ -456,11 +419,9 @@ Public Class F_MAINForm #End Region -#Region "Form-Events (Init, Buttons,...)" - #Region "Form Init/Close" - 'Initialize + 'Initialise Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim x As Integer @@ -478,8 +439,8 @@ Public Class F_MAINForm Me.TabControl1.TabPages(x).Show() Next - DRIpageHere = True - DRIpage = Me.TabPageDRI + CycleTabPageVisible = True + CycleTabPage = Me.TabPageDRI DEVpage = Me.TabPageDEV Me.TabControl1.Controls.Remove(DEVpage) @@ -495,12 +456,12 @@ Public Class F_MAINForm 'FileLists - GenList = New cFileListView(MyConfPath & "joblist.txt") - GenList.LVbox = Me.LvGEN - DriList = New cFileListView(MyConfPath & "cyclelist.txt") - DriList.LVbox = Me.LvDRI - BatchGenList = New cFileListView(MyConfPath & "joblist.txt") - BatchGenList.LVbox = Me.LvGEN + JobListView = New cFileListView(MyConfPath & "joblist.txt") + JobListView.LVbox = Me.LvGEN + CycleListView = New cFileListView(MyConfPath & "cyclelist.txt") + CycleListView.LVbox = Me.LvDRI + + JobListView.LoadList() 'Load GUI Options (here, the GEN/ADV/DRI lists are loaded) LoadOptions() @@ -511,9 +472,9 @@ Public Class F_MAINForm Me.LvMsg.Columns(2).Width = -2 'Initialize BackgroundWorker - PHEMworker = Me.BackgroundWorker1 - PHEMworker.WorkerReportsProgress = True - PHEMworker.WorkerSupportsCancellation = True + VECTOworker = Me.BackgroundWorker1 + VECTOworker.WorkerReportsProgress = True + VECTOworker.WorkerSupportsCancellation = True 'License check If Not Lic.LICcheck() Then @@ -536,12 +497,40 @@ Public Class F_MAINForm LoadDEVconfigs() End If - If Declaration.Active Then - Me.PnDeclOpt.Enabled = False + DeclOnOff() + + End Sub + + 'Declaration mode GUI settings + Private Sub DeclOnOff() + + If Cfg.DeclMode Then + Me.Text = "VECTO " & VECTOvers & " - Declaration Mode" Me.CBoxMODE.SelectedIndex = 0 - GUImsg(tMsgID.Warn, "VECTO is running in Declaration Mode") + Cfg.DeclInit() + Else + Me.Text = "VECTO " & VECTOvers + End If + + If Cfg.DeclMode Then + LastModeName = "Declaration" + Else + Select Case LastModeIndex + Case 0 'Standard + LastModeName = "STANDARD" + Case 1 'Batch + LastModeName = "BATCH" + End Select End If + Status(LastModeName & " Mode") + + Me.LoadOptions() + + Me.LbDecl.Visible = Cfg.DeclMode + + Me.PnDeclOpt.Enabled = Not Cfg.DeclMode + End Sub 'Shown Event (Form-Load finished) ... here StartUp Forms are loaded (DEV, GEN/ADV- Editor ..) @@ -568,7 +557,7 @@ Public Class F_MAINForm End Sub - 'Open file with PHEM + 'Open file Private Sub CmdLineCtrl(ByVal ComLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String)) Dim bBATCH As Boolean Dim bRUN As Boolean @@ -610,7 +599,7 @@ Public Class F_MAINForm If driFiles.Count > 0 Then LvDRI.Items.Clear() - AddToListViewDRI(driFiles.ToArray) + AddToCycleListView(driFiles.ToArray) End If Else @@ -621,7 +610,7 @@ Public Class F_MAINForm If vecFiles.Count > 0 Then If vecFiles.Count > 1 Or bRUN Then LvGEN.Items.Clear() - AddToListViewGEN(vecFiles.ToArray) + AddToJobListView(vecFiles.ToArray) Else ComFile = vecFiles(0) End If @@ -629,7 +618,7 @@ Public Class F_MAINForm 'Run or open file editor if file is specified If bRUN Then - PHEM_Launcher() + VECTO_Launcher() Else If ComFile <> sKey.NoFile Then OpenVectoFile(ComFile) End If @@ -642,14 +631,8 @@ Public Class F_MAINForm 'Save File-Lists SaveFileLists() - 'Login close - Try - LOGfile.WriteLine("Closing Session " & Now) - LOGfile.WriteLine("------------------------------------------------------------------------------------------") - LOGfile.Close() - Catch ex As Exception - End Try - + 'Close log + LogFile.CloseLog() 'Config save SetOptions() @@ -663,6 +646,7 @@ Public Class F_MAINForm #End Region + 'Open file - Job, vehicle, engine, gearbox or signature file Private Sub OpenVectoFile(ByVal File As String) If Not IO.File.Exists(File) Then @@ -677,7 +661,7 @@ Public Class F_MAINForm If Not F_GBX.Visible Then F_GBX.Show() Else - F_GBX.GenDir = "" + F_GBX.JobDir = "" If F_GBX.WindowState = FormWindowState.Minimized Then F_GBX.WindowState = FormWindowState.Normal F_GBX.BringToFront() End If @@ -686,7 +670,7 @@ Public Class F_MAINForm If Not F_VEH.Visible Then F_VEH.Show() Else - F_VEH.GenDir = "" + F_VEH.JobDir = "" If F_VEH.WindowState = FormWindowState.Minimized Then F_VEH.WindowState = FormWindowState.Normal F_VEH.BringToFront() End If @@ -695,13 +679,13 @@ Public Class F_MAINForm If Not F_ENG.Visible Then F_ENG.Show() Else - F_ENG.GenDir = "" + F_ENG.JobDir = "" If F_ENG.WindowState = FormWindowState.Minimized Then F_ENG.WindowState = FormWindowState.Normal F_ENG.BringToFront() End If F_ENG.openENG(File) Case ".VECTO" - OpenGENEditor(File) + OpenVECTOeditor(File) Case ".VSIG" OpenSigFile(File) Case Else @@ -712,27 +696,26 @@ Public Class F_MAINForm End Sub -#Region "GEN Liste" +#Region "Job file list" #Region "Events" Private Sub ButtonGENremove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGENremove.Click - removeGEN() + RemoveJobFile() End Sub Private Sub ButtonGENadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGENadd.Click - addGEN() + AddJobFile() End Sub Private Sub ButtonGENoptions_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGENopt.Click ConMenTarget = Me.LvGEN - ConMenTarGEN = True + ConMenTarJob = True 'Locked functions show/hide Me.LoadListToolStripMenuItem.Enabled = Not GUIlocked Me.LoadDefaultListToolStripMenuItem.Enabled = Not GUIlocked Me.ClearListToolStripMenuItem.Enabled = Not GUIlocked - Me.RemovePathsToolStripMenuItem2.Enabled = Not GUIlocked Me.ConMenFilelist.Show(Control.MousePosition) End Sub @@ -740,16 +723,16 @@ Public Class F_MAINForm Private Sub ListViewGEN_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles LvGEN.KeyDown Select Case e.KeyCode Case Keys.Delete, Keys.Back - If Not GUIlocked Then removeGEN() + If Not GUIlocked Then RemoveJobFile() Case Keys.Enter - OpenGenOrAdv() + OpenJobFile() End Select End Sub Private Sub ListViewGEN_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles LvGEN.DoubleClick If Me.LvGEN.SelectedItems.Count > 0 Then Me.LvGEN.SelectedItems(0).Checked = Not Me.LvGEN.SelectedItems(0).Checked - OpenGenOrAdv() + OpenJobFile() End If End Sub @@ -762,7 +745,7 @@ Public Class F_MAINForm End If If CheckLock Then Exit Sub - UpdateGENTabText() + UpdateJobTabText() End Sub @@ -786,7 +769,7 @@ Public Class F_MAINForm CheckLock = False GENchecked = Me.LvGEN.CheckedItems.Count - UpdateGENTabText() + UpdateJobTabText() End Sub Private Sub ListGEN_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles LvGEN.DragEnter @@ -797,7 +780,7 @@ Public Class F_MAINForm Private Sub ListGEN_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles LvGEN.DragDrop Dim f As String() f = CType(e.Data.GetData(DataFormats.FileDrop), Array) - AddToListViewGEN(f) + AddToJobListView(f) End Sub Private Sub BtGENup_Click(sender As System.Object, e As System.EventArgs) Handles BtGENup.Click @@ -808,14 +791,10 @@ Public Class F_MAINForm MoveItem(LvGEN, False) End Sub - - - - #End Region - 'Remove File from list - Private Sub removeGEN() + 'Remove selected file(s) from job list + Private Sub RemoveJobFile() Dim lastindx As Integer Dim SelIx() As Integer Dim i As Integer @@ -850,28 +829,28 @@ Public Class F_MAINForm CheckLock = False GENchecked = LvGEN.CheckedItems.Count - UpdateGENTabText() + UpdateJobTabText() End Sub - 'Append File to List - Private Sub addGEN() + 'Browse for job file(s) and add to job list with AddToJobListView + Private Sub AddJobFile() Dim x As String() Dim Chck As Boolean = False x = New String() {""} 'STANDARD/BATCH - If fbGEN.OpenDialog("", True, "vecto") Then + If fbVECTO.OpenDialog("", True, "vecto") Then Chck = True - x = fbGEN.Files + x = fbVECTO.Files End If - - If Chck Then AddToListViewGEN(x) + + If Chck Then AddToJobListView(x) End Sub - 'Open file - Private Sub OpenGenOrAdv() + 'Open file in list + Private Sub OpenJobFile() Dim f As String If Me.LvGEN.SelectedItems.Count < 1 Then @@ -883,16 +862,16 @@ Public Class F_MAINForm End If f = Me.LvGEN.SelectedItems(0).SubItems(0).Text - f = fFileRepl(f, Cfg.WorkDPath) + f = fFileRepl(f) If Not IO.File.Exists(f) Then MsgBox(f & " not found!") Else - OpenGENEditor(f) + OpenVECTOeditor(f) End If End Sub - 'GEN/ADV list: Add File - Private Sub AddToListViewGEN(ByVal Path As String(), Optional ByVal Txt As String = " ") + 'Add File to job listview (multiple files) + Private Sub AddToJobListView(ByVal Path As String(), Optional ByVal Txt As String = " ") Dim pDim As Int16 Dim p As Int16 Dim f As Int16 @@ -900,8 +879,8 @@ Public Class F_MAINForm Dim fListDim As Int16 = -1 Dim ListViewItem0 As ListViewItem - 'If PHEM runs: Cancel operation (because Mode-change during calculation is not very clever) - If PHEMworker.IsBusy Then Exit Sub + 'If VECTO runs: Cancel operation (because Mode-change during calculation is not very clever) + If VECTOworker.IsBusy Then Exit Sub pDim = UBound(Path) ReDim fList(0) 'um Nullverweisausnahme-Warnung zu verhindern @@ -961,18 +940,20 @@ lbFound: 'Number update GENchecked = Me.LvGEN.CheckedItems.Count - UpdateGENTabText() + UpdateJobTabText() End Sub - Public Sub AddToListViewGEN(ByVal Path As String, Optional ByVal Txt As String = " ") + 'Add File to job listview (single file) + Public Sub AddToJobListView(ByVal Path As String, Optional ByVal Txt As String = " ") Dim p(0) As String p(0) = Path - AddToListViewGEN(p, Txt) + AddToJobListView(p, Txt) End Sub - Private Sub UpdateGENTabText() + 'Update job files counter in tab titel + Private Sub UpdateJobTabText() Dim c As Integer c = Me.LvGEN.Items.Count @@ -995,41 +976,25 @@ lbFound: #End Region -#Region "DRI Liste" +#Region "Cycle list (BATCH)" #Region "Events" Private Sub ButtonDRIadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonDRIadd.Click - addDRI() + AddCycle() End Sub Private Sub ButtonDRIremove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonDRIremove.Click - removeDRI() + RemoveCycle() End Sub Private Sub ButtonDRIoptions_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonDRIedit.Click ConMenTarget = Me.LvDRI - ConMenTarGEN = False + ConMenTarJob = False Me.ConMenFilelist.Show(Control.MousePosition) End Sub - Private Sub LvDRI_ItemCheck(sender As Object, e As System.Windows.Forms.ItemCheckEventArgs) Handles LvDRI.ItemCheck - - 'If e.CurrentValue = e.NewValue Then Exit Sub - - 'If e.NewValue = CheckState.Checked Then - ' DRIchecked += 1 - 'Else - ' DRIchecked -= 1 - 'End If - - 'If CheckLock Then Exit Sub - 'UpdateDRITabText() - - - End Sub - Private Sub LvDRI_ItemChecked(sender As Object, e As System.Windows.Forms.ItemCheckedEventArgs) Handles LvDRI.ItemChecked If e.Item.Checked Then @@ -1039,7 +1004,7 @@ lbFound: End If If CheckLock Then Exit Sub - UpdateDRITabText() + UpdateCycleTabText() End Sub @@ -1062,25 +1027,25 @@ lbFound: CheckLock = False DRIchecked = Me.LvDRI.CheckedItems.Count - UpdateDRITabText() + UpdateCycleTabText() End Sub Private Sub ListViewDRI_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles LvDRI.DoubleClick If Me.LvDRI.SelectedItems.Count > 0 Then Me.LvDRI.SelectedItems(0).Checked = Not Me.LvDRI.SelectedItems(0).Checked - openDRI() + OpenCycle() Else - addDRI() + AddCycle() End If End Sub Private Sub ListViewDRI_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles LvDRI.KeyDown Select Case e.KeyCode Case Keys.Delete, Keys.Back - If Not GUIlocked Then removeDRI() + If Not GUIlocked Then RemoveCycle() Case Keys.Enter - openDRI() + OpenCycle() End Select End Sub @@ -1091,7 +1056,7 @@ lbFound: Private Sub ListDRI_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles LvDRI.DragDrop Dim f As String() f = CType(e.Data.GetData(DataFormats.FileDrop), Array) - AddToListViewDRI(f) + AddToCycleListView(f) If LvDRI.Items.Count > 0 Then LvDRI.Items(LvDRI.Items.Count - 1).Selected = True End Sub @@ -1105,7 +1070,8 @@ lbFound: #End Region - Private Sub removeDRI() + 'Remove selected file(s) from cycle list + Private Sub RemoveCycle() Dim lastindx As Integer Dim SelIx() As Integer Dim i As Integer @@ -1140,17 +1106,19 @@ lbFound: LvDRI.EndUpdate() DRIchecked = LvDRI.CheckedItems.Count - UpdateDRITabText() + UpdateCycleTabText() End Sub - Private Sub addDRI() + 'Browse for cycle file(s) and add to cycle list with AddToCycleListView + Private Sub AddCycle() If fbDRI.OpenDialog("", True) Then - AddToListViewDRI(fbDRI.Files) + AddToCycleListView(fbDRI.Files) If LvDRI.Items.Count > 0 Then LvDRI.Items(LvDRI.Items.Count - 1).Selected = True End If End Sub - Private Sub openDRI() + 'Open cycle in list + Private Sub OpenCycle() If Me.LvDRI.SelectedItems.Count < 1 Then If Me.LvDRI.Items.Count = 1 Then @@ -1160,11 +1128,11 @@ lbFound: End If End If - OpenFiles(fFileRepl(Me.LvDRI.SelectedItems(0).SubItems(0).Text, Cfg.WorkDPath)) + OpenFiles(fFileRepl(Me.LvDRI.SelectedItems(0).SubItems(0).Text)) End Sub - 'DRI list: Add File - Private Sub AddToListViewDRI(ByVal Path As String()) + 'Add File to cycle listview (multiple files) + Private Sub AddToCycleListView(ByVal Path As String()) Dim pDim As Int16 Dim p As Int16 Dim ListViewItem0 As ListViewItem @@ -1190,17 +1158,19 @@ lbFound: 'Number update DRIchecked = Me.LvDRI.CheckedItems.Count - UpdateDRITabText() + UpdateCycleTabText() End Sub - Private Sub AddToListViewDRI(ByVal Path As String) + 'Add File to cycle listview (single file) + Private Sub AddToCycleListView(ByVal Path As String) Dim p(0) As String p(0) = Path - AddToListViewDRI(p) + AddToCycleListView(p) End Sub - Private Sub UpdateDRITabText() + 'Update cycle files counter in tab titel + Private Sub UpdateCycleTabText() Dim c As Integer c = Me.LvDRI.Items.Count @@ -1225,22 +1195,22 @@ lbFound: #Region "Toolstrip" - 'New GEN/ADV + 'New Job file Private Sub ToolStripBtNew_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripBtNew.Click - OpenGENEditor("<New>") + OpenVECTOeditor("<New>") End Sub - 'Open GEN/ADV + 'Open input file Private Sub ToolStripBtOpen_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripBtOpen.Click - - If fbGEN.OpenDialog("", False, "vecto,vveh,vgbx,veng,vsig") Then - OpenVectoFile(fbGEN.Files(0)) + + If fbVECTO.OpenDialog("", False, "vecto,vveh,vgbx,veng,vsig") Then + OpenVectoFile(fbVECTO.Files(0)) End If End Sub Private Sub GENEditorToolStripMenuItem1_Click(sender As System.Object, e As System.EventArgs) Handles GENEditorToolStripMenuItem1.Click - OpenGENEditor("<New>") + OpenVECTOeditor("<New>") End Sub Private Sub VEHEditorToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles VEHEditorToolStripMenuItem.Click @@ -1280,33 +1250,12 @@ lbFound: End If End Sub - Private Sub GRAPHiToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles GRAPHiToolStripMenuItem.Click - Dim PSI As New ProcessStartInfo - Dim fileStr As String = "" - PSI.FileName = ChrW(34) & MyAppPath & "GRAPHi\GRAPHi.exe" & ChrW(34) - Try - Process.Start(PSI) - Catch ex As Exception - MsgBox("Failed to open GRAPHi!", MsgBoxStyle.Critical) - End Try - End Sub - - Private Sub OpenLogToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles OpenLogToolStripMenuItem.Click System.Diagnostics.Process.Start(MyAppPath & "log.txt") End Sub - Private Sub ChangeWorkingDirectoryToolStripMenuItem1_Click(sender As System.Object, e As System.EventArgs) Handles ChangeWorkingDirectoryToolStripMenuItem1.Click - Dim WD As String - WD = Cfg.WorkDPath - If fbWorkDir.OpenDialog(Cfg.WorkDPath) Then - Cfg.SetWorkDir(fbWorkDir.Files(0)) - If WD <> Cfg.WorkDPath Then GUImsg(tMsgID.Normal, "Working Directory changed to " & Cfg.WorkDPath) - End If - End Sub - Private Sub SettingsToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles SettingsToolStripMenuItem.Click - F_Options.Show() + F_Settings.ShowDialog() End Sub Private Sub UserManualToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles UserManualToolStripMenuItem.Click @@ -1354,7 +1303,7 @@ lbFound: End If End Sub - Private Sub AboutPHEMToolStripMenuItem1_Click(sender As System.Object, e As System.EventArgs) Handles AboutPHEMToolStripMenuItem1.Click + Private Sub AboutVECTOToolStripMenuItem1_Click(sender As System.Object, e As System.EventArgs) Handles AboutVECTOToolStripMenuItem1.Click F_AboutBox.ShowDialog() End Sub @@ -1363,7 +1312,7 @@ lbFound: #End Region - + 'Move job/cycle file up or down in list view Private Sub MoveItem(ByRef ListV As ListView, ByVal MoveUp As Boolean) Dim x As Int32 Dim y As Int32 @@ -1416,15 +1365,15 @@ lbFound: End Sub -#Region "FileList - Context Menu" +#Region "job/cycle file List - Context Menu" 'Save List Private Sub SaveListToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveListToolStripMenuItem.Click If fbFileLists.SaveDialog("") Then - If ConMenTarGEN Then - GenList.SaveList(fbFileLists.Files(0)) + If ConMenTarJob Then + JobListView.SaveList(fbFileLists.Files(0)) Else - DriList.SaveList(fbFileLists.Files(0)) + CycleListView.SaveList(fbFileLists.Files(0)) End If End If End Sub @@ -1436,40 +1385,37 @@ lbFound: If fbFileLists.OpenDialog("") Then - If ConMenTarGEN Then 'GEN - GenList.LoadList(fbFileLists.Files(0)) + If ConMenTarJob Then 'GEN + JobListView.LoadList(fbFileLists.Files(0)) GENchecked = Me.LvGEN.CheckedItems.Count - UpdateGENTabText() + UpdateJobTabText() Else 'DRI 'Mode toggle (from(auf) BATCH) If (LastModeIndex <> 1) Then Me.CBoxMODE.SelectedIndex = 1 - DriList.LoadList(fbFileLists.Files(0)) + CycleListView.LoadList(fbFileLists.Files(0)) DRIchecked = Me.LvDRI.CheckedItems.Count - UpdateDRITabText() + UpdateCycleTabText() End If End If End Sub - 'Load Default + 'Load Default List Private Sub LoadDefaultListToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoadDefaultListToolStripMenuItem.Click If GUIlocked Then Exit Sub - If ConMenTarGEN Then - Select Case LastModeIndex - Case 0 - GenList.LoadList() - Case 1 - BatchGenList.LoadList() - End Select + If ConMenTarJob Then + + JobListView.LoadList() + GENchecked = Me.LvGEN.CheckedItems.Count - UpdateGENTabText() + UpdateJobTabText() Else - DriList.LoadList() + CycleListView.LoadList() DRIchecked = Me.LvDRI.CheckedItems.Count - UpdateDRITabText() + UpdateCycleTabText() End If End Sub @@ -1482,119 +1428,112 @@ lbFound: If GUIlocked Then Exit Sub ConMenTarget.Items.Clear() - If ConMenTarGEN Then + If ConMenTarJob Then GENchecked = Me.LvGEN.CheckedItems.Count - UpdateGENTabText() + UpdateJobTabText() Else DRIchecked = Me.LvDRI.CheckedItems.Count - UpdateDRITabText() - End If - End Sub - - 'Remove Paths - Private Sub RemovePathsToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RemovePathsToolStripMenuItem2.Click - - If GUIlocked Then Exit Sub - - If ConMenTarGEN Then - GenList.RemovePaths() - Else - DriList.RemovePaths() + UpdateCycleTabText() End If End Sub #End Region - 'PHEM Start + 'VECTO Start button - Calls VECTO_Launcher or aborts calculation Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click - 'PHEM Start/Stop - If PHEMworker.IsBusy Then - 'If PHEM already running: STOP + 'VECTO Start/Stop + If VECTOworker.IsBusy Then + + 'If VECTO already running: STOP ComLineShutDown = False JobAbort() + Else + '...Otherwise: START 'Save Lists if Crash SaveFileLists() 'Start - PHEM_Launcher() + VECTO_Launcher() End If End Sub - 'Mode Change + 'Mode Change (STANDARD/BATCH) Private Sub CBoxMODE_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CBoxMODE.SelectedIndexChanged - Dim xB As Boolean, xA As Boolean - xB = (Me.CBoxMODE.SelectedIndex = 1) - xA = (Me.CBoxMODE.SelectedIndex = 2) - 'Save Old list - Select Case LastModeIndex - Case 0 'Standard - GenList.SaveList() - Case 1 'Batch - BatchGenList.SaveList() - DriList.SaveList() - End Select + 'Save lists + JobListView.SaveList() + If LastModeIndex = 1 Then CycleListView.SaveList() + 'New mode LastModeIndex = Me.CBoxMODE.SelectedIndex Select Case LastModeIndex Case 0 - PHEMmode = tPHEMmode.ModeSTANDARD + CalcMode = tCalcMode.ModeSTANDARD Case 1 - PHEMmode = tPHEMmode.ModeBATCH + CalcMode = tCalcMode.ModeBATCH End Select - 'Load New List + 'GUI changes according to current mode Select Case LastModeIndex Case 0 'Standard - LastModeName = "STANDARD" - GenList.LoadList() - 'Me.GrBoxSTD.BringToFront() + If Cfg.DeclMode Then + LastModeName = "Declaration" + Else + LastModeName = "STANDARD" + End If - Me.GrBoxSTD.Visible = False 'weil GroupBox leer!!! sonst 'True + 'Show mode-specific settings + Me.GrBoxSTD.Visible = False 'Currently no specific settings for STANDARD mode, therefore always 'False' Me.GrBoxBATCH.Visible = False - If DRIpageHere Then - Me.TabControl1.Controls.Remove(DRIpage) - DRIpageHere = False + 'Hide Cycle Tab Page + If CycleTabPageVisible Then + Me.TabControl1.Controls.Remove(CycleTabPage) + CycleTabPageVisible = False End If + Case 1 'Batch + LastModeName = "BATCH" - BatchGenList.LoadList() - DriList.LoadList() - DRIchecked = Me.LvDRI.CheckedItems.Count - UpdateDRITabText() - 'Me.GrBoxBATCH.BringToFront() + 'Load cycle list + CycleListView.LoadList() + + 'Update cycle counter + DRIchecked = Me.LvDRI.CheckedItems.Count + UpdateCycleTabText() + 'Show mode-specific settings Me.GrBoxSTD.Visible = False Me.GrBoxBATCH.Visible = True - If Not DRIpageHere Then - 'Me.TabControl1.Controls.Add(DRIpage) - Me.TabControl1.TabPages.Insert(1, DRIpage) - DRIpageHere = True + 'Show Cycle Tab Page + If Not CycleTabPageVisible Then + Me.TabControl1.TabPages.Insert(1, CycleTabPage) + CycleTabPageVisible = True End If End Select + 'Update job counter GENchecked = Me.LvGEN.CheckedItems.Count - UpdateGENTabText() + UpdateJobTabText() + + 'Status label Status(LastModeName & " Mode") End Sub - -#End Region - + 'Class for ListView control - Job and cycle lists Private Class cFileListView Private FilePath As String @@ -1679,21 +1618,9 @@ lbFound: End Sub - Public Sub RemovePaths() - Dim x As Int32 - For x = 1 To LVbox.Items.Count - Me.RemovePath(x - 1) - Next - End Sub - - Private Sub RemovePath(ByVal i As Int32) - Dim Path As String - Path = fFILE(LVbox.Items(i).SubItems(0).Text, True) - LVbox.Items(i).SubItems(0).Text = Path - End Sub - End Class + 'Set color of job files in list (Error, Warnings, Currently running, etc.) Private Sub SetCheckedItemColor(ByVal LvID As Integer, ByVal Status As tJobStatus) Dim lv0 As ListViewItem @@ -1722,8 +1649,8 @@ lbFound: End Sub - 'Open GEN-editor and load File - Friend Sub OpenGENEditor(ByVal x As String) + 'Open VECTO Editor and open file (or new file) + Friend Sub OpenVECTOeditor(ByVal x As String) If Not F_VECTO.Visible Then F_VECTO.Show() @@ -1733,15 +1660,16 @@ lbFound: End If If x = "<New>" Then - F_VECTO.GENnew() + F_VECTO.VECTOnew() Else - F_VECTO.GENload2Form(x) + F_VECTO.VECTOload2Form(x) End If F_VECTO.Activate() End Sub + 'Open signature file (.vsig) Friend Sub OpenSigFile(ByVal file As String) If Not F_FileSign.Visible Then F_FileSign.Show() @@ -1753,20 +1681,16 @@ lbFound: F_FileSign.Activate() End Sub - 'Save File-Lists + 'Save job and cycle file lists Private Sub SaveFileLists() - Select Case LastModeIndex - Case 0 - GenList.SaveList() - Case 1 - BatchGenList.SaveList() - DriList.SaveList() - End Select + JobListView.SaveList() + If LastModeIndex = 1 Then CycleListView.SaveList() End Sub -#Region "Sekundäre Progressbar (ToolStripProgBarSec) ...auch Update von ToolStripProgBarPrim möglich" +#Region "Progressbar controls" + 'Initialise progress bar (Start of next job in calculation) Private Sub ProgSecStart() Me.ToolStripProgBarJob.Value = 0 Me.ToolStripProgBarJob.Style = ProgressBarStyle.Marquee @@ -1774,17 +1698,25 @@ lbFound: Me.TmProgSec.Start() End Sub + 'Stop - Hide progress bar Private Sub ProgSecStop() Me.TmProgSec.Stop() Me.ToolStripProgBarJob.Visible = False Me.ToolStripProgBarJob.Value = 0 End Sub + 'Timer to update progress bar regularly Private Sub TmProgSec_Tick(sender As Object, e As System.EventArgs) Handles TmProgSec.Tick - ProgSecUpdate(True) + If GUItest0.TestActive Then + Call GUItest0.TestTick() + Exit Sub + Else + If Not ProgBarCtrl.ProgLock Then ProgSecUpdate() + End If End Sub - Private Sub ProgSecUpdate(ByVal ProgPrimUpdate As Boolean) + 'Update progress bar (timer controlled) + Private Sub ProgSecUpdate() With ProgBarCtrl @@ -1800,7 +1732,7 @@ lbFound: Me.ToolStripProgBarJob.Value = .ProgJobInt - If ProgPrimUpdate And .ProgOverallStartInt > -1 Then + If .ProgOverallStartInt > -1 Then Me.ToolStripProgBarOverall.Value = CInt(.ProgOverallStartInt + (.PgroOverallEndInt - .ProgOverallStartInt) * .ProgJobInt / 100) End If @@ -1813,18 +1745,17 @@ lbFound: #Region "Options Tab" + 'Load options from config class Public Sub LoadOptions() - Me.ChBoxCyclDistCor.Checked = Cfg.WegKorJa - Me.ChBoxUseGears.Checked = Cfg.GnVorgab + Me.ChBoxCyclDistCor.Checked = Cfg.DistCorr + Me.ChBoxUseGears.Checked = Cfg.GnUfromCycle Me.ChBoxModOut.Checked = Cfg.ModOut CbBOmode.SelectedIndex = -1 Select Case UCase(Cfg.BATCHoutpath) - Case sKey.WorkDir + Case sKey.JobPath CbBOmode.SelectedIndex = 0 - Case sKey.GenPath - CbBOmode.SelectedIndex = 1 Case Else - CbBOmode.SelectedIndex = 2 + CbBOmode.SelectedIndex = 1 Me.TbBOpath.Text = Cfg.BATCHoutpath End Select Me.ChBoxBatchSubD.Checked = Cfg.BATCHoutSubD @@ -1835,28 +1766,27 @@ lbFound: Select Case LastModeIndex Case 0 - PHEMmode = tPHEMmode.ModeSTANDARD + CalcMode = tCalcMode.ModeSTANDARD Case 1 - PHEMmode = tPHEMmode.ModeBATCH + CalcMode = tCalcMode.ModeBATCH End Select - End Sub - + Me.CbDecl.Checked = Cfg.DeclMode + End Sub + 'Update config class from options in GUI, e.g. before running calculations Private Sub SetOptions() 'General(Allgemein) - Cfg.WegKorJa = Me.ChBoxCyclDistCor.Checked - Cfg.GnVorgab = Me.ChBoxUseGears.Checked + Cfg.DistCorr = Me.ChBoxCyclDistCor.Checked + Cfg.GnUfromCycle = Me.ChBoxUseGears.Checked 'BATCH Cfg.ModOut = Me.ChBoxModOut.Checked Select Case CbBOmode.SelectedIndex Case 0 - Cfg.BATCHoutpath = sKey.WorkDir - Case 1 - Cfg.BATCHoutpath = sKey.GenPath + Cfg.BATCHoutpath = sKey.JobPath Case Else Cfg.BATCHoutpath = Trim(Me.TbBOpath.Text) If Microsoft.VisualBasic.Right(Cfg.BATCHoutpath, 1) <> "\" Then Cfg.BATCHoutpath &= "\" @@ -1868,11 +1798,8 @@ lbFound: End Sub - - #Region "Events" - Private Sub ChBoxAutoSD_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChBoxAutoSD.CheckedChanged Me.LbAutoShDown.Visible = Me.ChBoxAutoSD.Checked End Sub @@ -1883,8 +1810,8 @@ lbFound: End Sub Private Sub ButBObrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButBObrowse.Click - If fbWorkDir.OpenDialog(Me.TbBOpath.Text) Then - Me.TbBOpath.Text = fbWorkDir.Files(0) + If fbFolder.OpenDialog(Me.TbBOpath.Text) Then + Me.TbBOpath.Text = fbFolder.Files(0) End If End Sub @@ -1897,8 +1824,9 @@ lbFound: #End Region -#Region "DEV Tab" +#Region "Developer options (DEV) Tab" + 'Load DEV options Private Sub LoadDEVconfigs() Dim LV0 As ListViewItem Dim i As Integer @@ -1943,10 +1871,12 @@ lbFound: End Sub + 'Update value of specific DEV option Private Sub UpdateDEVconfigs(ByRef LV0 As ListViewItem) LV0.SubItems(3).Text = DEV.Options(LV0.Tag).ValText End Sub + 'Change value of DEV option or execute action-type DEV options Private Sub LvDEVoptions_DoubleClick(sender As Object, e As System.EventArgs) Handles LvDEVoptions.DoubleClick Dim Config0 As cDEVoption Dim str As String @@ -1999,6 +1929,7 @@ lbFound: End Sub + 'Context menu for selection-type DEV options Private Sub CmDEV_ItemClicked(sender As Object, e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles CmDEV.ItemClicked Dim i As Integer @@ -2010,48 +1941,39 @@ lbFound: End Sub + + + #End Region + 'Add message to message list Public Sub MSGtoForm(ByVal ID As tMsgID, ByVal Msg As String, ByVal Source As String, ByVal Link As String) Dim lv0 As ListViewItem - Dim TimeStr As String - Dim LogStr As String - - TimeStr = Now.ToString lv0 = New ListViewItem lv0.Text = Msg - lv0.SubItems.Add(TimeStr) + lv0.SubItems.Add(Now.ToString) lv0.SubItems.Add(Source) - LogStr = Msg & " | " & TimeStr & " | " & Source - If LvMsg.Items.Count > 9999 Then LvMsg.Items.RemoveAt(0) + LogFile.WriteToLog(ID, Msg & vbTab & Source) + Select Case ID Case tMsgID.Err - 'Log - LOGfile.WriteLine("ERROR | " & LogStr) - lv0.BackColor = Color.Red lv0.ForeColor = Color.White Case tMsgID.Warn - 'Log - LOGfile.WriteLine("WARNING | " & LogStr) - lv0.BackColor = Color.Khaki 'FromArgb(218, 125, 0) 'DarkOrange lv0.ForeColor = Color.Black Case Else - 'Log - LOGfile.WriteLine(LogStr) - If ID = tMsgID.NewJob Then lv0.BackColor = Color.LightGray lv0.ForeColor = Color.DarkBlue @@ -2072,15 +1994,10 @@ lbFound: End Sub - - - 'Private Sub LvMsg_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles LvMsg.SelectedIndexChanged - ' If LvMsg.SelectedItems.Count > 0 Then LvMsg.SelectedItems.Clear() - 'End Sub - 'If it is a Link => Open it + 'Open link in message list Private Sub LvMsg_MouseClick(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles LvMsg.MouseClick Dim txt As String If Me.LvMsg.SelectedIndices.Count > 0 Then @@ -2098,6 +2015,14 @@ lbFound: ElseIf Len(CStr(Me.LvMsg.SelectedItems(0).Tag)) > 5 AndAlso Microsoft.VisualBasic.Left(CStr(Me.LvMsg.SelectedItems(0).Tag), 5) = "<GUI>" Then txt = CStr(Me.LvMsg.SelectedItems(0).Tag).Replace("<GUI>", "") OpenVectoFile(txt) + + ElseIf Len(CStr(Me.LvMsg.SelectedItems(0).Tag)) > 5 AndAlso Microsoft.VisualBasic.Left(CStr(Me.LvMsg.SelectedItems(0).Tag), 5) = "<RUN>" Then + txt = CStr(Me.LvMsg.SelectedItems(0).Tag).Replace("<RUN>", "") + Try + Process.Start(txt) + Catch ex As Exception + GUImsg(tMsgID.Err, "Could not run '" & txt & "'!") + End Try Else OpenFiles(CStr(Me.LvMsg.SelectedItems(0).Tag)) End If @@ -2105,7 +2030,7 @@ lbFound: End If End Sub - 'Hand cursor for links + 'Link-cursor (Hand) for links Private Sub LvMsg_MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles LvMsg.MouseMove Dim lv0 As ListViewItem lv0 = Me.LvMsg.GetItemAt(e.Location.X, e.Location.Y) @@ -2120,6 +2045,7 @@ lbFound: Private CmFiles As String() + 'Initialise and open context menu Private Sub OpenFiles(ParamArray files() As String) If files.Length = 0 Then Exit Sub @@ -2132,14 +2058,12 @@ lbFound: End Sub - Private Sub OpenWithGRAPHiToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles OpenWithGRAPHiToolStripMenuItem.Click - If Not FileOpenGRAPHi(CmFiles) Then MsgBox("Failed to open file!") - End Sub - + 'Open with tool defined in Settings Private Sub OpenWithToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles OpenWithToolStripMenuItem.Click If Not FileOpenAlt(CmFiles(0)) Then MsgBox("Failed to open file!") End Sub + 'Show in folder Private Sub ShowInFolderToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ShowInFolderToolStripMenuItem.Click If IO.File.Exists(CmFiles(0)) Then Try @@ -2153,6 +2077,389 @@ lbFound: End Sub #End Region - - + + 'Change Declaraion Mode + Private Sub CbDecl_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles CbDecl.CheckedChanged + + If CbDeclLock Then Exit Sub + + If F_VECTO.Visible Or F_VEH.Visible Or F_GBX.Visible Or F_ENG.Visible Or F_Settings.Visible Then + CbDeclLock = True + Me.CbDecl.Checked = Not Me.CbDecl.Checked + CbDeclLock = False + MsgBox("Please close all dialog windows (e.g. VECTO Editor) before changing mode!") + Else + Cfg.DeclMode = Me.CbDecl.Checked + DeclOnOff() + End If + + + End Sub + + + +#Region "GUI Tests" + + Private GUItest0 As New GUItest(Me) + + Private Class GUItest + Private RowLim As Int16 = 9 + Private ColLim As Int16 = 45 + Public TestActive As Boolean = False + Private TestAborted As Boolean + Private xCtrl As Int16 + Private xPanel As Int16 + Private Scr As Int32 + Private PRbAlt As Boolean + Private Ctrls(RowLim + 1) As Int16 + Private Pnls(RowLim + 1) As Int16 + Private CtrlC As Int16 + Private CtrlCL As Int16 + Private PnDir As Int16 + Private PnDirC As Int16 + Private PnDirCL As Int16 + Private PnDirRnd As Int16 + Private CtrlRnd As Int16 + Private DiffC As Int16 + Private DiffLvl As Int16 + Private bInit As Int16 + Private MyForm As F_MAINForm + Private KeyCode As List(Of Integer) + + Private Sub TestRun() + + Dim z As Int16 + + xPanel = ColLim - 10 + xCtrl = ColLim - 10 + PRbAlt = False + Scr = 0 + PnDir = 0 + PnDirCL = 10 + PnDirC = 0 ' StrDirCL + CtrlCL = 5 + CtrlC = CtrlCL + PnDirRnd = 5 + CtrlRnd = 8 + DiffC = 0 + DiffLvl = 1 + bInit = 0 + TestAborted = False + Randomize() + + + MyForm.LvMsg.Items.Clear() + MyForm.ToolStripLbStatus.Text = "Score: 0000 Press <Esc> to Quit" + + For z = 1 To RowLim - 6 + PRbAlt = Not PRbAlt + If Not PRbAlt Then + MyForm.LvMsg.Items.Add(Space(ColLim - 11) & "*| |*") + Else + MyForm.LvMsg.Items.Add(Space(ColLim - 11) & "*| | |*") + End If + Next + + PRbAlt = False + + MyForm.LvMsg.Items.Add(" VECTO Interactive Mode" & Space(ColLim - 35) & "*| |*") + MyForm.LvMsg.Items.Add(Space(ColLim - 11) & "*| | |*") + MyForm.LvMsg.Items.Add(Space(ColLim - 11) & "*| |*") + MyForm.LvMsg.Items.Add(Space(ColLim - 11) & "*| | |*") + MyForm.LvMsg.Items.Add(Space(ColLim - 11) & "*| |*") + MyForm.LvMsg.Items.Add(Space(ColLim - 11) & "*| ∆ |*") + + For z = 1 To RowLim + 1 + Pnls(z) = ColLim - 10 + Ctrls(z) = 0 + Next + + MyForm.TmProgSec.Interval = 200 + + MyForm.LvMsg.Focus() + + MyForm.TmProgSec.Start() + + + End Sub + + Public Sub TestStop() + MyForm.TmProgSec.Stop() + TestActive = False + MyForm.LvMsg.Items.Clear() + CtrlC = 0 + MyForm.ToolStripLbStatus.Text = MyForm.LastModeName & " Mode" + End Sub + + Public Sub TestTick() + + If bInit = 24 Then GoTo LbRace + bInit += 1 + + Select Case bInit + Case 10 + MyForm.LvMsg.Items.RemoveAt(RowLim - 6) + MyForm.LvMsg.Items.RemoveAt(RowLim - 5) + MyForm.LvMsg.Items.Insert(RowLim - 6, Space(ColLim - 11) & "*| |*") + MyForm.LvMsg.Items.Insert(RowLim - 4, Space(ColLim - 30) & " 3 " & Space(10) & "*| |*") + Case 14 + MyForm.LvMsg.Items.RemoveAt(RowLim - 4) + MyForm.LvMsg.Items.Insert(RowLim - 4, Space(ColLim - 30) & " 2 " & Space(10) & "*| |*") + Case 18 + MyForm.LvMsg.Items.RemoveAt(RowLim - 4) + MyForm.LvMsg.Items.Insert(RowLim - 4, Space(ColLim - 30) & " 1 " & Space(10) & "*| |*") + Case 22 + MyForm.LvMsg.Items.RemoveAt(RowLim - 4) + MyForm.LvMsg.Items.Insert(RowLim - 4, Space(ColLim - 30) & " Go! " & Space(10) & "*| |*") + Case 24 + MyForm.LvMsg.Items.RemoveAt(RowLim - 4) + MyForm.LvMsg.Items.Insert(RowLim - 4, Space(ColLim - 30) & " " & Space(10) & "*| |*") + End Select + Exit Sub +LbRace: + + PRbAlt = Not PRbAlt + + MyForm.LvMsg.BeginUpdate() + + sLists() + + sAlign() + + sSetCtrl() + + sSetPanel() + + MyForm.LvMsg.Items.RemoveAt(RowLim) + + sUpdateCtrl() + + MyForm.LvMsg.EndUpdate() + + If Math.Abs(xCtrl - Pnls(2)) > 4 Then + sAbort() + Exit Sub + ElseIf Ctrls(2) <> 0 Then + If xCtrl = Pnls(2) + Ctrls(2) - 4 Then + sAbort() + Exit Sub + End If + Scr += 5 * DiffLvl + End If + + Scr += DiffLvl + DiffC += 1 + + 'Erhöhe Schwierigkeitsgrad + If DiffC = (DiffLvl + 3) * 4 Then + DiffC = 0 + DiffLvl += 1 + If DiffLvl > 2 And DiffLvl < 7 Then MyForm.TmProgSec.Interval = 300 - (DiffLvl) * 30 + Scr += 100 + Select Case DiffLvl + Case 3 + PnDirCL = 3 + CtrlCL = 4 + CtrlRnd = 6 + Case 5 + PnDirCL = 2 + PnDirRnd = 4 + Case 8 + CtrlCL = 2 + Case 10 + CtrlRnd = 4 + PnDirRnd = 3 + End Select + End If + + End Sub + + Public Sub TestKey(ByVal Key0 As Integer) + + If TestActive Then + Select Case Key0 + Case Keys.Left + xCtrl -= 1 + sUpdateCtrl() + Case Keys.Right + xCtrl += 1 + sUpdateCtrl() + Case Keys.Escape + TestStop() + End Select + Else + + If KeyCode(CtrlC) = Key0 Then + CtrlC += 1 + If CtrlC = KeyCode.Count Then + TestActive = True + TestRun() + End If + Else + CtrlC = 0 + End If + + End If + End Sub + + Private Sub sAbort() + + Dim s As String, s1 As String + + If TestAborted Then Exit Sub + + TestAborted = True + + MyForm.TmProgSec.Stop() + + MyForm.LvMsg.BeginUpdate() + + s = MyForm.LvMsg.Items(0).Text + MyForm.LvMsg.Items.RemoveAt(0) + MyForm.LvMsg.Items.Insert(0, "You crashed!" & Microsoft.VisualBasic.Right(s, Len(s) - 12)) + + s = MyForm.LvMsg.Items(1).Text + s1 = "Score: " & Scr & " " + MyForm.LvMsg.Items.RemoveAt(1) + MyForm.LvMsg.Items.Insert(1, s1 & Microsoft.VisualBasic.Right(s, Len(s) - Len(s1))) + + MyForm.LvMsg.EndUpdate() + + LogFile.WriteToLog(tMsgID.Normal, "*** Race Score: " & Scr.ToString("0000") & " ***") + + CtrlC = 0 + TestActive = False + + MyForm.ToolStripLbStatus.Text = MyForm.LastModeName & " Mode" + + + End Sub + + Private Sub sSetCtrl() + Dim x As Int16 + If Scr < 10 Then Exit Sub + Ctrls(RowLim + 1) = 0 + CtrlC += 1 + If CtrlC < CtrlCL Then Exit Sub + Select Case CInt(Int((CtrlRnd * Rnd()) + 1)) + Case 1, 2 + CtrlC = 0 + x = CInt(Int((7 * Rnd()) + 1)) + Ctrls(RowLim + 1) = x + Case Else + End Select + End Sub + + Private Sub sUpdateCtrl() + Dim s As String + If bInit < 21 Then + xCtrl = ColLim - 10 + Exit Sub + End If + If Math.Abs(xCtrl - Pnls(1)) > 5 Then + sAbort() + Exit Sub + End If + s = Replace(MyForm.LvMsg.Items(RowLim - 1).Text.ToString, "∆", " ") & " " + s = Microsoft.VisualBasic.Left(s, ColLim + 15) + 's = s.Remove(0, 20) + 's = "Press <Esc> to Quit " & s + If Mid(s, xCtrl + 5, 1) = "X" Then + sAbort() + Exit Sub + End If + s = s.Remove(xCtrl + 4, 1) + 's = Trim(s.Insert(xCar + 4, "∆")) & Space(ColLim + 5 - Streets(2)) & "Pts: " & Pts & " Lv: " & DiffLvl + s = Space(Pnls(2) - 1) & Trim(s.Insert(xCtrl + 4, "∆")) + MyForm.LvMsg.Items.RemoveAt(RowLim - 1) + MyForm.LvMsg.Items.Insert(RowLim - 1, s) + MyForm.ToolStripLbStatus.Text = "Score: " & Scr.ToString("0000") & " Press <Esc> to Quit" + End Sub + + Private Sub sSetPanel() + Dim s As String + s = "*| | |*" + If PRbAlt Then + s = s.Remove(5, 1) + s = s.Insert(5, " ") + End If + If Ctrls(RowLim + 1) <> 0 Then + s = s.Remove(Ctrls(RowLim + 1) + 1, 1) + s = s.Insert(Ctrls(RowLim + 1) + 1, "X") + End If + Select Case xPanel - Pnls(RowLim) + Case -1 + s = Replace(s, "|", "\") + Case 1 + s = Replace(s, "|", "/") + End Select + MyForm.LvMsg.Items.Insert(0, Space(xPanel - 1) & s) + End Sub + + Private Sub sAlign() + PnDirC += 1 + If PnDirC < PnDirCL Then GoTo Lb1 + PnDirC = 0 + Select Case CInt(Int((PnDirRnd * Rnd()) + 1)) + Case 1 + PnDir = 1 + Case 2 + PnDir = -1 + Case Else + PnDir = 0 + End Select +Lb1: + xPanel += PnDir + If xPanel > ColLim Then + xPanel = ColLim + ElseIf xPanel < 22 Then + xPanel = 22 + End If + Pnls(RowLim + 1) = xPanel + End Sub + + Private Sub sLists() + Dim x As Int16 + For x = 2 To RowLim + 1 + Ctrls(x - 1) = Ctrls(x) + Pnls(x - 1) = Pnls(x) + Next + End Sub + + Public Sub New(ByVal Form As F_MAINForm) + MyForm = Form + KeyCode = New List(Of Integer) + KeyCode.Add(Keys.Up) + KeyCode.Add(Keys.Up) + KeyCode.Add(Keys.Down) + KeyCode.Add(Keys.Down) + KeyCode.Add(Keys.Left) + KeyCode.Add(Keys.Right) + KeyCode.Add(Keys.Left) + KeyCode.Add(Keys.Right) + KeyCode.Add(Keys.B) + KeyCode.Add(Keys.A) + CtrlC = 0 + End Sub + + End Class + + Private Sub LvMsg_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles LvMsg.KeyDown + GUItest0.TestKey(e.KeyValue) + If GUItest0.TestActive Then e.SuppressKeyPress = True + End Sub + + Private Sub LvMsg_LostFocus(sender As Object, e As System.EventArgs) Handles LvMsg.LostFocus + If GUItest0.TestActive Then GUItest0.TestStop() + End Sub + +#End Region + + Private Sub GraphToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles GraphToolStripMenuItem.Click + + Dim FGraph As New F_Graph + + FGraph.Show() + + End Sub End Class diff --git a/VECTO/GUI/F_Options.Designer.vb b/VECTO/GUI/F_Settings.Designer.vb similarity index 82% rename from VECTO/GUI/F_Options.Designer.vb rename to VECTO/GUI/F_Settings.Designer.vb index 6d9869f486b5cb7143d1f26185f4f564bd8d98f6..9cde83e159936274de5a9d51dabcd3c849060248 100644 --- a/VECTO/GUI/F_Options.Designer.vb +++ b/VECTO/GUI/F_Settings.Designer.vb @@ -1,5 +1,5 @@ <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ -Partial Class F_Options +Partial Class F_Settings Inherits System.Windows.Forms.Form 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. @@ -22,9 +22,6 @@ Partial Class F_Options 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. <System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent() - Me.TextBoxWorDir = New System.Windows.Forms.TextBox() - Me.ButtonWorDir = New System.Windows.Forms.Button() - Me.GroupBoxWorDir = New System.Windows.Forms.GroupBox() Me.ButtonOK = New System.Windows.Forms.Button() Me.ButtonCancel = New System.Windows.Forms.Button() Me.GroupBox3 = New System.Windows.Forms.GroupBox() @@ -49,7 +46,6 @@ Partial Class F_Options Me.Label2 = New System.Windows.Forms.Label() Me.ButReset = New System.Windows.Forms.Button() Me.BtHelp = New System.Windows.Forms.Button() - Me.GroupBoxWorDir.SuspendLayout() Me.GroupBox3.SuspendLayout() Me.GroupBox5.SuspendLayout() Me.TabControl1.SuspendLayout() @@ -57,38 +53,10 @@ Partial Class F_Options Me.GrCalc.SuspendLayout() Me.SuspendLayout() ' - 'TextBoxWorDir - ' - Me.TextBoxWorDir.Location = New System.Drawing.Point(6, 19) - Me.TextBoxWorDir.Name = "TextBoxWorDir" - Me.TextBoxWorDir.Size = New System.Drawing.Size(444, 20) - Me.TextBoxWorDir.TabIndex = 1 - ' - 'ButtonWorDir - ' - Me.ButtonWorDir.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.ButtonWorDir.Location = New System.Drawing.Point(456, 19) - Me.ButtonWorDir.Name = "ButtonWorDir" - Me.ButtonWorDir.Size = New System.Drawing.Size(26, 20) - Me.ButtonWorDir.TabIndex = 2 - Me.ButtonWorDir.Text = "..." - Me.ButtonWorDir.UseVisualStyleBackColor = True - ' - 'GroupBoxWorDir - ' - Me.GroupBoxWorDir.Controls.Add(Me.ButtonWorDir) - Me.GroupBoxWorDir.Controls.Add(Me.TextBoxWorDir) - Me.GroupBoxWorDir.Location = New System.Drawing.Point(5, 6) - Me.GroupBoxWorDir.Name = "GroupBoxWorDir" - Me.GroupBoxWorDir.Size = New System.Drawing.Size(490, 51) - Me.GroupBoxWorDir.TabIndex = 2 - Me.GroupBoxWorDir.TabStop = False - Me.GroupBoxWorDir.Text = "Working Directory" - ' 'ButtonOK ' Me.ButtonOK.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ButtonOK.Location = New System.Drawing.Point(347, 337) + Me.ButtonOK.Location = New System.Drawing.Point(347, 287) Me.ButtonOK.Name = "ButtonOK" Me.ButtonOK.Size = New System.Drawing.Size(75, 26) Me.ButtonOK.TabIndex = 0 @@ -99,7 +67,7 @@ Partial Class F_Options ' Me.ButtonCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.ButtonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel - Me.ButtonCancel.Location = New System.Drawing.Point(428, 337) + Me.ButtonCancel.Location = New System.Drawing.Point(428, 287) Me.ButtonCancel.Name = "ButtonCancel" Me.ButtonCancel.Size = New System.Drawing.Size(75, 26) Me.ButtonCancel.TabIndex = 1 @@ -111,7 +79,7 @@ Partial Class F_Options Me.GroupBox3.Controls.Add(Me.GroupBox5) Me.GroupBox3.Controls.Add(Me.TextBoxLogSize) Me.GroupBox3.Controls.Add(Me.Label16) - Me.GroupBox3.Location = New System.Drawing.Point(5, 63) + Me.GroupBox3.Location = New System.Drawing.Point(5, 6) Me.GroupBox3.Name = "GroupBox3" Me.GroupBox3.Size = New System.Drawing.Size(489, 124) Me.GroupBox3.TabIndex = 11 @@ -188,18 +156,17 @@ Partial Class F_Options Me.TabControl1.Location = New System.Drawing.Point(3, 3) Me.TabControl1.Name = "TabControl1" Me.TabControl1.SelectedIndex = 0 - Me.TabControl1.Size = New System.Drawing.Size(508, 328) + Me.TabControl1.Size = New System.Drawing.Size(508, 278) Me.TabControl1.TabIndex = 12 ' 'TabPage2 ' Me.TabPage2.Controls.Add(Me.GrCalc) - Me.TabPage2.Controls.Add(Me.GroupBoxWorDir) Me.TabPage2.Controls.Add(Me.GroupBox3) Me.TabPage2.Location = New System.Drawing.Point(4, 22) Me.TabPage2.Name = "TabPage2" Me.TabPage2.Padding = New System.Windows.Forms.Padding(3) - Me.TabPage2.Size = New System.Drawing.Size(500, 302) + Me.TabPage2.Size = New System.Drawing.Size(500, 252) Me.TabPage2.TabIndex = 0 Me.TabPage2.Text = "VECTO" Me.TabPage2.UseVisualStyleBackColor = True @@ -215,7 +182,7 @@ Partial Class F_Options Me.GrCalc.Controls.Add(Me.Label8) Me.GrCalc.Controls.Add(Me.TbAirDensity) Me.GrCalc.Controls.Add(Me.Label2) - Me.GrCalc.Location = New System.Drawing.Point(6, 193) + Me.GrCalc.Location = New System.Drawing.Point(6, 136) Me.GrCalc.Name = "GrCalc" Me.GrCalc.Size = New System.Drawing.Size(488, 103) Me.GrCalc.TabIndex = 12 @@ -300,7 +267,7 @@ Partial Class F_Options 'ButReset ' Me.ButReset.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) - Me.ButReset.Location = New System.Drawing.Point(35, 337) + Me.ButReset.Location = New System.Drawing.Point(35, 287) Me.ButReset.Name = "ButReset" Me.ButReset.Size = New System.Drawing.Size(108, 26) Me.ButReset.TabIndex = 13 @@ -311,19 +278,19 @@ Partial Class F_Options ' Me.BtHelp.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) Me.BtHelp.Image = Global.VECTO.My.Resources.Resources.Help_icon - Me.BtHelp.Location = New System.Drawing.Point(3, 337) + Me.BtHelp.Location = New System.Drawing.Point(3, 287) Me.BtHelp.Name = "BtHelp" Me.BtHelp.Size = New System.Drawing.Size(26, 26) Me.BtHelp.TabIndex = 14 Me.BtHelp.UseVisualStyleBackColor = True ' - 'F_Options + 'F_Settings ' Me.AcceptButton = Me.ButtonOK Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.CancelButton = Me.ButtonCancel - Me.ClientSize = New System.Drawing.Size(515, 375) + Me.ClientSize = New System.Drawing.Size(515, 325) Me.Controls.Add(Me.BtHelp) Me.Controls.Add(Me.ButReset) Me.Controls.Add(Me.TabControl1) @@ -332,10 +299,8 @@ Partial Class F_Options Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False - Me.Name = "F_Options" + Me.Name = "F_Settings" Me.Text = "Settings" - Me.GroupBoxWorDir.ResumeLayout(False) - Me.GroupBoxWorDir.PerformLayout() Me.GroupBox3.ResumeLayout(False) Me.GroupBox3.PerformLayout() Me.GroupBox5.ResumeLayout(False) @@ -347,9 +312,6 @@ Partial Class F_Options Me.ResumeLayout(False) End Sub - Friend WithEvents TextBoxWorDir As System.Windows.Forms.TextBox - Friend WithEvents ButtonWorDir As System.Windows.Forms.Button - Friend WithEvents GroupBoxWorDir As System.Windows.Forms.GroupBox Friend WithEvents ButtonOK As System.Windows.Forms.Button Friend WithEvents ButtonCancel As System.Windows.Forms.Button Friend WithEvents GroupBox3 As System.Windows.Forms.GroupBox diff --git a/VECTO/GUI/F_Options.resx b/VECTO/GUI/F_Settings.resx similarity index 100% rename from VECTO/GUI/F_Options.resx rename to VECTO/GUI/F_Settings.resx diff --git a/VECTO/GUI/F_Options.vb b/VECTO/GUI/F_Settings.vb similarity index 63% rename from VECTO/GUI/F_Options.vb rename to VECTO/GUI/F_Settings.vb index 580765e1bf674fadd798198cdf186fd9e32ff91f..093fa98b630476d90e8d0b416cf13ba7923ba651 100644 --- a/VECTO/GUI/F_Options.vb +++ b/VECTO/GUI/F_Settings.vb @@ -1,47 +1,36 @@ -Public Class F_Options - - Dim WD As String = " " +''' <summary> +''' Settings form +''' </summary> +''' <remarks></remarks> +Public Class F_Settings 'Initialize - load config Private Sub F03_Options_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load - LoadConfig() - - If Declaration.Active Then - Me.GrCalc.Enabled = False - Me.TbAirDensity.Text = cDeclaration.AirDensity - Me.TbFuelDens.Text = cDeclaration.FuelDens - Me.TbCO2toFC.Text = cDeclaration.CO2perFC - End If - - - - End Sub - 'Load Config - Private Sub LoadConfig() - Me.TextBoxWorDir.Text = Cfg.WorkDPath - WD = Cfg.WorkDPath + 'Load Config Me.TextBoxLogSize.Text = Cfg.LogSize Me.TbAirDensity.Text = CStr(Cfg.AirDensity) Me.TbOpenCmd.Text = Cfg.OpenCmd Me.TbOpenCmdName.Text = Cfg.OpenCmdName Me.TbFuelDens.Text = Cfg.FuelDens.ToString Me.TbCO2toFC.Text = Cfg.CO2perFC.ToString + + Me.GrCalc.Enabled = Not Cfg.DeclMode + End Sub 'Reset Button Private Sub ButReset_Click(sender As System.Object, e As System.EventArgs) Handles ButReset.Click If MsgBox("This will reset all application settings including the Options Tab. Filehistory will not be deleted." & vbCrLf & vbCrLf & "Continue ?", MsgBoxStyle.YesNo, "Reset Application Settings") = MsgBoxResult.Yes Then Cfg.SetDefault() - If Declaration.Active Then Cfg.DeclInit() - LoadConfig() + If Cfg.DeclMode Then Cfg.DeclInit() F_MAINForm.LoadOptions() + Me.Close() End If End Sub - 'OK + 'Save and close Private Sub ButtonOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonOK.Click - Cfg.SetWorkDir(Me.TextBoxWorDir.Text) Cfg.LogSize = CSng(Me.TextBoxLogSize.Text) Cfg.AirDensity = CSng(Me.TbAirDensity.Text) Cfg.OpenCmd = Me.TbOpenCmd.Text @@ -50,9 +39,8 @@ Cfg.CO2perFC = CSng(Me.TbCO2toFC.Text) '---------------------------------------------------- - Call Cfg.ConfigSAVE() + Cfg.ConfigSAVE() - If WD <> Cfg.WorkDPath Then GUImsg(tMsgID.Normal, "Working Directory changed to " & Cfg.WorkDPath) Me.Close() End Sub @@ -61,13 +49,7 @@ Me.Close() End Sub - 'Options----------------------------------- - Private Sub ButtonWorDir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonWorDir.Click - If fbWorkDir.OpenDialog(Me.TextBoxWorDir.Text) Then - Me.TextBoxWorDir.Text = fbWorkDir.Files(0) - End If - End Sub - + 'Help button Private Sub BtHelp_Click(sender As System.Object, e As System.EventArgs) Handles BtHelp.Click If IO.File.Exists(MyAppPath & "User Manual\GUI\settings.html") Then System.Diagnostics.Process.Start(MyAppPath & "User Manual\GUI\settings.html") diff --git a/VECTO/GUI/F_ShutDown.vb b/VECTO/GUI/F_ShutDown.vb index 275fbe4cf1923c3b948876d90c2832985322bd3a..6c958e72af5c010d2875040a62dc61fcdd0eebee 100644 --- a/VECTO/GUI/F_ShutDown.vb +++ b/VECTO/GUI/F_ShutDown.vb @@ -1,6 +1,10 @@ Imports System.Windows.Forms Imports System.Runtime.InteropServices +''' <summary> +''' Automatic shutdown dialog. Allows to abort automatic shutdown within 100 seconds. +''' </summary> +''' <remarks></remarks> Public Class F_ShutDown Private iTime As Int16 diff --git a/VECTO/GUI/F_StrInpBox.designer.vb b/VECTO/GUI/F_StrInpBox.designer.vb index 9a489091308410701cc3d102520bb957653918ab..d5984e80e0a883aab30d4e285e037ca9c63e399d 100644 --- a/VECTO/GUI/F_StrInpBox.designer.vb +++ b/VECTO/GUI/F_StrInpBox.designer.vb @@ -96,7 +96,7 @@ Partial Class F_StrInpBox Me.Name = "F_StrInpBox" Me.ShowInTaskbar = False Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent - Me.Text = "PHEM" + Me.Text = "VECTO" Me.TableLayoutPanel1.ResumeLayout(False) Me.ResumeLayout(False) Me.PerformLayout() diff --git a/VECTO/GUI/F_StrInpBox.resx b/VECTO/GUI/F_StrInpBox.resx index 5ea0895e324fa7a86681adc56938bad2f2367ba0..29dcb1b3a353ba227f65e11fbe3d6f0766e84292 100644 --- a/VECTO/GUI/F_StrInpBox.resx +++ b/VECTO/GUI/F_StrInpBox.resx @@ -112,9 +112,9 @@ <value>2.0</value> </resheader> <resheader name="reader"> - <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> - <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> </root> \ No newline at end of file diff --git a/VECTO/GUI/F_StrInpBox.vb b/VECTO/GUI/F_StrInpBox.vb index 822992b8f5ba3618f02444d962612ff1c4681fef..11286fc872bb15249922c8651bcc081924fffb0f 100644 --- a/VECTO/GUI/F_StrInpBox.vb +++ b/VECTO/GUI/F_StrInpBox.vb @@ -1,5 +1,9 @@ Imports System.Windows.Forms +''' <summary> +''' String input dialog for changing DEV option values. Default input box cannot process empty strings (emtpy string = Cancel). +''' </summary> +''' <remarks></remarks> Public Class F_StrInpBox Public Function ShowDlog(ByVal Prompt As String, ByVal DefaultRespone As String) As String diff --git a/VECTO/GUI/F_VECTO.Designer.vb b/VECTO/GUI/F_VECTO.Designer.vb index b9568ae90a0634bfdea6cd1ab5f3bf2072ea1cd5..781995a9050252bd4b7099c301653eb40d5cb6a5 100644 --- a/VECTO/GUI/F_VECTO.Designer.vb +++ b/VECTO/GUI/F_VECTO.Designer.vb @@ -41,7 +41,7 @@ Partial Class F_VECTO Me.ButAuxAdd = New System.Windows.Forms.Button() Me.TbGBX = New System.Windows.Forms.TextBox() Me.TbENG = New System.Windows.Forms.TextBox() - Me.TextBoxVEH = New System.Windows.Forms.TextBox() + Me.TbVEH = New System.Windows.Forms.TextBox() Me.ButOpenGBX = New System.Windows.Forms.Button() Me.ButOpenENG = New System.Windows.Forms.Button() Me.ButOpenVEH = New System.Windows.Forms.Button() @@ -50,8 +50,7 @@ Partial Class F_VECTO Me.ButtonMAP = New System.Windows.Forms.Button() Me.TabControl1 = New System.Windows.Forms.TabControl() Me.TabPgDriver = New System.Windows.Forms.TabPage() - Me.PnVACC = New System.Windows.Forms.Panel() - Me.Label1 = New System.Windows.Forms.Label() + Me.GrVACC = New System.Windows.Forms.GroupBox() Me.TbDesMaxFile = New System.Windows.Forms.TextBox() Me.BtDesMaxBr = New System.Windows.Forms.Button() Me.BtAccOpen = New System.Windows.Forms.Button() @@ -65,6 +64,7 @@ Partial Class F_VECTO Me.Label28 = New System.Windows.Forms.Label() Me.CbLookAhead = New System.Windows.Forms.CheckBox() Me.GroupBox1 = New System.Windows.Forms.GroupBox() + Me.PnEcoRoll = New System.Windows.Forms.Panel() Me.Label21 = New System.Windows.Forms.Label() Me.Label20 = New System.Windows.Forms.Label() Me.Label14 = New System.Windows.Forms.Label() @@ -105,24 +105,34 @@ Partial Class F_VECTO Me.PictureBox1 = New System.Windows.Forms.PictureBox() Me.CbEngOnly = New System.Windows.Forms.CheckBox() Me.CmOpenFile = New System.Windows.Forms.ContextMenuStrip(Me.components) - Me.OpenWithGRAPHiToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.OpenWithToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ShowInFolderToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() + Me.PicVehicle = New System.Windows.Forms.PictureBox() + Me.PicBox = New System.Windows.Forms.PictureBox() + Me.TbEngTxt = New System.Windows.Forms.TextBox() + Me.TbVehCat = New System.Windows.Forms.TextBox() + Me.TbAxleConf = New System.Windows.Forms.TextBox() + Me.TbHVCclass = New System.Windows.Forms.TextBox() + Me.TbGbxTxt = New System.Windows.Forms.TextBox() + Me.TbMass = New System.Windows.Forms.TextBox() Me.TabPgGen.SuspendLayout() Me.GrCycles.SuspendLayout() Me.GrAux.SuspendLayout() Me.TabControl1.SuspendLayout() Me.TabPgDriver.SuspendLayout() - Me.PnVACC.SuspendLayout() + Me.GrVACC.SuspendLayout() Me.GrLAC.SuspendLayout() Me.PnLookAhead.SuspendLayout() Me.GroupBox1.SuspendLayout() + Me.PnEcoRoll.SuspendLayout() Me.GrStartStop.SuspendLayout() Me.PnStartStop.SuspendLayout() Me.StatusStrip1.SuspendLayout() Me.ToolStrip1.SuspendLayout() CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit() Me.CmOpenFile.SuspendLayout() + CType(Me.PicVehicle, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.PicBox, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'TabPgGen @@ -131,7 +141,7 @@ Partial Class F_VECTO Me.TabPgGen.Controls.Add(Me.GrAux) Me.TabPgGen.Controls.Add(Me.TbGBX) Me.TabPgGen.Controls.Add(Me.TbENG) - Me.TabPgGen.Controls.Add(Me.TextBoxVEH) + Me.TabPgGen.Controls.Add(Me.TbVEH) Me.TabPgGen.Controls.Add(Me.ButOpenGBX) Me.TabPgGen.Controls.Add(Me.ButOpenENG) Me.TabPgGen.Controls.Add(Me.ButOpenVEH) @@ -141,28 +151,32 @@ Partial Class F_VECTO Me.TabPgGen.Location = New System.Drawing.Point(4, 22) Me.TabPgGen.Name = "TabPgGen" Me.TabPgGen.Padding = New System.Windows.Forms.Padding(3) - Me.TabPgGen.Size = New System.Drawing.Size(646, 442) + Me.TabPgGen.Size = New System.Drawing.Size(527, 491) Me.TabPgGen.TabIndex = 0 Me.TabPgGen.Text = "General" Me.TabPgGen.UseVisualStyleBackColor = True ' 'GrCycles ' + Me.GrCycles.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.GrCycles.Controls.Add(Me.Label2) Me.GrCycles.Controls.Add(Me.LvCycles) Me.GrCycles.Controls.Add(Me.BtDRIrem) Me.GrCycles.Controls.Add(Me.BtDRIadd) - Me.GrCycles.Location = New System.Drawing.Point(6, 247) + Me.GrCycles.Location = New System.Drawing.Point(7, 271) Me.GrCycles.Name = "GrCycles" - Me.GrCycles.Size = New System.Drawing.Size(634, 177) + Me.GrCycles.Size = New System.Drawing.Size(515, 208) Me.GrCycles.TabIndex = 34 Me.GrCycles.TabStop = False Me.GrCycles.Text = "Cycles" ' 'Label2 ' + Me.Label2.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.Label2.AutoSize = True - Me.Label2.Location = New System.Drawing.Point(506, 153) + Me.Label2.Location = New System.Drawing.Point(387, 153) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(122, 13) Me.Label2.TabIndex = 33 @@ -170,6 +184,8 @@ Partial Class F_VECTO ' 'LvCycles ' + Me.LvCycles.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.LvCycles.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader1}) Me.LvCycles.FullRowSelect = True Me.LvCycles.GridLines = True @@ -179,7 +195,7 @@ Partial Class F_VECTO Me.LvCycles.Location = New System.Drawing.Point(6, 19) Me.LvCycles.MultiSelect = False Me.LvCycles.Name = "LvCycles" - Me.LvCycles.Size = New System.Drawing.Size(622, 123) + Me.LvCycles.Size = New System.Drawing.Size(503, 123) Me.LvCycles.TabIndex = 0 Me.LvCycles.TabStop = False Me.LvCycles.UseCompatibleStateImageBehavior = False @@ -188,13 +204,13 @@ Partial Class F_VECTO 'ColumnHeader1 ' Me.ColumnHeader1.Text = "Cycle path" - Me.ColumnHeader1.Width = 615 + Me.ColumnHeader1.Width = 470 ' 'BtDRIrem ' Me.BtDRIrem.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) Me.BtDRIrem.Image = Global.VECTO.My.Resources.Resources.minus_circle_icon - Me.BtDRIrem.Location = New System.Drawing.Point(41, 148) + Me.BtDRIrem.Location = New System.Drawing.Point(41, 179) Me.BtDRIrem.Name = "BtDRIrem" Me.BtDRIrem.Size = New System.Drawing.Size(29, 23) Me.BtDRIrem.TabIndex = 32 @@ -204,7 +220,7 @@ Partial Class F_VECTO ' Me.BtDRIadd.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) Me.BtDRIadd.Image = Global.VECTO.My.Resources.Resources.plus_circle_icon - Me.BtDRIadd.Location = New System.Drawing.Point(6, 148) + Me.BtDRIadd.Location = New System.Drawing.Point(6, 179) Me.BtDRIadd.Name = "BtDRIadd" Me.BtDRIadd.Size = New System.Drawing.Size(29, 23) Me.BtDRIadd.TabIndex = 31 @@ -212,21 +228,25 @@ Partial Class F_VECTO ' 'GrAux ' + Me.GrAux.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.GrAux.Controls.Add(Me.Label32) Me.GrAux.Controls.Add(Me.LvAux) Me.GrAux.Controls.Add(Me.ButAuxRem) Me.GrAux.Controls.Add(Me.ButAuxAdd) Me.GrAux.Location = New System.Drawing.Point(6, 87) Me.GrAux.Name = "GrAux" - Me.GrAux.Size = New System.Drawing.Size(634, 154) + Me.GrAux.Size = New System.Drawing.Size(515, 209) Me.GrAux.TabIndex = 33 Me.GrAux.TabStop = False Me.GrAux.Text = "Auxiliaries" ' 'Label32 ' + Me.Label32.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.Label32.AutoSize = True - Me.Label32.Location = New System.Drawing.Point(489, 130) + Me.Label32.Location = New System.Drawing.Point(369, 147) Me.Label32.Name = "Label32" Me.Label32.Size = New System.Drawing.Size(139, 13) Me.Label32.TabIndex = 34 @@ -243,7 +263,7 @@ Partial Class F_VECTO Me.LvAux.Location = New System.Drawing.Point(6, 19) Me.LvAux.MultiSelect = False Me.LvAux.Name = "LvAux" - Me.LvAux.Size = New System.Drawing.Size(622, 100) + Me.LvAux.Size = New System.Drawing.Size(503, 117) Me.LvAux.TabIndex = 30 Me.LvAux.TabStop = False Me.LvAux.UseCompatibleStateImageBehavior = False @@ -252,23 +272,22 @@ Partial Class F_VECTO 'ColumnHeader4 ' Me.ColumnHeader4.Text = "ID" - Me.ColumnHeader4.Width = 40 + Me.ColumnHeader4.Width = 45 ' 'ColumnHeader5 ' Me.ColumnHeader5.Text = "Type" - Me.ColumnHeader5.Width = 118 + Me.ColumnHeader5.Width = 108 ' 'ColumnHeader6 ' Me.ColumnHeader6.Text = "Input File" - Me.ColumnHeader6.Width = 457 + Me.ColumnHeader6.Width = 331 ' 'ButAuxRem ' - Me.ButAuxRem.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) Me.ButAuxRem.Image = Global.VECTO.My.Resources.Resources.minus_circle_icon - Me.ButAuxRem.Location = New System.Drawing.Point(41, 125) + Me.ButAuxRem.Location = New System.Drawing.Point(42, 142) Me.ButAuxRem.Name = "ButAuxRem" Me.ButAuxRem.Size = New System.Drawing.Size(29, 23) Me.ButAuxRem.TabIndex = 32 @@ -276,9 +295,8 @@ Partial Class F_VECTO ' 'ButAuxAdd ' - Me.ButAuxAdd.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) Me.ButAuxAdd.Image = Global.VECTO.My.Resources.Resources.plus_circle_icon - Me.ButAuxAdd.Location = New System.Drawing.Point(6, 125) + Me.ButAuxAdd.Location = New System.Drawing.Point(7, 142) Me.ButAuxAdd.Name = "ButAuxAdd" Me.ButAuxAdd.Size = New System.Drawing.Size(29, 23) Me.ButAuxAdd.TabIndex = 31 @@ -290,7 +308,7 @@ Partial Class F_VECTO Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.TbGBX.Location = New System.Drawing.Point(84, 60) Me.TbGBX.Name = "TbGBX" - Me.TbGBX.Size = New System.Drawing.Size(525, 20) + Me.TbGBX.Size = New System.Drawing.Size(406, 20) Me.TbGBX.TabIndex = 3 ' 'TbENG @@ -299,17 +317,17 @@ Partial Class F_VECTO Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.TbENG.Location = New System.Drawing.Point(84, 33) Me.TbENG.Name = "TbENG" - Me.TbENG.Size = New System.Drawing.Size(525, 20) + Me.TbENG.Size = New System.Drawing.Size(406, 20) Me.TbENG.TabIndex = 2 ' - 'TextBoxVEH + 'TbVEH ' - Me.TextBoxVEH.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ + Me.TbVEH.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.TextBoxVEH.Location = New System.Drawing.Point(84, 7) - Me.TextBoxVEH.Name = "TextBoxVEH" - Me.TextBoxVEH.Size = New System.Drawing.Size(525, 20) - Me.TextBoxVEH.TabIndex = 1 + Me.TbVEH.Location = New System.Drawing.Point(84, 7) + Me.TbVEH.Name = "TbVEH" + Me.TbVEH.Size = New System.Drawing.Size(406, 20) + Me.TbVEH.TabIndex = 1 ' 'ButOpenGBX ' @@ -344,7 +362,7 @@ Partial Class F_VECTO 'ButtonVEH ' Me.ButtonVEH.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ButtonVEH.Location = New System.Drawing.Point(615, 6) + Me.ButtonVEH.Location = New System.Drawing.Point(496, 6) Me.ButtonVEH.Name = "ButtonVEH" Me.ButtonVEH.Size = New System.Drawing.Size(28, 21) Me.ButtonVEH.TabIndex = 11 @@ -355,7 +373,7 @@ Partial Class F_VECTO 'ButtonGBX ' Me.ButtonGBX.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ButtonGBX.Location = New System.Drawing.Point(615, 60) + Me.ButtonGBX.Location = New System.Drawing.Point(496, 60) Me.ButtonGBX.Name = "ButtonGBX" Me.ButtonGBX.Size = New System.Drawing.Size(28, 21) Me.ButtonGBX.TabIndex = 13 @@ -366,7 +384,7 @@ Partial Class F_VECTO 'ButtonMAP ' Me.ButtonMAP.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ButtonMAP.Location = New System.Drawing.Point(615, 33) + Me.ButtonMAP.Location = New System.Drawing.Point(496, 33) Me.ButtonMAP.Name = "ButtonMAP" Me.ButtonMAP.Size = New System.Drawing.Size(28, 21) Me.ButtonMAP.TabIndex = 12 @@ -383,54 +401,49 @@ Partial Class F_VECTO Me.TabControl1.Location = New System.Drawing.Point(1, 107) Me.TabControl1.Name = "TabControl1" Me.TabControl1.SelectedIndex = 0 - Me.TabControl1.Size = New System.Drawing.Size(654, 468) + Me.TabControl1.Size = New System.Drawing.Size(535, 517) Me.TabControl1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed Me.TabControl1.TabIndex = 1 ' 'TabPgDriver ' - Me.TabPgDriver.Controls.Add(Me.PnVACC) + Me.TabPgDriver.Controls.Add(Me.GrVACC) Me.TabPgDriver.Controls.Add(Me.GrLAC) Me.TabPgDriver.Controls.Add(Me.GroupBox1) Me.TabPgDriver.Controls.Add(Me.GrStartStop) Me.TabPgDriver.Location = New System.Drawing.Point(4, 22) Me.TabPgDriver.Name = "TabPgDriver" Me.TabPgDriver.Padding = New System.Windows.Forms.Padding(3) - Me.TabPgDriver.Size = New System.Drawing.Size(646, 442) + Me.TabPgDriver.Size = New System.Drawing.Size(527, 491) Me.TabPgDriver.TabIndex = 7 Me.TabPgDriver.Text = "Driver Assist" Me.TabPgDriver.UseVisualStyleBackColor = True ' - 'PnVACC - ' - Me.PnVACC.Controls.Add(Me.Label1) - Me.PnVACC.Controls.Add(Me.TbDesMaxFile) - Me.PnVACC.Controls.Add(Me.BtDesMaxBr) - Me.PnVACC.Controls.Add(Me.BtAccOpen) - Me.PnVACC.Location = New System.Drawing.Point(3, 6) - Me.PnVACC.Name = "PnVACC" - Me.PnVACC.Size = New System.Drawing.Size(640, 44) - Me.PnVACC.TabIndex = 33 + 'GrVACC ' - 'Label1 - ' - Me.Label1.AutoSize = True - Me.Label1.Location = New System.Drawing.Point(3, 0) - Me.Label1.Name = "Label1" - Me.Label1.Size = New System.Drawing.Size(177, 13) - Me.Label1.TabIndex = 32 - Me.Label1.Text = "Max. acceleration and brake curves" + Me.GrVACC.Controls.Add(Me.TbDesMaxFile) + Me.GrVACC.Controls.Add(Me.BtDesMaxBr) + Me.GrVACC.Controls.Add(Me.BtAccOpen) + Me.GrVACC.Location = New System.Drawing.Point(6, 401) + Me.GrVACC.Name = "GrVACC" + Me.GrVACC.Size = New System.Drawing.Size(515, 84) + Me.GrVACC.TabIndex = 34 + Me.GrVACC.TabStop = False + Me.GrVACC.Text = "Max. acceleration and brake curves" ' 'TbDesMaxFile ' - Me.TbDesMaxFile.Location = New System.Drawing.Point(3, 16) + Me.TbDesMaxFile.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.TbDesMaxFile.Location = New System.Drawing.Point(6, 29) Me.TbDesMaxFile.Name = "TbDesMaxFile" - Me.TbDesMaxFile.Size = New System.Drawing.Size(571, 20) + Me.TbDesMaxFile.Size = New System.Drawing.Size(440, 20) Me.TbDesMaxFile.TabIndex = 0 ' 'BtDesMaxBr ' - Me.BtDesMaxBr.Location = New System.Drawing.Point(580, 15) + Me.BtDesMaxBr.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.BtDesMaxBr.Location = New System.Drawing.Point(452, 28) Me.BtDesMaxBr.Name = "BtDesMaxBr" Me.BtDesMaxBr.Size = New System.Drawing.Size(28, 21) Me.BtDesMaxBr.TabIndex = 1 @@ -439,8 +452,9 @@ Partial Class F_VECTO ' 'BtAccOpen ' + Me.BtAccOpen.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.BtAccOpen.Image = Global.VECTO.My.Resources.Resources.application_export_icon_small - Me.BtAccOpen.Location = New System.Drawing.Point(614, 14) + Me.BtAccOpen.Location = New System.Drawing.Point(486, 27) Me.BtAccOpen.Name = "BtAccOpen" Me.BtAccOpen.Size = New System.Drawing.Size(23, 23) Me.BtAccOpen.TabIndex = 2 @@ -451,9 +465,9 @@ Partial Class F_VECTO ' Me.GrLAC.Controls.Add(Me.PnLookAhead) Me.GrLAC.Controls.Add(Me.CbLookAhead) - Me.GrLAC.Location = New System.Drawing.Point(12, 307) + Me.GrLAC.Location = New System.Drawing.Point(7, 290) Me.GrLAC.Name = "GrLAC" - Me.GrLAC.Size = New System.Drawing.Size(375, 87) + Me.GrLAC.Size = New System.Drawing.Size(514, 105) Me.GrLAC.TabIndex = 5 Me.GrLAC.TabStop = False Me.GrLAC.Text = "Look-Ahead Coasting" @@ -535,29 +549,37 @@ Partial Class F_VECTO ' 'GroupBox1 ' - Me.GroupBox1.Controls.Add(Me.Label21) - Me.GroupBox1.Controls.Add(Me.Label20) - Me.GroupBox1.Controls.Add(Me.Label14) - Me.GroupBox1.Controls.Add(Me.TbVmin) - Me.GroupBox1.Controls.Add(Me.TbUnderSpeed) - Me.GroupBox1.Controls.Add(Me.TbOverspeed) - Me.GroupBox1.Controls.Add(Me.Label23) - Me.GroupBox1.Controls.Add(Me.Label22) - Me.GroupBox1.Controls.Add(Me.Label13) + Me.GroupBox1.Controls.Add(Me.PnEcoRoll) Me.GroupBox1.Controls.Add(Me.RdEcoRoll) Me.GroupBox1.Controls.Add(Me.RdOverspeed) Me.GroupBox1.Controls.Add(Me.RdOff) - Me.GroupBox1.Location = New System.Drawing.Point(12, 192) + Me.GroupBox1.Location = New System.Drawing.Point(6, 149) Me.GroupBox1.Name = "GroupBox1" - Me.GroupBox1.Size = New System.Drawing.Size(372, 109) + Me.GroupBox1.Size = New System.Drawing.Size(515, 135) Me.GroupBox1.TabIndex = 4 Me.GroupBox1.TabStop = False Me.GroupBox1.Text = "Overspeed / Eco-Roll" ' + 'PnEcoRoll + ' + Me.PnEcoRoll.Controls.Add(Me.Label21) + Me.PnEcoRoll.Controls.Add(Me.Label20) + Me.PnEcoRoll.Controls.Add(Me.Label14) + Me.PnEcoRoll.Controls.Add(Me.TbVmin) + Me.PnEcoRoll.Controls.Add(Me.TbUnderSpeed) + Me.PnEcoRoll.Controls.Add(Me.TbOverspeed) + Me.PnEcoRoll.Controls.Add(Me.Label23) + Me.PnEcoRoll.Controls.Add(Me.Label22) + Me.PnEcoRoll.Controls.Add(Me.Label13) + Me.PnEcoRoll.Location = New System.Drawing.Point(137, 16) + Me.PnEcoRoll.Name = "PnEcoRoll" + Me.PnEcoRoll.Size = New System.Drawing.Size(232, 102) + Me.PnEcoRoll.TabIndex = 6 + ' 'Label21 ' Me.Label21.AutoSize = True - Me.Label21.Location = New System.Drawing.Point(314, 76) + Me.Label21.Location = New System.Drawing.Point(178, 61) Me.Label21.Name = "Label21" Me.Label21.Size = New System.Drawing.Size(38, 13) Me.Label21.TabIndex = 3 @@ -566,7 +588,7 @@ Partial Class F_VECTO 'Label20 ' Me.Label20.AutoSize = True - Me.Label20.Location = New System.Drawing.Point(314, 50) + Me.Label20.Location = New System.Drawing.Point(178, 35) Me.Label20.Name = "Label20" Me.Label20.Size = New System.Drawing.Size(38, 13) Me.Label20.TabIndex = 3 @@ -575,7 +597,7 @@ Partial Class F_VECTO 'Label14 ' Me.Label14.AutoSize = True - Me.Label14.Location = New System.Drawing.Point(314, 24) + Me.Label14.Location = New System.Drawing.Point(178, 9) Me.Label14.Name = "Label14" Me.Label14.Size = New System.Drawing.Size(38, 13) Me.Label14.TabIndex = 3 @@ -583,21 +605,21 @@ Partial Class F_VECTO ' 'TbVmin ' - Me.TbVmin.Location = New System.Drawing.Point(244, 73) + Me.TbVmin.Location = New System.Drawing.Point(108, 58) Me.TbVmin.Name = "TbVmin" Me.TbVmin.Size = New System.Drawing.Size(64, 20) Me.TbVmin.TabIndex = 5 ' 'TbUnderSpeed ' - Me.TbUnderSpeed.Location = New System.Drawing.Point(244, 47) + Me.TbUnderSpeed.Location = New System.Drawing.Point(108, 32) Me.TbUnderSpeed.Name = "TbUnderSpeed" Me.TbUnderSpeed.Size = New System.Drawing.Size(64, 20) Me.TbUnderSpeed.TabIndex = 4 ' 'TbOverspeed ' - Me.TbOverspeed.Location = New System.Drawing.Point(244, 21) + Me.TbOverspeed.Location = New System.Drawing.Point(108, 6) Me.TbOverspeed.Name = "TbOverspeed" Me.TbOverspeed.Size = New System.Drawing.Size(64, 20) Me.TbOverspeed.TabIndex = 3 @@ -605,7 +627,7 @@ Partial Class F_VECTO 'Label23 ' Me.Label23.AutoSize = True - Me.Label23.Location = New System.Drawing.Point(158, 76) + Me.Label23.Location = New System.Drawing.Point(22, 61) Me.Label23.Name = "Label23" Me.Label23.Size = New System.Drawing.Size(80, 13) Me.Label23.TabIndex = 1 @@ -614,7 +636,7 @@ Partial Class F_VECTO 'Label22 ' Me.Label22.AutoSize = True - Me.Label22.Location = New System.Drawing.Point(147, 50) + Me.Label22.Location = New System.Drawing.Point(11, 35) Me.Label22.Name = "Label22" Me.Label22.Size = New System.Drawing.Size(91, 13) Me.Label22.TabIndex = 1 @@ -623,7 +645,7 @@ Partial Class F_VECTO 'Label13 ' Me.Label13.AutoSize = True - Me.Label13.Location = New System.Drawing.Point(153, 24) + Me.Label13.Location = New System.Drawing.Point(17, 9) Me.Label13.Name = "Label13" Me.Label13.Size = New System.Drawing.Size(85, 13) Me.Label13.TabIndex = 1 @@ -665,9 +687,9 @@ Partial Class F_VECTO ' Me.GrStartStop.Controls.Add(Me.PnStartStop) Me.GrStartStop.Controls.Add(Me.ChBStartStop) - Me.GrStartStop.Location = New System.Drawing.Point(12, 56) + Me.GrStartStop.Location = New System.Drawing.Point(6, 6) Me.GrStartStop.Name = "GrStartStop" - Me.GrStartStop.Size = New System.Drawing.Size(375, 130) + Me.GrStartStop.Size = New System.Drawing.Size(515, 137) Me.GrStartStop.TabIndex = 3 Me.GrStartStop.TabStop = False Me.GrStartStop.Text = "Engine Start Stop" @@ -683,15 +705,15 @@ Partial Class F_VECTO Me.PnStartStop.Controls.Add(Me.LabelSStime) Me.PnStartStop.Controls.Add(Me.TbSSdelay) Me.PnStartStop.Controls.Add(Me.TbSStime) - Me.PnStartStop.Location = New System.Drawing.Point(148, 10) + Me.PnStartStop.Location = New System.Drawing.Point(87, 21) Me.PnStartStop.Name = "PnStartStop" - Me.PnStartStop.Size = New System.Drawing.Size(221, 106) + Me.PnStartStop.Size = New System.Drawing.Size(422, 95) Me.PnStartStop.TabIndex = 1 ' 'Label31 ' Me.Label31.AutoSize = True - Me.Label31.Location = New System.Drawing.Point(169, 64) + Me.Label31.Location = New System.Drawing.Point(228, 58) Me.Label31.Name = "Label31" Me.Label31.Size = New System.Drawing.Size(18, 13) Me.Label31.TabIndex = 38 @@ -700,7 +722,7 @@ Partial Class F_VECTO 'Label27 ' Me.Label27.AutoSize = True - Me.Label27.Location = New System.Drawing.Point(169, 38) + Me.Label27.Location = New System.Drawing.Point(228, 32) Me.Label27.Name = "Label27" Me.Label27.Size = New System.Drawing.Size(18, 13) Me.Label27.TabIndex = 38 @@ -708,7 +730,7 @@ Partial Class F_VECTO ' 'TbSSspeed ' - Me.TbSSspeed.Location = New System.Drawing.Point(99, 9) + Me.TbSSspeed.Location = New System.Drawing.Point(158, 3) Me.TbSSspeed.Name = "TbSSspeed" Me.TbSSspeed.Size = New System.Drawing.Size(64, 20) Me.TbSSspeed.TabIndex = 0 @@ -716,7 +738,7 @@ Partial Class F_VECTO 'LabelSSspeed ' Me.LabelSSspeed.AutoSize = True - Me.LabelSSspeed.Location = New System.Drawing.Point(32, 12) + Me.LabelSSspeed.Location = New System.Drawing.Point(91, 6) Me.LabelSSspeed.Name = "LabelSSspeed" Me.LabelSSspeed.Size = New System.Drawing.Size(61, 13) Me.LabelSSspeed.TabIndex = 37 @@ -725,7 +747,7 @@ Partial Class F_VECTO 'Label26 ' Me.Label26.AutoSize = True - Me.Label26.Location = New System.Drawing.Point(169, 12) + Me.Label26.Location = New System.Drawing.Point(228, 6) Me.Label26.Name = "Label26" Me.Label26.Size = New System.Drawing.Size(38, 13) Me.Label26.TabIndex = 38 @@ -734,7 +756,7 @@ Partial Class F_VECTO 'Label30 ' Me.Label30.AutoSize = True - Me.Label30.Location = New System.Drawing.Point(9, 64) + Me.Label30.Location = New System.Drawing.Point(68, 58) Me.Label30.Name = "Label30" Me.Label30.Size = New System.Drawing.Size(84, 13) Me.Label30.TabIndex = 35 @@ -743,7 +765,7 @@ Partial Class F_VECTO 'LabelSStime ' Me.LabelSStime.AutoSize = True - Me.LabelSStime.Location = New System.Drawing.Point(6, 38) + Me.LabelSStime.Location = New System.Drawing.Point(65, 32) Me.LabelSStime.Name = "LabelSStime" Me.LabelSStime.Size = New System.Drawing.Size(87, 13) Me.LabelSStime.TabIndex = 35 @@ -751,14 +773,14 @@ Partial Class F_VECTO ' 'TbSSdelay ' - Me.TbSSdelay.Location = New System.Drawing.Point(99, 61) + Me.TbSSdelay.Location = New System.Drawing.Point(158, 55) Me.TbSSdelay.Name = "TbSSdelay" Me.TbSSdelay.Size = New System.Drawing.Size(64, 20) Me.TbSSdelay.TabIndex = 1 ' 'TbSStime ' - Me.TbSStime.Location = New System.Drawing.Point(99, 35) + Me.TbSStime.Location = New System.Drawing.Point(158, 29) Me.TbSStime.Name = "TbSStime" Me.TbSStime.Size = New System.Drawing.Size(64, 20) Me.TbSStime.TabIndex = 1 @@ -778,9 +800,9 @@ Partial Class F_VECTO 'StatusStrip1 ' Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripStatusLabelGEN}) - Me.StatusStrip1.Location = New System.Drawing.Point(0, 612) + Me.StatusStrip1.Location = New System.Drawing.Point(0, 627) Me.StatusStrip1.Name = "StatusStrip1" - Me.StatusStrip1.Size = New System.Drawing.Size(667, 22) + Me.StatusStrip1.Size = New System.Drawing.Size(944, 22) Me.StatusStrip1.SizingGrip = False Me.StatusStrip1.TabIndex = 6 Me.StatusStrip1.Text = "StatusStrip1" @@ -794,7 +816,7 @@ Partial Class F_VECTO 'ButOK ' Me.ButOK.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ButOK.Location = New System.Drawing.Point(502, 586) + Me.ButOK.Location = New System.Drawing.Point(779, 601) Me.ButOK.Name = "ButOK" Me.ButOK.Size = New System.Drawing.Size(75, 23) Me.ButOK.TabIndex = 11 @@ -805,7 +827,7 @@ Partial Class F_VECTO ' Me.ButCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.ButCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel - Me.ButCancel.Location = New System.Drawing.Point(583, 586) + Me.ButCancel.Location = New System.Drawing.Point(860, 601) Me.ButCancel.Name = "ButCancel" Me.ButCancel.Size = New System.Drawing.Size(75, 23) Me.ButCancel.TabIndex = 19 @@ -818,7 +840,7 @@ Partial Class F_VECTO Me.ToolStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripBtNew, Me.ToolStripBtOpen, Me.ToolStripBtSave, Me.ToolStripBtSaveAs, Me.ToolStripSeparator1, Me.ToolStripBtSendTo, Me.ToolStripSeparator2, Me.ToolStripButton1}) Me.ToolStrip1.Location = New System.Drawing.Point(0, 0) Me.ToolStrip1.Name = "ToolStrip1" - Me.ToolStrip1.Size = New System.Drawing.Size(667, 25) + Me.ToolStrip1.Size = New System.Drawing.Size(944, 25) Me.ToolStrip1.TabIndex = 20 Me.ToolStrip1.Text = "ToolStrip1" ' @@ -874,8 +896,8 @@ Partial Class F_VECTO Me.ToolStripBtSendTo.ImageTransparentColor = System.Drawing.Color.Magenta Me.ToolStripBtSendTo.Name = "ToolStripBtSendTo" Me.ToolStripBtSendTo.Size = New System.Drawing.Size(23, 22) - Me.ToolStripBtSendTo.Text = "Send to GEN List" - Me.ToolStripBtSendTo.ToolTipText = "Send to GEN List" + Me.ToolStripBtSendTo.Text = "Send to Job List" + Me.ToolStripBtSendTo.ToolTipText = "Send to Job List" ' 'ToolStripSeparator2 ' @@ -897,7 +919,7 @@ Partial Class F_VECTO Me.PictureBox1.Image = Global.VECTO.My.Resources.Resources.VECTO_VECTO Me.PictureBox1.Location = New System.Drawing.Point(12, 28) Me.PictureBox1.Name = "PictureBox1" - Me.PictureBox1.Size = New System.Drawing.Size(643, 40) + Me.PictureBox1.Size = New System.Drawing.Size(920, 40) Me.PictureBox1.TabIndex = 21 Me.PictureBox1.TabStop = False ' @@ -913,35 +935,104 @@ Partial Class F_VECTO ' 'CmOpenFile ' - Me.CmOpenFile.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.OpenWithGRAPHiToolStripMenuItem, Me.OpenWithToolStripMenuItem, Me.ShowInFolderToolStripMenuItem}) + Me.CmOpenFile.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.OpenWithToolStripMenuItem, Me.ShowInFolderToolStripMenuItem}) Me.CmOpenFile.Name = "CmOpenFile" - Me.CmOpenFile.Size = New System.Drawing.Size(175, 70) - ' - 'OpenWithGRAPHiToolStripMenuItem - ' - Me.OpenWithGRAPHiToolStripMenuItem.Name = "OpenWithGRAPHiToolStripMenuItem" - Me.OpenWithGRAPHiToolStripMenuItem.Size = New System.Drawing.Size(174, 22) - Me.OpenWithGRAPHiToolStripMenuItem.Text = "Open with GRAPHi" + Me.CmOpenFile.Size = New System.Drawing.Size(153, 48) ' 'OpenWithToolStripMenuItem ' Me.OpenWithToolStripMenuItem.Name = "OpenWithToolStripMenuItem" - Me.OpenWithToolStripMenuItem.Size = New System.Drawing.Size(174, 22) + Me.OpenWithToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.OpenWithToolStripMenuItem.Text = "Open with ..." ' 'ShowInFolderToolStripMenuItem ' Me.ShowInFolderToolStripMenuItem.Name = "ShowInFolderToolStripMenuItem" - Me.ShowInFolderToolStripMenuItem.Size = New System.Drawing.Size(174, 22) + Me.ShowInFolderToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.ShowInFolderToolStripMenuItem.Text = "Show in Folder" ' - 'F_VEC + 'PicVehicle + ' + Me.PicVehicle.BackColor = System.Drawing.Color.LightGray + Me.PicVehicle.Location = New System.Drawing.Point(542, 122) + Me.PicVehicle.Name = "PicVehicle" + Me.PicVehicle.Size = New System.Drawing.Size(300, 88) + Me.PicVehicle.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage + Me.PicVehicle.TabIndex = 36 + Me.PicVehicle.TabStop = False + ' + 'PicBox + ' + Me.PicBox.BackColor = System.Drawing.Color.LightGray + Me.PicBox.Location = New System.Drawing.Point(542, 268) + Me.PicBox.Name = "PicBox" + Me.PicBox.Size = New System.Drawing.Size(390, 327) + Me.PicBox.TabIndex = 36 + Me.PicBox.TabStop = False + ' + 'TbEngTxt + ' + Me.TbEngTxt.Location = New System.Drawing.Point(542, 216) + Me.TbEngTxt.Name = "TbEngTxt" + Me.TbEngTxt.ReadOnly = True + Me.TbEngTxt.Size = New System.Drawing.Size(390, 20) + Me.TbEngTxt.TabIndex = 37 + ' + 'TbVehCat + ' + Me.TbVehCat.Location = New System.Drawing.Point(848, 126) + Me.TbVehCat.Name = "TbVehCat" + Me.TbVehCat.ReadOnly = True + Me.TbVehCat.Size = New System.Drawing.Size(87, 20) + Me.TbVehCat.TabIndex = 37 + ' + 'TbAxleConf + ' + Me.TbAxleConf.Location = New System.Drawing.Point(894, 155) + Me.TbAxleConf.Name = "TbAxleConf" + Me.TbAxleConf.ReadOnly = True + Me.TbAxleConf.Size = New System.Drawing.Size(41, 20) + Me.TbAxleConf.TabIndex = 37 + ' + 'TbHVCclass + ' + Me.TbHVCclass.Location = New System.Drawing.Point(848, 184) + Me.TbHVCclass.Name = "TbHVCclass" + Me.TbHVCclass.ReadOnly = True + Me.TbHVCclass.Size = New System.Drawing.Size(87, 20) + Me.TbHVCclass.TabIndex = 37 + ' + 'TbGbxTxt + ' + Me.TbGbxTxt.Location = New System.Drawing.Point(542, 242) + Me.TbGbxTxt.Name = "TbGbxTxt" + Me.TbGbxTxt.ReadOnly = True + Me.TbGbxTxt.Size = New System.Drawing.Size(390, 20) + Me.TbGbxTxt.TabIndex = 37 + ' + 'TbMass + ' + Me.TbMass.Location = New System.Drawing.Point(848, 155) + Me.TbMass.Name = "TbMass" + Me.TbMass.ReadOnly = True + Me.TbMass.Size = New System.Drawing.Size(40, 20) + Me.TbMass.TabIndex = 37 + ' + 'F_VECTO ' Me.AcceptButton = Me.ButOK Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.CancelButton = Me.ButCancel - Me.ClientSize = New System.Drawing.Size(667, 634) + Me.ClientSize = New System.Drawing.Size(944, 649) + Me.Controls.Add(Me.TbHVCclass) + Me.Controls.Add(Me.TbMass) + Me.Controls.Add(Me.TbAxleConf) + Me.Controls.Add(Me.TbVehCat) + Me.Controls.Add(Me.TbGbxTxt) + Me.Controls.Add(Me.TbEngTxt) + Me.Controls.Add(Me.PicBox) + Me.Controls.Add(Me.PicVehicle) Me.Controls.Add(Me.CbEngOnly) Me.Controls.Add(Me.PictureBox1) Me.Controls.Add(Me.ToolStrip1) @@ -952,7 +1043,7 @@ Partial Class F_VECTO Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.MaximizeBox = False - Me.Name = "F_VEC" + Me.Name = "F_VECTO" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent Me.Text = "VECTO Editor" Me.TabPgGen.ResumeLayout(False) @@ -963,14 +1054,16 @@ Partial Class F_VECTO Me.GrAux.PerformLayout() Me.TabControl1.ResumeLayout(False) Me.TabPgDriver.ResumeLayout(False) - Me.PnVACC.ResumeLayout(False) - Me.PnVACC.PerformLayout() + Me.GrVACC.ResumeLayout(False) + Me.GrVACC.PerformLayout() Me.GrLAC.ResumeLayout(False) Me.GrLAC.PerformLayout() Me.PnLookAhead.ResumeLayout(False) Me.PnLookAhead.PerformLayout() Me.GroupBox1.ResumeLayout(False) Me.GroupBox1.PerformLayout() + Me.PnEcoRoll.ResumeLayout(False) + Me.PnEcoRoll.PerformLayout() Me.GrStartStop.ResumeLayout(False) Me.GrStartStop.PerformLayout() Me.PnStartStop.ResumeLayout(False) @@ -981,6 +1074,8 @@ Partial Class F_VECTO Me.ToolStrip1.PerformLayout() CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit() Me.CmOpenFile.ResumeLayout(False) + CType(Me.PicVehicle, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.PicBox, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) Me.PerformLayout() @@ -998,7 +1093,7 @@ Partial Class F_VECTO Friend WithEvents ButOK As System.Windows.Forms.Button Friend WithEvents TbGBX As System.Windows.Forms.TextBox Friend WithEvents TbENG As System.Windows.Forms.TextBox - Friend WithEvents TextBoxVEH As System.Windows.Forms.TextBox + Friend WithEvents TbVEH As System.Windows.Forms.TextBox Friend WithEvents ButCancel As System.Windows.Forms.Button Friend WithEvents ToolStrip1 As System.Windows.Forms.ToolStrip Friend WithEvents ToolStripBtNew As System.Windows.Forms.ToolStripButton @@ -1018,7 +1113,6 @@ Partial Class F_VECTO Friend WithEvents TabPgDriver As System.Windows.Forms.TabPage Friend WithEvents BtDesMaxBr As System.Windows.Forms.Button Friend WithEvents TbDesMaxFile As System.Windows.Forms.TextBox - Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents GrCycles As System.Windows.Forms.GroupBox Friend WithEvents LvCycles As System.Windows.Forms.ListView Friend WithEvents ColumnHeader1 As System.Windows.Forms.ColumnHeader @@ -1030,7 +1124,6 @@ Partial Class F_VECTO Friend WithEvents BtAccOpen As System.Windows.Forms.Button Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents CmOpenFile As System.Windows.Forms.ContextMenuStrip - Friend WithEvents OpenWithGRAPHiToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents OpenWithToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents ShowInFolderToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents ChBStartStop As System.Windows.Forms.CheckBox @@ -1068,5 +1161,14 @@ Partial Class F_VECTO Friend WithEvents Label30 As System.Windows.Forms.Label Friend WithEvents TbSSdelay As System.Windows.Forms.TextBox Friend WithEvents Label32 As System.Windows.Forms.Label - Friend WithEvents PnVACC As System.Windows.Forms.Panel + Friend WithEvents PnEcoRoll As System.Windows.Forms.Panel + Friend WithEvents PicVehicle As System.Windows.Forms.PictureBox + Friend WithEvents PicBox As System.Windows.Forms.PictureBox + Friend WithEvents TbEngTxt As System.Windows.Forms.TextBox + Friend WithEvents TbVehCat As System.Windows.Forms.TextBox + Friend WithEvents TbAxleConf As System.Windows.Forms.TextBox + Friend WithEvents TbHVCclass As System.Windows.Forms.TextBox + Friend WithEvents TbGbxTxt As System.Windows.Forms.TextBox + Friend WithEvents TbMass As System.Windows.Forms.TextBox + Friend WithEvents GrVACC As System.Windows.Forms.GroupBox End Class diff --git a/VECTO/GUI/F_VECTO.vb b/VECTO/GUI/F_VECTO.vb index 60d37ae5aa377004e36a68d00966eddf4856aee4..4f494299c728d29a4859acfd5308c685d718aa90 100644 --- a/VECTO/GUI/F_VECTO.vb +++ b/VECTO/GUI/F_VECTO.vb @@ -1,8 +1,12 @@ Imports System.Collections.Generic +''' <summary> +''' VECTO Editor. Create/Edit VECTO job files (.vecto) +''' </summary> +''' <remarks></remarks> Public Class F_VECTO - Private Genfile As String + Private VECTOfile As String Private Changed As Boolean = False Private pgDriver As TabPage @@ -11,7 +15,9 @@ Public Class F_VECTO Private AuxDlog As F_VEH_AuxDlog - 'Initialize form (Load Drives, Combo-lists, ...) + Private EStechs As New List(Of String) + + 'Initialise form Private Sub F02_GEN_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim x As Int16 @@ -19,7 +25,6 @@ Public Class F_VECTO pgDriver = Me.TabPgDriver - 'Damit Combobox-Inhalte aktuell sind |@@| So Combo-content is current For x = 0 To Me.TabControl1.TabCount - 1 Me.TabControl1.TabPages(x).Show() Next @@ -27,29 +32,38 @@ Public Class F_VECTO Me.LvAux.Columns(2).Width = -2 'Declaration Mode - If Declaration.Active Then - Me.CbEngOnly.Enabled = False - Me.GrCycles.Enabled = False - Me.PnVACC.Enabled = False - Me.PnStartStop.Enabled = False - Me.RdOff.Enabled = False - Me.GrLAC.Enabled = False + If Cfg.DeclMode Then + Me.LvAux.Columns(2).Text = "Technology" + Else + Me.LvAux.Columns(2).Text = "Input File" End If + Me.CbEngOnly.Enabled = Not Cfg.DeclMode + Me.GrCycles.Enabled = Not Cfg.DeclMode + Me.GrVACC.Enabled = Not Cfg.DeclMode + Me.PnStartStop.Enabled = Not Cfg.DeclMode + Me.RdOff.Enabled = Not Cfg.DeclMode + Me.GrLAC.Enabled = Not Cfg.DeclMode + Me.ButAuxAdd.Enabled = Not Cfg.DeclMode + Me.ButAuxRem.Enabled = Not Cfg.DeclMode + Me.PnEcoRoll.Enabled = Not Cfg.DeclMode + Changed = False End Sub - 'Close + 'Close - Check for unsaved changes Private Sub F02_GEN_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing If e.CloseReason <> CloseReason.ApplicationExitCall And e.CloseReason <> CloseReason.WindowsShutDown Then e.Cancel = ChangeCheckCancel() End If End Sub + 'Set generic values for Declaration mode Private Sub DeclInit() + Dim LV0 As ListViewItem - If Not Declaration.Active Then Exit Sub + If Not Cfg.DeclMode Then Exit Sub Me.LvCycles.Items.Clear() Me.CbEngOnly.Checked = False @@ -62,12 +76,66 @@ Public Class F_VECTO Me.TbSSdelay.Text = cDeclaration.SSdelay Me.TbAlookahead.Text = cDeclaration.LACa Me.TbVminLA.Text = cDeclaration.LACvmin - End Sub + Me.TbOverspeed.Text = cDeclaration.Overspeed + Me.TbUnderSpeed.Text = cDeclaration.Underspeed + Me.TbVmin.Text = cDeclaration.ECvmin + + If LvAux.Items.Count <> 5 OrElse (Me.LvAux.Items(0).Text <> sKey.AUX.Fan OrElse Me.LvAux.Items(1).Text <> sKey.AUX.SteerPump OrElse Me.LvAux.Items(2).Text <> sKey.AUX.HVAC OrElse Me.LvAux.Items(3).Text <> sKey.AUX.ElecSys OrElse Me.LvAux.Items(4).Text <> sKey.AUX.PneumSys) Then + Me.LvAux.Items.Clear() -#Region "Tabs" + LV0 = New ListViewItem(sKey.AUX.Fan) + LV0.SubItems.Add("Fan") + If Declaration.AuxTechs(tAux.Fan).Count > 1 Then + LV0.SubItems.Add("") + Else + LV0.SubItems.Add(Declaration.AuxTechs(tAux.Fan)(0)) + End If + Me.LvAux.Items.Add(LV0) + + LV0 = New ListViewItem(sKey.AUX.SteerPump) + LV0.SubItems.Add("Steering pump") + If Declaration.AuxTechs(tAux.SteerPump).Count > 1 Then + LV0.SubItems.Add("") + Else + LV0.SubItems.Add(Declaration.AuxTechs(tAux.SteerPump)(0)) + End If + Me.LvAux.Items.Add(LV0) + LV0 = New ListViewItem(sKey.AUX.HVAC) + LV0.SubItems.Add("HVAC") + If Declaration.AuxTechs(tAux.HVAC).Count > 1 Then + LV0.SubItems.Add("") + Else + LV0.SubItems.Add(Declaration.AuxTechs(tAux.HVAC)(0)) + End If + Me.LvAux.Items.Add(LV0) + + LV0 = New ListViewItem(sKey.AUX.ElecSys) + LV0.SubItems.Add("Electric System") + If Declaration.AuxTechs(tAux.ElectricSys).Count > 1 Then + LV0.SubItems.Add("") + Else + LV0.SubItems.Add(Declaration.AuxTechs(tAux.ElectricSys)(0)) + End If + Me.LvAux.Items.Add(LV0) + + LV0 = New ListViewItem(sKey.AUX.PneumSys) + LV0.SubItems.Add("Pneumatic System") + If Declaration.AuxTechs(tAux.PneumSys).Count > 1 Then + LV0.SubItems.Add("") + Else + LV0.SubItems.Add(Declaration.AuxTechs(tAux.PneumSys)(0)) + End If + Me.LvAux.Items.Add(LV0) + + End If + + End Sub + + + 'Show/Hide "Driver Assist" Tab Private Sub SetDrivertab(ByVal OnOff As Boolean) If OnOff Then If Not pgDriverON Then @@ -82,42 +150,40 @@ Public Class F_VECTO End If End Sub -#End Region #Region "Browse Buttons" - 'General Private Sub ButtonVEH_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonVEH.Click - If fbVEH.OpenDialog(fFileRepl(Me.TextBoxVEH.Text, fPATH(Genfile))) Then Me.TextBoxVEH.Text = fFileWoDir(fbVEH.Files(0), fPATH(Genfile)) + If fbVEH.OpenDialog(fFileRepl(Me.TbVEH.Text, fPATH(VECTOfile))) Then Me.TbVEH.Text = fFileWoDir(fbVEH.Files(0), fPATH(VECTOfile)) End Sub + Private Sub ButtonMAP_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonMAP.Click - If fbENG.OpenDialog(fFileRepl(Me.TbENG.Text, fPATH(Genfile))) Then Me.TbENG.Text = fFileWoDir(fbENG.Files(0), fPATH(Genfile)) + If fbENG.OpenDialog(fFileRepl(Me.TbENG.Text, fPATH(VECTOfile))) Then Me.TbENG.Text = fFileWoDir(fbENG.Files(0), fPATH(VECTOfile)) End Sub - Private Sub ButtonFLD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGBX.Click - If fbGBX.OpenDialog(fFileRepl(Me.TbGBX.Text, fPATH(Genfile))) Then Me.TbGBX.Text = fFileWoDir(fbGBX.Files(0), fPATH(Genfile)) + Private Sub ButtonGBX_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGBX.Click + If fbGBX.OpenDialog(fFileRepl(Me.TbGBX.Text, fPATH(VECTOfile))) Then Me.TbGBX.Text = fFileWoDir(fbGBX.Files(0), fPATH(VECTOfile)) End Sub - 'a_DesMax Private Sub BtDesMaxBr_Click_1(sender As System.Object, e As System.EventArgs) Handles BtDesMaxBr.Click - If fbACC.OpenDialog(fFileRepl(Me.TbDesMaxFile.Text, fPATH(Genfile))) Then Me.TbDesMaxFile.Text = fFileWoDir(fbACC.Files(0), fPATH(Genfile)) + If fbACC.OpenDialog(fFileRepl(Me.TbDesMaxFile.Text, fPATH(VECTOfile))) Then Me.TbDesMaxFile.Text = fFileWoDir(fbACC.Files(0), fPATH(VECTOfile)) End Sub Private Sub BtAccOpen_Click(sender As System.Object, e As System.EventArgs) Handles BtAccOpen.Click - OpenFiles(fFileRepl(Me.TbDesMaxFile.Text, fPATH(Genfile))) + OpenFiles(fFileRepl(Me.TbDesMaxFile.Text, fPATH(VECTOfile))) End Sub #End Region #Region "Open Buttons" - 'General + 'Open Vehicle Editor Private Sub ButOpenVEH_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButOpenVEH.Click Dim f As String - f = fFileRepl(TextBoxVEH.Text, fPATH(Genfile)) + f = fFileRepl(TbVEH.Text, fPATH(VECTOfile)) 'Thus Veh-file is returned - F_VEH.GenDir = fPATH(Genfile) + F_VEH.JobDir = fPATH(VECTOfile) F_VEH.AutoSendTo = True If Not Trim(f) = "" Then @@ -138,12 +204,13 @@ Public Class F_VECTO End Sub + 'Open Engine Editor Private Sub ButOpenENG_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButOpenENG.Click Dim f As String - f = fFileRepl(TbENG.Text, fPATH(Genfile)) + f = fFileRepl(TbENG.Text, fPATH(VECTOfile)) 'Thus Veh-file is returned - F_ENG.GenDir = fPATH(Genfile) + F_ENG.JobDir = fPATH(VECTOfile) F_ENG.AutoSendTo = True If Not Trim(f) = "" Then @@ -164,12 +231,13 @@ Public Class F_VECTO End Sub + 'Open Gearbox Editor Private Sub ButOpenGBX_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButOpenGBX.Click Dim f As String - f = fFileRepl(TbGBX.Text, fPATH(Genfile)) + f = fFileRepl(TbGBX.Text, fPATH(VECTOfile)) 'Thus Veh-file is returned - F_GBX.GenDir = fPATH(Genfile) + F_GBX.JobDir = fPATH(VECTOfile) F_GBX.AutoSendTo = True If Not Trim(f) = "" Then @@ -192,16 +260,16 @@ Public Class F_VECTO #End Region -#Region "Menüleiste / Toolbar" +#Region "Toolbar" 'New Private Sub ToolStripBtNew_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripBtNew.Click - GENnew() + VECTOnew() End Sub 'Open Private Sub ToolStripBtOpen_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripBtOpen.Click - If fbGEN.OpenDialog(Genfile, False, "vecto") Then GENload2Form(fbGEN.Files(0)) + If fbVECTO.OpenDialog(VECTOfile, False, "vecto") Then VECTOload2Form(fbVECTO.Files(0)) End Sub 'Save @@ -211,18 +279,16 @@ Public Class F_VECTO 'Save As Private Sub ToolStripBtSaveAs_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripBtSaveAs.Click - If fbGEN.SaveDialog(Genfile) Then Call GENsave(fbGEN.Files(0)) + If fbVECTO.SaveDialog(VECTOfile) Then Call VECTOsave(fbVECTO.Files(0)) End Sub - - 'Send to GEN List + 'Send to Job file list in main form Private Sub ToolStripBtSendTo_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripBtSendTo.Click If ChangeCheckCancel() Then Exit Sub - If Genfile = "" Then + If VECTOfile = "" Then MsgBox("File not found!" & ChrW(10) & ChrW(10) & "Save file and try again.") Else - F_MAINForm.AddToListViewGEN(Genfile) - 'Me.ToolStripStatusLabelGEN.Text = fFILE(Genfile, True) & " sent to GEN List." + F_MAINForm.AddToJobListView(VECTOfile) End If End Sub @@ -238,38 +304,36 @@ Public Class F_VECTO #End Region -#Region "Datei Funktionen" - 'Save ("Save" or "Save As" when new file) Private Function Save() As Boolean - If Genfile = "" Then - If fbGEN.SaveDialog("") Then - Genfile = fbGEN.Files(0) + If VECTOfile = "" Then + If fbVECTO.SaveDialog("") Then + VECTOfile = fbVECTO.Files(0) Else Return False End If End If - Return GENsave(Genfile) + Return VECTOsave(VECTOfile) End Function - 'Load GEN in the form - Public Sub GENload2Form(ByVal file As String) + 'Open file + Public Sub VECTOload2Form(ByVal file As String) Dim x As Int16 - Dim Gfile As cVECTO + Dim VEC0 As cVECTO Dim AuxEntryKV As KeyValuePair(Of String, cVECTO.cAuxEntry) Dim LV0 As ListViewItem Dim sb As cSubPath If ChangeCheckCancel() Then Exit Sub - GENnew() + VECTOnew() 'Read GEN - Gfile = New cVECTO - Gfile.FilePath = file + VEC0 = New cVECTO + VEC0.FilePath = file Try - If Not Gfile.ReadFile() Then - Gfile = Nothing + If Not VEC0.ReadFile() Then + VEC0 = Nothing MsgBox("Failed to load " & fFILE(file, True) & "!") Exit Sub End If @@ -281,49 +345,55 @@ Public Class F_VECTO 'Update Form 'Files ----------------------------- - TextBoxVEH.Text = Gfile.PathVEH(True) - TbENG.Text = Gfile.PathENG(True) - TbGBX.Text = Gfile.PathGBX(True) + TbVEH.Text = VEC0.PathVEH(True) + TbENG.Text = VEC0.PathENG(True) + TbGBX.Text = VEC0.PathGBX(True) 'Start/Stop - Me.ChBStartStop.Checked = Gfile.StartStop - Me.TbSSspeed.Text = Gfile.StStV - Me.TbSStime.Text = Gfile.StStT - Me.TbSSdelay.Text = Gfile.StStDelay + Me.ChBStartStop.Checked = VEC0.StartStop + Me.TbSSspeed.Text = VEC0.StStV + Me.TbSStime.Text = VEC0.StStT + Me.TbSSdelay.Text = VEC0.StStDelay 'VACC - Me.TbDesMaxFile.Text = Gfile.DesMaxFile(True) + Me.TbDesMaxFile.Text = VEC0.DesMaxFile(True) Me.LvAux.Items.Clear() - For Each AuxEntryKV In Gfile.AuxPaths + For Each AuxEntryKV In VEC0.AuxPaths LV0 = New ListViewItem LV0.SubItems(0).Text = AuxEntryKV.Key LV0.SubItems.Add(AuxEntryKV.Value.Type) - LV0.SubItems.Add(AuxEntryKV.Value.Path.OriginalPath) + If Cfg.DeclMode Then + LV0.SubItems.Add(AuxEntryKV.Value.TechStr) + Else + LV0.SubItems.Add(AuxEntryKV.Value.Path.OriginalPath) + End If LvAux.Items.Add(LV0) Next - For Each sb In Gfile.CycleFiles + EStechs = VEC0.EStechs + + For Each sb In VEC0.CycleFiles LV0 = New ListViewItem LV0.Text = sb.OriginalPath LvCycles.Items.Add(LV0) Next - Me.CbEngOnly.Checked = Gfile.EngOnly + Me.CbEngOnly.Checked = VEC0.EngOnly - If Gfile.EcoRollOn Then + If VEC0.EcoRollOn Then Me.RdEcoRoll.Checked = True - ElseIf Gfile.OverSpeedOn Then + ElseIf VEC0.OverSpeedOn Then Me.RdOverspeed.Checked = True Else Me.RdOff.Checked = True End If - Me.TbOverspeed.Text = CStr(Gfile.OverSpeed) - Me.TbUnderSpeed.Text = CStr(Gfile.UnderSpeed) - Me.TbVmin.Text = CStr(Gfile.vMin) - Me.CbLookAhead.Checked = Gfile.LookAheadOn - Me.TbAlookahead.Text = CStr(Gfile.a_lookahead) - Me.TbVminLA.Text = CStr(Gfile.vMinLA) + Me.TbOverspeed.Text = CStr(VEC0.OverSpeed) + Me.TbUnderSpeed.Text = CStr(VEC0.UnderSpeed) + Me.TbVmin.Text = CStr(VEC0.vMin) + Me.CbLookAhead.Checked = VEC0.LookAheadOn + Me.TbAlookahead.Text = CStr(VEC0.a_lookahead) + Me.TbVminLA.Text = CStr(VEC0.vMinLA) '------------------------------------------------------------- @@ -331,7 +401,12 @@ Public Class F_VECTO DeclInit() - Genfile = file + F_ENG.AutoSendTo = False + F_GBX.AutoSendTo = False + F_VEH.AutoSendTo = False + + + VECTOfile = file x = Len(file) While Mid(file, x, 1) <> "\" And x > 0 @@ -341,88 +416,98 @@ Public Class F_VECTO Changed = False Me.ToolStripStatusLabelGEN.Text = "" 'file & " opened." + UpdatePic() '------------------------------------------------------------- - If Gfile.NoJSON Then + If VEC0.NoJSON Then If MsgBox("File is not in JSON format!" & vbCrLf & vbCrLf & "Convert now?" & vbCrLf & "(Backup will be created with '.ORIG' extension)", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then - IO.File.Copy(Genfile, Genfile & ".ORIG", True) + IO.File.Copy(VECTOfile, VECTOfile & ".ORIG", True) Save() End If End If End Sub - 'GEN save from form - Private Function GENsave(ByVal file As String) As Boolean + 'Save file + Private Function VECTOsave(ByVal file As String) As Boolean - Dim g As cVECTO + Dim VEC0 As cVECTO Dim AuxEntry As cVECTO.cAuxEntry Dim LV0 As ListViewItem Dim sb As cSubPath - g = New cVECTO - g.FilePath = file + VEC0 = New cVECTO + VEC0.FilePath = file 'Files ------------------------------------------------- ----------------- - g.PathVEH = Me.TextBoxVEH.Text - g.PathENG = Me.TbENG.Text + VEC0.PathVEH = Me.TbVEH.Text + VEC0.PathENG = Me.TbENG.Text For Each LV0 In LvCycles.Items sb = New cSubPath sb.Init(fPATH(file), LV0.Text) - g.CycleFiles.Add(sb) + VEC0.CycleFiles.Add(sb) Next - g.PathGBX = Me.TbGBX.Text + VEC0.PathGBX = Me.TbGBX.Text 'Start/Stop - g.StartStop = Me.ChBStartStop.Checked - g.StStV = CSng(fTextboxToNumString(Me.TbSSspeed.Text)) - g.StStT = CSng(fTextboxToNumString(Me.TbSStime.Text)) - g.StStDelay = CInt(fTextboxToNumString(Me.TbSSdelay.Text)) + VEC0.StartStop = Me.ChBStartStop.Checked + VEC0.StStV = CSng(fTextboxToNumString(Me.TbSSspeed.Text)) + VEC0.StStT = CSng(fTextboxToNumString(Me.TbSStime.Text)) + VEC0.StStDelay = CInt(fTextboxToNumString(Me.TbSSdelay.Text)) 'a_DesMax - g.DesMaxFile = Me.TbDesMaxFile.Text + VEC0.DesMaxFile = Me.TbDesMaxFile.Text For Each LV0 In LvAux.Items AuxEntry = New cVECTO.cAuxEntry - AuxEntry.Path.Init(fPATH(file), LV0.SubItems(2).Text) + + If Cfg.DeclMode Then + AuxEntry.TechStr = LV0.SubItems(2).Text + Else + AuxEntry.Path.Init(fPATH(file), LV0.SubItems(2).Text) + End If + AuxEntry.Type = LV0.SubItems(1).Text - g.AuxPaths.Add(LV0.SubItems(0).Text, AuxEntry) + VEC0.AuxPaths.Add(LV0.SubItems(0).Text, AuxEntry) Next - g.EngOnly = Me.CbEngOnly.Checked + VEC0.EStechs = EStechs + - g.EcoRollOn = RdEcoRoll.Checked - g.OverSpeedOn = RdOverspeed.Checked - g.OverSpeed = CSng(fTextboxToNumString(Me.TbOverspeed.Text)) - g.UnderSpeed = CSng(fTextboxToNumString(Me.TbUnderSpeed.Text)) - g.vMin = CSng(fTextboxToNumString(Me.TbVmin.Text)) - g.LookAheadOn = Me.CbLookAhead.Checked - g.a_lookahead = CSng(fTextboxToNumString(Me.TbAlookahead.Text)) - g.vMinLA = CSng(fTextboxToNumString(Me.TbVminLA.Text)) + VEC0.EngOnly = Me.CbEngOnly.Checked + + VEC0.EcoRollOn = RdEcoRoll.Checked + VEC0.OverSpeedOn = RdOverspeed.Checked + VEC0.OverSpeed = CSng(fTextboxToNumString(Me.TbOverspeed.Text)) + VEC0.UnderSpeed = CSng(fTextboxToNumString(Me.TbUnderSpeed.Text)) + VEC0.vMin = CSng(fTextboxToNumString(Me.TbVmin.Text)) + VEC0.LookAheadOn = Me.CbLookAhead.Checked + VEC0.a_lookahead = CSng(fTextboxToNumString(Me.TbAlookahead.Text)) + VEC0.vMinLA = CSng(fTextboxToNumString(Me.TbVminLA.Text)) '------------------------------------------------------------ 'SAVE - If Not g.SaveFile Then + If Not VEC0.SaveFile Then MsgBox("Cannot safe to " & file, MsgBoxStyle.Critical) Return False End If - Genfile = file + VECTOfile = file - file = fFILE(Genfile, True) + file = fFILE(VECTOfile, True) Me.Text = file Me.ToolStripStatusLabelGEN.Text = "" - F_MAINForm.AddToListViewGEN(Genfile) + F_MAINForm.AddToJobListView(VECTOfile) Changed = False @@ -430,13 +515,13 @@ Public Class F_VECTO End Function - 'New VECTO file - Public Sub GENnew() + 'New file + Public Sub VECTOnew() If ChangeCheckCancel() Then Exit Sub 'Files - Me.TextBoxVEH.Text = "" + Me.TbVEH.Text = "" Me.TbENG.Text = "" Me.LvCycles.Items.Clear() Me.TbGBX.Text = "" @@ -463,39 +548,35 @@ Public Class F_VECTO DeclInit() + F_ENG.AutoSendTo = False - Genfile = "" + VECTOfile = "" Me.Text = "VECTO Editor" Me.ToolStripStatusLabelGEN.Text = "" Changed = False + UpdatePic() End Sub -#End Region -#Region "Formular Änderungen (Change() Aufruf) und ggf. Tabs ein/ausblenden" +#Region "Track changes" -#Region "Event Handler für Formänderungen" +#Region "'Change' Events" - 'Event handler for the form changes - Private Sub FormChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) - Call Change() - End Sub - - - 'TextBox.TextChanged Events => Change() - Private Sub TextBoxVEH_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBoxVEH.TextChanged + Private Sub TextBoxVEH_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TbVEH.TextChanged + UpdatePic() Change() End Sub Private Sub TextBoxMAP_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TbENG.TextChanged + UpdatePic() Change() End Sub Private Sub TextBoxFLD_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TbGBX.TextChanged + UpdatePic() Change() End Sub - Private Sub TbDesMaxFile_TextChanged_1(sender As System.Object, e As System.EventArgs) Handles TbDesMaxFile.TextChanged Change() End Sub @@ -525,10 +606,13 @@ Public Class F_VECTO Change() End Sub + Private Sub LvCycles_AfterLabelEdit(sender As Object, e As System.Windows.Forms.LabelEditEventArgs) Handles LvCycles.AfterLabelEdit + Change() + End Sub + #End Region - 'Change Status Change Private Sub Change() If Not Changed Then Me.ToolStripStatusLabelGEN.Text = "Unsaved changes in current file" @@ -559,9 +643,6 @@ Public Class F_VECTO End Function - - - #End Region #Region "Aux Listview" @@ -570,7 +651,7 @@ Public Class F_VECTO Dim LV0 As ListViewItem Dim ID As String - AuxDlog.VehPath = fPATH(Genfile) + AuxDlog.VehPath = fPATH(VECTOfile) AuxDlog.TbPath.Text = "" AuxDlog.CbType.SelectedIndex = -1 AuxDlog.CbType.Text = "" @@ -597,6 +678,13 @@ lbDlog: LvAux.Items.Add(LV0) + If ID = sKey.AUX.ElecSys Then + EStechs.Clear() + For Each LV0 In AuxDlog.LVTech.CheckedItems + EStechs.Add(LV0.Text) + Next + End If + Change() End If @@ -614,29 +702,60 @@ lbDlog: Private Sub LvAux_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles LvAux.KeyDown Select Case e.KeyCode Case Keys.Delete, Keys.Back - RemoveAuxItem() + If Not Cfg.DeclMode Then RemoveAuxItem() Case Keys.Enter EditAuxItem() End Select End Sub Private Sub EditAuxItem() + Dim SelItem As ListViewItem Dim LV0 As ListViewItem If LvAux.SelectedItems.Count = 0 Then Exit Sub - LV0 = LvAux.SelectedItems(0) + SelItem = LvAux.SelectedItems(0) - AuxDlog.VehPath = fPATH(Genfile) - AuxDlog.TbPath.Text = LV0.SubItems(2).Text + AuxDlog.VehPath = fPATH(VECTOfile) AuxDlog.CbType.SelectedIndex = -1 - AuxDlog.CbType.Text = LV0.SubItems(1).Text - AuxDlog.TbID.Text = LV0.SubItems(0).Text '!!! Vorher Type setzen weil ID beim ändern von Type überschrieben wird !!! + AuxDlog.CbType.Text = SelItem.SubItems(1).Text + AuxDlog.TbID.Text = SelItem.SubItems(0).Text 'After Type-set! + + If Cfg.DeclMode Then + AuxDlog.CbTech.Text = SelItem.SubItems(2).Text + AuxDlog.TbPath.Text = "" + + If AuxDlog.TbID.Text = sKey.AUX.ElecSys Then + For Each LV0 In AuxDlog.LVTech.Items + If EStechs.Contains(LV0.Text) Then + LV0.Checked = True + Else + LV0.Checked = False + End If + Next + End If + + Else + AuxDlog.CbTech.SelectedIndex = -1 + AuxDlog.TbPath.Text = SelItem.SubItems(2).Text + End If If AuxDlog.ShowDialog = Windows.Forms.DialogResult.OK Then - LV0.SubItems(0).Text = UCase(Trim(AuxDlog.TbID.Text)) - LV0.SubItems(1).Text = Trim(AuxDlog.CbType.Text) - LV0.SubItems(2).Text = Trim(AuxDlog.TbPath.Text) + SelItem.SubItems(0).Text = UCase(Trim(AuxDlog.TbID.Text)) + SelItem.SubItems(1).Text = Trim(AuxDlog.CbType.Text) + + If Cfg.DeclMode Then + SelItem.SubItems(2).Text = Trim(AuxDlog.CbTech.Text) + Else + SelItem.SubItems(2).Text = Trim(AuxDlog.TbPath.Text) + End If + + If UCase(Trim(AuxDlog.TbID.Text)) = sKey.AUX.ElecSys Then + EStechs.Clear() + For Each LV0 In AuxDlog.LVTech.CheckedItems + EStechs.Add(LV0.Text) + Next + End If Change() @@ -685,14 +804,10 @@ lbDlog: Me.Close() End Sub -#Region "DRI List" - - Private Sub LvCycles_AfterLabelEdit(sender As Object, e As System.Windows.Forms.LabelEditEventArgs) Handles LvCycles.AfterLabelEdit - Change() - End Sub +#Region "Cycle list" Private Sub LvCycles_DoubleClick(sender As Object, e As System.EventArgs) Handles LvCycles.DoubleClick - If Me.LvCycles.SelectedItems.Count > 0 Then OpenFiles(fFileRepl(Me.LvCycles.SelectedItems(0).SubItems(0).Text, fPATH(Genfile))) + If Me.LvCycles.SelectedItems.Count > 0 Then OpenFiles(fFileRepl(Me.LvCycles.SelectedItems(0).SubItems(0).Text, fPATH(VECTOfile))) End Sub Private Sub LvCycles_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles LvCycles.KeyDown @@ -703,13 +818,13 @@ lbDlog: If Me.LvCycles.SelectedItems.Count > 0 Then Me.LvCycles.SelectedItems(0).BeginEdit() End Select End Sub -#End Region + Private Sub BtDRIadd_Click(sender As System.Object, e As System.EventArgs) Handles BtDRIadd.Click Dim str As String Dim GenDir As String - GenDir = fPATH(Genfile) + GenDir = fPATH(VECTOfile) If fbDRI.OpenDialog("", True) Then @@ -756,6 +871,11 @@ lbDlog: End Sub +#End Region + +#Region "Enable/Disable GUI controls" + + 'Engine only mode changed Private Sub CbEngOnly_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles CbEngOnly.CheckedChanged CheckEngOnly() Change() @@ -769,7 +889,7 @@ lbDlog: SetDrivertab(OnOff) ButOpenVEH.Enabled = OnOff - TextBoxVEH.Enabled = OnOff + TbVEH.Enabled = OnOff ButtonVEH.Enabled = OnOff ButOpenGBX.Enabled = OnOff TbGBX.Enabled = OnOff @@ -778,20 +898,19 @@ lbDlog: End Sub + 'Start/Stop changed Private Sub ChBStartStop_CheckedChanged_1(sender As System.Object, e As System.EventArgs) Handles ChBStartStop.CheckedChanged Change() - If Not Declaration.Active Then Me.PnStartStop.Enabled = Me.ChBStartStop.Checked + If Not Cfg.DeclMode Then Me.PnStartStop.Enabled = Me.ChBStartStop.Checked End Sub - -#Region "Overspeed / Eco-Roll / Look Ahead" - + 'LAC changed Private Sub CbLookAhead_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles CbLookAhead.CheckedChanged Change() Me.PnLookAhead.Enabled = CbLookAhead.Checked - End Sub + 'EcoRoll / Overspeed changed Private Sub RdOff_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RdOff.CheckedChanged, RdOverspeed.CheckedChanged, RdEcoRoll.CheckedChanged Dim EcoR As Boolean Dim Ovr As Boolean @@ -817,6 +936,248 @@ lbDlog: #End Region + Public Sub UpdatePic() + Dim VEH0 As New cVEH + Dim ENG0 As cENG + Dim GBX0 As cGBX + Dim FLD0 As cFLD + Dim Shiftpoly As cGBX.cShiftPolygon + Dim MAP0 As cMAP + Dim OkCount As Integer + Dim i As Integer + Dim pmax As Single + + Dim f As cFile_V3 = Nothing + Dim lM As List(Of Single) + Dim lup As List(Of Single) + Dim ldown As List(Of Single) + Dim line As String() = Nothing + + Dim s0 As cSegmentTableEntry = Nothing + Dim HDVclass As String + + Dim MyChart As System.Windows.Forms.DataVisualization.Charting.Chart + Dim s As System.Windows.Forms.DataVisualization.Charting.Series + Dim a As System.Windows.Forms.DataVisualization.Charting.ChartArea + Dim img As Image + + Me.TbHVCclass.Text = "" + Me.TbVehCat.Text = "" + Me.TbMass.Text = "" + Me.TbAxleConf.Text = "" + Me.TbEngTxt.Text = "" + Me.TbGbxTxt.Text = "" + Me.PicVehicle.Image = Nothing + Me.PicBox.Image = Nothing + + + VEH0.FilePath = fFileRepl(Me.TbVEH.Text, fPATH(VECTOfile)) + If VEH0.ReadFile(False) Then + + If Declaration.SegmentTable.SetRef(s0, VEH0.VehCat, VEH0.AxleConf, VEH0.MassMax) Then + HDVclass = s0.HDVclass + Else + HDVclass = "-" + End If + + Me.PicVehicle.Image = Image.FromFile(Declaration.ConvPicPath(HDVclass, False)) + + Me.TbHVCclass.Text = "HDV Class " & HDVclass + Me.TbVehCat.Text = ConvVehCat(VEH0.VehCat, True) + Me.TbMass.Text = VEH0.MassMax.ToString("0") & " t" + Me.TbAxleConf.Text = ConvAxleConf(VEH0.AxleConf) + + End If + + + OkCount = 0 + + ENG0 = New cENG + ENG0.FilePath = fFileRepl(Me.TbENG.Text, fPATH(VECTOfile)) + + 'Create plot + MyChart = New System.Windows.Forms.DataVisualization.Charting.Chart + MyChart.Width = Me.PicBox.Width + MyChart.Height = Me.PicBox.Height + + a = New System.Windows.Forms.DataVisualization.Charting.ChartArea + + If ENG0.ReadFile(False) Then + + FLD0 = New cFLD + + For i = 0 To ENG0.fFLD.Count - 1 + + FLD0.FilePath = ENG0.fFLD(i).FullPath + If FLD0.ReadFile(False) Then + + s = New System.Windows.Forms.DataVisualization.Charting.Series + s.Points.DataBindXY(FLD0.LnU, FLD0.LTq) + s.ChartType = DataVisualization.Charting.SeriesChartType.FastLine + s.BorderWidth = 2 + s.Color = Color.DarkBlue + s.Name = "Full load (" & fFILE(FLD0.FilePath, True) & ")" + MyChart.Series.Add(s) + + s = New System.Windows.Forms.DataVisualization.Charting.Series + s.Points.DataBindXY(FLD0.LnU, FLD0.LTqDrag) + s.ChartType = DataVisualization.Charting.SeriesChartType.FastLine + s.BorderWidth = 2 + s.Color = Color.Blue + s.Name = "Motoring (" & fFILE(FLD0.FilePath, True) & ")" + MyChart.Series.Add(s) + + If Cfg.DeclMode Then + FLD0.Init(ENG0.Nidle) + + Shiftpoly = New cGBX.cShiftPolygon("", 0) + Shiftpoly.SetGenericShiftPoly(FLD0, ENG0.Nidle) + + s = New System.Windows.Forms.DataVisualization.Charting.Series + s.Points.DataBindXY(Shiftpoly.gs_nUup, Shiftpoly.gs_Mup) + s.ChartType = DataVisualization.Charting.SeriesChartType.FastLine + s.BorderWidth = 2 + s.Color = Color.DarkRed + s.Name = "Upshift curve" + MyChart.Series.Add(s) + + s = New System.Windows.Forms.DataVisualization.Charting.Series + s.Points.DataBindXY(Shiftpoly.gs_nUdown, Shiftpoly.gs_Mdown) + s.ChartType = DataVisualization.Charting.SeriesChartType.FastLine + s.BorderWidth = 2 + s.Color = Color.DarkRed + s.Name = "Downshift curve" + MyChart.Series.Add(s) + + End If + + OkCount += 1 + + pmax = FLD0.Pfull(FLD0.fnUrated) + + + End If + + + + Next + + Me.TbEngTxt.Text = (ENG0.Displ / 1000).ToString("0.0") & " l " & pmax.ToString("#") & " kW " & ENG0.ModelName + + + MAP0 = New cMAP + MAP0.FilePath = ENG0.PathMAP + + If MAP0.ReadFile Then + + s = New System.Windows.Forms.DataVisualization.Charting.Series + s.Points.DataBindXY(MAP0.nU, MAP0.Tq) + s.ChartType = DataVisualization.Charting.SeriesChartType.Point + s.MarkerSize = 3 + s.Color = Color.Red + s.Name = "Map" + MyChart.Series.Add(s) + + OkCount += 1 + + End If + + End If + + GBX0 = New cGBX + GBX0.FilePath = fFileRepl(Me.TbGBX.Text, fPATH(VECTOfile)) + + If GBX0.ReadFile(False) Then + + Me.TbGbxTxt.Text = GBX0.GearCount & "-Speed " & GearboxConv(GBX0.gs_Type) & " " & GBX0.ModelName + + If Not Cfg.DeclMode Then + f = New cFile_V3 + For i = 0 To GBX0.GearCount - 1 + + lM = New List(Of Single) + lup = New List(Of Single) + ldown = New List(Of Single) + + If f.OpenRead(GBX0.gsFile(i)) Then + + Try + + Do While Not f.EndOfFile + line = f.ReadLine + lM.Add(CSng(line(0))) + lup.Add(CSng(line(1))) + ldown.Add(CSng(line(2))) + Loop + + s = New System.Windows.Forms.DataVisualization.Charting.Series + s.Points.DataBindXY(lup, lM) + s.ChartType = DataVisualization.Charting.SeriesChartType.FastLine + s.BorderWidth = 2 + s.Color = Color.DarkRed + s.Name = "Upshift curve" + MyChart.Series.Add(s) + + s = New System.Windows.Forms.DataVisualization.Charting.Series + s.Points.DataBindXY(ldown, lM) + s.ChartType = DataVisualization.Charting.SeriesChartType.FastLine + s.BorderWidth = 2 + s.Color = Color.DarkRed + s.Name = "Downshift curve" + MyChart.Series.Add(s) + + OkCount += 1 + + f.Close() + + Catch ex As Exception + f.Close() + End Try + + End If + + Next + + End If + + End If + + If OkCount > 0 Then + + a.Name = "main" + + a.AxisX.Title = "engine speed [1/min]" + a.AxisX.TitleFont = New Font("Helvetica", 10) + a.AxisX.LabelStyle.Font = New Font("Helvetica", 8) + a.AxisX.LabelAutoFitStyle = DataVisualization.Charting.LabelAutoFitStyles.None + a.AxisX.MajorGrid.LineDashStyle = DataVisualization.Charting.ChartDashStyle.Dot + + a.AxisY.Title = "engine torque [Nm]" + a.AxisY.TitleFont = New Font("Helvetica", 10) + a.AxisY.LabelStyle.Font = New Font("Helvetica", 8) + a.AxisY.LabelAutoFitStyle = DataVisualization.Charting.LabelAutoFitStyles.None + a.AxisY.MajorGrid.LineDashStyle = DataVisualization.Charting.ChartDashStyle.Dot + + a.AxisX.Minimum = 300 + a.BorderDashStyle = DataVisualization.Charting.ChartDashStyle.Solid + a.BorderWidth = 1 + + a.BackColor = Color.GhostWhite + + MyChart.ChartAreas.Add(a) + + MyChart.Update() + + img = New Bitmap(MyChart.Width, MyChart.Height, Imaging.PixelFormat.Format32bppArgb) + MyChart.DrawToBitmap(img, New Rectangle(0, 0, Me.PicBox.Width, Me.PicBox.Height)) + + Me.PicBox.Image = img + + + End If + + End Sub + #Region "Open File Context Menu" @@ -834,10 +1195,6 @@ lbDlog: End Sub - Private Sub OpenWithGRAPHiToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles OpenWithGRAPHiToolStripMenuItem.Click - If Not FileOpenGRAPHi(CmFiles) Then MsgBox("Failed to open file!") - End Sub - Private Sub OpenWithToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles OpenWithToolStripMenuItem.Click If Not FileOpenAlt(CmFiles(0)) Then MsgBox("Failed to open file!") End Sub diff --git a/VECTO/GUI/F_VEH.Designer.vb b/VECTO/GUI/F_VEH.Designer.vb index 4f2c29cdf0c0af938425d01eac72cc0c884b1011..68d6776aa7ce725399a736836765a3b115759437 100644 --- a/VECTO/GUI/F_VEH.Designer.vb +++ b/VECTO/GUI/F_VEH.Designer.vb @@ -32,15 +32,12 @@ Partial Class F_VEH Me.TBcdTrTr = New System.Windows.Forms.TextBox() Me.Label4 = New System.Windows.Forms.Label() Me.TBAquersTrTr = New System.Windows.Forms.TextBox() - Me.Label7 = New System.Windows.Forms.Label() - Me.TbI_wheels = New System.Windows.Forms.TextBox() Me.Label13 = New System.Windows.Forms.Label() - Me.TBDreifen = New System.Windows.Forms.TextBox() + Me.TBrdyn = New System.Windows.Forms.TextBox() Me.ButOK = New System.Windows.Forms.Button() Me.ButCancel = New System.Windows.Forms.Button() Me.Label14 = New System.Windows.Forms.Label() Me.Label31 = New System.Windows.Forms.Label() - Me.Label32 = New System.Windows.Forms.Label() Me.Label35 = New System.Windows.Forms.Label() Me.Label37 = New System.Windows.Forms.Label() Me.Label38 = New System.Windows.Forms.Label() @@ -72,6 +69,10 @@ Partial Class F_VEH Me.Label50 = New System.Windows.Forms.Label() Me.TbMassExtra = New System.Windows.Forms.TextBox() Me.GroupBox8 = New System.Windows.Forms.GroupBox() + Me.PnWheelDiam = New System.Windows.Forms.Panel() + Me.CbRim = New System.Windows.Forms.ComboBox() + Me.Label7 = New System.Windows.Forms.Label() + Me.Label6 = New System.Windows.Forms.Label() Me.ButAxlRem = New System.Windows.Forms.Button() Me.LvRRC = New System.Windows.Forms.ListView() Me.ColumnHeader7 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) @@ -79,15 +80,14 @@ Partial Class F_VEH Me.ColumnHeader2 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) Me.ColumnHeader9 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) Me.ColumnHeader1 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) + Me.ColumnHeader3 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) + Me.ColumnHeader4 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) Me.ButAxlAdd = New System.Windows.Forms.Button() - Me.Label23 = New System.Windows.Forms.Label() Me.CbAxleConfig = New System.Windows.Forms.ComboBox() - Me.Label21 = New System.Windows.Forms.Label() Me.CbCat = New System.Windows.Forms.ComboBox() Me.Label5 = New System.Windows.Forms.Label() Me.Label9 = New System.Windows.Forms.Label() Me.TbMassMass = New System.Windows.Forms.TextBox() - Me.Label10 = New System.Windows.Forms.Label() Me.StatusStrip1 = New System.Windows.Forms.StatusStrip() Me.LbStatus = New System.Windows.Forms.ToolStripStatusLabel() Me.TbHDVclass = New System.Windows.Forms.TextBox() @@ -100,20 +100,22 @@ Partial Class F_VEH Me.PnCdATrTr = New System.Windows.Forms.Panel() Me.LbCdATr = New System.Windows.Forms.Label() Me.PnCdARig = New System.Windows.Forms.Panel() - Me.Label8 = New System.Windows.Forms.Label() + Me.LbCdARig = New System.Windows.Forms.Label() Me.TBcwRig = New System.Windows.Forms.TextBox() Me.TBAquersRig = New System.Windows.Forms.TextBox() Me.PictureBox1 = New System.Windows.Forms.PictureBox() Me.CmOpenFile = New System.Windows.Forms.ContextMenuStrip(Me.components) - Me.OpenWithGRAPHiToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.OpenWithToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ShowInFolderToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.PnAll = New System.Windows.Forms.Panel() + Me.PicVehicle = New System.Windows.Forms.PictureBox() + Me.Label8 = New System.Windows.Forms.Label() Me.GroupBox6.SuspendLayout() Me.ToolStrip1.SuspendLayout() Me.GroupBox7.SuspendLayout() Me.PnRt.SuspendLayout() Me.GroupBox8.SuspendLayout() + Me.PnWheelDiam.SuspendLayout() Me.StatusStrip1.SuspendLayout() Me.GroupBox1.SuspendLayout() Me.PnLoad.SuspendLayout() @@ -123,6 +125,7 @@ Partial Class F_VEH CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit() Me.CmOpenFile.SuspendLayout() Me.PnAll.SuspendLayout() + CType(Me.PicVehicle, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'Label1 @@ -160,7 +163,7 @@ Partial Class F_VEH 'Label3 ' Me.Label3.AutoSize = True - Me.Label3.Location = New System.Drawing.Point(37, 47) + Me.Label3.Location = New System.Drawing.Point(37, 55) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(58, 13) Me.Label3.TabIndex = 8 @@ -168,6 +171,8 @@ Partial Class F_VEH ' 'TBcdTrTr ' + Me.TBcdTrTr.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.TBcdTrTr.Location = New System.Drawing.Point(2, 24) Me.TBcdTrTr.Name = "TBcdTrTr" Me.TBcdTrTr.Size = New System.Drawing.Size(57, 20) @@ -176,7 +181,7 @@ Partial Class F_VEH 'Label4 ' Me.Label4.AutoSize = True - Me.Label4.Location = New System.Drawing.Point(12, 73) + Me.Label4.Location = New System.Drawing.Point(12, 81) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(83, 13) Me.Label4.TabIndex = 10 @@ -184,47 +189,33 @@ Partial Class F_VEH ' 'TBAquersTrTr ' + Me.TBAquersTrTr.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.TBAquersTrTr.Location = New System.Drawing.Point(2, 50) Me.TBAquersTrTr.Name = "TBAquersTrTr" Me.TBAquersTrTr.Size = New System.Drawing.Size(57, 20) Me.TBAquersTrTr.TabIndex = 1 ' - 'Label7 - ' - Me.Label7.AutoSize = True - Me.Label7.Location = New System.Drawing.Point(62, 177) - Me.Label7.Name = "Label7" - Me.Label7.Size = New System.Drawing.Size(75, 13) - Me.Label7.TabIndex = 4 - Me.Label7.Text = "Wheels Inertia" - ' - 'TbI_wheels - ' - Me.TbI_wheels.Location = New System.Drawing.Point(143, 174) - Me.TbI_wheels.Name = "TbI_wheels" - Me.TbI_wheels.Size = New System.Drawing.Size(57, 20) - Me.TbI_wheels.TabIndex = 4 - ' 'Label13 ' Me.Label13.AutoSize = True - Me.Label13.Location = New System.Drawing.Point(28, 203) + Me.Label13.Location = New System.Drawing.Point(7, 7) Me.Label13.Name = "Label13" - Me.Label13.Size = New System.Drawing.Size(109, 13) + Me.Label13.Size = New System.Drawing.Size(96, 13) Me.Label13.TabIndex = 6 - Me.Label13.Text = "Wheel Diameter (dyn)" + Me.Label13.Text = "Dynamic tire radius" ' - 'TBDreifen + 'TBrdyn ' - Me.TBDreifen.Location = New System.Drawing.Point(143, 200) - Me.TBDreifen.Name = "TBDreifen" - Me.TBDreifen.Size = New System.Drawing.Size(57, 20) - Me.TBDreifen.TabIndex = 5 + Me.TBrdyn.Location = New System.Drawing.Point(109, 4) + Me.TBrdyn.Name = "TBrdyn" + Me.TBrdyn.Size = New System.Drawing.Size(57, 20) + Me.TBrdyn.TabIndex = 5 ' 'ButOK ' Me.ButOK.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ButOK.Location = New System.Drawing.Point(383, 561) + Me.ButOK.Location = New System.Drawing.Point(394, 693) Me.ButOK.Name = "ButOK" Me.ButOK.Size = New System.Drawing.Size(75, 23) Me.ButOK.TabIndex = 9 @@ -235,7 +226,7 @@ Partial Class F_VEH ' Me.ButCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.ButCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel - Me.ButCancel.Location = New System.Drawing.Point(464, 561) + Me.ButCancel.Location = New System.Drawing.Point(475, 693) Me.ButCancel.Name = "ButCancel" Me.ButCancel.Size = New System.Drawing.Size(75, 23) Me.ButCancel.TabIndex = 10 @@ -260,28 +251,19 @@ Partial Class F_VEH Me.Label31.TabIndex = 24 Me.Label31.Text = "[kg]" ' - 'Label32 - ' - Me.Label32.AutoSize = True - Me.Label32.Location = New System.Drawing.Point(206, 177) - Me.Label32.Name = "Label32" - Me.Label32.Size = New System.Drawing.Size(36, 13) - Me.Label32.TabIndex = 24 - Me.Label32.Text = "[kgm²]" - ' 'Label35 ' Me.Label35.AutoSize = True - Me.Label35.Location = New System.Drawing.Point(206, 203) + Me.Label35.Location = New System.Drawing.Point(172, 7) Me.Label35.Name = "Label35" - Me.Label35.Size = New System.Drawing.Size(21, 13) + Me.Label35.Size = New System.Drawing.Size(29, 13) Me.Label35.TabIndex = 24 - Me.Label35.Text = "[m]" + Me.Label35.Text = "[mm]" ' 'Label37 ' Me.Label37.AutoSize = True - Me.Label37.Location = New System.Drawing.Point(223, 47) + Me.Label37.Location = New System.Drawing.Point(230, 53) Me.Label37.Name = "Label37" Me.Label37.Size = New System.Drawing.Size(16, 13) Me.Label37.TabIndex = 24 @@ -290,7 +272,7 @@ Partial Class F_VEH 'Label38 ' Me.Label38.AutoSize = True - Me.Label38.Location = New System.Drawing.Point(223, 73) + Me.Label38.Location = New System.Drawing.Point(230, 79) Me.Label38.Name = "Label38" Me.Label38.Size = New System.Drawing.Size(24, 13) Me.Label38.TabIndex = 24 @@ -311,13 +293,13 @@ Partial Class F_VEH Me.TbCdFile.Enabled = False Me.TbCdFile.Location = New System.Drawing.Point(6, 46) Me.TbCdFile.Name = "TbCdFile" - Me.TbCdFile.Size = New System.Drawing.Size(448, 20) + Me.TbCdFile.Size = New System.Drawing.Size(459, 20) Me.TbCdFile.TabIndex = 1 ' 'BtCdFileBrowse ' Me.BtCdFileBrowse.Enabled = False - Me.BtCdFileBrowse.Location = New System.Drawing.Point(460, 44) + Me.BtCdFileBrowse.Location = New System.Drawing.Point(471, 44) Me.BtCdFileBrowse.Name = "BtCdFileBrowse" Me.BtCdFileBrowse.Size = New System.Drawing.Size(32, 23) Me.BtCdFileBrowse.TabIndex = 2 @@ -331,9 +313,9 @@ Partial Class F_VEH Me.GroupBox6.Controls.Add(Me.CbCdMode) Me.GroupBox6.Controls.Add(Me.BtCdFileBrowse) Me.GroupBox6.Controls.Add(Me.TbCdFile) - Me.GroupBox6.Location = New System.Drawing.Point(6, 241) + Me.GroupBox6.Location = New System.Drawing.Point(6, 432) Me.GroupBox6.Name = "GroupBox6" - Me.GroupBox6.Size = New System.Drawing.Size(527, 74) + Me.GroupBox6.Size = New System.Drawing.Size(538, 74) Me.GroupBox6.TabIndex = 5 Me.GroupBox6.TabStop = False Me.GroupBox6.Text = "Cross Wind Correction" @@ -342,7 +324,7 @@ Partial Class F_VEH ' Me.BtCdFileOpen.Enabled = False Me.BtCdFileOpen.Image = Global.VECTO.My.Resources.Resources.application_export_icon_small - Me.BtCdFileOpen.Location = New System.Drawing.Point(498, 44) + Me.BtCdFileOpen.Location = New System.Drawing.Point(509, 44) Me.BtCdFileOpen.Name = "BtCdFileOpen" Me.BtCdFileOpen.Size = New System.Drawing.Size(23, 23) Me.BtCdFileOpen.TabIndex = 41 @@ -364,7 +346,7 @@ Partial Class F_VEH Me.ToolStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripBtNew, Me.ToolStripBtOpen, Me.ToolStripBtSave, Me.ToolStripBtSaveAs, Me.ToolStripSeparator3, Me.ToolStripBtSendTo, Me.ToolStripSeparator1, Me.ToolStripButton1}) Me.ToolStrip1.Location = New System.Drawing.Point(0, 0) Me.ToolStrip1.Name = "ToolStrip1" - Me.ToolStrip1.Size = New System.Drawing.Size(551, 25) + Me.ToolStrip1.Size = New System.Drawing.Size(562, 25) Me.ToolStrip1.TabIndex = 29 Me.ToolStrip1.Text = "ToolStrip1" ' @@ -420,8 +402,8 @@ Partial Class F_VEH Me.ToolStripBtSendTo.ImageTransparentColor = System.Drawing.Color.Magenta Me.ToolStripBtSendTo.Name = "ToolStripBtSendTo" Me.ToolStripBtSendTo.Size = New System.Drawing.Size(23, 22) - Me.ToolStripBtSendTo.Text = "Send to GEN Editor" - Me.ToolStripBtSendTo.ToolTipText = "Send to GEN Editor" + Me.ToolStripBtSendTo.Text = "Send to Job Editor" + Me.ToolStripBtSendTo.ToolTipText = "Send to Job Editor" ' 'ToolStripSeparator1 ' @@ -444,9 +426,9 @@ Partial Class F_VEH Me.GroupBox7.Controls.Add(Me.TbRtPath) Me.GroupBox7.Controls.Add(Me.CbRtType) Me.GroupBox7.Controls.Add(Me.Label12) - Me.GroupBox7.Location = New System.Drawing.Point(6, 321) + Me.GroupBox7.Location = New System.Drawing.Point(6, 345) Me.GroupBox7.Name = "GroupBox7" - Me.GroupBox7.Size = New System.Drawing.Size(527, 81) + Me.GroupBox7.Size = New System.Drawing.Size(538, 81) Me.GroupBox7.TabIndex = 7 Me.GroupBox7.TabStop = False Me.GroupBox7.Text = "Retarder Losses" @@ -491,7 +473,7 @@ Partial Class F_VEH 'BtRtBrowse ' Me.BtRtBrowse.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) - Me.BtRtBrowse.Location = New System.Drawing.Point(489, 52) + Me.BtRtBrowse.Location = New System.Drawing.Point(500, 52) Me.BtRtBrowse.Name = "BtRtBrowse" Me.BtRtBrowse.Size = New System.Drawing.Size(32, 23) Me.BtRtBrowse.TabIndex = 2 @@ -504,7 +486,7 @@ Partial Class F_VEH Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.TbRtPath.Location = New System.Drawing.Point(5, 54) Me.TbRtPath.Name = "TbRtPath" - Me.TbRtPath.Size = New System.Drawing.Size(478, 20) + Me.TbRtPath.Size = New System.Drawing.Size(489, 20) Me.TbRtPath.TabIndex = 1 ' 'CbRtType @@ -553,22 +535,57 @@ Partial Class F_VEH ' 'GroupBox8 ' + Me.GroupBox8.Controls.Add(Me.PnWheelDiam) + Me.GroupBox8.Controls.Add(Me.CbRim) + Me.GroupBox8.Controls.Add(Me.Label7) + Me.GroupBox8.Controls.Add(Me.Label6) Me.GroupBox8.Controls.Add(Me.ButAxlRem) Me.GroupBox8.Controls.Add(Me.LvRRC) Me.GroupBox8.Controls.Add(Me.ButAxlAdd) - Me.GroupBox8.Controls.Add(Me.TbI_wheels) - Me.GroupBox8.Controls.Add(Me.Label13) - Me.GroupBox8.Controls.Add(Me.TBDreifen) - Me.GroupBox8.Controls.Add(Me.Label7) - Me.GroupBox8.Controls.Add(Me.Label32) - Me.GroupBox8.Controls.Add(Me.Label35) - Me.GroupBox8.Location = New System.Drawing.Point(278, 3) + Me.GroupBox8.Location = New System.Drawing.Point(6, 133) Me.GroupBox8.Name = "GroupBox8" - Me.GroupBox8.Size = New System.Drawing.Size(255, 232) + Me.GroupBox8.Size = New System.Drawing.Size(538, 206) Me.GroupBox8.TabIndex = 4 Me.GroupBox8.TabStop = False Me.GroupBox8.Text = "Axles / Wheels" ' + 'PnWheelDiam + ' + Me.PnWheelDiam.Controls.Add(Me.Label13) + Me.PnWheelDiam.Controls.Add(Me.TBrdyn) + Me.PnWheelDiam.Controls.Add(Me.Label35) + Me.PnWheelDiam.Location = New System.Drawing.Point(321, 163) + Me.PnWheelDiam.Name = "PnWheelDiam" + Me.PnWheelDiam.Size = New System.Drawing.Size(204, 33) + Me.PnWheelDiam.TabIndex = 48 + ' + 'CbRim + ' + Me.CbRim.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.CbRim.FormattingEnabled = True + Me.CbRim.Location = New System.Drawing.Point(131, 167) + Me.CbRim.Name = "CbRim" + Me.CbRim.Size = New System.Drawing.Size(184, 21) + Me.CbRim.TabIndex = 47 + ' + 'Label7 + ' + Me.Label7.AutoSize = True + Me.Label7.Location = New System.Drawing.Point(6, 170) + Me.Label7.Name = "Label7" + Me.Label7.Size = New System.Drawing.Size(119, 13) + Me.Label7.TabIndex = 46 + Me.Label7.Text = "Powered axle tyres/rims" + ' + 'Label6 + ' + Me.Label6.AutoSize = True + Me.Label6.Location = New System.Drawing.Point(405, 132) + Me.Label6.Name = "Label6" + Me.Label6.Size = New System.Drawing.Size(121, 13) + Me.Label6.TabIndex = 45 + Me.Label6.Text = "Double-Click to edit axle" + ' 'ButAxlRem ' Me.ButAxlRem.Image = Global.VECTO.My.Resources.Resources.minus_circle_icon @@ -582,14 +599,14 @@ Partial Class F_VEH ' Me.LvRRC.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.LvRRC.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader7, Me.ColumnHeader8, Me.ColumnHeader2, Me.ColumnHeader9, Me.ColumnHeader1}) + Me.LvRRC.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader7, Me.ColumnHeader8, Me.ColumnHeader2, Me.ColumnHeader9, Me.ColumnHeader1, Me.ColumnHeader3, Me.ColumnHeader4}) Me.LvRRC.FullRowSelect = True Me.LvRRC.GridLines = True Me.LvRRC.HideSelection = False Me.LvRRC.Location = New System.Drawing.Point(6, 19) Me.LvRRC.MultiSelect = False Me.LvRRC.Name = "LvRRC" - Me.LvRRC.Size = New System.Drawing.Size(243, 102) + Me.LvRRC.Size = New System.Drawing.Size(526, 102) Me.LvRRC.TabIndex = 0 Me.LvRRC.TabStop = False Me.LvRRC.UseCompatibleStateImageBehavior = False @@ -613,12 +630,21 @@ Partial Class F_VEH 'ColumnHeader9 ' Me.ColumnHeader9.Text = "RRC" - Me.ColumnHeader9.Width = 56 + Me.ColumnHeader9.Width = 59 ' 'ColumnHeader1 ' Me.ColumnHeader1.Text = "Fz ISO" - Me.ColumnHeader1.Width = 47 + Me.ColumnHeader1.Width = 55 + ' + 'ColumnHeader3 + ' + Me.ColumnHeader3.Text = "Wheels" + Me.ColumnHeader3.Width = 181 + ' + 'ColumnHeader4 + ' + Me.ColumnHeader4.Text = "Inertia" ' 'ButAxlAdd ' @@ -629,48 +655,30 @@ Partial Class F_VEH Me.ButAxlAdd.TabIndex = 1 Me.ButAxlAdd.UseVisualStyleBackColor = True ' - 'Label23 - ' - Me.Label23.AutoSize = True - Me.Label23.Location = New System.Drawing.Point(206, 86) - Me.Label23.Name = "Label23" - Me.Label23.Size = New System.Drawing.Size(92, 13) - Me.Label23.TabIndex = 13 - Me.Label23.Text = "Axle Configuration" - ' 'CbAxleConfig ' Me.CbAxleConfig.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList Me.CbAxleConfig.FormattingEnabled = True - Me.CbAxleConfig.Items.AddRange(New Object() {"4x2", "4x4", "6x2", "6x4", "6x6", "8x2", "8x4", "8x6", "8x8"}) - Me.CbAxleConfig.Location = New System.Drawing.Point(304, 83) + Me.CbAxleConfig.Items.AddRange(New Object() {"-", "4x2", "4x4", "6x2", "6x4", "6x6", "8x2", "8x4", "8x6", "8x8"}) + Me.CbAxleConfig.Location = New System.Drawing.Point(136, 80) Me.CbAxleConfig.Name = "CbAxleConfig" - Me.CbAxleConfig.Size = New System.Drawing.Size(68, 21) + Me.CbAxleConfig.Size = New System.Drawing.Size(89, 21) Me.CbAxleConfig.TabIndex = 3 ' - 'Label21 - ' - Me.Label21.AutoSize = True - Me.Label21.Location = New System.Drawing.Point(13, 86) - Me.Label21.Name = "Label21" - Me.Label21.Size = New System.Drawing.Size(49, 13) - Me.Label21.TabIndex = 34 - Me.Label21.Text = "Category" - ' 'CbCat ' Me.CbCat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList Me.CbCat.FormattingEnabled = True - Me.CbCat.Items.AddRange(New Object() {"Rigid Truck", "Tractor", "City Bus", "Interurban Bus", "Coach"}) - Me.CbCat.Location = New System.Drawing.Point(68, 83) + Me.CbCat.Items.AddRange(New Object() {"-", "Rigid Truck", "Tractor", "City Bus", "Interurban Bus", "Coach"}) + Me.CbCat.Location = New System.Drawing.Point(12, 80) Me.CbCat.Name = "CbCat" - Me.CbCat.Size = New System.Drawing.Size(105, 21) + Me.CbCat.Size = New System.Drawing.Size(114, 21) Me.CbCat.TabIndex = 0 ' 'Label5 ' Me.Label5.AutoSize = True - Me.Label5.Location = New System.Drawing.Point(13, 119) + Me.Label5.Location = New System.Drawing.Point(13, 117) Me.Label5.Name = "Label5" Me.Label5.Size = New System.Drawing.Size(134, 13) Me.Label5.TabIndex = 31 @@ -679,7 +687,7 @@ Partial Class F_VEH 'Label9 ' Me.Label9.AutoSize = True - Me.Label9.Location = New System.Drawing.Point(201, 119) + Me.Label9.Location = New System.Drawing.Point(201, 117) Me.Label9.Name = "Label9" Me.Label9.Size = New System.Drawing.Size(16, 13) Me.Label9.TabIndex = 24 @@ -687,26 +695,17 @@ Partial Class F_VEH ' 'TbMassMass ' - Me.TbMassMass.Location = New System.Drawing.Point(153, 116) + Me.TbMassMass.Location = New System.Drawing.Point(153, 114) Me.TbMassMass.Name = "TbMassMass" Me.TbMassMass.Size = New System.Drawing.Size(42, 20) Me.TbMassMass.TabIndex = 4 ' - 'Label10 - ' - Me.Label10.AutoSize = True - Me.Label10.Location = New System.Drawing.Point(413, 86) - Me.Label10.Name = "Label10" - Me.Label10.Size = New System.Drawing.Size(58, 13) - Me.Label10.TabIndex = 31 - Me.Label10.Text = "HDV Class" - ' 'StatusStrip1 ' Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.LbStatus}) - Me.StatusStrip1.Location = New System.Drawing.Point(0, 587) + Me.StatusStrip1.Location = New System.Drawing.Point(0, 719) Me.StatusStrip1.Name = "StatusStrip1" - Me.StatusStrip1.Size = New System.Drawing.Size(551, 22) + Me.StatusStrip1.Size = New System.Drawing.Size(562, 22) Me.StatusStrip1.SizingGrip = False Me.StatusStrip1.TabIndex = 36 Me.StatusStrip1.Text = "StatusStrip1" @@ -719,10 +718,10 @@ Partial Class F_VEH ' 'TbHDVclass ' - Me.TbHDVclass.Location = New System.Drawing.Point(477, 83) + Me.TbHDVclass.Location = New System.Drawing.Point(153, 142) Me.TbHDVclass.Name = "TbHDVclass" Me.TbHDVclass.ReadOnly = True - Me.TbHDVclass.Size = New System.Drawing.Size(28, 20) + Me.TbHDVclass.Size = New System.Drawing.Size(25, 20) Me.TbHDVclass.TabIndex = 1 Me.TbHDVclass.TabStop = False ' @@ -779,7 +778,7 @@ Partial Class F_VEH Me.PnLoad.Controls.Add(Me.Label11) Me.PnLoad.Location = New System.Drawing.Point(6, 43) Me.PnLoad.Name = "PnLoad" - Me.PnLoad.Size = New System.Drawing.Size(256, 84) + Me.PnLoad.Size = New System.Drawing.Size(256, 75) Me.PnLoad.TabIndex = 25 ' 'GroupBox4 @@ -790,9 +789,9 @@ Partial Class F_VEH Me.GroupBox4.Controls.Add(Me.Label4) Me.GroupBox4.Controls.Add(Me.Label37) Me.GroupBox4.Controls.Add(Me.Label38) - Me.GroupBox4.Location = New System.Drawing.Point(6, 133) + Me.GroupBox4.Location = New System.Drawing.Point(278, 3) Me.GroupBox4.Name = "GroupBox4" - Me.GroupBox4.Size = New System.Drawing.Size(266, 102) + Me.GroupBox4.Size = New System.Drawing.Size(266, 124) Me.GroupBox4.TabIndex = 3 Me.GroupBox4.TabStop = False Me.GroupBox4.Text = "Air Resistance" @@ -802,15 +801,15 @@ Partial Class F_VEH Me.PnCdATrTr.Controls.Add(Me.LbCdATr) Me.PnCdATrTr.Controls.Add(Me.TBcdTrTr) Me.PnCdATrTr.Controls.Add(Me.TBAquersTrTr) - Me.PnCdATrTr.Location = New System.Drawing.Point(97, 20) + Me.PnCdATrTr.Location = New System.Drawing.Point(97, 26) Me.PnCdATrTr.Name = "PnCdATrTr" - Me.PnCdATrTr.Size = New System.Drawing.Size(60, 76) + Me.PnCdATrTr.Size = New System.Drawing.Size(64, 78) Me.PnCdATrTr.TabIndex = 27 ' 'LbCdATr ' Me.LbCdATr.AutoSize = True - Me.LbCdATr.Location = New System.Drawing.Point(2, 1) + 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 @@ -818,33 +817,33 @@ Partial Class F_VEH ' 'PnCdARig ' - Me.PnCdARig.Controls.Add(Me.Label8) + Me.PnCdARig.Controls.Add(Me.LbCdARig) Me.PnCdARig.Controls.Add(Me.TBcwRig) Me.PnCdARig.Controls.Add(Me.TBAquersRig) - Me.PnCdARig.Location = New System.Drawing.Point(157, 18) + Me.PnCdARig.Location = New System.Drawing.Point(164, 26) Me.PnCdARig.Name = "PnCdARig" - Me.PnCdARig.Size = New System.Drawing.Size(60, 78) + Me.PnCdARig.Size = New System.Drawing.Size(64, 78) Me.PnCdARig.TabIndex = 26 ' - 'Label8 + 'LbCdARig ' - Me.Label8.AutoSize = True - Me.Label8.Location = New System.Drawing.Point(10, 3) - Me.Label8.Name = "Label8" - Me.Label8.Size = New System.Drawing.Size(31, 13) - Me.Label8.TabIndex = 25 - Me.Label8.Text = "Rigid" + 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" ' 'TBcwRig ' - Me.TBcwRig.Location = New System.Drawing.Point(3, 26) + Me.TBcwRig.Location = New System.Drawing.Point(3, 24) Me.TBcwRig.Name = "TBcwRig" Me.TBcwRig.Size = New System.Drawing.Size(57, 20) Me.TBcwRig.TabIndex = 0 ' 'TBAquersRig ' - Me.TBAquersRig.Location = New System.Drawing.Point(3, 52) + Me.TBAquersRig.Location = New System.Drawing.Point(3, 50) Me.TBAquersRig.Name = "TBAquersRig" Me.TBAquersRig.Size = New System.Drawing.Size(57, 20) Me.TBAquersRig.TabIndex = 1 @@ -855,32 +854,26 @@ Partial Class F_VEH Me.PictureBox1.Image = Global.VECTO.My.Resources.Resources.VECTO_VEH Me.PictureBox1.Location = New System.Drawing.Point(12, 28) Me.PictureBox1.Name = "PictureBox1" - Me.PictureBox1.Size = New System.Drawing.Size(527, 40) + Me.PictureBox1.Size = New System.Drawing.Size(538, 40) Me.PictureBox1.TabIndex = 37 Me.PictureBox1.TabStop = False ' 'CmOpenFile ' - Me.CmOpenFile.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.OpenWithGRAPHiToolStripMenuItem, Me.OpenWithToolStripMenuItem, Me.ShowInFolderToolStripMenuItem}) + Me.CmOpenFile.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.OpenWithToolStripMenuItem, Me.ShowInFolderToolStripMenuItem}) Me.CmOpenFile.Name = "CmOpenFile" - Me.CmOpenFile.Size = New System.Drawing.Size(175, 70) - ' - 'OpenWithGRAPHiToolStripMenuItem - ' - Me.OpenWithGRAPHiToolStripMenuItem.Name = "OpenWithGRAPHiToolStripMenuItem" - Me.OpenWithGRAPHiToolStripMenuItem.Size = New System.Drawing.Size(174, 22) - Me.OpenWithGRAPHiToolStripMenuItem.Text = "Open with GRAPHi" + Me.CmOpenFile.Size = New System.Drawing.Size(153, 48) ' 'OpenWithToolStripMenuItem ' Me.OpenWithToolStripMenuItem.Name = "OpenWithToolStripMenuItem" - Me.OpenWithToolStripMenuItem.Size = New System.Drawing.Size(174, 22) + Me.OpenWithToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.OpenWithToolStripMenuItem.Text = "Open with ..." ' 'ShowInFolderToolStripMenuItem ' Me.ShowInFolderToolStripMenuItem.Name = "ShowInFolderToolStripMenuItem" - Me.ShowInFolderToolStripMenuItem.Size = New System.Drawing.Size(174, 22) + Me.ShowInFolderToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.ShowInFolderToolStripMenuItem.Text = "Show in Folder" ' 'PnAll @@ -890,30 +883,48 @@ Partial Class F_VEH Me.PnAll.Controls.Add(Me.GroupBox8) Me.PnAll.Controls.Add(Me.GroupBox7) Me.PnAll.Controls.Add(Me.GroupBox6) - Me.PnAll.Location = New System.Drawing.Point(6, 148) + Me.PnAll.Location = New System.Drawing.Point(6, 172) Me.PnAll.Name = "PnAll" - Me.PnAll.Size = New System.Drawing.Size(544, 407) + Me.PnAll.Size = New System.Drawing.Size(552, 514) Me.PnAll.TabIndex = 38 ' + 'PicVehicle + ' + Me.PicVehicle.BackColor = System.Drawing.Color.LightGray + Me.PicVehicle.Location = New System.Drawing.Point(250, 74) + Me.PicVehicle.Name = "PicVehicle" + Me.PicVehicle.Size = New System.Drawing.Size(300, 88) + Me.PicVehicle.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage + Me.PicVehicle.TabIndex = 39 + Me.PicVehicle.TabStop = False + ' + 'Label8 + ' + Me.Label8.AutoSize = True + Me.Label8.Location = New System.Drawing.Point(89, 145) + Me.Label8.Name = "Label8" + Me.Label8.Size = New System.Drawing.Size(58, 13) + Me.Label8.TabIndex = 40 + Me.Label8.Text = "HDV Class" + ' 'F_VEH ' Me.AcceptButton = Me.ButOK Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.CancelButton = Me.ButCancel - Me.ClientSize = New System.Drawing.Size(551, 609) + Me.ClientSize = New System.Drawing.Size(562, 741) + Me.Controls.Add(Me.Label8) + Me.Controls.Add(Me.TbHDVclass) + Me.Controls.Add(Me.PicVehicle) Me.Controls.Add(Me.PnAll) Me.Controls.Add(Me.PictureBox1) - Me.Controls.Add(Me.Label23) Me.Controls.Add(Me.Label9) Me.Controls.Add(Me.StatusStrip1) Me.Controls.Add(Me.CbAxleConfig) Me.Controls.Add(Me.TbMassMass) Me.Controls.Add(Me.CbCat) Me.Controls.Add(Me.Label5) - Me.Controls.Add(Me.Label21) - Me.Controls.Add(Me.TbHDVclass) - Me.Controls.Add(Me.Label10) Me.Controls.Add(Me.ToolStrip1) Me.Controls.Add(Me.ButCancel) Me.Controls.Add(Me.ButOK) @@ -933,6 +944,8 @@ Partial Class F_VEH Me.PnRt.PerformLayout() Me.GroupBox8.ResumeLayout(False) Me.GroupBox8.PerformLayout() + Me.PnWheelDiam.ResumeLayout(False) + Me.PnWheelDiam.PerformLayout() Me.StatusStrip1.ResumeLayout(False) Me.StatusStrip1.PerformLayout() Me.GroupBox1.ResumeLayout(False) @@ -948,6 +961,7 @@ Partial Class F_VEH CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit() Me.CmOpenFile.ResumeLayout(False) Me.PnAll.ResumeLayout(False) + CType(Me.PicVehicle, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) Me.PerformLayout() @@ -960,15 +974,12 @@ Partial Class F_VEH Friend WithEvents TBcdTrTr As System.Windows.Forms.TextBox Friend WithEvents Label4 As System.Windows.Forms.Label Friend WithEvents TBAquersTrTr As System.Windows.Forms.TextBox - Friend WithEvents Label7 As System.Windows.Forms.Label - Friend WithEvents TbI_wheels As System.Windows.Forms.TextBox Friend WithEvents Label13 As System.Windows.Forms.Label - Friend WithEvents TBDreifen As System.Windows.Forms.TextBox + Friend WithEvents TBrdyn As System.Windows.Forms.TextBox Friend WithEvents ButOK As System.Windows.Forms.Button Friend WithEvents ButCancel As System.Windows.Forms.Button Friend WithEvents Label14 As System.Windows.Forms.Label Friend WithEvents Label31 As System.Windows.Forms.Label - Friend WithEvents Label32 As System.Windows.Forms.Label Friend WithEvents Label35 As System.Windows.Forms.Label Friend WithEvents Label37 As System.Windows.Forms.Label Friend WithEvents Label38 As System.Windows.Forms.Label @@ -1002,13 +1013,11 @@ Partial Class F_VEH Friend WithEvents ColumnHeader7 As System.Windows.Forms.ColumnHeader Friend WithEvents ColumnHeader8 As System.Windows.Forms.ColumnHeader Friend WithEvents ButAxlAdd As System.Windows.Forms.Button - Friend WithEvents Label21 As System.Windows.Forms.Label Friend WithEvents CbCat As System.Windows.Forms.ComboBox Friend WithEvents Label5 As System.Windows.Forms.Label Friend WithEvents Label9 As System.Windows.Forms.Label Friend WithEvents TbMassMass As System.Windows.Forms.TextBox Friend WithEvents ColumnHeader9 As System.Windows.Forms.ColumnHeader - Friend WithEvents Label10 As System.Windows.Forms.Label Friend WithEvents StatusStrip1 As System.Windows.Forms.StatusStrip Friend WithEvents LbStatus As System.Windows.Forms.ToolStripStatusLabel Friend WithEvents CbAxleConfig As System.Windows.Forms.ComboBox @@ -1016,25 +1025,31 @@ Partial Class F_VEH Friend WithEvents Label11 As System.Windows.Forms.Label Friend WithEvents TbLoadingMax As System.Windows.Forms.TextBox Friend WithEvents Label22 As System.Windows.Forms.Label - Friend WithEvents Label23 As System.Windows.Forms.Label Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox Friend WithEvents GroupBox4 As System.Windows.Forms.GroupBox Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox Friend WithEvents ToolStripSeparator1 As System.Windows.Forms.ToolStripSeparator Friend WithEvents ToolStripButton1 As System.Windows.Forms.ToolStripButton Friend WithEvents CmOpenFile As System.Windows.Forms.ContextMenuStrip - Friend WithEvents OpenWithGRAPHiToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents OpenWithToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents ShowInFolderToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents BtCdFileOpen As System.Windows.Forms.Button 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 Label8 As System.Windows.Forms.Label + Friend WithEvents LbCdARig As System.Windows.Forms.Label Friend WithEvents LbCdATr As System.Windows.Forms.Label Friend WithEvents TBcwRig As System.Windows.Forms.TextBox Friend WithEvents TBAquersRig As System.Windows.Forms.TextBox Friend WithEvents PnCdARig As System.Windows.Forms.Panel Friend WithEvents PnCdATrTr 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 End Class diff --git a/VECTO/GUI/F_VEH.vb b/VECTO/GUI/F_VEH.vb index 0d9649f69d580fdc70d76a29d78c8a170051fbb9..cac79f82a70f2a52d2cc49a3877eb861070cdbca 100644 --- a/VECTO/GUI/F_VEH.vb +++ b/VECTO/GUI/F_VEH.vb @@ -1,43 +1,86 @@ Imports System.Collections.Generic +''' <summary> +''' Vehicle Editor. +''' </summary> +''' <remarks></remarks> Public Class F_VEH + Dim AxlDlog As F_VEH_Axle Dim VehFile As String - - Public AutoSendTo As Boolean = False - Public GenDir As String = "" + Public JobDir As String = "" Private Changed As Boolean = False + + 'Close - Check for unsaved changes Private Sub F_VEH_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing If e.CloseReason <> CloseReason.ApplicationExitCall And e.CloseReason <> CloseReason.WindowsShutDown Then e.Cancel = ChangeCheckCancel() End If End Sub - 'Init + 'Initialise form Private Sub F05_VEH_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load - - 'Declaration Mode - If Declaration.Active Then - Me.PnLoad.Enabled = False - Me.TbLoadingMax.Text = "-" - Me.ButAxlAdd.Enabled = False - Me.ButAxlRem.Enabled = False - Me.CbCdMode.Enabled = False + 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 + + If Cfg.DeclMode Then + Me.PnCdATrTr.Width = 64 Else - Me.PnCdARig.Enabled = False - Me.LbCdATr.Visible = False + Me.PnCdATrTr.Width = 132 End If + AxlDlog = New F_VEH_Axle + + Me.CbRim.Items.Add("-") + For Each txt In Declaration.RimsList + Me.CbRim.Items.Add(txt) + Next + Changed = False newVEH() End Sub + 'Set HDVclasss + Private Sub SetHDVclass() + Dim s0 As cSegmentTableEntry = Nothing + Dim VehC As tVehCat + Dim AxlC As tAxleConf + Dim MaxMass As Single + Dim HDVclass As String + + VehC = CType(Me.CbCat.SelectedIndex, tVehCat) + + AxlC = CType(Me.CbAxleConfig.SelectedIndex, tAxleConf) + + MaxMass = CSng(fTextboxToNumString(Me.TbMassMass.Text)) + + If Declaration.SegmentTable.SetRef(s0, VehC, AxlC, MaxMass) Then + HDVclass = s0.HDVclass + Else + HDVclass = "-" + End If + + Me.TbHDVclass.Text = HDVclass + + Me.PicVehicle.Image = Image.FromFile(Declaration.ConvPicPath(HDVclass, False)) + + End Sub + + 'Set generic values for Declaration mode Private Sub DeclInit() Dim VehC As tVehCat Dim AxlC As tAxleConf @@ -50,8 +93,9 @@ Public Class F_VEH Dim lvi As ListViewItem Dim RigEnabled As Boolean Dim TrTrEnabled As Boolean + Dim rdyn As Single - If Not Declaration.Active Then Exit Sub + If Not Cfg.DeclMode Then Exit Sub VehC = CType(Me.CbCat.SelectedIndex, tVehCat) @@ -73,6 +117,8 @@ Public Class F_VEH lvi.SubItems.Add("no") lvi.SubItems.Add("") lvi.SubItems.Add("") + lvi.SubItems.Add("-") + lvi.SubItems.Add("-") LvRRC.Items.Add(lvi) Next @@ -84,10 +130,10 @@ Public Class F_VEH End If If s0.LongHaulRigidTrailer Then - + RigEnabled = True TrTrEnabled = True - + Else If s0.VehCat = tVehCat.RigidTruck Then @@ -130,18 +176,27 @@ Public Class F_VEH Me.TBAquersTrTr.Text = "-" End If - Me.TbHDVclass.Text = HDVclass Me.TbMassExtra.Text = "-" Me.TbLoad.Text = "-" Me.CbCdMode.SelectedIndex = 1 + If Me.LvRRC.Items.Count > 0 Then + rdyn = Declaration.rdyn(Me.LvRRC.Items(1).SubItems(5).Text, Me.CbRim.Text) + Else + rdyn = -1 + End If + If rdyn < 0 Then + Me.TBrdyn.Text = "-" + Else + Me.TBrdyn.Text = rdyn + End If End Sub -#Region "Menü / Toolstrip" +#Region "Toolbar" 'New Private Sub ToolStripBtNew_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripBtNew.Click @@ -163,7 +218,7 @@ Public Class F_VEH SaveOrSaveAs(True) End Sub - 'Send to GEN Editor + 'Send to VECTO Editor Private Sub ToolStripBtSendTo_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripBtSendTo.Click If ChangeCheckCancel() Then Exit Sub @@ -178,14 +233,14 @@ Public Class F_VEH If Not F_VECTO.Visible Then - GenDir = "" + JobDir = "" F_VECTO.Show() - F_VECTO.GENnew() + F_VECTO.VECTOnew() Else F_VECTO.WindowState = FormWindowState.Normal End If - F_VECTO.TextBoxVEH.Text = fFileWoDir(VehFile, GenDir) + F_VECTO.TbVEH.Text = fFileWoDir(VehFile, JobDir) End Sub @@ -210,8 +265,6 @@ Public Class F_VEH Me.Close() End Sub -#Region "Speichern/Laden/Neue Datei" - 'Save or Save As function = true if file is saved Private Function SaveOrSaveAs(ByVal SaveAs As Boolean) As Boolean If VehFile = "" Or SaveAs Then @@ -231,8 +284,7 @@ Public Class F_VEH Me.TbMass.Text = "" Me.TbLoad.Text = "" - Me.TbI_wheels.Text = "" - Me.TBDreifen.Text = "" + Me.TBrdyn.Text = "" Me.TBcdTrTr.Text = "" Me.TBAquersTrTr.Text = "" Me.TBcwRig.Text = "" @@ -253,6 +305,8 @@ Public Class F_VEH Me.TbMassExtra.Text = "" Me.CbAxleConfig.SelectedIndex = 0 + Me.CbRim.SelectedIndex = 0 + DeclInit() @@ -270,8 +324,9 @@ Public Class F_VEH Sub openVEH(ByVal file As String) Dim i As Int16 Dim VEH0 As cVEH + Dim inertia As Single - Dim sl As Single() + Dim a0 As cVEH.cAxle Dim lvi As ListViewItem If ChangeCheckCancel() Then Exit Sub @@ -288,9 +343,8 @@ Public Class F_VEH Me.TbMass.Text = VEH0.Mass Me.TbMassExtra.Text = VEH0.MassExtra Me.TbLoad.Text = VEH0.Loading - Me.TbI_wheels.Text = VEH0.I_wheels - Me.TBDreifen.Text = VEH0.Dreifen - + Me.TBrdyn.Text = VEH0.rdyn + Me.CbRim.Text = VEH0.Rim Me.CbCdMode.SelectedIndex = CType(VEH0.CdMode, Integer) @@ -300,50 +354,58 @@ Public Class F_VEH Me.TbRtRatio.Text = CStr(VEH0.RtRatio) Me.TbRtPath.Text = CStr(VEH0.RtFile.OriginalPath) - If VEH0.VehCat = tVehCat.Undef Then - Me.CbCat.SelectedIndex = 0 - Else - Me.CbCat.SelectedIndex = CType(VEH0.VehCat, Integer) - End If + + Me.CbCat.SelectedIndex = CType(VEH0.VehCat, Integer) + Me.LvRRC.Items.Clear() i = 0 - For Each sl In VEH0.RRCs + For Each a0 In VEH0.Axles i += 1 lvi = New ListViewItem lvi.SubItems(0).Text = i.ToString - lvi.SubItems.Add(sl(0)) - If CBool(sl(1)) Then + + If Cfg.DeclMode Then + lvi.SubItems.Add("-") + Else + lvi.SubItems.Add(a0.Share) + End If + + If a0.TwinTire Then lvi.SubItems.Add("yes") Else lvi.SubItems.Add("no") End If - lvi.SubItems.Add(sl(2)) - lvi.SubItems.Add(sl(3)) + lvi.SubItems.Add(a0.RRC) + lvi.SubItems.Add(a0.FzISO) + lvi.SubItems.Add(a0.Wheels) + + If Cfg.DeclMode Then + inertia = Declaration.WheelsInertia(a0.Wheels) + If inertia < 0 Then + lvi.SubItems.Add("-") + Else + lvi.SubItems.Add(inertia) + End If + Else + lvi.SubItems.Add(a0.Inertia) + End If + LvRRC.Items.Add(lvi) Next Me.TbMassMass.Text = VEH0.MassMax Me.TbMassExtra.Text = VEH0.MassExtra - - If VEH0.AxleConf = tAxleConf.Undef Then - Me.CbAxleConfig.SelectedIndex = 0 - Else - Me.CbAxleConfig.SelectedIndex = CType(VEH0.AxleConf, Integer) - End If + Me.CbAxleConfig.SelectedIndex = CType(VEH0.AxleConf, Integer) Me.TBcdTrTr.Text = VEH0.Cd0Tr Me.TBAquersTrTr.Text = VEH0.Aquers0Tr Me.TBcwRig.Text = VEH0.Cd0Rig Me.TBAquersRig.Text = VEH0.Aquers0Rig - - DeclInit() - - fbVEH.UpdateHistory(file) Me.Text = fFILE(file, True) Me.LbStatus.Text = "" @@ -363,7 +425,7 @@ Public Class F_VEH 'Save VEH Private Function saveVEH(ByVal file As String) As Boolean - + Dim a0 As cVEH.cAxle Dim VEH0 As cVEH Dim LV0 As ListViewItem @@ -378,9 +440,9 @@ Public Class F_VEH VEH0.Cd0Rig = CSng(fTextboxToNumString(Me.TBcwRig.Text)) VEH0.Aquers0Rig = CSng(fTextboxToNumString(Me.TBAquersRig.Text)) - VEH0.I_wheels = CSng(fTextboxToNumString(Me.TbI_wheels.Text)) + VEH0.Rim = Me.CbRim.Text - VEH0.Dreifen = CSng(fTextboxToNumString(Me.TBDreifen.Text)) + VEH0.rdyn = CSng(fTextboxToNumString(Me.TBrdyn.Text)) VEH0.CdMode = CType(Me.CbCdMode.SelectedIndex, tCdMode) @@ -393,7 +455,18 @@ Public Class F_VEH VEH0.VehCat = CType(Me.CbCat.SelectedIndex, tVehCat) For Each LV0 In LvRRC.Items - VEH0.RRCs.Add(New Single() {CSng(LV0.SubItems(1).Text), CSng(LV0.SubItems(2).Text = "yes"), CSng(LV0.SubItems(3).Text), CSng(LV0.SubItems(4).Text)}) + + a0 = New cVEH.cAxle + + a0.Share = fTextboxToNumString(LV0.SubItems(1).Text) + a0.TwinTire = (LV0.SubItems(2).Text = "yes") + a0.RRC = fTextboxToNumString(LV0.SubItems(3).Text) + a0.FzISO = fTextboxToNumString(LV0.SubItems(4).Text) + a0.Wheels = LV0.SubItems(5).Text + a0.Inertia = fTextboxToNumString(LV0.SubItems(6).Text) + + VEH0.Axles.Add(a0) + Next VEH0.MassMax = CSng(fTextboxToNumString(Me.TbMassMass.Text)) @@ -407,8 +480,11 @@ Public Class F_VEH Return False End If - If Not GenDir = "" Or AutoSendTo Then - If F_VECTO.Visible And UCase(fFileRepl(F_VECTO.TextBoxVEH.Text, GenDir)) <> UCase(file) Then F_VECTO.TextBoxVEH.Text = fFileWoDir(file, GenDir) + If AutoSendTo Then + If F_VECTO.Visible Then + If UCase(fFileRepl(F_VECTO.TbVEH.Text, JobDir)) <> UCase(file) Then F_VECTO.TbVEH.Text = fFileWoDir(file, JobDir) + F_VECTO.UpdatePic() + End If End If fbVEH.UpdateHistory(file) @@ -421,9 +497,6 @@ Public Class F_VEH End Function -#End Region - - #Region "Cd" 'Cd Mode Change @@ -446,7 +519,7 @@ Public Class F_VEH End Select - If Not Declaration.Active Then + If Not Cfg.DeclMode Then Me.TbCdFile.Enabled = bEnabled Me.BtCdFileBrowse.Enabled = bEnabled Me.BtCdFileOpen.Enabled = bEnabled @@ -457,27 +530,25 @@ Public Class F_VEH 'Cd File Browse Private Sub BtCdFileBrowse_Click(sender As System.Object, e As System.EventArgs) Handles BtCdFileBrowse.Click - Dim fb As cFileBrowser - fb = New cFileBrowser("CdFile", False, True) + Dim ex As String If Me.CbCdMode.SelectedIndex = 1 Then - fb.Extensions = New String() {"vcdv"} + ex = "vcdv" Else - fb.Extensions = New String() {"vcdb"} + ex = "vcdb" End If - If fb.OpenDialog(fFileRepl(Me.TbCdFile.Text, fPATH(VehFile))) Then TbCdFile.Text = fFileWoDir(fb.Files(0), fPATH(VehFile)) + If fbCDx.OpenDialog(fFileRepl(Me.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))) End Sub #End Region - - #Region "Retarder" 'Rt Type Change @@ -506,18 +577,15 @@ Public Class F_VEH 'Rt File Browse Private Sub BtRtBrowse_Click(sender As System.Object, e As System.EventArgs) Handles BtRtBrowse.Click - Dim fb As cFileBrowser - fb = New cFileBrowser("RtFile", False, True) - If fb.OpenDialog(fFileRepl(Me.TbRtPath.Text, fPATH(VehFile))) Then TbRtPath.Text = fFileWoDir(fb.Files(0), fPATH(VehFile)) + If fbRLM.OpenDialog(fFileRepl(Me.TbRtPath.Text, fPATH(VehFile))) Then TbRtPath.Text = fFileWoDir(fbRLM.Files(0), fPATH(VehFile)) End Sub #End Region -#Region "Change Events" +#Region "Track changes" - 'Change Status ändern |@@| Change Status change Private Sub Change() If Not Changed Then Me.LbStatus.Text = "Unsaved changes in current file" @@ -547,7 +615,6 @@ Public Class F_VEH End Function - Private Sub TBmass_TextChanged(sender As System.Object, e As System.EventArgs) Handles TbMass.TextChanged SetMaxLoad() Change() @@ -557,12 +624,13 @@ Public Class F_VEH Change() End Sub - Private Sub TBmrad_TextChanged(sender As System.Object, e As System.EventArgs) Handles TbI_wheels.TextChanged + Private Sub TBDreifen_TextChanged(sender As System.Object, e As System.EventArgs) Handles TBrdyn.TextChanged Change() End Sub - Private Sub TBDreifen_TextChanged(sender As System.Object, e As System.EventArgs) Handles TBDreifen.TextChanged + Private Sub CbRim_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles CbRim.SelectedIndexChanged Change() + DeclInit() End Sub Private Sub TBcw_TextChanged(sender As System.Object, e As System.EventArgs) Handles TBcdTrTr.TextChanged, TBcwRig.TextChanged @@ -573,86 +641,11 @@ Public Class F_VEH Change() End Sub - Private Sub TBFr0_TextChanged(sender As System.Object, e As System.EventArgs) - Change() - End Sub - - Private Sub TBFr1_TextChanged(sender As System.Object, e As System.EventArgs) - Change() - End Sub - - Private Sub TBFr2_TextChanged(sender As System.Object, e As System.EventArgs) - Change() - End Sub - - Private Sub TBFr3_TextChanged(sender As System.Object, e As System.EventArgs) - Change() - End Sub - - Private Sub TBFr4_TextChanged(sender As System.Object, e As System.EventArgs) - Change() - End Sub - - Private Sub TBPnenn_TextChanged(sender As System.Object, e As System.EventArgs) - Change() - End Sub - - Private Sub TBnnenn_TextChanged(sender As System.Object, e As System.EventArgs) - Change() - End Sub - - Private Sub TBnleerl_TextChanged(sender As System.Object, e As System.EventArgs) - Change() - End Sub - - Private Sub TBI_mot_TextChanged(sender As System.Object, e As System.EventArgs) - Change() - End Sub - - Private Sub TBhinauf_TextChanged(sender As System.Object, e As System.EventArgs) - Change() - End Sub - - Private Sub TBhinunter_TextChanged(sender As System.Object, e As System.EventArgs) - Change() - End Sub - - Private Sub TBpfast_TextChanged(sender As System.Object, e As System.EventArgs) - Change() - End Sub - - Private Sub TBlhinauf_TextChanged(sender As System.Object, e As System.EventArgs) - Change() - End Sub - - Private Sub TBlhinunter_TextChanged(sender As System.Object, e As System.EventArgs) - Change() - End Sub - - Private Sub TBpspar_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 TBI_getr_TextChanged(sender As System.Object, e As System.EventArgs) - Change() - End Sub - - Private Sub TBfGetr_TextChanged(sender As System.Object, e As System.EventArgs) - Change() - End Sub - - Private Sub TbTracInt_TextChanged(sender As System.Object, e As System.EventArgs) - Change() - End Sub - - Private Sub TBP0_TextChanged(sender As System.Object, e As System.EventArgs) - Change() - End Sub - Private Sub TbRtPath_TextChanged(sender As System.Object, e As System.EventArgs) Handles TbRtPath.TextChanged Change() End Sub @@ -663,6 +656,7 @@ Public Class F_VEH Private Sub CbCat_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles CbCat.SelectedIndexChanged Change() + SetHDVclass() DeclInit() End Sub @@ -674,20 +668,23 @@ Public Class F_VEH Private Sub TbMassMax_TextChanged(sender As System.Object, e As System.EventArgs) Handles TbMassMass.TextChanged SetMaxLoad() Change() + SetHDVclass() DeclInit() End Sub Private Sub CbAxleConfig_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles CbAxleConfig.SelectedIndexChanged Change() + SetHDVclass() DeclInit() End Sub #End Region + 'Update maximum load when truck/trailer mass was changed Private Sub SetMaxLoad() - If Not Declaration.Active Then + 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) - CSng(Me.TbMass.Text) - CSng(Me.TbMassExtra.Text)) + Me.TbLoadingMax.Text = CStr(CSng(Me.TbMassMass.Text) * 1000 - CSng(Me.TbMass.Text) - CSng(Me.TbMassExtra.Text)) Else Me.TbLoadingMax.Text = "" End If @@ -696,27 +693,30 @@ Public Class F_VEH #Region "Axle Configuration" - Private Sub ButAxlAdd_Click(sender As System.Object, e As System.EventArgs) Handles ButAxlAdd.Click - Dim dlog As New F_VEH_Axle Dim lv0 As ListViewItem - If dlog.ShowDialog = Windows.Forms.DialogResult.OK Then + AxlDlog.Clear() + + If AxlDlog.ShowDialog = Windows.Forms.DialogResult.OK Then lv0 = New ListViewItem lv0.SubItems(0).Text = Me.LvRRC.Items.Count + 1 - lv0.SubItems.Add(Trim(dlog.TbAxleShare.Text)) - If dlog.CbTwinT.Checked Then + lv0.SubItems.Add(Trim(AxlDlog.TbAxleShare.Text)) + If AxlDlog.CbTwinT.Checked Then lv0.SubItems.Add("yes") Else lv0.SubItems.Add("no") End If - lv0.SubItems.Add(Trim(dlog.TbRRC.Text)) - lv0.SubItems.Add(Trim(dlog.TbFzISO.Text)) + lv0.SubItems.Add(Trim(AxlDlog.TbRRC.Text)) + lv0.SubItems.Add(Trim(AxlDlog.TbFzISO.Text)) + lv0.SubItems.Add(Trim(AxlDlog.CbWheels.Text)) + lv0.SubItems.Add(Trim(AxlDlog.TbI_wheels.Text)) Me.LvRRC.Items.Add(lv0) Change() + DeclInit() End If @@ -734,7 +734,7 @@ Public Class F_VEH Private Sub LvAxle_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles LvRRC.KeyDown Select Case e.KeyCode Case Keys.Delete, Keys.Back - If Not Declaration.Active Then RemoveAxleItem() + If Not Cfg.DeclMode Then RemoveAxleItem() Case Keys.Enter EditAxleItem() End Select @@ -772,29 +772,32 @@ Public Class F_VEH Private Sub EditAxleItem() Dim LV0 As ListViewItem - Dim dlog As New F_VEH_Axle If LvRRC.SelectedItems.Count = 0 Then Exit Sub LV0 = LvRRC.SelectedItems(0) - dlog.TbAxleShare.Text = LV0.SubItems(1).Text - dlog.CbTwinT.Checked = (LV0.SubItems(2).Text = "yes") - dlog.TbRRC.Text = LV0.SubItems(3).Text - dlog.TbFzISO.Text = LV0.SubItems(4).Text + AxlDlog.TbAxleShare.Text = LV0.SubItems(1).Text + AxlDlog.CbTwinT.Checked = (LV0.SubItems(2).Text = "yes") + AxlDlog.TbRRC.Text = LV0.SubItems(3).Text + AxlDlog.TbFzISO.Text = LV0.SubItems(4).Text + AxlDlog.TbI_wheels.Text = LV0.SubItems(6).Text + AxlDlog.CbWheels.Text = LV0.SubItems(5).Text - If dlog.ShowDialog = Windows.Forms.DialogResult.OK Then - LV0.SubItems(1).Text = dlog.TbAxleShare.Text - If dlog.CbTwinT.Checked Then + If AxlDlog.ShowDialog = Windows.Forms.DialogResult.OK Then + LV0.SubItems(1).Text = AxlDlog.TbAxleShare.Text + If AxlDlog.CbTwinT.Checked Then LV0.SubItems(2).Text = "yes" Else LV0.SubItems(2).Text = "no" End If - LV0.SubItems(3).Text = dlog.TbRRC.Text - LV0.SubItems(4).Text = dlog.TbFzISO.Text - + LV0.SubItems(3).Text = AxlDlog.TbRRC.Text + LV0.SubItems(4).Text = AxlDlog.TbFzISO.Text + LV0.SubItems(5).Text = AxlDlog.CbWheels.Text + LV0.SubItems(6).Text = AxlDlog.TbI_wheels.Text Change() + DeclInit() End If @@ -802,7 +805,7 @@ Public Class F_VEH End Sub #End Region - + #Region "Open File Context Menu" Private CmFiles As String() @@ -819,10 +822,6 @@ Public Class F_VEH End Sub - Private Sub OpenWithGRAPHiToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles OpenWithGRAPHiToolStripMenuItem.Click - If Not FileOpenGRAPHi(CmFiles) Then MsgBox("Failed to open file!") - End Sub - Private Sub OpenWithToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles OpenWithToolStripMenuItem.Click If Not FileOpenAlt(CmFiles(0)) Then MsgBox("Failed to open file!") End Sub @@ -841,6 +840,6 @@ Public Class F_VEH #End Region - - + + End Class diff --git a/VECTO/GUI/F_VEH_AuxDlog.Designer.vb b/VECTO/GUI/F_VEH_AuxDlog.Designer.vb index f680095e0f5519cfa9ab4cc77a4cd15ae0ef96ed..bc527d12d2d877a37f6414fdb7fd540537904a97 100644 --- a/VECTO/GUI/F_VEH_AuxDlog.Designer.vb +++ b/VECTO/GUI/F_VEH_AuxDlog.Designer.vb @@ -33,7 +33,15 @@ Partial Class F_VEH_AuxDlog Me.BtBrowse = New System.Windows.Forms.Button() Me.CbType = New System.Windows.Forms.ComboBox() Me.LbIDhelp = New System.Windows.Forms.Label() + Me.Label4 = New System.Windows.Forms.Label() + Me.CbTech = New System.Windows.Forms.ComboBox() + Me.PnTech = New System.Windows.Forms.Panel() + Me.PnFile = New System.Windows.Forms.Panel() + Me.LVTech = New System.Windows.Forms.ListView() + Me.ColumnHeader1 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) Me.TableLayoutPanel1.SuspendLayout() + Me.PnTech.SuspendLayout() + Me.PnFile.SuspendLayout() Me.SuspendLayout() ' 'TableLayoutPanel1 @@ -44,7 +52,7 @@ Partial Class F_VEH_AuxDlog Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) Me.TableLayoutPanel1.Controls.Add(Me.OK_Button, 0, 0) Me.TableLayoutPanel1.Controls.Add(Me.Cancel_Button, 1, 0) - Me.TableLayoutPanel1.Location = New System.Drawing.Point(287, 89) + Me.TableLayoutPanel1.Location = New System.Drawing.Point(301, 388) Me.TableLayoutPanel1.Name = "TableLayoutPanel1" Me.TableLayoutPanel1.RowCount = 1 Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) @@ -73,7 +81,7 @@ Partial Class F_VEH_AuxDlog 'Label1 ' Me.Label1.AutoSize = True - Me.Label1.Location = New System.Drawing.Point(173, 15) + Me.Label1.Location = New System.Drawing.Point(171, 10) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(18, 13) Me.Label1.TabIndex = 1 @@ -82,7 +90,7 @@ Partial Class F_VEH_AuxDlog 'Label2 ' Me.Label2.AutoSize = True - Me.Label2.Location = New System.Drawing.Point(12, 15) + Me.Label2.Location = New System.Drawing.Point(9, 10) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(31, 13) Me.Label2.TabIndex = 1 @@ -91,7 +99,7 @@ Partial Class F_VEH_AuxDlog 'Label3 ' Me.Label3.AutoSize = True - Me.Label3.Location = New System.Drawing.Point(12, 46) + Me.Label3.Location = New System.Drawing.Point(7, 39) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(50, 13) Me.Label3.TabIndex = 1 @@ -99,21 +107,21 @@ Partial Class F_VEH_AuxDlog ' 'TbID ' - Me.TbID.Location = New System.Drawing.Point(197, 12) + Me.TbID.Location = New System.Drawing.Point(195, 7) Me.TbID.Name = "TbID" Me.TbID.Size = New System.Drawing.Size(39, 20) Me.TbID.TabIndex = 5 ' 'TbPath ' - Me.TbPath.Location = New System.Drawing.Point(12, 62) + Me.TbPath.Location = New System.Drawing.Point(7, 55) Me.TbPath.Name = "TbPath" Me.TbPath.Size = New System.Drawing.Size(383, 20) Me.TbPath.TabIndex = 10 ' 'BtBrowse ' - Me.BtBrowse.Location = New System.Drawing.Point(401, 60) + Me.BtBrowse.Location = New System.Drawing.Point(396, 53) Me.BtBrowse.Name = "BtBrowse" Me.BtBrowse.Size = New System.Drawing.Size(32, 23) Me.BtBrowse.TabIndex = 15 @@ -123,8 +131,7 @@ Partial Class F_VEH_AuxDlog 'CbType ' Me.CbType.FormattingEnabled = True - Me.CbType.Items.AddRange(New Object() {"Alternator", "Air compressor", "Steering pump"}) - Me.CbType.Location = New System.Drawing.Point(49, 12) + Me.CbType.Location = New System.Drawing.Point(46, 7) Me.CbType.Name = "CbType" Me.CbType.Size = New System.Drawing.Size(109, 21) Me.CbType.TabIndex = 0 @@ -132,26 +139,82 @@ Partial Class F_VEH_AuxDlog 'LbIDhelp ' Me.LbIDhelp.AutoSize = True - Me.LbIDhelp.Location = New System.Drawing.Point(242, 15) + Me.LbIDhelp.Location = New System.Drawing.Point(240, 10) Me.LbIDhelp.Name = "LbIDhelp" Me.LbIDhelp.Size = New System.Drawing.Size(0, 13) Me.LbIDhelp.TabIndex = 26 ' + 'Label4 + ' + Me.Label4.AutoSize = True + Me.Label4.Location = New System.Drawing.Point(6, 9) + Me.Label4.Name = "Label4" + Me.Label4.Size = New System.Drawing.Size(63, 13) + Me.Label4.TabIndex = 1 + Me.Label4.Text = "Technology" + ' + 'CbTech + ' + Me.CbTech.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.CbTech.FormattingEnabled = True + Me.CbTech.Location = New System.Drawing.Point(75, 6) + Me.CbTech.Name = "CbTech" + Me.CbTech.Size = New System.Drawing.Size(352, 21) + Me.CbTech.TabIndex = 27 + ' + 'PnTech + ' + Me.PnTech.Controls.Add(Me.CbTech) + Me.PnTech.Controls.Add(Me.Label4) + Me.PnTech.Location = New System.Drawing.Point(12, 12) + Me.PnTech.Name = "PnTech" + Me.PnTech.Size = New System.Drawing.Size(435, 34) + Me.PnTech.TabIndex = 28 + ' + 'PnFile + ' + Me.PnFile.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) + Me.PnFile.Controls.Add(Me.LbIDhelp) + Me.PnFile.Controls.Add(Me.BtBrowse) + Me.PnFile.Controls.Add(Me.CbType) + Me.PnFile.Controls.Add(Me.TbID) + Me.PnFile.Controls.Add(Me.TbPath) + Me.PnFile.Controls.Add(Me.Label2) + Me.PnFile.Controls.Add(Me.Label3) + Me.PnFile.Controls.Add(Me.Label1) + Me.PnFile.Location = New System.Drawing.Point(12, 293) + Me.PnFile.Name = "PnFile" + Me.PnFile.Size = New System.Drawing.Size(435, 89) + Me.PnFile.TabIndex = 29 + ' + 'LVTech + ' + Me.LVTech.CheckBoxes = True + Me.LVTech.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader1}) + Me.LVTech.FullRowSelect = True + Me.LVTech.GridLines = True + Me.LVTech.Location = New System.Drawing.Point(12, 52) + Me.LVTech.Name = "LVTech" + Me.LVTech.Size = New System.Drawing.Size(435, 235) + Me.LVTech.TabIndex = 30 + Me.LVTech.UseCompatibleStateImageBehavior = False + Me.LVTech.View = System.Windows.Forms.View.Details + ' + 'ColumnHeader1 + ' + Me.ColumnHeader1.Text = "Technologies" + Me.ColumnHeader1.Width = 420 + ' 'F_VEH_AuxDlog ' Me.AcceptButton = Me.OK_Button Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.CancelButton = Me.Cancel_Button - Me.ClientSize = New System.Drawing.Size(445, 130) - Me.Controls.Add(Me.LbIDhelp) - Me.Controls.Add(Me.CbType) - Me.Controls.Add(Me.BtBrowse) - Me.Controls.Add(Me.TbPath) - Me.Controls.Add(Me.TbID) - Me.Controls.Add(Me.Label3) - Me.Controls.Add(Me.Label2) - Me.Controls.Add(Me.Label1) + Me.ClientSize = New System.Drawing.Size(459, 429) + Me.Controls.Add(Me.LVTech) + Me.Controls.Add(Me.PnFile) + Me.Controls.Add(Me.PnTech) Me.Controls.Add(Me.TableLayoutPanel1) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog Me.MaximizeBox = False @@ -161,8 +224,11 @@ Partial Class F_VEH_AuxDlog Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent Me.Text = "Auxiliary" Me.TableLayoutPanel1.ResumeLayout(False) + Me.PnTech.ResumeLayout(False) + Me.PnTech.PerformLayout() + Me.PnFile.ResumeLayout(False) + Me.PnFile.PerformLayout() Me.ResumeLayout(False) - Me.PerformLayout() End Sub Friend WithEvents TableLayoutPanel1 As System.Windows.Forms.TableLayoutPanel @@ -176,5 +242,11 @@ Partial Class F_VEH_AuxDlog Friend WithEvents BtBrowse As System.Windows.Forms.Button Friend WithEvents CbType As System.Windows.Forms.ComboBox Friend WithEvents LbIDhelp As System.Windows.Forms.Label + Friend WithEvents Label4 As System.Windows.Forms.Label + Friend WithEvents CbTech As System.Windows.Forms.ComboBox + Friend WithEvents PnTech As System.Windows.Forms.Panel + Friend WithEvents PnFile As System.Windows.Forms.Panel + Friend WithEvents LVTech As System.Windows.Forms.ListView + Friend WithEvents ColumnHeader1 As System.Windows.Forms.ColumnHeader End Class diff --git a/VECTO/GUI/F_VEH_AuxDlog.vb b/VECTO/GUI/F_VEH_AuxDlog.vb index c76f4875d5255bf194f58bd18ea03ba3e1a22b96..ab6044a450b3484ec44bcefc1131b95e3fd36f88 100644 --- a/VECTO/GUI/F_VEH_AuxDlog.vb +++ b/VECTO/GUI/F_VEH_AuxDlog.vb @@ -1,28 +1,115 @@ Imports System.Windows.Forms +Imports System.Collections.Generic +''' <summary> +''' Aux Config Editor (Job Editor sub-dialog) +''' </summary> +''' <remarks></remarks> Public Class F_VEH_AuxDlog Public VehPath As String = "" - 'Private Sub F_VEH_AuxDlog_Shown(sender As Object, e As System.EventArgs) Handles Me.Shown - ' Stop + 'New instance + Public Sub New() - 'End Sub + ' Dieser Aufruf ist für den Designer erforderlich. + InitializeComponent() + ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu. + Me.CbType.Items.Add("Fan") + Me.CbType.Items.Add("Steering pump") + Me.CbType.Items.Add("HVAC") + Me.CbType.Items.Add("Electric System") + + Me.PnFile.Enabled = Not Cfg.DeclMode + Me.PnTech.Enabled = Cfg.DeclMode + + + End Sub + + 'Initialise form + Private Sub F_VEH_AuxDlog_Load(sender As Object, e As System.EventArgs) Handles Me.Load + Me.Text = CbType.Text + End Sub + + 'Set generic values for Declaration mode + Private Sub DeclInit() + Dim txt As String + Dim kv As KeyValuePair(Of String, Dictionary(Of tMission, Single)) + + If Not Cfg.DeclMode Then Exit Sub + + Me.CbTech.Items.Clear() + + Select Case TbID.Text + Case sKey.AUX.Fan + For Each txt In Declaration.AuxTechs(tAux.Fan) + Me.CbTech.Items.Add(txt) + Next + + Case sKey.AUX.SteerPump + For Each txt In Declaration.AuxTechs(tAux.SteerPump) + Me.CbTech.Items.Add(txt) + Next + + Case sKey.AUX.HVAC + For Each txt In Declaration.AuxTechs(tAux.HVAC) + Me.CbTech.Items.Add(txt) + Next + Me.CbTech.SelectedIndex = 0 + + Case sKey.AUX.ElecSys + For Each txt In Declaration.AuxTechs(tAux.ElectricSys) + Me.CbTech.Items.Add(txt) + Next + Me.CbTech.SelectedIndex = 0 + + + Case Else 'sKey.AUX.PneumSys + For Each txt In Declaration.AuxTechs(tAux.PneumSys) + Me.CbTech.Items.Add(txt) + Next + Me.CbTech.SelectedIndex = 0 + + End Select + + + If TbID.Text = sKey.AUX.ElecSys Then + + Me.LVTech.Items.Clear() + For Each kv In Declaration.AuxESpower + Me.LVTech.Items.Add(kv.Key) + Next + Me.LVTech.Visible = True + + Me.Height = 457 + + Else + + Me.LVTech.Visible = False + Me.Height = 220 + + End If + + End Sub + + 'Save and close Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click Me.DialogResult = System.Windows.Forms.DialogResult.OK Me.Close() End Sub + 'Cancel Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click Me.DialogResult = System.Windows.Forms.DialogResult.Cancel Me.Close() End Sub + 'Close form. Check if form is complete and valid Private Sub F_VEH_AuxDlog_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing If e.CloseReason <> CloseReason.WindowsShutDown And Me.DialogResult <> Windows.Forms.DialogResult.Cancel Then - If Trim(Me.TbID.Text) = "" Or Trim(Me.CbType.Text) = "" Or Trim(Me.TbPath.Text) = "" Then + If Trim(Me.TbID.Text) = "" Or Trim(Me.CbType.Text) = "" Then MsgBox("Form is incomplete!", MsgBoxStyle.Critical) e.Cancel = True End If @@ -32,29 +119,65 @@ Public Class F_VEH_AuxDlog e.Cancel = True End If + If Cfg.DeclMode Then + + If Me.CbTech.Text = "" Then + MsgBox("Form is incomplete!", MsgBoxStyle.Critical) + e.Cancel = True + End If + + Else + + If Trim(Me.TbPath.Text) = "" Then + MsgBox("Form is incomplete!", MsgBoxStyle.Critical) + e.Cancel = True + End If + + End If + End If End Sub + 'Browse for .vaux files Private Sub BtBrowse_Click(sender As System.Object, e As System.EventArgs) Handles BtBrowse.Click If fbAUX.OpenDialog(fFileRepl(Me.TbPath.Text, VehPath)) Then Me.TbPath.Text = fFileWoDir(fbAUX.Files(0), VehPath) End Sub + 'Update ID when Aux Type was changed Private Sub CbType_TextChanged(sender As Object, e As System.EventArgs) Handles CbType.TextChanged If Me.CbType.Text = "" Then Me.TbID.Text = "" Else - Me.TbID.Text = Trim(UCase(Me.CbType.Text.Substring(0, CInt(Math.Min(Me.CbType.Text.Length, 3))))) + If Cfg.DeclMode Then + Select Case Me.CbType.SelectedIndex + Case 0 + Me.TbID.Text = sKey.AUX.Fan + Case 1 + Me.TbID.Text = sKey.AUX.SteerPump + + Case Else '2 + Me.TbID.Text = sKey.AUX.HVAC + + End Select + Else + Me.TbID.Text = Trim(UCase(Me.CbType.Text.Substring(0, CInt(Math.Min(Me.CbType.Text.Length, 3))))) + End If End If End Sub + 'Update help label if ID was changed Private Sub TbID_TextChanged(sender As System.Object, e As System.EventArgs) Handles TbID.TextChanged - If Trim(Me.TbID.Text) = "" Then + + DeclInit() + + If Trim(Me.TbID.Text) = "" Or Cfg.DeclMode Then Me.LbIDhelp.Text = "" Else Me.LbIDhelp.Text = "Header in Driving cycle: <AUX_" & Trim(Me.TbID.Text) & ">" End If + End Sub diff --git a/VECTO/GUI/F_VEH_Axle.Designer.vb b/VECTO/GUI/F_VEH_Axle.Designer.vb index 34d076a451f4f4d537df8694d1a3a712879429f6..85218fa75f676ae7fabbe65599fe2c99142543f8 100644 --- a/VECTO/GUI/F_VEH_Axle.Designer.vb +++ b/VECTO/GUI/F_VEH_Axle.Designer.vb @@ -34,12 +34,15 @@ Partial Class F_VEH_Axle Me.Label5 = New System.Windows.Forms.Label() Me.Label6 = New System.Windows.Forms.Label() Me.TbFzISO = New System.Windows.Forms.TextBox() - Me.Label7 = New System.Windows.Forms.Label() - Me.Label8 = New System.Windows.Forms.Label() Me.Label9 = New System.Windows.Forms.Label() Me.Label10 = New System.Windows.Forms.Label() Me.CbTwinT = New System.Windows.Forms.CheckBox() Me.PnAxle = New System.Windows.Forms.Panel() + Me.TbI_wheels = New System.Windows.Forms.TextBox() + Me.Label7 = New System.Windows.Forms.Label() + Me.Label32 = New System.Windows.Forms.Label() + Me.Label8 = New System.Windows.Forms.Label() + Me.CbWheels = New System.Windows.Forms.ComboBox() Me.TableLayoutPanel1.SuspendLayout() Me.PnAxle.SuspendLayout() Me.SuspendLayout() @@ -52,7 +55,7 @@ Partial Class F_VEH_Axle Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) Me.TableLayoutPanel1.Controls.Add(Me.OK_Button, 0, 0) Me.TableLayoutPanel1.Controls.Add(Me.Cancel_Button, 1, 0) - Me.TableLayoutPanel1.Location = New System.Drawing.Point(232, 164) + Me.TableLayoutPanel1.Location = New System.Drawing.Point(250, 217) Me.TableLayoutPanel1.Name = "TableLayoutPanel1" Me.TableLayoutPanel1.RowCount = 1 Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) @@ -81,7 +84,7 @@ Partial Class F_VEH_Axle 'Label1 ' Me.Label1.AutoSize = True - Me.Label1.Location = New System.Drawing.Point(18, 10) + Me.Label1.Location = New System.Drawing.Point(7, 10) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(96, 13) Me.Label1.TabIndex = 1 @@ -89,7 +92,7 @@ Partial Class F_VEH_Axle ' 'TbAxleShare ' - Me.TbAxleShare.Location = New System.Drawing.Point(120, 8) + Me.TbAxleShare.Location = New System.Drawing.Point(109, 8) Me.TbAxleShare.Name = "TbAxleShare" Me.TbAxleShare.Size = New System.Drawing.Size(53, 20) Me.TbAxleShare.TabIndex = 0 @@ -97,7 +100,7 @@ Partial Class F_VEH_Axle 'Label2 ' Me.Label2.AutoSize = True - Me.Label2.Location = New System.Drawing.Point(179, 11) + Me.Label2.Location = New System.Drawing.Point(168, 11) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(16, 13) Me.Label2.TabIndex = 1 @@ -106,7 +109,7 @@ Partial Class F_VEH_Axle 'Label3 ' Me.Label3.AutoSize = True - Me.Label3.Location = New System.Drawing.Point(41, 57) + Me.Label3.Location = New System.Drawing.Point(41, 108) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(51, 13) Me.Label3.TabIndex = 1 @@ -115,7 +118,7 @@ Partial Class F_VEH_Axle 'Label4 ' Me.Label4.AutoSize = True - Me.Label4.Location = New System.Drawing.Point(188, 57) + Me.Label4.Location = New System.Drawing.Point(188, 108) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(16, 13) Me.Label4.TabIndex = 1 @@ -123,7 +126,7 @@ Partial Class F_VEH_Axle ' 'TbRRC ' - Me.TbRRC.Location = New System.Drawing.Point(98, 54) + Me.TbRRC.Location = New System.Drawing.Point(98, 105) Me.TbRRC.Name = "TbRRC" Me.TbRRC.Size = New System.Drawing.Size(84, 20) Me.TbRRC.TabIndex = 2 @@ -131,7 +134,7 @@ Partial Class F_VEH_Axle 'Label5 ' Me.Label5.AutoSize = True - Me.Label5.Location = New System.Drawing.Point(226, 57) + Me.Label5.Location = New System.Drawing.Point(53, 154) Me.Label5.Name = "Label5" Me.Label5.Size = New System.Drawing.Size(39, 13) Me.Label5.TabIndex = 1 @@ -140,7 +143,7 @@ Partial Class F_VEH_Axle 'Label6 ' Me.Label6.AutoSize = True - Me.Label6.Location = New System.Drawing.Point(361, 57) + Me.Label6.Location = New System.Drawing.Point(188, 154) Me.Label6.Name = "Label6" Me.Label6.Size = New System.Drawing.Size(21, 13) Me.Label6.TabIndex = 1 @@ -148,35 +151,15 @@ Partial Class F_VEH_Axle ' 'TbFzISO ' - Me.TbFzISO.Location = New System.Drawing.Point(271, 54) + Me.TbFzISO.Location = New System.Drawing.Point(98, 151) Me.TbFzISO.Name = "TbFzISO" Me.TbFzISO.Size = New System.Drawing.Size(84, 20) Me.TbFzISO.TabIndex = 3 ' - 'Label7 - ' - Me.Label7.AutoSize = True - Me.Label7.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label7.Location = New System.Drawing.Point(25, 120) - Me.Label7.Name = "Label7" - Me.Label7.Size = New System.Drawing.Size(49, 13) - Me.Label7.TabIndex = 1 - Me.Label7.Text = "Fz ISO:" - ' - 'Label8 - ' - Me.Label8.AutoSize = True - Me.Label8.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label8.Location = New System.Drawing.Point(12, 97) - Me.Label8.Name = "Label8" - Me.Label8.Size = New System.Drawing.Size(62, 13) - Me.Label8.TabIndex = 1 - Me.Label8.Text = "RRC ISO:" - ' 'Label9 ' Me.Label9.AutoSize = True - Me.Label9.Location = New System.Drawing.Point(80, 97) + Me.Label9.Location = New System.Drawing.Point(223, 108) Me.Label9.Name = "Label9" Me.Label9.Size = New System.Drawing.Size(146, 13) Me.Label9.TabIndex = 1 @@ -185,7 +168,7 @@ Partial Class F_VEH_Axle 'Label10 ' Me.Label10.AutoSize = True - Me.Label10.Location = New System.Drawing.Point(80, 120) + Me.Label10.Location = New System.Drawing.Point(223, 154) Me.Label10.Name = "Label10" Me.Label10.Size = New System.Drawing.Size(167, 26) Me.Label10.TabIndex = 1 @@ -194,7 +177,7 @@ Partial Class F_VEH_Axle 'CbTwinT ' Me.CbTwinT.AutoSize = True - Me.CbTwinT.Location = New System.Drawing.Point(271, 14) + Me.CbTwinT.Location = New System.Drawing.Point(255, 19) Me.CbTwinT.Name = "CbTwinT" Me.CbTwinT.Size = New System.Drawing.Size(78, 17) Me.CbTwinT.TabIndex = 1 @@ -203,21 +186,69 @@ Partial Class F_VEH_Axle ' 'PnAxle ' + Me.PnAxle.Controls.Add(Me.TbI_wheels) Me.PnAxle.Controls.Add(Me.Label1) + Me.PnAxle.Controls.Add(Me.Label7) Me.PnAxle.Controls.Add(Me.Label2) + Me.PnAxle.Controls.Add(Me.Label32) Me.PnAxle.Controls.Add(Me.TbAxleShare) - Me.PnAxle.Location = New System.Drawing.Point(9, 4) + Me.PnAxle.Location = New System.Drawing.Point(9, 49) Me.PnAxle.Name = "PnAxle" - Me.PnAxle.Size = New System.Drawing.Size(204, 42) + Me.PnAxle.Size = New System.Drawing.Size(394, 39) Me.PnAxle.TabIndex = 5 ' + 'TbI_wheels + ' + Me.TbI_wheels.Location = New System.Drawing.Point(287, 8) + Me.TbI_wheels.Name = "TbI_wheels" + Me.TbI_wheels.Size = New System.Drawing.Size(57, 20) + Me.TbI_wheels.TabIndex = 26 + ' + 'Label7 + ' + Me.Label7.AutoSize = True + Me.Label7.Location = New System.Drawing.Point(206, 11) + Me.Label7.Name = "Label7" + Me.Label7.Size = New System.Drawing.Size(75, 13) + Me.Label7.TabIndex = 25 + Me.Label7.Text = "Wheels Inertia" + ' + 'Label32 + ' + Me.Label32.AutoSize = True + Me.Label32.Location = New System.Drawing.Point(350, 11) + Me.Label32.Name = "Label32" + Me.Label32.Size = New System.Drawing.Size(36, 13) + Me.Label32.TabIndex = 27 + Me.Label32.Text = "[kgm²]" + ' + 'Label8 + ' + Me.Label8.AutoSize = True + Me.Label8.Location = New System.Drawing.Point(6, 20) + Me.Label8.Name = "Label8" + Me.Label8.Size = New System.Drawing.Size(43, 13) + Me.Label8.TabIndex = 6 + Me.Label8.Text = "Wheels" + ' + 'CbWheels + ' + Me.CbWheels.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.CbWheels.FormattingEnabled = True + Me.CbWheels.Location = New System.Drawing.Point(55, 17) + Me.CbWheels.Name = "CbWheels" + Me.CbWheels.Size = New System.Drawing.Size(176, 21) + Me.CbWheels.TabIndex = 7 + ' 'F_VEH_Axle ' Me.AcceptButton = Me.OK_Button Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.CancelButton = Me.Cancel_Button - Me.ClientSize = New System.Drawing.Size(390, 205) + Me.ClientSize = New System.Drawing.Size(408, 258) + Me.Controls.Add(Me.CbWheels) + Me.Controls.Add(Me.Label8) Me.Controls.Add(Me.PnAxle) Me.Controls.Add(Me.CbTwinT) Me.Controls.Add(Me.TbFzISO) @@ -225,10 +256,8 @@ Partial Class F_VEH_Axle Me.Controls.Add(Me.TbRRC) Me.Controls.Add(Me.Label4) Me.Controls.Add(Me.Label10) - Me.Controls.Add(Me.Label7) Me.Controls.Add(Me.Label5) Me.Controls.Add(Me.Label9) - Me.Controls.Add(Me.Label8) Me.Controls.Add(Me.Label3) Me.Controls.Add(Me.TableLayoutPanel1) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog @@ -257,11 +286,14 @@ Partial Class F_VEH_Axle Friend WithEvents Label5 As System.Windows.Forms.Label Friend WithEvents Label6 As System.Windows.Forms.Label Friend WithEvents TbFzISO As System.Windows.Forms.TextBox - Friend WithEvents Label7 As System.Windows.Forms.Label - Friend WithEvents Label8 As System.Windows.Forms.Label Friend WithEvents Label9 As System.Windows.Forms.Label Friend WithEvents Label10 As System.Windows.Forms.Label Friend WithEvents CbTwinT As System.Windows.Forms.CheckBox Friend WithEvents PnAxle As System.Windows.Forms.Panel + Friend WithEvents TbI_wheels As System.Windows.Forms.TextBox + Friend WithEvents Label7 As System.Windows.Forms.Label + Friend WithEvents Label32 As System.Windows.Forms.Label + Friend WithEvents Label8 As System.Windows.Forms.Label + Friend WithEvents CbWheels As System.Windows.Forms.ComboBox End Class diff --git a/VECTO/GUI/F_VEH_Axle.vb b/VECTO/GUI/F_VEH_Axle.vb index 7eda3ad31a8d209864d723d515cea550c726893d..ae129a0de263520b76015ad65cdd906825706db3 100644 --- a/VECTO/GUI/F_VEH_Axle.vb +++ b/VECTO/GUI/F_VEH_Axle.vb @@ -1,24 +1,51 @@ Imports System.Windows.Forms +''' <summary> +''' Axle Config Editor (Vehicle Editor sub-dialog) +''' </summary> +''' <remarks></remarks> Public Class F_VEH_Axle + Public Sub New() + Dim w As String + + ' Dieser Aufruf ist für den Designer erforderlich. + InitializeComponent() + + ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu. + Me.CbWheels.Items.Add("-") + For Each w In Declaration.WheelsList + Me.CbWheels.Items.Add(w) + Next + + + + End Sub + + Public Sub Clear() + Me.CbTwinT.Checked = False + Me.TbAxleShare.Text = "" + Me.TbI_wheels.Text = "" + Me.TbRRC.Text = "" + Me.TbFzISO.Text = "" + Me.CbWheels.SelectedIndex = 0 + End Sub + + 'Initialise Private Sub F_VEH_Axle_Load(sender As Object, e As System.EventArgs) Handles Me.Load - 'Declaration Mode - If Declaration.Active Then - Me.PnAxle.Enabled = False - End If + Me.PnAxle.Enabled = Not Cfg.DeclMode End Sub + 'Save and close Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click - If Not Declaration.Active Then + If Not Cfg.DeclMode Then If Not IsNumeric(Me.TbAxleShare.Text) OrElse Trim(Me.TbAxleShare.Text) = "" Then MsgBox("Weight input is not valid!") Exit Sub End If End If - If Not IsNumeric(Me.TbRRC.Text) OrElse Trim(Me.TbRRC.Text) = "" Then MsgBox("RRC input is not valid!") Exit Sub @@ -33,10 +60,25 @@ Public Class F_VEH_Axle Me.Close() End Sub + Private Sub CbWheels_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles CbWheels.SelectedIndexChanged + Dim inertia As Single + If Cfg.DeclMode Then + inertia = Declaration.WheelsInertia(Me.CbWheels.Text) + If inertia < 0 Then + Me.TbI_wheels.Text = "-" + Else + Me.TbI_wheels.Text = inertia + End If + End If + End Sub + + 'Cancel Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click Me.DialogResult = System.Windows.Forms.DialogResult.Cancel Me.Close() End Sub + + End Class diff --git a/VECTO/GUI/F_Welcome.vb b/VECTO/GUI/F_Welcome.vb index bfba275d08ad1501b94fd0e9345630ffa2a3d26d..59a7daee15be1fa2ea12df41c5176f01c6ac8db6 100644 --- a/VECTO/GUI/F_Welcome.vb +++ b/VECTO/GUI/F_Welcome.vb @@ -1,16 +1,23 @@ Imports System.Windows.Forms +''' <summary> +''' Welcome screen. Shows only on the first time application start +''' </summary> +''' <remarks></remarks> Public Class F_Welcome + 'Close Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click Me.DialogResult = System.Windows.Forms.DialogResult.Cancel Me.Close() End Sub + 'Init Private Sub F_Welcome_Load(sender As Object, e As System.EventArgs) Handles Me.Load Me.Text = "VECTO " & VECTOvers End Sub + 'Open Update Notes Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click If IO.File.Exists(MyAppPath & "User Manual\Update Notes.pdf") Then System.Diagnostics.Process.Start(MyAppPath & "User Manual\Update Notes.pdf") @@ -19,6 +26,7 @@ Public Class F_Welcome End If End Sub + 'Open Quick Start Guide Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click If IO.File.Exists(MyAppPath & "User Manual\qsg\quickstartApp.html") Then System.Diagnostics.Process.Start(MyAppPath & "User Manual\qsg\quickstartApp.html") diff --git a/VECTO/GUI/GUI_Subs.vb b/VECTO/GUI/GUI_Subs.vb index 04290415206b8d9424a2d32a586cfd00ce98c438..e0aa20724f9925f0d4047a0cece0719784de2e40 100644 --- a/VECTO/GUI/GUI_Subs.vb +++ b/VECTO/GUI/GUI_Subs.vb @@ -1,8 +1,12 @@ -Module GUI_Subs +''' <summary> +''' Methods for GUI interaction +''' </summary> +''' <remarks></remarks> +Module GUI_Subs Public test As Integer = 0 -#Region "GUI Steuerung durch BG-Worker" +#Region "GUI control via background worker" 'Status Message => Msg-Listview Public Sub WorkerMsg(ByVal ID As tMsgID, ByVal Msg As String, ByVal Source As String, Optional ByVal Link As String = "") @@ -12,13 +16,13 @@ Case tMsgID.Err MSGerror += 1 Case tMsgID.Warn - MSGwarn += 1 + MSGwarn += 1 End Select WorkProg.Msg = Msg WorkProg.Source = Source WorkProg.Link = Link Try - PHEMworker.ReportProgress(0, WorkProg) + VECTOworker.ReportProgress(0, WorkProg) Catch ex As Exception GUImsg(ID, Msg) End Try @@ -28,71 +32,70 @@ Public Sub WorkerStatus(ByVal Msg As String) Dim WorkProg As New cWorkProg(tWorkMsgType.StatusBar) WorkProg.Msg = Msg - PHEMworker.ReportProgress(0, WorkProg) + VECTOworker.ReportProgress(0, WorkProg) End Sub - 'Job status => Job-list Status-column + 'Job status => Job listview Public Sub WorkerJobStatus(ByVal JobIndex As Int16, ByVal Msg As String, ByVal Status As tJobStatus) Dim WorkProg As cWorkProg WorkProg = New cWorkProg(tWorkMsgType.JobStatus) WorkProg.FileIndex = JobIndex WorkProg.Msg = Msg WorkProg.Status = Status - PHEMworker.ReportProgress(0, WorkProg) + VECTOworker.ReportProgress(0, WorkProg) End Sub - 'Cycle status => Cycle-list Status-column + 'Cycle status => Cycle listview Public Sub WorkerCycleStatus(ByVal CycleIndex As Int16, ByVal Msg As String) Dim WorkProg As cWorkProg WorkProg = New cWorkProg(tWorkMsgType.CycleStatus) WorkProg.FileIndex = CycleIndex WorkProg.Msg = Msg - PHEMworker.ReportProgress(0, WorkProg) + VECTOworker.ReportProgress(0, WorkProg) End Sub - 'Worker Progress => Progbar (ProgBarSec Update when ProgSec > -1; ProgBarSec-Reset at ProgSec = 0) - Public Sub WorkerProg(ByVal Prog As Int16, Optional ByVal ProgSec As Integer = -1) + 'Worker Progress => Progbar + Public Sub WorkerProgJobEnd(ByVal Prog As Int16) Dim WorkProg As New cWorkProg(tWorkMsgType.ProgBars) - WorkProg.ProgSec = ProgSec - PHEMworker.ReportProgress(Prog, WorkProg) + VECTOworker.ReportProgress(Prog, WorkProg) End Sub 'Progbar set to Continuous Public Sub WorkerProgInit() Dim WorkProg As New cWorkProg(tWorkMsgType.InitProgBar) - PHEMworker.ReportProgress(0, WorkProg) + VECTOworker.ReportProgress(0, WorkProg) End Sub 'Abort Public Sub WorkerAbort() Dim WorkProg As New cWorkProg(tWorkMsgType.Abort) - PHEMworker.ReportProgress(0, WorkProg) + VECTOworker.ReportProgress(0, WorkProg) End Sub #End Region -#Region "GUI Steuerung durch GUI direkt - NICHT über BG-Worker" +#Region "Direct GUI control - Cannot be called by background worker!" - 'Status message directly to GUI - can not be called by the BackgroundWorker! + 'Status message Public Sub GUImsg(ByVal ID As tMsgID, ByVal Msg As String) F_MAINForm.MSGtoForm(ID, Msg, "", "") End Sub - 'Statusbar - called either by WorkerMSG or directly by the form, NEVER by the Worker + 'Statusbar Public Sub Status(ByVal txt As String) F_MAINForm.ToolStripLbStatus.Text = txt End Sub - 'Status form reset - ONLY called by Events, NEVER by Worker + 'Status form reset Public Sub ClearMSG() F_MAINForm.LvMsg.Items.Clear() End Sub #End Region - 'Class used to pass Messages from BackgroundWorker + 'Class used to pass Messages from BackgroundWorker to GUI Public Class cWorkProg Private MyTarget As tWorkMsgType Private MyID As tMsgID @@ -100,14 +103,12 @@ Private MyFileIndex As Int16 Private MySource As String Private MyStatus As tJobStatus - Public ProgSec As Integer Public Link As String Public Sub New(ByVal MsgTarget As tWorkMsgType) MyTarget = MsgTarget MySource = "" MyStatus = tJobStatus.Undef - ProgSec = -1 Link = "" End Sub @@ -166,24 +167,26 @@ End Class + 'Progress bar control Public Class cProgBarCtrl Public ProgOverallStartInt As Integer = -1 Public PgroOverallEndInt As Integer = -1 Public ProgJobInt As Integer = -1 + Public ProgLock As Boolean = False End Class - '----------------------------------------------------------------------- +#Region "Textbox text conversion for file open/save operations" - 'If string not a number, then Zero + 'Text-to-number Public Function fTextboxToNumString(ByVal txt As String) As String If Not IsNumeric(txt) Then - 'GUImsg(tMsgID.Err, "'" & txt & "' is no numeric expression!") Return "0" Else Return txt End If End Function + 'Empty text to writable placeholder Public Function fStringOrDummySet(ByVal txt As String) As String If txt = "" Then Return sKey.EmptyString @@ -192,6 +195,7 @@ End If End Function + 'Placeholder to empty string Public Function fStringOrDummyGet(ByVal txt As String) As String If Trim(UCase(txt)) = sKey.EmptyString Then Return "" @@ -200,7 +204,9 @@ End If End Function - 'Open File +#End Region + + 'Open File with software defined in Config Public Function FileOpenAlt(ByVal file As String) As Boolean Dim PSI As New ProcessStartInfo @@ -214,144 +220,7 @@ Catch ex As Exception Return False End Try - End Function - - 'Open File with GRAPHi - Public Function FileOpenGRAPHi(ParamArray files() As String) As Boolean - Dim PSI As New ProcessStartInfo - Dim fileStr As String = "" - Dim str As String - - For Each str In files - If Not IO.File.Exists(str) Then Return False - fileStr &= " " & ChrW(34) & str & ChrW(34) - Next - - PSI.FileName = ChrW(34) & MyAppPath & "GRAPHi\GRAPHi.exe" & ChrW(34) - PSI.Arguments = fileStr & " -load -preconf" - Try - Process.Start(PSI) - Return True - Catch ex As Exception - Return False - End Try - - End Function - -#Region "Dateipfad Funktionen" - - 'When no path is specified, then insert either WorkDir or MainDir Special-folders - Public Function fFileRepl(ByVal file As String, Optional ByVal MainDir As String = "") As String - - Dim ReplPath As String - - 'Trim Path - file = Trim(file) - - 'If empty file => Abort - If file = "" Then Return "" - - 'Replace sKeys - file = Microsoft.VisualBasic.Strings.Replace(file, sKey.DefVehPath & "\", MyAppPath & "Default Vehicles\", 1, -1, CompareMethod.Text) - file = Microsoft.VisualBasic.Strings.Replace(file, sKey.WorkDir & "\", Cfg.WorkDPath, 1, -1, CompareMethod.Text) - file = Microsoft.VisualBasic.Strings.Replace(file, sKey.HomePath & "\", MyAppPath, 1, -1, CompareMethod.Text) - - 'Replace - Determine folder - If MainDir = "" Then - ReplPath = Cfg.WorkDPath - Else - ReplPath = MainDir - End If - - ' "..\" => One folder-level up - Do While ReplPath.Length > 0 AndAlso Left(file, 3) = "..\" - ReplPath = fPathUp(ReplPath) - file = file.Substring(3) - Loop - - - 'Supplement Path, if not available - If fPATH(file) = "" Then - - Return ReplPath & file - - Else - Return file - End If - - End Function - - 'Path one-level-up "C:\temp\ordner1\" >> "C:\temp\" - Private Function fPathUp(ByVal Pfad As String) As String - Dim x As Int16 - - Pfad = Pfad.Substring(0, Pfad.Length - 1) - - x = Pfad.LastIndexOf("\") - - If x = -1 Then Return "" - - Return Pfad.Substring(0, x + 1) - - End Function - - 'File name without the path "C:\temp\TEST.txt" >> "TEST.txt" oder "TEST" - Public Function fFILE(ByVal Pfad As String, ByVal MitEndung As Boolean) As String - Dim x As Int16 - x = Pfad.LastIndexOf("\") + 1 - Pfad = Microsoft.VisualBasic.Right(Pfad, Microsoft.VisualBasic.Len(Pfad) - x) - If Not MitEndung Then - x = Pfad.LastIndexOf(".") - If x > 0 Then Pfad = Microsoft.VisualBasic.Left(Pfad, x) - End If - Return Pfad - End Function - - 'Filename without extension "C:\temp\TEST.txt" >> "C:\temp\TEST" - Public Function fFileWoExt(ByVal Path As String) As String - Return fPATH(Path) & fFILE(Path, False) - End Function - - 'Filename without path if Path = WorkDir or MainDir - Public Function fFileWoDir(ByVal file As String, Optional ByVal MainDir As String = "") As String - Dim path As String - - - If MainDir = "" Then - path = Cfg.WorkDPath - Else - path = MainDir - End If - - If UCase(fPATH(file)) = UCase(path) Then file = fFILE(file, True) - - Return file - - End Function - - 'Path alone "C:\temp\TEST.txt" >> "C:\temp\" - ' "TEST.txt" >> "" - Public Function fPATH(ByVal Pfad As String) As String - Dim x As Int16 - If Pfad Is Nothing OrElse Pfad.Length < 3 OrElse Pfad.Substring(1, 2) <> ":\" Then Return "" - x = Pfad.LastIndexOf("\") - Return Microsoft.VisualBasic.Left(Pfad, x + 1) - End Function - 'Extension alone "C:\temp\TEST.txt" >> ".txt" - Public Function fEXT(ByVal Pfad As String) As String - Dim x As Int16 - x = Pfad.LastIndexOf(".") - If x = -1 Then - Return "" - Else - Return Microsoft.VisualBasic.Right(Pfad, Microsoft.VisualBasic.Len(Pfad) - x) - End If End Function - -#End Region - - - End Module diff --git a/VECTO/Input Files/cAux.vb b/VECTO/Input Files/cAux.vb index 18fcfa1c1ff3fd979d84cf29948ef48b5803a98b..2636aba85940b841d9615fa044751ef9c0719533 100644 --- a/VECTO/Input Files/cAux.vb +++ b/VECTO/Input Files/cAux.vb @@ -1,16 +1,52 @@ -Public Class cAux - +''' <summary> +''' Auxiliary +''' </summary> +''' <remarks></remarks> +Public Class cAux + + ''' <summary> + ''' Input file path (.vaux) + ''' </summary> + ''' <remarks></remarks> Public Filepath As String + ''' <summary> + ''' Transmission ratio to engine speed [-] + ''' </summary> + ''' <remarks></remarks> Public TransRatio As Single + + ''' <summary> + ''' Efficiency to engine [-] + ''' </summary> + ''' <remarks></remarks> Public EffToEng As Single + + ''' <summary> + ''' Efficiency auxiliary to supply [-] + ''' </summary> + ''' <remarks></remarks> Public EffToSply As Single + + ''' <summary> + ''' Efficiency map + ''' </summary> + ''' <remarks>x= Auxiliary speed [rpm]; y= Supply power [kW]; z= Mechanical power [kW]. Note that the columns in the input file are different!</remarks> Private EffMap As cDelaunayMap + ''' <summary> + ''' New instance. Creates new efficiency map + ''' </summary> + ''' <remarks></remarks> Public Sub New() EffMap = New cDelaunayMap End Sub + ''' <summary> + ''' Read input file (.vaux) + ''' </summary> + ''' <returns>True if successful, else False.</returns> + ''' <remarks></remarks> Public Function Readfile() As Boolean Dim MsgSrc As String Dim file As cFile_V3 @@ -18,13 +54,7 @@ MsgSrc = "Main/ReadInp/Aux" - 'Abort if there's no file - If Filepath = "" OrElse Not IO.File.Exists(Filepath) Then - WorkerMsg(tMsgID.Err, "Aux file not found (" & Filepath & ") !", MsgSrc) - Return False - End If - - 'Open file + 'Open file - Abort if file not accessible file = New cFile_V3 If Not file.OpenRead(Filepath) Then file = Nothing @@ -35,8 +65,10 @@ 'Map reset EffMap = New cDelaunayMap + 'Abort if file is empty If file.EndOfFile Then GoTo lbFileEndErr + 'Read file Try 'Transmission ration to engine rpm [-] @@ -66,6 +98,7 @@ EffMap.AddPoints(CDbl(line(0)), CDbl(line(2)), CDbl(line(1))) Loop + 'Triangulate map If Not EffMap.Triangulate Then WorkerMsg(tMsgID.Err, "Aux Map is invalid! (Triangulation Error)", MsgSrc) GoTo lbErr @@ -96,7 +129,13 @@ lbErr: End Function - + ''' <summary> + ''' Returns power demand for given engine speed and supply power + ''' </summary> + ''' <param name="nU">Engine speed [1/min]</param> + ''' <param name="Psupply">Supply power [kW] from driving cycle</param> + ''' <returns>Power demand [kW]</returns> + ''' <remarks></remarks> Public Function Paux(ByVal nU As Single, ByVal Psupply As Single) As Single Dim nUaux As Single diff --git a/VECTO/Input Files/cDRI.vb b/VECTO/Input Files/cDRI.vb index be03263f82994749de3ea3559997fe9978217559..a6facf541b342089b7f145105b09efdcf7361da2 100644 --- a/VECTO/Input Files/cDRI.vb +++ b/VECTO/Input Files/cDRI.vb @@ -1,33 +1,111 @@ Imports System.Collections.Generic +''' <summary> +''' Driving cycle input file +''' </summary> +''' <remarks></remarks> Public Class cDRI - 'Private Const FormatVersion As Integer = 1 - 'Private FileVersion As Integer + ''' <summary> + ''' Last index of driving cycle columns + ''' </summary> + ''' <remarks></remarks> Public tDim As Integer + ''' <summary> + ''' Dictionary holding all driving cycle columns. Key= Parameter-ID (enum), Value= parameter value per time step + ''' </summary> + ''' <remarks></remarks> Public Values As Dictionary(Of tDriComp, List(Of Double)) + + ''' <summary> + ''' First time stamp in driving cycle + ''' </summary> + ''' <remarks></remarks> Public t0 As Integer - Private sFilePath As String + ''' <summary> + ''' Full filepath. Needs to be defined before calling ReadFile. + ''' </summary> + ''' <remarks></remarks> + Public FilePath As String + ''' <summary> + ''' True= Cycle includes time stamps. Defined in ReadFile. + ''' </summary> + ''' <remarks></remarks> Public Tvorg As Boolean + + ''' <summary> + ''' True= Cycle includes time vehicle speed. Defined in ReadFile. + ''' </summary> + ''' <remarks></remarks> Public Vvorg As Boolean + + ''' <summary> + ''' True= Cycle includes engine power. Defined in ReadFile. + ''' </summary> + ''' <remarks></remarks> Public Pvorg As Boolean + + ''' <summary> + ''' True= Cycle includes additional auxiliary power demand (not to be confused with auxiliary supply power). Defined in ReadFile. + ''' </summary> + ''' <remarks></remarks> Public PaddVorg As Boolean + + ''' <summary> + ''' True= Cycle includes engine speed. Defined in ReadFile. + ''' </summary> + ''' <remarks></remarks> Public Nvorg As Boolean + + ''' <summary> + ''' True= Cycle includes gear input. Defined in ReadFile. + ''' </summary> + ''' <remarks></remarks> Public Gvorg As Boolean + + ''' <summary> + ''' True= Cycle includes slope. Defined in ReadFile. + ''' </summary> + ''' <remarks></remarks> Public GradVorg As Boolean - 'Aux-Psupply - Private bAuxDef As Boolean + ''' <summary> + ''' True= Cycle includes auxiliary supply power for at least one auxiliary. Defined in ReadFile. + ''' </summary> + ''' <remarks></remarks> + Public AuxDef As Boolean + + ''' <summary> + ''' Auxiliary supply power input. Key= Aux-ID, Value= Supply power [kW] per time step + ''' </summary> + ''' <remarks></remarks> Public AuxComponents As Dictionary(Of String, List(Of Single)) + ''' <summary> + ''' True= Cycle includes VairRes and VairBeta for side wind correction. Defined in ReadFile. + ''' </summary> + ''' <remarks></remarks> Public VairVorg As Boolean + ''' <summary> + ''' True= Cycle includes distance. Defined in ReadFile. + ''' </summary> + ''' <remarks></remarks> Public Scycle As Boolean + + ''' <summary> + ''' True= Cycle includes slope. Defined in ReadFile. + ''' </summary> + ''' <remarks></remarks> Public VoglS As List(Of Double) + ''' <summary> + ''' Reset all fields, etc. berfore loading new file. Called by ReadFile. + ''' </summary> + ''' <remarks></remarks> Private Sub ResetMe() Values = Nothing PaddVorg = False @@ -38,13 +116,18 @@ Public Class cDRI Gvorg = False Pvorg = False tDim = -1 - t0 = 1 'Ist Standardwert falls Converter nicht verwendet wird - bAuxDef = False + t0 = 1 'Default if no time steps are defined in driving cycle + AuxDef = False AuxComponents = Nothing VairVorg = False Scycle = False End Sub + ''' <summary> + ''' Read driving cycle. FilePath must be defined before calling. + ''' </summary> + ''' <returns>True= File loaded successfully.</returns> + ''' <remarks></remarks> Public Function ReadFile() As Boolean Dim file As cFile_V3 Dim line As String() @@ -74,8 +157,8 @@ Public Class cDRI ResetMe() 'Abort if there's no file - If sFilePath = "" OrElse Not IO.File.Exists(sFilePath) Then - WorkerMsg(tMsgID.Err, "Cycle file not found (" & sFilePath & ") !", MsgSrc) + If FilePath = "" OrElse Not IO.File.Exists(FilePath) Then + WorkerMsg(tMsgID.Err, "Cycle file not found (" & FilePath & ") !", MsgSrc) Return False End If @@ -84,8 +167,8 @@ Public Class cDRI 'Open file file = New cFile_V3 - If Not file.OpenRead(sFilePath) Then - WorkerMsg(tMsgID.Err, "Failed to open file (" & sFilePath & ") !", MsgSrc) + If Not file.OpenRead(FilePath) Then + WorkerMsg(tMsgID.Err, "Failed to open file (" & FilePath & ") !", MsgSrc) file = Nothing Return False End If @@ -138,7 +221,7 @@ Public Class cDRI txt = fCompSubStr(line(s)) - If Not bAuxDef Then + If Not AuxDef Then AuxComponents = New Dictionary(Of String, List(Of Single)) AuxSpalten = New Dictionary(Of String, Integer) End If @@ -151,7 +234,7 @@ Public Class cDRI AuxComponents.Add(txt, New List(Of Single)) AuxSpalten.Add(txt, s) - bAuxDef = True + AuxDef = True End If @@ -204,7 +287,7 @@ Public Class cDRI Values(sKV.Key).Add(CDbl(line(sKV.Value))) Next - If bAuxDef Then + If AuxDef Then For Each AuxID In AuxSpalten.Keys AuxComponents(AuxID).Add(CSng(line(AuxSpalten(AuxID)))) Next @@ -213,7 +296,7 @@ Public Class cDRI Loop Catch ex As Exception - WorkerMsg(tMsgID.Err, "Error during file read! Line number: " & tDim + 1 & " (" & sFilePath & ")", MsgSrc, sFilePath) + WorkerMsg(tMsgID.Err, "Error during file read! Line number: " & tDim + 1 & " (" & FilePath & ")", MsgSrc, FilePath) GoTo lbEr End Try @@ -246,6 +329,10 @@ lbEr: End Function + ''' <summary> + ''' Calculates altitude for each time step if driving cycle includes slope. + ''' </summary> + ''' <remarks></remarks> Public Sub GradToAlt() Dim i As Integer Dim v0 As New List(Of Double) @@ -257,7 +344,6 @@ lbEr: 'Skip if altitude is defined already If Values.ContainsKey(tDriComp.Alt) Then Exit Sub - If GradVorg And Vvorg Then vg = Values(tDriComp.Grad) @@ -309,6 +395,11 @@ lbEr: End Sub + ''' <summary> + ''' Convert distance-based cycle to time-based cycle. + ''' </summary> + ''' <returns>True= Convertion successful.</returns> + ''' <remarks></remarks> Public Function ConvStoT() As Boolean Dim i As Integer Dim j As Integer @@ -385,7 +476,7 @@ lbEr: End If Next - If bAuxDef Then + If AuxDef Then tAuxValues = New Dictionary(Of String, List(Of Single)) hzAuxValues = New Dictionary(Of String, List(Of Single)) For Each AuxKV In AuxComponents @@ -441,7 +532,7 @@ lbEr: tValues(tDriComp.V).Add(Speed(0)) tSpeedOgl.Add(SpeedOgl(0)) tDist.Add(s) - If bAuxDef Then + If AuxDef Then For Each AuxKV In AuxComponents tAuxValues(AuxKV.Key).Add(AuxKV.Value(0)) Next @@ -463,7 +554,7 @@ lbEr: tValues(tDriComp.V).Add(Speed(0)) tSpeedOgl.Add(SpeedOgl(0)) tDist.Add(s) - If bAuxDef Then + If AuxDef Then For Each AuxKV In AuxComponents tAuxValues(AuxKV.Key).Add(AuxKV.Value(0)) Next @@ -492,7 +583,7 @@ lbEr: tValues(tDriComp.V).Add(Speed(i + 1)) tSpeedOgl.Add(SpeedOgl(i + 1)) tDist.Add(s) - If bAuxDef Then + If AuxDef Then For Each AuxKV In AuxComponents tAuxValues(AuxKV.Key).Add(AuxKV.Value(i + 1)) Next @@ -515,7 +606,7 @@ lbEr: tSpeedOgl.Add(SpeedOgl(i + 1)) tDist.Add(s) - If bAuxDef Then + If AuxDef Then For Each AuxKV In AuxComponents tAuxValues(AuxKV.Key).Add(AuxKV.Value(i + 1)) Next @@ -563,7 +654,7 @@ lbEr: Next hzSpeedOgl.Add(0) - If bAuxDef Then + If AuxDef Then For Each AuxKV In AuxComponents 'WRONG!! => hzAuxValues(AuxKV.Key).Add(AuxKV.Value(i - 1)) hzAuxValues(AuxKV.Key).Add(tAuxValues(AuxKV.Key)(i - 1)) @@ -577,7 +668,7 @@ lbEr: Next hzSpeedOgl.Add((hzDist(j) - tDist(i - 1)) * (tSpeedOgl(i) - tSpeedOgl(i - 1)) / (tDist(i) - tDist(i - 1)) + tSpeedOgl(i - 1)) - If bAuxDef Then + If AuxDef Then For Each AuxKV In AuxComponents hzAuxValues(AuxKV.Key).Add((hzDist(j) - tDist(i - 1)) * (tAuxValues(AuxKV.Key)(i) - tAuxValues(AuxKV.Key)(i - 1)) / (tDist(i) - tDist(i - 1)) + tAuxValues(AuxKV.Key)(i - 1)) Next @@ -590,13 +681,18 @@ lbEr: Values = hzValues VoglS = hzSpeedOgl MODdata.Vh.Weg = hzDist - If bAuxDef Then AuxComponents = hzAuxValues + If AuxDef Then AuxComponents = hzAuxValues tDim = Values(tDriComp.V).Count - 1 Return True End Function + ''' <summary> + ''' Convert cycle to 1Hz. + ''' </summary> + ''' <returns>True= Convertion successful.</returns> + ''' <remarks></remarks> Public Function ConvTo1Hz() As Boolean Dim tMin As Double @@ -644,7 +740,7 @@ lbEr: If KV.Key <> tDriComp.t Then Summe.Add(KV.Key, 0) Next - If bAuxDef Then + If AuxDef Then NewAuxValues = New Dictionary(Of String, List(Of Single)) AuxSumme = New Dictionary(Of String, Single) For Each AuxKV In AuxComponents @@ -688,7 +784,7 @@ lb10: NewValues(KVd.Key).Add((tMid - fTime(z - 1)) * (Values(KVd.Key)(z) - Values(KVd.Key)(z - 1)) / (fTime(z) - fTime(z - 1)) + Values(KVd.Key)(z - 1)) Next - If bAuxDef Then + If AuxDef Then For Each AuxKV In AuxComponents NewAuxValues(AuxKV.Key).Add((tMid - fTime(z - 1)) * (AuxKV.Value(z) - AuxKV.Value(z - 1)) / (fTime(z) - fTime(z - 1)) + AuxKV.Value(z - 1)) Next @@ -702,7 +798,7 @@ lb10: NewValues(KVd.Key).Add((Summe(KVd.Key) + Values(KVd.Key)(z)) / (Anz + 1)) Next - If bAuxDef Then + If AuxDef Then For Each AuxKV In AuxComponents NewAuxValues(AuxKV.Key).Add((AuxSumme(AuxKV.Key) + AuxKV.Value(z)) / (Anz + 1)) Next @@ -718,7 +814,7 @@ lb10: NewValues(KVd.Key).Add((tMid - fTime(z - 1)) * (Values(KVd.Key)(z) - Values(KVd.Key)(z - 1)) / (fTime(z) - fTime(z - 1)) + Values(KVd.Key)(z - 1)) Next - If bAuxDef Then + If AuxDef Then For Each AuxKV In AuxComponents NewAuxValues(AuxKV.Key).Add((tMid - fTime(z - 1)) * (AuxKV.Value(z) - AuxKV.Value(z - 1)) / (fTime(z) - fTime(z - 1)) + AuxKV.Value(z - 1)) Next @@ -730,7 +826,7 @@ lb10: NewValues(KVd.Key).Add((tMid - fTime(z - 2)) * (Values(KVd.Key)(z - 1) - Values(KVd.Key)(z - 2)) / (fTime(z - 1) - fTime(z - 2)) + Values(KVd.Key)(z - 2)) Next - If bAuxDef Then + If AuxDef Then For Each AuxKV In AuxComponents NewAuxValues(AuxKV.Key).Add((tMid - fTime(z - 2)) * (AuxKV.Value(z - 1) - AuxKV.Value(z - 2)) / (fTime(z - 1) - fTime(z - 2)) + AuxKV.Value(z - 2)) Next @@ -744,7 +840,7 @@ lb10: NewValues(KVd.Key).Add(Summe(KVd.Key) / Anz) Next - If bAuxDef Then + If AuxDef Then For Each AuxKV In AuxComponents NewAuxValues(AuxKV.Key).Add(AuxSumme(AuxKV.Key) / Anz) Next @@ -772,7 +868,7 @@ lb10: If KV.Key <> tDriComp.t Then Summe(KV.Key) = 0 Next - If bAuxDef Then + If AuxDef Then For Each AuxKV In AuxComponents AuxSumme(AuxKV.Key) = 0 Next @@ -790,7 +886,7 @@ lb10: If KV.Key <> tDriComp.t Then Summe(KV.Key) += Values(KV.Key)(z) Next - If bAuxDef Then + If AuxDef Then For Each AuxKV In AuxComponents AuxSumme(AuxKV.Key) += AuxKV.Value(z) Next @@ -808,6 +904,10 @@ lb10: End Function + ''' <summary> + ''' Duplicates first time step. Needed for distance-based cycles to ensure vehicle stop at cycle start. + ''' </summary> + ''' <remarks></remarks> Public Sub FirstZero() Dim AuxKV As KeyValuePair(Of String, List(Of Single)) Dim ValKV As KeyValuePair(Of tDriComp, List(Of Double)) @@ -820,7 +920,7 @@ lb10: If Scycle Then VoglS.Insert(0, VoglS(0)) - If bAuxDef Then + If AuxDef Then For Each AuxKV In AuxComponents AuxKV.Value.Insert(0, AuxKV.Value(0)) Next @@ -828,22 +928,5 @@ lb10: End Sub - Public Property FilePath() As String - Get - Return sFilePath - End Get - Set(ByVal value As String) - sFilePath = value - End Set - End Property - - Public ReadOnly Property AuxDef As Boolean - Get - Return bAuxDef - End Get - End Property - - - End Class diff --git a/VECTO/Input Files/cENG.vb b/VECTO/Input Files/cENG.vb index 191d722110b63a8aa878dfd0e7e2fa9c0ac29f8f..182bfe37413eef8158fe87f2b859c7574f88de48 100644 --- a/VECTO/Input Files/cENG.vb +++ b/VECTO/Input Files/cENG.vb @@ -1,36 +1,124 @@ Imports System.Collections.Generic +''' <summary> +''' Engine input file +''' </summary> +''' <remarks></remarks> Public Class cENG - Private Const FormatVersion As String = "1.0" - Private FileVersion As String - + ''' <summary> + ''' Current format version + ''' </summary> + ''' <remarks></remarks> + Private Const FormatVersion As Short = 1 + + ''' <summary> + ''' Format version of input file. Defined in ReadFile. + ''' </summary> + ''' <remarks></remarks> + Private FileVersion As Short + + ''' <summary> + ''' Engine description (model, type, etc.). Saved in input file. + ''' </summary> + ''' <remarks></remarks> Public ModelName As String + + ''' <summary> + ''' Engine displacement [ccm]. Saved in input file. + ''' </summary> + ''' <remarks></remarks> Public Displ As Single + + ''' <summary> + ''' Idling speed [1/min]. Saved in input file. + ''' </summary> + ''' <remarks></remarks> Public Nidle As Single + + ''' <summary> + ''' Rotational inertia including flywheel [kgm²]. Saved in input file. Overwritten by generic value in Declaration mode. + ''' </summary> + ''' <remarks></remarks> Public I_mot As Single + ''' <summary> + ''' List of full load/motoring curve files (.vfld) + ''' </summary> + ''' <remarks></remarks> Public fFLD As List(Of cSubPath) + + ''' <summary> + ''' Path to fuel consumption map + ''' </summary> + ''' <remarks></remarks> Private fMAP As cSubPath + + ''' <summary> + ''' List of gear-assignments for the given .vfld files. + ''' </summary> + ''' <remarks></remarks> Public FLDgears As List(Of String) + ''' <summary> + ''' Directory of engine file. Defined in FilePath property (Set) + ''' </summary> + ''' <remarks></remarks> Private MyPath As String + + ''' <summary> + ''' Full file path. Needs to be defined via FilePath property before calling ReadFile or SaveFile. + ''' </summary> + ''' <remarks></remarks> Private sFilePath As String + ''' <summary> + ''' True= File is not in JSON Format. Defined in ReadFile. + ''' </summary> + ''' <remarks></remarks> Public NoJSON As Boolean + ''' <summary> + ''' List of sub input files (e.g. FC map). Can be accessed by FileList property. Generated by CreateFileList. + ''' </summary> + ''' <remarks></remarks> Private MyFileList As List(Of String) + + ''' <summary> + ''' WHTC Urban test results. Saved in input file. + ''' </summary> + ''' <remarks></remarks> Public WHTCurban As Single + + ''' <summary> + ''' WHTC Rural test results. Saved in input file. + ''' </summary> + ''' <remarks></remarks> Public WHTCrural As Single + + ''' <summary> + ''' WHTC Motorway test results. Saved in input file. + ''' </summary> + ''' <remarks></remarks> Public WHTCmw As Single + ''' <summary> + ''' Rated engine speed [1/min]. Engine speed at max. power. Defined in Init. + ''' </summary> + ''' <remarks></remarks> Public Nrated As Single - Public Nlo As Single - Public Npref As Single - Public N95h As Single - Public Nhi As Single - + ''' <summary> + ''' Maximum engine power [kW]. Power at rated engine speed. + ''' </summary> + ''' <remarks></remarks> + Public Pmax As Single + + ''' <summary> + ''' Generates list of all sub input files (e.g. FC map). Sets MyFileList. + ''' </summary> + ''' <returns>True if successful.</returns> + ''' <remarks></remarks> Public Function CreateFileList() As Boolean Dim sb As cSubPath @@ -48,6 +136,10 @@ Public Class cENG End Function + ''' <summary> + ''' New instance. Initialise + ''' </summary> + ''' <remarks></remarks> Public Sub New() MyPath = "" sFilePath = "" @@ -55,12 +147,17 @@ Public Class cENG SetDefault() End Sub + ''' <summary> + ''' Set default values + ''' </summary> + ''' <remarks></remarks> Private Sub SetDefault() ModelName = "Undefined" Displ = 0 Nidle = 0 I_mot = 0 Nrated = 0 + Pmax = 0 fFLD = New List(Of cSubPath) FLDgears = New List(Of String) @@ -74,7 +171,12 @@ Public Class cENG End Sub - Private Function ReadFileOld() As Boolean + ''' <summary> + ''' Read file in old csv format. Called by ReadFile if file is not in JSON format. + ''' </summary> + ''' <returns>True if successful.</returns> + ''' <remarks></remarks> + Private Function ReadFileOld(ByVal ShowMsg As Boolean) As Boolean Dim MsgSrc As String Dim file As cFile_V3 Dim line() As String @@ -87,14 +189,14 @@ Public Class cENG If sFilePath = "" Or Not IO.File.Exists(sFilePath) Then - WorkerMsg(tMsgID.Err, "Engine file not found (" & sFilePath & ") !", MsgSrc) + If ShowMsg Then WorkerMsg(tMsgID.Err, "Engine file not found (" & sFilePath & ") !", MsgSrc) Return False End If file = New cFile_V3 If Not file.OpenRead(sFilePath) Then - WorkerMsg(tMsgID.Err, "Failed to open file (" & sFilePath & ") !", MsgSrc) + If ShowMsg Then WorkerMsg(tMsgID.Err, "Failed to open file (" & sFilePath & ") !", MsgSrc) file = Nothing Return False End If @@ -133,7 +235,7 @@ Public Class cENG fMAP.Init(MyPath, file.ReadLine(0)) Catch ex As Exception - WorkerMsg(tMsgID.Err, ex.Message, MsgSrc) + If ShowMsg Then WorkerMsg(tMsgID.Err, ex.Message, MsgSrc) file.Close() Return False End Try @@ -144,6 +246,11 @@ Public Class cENG End Function + ''' <summary> + ''' Save file. <see cref="P:VECTO.cENG.FilePath" /> must be set before calling. + ''' </summary> + ''' <returns>True if successful.</returns> + ''' <remarks></remarks> Public Function SaveFile() As Boolean Dim i As Integer Dim JSON As New cJSON @@ -192,7 +299,12 @@ Public Class cENG End Function - Public Function ReadFile() As Boolean + ''' <summary> + ''' Read file. <see cref="P:VECTO.cENG.FilePath" /> must be set before calling. + ''' </summary> + ''' <returns>True if successful.</returns> + ''' <remarks></remarks> + Public Function ReadFile(Optional ByVal ShowMsg As Boolean = True) As Boolean Dim MsgSrc As String Dim i As Integer Dim JSON As New cJSON @@ -209,7 +321,7 @@ Public Class cENG If Not JSON.ReadFile(sFilePath) Then NoJSON = True Try - Return ReadFileOld() + Return ReadFileOld(ShowMsg) Catch ex As Exception Return False End Try @@ -242,7 +354,7 @@ Public Class cENG End If Catch ex As Exception - WorkerMsg(tMsgID.Err, "Failed to read VECTO file! " & ex.Message, MsgSrc) + If ShowMsg Then WorkerMsg(tMsgID.Err, "Failed to read VECTO file! " & ex.Message, MsgSrc) Return False End Try @@ -250,20 +362,23 @@ Public Class cENG End Function + ''' <summary> + ''' Initialise for calculation. File must be read already. + ''' </summary> + ''' <returns>True if successful.</returns> + ''' <remarks></remarks> Public Function Init() As Boolean - Dim Pmax As Single Dim fl As cFLD Dim fldgear As Dictionary(Of Integer, String) Dim fldgFromTo As String() Dim str As String Dim i As Integer Dim j As Integer - Dim nr As Single Dim MsgSrc As String MsgSrc = "ENG/Init" - 'Read FLDs and MAP + 'Create cFLD instance for each gear (list with gear as index) FLD = New List(Of cFLD) If FLDgears.Count = 0 Then @@ -308,7 +423,7 @@ Public Class cENG Return False End Try - + 'read .vfld files For i = 0 To GBX.GearCount If Not fldgear.ContainsKey(i) Then @@ -320,15 +435,17 @@ Public Class cENG FLD(i).FilePath = fldgear(i) Try - If Not FLD(i).ReadFile Then Return False 'Fehlermeldung hier nicht notwendig weil schon von in ReadFile + If Not FLD(i).ReadFile Then Return False 'Error message in ReadFile Catch ex As Exception WorkerMsg(tMsgID.Err, "File read error! (" & fldgear(i) & ")", MsgSrc, fldgear(i)) Return False End Try + FLD(i).Init(Nidle) + Next - 'Kennfeld read + 'Read FC map MAP = New cMAP MAP.FilePath = PathMAP @@ -339,55 +456,81 @@ Public Class cENG Return False End Try - 'Normalize - MAP.Norm() + 'Triangulate FC map. + If Not MAP.Triangulate() Then + WorkerMsg(tMsgID.Err, "Failed to triangulate FC map! (" & PathMAP & ")", MsgSrc, PathMAP) + Return False + End If + - Nrated = 0 - For Each fl In FLD - nr = fl.fnUrated - If Nrated < nr Then Nrated = nr - Next + 'Special rpms for Shift Model and WHTC de-normalisation + fl = FLD(0) - 'Special rpms for Shift Model - fl = FLD(FLD.Count - 1) + Nrated = fl.fnUrated Pmax = fl.Pfull(fl.fnUrated) - Nlo = fl.fnUofPfull(0.55 * Pmax, True) + Return True - N95h = fl.fnUofPfull(0.95 * Pmax, False) + End Function - Npref = fl.Npref + ''' <summary> + ''' Set generic values for Declaration Mode + ''' </summary> + ''' <returns>True if successful.</returns> + ''' <remarks></remarks> + Public Function DeclInit() As Boolean + Dim f0 As cFLD - Nhi = fl.fnUofPfull(0.7 * Pmax, False) + I_mot = Declaration.EngInertia(Displ) + For Each f0 In FLD + f0.DeclInit() + Next Return True - End Function - Public Sub DeclInit() - - I_mot = Declaration.GetEngInertia(Displ) - - End Sub - + ''' <summary> + ''' Returns list of sub input files after calling CreateFileList. + ''' </summary> + ''' <value></value> + ''' <returns>list of sub input files</returns> + ''' <remarks></remarks> Public ReadOnly Property FileList As List(Of String) Get Return MyFileList End Get End Property + ''' <summary> + ''' Get or set Filepath before calling <see cref="M:VECTO.cENG.ReadFile" /> or <see cref="M:VECTO.cENG.SaveFile" /> + ''' </summary> + ''' <value></value> + ''' <returns>Full filepath</returns> + ''' <remarks></remarks> Public Property FilePath() As String Get Return sFilePath End Get Set(ByVal value As String) sFilePath = value - MyPath = IO.Path.GetDirectoryName(sFilePath) & "\" + If sFilePath = "" Then + MyPath = "" + Else + MyPath = IO.Path.GetDirectoryName(sFilePath) & "\" + End If End Set End Property + ''' <summary> + ''' Get or set file path (cSubPath) of .vfld file for each gear range. + ''' </summary> + ''' <param name="x">Index</param> + ''' <param name="Original">True= (relative) file path as saved in file; False= full file path</param> + ''' <value></value> + ''' <returns>Relative or absolute file path for each gear range</returns> + ''' <remarks></remarks> Public Property PathFLD(ByVal x As Short, Optional ByVal Original As Boolean = False) As String Get If Original Then @@ -401,6 +544,13 @@ Public Class cENG End Set End Property + ''' <summary> + ''' Get or set file path (cSubPath) to FC map (.vmap) + ''' </summary> + ''' <param name="Original">True= (relative) file path as saved in file; False= full file path</param> + ''' <value></value> + ''' <returns>Relative or absolute file path to FC map</returns> + ''' <remarks></remarks> Public Property PathMAP(Optional ByVal Original As Boolean = False) As String Get If Original Then diff --git a/VECTO/Input Files/cFLD.vb b/VECTO/Input Files/cFLD.vb index d24b8c4673f28a4976b8ec899c664ab902ece56d..cf80d3c7604cc0f937525d7646f689df149e4d00 100644 --- a/VECTO/Input Files/cFLD.vb +++ b/VECTO/Input Files/cFLD.vb @@ -1,58 +1,103 @@ Imports System.Collections.Generic +''' <summary> +''' Full load/motoring curve input file +''' </summary> +''' <remarks></remarks> Public Class cFLD - 'Private Const FormatVersion As Integer = 1 - 'Private FileVersion As Integer - + ''' <summary> + ''' Full file path. Needs to be defined via FilePath property before calling ReadFile or SaveFile. + ''' </summary> + ''' <remarks></remarks> Private sFilePath As String - Private LTq As List(Of Single) - Private LTqDrag As List(Of Single) - Private LnU As List(Of Single) + ''' <summary> + ''' List of full load torque values [Nm] + ''' </summary> + ''' <remarks></remarks> + Public LTq As List(Of Single) + + ''' <summary> + ''' List of motoring torque values [Nm] + ''' </summary> + ''' <remarks></remarks> + Public LTqDrag As List(Of Single) + + ''' <summary> + ''' List of engine speed values [1/min] + ''' </summary> + ''' <remarks></remarks> + Public LnU As List(Of Single) + + ''' <summary> + ''' List of PT1 values [s] + ''' </summary> + ''' <remarks></remarks> Private LPT1 As List(Of Single) - Private LPtarget As List(Of Single) - + ''' <summary> + ''' Last index of lists (items count - 1) + ''' </summary> + ''' <remarks></remarks> Private iDim As Integer - - - Private Sub ResetMe() - LTq = Nothing - LTqDrag = Nothing - LnU = Nothing - LPT1 = Nothing - iDim = -1 - End Sub - - Public Function ReadFile() As Boolean + ''' <summary> + ''' Nlo [1/min]. Lowest enging speed with 55% of max. power. Defined in Init. + ''' </summary> + ''' <remarks></remarks> + Public Nlo As Single + + ''' <summary> + ''' Nhi [1/min]. Highest engine speed with 70% of max. power. Defined in Init. + ''' </summary> + ''' <remarks></remarks> + Public Nhi As Single + + ''' <summary> + ''' Npref [1/min]. Speed at 51% torque/speed-integral between idling and N95h. Defined in Init. + ''' </summary> + ''' <remarks></remarks> + Public Npref As Single + + ''' <summary> + ''' N95h [1/min]. Highest engine speed with 95% of max. power. Defined in Init. + ''' </summary> + ''' <remarks></remarks> + Public N95h As Single + + ''' <summary> + ''' Read file. FilePath must be set before calling. + ''' </summary> + ''' <returns>True if successful.</returns> + ''' <remarks></remarks> + Public Function ReadFile(Optional ByVal ShowMsg As Boolean = True) As Boolean Dim file As cFile_V3 Dim line As String() - Dim s1 As Integer - Dim sPT1 As Integer - Dim PT1 As Single + Dim PT1set As Boolean + Dim FirstLine As Boolean Dim nU As Double Dim MsgSrc As String MsgSrc = "Main/ReadInp/FLD" - sPT1 = -1 - PT1 = 0 '=> Defaultwert falls nicht in FLD vorgegeben - 'Reset - ResetMe() + LTq = Nothing + LTqDrag = Nothing + LnU = Nothing + LPT1 = Nothing + iDim = -1 'Stop if there's no file If sFilePath = "" OrElse Not IO.File.Exists(sFilePath) Then - WorkerMsg(tMsgID.Err, "FLD file '" & sFilePath & "' not found!", MsgSrc) + If ShowMsg Then WorkerMsg(tMsgID.Err, "FLD file '" & sFilePath & "' not found!", MsgSrc) Return False End If 'Open file file = New cFile_V3 If Not file.OpenRead(sFilePath) Then - WorkerMsg(tMsgID.Err, "Failed to open file (" & sFilePath & ") !", MsgSrc) + If ShowMsg Then WorkerMsg(tMsgID.Err, "Failed to open file (" & sFilePath & ") !", MsgSrc) file = Nothing Return False End If @@ -63,12 +108,7 @@ Public Class cFLD LnU = New System.Collections.Generic.List(Of Single) LPT1 = New System.Collections.Generic.List(Of Single) - - 'VECTO: No Header/Unit column. Always PT1! - s1 = 3 - sPT1 = 3 - - 'From Line 4: Values + FirstLine = True Try Do While Not file.EndOfFile @@ -83,28 +123,27 @@ Public Class cFLD LTq.Add(CDbl(line(1))) LTqDrag.Add(CDbl(line(2))) - 'If PT1 not given, use default value (see above) - If sPT1 > -1 Then - - PT1 = CSng(line(sPT1)) - - If PT1 < 0 Then - WorkerMsg(tMsgID.Err, "PT1 value invalid! line " & iDim + 1, MsgSrc) - PT1 = 0 - End If - + If FirstLine Then + PT1set = (UBound(line) > 2) + FirstLine = False End If - LPT1.Add(PT1) + 'If PT1 not defined, use default value (0) + If PT1set Then + LPT1.Add(CSng(line(3))) + Else + LPT1.Add(0) + End If 'Line-counter up (was reset in ResetMe) iDim += 1 + Loop Catch ex As Exception - WorkerMsg(tMsgID.Err, "Error during file read! Line number: " & iDim + 1 & " (" & sFilePath & ")", MsgSrc, sFilePath) + If ShowMsg Then WorkerMsg(tMsgID.Err, "Error during file read! Line number: " & iDim + 1 & " (" & sFilePath & ")", MsgSrc, sFilePath) GoTo lbEr End Try @@ -125,6 +164,12 @@ lbEr: End Function + ''' <summary> + ''' Returns motoring power [kW] for given engine speed + ''' </summary> + ''' <param name="nU">engine speed [1/min]</param> + ''' <returns>motoring power [kW]</returns> + ''' <remarks></remarks> Public Function Pdrag(ByVal nU As Single) As Single Dim i As Int32 @@ -151,6 +196,13 @@ lbInt: End Function + ''' <summary> + ''' Returns full load power [kW] at given engine speed considering transient torque build-up via PT1. + ''' </summary> + ''' <param name="nU">engine speed [1/min]</param> + ''' <param name="LastPe">engine power at previous time step</param> + ''' <returns>full load power [kW]</returns> + ''' <remarks></remarks> Public Function Pfull(ByVal nU As Single, ByVal LastPe As Single) As Single Dim i As Int32 Dim PfullStat As Single @@ -183,6 +235,12 @@ lbInt: End Function + ''' <summary> + ''' Returns stationary full load power [kW] at given engine speed. + ''' </summary> + ''' <param name="nU">engine speed [1/min]</param> + ''' <returns>stationary full load power [kW]</returns> + ''' <remarks></remarks> Public Function Pfull(ByVal nU As Single) As Single Dim i As Int32 @@ -208,6 +266,12 @@ lbInt: Return nMtoPe(nU, (nU - LnU(i - 1)) * (LTq(i) - LTq(i - 1)) / (LnU(i) - LnU(i - 1)) + LTq(i - 1)) End Function + ''' <summary> + ''' Returns stationary full load torque [Nm] at given engine speed. + ''' </summary> + ''' <param name="nU">engine speed [1/min]</param> + ''' <returns>stationary full load torque [Nm]</returns> + ''' <remarks></remarks> Public Function Tq(ByVal nU As Single) As Single Dim i As Int32 @@ -233,7 +297,12 @@ lbInt: Return (nU - LnU(i - 1)) * (LTq(i) - LTq(i - 1)) / (LnU(i) - LnU(i - 1)) + LTq(i - 1) End Function - Public Function Npref() As Single + ''' <summary> + ''' Calculates and returns Npref [1/min]. Speed at 51% torque/speed-integral between idling and N95h. Defined in Init. + ''' </summary> + ''' <returns>Npref [1/min]</returns> + ''' <remarks></remarks> + Public Function fNpref(ByVal Nidle As Single) As Single Dim i As Integer Dim Amax As Single Dim N95h As Single @@ -248,15 +317,15 @@ lbInt: N95h = fnUofPfull(0.95 * Pfull(fnUrated), False) - Amax = Area(ENG.Nidle, N95h) + Amax = Area(Nidle, N95h) For i = 0 To iDim - 1 - If Area(ENG.Nidle, LnU(i + 1)) > 0.51 * Amax Then + If Area(Nidle, LnU(i + 1)) > 0.51 * Amax Then n = LnU(i) T0 = LTq(i) - A = Area(ENG.Nidle, n) + A = Area(Nidle, n) k = (LTq(i + 1) - LTq(i)) / (LnU(i + 1) - LnU(i)) @@ -275,7 +344,13 @@ lbInt: End Function - + ''' <summary> + ''' Calculates torque/speed-integral between two engine speed limits. Used for Npref. + ''' </summary> + ''' <param name="nFrom">lower engine speed limit [1/min]</param> + ''' <param name="nTo">upper engine speed limit [1/min]</param> + ''' <returns>torque/speed-integral between nFrom and nTo [Nm/min]</returns> + ''' <remarks></remarks> Private Function Area(ByVal nFrom As Single, ByVal nTo As Single) As Single Dim A As Single Dim i As Integer @@ -319,7 +394,11 @@ lbInt: End Function - + ''' <summary> + ''' Calculates and returns engine speed at maximum power [1/min]. + ''' </summary> + ''' <returns>engine speed at maximum power [1/min]</returns> + ''' <remarks></remarks> Public Function fnUrated() As Single Dim PeMax As Single Dim nU As Single @@ -347,7 +426,13 @@ lbInt: End Function - + ''' <summary> + ''' Calculates and returns lowest or highest engine speed at given full load power [1/min]. + ''' </summary> + ''' <param name="PeTarget">full load power [kW]</param> + ''' <param name="FromLeft">True= lowest engine speed; False= highest engine speed</param> + ''' <returns>lowest or highest engine speed at given full load power [1/min]</returns> + ''' <remarks></remarks> Public Function fnUofPfull(ByVal PeTarget As Single, ByVal FromLeft As Boolean) As Single Dim Pe As Single Dim LastPe As Single @@ -409,7 +494,11 @@ lbInt: End Function - + ''' <summary> + ''' Calculates and returns maximum torque [Nm]. + ''' </summary> + ''' <returns>maximum torque [Nm]</returns> + ''' <remarks></remarks> Public Function Tmax() As Single Dim i As Int16 Dim Tm As Single @@ -423,6 +512,36 @@ lbInt: End Function + Public Sub Init(ByVal Nidle As Single) + Dim Pmax As Single + + Pmax = Pfull(fnUrated) + + Nlo = fnUofPfull(0.55 * Pmax, True) + + N95h = fnUofPfull(0.95 * Pmax, False) + + Npref = fNpref(Nidle) + + Nhi = fnUofPfull(0.7 * Pmax, False) + + End Sub + + Public Sub DeclInit() + Dim i As Integer + + For i = 0 To iDim + LPT1(i) = Declaration.PT1(LnU(i)) + Next + + End Sub + + ''' <summary> + ''' Get or set Filepath before calling ReadFile + ''' </summary> + ''' <value></value> + ''' <returns>Full filepath</returns> + ''' <remarks></remarks> Public Property FilePath() As String Get Return sFilePath diff --git a/VECTO/Input Files/cGBX.vb b/VECTO/Input Files/cGBX.vb index f78b47f263340afb18baac27da96481bd5d69f42..319f69218ea00f5ffaadd1d50c64c0fe213e02b8 100644 --- a/VECTO/Input Files/cGBX.vb +++ b/VECTO/Input Files/cGBX.vb @@ -2,8 +2,8 @@ Public Class cGBX - Private Const FormatVersion As String = "1.0" - Private FileVersion As String + Private Const FormatVersion As Short = 2 + Private FileVersion As Short Private MyPath As String Private sFilePath As String @@ -12,20 +12,19 @@ Public Class cGBX Public I_Getriebe As Single Public TracIntrSi As Single - Public GetrI As List(Of Single) + Public Igetr As List(Of Single) Public GetrMaps As List(Of cSubPath) Public IsTCgear As List(Of Boolean) - Private iganganz As Short + Private MyGBmaps As List(Of cDelaunayMap) + Private GetrEffDef As List(Of Boolean) + Private GetrEff As List(Of Single) 'Gear shift polygons - Private gs_file As New cSubPath - Private gs_Mup As New List(Of Single) - Private gs_Mdown As New List(Of Single) - Private gs_nUup As New List(Of Single) - Private gs_nUdown As New List(Of Single) - Private gs_Dup As Integer - Private gs_Ddown As Integer + Public gs_files As List(Of cSubPath) + Public Shiftpolygons As List(Of cShiftPolygon) + + Public gs_TorqueResv As Single Public gs_SkipGears As Boolean Public gs_ShiftTime As Integer @@ -66,21 +65,24 @@ Public Class cGBX MyFileList = New List(Of String) - '.vgbs - MyFileList.Add(Me.gs_file.FullPath) - 'Transm. Loss Maps - For i = 0 To GetrMaps.Count - 1 + For i = 0 To GearCount() - 1 If Not IsNumeric(Me.GetrMap(i, True)) Then - MyFileList.Add(Me.GetrMap(i)) + If Not MyFileList.Contains(Me.GetrMap(i)) Then MyFileList.Add(Me.GetrMap(i)) + End If + + '.vgbs + If Not Cfg.DeclMode Then + If i > 0 AndAlso Not MyFileList.Contains(Me.gs_files(i).FullPath) Then MyFileList.Add(Me.gs_files(i).FullPath) End If + Next 'Torque Converter If Me.TCon Then MyFileList.Add(TCfile) - Return True + End Function @@ -96,18 +98,16 @@ Public Class cGBX I_Getriebe = 0 TracIntrSi = 0 - GetrI = New List(Of Single) - GetrMaps = New List(Of cSubPath) + Igetr = New List(Of Single) IsTCgear = New List(Of Boolean) + GetrMaps = New List(Of cSubPath) + gs_files = New List(Of cSubPath) + + GetrEffDef = New List(Of Boolean) + GetrEff = New List(Of Single) + + MyGBmaps = Nothing - iganganz = 0 - gs_Mup.Clear() - gs_Mdown.Clear() - gs_nUdown.Clear() - gs_nUup.Clear() - gs_file.Clear() - gs_Dup = -1 - gs_Ddown = -1 gs_TorqueResv = 0 gs_SkipGears = False gs_ShiftTime = 0 @@ -124,7 +124,7 @@ Public Class cGBX End Sub - Private Function ReadFileOld() As Boolean + Private Function ReadFileOld(ByVal ShowMsg As Boolean) As Boolean Dim line() As String Dim file As cFile_V3 Dim i As Integer @@ -136,14 +136,14 @@ Public Class cGBX SetDefault() If sFilePath = "" Or Not IO.File.Exists(sFilePath) Then - WorkerMsg(tMsgID.Err, "Gearbox file not found (" & sFilePath & ") !", MsgSrc) + If ShowMsg Then WorkerMsg(tMsgID.Err, "Gearbox file not found (" & sFilePath & ") !", MsgSrc) Return False End If file = New cFile_V3 If Not file.OpenRead(sFilePath) Then - WorkerMsg(tMsgID.Err, "Failed to open file (" & sFilePath & ") !", MsgSrc) + If ShowMsg Then WorkerMsg(tMsgID.Err, "Failed to open file (" & sFilePath & ") !", MsgSrc) file = Nothing Return False End If @@ -167,7 +167,7 @@ Public Class cGBX If CSng(line(0)) = 0 Then Continue Do - GetrI.Add(CSng(line(0))) + Igetr.Add(CSng(line(0))) GetrMaps.Add(New cSubPath) GetrMaps(i).Init(MyPath, line(1)) If OldFile Then @@ -178,20 +178,19 @@ Public Class cGBX Loop - iganganz = GetrI.Count - 1 + line = file.ReadLine + For i = 0 To Igetr.Count - 1 + gs_files.Add(New cSubPath) + gs_files(i).Init(MyPath, line(0)) + Next - - 'Allow file end here to keep compatibility to older versions - If Not file.EndOfFile Then - gs_file.Init(MyPath, file.ReadLine(0)) - gs_TorqueResv = CSng(file.ReadLine(0)) - gs_SkipGears = CBool(CInt(file.ReadLine(0))) - gs_ShiftTime = CInt(file.ReadLine(0)) - gs_TorqueResvStart = CSng(file.ReadLine(0)) - gs_StartSpeed = CSng(file.ReadLine(0)) - gs_StartAcc = CSng(file.ReadLine(0)) - gs_ShiftInside = CBool(CInt(file.ReadLine(0))) - End If + gs_TorqueResv = CSng(file.ReadLine(0)) + gs_SkipGears = CBool(CInt(file.ReadLine(0))) + gs_ShiftTime = CInt(file.ReadLine(0)) + gs_TorqueResvStart = CSng(file.ReadLine(0)) + gs_StartSpeed = CSng(file.ReadLine(0)) + gs_StartAcc = CSng(file.ReadLine(0)) + gs_ShiftInside = CBool(CInt(file.ReadLine(0))) If Not file.EndOfFile Then gs_Type = CType(CInt(file.ReadLine(0)), tGearbox) @@ -205,7 +204,7 @@ Public Class cGBX If OldFile And TCon Then IsTCgear(1) = True Catch ex As Exception - WorkerMsg(tMsgID.Err, ex.Message, MsgSrc) + If ShowMsg Then WorkerMsg(tMsgID.Err, ex.Message, MsgSrc) file.Close() Return False End Try @@ -241,20 +240,23 @@ Public Class cGBX dic.Add("TracInt", TracIntrSi) ls = New List(Of Object) - For i = 0 To GetrI.Count - 1 + For i = 0 To Igetr.Count - 1 dic0 = New Dictionary(Of String, Object) - dic0.Add("Ratio", GetrI(i)) + dic0.Add("Ratio", Igetr(i)) If IsNumeric(Me.GetrMap(i, True)) Then dic0.Add("Efficiency", GetrMaps(i).PathOrDummy) Else dic0.Add("LossMap", GetrMaps(i).PathOrDummy) End If - dic0.Add("TCactive", IsTCgear(i)) + If i > 0 Then + dic0.Add("TCactive", IsTCgear(i)) + dic0.Add("ShiftPolygon", gs_files(i).PathOrDummy) + End If + ls.Add(dic0) Next dic.Add("Gears", ls) - dic.Add("ShiftPolygons", gs_file.PathOrDummy) dic.Add("TqReserve", gs_TorqueResv) dic.Add("SkipGears", gs_SkipGears) dic.Add("ShiftTime", gs_ShiftTime) @@ -278,7 +280,7 @@ Public Class cGBX End Function - Public Function ReadFile() As Boolean + Public Function ReadFile(Optional ByVal ShowMsg As Boolean = True) As Boolean Dim i As Integer Dim MsgSrc As String Dim JSON As New cJSON @@ -294,7 +296,7 @@ Public Class cGBX If Not JSON.ReadFile(sFilePath) Then NoJSON = True Try - Return ReadFileOld() + Return ReadFileOld(ShowMsg) Catch ex As Exception Return False End Try @@ -312,7 +314,7 @@ Public Class cGBX For Each dic In JSON.Content("Body")("Gears") i += 1 - GetrI.Add(dic("Ratio")) + Igetr.Add(dic("Ratio")) GetrMaps.Add(New cSubPath) If dic("Efficiency") Is Nothing Then @@ -321,13 +323,23 @@ Public Class cGBX GetrMaps(i).Init(MyPath, dic("Efficiency")) End If - IsTCgear.Add(dic("TCactive")) - Next + gs_files.Add(New cSubPath) - iganganz = GetrI.Count - 1 + If i = 0 Then + IsTCgear.Add(False) + gs_files(i).Init(MyPath, sKey.NoFile) + Else + IsTCgear.Add(dic("TCactive")) + If FileVersion < 2 Then + gs_files(i).Init(MyPath, JSON.Content("Body")("ShiftPolygons")) + Else + gs_files(i).Init(MyPath, dic("ShiftPolygon")) + End If + End If + + Next - gs_file.Init(MyPath, JSON.Content("Body")("ShiftPolygons")) gs_TorqueResv = JSON.Content("Body")("TqReserve") gs_SkipGears = JSON.Content("Body")("SkipGears") gs_ShiftTime = JSON.Content("Body")("ShiftTime") @@ -347,7 +359,7 @@ Public Class cGBX End If Catch ex As Exception - WorkerMsg(tMsgID.Err, "Failed to read VECTO file! " & ex.Message, MsgSrc) + If ShowMsg Then WorkerMsg(tMsgID.Err, "Failed to read VECTO file! " & ex.Message, MsgSrc) Return False End Try @@ -357,8 +369,15 @@ Public Class cGBX End Function Public Function DeclInit() As Boolean + Dim MsgSrc As String + Dim i As Int16 - If gs_Type = tGearbox.Custom Or gs_Type = tGearbox.Automatic Then Return False + MsgSrc = "GBX/DeclInit" + + If gs_Type = tGearbox.Custom Or gs_Type = tGearbox.Automatic Then + WorkerMsg(tMsgID.Err, "Invalid gearbox type for Declaration Mode!", MsgSrc) + Return False + End If I_Getriebe = cDeclaration.GbInertia TracIntrSi = Declaration.TracInt(gs_Type) @@ -372,7 +391,10 @@ Public Class cGBX TCon = (gs_Type = tGearbox.Automatic) - SetGenericShiftPoly() + For i = 1 To GearCount() + Shiftpolygons(i).SetGenericShiftPoly() + Next + Return True @@ -425,7 +447,7 @@ Public Class cGBX End Function - Public Function TCiteration(ByVal nUout As Single, ByVal PeOut As Single, ByVal t As Integer) As Boolean + Public Function TCiteration(ByVal Gear As Integer, ByVal nUout As Single, ByVal PeOut As Single, ByVal t As Integer) As Boolean Dim nUin As Single Dim Mout As Single Dim Min As Single @@ -510,8 +532,8 @@ Public Class cGBX Min = Mout / mu 'Up/Downshift rpms - nUup = GBX.fGSnUup(Min) - nUdown = GBX.fGSnUdown(Min) + nUup = GBX.Shiftpolygons(Gear).fGSnUup(Min) + nUdown = GBX.Shiftpolygons(Gear).fGSnUdown(Min) 'If nUin > 1.05 * nUup - 0.0001 Then If nUin > ENG.Nrated - 0.0001 Then @@ -648,184 +670,450 @@ lbInt: End Function Public Function GSinit() As Boolean + Dim i As Integer + + 'Set Gearbox Type-specific settings + If gs_Type <> tGearbox.Custom Then + + gs_ShiftInside = Declaration.ShiftInside(gs_Type) + TCon = (gs_Type = tGearbox.Automatic) + gs_SkipGears = Declaration.SkipGears(gs_Type) + + End If + + Shiftpolygons = New List(Of cShiftPolygon) + For i = 0 To Igetr.Count - 1 + Shiftpolygons.Add(New cShiftPolygon(gs_files(i).FullPath, i)) + If Not Cfg.DeclMode And i > 0 Then + 'Error-notification within ReadFile() + If Not Shiftpolygons(i).ReadFile() Then Return False + End If + Next + + Return True + + End Function + + Public Function GearCount() As Integer + Return Me.Igetr.Count - 1 + End Function + +#Region "Transmission Loss Maps" + + Public Function TrLossMapInit() As Boolean + Dim i As Short + Dim GBmap0 As cDelaunayMap + 'Dim n_norm As Double + 'Dim Pe_norm As Double Dim file As cFile_V3 + Dim path As String Dim line As String() - Dim gserror As Boolean + Dim l As Integer + Dim nU As Double + Dim M_in As Double + Dim M_loss As Double + Dim M_out As Double + + Dim dnU As Single + Dim dM As Single + Dim P_In As Single + Dim P_Loss As Single + Dim EffSum As Single + Dim Anz As Integer + Dim EffDiffSum As Single = 0 + Dim AnzDiff As Integer = 0 + + Dim MinG As Single + Dim plossG As Single Dim MsgSrc As String - MsgSrc = "GBX/GSinit" + MyGBmaps = New List(Of cDelaunayMap) + file = New cFile_V3 - 'Check if settings ok - If gs_Type <> tGearbox.Custom Then + For i = 0 To GBX.GearCount - gserror = False + MsgSrc = "VEH/TrLossMapInit/G" & i + + If IsNumeric(GetrMap(i, True)) Then + GetrEffDef.Add(True) + GetrEff.Add(CSng(GBX.GetrMap(i, True))) + Else + GetrEffDef.Add(False) + GetrEff.Add(0) + End If + + If GetrEffDef(i) Then + + If GetrEff(i) > 1 Or GetrEff(i) <= 0 Then + WorkerMsg(tMsgID.Err, "Gearboy efficiency '" & GetrEff(i) & "' invalid!", MsgSrc) + Return False + End If + + MyGBmaps.Add(Nothing) + + Else + + path = GetrMaps(i).FullPath + + If Not file.OpenRead(path) Then + WorkerMsg(tMsgID.Err, "Cannot read file '" & path & "'!", MsgSrc) + MyGBmaps = Nothing + Return False + End If + + GBmap0 = New cDelaunayMap + GBmap0.DualMode = True + + l = 0 'Nur für Fehler-Ausgabe + Do While Not file.EndOfFile + l += 1 + line = file.ReadLine + Try + + nU = CDbl(line(0)) + M_in = CDbl(line(1)) + M_loss = CDbl(line(2)) + + M_out = M_in - M_loss + + 'old version: Power instead of torque: GBmap0.AddPoints(nU, nMtoPe(nU, M_out), nMtoPe(nU, M_in)) + GBmap0.AddPoints(nU, M_out, M_in) + Catch ex As Exception + WorkerMsg(tMsgID.Err, "Error during file read! Line number: " & l & " (" & path & ")", MsgSrc, path) + file.Close() + MyGBmaps = Nothing + Return False + End Try + Loop + + file.Close() + + If Not GBmap0.Triangulate Then + WorkerMsg(tMsgID.Err, "Map triangulation failed! File: " & path, MsgSrc, path) + MyGBmaps = Nothing + Return False + End If + + MyGBmaps.Add(GBmap0) + + 'Calculate average efficiency for fast approx. calculation + If i > 0 Then + + If GBX.IsTCgear(i) Then + + GetrEff(i) = -1 + + Else + + EffSum = 0 + Anz = 0 + + dnU = (2 / 3) * (ENG.Nrated - ENG.Nidle) / 10 + nU = ENG.Nidle + dnU + + Do While nU <= ENG.Nrated + + dM = nPeToM(nU, (2 / 3) * FLD(i).Pfull(nU) / 10) + M_in = nPeToM(nU, (1 / 3) * FLD(i).Pfull(nU)) + + Do While M_in <= nPeToM(nU, FLD(i).Pfull(nU)) + + P_In = nMtoPe(nU, M_in) + + P_Loss = IntpolPeLossFwd(i, nU, P_In, False) + + EffSum += (P_In - P_Loss) / P_In + Anz += 1 + + + plossG = P_Loss + MinG = M_in + + + 'Axle + P_In -= P_Loss + P_Loss = IntpolPeLossFwd(0, nU / GBX.Igetr(i), P_In, False) + EffDiffSum += (P_In - P_Loss) / P_In + AnzDiff += 1 + + If MODdata.ModErrors.TrLossMapExtr <> "" Then + WorkerMsg(tMsgID.Err, "Transmission loss map does not cover full engine operating range!", MsgSrc) + WorkerMsg(tMsgID.Err, MODdata.ModErrors.TrLossMapExtr, MsgSrc) + WorkerMsg(tMsgID.Err, "nU_In(GB)=" & nU & " [1/min]", MsgSrc) + WorkerMsg(tMsgID.Err, "M_In(GB)=" & MinG & " [Nm]", MsgSrc) + WorkerMsg(tMsgID.Err, "P_Loss(GB)=" & plossG & " [kW]", MsgSrc) + WorkerMsg(tMsgID.Err, "nU_In(axle)=" & CStr(nU / Igetr(i)) & " [1/min]", MsgSrc) + WorkerMsg(tMsgID.Err, "M_In(axle)=" & CStr(nPeToM(nU / Igetr(i), P_In)) & " [Nm]", MsgSrc) + WorkerMsg(tMsgID.Err, "P_Loss(axle)=" & P_Loss & " [kW]", MsgSrc) + Return False + End If + + M_in += dM + Loop + + + nU += dnU + Loop + + If Anz = 0 Then + WorkerMsg(tMsgID.Err, "Failed to calculate approx. transmission losses!", MsgSrc) + Return False + End If + + GetrEff(i) = EffSum / Anz - Select Case gs_Type - Case tGearbox.Manual - If gs_ShiftInside Then - WorkerMsg(tMsgID.Err, "Option 'Shift-Up inside polygons' is not available for Manual Transmissions!", MsgSrc) - gserror = True - End If - If TCon Then - WorkerMsg(tMsgID.Err, "Torque Converter is not available for Manual Transmissions!", MsgSrc) - gserror = True End If - Case tGearbox.SemiAutomatic - If TCon Then - WorkerMsg(tMsgID.Err, "Torque Converter is not available for Automated Manual Transmissions!", MsgSrc) - gserror = True + End If + + + End If + + Next + + If Not GetrEffDef(0) Then + GetrEff(0) = EffDiffSum / AnzDiff + End If + + + Return True + + End Function + + Public Function IntpolPeLoss(ByVal Gear As Integer, ByVal nU As Double, ByVal PeOut As Double, ByVal Approx As Boolean) As Double + + Dim PeIn As Double + Dim WG As Double + Dim GBmap As cDelaunayMap + Dim i As Integer + Dim Ab As Double + Dim AbMin As Double + Dim iMin As Integer + Dim PeOutX As Double + Dim GrTxt As String + Dim Ploss As Single + + Dim MsgSrc As String + + MsgSrc = "VEH/TrLossMapInterpol/G" & Gear + + If Gear = 0 Then + GrTxt = "A" + Else + GrTxt = Gear.ToString + End If + + If GetrEffDef(Gear) Or (Approx AndAlso GetrEff(Gear) > 0) Then + + If PeOut > 0 Then + PeIn = PeOut / GetrEff(Gear) + Else + PeIn = PeOut * GetrEff(Gear) + End If + Ploss = PeIn - PeOut + + Else + + GBmap = MyGBmaps(Gear) + + Try + 'Interpolate with Original Values + PeIn = nMtoPe(nU, GBmap.Intpol(nU, nPeToM(nU, PeOut))) + Ploss = PeIn - PeOut + + Catch ex As Exception + + 'If error: try extrapolation + + 'Search for the nearest Map point + AbMin = ((GBmap.ptList(0).X - nU) ^ 2 + (GBmap.ptList(0).Y - nPeToM(nU, PeOut)) ^ 2) ^ 0.5 + iMin = 0 + For i = 1 To GBmap.ptDim + Ab = ((GBmap.ptList(i).X - nU) ^ 2 + (GBmap.ptList(i).Y - nPeToM(nU, PeOut)) ^ 2) ^ 0.5 + If Ab < AbMin Then + AbMin = Ab + iMin = i End If + Next + + PeOutX = nMtoPe(nU, GBmap.ptList(iMin).Y) + PeIn = nMtoPe(nU, GBmap.ptList(iMin).Z) + + 'Efficiency + If PeOutX > 0 Then + If PeIn > 0 Then + + WG = PeOutX / PeIn + PeIn = PeOut / WG + Ploss = PeIn - PeOut + + Else + + 'Drag => Drive: ERROR! + WorkerMsg(tMsgID.Err, "Transmission Loss Map invalid! Gear= " & GrTxt & ", nU= " & nU.ToString("0.00") & " [1/min], PeIn=" & PeIn.ToString("0.0") & " [kW], PeOut=" & PeOutX.ToString("0.0") & " [kW]", MsgSrc) + WorkerAbort() + Return 0 - Case tGearbox.Automatic - If gs_ShiftInside Then - WorkerMsg(tMsgID.Err, "Option 'Shift-Up inside polygons' is not available for Automatic Transmissions!", MsgSrc) - gserror = True End If - If gs_SkipGears Then - WorkerMsg(tMsgID.Err, "Option 'Skip gears' is not available for Automatic Transmissions!", MsgSrc) - gserror = True + + ElseIf PeOutX < 0 Then + + If PeIn > 0 Then + + WG = (PeIn - (PeIn - PeOutX)) / PeIn + PeIn = PeOut / WG + Ploss = PeIn - PeOut + + ElseIf PeIn < 0 Then + + WG = PeIn / PeOutX + PeIn = PeOut * WG + Ploss = PeIn - PeOut + + Else + + Ploss = Math.Abs(PeOut) + End If - If Not TCon Then - WorkerMsg(tMsgID.Err, "Torque Converter must be activated for Automatic Transmissions!", MsgSrc) - gserror = True + + + Else + + If PeIn > 0 Then + + Ploss = PeIn + + ElseIf PeIn < 0 Then + + 'Drag => Zero: ERROR! + WorkerMsg(tMsgID.Err, "Transmission Loss Map invalid! Gear= " & GrTxt & ", nU= " & nU.ToString("0.00") & " [1/min], PeIn=" & PeIn.ToString("0.0") & " [kW], PeOut=" & PeOutX.ToString("0.0") & " [kW]", MsgSrc) + WorkerAbort() + Return 0 + Else + + Ploss = Math.Abs(PeOut) + End If - End Select + End If - If gserror Then Return False + MODdata.ModErrors.TrLossMapExtr = "Gear= " & GrTxt & ", nU= " & nU.ToString("0.00") & " [1/min], MeOut=" & nPeToM(nU, PeOut).ToString("0.00") & " [Nm]" - End If + End Try - 'Check if file exists - If Not IO.File.Exists(gs_file.FullPath) Then - WorkerMsg(tMsgID.Err, "Gear Shift Polygon File not found! '" & gs_file.FullPath & "'", MsgSrc) - Return False End If - 'Init file instance - file = New cFile_V3 + Return Math.Max(Ploss, 0) - 'Open file - If Not file.OpenRead(gs_file.FullPath) Then - WorkerMsg(tMsgID.Err, "Failed to load Gear Shift Polygon File! '" & gs_file.FullPath & "'", MsgSrc) - Return False - End If - 'Clear lists - gs_Mup.Clear() - gs_Mdown.Clear() - gs_nUdown.Clear() - gs_nUup.Clear() - gs_Dup = -1 + End Function - 'Read file - Try - Do While Not file.EndOfFile - line = file.ReadLine - gs_Dup += 1 - gs_Mup.Add(CSng(line(0))) - gs_Mdown.Add(CSng(line(0))) - gs_nUdown.Add(CSng(line(1))) - gs_nUup.Add(CSng(line(2))) - Loop - Catch ex As Exception - WorkerMsg(tMsgID.Err, "Error while reading Gear Shift Polygon File! (" & ex.Message & ")", MsgSrc) - Return False - End Try + Public Function IntpolPeLossFwd(ByVal Gear As Integer, ByVal nU As Double, ByVal PeIn As Double, ByVal Approx As Boolean) As Double - 'Check if more then one point - If gs_Dup < 1 Then - WorkerMsg(tMsgID.Err, "More points in Gear Shift Polygon File needed!", MsgSrc) - Return False + Dim PeOut As Double + Dim WG As Double + Dim GBmap As cDelaunayMap + Dim i As Integer + Dim Ab As Double + Dim AbMin As Double + Dim iMin As Integer + Dim PeInX As Double + Dim GrTxt As String + + Dim MsgSrc As String + + MsgSrc = "VEH/TrLossMapInterpolFwd/G" & Gear + + If Gear = 0 Then + GrTxt = "A" + Else + GrTxt = Gear.ToString End If - gs_Ddown = gs_Dup + If GetrEffDef(Gear) Or (Approx AndAlso GetrEff(Gear) > 0) Then - Return True + If PeIn > 0 Then + PeOut = PeIn * GetrEff(Gear) + Else + PeOut = PeIn / GetrEff(Gear) + End If - End Function + Else - Public Sub SetGenericShiftPoly() + GBmap = MyGBmaps(Gear) - Dim Tmax As Single + Try + 'Interpolate with original values + PeOut = nMtoPe(nU, GBmap.IntpolXZ(nU, nPeToM(nU, PeIn))) - 'Clear lists - gs_Mup.Clear() - gs_Mdown.Clear() - gs_nUdown.Clear() - gs_nUup.Clear() + Catch ex As Exception - Tmax = FLD(FLD.Count - 1).Tmax + 'If error: try extrapolation - gs_nUdown.Add(ENG.Nidle) - gs_nUdown.Add(ENG.Nidle) - gs_nUdown.Add((ENG.Npref + ENG.Nlo) / 2) + 'Search for the nearest Map-point + AbMin = ((GBmap.ptList(0).X - nU) ^ 2 + (GBmap.ptList(0).Z - nPeToM(nU, PeIn)) ^ 2) ^ 0.5 + iMin = 0 + For i = 1 To GBmap.ptDim + Ab = ((GBmap.ptList(i).X - nU) ^ 2 + (GBmap.ptList(i).Z - nPeToM(nU, PeIn)) ^ 2) ^ 0.5 + If Ab < AbMin Then + AbMin = Ab + iMin = i + End If + Next - gs_Mdown.Add(0) - gs_Mdown.Add(Tmax * ENG.Nidle / (ENG.Npref + ENG.Nlo - ENG.Nidle)) - gs_Mdown.Add(Tmax) + PeInX = nMtoPe(nU, GBmap.ptList(iMin).Z) + PeOut = nMtoPe(nU, GBmap.ptList(iMin).Y) - gs_nUup.Add(ENG.Npref) - gs_nUup.Add(ENG.Npref) - gs_nUup.Add(ENG.N95h) + 'Efficiency + If PeOut > 0 Then + If PeInX > 0 Then - gs_Mup.Add(0) - gs_Mup.Add(Tmax * (ENG.Npref - ENG.Nidle) / (ENG.N95h - ENG.Nidle)) - gs_Mup.Add(Tmax) + 'Drivetrain => Drivetrain + WG = PeOut / PeInX - gs_Ddown = 2 - gs_Dup = 2 + Else - End Sub + 'Drag => Drivetrain: ERROR! + WorkerMsg(tMsgID.Err, "Transmission Loss Map invalid! Gear= " & GrTxt & ", nU= " & nU.ToString("0.00") & " [1/min], PeIn=" & PeInX.ToString("0.00") & " [kW], PeOut=" & PeOut.ToString("0.00") & " [kW] (fwd)", MsgSrc) + WorkerAbort() + Return 0 - Public Function fGSnUdown(ByVal Md As Single) As Single - Dim i As Int32 + End If - 'Extrapolation for x < x(1) - If gs_Mdown(0) >= Md Then - i = 1 - GoTo lbInt - End If + Else + If PeInX > 0 Then - i = 0 - Do While gs_Mdown(i) < Md And i < gs_Ddown - i += 1 - Loop + WorkerMsg(tMsgID.Warn, "Change of sign in Transmission Loss Map! Set efficiency to 10%. Gear= " & GrTxt & ", nU= " & nU.ToString("0.00") & " [1/min], PeIn=" & PeInX.ToString("0.00") & " [kW], PeOut=" & PeOut.ToString("0.00") & " [kW] (fwd)", MsgSrc) + 'WorkerAbort() + WG = 0.1 + Else -lbInt: - 'Interpolation - Return (Md - gs_Mdown(i - 1)) * (gs_nUdown(i) - gs_nUdown(i - 1)) / (gs_Mdown(i) - gs_Mdown(i - 1)) + gs_nUdown(i - 1) + 'Drag => Drag + WG = PeInX / PeOut - End Function - Public Function fGSnUup(ByVal Md As Single) As Single - Dim i As Int32 + End If + End If - 'Extrapolation for x < x(1) - If gs_Mup(0) >= Md Then - i = 1 - GoTo lbInt - End If + 'Calculate efficiency with PeIn for original PeOut + PeOut = PeIn * WG - i = 0 - Do While gs_Mup(i) < Md And i < gs_Dup - i += 1 - Loop + MODdata.ModErrors.TrLossMapExtr = "Gear= " & GrTxt & ", nU= " & nU.ToString("0.00") & " [1/min], MeIn=" & nPeToM(nU, PeIn).ToString("0.00") & " [Nm] (fwd)" + End Try -lbInt: - 'Interpolation - Return (Md - gs_Mup(i - 1)) * (gs_nUup(i) - gs_nUup(i - 1)) / (gs_Mup(i) - gs_Mup(i - 1)) + gs_nUup(i - 1) + End If - End Function + Return Math.Max(PeIn - PeOut, 0) - Public Function GearCount() As Integer - Return GBX.GetrI.Count - 1 End Function + + +#End Region + Public ReadOnly Property FileList As List(Of String) Get Return MyFileList @@ -838,7 +1126,11 @@ lbInt: End Get Set(ByVal value As String) sFilePath = value - MyPath = IO.Path.GetDirectoryName(sFilePath) & "\" + If sFilePath = "" Then + MyPath = "" + Else + MyPath = IO.Path.GetDirectoryName(sFilePath) & "\" + End If End Set End Property @@ -855,19 +1147,21 @@ lbInt: End Set End Property - Public Property gsFile(Optional ByVal Original As Boolean = False) As String + Public Property gsFile(ByVal x As Short, Optional ByVal Original As Boolean = False) As String Get If Original Then - Return gs_file.OriginalPath + Return gs_files(x).OriginalPath Else - Return gs_file.FullPath + Return gs_files(x).FullPath End If End Get Set(value As String) - gs_file.Init(MyPath, value) + gs_files(x).Init(MyPath, value) End Set End Property + + Public Property TCfile(Optional ByVal Original As Boolean = False) As String Get If Original Then @@ -881,31 +1175,163 @@ lbInt: End Set End Property - Public Function GearboxConv(ByVal Gearbox As tGearbox) As String - Select Case Gearbox - Case tGearbox.Manual - Return "MT" - Case tGearbox.Automatic - Return "AT" - Case tGearbox.SemiAutomatic - Return "AMT" - Case Else 'tGearbox.Custom - Return "Custom" - End Select - End Function - Public Function GearboxConv(ByVal Gearbox As String) As tGearbox - Select Case UCase(Trim(Gearbox)) - Case "MT" - Return tGearbox.Manual - Case "AT" - Return tGearbox.Automatic - Case "AMT" - Return tGearbox.SemiAutomatic - Case Else '"Custom" - Return tGearbox.Custom - End Select - End Function + Public Class cShiftPolygon + + Private Filepath As String + Public MyGear As Integer + + Public gs_Mup As New List(Of Single) + Public gs_Mdown As New List(Of Single) + Public gs_nUup As New List(Of Single) + Public gs_nUdown As New List(Of Single) + Private gs_Dup As Integer = -1 + Private gs_Ddown As Integer = -1 + + Public Sub New(ByVal Path As String, ByVal Gear As Integer) + Filepath = Path + MyGear = Gear + End Sub + + Public Function ReadFile() As Boolean + Dim file As cFile_V3 + Dim line As String() + + Dim MsgSrc As String + + MsgSrc = "GBX/GSinit/ShiftPolygon.Init" + + 'Check if file exists + If Not IO.File.Exists(Filepath) Then + WorkerMsg(tMsgID.Err, "Gear Shift Polygon File not found! '" & Filepath & "'", MsgSrc) + Return False + End If + + 'Init file instance + file = New cFile_V3 + + 'Open file + If Not file.OpenRead(Filepath) Then + WorkerMsg(tMsgID.Err, "Failed to load Gear Shift Polygon File! '" & Filepath & "'", MsgSrc) + Return False + End If + + 'Clear lists + gs_Mup.Clear() + gs_Mdown.Clear() + gs_nUdown.Clear() + gs_nUup.Clear() + gs_Dup = -1 + + 'Read file + Try + Do While Not file.EndOfFile + line = file.ReadLine + gs_Dup += 1 + gs_Mup.Add(CSng(line(0))) + gs_Mdown.Add(CSng(line(0))) + gs_nUdown.Add(CSng(line(1))) + gs_nUup.Add(CSng(line(2))) + Loop + Catch ex As Exception + WorkerMsg(tMsgID.Err, "Error while reading Gear Shift Polygon File! (" & ex.Message & ")", MsgSrc) + Return False + End Try + + 'Check if more then one point + If gs_Dup < 1 Then + WorkerMsg(tMsgID.Err, "More points in Gear Shift Polygon File needed!", MsgSrc) + Return False + End If + + gs_Ddown = gs_Dup + + Return True + + End Function + + + Public Sub SetGenericShiftPoly(Optional ByRef fld0 As cFLD = Nothing, Optional ByVal nidle As Single = -1) + Dim Tmax As Single + + 'Clear lists + gs_Mup.Clear() + gs_Mdown.Clear() + gs_nUdown.Clear() + gs_nUup.Clear() + + If fld0 Is Nothing Then fld0 = FLD(MyGear) + If nidle < 0 Then nidle = ENG.Nidle + + Tmax = fld0.Tmax + + gs_nUdown.Add(nidle) + gs_nUdown.Add(nidle) + gs_nUdown.Add((fld0.Npref + fld0.Nlo) / 2) + + gs_Mdown.Add(0) + gs_Mdown.Add(Tmax * nidle / (fld0.Npref + fld0.Nlo - nidle)) + gs_Mdown.Add(Tmax) + + gs_nUup.Add(fld0.Npref) + gs_nUup.Add(fld0.Npref) + gs_nUup.Add(fld0.N95h) + + gs_Mup.Add(0) + gs_Mup.Add(Tmax * (fld0.Npref - nidle) / (fld0.N95h - nidle)) + gs_Mup.Add(Tmax) + + gs_Ddown = 2 + gs_Dup = 2 + + End Sub + + Public Function fGSnUdown(ByVal Md As Single) As Single + Dim i As Int32 + + 'Extrapolation for x < x(1) + If gs_Mdown(0) >= Md Then + i = 1 + GoTo lbInt + End If + + i = 0 + Do While gs_Mdown(i) < Md And i < gs_Ddown + i += 1 + Loop + + +lbInt: + 'Interpolation + Return (Md - gs_Mdown(i - 1)) * (gs_nUdown(i) - gs_nUdown(i - 1)) / (gs_Mdown(i) - gs_Mdown(i - 1)) + gs_nUdown(i - 1) + + End Function + + Public Function fGSnUup(ByVal Md As Single) As Single + Dim i As Int32 + + 'Extrapolation for x < x(1) + If gs_Mup(0) >= Md Then + i = 1 + GoTo lbInt + End If + + i = 0 + Do While gs_Mup(i) < Md And i < gs_Dup + i += 1 + Loop + + +lbInt: + 'Interpolation + Return (Md - gs_Mup(i - 1)) * (gs_nUup(i) - gs_nUup(i - 1)) / (gs_Mup(i) - gs_Mup(i - 1)) + gs_nUup(i - 1) + + End Function + + + + End Class + End Class diff --git a/VECTO/Input Files/cMAP.vb b/VECTO/Input Files/cMAP.vb index 776f5f9f6be63825aa221b9ca418b250a188f0fd..e1bfed730e604ea762e5a8e2bb1015a477107ec4 100644 --- a/VECTO/Input Files/cMAP.vb +++ b/VECTO/Input Files/cMAP.vb @@ -2,31 +2,24 @@ Public Class cMAP - 'Private Const FormatVersion As Integer = 1 - 'Private FileVersion As Integer - - Public lFC As List(Of Single) - - Public LPe As List(Of Single) - Public LnU As List(Of Single) + Private LnU As List(Of Single) + Private LTq As List(Of Single) + Private lFC As List(Of Single) Private sFilePath As String Private iMapDim As Integer - Private MapIntp As cMapInterpol - Private FuelMap As cDelaunayMap Private Sub ResetMe() - MapIntp = Nothing lFC = Nothing - LPe = Nothing + LTq = Nothing LnU = Nothing iMapDim = -1 FuelMap = New cDelaunayMap End Sub - Public Function ReadFile(Optional ByVal MsgOutput As Boolean = True) As Boolean + Public Function ReadFile(Optional ByVal ShowMsg As Boolean = True) As Boolean Dim file As cFile_V3 Dim line As String() Dim nU As Double @@ -40,7 +33,7 @@ Public Class cMAP 'Stop if there's no file If sFilePath = "" OrElse Not IO.File.Exists(sFilePath) Then - WorkerMsg(tMsgID.Err, "Map file not found! (" & sFilePath & ")", MsgSrc) + If ShowMsg Then WorkerMsg(tMsgID.Err, "Map file not found! (" & sFilePath & ")", MsgSrc) Return False End If @@ -48,13 +41,13 @@ Public Class cMAP file = New cFile_V3 If Not file.OpenRead(sFilePath) Then file = Nothing - WorkerMsg(tMsgID.Err, "Failed to open file (" & sFilePath & ") !", MsgSrc) + If ShowMsg Then WorkerMsg(tMsgID.Err, "Failed to open file (" & sFilePath & ") !", MsgSrc) Return False End If 'Initi Lists (before version check so ReadOldFormat works) lFC = New System.Collections.Generic.List(Of Single) - LPe = New System.Collections.Generic.List(Of Single) + LTq = New System.Collections.Generic.List(Of Single) LnU = New System.Collections.Generic.List(Of Single) Try @@ -72,13 +65,13 @@ Public Class cMAP LnU.Add(nU) 'Power - LPe.Add(nMtoPe(nU, CDbl(line(1)))) + LTq.Add(line(1)) 'FC 'Check sign If CSng(line(2)) < 0 Then file.Close() - WorkerMsg(tMsgID.Err, "FC < 0 in map at " & nU & " [1/min], " & line(1) & " [Nm]", MsgSrc) + If ShowMsg Then WorkerMsg(tMsgID.Err, "FC < 0 in map at " & nU & " [1/min], " & line(1) & " [Nm]", MsgSrc) Return False End If @@ -88,14 +81,11 @@ Public Class cMAP Loop Catch ex As Exception - WorkerMsg(tMsgID.Err, "Error during file input! Line number " & iMapDim + 1 & " (" & sFilePath & ")", MsgSrc, sFilePath) + If ShowMsg Then WorkerMsg(tMsgID.Err, "Error during file input! Line number " & iMapDim + 1 & " (" & sFilePath & ")", MsgSrc, sFilePath) GoTo lbEr End Try - 'Shep-Init - MapIntp = New cMapInterpol(Me) - 'Close file file.Close() @@ -113,7 +103,7 @@ lbEr: End Function - Public Sub Norm() + Public Function Triangulate() As Boolean Dim i As Integer Dim MsgSrc As String @@ -122,59 +112,23 @@ lbEr: 'FC Delauney For i = 0 To iMapDim - FuelMap.AddPoints(LnU(i), LPe(i), lFC(i)) + FuelMap.AddPoints(LnU(i), LTq(i), lFC(i)) Next - FuelMap.Triangulate() + Return FuelMap.Triangulate() - End Sub + End Function - Public Function fFCdelaunay_Intp(ByVal nU As Single, ByVal Pe As Single) As Single + Public Function fFCdelaunay_Intp(ByVal nU As Single, ByVal Tq As Single) As Single Try - Return FuelMap.Intpol(nU, Pe) + Return FuelMap.Intpol(nU, Tq) Catch ex As Exception - WorkerMsg(tMsgID.Err, "Cannot extrapolate FC map! n= " & nU.ToString("0") & " [1/min], Me= " & nPeToM(nU, Pe).ToString("0.0") & " [Nm]", "MAP/FC_Intp") + WorkerMsg(tMsgID.Err, "Cannot extrapolate FC map! n= " & nU.ToString("0.0") & " [1/min], Me= " & Tq.ToString("0.0") & " [Nm]", "MAP/FC_Intp") Return -10000 End Try End Function - 'Default Shepard in intpshep () - Private Class cMapInterpol - - Private iMapDim As Integer - Private Pe0 As Single - Private n0 As Single - Private myMap As cMAP - Private PeDrag As Single - - 'Interpolator V1 - Private abOK As Boolean() 'Array für alle Punkte (iMapDim) - Private ab As Double() 'Array für ausgewählte Punkte (inim) - Private wisum As Double - Private PeIntp As Single - - 'Interpolator V2 - Private abOKV2 As Boolean() 'Array für alle Punkte (iMapDim) - Private abV2 As Double() 'Array für ausgewählte Punkte (inim) - Private wisumV2 As Double - Private PeIntpV2 As Single - - Public Sub New(ByRef MapClass As cMAP) - myMap = MapClass - iMapDim = MapClass.iMapDim - End Sub - - Public Sub CleanUp() - myMap = Nothing - End Sub - - - End Class - - - - #Region "Properties" Public Property FilePath() As String @@ -186,6 +140,30 @@ lbEr: End Set End Property + Public ReadOnly Property MapDim As Integer + Get + Return iMapDim + End Get + End Property + + Public ReadOnly Property Tq As List(Of Single) + Get + Return LTq + End Get + End Property + + Public ReadOnly Property FC As List(Of Single) + Get + Return lFC + End Get + End Property + + Public ReadOnly Property nU As List(Of Single) + Get + Return LnU + End Get + End Property + #End Region diff --git a/VECTO/Input Files/cVECTO.vb b/VECTO/Input Files/cVECTO.vb index ad73d3d2b305c08f162f66e4385c94d558e8a17f..340dfc7ec53416319a842452a66bac49d60889fc 100644 --- a/VECTO/Input Files/cVECTO.vb +++ b/VECTO/Input Files/cVECTO.vb @@ -2,8 +2,8 @@ Public Class cVECTO - Private Const FormatVersion As String = "1.0" - Private FileVersion As String + Private Const FormatVersion As Short = 1 + Private FileVersion As Short Private sFilePath As String @@ -28,7 +28,7 @@ Public Class cVECTO Public AuxPaths As Dictionary(Of String, cAuxEntry) Public AuxRefs As Dictionary(Of String, cAux) 'Alle Nebenverbraucher die in der Veh-Datei UND im Zyklus definiert sind Public AuxDef As Boolean 'True wenn ein oder mehrere Nebenverbraucher definiert sind - + Public EStechs As List(Of String) Public CycleFiles As List(Of cSubPath) @@ -51,6 +51,7 @@ Public Class cVECTO Public Class cAuxEntry Public Type As String Public Path As cSubPath + Public TechStr As String = "" Public Sub New() Path = New cSubPath End Sub @@ -95,7 +96,7 @@ Public Class cVECTO Next 'Aux - If AuxDef Then + If AuxDef And Not Cfg.DeclMode Then For Each Aux0 In Me.AuxPaths.Values MyFileList.Add(Aux0.Path.FullPath) Next @@ -134,6 +135,7 @@ Public Class cVECTO AuxPaths = New Dictionary(Of String, cAuxEntry) AuxRefs = New Dictionary(Of String, cAux) AuxDef = False + EStechs = New List(Of String) CycleFiles = New List(Of cSubPath) @@ -162,84 +164,6 @@ Public Class cVECTO Return False End If - ''*** - ''*** First line: Version - 'line = file.ReadLine - 'txt = Trim(UCase(line(0))) - 'If Microsoft.VisualBasic.Left(txt, 1) = "V" Then - ' ' "V" entfernen => Zahl bleibt übrig - ' txt = txt.Replace("V", "") - ' If Not IsNumeric(txt) Then - ' 'Falls Version ungültig: Abbruch - ' GoTo lbEr - ' Else - ' 'Version festgelegt - ' FileVersion = CInt(txt) - ' End If - 'Else - ' file.Close() - ' Return ReadOldFormat() - 'End If - - ''Version Check: abort if Input-file's format is newer than PHEM-version - 'If FileVersion > FormatVersion Then - ' WorkerMsg(tMsgID.Err, "File Version not supported!", MsgSrc) - ' GoTo lbEr - 'End If - - '**** GEN Datei einlesen **** |@@| Read GEN file **** - - 'Allgemein |@@| Common - 'boPKWja = CBool(file.ReadLine(0)) - 'bodynkorja = CBool(file.ReadLine(0)) - 'ineklasse = CShort(file.ReadLine(0)) - 'inizykwael = CShort(file.ReadLine(0)) - - 'line = file.ReadLine - 'If UBound(line) < 2 Then - ' WorkerMsg(tMsgID.Err, "File Format invalid (" & sFilePath & ")!", MsgSrc) - ' GoTo lbEr - 'End If - - 'Select Case CShort(line(0)) - ' Case 0 - ' VehMode = tVehMode.StandardMode - ' Case 1 - ' VehMode = tVehMode.EngineOnly - ' Case 2 - ' VehMode = tVehMode.HEV - ' Case Else '3 - ' VehMode = tVehMode.EV - 'End Select - - 'EngAnalysis = CBool(line(1)) - 'CreateMap = CBool(line(2)) - 'ModeHorEV = (VehMode = tVehMode.HEV Or VehMode = tVehMode.EV) - - - 'KF creation - 'line = file.ReadLine - 'inPschrit = CShort(line(0)) - 'innschrit = CShort(line(1)) - - 'line = file.ReadLine - 'bKFcutFull = CBool(line(0)) - 'bKFcutDrag = CBool(line(1)) - 'bKFinsertDrag = CBool(line(2)) - 'bKFDragIntp = CBool(line(3)) - - 'boMapSchaltja = CBool(file.ReadLine(0)) - - 'iniMsek = CShort(file.ReadLine(0)) - - 'boottoJa = CBool(file.ReadLine(0)) - - 'bokaltst1 = CBool(file.ReadLine(0)) - - 'sitkat1 = CSng(file.ReadLine(0)) - 'sitkw1 = CSng(file.ReadLine(0)) - 'sihsstart = CSng(file.ReadLine(0)) - stPathVEH.Init(MyPath, file.ReadLine(0)) stPathENG.Init(MyPath, file.ReadLine(0)) @@ -433,6 +357,12 @@ lbEr: dic.Add("ID", Trim(UCase(AuxEntryKV.Key))) dic.Add("Type", AuxEntryKV.Value.Type) dic.Add("Path", AuxEntryKV.Value.Path.PathOrDummy) + dic.Add("Technology", AuxEntryKV.Value.TechStr) + + If AuxEntryKV.Key = sKey.AUX.ElecSys Then + dic.Add("TechList", EStechs) + End If + ls.Add(dic) Next dic0.Add("Aux", ls) @@ -538,10 +468,20 @@ lbEr: AuxEntry.Type = dic("Type") AuxEntry.Path.Init(MyPath, dic("Path")) + If Not dic("Technology") Is Nothing Then AuxEntry.TechStr = dic("Technology") + AuxPaths.Add(AuxID, AuxEntry) AuxDef = True + If AuxID = sKey.AUX.ElecSys Then + If Not dic("TechList") Is Nothing Then + For Each str In dic("TechList") + EStechs.Add(str) + Next + End If + End If + Next End If @@ -631,6 +571,7 @@ lbEr: AuxPaths.Clear() AuxRefs.Clear() AuxDef = False + EStechs.Clear() EngOnly = False @@ -645,10 +586,14 @@ lbEr: End Sub - Public Sub DeclInit() + Public Function DeclInit() As Boolean + Dim cl As List(Of String) Dim s As String Dim SubPath As cSubPath + Dim MsgSrc As String + + MsgSrc = "VECTO/DeclInit" EngOnly = False @@ -670,16 +615,19 @@ lbEr: If Not EcoRollOn Then OverSpeedOn = True + OverSpeed = cDeclaration.Overspeed + UnderSpeed = cDeclaration.Underspeed + vMin = cDeclaration.ECvmin + LookAheadOn = True a_lookahead = cDeclaration.LACa vMinLA = cDeclaration.LACvmin - 'TODO: Aux - AuxDef = False 'TEST ONLY!!! - + 'No need to check Aux (AuxDef). Will be checked in cDeclaration.CalcInitLoad + Return True - End Sub + End Function 'This Sub reads those Input-files that do not have their own class, etc. Public Function Init() As Boolean @@ -688,7 +636,7 @@ lbEr: Dim MsgSrc As String - MsgSrc = "GEN/Init" + MsgSrc = "VECTO/Init" If Not EngOnly Then @@ -748,6 +696,17 @@ lbEr: AuxRefs = New Dictionary(Of String, cAux) + If Cfg.DeclMode Then + + For Each AuxPathKV In AuxPaths + AuxRefs.Add(AuxPathKV.Key, Nothing) + Next + + Return True + + End If + + If DRI.AuxDef Xor AuxDef Then If AuxDef Then @@ -809,6 +768,8 @@ lbEr: MsgSrc = "VEH/Paux" + If Cfg.DeclMode Then Return Declaration.AuxPower(AuxID) + If AuxDef Then Aux0 = AuxRefs(AuxID) @@ -883,7 +844,11 @@ lbAuxError: End Get Set(ByVal value As String) sFilePath = value - MyPath = IO.Path.GetDirectoryName(sFilePath) & "\" + If sFilePath = "" Then + MyPath = "" + Else + MyPath = IO.Path.GetDirectoryName(sFilePath) & "\" + End If End Set End Property diff --git a/VECTO/Input Files/cVEH.vb b/VECTO/Input Files/cVEH.vb index b4b78209cb6fa7c2325ad8fc8e813c93fdbeb5b6..601464a17fc93ca01e75778b4d32b1f593e244bc 100644 --- a/VECTO/Input Files/cVEH.vb +++ b/VECTO/Input Files/cVEH.vb @@ -2,19 +2,16 @@ Public Class cVEH - 'V1.1 MassMax is now saved in [t] instead of [kg] - - Private Const FormatVersion As String = "1.1" - Private FileVersion As String + 'V2 MassMax is now saved in [t] instead of [kg] + Private Const FormatVersion As Short = 3 + Private FileVersion As Short Private sFilePath As String Private MyPath As String Public Mass As Single Public Loading As Single - Private siI_wheels As Single - Private siFr0 As Single '<= wird aus Achs-RRC-Werten berechnet - Private siDreifen As Single + Private siFr0 As Single Public Cd0Tr As Single Public Aquers0Tr As Single @@ -25,19 +22,12 @@ Public Class cVEH Private Cd0Act As Single Private AquersAct 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 siGetrI As List(Of Single) - Public GetrMap As List(Of cSubPath) - Private MyGBmaps As List(Of cDelaunayMap) - Public GetrEffDef As List(Of Boolean) - Public GetrEff As List(Of Single) - Public RtType As tRtType '0=None, 1=Primary, 2=Secondary Public RtRatio As Single = 0 Public RtFile As cSubPath @@ -45,7 +35,11 @@ Public Class cVEH Private RtnU As List(Of Single) Private RtM As List(Of Single) - Public RRCs As List(Of Single()) + Public rdyn As Single + Public Axles As List(Of cAxle) + Public Rim As String + Private m_red0 As Single + Public VehCat As tVehCat Public MassExtra As Single Public MassMax As Single @@ -55,7 +49,14 @@ Public Class cVEH Private MyFileList As List(Of String) - + 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 @@ -84,7 +85,7 @@ Public Class cVEH RtFile = New cSubPath RtnU = New List(Of Single) RtM = New List(Of Single) - RRCs = New List(Of Single()) + Axles = New List(Of cAxle) SetDefault() End Sub @@ -103,32 +104,28 @@ Public Class cVEH CdX.Clear() CdY.Clear() CdDim = -1 - siI_wheels = 0 siFr0 = 0 - siDreifen = 0 - - siGetrI = New List(Of Single) - GetrEffDef = New List(Of Boolean) - GetrEff = New List(Of Single) - GetrMap = New List(Of cSubPath) + rdyn = 0 + Rim = "" - MyGBmaps = Nothing - RtType = tRtType.None RtRatio = 0 RtnU.Clear() RtM.Clear() RtFile.Clear() - RRCs.Clear() - VehCat = tVehCat.RigidTruck + Axles.Clear() + VehCat = tVehCat.Undef MassMax = 0 - AxleConf = tAxleConf.a4x2 + AxleConf = tAxleConf.Undef + End Sub - Private Function ReadFileOld() As Boolean + Private Function ReadFileOld(ByVal ShowMsg As Boolean) As Boolean Dim file As cFile_V3 Dim line() As String + Dim Itemp As Single + Dim a0 As cAxle Dim MsgSrc As String MsgSrc = "VEH/ReadFile" @@ -136,14 +133,14 @@ Public Class cVEH SetDefault() If sFilePath = "" Or Not IO.File.Exists(sFilePath) Then - WorkerMsg(tMsgID.Err, "Vehicle file not found (" & sFilePath & ") !", MsgSrc) + If ShowMsg Then WorkerMsg(tMsgID.Err, "Vehicle file not found (" & sFilePath & ") !", MsgSrc) Return False End If file = New cFile_V3 If Not file.OpenRead(sFilePath) Then - WorkerMsg(tMsgID.Err, "Failed to open file (" & sFilePath & ") !", MsgSrc) + If ShowMsg Then WorkerMsg(tMsgID.Err, "Failed to open file (" & sFilePath & ") !", MsgSrc) file = Nothing Return False End If @@ -158,8 +155,9 @@ Public Class cVEH Cd0Act = Cd0Tr AquersAct = Aquers0Tr - siI_wheels = CSng(file.ReadLine(0)) - siDreifen = CSng(file.ReadLine(0)) + Itemp = CSng(file.ReadLine(0)) + rdyn = 1000 * CSng(file.ReadLine(0)) / 2 + Rim = "-" If file.EndOfFile Then GoTo lbError @@ -169,7 +167,7 @@ Public Class cVEH CdMode = CType(CInt(line(0)), tCdMode) CdFile.Init(MyPath, line(1)) Catch ex As Exception - WorkerMsg(tMsgID.Err, ex.Message, MsgSrc) + If ShowMsg Then WorkerMsg(tMsgID.Err, ex.Message, MsgSrc) file.Close() Return False End Try @@ -182,7 +180,7 @@ Public Class cVEH RtRatio = CSng(file.ReadLine(0)) RtFile.Init(MyPath, file.ReadLine(0)) Catch ex As Exception - WorkerMsg(tMsgID.Err, ex.Message, MsgSrc) + If ShowMsg Then WorkerMsg(tMsgID.Err, ex.Message, MsgSrc) file.Close() Return False End Try @@ -194,21 +192,40 @@ Public Class cVEH If line(0) = sKey.Break Then Exit Do + a0 = New cAxle + + a0.Wheels = "-" + Try If UBound(line) > 2 Then - RRCs.Add(New Single() {CSng(line(0)), CSng(line(1)), CSng(line(2)), CSng(line(3))}) + a0.Share = CSng(line(0)) + a0.TwinTire = CBool(line(1)) + a0.RRC = CSng(line(2)) + a0.FzISO = CSng(line(3)) Else - RRCs.Add(New Single() {0.0, CSng(False), CSng(line(1)), 0.0}) + a0.Share = 0 + a0.TwinTire = False + a0.RRC = CSng(line(1)) + a0.FzISO = 0 End If Catch ex As Exception - WorkerMsg(tMsgID.Err, ex.Message, MsgSrc) + If ShowMsg Then WorkerMsg(tMsgID.Err, ex.Message, MsgSrc) file.Close() Return False End Try + Axles.Add(a0) Loop + 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 + If file.EndOfFile Then GoTo lbError Try @@ -217,7 +234,7 @@ Public Class cVEH MassMax = CSng(file.ReadLine(0)) / 1000 AxleConf = CType(CInt(file.ReadLine(0)), tAxleConf) Catch ex As Exception - WorkerMsg(tMsgID.Err, ex.Message, MsgSrc) + If ShowMsg Then WorkerMsg(tMsgID.Err, ex.Message, MsgSrc) file.Close() Return False End Try @@ -230,12 +247,14 @@ Public Class cVEH lbError: file.Close() - WorkerMsg(tMsgID.Err, "Unexpected end of file!", MsgSrc) + If ShowMsg Then WorkerMsg(tMsgID.Err, "Unexpected end of file!", MsgSrc) Return False End Function - Public Function ReadFile() As Boolean + Public Function ReadFile(Optional ByVal ShowMsg As Boolean = True) As Boolean + Dim Itemp As Single + Dim a0 As cAxle Dim JSON As New cJSON Dim dic As Object @@ -252,7 +271,7 @@ lbError: If Not JSON.ReadFile(sFilePath) Then NoJSON = True Try - Return ReadFileOld() + Return ReadFileOld(ShowMsg) Catch ex As Exception Return False End Try @@ -266,7 +285,7 @@ lbError: MassExtra = JSON.Content("Body")("CurbWeightExtra") Loading = JSON.Content("Body")("Loading") MassMax = JSON.Content("Body")("MassMax") - If FileVersion = "1.0" Then MassMax /= 1000 + If FileVersion < 2 Then MassMax /= 1000 Cd0Tr = JSON.Content("Body")("Cd") Aquers0Tr = JSON.Content("Body")("CrossSecArea") @@ -277,8 +296,14 @@ lbError: Cd0Act = Cd0Tr AquersAct = Aquers0Tr - siI_wheels = JSON.Content("Body")("WheelsInertia") - siDreifen = JSON.Content("Body")("WheelsDiaEff") + 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")) @@ -291,15 +316,43 @@ lbError: 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") - RRCs.Add(New Single() {dic("AxleWeightShare"), CSng(dic("TwinTyres")), dic("RRCISO"), dic("FzISO")}) + + a0 = New cAxle + + If FileVersion < 3 Then + a0.Wheels = "-" + Else + a0.Inertia = CSng(dic("Inertia")) + a0.Wheels = CStr(dic("Wheels")) + 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) + Next - VehCat = ConvVehCat(JSON.Content("Body")("VehCat").ToString) + 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 - WorkerMsg(tMsgID.Err, "Failed to read Vehicle file! " & ex.Message, MsgSrc) + If ShowMsg Then WorkerMsg(tMsgID.Err, "Failed to read Vehicle file! " & ex.Message, MsgSrc) Return False End Try @@ -309,10 +362,82 @@ lbError: 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 cJSON + + + '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) + + dic.Add("VehCat", ConvVehCat(VehCat, False)) + + dic.Add("CurbWeight", Mass) + dic.Add("CurbWeightExtra", MassExtra) + dic.Add("Loading", Loading) + dic.Add("MassMax", MassMax) + + dic.Add("Cd", Cd0Tr) + dic.Add("CrossSecArea", Aquers0Tr) + + dic.Add("CdRigid", Cd0Rig) + dic.Add("CrossSecAreaRigid", Aquers0Rig) + + 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) + + 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 + + dic0 = New Dictionary(Of String, Object) + dic0.Add("Type", ConvAxleConf(AxleConf)) + dic0.Add("Axles", ls) + dic.Add("AxleConfig", dic0) + + JSON.Content.Add("Body", dic) + + Return JSON.WriteFile(sFilePath) + + + End Function + + Public Function DeclInit() As Boolean Dim al As List(Of Single) Dim i As Integer Dim a As Single + Dim a0 As cAxle Dim MissionID As tMission Dim MsgSrc As String @@ -325,20 +450,20 @@ lbError: al = Declaration.SegRef.AxleShares(MissionID) - If al.Count > RRCs.Count Then - WorkerMsg(tMsgID.Err, "Invalid number of axles! Defined: " & RRCs.Count & ", required: " & al.Count, MsgSrc) + If al.Count > Axles.Count Then + WorkerMsg(tMsgID.Err, "Invalid number of axles! Defined: " & Axles.Count & ", required: " & al.Count, MsgSrc) Return False End If i = -1 For Each a In al i += 1 - RRCs(i)(0) = a / 100 + Axles(i).Share = a / 100 Next 'Remove non-Truck axles - Do While RRCs.Count > al.Count - RRCs.RemoveAt(RRCs.Count - 1) + Do While Axles.Count > al.Count + Axles.RemoveAt(Axles.Count - 1) Loop @@ -346,10 +471,33 @@ lbError: If Not Declaration.SegRef.LongHaulRigidTrailer OrElse MissionID = tMission.LongHaul Then al = Declaration.SegRef.AxleSharesTr(MissionID) For Each a In al - RRCs.Add(New Single() {a / 100, 0, cDeclaration.RRCTr, cDeclaration.FzISOTr}) + + a0 = New cAxle + + a0.Inertia = 0 'Defined later + a0.Wheels = "385/65 R 22.5" + + a0.Share = a / 100 + a0.TwinTire = False + a0.RRC = cDeclaration.RRCTr + a0.FzISO = cDeclaration.FzISOTr + + Axles.Add(a0) + Next End If + 'Wheels Inertias + For Each a0 In Axles + a0.Inertia = Declaration.WheelsInertia(a0.Wheels) + + If a0.Inertia < 0 Then + WorkerMsg(tMsgID.Err, "Selected wheels (" & a0.Wheels & ") are not supported!", MsgSrc) + Return False + End If + + Next + CdMode = tCdMode.CdOfV @@ -378,6 +526,17 @@ lbError: End If + If Axles.Count < 2 Then + rdyn = -1 + Else + rdyn = Declaration.rdyn(Axles(1).Wheels, Rim) + End If + + If rdyn < 0 Then + WorkerMsg(tMsgID.Err, "Failed to calculate dynamic tire radius! Check wheels/rims", MsgSrc) + Return False + End If + Return True End Function @@ -424,90 +583,21 @@ lbError: End Function - Public Function SaveFile() As Boolean - Dim sl As Single() - Dim dic As Dictionary(Of String, Object) - Dim dic0 As Dictionary(Of String, Object) - Dim ls As List(Of Dictionary(Of String, Object)) - Dim JSON As New cJSON - - - '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) - - dic.Add("VehCat", ConvVehCat(VehCat)) - - dic.Add("CurbWeight", Mass) - dic.Add("CurbWeightExtra", MassExtra) - dic.Add("Loading", Loading) - dic.Add("MassMax", MassMax) - - dic.Add("Cd", Cd0Tr) - dic.Add("CrossSecArea", Aquers0Tr) - - dic.Add("CdRigid", Cd0Rig) - dic.Add("CrossSecAreaRigid", Aquers0Rig) - - dic.Add("WheelsInertia", siI_wheels) - dic.Add("WheelsDiaEff", siDreifen) - - 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) - - ls = New List(Of Dictionary(Of String, Object)) - For Each sl In RRCs - dic0 = New Dictionary(Of String, Object) - dic0.Add("AxleWeightShare", sl(0)) - dic0.Add("TwinTyres", CBool(sl(1))) - dic0.Add("RRCISO", sl(2)) - dic0.Add("FzISO", sl(3)) - ls.Add(dic0) - Next - - dic0 = New Dictionary(Of String, Object) - dic0.Add("Type", ConvAxleConf(AxleConf)) - dic0.Add("Axles", ls) - dic.Add("AxleConfig", dic0) - - JSON.Content.Add("Body", dic) - - Return JSON.WriteFile(sFilePath) - - - End Function - - Public Function VehmodeInit() As Boolean Dim MsgSrc As String - Dim sl As Single() + Dim a0 As cAxle Dim ShareSum As Double Dim RRC As Double Dim nrwheels As Single - - MsgSrc = "VEH/Init" 'Cd-Init If Not CdInit() Then Return False 'Transmission Loss Maps - If Not VEH.TrLossMapInit Then + If Not GBX.TrLossMapInit Then WorkerMsg(tMsgID.Err, "Failed to initialize Transmission Loss Maps!", MsgSrc) Return False End If @@ -516,15 +606,15 @@ lbError: If Not RtInit() Then Return False 'Fr0 - If RRCs.Count < 2 Then + If Axles.Count < 2 Then WorkerMsg(tMsgID.Err, "At least 2 axle configurations are required!", MsgSrc, "<GUI>" & sFilePath) Return False End If 'Check if sum=100% ShareSum = 0 - For Each sl In RRCs - ShareSum += sl(0) + For Each a0 In Axles + ShareSum += a0.Share Next If Math.Abs(ShareSum - 1) > 0.0001 Then @@ -533,459 +623,41 @@ lbError: End If RRC = 0 - For Each sl In RRCs + m_red0 = 0 + For Each a0 In Axles - If sl(2) < -0.000001 Then - WorkerMsg(tMsgID.Err, "Invalid RRC value! (" & sl(2) & ")", MsgSrc, "<GUI>" & sFilePath) + If a0.RRC < -0.000001 Then + WorkerMsg(tMsgID.Err, "Invalid RRC value! (" & a0.RRC & ")", MsgSrc, "<GUI>" & sFilePath) Return False End If - If sl(3) < 0.00001 Then - WorkerMsg(tMsgID.Err, "Invalid FzISO value! (" & sl(3) & ")", MsgSrc, "<GUI>" & sFilePath) + If a0.FzISO < 0.00001 Then + WorkerMsg(tMsgID.Err, "Invalid FzISO value! (" & a0.FzISO & ")", MsgSrc, "<GUI>" & sFilePath) Return False End If - If CBool(sl(1)) Then + If a0.TwinTire Then nrwheels = 4 Else nrwheels = 2 End If - RRC += sl(0) * (sl(2) * ((Loading + Mass + MassExtra) * sl(0) * 9.81 / (sl(3) * nrwheels)) ^ (0.9 - 1)) 'Beta=0.9 - Next - - siFr0 = RRC - - - - Return True - - End Function - - + RRC += a0.Share * (a0.RRC * ((Loading + Mass + MassExtra) * a0.Share * 9.81 / (a0.FzISO * nrwheels)) ^ (0.9 - 1)) 'Beta=0.9 -#Region "Transmission Loss Maps" - - Private Function TrLossMapInit() As Boolean - Dim i As Short - Dim GBmap0 As cDelaunayMap - 'Dim n_norm As Double - 'Dim Pe_norm As Double - Dim file As cFile_V3 - Dim path As String - Dim line As String() - Dim l As Integer - Dim nU As Double - Dim M_in As Double - Dim M_loss As Double - Dim M_out As Double - - Dim dnU As Single - Dim dM As Single - Dim P_In As Single - Dim P_Loss As Single - Dim EffSum As Single - Dim Anz As Integer - Dim EffDiffSum As Single = 0 - Dim AnzDiff As Integer = 0 - - Dim MinG As Single - Dim plossG As Single - - Dim MsgSrc As String - - MyGBmaps = New List(Of cDelaunayMap) - file = New cFile_V3 - - For i = 0 To GBX.GearCount - - MsgSrc = "VEH/TrLossMapInit/G" & i - - If GetrEffDef(i) Then - - If GetrEff(i) > 1 Or GetrEff(i) <= 0 Then - WorkerMsg(tMsgID.Err, "Gearboy efficiency '" & GetrEff(i) & "' invalid!", MsgSrc) - Return False - End If - - MyGBmaps.Add(Nothing) - - Else - - path = GetrMap(i).FullPath - - If Not file.OpenRead(path) Then - WorkerMsg(tMsgID.Err, "Cannot read file '" & path & "'!", MsgSrc) - MyGBmaps = Nothing - Return False - End If - - 'Transmission Nominal-Revolutions - 'n_norm = CSng(file.ReadLine(0)) - - 'Transmission Nominal-Power - 'Pe_norm = CSng(file.ReadLine(0)) - - 'If nothing specified: Engine's Nominal-power and Nominal-Revolutions from Normalized ones - 'If n_norm < 0.0001 Then - ' n_norm = sinNenn - ' Pe_norm = siPnenn - 'End If - - GBmap0 = New cDelaunayMap - GBmap0.DualMode = True - - l = 0 'Nur für Fehler-Ausgabe - Do While Not file.EndOfFile - l += 1 - line = file.ReadLine - Try - 'PHEM: n, PeIn, PeOut => x=n, y=PeOut, z=PeIn - 'PHEM: GBmap0.AddPoints(CDbl(line(0)) * n_norm, CDbl(line(2)) * Pe_norm, CDbl(line(1)) * Pe_norm) - 'old version: VECTO: n, M_in, M_loss => x=n, y=PeOut, z=PeIn - 'VECTO: n, M_in, M_loss => x=n, y=M_out, z=M_in - nU = CDbl(line(0)) - M_in = CDbl(line(1)) - M_loss = CDbl(line(2)) - - M_out = M_in - M_loss - - 'old version: Power instead of torque: GBmap0.AddPoints(nU, nMtoPe(nU, M_out), nMtoPe(nU, M_in)) - GBmap0.AddPoints(nU, M_out, M_in) - Catch ex As Exception - WorkerMsg(tMsgID.Err, "Error during file read! Line number: " & l & " (" & path & ")", MsgSrc, path) - file.Close() - MyGBmaps = Nothing - Return False - End Try - Loop - - file.Close() - - If Not GBmap0.Triangulate Then - WorkerMsg(tMsgID.Err, "Map triangulation failed! File: " & path, MsgSrc, path) - MyGBmaps = Nothing - Return False - End If - - MyGBmaps.Add(GBmap0) - - 'Calculate average efficiency for fast approx. calculation - If i > 0 Then - - If GBX.IsTCgear(i) Then - - GetrEff(i) = -1 - - Else - - EffSum = 0 - Anz = 0 - - dnU = (2 / 3) * (ENG.Nrated - ENG.Nidle) / 10 - nU = ENG.Nidle + dnU - - Do While nU <= ENG.Nrated - - dM = nPeToM(nU, (2 / 3) * FLD(i).Pfull(nU) / 10) - M_in = nPeToM(nU, (1 / 3) * FLD(i).Pfull(nU)) - - Do While M_in <= nPeToM(nU, FLD(i).Pfull(nU)) - - P_In = nMtoPe(nU, M_in) - - P_Loss = IntpolPeLossFwd(i, nU, P_In, False) - - EffSum += (P_In - P_Loss) / P_In - Anz += 1 - - - plossG = P_Loss - MinG = M_in - - - 'Axle - P_In -= P_Loss - P_Loss = IntpolPeLossFwd(0, nU / VEH.Igetr(i), P_In, False) - EffDiffSum += (P_In - P_Loss) / P_In - AnzDiff += 1 - - If MODdata.ModErrors.TrLossMapExtr <> "" Then - WorkerMsg(tMsgID.Err, "Transmission loss map does not cover full engine operating range!", MsgSrc) - WorkerMsg(tMsgID.Err, MODdata.ModErrors.TrLossMapExtr, MsgSrc) - WorkerMsg(tMsgID.Err, "nU_In(GB)=" & nU & " [1/min]", MsgSrc) - WorkerMsg(tMsgID.Err, "M_In(GB)=" & MinG & " [Nm]", MsgSrc) - WorkerMsg(tMsgID.Err, "P_Loss(GB)=" & plossG & " [kW]", MsgSrc) - WorkerMsg(tMsgID.Err, "nU_In(axle)=" & CStr(nU / VEH.Igetr(i)) & " [1/min]", MsgSrc) - WorkerMsg(tMsgID.Err, "M_In(axle)=" & CStr(nPeToM(nU / VEH.Igetr(i), P_In)) & " [Nm]", MsgSrc) - WorkerMsg(tMsgID.Err, "P_Loss(axle)=" & P_Loss & " [kW]", MsgSrc) - Return False - End If - - M_in += dM - Loop - - - nU += dnU - Loop - - If Anz = 0 Then - WorkerMsg(tMsgID.Err, "Failed to calculate approx. transmission losses!", MsgSrc) - Return False - End If - - GetrEff(i) = EffSum / Anz - - End If - - End If - - - End If + m_red0 += nrwheels * a0.Inertia / ((rdyn / 1000) ^ 2) Next - If Not GetrEffDef(0) Then - GetrEff(0) = EffDiffSum / AnzDiff - End If - + siFr0 = RRC Return True End Function - Public Function IntpolPeLoss(ByVal Gear As Integer, ByVal nU As Double, ByVal PeOut As Double, ByVal Approx As Boolean) As Double - - Dim PeIn As Double - Dim WG As Double - Dim GBmap As cDelaunayMap - Dim i As Integer - Dim Ab As Double - Dim AbMin As Double - Dim iMin As Integer - Dim PeOutX As Double - Dim GrTxt As String - Dim Ploss As Single - - Dim MsgSrc As String - - MsgSrc = "VEH/TrLossMapInterpol/G" & Gear - - If Gear = 0 Then - GrTxt = "A" - Else - GrTxt = Gear.ToString - End If - - If GetrEffDef(Gear) Or (Approx And DEV.AllowAprxTrLoss AndAlso GetrEff(Gear) > 0) Then - - If PeOut > 0 Then - PeIn = PeOut / GetrEff(Gear) - Else - PeIn = PeOut * GetrEff(Gear) - End If - Ploss = PeIn - PeOut - - Else - - GBmap = MyGBmaps(Gear) - - Try - 'Interpolate with Original Values - PeIn = nMtoPe(nU, GBmap.Intpol(nU, nPeToM(nU, PeOut))) - Ploss = PeIn - PeOut - - Catch ex As Exception - - 'If error: try extrapolation - - 'Search for the nearest Map point - AbMin = ((GBmap.ptList(0).X - nU) ^ 2 + (GBmap.ptList(0).Y - nPeToM(nU, PeOut)) ^ 2) ^ 0.5 - iMin = 0 - For i = 1 To GBmap.ptDim - Ab = ((GBmap.ptList(i).X - nU) ^ 2 + (GBmap.ptList(i).Y - nPeToM(nU, PeOut)) ^ 2) ^ 0.5 - If Ab < AbMin Then - AbMin = Ab - iMin = i - End If - Next - - PeOutX = nMtoPe(nU, GBmap.ptList(iMin).Y) - PeIn = nMtoPe(nU, GBmap.ptList(iMin).Z) - - 'Efficiency - If PeOutX > 0 Then - If PeIn > 0 Then - - WG = PeOutX / PeIn - PeIn = PeOut / WG - Ploss = PeIn - PeOut - - Else - - 'Drag => Drive: ERROR! - WorkerMsg(tMsgID.Err, "Transmission Loss Map invalid! Gear= " & GrTxt & ", nU= " & nU.ToString("0.00") & " [1/min], PeIn=" & PeIn.ToString("0.0") & " [kW], PeOut=" & PeOutX.ToString("0.0") & " [kW]", MsgSrc) - WorkerAbort() - Return 0 - - End If - - ElseIf PeOutX < 0 Then - - If PeIn > 0 Then - - WG = (PeIn - (PeIn - PeOutX)) / PeIn - PeIn = PeOut / WG - Ploss = PeIn - PeOut - - ElseIf PeIn < 0 Then - - WG = PeIn / PeOutX - PeIn = PeOut * WG - Ploss = PeIn - PeOut - - Else - - Ploss = Math.Abs(PeOut) - - End If - - - Else - - If PeIn > 0 Then - - Ploss = PeIn - - ElseIf PeIn < 0 Then - - 'Drag => Zero: ERROR! - WorkerMsg(tMsgID.Err, "Transmission Loss Map invalid! Gear= " & GrTxt & ", nU= " & nU.ToString("0.00") & " [1/min], PeIn=" & PeIn.ToString("0.0") & " [kW], PeOut=" & PeOutX.ToString("0.0") & " [kW]", MsgSrc) - WorkerAbort() - Return 0 - Else - - Ploss = Math.Abs(PeOut) - - End If - - End If - - MODdata.ModErrors.TrLossMapExtr = "Gear= " & GrTxt & ", nU= " & nU.ToString("0.00") & " [1/min], MeOut=" & nPeToM(nU, PeOut).ToString("0.00") & " [Nm]" - - End Try - - End If - - Return Math.Max(Ploss, 0) - - - End Function - - Public Function IntpolPeLossFwd(ByVal Gear As Integer, ByVal nU As Double, ByVal PeIn As Double, ByVal Approx As Boolean) As Double - - Dim PeOut As Double - Dim WG As Double - Dim GBmap As cDelaunayMap - Dim i As Integer - Dim Ab As Double - Dim AbMin As Double - Dim iMin As Integer - Dim PeInX As Double - Dim GrTxt As String - - Dim MsgSrc As String - - MsgSrc = "VEH/TrLossMapInterpolFwd/G" & Gear - - If Gear = 0 Then - GrTxt = "A" - Else - GrTxt = Gear.ToString - End If - - If GetrEffDef(Gear) Or (Approx And DEV.AllowAprxTrLoss AndAlso GetrEff(Gear) > 0) Then - - If PeIn > 0 Then - PeOut = PeIn * GetrEff(Gear) - Else - PeOut = PeIn / GetrEff(Gear) - End If - - Else - - GBmap = MyGBmaps(Gear) - - Try - 'Interpolate with original values - PeOut = nMtoPe(nU, GBmap.IntpolXZ(nU, nPeToM(nU, PeIn))) - - Catch ex As Exception - - 'If error: try extrapolation - - 'Search for the nearest Map-point - AbMin = ((GBmap.ptList(0).X - nU) ^ 2 + (GBmap.ptList(0).Z - nPeToM(nU, PeIn)) ^ 2) ^ 0.5 - iMin = 0 - For i = 1 To GBmap.ptDim - Ab = ((GBmap.ptList(i).X - nU) ^ 2 + (GBmap.ptList(i).Z - nPeToM(nU, PeIn)) ^ 2) ^ 0.5 - If Ab < AbMin Then - AbMin = Ab - iMin = i - End If - Next - - PeInX = nMtoPe(nU, GBmap.ptList(iMin).Z) - PeOut = nMtoPe(nU, GBmap.ptList(iMin).Y) - - 'Efficiency - If PeOut > 0 Then - If PeInX > 0 Then - - 'Drivetrain => Drivetrain - WG = PeOut / PeInX - - Else - - 'Drag => Drivetrain: ERROR! - WorkerMsg(tMsgID.Err, "Transmission Loss Map invalid! Gear= " & GrTxt & ", nU= " & nU.ToString("0.00") & " [1/min], PeIn=" & PeInX.ToString("0.00") & " [kW], PeOut=" & PeOut.ToString("0.00") & " [kW] (fwd)", MsgSrc) - WorkerAbort() - Return 0 - - End If - - Else - If PeInX > 0 Then - - WorkerMsg(tMsgID.Warn, "Change of sign in Transmission Loss Map! Set efficiency to 10%. Gear= " & GrTxt & ", nU= " & nU.ToString("0.00") & " [1/min], PeIn=" & PeInX.ToString("0.00") & " [kW], PeOut=" & PeOut.ToString("0.00") & " [kW] (fwd)", MsgSrc) - 'WorkerAbort() - WG = 0.1 - - Else - - 'Drag => Drag - WG = PeInX / PeOut - - - End If - End If - - 'Calculate efficiency with PeIn for original PeOut - PeOut = PeIn * WG - - MODdata.ModErrors.TrLossMapExtr = "Gear= " & GrTxt & ", nU= " & nU.ToString("0.00") & " [1/min], MeIn=" & nPeToM(nU, PeIn).ToString("0.00") & " [Nm] (fwd)" - - End Try - - End If - - Return Math.Max(PeIn - PeOut, 0) - - End Function + -#End Region #Region "Cd Funktionen" @@ -1151,10 +823,10 @@ lbInt: Select Case RtType Case tRtType.Primary - nU = (60 * v) / (VEH.Dreifen * Math.PI) * VEH.Igetr(0) * VEH.Igetr(Gear) * RtRatio + nU = (60 * v) / (2 * VEH.rdyn * Math.PI / 1000) * GBX.Igetr(0) * GBX.Igetr(Gear) * RtRatio Case tRtType.Secondary - nU = (60 * v) / (VEH.Dreifen * Math.PI) * VEH.Igetr(0) * RtRatio + nU = (60 * v) / (2 * VEH.rdyn * Math.PI / 1000) * GBX.Igetr(0) * RtRatio Case Else 'tRtType.None Return 0 @@ -1201,37 +873,12 @@ lbInt: End Get End Property - Public Property AchsI As Single + Public ReadOnly Property m_red As Single Get - Return siGetrI(0) + Return m_red0 End Get - Set(ByVal value As Single) - siGetrI(0) = value - End Set End Property - Public ReadOnly Property Igetr(ByVal x As Short) As Single - Get - Return siGetrI(x) - End Get - End Property - - Public ReadOnly Property m_raeder_red As Single - Get - Return siI_wheels / ((siDreifen / 2) ^ 2) - End Get - End Property - - Public Property I_wheels As Single - Get - Return siI_wheels - End Get - Set(ByVal value As Single) - siI_wheels = value - End Set - End Property - - Public Property Fr0 As Single Get Return siFr0 @@ -1241,23 +888,17 @@ lbInt: End Set End Property - Public Property Dreifen As Single - Get - Return siDreifen - End Get - Set(ByVal value As Single) - siDreifen = value - End Set - End Property - - Public Property FilePath() As String Get Return sFilePath End Get Set(ByVal value As String) sFilePath = value - MyPath = IO.Path.GetDirectoryName(sFilePath) & "\" + If sFilePath = "" Then + MyPath = "" + Else + MyPath = IO.Path.GetDirectoryName(sFilePath) & "\" + End If End Set End Property diff --git a/VECTO/MODcalc/cMOD.vb b/VECTO/MODcalc/cMOD.vb index 458aaaeb8fa04a44836f6826f0bd12658784803c..ad25dfca72b473383148c98c0cef2355c768b0b2 100644 --- a/VECTO/MODcalc/cMOD.vb +++ b/VECTO/MODcalc/cMOD.vb @@ -44,11 +44,13 @@ Public Class cMOD 'FC Public FCerror As Boolean Public lFC As List(Of Single) + Public lFCAUXc As List(Of Single) + Public lFCWHTCc As List(Of Single) Public FCavg As Single + Public FCavgAUXc As Single + Public FCavgWHTCc As Single - Public CorrFactor As Single - - + Public FCAUXcSet As Boolean Private bInit As Boolean @@ -90,6 +92,9 @@ Public Class cMOD TCnOut = New List(Of Single) lFC = New List(Of Single) + lFCAUXc = New List(Of Single) + lFCWHTCc = New List(Of Single) + FCAUXcSet = False FCerror = False @@ -104,6 +109,8 @@ Public Class cMOD Public Sub CleanUp() If bInit Then lFC = Nothing + lFCAUXc = Nothing + lFCWHTCc = Nothing Vh.CleanUp() Px = Nothing @@ -193,6 +200,7 @@ Public Class cMOD Dim s As Integer Dim L As List(Of Double) Dim AuxKV As KeyValuePair(Of String, List(Of Single)) + Dim st As String 'Define Cycle-length (shorter by 1sec than original because of Interim-seconds) tDim = DRI.tDim - 1 @@ -220,20 +228,32 @@ Public Class cMOD End If - 'Specify average Aux and Aux-lists, when Au8x present in DRI and VEH - If DRI.AuxDef Then - For Each AuxKV In DRI.AuxComponents + 'Specify average Aux and Aux-lists, when Aux present in DRI and VEH + If Cfg.DeclMode Then - For s = 0 To tDim - AuxKV.Value(s) = (AuxKV.Value(s + 1) + AuxKV.Value(s)) / 2 - Next + For Each st In VEC.AuxPaths.Keys + MODdata.Paux.Add(st, New List(Of Single)) + Next - If VEC.AuxPaths.ContainsKey(AuxKV.Key) Then MODdata.Paux.Add(AuxKV.Key, New List(Of Single)) + Else + + If DRI.AuxDef Then + For Each AuxKV In DRI.AuxComponents + + For s = 0 To tDim + AuxKV.Value(s) = (AuxKV.Value(s + 1) + AuxKV.Value(s)) / 2 + Next + + If VEC.AuxPaths.ContainsKey(AuxKV.Key) Then MODdata.Paux.Add(AuxKV.Key, New List(Of Single)) + + Next + End If - Next End If + + End Sub Private Sub EngCycleInit() @@ -289,7 +309,6 @@ Public Class cMOD Dim rA As Double Dim rB As Double Dim rSE As Double - Dim FCadd As Double Dim PeAdd As Double Dim MsgSrc As String @@ -316,7 +335,7 @@ Public Class cMOD 'Delaunay - v = MAP.fFCdelaunay_Intp(MODdata.nU(i), MODdata.Pe(i)) + v = MAP.fFCdelaunay_Intp(MODdata.nU(i), nPeToM(MODdata.nU(i), MODdata.Pe(i))) If v < 0 And v > -999 Then v = 0 @@ -340,15 +359,6 @@ Public Class cMOD Next FCavg = CSng(sum / lFC.Count) - - 'WHTC Correction - If Declaration.Active AndAlso WHTCcorrection Then - CorrFactor = Declaration.SegRef.WHTCWF(Declaration.CurrentMission.MissionID)(tWHTCpart.Urban) * ENG.WHTCurban / Declaration.WHTCresults(tWHTCpart.Urban) _ - + Declaration.SegRef.WHTCWF(Declaration.CurrentMission.MissionID)(tWHTCpart.Rural) * ENG.WHTCrural / Declaration.WHTCresults(tWHTCpart.Rural) _ - + Declaration.SegRef.WHTCWF(Declaration.CurrentMission.MissionID)(tWHTCpart.Motorway) * ENG.WHTCmw / Declaration.WHTCresults(tWHTCpart.Motorway) - End If - - 'Start/Stop-Aux - Correction If Result AndAlso LostEnergy > 0 Then @@ -381,23 +391,39 @@ Public Class cMOD WorkerMsg(tMsgID.Normal, " > Additional engine load: " & AddEngLoad.ToString("0.000") & " [kW]", MsgSrc) - FCadd = 0 For i = 0 To MODdata.tDim + lFCAUXc.Add(lFC(i)) If MODdata.EngState(i) <> tEngState.Stopped Then PeAdd = AddEngLoad + MODdata.Pbrake(i) If PeAdd > 0 Then - FCadd += rB * PeAdd + lFCAUXc(i) += rB * PeAdd End If End If Next - FCadd /= EngOnTime '[g/h] + 'average + sum = 0 + For Each x In lFCAUXc + sum += x + Next + FCavgAUXc = CSng(sum / lFC.Count) - WorkerMsg(tMsgID.Normal, " > FC corrected from: " & FCavg.ToString("0.0") & " [g/h] to " & (FCavg + FCadd).ToString("0.0") & " [g/h]", MsgSrc) + FCAUXcSet = True - 'Correct FC to higher load - FCavg += FCadd + End If + 'WHTC Correction + If Cfg.DeclMode Then + + For i = 0 To MODdata.tDim + lFCWHTCc.Add(lFC(i) * Declaration.WHTCcorrFactor) + Next + + sum = 0 + For Each x In lFCWHTCc + sum += x + Next + FCavgWHTCc = CSng(sum / lFC.Count) End If @@ -512,10 +538,11 @@ Public Class cMOD s.Append(Sepp & "FC") sU.Append(Sepp & "[g/h]") - If Declaration.Active Then - s.Append(Sepp & "FC corrected") - sU.Append(Sepp & "[g/h]") - End If + s.Append(Sepp & "FC-AUXc") + sU.Append(Sepp & "[g/h]") + + s.Append(Sepp & "FC-WHTCc") + sU.Append(Sepp & "[g/h]") 'Write to File @@ -675,12 +702,25 @@ Public Class cMOD s.Append(Sepp & "ERROR") End If - If Declaration.Active Then - If .lFC(t) > -0.0001 Then - s.Append(Sepp & .lFC(t) * .CorrFactor) + If FCAUXcSet Then + If .lFCAUXc(t) > -0.0001 Then + s.Append(Sepp & .lFCAUXc(t)) + Else + s.Append(Sepp & "ERROR") + End If + Else + s.Append(Sepp & "-") + End If + + + If Cfg.DeclMode Then + If .lFCWHTCc(t) > -0.0001 Then + s.Append(Sepp & .lFCWHTCc(t)) Else s.Append(Sepp & "ERROR") End If + Else + s.Append(Sepp & "-") End If 'Write to File diff --git a/VECTO/MODcalc/cPower.vb b/VECTO/MODcalc/cPower.vb index 71b10e3ccfadd2c0394342310fdeb904ba5f9404..36c05178d2303e99b6705c1d5e864d904bea4dbb 100644 --- a/VECTO/MODcalc/cPower.vb +++ b/VECTO/MODcalc/cPower.vb @@ -134,7 +134,7 @@ Public Class cPower i += 1 'Check if cancellation pending - If PHEMworker.CancellationPending Then Return True + If VECTOworker.CancellationPending Then Return True Vist = Vh.V(i) aist = Vh.a(i) @@ -185,7 +185,7 @@ Public Class cPower PaMot = (ENG.I_mot * MODdata.dnUvorg(i) * 0.01096 * MODdata.nUvorg(i)) * 0.001 Else nU = fnU(Vist, Gear, False) - PaMot = ((ENG.I_mot * (VEH.AchsI * VEH.Igetr(Gear) / (0.5 * VEH.Dreifen)) ^ 2) * aist * Vist) * 0.001 + PaMot = ((ENG.I_mot * (GBX.Igetr(0) * GBX.Igetr(Gear) / (VEH.rdyn / 1000)) ^ 2) * aist * Vist) * 0.001 End If 'Aux Demand @@ -324,7 +324,7 @@ Public Class cPower If ProgBarLACpart > 0 Then ProgBarCtrl.ProgJobInt = CInt((100 / ProgBarShare) * (MODdata.tDim - i) / MODdata.tDim + (ProgBarLACpart - 1) * (100 / ProgBarShare)) 'Check if cancellation pending - If PHEMworker.CancellationPending Then Return True + If VECTOworker.CancellationPending Then Return True If Positions(i) = 1 Then vset2 = Vh.V(i) @@ -463,7 +463,7 @@ Public Class cPower MsgSrc = "Power/Calc" - StdMode = (PHEMmode = tPHEMmode.ModeSTANDARD) + StdMode = (CalcMode = tCalcMode.ModeSTANDARD) 'Abort if no speed given If Not DRI.Vvorg Then @@ -472,7 +472,7 @@ Public Class cPower End If 'Messages - If Not Cfg.WegKorJa Then WorkerMsg(tMsgID.Warn, "Distance Correction is disabled!", MsgSrc, "<UM>/GUI/mainform_options.html#CycleDistCor") + If Not Cfg.DistCorr Then WorkerMsg(tMsgID.Warn, "Distance Correction is disabled!", MsgSrc, "<UM>/GUI/mainform_options.html#CycleDistCor") ' Initialize Vh = MODdata.Vh @@ -484,7 +484,7 @@ Public Class cPower End If - If Cfg.GnVorgab Then + If Cfg.GnUfromCycle Then Gvorg = DRI.Gvorg Nvorg = DRI.Nvorg If StdMode Then @@ -517,7 +517,7 @@ Public Class cPower LastClutch = tEngClutch.Opened 'Theoretical maximum speed [m/s] - set to Speed ​​at 1.2 x Nominal-Revolutions in top-Gear - GVmax = 1.2 * ENG.Nrated * VEH.Dreifen * Math.PI / (VEH.AchsI * VEH.Igetr(GBX.GearCount) * 60) + GVmax = 1.2 * ENG.Nrated * 2 * VEH.rdyn * Math.PI / (1000 * GBX.Igetr(0) * GBX.Igetr(GBX.GearCount) * 60) dist = 0 dist0 = 0 @@ -588,7 +588,7 @@ lbGschw: WorkerMsg(tMsgID.Err, "aDesMax(dec) invalid! v= " & Vist & ", aDesMax(dec) =" & amax, MsgSrc) Return False End If - If aist < amax - 0.0001 Then + If aist < amax - 0.0001 And Not Vh.EcoRoll(jz) Then Vh.SetSpeed0(jz, Vh.V0(jz) + amax) GoTo lbGschw End If @@ -632,6 +632,14 @@ lbGschw: Pminus = True End Select + + ''Eco-Roll (triggers if Pwheel < 2 [kW]) + 'If Vh.EcoRoll(jz) AndAlso Pplus Then + ' Vh.ReduceSpeed(jz, 0.9999) + ' FirstSecItar = False + ' GoTo lbGschw + 'End If + 'Faster check if Power is too high 'If PvorD > 1.2 * VEH.Pnenn Then ' Vh.ReduceSpeed(jz, 0.9) @@ -719,11 +727,11 @@ lbGschw: Return False End If - 'Eco-Roll (triggers if Pwheel < 2 [kW]) - If Vh.EcoRoll(jz) AndAlso PvorD < 2 Then - Clutch = tEngClutch.Opened - Gear = 0 - End If + ''Eco-Roll (triggers if Pwheel < 2 [kW]) + 'If Vh.EcoRoll(jz) AndAlso PvorD < 2 Then + ' Clutch = tEngClutch.Opened + ' Gear = 0 + 'End If If Gear = 1 And Pminus And Vist <= 5 / 3.6 Then Clutch = tEngClutch.Opened @@ -846,7 +854,7 @@ lbCheck: PaGetr = fPaG(Vist, aist) Pkup = PvorD + PlossGB + PlossDiff + PaGetr + PlossRt - If Not GBX.TCiteration(fnUout(Vist, Gear), Pkup, jz) Then + If Not GBX.TCiteration(Gear, fnUout(Vist, Gear), Pkup, jz) Then WorkerMsg(tMsgID.Err, "TC Iteration failed!", MsgSrc & "/t= " & jz + 1) Return False End If @@ -907,7 +915,7 @@ lb_nOK: If Nvorg Then PaMot = (ENG.I_mot * MODdata.dnUvorg(jz) * 0.01096 * MODdata.nUvorg(jz)) * 0.001 Else - PaMot = ((ENG.I_mot * (VEH.AchsI * VEH.Igetr(Gear) / (0.5 * VEH.Dreifen)) ^ 2) * aist * Vist) * 0.001 + PaMot = ((ENG.I_mot * (GBX.Igetr(0) * GBX.Igetr(Gear) / (VEH.rdyn / 1000)) ^ 2) * aist * Vist) * 0.001 End If End If @@ -1067,8 +1075,8 @@ lb_nOK: Pkup = P - Paux - PaMot PaGetr = fPaG(Vist, aist) PlossGB = fPlossGBfwd(Pkup, Vist, Gear, False) - PlossDiff = fPlossDiffFwd(Pkup - PlossGB, Vist, False) PlossRt = fPlossRt(Vist, Gear) + PlossDiff = fPlossDiffFwd(Pkup - PlossGB - PlossRt, Vist, False) Pbrake = PvorD - (Pkup - PlossGB - PlossDiff - PaGetr - PlossRt) @@ -1080,7 +1088,7 @@ lb_nOK: End If 'Check if cancellation pending (before Speed-reduce-iteration, otherwise it hangs) - If PHEMworker.CancellationPending Then Return True + If VECTOworker.CancellationPending Then Return True 'Check whether P above Full-load => Reduce Speed If Pplus And P > Pmax Then @@ -1286,7 +1294,7 @@ lb_nOK: '*********************************************************************************************** 'Notify - If Cfg.WegKorJa Then + If Cfg.DistCorr Then If MODdata.tDim > MODdata.tDimOgl Then WorkerMsg(tMsgID.Normal, "Cycle extended by " & MODdata.tDim - MODdata.tDimOgl & " seconds to meet target distance.", MsgSrc) If Math.Abs(Vh.WegIst - Vh.WegSoll) > 80 Then @@ -1306,7 +1314,7 @@ lb_nOK: End Function - Public Function Eng_Calc() As Boolean + Public Function Eng_Calc(ByVal NoWarnings As Boolean) As Boolean Dim Pmr As Single Dim t As Integer @@ -1322,7 +1330,7 @@ lb_nOK: MsgSrc = "Power/Eng_Calc" - StdMode = (PHEMmode = tPHEMmode.ModeSTANDARD) + StdMode = (CalcMode = tCalcMode.ModeSTANDARD) 'Abort if Power/Revolutions not given If Not (DRI.Nvorg And DRI.Pvorg) Then @@ -1420,7 +1428,7 @@ lb_nOK: Next - If PcorCount > 0 Then WorkerMsg(tMsgID.Warn, "Power corrected (>5%) in " & PcorCount & " time steps.", MsgSrc) + If PcorCount > 0 And Not NoWarnings Then WorkerMsg(tMsgID.Warn, "Power corrected (>5%) in " & PcorCount & " time steps.", MsgSrc) Return True @@ -1570,15 +1578,15 @@ lb_nOK: Diff = Math.Abs(Pdrag - Pe) - If Diff > DEV.SpeedPeEps Then + If Diff > 0.0001 Then vVorz = 1 Else Return v End If - LastDiff = Diff + 10 * DEV.SpeedPeEps + LastDiff = Diff + 10 * 0.0001 - Do While Diff > DEV.SpeedPeEps 'And Math.Abs(LastDiff - Diff) > eps + Do While Diff > 0.0001 'And Math.Abs(LastDiff - Diff) > eps If LastDiff < Diff Or v + vVorz * vstep <= 0.0001 Then vVorz *= -1 @@ -1659,14 +1667,14 @@ lb_nOK: For Gear = GBX.GearCount To 1 Step -1 - nU = CSng(Vist * 60.0 * VEH.AchsI * VEH.Igetr(Gear) / (VEH.Dreifen * Math.PI)) + nU = CSng(Vist * 60.0 * GBX.Igetr(0) * GBX.Igetr(Gear) / (2 * VEH.rdyn * Math.PI / 1000)) 'Current torque demand with previous gear Md = Pe * 1000 / (nU * 2 * Math.PI / 60) 'Up/Downshift rpms - nUup = GBX.fGSnUup(Md) - nUdown = GBX.fGSnUdown(Md) + nUup = GBX.Shiftpolygons(Gear).fGSnUup(Md) + nUdown = GBX.Shiftpolygons(Gear).fGSnUdown(Md) If nU > nUdown Then Return Gear @@ -1708,8 +1716,8 @@ lb_nOK: Md = Pe * 1000 / (nU * 2 * Math.PI / 60) 'Up/Downshift rpms - nUup = GBX.fGSnUup(Md) - nUdown = GBX.fGSnUdown(Md) + nUup = GBX.Shiftpolygons(Gear).fGSnUup(Md) + nUdown = GBX.Shiftpolygons(Gear).fGSnUdown(Md) 'Max torque MdMax = Pmax * 1000 / (nU * 2 * Math.PI / 60) @@ -1729,7 +1737,7 @@ lb_nOK: For Gear = GBX.GearCount To 1 Step -1 'rpm at StartSpeed [m/s] - nU = GBX.gs_StartSpeed * 60.0 * VEH.AchsI * VEH.Igetr(Gear) / (VEH.Dreifen * Math.PI) + nU = GBX.gs_StartSpeed * 60.0 * GBX.Igetr(0) * GBX.Igetr(Gear) / (2 * VEH.rdyn * Math.PI / 1000) 'full load Pmax = FLD(Gear).Pfull(nU) @@ -1745,8 +1753,8 @@ lb_nOK: Md = Pe * 1000 / (nU * 2 * Math.PI / 60) 'Up/Downshift rpms - nUup = GBX.fGSnUup(Md) - nUdown = GBX.fGSnUdown(Md) + nUup = GBX.Shiftpolygons(Gear).fGSnUup(Md) + nUdown = GBX.Shiftpolygons(Gear).fGSnUdown(Md) If nU > nUdown And nU >= ENG.Nidle And (1 - Md / MdMax >= GBX.gs_TorqueResvStart / 100 Or Md < 0) Then Exit For @@ -1805,8 +1813,8 @@ lb_nOK: Md = Pe * 1000 / (nU * 2 * Math.PI / 60) 'Up/Downshift rpms - nUup = GBX.fGSnUup(Md) - nUdown = GBX.fGSnUdown(Md) + nUup = GBX.Shiftpolygons(LastGear).fGSnUup(Md) + nUdown = GBX.Shiftpolygons(LastGear).fGSnUdown(Md) If nU > nUup Then @@ -1836,15 +1844,6 @@ lb_nOK: Dim MdMax As Single Dim LastPeNorm As Single - Dim iphase As Int16 - Dim iphase0 As Int16 - Dim itgangw As Integer - Dim i As Integer - Dim bCheck As Boolean - Dim Pjetzt As Single - Dim Pvorher As Single - Dim a As Single - Dim b As Single Dim tx As Int16 Dim OutOfRpmRange As Boolean @@ -1865,7 +1864,7 @@ lb_nOK: tx += 1 Loop - nU = CSng(Vist * 60.0 * VEH.AchsI * VEH.Igetr(LastGear) / (VEH.Dreifen * Math.PI)) + nU = CSng(Vist * 60.0 * GBX.Igetr(0) * GBX.Igetr(LastGear) / (2 * VEH.rdyn * Math.PI / 1000)) OutOfRpmRange = ((nU - ENG.Nidle) / (ENG.Nrated - ENG.Nidle) >= 1.2 Or nU < ENG.Nidle) @@ -1901,8 +1900,8 @@ lb_nOK: MdMax = FLD(LastGear).Pfull(nU, LastPeNorm) * 1000 / (nU * 2 * Math.PI / 60) 'Up/Downshift rpms - nnUp = GBX.fGSnUup(Md) - nnDown = GBX.fGSnUdown(Md) + nnUp = GBX.Shiftpolygons(LastGear).fGSnUup(Md) + nnDown = GBX.Shiftpolygons(LastGear).fGSnUdown(Md) 'Compare rpm with Up/Downshift rpms If nU <= nnDown And LastGear > 1 Then @@ -1921,8 +1920,8 @@ lb_nOK: Pe = Math.Min(fPeGearMod(Gear - 1, t, Grad), FLD(Gear - 1).Pfull(nU)) Pe = Math.Max(Pe, FLD(Gear - 1).Pdrag(nU)) Md = Pe * 1000 / (nU * 2 * Math.PI / 60) - nnUp = GBX.fGSnUup(Md) - nnDown = GBX.fGSnUdown(Md) + nnUp = GBX.Shiftpolygons(Gear - 1).fGSnUup(Md) + nnDown = GBX.Shiftpolygons(Gear - 1).fGSnUdown(Md) 'Shift down as long as Gear > 1 and rpm is below UpShift-rpm Do While Gear > 1 AndAlso nU < nnUp @@ -1942,8 +1941,8 @@ lb_nOK: Pe = Math.Min(fPeGearMod(Gear - 1, t, Grad), FLD(Gear - 1).Pfull(nU)) Pe = Math.Max(Pe, FLD(Gear - 1).Pdrag(nU)) Md = Pe * 1000 / (nU * 2 * Math.PI / 60) - nnUp = GBX.fGSnUup(Md) - nnDown = GBX.fGSnUdown(Md) + nnUp = GBX.Shiftpolygons(Gear - 1).fGSnUup(Md) + nnDown = GBX.Shiftpolygons(Gear - 1).fGSnUdown(Md) Loop @@ -1969,8 +1968,8 @@ lb_nOK: Pe = Math.Min(fPeGearMod(Gear + 1, t, Grad), FLD(Gear + 1).Pfull(nU)) Pe = Math.Max(Pe, FLD(Gear + 1).Pdrag(nU)) Md = Pe * 1000 / (nU * 2 * Math.PI / 60) - nnUp = GBX.fGSnUup(Md) - nnDown = GBX.fGSnUdown(Md) + nnUp = GBX.Shiftpolygons(Gear + 1).fGSnUup(Md) + nnDown = GBX.Shiftpolygons(Gear + 1).fGSnUdown(Md) 'Max Torque MdMax = FLD(Gear + 1).Pfull(nU, LastPeNorm) * 1000 / (nU * 2 * Math.PI / 60) @@ -1993,8 +1992,8 @@ lb_nOK: Pe = Math.Min(fPeGearMod(Gear + 1, t, Grad), FLD(Gear + 1).Pfull(nU)) Pe = Math.Max(Pe, FLD(Gear + 1).Pdrag(nU)) Md = Pe * 1000 / (nU * 2 * Math.PI / 60) - nnUp = GBX.fGSnUup(Md) - nnDown = GBX.fGSnUdown(Md) + nnUp = GBX.Shiftpolygons(Gear + 1).fGSnUup(Md) + nnDown = GBX.Shiftpolygons(Gear + 1).fGSnUdown(Md) 'Max Torque MdMax = FLD(Gear + 1).Pfull(nU, LastPeNorm) * 1000 / (nU * 2 * Math.PI / 60) @@ -2019,8 +2018,8 @@ lb_nOK: Pe = Math.Min(fPeGearMod(Gear + 1, t, Grad), FLD(Gear + 1).Pfull(nU)) Pe = Math.Max(Pe, FLD(Gear + 1).Pdrag(nU)) Md = Pe * 1000 / (nU * 2 * Math.PI / 60) - nnUp = GBX.fGSnUup(Md) - nnDown = GBX.fGSnUdown(Md) + nnUp = GBX.Shiftpolygons(Gear + 1).fGSnUup(Md) + nnDown = GBX.Shiftpolygons(Gear + 1).fGSnUdown(Md) 'Max Torque MdMax = FLD(Gear + 1).Pfull(nU, LastPeNorm) * 1000 / (nU * 2 * Math.PI / 60) @@ -2043,8 +2042,8 @@ lb_nOK: Pe = Math.Min(fPeGearMod(Gear + 1, t, Grad), FLD(Gear + 1).Pfull(nU)) Pe = Math.Max(Pe, FLD(Gear + 1).Pdrag(nU)) Md = Pe * 1000 / (nU * 2 * Math.PI / 60) - nnUp = GBX.fGSnUup(Md) - nnDown = GBX.fGSnUdown(Md) + nnUp = GBX.Shiftpolygons(Gear + 1).fGSnUup(Md) + nnDown = GBX.Shiftpolygons(Gear + 1).fGSnUdown(Md) 'Max Torque MdMax = FLD(Gear + 1).Pfull(nU, LastPeNorm) * 1000 / (nU * 2 * Math.PI / 60) @@ -2069,79 +2068,8 @@ lb10: Md = Pe * 1000 / (nU * 2 * Math.PI / 60) 'If GearCorrection is OFF then return here - If Not DEV.GearCorrection Then Return Gear - - 'Search for last Gear-change - itgangw = 0 - For i = t - 1 To 1 Step -1 - If MODdata.Gear(i) <> MODdata.Gear(i - 1) Then - itgangw = i - Exit For - End If - Next - - 'Maximum permissible Gear-shifts every 3 seconds: - If t - itgangw <= GBX.gs_ShiftTime And t > GBX.gs_ShiftTime - 1 Then - Return LastGear '<<< no further checks!!! - End If - - 'Checks to Purge non-sensible Gear-shift: - 'Division into "IPhase(j)" stages: Acceleration(=1), Deceleration(=2) and Cruise(=3): - iphase = 0 - If t > 1 Then - Select Case (MODdata.Vh.a(t - 2) + MODdata.Vh.a(t - 1) + MODdata.Vh.a(t)) / 3 - Case Is >= 0.125 - iphase = 1 - Case Is <= -0.125 - iphase = 2 - Case Else - iphase = 3 - End Select - End If - - iphase0 = 0 - If t > 3 Then - Select Case (MODdata.Vh.a(t - 3) + MODdata.Vh.a(t - 2) + MODdata.Vh.a(t - 1)) / 3 - Case Is >= 0.125 - iphase0 = 1 - Case Is <= -0.125 - iphase0 = 2 - Case Else - iphase0 = 3 - End Select - End If - - 'Cruise-phases: - 'As long Speed-change since last Gear-shift is below 6% and Pe/Pnom below 6% then do not Gear-shift: - 'Deceleration-phases: Upshift suppressed - 'Acceleration phases: Downshift suppressed - bCheck = False - Pjetzt = fPeGearModvD(t, Grad) - Pvorher = MODdata.Pe(itgangw) - If MODdata.Vh.V(itgangw) = 0 Then - a = Math.Abs(Vist / 0.0001 - 1) - Else - a = Math.Abs(Vist / MODdata.Vh.V(itgangw) - 1) - End If - If Pvorher = 0 Then - b = Math.Abs(Pjetzt / 0.0001 - 1) - Else - b = Math.Abs(Pjetzt / Pvorher - 1) - End If - If iphase = 3 And a < 0.06 And b < 0.06 Then bCheck = True - If (iphase = 1) And Gear < MODdata.Gear(t - 1) And iphase0 = 1 Then bCheck = True - If (iphase = 2) And Gear > MODdata.Gear(t - 1) Then bCheck = True - If bCheck Then Gear = LastGear - - 'Shifting from 2nd to 1st Gear is suppressed when v > 1.5 m/s - 'NEU LUZ 040210: Hochschalten nur wenn im 2. Gang über Kuppeldrehzahl |@@| NEW LUZ 040210: Upshifting only when in 2nd Gear over the Clutch-revolutions - If Gear = 1 And LastGear > 1 And Vist >= 1.5 Then - If fnn(Vist, 2, False) > Kuppln_norm Then Gear = 2 - End If - Return Gear - End Function Private Function fGearByU(ByVal nU As Single, ByVal V As Single) As Integer @@ -2151,7 +2079,7 @@ lb10: Dim g0 As Integer DifMin = 9999 For g = 1 To GBX.GearCount - Dif = Math.Abs(VEH.Igetr(g) - nU * (VEH.Dreifen * Math.PI) / (V * 60.0 * VEH.AchsI)) + Dif = Math.Abs(GBX.Igetr(g) - nU * (2 * VEH.rdyn * Math.PI) / (1000 * V * 60.0 * GBX.Igetr(0))) If Dif <= DifMin Then g0 = g DifMin = Dif @@ -2178,7 +2106,7 @@ lb10: 'Drehzahlvorgabe PaM = (ENG.I_mot * MODdata.dnUvorg(t) * 0.01096 * MODdata.nUvorg(t)) * 0.001 Else - PaM = ((ENG.I_mot * (VEH.AchsI * VEH.Igetr(Gear) / (0.5 * VEH.Dreifen)) ^ 2) * a * V) * 0.001 + PaM = ((ENG.I_mot * (GBX.Igetr(0) * GBX.Igetr(Gear) / (VEH.rdyn / 1000)) ^ 2) * a * V) * 0.001 End If If Clutch = tEngClutch.Closed Then Return (PvD + fPlossGB(PvD, V, Gear, True) + fPlossDiff(PvD, V, True) + fPaG(V, a) + fPaux(t, nU) + PaM) @@ -2205,7 +2133,7 @@ lb10: Private Function fnU(ByVal V As Single, ByVal Gear As Integer, ByVal ClutchSlip As Boolean) As Single Dim akn As Single Dim U As Single - U = CSng(V * 60.0 * VEH.AchsI * VEH.Igetr(Gear) / (VEH.Dreifen * Math.PI)) + U = CSng(V * 60.0 * GBX.Igetr(0) * GBX.Igetr(Gear) / (2 * VEH.rdyn * Math.PI / 1000)) If U < ENG.Nidle Then U = ENG.Nidle If ClutchSlip Then akn = Kuppln_norm / ((ENG.Nidle + Kuppln_norm * (ENG.Nrated - ENG.Nidle)) / ENG.Nrated) @@ -2215,7 +2143,7 @@ lb10: End Function Private Function fnUout(ByVal V As Single, ByVal Gear As Integer) As Single - Return CSng(V * 60.0 * VEH.AchsI * VEH.Igetr(Gear) / (VEH.Dreifen * Math.PI)) + Return CSng(V * 60.0 * GBX.Igetr(0) * GBX.Igetr(Gear) / (2 * VEH.rdyn * Math.PI / 1000)) End Function #End Region @@ -2263,24 +2191,14 @@ lb10: '--------Vehicle Acceleration-capability(Beschleunigungsleistung) -------- Private Function fPaFZ(ByVal v As Single, ByVal a As Single) As Single - 'Previously (PHEM 10.4.2 and older) the m_raeder was used for Massered instead, with Massered = m_raeder + I_Getriebe * (Iachs / (0.5 * Dreifen)) ^ 2 - ' The missing part (I_Getriebe * (Iachs / (0.5 * Dreifen)) ^ 2) is now considered by fPaG(V,a) - Return CSng(((VEH.Mass + VEH.MassExtra + VEH.m_raeder_red + VEH.Loading) * a * v) * 0.001) - End Function - - Private Function fPaMot(ByVal t As Integer, ByVal Gear As Integer) As Single - If Nvorg Then - Return (ENG.I_mot * MODdata.dnUvorg(t) * 0.01096 * MODdata.nUvorg(t)) * 0.001 - Else - Return ((ENG.I_mot * (VEH.AchsI * VEH.Igetr(Gear) / (0.5 * VEH.Dreifen)) ^ 2) * aist * Vist) * 0.001 - End If + Return CSng(((VEH.Mass + VEH.MassExtra + VEH.m_red + VEH.Loading) * a * v) * 0.001) End Function Private Function fPaMot(ByVal t As Integer, ByVal Gear As Integer, ByVal v As Single, ByVal a As Single) As Single If Nvorg Then Return (ENG.I_mot * MODdata.dnUvorg(t) * 0.01096 * MODdata.nUvorg(t)) * 0.001 Else - Return ((ENG.I_mot * (VEH.AchsI * VEH.Igetr(Gear) / (0.5 * VEH.Dreifen)) ^ 2) * a * v) * 0.001 + Return ((ENG.I_mot * (GBX.Igetr(0) * GBX.Igetr(Gear) / (VEH.rdyn / 1000)) ^ 2) * a * v) * 0.001 End If End Function @@ -2297,22 +2215,28 @@ lb10: '-------------------Transmission(Getriebe)------------------- Private Function fPlossGB(ByVal PvD As Single, ByVal V As Single, ByVal Gear As Integer, ByVal TrLossApprox As Boolean) As Single Dim Pdiff As Single + Dim Prt As Single Dim P As Single Dim nU As Single If Gear = 0 Then Return 0 - nU = (60 * V) / (VEH.Dreifen * Math.PI) * VEH.Igetr(0) * VEH.Igetr(Gear) + nU = (60 * V) / (2 * VEH.rdyn * Math.PI / 1000) * GBX.Igetr(0) * GBX.Igetr(Gear) 'Pdiff Pdiff = fPlossDiff(PvD, V, TrLossApprox) + If VEH.RtType = tRtType.Secondary Then + Prt = fPlossRt(V, Gear) + Else + Prt = 0 + End If '***Differential - ' Power after Differential (before Transmission) - P = PvD + Pdiff + ' Power before Transmission; after Differential and Retarder (if Type=Secondary) + P = PvD + Pdiff + Prt - Return Math.Max(VEH.IntpolPeLoss(Gear, nU, P, TrLossApprox), 0) + Return Math.Max(GBX.IntpolPeLoss(Gear, nU, P, TrLossApprox), 0) End Function @@ -2321,27 +2245,34 @@ lb10: '***Differential ' Power before Differential - Return Math.Max(VEH.IntpolPeLoss(0, (60 * V) / (VEH.Dreifen * Math.PI) * VEH.Igetr(0), PvD, TrLossApprox), 0) + Return Math.Max(GBX.IntpolPeLoss(0, (60 * V) / (2 * VEH.rdyn * Math.PI / 1000) * GBX.Igetr(0), PvD, TrLossApprox), 0) End Function Private Function fPlossGBfwd(ByVal PeICE As Single, ByVal V As Single, ByVal Gear As Integer, ByVal TrLossApprox As Boolean) As Single Dim nU As Single + Dim Prt As Single If Gear = 0 Then Return 0 - nU = (60 * V) / (VEH.Dreifen * Math.PI) * VEH.Igetr(0) * VEH.Igetr(Gear) + If VEH.RtType = tRtType.Primary Then + Prt = fPlossRt(V, Gear) + Else + Prt = 0 + End If + + nU = (60 * V) / (2 * VEH.rdyn * Math.PI / 1000) * GBX.Igetr(0) * GBX.Igetr(Gear) - Return Math.Max(VEH.IntpolPeLossFwd(Gear, nU, PeICE, TrLossApprox), 0) + Return Math.Max(GBX.IntpolPeLossFwd(Gear, nU, PeICE + Prt, TrLossApprox), 0) End Function Private Function fPlossDiffFwd(ByVal PeIn As Single, ByVal V As Single, ByVal TrLossApprox As Boolean) As Single Dim nU As Single - nU = (60 * V) / (VEH.Dreifen * Math.PI) * VEH.Igetr(0) + nU = (60 * V) / (2 * VEH.rdyn * Math.PI / 1000) * GBX.Igetr(0) - Return Math.Max(VEH.IntpolPeLossFwd(0, nU, PeIn, TrLossApprox), 0) + Return Math.Max(GBX.IntpolPeLossFwd(0, nU, PeIn, TrLossApprox), 0) End Function @@ -2352,7 +2283,7 @@ lb10: '----------------Gearbox inertia ---------------- Private Function fPaG(ByVal V As Single, ByVal a As Single) As Single Dim Mred As Single - Mred = CSng(GBX.I_Getriebe * (VEH.AchsI / (0.5 * VEH.Dreifen)) ^ 2) + Mred = CSng(GBX.I_Getriebe * (GBX.Igetr(0) / (VEH.rdyn / 1000)) ^ 2) Return CSng((Mred * a * V) * 0.001) End Function diff --git a/VECTO/MODcalc/cVh.vb b/VECTO/MODcalc/cVh.vb index ab667bbfcb9ac3c8de15f056fa8e792143df66e1..038d25fef8b99c3e0fb2a97f51a2bd4b10da9e4f 100644 --- a/VECTO/MODcalc/cVh.vb +++ b/VECTO/MODcalc/cVh.vb @@ -360,7 +360,7 @@ Public Class cVh v = lV(t) dWegIst += v - If Not Cfg.WegKorJa Then Return False + If Not Cfg.DistCorr Then Return False If t + 1 > MODdata.tDim Then Return False @@ -587,7 +587,10 @@ lbInt: End Function - Public Function AltIntp(ByVal s As Single, Optional ByVal OverwiAlt As Boolean = False) As Single + 'IndexInit = 0 ...Set iAlt to 1 + 'IndexInit = 0 ...Set iAlt + 'IndexInit > 0 ...Use IndexStart + Public Function AltIntp(ByVal s As Single, ByVal iAltReset As Boolean) As Single Dim i As Int32 If ls0(0) >= s Then @@ -595,6 +598,8 @@ lbInt: GoTo lbInt End If + If iAltReset Then iAlt = 1 + i = iAlt If ls0(i - 1) > s Then @@ -611,15 +616,11 @@ lbInt: End If - lbInt: - - If OverwiAlt Then iAlt = i + iAlt = i Return (s - ls0(i - 1)) * (lAlt0(i) - lAlt0(i - 1)) / (ls0(i) - ls0(i - 1)) + lAlt0(i - 1) - - End Function diff --git a/VECTO/M_MAIN.vb b/VECTO/M_MAIN.vb index 7f4c706cff405fe6b8fef56719caf1698b7a01f7..6cb5e9eee8379d7b57970657a92ba290088a693b 100644 --- a/VECTO/M_MAIN.vb +++ b/VECTO/M_MAIN.vb @@ -6,7 +6,7 @@ ''' <remarks></remarks> Module M_MAIN - Public PHEMmode As tPHEMmode + Public CalcMode As tCalcMode Public JobFileList As List(Of String) Public JobCycleList As List(Of String) @@ -15,17 +15,17 @@ Module M_MAIN Public CycleFiles As New List(Of String) Public CurrentCycleFile As String - Private jgen As Integer - Private jzkl As Integer + Private iJob As Integer + Private iCycle As Integer Private CyclesDim As Integer Private FilesDim As Integer Private jsubcycle As Integer - Private jsubcyclecount As Integer + Private jsubcycleDim As Integer Private SigFile As String ''' <summary> - ''' Main calculation routine. Launched by PHEMworker via Mainform's Start button or command line + ''' Main calculation routine. Launched by VECTOworker via Mainform's Start button or command line ''' </summary> ''' <returns></returns> ''' <remarks></remarks> @@ -41,6 +41,8 @@ Module M_MAIN Dim MsgSrc As String Dim loading As tLoading Dim LoadList As New List(Of tLoading) + Dim iLoad As Integer + Dim iLoadDim As Integer @@ -55,21 +57,21 @@ Module M_MAIN ''ClearErrors() 'Specify Mode and Notification-msg - Select Case PHEMmode - Case tPHEMmode.ModeSTANDARD + Select Case CalcMode + Case tCalcMode.ModeSTANDARD WorkerMsg(tMsgID.Normal, "Starting VECTO STANDARD...", MsgSrc) CyclesDim = 0 - Case tPHEMmode.ModeBATCH + Case tCalcMode.ModeBATCH WorkerMsg(tMsgID.Normal, "Starting VECTO BATCH...", MsgSrc) CyclesDim = JobCycleList.Count - 1 End Select FilesDim = JobFileList.Count - 1 - MsgOut = (PHEMmode = tPHEMmode.ModeSTANDARD) + MsgOut = (CalcMode = tCalcMode.ModeSTANDARD) 'License check - If (PHEMmode = tPHEMmode.ModeBATCH) Then + If (CalcMode = tCalcMode.ModeBATCH) Then If Not Lic.LicFeature(1) Then WorkerMsg(tMsgID.Err, "Your license does not support BATCH mode!", MsgSrc) GoTo lbErrBefore @@ -81,17 +83,15 @@ Module M_MAIN GoTo lbErrBefore End If - If CyclesDim = -1 And (PHEMmode = tPHEMmode.ModeBATCH) Then + If CyclesDim = -1 And (CalcMode = tCalcMode.ModeBATCH) Then WorkerMsg(tMsgID.Err, "No Driving Cycles defined.", MsgSrc) GoTo lbErrBefore End If 'Create BATCH Output-folder if necessary - If (PHEMmode = tPHEMmode.ModeBATCH) Then + If (CalcMode = tCalcMode.ModeBATCH) Then Select Case UCase(Cfg.BATCHoutpath) - Case sKey.WorkDir - path0 = Cfg.WorkDPath - Case sKey.GenPath + Case sKey.JobPath GoTo lbSkip0 Case Else path0 = Cfg.BATCHoutpath @@ -116,7 +116,6 @@ lbSkip0: 'ERG-class initialization WorkerMsg(tMsgID.Normal, "Analyzing input files", MsgSrc) VSUM = New cVSUM - VRES = New cVRES If Not VSUM.Init(JobFileList(0)) Then GoTo lbErrBefore SigFile = Left(VSUM.VSUMfile, VSUM.VSUMfile.Length - 5) & ".vsig" @@ -124,12 +123,14 @@ lbSkip0: 'Warning on invalid/unrealistic settings If Cfg.AirDensity > 2 Then WorkerMsg(tMsgID.Err, "Air Density = " & Cfg.AirDensity & " ?!", MsgSrc) - If Declaration.Active Then + If Cfg.DeclMode Then LoadList.Add(tLoading.EmptyLoaded) LoadList.Add(tLoading.RefLoaded) LoadList.Add(tLoading.FullLoaded) + iLoadDim = 2 Else LoadList.Add(tLoading.UserDefLoaded) + iLoadDim = 0 End If 'Progbar-Init @@ -141,25 +142,25 @@ lbSkip0: '********************************************************************************************** '**************************************** Job loop **************************************** '********************************************************************************************** - For jgen = 0 To FilesDim + For iJob = 0 To FilesDim - jzkl = 0 '<= Damit NrOfRun stimmt + iCycle = 0 '<= Damit NrOfRun stimmt - JobFile = fFileRepl(JobFileList(jgen)) + JobFile = fFileRepl(JobFileList(iJob)) GenFile = JobFile - WorkerMsg(tMsgID.NewJob, "Job: " & (jgen * (CyclesDim + 1) + jzkl + 1) & " / " & ((FilesDim + 1) * (CyclesDim + 1)) & " | " & fFILE(JobFile, True), MsgSrc) - WorkerStatus("Current Job: " & (jgen * (CyclesDim + 1) + jzkl + 1) & " / " & ((FilesDim + 1) * (CyclesDim + 1)) & " | " & fFILE(JobFile, True)) - WorkerJobStatus(jgen, "initialising... ", tJobStatus.Running) + WorkerMsg(tMsgID.NewJob, "Job: " & (iJob * (CyclesDim + 1) + iCycle + 1) & " / " & ((FilesDim + 1) * (CyclesDim + 1)) & " | " & fFILE(JobFile, True), MsgSrc) + WorkerStatus("Current Job: " & (iJob * (CyclesDim + 1) + iCycle + 1) & " / " & ((FilesDim + 1) * (CyclesDim + 1)) & " | " & fFILE(JobFile, True)) + WorkerJobStatus(iJob, "initialising... ", tJobStatus.Running) JobAbortedByErr = False MSGwarn = 0 MSGerror = 0 'Check if Abort - If PHEMworker.CancellationPending Then GoTo lbAbort + If VECTOworker.CancellationPending Then GoTo lbAbort 'If error when read GEN CurrentCycleFile = "" @@ -172,7 +173,10 @@ lbSkip0: End If 'WHTC Correction - If Declaration.Active Then + If Cfg.DeclMode Then + + 'Initialise Report + Declaration.ReportInit() WorkerMsg(tMsgID.Normal, "WHTC Correction", MsgSrc) @@ -187,7 +191,7 @@ lbSkip0: MODdata.CycleInit() - If Not MODdata.Px.Eng_Calc() Then + If Not MODdata.Px.Eng_Calc(True) Then JobAbortedByErr = True GoTo lbNextJob End If @@ -206,11 +210,9 @@ lbSkip0: End If 'BATCH: Create Output-sub-folder - If (PHEMmode = tPHEMmode.ModeBATCH) And Cfg.ModOut And Cfg.BATCHoutSubD Then + If (CalcMode = tCalcMode.ModeBATCH) And Cfg.ModOut And Cfg.BATCHoutSubD Then Select Case UCase(Cfg.BATCHoutpath) - Case sKey.WorkDir - path0 = Cfg.WorkDPath - Case sKey.GenPath + Case sKey.JobPath path0 = fPATH(JobFile) Case Else path0 = Cfg.BATCHoutpath @@ -230,31 +232,33 @@ lbSkip0: '********************************************************************************************** '************************************** Cycle-loop **************************************** '********************************************************************************************** - For jzkl = 0 To CyclesDim + For iCycle = 0 To CyclesDim CyclAbrtedByErr = False - If PHEMmode = tPHEMmode.ModeBATCH Then + If CalcMode = tCalcMode.ModeBATCH Then 'ProgBar - ProgBarCtrl.ProgOverallStartInt = 100 * (jgen * (CyclesDim + 1) + jzkl) / ((FilesDim + 1) * (CyclesDim + 1)) - ProgBarCtrl.PgroOverallEndInt = 100 * (jgen * (CyclesDim + 1) + jzkl + 1) / ((FilesDim + 1) * (CyclesDim + 1)) + ProgBarCtrl.ProgLock = True + ProgBarCtrl.ProgJobInt = 0 + ProgBarCtrl.ProgOverallStartInt = 100 * (iJob * (CyclesDim + 1) + iCycle) / ((FilesDim + 1) * (CyclesDim + 1)) + ProgBarCtrl.PgroOverallEndInt = 100 * (iJob * (CyclesDim + 1) + iCycle + 1) / ((FilesDim + 1) * (CyclesDim + 1)) + ProgBarCtrl.ProgLock = False + 'BATCH mode: Cycles from DRI list CycleFiles.Clear() - CycleFiles.Add(fFileRepl(JobCycleList(jzkl))) + CycleFiles.Add(fFileRepl(JobCycleList(iCycle))) 'Status - WorkerMsg(tMsgID.NewJob, "Cycle: " & (jgen * (CyclesDim + 1) + jzkl + 1) & " / " & ((FilesDim + 1) * (CyclesDim + 1)) & " | " & fFILE(JobFile, True) & " | " & fFILE(CycleFiles(0), True), MsgSrc) - WorkerStatus("Current Job: " & (jgen * (CyclesDim + 1) + jzkl + 1) & " / " & ((FilesDim + 1) * (CyclesDim + 1)) & " | " & fFILE(JobFile, True) & " | " & fFILE(CycleFiles(0), True)) - WorkerJobStatus(jgen, "running... " & jzkl + 1 & "/" & (CyclesDim + 1), tJobStatus.Running) + WorkerMsg(tMsgID.NewJob, "Cycle: " & (iJob * (CyclesDim + 1) + iCycle + 1) & " / " & ((FilesDim + 1) * (CyclesDim + 1)) & " | " & fFILE(JobFile, True) & " | " & fFILE(CycleFiles(0), True), MsgSrc) + WorkerStatus("Current Job: " & (iJob * (CyclesDim + 1) + iCycle + 1) & " / " & ((FilesDim + 1) * (CyclesDim + 1)) & " | " & fFILE(JobFile, True) & " | " & fFILE(CycleFiles(0), True)) + WorkerJobStatus(iJob, "running... " & iCycle + 1 & "/" & (CyclesDim + 1), tJobStatus.Running) 'Output name definition Select Case UCase(Cfg.BATCHoutpath) - Case sKey.WorkDir - path0 = Cfg.WorkDPath - Case sKey.GenPath + Case sKey.JobPath path0 = fPATH(JobFile) Case Else path0 = Cfg.BATCHoutpath @@ -269,65 +273,79 @@ lbSkip0: End If '****************************************************************************************** - '********************************** VECTO-Cycle-loop ********************************** - jsubcyclecount = CycleFiles.Count + '********************************** VECTO-Cycle-loop START ********************************** + '****************************************************************************************** + jsubcycleDim = CycleFiles.Count - 1 - If jsubcyclecount = 0 Then + If jsubcycleDim = -1 Then WorkerMsg(tMsgID.Err, "No driving cycle defined!", MsgSrc) JobAbortedByErr = True GoTo lbNextJob End If - jsubcycle = 0 + jsubcycle = -1 For Each CurrentCycleFile In CycleFiles jsubcycle += 1 ProgBarCtrl.ProgJobInt = 0 - If Declaration.Active Then - If Not Declaration.CalcInitCycle(jsubcycle - 1) Then - JobAbortedByErr = True - GoTo lbNextJob - End If - End If - If PHEMmode = tPHEMmode.ModeSTANDARD Then + If CalcMode = tCalcMode.ModeSTANDARD Then + MODdata.ModOutpName = fFileWoExt(JobFile) & "_" & fFILE(CurrentCycleFile, False) + WorkerMsg(tMsgID.NewJob, "Cycle: " & (jsubcycle + 1) & " / " & (jsubcycleDim + 1) & " | " & fFILE(CurrentCycleFile, True), MsgSrc) + End If - 'ProgBar - ProgBarCtrl.ProgOverallStartInt = 100 * (jgen) / (FilesDim + 1) + 100 * (jsubcycle - 1) / jsubcyclecount * 1 / (FilesDim + 1) - ProgBarCtrl.PgroOverallEndInt = 100 * (jgen) / (FilesDim + 1) + 100 * jsubcycle / jsubcyclecount * 1 / (FilesDim + 1) + If Cfg.DeclMode Then - MODdata.ModOutpName = fFileWoExt(JobFile) & "_" & fFILE(CurrentCycleFile, False) + If Not Declaration.CalcInitCycle(jsubcycle) Then + JobAbortedByErr = True + GoTo lbNextJob + End If - WorkerMsg(tMsgID.NewJob, "Cycle: " & jsubcycle & " / " & jsubcyclecount & " | " & fFILE(CurrentCycleFile, True), MsgSrc) - WorkerStatus("Current Job: " & (jgen * (CyclesDim + 1) + jzkl + 1) & " / " & (FilesDim + 1) & " | " & fFILE(JobFile, True) & " | " & fFILE(CurrentCycleFile, True)) + WorkerMsg(tMsgID.Normal, "WHTC Correction Factor: " & Declaration.WHTCcorrFactor, MsgSrc) - WorkerJobStatus(jgen, "running... " & jsubcycle & "/" & jsubcyclecount, tJobStatus.Running) + Declaration.ReportAddCycle() End If - VRES.ResetMe() - VRES.FilePath = MODdata.ModOutpName - - '***************************** VECTO-loading-loop ********************************* '************************************************************************************** - + '***************************** VECTO-loading-loop START ******************************* + '************************************************************************************** + iLoad = -1 For Each loading In LoadList - If Declaration.Active Then + iLoad += 1 + + 'ProgBar + If CalcMode = tCalcMode.ModeSTANDARD Then + ProgBarCtrl.ProgLock = True + ProgBarCtrl.ProgJobInt = 0 + ProgBarCtrl.ProgOverallStartInt = 100 * iJob / (FilesDim + 1) + 100 * jsubcycle / (jsubcycleDim + 1) * 1 / (FilesDim + 1) + 100 * iLoad / (iLoadDim + 1) * 1 / ((FilesDim + 1) * (jsubcycleDim + 1)) + ProgBarCtrl.PgroOverallEndInt = 100 * iJob / (FilesDim + 1) + 100 * jsubcycle / (jsubcycleDim + 1) * 1 / (FilesDim + 1) + 100 * (iLoad + 1) / (iLoadDim + 1) * 1 / ((FilesDim + 1) * (jsubcycleDim + 1)) + ProgBarCtrl.ProgLock = False + WorkerJobStatus(iJob, "running... " & (iLoad + 1) + jsubcycle * (iLoadDim + 1) & "/" & (jsubcycleDim + 1) * (iLoadDim + 1), tJobStatus.Running) + End If + + + If Cfg.DeclMode Then 'Results filename with loading MODdata.ModOutpName = fFileWoExt(JobFile) & "_" & fFILE(CurrentCycleFile, False) & "_" & ConvLoading(loading) - - WorkerMsg(tMsgID.NewJob, "Loading: " & ConvLoading(loading), MsgSrc) + WorkerMsg(tMsgID.NewJob, "Loading: " & (iLoad + 1) & " / " & (iLoadDim + 1) & " | " & ConvLoading(loading), MsgSrc) If Not Declaration.CalcInitLoad(loading) Then JobAbortedByErr = True GoTo lbNextJob End If + WorkerStatus("Current Job: " & (iJob * (CyclesDim + 1) + iCycle + 1) & " / " & (FilesDim + 1) & " | " & fFILE(JobFile, True) & " | " & Declaration.CurrentMission.NameStr & " | " & ConvLoading(loading)) + + Else + + If CalcMode = tCalcMode.ModeSTANDARD Then WorkerStatus("Current Job: " & (iJob * (CyclesDim + 1) + iCycle + 1) & " / " & (FilesDim + 1) & " | " & fFILE(JobFile, True) & " | " & fFILE(CurrentCycleFile, True)) + End If 'Clean up @@ -385,7 +403,7 @@ lbSkip0: If MsgOut Then WorkerMsg(tMsgID.Normal, "Engine Only Calc", MsgSrc) 'Rechne .npi-Leistung in Pe und P_clutch um |@@| Expect Npi-Power into Pe and P_clutch - If Not MODdata.Px.Eng_Calc() Then + If Not MODdata.Px.Eng_Calc(False) Then CyclAbrtedByErr = True GoTo lbAusg End If @@ -406,12 +424,6 @@ lbSkip0: GoTo lbNextJob End If - If Not GBX.GSinit Then - 'Error-notification within GSinit() - JobAbortedByErr = True - GoTo lbNextJob - End If - If GBX.TCon Then If Not GBX.TCinit Then 'Error-notification within TCinit() @@ -420,17 +432,16 @@ lbSkip0: End If End If - If DEV.PreRun Then + + If MsgOut Then WorkerMsg(tMsgID.Normal, "Driving Cycle Preprocessing", MsgSrc) + If Not MODdata.Px.PreRun Then + CyclAbrtedByErr = True + GoTo lbAusg + End If - If MsgOut Then WorkerMsg(tMsgID.Normal, "Driving Cycle Preprocessing", MsgSrc) - If Not MODdata.Px.PreRun Then - CyclAbrtedByErr = True - GoTo lbAusg - End If + If VECTOworker.CancellationPending Then GoTo lbAbort - If PHEMworker.CancellationPending Then GoTo lbAbort - End If If MsgOut Then WorkerMsg(tMsgID.Normal, "Vehicle Calc", MsgSrc) @@ -442,7 +453,7 @@ lbSkip0: End If - If PHEMworker.CancellationPending Then GoTo lbAbort + If VECTOworker.CancellationPending Then GoTo lbAbort 'Calculate CycleKin (for erg/sum, etc.) MODdata.CylceKin.Calc() @@ -457,7 +468,7 @@ lbSkip0: 'Calculate FC MODdata.FCcalc(True) - If PHEMworker.CancellationPending Then GoTo lbAbort + If VECTOworker.CancellationPending Then GoTo lbAbort '*** second-by-second output *** If Cfg.ModOut Then @@ -471,46 +482,39 @@ lbSkip0: End If - 'VECTO Output - If Not VEC.EngOnly Then - If Not VRES.SetVals(loading) Then - CyclAbrtedByErr = True - GoTo lbAusg - End If - End If - 'Output for BATCH and ADVANCE lbAusg: - If PHEMworker.CancellationPending Then GoTo lbAbort + If VECTOworker.CancellationPending Then GoTo lbAbort + + 'Status-Update + ProgBarCtrl.ProgLock = True + If CalcMode = tCalcMode.ModeSTANDARD Then + WorkerProgJobEnd(100 * iJob / (FilesDim + 1) + 100 * jsubcycle / (jsubcycleDim + 1) * 1 / (FilesDim + 1) + 100 * (iLoad + 1) / (iLoadDim + 1) * 1 / ((FilesDim + 1) * (jsubcycleDim + 1))) + ElseIf CalcMode = tCalcMode.ModeBATCH Then + WorkerProgJobEnd(100 * (iJob * (CyclesDim + 1) + iCycle + 1) / ((FilesDim + 1) * (CyclesDim + 1))) + End If + + If Cfg.DeclMode Then + Declaration.ReportAddResults() + End If 'VSUM Output (first Calculation - Initialization & Header) - If Not VSUM.AusgVSUM(jgen * (CyclesDim + 1) + jzkl + 1, fFILE(GenFile, True), fFILE(CurrentCycleFile, True), CyclAbrtedByErr) Then GoTo lbErrInJobLoop + If Not VSUM.AusgVSUM(iJob * (CyclesDim + 1) + iCycle + 1, fFILE(GenFile, True), fFILE(CurrentCycleFile, True), CyclAbrtedByErr) Then GoTo lbErrInJobLoop 'Data Cleanup MODdata.CleanUp() - 'Status-Update - If PHEMmode = tPHEMmode.ModeSTANDARD Then - WorkerProg(100 * (jgen) / (FilesDim + 1) + 100 * jsubcycle / jsubcyclecount * 1 / (FilesDim + 1), 0) - ElseIf PHEMmode = tPHEMmode.ModeBATCH Then - WorkerProg(100 * (jgen * (CyclesDim + 1) + jzkl + 1) / ((FilesDim + 1) * (CyclesDim + 1)), 0) - End If - Next + '******************************************************************************** '******************** END *** VECTO-loading loop *** END ************************ - '************************************************************************************** + '******************************************************************************** - If Not VEC.EngOnly Then - If Not VRES.Output() Then - CyclAbrtedByErr = True - GoTo lbNextJob - End If - End If Next + '****************************************************************************************** '************************* END *** VECTO Cycle-loop *** END ************************* '****************************************************************************************** @@ -519,19 +523,31 @@ lbAusg: '********************************************************************************************** '****************************** END *** Cycle-loop *** END ****************************** '********************************************************************************************** + + If Cfg.DeclMode Then + WorkerMsg(tMsgID.Normal, "Writing report file", MsgSrc) + If Declaration.WriteReport() Then + WorkerMsg(tMsgID.Normal, "Click here to open report " & fFILE(Declaration.Report.Filepath, True), MsgSrc, "<RUN>" & Declaration.Report.Filepath) + Else + WorkerMsg(tMsgID.Err, "Failed to write pdf report!", MsgSrc) + JobAbortedByErr = True + GoTo lbNextJob + End If + End If + lbNextJob: If JobAbortedByErr Or (CyclAbrtedByErr And CyclesDim = 0) Then If JobAbortedByErr Then - If CInt(jgen * (CyclesDim + 1) + 1) = CInt((jgen + 1) * (CyclesDim + 1)) Then - VSUM.AusgVSUM(((jgen + 1) * (CyclesDim + 1)).ToString, fFILE(GenFile, True), "-", True) + If CInt(iJob * (CyclesDim + 1) + 1) = CInt((iJob + 1) * (CyclesDim + 1)) Then + VSUM.AusgVSUM(((iJob + 1) * (CyclesDim + 1)).ToString, fFILE(GenFile, True), "-", True) Else - VSUM.AusgVSUM((jgen * (CyclesDim + 1) + 1).ToString & ".." & ((jgen + 1) * (CyclesDim + 1)).ToString, fFILE(GenFile, True), "-", True) + VSUM.AusgVSUM((iJob * (CyclesDim + 1) + 1).ToString & ".." & ((iJob + 1) * (CyclesDim + 1)).ToString, fFILE(GenFile, True), "-", True) End If End If - WorkerJobStatus(jgen, "Aborted due to error!", tJobStatus.Err) + WorkerJobStatus(iJob, "Aborted due to error!", tJobStatus.Err) Else @@ -559,15 +575,15 @@ lbNextJob: End If If MSGerror > 0 Then - WorkerJobStatus(jgen, MsgStrBuilder.ToString & ".", tJobStatus.Warn) + WorkerJobStatus(iJob, MsgStrBuilder.ToString & ".", tJobStatus.Warn) Else - WorkerJobStatus(jgen, MsgStrBuilder.ToString & ".", tJobStatus.OK) + WorkerJobStatus(iJob, MsgStrBuilder.ToString & ".", tJobStatus.OK) End If End If 'Check whether Abort - If PHEMworker.CancellationPending Then GoTo lbAbort + If VECTOworker.CancellationPending Then GoTo lbAbort Next @@ -613,10 +629,10 @@ lbErrBefore: '!!!!!!!!!! Abbruch bevor (!!!) der erste Job angefangen wurde !!! lbErrInJobLoop: WorkerMsg(tMsgID.Normal, "aborted", MsgSrc) - WorkerJobStatus(jgen, "aborted", tJobStatus.Err) + WorkerJobStatus(iJob, "aborted", tJobStatus.Err) VECTO = tCalcResult.Err - For i = jgen + 1 To FilesDim + For i = iJob + 1 To FilesDim WorkerJobStatus(i, "", tJobStatus.Undef) Next @@ -626,10 +642,10 @@ lbErrInJobLoop: lbAbort: WorkerMsg(tMsgID.Normal, "aborted", MsgSrc) - WorkerJobStatus(jgen, "aborted", tJobStatus.Warn) + WorkerJobStatus(iJob, "aborted", tJobStatus.Warn) VECTO = tCalcResult.Abort - For i = jgen + 1 To FilesDim + For i = iJob + 1 To FilesDim WorkerJobStatus(i, "", tJobStatus.Undef) Next @@ -650,7 +666,6 @@ lbExit: End Function Public Function ReadFiles() As Boolean - Dim i As Integer Dim sb As cSubPath @@ -670,7 +685,7 @@ lbExit: Try If Not VEC.ReadFile() Then - WorkerMsg(tMsgID.Err, "Cannot read .gen file (" & GenFile & ")", MsgSrc) + WorkerMsg(tMsgID.Err, "Cannot read .vecto file (" & GenFile & ")", MsgSrc) Return False End If Catch ex As Exception @@ -698,7 +713,7 @@ lbExit: If VEH.NoJSON Then WorkerMsg(tMsgID.Warn, "Vehicle file format is outdated! CLICK HERE to convert to current format!", MsgSrc, "<GUI>" & VEC.PathVEH) - If Declaration.Active Then + If Cfg.DeclMode Then If Not Declaration.SetRef() Then WorkerMsg(tMsgID.Err, "Vehicle Configuration not found in Segment Table!", MsgSrc) Return False @@ -706,7 +721,9 @@ lbExit: End If - If Declaration.Active Then VEC.DeclInit() + If Cfg.DeclMode Then + If Not VEC.DeclInit() Then Return False + End If CycleFiles.Clear() @@ -719,7 +736,7 @@ lbExit: - '----------------------------- ~ENG~ ----------------------------- + '---------------------- ~ENG~ (incl. FLD, MAP) ---------------------- ENG = New cENG ENG.FilePath = VEC.PathENG Try @@ -731,7 +748,7 @@ lbExit: If ENG.NoJSON Then WorkerMsg(tMsgID.Warn, "Engine file format is outdated! CLICK HERE to convert to current format!", MsgSrc, "<GUI>" & VEC.PathENG) - If Declaration.Active Then ENG.DeclInit() + '----------------------------- ~GBX~ ----------------------------- @@ -741,44 +758,30 @@ lbExit: GBX.FilePath = VEC.PathGBX Try If Not GBX.ReadFile Then Return False + If Not GBX.GSinit Then Return False Catch ex As Exception WorkerMsg(tMsgID.Err, "File read error! (" & VEC.PathGBX & ")", MsgSrc, VEC.PathGBX) Return False End Try + End If If GBX.NoJSON Then WorkerMsg(tMsgID.Warn, "Gearbox file format is outdated! CLICK HERE to convert to current format!", MsgSrc, "<GUI>" & VEC.PathGBX) - - - '----------------------------- VECTO ----------------------------- - - 'GBX => VEH - For i = 0 To GBX.GetrI.Count - 1 - VEH.siGetrI.Add(GBX.GetrI(i)) - VEH.GetrMap.Add(New cSubPath) - If IsNumeric(GBX.GetrMap(i, True)) Then - VEH.GetrEffDef.Add(True) - VEH.GetrEff.Add(CSng(GBX.GetrMap(i, True))) - Else - VEH.GetrEffDef.Add(False) - VEH.GetrEff.Add(0) - VEH.GetrMap(i).Init(fPATH(VEC.PathGBX), GBX.GetrMap(i, True)) - End If - Next - + 'Must be called after cGBX.ReadFile because cGBX.GearCount is needed ENG.Init() + 'Must be called after cENG.Init because FLD must be loaded + If Cfg.DeclMode Then + If Not ENG.DeclInit() Then Return False + End If - '----------------------------- ~FLD~ ----------------------------- - 'Now in cENG.Init - - - '----------------------------- ~MAP~ ----------------------------- - 'Now in cENG.Init 'Must be after ENG.Init() - If Declaration.Active Then GBX.DeclInit() + If Cfg.DeclMode Then + If Not GBX.DeclInit() Then Return False + End If + diff --git a/VECTO/VECTO.vbproj b/VECTO/VECTO.vbproj index 727a5fb7cb421e20fb44ceafce1b1b4e783b3fa9..07faf9a028dcdd1185093e8c03cdc100363da450 100644 --- a/VECTO/VECTO.vbproj +++ b/VECTO/VECTO.vbproj @@ -95,6 +95,7 @@ <Reference Include="System.Management" /> <Reference Include="System.Runtime.Remoting" /> <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Windows.Forms.DataVisualization" /> <Reference Include="System.Xml" /> <Reference Include="vectolic, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> @@ -114,7 +115,6 @@ <Compile Include="ApplicationEvents.vb" /> <Compile Include="cJSONparser.vb" /> <Compile Include="cDeclaration.vb" /> - <Compile Include="cVRES.vb" /> <Compile Include="GUI\F_FileSign.Designer.vb"> <DependentUpon>F_FileSign.vb</DependentUpon> </Compile> @@ -127,6 +127,18 @@ <Compile Include="GUI\F_FLD.vb"> <SubType>Form</SubType> </Compile> + <Compile Include="GUI\F_Graph.Designer.vb"> + <DependentUpon>F_Graph.vb</DependentUpon> + </Compile> + <Compile Include="GUI\F_Graph.vb"> + <SubType>Form</SubType> + </Compile> + <Compile Include="GUI\F_Graph_ChEdit.Designer.vb"> + <DependentUpon>F_Graph_ChEdit.vb</DependentUpon> + </Compile> + <Compile Include="GUI\F_Graph_ChEdit.vb"> + <SubType>Form</SubType> + </Compile> <Compile Include="GUI\F_Welcome.Designer.vb"> <DependentUpon>F_Welcome.vb</DependentUpon> </Compile> @@ -190,10 +202,10 @@ <Compile Include="Input Files\cDRI.vb" /> <Compile Include="Input Files\cVECTO.vb" /> <Compile Include="Input Files\cVEH.vb" /> - <Compile Include="GUI\F_VEH_GearDlog.Designer.vb"> - <DependentUpon>F_VEH_GearDlog.vb</DependentUpon> + <Compile Include="GUI\F_GBX_GearDlog.Designer.vb"> + <DependentUpon>F_GBX_GearDlog.vb</DependentUpon> </Compile> - <Compile Include="GUI\F_VEH_GearDlog.vb"> + <Compile Include="GUI\F_GBX_GearDlog.vb"> <SubType>Form</SubType> </Compile> <Compile Include="Input Files\cSubPath.vb" /> @@ -220,10 +232,10 @@ <Compile Include="GUI\F_VEH.vb"> <SubType>Form</SubType> </Compile> - <Compile Include="GUI\F_Options.Designer.vb"> - <DependentUpon>F_Options.vb</DependentUpon> + <Compile Include="GUI\F_Settings.Designer.vb"> + <DependentUpon>F_Settings.vb</DependentUpon> </Compile> - <Compile Include="GUI\F_Options.vb"> + <Compile Include="GUI\F_Settings.vb"> <SubType>Form</SubType> </Compile> <Compile Include="GUI\F_AboutBox.Designer.vb"> @@ -262,6 +274,7 @@ <ItemGroup> <EmbeddedResource Include="File Browser\FB_Dialog.resx"> <DependentUpon>FB_Dialog.vb</DependentUpon> + <SubType>Designer</SubType> </EmbeddedResource> <EmbeddedResource Include="File Browser\FB_FavDlog.resx"> <DependentUpon>FB_FavDlog.vb</DependentUpon> @@ -272,6 +285,12 @@ <EmbeddedResource Include="GUI\F_FLD.resx"> <DependentUpon>F_FLD.vb</DependentUpon> </EmbeddedResource> + <EmbeddedResource Include="GUI\F_Graph.resx"> + <DependentUpon>F_Graph.vb</DependentUpon> + </EmbeddedResource> + <EmbeddedResource Include="GUI\F_Graph_ChEdit.resx"> + <DependentUpon>F_Graph_ChEdit.vb</DependentUpon> + </EmbeddedResource> <EmbeddedResource Include="GUI\F_Welcome.resx"> <DependentUpon>F_Welcome.vb</DependentUpon> </EmbeddedResource> @@ -300,9 +319,9 @@ <SubType>Designer</SubType> <DependentUpon>F_VEH.vb</DependentUpon> </EmbeddedResource> - <EmbeddedResource Include="GUI\F_Options.resx"> + <EmbeddedResource Include="GUI\F_Settings.resx"> <SubType>Designer</SubType> - <DependentUpon>F_Options.vb</DependentUpon> + <DependentUpon>F_Settings.vb</DependentUpon> </EmbeddedResource> <EmbeddedResource Include="GUI\F_AboutBox.resx"> <SubType>Designer</SubType> @@ -314,8 +333,8 @@ <EmbeddedResource Include="GUI\F_VEH_Axle.resx"> <DependentUpon>F_VEH_Axle.vb</DependentUpon> </EmbeddedResource> - <EmbeddedResource Include="GUI\F_VEH_GearDlog.resx"> - <DependentUpon>F_VEH_GearDlog.vb</DependentUpon> + <EmbeddedResource Include="GUI\F_GBX_GearDlog.resx"> + <DependentUpon>F_GBX_GearDlog.vb</DependentUpon> </EmbeddedResource> <EmbeddedResource Include="My Project\Resources.resx"> <Generator>VbMyResourcesResXFileCodeGenerator</Generator> diff --git a/VECTO/VECTO_Global.vb b/VECTO/VECTO_Global.vb index 4195413bdb8a47830e29ffb071270018f707496e..dc7be661ce0e5e456eb36dab280d5de664eb94bf 100644 --- a/VECTO/VECTO_Global.vb +++ b/VECTO/VECTO_Global.vb @@ -8,8 +8,11 @@ Module VECTO_Global Public MyConfPath As String Public MyDeclPath As String + 'Log + Public LogFile As cLogFile + 'BackgroundWorker - Public PHEMworker As System.ComponentModel.BackgroundWorker + Public VECTOworker As System.ComponentModel.BackgroundWorker 'Log/Msg Public MSGerror As Integer @@ -25,8 +28,6 @@ Module VECTO_Global 'File format Public FileFormat As System.Text.Encoding = System.Text.Encoding.UTF8 - Public LOGfile As System.IO.StreamWriter - Public VEC As cVECTO Public VEH As cVEH Public MAP As cMAP @@ -39,7 +40,6 @@ Module VECTO_Global Public ENG As cENG Public GBX As cGBX - Public VRES As cVRES Public Declaration As cDeclaration @@ -58,6 +58,33 @@ Module VECTO_Global #Region "sKey > Typ Umwandlung" + + Public Function GearboxConv(ByVal Gearbox As tGearbox) As String + Select Case Gearbox + Case tGearbox.Manual + Return "MT" + Case tGearbox.Automatic + Return "AT" + Case tGearbox.SemiAutomatic + Return "AMT" + Case Else 'tGearbox.Custom + Return "Custom" + End Select + End Function + + Public Function GearboxConv(ByVal Gearbox As String) As tGearbox + Select Case UCase(Trim(Gearbox)) + Case "MT" + Return tGearbox.Manual + Case "AT" + Return tGearbox.Automatic + Case "AMT" + Return tGearbox.SemiAutomatic + Case Else '"Custom" + Return tGearbox.Custom + End Select + End Function + Public Function fDriComp(ByVal sK As String) As tDriComp sK = Trim(UCase(sK)) Select Case sK @@ -158,18 +185,30 @@ Module VECTO_Global - Public Function ConvVehCat(ByVal VehCat As tVehCat) As String + Public Function ConvVehCat(ByVal VehCat As tVehCat, ByVal NiceName As Boolean) As String Select Case VehCat Case tVehCat.Citybus Return "Citybus" Case tVehCat.Coach Return "Coach" Case tVehCat.InterurbanBus - Return "InterurbanBus" + If NiceName Then + Return "Interurban Bus" + Else + Return "InterurbanBus" + End If Case tVehCat.RigidTruck - Return "RigidTruck" + If NiceName Then + Return "Rigid Truck" + Else + Return "RigidTruck" + End If Case tVehCat.Tractor - Return "Tractor" + If NiceName Then + Return "Semitrailer Truck" + Else + Return "Tractor" + End If Case Else ' tVehCat.Undef Return "not defined" End Select @@ -343,27 +382,226 @@ Module VECTO_Global #End Region - Public Sub StartLogfile() + Public Class cLogFile - 'Log start - LOGfile = My.Computer.FileSystem.OpenTextFileWriter(MyAppPath & "LOG.txt", True, FileFormat) - LOGfile.AutoFlush = True + Private LOGstream As System.IO.StreamWriter - LOGfile.WriteLine("------------------------------------------------------------------------------------------") - LOGfile.WriteLine("Starting Session " & Now) - LOGfile.WriteLine("VECTO " & VECTOvers) + Public Function StartLog() As Boolean + + 'Log start + Try + LOGstream = My.Computer.FileSystem.OpenTextFileWriter(MyAppPath & "LOG.txt", True, FileFormat) + LOGstream.AutoFlush = True + WriteToLog(tMsgID.Normal, "Starting Session " & Now) + WriteToLog(tMsgID.Normal, "VECTO " & VECTOvers) + Catch ex As Exception + Return False + End Try + + Return True + + End Function + + Public Function SizeCheck() As Boolean + Dim logfDetail As IO.FileInfo + Dim BackUpError As Boolean + + 'Start new log if file size limit reached + If IO.File.Exists(MyAppPath & "LOG.txt") Then + + 'File size check + logfDetail = My.Computer.FileSystem.GetFileInfo(MyAppPath & "LOG.txt") + + 'If Log too large: Delete + If logfDetail.Length / (2 ^ 20) > Cfg.LogSize Then + + WriteToLog(tMsgID.Normal, "Starting new logfile") + LOGstream.Close() + + BackUpError = False + + Try + If IO.File.Exists(MyAppPath & "LOG_backup.txt") Then IO.File.Delete(MyAppPath & "LOG_backup.txt") + IO.File.Move(MyAppPath & "LOG.txt", MyAppPath & "LOG_backup.txt") + Catch ex As Exception + BackUpError = True + End Try + + If Not StartLog() Then Return False + + If BackUpError Then + WriteToLog(tMsgID.Err, "Failed to backup logfile! (" & MyAppPath & "LOG_backup.txt)") + Else + WriteToLog(tMsgID.Normal, "Logfile restarted. Old log saved to LOG_backup.txt") + End If + + End If + + End If + + Return True + + End Function + + Public Function CloseLog() As Boolean + Try + WriteToLog(tMsgID.Normal, "Closing Session " & Now) + LOGstream.Close() + Catch ex As Exception + Return False + End Try + + Return True + + End Function + + + Public Function WriteToLog(ByVal MsgType As tMsgID, ByVal Msg As String) As Boolean + Dim MsgTypeStr As String + + Select Case MsgType + Case tMsgID.Err + MsgTypeStr = "Error" + Case tMsgID.Warn + MsgTypeStr = "Warning" + Case Else + MsgTypeStr = "-" + End Select + + Try + LOGstream.WriteLine(Now.ToString("yyyy/MM/dd-HH:mm:ss") & vbTab & MsgTypeStr & vbTab & Msg) + Return True + Catch ex As Exception + Return False + End Try + + End Function + + + End Class + +#Region "File path functions" + + 'When no path is specified, then insert either HomeDir or MainDir Special-folders + Public Function fFileRepl(ByVal file As String, Optional ByVal MainDir As String = "") As String + + Dim ReplPath As String + + 'Trim Path + file = Trim(file) + + 'If empty file => Abort + If file = "" Then Return "" + + 'Replace sKeys + file = Microsoft.VisualBasic.Strings.Replace(file, sKey.DefVehPath & "\", MyAppPath & "Default Vehicles\", 1, -1, CompareMethod.Text) + file = Microsoft.VisualBasic.Strings.Replace(file, sKey.HomePath & "\", MyAppPath, 1, -1, CompareMethod.Text) + + 'Replace - Determine folder + If MainDir = "" Then + ReplPath = MyAppPath + Else + ReplPath = MainDir + End If + + ' "..\" => One folder-level up + Do While ReplPath.Length > 0 AndAlso Left(file, 3) = "..\" + ReplPath = fPathUp(ReplPath) + file = file.Substring(3) + Loop + + + 'Supplement Path, if not available + If fPATH(file) = "" Then + + Return ReplPath & file + + Else + Return file + End If + + End Function + + 'Path one-level-up "C:\temp\ordner1\" >> "C:\temp\" + Private Function fPathUp(ByVal Pfad As String) As String + Dim x As Int16 + + Pfad = Pfad.Substring(0, Pfad.Length - 1) + + x = Pfad.LastIndexOf("\") + + If x = -1 Then Return "" + + Return Pfad.Substring(0, x + 1) + + End Function + + 'File name without the path "C:\temp\TEST.txt" >> "TEST.txt" oder "TEST" + Public Function fFILE(ByVal Pfad As String, ByVal MitEndung As Boolean) As String + Dim x As Int16 + x = Pfad.LastIndexOf("\") + 1 + Pfad = Microsoft.VisualBasic.Right(Pfad, Microsoft.VisualBasic.Len(Pfad) - x) + If Not MitEndung Then + x = Pfad.LastIndexOf(".") + If x > 0 Then Pfad = Microsoft.VisualBasic.Left(Pfad, x) + End If + Return Pfad + End Function + + 'Filename without extension "C:\temp\TEST.txt" >> "C:\temp\TEST" + Public Function fFileWoExt(ByVal Path As String) As String + Return fPATH(Path) & fFILE(Path, False) + End Function + + 'Filename without path if Path = WorkDir or MainDir + Public Function fFileWoDir(ByVal file As String, Optional ByVal MainDir As String = "") As String + Dim path As String + + If MainDir = "" Then + path = MyAppPath + Else + path = MainDir + End If + + If UCase(fPATH(file)) = UCase(path) Then file = fFILE(file, True) + + Return file + + End Function + + 'Path alone "C:\temp\TEST.txt" >> "C:\temp\" + ' "TEST.txt" >> "" + Public Function fPATH(ByVal Pfad As String) As String + Dim x As Int16 + If Pfad Is Nothing OrElse Pfad.Length < 3 OrElse Pfad.Substring(1, 2) <> ":\" Then Return "" + x = Pfad.LastIndexOf("\") + Return Microsoft.VisualBasic.Left(Pfad, x + 1) + End Function + + 'Extension alone "C:\temp\TEST.txt" >> ".txt" + Public Function fEXT(ByVal Pfad As String) As String + Dim x As Int16 + x = Pfad.LastIndexOf(".") + If x = -1 Then + Return "" + Else + Return Microsoft.VisualBasic.Right(Pfad, Microsoft.VisualBasic.Len(Pfad) - x) + End If + End Function + + +#End Region - End Sub End Module Public Class csKey Public DRI As csKeyDRI + Public AUX As csKeyAux - Public WorkDir As String = "<WORKDIR>" Public HomePath As String = "<HOME>" - Public GenPath As String = "<GENPATH>" + Public JobPath As String = "<JOBPATH>" Public DefVehPath As String = "<VEHDIR>" Public NoFile As String = "<NOFILE>" Public EmptyString As String = "<EMPTYSTRING>" @@ -377,6 +615,7 @@ Public Class csKey Public Sub New() DRI = New csKeyDRI + AUX = New csKeyAux End Sub Public Class csKeyDRI @@ -395,6 +634,14 @@ Public Class csKey Public Torque As String = "<ME>" End Class + Public Class csKeyAux + Public Fan As String = "FAN" + Public SteerPump As String = "STP" + Public HVAC As String = "AC" + Public ElecSys As String = "ES" + Public PneumSys As String = "PS" + End Class + End Class diff --git a/VECTO/VECTO_Types.vb b/VECTO/VECTO_Types.vb index df001456049d44f0022202eab3e002ba505314bc..ce19e5a86a43676a858d883e4df97105ebd8ab9b 100644 --- a/VECTO/VECTO_Types.vb +++ b/VECTO/VECTO_Types.vb @@ -1,17 +1,16 @@ -Public Enum tPHEMmode As Short - ModeSTANDARD = 0 - ModeBATCH = 1 +''' <summary> +''' Determines how file extensions are set in the File Browser +''' </summary> +''' <remarks></remarks> +Public Enum tFbExtMode As Integer + ForceExt = 0 + MultiExt = 1 + SingleExt = 2 End Enum Public Enum tCalcMode As Short - cmStandard = 0 '0 Standard (Gesamtes Fzg mit bestehendem Kennfeld) - cmEngineOnly = 1 '1 Motor alleine (mit bestehendem Kennfeld) - cmKEmes = 2 '2 Kennfeld erstellen aus Rollenzyklus - cmEAnpi = 3 '3 Motoranalyse (x-Sek. Mittelwerte Messung-Rechng) - cmKEnpi = 4 '4 Kennfeld erstellen aus Motormessung - cmEAmes = 5 '5 Motoranalyse aus Fahrzeugmessung - cmHEV = 6 '6 Hybridfahrzeug (VKM + Elektro) - cmEV = 7 '7 Elektrofahrzeug + ModeSTANDARD = 0 + ModeBATCH = 1 End Enum Public Enum tWorkMsgType @@ -112,27 +111,26 @@ Public Enum tGearbox Custom = 3 End Enum - Public Enum tVehCat As Integer - RigidTruck = 0 - Tractor = 1 - Citybus = 2 - InterurbanBus = 3 - Coach = 4 - Undef = 99 + Undef = 0 + RigidTruck = 1 + Tractor = 2 + Citybus = 3 + InterurbanBus = 4 + Coach = 5 End Enum Public Enum tAxleConf As Integer - a4x2 = 0 - a4x4 = 1 - a6x2 = 2 - a6x4 = 3 - a6x6 = 4 - a8x2 = 5 - a8x4 = 6 - a8x6 = 7 - a8x8 = 8 - Undef = 99 + Undef = 0 + a4x2 = 1 + a4x4 = 2 + a6x2 = 3 + a6x4 = 4 + a6x6 = 5 + a8x2 = 6 + a8x4 = 7 + a8x6 = 8 + a8x8 = 9 End Enum Public Enum tLoading @@ -162,6 +160,14 @@ Public Enum tWHTCpart Motorway End Enum +Public Enum tAux + Fan + SteerPump + HVAC + ElectricSys + PneumSys +End Enum + diff --git a/VECTO/cConfig.vb b/VECTO/cConfig.vb index 32bd3947bc37989ede1e7b43440916e20ac5d7ec..56b3e2e3d2b863fc080f7586e097e56de6d4a30c 100644 --- a/VECTO/cConfig.vb +++ b/VECTO/cConfig.vb @@ -1,16 +1,18 @@ -Public Class cConfig +Imports System.Collections.Generic - 'Private Const FormatVersion As Short = 1 - 'Private FileVersion As Short +Public Class cConfig - Public GnVorgab As Boolean - Private sWorkDPath As String - Private WorkDirHome As Boolean 'Nicht direkt in Configdatei + Public FilePath As String + + Private Const FormatVersion As Short = 1 + Private FileVersion As Short + + Public GnUfromCycle As Boolean Public LastMode As Int16 Public ModOut As Boolean Public BATCHoutpath As String 'Ausgabepfad für BATCH-Modus: <WORKDIR>, <GENPATH> oder Pfad Public BATCHoutSubD As Boolean - Public WegKorJa As Boolean + Public DistCorr As Boolean Public LogSize As Single Public AirDensity As Single Public OpenCmd As String @@ -21,6 +23,8 @@ Public FirstRun As Boolean + Public DeclMode As Boolean + Public Sub New() SetDefault() End Sub @@ -29,118 +33,17 @@ AirDensity = cDeclaration.AirDensity FuelDens = cDeclaration.FuelDens CO2perFC = cDeclaration.CO2perFC + DistCorr = True + GnUfromCycle = False End Sub - Public Function ConfigLOAD() As Boolean - Dim c As New cFile_V3 - Dim line As String() - - SetDefault() - - If Not IO.File.Exists(MyConfPath & "settings.txt") Then - If Not Cfg.FirstRun Then GUImsg(tMsgID.Err, "Config-file not found! Using default settings.") - Return False - End If - - c.OpenRead(MyConfPath & "settings.txt", ";") - - '*** - '*** First line: Version - 'txt = Trim(UCase(c.ReadLine(0))) - 'If Microsoft.VisualBasic.Left(txt, 1) = "V" Then - ' ' "Remove V'' => It remains the number - ' txt = txt.Replace("V", "") - ' If Not IsNumeric(txt) Then - ' 'If invalid version: Abort - ' GoTo lbEr - ' Else - ' 'Version settled - ' FileVersion = CInt(txt) - ' End If - 'Else - ' c.Close() - ' Return ReadOldFormat() - 'End If - - 'If FileVersion > FormatVersion Then - ' GUImsg(tMsgID.Err, "Config-file Version " & FileVersion & " incompatible with application version! Using default settings.") - ' Return False - 'End If - - sWorkDPath = Trim(c.ReadLine(0)) - If UCase(sWorkDPath) = sKey.HomePath Then - WorkDirHome = True - sWorkDPath = MyAppPath - End If - - LastMode = CShort(c.ReadLine(0)) - - c.ReadLine() - - c.ReadLine() - - c.ReadLine() - - c.ReadLine() - - c.ReadLine() - - ModOut = CBool(c.ReadLine(0)) - - WegKorJa = CBool(c.ReadLine(0)) - - GnVorgab = CBool(c.ReadLine(0)) - - c.ReadLine() - - c.ReadLine() - - LogSize = CSng(c.ReadLine(0)) - - BATCHoutpath = Trim(c.ReadLine(0)) - - BATCHoutSubD = CBool(c.ReadLine(0)) - - AirDensity = CSng(c.ReadLine(0)) - - c.ReadLine() - - c.ReadLine() - - line = c.ReadLine - OpenCmd = line(0) - If UBound(line) > 0 Then OpenCmdName = line(1) - - FuelDens = CSng(c.ReadLine(0)) - CO2perFC = CSng(c.ReadLine(0)) - - If c.EndOfFile Then GoTo lbDone - - FirstRun = CBool(c.ReadLine(0)) - - - -lbDone: - - c.Close() - - Return True - - -lbEr: - c.Close() - Return False - - End Function - Public Sub SetDefault() - GnVorgab = True - sWorkDPath = "c:\" + GnUfromCycle = True LastMode = 0 ModOut = True - BATCHoutpath = sKey.GenPath + BATCHoutpath = sKey.JobPath BATCHoutSubD = False - WegKorJa = True + DistCorr = True LogSize = 2 AirDensity = 1.2 OpenCmd = "notepad" @@ -149,102 +52,89 @@ lbEr: FuelDens = 0.835 CO2perFC = 3.153 - WorkDirHome = False - FirstRun = True - End Sub + DeclMode = True - Public Sub ConfigSAVE() - Dim c As New cFile_V3 - c.OpenWrite(MyConfPath & "settings.txt", ";") - - 'Version - 'c.WriteLine("V" & FormatVersion) - - c.WriteLine("c Working Directory Path") - If WorkDirHome And UCase(Trim(sWorkDPath)) = UCase(Trim(MyAppPath)) Then - c.WriteLine(sKey.HomePath) - Else - c.WriteLine(sWorkDPath) - WorkDirHome = False - End If - c.WriteLine("c LastMode 0/1/2") - c.WriteLine(F_MAINForm.CBoxMODE.SelectedIndex) - c.WriteLine("c NOT USED") - c.WriteLine("0") - c.WriteLine("c NOT USED") - c.WriteLine("0") - c.WriteLine("c NOT USED") - c.WriteLine("0") - c.WriteLine("c NOT USED") - c.WriteLine("0") - c.WriteLine("c NOT USED") - c.WriteLine("0") - c.WriteLine("c Modal output 1/0") - c.WriteLine(Math.Abs(CInt(ModOut))) - c.WriteLine("c Cycle Distance Correction 1/0") - c.WriteLine(Math.Abs(CInt(WegKorJa))) - c.WriteLine("c Use gears/rpm's form driving cycle 1/0") - c.WriteLine(Math.Abs(CInt(GnVorgab))) - c.WriteLine("c Log file size limit [MB]") - c.WriteLine(LogSize) - c.WriteLine("c NOT USED") - c.WriteLine("0") - c.WriteLine("c NOT USED") - c.WriteLine("0") - c.WriteLine("c BATCH Output Path") - c.WriteLine(BATCHoutpath) - c.WriteLine("c BATCH Sub Dir Output 1/0") - c.WriteLine(Math.Abs(CInt(BATCHoutSubD))) - c.WriteLine("c Air Density [kg/m3]") - c.WriteLine(CStr(AirDensity)) - c.WriteLine("c NOT USED") - c.WriteLine("0") - c.WriteLine("c NOT USED") - c.WriteLine("0") - c.WriteLine("c File Open CMD") - c.WriteLine(OpenCmd, OpenCmdName) - - c.WriteLine("c Fuel Density [kg/l]") - c.WriteLine(FuelDens.ToString) - c.WriteLine("c CO2 per FC [kgCO2/kgFC]") - c.WriteLine(CO2perFC.ToString) - - c.WriteLine("c First Run (Show Quick Start Guide Prompt)") - c.WriteLine(Math.Abs(CInt(FirstRun))) - - c.Close() - c = Nothing End Sub - Public Sub SetWorkDir(ByVal Path As String) + Public Sub ConfigLOAD() + + Dim JSON As New cJSON + + SetDefault() + + If Not IO.File.Exists(FilePath) Then Exit Sub + + + If Not JSON.ReadFile(FilePath) Then GUImsg(tMsgID.Err, "Failed to load settings! Using default settings.") - Path = Trim(Path) + Try - If Path = "" Then Exit Sub + FileVersion = JSON.Content("Header")("FileVersion") - If Right(Path, 1) <> "\" Then Path &= "\" + LastMode = JSON.Content("Body")("LastMode") + ModOut = JSON.Content("Body")("ModOut") + DistCorr = JSON.Content("Body")("DistCorrection") + GnUfromCycle = JSON.Content("Body")("UseGnUfromCycle") + LogSize = JSON.Content("Body")("LogSize") + BATCHoutpath = JSON.Content("Body")("BATCHoutpath") + BATCHoutSubD = JSON.Content("Body")("BATCHoutSubD") + AirDensity = JSON.Content("Body")("AirDensity") + FuelDens = JSON.Content("Body")("FuelDensity") + CO2perFC = JSON.Content("Body")("CO2perFC") + OpenCmd = JSON.Content("Body")("OpenCmd") + OpenCmdName = JSON.Content("Body")("OpenCmdName") + FirstRun = JSON.Content("Body")("FirstRun") + DeclMode = JSON.Content("Body")("DeclMode") - If UCase(Path) <> UCase(sWorkDPath) Then - If UCase(Path) = sKey.HomePath Then - WorkDirHome = True - sWorkDPath = MyAppPath - Else - WorkDirHome = False - sWorkDPath = Path - End If - End If + Catch ex As Exception + + GUImsg(tMsgID.Err, "Error while loading settings!") + + End Try + + + End Sub + + Public Sub ConfigSAVE() + Dim JSON As New cJSON + Dim dic As Dictionary(Of String, Object) + + '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) + + dic.Add("LastMode", F_MAINForm.CBoxMODE.SelectedIndex) + dic.Add("ModOut", ModOut) + dic.Add("DistCorrection", DistCorr) + dic.Add("UseGnUfromCycle", GnUfromCycle) + dic.Add("LogSize", LogSize) + dic.Add("BATCHoutpath", BATCHoutpath) + dic.Add("BATCHoutSubD", BATCHoutSubD) + dic.Add("AirDensity", AirDensity) + dic.Add("FuelDensity", FuelDens) + dic.Add("CO2perFC", CO2perFC) + dic.Add("OpenCmd", OpenCmd) + dic.Add("OpenCmdName", OpenCmdName) + dic.Add("FirstRun", FirstRun) + dic.Add("DeclMode", DeclMode) + + JSON.Content.Add("Body", dic) + + JSON.WriteFile(FilePath) End Sub - Public ReadOnly Property WorkDPath As String - Get - Return sWorkDPath - End Get - End Property End Class diff --git a/VECTO/cDEV.vb b/VECTO/cDEV.vb index ac9d8fabde59f2bd27a7fdacb6e04caff1052503..88ed58e5713c1da2ba4afe81e1819e811f970510 100644 --- a/VECTO/cDEV.vb +++ b/VECTO/cDEV.vb @@ -7,16 +7,10 @@ Public Class cDEV Private MyOptions As Dictionary(Of String, cDEVoption) Private iOptionsDim As Integer - Public GearCorrection As Boolean - Public TCiterPrec As Single Public TCnUstep As Single Public TCnUstepMin As Single - Public SpeedPeEps As Single - Public PreRun As Boolean - - Public AllowAprxTrLoss As Boolean @@ -30,7 +24,7 @@ Public Class cDEV ' ' ConfigType <tDEVconfType> ...Type definition: Boolean, Integer, Single, String, menu selection (Integer) or Reference to Function ' Description <String> ...Description of the parameters - ' SaveInConfg <Boolean> ...Whether you want to save settings for next PHEM-startup + ' SaveInConfg <Boolean> ...Whether you want to save settings for next VECTO-startup ' Enabled <Boolean> ...Whether settings in the DEV-tab can be changed ' ' II) default value definition. Distinguish which ConfigType to use: @@ -115,11 +109,6 @@ Public Class cDEV 'MyOptions.Add("Menu_Test", Conf0) - Conf0 = New cDEVoption(tDEVconfType.tBoolean, "Gear Correcion (gear shift polygons model only!)", False) - Conf0.BoolVal = False - MyOptions.Add("GearCorrection", Conf0) - - Conf0 = New cDEVoption(tDEVconfType.tSingleVal, "TC iteration: target precision for torque ratio") Conf0.SingleVal = 0.001 @@ -133,20 +122,6 @@ Public Class cDEV Conf0.SingleVal = 0.01 MyOptions.Add("TCnUstepMin", Conf0) - - Conf0 = New cDEVoption(tDEVconfType.tSingleVal, "Epsilon for Iteration Abort Criterion: eps >= |Pdrag - Pe| / VEH.Pnenn [-]") - Conf0.SingleVal = 0.0001 - MyOptions.Add("SpeedPeEps", Conf0) - - Conf0 = New cDEVoption(tDEVconfType.tBoolean, "PreRun", False) - Conf0.BoolVal = True - MyOptions.Add("PreRun", Conf0) - - Conf0 = New cDEVoption(tDEVconfType.tBoolean, "Allow approximate transmission loss calculation in Cycle Preprocessing and Gear Shift Model", False) - Conf0.BoolVal = True - MyOptions.Add("AllowAprxTrLoss", Conf0) - - '**************************** END: Parameters Configuration '***************************** '***************************************************************************************** '***************************************************************************************** @@ -157,17 +132,9 @@ Public Class cDEV 'Initialize the actual Config-Parameters from MyConfigs list Public Sub SetOptions() - GearCorrection = MyOptions("GearCorrection").BoolVal TCiterPrec = MyOptions("TCiterPrec").SingleVal TCnUstep = MyOptions("TCnUstep").SingleVal TCnUstepMin = MyOptions("TCnUstepMin").SingleVal - - SpeedPeEps = MyOptions("SpeedPeEps").SingleVal - - PreRun = MyOptions("PreRun").BoolVal - - AllowAprxTrLoss = MyOptions("AllowAprxTrLoss").BoolVal - End Sub 'Demo for Delegate Function diff --git a/VECTO/cDeclaration.vb b/VECTO/cDeclaration.vb index c12c4e8911cc2f71c55b095966f49bd8a5637779..4619e85de82ad1024562abf88c731d3a5ddf73ea 100644 --- a/VECTO/cDeclaration.vb +++ b/VECTO/cDeclaration.vb @@ -1,8 +1,10 @@ Imports System.Collections.Generic +Imports iTextSharp.text.pdf +Imports System.IO Public Class cDeclaration - Public Active As Boolean Public CurrentMission As cMission + Public CurrentLoading As tLoading Public Missions As Dictionary(Of tMission, cMission) Public SegmentTable As cSegmentTable Public SegRef As cSegmentTableEntry @@ -12,6 +14,9 @@ Public Class cDeclaration Public Const SSdelay As Single = 5 Public Const LACa As Single = -0.5 Public Const LACvmin As Single = 50 + Public Const Overspeed As Single = 5 + Public Const Underspeed As Single = 5 + Public Const ECvmin As Single = 50 Public Const TqResv As Single = 20 Public Const TqResvStart As Single = 20 @@ -22,15 +27,40 @@ Public Class cDeclaration Public Const RRCTr As Single = 0.00555 Public Const FzISOTr As Single = 37500 - Public Const AirDensity As Single = 1.17 'HILS Default Silberholz + Public Const AirDensity As Single = 1.188 Public Const FuelDens As Single = 0.832 Public Const CO2perFC As Single = 3.16 + Public Const AuxESeff As Single = 0.7 + + Private lPT1nU As List(Of Single) + Private lPT1 As List(Of Single) + Private PT1dim As Integer + + Public WHTCresults As Dictionary(Of tWHTCpart, Single) + Public WHTCcorrFactor As Single - Public Sub New() - Active = True - End Sub + Public Report As cReport + + Public AuxTechs As Dictionary(Of tAux, List(Of String)) + Public AuxPower As Dictionary(Of String, Single) + + Private AuxFanPower As Dictionary(Of String, Dictionary(Of tMission, Single)) + + Private AuxSteerPumpPower As Dictionary(Of String, Dictionary(Of tMission, Single())) + Private AuxSteepPumpFactors As Dictionary(Of String, Single()) + + Private AuxHVACPower As Dictionary(Of String, Dictionary(Of tMission, Single)) + + Private AuxESbase As Dictionary(Of tMission, Single) + Public AuxESpower As Dictionary(Of String, Dictionary(Of tMission, Single)) + + Private AuxPSpower As Dictionary(Of String, Dictionary(Of tMission, Single)) + + + Private Wheels As Dictionary(Of String, cWheel) + Private Rims As Dictionary(Of String, cRim) Public Function Init() As Boolean @@ -45,6 +75,8 @@ Public Class cDeclaration Dim s As String() Dim TrS As Single Dim TrA As Single + Dim stl As String() + Dim First As Boolean Dim BodyTrWeightList As List(Of String) Dim LoadingList As List(Of String) @@ -54,6 +86,13 @@ Public Class cDeclaration Dim WHTCWF As List(Of String) Dim dWHTCWF As Dictionary(Of tWHTCpart, Single) + Dim at0 As List(Of String) + Dim AuxPower0 As Dictionary(Of tMission, Single) + Dim STEpower0 As Dictionary(Of tMission, Single()) + + Dim w0 As cWheel + Dim r0 As cRim + 'Initialize Missions = New Dictionary(Of tMission, cMission) SegmentTable = New cSegmentTable @@ -251,13 +290,361 @@ Public Class cDeclaration End If Loop + + file.Close() + Catch ex As Exception file.Close() GUImsg(tMsgID.Err, "Failed to load Declaration Config (Segment Table)! " & ex.Message) Return False End Try - Cfg.DeclInit() + + 'Aux + AuxTechs = New Dictionary(Of tAux, List(Of String)) + + + + 'Aux - Fan + AuxFanPower = New Dictionary(Of String, Dictionary(Of tMission, Single)) + + Try + + If Not file.OpenRead(MyDeclPath & "VAUX\Fan-Tech.csv") Then + GUImsg(tMsgID.Err, "Failed to load Declaration Config (Fan aux config)!") + Return False + End If + + 'Skip Header + file.ReadLine() + + at0 = New List(Of String) + + Do While Not file.EndOfFile + + line = file.ReadLine + + at0.Add(line(0)) + + AuxPower0 = New Dictionary(Of tMission, Single) + + i = 0 + For Each mt0 In SegmentTable.MissionList + i += 1 + AuxPower0.Add(mt0, line(i)) + Next + + AuxFanPower.Add(line(0), AuxPower0) + Loop + + AuxTechs.Add(tAux.Fan, at0) + + file.Close() + + Catch ex As Exception + file.Close() + GUImsg(tMsgID.Err, "Failed to load Declaration Config (Fan aux config)!" & ex.Message) + Return False + End Try + + + + 'Aux - Steering Pump + AuxSteerPumpPower = New Dictionary(Of String, Dictionary(Of tMission, Single())) + AuxSteepPumpFactors = New Dictionary(Of String, Single()) + + Try + + If Not file.OpenRead(MyDeclPath & "VAUX\SP-Tech.csv") Then + GUImsg(tMsgID.Err, "Failed to load Declaration Config (Steering pump config)!") + Return False + End If + + 'Skip Header + file.ReadLine() + + at0 = New List(Of String) + + Do While Not file.EndOfFile + + line = file.ReadLine + + at0.Add(line(0)) + + AuxSteepPumpFactors.Add(line(0), New Single() {CSng(line(1)), CSng(line(2)), CSng(line(3)), CSng(line(4))}) + + Loop + + file.Close() + + If Not file.OpenRead(MyDeclPath & "VAUX\SP-Table.csv") Then + GUImsg(tMsgID.Err, "Failed to load Declaration Config (Steering pump config)!") + Return False + End If + + 'Skip Header + file.ReadLine() + + Do While Not file.EndOfFile + + line = file.ReadLine + + STEpower0 = New Dictionary(Of tMission, Single()) + + i = 0 + For Each mt0 In SegmentTable.MissionList + i += 1 + + If line(i) = "0" Then + STEpower0.Add(mt0, New Single() {0}) + Else + stl = line(i).Split("/") + STEpower0.Add(mt0, New Single() {CSng(stl(0)), CSng(stl(1)), CSng(stl(2)), CSng(stl(3))}) + End If + + Next + + AuxSteerPumpPower.Add(line(0), STEpower0) + + Loop + + AuxTechs.Add(tAux.SteerPump, at0) + + file.Close() + + Catch ex As Exception + file.Close() + GUImsg(tMsgID.Err, "Failed to load Declaration Config (Steering pump config)!" & ex.Message) + Return False + End Try + + + 'Aux - HVAC + AuxHVACPower = New Dictionary(Of String, Dictionary(Of tMission, Single)) + + Try + + If Not file.OpenRead(MyDeclPath & "VAUX\HVAC-Table.csv") Then + GUImsg(tMsgID.Err, "Failed to load Declaration Config (HVAC config)!") + Return False + End If + + 'Skip Header + file.ReadLine() + + Do While Not file.EndOfFile + + line = file.ReadLine + + AuxPower0 = New Dictionary(Of tMission, Single) + + i = 0 + For Each mt0 In SegmentTable.MissionList + i += 1 + AuxPower0.Add(mt0, line(i)) + Next + + AuxHVACPower.Add(line(0), AuxPower0) + + Loop + + Catch ex As Exception + file.Close() + GUImsg(tMsgID.Err, "Failed to load Declaration Config (HVAC config)!" & ex.Message) + Return False + End Try + + at0 = New List(Of String) + at0.Add("Default") + AuxTechs.Add(tAux.HVAC, at0) + + + 'Aux - Electric System + AuxESbase = New Dictionary(Of tMission, Single) + AuxESpower = New Dictionary(Of String, Dictionary(Of tMission, Single)) + + Try + + If Not file.OpenRead(MyDeclPath & "VAUX\ES-Tech.csv") Then + GUImsg(tMsgID.Err, "Failed to load Declaration Config (Electric system config)!") + Return False + End If + + 'Skip Header + file.ReadLine() + + First = True + Do While Not file.EndOfFile + + line = file.ReadLine + + AuxPower0 = New Dictionary(Of tMission, Single) + + i = 0 + For Each mt0 In SegmentTable.MissionList + i += 1 + AuxPower0.Add(mt0, line(i)) + Next + + If First Then + AuxESbase = AuxPower0 + First = False + Else + AuxESpower.Add(line(0), AuxPower0) + End If + + Loop + + file.Close() + + Catch ex As Exception + file.Close() + GUImsg(tMsgID.Err, "Failed to load Declaration Config (Electric system config)!" & ex.Message) + Return False + End Try + + at0 = New List(Of String) + at0.Add("Custom Technology List") + AuxTechs.Add(tAux.ElectricSys, at0) + + + + + + 'Aux - Pneumatic System + AuxPSpower = New Dictionary(Of String, Dictionary(Of tMission, Single)) + + Try + + If Not file.OpenRead(MyDeclPath & "VAUX\PS-Table.csv") Then + GUImsg(tMsgID.Err, "Failed to load Declaration Config (Pneumatic system config)!") + Return False + End If + + 'Skip Header + file.ReadLine() + + Do While Not file.EndOfFile + + line = file.ReadLine + + AuxPower0 = New Dictionary(Of tMission, Single) + + i = 0 + For Each mt0 In SegmentTable.MissionList + i += 1 + AuxPower0.Add(mt0, line(i)) + Next + + AuxPSpower.Add(line(0), AuxPower0) + + Loop + + Catch ex As Exception + file.Close() + GUImsg(tMsgID.Err, "Failed to load Declaration Config (Pneumatic system config)!" & ex.Message) + Return False + End Try + + at0 = New List(Of String) + at0.Add("Default") + AuxTechs.Add(tAux.PneumSys, at0) + + + + + + 'Default PT1 values + lPT1nU = New List(Of Single) + lPT1 = New List(Of Single) + PT1dim = -1 + + If Not file.OpenRead(MyDeclPath & "PT1.csv") Then + GUImsg(tMsgID.Err, "Failed to load Declaration Config (PT1 table)!") + Return False + End If + + Try + + Do While Not file.EndOfFile + line = file.ReadLine + PT1dim += 1 + lPT1nU.Add(CDbl(line(0))) + lPT1.Add(CDbl(line(1))) + Loop + + Catch ex As Exception + file.Close() + GUImsg(tMsgID.Err, "Failed to load Declaration Config (PT1 table)!" & ex.Message) + Return False + End Try + + file.Close() + + + + 'Wheels + Wheels = New Dictionary(Of String, cWheel) + + If Not file.OpenRead(MyDeclPath & "wheels.csv") Then + GUImsg(tMsgID.Err, "Failed to load Declaration Config (Wheels table)!") + Return False + End If + + Try + + Do While Not file.EndOfFile + line = file.ReadLine + + w0 = New cWheel + w0.Inertia = CSng(line(1)) + w0.Diam = CSng(line(2)) + w0.SizeA = (CInt(line(3)) = 1) + + Wheels.Add(line(0), w0) + + Loop + + Catch ex As Exception + file.Close() + GUImsg(tMsgID.Err, "Failed to load Declaration Config (Wheels table)!" & ex.Message) + Return False + End Try + + file.Close() + + + + 'Rims + Rims = New Dictionary(Of String, cRim) + + If Not file.OpenRead(MyDeclPath & "rims.csv") Then + GUImsg(tMsgID.Err, "Failed to load Declaration Config (Rims table)!") + Return False + End If + + Try + + Do While Not file.EndOfFile + line = file.ReadLine + + r0 = New cRim + r0.Fa = CSng(line(1)) + r0.Fb = CSng(line(2)) + + Rims.Add(line(0), r0) + + Loop + + Catch ex As Exception + file.Close() + GUImsg(tMsgID.Err, "Failed to load Declaration Config (Rims table)!" & ex.Message) + Return False + End Try + + file.Close() + + GUImsg(tMsgID.Normal, "Declaration Config loaded.") @@ -265,17 +652,17 @@ Public Class cDeclaration End Function - Public Function GetEngInertia(ByVal Displ As Single) As Single - Return 0.41 + 0.27 * (Displ / 1000) + Public Function EngInertia(ByVal Displ As Single) As Single + Return 1.3 + 0.41 + 0.27 * (Displ / 1000) End Function Public Function TracInt(ByVal Gearbox As tGearbox) As Single Select Case Gearbox Case tGearbox.Manual - Return 1 + Return 2 Case tGearbox.SemiAutomatic - Return 0.8 + Return 1 Case Else 'tGearbox.Automatic Return 0.8 @@ -313,6 +700,88 @@ Public Class cDeclaration End Select End Function + Public Function WheelsInertia(ByVal Wheel As String) As Single + + If Wheels.ContainsKey(Wheel) Then + Return Wheels(Wheel).Inertia + Else + Return -1 + End If + + End Function + + Public Function rdyn(ByVal Wheel As String, ByVal Rim As String) As Single + Dim F As Single + Dim w As cWheel + + If Not Wheels.ContainsKey(Wheel) Then + Return -1 + End If + + + If Not Rims.ContainsKey(Rim) Then + Return -1 + End If + + w = Wheels(Wheel) + + If w.SizeA Then + F = Rims(Rim).Fa + Else + F = Rims(Rim).Fb + End If + + Return (F * w.Diam) / (2 * Math.PI) + + End Function + + Public ReadOnly Property WheelsList As Dictionary(Of String, cWheel).KeyCollection + Get + Return Wheels.Keys + End Get + End Property + + Public ReadOnly Property RimsList As Dictionary(Of String, cRim).KeyCollection + Get + Return Rims.Keys + End Get + End Property + + Public Function ConvPicPath(ByVal HDVclass As String, ByVal LongHaul As Boolean) As String + + Select Case HDVclass + + Case 1, 2, 3 + Return MyDeclPath & "Reports\4x2r.png" + + Case 4 + If LongHaul Then + Return MyDeclPath & "Reports\4x2rt.png" + Else + Return MyDeclPath & "Reports\4x2r.png" + End If + + Case 5 + Return MyDeclPath & "Reports\4x2tt.png" + + Case 9 + If LongHaul Then + Return MyDeclPath & "Reports\6x2rt.png" + Else + Return MyDeclPath & "Reports\6x2r.png" + End If + + Case 10 + Return MyDeclPath & "Reports\6x2tt.png" + + Case Else + Return MyDeclPath & "Reports\Undef.png" + + End Select + + End Function + + Public Function SetRef() As Boolean Return SegmentTable.SetRef(SegRef, VEH.VehCat, VEH.AxleConf, VEH.MassMax) End Function @@ -323,11 +792,16 @@ Public Class cDeclaration ''' </summary> ''' <param name="CycleIndex"></param> ''' <returns></returns> - ''' <remarks></remarks> + ''' <remarks></remarks> Public Function CalcInitCycle(ByVal CycleIndex As Integer) As Boolean CurrentMission = Missions(SegRef.Missions(CycleIndex)) + WHTCcorrFactor = Declaration.SegRef.WHTCWF(Declaration.CurrentMission.MissionID)(tWHTCpart.Urban) * ENG.WHTCurban / Declaration.WHTCresults(tWHTCpart.Urban) _ + + Declaration.SegRef.WHTCWF(Declaration.CurrentMission.MissionID)(tWHTCpart.Rural) * ENG.WHTCrural / Declaration.WHTCresults(tWHTCpart.Rural) _ + + Declaration.SegRef.WHTCWF(Declaration.CurrentMission.MissionID)(tWHTCpart.Motorway) * ENG.WHTCmw / Declaration.WHTCresults(tWHTCpart.Motorway) + + If Not VEH.DeclInit Then Return False Return True @@ -341,10 +815,206 @@ Public Class cDeclaration ''' <returns></returns> ''' <remarks></remarks> Public Function CalcInitLoad(ByVal Loading As tLoading) As Boolean + Dim MsgSrc As String + Dim U As Single + Dim F As Single + Dim B As Single + Dim S As Single + Dim fU As Single + Dim fF As Single + Dim fB As Single + Dim fS As Single + Dim sl As Single() + Dim Result As Boolean + Dim ESsum As Single + Dim EStech As String + + MsgSrc = "DeclInit" + + CurrentLoading = Loading If Not VEH.DeclInitLoad(Loading) Then Return False - Return True + 'AuxPower + AuxPower = New Dictionary(Of String, Single) + + Result = True + + 'Fan + Try + AuxPower.Add(sKey.AUX.Fan, AuxFanPower(VEC.AuxPaths(sKey.AUX.Fan).TechStr)(CurrentMission.MissionID) / 1000) + Catch ex As Exception + WorkerMsg(tMsgID.Err, "Failed to initialise fan! " & ex.Message, MsgSrc) + Result = False + End Try + + 'Steering pump + Try + sl = AuxSteerPumpPower(SegRef.HDVclass)(CurrentMission.MissionID) + U = sl(0) + F = sl(1) + B = sl(2) + S = sl(3) + sl = AuxSteepPumpFactors(VEC.AuxPaths(sKey.AUX.SteerPump).TechStr) + fU = sl(0) + fF = sl(1) + fB = sl(2) + fS = sl(3) + AuxPower.Add(sKey.AUX.SteerPump, (U * fU + F * fF + B * fB + S * fS) / 1000) + Catch ex As Exception + WorkerMsg(tMsgID.Err, "Failed to initialise steering pump! " & ex.Message, MsgSrc) + Result = False + End Try + + 'HVAC + Try + AuxPower.Add(sKey.AUX.HVAC, AuxHVACPower(SegRef.HDVclass)(CurrentMission.MissionID) / 1000) + Catch ex As Exception + WorkerMsg(tMsgID.Err, "Failed to initialise HVAC! " & ex.Message, MsgSrc) + Result = False + End Try + + 'Electric System + Try + + ESsum = AuxESbase(CurrentMission.MissionID) + + For Each EStech In VEC.EStechs + + If Not AuxESpower.ContainsKey(EStech) Then + WorkerMsg(tMsgID.Err, "Electric system '" & EStech & "' is not supported! ", MsgSrc) + Result = False + End If + + ESsum -= AuxESpower(EStech)(CurrentMission.MissionID) + + Next + + AuxPower.Add(sKey.AUX.ElecSys, ESsum / (1000 * AuxESeff)) + + Catch ex As Exception + WorkerMsg(tMsgID.Err, "Failed to initialise electric system! " & ex.Message, MsgSrc) + Result = False + End Try + + + 'PS + Try + AuxPower.Add(sKey.AUX.PneumSys, AuxPSpower(SegRef.HDVclass)(CurrentMission.MissionID) / 1000) + Catch ex As Exception + WorkerMsg(tMsgID.Err, "Failed to initialise pneumatic system! " & ex.Message, MsgSrc) + Result = False + End Try + + + Return Result + + End Function + + Public Function PT1(ByVal nU As Single) As Single + Dim i As Int32 + + 'Extrapolation for x < x(1) + If lPT1nU(0) >= nU Then + i = 1 + GoTo lbInt + End If + + i = 0 + Do While lPT1nU(i) < nU And i < PT1dim + i += 1 + Loop + +lbInt: + 'Interpolation + Return (nU - lPT1nU(i - 1)) * (lPT1(i) - lPT1(i - 1)) / (lPT1nU(i) - lPT1nU(i - 1)) + lPT1(i - 1) + + End Function + + Public Sub ReportInit() + + Report = New cReport + + With Report + .Filepath = fFileWoExt(JobFile) & ".pdf" + .HDVclassStr = SegRef.HDVclass + .VehCat = SegRef.VehCat + .AxleConf = SegRef.AxleConf + .MassMaxStr = VEH.MassMax & "t" + .JobFile = fFILE(JobFile, True) + .DateStr = Now.ToString + .Creator = Lic.LicString + .EngStr = (ENG.Displ / 1000).ToString("0.0") & " l " & Math.Round(ENG.Pmax, 0).ToString("#") & " kW" + .EngModelStr = ENG.ModelName + .GbxStr = GBX.GearCount & "-Speed " & GearboxConv(GBX.gs_Type) + .GbxModelStr = GBX.ModelName + End With + + End Sub + + Public Sub ReportAddCycle() + Dim mr As New cReport.cMissionResults + + mr.MissionRef = CurrentMission + + Report.CurrentMR = mr + Report.MissionResults.Add(mr) + + End Sub + + Public Sub ReportAddResults() + Dim lr As New cReport.cLoadingResults + Dim t1 As Integer + Dim t As Integer + Dim Vquer As Single + Dim sum As Double + Dim d As Double + + t1 = MODdata.tDim + + 'Average Speed calculation + sum = 0 + For t = 0 To t1 + sum += MODdata.Vh.V(t) + Next + Vquer = 3.6 * sum / (t1 + 1) + + With lr + + .Loading = VEH.Loading / 1000 + .Speed = Vquer + .FCkm = (100 * MODdata.FCavgWHTCc / Vquer) / (Cfg.FuelDens * 1000) + .CO2km = Cfg.CO2perFC * (MODdata.FCavgWHTCc / Vquer) + If VEH.Loading > 0 Then + .FCtkm = .FCkm / .Loading + .CO2tkm = .CO2km / .Loading + End If + .FCerror = MODdata.FCerror + + d = 0 + MODdata.Vh.AltIntp(d, True) + For t = 0 To t1 + .ActualSpeed.Add(MODdata.Vh.V(t) * 3.6) + .TargetSpeed.Add(MODdata.Vh.Vsoll(t) * 3.6) + d += MODdata.Vh.V(t) + .Distance.Add(CSng(d / 1000)) + .Alt.Add(MODdata.Vh.AltIntp(d, False)) + .nU.Add(MODdata.nU(t)) + .Tq.Add(nPeToM(MODdata.nU(t), MODdata.Pe(t))) + Next + + End With + + Report.CurrentMR.Results.Add(CurrentLoading, lr) + + End Sub + + Public Function WriteReport() As Boolean + + Report.CreateCharts() + + Return Report.WritePdfs + End Function @@ -379,7 +1049,7 @@ Public Class cDeclaration Tq = line(2) 'Denorm - nU = nU * 0.01 * (0.45 * ENG.Nlo + 0.45 * ENG.Npref + 0.1 * ENG.nHi - ENG.Nidle) * 2.0327 + ENG.Nidle + nU = nU * 0.01 * (0.45 * FLD(0).Nlo + 0.45 * FLD(0).Npref + 0.1 * FLD(0).Nhi - ENG.Nidle) * 2.0327 + ENG.Nidle If Tq < 0 Then Tq = -90000000000.0 @@ -403,6 +1073,9 @@ Public Class cDeclaration Dim Psum As Double Dim i As Integer Dim FC As List(Of Single) + Dim MsgSrc As String + + MsgSrc = "WHTCcor/Calc" WHTCresults = New Dictionary(Of tWHTCpart, Single) @@ -417,6 +1090,7 @@ Public Class cDeclaration Psum += Math.Max(0, MODdata.Pe(i)) Next WHTCresults.Add(tWHTCpart.Urban, sum / Psum) + WorkerMsg(tMsgID.Normal, " > Urban: " & (sum / Psum).ToString("0.0") & " [g/kWh]", MsgSrc) 'Rural sum = 0 @@ -426,6 +1100,7 @@ Public Class cDeclaration Psum += Math.Max(0, MODdata.Pe(i)) Next WHTCresults.Add(tWHTCpart.Rural, sum / Psum) + WorkerMsg(tMsgID.Normal, " > Rural: " & (sum / Psum).ToString("0.0") & " [g/kWh]", MsgSrc) 'Motorway sum = 0 @@ -435,11 +1110,24 @@ Public Class cDeclaration Psum += Math.Max(0, MODdata.Pe(i)) Next WHTCresults.Add(tWHTCpart.Motorway, sum / Psum) + WorkerMsg(tMsgID.Normal, " > Motorway: " & (sum / Psum).ToString("0.0") & " [g/kWh]", MsgSrc) + End Sub End Class +Public Class cWheel + Public Inertia As Single + Public Diam As Single + Public SizeA As Boolean +End Class + +Public Class cRim + Public Fa As Single + Public Fb As Single +End Class + Public Class cMission Public MissionID As tMission Public NameStr As String @@ -537,6 +1225,585 @@ Public Class cSegmentTableEntry End Class Public Class cReport - Private MyChart As + + Public Filepath As String = "" + Public CurrentMR As cMissionResults + Public MissionResults As List(Of cMissionResults) + Public HDVclassStr As String = "" + Public VehCat As tVehCat = tVehCat.Undef + Public AxleConf As tAxleConf = tAxleConf.Undef + Public MassMaxStr As String = "" + Public JobFile As String = "" + Public DateStr As String = "" + Public Creator As String = "" + Public EngStr As String = "" + Public EngModelStr As String = "" + Public GbxStr As String = "" + Public GbxModelStr As String = "" + + Public ChartCO2tkm As Image + Public ChartCO2speed As Image + + + Public Sub New() + MissionResults = New List(Of cMissionResults) + End Sub + + Public Sub CreateCharts() + Dim mr As cMissionResults + Dim lr As KeyValuePair(Of tLoading, cLoadingResults) + Dim MyChart As System.Windows.Forms.DataVisualization.Charting.Chart + Dim s As System.Windows.Forms.DataVisualization.Charting.Series + Dim a As System.Windows.Forms.DataVisualization.Charting.ChartArea + Dim i As Int16 + + 'Torque, rpm + For Each mr In MissionResults + + MyChart = New System.Windows.Forms.DataVisualization.Charting.Chart + MyChart.Width = 1000 + MyChart.Height = 427 + + a = New System.Windows.Forms.DataVisualization.Charting.ChartArea + + s = New System.Windows.Forms.DataVisualization.Charting.Series + s.Points.DataBindXY(FLD(0).LnU, FLD(0).LTq) + s.ChartType = DataVisualization.Charting.SeriesChartType.FastLine + s.BorderWidth = 3 + s.Color = Color.DarkBlue + s.Name = "Full load curve" + MyChart.Series.Add(s) + + s = New System.Windows.Forms.DataVisualization.Charting.Series + s.Points.DataBindXY(FLD(0).LnU, FLD(0).LTqDrag) + s.ChartType = DataVisualization.Charting.SeriesChartType.FastLine + s.BorderWidth = 3 + s.Color = Color.Blue + s.Name = "Drag curve" + MyChart.Series.Add(s) + + 's = New System.Windows.Forms.DataVisualization.Charting.Series + 's.Points.DataBindXY(GBX.Shiftpolygons(GBX.GearCount).gs_nUdown, GBX.Shiftpolygons(GBX.GearCount).gs_Mdown) + 's.ChartType = DataVisualization.Charting.SeriesChartType.FastLine + 's.Color = Color.DarkGray + 's.BorderWidth = 3 + 's.Name = "Down-Shift threshold" + 'MyChart.Series.Add(s) + + 's = New System.Windows.Forms.DataVisualization.Charting.Series + 's.Points.DataBindXY(GBX.Shiftpolygons(GBX.GearCount).gs_nUup, GBX.Shiftpolygons(GBX.GearCount).gs_Mup) + 's.ChartType = DataVisualization.Charting.SeriesChartType.FastLine + 's.Color = Color.Gray + 's.BorderWidth = 3 + 's.Name = "Up-Shift threshold" + 'MyChart.Series.Add(s) + + s = New System.Windows.Forms.DataVisualization.Charting.Series + s.Points.DataBindXY(mr.Results(tLoading.RefLoaded).nU, mr.Results(tLoading.RefLoaded).Tq) + s.ChartType = DataVisualization.Charting.SeriesChartType.Point + s.Color = Color.Red + s.Name = "load points (Ref. load.)" + MyChart.Series.Add(s) + + + a.Name = "main" + + a.AxisX.Title = "engine speed [1/min]" + a.AxisX.TitleFont = New Font("Helvetica", 20) + a.AxisX.LabelStyle.Font = New Font("Helvetica", 20) + a.AxisX.LabelAutoFitStyle = DataVisualization.Charting.LabelAutoFitStyles.None + + a.AxisY.Title = "engine torque [Nm]" + a.AxisY.TitleFont = New Font("Helvetica", 20) + a.AxisY.LabelStyle.Font = New Font("Helvetica", 20) + a.AxisY.LabelAutoFitStyle = DataVisualization.Charting.LabelAutoFitStyles.None + + a.AxisX.Minimum = 300 + a.BorderDashStyle = DataVisualization.Charting.ChartDashStyle.Solid + a.BorderWidth = 3 + + + MyChart.ChartAreas.Add(a) + + With MyChart.ChartAreas(0) + .Position.X = 0 + .Position.Y = 0 + .Position.Width = 70 + .Position.Height = 100 + End With + + MyChart.Legends.Add("main") + MyChart.Legends(0).Font = New Font("Helvetica", 14) + MyChart.Legends(0).BorderColor = Color.Black + MyChart.Legends(0).BorderWidth = 3 + + + 'MyChart.Titles.Add("CO2 Results [g/km]") + 'MyChart.Titles(0).Font = New Font("Helvetica", 30, FontStyle.Bold) + + + + + MyChart.Update() + + mr.ChartTqN = New Bitmap(MyChart.Width, MyChart.Height, Imaging.PixelFormat.Format32bppArgb) + MyChart.DrawToBitmap(mr.ChartTqN, New Rectangle(0, 0, mr.ChartTqN.Size.Width, mr.ChartTqN.Size.Height)) + + Next + + 'Speed over distance + For Each mr In MissionResults + + MyChart = New System.Windows.Forms.DataVisualization.Charting.Chart + MyChart.Width = 2000 + MyChart.Height = 400 + + a = New System.Windows.Forms.DataVisualization.Charting.ChartArea + + 'Altitude + s = New System.Windows.Forms.DataVisualization.Charting.Series + s.Points.DataBindXY(mr.Results(tLoading.RefLoaded).Distance, mr.Results(tLoading.RefLoaded).Alt) + s.ChartType = DataVisualization.Charting.SeriesChartType.Area + s.Color = Color.Lavender + s.Name = "Altitude" + s.YAxisType = DataVisualization.Charting.AxisType.Secondary + MyChart.Series.Add(s) + + 'Target speed + s = New System.Windows.Forms.DataVisualization.Charting.Series + s.Points.DataBindXY(mr.Results(tLoading.RefLoaded).Distance, mr.Results(tLoading.RefLoaded).TargetSpeed) + s.ChartType = DataVisualization.Charting.SeriesChartType.FastLine + s.BorderWidth = 3 + s.Name = "Target speed" + MyChart.Series.Add(s) + + For Each lr In mr.Results + + s = New System.Windows.Forms.DataVisualization.Charting.Series + s.Points.DataBindXY(lr.Value.Distance, lr.Value.ActualSpeed) + s.ChartType = DataVisualization.Charting.SeriesChartType.FastLine + s.Name = ConvLoading(lr.Key) + MyChart.Series.Add(s) + + Next + + a.Name = "main" + + a.AxisX.Title = "distance [km]" + a.AxisX.TitleFont = New Font("Helvetica", 16) + a.AxisX.LabelStyle.Font = New Font("Helvetica", 16) + a.AxisX.LabelAutoFitStyle = DataVisualization.Charting.LabelAutoFitStyles.None + a.AxisX.LabelStyle.Format = "0.0" + + a.AxisY.Title = "vehicle speed [km/h]" + a.AxisY.TitleFont = New Font("Helvetica", 16) + a.AxisY.LabelStyle.Font = New Font("Helvetica", 16) + a.AxisY.LabelAutoFitStyle = DataVisualization.Charting.LabelAutoFitStyles.None + + a.AxisY2.Title = "altitude [m]" + a.AxisY2.TitleFont = New Font("Helvetica", 16) + a.AxisY2.LabelStyle.Font = New Font("Helvetica", 16) + a.AxisY2.LabelAutoFitStyle = DataVisualization.Charting.LabelAutoFitStyles.None + a.AxisY2.MinorGrid.Enabled = False + a.AxisY2.MajorGrid.Enabled = False + + a.AxisX.Minimum = 0 + a.BorderDashStyle = DataVisualization.Charting.ChartDashStyle.Solid + a.BorderWidth = 3 + + MyChart.ChartAreas.Add(a) + + With MyChart.ChartAreas(0) + .Position.X = 0 + .Position.Y = 0 + .Position.Width = 90 + .Position.Height = 100 + End With + + + MyChart.Legends.Add("main") + MyChart.Legends(0).Font = New Font("Helvetica", 14) + MyChart.Legends(0).BorderColor = Color.Black + MyChart.Legends(0).BorderWidth = 3 + 'MyChart.Legends(0).Position.Auto = False + MyChart.Legends(0).Position.X = 97 + MyChart.Legends(0).Position.Y = 3 + MyChart.Legends(0).Position.Width = 10 + MyChart.Legends(0).Position.Height = 40 + + + 'MyChart.Titles.Add("CO2 Results [g/km]") + 'MyChart.Titles(0).Font = New Font("Helvetica", 30, FontStyle.Bold) + + + + MyChart.Update() + + mr.ChartSpeed = New Bitmap(MyChart.Width, MyChart.Height, Imaging.PixelFormat.Format32bppArgb) + MyChart.DrawToBitmap(mr.ChartSpeed, New Rectangle(0, 0, mr.ChartSpeed.Size.Width, mr.ChartSpeed.Size.Height)) + + Next + + 'CO2 Bars + MyChart = New System.Windows.Forms.DataVisualization.Charting.Chart + a = New System.Windows.Forms.DataVisualization.Charting.ChartArea + + For Each mr In MissionResults + s = New System.Windows.Forms.DataVisualization.Charting.Series + s.Points.AddXY(mr.MissionRef.NameStr, mr.Results(tLoading.RefLoaded).CO2tkm) + 's.IsValueShownAsLabel = True + s.Points(0).Label = s.Points(0).YValues(0).ToString("0.0") & " [g/tkm]" + s.Points(0).Font = New Font("Helvetica", 20) + s.Points(0).LabelBackColor = Color.White + s.Name = mr.MissionRef.NameStr & " (Ref. load.)" + MyChart.Series.Add(s) + Next + + a.Name = "main" + + a.AxisX.Title = "Missions" + a.AxisX.TitleFont = New Font("Helvetica", 20) + a.AxisX.LabelStyle.Enabled = False + + a.AxisY.Title = "CO2 [g/tkm]" + a.AxisY.TitleFont = New Font("Helvetica", 20) + a.AxisY.LabelStyle.Font = New Font("Helvetica", 20) + a.AxisY.LabelAutoFitStyle = DataVisualization.Charting.LabelAutoFitStyles.None + + a.BorderDashStyle = DataVisualization.Charting.ChartDashStyle.Solid + a.BorderWidth = 3 + + MyChart.ChartAreas.Add(a) + + MyChart.Legends.Add("main") + MyChart.Legends(0).Font = New Font("Helvetica", 20) + MyChart.Legends(0).BorderColor = Color.Black + MyChart.Legends(0).BorderWidth = 3 + + MyChart.Width = 1500 + MyChart.Height = 700 + + MyChart.Update() + + ChartCO2tkm = New Bitmap(MyChart.Width, MyChart.Height, Imaging.PixelFormat.Format32bppArgb) + MyChart.DrawToBitmap(ChartCO2tkm, New Rectangle(0, 0, ChartCO2tkm.Size.Width, ChartCO2tkm.Size.Height)) + + + 'CO2 & Speed + MyChart = New System.Windows.Forms.DataVisualization.Charting.Chart + a = New System.Windows.Forms.DataVisualization.Charting.ChartArea + + For Each mr In MissionResults + s = New System.Windows.Forms.DataVisualization.Charting.Series + s.MarkerSize = 15 + s.MarkerStyle = DataVisualization.Charting.MarkerStyle.Circle + s.ChartType = DataVisualization.Charting.SeriesChartType.Point + i = -1 + For Each lr In mr.Results + i += 1 + s.Points.AddXY(lr.Value.Speed, lr.Value.CO2km) + s.Points(i).Label = lr.Value.Loading.ToString("0.0") & " t" + If lr.Key = tLoading.RefLoaded Then + s.Points(i).Font = New Font("Helvetica", 16) + Else + s.Points(i).MarkerSize = 10 + s.Points(i).Font = New Font("Helvetica", 14) + End If + s.Points(i).LabelBackColor = Color.White + Next + s.Name = mr.MissionRef.NameStr + MyChart.Series.Add(s) + Next + + a.Name = "main" + + a.AxisX.Title = "vehicle speed [km/h]" + a.AxisX.TitleFont = New Font("Helvetica", 20) + a.AxisX.LabelStyle.Font = New Font("Helvetica", 20) + a.AxisX.LabelAutoFitStyle = DataVisualization.Charting.LabelAutoFitStyles.None + + a.AxisY.Title = "CO2 [g/km]" + a.AxisY.TitleFont = New Font("Helvetica", 20) + a.AxisY.LabelStyle.Font = New Font("Helvetica", 20) + a.AxisY.LabelAutoFitStyle = DataVisualization.Charting.LabelAutoFitStyles.None + + a.AxisX.Minimum = 20 + a.BorderDashStyle = DataVisualization.Charting.ChartDashStyle.Solid + a.BorderWidth = 3 + + MyChart.ChartAreas.Add(a) + + MyChart.Legends.Add("main") + MyChart.Legends(0).Font = New Font("Helvetica", 20) + MyChart.Legends(0).BorderColor = Color.Black + MyChart.Legends(0).BorderWidth = 3 + + 'MyChart.Titles.Add("CO2 Results [g/km]") + 'MyChart.Titles(0).Font = New Font("Helvetica", 30, FontStyle.Bold) + + MyChart.Width = 1500 + MyChart.Height = 700 + + MyChart.Update() + + ChartCO2speed = New Bitmap(MyChart.Width, MyChart.Height, Imaging.PixelFormat.Format32bppArgb) + MyChart.DrawToBitmap(ChartCO2speed, New Rectangle(0, 0, ChartCO2speed.Size.Width, ChartCO2speed.Size.Height)) + + + End Sub + + Public Function WritePdfs() As Boolean + Dim pdfReader As PdfReader + Dim pdfStamper As PdfStamper + Dim PdfTemp As String = "" + Dim PdfTempMR As String = "" + Dim i As Integer + Dim pgMax As Integer + Dim imgp As iTextSharp.text.Image + Dim pdfContentByte As iTextSharp.text.pdf.PdfContentByte + Dim doc As iTextSharp.text.Document + Dim pdfpage As PdfImportedPage + Dim pdfWriter As PdfWriter + Dim mr As cMissionResults + Dim lr As KeyValuePair(Of tLoading, cLoadingResults) + Dim lstr As String = "" + Dim temppdfs As New List(Of String) + Dim temppath As String + Dim pdfFormFields As AcroFields + + Select Case MissionResults.Count + Case 2 + PdfTemp = MyDeclPath & "Reports\rep2C.pdf" + pgMax = 3 + Case 3 + PdfTemp = MyDeclPath & "Reports\rep3C.pdf" + pgMax = 4 + End Select + + PdfTempMR = MyDeclPath & "Reports\repMR.pdf" + + Try + + temppath = MyDeclPath & "Reports\temp0.pdf" + temppdfs.Add(temppath) + + pdfReader = New PdfReader(PdfTemp) + pdfStamper = New PdfStamper(pdfReader, New FileStream(temppath, FileMode.Create)) + + pdfFormFields = pdfStamper.AcroFields + + pdfFormFields.SetField("version", VECTOvers) + pdfFormFields.SetField("Job", JobFile) + pdfFormFields.SetField("Date", DateStr) + pdfFormFields.SetField("Created", Creator) + pdfFormFields.SetField("Config", MassMaxStr & " " & ConvAxleConf(AxleConf) & " " & ConvVehCat(VehCat, True)) + pdfFormFields.SetField("HDVclass", "HDV Class " & HDVclassStr) + pdfFormFields.SetField("Engine", EngStr) + pdfFormFields.SetField("EngM", EngModelStr) + pdfFormFields.SetField("Gearbox", GbxStr) + pdfFormFields.SetField("GbxM", GbxModelStr) + pdfFormFields.SetField("PageNr", "Page 1 of " & pgMax) + + i = 0 + For Each mr In MissionResults + i += 1 + pdfFormFields.SetField("Mission" & i, mr.MissionRef.NameStr) + With mr.Results(tLoading.RefLoaded) + pdfFormFields.SetField("Loading" & i, .Loading.ToString("0.0") & " t") + pdfFormFields.SetField("Speed" & i, .Speed.ToString("0.0") & " km/h") + pdfFormFields.SetField("FC" & i, .FCkm.ToString("0.0")) + pdfFormFields.SetField("FCt" & i, .FCtkm.ToString("0.0")) + pdfFormFields.SetField("CO2" & i, .CO2km.ToString("0.0")) + pdfFormFields.SetField("CO2t" & i, .CO2tkm.ToString("0.0")) + End With + Next + + + 'Add Images + pdfContentByte = pdfStamper.GetOverContent(1) + + imgp = iTextSharp.text.Image.GetInstance(ChartCO2tkm, iTextSharp.text.Color.WHITE) + imgp.ScaleAbsolute(440, 195) + imgp.SetAbsolutePosition(360, 270) + pdfContentByte.AddImage(imgp) + + imgp = iTextSharp.text.Image.GetInstance(ChartCO2speed, iTextSharp.text.Color.WHITE) + imgp.ScaleAbsolute(440, 195) + imgp.SetAbsolutePosition(360, 75) + pdfContentByte.AddImage(imgp) + + imgp = iTextSharp.text.Image.GetInstance(Declaration.ConvPicPath(HDVclassStr, True)) + imgp.ScaleAbsolute(180, 50) + imgp.SetAbsolutePosition(30, 475) + pdfContentByte.AddImage(imgp) + + ' flatten the form to remove editting options, set it to false to leave the form open to subsequent manual edits + pdfStamper.FormFlattening = True + + ' close the pdf + pdfStamper.Close() + + + i = 0 + For Each mr In MissionResults + i += 1 + + temppath = MyDeclPath & "Reports\temp" & i & ".pdf" + temppdfs.Add(temppath) + + pdfReader = New PdfReader(PdfTempMR) + pdfStamper = New PdfStamper(pdfReader, New FileStream(temppath, FileMode.Create)) + + pdfFormFields = pdfStamper.AcroFields + + pdfFormFields.SetField("version", VECTOvers) + pdfFormFields.SetField("Job", JobFile) + pdfFormFields.SetField("Date", DateStr) + pdfFormFields.SetField("Created", Creator) + pdfFormFields.SetField("Config", MassMaxStr & " " & ConvAxleConf(AxleConf) & " " & ConvVehCat(VehCat, True)) + pdfFormFields.SetField("HDVclass", "HDV Class " & HDVclassStr) + pdfFormFields.SetField("PageNr", "Page " & i + 1 & " of " & pgMax) + + pdfFormFields.SetField("Mission", mr.MissionRef.NameStr) + + For Each lr In mr.Results + + Select Case lr.Key + Case tLoading.EmptyLoaded + lstr = "E" + Case tLoading.RefLoaded + lstr = "R" + Case tLoading.FullLoaded + lstr = "F" + Case Else + Return False + End Select + + With lr.Value + pdfFormFields.SetField("Load" & lstr, .Loading.ToString("0.0") & " t") + pdfFormFields.SetField("Speed" & lstr, .Speed.ToString("0.0")) + pdfFormFields.SetField("FCkm" & lstr, .FCkm.ToString("0.0")) + If .Loading = 0 Then + pdfFormFields.SetField("FCtkm" & lstr, "-") + pdfFormFields.SetField("CO2tkm" & lstr, "-") + Else + pdfFormFields.SetField("FCtkm" & lstr, .FCtkm.ToString("0.0")) + pdfFormFields.SetField("CO2tkm" & lstr, .CO2tkm.ToString("0.0")) + End If + pdfFormFields.SetField("CO2km" & lstr, .CO2km.ToString("0.0")) + End With + + Next + + 'Add Images + pdfContentByte = pdfStamper.GetOverContent(1) + + imgp = iTextSharp.text.Image.GetInstance(Declaration.ConvPicPath(HDVclassStr, (mr.MissionRef.MissionID = tMission.LongHaul))) + imgp.ScaleAbsolute(180, 50) + imgp.SetAbsolutePosition(600, 475) + pdfContentByte.AddImage(imgp) + + imgp = iTextSharp.text.Image.GetInstance(mr.ChartSpeed, iTextSharp.text.Color.WHITE) + imgp.ScaleAbsolute(780, 156) + imgp.SetAbsolutePosition(17, 270) + pdfContentByte.AddImage(imgp) + + imgp = iTextSharp.text.Image.GetInstance(mr.ChartTqN, iTextSharp.text.Color.WHITE) + imgp.ScaleAbsolute(420, 178) + imgp.SetAbsolutePosition(375, 75) + pdfContentByte.AddImage(imgp) + + ' flatten the form to remove editting options, set it to false to leave the form open to subsequent manual edits + pdfStamper.FormFlattening = True + + ' close the pdf + pdfStamper.Close() + + Next + + 'Merge files + doc = New iTextSharp.text.Document(iTextSharp.text.PageSize.A4.Rotate, 12, 12, 12, 12) + + pdfWriter = pdfWriter.GetInstance(doc, New FileStream(Filepath, FileMode.Create)) + + doc.Open() + + For Each temppath In temppdfs + pdfReader = New PdfReader(temppath) + pdfpage = pdfWriter.GetImportedPage(pdfReader, 1) + doc.Add(iTextSharp.text.Image.GetInstance(pdfpage)) + Next + + doc.Close() + + 'Delete temp files + For Each temppath In temppdfs + IO.File.Delete(temppath) + Next + + Catch ex As Exception + + Return False + + End Try + + + + Return True + + + End Function + + + Public Class cMissionResults + + Public Results As Dictionary(Of tLoading, cLoadingResults) + + Public MissionRef As cMission + + Public ChartSpeed As Image + Public ChartTqN As Image + + + Public Sub New() + Results = New Dictionary(Of tLoading, cLoadingResults) + End Sub + + + + End Class + + Public Class cLoadingResults + Public Loading As Single = 0 + Public Speed As Single = 0 + Public FCkm As Single = 0 + Public FCtkm As Single = 0 + Public CO2km As Single = 0 + Public CO2tkm As Single = 0 + Public FCerror As Boolean = False + + Public TargetSpeed As List(Of Single) + Public ActualSpeed As List(Of Single) + Public Distance As List(Of Single) + Public Alt As List(Of Single) + Public Tq As List(Of Single) + Public nU As List(Of Single) + + + Public Sub New() + TargetSpeed = New List(Of Single) + ActualSpeed = New List(Of Single) + Distance = New List(Of Single) + Alt = New List(Of Single) + Tq = New List(Of Single) + nU = New List(Of Single) + End Sub + + + + + End Class + + End Class diff --git a/VECTO/cDelaunayMap.vb b/VECTO/cDelaunayMap.vb index 628a08cffa77e8c04e1ddc07f56f4a1e5edcdc45..783fa9ac53ba20e097c994ca9ca99ede0be73a65 100644 --- a/VECTO/cDelaunayMap.vb +++ b/VECTO/cDelaunayMap.vb @@ -1,5 +1,4 @@ Imports System.Collections.Generic -Imports VECTO.DelaunayTrigSimple '<<<< Verweis auf Namespace ersetzen! Public Class cDelaunayMap @@ -48,17 +47,17 @@ Public Class cDelaunayMap -#If DEBUG Then - Dim i As Int16 - Debug.Print("#,x1,y1,z1,x2,y2,z2") - i = -1 - For Each tr In lDT - i += 1 - Debug.Print(i & "," & tr.P1.X & "," & tr.P1.Y & "," & tr.P1.Z & "," & tr.P2.X & "," & tr.P2.Y & "," & tr.P2.Z) - Debug.Print(i & "," & tr.P3.X & "," & tr.P3.Y & "," & tr.P3.Z & "," & tr.P2.X & "," & tr.P2.Y & "," & tr.P2.Z) - Debug.Print(i & "," & tr.P1.X & "," & tr.P1.Y & "," & tr.P1.Z & "," & tr.P3.X & "," & tr.P3.Y & "," & tr.P3.Z) - Next -#End If + '#If DEBUG Then + ' Dim i As Int16 + ' Debug.Print("#,x1,y1,z1,x2,y2,z2") + ' i = -1 + ' For Each tr In lDT + ' i += 1 + ' Debug.Print(i & "," & tr.P1.X & "," & tr.P1.Y & "," & tr.P1.Z & "," & tr.P2.X & "," & tr.P2.Y & "," & tr.P2.Z) + ' Debug.Print(i & "," & tr.P3.X & "," & tr.P3.Y & "," & tr.P3.Z & "," & tr.P2.X & "," & tr.P2.Y & "," & tr.P2.Z) + ' Debug.Print(i & "," & tr.P1.X & "," & tr.P1.Y & "," & tr.P1.Z & "," & tr.P3.X & "," & tr.P3.Y & "," & tr.P3.Z) + ' Next + '#End If @@ -252,11 +251,6 @@ Public Class cDelaunayMap End Function -End Class - - -Namespace DelaunayTrigSimple - Public Class dPoint Public X As Double Public Y As Double @@ -485,4 +479,6 @@ Namespace DelaunayTrigSimple End Class -End Namespace + +End Class + diff --git a/VECTO/cVRES.vb b/VECTO/cVRES.vb deleted file mode 100644 index c0fc448d5f0eed4b51064088653f207f1110d82c..0000000000000000000000000000000000000000 --- a/VECTO/cVRES.vb +++ /dev/null @@ -1,255 +0,0 @@ -Imports System.Collections.Generic -Imports iTextSharp.text.pdf -Imports System.IO - - - - - -Public Class cVRES - - Public FilePath As String - - Public SingleResults As New List(Of cVRESsingle) - - Public Sub New() - ResetMe() - End Sub - - Public Sub ResetMe() - SingleResults.Clear() - End Sub - - Public Function SetVals(ByVal VREStype As tLoading) As Boolean - Dim VRESsingleRef As cVRESsingle - Dim t1 As Integer - Dim t As Integer - Dim MsgSrc As String - Dim Vquer As Single - Dim sum As Double - - MsgSrc = "SUM/SetVals" - - t1 = MODdata.tDim - - 'Average Speed calculation - sum = 0 - For t = 0 To t1 - sum += MODdata.Vh.V(t) - Next - Vquer = 3.6 * sum / (t1 + 1) - - If Vquer = 0 Then - WorkerMsg(tMsgID.Err, "Average Speed = 0 ?!", MsgSrc) - Return False - End If - - VRESsingleRef = New cVRESsingle - - VRESsingleRef.DescStr = ConvLoading(VREStype) - - VRESsingleRef.Loading = VEH.Loading / 1000 - VRESsingleRef.FCl100km = (100 * MODdata.FCavg / Vquer) / (Cfg.FuelDens * 1000) - If VRESsingleRef.Loading > 0 Then VRESsingleRef.FCl100tkm = VRESsingleRef.FCl100km / VRESsingleRef.Loading - VRESsingleRef.CO2gkm = Cfg.CO2perFC * (MODdata.FCavg / Vquer) - If VRESsingleRef.Loading > 0 Then VRESsingleRef.CO2gtkm = VRESsingleRef.CO2gkm / VRESsingleRef.Loading - VRESsingleRef.AvgSpeed = Vquer - - VRESsingleRef.FCerror = MODdata.FCerror - - SingleResults.Add(VRESsingleRef) - - Return True - - End Function - - - Public Function Output() As Boolean - Dim file As New cFile_V3 - Dim MsgSrc As String - Dim x As Integer - Dim VRESsingleRef As cVRESsingle - Dim pdfTemplate As String - Dim pdfout As String - Dim pdfReader As PdfReader - Dim pdfStamper As PdfStamper - - - MsgSrc = "SUM/Output" - - If Not file.OpenWrite(FilePath & ".vres", vbTab) Then - WorkerMsg(tMsgID.Err, "Can't write to " & FilePath & ".vres", MsgSrc) - Return False - End If - - file.WriteLine(" _ ________________________ ") - file.WriteLine("| | / ____ ______ __ __ \") - file.WriteLine("| | / / __/ / / / / / / / /") - file.WriteLine("| |/ / /___/ /___ / / / /_/ / ") - file.WriteLine("|___/_____/\____/ /_/ \____/ ") - - x = CInt((31 - 4 - Len(VECTOvers)) / 2) - file.WriteLine(Space(x) & "~ " & VECTOvers & " ~" & Space(x)) - file.WriteLine(" ") - file.WriteLine("Date:" & vbTab & Now.ToString) - file.WriteLine(" ") - file.WriteLine("Specifications") - - If Declaration.Active Then - file.WriteLine(vbTab & "Mission: " & vbTab & Declaration.CurrentMission.NameStr) - file.WriteLine(vbTab & "HDV Class: " & vbTab & Declaration.SegRef.HDVclass) - Else - file.WriteLine(vbTab & "Cycle: " & vbTab & fFILE(CurrentCycleFile, False)) - End If - - file.WriteLine(" ") - file.WriteLine("Results:") - file.WriteLine(" ") - file.WriteLine(vbTab & "Efficiency Index (FCrel): " & vbTab & "N/A") - file.WriteLine(" ") - file.WriteLine("Single Results:") - - For Each VRESsingleRef In SingleResults - file.WriteLine(vbTab & VRESsingleRef.DescStr) - file.WriteLine(vbTab & vbTab & "Loading: " & vbTab & VRESsingleRef.Loading & vbTab & "[t]") - file.WriteLine(vbTab & vbTab & "Average Speed: " & vbTab & VRESsingleRef.AvgSpeed.ToString & vbTab & "[km/h]") - file.WriteLine(vbTab & vbTab & "Fuel Consumption" & vbTab & vbTab & "CO2 Emissions") - - If VRESsingleRef.FCerror Then - file.WriteLine(vbTab & vbTab & "ERROR") - Else - file.WriteLine(vbTab & vbTab & VRESsingleRef.FCl100km.ToString("#.0") & vbTab & "[l/100km]" & vbTab & VRESsingleRef.CO2gkm.ToString("#.0") & vbTab & "[g/km]") - If VRESsingleRef.Loading = 0 Then - file.WriteLine(vbTab & vbTab & "-" & vbTab & "[l/100tkm]" & vbTab & "-" & vbTab & "[g/tkm]") - Else - file.WriteLine(vbTab & vbTab & VRESsingleRef.FCl100tkm.ToString("#.0") & vbTab & "[l/100tkm]" & vbTab & VRESsingleRef.CO2gtkm.ToString("#.0") & vbTab & "[g/tkm]") - End If - End If - - - Next - - file.Close() - - 'Add file to signing list - Lic.FileSigning.AddFile(FilePath & ".vres") - - 'pdf Output - If Declaration.Active Then - - pdfTemplate = MyDeclPath & "reptemp.pdf" - pdfout = FilePath & ".pdf" - - Try - - pdfReader = New PdfReader(pdfTemplate) - pdfStamper = New PdfStamper(pdfReader, New FileStream(pdfout, FileMode.Create)) - - Dim pdfFormFields As AcroFields = pdfStamper.AcroFields - - - pdfFormFields.SetField("version", VECTOvers) - pdfFormFields.SetField("date", Now.ToString) - pdfFormFields.SetField("mission", Declaration.CurrentMission.NameStr) - pdfFormFields.SetField("HDVclass", Declaration.SegRef.HDVclass) - - VRESsingleRef = SingleResults(1) - pdfFormFields.SetField("load1", VRESsingleRef.Loading.ToString & " [t]") - pdfFormFields.SetField("speed1", VRESsingleRef.AvgSpeed.ToString("#.0") & " [km/h]") - pdfFormFields.SetField("FC11", VRESsingleRef.FCl100km.ToString("#.0") & " [l/100km]") - pdfFormFields.SetField("FC12", VRESsingleRef.FCl100tkm.ToString("#.0") & " [l/100tkm]") - - pdfFormFields.SetField("CO211", VRESsingleRef.CO2gkm.ToString("#.0") & " [g/km]") - pdfFormFields.SetField("CO212", VRESsingleRef.CO2gtkm.ToString("#.0") & " [g/tkm]") - - VRESsingleRef = SingleResults(0) - pdfFormFields.SetField("load2", VRESsingleRef.Loading.ToString & " [t]") - pdfFormFields.SetField("speed2", VRESsingleRef.AvgSpeed.ToString("#.0") & " [km/h]") - pdfFormFields.SetField("FC21", VRESsingleRef.FCl100km.ToString("#.0") & " [l/100km]") - pdfFormFields.SetField("FC22", "- [l/100tkm]") - - pdfFormFields.SetField("CO221", VRESsingleRef.CO2gkm.ToString("#.0") & " [g/km]") - pdfFormFields.SetField("CO222", "- [g/tkm]") - - VRESsingleRef = SingleResults(2) - pdfFormFields.SetField("load3", VRESsingleRef.Loading.ToString & " [t]") - pdfFormFields.SetField("speed3", VRESsingleRef.AvgSpeed.ToString("#.0") & " [km/h]") - pdfFormFields.SetField("FC31", VRESsingleRef.FCl100km.ToString("#.0") & " [l/100km]") - pdfFormFields.SetField("FC32", VRESsingleRef.FCl100tkm.ToString("#.0") & " [l/100tkm]") - - pdfFormFields.SetField("CO231", VRESsingleRef.CO2gkm.ToString("#.0") & " [g/km]") - pdfFormFields.SetField("CO232", VRESsingleRef.CO2gtkm.ToString("#.0") & " [g/tkm]") - - - ' flatten the form to remove editting options, set it to false - ' to leave the form open to subsequent manual edits - pdfStamper.FormFlattening = True - - ' close the pdf - pdfStamper.Close() - - Catch ex As Exception - - WorkerMsg(tMsgID.Err, "Failed to write pdf file (" & pdfout & ")!", MsgSrc) - - End Try - - - - - - - End If - - - - - - - - - - - - - - - - - - - - - - - - - - Return True - - - - End Function - -End Class - -Public Class cVRESsingle - Public Loading As Single - Public AvgSpeed As Single - Public FCl100km As Single - Public FCl100tkm As Single - Public CO2gkm As Single - Public CO2gtkm As Single - Public DescStr As String - Public FCerror As Boolean - - Public Sub ResetMe() - FCl100km = 0 - FCl100tkm = 0 - CO2gkm = 0 - CO2gtkm = 0 - DescStr = "" - End Sub - - -End Class diff --git a/VECTO/cVSUM.vb b/VECTO/cVSUM.vb index ace570c53058c61b4d870710e226b45d0287424a..08f283bed1e242cddd8192a2b03d1e0302188a9c 100644 --- a/VECTO/cVSUM.vb +++ b/VECTO/cVSUM.vb @@ -2,7 +2,7 @@ Class cVSUM - Private Const FormatVersion As String = "1.0" + Private Const FormatVersion As Short = 1 Private VSUMpath As String Private Fvsum As System.IO.StreamWriter @@ -85,7 +85,7 @@ Class cVSUM VSUMentries("\\V").ValueString = Vquer 'altitude change - VSUMentries("\\G").ValueString = MODdata.Vh.AltIntp(Vquer * (t1 + 1) / 3.6) - MODdata.Vh.AltIntp(0) + VSUMentries("\\G").ValueString = MODdata.Vh.AltIntp(Vquer * (t1 + 1) / 3.6, False) - MODdata.Vh.AltIntp(0, False) 'Auxiliary energy consumption If VEC.AuxDef Then @@ -103,32 +103,50 @@ Class cVSUM 'FC If MODdata.FCerror Then + If VEC.EngOnly Then VSUMentries("FC_h").ValueString = "ERROR" Else VSUMentries("FC_km").ValueString = "ERROR" End If - If Declaration.Active Then + If MODdata.FCAUXcSet Then + If VEC.EngOnly Then + VSUMentries("FC-AUXc_h").ValueString = "ERROR" + Else + VSUMentries("FC-AUXc_km").ValueString = "ERROR" + End If + End If + + If Cfg.DeclMode Then If VEC.EngOnly Then - VSUMentries("FCc_h").ValueString = "ERROR" + VSUMentries("FC-WHTCc_h").ValueString = "ERROR" Else - VSUMentries("FCc_km").ValueString = "ERROR" + VSUMentries("FC-WHTCc_km").ValueString = "ERROR" End If End If Else + If VEC.EngOnly Then VSUMentries("FC_h").ValueString = MODdata.FCavg Else VSUMentries("FC_km").ValueString = (MODdata.FCavg / Vquer) End If - If Declaration.Active Then + If MODdata.FCAUXcSet Then + If VEC.EngOnly Then + VSUMentries("FC-AUXc_h").ValueString = MODdata.FCavgAUXc + Else + VSUMentries("FC-AUXc_km").ValueString = (MODdata.FCavgAUXc / Vquer) + End If + End If + + If Cfg.DeclMode Then If VEC.EngOnly Then - VSUMentries("FCc_h").ValueString = MODdata.FCavg * MODdata.CorrFactor + VSUMentries("FC-WHTCc_h").ValueString = MODdata.FCavgWHTCc Else - VSUMentries("FCc_km").ValueString = (MODdata.FCavg * MODdata.CorrFactor / Vquer) + VSUMentries("FC-WHTCc_km").ValueString = (MODdata.FCavgWHTCc / Vquer) End If End If @@ -211,6 +229,13 @@ Class cVSUM Next VSUMentries("\\Etransm").ValueString = (-sum / 3600) + 'Retarder + sum = 0 + For t = 0 To t1 + sum += MODdata.PlossRt(t) + Next + VSUMentries("\\Eretarder").ValueString = (-sum / 3600) + 'Masse, Loading VSUMentries("\\Mass").ValueString = (VEH.Mass + VEH.MassExtra) VSUMentries("\\Loading").ValueString = VEH.Loading @@ -276,7 +301,7 @@ Class cVSUM End Function - Public Function AusgVSUM(ByVal NrOfRunStr As String, ByVal GenFilename As String, ByVal CycleFilename As String, ByVal AbortedByError As Boolean) As Boolean + Public Function AusgVSUM(ByVal NrOfRunStr As String, ByVal JobFilename As String, ByVal CycleFilename As String, ByVal AbortedByError As Boolean) As Boolean Dim str As String Dim MsgSrc As String Dim dic As Dictionary(Of String, Object) @@ -302,8 +327,8 @@ Class cVSUM Return False End Try - str = NrOfRunStr & "," & GenFilename & "," & CycleFilename & "," - dic.Add("Job", GenFilename) + str = NrOfRunStr & "," & JobFilename & "," & CycleFilename & "," + dic.Add("Job", JobFilename) dic.Add("Cycle", CycleFilename) If AbortedByError Then @@ -354,13 +379,12 @@ Class cVSUM End If End Sub - Public Function Init(ByVal GenFile As String) As Boolean - Dim GENs As New List(Of String) + Public Function Init(ByVal JobFile As String) As Boolean + Dim JobFiles As New List(Of String) Dim str As String Dim str1 As String - Dim iGEN As Integer Dim file As New cFile_V3 - Dim GEN0 As cVECTO + Dim VEC0 As cVECTO Dim MAP0 As cMAP Dim ENG0 As cENG Dim HEVorEVdone As Boolean @@ -380,23 +404,21 @@ Class cVSUM MsgSrc = "SUMALL/Init" 'Check if file exists - If Not IO.File.Exists(GenFile) Then - WorkerMsg(tMsgID.Err, "Job file not found! (" & GenFile & ")", MsgSrc) + If Not IO.File.Exists(JobFile) Then + WorkerMsg(tMsgID.Err, "Job file not found! (" & JobFile & ")", MsgSrc) Return False End If 'Define Output-path - If (PHEMmode = tPHEMmode.ModeBATCH) Then + If (CalcMode = tCalcMode.ModeBATCH) Then Select Case UCase(Cfg.BATCHoutpath) - Case sKey.WorkDir - VSUMpath = Cfg.WorkDPath & fFILE(GenFile, False) & "_BATCH.vsum" - Case sKey.GenPath - VSUMpath = fFileWoExt(GenFile) & "_BATCH.vsum" + Case sKey.JobPath + VSUMpath = fFileWoExt(JobFile) & "_BATCH.vsum" Case Else - VSUMpath = Cfg.BATCHoutpath & fFILE(GenFile, False) & "_BATCH.vsum" + VSUMpath = Cfg.BATCHoutpath & fFILE(JobFile, False) & "_BATCH.vsum" End Select Else - VSUMpath = fFileWoExt(GenFile) & ".vsum" + VSUMpath = fFileWoExt(JobFile) & ".vsum" End If 'Open file @@ -421,7 +443,7 @@ Class cVSUM vsumJSON.Content.Add("Body", New Dictionary(Of String, Object)) dic = New Dictionary(Of String, Object) dic.Add("Air Density [kg/m3]", Cfg.AirDensity) - dic.Add("Distance Correction", Cfg.WegKorJa) + dic.Add("Distance Correction", Cfg.DistCorr) vsumJSON.Content("Body").add("Settings", dic) ResList = New List(Of Dictionary(Of String, Object)) @@ -431,7 +453,7 @@ Class cVSUM Fvsum.WriteLine("VECTO " & VECTOvers) Fvsum.WriteLine(Now.ToString) Fvsum.WriteLine("air density [kg/m3]: " & Cfg.AirDensity) - If Cfg.WegKorJa Then + If Cfg.DistCorr Then Fvsum.WriteLine("Distance Correction ON") Else Fvsum.WriteLine("Distance Correction OFF") @@ -449,11 +471,9 @@ Class cVSUM VSUMentryList = New List(Of String) - '********************** GEN-Liste raussuchen. Bei ADVANCE aus Flotte sonst aus Jobliste '********************** |@@| Select GEN-list for ADVANCE either from Fleet or from Job-list '********************** For Each str In JobFileList - GENs.Add(fFileRepl(str)) + JobFiles.Add(fFileRepl(str)) Next - iGEN = GENs.Count - 1 '********************** Create VSUM-Entries '********************** @@ -465,16 +485,15 @@ Class cVSUM 'Vehicle type-independent AddToVSUM("\\T", "time", "[s]") - 'For each GEN-file check Mode and Map - For Each str In GENs + For Each str In JobFiles - GEN0 = New cVECTO + VEC0 = New cVECTO - GEN0.FilePath = str + VEC0.FilePath = str Try - If Not GEN0.ReadFile Then - WorkerMsg(tMsgID.Err, "Can't read .gen file '" & str & "' !", MsgSrc) + If Not VEC0.ReadFile Then + WorkerMsg(tMsgID.Err, "Can't read .vecto file '" & str & "' !", MsgSrc) Return False End If Catch ex As Exception @@ -482,7 +501,7 @@ Class cVSUM Return False End Try - If GEN0.EngOnly Then + If VEC0.EngOnly Then If Not EngOnly Then @@ -505,8 +524,8 @@ Class cVSUM End If 'Auxiliary energy consumption - If GEN0.AuxDef Then - For Each str1 In GEN0.AuxPaths.Keys + If VEC0.AuxDef Then + For Each str1 In VEC0.AuxPaths.Keys AddToVSUM("\\Eaux_" & UCase(str1), "Eaux_" & str1, "[kWh]") Next End If @@ -519,12 +538,12 @@ Class cVSUM 'From the Engine-Map ENG0 = New cENG - ENG0.FilePath = GEN0.PathENG + ENG0.FilePath = VEC0.PathENG Try If Not ENG0.ReadFile Then Return False Catch ex As Exception - WorkerMsg(tMsgID.Err, "File read error! (" & GEN0.PathENG & ")", MsgSrc) + WorkerMsg(tMsgID.Err, "File read error! (" & VEC0.PathENG & ")", MsgSrc) Return False End Try @@ -538,18 +557,14 @@ Class cVSUM Return False End Try - If GEN0.EngOnly Then + If VEC0.EngOnly Then AddToVSUM("FC_h", "FC", "[g/h]") + AddToVSUM("FC-AUXc_h", "FC-AUXc", "[g/h]") + AddToVSUM("FC-WHTCc_h", "FC-WHTCc", "[g/h]") Else AddToVSUM("FC_km", "FC", "[g/km]") - End If - - If Declaration.Active Then - If GEN0.EngOnly Then - AddToVSUM("FCc_h", "FC corrected", "[g/h]") - Else - AddToVSUM("FCc_km", "FC corrected", "[g/km]") - End If + AddToVSUM("FC-AUXc_km", "FC-AUXc", "[g/km]") + AddToVSUM("FC-WHTCc_km", "FC-WHTCc", "[g/km]") End If Next @@ -574,6 +589,7 @@ Class cVSUM AddToVSUM("\\Eaux", "Eaux", "[kWh]") AddToVSUM("\\Ebrake", "Ebrake", "[kWh]") AddToVSUM("\\Etransm", "Etransm", "[kWh]") + AddToVSUM("\\Eretarder", "Eretarder", "[kWh]") AddToVSUM("\\Mass", "Mass", "[kg]") AddToVSUM("\\Loading", "Loading", "[kg]") @@ -585,7 +601,7 @@ Class cVSUM End If - 'ErgListe sortieren damit g/km und g/h nebeneinander liegen |@@| Sort ErgListe so that g/km and g/h are side-by-side + 'Sort iDim = VSUMentryList.Count - 1 For i1 = 0 To iDim - 1