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 627ba3d3 authored by Harald Martini's avatar Harald Martini
Browse files

added settings to override initial soc for Charge depleting runs, and disable...

added settings to override initial soc for Charge depleting runs, and disable charge sustaining iterating mode
parent 6d3cbc68
No related branches found
No related tags found
No related merge requests found
Showing
with 512 additions and 351 deletions
......@@ -36,10 +36,33 @@ Public Class Configuration
public OutputFolder As String
Public Const DefaultFuelType As FuelType = FuelType.DieselCI
Private Const FormatVersion As Short = 2
'Test Settings 2nd amendment
Public InitialSOCOverrideValue As Double
Public InitialSOCOverride As Boolean
Public ChargeSustainingIterationModeActivated As Boolean
Private _body as String = "Body"
Private _mod1Hz as String = "Mod1Hz"
Private _modOut as String = "ModOut"
Private _logSize as String = "LogSize"
Private _airdensity as String = "AirDensity"
Private _fueldensity as String = "FuelDensity"
Private _co2Perfc as String = "CO2perFC"
Private _openCmd as String = "OpenCmd"
Private _opencmdname as String = "OpenCmdName"
Private _firstrun as String = "FirstRun"
Private _declmode as String = "DeclMode"
Private _validaterundata as String = "ValidateRunData"
Private _outputfolder as String = "OutputFolder"
Private _saverundata as String = "SaveRunData"
Private _overrideinitialsoc as String = "OverrideInitialSOC"
Private _overrideinitialsocvalue as String = "OverrideInitialSOCValue"
Private _csItActive as String = "CS_it_Active"
Public Sub New()
SetDefault()
End Sub
......@@ -81,23 +104,29 @@ Public Class Configuration
Using reader As TextReader = File.OpenText(FilePath)
Dim content As JToken = JToken.ReadFrom(New JsonTextReader(reader))
Dim body As JToken = content.GetEx("Body")
Dim body As JToken = content.GetEx(_body)
Try
Mod1Hz = body.GetEx(Of Boolean)("Mod1Hz")
Mod1Hz = body.GetEx(Of Boolean)(_mod1Hz)
Catch
End Try
ModOut = body.GetEx(Of Boolean)("ModOut")
LogSize = body.GetEx(Of Double)("LogSize")
AirDensity = body.GetEx(Of Double)("AirDensity")
FuelDens = body.GetEx(Of Double)("FuelDensity")
Co2PerFc = body.GetEx(Of Double)("CO2perFC")
OpenCmd = body.GetEx(Of String)("OpenCmd")
OpenCmdName = body.GetEx(Of String)("OpenCmdName")
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)())
SaveVectoRunData = body.GetEx(Of Boolean)("SaveRunData")
ModOut = body.GetEx(Of Boolean)(_modOut)
LogSize = body.GetEx(Of Double)(_logSize)
AirDensity = body.GetEx(Of Double)(_airdensity)
FuelDens = body.GetEx(Of Double)(_fueldensity)
Co2PerFc = body.GetEx(Of Double)(_co2Perfc)
OpenCmd = body.GetEx(Of String)(_openCmd)
OpenCmdName = body.GetEx(Of String)(_opencmdname)
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)())
SaveVectoRunData = body.GetEx(Of Boolean)(_saverundata)
InitialSOCOverride = body.GetEx(Of Boolean)(_overrideinitialsoc)
InitialSOCOverrideValue = body.GetEx(Of Double)(_overrideinitialsocvalue)
ChargeSustainingIterationModeActivated = body.GetEx(Of Boolean)(_csItActive)
End Using
Catch ex As Exception
GUIMsg(MessageType.Err, "Error while loading settings!")
......@@ -112,21 +141,27 @@ Public Class Configuration
header.Add("FileVersion", FormatVersion)
Dim body As Dictionary(Of String, Object) = New Dictionary(Of String, Object)
body.Add("ModOut", ModOut)
body.Add("Mod1Hz", Mod1Hz)
body.Add("LogSize", LogSize)
body.Add("AirDensity", AirDensity)
body.Add("FuelDensity", FuelDens)
body.Add("CO2perFC", Co2PerFc)
body.Add("OpenCmd", OpenCmd)
body.Add("OpenCmdName", OpenCmdName)
body.Add("FirstRun", FirstRun)
body.Add("DeclMode", DeclMode)
body.Add("ValidateRunData", ValidateRunData)
body.Add("OutputFolder", OutputFolder)
body.Add("SaveRunData", SaveVectoRunData)
JSONFileWriter.WriteFile(New Dictionary(Of String, Object) From {{"Header", header}, {"Body", body}}, FilePath)
body.Add(_modOut, ModOut)
body.Add(_mod1Hz, Mod1Hz)
body.Add(_logSize, LogSize)
body.Add(_airdensity, AirDensity)
body.Add(_fueldensity, FuelDens)
body.Add(_co2Perfc, Co2PerFc)
body.Add(_openCMD, OpenCmd)
body.Add(_opencmdname, OpenCmdName)
body.Add(_firstrun, FirstRun)
body.Add(_declMode, DeclMode)
body.Add(_validaterundata, ValidateRunData)
body.Add(_outputfolder, OutputFolder)
body.Add(_saverundata, SaveVectoRunData)
body.Add(_overrideinitialsoc, InitialSOCOverride)
body.Add(_overrideinitialsocvalue, InitialSOCOverrideValue)
body.Add(_csItActive, ChargeSustainingIterationModeActivated)
JSONFileWriter.WriteFile(New Dictionary(Of String, Object) From {{"Header", header}, {_body, body}}, FilePath)
End Sub
End Class
This diff is collapsed.
<?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">
......@@ -223,6 +163,9 @@
<metadata name="CmOpenFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>732, 12</value>
</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">
<value>25</value>
</metadata>
......
......@@ -47,6 +47,7 @@ Imports TUGraz.VectoCommon.Utils
Imports TUGraz.VectoCore
Imports TUGraz.VectoCore.InputData.FileIO.XML
Imports TUGraz.VectoCore.Models.Simulation
Imports TUGraz.VectoCore.Models.Simulation.Data
Imports TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory
Imports TUGraz.VectoCore.OutputData
Imports TUGraz.VectoCore.OutputData.FileIO
......@@ -1050,12 +1051,42 @@ lbFound:
Dim fileWriter As FileOutputWriter = New FileOutputWriter(outFile)
Dim runsFactory As ISimulatorFactory = SimulatorFactory.CreateSimulatorFactory(mode, input, fileWriter)
'Remove
runsFactory.ModifyRunData = Sub(data)
Dim runData = data
If(cbInitialSOC.Checked And (runData.OVCMode = VectoRunData.OvcHevMode.ChargeDepleting))
Dim initSOC = Double.Parse(tbInitSOCinPercent.Text) / 100
If(runData.HybridStrategyParameters IsNot Nothing)
runData.HybridStrategyParameters.InitialSoc = initSOC
runData.HybridStrategyParameters.TargetSoC = initSOC - 1
End If
If(runData.BatteryData IsNot Nothing)
runData.BatteryData.InitialSoc = initSOC
End If
End If
runData.IterativeRunStrategy.Enabled = cbCSIteratingMode.Checked
End Sub
runsFactory.WriteModalResults = Cfg.ModOut
runsFactory.ModalResults1Hz = Cfg.Mod1Hz
runsFactory.Validate = cbValidateRunData.Checked
runsFactory.ActualModalData = cbActVmod.Checked
runsFactory.SerializeVectoRunData = cbSaveVectoRunData.Checked
For Each run as integer In jobContainer.AddRuns(runsFactory)
fileWriters.Add(run, fileWriter)
Next
......@@ -1509,6 +1540,10 @@ lbFound:
cbSaveVectoRunData.Checked = Cfg.SaveVectoRunData
tbOutputFolder.Text = Cfg.OutputFolder
'Test Settings for 2nd amendment
cbCSIteratingMode.Checked = Cfg.ChargeSustainingIterationModeActivated
cbInitialSOC.Checked = Cfg.InitialSOCOverride
tbInitSOCinPercent.Text = Cfg.InitialSOCOverrideValue.ToString()
End Sub
'Update config class from options in GUI, e.g. before running calculations
......@@ -1518,6 +1553,17 @@ lbFound:
Cfg.ValidateRunData = cbValidateRunData.Checked
Cfg.SaveVectoRunData = cbSaveVectoRunData.Checked
Cfg.OutputFolder = tbOutputFolder.Text
Cfg.ChargeSustainingIterationModeActivated = cbCSIteratingMode.Checked
Cfg.InitialSOCOverride = cbInitialSOC.Checked
Dim initSoc as Double
Dim parsingOk = Double.TryParse(tbInitSOCinPercent.Text, initSoc)
Cfg.InitialSOCOverrideValue = If(parsingOk, initSoc, 0d)
'Test Settings for 2nd amendment
'
End Sub
#End Region
......@@ -2233,4 +2279,8 @@ lbFound:
Private Sub ToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles JobEditorIEPC_S_VehicleToolStripMenuItem.Click
OpenVECTOeditor("<New>", VectoSimulationJobType.IEPC_S)
End Sub
Private Sub tbInitSOCinPercent_TextChanged(sender As Object, e As EventArgs) Handles tbInitSOCinPercent.TextChanged
End Sub
End Class
\ No newline at end of file
This diff is collapsed.
......@@ -8,7 +8,8 @@
<OptionStrict>On</OptionStrict>
<UseWindowsForms>true</UseWindowsForms>
<MyType>WindowsForms</MyType>
<TargetFrameworks>net45;net48;net6.0-windows</TargetFrameworks>
<TargetFramework>net6.0-windows</TargetFramework>
<!--<TargetFrameworks>net45;net48;net6.0-windows</TargetFrameworks>-->
<TargetFrameworks Condition="'$(Configuration)' == 'Release'">net45;net48;net6.0-windows</TargetFrameworks>
<TargetFrameworks Condition="'$(Configuration)' == 'Deploy'">net45;net48;net6.0-windows</TargetFrameworks>
<TargetFrameworks Condition="'$(Configuration)' == 'MockupDeploy'">net45;net48;net6.0-windows</TargetFrameworks>
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
using TUGraz.VectoCommon.InputData;
......@@ -92,7 +93,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider.v24
public override VectoSimulationJobType VehicleType
{
get => VectoSimulationJobType.ParallelHybridVehicle;
get => Components.ElectricMachines.Entries.Any(em => em.ElectricMachine.IsIHPC()) ? VectoSimulationJobType.IHPC : VectoSimulationJobType.ParallelHybridVehicle;
}
}
......
......@@ -18,6 +18,7 @@ namespace TUGraz.VectoCore.Models.Declaration.IterativeRunStrategies
public abstract bool RunAgain(int iteration, IModalDataContainer modData, VectoRunData runData);
public abstract void UpdateRunData(int iteration, IModalDataContainer modData, VectoRunData runData);
public bool Enabled { get; set; }
#endregion
}
......
......@@ -23,6 +23,12 @@ namespace TUGraz.VectoCore.Models.Declaration.IterativeRunStrategies
/// <param name="modData">The results of the finished run</param>
/// <param name="runData">modifies runData</param>
void UpdateRunData(int iteration, IModalDataContainer modData, VectoRunData runData);
/// <summary>
/// Enables or disables the iterative run strategy
/// </summary>
bool Enabled { get; set; }
}
public interface IIterativeRunResult
......
......@@ -11,7 +11,8 @@ namespace TUGraz.VectoCore.Models.Declaration.IterativeRunStrategies
public override bool RunAgain(int iteration, IModalDataContainer modData, VectoRunData runData)
{
return iteration < 2;
return Enabled && iteration < 2;
}
public override void UpdateRunData(int iteration, IModalDataContainer modData, VectoRunData runData)
......
......@@ -29,8 +29,10 @@
* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology
*/
using System;
using System.Collections.Generic;
using TUGraz.VectoCore.InputData;
using TUGraz.VectoCore.Models.Simulation.Data;
using TUGraz.VectoCore.OutputData;
namespace TUGraz.VectoCore.Models.Simulation
......@@ -51,6 +53,10 @@ namespace TUGraz.VectoCore.Models.Simulation
bool CreateFollowUpSimulatorFactory { get; set; }
/// <summary>
/// Only for testing purposes
/// </summary>
Action<VectoRunData> ModifyRunData { get; set; }
/// <summary>
......
......@@ -138,6 +138,13 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory
public bool SerializeVectoRunData { get; set; }
/// <summary>
/// Only for testing purposes
/// </summary>
public Action<VectoRunData> ModifyRunData { get; set; }
/// <summary>
/// Creates powertrain and initializes it with the component's data.
/// </summary>
......@@ -152,9 +159,17 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory
}
foreach (var data in RunDataFactory.NextRun()) {
var current = i++;
var d = data;
data.JobRunId = current;
yield return (data.Exempted || data.MultistageRun) ? GetExemptedRun(data) : GetNonExemptedRun(data, current, d, ref warning1Hz, ref firstRun);
if (ModifyRunData != null) {
ModifyRunData(data);
}
yield return (data.Exempted || data.MultistageRun) ? GetExemptedRun(data) : GetNonExemptedRun(data, current, ref warning1Hz, ref firstRun);
}
}
......@@ -171,7 +186,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory
});
}
protected virtual IVectoRun GetNonExemptedRun(VectoRunData data, int current, VectoRunData d, ref bool warning1Hz, ref bool firstRun)
protected virtual IVectoRun GetNonExemptedRun(VectoRunData data, int current, ref bool warning1Hz, ref bool firstRun)
{
var addReportResult = PrepareReport(data);
if (!data.Cycle.CycleType.IsDistanceBased() && ModalResults1Hz && !warning1Hz) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment