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

Skip to content
Snippets Groups Projects
Commit 7ff0af68 authored by Raphael LUZ's avatar Raphael LUZ
Browse files

- Added backwards compatibility with updated wheels list

- WHTC Weighting Factors as separate file (not part of Segment Table)
parent 15b6872b
No related branches found
No related tags found
No related merge requests found
Part,Long haul,Regional delivery,Urban delivery,Municipal utility,Construction,Heavy Urban,Urban,Suburban,Interurban,Coach
Urban,11,17,69,98,62,100,100,100,45,0
Rural,0,30,27,0,32,0,0,0,36,22
Motorway,89,53,4,2,6,0,0,0,19,78
...@@ -13,7 +13,7 @@ Imports System.Collections.Generic ...@@ -13,7 +13,7 @@ Imports System.Collections.Generic
Public Class cVEH Public Class cVEH
'V2 MassMax is now saved in [t] instead of [kg] 'V2 MassMax is now saved in [t] instead of [kg]
Private Const FormatVersion As Short = 5 Private Const FormatVersion As Short = 6
Private FileVersion As Short Private FileVersion As Short
Private sFilePath As String Private sFilePath As String
...@@ -76,7 +76,7 @@ Public Class cVEH ...@@ -76,7 +76,7 @@ Public Class cVEH
MyFileList = New List(Of String) MyFileList = New List(Of String)
'.vcdv / .vcdb '.vcdv / .vcdb
If Me.CdMode <> tCdMode.ConstCd0 Then MyFileList.Add(Me.CdFile.FullPath) If Me.CdMode = tCdMode.CdOfVeng Or Me.CdMode = tCdMode.CdOfBeta Then MyFileList.Add(Me.CdFile.FullPath)
'Retarder 'Retarder
If Me.RtType <> tRtType.None Then MyFileList.Add(Me.RtFile.FullPath) If Me.RtType <> tRtType.None Then MyFileList.Add(Me.RtFile.FullPath)
...@@ -229,7 +229,8 @@ Public Class cVEH ...@@ -229,7 +229,8 @@ Public Class cVEH
a0.Wheels = "-" a0.Wheels = "-"
Else Else
a0.Inertia = CSng(dic("Inertia")) a0.Inertia = CSng(dic("Inertia"))
a0.Wheels = CStr(dic("Wheels")) a0.Wheels = CStr(dic("Wheels"))
If FileVersion < 6 Then a0.Wheels = a0.Wheels.Replace("R ", "R")
End If End If
a0.Share = CSng(dic("AxleWeightShare")) a0.Share = CSng(dic("AxleWeightShare"))
...@@ -382,7 +383,7 @@ Public Class cVEH ...@@ -382,7 +383,7 @@ Public Class cVEH
a0 = New cAxle a0 = New cAxle
a0.Inertia = 0 'Defined later a0.Inertia = 0 'Defined later
a0.Wheels = "385/65 R 22.5" a0.Wheels = "385/65 R22.5"
a0.Share = a / 100 a0.Share = a / 100
a0.TwinTire = False a0.TwinTire = False
......
...@@ -108,7 +108,6 @@ Public Class cDeclaration ...@@ -108,7 +108,6 @@ Public Class cDeclaration
Dim AxleShares As List(Of String) Dim AxleShares As List(Of String)
Dim AxleSharesTr As List(Of String) Dim AxleSharesTr As List(Of String)
Dim l0 As List(Of Single) Dim l0 As List(Of Single)
Dim dWHTCWF As Dictionary(Of tWHTCpart, Single)
Dim at0 As List(Of String) Dim at0 As List(Of String)
Dim AuxPower0 As Dictionary(Of tMission, Single) Dim AuxPower0 As Dictionary(Of tMission, Single)
...@@ -228,8 +227,46 @@ Public Class cDeclaration ...@@ -228,8 +227,46 @@ Public Class cDeclaration
file.Close() file.Close()
'WHTC-Weighting-Factors.csv
If Not file.OpenRead(MyDeclPath & "WHTC-Weighting-Factors.csv") Then
GUImsg(tMsgID.Err, "Failed to load Declaration Config (WHTC-Weighting-Factors.csv)!")
Return False
End If
'Skip Header
file.ReadLine()
Try
For i = 0 To 2
If file.EndOfFile Then Throw New Exception("Unexpected end of file.")
line = file.ReadLine
a = 0
For Each mt0 In Missions.Keys
a += 1
mc0 = Missions(mt0)
Select Case i
Case 0
mc0.WHTCWF = New Dictionary(Of tWHTCpart, Single)
mc0.WHTCWF.Add(tWHTCpart.Urban, line(a) / 100)
Case 1
mc0.WHTCWF.Add(tWHTCpart.Rural, line(a) / 100)
Case Else '2
mc0.WHTCWF.Add(tWHTCpart.Motorway, line(a) / 100)
End Select
Next
Next
Catch ex As Exception
file.Close()
GUImsg(tMsgID.Err, "Error in WHTC-Weighting-Factors! " & ex.Message)
Return False
End Try
file.Close()
'Segment Table 'Segment Table
If Not file.OpenRead(MyDeclPath & "SegmentTable.csv") Then If Not file.OpenRead(MyDeclPath & "SegmentTable.csv") Then
GUImsg(tMsgID.Err, "Failed to load Declaration Config (Segment Table)!") GUImsg(tMsgID.Err, "Failed to load Declaration Config (Segment Table)!")
...@@ -336,13 +373,6 @@ Public Class cDeclaration ...@@ -336,13 +373,6 @@ Public Class cDeclaration
ste0.AxleSharesTr.Add(SegmentTable.MissionList(i), l0) ste0.AxleSharesTr.Add(SegmentTable.MissionList(i), l0)
dWHTCWF = New Dictionary(Of tWHTCpart, Single)
dWHTCWF.Add(tWHTCpart.Urban, 0)
dWHTCWF.Add(tWHTCpart.Rural, 0)
dWHTCWF.Add(tWHTCpart.Motorway, 0)
ste0.WHTCWF.Add(SegmentTable.MissionList(i), dWHTCWF)
End If End If
Next Next
...@@ -866,9 +896,9 @@ Public Class cDeclaration ...@@ -866,9 +896,9 @@ Public Class cDeclaration
CurrentMission = Missions(SegRef.Missions(CycleIndex)) CurrentMission = Missions(SegRef.Missions(CycleIndex))
WHTCcorrFactor = Declaration.SegRef.WHTCWF(Declaration.CurrentMission.MissionID)(tWHTCpart.Urban) * ENG.WHTCurban / Declaration.WHTCresults(tWHTCpart.Urban) _ WHTCcorrFactor = CurrentMission.WHTCWF(tWHTCpart.Urban) * ENG.WHTCurban / Declaration.WHTCresults(tWHTCpart.Urban) _
+ Declaration.SegRef.WHTCWF(Declaration.CurrentMission.MissionID)(tWHTCpart.Rural) * ENG.WHTCrural / Declaration.WHTCresults(tWHTCpart.Rural) _ + CurrentMission.WHTCWF(tWHTCpart.Rural) * ENG.WHTCrural / Declaration.WHTCresults(tWHTCpart.Rural) _
+ Declaration.SegRef.WHTCWF(Declaration.CurrentMission.MissionID)(tWHTCpart.Motorway) * ENG.WHTCmw / Declaration.WHTCresults(tWHTCpart.Motorway) + CurrentMission.WHTCWF(tWHTCpart.Motorway) * ENG.WHTCmw / Declaration.WHTCresults(tWHTCpart.Motorway)
If Not VEH.DeclInitCycle Then Return False If Not VEH.DeclInitCycle Then Return False
...@@ -1204,6 +1234,7 @@ Public Class cMission ...@@ -1204,6 +1234,7 @@ Public Class cMission
Public MissionID As tMission Public MissionID As tMission
Public NameStr As String Public NameStr As String
Public CyclePath As String Public CyclePath As String
Public WHTCWF As New Dictionary(Of tWHTCpart, Single)
End Class End Class
Public Class cSegmentTable Public Class cSegmentTable
...@@ -1241,7 +1272,6 @@ Public Class cSegmentTableEntry ...@@ -1241,7 +1272,6 @@ Public Class cSegmentTableEntry
Public Loading As New Dictionary(Of tMission, String) Public Loading As New Dictionary(Of tMission, String)
Public AxleShares As New Dictionary(Of tMission, List(Of Single)) Public AxleShares As New Dictionary(Of tMission, List(Of Single))
Public AxleSharesTr As New Dictionary(Of tMission, List(Of Single)) Public AxleSharesTr As New Dictionary(Of tMission, List(Of Single))
Public WHTCWF As New Dictionary(Of tMission, Dictionary(Of tWHTCpart, Single))
Public TrailerOnlyInLongHaul As Boolean Public TrailerOnlyInLongHaul As Boolean
Public Function GetCycles() As List(Of String) Public Function GetCycles() As List(Of String)
......
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