Newer
Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
s.Points.DataBindXY(
shiftLines.Downshift.Select(Function(pt) pt.AngularSpeed.AsRPM) _
.ToArray(),
shiftLines.Downshift.Select(Function(pt) pt.Torque.Value()).ToArray())
end If
s.ChartType = SeriesChartType.FastLine
s.BorderWidth = 2
s.Color = Color.DarkRed
s.BorderDashStyle = ChartDashStyle.Dash
s.Name = "Downshift curve (generic)"
chart.Series.Add(s)
End If
'End If
End If
End Sub
Private Function GetShiftLines(emFld As ElectricMotorFullLoadCurve, vehicle As IVehicleEngineeringInputData, gears As IList(Of ITransmissionInputData), gear As Integer) As ShiftPolygon
Dim maxTqStr As String = LvGears.Items(gear).SubItems(GearboxTbl.MaxTorque).Text
If gears.Count <= 1 Then
Return Nothing
End If
Dim rDyn As Meter = vehicle.DynamicTyreRadius
If rDyn.IsEqual(0) Then
If (vehicle.Components.AxleWheels.AxlesEngineering.Count < 2) Then
Return Nothing
End If
rdyn = vehicle.Components.AxleWheels.AxlesEngineering.Where(Function(axle) axle.AxleType = AxleType.VehicleDriven) _
.Select(Function(da) DeclarationData.Wheels.Lookup(da.Tyre.Dimension).DynamicTyreRadius) _
.Average()
End If
If (rDyn.IsEqual(0)) Then
Return Nothing
End If
Dim tmpRunData as VectoRunData = New VectoRunData() With {
.GearboxData = New GearboxData() with {
.Type = CType(CbGStype.SelectedValue, GearboxType)
},
.GearshiftParameters = New ShiftStrategyParameters(),
.JobType = VectoSimulationJobType.BatteryElectricVehicle
}
Dim tmpStrategy as IShiftPolygonCalculator = PowertrainBuilder.GetShiftStrategy(new SimplePowertrainContainer(tmpRunData))
dim em as ElectricMotorData = ConvertToElectricMotorData(emFld, gear)
Dim shiftLines As ShiftPolygon = tmpStrategy.ComputeDeclarationShiftPolygon(
CType(CbGStype.SelectedValue, GearboxType), gear - 1,
Nothing, gears, nothing,
Double.Parse(LvGears.Items(0).SubItems(GearboxTbl.Ratio).Text, CultureInfo.InvariantCulture),
(rDyn), em)
Return shiftLines
End Function
Private Function GetShiftLines(idleSpeed As PerSecond, engineFullLoadCurve As EngineFullLoadCurve, vehicle As IVehicleEngineeringInputData, gears As IList(Of ITransmissionInputData), gear As Integer) _
As ShiftPolygon
Dim maxTqStr As String = LvGears.Items(gear).SubItems(GearboxTbl.MaxTorque).Text
Dim engine As CombustionEngineData = ConvertToEngineData(engineFullLoadCurve, idleSpeed, gear,
If(String.IsNullOrWhiteSpace(maxTqStr), Nothing, maxTqStr.ToDouble(0).SI(Of NewtonMeter)))
If gears.Count <= 1 Then
Return Nothing
End If
Dim rDyn As Meter = vehicle.DynamicTyreRadius
If rDyn.IsEqual(0) Then

Markus Quaritsch
committed
If (vehicle.Components.AxleWheels.AxlesEngineering.Count < 2) Then

Markus Quaritsch
committed
rdyn = vehicle.Components.AxleWheels.AxlesEngineering.Where(Function(axle) axle.AxleType = AxleType.VehicleDriven) _

Markus Quaritsch
committed
.Select(Function(da) DeclarationData.Wheels.Lookup(da.Tyre.Dimension).DynamicTyreRadius) _
.Average()
End If
If (rDyn.IsEqual(0)) Then
Return Nothing
End If

Markus Quaritsch
committed
Dim tmpRunData as VectoRunData = New VectoRunData() With {
.GearboxData = New GearboxData() with {
.Type = CType(CbGStype.SelectedValue, GearboxType)
},
.JobType = _vehicleJobType

Markus Quaritsch
committed
}

Markus Quaritsch
committed
Dim tmpStrategy as IShiftPolygonCalculator = PowertrainBuilder.GetShiftStrategy(new SimplePowertrainContainer(tmpRunData))

Markus Quaritsch
committed
Dim shiftLines As ShiftPolygon = tmpStrategy.ComputeDeclarationShiftPolygon(
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
CType(CbGStype.SelectedValue, GearboxType), gear - 1,
engine.FullLoadCurves(CType(gear, UInteger)), gears, engine,
Double.Parse(LvGears.Items(0).SubItems(GearboxTbl.Ratio).Text, CultureInfo.InvariantCulture),
(rDyn))
Return shiftLines
End Function
Private Function ConvertToGears(gbx As ListView.ListViewItemCollection) As IList(Of ITransmissionInputData)
Dim retVal As List(Of ITransmissionInputData) = New List(Of ITransmissionInputData)
Dim value As Double
For i As Integer = 1 To gbx.Count - 1
If _
gbx(i).SubItems(GearboxTbl.Ratio).Text <> "" AndAlso Double.TryParse(gbx(i).SubItems(GearboxTbl.Ratio).Text, value) _
Then
Dim maxSpeed As PerSecond =
If _
(String.IsNullOrWhiteSpace(gbx(i).SubItems(GearboxTbl.MaxSpeed).Text), Nothing,
gbx(i).SubItems(GearboxTbl.MaxSpeed).Text.ToDouble().RPMtoRad())
retVal.Add(
New TransmissionInputData() _
With {.Ratio = value, .MaxInputSpeed = maxSpeed})
End If
Next
Return retVal
End Function

Markus Quaritsch
committed
#Region "Torque Converter"
'Browse TC file
Private Sub BtTCfileBrowse_Click(sender As Object, e As EventArgs) Handles BtTCfileBrowse.Click
If TorqueConverterFileBrowser.OpenDialog(FileRepl(TbTCfile.Text, GetPath(_gbxFile))) Then
TbTCfile.Text = GetFilenameWithoutDirectory(TorqueConverterFileBrowser.Files(0), GetPath(_gbxFile))
End If
End Sub

Markus Quaritsch
committed
'Open TC file
Private Sub BtTCfileOpen_Click(sender As Object, e As EventArgs) Handles BtTCfileOpen.Click
OpenFiles(FileRepl(TbTCfile.Text, GetPath(_gbxFile)))
End Sub

Markus Quaritsch
committed
#End Region
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
Private Sub GroupBox1_Enter(sender As Object, e As EventArgs) Handles GroupBox1.Enter
End Sub
Public Sub New()
' Dieser Aufruf ist für den Designer erforderlich.
InitializeComponent()
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
End Sub
Private Sub BtTCShiftFileBrowse_Click(sender As Object, e As EventArgs) Handles BtTCShiftFileBrowse.Click
If TorqueConverterShiftPolygonFileBrowser.OpenDialog(FileRepl(TBTCShiftPolygon.Text, GetPath(_gbxFile))) Then
TBTCShiftPolygon.Text = GetFilenameWithoutDirectory(TorqueConverterShiftPolygonFileBrowser.Files(0),
GetPath(_gbxFile))
End If
End Sub
Private Sub btnExportXML_Click(sender As Object, e As EventArgs) Handles btnExportXML.Click
If Not Cfg.DeclMode Then
MsgBox("XML Export is only supported in Declaration Mode")
Exit Sub
End If
If Not FolderFileBrowser.OpenDialog("") Then
Exit Sub
End If
Dim filePath As String = FolderFileBrowser.Files(0)
Dim data As Gearbox = FillGearboxData(_gbxFile)
If (Cfg.DeclMode) Then
Dim export As XDocument = New XMLDeclarationWriter(data.Manufacturer).GenerateVectoComponent(data, data)
export.Save(Path.Combine(filePath, data.ModelName + ".xml"))
Else

Markus Quaritsch
committed
Dim kernel As IKernel = new StandardKernel(new VectoNinjectModule)
dim writer As IXMLEngineeringWriter = kernel.Get(of IXMLEngineeringWriter)()
writer.Configuration = new WriterConfiguration() With { .SingleFile = true, .BasePath = filePath }
Dim export As XDocument = writer.WriteComponent(TryCast(data, IGearboxEngineeringInputData))
export.Save(Path.Combine(filePath, data.ModelName + ".xml"))
End If
End Sub
Private Sub btnExportAxlGearXML_Click(sender As Object, e As EventArgs) Handles btnExportAxlGearXML.Click
If Not Cfg.DeclMode Then
MsgBox("XML Export is only supported in Declaration Mode")
Exit Sub
End If
If Not FolderFileBrowser.OpenDialog("") Then
Exit Sub
End If
Dim filePath As String = FolderFileBrowser.Files(0)
Dim data As Gearbox = FillGearboxData(_gbxFile)
If (Cfg.DeclMode) Then
Dim export As XDocument = New XMLDeclarationWriter(data.Manufacturer).GenerateVectoComponent(data)
export.Save(Path.Combine(filePath, data.ModelName + ".xml"))
Else

Markus Quaritsch
committed
Dim kernel As IKernel = new StandardKernel(new VectoNinjectModule)
dim writer As IXMLEngineeringWriter = kernel.Get(of IXMLEngineeringWriter)()
writer.Configuration = new WriterConfiguration() With { .SingleFile = true, .BasePath = filePath }
Dim export As XDocument = writer.WriteComponent(TryCast(data, IAxleGearInputData))
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
export.Save(Path.Combine(filePath, data.ModelName + ".xml"))
End If
End Sub
Private Sub btExportVGBS_Click(sender As Object, e As EventArgs) Handles btExportVGBS.Click
If LvGears.Items.Count <= 1 Then Exit Sub
Dim shiftPolygon As ShiftPolygon = Nothing
Dim path As String
Dim gear As Integer
Try
If LvGears.SelectedItems.Count > 0 AndAlso LvGears.SelectedIndices(0) > 0 Then
path = FileRepl(LvGears.SelectedItems(0).SubItems(GearboxTbl.ShiftPolygons).Text, GetPath(_gbxFile))
gear = LvGears.SelectedIndices(0)
Else
path = FileRepl(LvGears.Items(1).SubItems(GearboxTbl.ShiftPolygons).Text, GetPath(_gbxFile))
gear = 1
End If
If File.Exists(path) Then shiftPolygon = ShiftPolygonReader.ReadFromFile(path)
If Not shiftPolygon Is Nothing Then
ShiftPolygonExport.WriteShiftPolygon(shiftPolygon, path & ".vgbs")
End If
Catch ex As Exception
End Try
Dim jobFile As String = VectoJobForm.VectoFile
If Not jobFile Is Nothing AndAlso File.Exists(jobFile) Then
Dim inputData As IEngineeringInputDataProvider = TryCast(JSONInputDataFactory.ReadJsonJob(jobFile),
IEngineeringInputDataProvider)
If (inputData Is Nothing) Then
Exit Sub
End If
Dim vehicle As IVehicleEngineeringInputData = inputData.JobInputData.Vehicle

Markus Quaritsch
committed
Dim engine As IEngineEngineeringInputData = vehicle.Components.EngineInputData
Dim engineFld As EngineFullLoadCurve = FullLoadCurveReader.Create(engine.EngineModes.First().FullLoadCurve)

Markus Quaritsch
committed
If VectoJobForm.Visible AndAlso engine.EngineModes.First().IdleSpeed > 0 Then
Dim gears As IList(Of ITransmissionInputData) = ConvertToGears(LvGears.Items)
Dim shiftLines As ShiftPolygon = GetShiftLines(engine.EngineModes.First().IdleSpeed, engineFld, vehicle, gears, gear)
If (Not IsNothing(shiftLines)) Then
ShiftPolygonExport.WriteShiftPolygon(shiftLines, jobFile & "_Gear " & gear & ".vgbs")
End If
End If
End If
End Sub