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

minor fixes user interface, input validation torque converter

parent 94a7e69a
No related branches found
No related tags found
No related merge requests found
......@@ -454,7 +454,7 @@ Public Class VectoJobForm
Dim auxInput As IAuxiliariesDeclarationInputData = declarationInput.AuxiliaryInputData()
cboAdvancedAuxiliaries.SelectedIndex = 0
cboAdvancedAuxiliaries.Enabled = False
LvAux.Items.Clear()
Dim entry As IAuxiliaryDeclarationInputData
For Each entry In auxInput.Auxiliaries
......@@ -470,7 +470,7 @@ Public Class VectoJobForm
TbDesMaxFile.Text =
If(driver.AccelerationCurve Is Nothing, "", GetRelativePath(driver.AccelerationCurve.Source, _basePath))
cboAdvancedAuxiliaries.Enabled = True
Dim auxInput As IAuxiliariesEngineeringInputData = inputData.AuxiliaryInputData()
For Each item As AdvancedAuxiliary In cboAdvancedAuxiliaries.Items
If _
......@@ -716,6 +716,7 @@ Public Class VectoJobForm
tbLacDfTargetSpeedFile.Text = ""
tbLacDfVelocityDropFile.Text = ""
cboAdvancedAuxiliaries.Enabled = Not Cfg.DeclMode
'---------------------------------------------------
DeclInit()
......@@ -872,15 +873,15 @@ lbDlog:
End If
Dim selItem As ListViewItem = LvAux.SelectedItems(0)
_auxDialog.VehPath = GetPath(VectoFile)
_auxDialog.CbType.SelectedIndex = -1
_auxDialog.CbType.Text = selItem.SubItems(AuxViewColumns.AuxType).Text
_auxDialog.NumAxles = AxleConfigurationHelper.Parse(TbAxleConf.Text).NumAxles()
_auxDialog.TbID.Text = selItem.SubItems(AuxViewColumns.AuxID).Text ' last call, updates GUI
_auxDialog.NumAxles =
If(String.IsNullOrWhiteSpace(TbAxleConf.Text), 1, AxleConfigurationHelper.Parse(TbAxleConf.Text).NumAxles())
If Cfg.DeclMode Then
If _auxDialog.TbID.Text = AuxiliaryTypeHelper.GetAuxKey(AuxiliaryType.SteeringPump) Then
If selItem.SubItems(AuxViewColumns.AuxID).Text = AuxiliaryTypeHelper.GetAuxKey(AuxiliaryType.SteeringPump) Then
Dim parts As String() = selItem.SubItems(AuxViewColumns.AuxInputOrTech).Text.Split(";"c)
_auxDialog.CbTech2.SelectedItem = VehicleAuxiliariesDialog.AxleNotSteered
_auxDialog.CbTech3.SelectedItem = VehicleAuxiliariesDialog.AxleNotSteered
......@@ -892,12 +893,15 @@ lbDlog:
Else
_auxDialog.CbTech.SelectedItem = selItem.SubItems(AuxViewColumns.AuxInputOrTech).Text
_auxDialog.TbPath.Text = ""
_auxDialog.NumAxles = 0
End If
Else
_auxDialog.CbTech.SelectedIndex = -1
_auxDialog.TbPath.Text = selItem.SubItems(AuxViewColumns.AuxInputOrTech).Text
End If
'_auxDialog.TbID.Text = selItem.SubItems(AuxViewColumns.AuxID).Text
_auxDialog.CbType.Text = selItem.SubItems(AuxViewColumns.AuxType).Text ' last call, updates GUI
If _auxDialog.ShowDialog = DialogResult.OK Then
selItem.SubItems(AuxViewColumns.AuxID).Text = UCase(Trim(_auxDialog.TbID.Text))
selItem.SubItems(AuxViewColumns.AuxType).Text = Trim(_auxDialog.CbType.Text)
......
......@@ -173,6 +173,7 @@ Public Class VehicleForm
TbMassExtra.Text = "-"
TbLoad.Text = "-"
CbCdMode.SelectedValue = CrossWindCorrectionMode.DeclarationModeCorrection
TbCdFile.Text = ""
Dim rdyn As Double
......
......@@ -314,7 +314,7 @@ Public Class Gearbox
Public ReadOnly Property IComponentInputData_ModelName As String Implements IComponentInputData.ModelName
Get
Return "N.A." ' todo MQ 20160915
Return ModelName
End Get
End Property
......@@ -371,6 +371,7 @@ Public Class Gearbox
Public ReadOnly Property ShiftPolygon As TableData Implements ITorqueConverterEngineeringInputData.ShiftPolygon
Get
If Not File.Exists(Path.Combine(_myPath, TorqueConverterShiftPolygonFile)) Then Return Nothing
Return VectoCSVFile.Read(Path.Combine(_myPath, TorqueConverterShiftPolygonFile))
End Get
End Property
......
......@@ -102,7 +102,7 @@ Public Class JSONFileWriter
gearDict.Add("LossMap", GetRelativePath(gear.LossMap.Source, Path.GetDirectoryName(filename)))
End If
gearDict.Add("ShiftPolygon", If _
(gbx.SavedInDeclarationMode AndAlso Not gear.ShiftPolygon Is Nothing,
(Not gbx.SavedInDeclarationMode AndAlso Not gear.ShiftPolygon Is Nothing,
GetRelativePath(gear.ShiftPolygon.Source, Path.GetDirectoryName(filename)), ""))
gearDict.Add("MaxTorque", If(gear.MaxTorque Is Nothing, "", gear.MaxTorque.Value().ToString()))
......@@ -130,7 +130,7 @@ Public Class JSONFileWriter
torqueConverterDict.Add("Inertia", torqueConverter.Inertia.Value())
torqueConverterDict.Add("ShiftPolygon",
If _
(gbx.SavedInDeclarationMode AndAlso Not torqueConverter.ShiftPolygon Is Nothing,
(Not gbx.SavedInDeclarationMode AndAlso Not torqueConverter.ShiftPolygon Is Nothing,
GetRelativePath(torqueConverter.ShiftPolygon.Source, Path.GetDirectoryName(filename)), ""))
End If
body.Add("TorqueConverter", torqueConverterDict)
......@@ -261,7 +261,7 @@ Public Class JSONFileWriter
'AA-TB
'ADVANCED AUXILIARIES
body.Add("AuxiliaryAssembly", aux.AuxiliaryAssembly.ToString())
body.Add("AuxiliaryAssembly", aux.AuxiliaryAssembly.GetName())
body.Add("AuxiliaryVersion", aux.AuxiliaryVersion)
body.Add("AdvancedAuxiliaryFilePath", aux.AdvancedAuxiliaryFilePath)
......
......@@ -29,6 +29,8 @@
* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology
*/
using System;
namespace TUGraz.VectoCommon.Models
{
public enum AuxiliaryModel
......@@ -50,5 +52,14 @@ namespace TUGraz.VectoCommon.Models
}
return AuxiliaryModel.Classic;
}
public static string GetName(this AuxiliaryModel model)
{
switch (model) {
case AuxiliaryModel.Advanced:
return "BusAuxiliaries";
}
return model.ToString();
}
}
}
\ No newline at end of file
......@@ -178,7 +178,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
// powersplit transmission: torque converter already contains ratio and losses
gearData.TorqueConverterRatio = 1;
gearData.TorqueConverterGearLossMap = TransmissionLossMapReader.Create(1, 1, string.Format("TCGear {0}", i + 1));
gearData.TorqueConverterShiftPolygon = ShiftPolygonReader.Create(gearbox.TorqueConverter.ShiftPolygon);
gearData.TorqueConverterShiftPolygon = gearbox.TorqueConverter.ShiftPolygon == null ? null : ShiftPolygonReader.Create(gearbox.TorqueConverter.ShiftPolygon);
}
}
if (gearbox.Type == GearboxType.ATSerial) {
......@@ -186,14 +186,14 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
// torqueconverter is active in first gear - duplicate ratio and lossmap for torque converter mode
gearData.TorqueConverterRatio = gearData.Ratio;
gearData.TorqueConverterGearLossMap = gearData.LossMap;
gearData.TorqueConverterShiftPolygon = ShiftPolygonReader.Create(gearbox.TorqueConverter.ShiftPolygon);
gearData.TorqueConverterShiftPolygon = gearbox.TorqueConverter.ShiftPolygon == null ? null : ShiftPolygonReader.Create(gearbox.TorqueConverter.ShiftPolygon);
}
if (i == 1 && gearDifferenceRatio >= DeclarationData.Gearbox.TorqueConverterSecondGearThreshold) {
// ratio between first and second gear is above threshold, torqueconverter is active in second gear as well
// -> duplicate ratio and lossmap for torque converter mode, remove locked transmission for previous gear
gearData.TorqueConverterRatio = gearData.Ratio;
gearData.TorqueConverterGearLossMap = gearData.LossMap;
gearData.TorqueConverterShiftPolygon = ShiftPolygonReader.Create(gearbox.TorqueConverter.ShiftPolygon);
gearData.TorqueConverterShiftPolygon = gearbox.TorqueConverter.ShiftPolygon == null ? null : ShiftPolygonReader.Create(gearbox.TorqueConverter.ShiftPolygon);
// NOTE: the lower gear in 'gears' dictionary has index i !!
gears[i].Ratio = double.NaN;
gears[i].LossMap = null;
......
......@@ -30,6 +30,8 @@
*/
using System.ComponentModel.DataAnnotations;
using System.Linq;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils;
namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox
......@@ -43,6 +45,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox
public double Ratio { get; internal set; }
}
[CustomValidation(typeof(GearData), "ValidateGearData")]
public class GearData : TransmissionData
{
public GearData()
......@@ -70,5 +73,22 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox
public NewtonMeter MaxTorque { get; internal set; }
public ShiftPolygon TorqueConverterShiftPolygon { get; set; }
public static ValidationResult ValidateGearData(GearData gearData, ValidationContext context)
{
var modeService = context.GetService(typeof(ExecutionMode)) as ExecutionModeServiceContainer;
var mode = modeService == null ? ExecutionMode.Declaration : modeService.Mode;
if (gearData.HasTorqueConverter) {
if (gearData.TorqueConverterShiftPolygon == null) {
return new ValidationResult("Shift Polygon for Torque Converter Gear required!");
}
var result = gearData.TorqueConverterShiftPolygon.Validate(mode);
if (result.Any()) {
return new ValidationResult(string.Format("Validation of GearData failed"), result.Select(x => x.ErrorMessage));
}
}
return ValidationResult.Success;
}
}
}
\ 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