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 7ff78ce9 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

add input field in gui to select which shift strategy to use

parent 05b07c94
Branches
Tags
No related merge requests found
...@@ -28,6 +28,9 @@ Partial Class VectoJobForm ...@@ -28,6 +28,9 @@ Partial Class VectoJobForm
Me.components = New System.ComponentModel.Container() Me.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(VectoJobForm)) Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(VectoJobForm))
Me.TabPgGen = New System.Windows.Forms.TabPage() Me.TabPgGen = New System.Windows.Forms.TabPage()
Me.TbShiftStrategyParams = New System.Windows.Forms.TextBox()
Me.BtnShiftParamsForm = New System.Windows.Forms.Button()
Me.BtnShiftStrategyParams = New System.Windows.Forms.Button()
Me.GrCycles = New System.Windows.Forms.GroupBox() Me.GrCycles = New System.Windows.Forms.GroupBox()
Me.Label2 = New System.Windows.Forms.Label() Me.Label2 = New System.Windows.Forms.Label()
Me.LvCycles = New System.Windows.Forms.ListView() Me.LvCycles = New System.Windows.Forms.ListView()
...@@ -129,9 +132,8 @@ Partial Class VectoJobForm ...@@ -129,9 +132,8 @@ Partial Class VectoJobForm
Me.TbMass = New System.Windows.Forms.TextBox() Me.TbMass = New System.Windows.Forms.TextBox()
Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components) Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
Me.lblEngineCharacteristics = New System.Windows.Forms.Label() Me.lblEngineCharacteristics = New System.Windows.Forms.Label()
Me.TbShiftStrategyParams = New System.Windows.Forms.TextBox() Me.GroupBox3 = New System.Windows.Forms.GroupBox()
Me.BtnShiftParamsForm = New System.Windows.Forms.Button() Me.cbGearshiftStrategy = New System.Windows.Forms.ComboBox()
Me.BtnShiftStrategyParams = New System.Windows.Forms.Button()
Me.TabPgGen.SuspendLayout Me.TabPgGen.SuspendLayout
Me.GrCycles.SuspendLayout Me.GrCycles.SuspendLayout
Me.GrAux.SuspendLayout Me.GrAux.SuspendLayout
...@@ -150,6 +152,7 @@ Partial Class VectoJobForm ...@@ -150,6 +152,7 @@ Partial Class VectoJobForm
Me.CmOpenFile.SuspendLayout Me.CmOpenFile.SuspendLayout
CType(Me.PicVehicle,System.ComponentModel.ISupportInitialize).BeginInit CType(Me.PicVehicle,System.ComponentModel.ISupportInitialize).BeginInit
CType(Me.PicBox,System.ComponentModel.ISupportInitialize).BeginInit CType(Me.PicBox,System.ComponentModel.ISupportInitialize).BeginInit
Me.GroupBox3.SuspendLayout
Me.SuspendLayout Me.SuspendLayout
' '
'TabPgGen 'TabPgGen
...@@ -176,6 +179,36 @@ Partial Class VectoJobForm ...@@ -176,6 +179,36 @@ Partial Class VectoJobForm
Me.TabPgGen.Text = "General" Me.TabPgGen.Text = "General"
Me.TabPgGen.UseVisualStyleBackColor = true Me.TabPgGen.UseVisualStyleBackColor = true
' '
'TbShiftStrategyParams
'
Me.TbShiftStrategyParams.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles)
Me.TbShiftStrategyParams.Location = New System.Drawing.Point(85, 87)
Me.TbShiftStrategyParams.Name = "TbShiftStrategyParams"
Me.TbShiftStrategyParams.Size = New System.Drawing.Size(411, 20)
Me.TbShiftStrategyParams.TabIndex = 12
'
'BtnShiftParamsForm
'
Me.BtnShiftParamsForm.Location = New System.Drawing.Point(7, 87)
Me.BtnShiftParamsForm.Name = "BtnShiftParamsForm"
Me.BtnShiftParamsForm.Size = New System.Drawing.Size(72, 21)
Me.BtnShiftParamsForm.TabIndex = 11
Me.BtnShiftParamsForm.TabStop = false
Me.BtnShiftParamsForm.Text = "Shift Parameters"
Me.BtnShiftParamsForm.UseVisualStyleBackColor = true
'
'BtnShiftStrategyParams
'
Me.BtnShiftStrategyParams.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles)
Me.BtnShiftStrategyParams.Image = CType(resources.GetObject("BtnShiftStrategyParams.Image"),System.Drawing.Image)
Me.BtnShiftStrategyParams.Location = New System.Drawing.Point(497, 85)
Me.BtnShiftStrategyParams.Name = "BtnShiftStrategyParams"
Me.BtnShiftStrategyParams.Size = New System.Drawing.Size(24, 24)
Me.BtnShiftStrategyParams.TabIndex = 13
Me.BtnShiftStrategyParams.TabStop = false
Me.BtnShiftStrategyParams.UseVisualStyleBackColor = true
'
'GrCycles 'GrCycles
' '
Me.GrCycles.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ Me.GrCycles.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
...@@ -533,13 +566,14 @@ Partial Class VectoJobForm ...@@ -533,13 +566,14 @@ Partial Class VectoJobForm
' '
'TabPgDriver 'TabPgDriver
' '
Me.TabPgDriver.Controls.Add(Me.GroupBox3)
Me.TabPgDriver.Controls.Add(Me.GrVACC) Me.TabPgDriver.Controls.Add(Me.GrVACC)
Me.TabPgDriver.Controls.Add(Me.GrLAC) Me.TabPgDriver.Controls.Add(Me.GrLAC)
Me.TabPgDriver.Controls.Add(Me.GroupBox1) Me.TabPgDriver.Controls.Add(Me.GroupBox1)
Me.TabPgDriver.Location = New System.Drawing.Point(4, 22) Me.TabPgDriver.Location = New System.Drawing.Point(4, 22)
Me.TabPgDriver.Name = "TabPgDriver" Me.TabPgDriver.Name = "TabPgDriver"
Me.TabPgDriver.Padding = New System.Windows.Forms.Padding(3) Me.TabPgDriver.Padding = New System.Windows.Forms.Padding(3)
Me.TabPgDriver.Size = New System.Drawing.Size(527, 487) Me.TabPgDriver.Size = New System.Drawing.Size(527, 512)
Me.TabPgDriver.TabIndex = 7 Me.TabPgDriver.TabIndex = 7
Me.TabPgDriver.Text = "Driver Model" Me.TabPgDriver.Text = "Driver Model"
Me.TabPgDriver.UseVisualStyleBackColor = true Me.TabPgDriver.UseVisualStyleBackColor = true
...@@ -1160,35 +1194,23 @@ Partial Class VectoJobForm ...@@ -1160,35 +1194,23 @@ Partial Class VectoJobForm
Me.lblEngineCharacteristics.Size = New System.Drawing.Size(0, 13) Me.lblEngineCharacteristics.Size = New System.Drawing.Size(0, 13)
Me.lblEngineCharacteristics.TabIndex = 37 Me.lblEngineCharacteristics.TabIndex = 37
' '
'TbShiftStrategyParams 'GroupBox3
' '
Me.TbShiftStrategyParams.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ Me.GroupBox3.Controls.Add(Me.cbGearshiftStrategy)
Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles) Me.GroupBox3.Location = New System.Drawing.Point(9, 347)
Me.TbShiftStrategyParams.Location = New System.Drawing.Point(85, 87) Me.GroupBox3.Name = "GroupBox3"
Me.TbShiftStrategyParams.Name = "TbShiftStrategyParams" Me.GroupBox3.Size = New System.Drawing.Size(514, 50)
Me.TbShiftStrategyParams.Size = New System.Drawing.Size(411, 20) Me.GroupBox3.TabIndex = 4
Me.TbShiftStrategyParams.TabIndex = 12 Me.GroupBox3.TabStop = false
Me.GroupBox3.Text = "Gearshift Strategy"
' '
'BtnShiftParamsForm 'cbGearshiftStrategy
' '
Me.BtnShiftParamsForm.Location = New System.Drawing.Point(7, 87) Me.cbGearshiftStrategy.FormattingEnabled = true
Me.BtnShiftParamsForm.Name = "BtnShiftParamsForm" Me.cbGearshiftStrategy.Location = New System.Drawing.Point(6, 19)
Me.BtnShiftParamsForm.Size = New System.Drawing.Size(72, 21) Me.cbGearshiftStrategy.Name = "cbGearshiftStrategy"
Me.BtnShiftParamsForm.TabIndex = 11 Me.cbGearshiftStrategy.Size = New System.Drawing.Size(270, 21)
Me.BtnShiftParamsForm.TabStop = false Me.cbGearshiftStrategy.TabIndex = 0
Me.BtnShiftParamsForm.Text = "Shift Parameters"
Me.BtnShiftParamsForm.UseVisualStyleBackColor = true
'
'BtnShiftStrategyParams
'
Me.BtnShiftStrategyParams.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles)
Me.BtnShiftStrategyParams.Image = CType(resources.GetObject("BtnShiftStrategyParams.Image"),System.Drawing.Image)
Me.BtnShiftStrategyParams.Location = New System.Drawing.Point(497, 85)
Me.BtnShiftStrategyParams.Name = "BtnShiftStrategyParams"
Me.BtnShiftStrategyParams.Size = New System.Drawing.Size(24, 24)
Me.BtnShiftStrategyParams.TabIndex = 13
Me.BtnShiftStrategyParams.TabStop = false
Me.BtnShiftStrategyParams.UseVisualStyleBackColor = true
' '
'VectoJobForm 'VectoJobForm
' '
...@@ -1248,6 +1270,7 @@ Partial Class VectoJobForm ...@@ -1248,6 +1270,7 @@ Partial Class VectoJobForm
Me.CmOpenFile.ResumeLayout(false) Me.CmOpenFile.ResumeLayout(false)
CType(Me.PicVehicle,System.ComponentModel.ISupportInitialize).EndInit CType(Me.PicVehicle,System.ComponentModel.ISupportInitialize).EndInit
CType(Me.PicBox,System.ComponentModel.ISupportInitialize).EndInit CType(Me.PicBox,System.ComponentModel.ISupportInitialize).EndInit
Me.GroupBox3.ResumeLayout(false)
Me.ResumeLayout(false) Me.ResumeLayout(false)
Me.PerformLayout Me.PerformLayout
...@@ -1357,4 +1380,6 @@ End Sub ...@@ -1357,4 +1380,6 @@ End Sub
Friend WithEvents TbShiftStrategyParams As TextBox Friend WithEvents TbShiftStrategyParams As TextBox
Friend WithEvents BtnShiftParamsForm As Button Friend WithEvents BtnShiftParamsForm As Button
Friend WithEvents BtnShiftStrategyParams As Button Friend WithEvents BtnShiftStrategyParams As Button
Friend WithEvents GroupBox3 As GroupBox
Friend WithEvents cbGearshiftStrategy As ComboBox
End Class End Class
...@@ -24,6 +24,7 @@ Imports TUGraz.VectoCommon.Utils ...@@ -24,6 +24,7 @@ Imports TUGraz.VectoCommon.Utils
Imports TUGraz.VectoCore.InputData.FileIO.JSON Imports TUGraz.VectoCore.InputData.FileIO.JSON
Imports TUGraz.VectoCore.InputData.Reader Imports TUGraz.VectoCore.InputData.Reader
Imports TUGraz.VectoCore.Models.Declaration Imports TUGraz.VectoCore.Models.Declaration
Imports TUGraz.VectoCore.Models.Simulation.Impl
Imports TUGraz.VectoCore.Models.SimulationComponent.Data Imports TUGraz.VectoCore.Models.SimulationComponent.Data
Imports TUGraz.VectoCore.Models.SimulationComponent.Data.Engine Imports TUGraz.VectoCore.Models.SimulationComponent.Data.Engine
Imports TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox Imports TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox
...@@ -94,6 +95,9 @@ Public Class VectoJobForm ...@@ -94,6 +95,9 @@ Public Class VectoJobForm
'AA-TB 'AA-TB
PopulateAdvancedAuxiliaries() PopulateAdvancedAuxiliaries()
cbGearshiftStrategy.DataSource = PowertrainBuilder.GetRegisteredShiftStrategies(Nothing).Select(Function(entry) New With {.Value = entry.Item1, .Label = entry.Item2}).ToList()
cbGearshiftStrategy.DisplayMember = "Label"
cbGearshiftStrategy.ValueMember = "Value"
'Attempt to select that found in Config 'Attempt to select that found in Config
End Sub End Sub
...@@ -443,7 +447,11 @@ Public Class VectoJobForm ...@@ -443,7 +447,11 @@ Public Class VectoJobForm
TbVEH.Text = GetRelativePath(inputData.JobInputData.Vehicle.Source, _basePath) TbVEH.Text = GetRelativePath(inputData.JobInputData.Vehicle.Source, _basePath)
TbENG.Text = GetRelativePath(inputData.JobInputData.Vehicle.EngineInputData.Source, _basePath) TbENG.Text = GetRelativePath(inputData.JobInputData.Vehicle.EngineInputData.Source, _basePath)
TbGBX.Text = GetRelativePath(inputData.JobInputData.Vehicle.GearboxInputData.Source, _basePath) TbGBX.Text = GetRelativePath(inputData.JobInputData.Vehicle.GearboxInputData.Source, _basePath)
if (inputData.GearshiftInputData Is Nothing) Then
TbShiftStrategyParams.Text = ""
else
TbShiftStrategyParams.Text = GetRelativePath(inputData.GearshiftInputData.Source, _basePath) TbShiftStrategyParams.Text = GetRelativePath(inputData.GearshiftInputData.Source, _basePath)
End If
'Start/Stop 'Start/Stop
Dim driver As IDriverEngineeringInputData = inputData.DriverInputData Dim driver As IDriverEngineeringInputData = inputData.DriverInputData
...@@ -545,6 +553,12 @@ Public Class VectoJobForm ...@@ -545,6 +553,12 @@ Public Class VectoJobForm
End If End If
'------------------------------------------------------------- '-------------------------------------------------------------
cbGearshiftStrategy.DataSource = PowertrainBuilder.GetRegisteredShiftStrategies(inputData.JobInputData.Vehicle.GearboxInputData.Type).Select(Function(entry) New With {.Value = entry.Item1, .Label = entry.Item2}).ToList()
cbGearshiftStrategy.DisplayMember = "Label"
cbGearshiftStrategy.ValueMember = "Value"
cbGearshiftStrategy.SelectedValue = inputData.JobInputData.ShiftStrategy
DeclInit() DeclInit()
...@@ -617,6 +631,7 @@ Public Class VectoJobForm ...@@ -617,6 +631,7 @@ Public Class VectoJobForm
vectoJob.PathGbx = TbGBX.Text vectoJob.PathGbx = TbGBX.Text
vectoJob.PathShiftParams = TbShiftStrategyParams.Text vectoJob.PathShiftParams = TbShiftStrategyParams.Text
vectoJob.ShiftStrategy = cbGearshiftStrategy.SelectedValue.ToString()
'a_DesMax 'a_DesMax
vectoJob.DesMaxFile = TbDesMaxFile.Text vectoJob.DesMaxFile = TbDesMaxFile.Text
......
...@@ -38,6 +38,7 @@ using TUGraz.VectoCommon.Utils; ...@@ -38,6 +38,7 @@ using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Declaration;
using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.Data;
using TUGraz.VectoCore.Models.Simulation.DataBus;
using TUGraz.VectoCore.Models.SimulationComponent; using TUGraz.VectoCore.Models.SimulationComponent;
using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Models.SimulationComponent.Data;
using TUGraz.VectoCore.Models.SimulationComponent.Impl; using TUGraz.VectoCore.Models.SimulationComponent.Impl;
...@@ -55,6 +56,17 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl ...@@ -55,6 +56,17 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
private readonly IModalDataContainer _modData; private readonly IModalDataContainer _modData;
private readonly WriteSumData _sumWriter; private readonly WriteSumData _sumWriter;
private static List<Tuple<List<GearboxType>, string, string, Func<VectoRunData, IVehicleContainer, BaseShiftStrategy>>> ShiftStrategies = new List<Tuple<List<GearboxType>, string, string, Func<VectoRunData, IVehicleContainer, BaseShiftStrategy>>>
{
Tuple.Create<List<GearboxType>, string, string, Func<VectoRunData, IVehicleContainer, BaseShiftStrategy>>(new List<GearboxType> {GearboxType.MT}, typeof(MTShiftStrategy).FullName, MTShiftStrategy.Name, (r, c) => new MTShiftStrategy(r, c)),
Tuple.Create<List<GearboxType>, string, string, Func<VectoRunData, IVehicleContainer, BaseShiftStrategy>>( new List<GearboxType> {GearboxType.AMT}, typeof(AMTShiftStrategy).FullName,AMTShiftStrategy.Name, (r, c) => new AMTShiftStrategy(r, c)),
Tuple.Create<List<GearboxType>, string, string, Func<VectoRunData, IVehicleContainer, BaseShiftStrategy>>( new List<GearboxType> {GearboxType.AMT}, typeof(AMTShiftStrategyOptimized).FullName, AMTShiftStrategyOptimized.Name, (r, c) => new AMTShiftStrategyOptimized(r, c)),
Tuple.Create<List<GearboxType>, string, string, Func<VectoRunData, IVehicleContainer, BaseShiftStrategy>>( new List<GearboxType> {GearboxType.AMT}, typeof(AMTShiftStrategyV2).FullName, AMTShiftStrategyV2.Name, (r, c) => new AMTShiftStrategyV2(r, c)),
Tuple.Create<List<GearboxType>, string, string, Func<VectoRunData, IVehicleContainer, BaseShiftStrategy>>( new List<GearboxType> {GearboxType.ATPowerSplit, GearboxType.ATSerial}, typeof(ATShiftStrategy).FullName, ATShiftStrategy.Name, (r, c) => new ATShiftStrategy(r, c)),
};
public PowertrainBuilder(IModalDataContainer modData, WriteSumData sumWriter = null) public PowertrainBuilder(IModalDataContainer modData, WriteSumData sumWriter = null)
{ {
if (modData == null) { if (modData == null) {
...@@ -383,28 +395,40 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl ...@@ -383,28 +395,40 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
private static IGearbox GetGearbox(IVehicleContainer container, VectoRunData runData) private static IGearbox GetGearbox(IVehicleContainer container, VectoRunData runData)
{ {
IShiftStrategy strategy; IShiftStrategy strategy;
strategy = GetShiftStrategy(runData, container);
switch (runData.GearboxData.Type) { switch (runData.GearboxData.Type) {
case GearboxType.AMT: case GearboxType.AMT:
#if CLASSIC_TCU
strategy = new AMTShiftStrategy(runData, container);
#else
strategy = runData.GearshiftParameters == null
? (IShiftStrategy)new AMTShiftStrategy(runData, container)
: new AMTShiftStrategyV2(runData, container);
#endif
break;
case GearboxType.MT: case GearboxType.MT:
strategy = new MTShiftStrategy(runData, container); return new Gearbox(container, strategy, runData);
break;
case GearboxType.ATPowerSplit: case GearboxType.ATPowerSplit:
case GearboxType.ATSerial: case GearboxType.ATSerial:
strategy = new ATShiftStrategy(runData.GearboxData, container);
return new ATGearbox(container, strategy, runData); return new ATGearbox(container, strategy, runData);
default: default:
throw new ArgumentOutOfRangeException("Unknown Gearbox Type", runData.GearboxData.Type.ToString()); throw new ArgumentOutOfRangeException("Unknown Gearbox Type", runData.GearboxData.Type.ToString());
} }
return new Gearbox(container, strategy, runData); }
private static IShiftStrategy GetShiftStrategy(VectoRunData runData, IVehicleContainer container)
{
if (string.IsNullOrWhiteSpace(runData.ShiftStrategy)) {
switch (runData.GearboxData.Type) {
case GearboxType.AMT:
return new AMTShiftStrategy(runData, container);
case GearboxType.MT:
return new MTShiftStrategy(runData, container);
case GearboxType.ATPowerSplit:
case GearboxType.ATSerial:
return new ATShiftStrategy(runData, container);
default:
throw new ArgumentOutOfRangeException("GearboxType", "Unknown Gearbox Type {0}", runData.GearboxData.Type.ToString());
}
}
var selected = ShiftStrategies.FirstOrDefault(x => x.Item1.Contains(runData.GearboxData.Type) && x.Item2.Equals(runData.ShiftStrategy, StringComparison.InvariantCultureIgnoreCase));
if (selected == null) {
throw new ArgumentOutOfRangeException("ShiftStrategy", "Unknown Shiftstrategy {0} for Gearbox Type {1}", runData.GearboxData.Type.ToString());
}
return selected.Item4(runData, container);
} }
private static IGearbox GetSimpleGearbox(IVehicleContainer container, VectoRunData runData) private static IGearbox GetSimpleGearbox(IVehicleContainer container, VectoRunData runData)
...@@ -414,5 +438,13 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl ...@@ -414,5 +438,13 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
} }
return new Gearbox(container, null, runData); return new Gearbox(container, null, runData);
} }
public static IEnumerable<Tuple<string, string>> GetRegisteredShiftStrategies(GearboxType? type)
{
if (!type.HasValue) {
return new List<Tuple<string, string>>();
}
return ShiftStrategies.Where(x => x.Item1.Contains(type.Value)).Select(x => Tuple.Create(x.Item2, x.Item3)).ToList();
}
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment