Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 3945a46a authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

Merge pull request #781 in VECTO/vecto-sim from...

Merge pull request #781 in VECTO/vecto-sim from ~EMQUARIMA/vecto-sim:feature/VECTO-1042-add-option-to-write-results-into-a-certain-directory to develop

* commit '291ef7bd':
  chaning layout, adding browse directory button
  updating user manual
  reduce log-level in case time shares in sum-data does not sum up to 100%, increase tolerance
  adding configuration option for output folder to gui and for initializing filewriters  when running simulation
parents ce13ad1c 291ef7bd
Branches
Tags
No related merge requests found
...@@ -66,6 +66,10 @@ In this tab the global calculation settings can be changed. ...@@ -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) : 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** **Output**
![cb](pics/checkbox.png) Write modal results ![cb](pics/checkbox.png) Write modal results
......
Documentation/User Manual/pics/VECTO_OptionsTab.PNG

5.94 KiB | W: | H:

Documentation/User Manual/pics/VECTO_OptionsTab.PNG

8.93 KiB | W: | H:

Documentation/User Manual/pics/VECTO_OptionsTab.PNG
Documentation/User Manual/pics/VECTO_OptionsTab.PNG
Documentation/User Manual/pics/VECTO_OptionsTab.PNG
Documentation/User Manual/pics/VECTO_OptionsTab.PNG
  • 2-up
  • Swipe
  • Onion skin
...@@ -32,6 +32,8 @@ Public Class Configuration ...@@ -32,6 +32,8 @@ Public Class Configuration
Public ValidateRunData As Boolean Public ValidateRunData As Boolean
public OutputFolder As String
Public Const DefaultFuelType As FuelType = FuelType.DieselCI Public Const DefaultFuelType As FuelType = FuelType.DieselCI
Private Const FormatVersion As Short = 2 Private Const FormatVersion As Short = 2
...@@ -58,6 +60,7 @@ Public Class Configuration ...@@ -58,6 +60,7 @@ Public Class Configuration
FirstRun = True FirstRun = True
DeclMode = True DeclMode = True
ValidateRunData = True ValidateRunData = True
OutputFolder = ""
End Sub End Sub
Public Sub Load() Public Sub Load()
...@@ -86,6 +89,7 @@ Public Class Configuration ...@@ -86,6 +89,7 @@ Public Class Configuration
FirstRun = body.GetEx(Of Boolean)("FirstRun") FirstRun = body.GetEx(Of Boolean)("FirstRun")
DeclMode = body.GetEx(Of Boolean)("DeclMode") DeclMode = body.GetEx(Of Boolean)("DeclMode")
ValidateRunData = IsNothing(body("ValidateRunData")) OrElse body.GetEx(Of Boolean)("ValidateRunData") ValidateRunData = IsNothing(body("ValidateRunData")) OrElse body.GetEx(Of Boolean)("ValidateRunData")
OutputFolder = If(body("OutputFolder") Is Nothing, "", body("OutputFolder").Value(of string)())
End Using End Using
Catch ex As Exception Catch ex As Exception
GUIMsg(MessageType.Err, "Error while loading settings!") GUIMsg(MessageType.Err, "Error while loading settings!")
...@@ -111,6 +115,7 @@ Public Class Configuration ...@@ -111,6 +115,7 @@ Public Class Configuration
body.Add("FirstRun", FirstRun) body.Add("FirstRun", FirstRun)
body.Add("DeclMode", DeclMode) body.Add("DeclMode", DeclMode)
body.Add("ValidateRunData", ValidateRunData) body.Add("ValidateRunData", ValidateRunData)
body.Add("OutputFolder", OutputFolder)
JSONFileWriter.WriteFile(New Dictionary(Of String, Object) From {{"Header", header}, {"Body", body}}, FilePath) JSONFileWriter.WriteFile(New Dictionary(Of String, Object) From {{"Header", header}, {"Body", body}}, FilePath)
End Sub End Sub
......
...@@ -59,6 +59,9 @@ Partial Class MainForm ...@@ -59,6 +59,9 @@ Partial Class MainForm
Me.ButtonGENadd = New System.Windows.Forms.Button() Me.ButtonGENadd = New System.Windows.Forms.Button()
Me.TabPgOptions = New System.Windows.Forms.TabPage() Me.TabPgOptions = New System.Windows.Forms.TabPage()
Me.PanelOptAllg = New System.Windows.Forms.Panel() 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.GroupBox3 = New System.Windows.Forms.GroupBox()
Me.cbActVmod = New System.Windows.Forms.CheckBox() Me.cbActVmod = New System.Windows.Forms.CheckBox()
Me.cbValidateRunData = New System.Windows.Forms.CheckBox() Me.cbValidateRunData = New System.Windows.Forms.CheckBox()
...@@ -122,6 +125,7 @@ Partial Class MainForm ...@@ -122,6 +125,7 @@ Partial Class MainForm
CType(Me.PictureBox1,System.ComponentModel.ISupportInitialize).BeginInit CType(Me.PictureBox1,System.ComponentModel.ISupportInitialize).BeginInit
Me.TabPgOptions.SuspendLayout Me.TabPgOptions.SuspendLayout
Me.PanelOptAllg.SuspendLayout Me.PanelOptAllg.SuspendLayout
Me.GroupBox4.SuspendLayout
Me.GroupBox3.SuspendLayout Me.GroupBox3.SuspendLayout
Me.GroupBox2.SuspendLayout Me.GroupBox2.SuspendLayout
Me.GroupBox1.SuspendLayout Me.GroupBox1.SuspendLayout
...@@ -375,6 +379,7 @@ Partial Class MainForm ...@@ -375,6 +379,7 @@ Partial Class MainForm
' '
'PanelOptAllg 'PanelOptAllg
' '
Me.PanelOptAllg.Controls.Add(Me.GroupBox4)
Me.PanelOptAllg.Controls.Add(Me.GroupBox3) Me.PanelOptAllg.Controls.Add(Me.GroupBox3)
Me.PanelOptAllg.Controls.Add(Me.GroupBox2) Me.PanelOptAllg.Controls.Add(Me.GroupBox2)
Me.PanelOptAllg.Controls.Add(Me.GroupBox1) Me.PanelOptAllg.Controls.Add(Me.GroupBox1)
...@@ -383,6 +388,34 @@ Partial Class MainForm ...@@ -383,6 +388,34 @@ Partial Class MainForm
Me.PanelOptAllg.Size = New System.Drawing.Size(1022, 290) Me.PanelOptAllg.Size = New System.Drawing.Size(1022, 290)
Me.PanelOptAllg.TabIndex = 0 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 'GroupBox3
' '
Me.GroupBox3.Controls.Add(Me.cbActVmod) Me.GroupBox3.Controls.Add(Me.cbActVmod)
...@@ -842,6 +875,8 @@ Partial Class MainForm ...@@ -842,6 +875,8 @@ Partial Class MainForm
CType(Me.PictureBox1,System.ComponentModel.ISupportInitialize).EndInit CType(Me.PictureBox1,System.ComponentModel.ISupportInitialize).EndInit
Me.TabPgOptions.ResumeLayout(false) Me.TabPgOptions.ResumeLayout(false)
Me.PanelOptAllg.ResumeLayout(false) Me.PanelOptAllg.ResumeLayout(false)
Me.GroupBox4.ResumeLayout(false)
Me.GroupBox4.PerformLayout
Me.GroupBox3.ResumeLayout(false) Me.GroupBox3.ResumeLayout(false)
Me.GroupBox3.PerformLayout Me.GroupBox3.PerformLayout
Me.GroupBox2.ResumeLayout(false) Me.GroupBox2.ResumeLayout(false)
...@@ -951,5 +986,7 @@ End Sub ...@@ -951,5 +986,7 @@ End Sub
Friend WithEvents cbValidateRunData As System.Windows.Forms.CheckBox Friend WithEvents cbValidateRunData As System.Windows.Forms.CheckBox
Friend WithEvents cbActVmod As System.Windows.Forms.CheckBox Friend WithEvents cbActVmod As System.Windows.Forms.CheckBox
Friend WithEvents EPTPJobEditorToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents EPTPJobEditorToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents GroupBox4 As GroupBox
Friend WithEvents tbOutputFolder As TextBox
Friend WithEvents BtTCfileBrowse As Button
End Class End Class
...@@ -223,6 +223,9 @@ ...@@ -223,6 +223,9 @@
<metadata name="CmOpenFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="CmOpenFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>732, 12</value> <value>732, 12</value>
</metadata> </metadata>
<metadata name="ToolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>850, 12</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>49</value> <value>49</value>
</metadata> </metadata>
......
...@@ -51,6 +51,7 @@ Imports TUGraz.VectoCore ...@@ -51,6 +51,7 @@ Imports TUGraz.VectoCore
Imports TUGraz.VectoCore.InputData.FileIO.XML Imports TUGraz.VectoCore.InputData.FileIO.XML
Imports TUGraz.VectoCore.InputData.FileIO.XML.Declaration Imports TUGraz.VectoCore.InputData.FileIO.XML.Declaration
Imports TUGraz.VectoCore.InputData.FileIO.XML.Engineering Imports TUGraz.VectoCore.InputData.FileIO.XML.Engineering
Imports TUGraz.VectoCore.Models.Simulation
Imports TUGraz.VectoCore.OutputData Imports TUGraz.VectoCore.OutputData
Imports TUGraz.VectoCore.OutputData.FileIO Imports TUGraz.VectoCore.OutputData.FileIO
Imports TUGraz.VectoCore.Utils Imports TUGraz.VectoCore.Utils
...@@ -937,7 +938,7 @@ Imports TUGraz.VectoCore.Utils ...@@ -937,7 +938,7 @@ Imports TUGraz.VectoCore.Utils
AllowSleepOff() 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 sumWriter As SummaryDataContainer = New SummaryDataContainer(sumFileWriter)
Dim jobContainer As JobContainer = New JobContainer(sumWriter) Dim jobContainer As JobContainer = New JobContainer(sumWriter)
...@@ -987,7 +988,8 @@ Imports TUGraz.VectoCore.Utils ...@@ -987,7 +988,8 @@ Imports TUGraz.VectoCore.Utils
Continue For Continue For
End If 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) Dim runsFactory As SimulatorFactory = New SimulatorFactory(mode, input, fileWriter)
runsFactory.WriteModalResults = Cfg.ModOut runsFactory.WriteModalResults = Cfg.ModOut
...@@ -1087,7 +1089,7 @@ Imports TUGraz.VectoCore.Utils ...@@ -1087,7 +1089,7 @@ Imports TUGraz.VectoCore.Utils
Next Next
For Each job As String In JobFileList 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 _ For Each entry as KeyValuePair(Of string, string) In _
new Dictionary(Of string, string) _ new Dictionary(Of string, string) _
from {{w.XMLFullReportName, "XML Manufacturer Report"}, {w.XMLCustomerReportName, "XML Customer Report"}, from {{w.XMLFullReportName, "XML Manufacturer Report"}, {w.XMLCustomerReportName, "XML Customer Report"},
...@@ -1127,6 +1129,23 @@ Imports TUGraz.VectoCore.Utils ...@@ -1127,6 +1129,23 @@ Imports TUGraz.VectoCore.Utils
End If End If
End Sub 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), Private Shared Sub PrintRuns(progress As Dictionary(Of Integer, JobContainer.ProgressEntry),
fileWriters As Dictionary(Of Integer, FileOutputWriter)) fileWriters As Dictionary(Of Integer, FileOutputWriter))
...@@ -1435,6 +1454,9 @@ Imports TUGraz.VectoCore.Utils ...@@ -1435,6 +1454,9 @@ Imports TUGraz.VectoCore.Utils
RbDecl.Checked = Cfg.DeclMode RbDecl.Checked = Cfg.DeclMode
cbValidateRunData.Checked = cfg.ValidateRunData cbValidateRunData.Checked = cfg.ValidateRunData
tbOutputFolder.Text = Cfg.OutputFolder
End Sub End Sub
'Update config class from options in GUI, e.g. before running calculations 'Update config class from options in GUI, e.g. before running calculations
...@@ -1442,6 +1464,7 @@ Imports TUGraz.VectoCore.Utils ...@@ -1442,6 +1464,7 @@ Imports TUGraz.VectoCore.Utils
Cfg.ModOut = ChBoxModOut.Checked Cfg.ModOut = ChBoxModOut.Checked
Cfg.Mod1Hz = ChBoxMod1Hz.Checked Cfg.Mod1Hz = ChBoxMod1Hz.Checked
Cfg.ValidateRunData = cbValidateRunData.Checked Cfg.ValidateRunData = cbValidateRunData.Checked
Cfg.OutputFolder = tbOutputFolder.Text
End Sub End Sub
#End Region #End Region
...@@ -2100,6 +2123,16 @@ Imports TUGraz.VectoCore.Utils ...@@ -2100,6 +2123,16 @@ Imports TUGraz.VectoCore.Utils
Handles EPTPJobEditorToolStripMenuItem.Click Handles EPTPJobEditorToolStripMenuItem.Click
OpenVECTOeditor("<VTP>") OpenVECTOeditor("<VTP>")
End Sub 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 End Class
...@@ -584,8 +584,8 @@ namespace TUGraz.VectoCore.OutputData ...@@ -584,8 +584,8 @@ namespace TUGraz.VectoCore.OutputData
row[MAX_ENGINE_SPEED] = (ConvertedSI)modData.MaxEngineSpeed().AsRPM.SI<Scalar>(); row[MAX_ENGINE_SPEED] = (ConvertedSI)modData.MaxEngineSpeed().AsRPM.SI<Scalar>();
if (accTimeShare != null && decTimeShare != null && cruiseTimeShare != null) { if (accTimeShare != null && decTimeShare != null && cruiseTimeShare != null) {
var shareSum = accTimeShare + decTimeShare + cruiseTimeShare + stopTimeShare; var shareSum = accTimeShare + decTimeShare + cruiseTimeShare + stopTimeShare;
if (!shareSum.IsEqual(100)) { if (!shareSum.IsEqual(100, 1e-2)) {
Log.Error( Log.Warn(
"Sumfile Error: driving behavior timeshares must sum up to 100%: acc: {0}%, dec: {1}%, cruise: {2}%, stop: {3}%, sum: {4}%", "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), accTimeShare.ToOutputFormat(1, null, false), decTimeShare.ToOutputFormat(1, null, false),
cruiseTimeShare.ToOutputFormat(1, null, false), stopTimeShare.ToOutputFormat(1, null, false), cruiseTimeShare.ToOutputFormat(1, null, false), stopTimeShare.ToOutputFormat(1, null, false),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment