Newer
Older
TbVmin.Enabled = Ovr Or EcoR
Label23.Enabled = Ovr Or EcoR
Label21.Enabled = Ovr Or EcoR
End Sub
#End Region
Public Sub UpdatePic()
Dim i As Integer
Dim pmax As Double
Dim HDVclass As String

Markus QUARITSCH
committed
Dim s As Series
Dim a As ChartArea
Dim img As Bitmap

Markus QUARITSCH
committed
Dim EngOK As Boolean = False
TbHVCclass.Text = ""
TbVehCat.Text = ""
TbMass.Text = ""
TbAxleConf.Text = ""
TbEngTxt.Text = ""
TbGbxTxt.Text = ""
PicVehicle.Image = Nothing
PicBox.Image = Nothing

Markus QUARITSCH
committed
Dim inputData As IEngineeringInputDataProvider = TryCast(JSONInputDataFactory.ReadComponentData(VECTOfile),
IEngineeringInputDataProvider)

Markus QUARITSCH
committed
Dim vehicle As IVehicleEngineeringInputData = inputData.VehicleInputData
If Not vehicle Is Nothing Then

Markus QUARITSCH
committed
Dim maxMass As Kilogram = vehicle.GrossVehicleMassRating 'CSng(fTextboxToNumString(TbMassMass.Text))
Dim s0 As Segment = Nothing
Try

Markus QUARITSCH
committed
s0 = DeclarationData.Segments.Lookup(vehicle.VehicleCategory, vehicle.AxleConfiguration, maxMass, 0.SI(Of Kilogram),
True)
Catch
End Try
If Not s0 Is Nothing Then
HDVclass = s0.VehicleClass.GetClassNumber()
If Cfg.DeclMode Then
LvCycles.Items.Clear()

Markus QUARITSCH
committed
Dim m0 As Mission
For Each m0 In s0.Missions
LvCycles.Items.Add(m0.MissionType.ToString())
Next
End If
Else
HDVclass = "-"
End If
PicVehicle.Image = ConvPicPath(If(s0 Is Nothing, -1, HDVclass.ToInt()), False) _
'Image.FromFile(cDeclaration.ConvPicPath(HDVclass, False))
TbHVCclass.Text = "HDV Class " & HDVclass
TbVehCat.Text = vehicle.VehicleCategory.GetCategoryName() 'ConvVehCat(VEH0.VehCat, True)
TbMass.Text = (vehicle.GrossVehicleMassRating.Value() / 1000) & " t"
TbAxleConf.Text = vehicle.AxleConfiguration.GetName() 'ConvAxleConf(VEH0.AxleConf)
End If

Markus QUARITSCH
committed
Dim OkCount As Integer = 0
Dim engine As IEngineEngineeringInputData = inputData.EngineInputData
'engine.FilePath = fFileRepl(TbENG.Text, GetPath(VECTOfile))
'Create plot

Markus QUARITSCH
committed
Dim MyChart As Chart = New Chart
MyChart.Width = PicBox.Width
MyChart.Height = PicBox.Height
a = New ChartArea
'Dim FLD0 As EngineFullLoadCurve = New EngineFullLoadCurve
If Not engine Is Nothing Then
EngineIdleSpeed = engine.IdleSpeed.Value()

Markus QUARITSCH
committed
Dim fullLoadCurve As FullLoadCurve = EngineFullLoadCurve.Create(engine.FullLoadCurve)
s = New Series

Markus QUARITSCH
committed
s.Points.DataBindXY(fullLoadCurve.FullLoadEntries.Select(Function(x) x.EngineSpeed.AsRPM).ToArray(),
fullLoadCurve.FullLoadEntries.Select(Function(x) x.TorqueFullLoad.Value()).ToArray())
s.ChartType = SeriesChartType.FastLine
s.BorderWidth = 2
s.Color = Color.DarkBlue
s.Name = "Full load"
MyChart.Series.Add(s)
s = New Series

Markus QUARITSCH
committed
s.Points.DataBindXY(fullLoadCurve.FullLoadEntries.Select(Function(x) x.EngineSpeed.AsRPM).ToArray(),
fullLoadCurve.FullLoadEntries.Select(Function(x) x.TorqueDrag.Value()).ToArray())
s.ChartType = SeriesChartType.FastLine
s.BorderWidth = 2
s.Color = Color.Blue
s.Name = "Motoring"
MyChart.Series.Add(s)
OkCount += 1

Markus QUARITSCH
committed
pmax = fullLoadCurve.MaxPower.Value() / 1000 'FLD0.Pfull(FLD0.EngineRatedSpeed)

Markus QUARITSCH
committed
TbEngTxt.Text = (engine.Displacement.Value() * 1000).ToString("0.0") & " l " & pmax.ToString("#") & " kW " &
engine.ModelName
Dim fuelConsumptionMap As FuelConsumptionMap = FuelConsumptionMapReader.Create(engine.FuelConsumptionMap)
s = New Series
s.Points.DataBindXY(fuelConsumptionMap.Entries.Select(Function(x) x.EngineSpeed.AsRPM).ToArray(),
fuelConsumptionMap.Entries.Select(Function(x) x.Torque.Value()).ToArray())
s.ChartType = SeriesChartType.Point
s.MarkerSize = 3
s.Color = Color.Red
s.Name = "Map"
MyChart.Series.Add(s)
OkCount += 1
End If

Markus QUARITSCH
committed
Dim gearbox As IGearboxEngineeringInputData = inputData.GearboxInputData

Markus QUARITSCH
committed
If Not gearbox Is Nothing Then

Markus QUARITSCH
committed
TbGbxTxt.Text = gearbox.Gears.Count & "-Speed " & gearbox.Type.ShortName() & " " & gearbox.ModelName
If Cfg.DeclMode Then
If EngOK Then

Markus QUARITSCH
committed
For i = 1 To gearbox.Gears.Count
'If FLD0.Init(ENG0.Nidle) Then '' use engine from below...
'Dim engine As CombustionEngineData = ConvertToEngineData(FLD0, F_VECTO.n_idle)
'Dim shiftLines As ShiftPolygon = DeclarationData.Gearbox.ComputeShiftPolygon(Gear - 1,
' engine.FullLoadCurve, gears,
' engine,
' Double.Parse(LvGears.Items(0).SubItems(F_GBX.GearboxTbl.Ratio).Text,
' CultureInfo.InvariantCulture),
' (.rdyn / 1000.0).SI(Of Meter))
's = New Series
's.Points.DataBindXY(shiftLines.Upshift.Select(Function(pt) pt.AngularSpeed.Value() / Constants.RPMToRad).ToList(),
' shiftLines.Upshift.Select(Function(pt) pt.Torque.Value()).ToList())
's.ChartType = SeriesChartType.FastLine
's.BorderWidth = 2
's.Color = Color.DarkRed
's.Name = "Upshift curve (" & i & ")"
'MyChart.Series.Add(s)
's = New Series
's.Points.DataBindXY(
' shiftLines.Downshift.Select(Function(pt) pt.AngularSpeed.Value() / Constants.RPMToRad).ToList(),
' shiftLines.Downshift.Select(Function(pt) pt.Torque.Value()).ToList())
's.ChartType = SeriesChartType.FastLine
's.BorderWidth = 2
's.Color = Color.DarkRed
's.Name = "Downshift curve (" & i & ")"
'MyChart.Series.Add(s)
'End If
' OkCount += 1
' pmax = FLD0.Pfull(FLD0.EngineRatedSpeed)
'End If
Next
End If
Else

Markus QUARITSCH
committed
For Each gear As ITransmissionInputData In gearbox.Gears

Markus QUARITSCH
committed
If gear.ShiftPolygon.Rows.Count = 0 Then Continue For

Markus QUARITSCH
committed
Dim shiftPolygon As ShiftPolygon = ShiftPolygonReader.Create(gear.ShiftPolygon)
s = New Series
s.Points.DataBindXY(shiftPolygon.Upshift.Select(Function(x) x.AngularSpeed),
shiftPolygon.Upshift.Select(Function(x) x.Torque))
s.ChartType = SeriesChartType.FastLine
s.BorderWidth = 2
s.Color = Color.DarkRed
s.Name = "Upshift curve"
' MyChart.Series.Add(s) 'MQ 2016-06-20: do not plot shift lines in engine dialog
s = New Series
s.Points.DataBindXY(shiftPolygon.Downshift.Select(Function(x) x.AngularSpeed),
shiftPolygon.Downshift.Select(Function(x) x.Torque))
s.ChartType = SeriesChartType.FastLine
s.BorderWidth = 2
s.Color = Color.DarkRed
s.Name = "Downshift curve"
'MyChart.Series.Add(s) 'MQ 2016-06-20:do not plot shift lines in engine dialog
OkCount += 1
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
Next
End If
End If
If OkCount > 0 Then
a.Name = "main"
a.AxisX.Title = "engine speed [1/min]"
a.AxisX.TitleFont = New Font("Helvetica", 10)
a.AxisX.LabelStyle.Font = New Font("Helvetica", 8)
a.AxisX.LabelAutoFitStyle = LabelAutoFitStyles.None
a.AxisX.MajorGrid.LineDashStyle = ChartDashStyle.Dot
a.AxisY.Title = "engine torque [Nm]"
a.AxisY.TitleFont = New Font("Helvetica", 10)
a.AxisY.LabelStyle.Font = New Font("Helvetica", 8)
a.AxisY.LabelAutoFitStyle = LabelAutoFitStyles.None
a.AxisY.MajorGrid.LineDashStyle = ChartDashStyle.Dot
a.AxisX.Minimum = 300
a.BorderDashStyle = ChartDashStyle.Solid
a.BorderWidth = 1
a.BackColor = Color.GhostWhite
MyChart.ChartAreas.Add(a)
MyChart.Update()
img = New Bitmap(MyChart.Width, MyChart.Height, PixelFormat.Format32bppArgb)
MyChart.DrawToBitmap(img, New Rectangle(0, 0, PicBox.Width, PicBox.Height))
PicBox.Image = img
End If
End Sub
#Region "Open File Context Menu"
Private CmFiles As String()

Markus QUARITSCH
committed
Private _basePath As String = ""
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
Private Sub OpenFiles(ParamArray files() As String)
If files.Length = 0 Then Exit Sub
CmFiles = files
OpenWithToolStripMenuItem.Text = "Open with " & Cfg.OpenCmdName
CmOpenFile.Show(Windows.Forms.Cursor.Position)
End Sub
Private Sub OpenWithToolStripMenuItem_Click(sender As Object, e As EventArgs) _
Handles OpenWithToolStripMenuItem.Click
If Not FileOpenAlt(CmFiles(0)) Then MsgBox("Failed to open file!")
End Sub
Private Sub ShowInFolderToolStripMenuItem_Click(sender As Object, e As EventArgs) _
Handles ShowInFolderToolStripMenuItem.Click
If File.Exists(CmFiles(0)) Then
Try
Process.Start("explorer", "/select,""" & CmFiles(0) & "")
Catch ex As Exception
MsgBox("Failed to open file!")
End Try
Else
MsgBox("File not found!")
End If
End Sub
#End Region
'AA-TB
Private Sub picAuxInfo_MouseEnter(sender As Object, e As EventArgs) Handles picAuxInfo.MouseEnter
If cboAdvancedAuxiliaries.SelectedIndex = -1 Then Exit Sub
'Get tooltip

Markus QUARITSCH
committed
Dim item As AdvancedAuxiliary

Markus QUARITSCH
committed
item = DirectCast(cboAdvancedAuxiliaries.SelectedItem, AdvancedAuxiliary)
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
If item.AuxiliaryVersion = "CLASSIC" Then
ToolTip1.ToolTipTitle = "Classic Vecto Auxiliaries"
ToolTip1.SetToolTip(picAuxInfo, "Uses original basic auxiliaries calculation")
Else
ToolTip1.ToolTipTitle = "Advanced Auxiliary Information"
ToolTip1.SetToolTip(picAuxInfo, item.AuxiliaryName & " : Version=" & item.AuxiliaryVersion)
End If
End Sub
'AA-TB
Private Sub btnBrowseAAUXFile_Click(sender As Object, e As EventArgs) Handles btnBrowseAAUXFile.Click
If String.IsNullOrEmpty(VECTOfile) Then
MessageBox.Show(
"Please complete and save a valid new .vecto file before adding/configuring advanced bus auxiliaries.")
Return
End If
Dim aauxFileValidated As Boolean = False
Dim fbAux As New FileBrowser("aaux", True, False)
Dim message As String = String.Empty
Dim absoluteAuxPath As String

Markus QUARITSCH
committed
Dim assembly As AdvancedAuxiliary
'If Classic is selected, then bail
If cboAdvancedAuxiliaries.SelectedIndex = 0 Then Return
'Get Absolute Path for AAUX FILE.

Markus QUARITSCH
committed
absoluteAuxPath = ResolveAAUXFilePath(GetPath(VECTOfile), txtAdvancedAuxiliaryFile.Text)
'Set Extensions
fbAux.Extensions = New String() {"AAUX"}
Try

Markus QUARITSCH
committed
assembly = DirectCast(cboAdvancedAuxiliaries.SelectedItem, AdvancedAuxiliary)
Dim validAAUXFile As Boolean = ValidateAAUXFile(absoluteAuxPath, assembly.AssemblyName,
assembly.AuxiliaryVersion, message)
Dim fileExists As Boolean = File.Exists(absoluteAuxPath)
If fileExists AndAlso validAAUXFile Then
ConfigureAdvancedAuxiliaries(assembly.AssemblyName, assembly.AuxiliaryVersion,
txtAdvancedAuxiliaryFile.Text, VECTOfile)
Else
Dim needToFindOrCreateFile As Boolean = True
While needToFindOrCreateFile
'Find / Create file and configure.
If fbAux.CustomDialog(absoluteAuxPath, False, False, FileBrowserFileExtensionMode.ForceExt, False, String.Empty) _
Then

Markus QUARITSCH
committed
txtAdvancedAuxiliaryFile.Text = GetFilenameWithoutDirectory(fbAux.Files(0), GetPath(VECTOfile))
assembly = DirectCast(cboAdvancedAuxiliaries.SelectedItem, AdvancedAuxiliary)

Markus QUARITSCH
committed
File.Exists(ResolveAAUXFilePath(GetPath(VECTOfile), txtAdvancedAuxiliaryFile.Text)) OrElse
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
MsgBox("Do you want to create a new .AAUX file?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
needToFindOrCreateFile = False
ConfigureAdvancedAuxiliaries(assembly.AssemblyName, assembly.AuxiliaryVersion,
txtAdvancedAuxiliaryFile.Text, VECTOfile)
End If
Else
needToFindOrCreateFile = False
End If
End While
End If
Catch ex As Exception
MessageBox.Show("There was an error configuring your Advanced Auxiliary File")
End Try
End Sub
'AA-TB
Private Sub cboAdvancedAuxiliaries_SelectedIndexChanged(sender As Object, e As EventArgs) _
Handles cboAdvancedAuxiliaries.SelectedIndexChanged
'Enable or otherwise the text box and browser button associated with Advanced Axuiliaries
If cboAdvancedAuxiliaries.SelectedIndex = 0 Then
btnBrowseAAUXFile.Enabled = False
txtAdvancedAuxiliaryFile.Enabled = False
Else
btnBrowseAAUXFile.Enabled = True
txtAdvancedAuxiliaryFile.Enabled = True
End If
End Sub
'AA-TB
Private Sub btnAAUXOpen_Click(sender As Object, e As EventArgs) Handles btnAAUXOpen.Click

Markus QUARITSCH
committed
OpenFiles(fFileRepl(txtAdvancedAuxiliaryFile.Text, GetPath(VECTOfile)))
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnDfTargetSpeed.Click

Markus QUARITSCH
committed
If DriverDecisionFactorTargetSpeedFileBrowser.OpenDialog(fFileRepl(tbLacDfTargetSpeedFile.Text, GetPath(VECTOfile))) _
Then _
tbLacDfTargetSpeedFile.Text = GetFilenameWithoutDirectory(DriverDecisionFactorTargetSpeedFileBrowser.Files(0),
GetPath(VECTOfile))
End Sub
End Class