Code development platform for open source projects from the European Union institutions

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

updting gui to allow entering gear ratios per gear

parent 39b0f6bc
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
......@@ -129,9 +129,6 @@
<metadata name="ToolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>376, 21</value>
</metadata>
<metadata name="ToolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>376, 21</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btnBrowseBattery.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
......
......@@ -42,6 +42,12 @@ Public Class VehicleForm
MaxTorque = 1
End Enum
Private Enum RatiosPerGearTbl
Gear = 0
Ratio = 1
End Enum
Private _axlDlog As VehicleAxleDialog
Private _hdVclass As VehicleClass
Private _vehFile As String
......@@ -51,6 +57,7 @@ Public Class VehicleForm
Public AutoSendTo As Boolean = False
Public JobDir As String = ""
Private _torqueLimitDlog As VehicleTorqueLimitDialog
private _emRatioPerGearDlog as EMGearRatioDialog
Friend VehicleType As VectoSimulationJobType
'Close - Check for unsaved changes
......@@ -126,6 +133,7 @@ Public Class VehicleForm
.Cast(Of AngledriveType).Select(Function(type) New With {Key .Value = type, .Label = type.GetLabel()}).ToList()
_axlDlog = New VehicleAxleDialog
_torqueLimitDlog = New VehicleTorqueLimitDialog()
_emRatioPerGearDlog = new EMGearRatioDialog()
cbPTOType.ValueMember = "Value"
cbPTOType.DisplayMember = "Label"
......@@ -478,6 +486,16 @@ Public Class VehicleForm
GetRelativePath(em.MechanicalTransmissionLossMap.Source, basePath))
tbRatioEm.Text = em.RatioADC.ToGUIFormat()
cbEmPos.SelectedValue = em.Position
If (em.Position = PowertrainPosition.HybridP2_5) AndAlso Not em.RatioPerGear Is nothing Then
lvRatioPerGear.Items.Clear()
dim gear as integer = 1
for each entry as Double in em.RatioPerGear
lvRatioPerGear.Items.Add(CreateRatioPerGearListViewItem(gear, entry))
gear += 1
Next
End If
End If
If (vehicle.VehicleType = VectoSimulationJobType.ParallelHybridVehicle) Then
......@@ -497,7 +515,14 @@ Public Class VehicleForm
_changed = False
End Sub
Private Sub UpdateForm(vehType As VectoSimulationJobType)
Private Function CreateRatioPerGearListViewItem(gear As Integer, ratio As Double) As ListViewItem
dim retval as new ListViewItem
retVal.SubItems(0).Text = gear.ToGUIFormat()
retVal.SubItems.Add(ratio.ToGUIFormat())
return retval
End Function
Private Sub UpdateForm(vehType As VectoSimulationJobType)
VehicleType = vehType
Select Case vehType
Case VectoSimulationJobType.ConventionalVehicle
......@@ -624,6 +649,9 @@ Public Class VehicleForm
veh.ElectricMotorRatio = tbRatioEm.Text.ToDouble()
'veh.ElectricMotorMechEff = tbEmADCLossMap.Text.ToDouble()
veh.ElectricMotorMechLossMap.Init(GetPath(file), tbEmADCLossMap.Text)
if (veh.ElectricMotorPosition = PowertrainPosition.HybridP2_5)
veh.ElectricMotorPerGearRatios = lvRatioPerGear.Items.Cast(Of ListViewItem).Select(function(item) item.SubItems(RatiosPerGearTbl.Ratio).Text.ToDouble(0)).ToArray()
End If
End If
If (VehicleType = VectoSimulationJobType.ParallelHybridVehicle) AndAlso not String.IsNullOrWhiteSpace(tbEmTorqueLimits.Text) Then
......@@ -1168,5 +1196,62 @@ Public Class VehicleForm
tbPTODrive.Text = GetFilenameWithoutDirectory(PTODrivingCycleDrivingFileBrowser.Files(0), GetPath(_vehFile))
End If
End Sub
Private Sub lvTorqueLimits_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lvTorqueLimits.SelectedIndexChanged
End Sub
Private Sub cbEmPos_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbEmPos.SelectedIndexChanged
gbRatiosPerGear.Enabled = cbEmPos.SelectedValue.Equals(PowertrainPosition.HybridP2_5)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
_emRatioPerGearDlog.Clear()
If _emRatioPerGearDlog.ShowDialog() = DialogResult.OK Then
Dim gear As Integer = _emRatioPerGearDlog.tbGear.Text.ToInt(0)
For Each entry As ListViewItem In lvRatioPerGear.Items
If entry.SubItems(TorqueLimitsTbl.Gear).Text.ToInt() = gear Then
entry.SubItems(TorqueLimitsTbl.MaxTorque).Text = _emRatioPerGearDlog.tbGearRatio.Text.ToDouble(0).ToGUIFormat
Change()
Return
End If
Next
lvRatioPerGear.Items.Add(CreateRatioPerGearListViewItem(gear, _emRatioPerGearDlog.tbGearRatio.Text.ToDouble(0)))
Change()
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
If lvRatioPerGear.SelectedItems.Count = 0 Then
If lvRatioPerGear.Items.Count = 0 Then
Exit Sub
Else
lvRatioPerGear.Items(lvRatioPerGear.Items.Count - 1).Selected = True
End If
End If
lvRatioPerGear.SelectedItems(0).Remove()
End Sub
Private Sub lvRatioPerGear_DoubleClick(sender As Object, e As EventArgs) Handles lvRatioPerGear.DoubleClick
If lvRatioPerGear.SelectedItems.Count = 0 Then Exit Sub
Dim entry As ListViewItem = lvRatioPerGear.SelectedItems(0)
_emRatioPerGearDlog.tbGear.Text = entry.SubItems(RatiosPerGearTbl.Gear).Text
_emRatioPerGearDlog.tbGear.ReadOnly = True
_emRatioPerGearDlog.tbGearRatio.Text = entry.SubItems(RatiosPerGearTbl.Ratio).Text
_emRatioPerGearDlog.tbGearRatio.Focus()
If (_emRatioPerGearDlog.ShowDialog() = DialogResult.OK) Then
entry.SubItems(RatiosPerGearTbl.Ratio).Text = _emRatioPerGearDlog.tbGearRatio.Text
End If
_emRatioPerGearDlog.tbGear.ReadOnly = False
End Sub
Private Sub lvRatioPerGear_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lvRatioPerGear.SelectedIndexChanged
End Sub
End Class
......@@ -92,6 +92,7 @@ Public Class Vehicle
public GearDuringPTODrive As UInteger?
Public EngineSpeedDuringPTODrive As PerSecond
Public ElectricMotorPerGearRatios As Double()
Public Sub New()
_path = ""
......@@ -973,6 +974,7 @@ Public Class ElectricMachineWrapper
.MechanicalTransmissionLossMap = VectoCSVFile.Read(Vehicle.ElectricMotorMechLossMap.FullPath),
.Position = Vehicle.ElectricMotorPosition,
.RatioADC = Vehicle.ElectricMotorRatio,
.RatioPerGear = vehicle.ElectricMotorPerGearRatios,
.Count = Vehicle.ElectricMotorCount}})
End Get
End Property
......@@ -985,6 +987,7 @@ Public Class ElectricMachineWrapper
.MechanicalTransmissionLossMap = If(IsNumeric(Vehicle.ElectricMotorMechLossMap.OriginalPath), Nothing, VectoCSVFile.Read(Vehicle.ElectricMotorMechLossMap.FullPath)),
.Position = Vehicle.ElectricMotorPosition,
.RatioADC = Vehicle.ElectricMotorRatio,
.RatioPerGear = Vehicle.ElectricMotorPerGearRatios,
.Count = Vehicle.ElectricMotorCount}})
End Get
......
......@@ -253,6 +253,12 @@
<Compile Include="GUI\VectoVTPJobForm.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="GUI\EMGearRatioDialog.Designer.vb">
<DependentUpon>EMGearRatioDialog.vb</DependentUpon>
</Compile>
<Compile Include="GUI\EMGearRatioDialog.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Input Files\Battery.vb" />
<Compile Include="Input Files\BrowserUtils.vb" />
<Compile Include="GUI\VehicleTorqueLimitsDialog.Designer.vb">
......@@ -446,6 +452,9 @@
<EmbeddedResource Include="GUI\VectoVTPJobForm.resx">
<DependentUpon>VectoVTPJobForm.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\EMGearRatioDialog.resx">
<DependentUpon>EMGearRatioDialog.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\VehicleTorqueLimitsDialog.resx">
<DependentUpon>VehicleTorqueLimitsDialog.vb</DependentUpon>
</EmbeddedResource>
......
......@@ -26,7 +26,7 @@ namespace TUGraz.VectoCommon.InputData {
public static PowertrainPosition Parse(string pos)
{
if (pos.StartsWith("P",StringComparison.InvariantCultureIgnoreCase)) {
return (HybridPrefix + pos).ParseEnum<PowertrainPosition>();
return (HybridPrefix + pos).Replace(".", "_").ParseEnum<PowertrainPosition>();
}
if (pos.StartsWith("B", StringComparison.InvariantCultureIgnoreCase)) {
......
......@@ -582,7 +582,11 @@ public class JSONFileWriter : IOutputFileWriter
d["MechanicalTransmissionLossMap"] = GetRelativePath(em.MechanicalTransmissionLossMap.Source, basePath);
}
return d;
if (em.Position == PowertrainPosition.HybridP2_5) {
d["RatioPerGear"] = em.RatioPerGear;
}
return d;
}).ToArray();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment