diff --git a/Documentation/User Manual/1-user-interface/B_mainform.md b/Documentation/User Manual/1-user-interface/B_mainform.md index 417ecca65bca9ea0d91dbad1c8ca587cd11a81e3..c9fd73c69b92d0d2081f399911dc28950e9d9f15 100644 --- a/Documentation/User Manual/1-user-interface/B_mainform.md +++ b/Documentation/User Manual/1-user-interface/B_mainform.md @@ -66,6 +66,10 @@ In this tab the global calculation settings can be changed. : Select either [Declaration Mode](#declaration-mode) or [Engineering Mode](#engineering-mode) +**Output Directory** + +: This input can be used to write all simulation result files to a certain directory. This can be either an absolute path or a relative path. If an absolute path is provided, all result files are written to this directory. If a relative path is provided the .vmod and XML reports are written into the corresponding subdirectory of the job file and the .vsum file is written to the corresponding subdirectory of the first selected job file. + **Output**  Write modal results diff --git a/Documentation/User Manual/pics/VECTO_OptionsTab.PNG b/Documentation/User Manual/pics/VECTO_OptionsTab.PNG index d966aea394424c38254514d954490493799e0a4e..620914bf1e9859c3abb9efb3c95c765af19cdca3 100644 Binary files a/Documentation/User Manual/pics/VECTO_OptionsTab.PNG and b/Documentation/User Manual/pics/VECTO_OptionsTab.PNG differ diff --git a/VECTO/Configuration.vb b/VECTO/Configuration.vb index 0af42028dbd1fed1a2bb10ea39913d67440fa88b..685d15b68f6d6587b2a321b68296d4e9a37b85b1 100644 --- a/VECTO/Configuration.vb +++ b/VECTO/Configuration.vb @@ -32,6 +32,8 @@ Public Class Configuration Public ValidateRunData As Boolean + public OutputFolder As String + Public Const DefaultFuelType As FuelType = FuelType.DieselCI Private Const FormatVersion As Short = 2 @@ -58,6 +60,7 @@ Public Class Configuration FirstRun = True DeclMode = True ValidateRunData = True + OutputFolder = "" End Sub Public Sub Load() @@ -86,6 +89,7 @@ Public Class Configuration FirstRun = body.GetEx(Of Boolean)("FirstRun") DeclMode = body.GetEx(Of Boolean)("DeclMode") ValidateRunData = IsNothing(body("ValidateRunData")) OrElse body.GetEx(Of Boolean)("ValidateRunData") + OutputFolder = If(body("OutputFolder") Is Nothing, "", body("OutputFolder").Value(of string)()) End Using Catch ex As Exception GUIMsg(MessageType.Err, "Error while loading settings!") @@ -111,6 +115,7 @@ Public Class Configuration body.Add("FirstRun", FirstRun) body.Add("DeclMode", DeclMode) body.Add("ValidateRunData", ValidateRunData) + body.Add("OutputFolder", OutputFolder) JSONFileWriter.WriteFile(New Dictionary(Of String, Object) From {{"Header", header}, {"Body", body}}, FilePath) End Sub diff --git a/VECTO/GUI/MainForm.Designer.vb b/VECTO/GUI/MainForm.Designer.vb index 6308e8eb093aca2fc7b3963871eafa57a76a5eb0..e422b957e388bfd976ef3c7f7b88ddffa0ee0677 100644 --- a/VECTO/GUI/MainForm.Designer.vb +++ b/VECTO/GUI/MainForm.Designer.vb @@ -59,6 +59,9 @@ Partial Class MainForm Me.ButtonGENadd = New System.Windows.Forms.Button() Me.TabPgOptions = New System.Windows.Forms.TabPage() Me.PanelOptAllg = New System.Windows.Forms.Panel() + Me.GroupBox4 = New System.Windows.Forms.GroupBox() + Me.BtTCfileBrowse = New System.Windows.Forms.Button() + Me.tbOutputFolder = New System.Windows.Forms.TextBox() Me.GroupBox3 = New System.Windows.Forms.GroupBox() Me.cbActVmod = New System.Windows.Forms.CheckBox() Me.cbValidateRunData = New System.Windows.Forms.CheckBox() @@ -116,12 +119,14 @@ Partial Class MainForm Me.OpenInGraphWindowToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ShowInFolderToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components) + Me.Label2 = New System.Windows.Forms.Label() Me.StatusBAR.SuspendLayout Me.TabControl1.SuspendLayout Me.TabPageGEN.SuspendLayout CType(Me.PictureBox1,System.ComponentModel.ISupportInitialize).BeginInit Me.TabPgOptions.SuspendLayout Me.PanelOptAllg.SuspendLayout + Me.GroupBox4.SuspendLayout Me.GroupBox3.SuspendLayout Me.GroupBox2.SuspendLayout Me.GroupBox1.SuspendLayout @@ -375,6 +380,7 @@ Partial Class MainForm ' 'PanelOptAllg ' + Me.PanelOptAllg.Controls.Add(Me.GroupBox4) Me.PanelOptAllg.Controls.Add(Me.GroupBox3) Me.PanelOptAllg.Controls.Add(Me.GroupBox2) Me.PanelOptAllg.Controls.Add(Me.GroupBox1) @@ -383,6 +389,34 @@ Partial Class MainForm Me.PanelOptAllg.Size = New System.Drawing.Size(1022, 290) Me.PanelOptAllg.TabIndex = 0 ' + 'GroupBox4 + ' + Me.GroupBox4.Controls.Add(Me.BtTCfileBrowse) + Me.GroupBox4.Controls.Add(Me.tbOutputFolder) + Me.GroupBox4.Location = New System.Drawing.Point(183, 4) + Me.GroupBox4.Name = "GroupBox4" + Me.GroupBox4.Size = New System.Drawing.Size(260, 46) + Me.GroupBox4.TabIndex = 19 + Me.GroupBox4.TabStop = false + Me.GroupBox4.Text = "Output Directory" + ' + 'BtTCfileBrowse + ' + Me.BtTCfileBrowse.Image = Global.TUGraz.VECTO.My.Resources.Resources.Open_icon + Me.BtTCfileBrowse.Location = New System.Drawing.Point(227, 14) + Me.BtTCfileBrowse.Name = "BtTCfileBrowse" + Me.BtTCfileBrowse.Size = New System.Drawing.Size(24, 24) + Me.BtTCfileBrowse.TabIndex = 27 + Me.BtTCfileBrowse.TabStop = false + Me.BtTCfileBrowse.UseVisualStyleBackColor = true + ' + 'tbOutputFolder + ' + Me.tbOutputFolder.Location = New System.Drawing.Point(6, 17) + Me.tbOutputFolder.Name = "tbOutputFolder" + Me.tbOutputFolder.Size = New System.Drawing.Size(215, 20) + Me.tbOutputFolder.TabIndex = 0 + ' 'GroupBox3 ' Me.GroupBox3.Controls.Add(Me.cbActVmod) @@ -820,6 +854,15 @@ Partial Class MainForm Me.ShowInFolderToolStripMenuItem.Size = New System.Drawing.Size(173, 22) Me.ShowInFolderToolStripMenuItem.Text = "Show in Folder" ' + 'Label2 + ' + Me.Label2.AutoSize = true + Me.Label2.Location = New System.Drawing.Point(7, 19) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(84, 13) + Me.Label2.TabIndex = 1 + Me.Label2.Text = "Output Directory" + ' 'MainForm ' Me.AcceptButton = Me.btStartV3 @@ -842,6 +885,8 @@ Partial Class MainForm CType(Me.PictureBox1,System.ComponentModel.ISupportInitialize).EndInit Me.TabPgOptions.ResumeLayout(false) Me.PanelOptAllg.ResumeLayout(false) + Me.GroupBox4.ResumeLayout(false) + Me.GroupBox4.PerformLayout Me.GroupBox3.ResumeLayout(false) Me.GroupBox3.PerformLayout Me.GroupBox2.ResumeLayout(false) @@ -951,5 +996,8 @@ End Sub Friend WithEvents cbValidateRunData As System.Windows.Forms.CheckBox Friend WithEvents cbActVmod As System.Windows.Forms.CheckBox Friend WithEvents EPTPJobEditorToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem - + Friend WithEvents GroupBox4 As GroupBox + Friend WithEvents Label2 As Label + Friend WithEvents tbOutputFolder As TextBox + Friend WithEvents BtTCfileBrowse As Button End Class diff --git a/VECTO/GUI/MainForm.vb b/VECTO/GUI/MainForm.vb index 0e69f888b7b8a3d6cf880e1ae8801b447e781934..f5ca18d34ee163189000148ba98890c986dd768e 100644 --- a/VECTO/GUI/MainForm.vb +++ b/VECTO/GUI/MainForm.vb @@ -51,6 +51,7 @@ Imports TUGraz.VectoCore Imports TUGraz.VectoCore.InputData.FileIO.XML Imports TUGraz.VectoCore.InputData.FileIO.XML.Declaration Imports TUGraz.VectoCore.InputData.FileIO.XML.Engineering +Imports TUGraz.VectoCore.Models.Simulation Imports TUGraz.VectoCore.OutputData Imports TUGraz.VectoCore.OutputData.FileIO Imports TUGraz.VectoCore.Utils @@ -937,7 +938,7 @@ Imports TUGraz.VectoCore.Utils AllowSleepOff() - Dim sumFileWriter As FileOutputWriter = New FileOutputWriter(JobFileList(0)) + Dim sumFileWriter As FileOutputWriter = New FileOutputWriter(GetOutputDirectory(JobFileList(0))) Dim sumWriter As SummaryDataContainer = New SummaryDataContainer(sumFileWriter) Dim jobContainer As JobContainer = New JobContainer(sumWriter) @@ -987,7 +988,8 @@ Imports TUGraz.VectoCore.Utils Continue For End If - Dim fileWriter As FileOutputWriter = New FileOutputWriter(jobFile) + Dim outFile As String = GetOutputDirectory(jobFile) + Dim fileWriter As FileOutputWriter = New FileOutputWriter(outFile) Dim runsFactory As SimulatorFactory = New SimulatorFactory(mode, input, fileWriter) runsFactory.WriteModalResults = Cfg.ModOut @@ -1087,7 +1089,7 @@ Imports TUGraz.VectoCore.Utils Next For Each job As String In JobFileList - dim w as FileOutputWriter = new FileOutputWriter(job) + dim w as FileOutputWriter = new FileOutputWriter(GetOutputDirectory(job)) For Each entry as KeyValuePair(Of string, string) In _ new Dictionary(Of string, string) _ from {{w.XMLFullReportName, "XML Manufacturer Report"}, {w.XMLCustomerReportName, "XML Customer Report"}, @@ -1127,6 +1129,23 @@ Imports TUGraz.VectoCore.Utils End If End Sub + Private Function GetOutputDirectory(jobFile As String) As String + + dim outFile as String = jobfile + If (Not string.IsNullOrWhiteSpace(tbOutputFolder.Text)) Then + Dim outPath as string = tbOutputFolder.Text + if (path.IsPathRooted(outPath)) Then + outFile = Path.Combine(outPath, Path.GetFileName(jobFile)) + Else + outFile = Path.Combine(path.GetDirectoryName(jobFile), outPath, path.GetFileName(jobFile)) + End If + If (Not directory.Exists(path.GetDirectoryName(outFile))) then + Directory.CreateDirectory(path.GetDirectoryName(outFile)) + End If + End If + Return outFile + End Function + Private Shared Sub PrintRuns(progress As Dictionary(Of Integer, JobContainer.ProgressEntry), fileWriters As Dictionary(Of Integer, FileOutputWriter)) @@ -1435,6 +1454,9 @@ Imports TUGraz.VectoCore.Utils RbDecl.Checked = Cfg.DeclMode cbValidateRunData.Checked = cfg.ValidateRunData + + tbOutputFolder.Text = Cfg.OutputFolder + End Sub 'Update config class from options in GUI, e.g. before running calculations @@ -1442,6 +1464,7 @@ Imports TUGraz.VectoCore.Utils Cfg.ModOut = ChBoxModOut.Checked Cfg.Mod1Hz = ChBoxMod1Hz.Checked Cfg.ValidateRunData = cbValidateRunData.Checked + Cfg.OutputFolder = tbOutputFolder.Text End Sub #End Region @@ -2100,6 +2123,16 @@ Imports TUGraz.VectoCore.Utils Handles EPTPJobEditorToolStripMenuItem.Click OpenVECTOeditor("<VTP>") End Sub + + Private Sub BtTCfileBrowse_Click(sender As Object, e As EventArgs) Handles BtTCfileBrowse.Click + If Not FolderFileBrowser.OpenDialog("") Then + Exit Sub + End If + + Dim filePath As String = FolderFileBrowser.Files(0) + tbOutputFolder.Text = Path.GetFullPath(filePath) + End Sub + End Class diff --git a/VectoCore/VectoCore/OutputData/SummaryDataContainer.cs b/VectoCore/VectoCore/OutputData/SummaryDataContainer.cs index 2cd0e98b3189a3c98b4879fda4864b1b71f1e986..b774f06cdc0851f172bdb0329d0c219c0511ecb0 100644 --- a/VectoCore/VectoCore/OutputData/SummaryDataContainer.cs +++ b/VectoCore/VectoCore/OutputData/SummaryDataContainer.cs @@ -584,8 +584,8 @@ namespace TUGraz.VectoCore.OutputData row[MAX_ENGINE_SPEED] = (ConvertedSI)modData.MaxEngineSpeed().AsRPM.SI<Scalar>(); if (accTimeShare != null && decTimeShare != null && cruiseTimeShare != null) { var shareSum = accTimeShare + decTimeShare + cruiseTimeShare + stopTimeShare; - if (!shareSum.IsEqual(100)) { - Log.Error( + if (!shareSum.IsEqual(100, 1e-2)) { + Log.Warn( "Sumfile Error: driving behavior timeshares must sum up to 100%: acc: {0}%, dec: {1}%, cruise: {2}%, stop: {3}%, sum: {4}%", accTimeShare.ToOutputFormat(1, null, false), decTimeShare.ToOutputFormat(1, null, false), cruiseTimeShare.ToOutputFormat(1, null, false), stopTimeShare.ToOutputFormat(1, null, false),