From 0bb25e6e5cd5c6b8d786593a7a1084aba2a1b7ed Mon Sep 17 00:00:00 2001 From: Stefan Brandt <brandt@ivt.tugraz.at> Date: Fri, 13 Dec 2019 09:43:23 +0100 Subject: [PATCH] Adding medium lorries to VECTO --- Documentation/User Manual/help.html | 15 +- VECTO/GUI/EngineForm.vb | 4 +- VECTO/GUI/GearboxForm.vb | 4 +- VECTO/GUI/MainForm.Designer.vb | 30 +- VECTO/GUI/VectoJobForm.vb | 10 +- VECTO/GUI/VectoVTPJobForm.vb | 4 +- VECTO/GUI/VehicleForm.vb | 8 +- VECTO/MainModule.vb | 42 +- VECTO/OutputData/JSONFileWriter.vb | 518 +- VECTO/VECTO.vbproj | 1 + .../VectoCommon/Models/AxleConfiguration.cs | 3 +- .../VectoCommon/Models/VehicleCategory.cs | 14 +- .../DeclarationDataAdapter.cs | 6 +- .../EngineeringDataAdapter.cs | 14 +- .../Models/Connector/Ports/Impl/Response.cs | 5 + .../Models/Declaration/DeclarationData.cs | 3 +- VectoCore/VectoCore/Models/Declaration/Fan.cs | 114 +- .../VectoCore/Models/Declaration/Payloads.cs | 7 +- .../VectoCore/Models/Declaration/Segments.cs | 19 +- .../Models/Declaration/VehicleClass.cs | 28 +- .../Models/Declaration/WeightingGroups.cs | 15 +- .../Declaration/Body_Trailers_Weights.csv | 25 +- .../CO2Standards/MissionProfileWeights.csv | 33 +- .../CO2Standards/WeightingGroups.csv | 30 +- .../Resources/Declaration/Payloads.csv | 8 +- .../Resources/Declaration/SegmentTable.csv | 14 +- .../Declaration/VAUX/Fan-Tech-Medium.csv | 12 + .../Resources/Declaration/VAUX/HVAC-Table.csv | 20 +- .../Resources/Declaration/VAUX/SP-Table.csv | 9 +- .../Declaration/VCDV/VCDV_parameters.csv | 12 +- VectoCore/VectoCore/VectoCore.csproj | 17 +- .../Models/Declaration/DeclarationDataTest.cs | 4285 +++++++++-------- .../Models/Simulation/AuxTests.cs | 2 +- VectoCore/VectoCoreTest/VectoCoreTest.csproj | 3 + 34 files changed, 2855 insertions(+), 2479 deletions(-) create mode 100644 VectoCore/VectoCore/Resources/Declaration/VAUX/Fan-Tech-Medium.csv diff --git a/Documentation/User Manual/help.html b/Documentation/User Manual/help.html index 8b43e29a69..92bad9001e 100644 --- a/Documentation/User Manual/help.html +++ b/Documentation/User Manual/help.html @@ -4474,7 +4474,7 @@ Example: “Gears\Gear1.vtlm†points to the “Gears†subdirectory of the Ge <p>The FC map is used to interpolate the base fuel consumption before corrections are applied. For details see <a href="#engine-fuel-consumption-calculation">Fuel Consumption Calculation</a>. The file uses the <a href="#csv">VECTO CSV format</a>.</p> <ul> <li>Filetype: .vmap</li> -<li>Header: <strong>engine speed [rpm], torque [Nm], fuel consumption [g/h]</strong>, <em>whr power [W]</em> (required only if an electric WHR system is installed)</li> +<li>Header: <strong>engine speed [rpm], torque [Nm], fuel consumption [g/h]</strong>, <em>whr power [W]</em> (required only if an electric WHR system is used)</li> <li>Requires at least 3 data entries</li> <li>The map must cover the full engine range between full load and motoring curve.</li> </ul> @@ -5387,16 +5387,11 @@ CycleTime,UnknownCycleName,3600</code></pre> <h3>Declaration Mode Cycles</h3> <p>In Declaration Mode driving cycles are automatically chosen depending on vehicle category and cannot be changed by the user. These predefined cycles are of type target-speed, distance-based.</p> <ul> -<li>Coach: 275km</li> -<li>Construction: 21km</li> -<li>Heavy Urban: 30km</li> -<li>Inter Urban: 123km</li> +<li>Construction: 100km</li> <li>Long Haul: 100km</li> -<li>Municipal Utility: 10km</li> -<li>Regional Delivery: 26km</li> -<li>Sub Urban: 23km</li> -<li>Urban: 40km</li> -<li>Urban Delivery: 28km</li> +<li>Municipal Utility: 11.25km</li> +<li>Regional Delivery: 100km</li> +<li>Urban Delivery: 100km</li> </ul> </div> <div id="verification-test-cycle" class="section level3"> diff --git a/VECTO/GUI/EngineForm.vb b/VECTO/GUI/EngineForm.vb index c3e757f688..1a1fc65822 100644 --- a/VECTO/GUI/EngineForm.vb +++ b/VECTO/GUI/EngineForm.vb @@ -365,8 +365,8 @@ Public Class EngineForm engine.maxTorqueInput = tbMaxTorque.Text.ToDouble(0).SI (Of NewtonMeter)() If Not engine.SaveFile Then - MsgBox("Cannot safe to " & file, MsgBoxStyle.Critical) - Return False + MsgBox("Cannot save to " & file, MsgBoxStyle.Critical) + Return False End If If AutoSendTo Then diff --git a/VECTO/GUI/GearboxForm.vb b/VECTO/GUI/GearboxForm.vb index aaef282ea9..fe24b7265a 100644 --- a/VECTO/GUI/GearboxForm.vb +++ b/VECTO/GUI/GearboxForm.vb @@ -374,8 +374,8 @@ Public Class GearboxForm If Not gearbox.SaveFile Then - MsgBox("Cannot safe to " & file, MsgBoxStyle.Critical) - Return False + MsgBox("Cannot save to " & file, MsgBoxStyle.Critical) + Return False End If If AutoSendTo Then diff --git a/VECTO/GUI/MainForm.Designer.vb b/VECTO/GUI/MainForm.Designer.vb index 89ad1e849e..e08e9972aa 100644 --- a/VECTO/GUI/MainForm.Designer.vb +++ b/VECTO/GUI/MainForm.Designer.vb @@ -718,66 +718,66 @@ Partial Class MainForm Me.ToolStripDrDnBtTools.Image = Global.TUGraz.VECTO.My.Resources.Resources.Misc_Tools_icon Me.ToolStripDrDnBtTools.ImageTransparentColor = System.Drawing.Color.Magenta Me.ToolStripDrDnBtTools.Name = "ToolStripDrDnBtTools" - Me.ToolStripDrDnBtTools.Size = New System.Drawing.Size(64, 22) + Me.ToolStripDrDnBtTools.Size = New System.Drawing.Size(63, 22) Me.ToolStripDrDnBtTools.Text = "Tools" ' 'GENEditorToolStripMenuItem1 ' Me.GENEditorToolStripMenuItem1.Image = Global.TUGraz.VECTO.My.Resources.Resources.F_VECTO Me.GENEditorToolStripMenuItem1.Name = "GENEditorToolStripMenuItem1" - Me.GENEditorToolStripMenuItem1.Size = New System.Drawing.Size(151, 22) + Me.GENEditorToolStripMenuItem1.Size = New System.Drawing.Size(152, 22) Me.GENEditorToolStripMenuItem1.Text = "Job Editor" ' 'EPTPJobEditorToolStripMenuItem ' Me.EPTPJobEditorToolStripMenuItem.Image = Global.TUGraz.VECTO.My.Resources.Resources.F_VECTO Me.EPTPJobEditorToolStripMenuItem.Name = "EPTPJobEditorToolStripMenuItem" - Me.EPTPJobEditorToolStripMenuItem.Size = New System.Drawing.Size(151, 22) + Me.EPTPJobEditorToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.EPTPJobEditorToolStripMenuItem.Text = "VTP Job Editor" ' 'VEHEditorToolStripMenuItem ' Me.VEHEditorToolStripMenuItem.Image = Global.TUGraz.VECTO.My.Resources.Resources.F_VEH Me.VEHEditorToolStripMenuItem.Name = "VEHEditorToolStripMenuItem" - Me.VEHEditorToolStripMenuItem.Size = New System.Drawing.Size(151, 22) + Me.VEHEditorToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.VEHEditorToolStripMenuItem.Text = "Vehicle Editor" ' 'EngineEditorToolStripMenuItem ' Me.EngineEditorToolStripMenuItem.Image = Global.TUGraz.VECTO.My.Resources.Resources.F_ENG Me.EngineEditorToolStripMenuItem.Name = "EngineEditorToolStripMenuItem" - Me.EngineEditorToolStripMenuItem.Size = New System.Drawing.Size(151, 22) + Me.EngineEditorToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.EngineEditorToolStripMenuItem.Text = "Engine Editor" ' 'GearboxEditorToolStripMenuItem ' Me.GearboxEditorToolStripMenuItem.Image = Global.TUGraz.VECTO.My.Resources.Resources.F_GBX Me.GearboxEditorToolStripMenuItem.Name = "GearboxEditorToolStripMenuItem" - Me.GearboxEditorToolStripMenuItem.Size = New System.Drawing.Size(151, 22) + Me.GearboxEditorToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.GearboxEditorToolStripMenuItem.Text = "Gearbox Editor" ' 'GraphToolStripMenuItem ' Me.GraphToolStripMenuItem.Image = Global.TUGraz.VECTO.My.Resources.Resources.F_Graph Me.GraphToolStripMenuItem.Name = "GraphToolStripMenuItem" - Me.GraphToolStripMenuItem.Size = New System.Drawing.Size(151, 22) + Me.GraphToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.GraphToolStripMenuItem.Text = "Graph" ' 'ToolStripSeparator6 ' Me.ToolStripSeparator6.Name = "ToolStripSeparator6" - Me.ToolStripSeparator6.Size = New System.Drawing.Size(148, 6) + Me.ToolStripSeparator6.Size = New System.Drawing.Size(149, 6) ' 'OpenLogToolStripMenuItem ' Me.OpenLogToolStripMenuItem.Name = "OpenLogToolStripMenuItem" - Me.OpenLogToolStripMenuItem.Size = New System.Drawing.Size(151, 22) + Me.OpenLogToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.OpenLogToolStripMenuItem.Text = "Open Log" ' 'SettingsToolStripMenuItem ' Me.SettingsToolStripMenuItem.Name = "SettingsToolStripMenuItem" - Me.SettingsToolStripMenuItem.Size = New System.Drawing.Size(151, 22) + Me.SettingsToolStripMenuItem.Size = New System.Drawing.Size(152, 22) Me.SettingsToolStripMenuItem.Text = "Settings" ' 'ToolStripDrDnBtInfo @@ -792,30 +792,30 @@ Partial Class MainForm 'UserManualToolStripMenuItem ' Me.UserManualToolStripMenuItem.Name = "UserManualToolStripMenuItem" - Me.UserManualToolStripMenuItem.Size = New System.Drawing.Size(221, 22) + Me.UserManualToolStripMenuItem.Size = New System.Drawing.Size(220, 22) Me.UserManualToolStripMenuItem.Text = "User Manual" ' 'UpdateNotesToolStripMenuItem ' Me.UpdateNotesToolStripMenuItem.Name = "UpdateNotesToolStripMenuItem" - Me.UpdateNotesToolStripMenuItem.Size = New System.Drawing.Size(221, 22) + Me.UpdateNotesToolStripMenuItem.Size = New System.Drawing.Size(220, 22) Me.UpdateNotesToolStripMenuItem.Text = "Release Notes" ' 'ReportBugViaCITnetToolStripMenuItem ' Me.ReportBugViaCITnetToolStripMenuItem.Name = "ReportBugViaCITnetToolStripMenuItem" - Me.ReportBugViaCITnetToolStripMenuItem.Size = New System.Drawing.Size(221, 22) + Me.ReportBugViaCITnetToolStripMenuItem.Size = New System.Drawing.Size(220, 22) Me.ReportBugViaCITnetToolStripMenuItem.Text = "Report Bug via CITnet / JIRA" ' 'ToolStripSeparator3 ' Me.ToolStripSeparator3.Name = "ToolStripSeparator3" - Me.ToolStripSeparator3.Size = New System.Drawing.Size(218, 6) + Me.ToolStripSeparator3.Size = New System.Drawing.Size(217, 6) ' 'AboutVECTOToolStripMenuItem1 ' Me.AboutVECTOToolStripMenuItem1.Name = "AboutVECTOToolStripMenuItem1" - Me.AboutVECTOToolStripMenuItem1.Size = New System.Drawing.Size(221, 22) + Me.AboutVECTOToolStripMenuItem1.Size = New System.Drawing.Size(220, 22) Me.AboutVECTOToolStripMenuItem1.Text = "About VECTO" ' 'CmDEV diff --git a/VECTO/GUI/VectoJobForm.vb b/VECTO/GUI/VectoJobForm.vb index 6f71770915..ca7ec99bc0 100644 --- a/VECTO/GUI/VectoJobForm.vb +++ b/VECTO/GUI/VectoJobForm.vb @@ -657,8 +657,8 @@ Public Class VectoJobForm 'SAVE If Not vectoJob.SaveFile Then - MsgBox("Cannot safe to " & file, MsgBoxStyle.Critical) - Return False + MsgBox("Cannot save to " & file, MsgBoxStyle.Critical) + Return False End If VectoFile = file @@ -1343,10 +1343,10 @@ lbDlog: End If - PicVehicle.Image = ConvPicPath(If(Not s0.Found, -1, HDVclass.ToInt()), False) _ - 'Image.FromFile(cDeclaration.ConvPicPath(HDVclass, False)) + PicVehicle.Image = ConvPicPath(HDVclass, False) _ + 'Image.FromFile(cDeclaration.ConvPicPath(HDVclass, False)) - TbHVCclass.Text = String.Format("HDV Group {0}", HDVclass) + TbHVCclass.Text = String.Format("HDV Group {0}", 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) diff --git a/VECTO/GUI/VectoVTPJobForm.vb b/VECTO/GUI/VectoVTPJobForm.vb index b5194ccf68..2cf8d8b58f 100644 --- a/VECTO/GUI/VectoVTPJobForm.vb +++ b/VECTO/GUI/VectoVTPJobForm.vb @@ -306,7 +306,7 @@ Public Class VectoVTPJobForm 'SAVE If Not vectoJob.SaveFile Then - MsgBox("Cannot safe to " & file, MsgBoxStyle.Critical) + MsgBox("Cannot save to " & file, MsgBoxStyle.Critical) Return False End If @@ -685,7 +685,7 @@ Public Class VectoVTPJobForm HDVclass = s0.VehicleClass.GetClassNumber() End If - PicVehicle.Image = ConvPicPath(If(Not s0.Found, - 1, HDVclass.ToInt()), False) _ + PicVehicle.Image = ConvPicPath(HDVclass, False) _ 'Image.FromFile(cDeclaration.ConvPicPath(HDVclass, False)) TbHVCclass.Text = String.Format("HDV Group {0}", HDVclass) diff --git a/VECTO/GUI/VehicleForm.vb b/VECTO/GUI/VehicleForm.vb index 5196c87017..1e2d2b424a 100644 --- a/VECTO/GUI/VehicleForm.vb +++ b/VECTO/GUI/VehicleForm.vb @@ -161,8 +161,8 @@ Public Class VehicleForm TbHDVclass.Text = _hdVclass - PicVehicle.Image = ConvPicPath(If(Not s0.Found, -1, _hdVclass.ToInt()), False) - End Sub + PicVehicle.Image = ConvPicPath(_hdVclass, False) + End Sub 'Set generic values for Declaration mode @@ -544,8 +544,8 @@ Public Class VehicleForm '--------------------------------------------------------------------------------- If Not veh.SaveFile Then - MsgBox("Cannot safe to " & file, MsgBoxStyle.Critical) - Return False + MsgBox("Cannot save to " & file, MsgBoxStyle.Critical) + Return False End If If AutoSendTo Then diff --git a/VECTO/MainModule.vb b/VECTO/MainModule.vb index 25f0781d0d..19992aeb86 100644 --- a/VECTO/MainModule.vb +++ b/VECTO/MainModule.vb @@ -40,26 +40,30 @@ Module MainModule Return retVal End Function - Public Function ConvPicPath(hdVclass As Integer, isLongHaul As Boolean) As Bitmap - Select Case hdVclass - Case 1, 2, 3, 6, 7 - Return My.Resources._4x2r - Case 4 - If isLongHaul Then Return My.Resources._4x2rt - Return My.Resources._4x2r - Case 5, 8 - Return My.Resources._4x2tt - Case 9, 11, 13 - If isLongHaul Then Return My.Resources._6x2rt - Return My.Resources._6x2r - Case 10, 12, 14 - Return My.Resources._6x2tt - Case Else - Return My.Resources.Undef - End Select - End Function + Public Function ConvPicPath(hdVclass As String, isLongHaul As Boolean) As Bitmap + + Select Case hdVclass + Case "ML2r", "ML2van", "ML3r", "ML3van", "ML4r", "ML4van", "ML4van", "1s" + Return My.Resources.Undef + + Case "1", "2", "3", "6", "7" + Return My.Resources._4x2r + Case "4" + If isLongHaul Then Return My.Resources._4x2rt + Return My.Resources._4x2r + Case "5", "8" + Return My.Resources._4x2tt + Case "9", "11", "13" + If isLongHaul Then Return My.Resources._6x2rt + Return My.Resources._6x2r + Case "10", "12", "14" + Return My.Resources._6x2tt + Case Else + Return My.Resources.Undef + End Select + End Function - Public Function GetRelativePath(filePath As String, basePath As String) As String + Public Function GetRelativePath(filePath As String, basePath As String) As String If (String.IsNullOrEmpty(filePath)) then Return "" End If diff --git a/VECTO/OutputData/JSONFileWriter.vb b/VECTO/OutputData/JSONFileWriter.vb index 6fd6a51e3b..ef67d20344 100644 --- a/VECTO/OutputData/JSONFileWriter.vb +++ b/VECTO/OutputData/JSONFileWriter.vb @@ -48,34 +48,34 @@ Public Class JSONFileWriter Dim fuels As List(Of Object) = New List(Of Object)() - For Each fuel As IEngineFuelEngineeringInputData In eng.EngineModes.First().Fuels - Dim entry as Dictionary(Of string, object) = New Dictionary(Of String,Object)() - entry.Add("WHTC-Urban", fuel.WHTCUrban) - entry.Add("WHTC-Rural", fuel.WHTCRural) - entry.Add("WHTC-Motorway", fuel.WHTCMotorway) - entry.Add("WHTC-Engineering", fuel.WHTCEngineering) - entry.Add("ColdHotBalancingFactor", fuel.ColdHotBalancingFactor) - entry.Add("CFRegPer", fuel.CorrectionFactorRegPer) - entry.Add("FuelMap", GetRelativePath(fuel.FuelConsumptionMap.Source, Path.GetDirectoryName(filename))) - entry.Add("FuelType", fuel.FuelType.ToString()) + For Each fuel As IEngineFuelEngineeringInputData In eng.EngineModes.First().Fuels + Dim entry As Dictionary(Of String, Object) = New Dictionary(Of String, Object)() + entry.Add("WHTC-Urban", fuel.WHTCUrban) + entry.Add("WHTC-Rural", fuel.WHTCRural) + entry.Add("WHTC-Motorway", fuel.WHTCMotorway) + entry.Add("WHTC-Engineering", fuel.WHTCEngineering) + entry.Add("ColdHotBalancingFactor", fuel.ColdHotBalancingFactor) + entry.Add("CFRegPer", fuel.CorrectionFactorRegPer) + entry.Add("FuelMap", GetRelativePath(fuel.FuelConsumptionMap.Source, Path.GetDirectoryName(filename))) + entry.Add("FuelType", fuel.FuelType.ToString()) fuels.Add(entry) - Next + Next body.Add("Fuels", fuels) - - body.Add("RatedPower", eng.RatedPowerDeclared.Value()) - body.Add("RatedSpeed", eng.RatedSpeedDeclared.AsRPM) - body.Add("MaxTorque", eng.MaxTorqueDeclared.Value()) - - body.Add("FullLoadCurve", GetRelativePath(eng.EngineModes.First().FullLoadCurve.Source, Path.GetDirectoryName(filename))) + body.Add("RatedPower", eng.RatedPowerDeclared.Value()) + body.Add("RatedSpeed", eng.RatedSpeedDeclared.AsRPM) + body.Add("MaxTorque", eng.MaxTorqueDeclared.Value()) + + + body.Add("FullLoadCurve", GetRelativePath(eng.EngineModes.First().FullLoadCurve.Source, Path.GetDirectoryName(filename))) - body.add("WHRType", eng.WHRType.ToString()) + body.Add("WHRType", eng.WHRType.ToString()) - If (eng.WHRType.IsElectrical()) then - Dim whr As Dictionary(Of String, Object) = New Dictionary(Of String,Object) + If (eng.WHRType.IsElectrical()) Then + Dim whr As Dictionary(Of String, Object) = New Dictionary(Of String, Object) Dim whrInput As IWHRData = eng.EngineModes.First().WasteHeatRecoveryData whr.Add("Urban", whrInput.UrbanCorrectionFactor) whr.Add("Rural", whrInput.RuralCorrectionFactor) @@ -86,270 +86,270 @@ Public Class JSONFileWriter body.Add("WHRCorrectionFactors", whr) End If - WriteFile(header, body, filename) - End Sub + WriteFile(header, body, filename) + End Sub - Protected Function GetHeader(fileVersion As Integer) As Dictionary(Of String, Object) - Dim header As Dictionary(Of String, Object) = New Dictionary(Of String, Object) + Protected Function GetHeader(fileVersion As Integer) As Dictionary(Of String, Object) + Dim header As Dictionary(Of String, Object) = New Dictionary(Of String, Object) - header.Add("CreatedBy", "") - header.Add("Date", Now.ToUniversalTime().ToString("o")) - header.Add("AppVersion", VECTOvers) - header.Add("FileVersion", fileVersion) - Return header - End Function + header.Add("CreatedBy", "") + header.Add("Date", Now.ToUniversalTime().ToString("o")) + header.Add("AppVersion", VECTOvers) + header.Add("FileVersion", fileVersion) + Return header + End Function - Public Sub SaveGearbox(gbx As IGearboxEngineeringInputData, axl As IAxleGearInputData, torqueConverter As ITorqueConverterEngineeringInputData, gshift As IGearshiftEngineeringInputData, filename As String) _ - Implements IOutputFileWriter.SaveGearbox + Public Sub SaveGearbox(gbx As IGearboxEngineeringInputData, axl As IAxleGearInputData, torqueConverter As ITorqueConverterEngineeringInputData, gshift As IGearshiftEngineeringInputData, filename As String) _ + Implements IOutputFileWriter.SaveGearbox - 'Header - Dim header As Dictionary(Of String, Object) = GetHeader(GearboxFormatVersion) + 'Header + Dim header As Dictionary(Of String, Object) = GetHeader(GearboxFormatVersion) - 'Body - Dim body As Dictionary(Of String, Object) = New Dictionary(Of String, Object) + 'Body + Dim body As Dictionary(Of String, Object) = New Dictionary(Of String, Object) - body.Add(JsonKeys.SavedInDeclMode, Cfg.DeclMode) - body.Add(JsonKeys.Gearbox_ModelName, gbx.Model) - body.Add(JsonKeys.Gearbox_Inertia, gbx.Inertia.Value()) - body.Add(JsonKeys.Gearbox_TractionInterruption, gbx.TractionInterruption.Value()) - - Dim ls As New List(Of Dictionary(Of String, Object)) - Dim axlgDict As New Dictionary(Of String, Object) - axlgDict.Add(JsonKeys.Gearbox_Gear_Ratio, axl.Ratio) - If axl.LossMap Is Nothing Then - axlgDict.Add(JsonKeys.Gearbox_Gear_Efficiency, axl.Efficiency) - Else - axlgDict.Add(JsonKeys.Gearbox_Gear_LossMapFile, GetRelativePath(axl.LossMap.Source, Path.GetDirectoryName(filename))) - End If - ls.Add(axlgDict) - - For Each gear As ITransmissionInputData In gbx.Gears - Dim gearDict As New Dictionary(Of String, Object) - gearDict.Add(JsonKeys.Gearbox_Gear_Ratio, gear.Ratio) - If gear.LossMap Is Nothing Then - gearDict.Add(JsonKeys.Gearbox_Gear_Efficiency, gear.Efficiency) - Else - gearDict.Add(JsonKeys.Gearbox_Gear_LossMapFile, - GetRelativePath(gear.LossMap.Source, Path.GetDirectoryName(filename))) - End If - gearDict.Add(JsonKeys.Gearbox_Gear_ShiftPolygonFile, If _ - (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())) - gearDict.Add("MaxSpeed", If(gear.MaxInputSpeed Is Nothing, "", gear.MaxInputSpeed.AsRPM.ToString())) - - ls.Add(gearDict) - Next - body.Add(JsonKeys.Gearbox_Gears, ls) - body.Add(JsonKeys.Gearbox_TorqueReserve, gshift.TorqueReserve*100) - body.Add(JsonKeys.Gearbox_ShiftTime, gshift.MinTimeBetweenGearshift.Value()) - body.Add(JsonKeys.Gearbox_StartTorqueReserve, gshift.StartTorqueReserve*100) - body.Add(JsonKeys.Gearbox_StartSpeed, gshift.StartSpeed.Value()) - body.Add(JsonKeys.Gearbox_StartAcceleration, gshift.StartAcceleration.Value()) - body.Add(JsonKeys.Gearbox_GearboxType, gbx.Type.ToString()) - - - Dim torqueConverterDict As New Dictionary(Of String, Object) - torqueConverterDict.Add("Enabled", Not torqueConverter Is Nothing AndAlso gbx.Type.AutomaticTransmission()) - If gbx.Type.AutomaticTransmission() AndAlso Not torqueConverter Is Nothing Then - torqueConverterDict.Add("File", GetRelativePath(torqueConverter.TCData.Source, Path.GetDirectoryName(filename))) - torqueConverterDict.Add(JsonKeys.Gearbox_TorqueConverter_ReferenceRPM, torqueConverter.ReferenceRPM.AsRPM) - torqueConverterDict.Add(JsonKeys.Gearbox_TorqueConverter_Inertia, torqueConverter.Inertia.Value()) - torqueConverterDict.Add("MaxTCSpeed", torqueConverter.MaxInputSpeed.AsRPM) - torqueConverterDict.Add("ShiftPolygon", - If (Not gbx.SavedInDeclarationMode AndAlso Not torqueConverter.ShiftPolygon Is Nothing, - GetRelativePath(torqueConverter.ShiftPolygon.Source, Path.GetDirectoryName(filename)), "")) - torqueConverterDict.Add("CLUpshiftMinAcceleration", gshift.CLUpshiftMinAcceleration.Value()) - torqueConverterDict.Add("CCUpshiftMinAcceleration", gshift.CCUpshiftMinAcceleration.Value()) - End If - body.Add(JsonKeys.Gearbox_TorqueConverter, torqueConverterDict) + body.Add(JsonKeys.SavedInDeclMode, Cfg.DeclMode) + body.Add(JsonKeys.Gearbox_ModelName, gbx.Model) + body.Add(JsonKeys.Gearbox_Inertia, gbx.Inertia.Value()) + body.Add(JsonKeys.Gearbox_TractionInterruption, gbx.TractionInterruption.Value()) - body.Add("DownshiftAfterUpshiftDelay", gshift.DownshiftAfterUpshiftDelay.Value()) - body.Add("UpshiftAfterDownshiftDelay", gshift.UpshiftAfterDownshiftDelay.Value()) - body.Add("UpshiftMinAcceleration", gshift.UpshiftMinAcceleration.Value()) + Dim ls As New List(Of Dictionary(Of String, Object)) + Dim axlgDict As New Dictionary(Of String, Object) + axlgDict.Add(JsonKeys.Gearbox_Gear_Ratio, axl.Ratio) + If axl.LossMap Is Nothing Then + axlgDict.Add(JsonKeys.Gearbox_Gear_Efficiency, axl.Efficiency) + Else + axlgDict.Add(JsonKeys.Gearbox_Gear_LossMapFile, GetRelativePath(axl.LossMap.Source, Path.GetDirectoryName(filename))) + End If + ls.Add(axlgDict) + + For Each gear As ITransmissionInputData In gbx.Gears + Dim gearDict As New Dictionary(Of String, Object) + gearDict.Add(JsonKeys.Gearbox_Gear_Ratio, gear.Ratio) + If gear.LossMap Is Nothing Then + gearDict.Add(JsonKeys.Gearbox_Gear_Efficiency, gear.Efficiency) + Else + gearDict.Add(JsonKeys.Gearbox_Gear_LossMapFile, + GetRelativePath(gear.LossMap.Source, Path.GetDirectoryName(filename))) + End If + gearDict.Add(JsonKeys.Gearbox_Gear_ShiftPolygonFile, If _ + (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())) + gearDict.Add("MaxSpeed", If(gear.MaxInputSpeed Is Nothing, "", gear.MaxInputSpeed.AsRPM.ToString())) + + ls.Add(gearDict) + Next + body.Add(JsonKeys.Gearbox_Gears, ls) + body.Add(JsonKeys.Gearbox_TorqueReserve, gshift.TorqueReserve * 100) + body.Add(JsonKeys.Gearbox_ShiftTime, gshift.MinTimeBetweenGearshift.Value()) + body.Add(JsonKeys.Gearbox_StartTorqueReserve, gshift.StartTorqueReserve * 100) + body.Add(JsonKeys.Gearbox_StartSpeed, gshift.StartSpeed.Value()) + body.Add(JsonKeys.Gearbox_StartAcceleration, gshift.StartAcceleration.Value()) + body.Add(JsonKeys.Gearbox_GearboxType, gbx.Type.ToString()) + + + Dim torqueConverterDict As New Dictionary(Of String, Object) + torqueConverterDict.Add("Enabled", Not torqueConverter Is Nothing AndAlso gbx.Type.AutomaticTransmission()) + If gbx.Type.AutomaticTransmission() AndAlso Not torqueConverter Is Nothing Then + torqueConverterDict.Add("File", GetRelativePath(torqueConverter.TCData.Source, Path.GetDirectoryName(filename))) + torqueConverterDict.Add(JsonKeys.Gearbox_TorqueConverter_ReferenceRPM, torqueConverter.ReferenceRPM.AsRPM) + torqueConverterDict.Add(JsonKeys.Gearbox_TorqueConverter_Inertia, torqueConverter.Inertia.Value()) + torqueConverterDict.Add("MaxTCSpeed", torqueConverter.MaxInputSpeed.AsRPM) + torqueConverterDict.Add("ShiftPolygon", + If(Not gbx.SavedInDeclarationMode AndAlso Not torqueConverter.ShiftPolygon Is Nothing, + GetRelativePath(torqueConverter.ShiftPolygon.Source, Path.GetDirectoryName(filename)), "")) + torqueConverterDict.Add("CLUpshiftMinAcceleration", gshift.CLUpshiftMinAcceleration.Value()) + torqueConverterDict.Add("CCUpshiftMinAcceleration", gshift.CCUpshiftMinAcceleration.Value()) + End If + body.Add(JsonKeys.Gearbox_TorqueConverter, torqueConverterDict) + + body.Add("DownshiftAfterUpshiftDelay", gshift.DownshiftAfterUpshiftDelay.Value()) + body.Add("UpshiftAfterDownshiftDelay", gshift.UpshiftAfterDownshiftDelay.Value()) + body.Add("UpshiftMinAcceleration", gshift.UpshiftMinAcceleration.Value()) + + body.Add("PowershiftShiftTime", gbx.PowershiftShiftTime.Value()) + + WriteFile(header, body, filename) + End Sub + + Public Sub SaveVehicle(vehicle As IVehicleEngineeringInputData, airdrag As IAirdragEngineeringInputData, + retarder As IRetarderInputData, + pto As IPTOTransmissionInputData, angledrive As IAngledriveInputData, filename As String) _ + Implements IOutputFileWriter.SaveVehicle + Dim basePath As String = Path.GetDirectoryName(filename) + + 'Header + Dim header As Dictionary(Of String, Object) = GetHeader(VehicleFormatVersion) + + 'Body + Dim retarderOut As Dictionary(Of String, Object) = New Dictionary(Of String, Object)() + If retarder Is Nothing Then + retarderOut.Add("Type", RetarderType.None.GetName()) + Else + retarderOut.Add("Type", retarder.Type.GetName()) + retarderOut.Add("Ratio", retarder.Ratio) + retarderOut.Add("File", + If _ + (retarder.Type.IsDedicatedComponent AndAlso Not retarder.LossMap Is Nothing, + GetRelativePath(retarder.LossMap.Source, basePath), "")) + End If - body.Add("PowershiftShiftTime", gbx.PowershiftShiftTime.Value()) + Dim ptoOut As Dictionary(Of String, Object) = New Dictionary(Of String, Object) + If pto Is Nothing Then + ptoOut.Add("Type", "None") + Else + ptoOut.Add("Type", pto.PTOTransmissionType) + ptoOut.Add("LossMap", + If _ + (pto.PTOTransmissionType <> "None" AndAlso Not pto.PTOLossMap Is Nothing, + GetRelativePath(pto.PTOLossMap.Source, basePath), "")) + ptoOut.Add("Cycle", + If _ + (pto.PTOTransmissionType <> "None" AndAlso Not pto.PTOCycle Is Nothing, + GetRelativePath(pto.PTOCycle.Source, basePath), "")) + End If - WriteFile(header, body, filename) - End Sub + Dim angledriveOut As Dictionary(Of String, Object) = New Dictionary(Of String, Object) From { + {"Type", angledrive.Type.ToString()}, + {"Ratio", angledrive.Ratio}, + {"LossMap", + If _ + (angledrive.Type = AngledriveType.SeparateAngledrive AndAlso Not angledrive.LossMap Is Nothing, + GetRelativePath(angledrive.LossMap.Source, basePath), "")}} + + Dim torqueLimits As Dictionary(Of String, String) = New Dictionary(Of String, String) + For Each entry As ITorqueLimitInputData In vehicle.TorqueLimits + torqueLimits.Add(entry.Gear().ToString(), entry.MaxTorque.Value().ToString()) + Next + + Dim body As Dictionary(Of String, Object) = New Dictionary(Of String, Object) From { + {"SavedInDeclMode", Cfg.DeclMode}, + {"VehCat", vehicle.VehicleCategory.ToString()}, + {"LegislativeClass", vehicle.LegislativeClass.ToString()}, + {"CurbWeight", vehicle.CurbMassChassis.Value()}, + {"CurbWeightExtra", vehicle.CurbMassExtra.Value()}, + {"Loading", vehicle.Loading.Value()}, + {"MassMax", vehicle.GrossVehicleMassRating.ConvertToTon().Value}, + {"rdyn", vehicle.DynamicTyreRadius.ConvertToMilliMeter().Value}, + {"CdCorrMode", airdrag.CrossWindCorrectionMode.GetName()}, + {"CdCorrFile", + If((airdrag.CrossWindCorrectionMode = CrossWindCorrectionMode.SpeedDependentCorrectionFactor OrElse + airdrag.CrossWindCorrectionMode = CrossWindCorrectionMode.VAirBetaLookupTable) AndAlso + Not airdrag.CrosswindCorrectionMap Is Nothing, GetRelativePath(airdrag.CrosswindCorrectionMap.Source, basePath), + "") + }, + {"Retarder", retarderOut}, + {"Angledrive", angledriveOut}, + {"PTO", ptoOut}, + {"TorqueLimits", torqueLimits}, + {"IdlingSpeed", vehicle.EngineIdleSpeed.AsRPM}, + {"AxleConfig", New Dictionary(Of String, Object) From { + {"Type", vehicle.AxleConfiguration.GetName()}, + {"Axles", From axle In vehicle.Components.AxleWheels.AxlesEngineering Select New Dictionary(Of String, Object) From { + {"Inertia", axle.Tyre.Inertia.Value()}, + {"Wheels", axle.Tyre.Dimension}, + {"AxleWeightShare", axle.AxleWeightShare}, + {"TwinTyres", axle.TwinTyres}, + {"RRCISO", axle.Tyre.RollResistanceCoefficient}, + {"FzISO", axle.Tyre.TyreTestLoad.Value()}, + {"Type", axle.AxleType.ToString()} + }}}}} + If (vehicle.TankSystem.HasValue) Then + body("TankSystem") = vehicle.TankSystem.Value.ToString() + End If - Public Sub SaveVehicle(vehicle As IVehicleEngineeringInputData, airdrag As IAirdragEngineeringInputData, - retarder As IRetarderInputData, - pto As IPTOTransmissionInputData, angledrive As IAngledriveInputData, filename As String) _ - Implements IOutputFileWriter.SaveVehicle - Dim basePath As String = Path.GetDirectoryName(filename) + body("EngineStopStart") = vehicle.ADAS.EngineStopStart + body("EcoRoll") = vehicle.ADAS.EcoRoll.ToString() + body("PredictiveCruiseControl") = vehicle.ADAS.PredictiveCruiseControl.ToString() - 'Header - Dim header As Dictionary(Of String, Object) = GetHeader(VehicleFormatVersion) + If (Not IsNothing(airdrag.AirDragArea)) Then + body("CdA") = airdrag.AirDragArea.Value() + End If + If (Not IsNothing(vehicle.Height)) Then + body("VehicleHeight") = vehicle.Height.Value() + End If + WriteFile(header, body, filename) + End Sub - 'Body - Dim retarderOut As Dictionary(Of String, Object) = New Dictionary(Of String, Object)() - If retarder Is Nothing Then - retarderOut.Add("Type", RetarderType.None.GetName()) - Else - retarderOut.Add("Type", retarder.Type.GetName()) - retarderOut.Add("Ratio", retarder.Ratio) - retarderOut.Add("File", - If _ - (retarder.Type.IsDedicatedComponent AndAlso Not retarder.LossMap Is Nothing, - GetRelativePath(retarder.LossMap.Source, basePath), "")) - End If + Public Sub SaveJob(input As IEngineeringInputDataProvider, filename As String) _ + Implements IOutputFileWriter.SaveJob + Dim basePath As String = Path.GetDirectoryName(filename) + 'Header + Dim header As Dictionary(Of String, Object) = GetHeader(VectoJobFormatVersion) - Dim ptoOut As Dictionary(Of String, Object) = New Dictionary(Of String, Object) - If pto Is Nothing Then - ptoOut.Add("Type", "None") - Else - ptoOut.Add("Type", pto.PTOTransmissionType) - ptoOut.Add("LossMap", - If _ - (pto.PTOTransmissionType <> "None" AndAlso Not pto.PTOLossMap Is Nothing, - GetRelativePath(pto.PTOLossMap.Source, basePath), "")) - ptoOut.Add("Cycle", - If _ - (pto.PTOTransmissionType <> "None" AndAlso Not pto.PTOCycle Is Nothing, - GetRelativePath(pto.PTOCycle.Source, basePath), "")) - End If + 'Body + Dim body As Dictionary(Of String, Object) = New Dictionary(Of String, Object) - Dim angledriveOut As Dictionary(Of String, Object) = New Dictionary(Of String, Object) From { - {"Type", angledrive.Type.ToString()}, - {"Ratio", angledrive.Ratio}, - {"LossMap", - If _ - (angledrive.Type = AngledriveType.SeparateAngledrive AndAlso Not angledrive.LossMap Is Nothing, - GetRelativePath(angledrive.LossMap.Source, basePath), "")}} - - Dim torqueLimits As Dictionary(Of String, String) = New Dictionary(Of String, String) - For Each entry As ITorqueLimitInputData In vehicle.TorqueLimits - torqueLimits.Add(entry.Gear().ToString(), entry.MaxTorque.Value().ToString()) - Next - - Dim body As Dictionary(Of String, Object) = New Dictionary(Of String, Object) From { - {"SavedInDeclMode", Cfg.DeclMode}, - {"VehCat", vehicle.VehicleCategory.ToString()}, - {"LegislativeClass", vehicle.LegislativeClass.ToString()}, - {"CurbWeight", vehicle.CurbMassChassis.Value()}, - {"CurbWeightExtra", vehicle.CurbMassExtra.Value()}, - {"Loading", vehicle.Loading.Value()}, - {"MassMax", vehicle.GrossVehicleMassRating.ConvertToTon().Value}, - {"rdyn", vehicle.DynamicTyreRadius.ConvertToMilliMeter().Value}, - {"CdCorrMode", airdrag.CrossWindCorrectionMode.GetName()}, - {"CdCorrFile", - If((airdrag.CrossWindCorrectionMode = CrossWindCorrectionMode.SpeedDependentCorrectionFactor OrElse - airdrag.CrossWindCorrectionMode = CrossWindCorrectionMode.VAirBetaLookupTable) AndAlso - Not airdrag.CrosswindCorrectionMap Is Nothing, GetRelativePath(airdrag.CrosswindCorrectionMap.Source, basePath), - "") - }, - {"Retarder", retarderOut}, - {"Angledrive", angledriveOut}, - {"PTO", ptoOut}, - {"TorqueLimits", torqueLimits}, - {"IdlingSpeed", vehicle.EngineIdleSpeed.AsRPM}, - {"AxleConfig", New Dictionary(Of String, Object) From { - {"Type", vehicle.AxleConfiguration.GetName()}, - {"Axles", From axle In vehicle.Components.AxleWheels.AxlesEngineering Select New Dictionary(Of String, Object) From { - {"Inertia", axle.Tyre.Inertia.Value()}, - {"Wheels", axle.Tyre.Dimension}, - {"AxleWeightShare", axle.AxleWeightShare}, - {"TwinTyres", axle.TwinTyres}, - {"RRCISO", axle.Tyre.RollResistanceCoefficient}, - {"FzISO", axle.Tyre.TyreTestLoad.Value()}, - {"Type", axle.AxleType.ToString()} - }}}}} - If (vehicle.TankSystem.HasValue) Then - body("TankSystem") = vehicle.TankSystem.Value.ToString() - End If - - body("EngineStopStart") = vehicle.ADAS.EngineStopStart - body("EcoRoll") = vehicle.ADAS.EcoRoll.ToString() - body("PredictiveCruiseControl") = vehicle.ADAS.PredictiveCruiseControl.ToString() - - If (Not IsNothing(airdrag.AirDragArea)) Then - body("CdA") = airdrag.AirDragArea.Value() - End If - If (Not IsNothing(vehicle.Height)) Then - body("VehicleHeight") = vehicle.Height.Value() - End If - WriteFile(header, body, filename) - End Sub + 'SavedInDeclMode = Cfg.DeclMode - Public Sub SaveJob(input As IEngineeringInputDataProvider, filename As String) _ - Implements IOutputFileWriter.SaveJob - Dim basePath As String = Path.GetDirectoryName(filename) - 'Header - Dim header As Dictionary(Of String, Object) = GetHeader(VectoJobFormatVersion) + Dim job As IEngineeringJobInputData = input.JobInputData() - 'Body - Dim body As Dictionary(Of String, Object) = New Dictionary(Of String, Object) + body.Add("SavedInDeclMode", job.SavedInDeclarationMode) + body.Add("EngineOnlyMode", job.EngineOnlyMode) - 'SavedInDeclMode = Cfg.DeclMode - - Dim job As IEngineeringJobInputData = input.JobInputData() + If job.EngineOnlyMode Then + body.Add("EngineFile", GetRelativePath(job.EngineOnly.DataSource.SourceFile, basePath)) + body.Add("Cycles", + job.Cycles.Select(Function(x) GetRelativePath(x.CycleData.Source, Path.GetDirectoryName(filename))).ToArray()) + WriteFile(header, body, filename) + Return + End If - body.Add("SavedInDeclMode", job.SavedInDeclarationMode) - body.Add("EngineOnlyMode", job.EngineOnlyMode) + 'Main Files + body.Add("VehicleFile", GetRelativePath(job.Vehicle.DataSource.SourceFile, basePath)) + body.Add("EngineFile", GetRelativePath(input.JobInputData.Vehicle.Components.EngineInputData.DataSource.SourceFile, basePath)) + body.Add("GearboxFile", GetRelativePath(input.JobInputData.Vehicle.Components.GearboxInputData.DataSource.SourceFile, basePath)) + + + Dim aux As IAuxiliariesEngineeringInputData = job.Vehicle.Components.AuxiliaryInputData + 'AA-TB + 'ADVANCED AUXILIARIES + body.Add("AuxiliaryAssembly", aux.AuxiliaryAssembly.GetName()) + body.Add("AuxiliaryVersion", aux.AuxiliaryVersion) + body.Add("AdvancedAuxiliaryFilePath", GetRelativePath(aux.AdvancedAuxiliaryFilePath, basePath)) + + Dim pAdd As Double = 0.0 + Dim auxList As List(Of Object) = New List(Of Object) + For Each auxEntry As IAuxiliaryEngineeringInputData In aux.Auxiliaries + If auxEntry.AuxiliaryType = AuxiliaryDemandType.Constant Then + pAdd += auxEntry.ConstantPowerDemand.Value() + Continue For + End If + Dim auxOut As Dictionary(Of String, Object) = New Dictionary(Of String, Object) + Dim engineeringAuxEntry As IAuxiliaryDeclarationInputData = TryCast(auxEntry, IAuxiliaryDeclarationInputData) + If Not job.SavedInDeclarationMode Then + auxOut.Add("ID", auxEntry.ID) + auxOut.Add("Type", AuxiliaryTypeHelper.ParseKey(auxEntry.ID).Name()) + auxOut.Add("Path", GetRelativePath(auxEntry.DemandMap.Source, basePath)) + auxOut.Add("Technology", New String() {}) + Else + auxOut.Add("ID", auxEntry.ID) + auxOut.Add("Type", AuxiliaryTypeHelper.ParseKey(auxEntry.ID).Name()) + auxOut.Add("Technology", engineeringAuxEntry.Technology) + End If + auxList.Add(auxOut) + Next + + body.Add("Aux", auxList) + If Not job.SavedInDeclarationMode Then + body.Add("Padd", pAdd) + End If - If job.EngineOnlyMode Then - body.Add("EngineFile", GetRelativePath(job.EngineOnly.DataSource.SourceFile, basePath)) - body.Add("Cycles", - job.Cycles.Select(Function(x) GetRelativePath(x.CycleData.Source, Path.GetDirectoryName(filename))).ToArray()) - WriteFile(header, body, filename) - Return - End If + Dim driver As IDriverEngineeringInputData = input.DriverInputData - 'Main Files - body.Add("VehicleFile", GetRelativePath(job.Vehicle.DataSource.SourceFile, basePath)) - body.Add("EngineFile", GetRelativePath(input.JobInputData.Vehicle.Components.EngineInputData.DataSource.SourceFile, basePath)) - body.Add("GearboxFile", GetRelativePath(input.JobInputData.Vehicle.Components.GearboxInputData.DataSource.SourceFile, basePath)) - - - Dim aux As IAuxiliariesEngineeringInputData = job.Vehicle.Components.AuxiliaryInputData - 'AA-TB - 'ADVANCED AUXILIARIES - body.Add("AuxiliaryAssembly", aux.AuxiliaryAssembly.GetName()) - body.Add("AuxiliaryVersion", aux.AuxiliaryVersion) - body.Add("AdvancedAuxiliaryFilePath", GetRelativePath(aux.AdvancedAuxiliaryFilePath, basePath)) - - Dim pAdd As Double = 0.0 - Dim auxList As List(Of Object) = New List(Of Object) - For Each auxEntry As IAuxiliaryEngineeringInputData In aux.Auxiliaries - If auxEntry.AuxiliaryType = AuxiliaryDemandType.Constant Then - pAdd += auxEntry.ConstantPowerDemand.Value() - Continue For - End If - Dim auxOut As Dictionary(Of String, Object) = New Dictionary(Of String, Object) - Dim engineeringAuxEntry As IAuxiliaryDeclarationInputData = TryCast(auxEntry, IAuxiliaryDeclarationInputData) - If Not job.SavedInDeclarationMode Then - auxOut.Add("ID", auxEntry.ID) - auxOut.Add("Type", AuxiliaryTypeHelper.ParseKey(auxEntry.ID).Name()) - auxOut.Add("Path", GetRelativePath(auxEntry.DemandMap.Source, basePath)) - auxOut.Add("Technology", New String() {}) - Else - auxOut.Add("ID", auxEntry.ID) - auxOut.Add("Type", AuxiliaryTypeHelper.ParseKey(auxEntry.ID).Name()) - auxOut.Add("Technology", engineeringAuxEntry.Technology) - End If - auxList.Add(auxOut) - Next - - body.Add("Aux", auxList) - If Not job.SavedInDeclarationMode Then - body.Add("Padd", pAdd) - End If - - Dim driver As IDriverEngineeringInputData = input.DriverInputData - - If Not job.SavedInDeclarationMode Then - body.Add("VACC", GetRelativePath(driver.AccelerationCurve.AccelerationCurve.Source, basePath)) - body.Add("EngineStopStartAtVehicleStopThreshold", driver.EngineStopStartData.ActivationDelay.Value()) + If Not job.SavedInDeclarationMode Then + body.Add("VACC", GetRelativePath(driver.AccelerationCurve.AccelerationCurve.Source, basePath)) + body.Add("EngineStopStartAtVehicleStopThreshold", driver.EngineStopStartData.ActivationDelay.Value()) body.Add("EngineStopStartMaxOffTimespan", driver.EngineStopStartData.MaxEngineOffTimespan.Value()) body.Add("EngineStopStartUtilityFactor", driver.EngineStopStartData.UtilityFactor) - body.Add("EcoRollMinSpeed", driver.EcoRollData.MinSpeed) - body.Add("EcoRollActivationDelay", driver.EcoRollData.ActivationDelay) - body.Add("EcoRollUnderspeedThreshold", driver.EcoRollData.UnderspeedThreshold) + body.Add("EcoRollMinSpeed", driver.EcoRollData.MinSpeed.AsKmph) + body.Add("EcoRollActivationDelay", driver.EcoRollData.ActivationDelay.Value()) + body.Add("EcoRollUnderspeedThreshold", driver.EcoRollData.UnderspeedThreshold.AsKmph) - End If + End If 'body.Add("StartStop", New Dictionary(Of String, Object) From { ' {"Enabled", driver.StartStop.Enabled}, ' {"MaxSpeed", driver.StartStop.MaxSpeed.AsKmph}, diff --git a/VECTO/VECTO.vbproj b/VECTO/VECTO.vbproj index 1d34ccb87b..fc5421c6d4 100644 --- a/VECTO/VECTO.vbproj +++ b/VECTO/VECTO.vbproj @@ -429,6 +429,7 @@ </EmbeddedResource> </ItemGroup> <ItemGroup> + <None Include="ClassDiagram1.cd" /> <None Include="My Project\app.manifest"> <SubType>Designer</SubType> </None> diff --git a/VectoCommon/VectoCommon/Models/AxleConfiguration.cs b/VectoCommon/VectoCommon/Models/AxleConfiguration.cs index 5994a42c8e..4c8205788e 100644 --- a/VectoCommon/VectoCommon/Models/AxleConfiguration.cs +++ b/VectoCommon/VectoCommon/Models/AxleConfiguration.cs @@ -39,7 +39,8 @@ namespace TUGraz.VectoCommon.Models public enum AxleConfiguration { AxleConfig_4x2, - AxleConfig_4x4, + AxleConfig_4x2F, + AxleConfig_4x4, AxleConfig_6x2, AxleConfig_6x4, AxleConfig_6x6, diff --git a/VectoCommon/VectoCommon/Models/VehicleCategory.cs b/VectoCommon/VectoCommon/Models/VehicleCategory.cs index f4927a6adc..565dfcf5c8 100644 --- a/VectoCommon/VectoCommon/Models/VehicleCategory.cs +++ b/VectoCommon/VectoCommon/Models/VehicleCategory.cs @@ -36,6 +36,7 @@ namespace TUGraz.VectoCommon.Models public enum VehicleCategory { Unknown, + Van, RigidTruck, Tractor, CityBus, @@ -48,7 +49,9 @@ namespace TUGraz.VectoCommon.Models public static string GetLabel(this VehicleCategory category) { switch (category) { - case VehicleCategory.RigidTruck: + case VehicleCategory.Van: + return "Van"; + case VehicleCategory.RigidTruck: return "Rigid Truck"; case VehicleCategory.Tractor: return "Tractor"; @@ -66,7 +69,9 @@ namespace TUGraz.VectoCommon.Models public static string GetCategoryName(this VehicleCategory category) { switch (category) { - case VehicleCategory.RigidTruck: + case VehicleCategory.Van: + return "Van"; + case VehicleCategory.RigidTruck: return "Rigid Truck"; case VehicleCategory.Tractor: return "Semitrailer Truck"; @@ -101,10 +106,11 @@ namespace TUGraz.VectoCommon.Models public static bool IsTruck(this VehicleCategory category) { switch (category) { - case VehicleCategory.RigidTruck: + case VehicleCategory.Van: + case VehicleCategory.RigidTruck: case VehicleCategory.Tractor: return true; - case VehicleCategory.CityBus: + case VehicleCategory.CityBus: case VehicleCategory.InterurbanBus: case VehicleCategory.Coach: return false; diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs index 4de0eeaffb..66566b17e5 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs @@ -233,14 +233,14 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter retVal.FullLoadCurves = fullLoadCurves; - var whr = CreateWHRData(mode.WasteHeatRecoveryData); + /*var whr = CreateWHRData(mode.WasteHeatRecoveryData); if (whr != null) { whr.WHRCorrectionFactor = DeclarationData.WHTCCorrection.Lookup( mission.MissionType.GetNonEMSMissionType(), whr.CFRural, whr.CFUrban, whr.CFMotorway) * whr.CFColdHot * whr.CFRegPer; } retVal.WHRData = whr; - + */ return retVal; } @@ -444,7 +444,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter mission = mission.GetNonEMSMissionType(); switch (auxType) { case AuxiliaryType.Fan: - aux.PowerDemand = DeclarationData.Fan.Lookup(mission, auxData.Technology.FirstOrDefault()).PowerDemand; + aux.PowerDemand = DeclarationData.Fan.Lookup(hvdClass, mission, auxData.Technology.FirstOrDefault()).PowerDemand; aux.ID = Constants.Auxiliaries.IDs.Fan; break; case AuxiliaryType.SteeringPump: diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs index 51d4709f7d..d00fd93e02 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs @@ -43,6 +43,7 @@ using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine; using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; +using TUGraz.VectoCore.Models.SimulationComponent.Impl; namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter { @@ -144,7 +145,10 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter private string GetAirdragParameterSet(VehicleCategory vehicleCategory, AxleConfiguration axles, int numAxles) { + //TODO: check if is i switch (vehicleCategory) { + case VehicleCategory.Van: + return "MediumLorriesVan"; case VehicleCategory.RigidTruck: return numAxles > axles.NumAxles() ? "RigidTrailer" : "RigidSolo"; case VehicleCategory.Tractor: return "TractorSemitrailer"; case VehicleCategory.CityBus: @@ -201,9 +205,13 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter retVal.FullLoadCurves = fullLoadCurves; - var whr = CreateWHRData(engineMode.WasteHeatRecoveryData); - if (whr != null) { - whr.WHRCorrectionFactor = engineMode.WasteHeatRecoveryData.EngineeringCorrectionFactor; + WHRData whr = null; + if (engine.WHRType != WHRType.None) { + + whr = CreateWHRData(engineMode.WasteHeatRecoveryData); + if (whr != null) { + whr.WHRCorrectionFactor = engineMode.WasteHeatRecoveryData.EngineeringCorrectionFactor; + } } retVal.WHRType = engine.WHRType; diff --git a/VectoCore/VectoCore/Models/Connector/Ports/Impl/Response.cs b/VectoCore/VectoCore/Models/Connector/Ports/Impl/Response.cs index 8e5812da52..8d08ae62e3 100644 --- a/VectoCore/VectoCore/Models/Connector/Ports/Impl/Response.cs +++ b/VectoCore/VectoCore/Models/Connector/Ports/Impl/Response.cs @@ -29,6 +29,7 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ +using System; using System.Linq; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; @@ -110,6 +111,10 @@ namespace TUGraz.VectoCore.Models.Connector.Ports.Impl public class ResponseFailTimeInterval : AbstractResponse { public Second DeltaT { get; set; } + + public ResponseFailTimeInterval() + { + } } public class ResponseDrivingCycleDistanceExceeded : AbstractResponse diff --git a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs index 484313b3e3..68266d77c1 100644 --- a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs +++ b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs @@ -65,7 +65,8 @@ namespace TUGraz.VectoCore.Models.Declaration public static readonly PT1 PT1 = new PT1(); public static readonly FuelData FuelData = FuelData.Instance(); public static readonly ElectricSystem ElectricSystem = new ElectricSystem(); - public static readonly Fan Fan = new Fan(); + public static readonly Fan Fan=new Fan(); + public static readonly HeatingVentilationAirConditioning HeatingVentilationAirConditioning = new HeatingVentilationAirConditioning(); diff --git a/VectoCore/VectoCore/Models/Declaration/Fan.cs b/VectoCore/VectoCore/Models/Declaration/Fan.cs index bff65c8726..643d6e761a 100644 --- a/VectoCore/VectoCore/Models/Declaration/Fan.cs +++ b/VectoCore/VectoCore/Models/Declaration/Fan.cs @@ -38,54 +38,98 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.Declaration { - public sealed class Fan : LookupData<MissionType, string, AuxDemandEntry>, IDeclarationAuxiliaryTable - { - private readonly List<string> FullyElectricFanTechnologies = new List<string>(); - protected override string ResourceId + public class Fan : IDeclarationAuxiliaryTable + { + readonly FanMediumLorries fanMediumLorries=new FanMediumLorries(); + readonly FanHeavyLorries fanHeavyLorries=new FanHeavyLorries(); + + public AuxDemandEntry Lookup(VehicleClass vehicleClass, MissionType mission, string technology = null) { - get { return DeclarationData.DeclarationDataResourcePrefix + ".VAUX.Fan-Tech.csv"; } + return VehicleClassHelper.IsMediumLorry(vehicleClass) ? fanMediumLorries.Lookup(mission, technology) : fanHeavyLorries.Lookup(mission, technology); } - protected override string ErrorMessage - { - get { return "Auxiliary Lookup Error: No value found for Fan. Mission: '{0}', Technology: '{1}'"; } - } - protected override void ParseData(DataTable table) + //protected override string ResourceId { get; } + public string[] FullyElectricTechnologies() { - foreach (DataRow row in table.Rows) { - var name = row.Field<string>("technology"); - var electric = row.ParseBoolean("fullyelectric"); - if (electric) { - FullyElectricFanTechnologies.Add(name); - } - foreach (DataColumn col in table.Columns) { - if (col.Caption != "technology" && col.Caption != "fullyelectric") { - Data[Tuple.Create(col.Caption.ParseEnum<MissionType>(), name)] = new AuxDemandEntry { - PowerDemand = row.ParseDouble(col).SI<Watt>(), - }; - } - } - } + return fanHeavyLorries.FullyElectricTechnologies(); } - public override AuxDemandEntry Lookup(MissionType mission, string technology = null) + public string[] GetTechnologies() { - if (string.IsNullOrWhiteSpace(technology)) { - technology = "Crankshaft mounted - Electronically controlled visco clutch"; - } - return base.Lookup(mission, technology); - } + return fanHeavyLorries.GetTechnologies(); + } + } - public string[] FullyElectricTechnologies() + public abstract class AbstractFan : LookupData<MissionType, string, AuxDemandEntry>, IDeclarationAuxiliaryTable + { + private readonly List<string> FullyElectricFanTechnologies = new List<string>(); + + protected override string ErrorMessage + { + get { return "Auxiliary Lookup Error: No value found for Fan. Mission: '{0}', Technology: '{1}'"; } + } + + protected override void ParseData(DataTable table) + { + foreach (DataRow row in table.Rows) + { + var name = row.Field<string>("technology"); + var electric = row.ParseBoolean("fullyelectric"); + if (electric) + { + FullyElectricFanTechnologies.Add(name); + } + foreach (DataColumn col in table.Columns) + { + if (col.Caption != "technology" && col.Caption != "fullyelectric") + { + Data[Tuple.Create(col.Caption.ParseEnum<MissionType>(), name)] = new AuxDemandEntry + { + PowerDemand = row.ParseDouble(col).SI<Watt>(), + }; + } + } + } + } + + public override AuxDemandEntry Lookup(MissionType mission, string technology = null) + { + if (string.IsNullOrWhiteSpace(technology)) + { + technology = "Crankshaft mounted - Electronically controlled visco clutch"; + } + return base.Lookup(mission, technology); + } + + + + public string[] FullyElectricTechnologies() + { + return FullyElectricFanTechnologies.ToArray(); + } + + public string[] GetTechnologies() + { + return Data.Keys.Select(x => x.Item2).Distinct().ToArray(); + } + } + + + public sealed class FanMediumLorries : AbstractFan + { + protected override string ResourceId { - return FullyElectricFanTechnologies.ToArray(); + get { return DeclarationData.DeclarationDataResourcePrefix + ".VAUX.Fan-Tech-Medium.csv"; } } + } - public string[] GetTechnologies() + public sealed class FanHeavyLorries : AbstractFan + { + protected override string ResourceId { - return Data.Keys.Select(x => x.Item2).Distinct().ToArray(); + get { return DeclarationData.DeclarationDataResourcePrefix + ".VAUX.Fan-Tech.csv"; } } - } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Declaration/Payloads.cs b/VectoCore/VectoCore/Models/Declaration/Payloads.cs index c81dda0ec9..ba8c408ab8 100644 --- a/VectoCore/VectoCore/Models/Declaration/Payloads.cs +++ b/VectoCore/VectoCore/Models/Declaration/Payloads.cs @@ -51,7 +51,8 @@ namespace TUGraz.VectoCore.Models.Declaration public Kilogram Lookup10Percent(Kilogram grossVehicleWeight) { - var section = Data.GetSection(d => d.Key > grossVehicleWeight); + var section = Data.GetSection(d => d.Key < grossVehicleWeight); + //var section = Data.GetSection(grossVehicleWeight); return VectoMath.Interpolate(section.Item1.Key, section.Item2.Key, section.Item1.Value.Payload10Percent, section.Item2.Value.Payload10Percent, grossVehicleWeight); @@ -59,7 +60,7 @@ namespace TUGraz.VectoCore.Models.Declaration public Kilogram Lookup50Percent(Kilogram grossVehicleWeight) { - var section = Data.GetSection(d => d.Key > grossVehicleWeight); + var section = Data.GetSection(d => d.Key < grossVehicleWeight); return VectoMath.Interpolate(section.Item1.Key, section.Item2.Key, section.Item1.Value.Payload50Percent, section.Item2.Value.Payload50Percent, grossVehicleWeight); @@ -67,7 +68,7 @@ namespace TUGraz.VectoCore.Models.Declaration public Kilogram Lookup75Percent(Kilogram grossVehicleWeight) { - var section = Data.GetSection(d => d.Key > grossVehicleWeight); + var section = Data.GetSection(d => d.Key < grossVehicleWeight); return VectoMath.Interpolate(section.Item1.Key, section.Item2.Key, section.Item1.Value.Payload75Percent, section.Item2.Value.Payload75Percent, grossVehicleWeight); diff --git a/VectoCore/VectoCore/Models/Declaration/Segments.cs b/VectoCore/VectoCore/Models/Declaration/Segments.cs index fc3df9f232..60c72e87f8 100644 --- a/VectoCore/VectoCore/Models/Declaration/Segments.cs +++ b/VectoCore/VectoCore/Models/Declaration/Segments.cs @@ -67,6 +67,7 @@ namespace TUGraz.VectoCore.Models.Declaration public override Segment Lookup(VehicleCategory vehicleCategory, AxleConfiguration axleConfiguration, Kilogram grossVehicleMassRating, Kilogram curbWeight, bool vocational) { + return Lookup(vehicleCategory, axleConfiguration, grossVehicleMassRating, curbWeight, vocational, false); } @@ -84,23 +85,28 @@ namespace TUGraz.VectoCore.Models.Declaration public Segment Lookup(VehicleCategory vehicleCategory, AxleConfiguration axleConfiguration, Kilogram grossVehicleMassRating, Kilogram curbWeight, bool vocational, bool considerInvalid) { - - var row = GetSegmentDataRow(vehicleCategory, axleConfiguration, grossVehicleMassRating, vocational, considerInvalid); + + var row = GetSegmentDataRow(vehicleCategory, axleConfiguration, grossVehicleMassRating, vocational, considerInvalid); if (row == null) { return new Segment() { Found = false }; } - var segment = new Segment { + var segment = new Segment { Found = true, GrossVehicleWeightMin = row.ParseDouble("tpmlm_min").SI(Unit.SI.Ton).Cast<Kilogram>(), GrossVehicleWeightMax = row.ParseDouble("tpmlm_max").SI(Unit.SI.Ton).Cast<Kilogram>(), VehicleCategory = vehicleCategory, AxleConfiguration = axleConfiguration, VehicleClass = VehicleClassHelper.Parse(row.Field<string>("hdvgroup")), + AccelerationFile = RessourceHelper.ReadStream(DeclarationData.DeclarationDataResourcePrefix + ".VACC." + row.Field<string>(".vaccfile")), Missions = CreateMissions(ref grossVehicleMassRating, curbWeight, row), + + + + VehicleHeight = LookupHeight(vehicleCategory, axleConfiguration, grossVehicleMassRating, vocational), DesignSpeed = row.ParseDouble("designspeed").KMPHtoMeterPerSecond(), GrossVehicleMassRating = grossVehicleMassRating, @@ -117,7 +123,8 @@ namespace TUGraz.VectoCore.Models.Declaration row = _segmentTable.AsEnumerable().First(r => { var isValid = r.Field<string>("valid"); var isVocational = r.Field<string>("vocational").ToBoolean(); - var category = r.Field<string>("vehiclecategory"); + + var category = r.Field<string>("vehiclecategory"); var axleConf = r.Field<string>("axleconf."); var massMin = r.ParseDouble("tpmlm_min").SI(Unit.SI.Ton); var massMax = r.ParseDouble("tpmlm_max").SI(Unit.SI.Ton); @@ -297,7 +304,9 @@ namespace TUGraz.VectoCore.Models.Declaration { var refLoadValue = payloadStr.ToDouble(double.NaN); if (double.IsNaN(refLoadValue)) { - var vehiclePayload = DeclarationData.GetPayloadForGrossVehicleWeight(grossVehicleWeight, payloadStr) + //var testvehiclePayload = DeclarationData.GetPayloadForGrossVehicleWeight(grossVehicleWeight, payloadStr); + + var vehiclePayload = DeclarationData.GetPayloadForGrossVehicleWeight(grossVehicleWeight, payloadStr) .LimitTo(0.SI<Kilogram>(), grossVehicleWeight - vehicleWeight); var trailerPayload = trailers.Sum( t => DeclarationData.GetPayloadForTrailerWeight(t.TrailerGrossVehicleWeight, t.TrailerCurbWeight, lowLoading)) diff --git a/VectoCore/VectoCore/Models/Declaration/VehicleClass.cs b/VectoCore/VectoCore/Models/Declaration/VehicleClass.cs index f058a5d870..027e70f6f7 100644 --- a/VectoCore/VectoCore/Models/Declaration/VehicleClass.cs +++ b/VectoCore/VectoCore/Models/Declaration/VehicleClass.cs @@ -35,7 +35,14 @@ namespace TUGraz.VectoCore.Models.Declaration { public enum VehicleClass { - Class0, + ClassML2r, + ClassML2van, + ClassML3r, + ClassML3van, + ClassML4r, + ClassML4van, + Class1s, + Class0, Class1, Class2, Class3, @@ -58,8 +65,8 @@ namespace TUGraz.VectoCore.Models.Declaration ClassB3, ClassB4, ClassB5, - ClassB6 - } + ClassB6, + } public static class VehicleClassHelper { @@ -74,5 +81,20 @@ namespace TUGraz.VectoCore.Models.Declaration { return hdvClass.ToString().Substring(Prefix.Length); } + + public static bool IsMediumLorry(VehicleClass vehicleClass) + { + switch (vehicleClass) { + case VehicleClass.ClassML2r: + case VehicleClass.ClassML2van: + case VehicleClass.ClassML3r: + case VehicleClass.ClassML3van: + case VehicleClass.ClassML4r: + case VehicleClass.ClassML4van: + return true; + default: + return false; + } + } } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Declaration/WeightingGroups.cs b/VectoCore/VectoCore/Models/Declaration/WeightingGroups.cs index 8cbfddd8cf..59b3a9d21d 100644 --- a/VectoCore/VectoCore/Models/Declaration/WeightingGroups.cs +++ b/VectoCore/VectoCore/Models/Declaration/WeightingGroups.cs @@ -41,7 +41,17 @@ namespace TUGraz.VectoCore.Models.Declaration { public enum WeightingGroup { - Group4UD = 1, + GroupML2r = 1, + GroupML2van, + GroupML3r, + GroupML3van, + GroupML4r, + GroupML4van, + Group1s, + Group1, + Group2, + Group3, + Group4UD, Group4RD, Group4LH, Group5RD, @@ -50,6 +60,9 @@ namespace TUGraz.VectoCore.Models.Declaration Group9LH, Group10RD, Group10LH, + Group11, + Group12, + Group16, Unknown } diff --git a/VectoCore/VectoCore/Resources/Declaration/Body_Trailers_Weights.csv b/VectoCore/VectoCore/Resources/Declaration/Body_Trailers_Weights.csv index e671266386..9842606b93 100644 --- a/VectoCore/VectoCore/Resources/Declaration/Body_Trailers_Weights.csv +++ b/VectoCore/VectoCore/Resources/Declaration/Body_Trailers_Weights.csv @@ -1,20 +1,21 @@ name , curb mass , max gross mass , delta CdxA for trailer operation in long haul , Axle count , Wheels , cargo volume , remark # , [kg] , [kg] , [m²] first trailer/second+ trailer (EMS) , # , , [m³] , +B-II , 800 , - , - , 0 , , 22.6 , --- B1 , 1600 , - , - , 0 , , 36.5 , --- B2 , 1900 , - , - , 0 , , 45.2 , --- B3 , 2000 , - , - , 0 , , 47.7 , --- B4 , 2100 , - , - , 0 , , 49.4 , --- -B5 , 2200 , - , - , 0 , , 51.9 , """B6"" changed to ""B5"" as ""old B5"" not applicable anymore" -BT1 , 2000 , - , - , 0 , , 0.0 , tipper body for construction cycle -BT2 , 3230 , - , - , 0 , , 0.0 , tipper body for construction cycle -BT3 , 4355 , - , - , 0 , , 0.0 , tipper body for construction cycle -MU4 , 6000 , - , - , 0 , , 0.0 , rear collector body -MU9 , 6750 , - , - , 0 , , 0.0 , rear collector body -MU11 , 6750 , - , - , 0 , , 0.0 , rear collector body +B5 , 2200 , - , - , 0 , , 51.9 , " """"""B6"""" changed to """"B5"""" as """"old B5"""" not applicable anymore""" +BT1 , 2000 , - , - , 0 , , 0 , tipper body for construction cycle +BT2 , 3230 , - , - , 0 , , 0 , tipper body for construction cycle +BT3 , 4355 , - , - , 0 , , 0 , tipper body for construction cycle +MU4 , 6000 , - , - , 0 , , 0 , rear collector body +MU9 , 6750 , - , - , 0 , , 0 , rear collector body +MU11 , 6750 , - , - , 0 , , 0 , rear collector body T1 , 3400 , 10500 , 1.3 , 2 , 235/75 R17.5 , 39.8 , T2 , 5400 , 18000 , 1.5/1.5 , 2 , 385/65 R22.5 , 49.5 , -ST1 , 7500 , 24000 , 0/2.1 , 3 , 385/65 R22.5 , 91.0 , relevant for fully loaded is GVM of tractor semitrailer combination = 40000kg -ST1-v2 , 7500 , - , 0/2.1 , 3 , 385/65 R22.5 , 91.0 , -Dolly , 2500 , 12000 , 0/0 , 2 , 315/70 R22.5 , 0.0 , only relevant for EMS -STT1 , 6100 , 24000 , 0/0 , 3 , 385/65 R22.5 , 0.0 , tipper semitrailer for construction cycle -STT2 , 5600 , 18000 , 0/0 , 2 , 385/65 R22.5 , 0.0 , tipper semitrailer for construction cycle \ No newline at end of file +ST1 , 7500 , 24000 , 0/2.1 , 3 , 385/65 R22.5 , 91 , relevant for fully loaded is GVM of tractor semitrailer combination = 40000kg +ST1-v2 , 7500 , - , 0/2.1 , 3 , 385/65 R22.5 , 91 , +Dolly , 2500 , 12000 , 0/0 , 2 , 315/70 R22.5 , 0 , only relevant for EMS +STT1 , 6100 , 24000 , 0/0 , 3 , 385/65 R22.5 , 0 , tipper semitrailer for construction cycle +STT2 , 5600 , 18000 , 0/0 , 2 , 385/65 R22.5 , 0 , tipper semitrailer for construction cycle diff --git a/VectoCore/VectoCore/Resources/Declaration/CO2Standards/MissionProfileWeights.csv b/VectoCore/VectoCore/Resources/Declaration/CO2Standards/MissionProfileWeights.csv index bf79586e49..018c9fed94 100644 --- a/VectoCore/VectoCore/Resources/Declaration/CO2Standards/MissionProfileWeights.csv +++ b/VectoCore/VectoCore/Resources/Declaration/CO2Standards/MissionProfileWeights.csv @@ -1,10 +1,23 @@ -Weighting Group , LongHaul , LongHaul EMS , Regional Delivery , Regional Delivery EMS , Urban Delivery , Municipal Utility , Construction -4-UD , 0/0 , 0/0 , 0/0 , 0/0 , 0.5/0.5 , 0/0 , 0/0 -4-RD , 0.05/0.05 , 0/0 , 0.45/0.45 , 0/0 , 0/0 , 0/0 , 0/0 -4-LH , 0.45/0.45 , 0/0 , 0.05/0.05 , 0/0 , 0/0 , 0/0 , 0/0 -5-RD , 0.03/0.07 , 0/0 , 0.27/0.63 , 0/0 , 0/0 , 0/0 , 0/0 -5-LH , 0.27/0.63 , 0/0 , 0.03/0.07 , 0/0 , 0/0 , 0/0 , 0/0 -9-RD , 0.03/0.07 , 0/0 , 0.27/0.63 , 0/0 , 0/0 , 0/0 , 0/0 -9-LH , 0.27/0.63 , 0/0 , 0.03/0.07 , 0/0 , 0/0 , 0/0 , 0/0 -10-RD , 0.03/0.07 , 0/0 , 0.27/0.63 , 0/0 , 0/0 , 0/0 , 0/0 -10-LH , 0.27/0.63 , 0/0 , 0.03/0.07 , 0/0 , 0/0 , 0/0 , 0/0 \ No newline at end of file +Weighting Group , LongHaul , LongHaul EMS , Regional Delivery , Regional Delivery EMS , Urban Delivery , Municipal Utility , Construction +ML2r , 0/0 , 0/0 , 0.25/0.25 , 0/0 , 0.25/0.25 , 0/0 , 0/0 +ML2van , 0/0 , 0/0 , 0.25/0.25 , 0/0 , 0.25/0.25 , 0/0 , 0/0 +ML3r , 0/0 , 0/0 , 0.25/0.25 , 0/0 , 0.25/0.25 , 0/0 , 0/0 +ML3van , 0/0 , 0/0 , 0.25/0.25 , 0/0 , 0.25/0.25 , 0/0 , 0/0 +ML4r , 0/0 , 0/0 , 0.25/0.25 , 0/0 , 0.25/0.25 , 0/0 , 0/0 +ML4van , 0/0 , 0/0 , 0.25/0.25 , 0/0 , 0.25/0.25 , 0/0 , 0/0 +1s , 0/0 , 0/0 , 0.1/0.4 , 0/0 , 0.15/0.35 , 0/0 , 0/0 +1 , 0/0 , 0/0 , 0.1/0.4 , 0/0 , 0.15/0.35 , 0/0 , 0/0 +2 , 0.06/0.14 , 0/0 , 0.06/0.24 , 0/0 , 0.15/0.35 , 0/0 , 0/0 +3 , 0/0 , 0/0 , 0.1/0.4 , 0/0 , 0.15/0.35 , 0/0 , 0/0 +4-UD , 0/0 , 0/0 , 0/0 , 0/0 , 0.5/0.5 , 0/0 , 0/0 +4-RD , 0.05/0.05 , 0/0 , 0.45/0.45 , 0/0 , 0/0 , 0/0 , 0/0 +4-LH , 0.45/0.45 , 0/0 , 0.05/0.05 , 0/0 , 0/0 , 0/0 , 0/0 +5-RD , 0.03/0.07 , 0/0 , 0.27/0.63 , 0/0 , 0/0 , 0/0 , 0/0 +5-LH , 0.27/0.63 , 0/0 , 0.03/0.07 , 0/0 , 0/0 , 0/0 , 0/0 +9-RD , 0.03/0.07 , 0/0 , 0.27/0.63 , 0/0 , 0/0 , 0/0 , 0/0 +9-LH , 0.27/0.63 , 0/0 , 0.03/0.07 , 0/0 , 0/0 , 0/0 , 0/0 +10-RD , 0.03/0.07 , 0/0 , 0.27/0.63 , 0/0 , 0/0 , 0/0 , 0/0 +10-LH , 0.27/0.63 , 0/0 , 0.03/0.07 , 0/0 , 0/0 , 0/0 , 0/0 +11 , 0.01/0.02 , 0/0 , 0.11/0.25 , 0/0 , 0/0 , 0.08/0.19 , 0.09/0.25 +12 , 0.16/0.36 , 0/0 , 0.03/0.07 , 0/0 , 0/0 , 0/0 , 0.11/0.27 +16 , 0/0 , 0/0 , 0/0 , 0/0 , 0/0 , 0/0 , 0.30/0.70 diff --git a/VectoCore/VectoCore/Resources/Declaration/CO2Standards/WeightingGroups.csv b/VectoCore/VectoCore/Resources/Declaration/CO2Standards/WeightingGroups.csv index 475eba6838..14d5ee8582 100644 --- a/VectoCore/VectoCore/Resources/Declaration/CO2Standards/WeightingGroups.csv +++ b/VectoCore/VectoCore/Resources/Declaration/CO2Standards/WeightingGroups.csv @@ -1,4 +1,24 @@ -Vehicle Group , Cabin Type , Engine Rated Power Min [kw] , Engine Rated Power Max [kW] , Weighting Group +Vehicle Group , Cabin Type , Engine Rated Power Min [kw] , Engine Rated Power Max [kW] , Weighting Group +ML2r , DayCab , 0 , 999999 , ML2r +ML2r , SleeperCab , 0 , 999999 , ML2r +ML2van , DayCab , 0 , 999999 , ML2van +ML2van , SleeperCab , 0 , 999999 , ML2van +ML3r , DayCab , 0 , 999999 , ML3r +ML3r , SleeperCab , 0 , 999999 , ML3r +ML3van , DayCab , 0 , 999999 , ML3van +ML3van , SleeperCab , 0 , 999999 , ML3van +ML4r , DayCab , 0 , 999999 , ML4r +ML4r , SleeperCab , 0 , 999999 , ML4r +ML4van , DayCab , 0 , 999999 , ML4van +ML4van , SleeperCab , 0 , 999999 , ML4van +1s , DayCab , 0 , 999999 , 1s +1s , SleeperCab , 0 , 999999 , 1s +1 , DayCab , 0 , 999999 , 1 +1 , SleeperCab , 0 , 999999 , 1 +2 , DayCab , 0 , 999999 , 2 +2 , SleeperCab , 0 , 999999 , 2 +3 , DayCab , 0 , 999999 , 3 +3 , SleeperCab , 0 , 999999 , 3 4 , DayCab , 0 , 170 , 4-UD 4 , SleeperCab , 0 , 170 , 4-UD 4 , DayCab , 170 , 999999 , 4-RD @@ -10,4 +30,10 @@ 9 , DayCab , 0 , 999999 , 9-RD 9 , SleeperCab , 0 , 999999 , 9-LH 10 , DayCab , 0 , 999999 , 10-RD -10 , SleeperCab , 0 , 999999 , 10-LH \ No newline at end of file +10 , SleeperCab , 0 , 999999 , 10-LH +11 , DayCab , 0 , 999999 , 11 +11 , SleeperCab , 0 , 999999 , 11 +12 , DayCab , 0 , 999999 , 12 +12 , SleeperCab , 0 , 999999 , 12 +16 , DayCab , 0 , 999999 , 16 +16 , SleeperCab , 0 , 999999 , 16 diff --git a/VectoCore/VectoCore/Resources/Declaration/Payloads.csv b/VectoCore/VectoCore/Resources/Declaration/Payloads.csv index 711ef50d78..afbfcac7c1 100644 --- a/VectoCore/VectoCore/Resources/Declaration/Payloads.csv +++ b/VectoCore/VectoCore/Resources/Declaration/Payloads.csv @@ -1,3 +1,5 @@ -Gross Vehicle Weight,Payload 10%,Payload 50%,Payload 75% -7500,250,1250,1900 -16000,920,4600,6900 +Gross Vehicle Weight , Payload 10% , Payload 50% , Payload 75% +3500 , 80 , 420 , 630 +7400 , 240 , 1210 , 1840 +7500 , 250 , 1250 , 1900 +16000 , 920 , 4600 , 6900 diff --git a/VectoCore/VectoCore/Resources/Declaration/SegmentTable.csv b/VectoCore/VectoCore/Resources/Declaration/SegmentTable.csv index ed09601ea6..5d670e449e 100644 --- a/VectoCore/VectoCore/Resources/Declaration/SegmentTable.csv +++ b/VectoCore/VectoCore/Resources/Declaration/SegmentTable.csv @@ -1,5 +1,15 @@ HDV group , Vocational , Valid , Vehicle Category , Axle Conf. , TPMLM_Min , TPMLM_Max , Height , DesignSpeed , Body , Body Construction , Body MunicipalUtility , Trailer , Trailer Construction , EMS , .vacc file , Cross Wind Correction - Long haul , Cross Wind Correction - EMS , Cross Wind Correction - Other , Truck Axles - Long haul , Truck Axles - Other , Trailer Axles - Long haul , Trailer Axles - Other , Truck Axles - Long haul EMS , Truck Axles - Other EMS , Trailer Axles - Long haul EMS , Trailer Axles - Other EMS , Long haul , Long haul EMS , Regional delivery , Regional delivery EMS , Urban delivery , Municipal utility , Construction , Heavy Urban , Urban , Suburban , Interurban , Coach , CdxA_Default , CdxA_Construction -## 0 , 0 , 0 , RigidTruck , 4x2 , 0 , 7.5 , 4 , 85 , , , , , , , Truck.vacc , , , RigidSolo , , , , , , , , , - , , pc10(R)/pc50(R) , , pc10(R)/pc50(R) , - , - , - , - , - , - , - , , +ML2r , 0 , 1 , RigidTruck , 4x2F , 5 , 7.4 , 3.5 , 85 , B-II , , , , , , Truck.vacc , , , MediumLorriesRigid , , 45/55 , , , , , , , - , - , pc10(R)/pc50(R) , - , pc10(R)/pc50(R) , - , - , - , - , - , - , - , 5.8 , +ML2r , 0 , 1 , Tractor , 4x2F , 5 , 7.4 , 3.5 , 85 , B-II , , , , , , Truck.vacc , , , MediumLorriesRigid , , 45/55 , , , , , , , - , - , pc10(R)/pc50(R) , - , pc10(R)/pc50(R) , - , - , - , - , - , - , - , 5.8 , +ML2van , 0 , 1 , Van , 4x2F , 5 , 7.4 , 2.9 , 85 , , , , , , , Truck.vacc , , , MediumLorriesVan , , 45/55 , , , , , , , - , - , pc10(V)/pc50(V) , - , pc10(V)/pc50(V) , - , - , - , - , - , - , - , 2.5 , +ML3r , 0 , 1 , RigidTruck , 4x2 , 5 , 7.4 , 3.5 , 85 , B-II , , , , , , Truck.vacc , , , MediumLorriesRigid , , 45/55 , , , , , , , - , - , pc10(R)/pc50(R) , - , pc10(R)/pc50(R) , - , - , - , - , - , - , - , 5.8 , +ML3r , 0 , 1 , Tractor , 4x2 , 5 , 7.4 , 3.5 , 85 , B-II , , , , , , Truck.vacc , , , MediumLorriesRigid , , 45/55 , , , , , , , - , - , pc10(R)/pc50(R) , - , pc10(R)/pc50(R) , - , - , - , - , - , - , - , 5.8 , +ML3van , 0 , 1 , Van , 4x2 , 5 , 7.4 , 2.9 , 85 , , , , , , , Truck.vacc , , , MediumLorriesVan , , 45/55 , , , , , , , - , - , pc10(V)/pc50(V) , - , pc10(V)/pc50(V) , - , - , - , - , - , - , - , 2.5 , +ML4r , 0 , 1 , RigidTruck , 4x4 , 5 , 7.4 , 3.5 , 85 , B-II , , , , , , Truck.vacc , , , MediumLorriesRigid , , 45/55 , , , , , , , - , - , pc10(R)/pc50(R) , - , pc10(R)/pc50(R) , - , - , - , - , - , - , - , 5.8 , +ML4r , 0 , 1 , Tractor , 4x4 , 5 , 7.4 , 3.5 , 85 , B-II , , , , , , Truck.vacc , , , MediumLorriesRigid , , 45/55 , , , , , , , - , - , pc10(R)/pc50(R) , - , pc10(R)/pc50(R) , - , - , - , - , - , - , - , 5.8 , +ML4van , 0 , 1 , Van , 4x4 , 5 , 7.4 , 2.9 , 85 , , , , , , , Truck.vacc , , , MediumLorriesVan , , 45/55 , , , , , , , - , - , pc10(V)/pc50(V) , - , pc10(V)/pc50(V) , - , - , - , - , - , - , - , 2.5 , +1s , 0 , 1 , RigidTruck , 4x2 , 7.4 , 7.5 , 3.6 , 85 , B1 , , , , , , Truck.vacc , , , RigidSolo , , 45/55 , , , , , , , - , - , pc10(R)/pc50(R) , - , pc10(R)/pc50(R) , - , - , - , - , - , - , - , 7.1 , +1s , 0 , 1 , Tractor , 4x2 , 7.4 , 7.5 , 3.6 , 85 , B1 , , , , , , Truck.vacc , , , RigidSolo , , 45/55 , , , , , , , - , - , pc10(R)/pc50(R) , - , pc10(R)/pc50(R) , - , - , - , - , - , - , - , 7.1 , 1 , 0 , 1 , RigidTruck , 4x2 , 7.5 , 10 , 3.6 , 85 , B1 , , , , , , Truck.vacc , , , RigidSolo , , 45/55 , , , , , , , - , - , pc10(R)/pc50(R) , - , pc10(R)/pc50(R) , - , - , - , - , - , - , - , 7.1 , 1 , 0 , 1 , Tractor , 4x2 , 7.5 , 10 , 3.6 , 85 , B1 , , , , , , Truck.vacc , , , RigidSolo , , 45/55 , , , , , , , - , - , pc10(R)/pc50(R) , - , pc10(R)/pc50(R) , - , - , - , - , - , - , - , 7.1 , 2 , 0 , 1 , RigidTruck , 4x2 , 10 , 12 , 3.75 , 85 , B2 , , , T1 , , , Truck.vacc , RigidTrailer , , RigidSolo , 22.5/32.5 , 45/55 , 45 , , , , , , pc10(R)/pc75(R) , - , pc10(R)/pc50(R) , - , pc10(R)/pc50(R) , - , - , - , - , - , - , - , 7.2 , @@ -30,4 +40,4 @@ B2 , 0 , 0 , InterurbanBus , 4x2 , 0 , 18 B3 , 0 , 0 , Coach , 4x2 , 0 , 18 , 4 , 85 , , , , , , , , , , CoachBus , , , , , , , , , - , - , - , - , - , - , - , - , - , - , - , ??? , , B4 , 0 , 0 , CityBus , 6x2 , 18 , 99 , 4 , 85 , , , , , , , , , , CoachBus , , , , , , , , , - , - , - , - , - , - , - , ??? , ??? , ??? , - , - , , B5 , 0 , 0 , InterurbanBus , 6x2 , 18 , 99 , 4 , 85 , , , , , , , , , , CoachBus , , , , , , , , , - , - , - , - , - , - , - , - , - , - , ??? , - , , -B6 , 0 , 0 , Coach , 6x2 , 18 , 99 , 4 , 85 , , , , , , , , , , CoachBus , , , , , , , , , - , - , - , - , - , - , - , - , - , - , - , ??? , , \ No newline at end of file +B6 , 0 , 0 , Coach , 6x2 , 18 , 99 , 4 , 85 , , , , , , , , , , CoachBus , , , , , , , , , - , - , - , - , - , - , - , - , - , - , - , ??? , , diff --git a/VectoCore/VectoCore/Resources/Declaration/VAUX/Fan-Tech-Medium.csv b/VectoCore/VectoCore/Resources/Declaration/VAUX/Fan-Tech-Medium.csv new file mode 100644 index 0000000000..4e2f1ebc32 --- /dev/null +++ b/VectoCore/VectoCore/Resources/Declaration/VAUX/Fan-Tech-Medium.csv @@ -0,0 +1,12 @@ +Technology , fully electric , Long haul , Regional delivery , Urban delivery , Municipal utility , Construction +Crankshaft mounted - Electronically controlled visco clutch , 0 , 0 , 258 , 198 , 0 , 0 +Crankshaft mounted - Bimetallic controlled visco clutch , 0 , 0 , 335 , 260 , 0 , 0 +Crankshaft mounted - Discrete step clutch , 0 , 0 , 277 , 237 , 0 , 0 +Crankshaft mounted - On/off clutch , 0 , 0 , 297 , 256 , 0 , 0 +Belt driven or driven via transm. - Electronically controlled visco clutch , 0 , 0 , 402 , 320 , 0 , 0 +Belt driven or driven via transm. - Bimetallic controlled visco clutch , 0 , 0 , 478 , 382 , 0 , 0 +Belt driven or driven via transm. - Discrete step clutch , 0 , 0 , 421 , 378 , 0 , 0 +Belt driven or driven via transm. - On/off clutch , 0 , 0 , 440 , 397 , 0 , 0 +Hydraulic driven - Variable displacement pump , 0 , 0 , 444 , 320 , 0 , 0 +Hydraulic driven - Constant displacement pump , 0 , 0 , 538 , 385 , 0 , 0 +Electrically driven - Electronically controlled , 0 , 0 , 308 , 231 , 0 , 0 diff --git a/VectoCore/VectoCore/Resources/Declaration/VAUX/HVAC-Table.csv b/VectoCore/VectoCore/Resources/Declaration/VAUX/HVAC-Table.csv index 2c85457340..81f45a5abf 100644 --- a/VectoCore/VectoCore/Resources/Declaration/VAUX/HVAC-Table.csv +++ b/VectoCore/VectoCore/Resources/Declaration/VAUX/HVAC-Table.csv @@ -1,4 +1,12 @@ Technology , HDV Group , Long haul , Regional delivery , Urban delivery , Municipal utility , Construction +None , ML2r , 0 , 0 , 0 , 0 , 0 +None , ML2van , 0 , 0 , 0 , 0 , 0 +None , ML3r , 0 , 0 , 0 , 0 , 0 +None , ML3van , 0 , 0 , 0 , 0 , 0 +None , ML4r , 0 , 0 , 0 , 0 , 0 +None , ML4van , 0 , 0 , 0 , 0 , 0 +# , , , , , , +None , 1s , 0 , 0 , 0 , 0 , 0 None , 1 , 0 , 0 , 0 , 0 , 0 None , 2 , 0 , 0 , 0 , 0 , 0 None , 3 , 0 , 0 , 0 , 0 , 0 @@ -6,10 +14,18 @@ None , 4 , 0 , 0 , 0 , 0 None , 5 , 0 , 0 , 0 , 0 , 0 None , 9 , 0 , 0 , 0 , 0 , 0 None , 10 , 0 , 0 , 0 , 0 , 0 -None , 11 , 0 , 0 , 0 , 0 , 0 +None , 11 , 0 , 0 , 0 , 0 , 0 None , 12 , 0 , 0 , 0 , 0 , 0 None , 16 , 0 , 0 , 0 , 0 , 0 -# +# , , , , , , +Default , ML2r , , 150 , 150 , , +Default , ML2van , , 150 , 150 , , +Default , ML3r , , 150 , 150 , , +Default , ML3van , , 150 , 150 , , +Default , ML4r , , 150 , 150 , , +Default , ML4van , , 150 , 150 , , +# , , , , , , +Default , 1s , , 150 , 150 , , Default , 1 , , 150 , 150 , , Default , 2 , 200 , 200 , 150 , , Default , 3 , , 200 , 150 , , diff --git a/VectoCore/VectoCore/Resources/Declaration/VAUX/SP-Table.csv b/VectoCore/VectoCore/Resources/Declaration/VAUX/SP-Table.csv index b769bdae86..47c8b717ef 100644 --- a/VectoCore/VectoCore/Resources/Declaration/VAUX/SP-Table.csv +++ b/VectoCore/VectoCore/Resources/Declaration/VAUX/SP-Table.csv @@ -1,4 +1,11 @@ HDV Group , Long haul , Regional delivery , Urban delivery , Municipal utility , Construction +ML2r , , 90/10/10 , 80/10/10 , , +ML2van , , 90/10/10 , 80/10/10 , , +ML3r , , 90/10/10 , 80/10/10 , , +ML3van , , 90/10/10 , 80/10/10 , , +ML4r , , 90/10/10 , 80/10/10 , , +ML4van , , 90/10/10 , 80/10/10 , , +1s , , 240/20/20 , 220/20/30 , , 1 , , 240/20/20 , 220/20/30 , , 2 , 340/30/0 , 290/30/20 , 260/20/30 , , 3 , , 310/30/30 , 280/30/40 , , @@ -11,4 +18,4 @@ HDV Group , Long haul , Regional delivery , Urban delivery , Municipal utility , 10 , 450/120/0 , 440/90/40 , , , 640/50/80 11 , 600/120/0 , 490/60/40 , , 430/30/50 , 640/50/80 12 , 450/120/0 , 440/90/40 , , , 640/50/80 -16 , , , , , 640/50/80 \ No newline at end of file +16 , , , , , 640/50/80 diff --git a/VectoCore/VectoCore/Resources/Declaration/VCDV/VCDV_parameters.csv b/VectoCore/VectoCore/Resources/Declaration/VCDV/VCDV_parameters.csv index 99ddf04bd3..b4971f0bfd 100644 --- a/VectoCore/VectoCore/Resources/Declaration/VCDV/VCDV_parameters.csv +++ b/VectoCore/VectoCore/Resources/Declaration/VCDV/VCDV_parameters.csv @@ -1,5 +1,7 @@ -Parameters,a1,a2,a3 -RigidSolo,0.013526,0.017746,-0.000666 -RigidTrailer,0.017125,0.072275,-0.004148 -TractorSemitrailer,0.030042,0.040817,-0.00213 -CoachBus,-0.000794,0.02109,-0.00109 +Parameters , a1 , a2 , a3 +RigidSolo , 0.013526 , 0.017746 , -0.000666 +RigidTrailer , 0.017125 , 0.072275 , -0.004148 +TractorSemitrailer , 0.030042 , 0.040817 , -0.00213 +CoachBus , -0.000794 , 0.02109 , -0.00109 +MediumLorriesRigid , -0.0015 , 0.0086 , -0.00029 +MediumLorriesVan , 0.0032 , 0.00532 , -0.00028 diff --git a/VectoCore/VectoCore/VectoCore.csproj b/VectoCore/VectoCore/VectoCore.csproj index 2c1299b072..9544c9cab9 100644 --- a/VectoCore/VectoCore/VectoCore.csproj +++ b/VectoCore/VectoCore/VectoCore.csproj @@ -522,6 +522,11 @@ <Compile Include="Utils\XMLValidator.cs" /> <Compile Include="Utils\XPathHelper.cs" /> <Compile Include="Ninject\VectoNinjectModule.cs" /> + <Compile Include="VersionNumber1.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>VersionNumber.t4</DependentUpon> + </Compile> </ItemGroup> <ItemGroup> <None Include="app.config" /> @@ -697,6 +702,7 @@ <EmbeddedResource Include="Resources\XSD\VectoEngineeringDefinitions.1.1.xsd"> <SubType>Designer</SubType> </EmbeddedResource> + <EmbeddedResource Include="Resources\Declaration\VAUX\Fan-Tech-Medium.csv" /> <None Include="Utils\VectoVersionCore.tt"> <Generator>TextTemplatingFileGenerator</Generator> <LastGenOutput>VectoVersionCore.cs</LastGenOutput> @@ -719,24 +725,23 @@ <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" /> </ItemGroup> <ItemGroup> - <ProjectReference Include="..\..\VectoCommon\AdvancedAuxiliaryInterfaces\AdvancedAuxiliaryInterfaces.vbproj"> - <Project>{b4b9bd2f-fd8f-4bb8-82fa-e2154d2c7fbd}</Project> - <Name>AdvancedAuxiliaryInterfaces</Name> - </ProjectReference> <ProjectReference Include="..\..\VECTOAux\VectoAuxiliaries\VectoAuxiliaries.vbproj"> <Project>{fdeee460-0b8a-4ef6-8d9e-72f203a50f65}</Project> <Name>VectoAuxiliaries</Name> </ProjectReference> + <ProjectReference Include="..\..\VectoCommon\AdvancedAuxiliaryInterfaces\AdvancedAuxiliaryInterfaces.vbproj"> + <Project>{b4b9bd2f-fd8f-4bb8-82fa-e2154d2c7fbd}</Project> + <Name>AdvancedAuxiliaryInterfaces</Name> + </ProjectReference> <ProjectReference Include="..\..\VectoCommon\VectoCommon\VectoCommon.csproj"> <Project>{79a066ad-69a9-4223-90f6-6ed5d2d084f4}</Project> <Name>VectoCommon</Name> </ProjectReference> <ProjectReference Include="..\..\VectoCommon\VectoHashing\VectoHashing.csproj"> - <Project>{B673E12F-D323-4C4C-8805-9915B2C72D3D}</Project> + <Project>{b673e12f-d323-4c4c-8805-9915b2c72d3d}</Project> <Name>VectoHashing</Name> </ProjectReference> </ItemGroup> - <ItemGroup /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. diff --git a/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs b/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs index 1f0d41ea4c..f7354b8918 100644 --- a/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs +++ b/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs @@ -48,2068 +48,2237 @@ using TUGraz.VectoCore.Tests.Utils; namespace TUGraz.VectoCore.Tests.Models.Declaration { - [TestFixture] - public class DeclarationDataTest - { - private const double Tolerance = 0.0001; - - private readonly MissionType[] _missions = { - MissionType.LongHaul, - MissionType.RegionalDelivery, - MissionType.UrbanDelivery, - MissionType.MunicipalUtility, - MissionType.Construction, - }; - - [OneTimeSetUp] - public void RunBeforeAnyTests() - { - Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory); - } - - - [TestCase("285/60 R22.5", 10.6, 0.914, 3.03, 0.440766), - TestCase("285/70 R19.5", 7.9, 0.895, 3.05, 0.434453), - TestCase("395/85 R20", 27.9, 1.18, 3.05, 0.572798)] - public void WheelDataTest(string wheels, double inertia, double wheelsDiameter, double circumferenceFactor, - double expectedDynamicRadius) - { - var tmp = DeclarationData.Wheels.Lookup(wheels); - - AssertHelper.AreRelativeEqual(inertia, tmp.Inertia); - AssertHelper.AreRelativeEqual(wheelsDiameter, tmp.WheelsDiameter); - AssertHelper.AreRelativeEqual(circumferenceFactor, tmp.CircumferenceFactor); - Assert.AreEqual(expectedDynamicRadius, tmp.DynamicTyreRadius.Value(), 1e-6); - } - - [ - // fixed points - TestCase(400, 0), - TestCase(800, 0.47), - TestCase(1000, 0.58), - TestCase(1200, 0.53), - TestCase(1400, 0.46), - TestCase(1500, 0.43), - TestCase(1750, 0.22), - TestCase(1800, 0.2), - TestCase(2000, 0.11), - TestCase(2500, 0.11), - // interpolate - TestCase(600, 0.235), - TestCase(900, 0.525), - TestCase(1100, 0.555), - TestCase(1300, 0.495), - TestCase(1450, 0.445), - TestCase(1625, 0.325), - TestCase(1775, 0.21), - TestCase(1900, 0.155), - TestCase(2250, 0.11), - ] - public void PT1Test(double rpm, double expectedPt1) - { - var pt1 = DeclarationData.PT1.Lookup(rpm.RPMtoRad()); - Assert.AreEqual(expectedPt1, pt1.Value.Value(), Tolerance); - Assert.IsFalse(pt1.Extrapolated); - } - - [TestCase(200), - TestCase(0), - TestCase(13000),] - public void PT1ExceptionsTest(double rpm) - { - // EXTRAPOLATE - var tmp = DeclarationData.PT1.Lookup(rpm.RPMtoRad()); - Assert.IsTrue(tmp.Extrapolated); - } - - [TestCase] - public void WHTCTest() - { - var whtc = DeclarationData.WHTCCorrection; - - var factors = new { - urban = new[] { 0.11, 0.17, 0.69, 0.98, 0.62, 1.0, 1.0, 1.0, 0.45, 0.0 }, - rural = new[] { 0.0, 0.3, 0.27, 0.0, 0.32, 0.0, 0.0, 0.0, 0.36, 0.22 }, - motorway = new[] { 0.89, 0.53, 0.04, 0.02, 0.06, 0.0, 0.0, 0.0, 0.19, 0.78 } - }; - - var r = new Random(); - for (var i = 0; i < _missions.Length; i++) { - var urban = r.NextDouble() * 2; - var rural = r.NextDouble() * 2; - var motorway = r.NextDouble() * 2; - var whtcValue = whtc.Lookup(_missions[i], rural: rural, urban: urban, motorway: motorway); - Assert.AreEqual(urban * factors.urban[i] + rural * factors.rural[i] + motorway * factors.motorway[i], - whtcValue); - } - } - - [TestCase] - public void WHTCLookupTestLongHaul() - { - var expected = 1.015501; - - var rural = 1.0265; - var urban = 1.0948; - var motorway = 1.0057; - - var lookup = DeclarationData.WHTCCorrection.Lookup(MissionType.LongHaul, rural: rural, urban: urban, - motorway: motorway); - Assert.AreEqual(expected, lookup, 1e-8); - } - - [TestCase] - public void WHTCLookupTestRegionalDelivery() - { - var expected = 1.02708700; - - var rural = 1.0265; - var urban = 1.0948; - var motorway = 1.0057; - - var lookup = DeclarationData.WHTCCorrection.Lookup(MissionType.RegionalDelivery, rural: rural, urban: urban, - motorway: motorway); - Assert.AreEqual(expected, lookup, 1e-8); - } - - [TestCase("RigidSolo", 0.013526, 0.017746, -0.000666), - TestCase("RigidTrailer", 0.017125, 0.072275, -0.004148), - TestCase("TractorSemitrailer", 0.030042, 0.040817, -0.00213), - TestCase("CoachBus", -0.000794, 0.02109, -0.00109)] - public void AirDrag_WithStringKey(string key, double a1, double a2, double a3) - { - var value = DeclarationData.AirDrag.Lookup(key); - AssertHelper.AreRelativeEqual(a1, value.A1); - AssertHelper.AreRelativeEqual(a2, value.A2); - AssertHelper.AreRelativeEqual(a3, value.A3); - } - - [TestCase("RigidSolo", 0.013526, 0.017746, -0.000666), - TestCase("TractorSemitrailer", 0.030042, 0.040817, -0.00213), - TestCase("RigidTrailer", 0.017125, 0.072275, -0.004148), - TestCase("CoachBus", -0.000794, 0.02109, -0.00109)] - public void AirDrag_WithVehicleCategory(string parameterSet, double a1, double a2, double a3) - { - var value = DeclarationData.AirDrag.Lookup(parameterSet); - AssertHelper.AreRelativeEqual(a1, value.A1); - AssertHelper.AreRelativeEqual(a2, value.A2); - AssertHelper.AreRelativeEqual(a3, value.A3); - } - - [TestCase("TractorSemitrailer", 6.46, 0, 4.0, 7.71712257), - TestCase("TractorSemitrailer", 6.46, 60, 4.0, 7.71712257), - TestCase("TractorSemitrailer", 6.46, 75, 3.75, 7.35129203), - TestCase("TractorSemitrailer", 6.46, 100, 4.0, 7.03986404), - TestCase("TractorSemitrailer", 6.46, 62.1234, 4.0, 7.65751048), - TestCase("TractorSemitrailer", 6.46, 73.5432, 3.75, 7.37814098), - TestCase("TractorSemitrailer", 6.46, 92.8765, 4.0, 7.11234364), - TestCase("TractorSemitrailer", 6.46, 100.449, 4.0, 7.03571556), - TestCase("TractorSemitrailer", 6.46, 103, 3.6, 6.99454230), - TestCase("TractorSemitrailer", 6.46, 105, 3.9, 6.99177143), - TestCase("TractorSemitrailer", 6.46, 115, 4.0, 6.92267778), - TestCase("TractorSemitrailer", 6.46, 130, 4.0, 6.83867361),] - public void CrossWindCorrectionTest(string parameterSet, double crossSectionArea, double kmph, double height, - double expected) - { - var crossWindCorrectionCurve = new CrosswindCorrectionCdxALookup(crossSectionArea.SI<SquareMeter>(), - DeclarationDataAdapter.GetDeclarationAirResistanceCurve(parameterSet, crossSectionArea.SI<SquareMeter>(), - height.SI<Meter>()), - CrossWindCorrectionMode.DeclarationModeCorrection); - - var tmp = crossWindCorrectionCurve.EffectiveAirDragArea(kmph.KMPHtoMeterPerSecond()); - AssertHelper.AreRelativeEqual(expected, tmp.Value(), toleranceFactor: 1e-3); - } - - [TestCase("TractorSemitrailer", 5.8, 4.0)] - public void CrossWindGetDeclarationAirResistance(string parameterSet, double cdxa0, double height) - { - var curve = - DeclarationDataAdapter.GetDeclarationAirResistanceCurve(parameterSet, cdxa0.SI<SquareMeter>(), height.SI<Meter>()); - - AssertHelper.AreRelativeEqual(60.KMPHtoMeterPerSecond(), curve[1].Velocity); - AssertHelper.AreRelativeEqual(7.0418009.SI<SquareMeter>(), curve[1].EffectiveCrossSectionArea); - - AssertHelper.AreRelativeEqual(65.KMPHtoMeterPerSecond(), curve[2].Velocity); - AssertHelper.AreRelativeEqual(6.90971991.SI<SquareMeter>(), curve[2].EffectiveCrossSectionArea); - - AssertHelper.AreRelativeEqual(85.KMPHtoMeterPerSecond(), curve[6].Velocity); - AssertHelper.AreRelativeEqual(6.54224222.SI<SquareMeter>(), curve[6].EffectiveCrossSectionArea); - - AssertHelper.AreRelativeEqual(100.KMPHtoMeterPerSecond(), curve[9].Velocity); - AssertHelper.AreRelativeEqual(6.37434824.SI<SquareMeter>(), curve[9].EffectiveCrossSectionArea); - - AssertHelper.AreRelativeEqual(105.KMPHtoMeterPerSecond(), curve[10].Velocity); - AssertHelper.AreRelativeEqual(6.33112792.SI<SquareMeter>(), curve[10].EffectiveCrossSectionArea); - - Assert.Greater(20, curve.Count); - } - - [ - TestCase("TractorSemitrailer", 6.46, -0.1, 3.0), - TestCase("TractorSemitrailer", 6.46, 130.1, 3.0), - ] - public void CrossWindCorrectionExceptionTest(string parameterSet, double crossSectionArea, double kmph, double height) - { - var crossWindCorrectionCurve = new CrosswindCorrectionCdxALookup(crossSectionArea.SI<SquareMeter>(), - DeclarationDataAdapter.GetDeclarationAirResistanceCurve(parameterSet, crossSectionArea.SI<SquareMeter>(), - height.SI<Meter>()), - CrossWindCorrectionMode.DeclarationModeCorrection); - - AssertHelper.Exception<VectoException>(() => - crossWindCorrectionCurve.EffectiveAirDragArea(kmph.KMPHtoMeterPerSecond())); - } - - [TestCase] - public void CrossWindAreaCdxANotSet_DeclarationMode() - { - var airDrag = new AirdragData() { - CrossWindCorrectionMode = CrossWindCorrectionMode.DeclarationModeCorrection, - CrossWindCorrectionCurve = - new CrosswindCorrectionCdxALookup(null, null, CrossWindCorrectionMode.DeclarationModeCorrection) - }; - - Assert.IsTrue(airDrag.IsValid(), - "In Speed Dependent (Declaration Mode) Crosswind Correction the CdxA Value can be empty."); - } - - [TestCase] - public void CrossWindAreaCdxANotSet_Other() - { - foreach (var correctionMode in EnumHelper.GetValues<CrossWindCorrectionMode>()) { - if (correctionMode == CrossWindCorrectionMode.DeclarationModeCorrection) { - continue; - } - - var airDrag = new AirdragData { - CrossWindCorrectionMode = correctionMode, - CrossWindCorrectionCurve = - new CrosswindCorrectionCdxALookup(null, null, correctionMode) - }; - - Assert.IsFalse(airDrag.IsValid(), - "Only in Speed Dependent (Declaration Mode) Crosswind Correction the CdxA Value can be empty."); - } - } - - [TestCase(MissionType.LongHaul, "Standard technology", 1200, 0.7), - TestCase(MissionType.RegionalDelivery, "Standard technology", 1000, 0.7), - TestCase(MissionType.UrbanDelivery, "Standard technology", 1000, 0.7), - TestCase(MissionType.MunicipalUtility, "Standard technology", 1000, 0.7), - TestCase(MissionType.Construction, "Standard technology", 1000, 0.7), - TestCase(MissionType.LongHaul, "Standard technology - LED headlights, all", 1150, 0.7), - TestCase(MissionType.RegionalDelivery, "Standard technology - LED headlights, all", 950, 0.7), - TestCase(MissionType.UrbanDelivery, "Standard technology - LED headlights, all", 950, 0.7), - TestCase(MissionType.MunicipalUtility, "Standard technology - LED headlights, all", 950, 0.7), - TestCase(MissionType.Construction, "Standard technology - LED headlights, all", 950, 0.7),] - public void AuxElectricSystemTest(MissionType mission, string technology, double value, double efficiency) - { - AssertHelper.AreRelativeEqual(value / efficiency, - DeclarationData.ElectricSystem.Lookup(mission, technology).PowerDemand.Value()); - } - - [TestCase(MissionType.Interurban, "Standard technology"), - TestCase(MissionType.LongHaul, "Standard technology - Flux-Compensator")] - public void AuxElectricSystem_NotExistingError(MissionType mission, string technology) - { - AssertHelper.Exception<VectoException>(() => { DeclarationData.ElectricSystem.Lookup(mission, technology); }); - } - - [TestCase("only the drive shaft of the PTO - shift claw, synchronizer, sliding gearwheel", 50), - TestCase("only the drive shaft of the PTO - multi-disc clutch", 1000), - TestCase("only the drive shaft of the PTO - multi-disc clutch, oil pump", 2000), - TestCase("drive shaft and/or up to 2 gear wheels - shift claw, synchronizer, sliding gearwheel", 300), - TestCase("drive shaft and/or up to 2 gear wheels - multi-disc clutch", 1500), - TestCase("drive shaft and/or up to 2 gear wheels - multi-disc clutch, oil pump", 3000), - TestCase("drive shaft and/or more than 2 gear wheels - shift claw, synchronizer, sliding gearwheel", 600), - TestCase("drive shaft and/or more than 2 gear wheels - multi-disc clutch", 2000), - TestCase("drive shaft and/or more than 2 gear wheels - multi-disc clutch, oil pump", 4000), - TestCase("only one engaged gearwheel above oil level", 0)] - public void AuxPTOTransmissionTest(string technology, double value) - { - AssertHelper.AreRelativeEqual(value, DeclarationData.PTOTransmission.Lookup(technology).PowerDemand.Value()); - } - - [TestCase("Superfluid")] - public void AuxPTOTransmission_NotExistingError(string technology) - { - AssertHelper.Exception<VectoException>(() => { DeclarationData.PTOTransmission.Lookup(technology); }); - } - - [TestCase("", new[] { 618, 671, 516, 566, 1037 }), - TestCase("Crankshaft mounted - Electronically controlled visco clutch", new[] { 618, 671, 516, 566, 1037 }), - TestCase("Crankshaft mounted - Bimetallic controlled visco clutch", new[] { 818, 871, 676, 766, 1277 }), - TestCase("Crankshaft mounted - Discrete step clutch", new[] { 668, 721, 616, 616, 1157 }), - TestCase("Crankshaft mounted - On/off clutch", new[] { 718, 771, 666, 666, 1237 }), - TestCase("Belt driven or driven via transm. - Electronically controlled visco clutch", - new[] { 989, 1044, 833, 933, 1478 }), - TestCase("Belt driven or driven via transm. - Bimetallic controlled visco clutch", - new[] { 1189, 1244, 993, 1133, 1718 }), - TestCase("Belt driven or driven via transm. - Discrete step clutch", new[] { 1039, 1094, 983, 983, 1598 }), - TestCase("Belt driven or driven via transm. - On/off clutch", new[] { 1089, 1144, 1033, 1033, 1678 }), - TestCase("Hydraulic driven - Variable displacement pump", new[] { 938, 1155, 832, 917, 1872 }), - TestCase("Hydraulic driven - Constant displacement pump", new[] { 1200, 1400, 1000, 1100, 2300 }), - TestCase("Electrically driven - Electronically controlled", new[] {700, 800, 600, 600, 1400})] - - public void AuxFanTechTest(string technology, int[] expected) - { - for (var i = 0; i < _missions.Length; i++) { - var lookup = DeclarationData.Fan.Lookup(_missions[i], technology); - Assert.AreEqual(expected[i], lookup.PowerDemand.Value(), Tolerance); - } - } - - [TestCase("Superfluid Hydraulic", MissionType.LongHaul, TestName = "AuxFanTechError( wrong tech )"), - TestCase("Hydraulic driven - Electronically controlled", MissionType.Coach, - TestName = "AuxFanTechError( wrong mission )") - ] - public void AuxFanTechError(string technology, MissionType missionType) - { - AssertHelper.Exception<VectoException>(() => DeclarationData.Fan.Lookup(missionType, technology)); - } - - [TestCase(VehicleClass.Class1, new[] { 0, 150, 150, 0, 0 }), - TestCase(VehicleClass.Class2, new[] { 200, 200, 150, 0, 0 }), - TestCase(VehicleClass.Class3, new[] { 0, 200, 150, 0, 0 }), - TestCase(VehicleClass.Class4, new[] { 350, 200, 150, 300, 200 }), - TestCase(VehicleClass.Class5, new[] { 350, 200, 150, 0, 200 }), - TestCase(VehicleClass.Class9, new[] { 350, 200, 150, 300, 200 }), - TestCase(VehicleClass.Class10, new[] { 350, 200, 0, 0, 200 }), - TestCase(VehicleClass.Class11, new[] { 350, 200, 0, 300, 200 }), - TestCase(VehicleClass.Class12, new[] { 350, 200, 0, 0, 200 }), - TestCase(VehicleClass.Class16, new[] { 0, 0, 0, 0, 200 })] - public void AuxHeatingVentilationAirConditionTest_Default(VehicleClass vehicleClass, int[] expected) - { - for (var i = 0; i < expected.Length; i++) { - if (expected[i] > 0) { - AssertHelper.AreRelativeEqual(expected[i], - DeclarationData.HeatingVentilationAirConditioning.Lookup(_missions[i], "Default", vehicleClass) - .PowerDemand.Value()); - } else { - var i1 = i; - AssertHelper.Exception<VectoException>( - () => DeclarationData.HeatingVentilationAirConditioning.Lookup(_missions[i1], "Default", vehicleClass)); - } - } - } - - [TestCase(VehicleClass.Class1, new[] { 0, 0, 0, 0, 0 }), - TestCase(VehicleClass.Class2, new[] { 0, 0, 0, 0, 0 }), - TestCase(VehicleClass.Class3, new[] { 0, 0, 0, 0, 0 }), - TestCase(VehicleClass.Class4, new[] { 0, 0, 0, 0, 0 }), - TestCase(VehicleClass.Class5, new[] { 0, 0, 0, 0, 0 }), - TestCase(VehicleClass.Class9, new[] { 0, 0, 0, 0, 0 }), - TestCase(VehicleClass.Class10, new[] { 0, 0, 0, 0, 0 }), - TestCase(VehicleClass.Class11, new[] { 0, 0, 0, 0, 0 }), - TestCase(VehicleClass.Class12, new[] { 0, 0, 0, 0, 0 }), - TestCase(VehicleClass.Class16, new[] { 0, 0, 0, 0, 0 })] - public void AuxHeatingVentilationAirConditionTest_None(VehicleClass vehicleClass, int[] expected) - { - for (var i = 0; i < expected.Length; i++) { - AssertHelper.AreRelativeEqual(expected[i], - DeclarationData.HeatingVentilationAirConditioning.Lookup(_missions[i], "None", vehicleClass).PowerDemand.Value()); - } - } - - [TestCase()] - public void AuxHetingVentilationAirConditionTechnologyTest() - { - var tech = DeclarationData.HeatingVentilationAirConditioning.GetTechnologies(); - Assert.AreEqual(2, tech.Length); - Assert.IsTrue(tech.Contains("Default")); - Assert.IsTrue(tech.Contains("None")); - } - - [Test, - TestCase("Small", new[] { 1400, 1300, 1200, 1200, 1300 }), - TestCase("Small + ESS", new[] { 900, 800, 800, 800, 800 }), - TestCase("Small + visco clutch", new[] { 800, 700, 700, 700, 700 }), - TestCase("Small + mech. clutch", new[] { 600, 600, 650, 650, 600 }), - TestCase("Small + ESS + AMS", new[] { 500, 400, 500, 500, 400 }), - TestCase("Small + visco clutch + AMS", new[] { 400, 300, 400, 400, 300 }), - TestCase("Small + mech. clutch + AMS", new[] { 200, 200, 350, 350, 200 }), - TestCase("Medium Supply 1-stage", new[] { 1600, 1400, 1350, 1350, 1500 }), - TestCase("Medium Supply 1-stage + ESS", new[] { 1000, 900, 900, 900, 900 }), - TestCase("Medium Supply 1-stage + visco clutch", new[] { 850, 800, 800, 800, 750 }), - TestCase("Medium Supply 1-stage + mech. clutch", new[] { 600, 550, 550, 550, 600 }), - TestCase("Medium Supply 1-stage + ESS + AMS", new[] { 600, 700, 700, 700, 500 }), - TestCase("Medium Supply 1-stage + visco clutch + AMS", new[] { 450, 600, 600, 600, 350 }), - TestCase("Medium Supply 1-stage + mech. clutch + AMS", new[] { 200, 350, 350, 350, 200 }), - TestCase("Medium Supply 2-stage", new[] { 2100, 1750, 1700, 1700, 2100 }), - TestCase("Medium Supply 2-stage + ESS", new[] { 1100, 1050, 1000, 1000, 1000 }), - TestCase("Medium Supply 2-stage + visco clutch", new[] { 1000, 850, 800, 800, 900 }), - TestCase("Medium Supply 2-stage + mech. clutch", new[] { 700, 650, 600, 600, 800 }), - TestCase("Medium Supply 2-stage + ESS + AMS", new[] { 700, 850, 800, 800, 500 }), - TestCase("Medium Supply 2-stage + visco clutch + AMS", new[] { 600, 650, 600, 600, 400 }), - TestCase("Medium Supply 2-stage + mech. clutch + AMS", new[] { 300, 450, 400, 400, 300 }), - TestCase("Large Supply", new[] { 4300, 3600, 3500, 3500, 4100 }), - TestCase("Large Supply + ESS", new[] { 1600, 1300, 1200, 1200, 1500 }), - TestCase("Large Supply + visco clutch", new[] { 1300, 1100, 1000, 1000, 1200 }), - TestCase("Large Supply + mech. clutch", new[] { 800, 800, 700, 700, 900 }), - TestCase("Large Supply + ESS + AMS", new[] { 1100, 1000, 1000, 1000, 1000 }), - TestCase("Large Supply + visco clutch + AMS", new[] { 800, 800, 800, 800, 700 }), - TestCase("Large Supply + mech. clutch + AMS", new[] { 300, 500, 500, 500, 400 }), - TestCase("Vacuum pump", new[] { 190, 160, 130, 130, 130 }), - ] - public void AuxPneumaticSystemTest(string technology, int[] expected) - { - for (var i = 0; i < _missions.Length; i++) { - var lookup = DeclarationData.PneumaticSystem.Lookup(_missions[i], technology); - AssertHelper.AreRelativeEqual(expected[i], lookup.PowerDemand.Value()); - } - } - - [ - TestCase(MissionType.LongHaul, VehicleClass.Class2, 370, "Fixed displacement", null, null, null), - TestCase(MissionType.LongHaul, VehicleClass.Class4, 610, "Fixed displacement", null, null, null), - TestCase(MissionType.LongHaul, VehicleClass.Class5, 720, "Fixed displacement", null, null, null), - TestCase(MissionType.LongHaul, VehicleClass.Class9, 720, "Fixed displacement", null, null, null), - TestCase(MissionType.LongHaul, VehicleClass.Class10, 570, "Fixed displacement", null, null, null), - TestCase(MissionType.LongHaul, VehicleClass.Class11, 720, "Fixed displacement", null, null, null), - TestCase(MissionType.LongHaul, VehicleClass.Class12, 570, "Fixed displacement", null, null, null), + [TestFixture] + public class DeclarationDataTest + { + private const double Tolerance = 0.0001; + + private readonly MissionType[] _missions = { + MissionType.LongHaul, + MissionType.RegionalDelivery, + MissionType.UrbanDelivery, + MissionType.MunicipalUtility, + MissionType.Construction, + }; + + [OneTimeSetUp] + public void RunBeforeAnyTests() + { + Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory); + } + + + [TestCase("285/60 R22.5", 10.6, 0.914, 3.03, 0.440766), + TestCase("285/70 R19.5", 7.9, 0.895, 3.05, 0.434453), + TestCase("395/85 R20", 27.9, 1.18, 3.05, 0.572798)] + public void WheelDataTest(string wheels, double inertia, double wheelsDiameter, double circumferenceFactor, + double expectedDynamicRadius) + { + var tmp = DeclarationData.Wheels.Lookup(wheels); + + AssertHelper.AreRelativeEqual(inertia, tmp.Inertia); + AssertHelper.AreRelativeEqual(wheelsDiameter, tmp.WheelsDiameter); + AssertHelper.AreRelativeEqual(circumferenceFactor, tmp.CircumferenceFactor); + Assert.AreEqual(expectedDynamicRadius, tmp.DynamicTyreRadius.Value(), 1e-6); + } + + [ + // fixed points + TestCase(400, 0), + TestCase(800, 0.47), + TestCase(1000, 0.58), + TestCase(1200, 0.53), + TestCase(1400, 0.46), + TestCase(1500, 0.43), + TestCase(1750, 0.22), + TestCase(1800, 0.2), + TestCase(2000, 0.11), + TestCase(2500, 0.11), + // interpolate + TestCase(600, 0.235), + TestCase(900, 0.525), + TestCase(1100, 0.555), + TestCase(1300, 0.495), + TestCase(1450, 0.445), + TestCase(1625, 0.325), + TestCase(1775, 0.21), + TestCase(1900, 0.155), + TestCase(2250, 0.11), + ] + public void PT1Test(double rpm, double expectedPt1) + { + var pt1 = DeclarationData.PT1.Lookup(rpm.RPMtoRad()); + Assert.AreEqual(expectedPt1, pt1.Value.Value(), Tolerance); + Assert.IsFalse(pt1.Extrapolated); + } + + [TestCase(200), + TestCase(0), + TestCase(13000),] + public void PT1ExceptionsTest(double rpm) + { + // EXTRAPOLATE + var tmp = DeclarationData.PT1.Lookup(rpm.RPMtoRad()); + Assert.IsTrue(tmp.Extrapolated); + } + + [TestCase] + public void WHTCTest() + { + var whtc = DeclarationData.WHTCCorrection; + + var factors = new + { + urban = new[] { 0.11, 0.17, 0.69, 0.98, 0.62, 1.0, 1.0, 1.0, 0.45, 0.0 }, + rural = new[] { 0.0, 0.3, 0.27, 0.0, 0.32, 0.0, 0.0, 0.0, 0.36, 0.22 }, + motorway = new[] { 0.89, 0.53, 0.04, 0.02, 0.06, 0.0, 0.0, 0.0, 0.19, 0.78 } + }; + + var r = new Random(); + for (var i = 0; i < _missions.Length; i++) + { + var urban = r.NextDouble() * 2; + var rural = r.NextDouble() * 2; + var motorway = r.NextDouble() * 2; + var whtcValue = whtc.Lookup(_missions[i], rural: rural, urban: urban, motorway: motorway); + Assert.AreEqual(urban * factors.urban[i] + rural * factors.rural[i] + motorway * factors.motorway[i], + whtcValue); + } + } + + [TestCase] + public void WHTCLookupTestLongHaul() + { + var expected = 1.015501; + + var rural = 1.0265; + var urban = 1.0948; + var motorway = 1.0057; + + var lookup = DeclarationData.WHTCCorrection.Lookup(MissionType.LongHaul, rural: rural, urban: urban, + motorway: motorway); + Assert.AreEqual(expected, lookup, 1e-8); + } + + [TestCase] + public void WHTCLookupTestRegionalDelivery() + { + var expected = 1.02708700; + + var rural = 1.0265; + var urban = 1.0948; + var motorway = 1.0057; + + var lookup = DeclarationData.WHTCCorrection.Lookup(MissionType.RegionalDelivery, rural: rural, urban: urban, + motorway: motorway); + Assert.AreEqual(expected, lookup, 1e-8); + } + + [ + //TestCase("MediumLorryVan",), + //TestCase("MediumLorryRigid"), + TestCase("RigidSolo", 0.013526, 0.017746, -0.000666), + TestCase("RigidTrailer", 0.017125, 0.072275, -0.004148), + TestCase("TractorSemitrailer", 0.030042, 0.040817, -0.00213), + TestCase("CoachBus", -0.000794, 0.02109, -0.00109), + TestCase("MediumLorriesRigid",-0.0015 ,0.0086, -0.00029), + TestCase("MediumLorriesVan", 0.0032, 0.00532, -0.00028)] + + public void AirDrag_WithStringKey(string key, double a1, double a2, double a3) + { + var value = DeclarationData.AirDrag.Lookup(key); + AssertHelper.AreRelativeEqual(a1, value.A1); + AssertHelper.AreRelativeEqual(a2, value.A2); + AssertHelper.AreRelativeEqual(a3, value.A3); + } + + [ + //TestCase("MediumLorryVan",), + //TestCase("MediumLorryRigid"), + TestCase("RigidSolo", 0.013526, 0.017746, -0.000666), + TestCase("TractorSemitrailer", 0.030042, 0.040817, -0.00213), + TestCase("RigidTrailer", 0.017125, 0.072275, -0.004148), + TestCase("CoachBus", -0.000794, 0.02109, -0.00109), + TestCase("MediumLorriesRigid", -0.0015, 0.0086, -0.00029), + TestCase("MediumLorriesVan", 0.0032, 0.00532, -0.00028)] + public void AirDrag_WithVehicleCategory(string parameterSet, double a1, double a2, double a3) + { + var value = DeclarationData.AirDrag.Lookup(parameterSet); + AssertHelper.AreRelativeEqual(a1, value.A1); + AssertHelper.AreRelativeEqual(a2, value.A2); + AssertHelper.AreRelativeEqual(a3, value.A3); + } + + [TestCase("TractorSemitrailer", 6.46, 0, 4.0, 7.71712257), + TestCase("TractorSemitrailer", 6.46, 60, 4.0, 7.71712257), + TestCase("TractorSemitrailer", 6.46, 75, 3.75, 7.35129203), + TestCase("TractorSemitrailer", 6.46, 100, 4.0, 7.03986404), + TestCase("TractorSemitrailer", 6.46, 62.1234, 4.0, 7.65751048), + TestCase("TractorSemitrailer", 6.46, 73.5432, 3.75, 7.37814098), + TestCase("TractorSemitrailer", 6.46, 92.8765, 4.0, 7.11234364), + TestCase("TractorSemitrailer", 6.46, 100.449, 4.0, 7.03571556), + TestCase("TractorSemitrailer", 6.46, 103, 3.6, 6.99454230), + TestCase("TractorSemitrailer", 6.46, 105, 3.9, 6.99177143), + TestCase("TractorSemitrailer", 6.46, 115, 4.0, 6.92267778), + TestCase("TractorSemitrailer", 6.46, 130, 4.0, 6.83867361),] + public void CrossWindCorrectionTest(string parameterSet, double crossSectionArea, double kmph, double height, + double expected) + { + var crossWindCorrectionCurve = new CrosswindCorrectionCdxALookup(crossSectionArea.SI<SquareMeter>(), + DeclarationDataAdapter.GetDeclarationAirResistanceCurve(parameterSet, crossSectionArea.SI<SquareMeter>(), + height.SI<Meter>()), + CrossWindCorrectionMode.DeclarationModeCorrection); + + var tmp = crossWindCorrectionCurve.EffectiveAirDragArea(kmph.KMPHtoMeterPerSecond()); + AssertHelper.AreRelativeEqual(expected, tmp.Value(), toleranceFactor: 1e-3); + } + + [TestCase("TractorSemitrailer", 5.8, 4.0)] + public void CrossWindGetDeclarationAirResistance(string parameterSet, double cdxa0, double height) + { + var curve = + DeclarationDataAdapter.GetDeclarationAirResistanceCurve(parameterSet, cdxa0.SI<SquareMeter>(), height.SI<Meter>()); + + AssertHelper.AreRelativeEqual(60.KMPHtoMeterPerSecond(), curve[1].Velocity); + AssertHelper.AreRelativeEqual(7.0418009.SI<SquareMeter>(), curve[1].EffectiveCrossSectionArea); + + AssertHelper.AreRelativeEqual(65.KMPHtoMeterPerSecond(), curve[2].Velocity); + AssertHelper.AreRelativeEqual(6.90971991.SI<SquareMeter>(), curve[2].EffectiveCrossSectionArea); + + AssertHelper.AreRelativeEqual(85.KMPHtoMeterPerSecond(), curve[6].Velocity); + AssertHelper.AreRelativeEqual(6.54224222.SI<SquareMeter>(), curve[6].EffectiveCrossSectionArea); + + AssertHelper.AreRelativeEqual(100.KMPHtoMeterPerSecond(), curve[9].Velocity); + AssertHelper.AreRelativeEqual(6.37434824.SI<SquareMeter>(), curve[9].EffectiveCrossSectionArea); + + AssertHelper.AreRelativeEqual(105.KMPHtoMeterPerSecond(), curve[10].Velocity); + AssertHelper.AreRelativeEqual(6.33112792.SI<SquareMeter>(), curve[10].EffectiveCrossSectionArea); + + Assert.Greater(20, curve.Count); + } + + [ + TestCase("TractorSemitrailer", 6.46, -0.1, 3.0), + TestCase("TractorSemitrailer", 6.46, 130.1, 3.0), + ] + public void CrossWindCorrectionExceptionTest(string parameterSet, double crossSectionArea, double kmph, double height) + { + var crossWindCorrectionCurve = new CrosswindCorrectionCdxALookup(crossSectionArea.SI<SquareMeter>(), + DeclarationDataAdapter.GetDeclarationAirResistanceCurve(parameterSet, crossSectionArea.SI<SquareMeter>(), + height.SI<Meter>()), + CrossWindCorrectionMode.DeclarationModeCorrection); + + AssertHelper.Exception<VectoException>(() => + crossWindCorrectionCurve.EffectiveAirDragArea(kmph.KMPHtoMeterPerSecond())); + } + + [TestCase] + public void CrossWindAreaCdxANotSet_DeclarationMode() + { + var airDrag = new AirdragData() + { + CrossWindCorrectionMode = CrossWindCorrectionMode.DeclarationModeCorrection, + CrossWindCorrectionCurve = + new CrosswindCorrectionCdxALookup(null, null, CrossWindCorrectionMode.DeclarationModeCorrection) + }; + + Assert.IsTrue(airDrag.IsValid(), + "In Speed Dependent (Declaration Mode) Crosswind Correction the CdxA Value can be empty."); + } + + [TestCase] + public void CrossWindAreaCdxANotSet_Other() + { + foreach (var correctionMode in EnumHelper.GetValues<CrossWindCorrectionMode>()) + { + if (correctionMode == CrossWindCorrectionMode.DeclarationModeCorrection) + { + continue; + } + + var airDrag = new AirdragData + { + CrossWindCorrectionMode = correctionMode, + CrossWindCorrectionCurve = + new CrosswindCorrectionCdxALookup(null, null, correctionMode) + }; + + Assert.IsFalse(airDrag.IsValid(), + "Only in Speed Dependent (Declaration Mode) Crosswind Correction the CdxA Value can be empty."); + } + } + + [TestCase(MissionType.LongHaul, "Standard technology", 1200, 0.7), + TestCase(MissionType.RegionalDelivery, "Standard technology", 1000, 0.7), + TestCase(MissionType.UrbanDelivery, "Standard technology", 1000, 0.7), + TestCase(MissionType.MunicipalUtility, "Standard technology", 1000, 0.7), + TestCase(MissionType.Construction, "Standard technology", 1000, 0.7), + TestCase(MissionType.LongHaul, "Standard technology - LED headlights, all", 1150, 0.7), + TestCase(MissionType.RegionalDelivery, "Standard technology - LED headlights, all", 950, 0.7), + TestCase(MissionType.UrbanDelivery, "Standard technology - LED headlights, all", 950, 0.7), + TestCase(MissionType.MunicipalUtility, "Standard technology - LED headlights, all", 950, 0.7), + TestCase(MissionType.Construction, "Standard technology - LED headlights, all", 950, 0.7),] + public void AuxElectricSystemTest(MissionType mission, string technology, double value, double efficiency) + { + AssertHelper.AreRelativeEqual(value / efficiency, + DeclarationData.ElectricSystem.Lookup(mission, technology).PowerDemand.Value()); + } + + [TestCase(MissionType.Interurban, "Standard technology"), + TestCase(MissionType.LongHaul, "Standard technology - Flux-Compensator")] + public void AuxElectricSystem_NotExistingError(MissionType mission, string technology) + { + AssertHelper.Exception<VectoException>(() => { DeclarationData.ElectricSystem.Lookup(mission, technology); }); + } + + [TestCase("only the drive shaft of the PTO - shift claw, synchronizer, sliding gearwheel", 50), + TestCase("only the drive shaft of the PTO - multi-disc clutch", 1000), + TestCase("only the drive shaft of the PTO - multi-disc clutch, oil pump", 2000), + TestCase("drive shaft and/or up to 2 gear wheels - shift claw, synchronizer, sliding gearwheel", 300), + TestCase("drive shaft and/or up to 2 gear wheels - multi-disc clutch", 1500), + TestCase("drive shaft and/or up to 2 gear wheels - multi-disc clutch, oil pump", 3000), + TestCase("drive shaft and/or more than 2 gear wheels - shift claw, synchronizer, sliding gearwheel", 600), + TestCase("drive shaft and/or more than 2 gear wheels - multi-disc clutch", 2000), + TestCase("drive shaft and/or more than 2 gear wheels - multi-disc clutch, oil pump", 4000), + TestCase("only one engaged gearwheel above oil level", 0)] + public void AuxPTOTransmissionTest(string technology, double value) + { + AssertHelper.AreRelativeEqual(value, DeclarationData.PTOTransmission.Lookup(technology).PowerDemand.Value()); + } + + [TestCase("Superfluid")] + public void AuxPTOTransmission_NotExistingError(string technology) + { + AssertHelper.Exception<VectoException>(() => { DeclarationData.PTOTransmission.Lookup(technology); }); + } + + [TestCase(VehicleClass.Class1, "", new[] { 618, 671, 516, 566, 1037 }), + TestCase(VehicleClass.Class1, "Crankshaft mounted - Electronically controlled visco clutch", new[] { 618, 671, 516, 566, 1037 }), + TestCase(VehicleClass.Class1, "Crankshaft mounted - Bimetallic controlled visco clutch", new[] { 818, 871, 676, 766, 1277 }), + TestCase(VehicleClass.Class1, "Crankshaft mounted - Discrete step clutch", new[] { 668, 721, 616, 616, 1157 }), + TestCase(VehicleClass.Class1, "Crankshaft mounted - On/off clutch", new[] { 718, 771, 666, 666, 1237 }), + TestCase(VehicleClass.Class1, "Belt driven or driven via transm. - Electronically controlled visco clutch", + new[] { 989, 1044, 833, 933, 1478 }), + TestCase(VehicleClass.Class1, "Belt driven or driven via transm. - Bimetallic controlled visco clutch", + new[] { 1189, 1244, 993, 1133, 1718 }), + TestCase(VehicleClass.Class1, "Belt driven or driven via transm. - Discrete step clutch", new[] { 1039, 1094, 983, 983, 1598 }), + TestCase(VehicleClass.Class1, "Belt driven or driven via transm. - On/off clutch", new[] { 1089, 1144, 1033, 1033, 1678 }), + TestCase(VehicleClass.Class1, "Hydraulic driven - Variable displacement pump", new[] { 938, 1155, 832, 917, 1872 }), + TestCase(VehicleClass.Class1, "Hydraulic driven - Constant displacement pump", new[] { 1200, 1400, 1000, 1100, 2300 }), + TestCase(VehicleClass.Class1, "Electrically driven - Electronically controlled", new[] { 700, 800, 600, 600, 1400 }), + + //medium lorries + TestCase(VehicleClass.ClassML2r, "", new[] { 0, 258, 198, 0, 0 }), + TestCase(VehicleClass.ClassML2r, "Crankshaft mounted - Electronically controlled visco clutch", new[] { 0, 258, 198, 0, 0 }), + TestCase(VehicleClass.ClassML2r, "Crankshaft mounted - Bimetallic controlled visco clutch", new[] { 0, 335, 260, 0, 0 }), + TestCase(VehicleClass.ClassML2r, "Crankshaft mounted - Discrete step clutch", new[] { 0, 277, 237, 0, 0 }), + TestCase(VehicleClass.ClassML2r, "Crankshaft mounted - On/off clutch", new[] { 0, 297, 256, 0, 0 }), + TestCase(VehicleClass.ClassML2r, "Belt driven or driven via transm. - Electronically controlled visco clutch", + new[] { 0, 402, 320, 0, 0 }), + TestCase(VehicleClass.ClassML2r, "Belt driven or driven via transm. - Bimetallic controlled visco clutch", + new[] { 0, 478, 382, 0, 0 }), + TestCase(VehicleClass.ClassML2r, "Belt driven or driven via transm. - Discrete step clutch", new[] { 0, 421, 378, 0, 0 }), + TestCase(VehicleClass.ClassML2r, "Belt driven or driven via transm. - On/off clutch", new[] { 0, 440, 397, 0, 0 }), + TestCase(VehicleClass.ClassML2r, "Hydraulic driven - Variable displacement pump", new[] { 0, 444, 320, 0, 0 }), + TestCase(VehicleClass.ClassML2r, "Hydraulic driven - Constant displacement pump", new[] { 0, 538, 385, 0, 0 }), + TestCase(VehicleClass.ClassML2r, "Electrically driven - Electronically controlled", new[] { 0, 308, 231, 0, 0 }) + ] + + public void AuxFanTechTest(VehicleClass vehicleClass, string technology, int[] expected) + { + for (var i = 0; i < _missions.Length; i++) + { + if (expected[i] == 0) + continue; + var lookup = DeclarationData.Fan.Lookup(vehicleClass, _missions[i], technology); + Assert.AreEqual(expected[i], lookup.PowerDemand.Value(), Tolerance); + } + } + + [TestCase(VehicleClass.Class1, "Superfluid Hydraulic", MissionType.LongHaul, TestName = "AuxFanTechError( wrong tech )"), + TestCase(VehicleClass.Class1, "Hydraulic driven - Electronically controlled", MissionType.Coach, + TestName = "AuxFanTechError( wrong mission )") + ] + public void AuxFanTechError(VehicleClass vehicleClass, string technology, MissionType missionType) + { + AssertHelper.Exception<VectoException>(() => DeclarationData.Fan.Lookup(vehicleClass, missionType, technology)); + } + + [TestCase(VehicleClass.ClassML2r, new[] { 0, 150, 150, 0, 0 }), + TestCase(VehicleClass.ClassML2van, new[] { 0, 150, 150, 0, 0 }), + TestCase(VehicleClass.ClassML3r, new[] { 0, 150, 150, 0, 0 }), + TestCase(VehicleClass.ClassML3van, new[] { 0, 150, 150, 0, 0 }), + TestCase(VehicleClass.ClassML4r, new[] { 0, 150, 150, 0, 0 }), + TestCase(VehicleClass.ClassML4van, new[] { 0, 150, 150, 0, 0 }), + TestCase(VehicleClass.Class1s, new[] { 0, 150, 150, 0, 0 }), + TestCase(VehicleClass.Class1, new[] { 0, 150, 150, 0, 0 }), + TestCase(VehicleClass.Class2, new[] { 200, 200, 150, 0, 0 }), + TestCase(VehicleClass.Class3, new[] { 0, 200, 150, 0, 0 }), + TestCase(VehicleClass.Class4, new[] { 350, 200, 150, 300, 200 }), + TestCase(VehicleClass.Class5, new[] { 350, 200, 150, 0, 200 }), + TestCase(VehicleClass.Class9, new[] { 350, 200, 150, 300, 200 }), + TestCase(VehicleClass.Class10, new[] { 350, 200, 0, 0, 200 }), + TestCase(VehicleClass.Class11, new[] { 350, 200, 0, 300, 200 }), + TestCase(VehicleClass.Class12, new[] { 350, 200, 0, 0, 200 }), + TestCase(VehicleClass.Class16, new[] { 0, 0, 0, 0, 200 })] + public void AuxHeatingVentilationAirConditionTest_Default(VehicleClass vehicleClass, int[] expected) + { + for (var i = 0; i < expected.Length; i++) + { + if (expected[i] > 0) + { + AssertHelper.AreRelativeEqual(expected[i], + DeclarationData.HeatingVentilationAirConditioning.Lookup(_missions[i], "Default", vehicleClass) + .PowerDemand.Value()); + } + else + { + var i1 = i; + AssertHelper.Exception<VectoException>( + () => DeclarationData.HeatingVentilationAirConditioning.Lookup(_missions[i1], "Default", vehicleClass)); + } + } + } + + [ + TestCase(VehicleClass.ClassML2r, new[] { 0, 0, 0, 0, 0 }), + TestCase(VehicleClass.ClassML2van, new[] { 0, 0, 0, 0, 0 }), + TestCase(VehicleClass.ClassML3r, new[] { 0, 0, 0, 0, 0 }), + TestCase(VehicleClass.ClassML3van, new[] { 0, 0, 0, 0, 0 }), + TestCase(VehicleClass.ClassML4r, new[] { 0, 0, 0, 0, 0 }), + TestCase(VehicleClass.ClassML4van, new[] { 0, 0, 0, 0, 0 }), + TestCase(VehicleClass.Class1s, new[] { 0, 0, 0, 0, 0 }), + TestCase(VehicleClass.Class1, new[] { 0, 0, 0, 0, 0 }), + TestCase(VehicleClass.Class2, new[] { 0, 0, 0, 0, 0 }), + TestCase(VehicleClass.Class3, new[] { 0, 0, 0, 0, 0 }), + TestCase(VehicleClass.Class4, new[] { 0, 0, 0, 0, 0 }), + TestCase(VehicleClass.Class5, new[] { 0, 0, 0, 0, 0 }), + TestCase(VehicleClass.Class9, new[] { 0, 0, 0, 0, 0 }), + TestCase(VehicleClass.Class10, new[] { 0, 0, 0, 0, 0 }), + TestCase(VehicleClass.Class11, new[] { 0, 0, 0, 0, 0 }), + TestCase(VehicleClass.Class12, new[] { 0, 0, 0, 0, 0 }), + TestCase(VehicleClass.Class16, new[] { 0, 0, 0, 0, 0 })] + public void AuxHeatingVentilationAirConditionTest_None(VehicleClass vehicleClass, int[] expected) + { + for (var i = 0; i < expected.Length; i++) + { + AssertHelper.AreRelativeEqual(expected[i], + DeclarationData.HeatingVentilationAirConditioning.Lookup(_missions[i], "None", vehicleClass).PowerDemand.Value()); + } + } + + [TestCase()] + public void AuxHeatingVentilationAirConditionTechnologyTest() + { + var tech = DeclarationData.HeatingVentilationAirConditioning.GetTechnologies(); + Assert.AreEqual(2, tech.Length); + Assert.IsTrue(tech.Contains("Default")); + Assert.IsTrue(tech.Contains("None")); + } + + [Test, + TestCase("Small", new[] { 1400, 1300, 1200, 1200, 1300 }), + TestCase("Small + ESS", new[] { 900, 800, 800, 800, 800 }), + TestCase("Small + visco clutch", new[] { 800, 700, 700, 700, 700 }), + TestCase("Small + mech. clutch", new[] { 600, 600, 650, 650, 600 }), + TestCase("Small + ESS + AMS", new[] { 500, 400, 500, 500, 400 }), + TestCase("Small + visco clutch + AMS", new[] { 400, 300, 400, 400, 300 }), + TestCase("Small + mech. clutch + AMS", new[] { 200, 200, 350, 350, 200 }), + TestCase("Medium Supply 1-stage", new[] { 1600, 1400, 1350, 1350, 1500 }), + TestCase("Medium Supply 1-stage + ESS", new[] { 1000, 900, 900, 900, 900 }), + TestCase("Medium Supply 1-stage + visco clutch", new[] { 850, 800, 800, 800, 750 }), + TestCase("Medium Supply 1-stage + mech. clutch", new[] { 600, 550, 550, 550, 600 }), + TestCase("Medium Supply 1-stage + ESS + AMS", new[] { 600, 700, 700, 700, 500 }), + TestCase("Medium Supply 1-stage + visco clutch + AMS", new[] { 450, 600, 600, 600, 350 }), + TestCase("Medium Supply 1-stage + mech. clutch + AMS", new[] { 200, 350, 350, 350, 200 }), + TestCase("Medium Supply 2-stage", new[] { 2100, 1750, 1700, 1700, 2100 }), + TestCase("Medium Supply 2-stage + ESS", new[] { 1100, 1050, 1000, 1000, 1000 }), + TestCase("Medium Supply 2-stage + visco clutch", new[] { 1000, 850, 800, 800, 900 }), + TestCase("Medium Supply 2-stage + mech. clutch", new[] { 700, 650, 600, 600, 800 }), + TestCase("Medium Supply 2-stage + ESS + AMS", new[] { 700, 850, 800, 800, 500 }), + TestCase("Medium Supply 2-stage + visco clutch + AMS", new[] { 600, 650, 600, 600, 400 }), + TestCase("Medium Supply 2-stage + mech. clutch + AMS", new[] { 300, 450, 400, 400, 300 }), + TestCase("Large Supply", new[] { 4300, 3600, 3500, 3500, 4100 }), + TestCase("Large Supply + ESS", new[] { 1600, 1300, 1200, 1200, 1500 }), + TestCase("Large Supply + visco clutch", new[] { 1300, 1100, 1000, 1000, 1200 }), + TestCase("Large Supply + mech. clutch", new[] { 800, 800, 700, 700, 900 }), + TestCase("Large Supply + ESS + AMS", new[] { 1100, 1000, 1000, 1000, 1000 }), + TestCase("Large Supply + visco clutch + AMS", new[] { 800, 800, 800, 800, 700 }), + TestCase("Large Supply + mech. clutch + AMS", new[] { 300, 500, 500, 500, 400 }), + TestCase("Vacuum pump", new[] { 190, 160, 130, 130, 130 }), + ] + public void AuxPneumaticSystemTest(string technology, int[] expected) + { + for (var i = 0; i < _missions.Length; i++) + { + var lookup = DeclarationData.PneumaticSystem.Lookup(_missions[i], technology); + AssertHelper.AreRelativeEqual(expected[i], lookup.PowerDemand.Value()); + } + } + + [ + TestCase(MissionType.LongHaul, VehicleClass.Class2, 370, "Fixed displacement", null, null, null), + TestCase(MissionType.LongHaul, VehicleClass.Class4, 610, "Fixed displacement", null, null, null), + TestCase(MissionType.LongHaul, VehicleClass.Class5, 720, "Fixed displacement", null, null, null), + TestCase(MissionType.LongHaul, VehicleClass.Class9, 720, "Fixed displacement", null, null, null), + TestCase(MissionType.LongHaul, VehicleClass.Class10, 570, "Fixed displacement", null, null, null), + TestCase(MissionType.LongHaul, VehicleClass.Class11, 720, "Fixed displacement", null, null, null), + TestCase(MissionType.LongHaul, VehicleClass.Class12, 570, "Fixed displacement", null, null, null), + TestCase(MissionType.RegionalDelivery, VehicleClass.Class1s, 280, "Fixed displacement", null, null, null), TestCase(MissionType.RegionalDelivery, VehicleClass.Class1, 280, "Fixed displacement", null, null, null), - TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, 340, "Fixed displacement", null, null, null), - TestCase(MissionType.RegionalDelivery, VehicleClass.Class3, 370, "Fixed displacement", null, null, null), - TestCase(MissionType.RegionalDelivery, VehicleClass.Class4, 570, "Fixed displacement", null, null, null), - TestCase(MissionType.RegionalDelivery, VehicleClass.Class5, 670, "Fixed displacement", null, null, null), - TestCase(MissionType.RegionalDelivery, VehicleClass.Class9, 590, "Fixed displacement", null, null, null), - TestCase(MissionType.RegionalDelivery, VehicleClass.Class10, 570, "Fixed displacement", null, null, null), - TestCase(MissionType.RegionalDelivery, VehicleClass.Class11, 590, "Fixed displacement", null, null, null), - TestCase(MissionType.RegionalDelivery, VehicleClass.Class12, 570, "Fixed displacement", null, null, null), - TestCase(MissionType.UrbanDelivery, VehicleClass.Class1, 270, "Fixed displacement", null, null, null), - TestCase(MissionType.UrbanDelivery, VehicleClass.Class2, 310, "Fixed displacement", null, null, null), - TestCase(MissionType.UrbanDelivery, VehicleClass.Class3, 350, "Fixed displacement", null, null, null), - TestCase(MissionType.UrbanDelivery, VehicleClass.Class5, 620, "Fixed displacement", null, null, null), - TestCase(MissionType.MunicipalUtility, VehicleClass.Class4, 510, "Fixed displacement", null, null, null), - TestCase(MissionType.MunicipalUtility, VehicleClass.Class9, 510, "Fixed displacement", null, null, null), - TestCase(MissionType.MunicipalUtility, VehicleClass.Class11, 510, "Fixed displacement", null, null, null), - TestCase(MissionType.Construction, VehicleClass.Class11, 770, "Fixed displacement", null, null, null), - TestCase(MissionType.Construction, VehicleClass.Class12, 770, "Fixed displacement", null, null, null), - TestCase(MissionType.Construction, VehicleClass.Class16, 770, "Fixed displacement", null, null, null), - TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, 325.5, "Fixed displacement with elec. control", null, - null, - null), - TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, 289, "Dual displacement", null, null, null), - TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, 255, "Variable displacement mech. controlled", null, - null, - null), - TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, 204, "Variable displacement elec. controlled", null, - null, - null), - TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, 92.8571, "Electric", null, null, null), - TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, 665, "Fixed displacement", "Fixed displacement", null, - null), - TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, 1295, "Fixed displacement", "Fixed displacement", - "Fixed displacement", "Fixed displacement"), - TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, 1021.5, "Dual displacement", - "Variable displacement mech. controlled", "Fixed displacement with elec. control", - "Variable displacement elec. controlled"), - ] - public void Aux_SteeringPumpLookupValues(MissionType mission, VehicleClass hdvClass, double expected, string axle1, - string axle2, string axle3, string axle4) - { - // mk remark: made the test call with 4 axle params, so that the test name is clear in the test explorer. - AssertHelper.AreRelativeEqual(expected, - DeclarationData.SteeringPump.Lookup(mission, hdvClass, - new[] { axle1, axle2, axle3, axle4 }.TakeWhile(a => a != null).ToArray())); - } - - [TestCase] - public void Aux_SteeringpumpMultipleLookups() - { - // testcase to illustrate modification of lookup-data for steering pump - const string axle1 = "Electric"; - const MissionType mission = MissionType.LongHaul; - const VehicleClass hdvClass = VehicleClass.Class5; - var first = DeclarationData.SteeringPump.Lookup(mission, hdvClass, - new[] { axle1 }.TakeWhile(a => a != null).ToArray()); - - for (var i = 0; i < 10; i++) { - DeclarationData.SteeringPump.Lookup(mission, hdvClass, - new[] { axle1 }.TakeWhile(a => a != null).ToArray()); - } - - var last = DeclarationData.SteeringPump.Lookup(mission, hdvClass, - new[] { axle1 }.TakeWhile(a => a != null).ToArray()); - - Assert.AreEqual(first.Value(), last.Value(), 1e-3); - } - - [TestCase(MissionType.LongHaul, VehicleClass.Class1, "Dual displacement", + TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, 340, "Fixed displacement", null, null, null), + TestCase(MissionType.RegionalDelivery, VehicleClass.Class3, 370, "Fixed displacement", null, null, null), + TestCase(MissionType.RegionalDelivery, VehicleClass.Class4, 570, "Fixed displacement", null, null, null), + TestCase(MissionType.RegionalDelivery, VehicleClass.Class5, 670, "Fixed displacement", null, null, null), + TestCase(MissionType.RegionalDelivery, VehicleClass.Class9, 590, "Fixed displacement", null, null, null), + TestCase(MissionType.RegionalDelivery, VehicleClass.Class10, 570, "Fixed displacement", null, null, null), + TestCase(MissionType.RegionalDelivery, VehicleClass.Class11, 590, "Fixed displacement", null, null, null), + TestCase(MissionType.RegionalDelivery, VehicleClass.Class12, 570, "Fixed displacement", null, null, null), + TestCase(MissionType.UrbanDelivery, VehicleClass.Class1s, 270, "Fixed displacement", null, null, null), + TestCase(MissionType.UrbanDelivery, VehicleClass.Class1, 270, "Fixed displacement", null, null, null), + TestCase(MissionType.UrbanDelivery, VehicleClass.Class2, 310, "Fixed displacement", null, null, null), + TestCase(MissionType.UrbanDelivery, VehicleClass.Class3, 350, "Fixed displacement", null, null, null), + TestCase(MissionType.UrbanDelivery, VehicleClass.Class5, 620, "Fixed displacement", null, null, null), + TestCase(MissionType.MunicipalUtility, VehicleClass.Class4, 510, "Fixed displacement", null, null, null), + TestCase(MissionType.MunicipalUtility, VehicleClass.Class9, 510, "Fixed displacement", null, null, null), + TestCase(MissionType.MunicipalUtility, VehicleClass.Class11, 510, "Fixed displacement", null, null, null), + TestCase(MissionType.Construction, VehicleClass.Class11, 770, "Fixed displacement", null, null, null), + TestCase(MissionType.Construction, VehicleClass.Class12, 770, "Fixed displacement", null, null, null), + TestCase(MissionType.Construction, VehicleClass.Class16, 770, "Fixed displacement", null, null, null), + TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, 325.5, "Fixed displacement with elec. control", null, + null, + null), + TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, 289, "Dual displacement", null, null, null), + TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, 255, "Variable displacement mech. controlled", null, + null, + null), + TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, 204, "Variable displacement elec. controlled", null, + null, + null), + TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, 92.8571, "Electric", null, null, null), + TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, 665, "Fixed displacement", "Fixed displacement", null, + null), + TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, 1295, "Fixed displacement", "Fixed displacement", + "Fixed displacement", "Fixed displacement"), + TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, 1021.5, "Dual displacement", + "Variable displacement mech. controlled", "Fixed displacement with elec. control", + "Variable displacement elec. controlled"), + ] + public void Aux_SteeringPumpLookupValues(MissionType mission, VehicleClass hdvClass, double expected, string axle1, + string axle2, string axle3, string axle4) + { + // mk remark: made the test call with 4 axle params, so that the test name is clear in the test explorer. + AssertHelper.AreRelativeEqual(expected, + DeclarationData.SteeringPump.Lookup(mission, hdvClass, + new[] { axle1, axle2, axle3, axle4 }.TakeWhile(a => a != null).ToArray())); + } + + [TestCase] + public void Aux_SteeringpumpMultipleLookups() + { + // testcase to illustrate modification of lookup-data for steering pump + const string axle1 = "Electric"; + const MissionType mission = MissionType.LongHaul; + const VehicleClass hdvClass = VehicleClass.Class5; + var first = DeclarationData.SteeringPump.Lookup(mission, hdvClass, + new[] { axle1 }.TakeWhile(a => a != null).ToArray()); + + for (var i = 0; i < 10; i++) + { + DeclarationData.SteeringPump.Lookup(mission, hdvClass, + new[] { axle1 }.TakeWhile(a => a != null).ToArray()); + } + + var last = DeclarationData.SteeringPump.Lookup(mission, hdvClass, + new[] { axle1 }.TakeWhile(a => a != null).ToArray()); + + Assert.AreEqual(first.Value(), last.Value(), 1e-3); + } + + [TestCase(MissionType.LongHaul, VehicleClass.Class1s, "Dual displacement", TestName = "Aux_SteeringPumpLookupFail( No Value )"), - TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, "Super displacement", - TestName = "Aux_SteeringPumpLookupFail( Wrong Tech )"), - TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, "Dual displacement", "Dual displacement", - "Dual displacement", "Dual displacement", "Dual displacement", TestName = "Aux_SteeringPumpLookupFail( >4 Techs )"), - TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, TestName = "Aux_SteeringPumpLookupFail( Null Techs )"), - TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, new string[0], - TestName = "Aux_SteeringPumpLookupFail( 0 Techs )"), - ] - public void Aux_SteeringPumpLookupFail(MissionType mission, VehicleClass hdvClass, params string[] tech) - { - AssertHelper.Exception<VectoException>(() => DeclarationData.SteeringPump.Lookup(mission, hdvClass, tech)); - } - - [ - TestCase(0), - TestCase(1000), - TestCase(3500), - TestCase(7500) - ] - public void SegmentWeightOutOfRange4X2(double weight) - { - AssertHelper.Exception<VectoException>(() => - DeclarationData.Segments.Lookup( - VehicleCategory.RigidTruck, - AxleConfiguration.AxleConfig_4x2, - weight.SI<Kilogram>(), - 0.SI<Kilogram>(), - false), - string.Format("ERROR: Could not find the declaration segment for vehicle. Category: {0}, AxleConfiguration: {1}, GrossVehicleWeight: {2}", VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2.GetName(), weight.SI<Kilogram>())); - } - - [ - TestCase(0), - TestCase(1000), - TestCase(3500), - TestCase(7500) - ] - public void SegmentWeightOutOfRange4X4(double weight) - { - AssertHelper.Exception<VectoException>(() => - DeclarationData.Segments.Lookup( - VehicleCategory.RigidTruck, - AxleConfiguration.AxleConfig_4x4, - weight.SI<Kilogram>(), - 0.SI<Kilogram>(), - false), - string.Format("ERROR: Could not find the declaration segment for vehicle. Category: {0}, AxleConfiguration: {1}, GrossVehicleWeight: {2}", VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x4.GetName(), weight.SI<Kilogram>())); - } - - [Test, + TestCase(MissionType.LongHaul, VehicleClass.Class1, "Dual displacement", + TestName = "Aux_SteeringPumpLookupFail( No Value )"), + TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, "Super displacement", + TestName = "Aux_SteeringPumpLookupFail( Wrong Tech )"), + TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, "Dual displacement", "Dual displacement", + "Dual displacement", "Dual displacement", "Dual displacement", TestName = "Aux_SteeringPumpLookupFail( >4 Techs )"), + TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, TestName = "Aux_SteeringPumpLookupFail( Null Techs )"), + TestCase(MissionType.RegionalDelivery, VehicleClass.Class2, new string[0], + TestName = "Aux_SteeringPumpLookupFail( 0 Techs )"), + ] + public void Aux_SteeringPumpLookupFail(MissionType mission, VehicleClass hdvClass, params string[] tech) + { + AssertHelper.Exception<VectoException>(() => DeclarationData.SteeringPump.Lookup(mission, hdvClass, tech)); + } + + [ + TestCase(0), + TestCase(1000), + TestCase(3500), + TestCase(7500) + ] + public void SegmentWeightOutOfRange4X2(double weight) + { + AssertHelper.Exception<VectoException>(() => + DeclarationData.Segments.Lookup( + VehicleCategory.RigidTruck, + AxleConfiguration.AxleConfig_4x2, + weight.SI<Kilogram>(), + 0.SI<Kilogram>(), + false), + string.Format("ERROR: Could not find the declaration segment for vehicle. Category: {0}, AxleConfiguration: {1}, GrossVehicleWeight: {2}", VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2.GetName(), weight.SI<Kilogram>())); + } + + [ + TestCase(0), + TestCase(1000), + TestCase(3500), + TestCase(7500) + ] + public void SegmentWeightOutOfRange4X4(double weight) + { + AssertHelper.Exception<VectoException>(() => + DeclarationData.Segments.Lookup( + VehicleCategory.RigidTruck, + AxleConfiguration.AxleConfig_4x4, + weight.SI<Kilogram>(), + 0.SI<Kilogram>(), + false), + string.Format("ERROR: Could not find the declaration segment for vehicle. Category: {0}, AxleConfiguration: {1}, GrossVehicleWeight: {2}", VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x4.GetName(), weight.SI<Kilogram>())); + } + + [Test, + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2F, 5000.01, 0, false, VehicleClass.ClassML2r), + TestCase(VehicleCategory.Van, AxleConfiguration.AxleConfig_4x2F, 5000.01, 0, false, VehicleClass.ClassML2van), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 5000.01, 0, false, VehicleClass.ClassML3r), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 5000.01, 0, false, VehicleClass.ClassML3r), + TestCase(VehicleCategory.Van, AxleConfiguration.AxleConfig_4x2, 5000.01, 0, false, VehicleClass.ClassML3van), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x4, 5000.01, 0, false, VehicleClass.ClassML4r), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x4, 5000.01, 0, false, VehicleClass.ClassML4r), + TestCase(VehicleCategory.Van, AxleConfiguration.AxleConfig_4x4, 5000.01, 0, false, VehicleClass.ClassML4van), + + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 7400.01, 0, false, VehicleClass.Class1s), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 7400.01, 0, false, VehicleClass.Class1s), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 7500, 0, false, VehicleClass.Class1s), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 7500, 0, false, VehicleClass.Class1s), TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 7500.01, 0, false, VehicleClass.Class1), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 7500.01, 0, false, VehicleClass.Class1), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 10000, 0, false, VehicleClass.Class1), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 10000, 0, false, VehicleClass.Class1), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 10001, 0, false, VehicleClass.Class2), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 10001, 0, false, VehicleClass.Class2), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 12000, 0, false, VehicleClass.Class2), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 12000, 0, false, VehicleClass.Class2), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 12001, 0, false, VehicleClass.Class3), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 12001, 0, false, VehicleClass.Class3), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 16000, 0, false, VehicleClass.Class3), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 16000, 0, false, VehicleClass.Class3), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 16001, 0, false, VehicleClass.Class4), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 99000, 0, false, VehicleClass.Class4), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 16001, 0, true, VehicleClass.Class4), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 99000, 0, true, VehicleClass.Class4), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 16001, 0, false, VehicleClass.Class5), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 99000, 0, false, VehicleClass.Class5), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 16001, 0, true, VehicleClass.Class5), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 99000, 0, true, VehicleClass.Class5), - //TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x4, 7500, 0, VehicleClass.Class6), - //TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x4, 16000, 0, VehicleClass.Class6), - //TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x4, 16001, 0, VehicleClass.Class7), - //TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x4, 99000, 0, VehicleClass.Class7), - //TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x4, 16000, 0, VehicleClass.Class8), - //TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x4, 99000, 0, VehicleClass.Class8), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 7500, 0, false, VehicleClass.Class9), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 16000, 0, false, VehicleClass.Class9), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 40000, 0, false, VehicleClass.Class9), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 99000, 0, false, VehicleClass.Class9), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 7500, 0, true, VehicleClass.Class9), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 99000, 0, true, VehicleClass.Class9), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 7500, 0, false, VehicleClass.Class10), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 16000, 0, false, VehicleClass.Class10), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 40000, 0, false, VehicleClass.Class10), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 99000, 0, false, VehicleClass.Class10), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 7500, 0, true, VehicleClass.Class10), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 99000, 0, true, VehicleClass.Class10), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x4, 7500, 0, false, VehicleClass.Class11), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x4, 40000, 0, false, VehicleClass.Class11), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x4, 7500, 0, false, VehicleClass.Class12), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x4, 99000, 0, false, VehicleClass.Class12), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_8x4, 7500, 0, false, VehicleClass.Class16), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_8x4, 99000, 0, false, VehicleClass.Class16) - ] - public void SegmentLookupTest(VehicleCategory category, AxleConfiguration axleConfiguration, double grossWeight, - double curbWeight, bool vocational, VehicleClass expectedClass) - { - var segment = DeclarationData.Segments.Lookup(category, axleConfiguration, grossWeight.SI<Kilogram>(), - curbWeight.SI<Kilogram>(), vocational); - Assert.AreEqual(expectedClass, segment.VehicleClass); - } - - [TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 7501, 0, false, VehicleClass.Class1, 85), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 10001, 0, false, VehicleClass.Class2, 85), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 12001, 0, false, VehicleClass.Class3, 85), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 16001, 0, false, VehicleClass.Class4, 85), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 16001, 0, true, VehicleClass.Class4, 85), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 16001, 0, false, VehicleClass.Class5, 85), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 16001, 0, true, VehicleClass.Class5, 85), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 7501, 0, false, VehicleClass.Class9, 85), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 7501, 0, true, VehicleClass.Class9, 85), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 7500, 0, false, VehicleClass.Class10, 85), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 7500, 0, true, VehicleClass.Class10, 85), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x4, 7500, 0, false, VehicleClass.Class11, 85), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x4, 7500, 0, false, VehicleClass.Class12, 85), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_8x4, 7500, 0, false, VehicleClass.Class16, 85), - ] - public void SegmentDesignSpeedTest(VehicleCategory category, AxleConfiguration axleConfiguration, double grossWeight, - double curbWeight, bool vocational, VehicleClass expectedClass, double speed) - { - var segment = DeclarationData.Segments.Lookup(category, axleConfiguration, grossWeight.SI<Kilogram>(), - curbWeight.SI<Kilogram>(), vocational); - - Assert.AreEqual(speed.KMPHtoMeterPerSecond(), segment.DesignSpeed); - } - - [Test, - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 10000, 0, false, VehicleClass.Class1, 1600, null, - TestName = "SegmentLookupBodyWeight Class1 Rigid"), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 10000, 0, false, VehicleClass.Class1, 1600, null, - TestName = "SegmentLookupBodyWeight Class1 Tractor"), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 12000, 0, false, VehicleClass.Class2, 1900, 3400, - TestName = "SegmentLookupBodyWeight Class2 Rigid"), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 12000, 0, false, VehicleClass.Class2, 1900, 3400, - TestName = "SegmentLookupBodyWeight Class2 Tractor"), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 16000, 0, false, VehicleClass.Class3, 2000, null, - TestName = "SegmentLookupBodyWeight Class3 Rigid"), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 16000, 0, false, VehicleClass.Class3, 2000, null, - TestName = "SegmentLookupBodyWeight Class3 Tractor"), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 18000, 0, false, VehicleClass.Class4, 2100, 5400, - TestName = "SegmentLookupBodyWeight Class4"), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 18000, 0, false, VehicleClass.Class5, null, 7500, - TestName = "SegmentLookupBodyWeight Class5"), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 40000, 0, false, VehicleClass.Class9, 2200, 5400, - TestName = "SegmentLookupBodyWeight Class9"), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 40000, 0, false, VehicleClass.Class10, null, 7500, - TestName = "SegmentLookupBodyWeight Class10"), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x4, 12000, 0, false, VehicleClass.Class11, 2200, 5400, - TestName = "SegmentLookupBodyWeight Class11"), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x4, 12000, 0, false, VehicleClass.Class12, null, 7500, - TestName = "SegmentLookupBodyWeight Class12"), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_8x4, 12000, 0, false, VehicleClass.Class16, null, null, - TestName = "SegmentLookupBodyWeight Class16")] - public void SegmentLookupBodyTest(VehicleCategory category, AxleConfiguration axleConfiguration, double grossWeight, - double curbWeight, bool vocational, VehicleClass expectedClass, int? expectedBodyWeight, int? expectedTrailerWeight) - { - var segment = DeclarationData.Segments.Lookup(category, axleConfiguration, grossWeight.SI<Kilogram>(), - curbWeight.SI<Kilogram>(), vocational); - Assert.AreEqual(expectedClass, segment.VehicleClass); - - if (expectedBodyWeight.HasValue) { - Assert.AreEqual(expectedBodyWeight, segment.Missions[0].BodyCurbWeight.Value()); - } - if (expectedTrailerWeight.HasValue) { - var trailerMission = segment.Missions.Where(m => m.Trailer.Count > 0).ToList(); - if (trailerMission.Count > 0) { - Assert.AreEqual(expectedTrailerWeight, trailerMission.First().Trailer.First().TrailerCurbWeight.Value()); - } - } - } - - [Test, - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 10000, 0, false, VehicleClass.Class1, 3.6, - TestName = "SegmentLookupHeight Class1 Rigid"), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 10000, 0, false, VehicleClass.Class1, 3.6, - TestName = "SegmentLookupHeight Class1 Tractor"), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 12000, 0, false, VehicleClass.Class2, 3.75, - TestName = "SegmentLookupHeight Class2 Rigid"), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 12000, 0, false, VehicleClass.Class2, 3.75, - TestName = "SegmentLookupHeight Class2 Tractor"), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 16000, 0, false, VehicleClass.Class3, 3.9, - TestName = "SegmentLookupHeight Class3 Rigid"), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 16000, 0, false, VehicleClass.Class3, 3.9, - TestName = "SegmentLookupHeight Class3 Tractor"), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 18000, 0, false, VehicleClass.Class4, 4.0, - TestName = "SegmentLookupHeight Class4"), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 18000, 0, true, VehicleClass.Class4, 4.0, - TestName = "SegmentLookupHeight Class4v"), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 18000, 0, false, VehicleClass.Class5, 4.0, - TestName = "SegmentLookupHeight Class5"), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 18000, 0, true, VehicleClass.Class5, 4.0, - TestName = "SegmentLookupHeight Class5v"), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 10000, 0, false, VehicleClass.Class9, 3.6, - TestName = "SegmentLookupHeight Class9 - 1"), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 12000, 0, false, VehicleClass.Class9, 3.75, - TestName = "SegmentLookupHeight Class9 - 2"), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 16000, 0, false, VehicleClass.Class9, 3.9, - TestName = "SegmentLookupHeight Class9 - 3"), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 18000, 0, false, VehicleClass.Class9, 4.0, - TestName = "SegmentLookupHeight Class9 - 4"), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 40000, 0, false, VehicleClass.Class9, 4.0, - TestName = "SegmentLookupHeight Class9 - other"), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 40000, 0, true, VehicleClass.Class9, 4.0, - TestName = "SegmentLookupHeight Class9v - other"), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 40000, 0, false, VehicleClass.Class10, 4.0, - TestName = "SegmentLookupHeight Class10"), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 40000, 0, true, VehicleClass.Class10, 4.0, - TestName = "SegmentLookupHeight Class10v"), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x4, 12000, 0, false, VehicleClass.Class11, 4.0, - TestName = "SegmentLookupHeight Class11"), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x4, 12000, 0, false, VehicleClass.Class12, 4.0, - TestName = "SegmentLookupHeight Class12"), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_8x4, 12000, 0, false, VehicleClass.Class16, 3.6, - TestName = "SegmentLookupHeight Class16")] - public void SegmentLookupHeightTest(VehicleCategory category, AxleConfiguration axleConfiguration, double grossWeight, - double curbWeight, bool vocational, VehicleClass expectedClass, double expectedHeight) - { - var segment = DeclarationData.Segments.Lookup(category, axleConfiguration, grossWeight.SI<Kilogram>(), - curbWeight.SI<Kilogram>(), vocational); - Assert.AreEqual(expectedClass, segment.VehicleClass); - AssertHelper.AreRelativeEqual(expectedHeight, segment.VehicleHeight); - } - - [Test, - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 7501, 0, false, VehicleClass.Class1, + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 7500.01, 0, false, VehicleClass.Class1), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 10000, 0, false, VehicleClass.Class1), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 10000, 0, false, VehicleClass.Class1), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 10001, 0, false, VehicleClass.Class2), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 10001, 0, false, VehicleClass.Class2), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 12000, 0, false, VehicleClass.Class2), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 12000, 0, false, VehicleClass.Class2), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 12001, 0, false, VehicleClass.Class3), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 12001, 0, false, VehicleClass.Class3), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 16000, 0, false, VehicleClass.Class3), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 16000, 0, false, VehicleClass.Class3), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 16001, 0, false, VehicleClass.Class4), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 99000, 0, false, VehicleClass.Class4), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 16001, 0, true, VehicleClass.Class4), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 99000, 0, true, VehicleClass.Class4), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 16001, 0, false, VehicleClass.Class5), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 99000, 0, false, VehicleClass.Class5), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 16001, 0, true, VehicleClass.Class5), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 99000, 0, true, VehicleClass.Class5), + //TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x4, 7500, 0, VehicleClass.Class6), + //TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x4, 16000, 0, VehicleClass.Class6), + //TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x4, 16001, 0, VehicleClass.Class7), + //TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x4, 99000, 0, VehicleClass.Class7), + //TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x4, 16000, 0, VehicleClass.Class8), + //TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x4, 99000, 0, VehicleClass.Class8), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 7500, 0, false, VehicleClass.Class9), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 16000, 0, false, VehicleClass.Class9), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 40000, 0, false, VehicleClass.Class9), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 99000, 0, false, VehicleClass.Class9), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 7500, 0, true, VehicleClass.Class9), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 99000, 0, true, VehicleClass.Class9), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 7500, 0, false, VehicleClass.Class10), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 16000, 0, false, VehicleClass.Class10), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 40000, 0, false, VehicleClass.Class10), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 99000, 0, false, VehicleClass.Class10), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 7500, 0, true, VehicleClass.Class10), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 99000, 0, true, VehicleClass.Class10), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x4, 7500, 0, false, VehicleClass.Class11), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x4, 40000, 0, false, VehicleClass.Class11), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x4, 7500, 0, false, VehicleClass.Class12), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x4, 99000, 0, false, VehicleClass.Class12), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_8x4, 7500, 0, false, VehicleClass.Class16), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_8x4, 99000, 0, false, VehicleClass.Class16) + ] + public void SegmentLookupTest(VehicleCategory category, AxleConfiguration axleConfiguration, double grossWeight, + double curbWeight, bool vocational, VehicleClass expectedClass) + { + var segment = DeclarationData.Segments.Lookup(category, axleConfiguration, grossWeight.SI<Kilogram>(), + curbWeight.SI<Kilogram>(), vocational); + Assert.AreEqual(expectedClass, segment.VehicleClass); + } + + [ + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2F, 5001, 0, false, VehicleClass.ClassML2r, 85), + TestCase(VehicleCategory.Van, AxleConfiguration.AxleConfig_4x2F, 5001, 0, false, VehicleClass.ClassML2van, 85), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 5001, 0, false, VehicleClass.ClassML3r, 85), + TestCase(VehicleCategory.Van, AxleConfiguration.AxleConfig_4x2, 5001, 0, false, VehicleClass.ClassML3van, 85), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x4, 5001, 0, false, VehicleClass.ClassML4r, 85), + TestCase(VehicleCategory.Van, AxleConfiguration.AxleConfig_4x4, 5001, 0, false, VehicleClass.ClassML4van, 85), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 7401, 0, false, VehicleClass.Class1s, 85), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 7501, 0, false, VehicleClass.Class1, 85), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 10001, 0, false, VehicleClass.Class2, 85), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 12001, 0, false, VehicleClass.Class3, 85), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 16001, 0, false, VehicleClass.Class4, 85), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 16001, 0, true, VehicleClass.Class4, 85), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 16001, 0, false, VehicleClass.Class5, 85), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 16001, 0, true, VehicleClass.Class5, 85), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 7501, 0, false, VehicleClass.Class9, 85), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 7501, 0, true, VehicleClass.Class9, 85), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 7500, 0, false, VehicleClass.Class10, 85), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 7500, 0, true, VehicleClass.Class10, 85), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x4, 7500, 0, false, VehicleClass.Class11, 85), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x4, 7500, 0, false, VehicleClass.Class12, 85), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_8x4, 7500, 0, false, VehicleClass.Class16, 85), + ] + public void SegmentDesignSpeedTest(VehicleCategory category, AxleConfiguration axleConfiguration, double grossWeight, + double curbWeight, bool vocational, VehicleClass expectedClass, double speed) + { + var segment = DeclarationData.Segments.Lookup(category, axleConfiguration, grossWeight.SI<Kilogram>(), + curbWeight.SI<Kilogram>(), vocational); + + Assert.AreEqual(speed.KMPHtoMeterPerSecond(), segment.DesignSpeed); + } + + [Test, + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2F, 7400, 0, false, VehicleClass.ClassML2r, 800, null, + TestName = "SegmentLookupBodyWeight ClassML2r Rigid"), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2F, 7400, 0, false, VehicleClass.ClassML2r, 800, null, + TestName = "SegmentLookupBodyWeight ClassML2r Tractor"), + TestCase(VehicleCategory.Van, AxleConfiguration.AxleConfig_4x2F, 7400, 0, false, VehicleClass.ClassML2van, 0, null, + TestName = "SegmentLookupBodyWeight ClassML2van Van"), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 7400, 0, false, VehicleClass.ClassML3r, 800, null, + TestName = "SegmentLookupBodyWeight ClassML3r Rigid"), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 7400, 0, false, VehicleClass.ClassML3r, 800, null, + TestName = "SegmentLookupBodyWeight ClassML3r Tractor"), + TestCase(VehicleCategory.Van, AxleConfiguration.AxleConfig_4x2, 7400, 0, false, VehicleClass.ClassML3van, 0, null, + TestName = "SegmentLookupBodyWeight ClassML3van Van"), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x4, 7400, 0, false, VehicleClass.ClassML4r, 800, null, + TestName = "SegmentLookupBodyWeight ClassML4r Rigid"), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x4, 7400, 0, false, VehicleClass.ClassML4r, 800, null, + TestName = "SegmentLookupBodyWeight ClassML4r Tractor"), + TestCase(VehicleCategory.Van, AxleConfiguration.AxleConfig_4x4, 7400, 0, false, VehicleClass.ClassML4van, 0, null, + TestName = "SegmentLookupBodyWeight ClassML4rvan Van"), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 7500, 0, false, VehicleClass.Class1s, 1600, null, + TestName = "SegmentLookupBodyWeight Class1s Rigid"), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 7500, 0, false, VehicleClass.Class1s, 1600, null, + TestName = "SegmentLookupBodyWeight Class1s Tractor"), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 10000, 0, false, VehicleClass.Class1, 1600, null, + TestName = "SegmentLookupBodyWeight Class1 Rigid"), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 10000, 0, false, VehicleClass.Class1, 1600, null, + TestName = "SegmentLookupBodyWeight Class1 Tractor"), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 12000, 0, false, VehicleClass.Class2, 1900, 3400, + TestName = "SegmentLookupBodyWeight Class2 Rigid"), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 12000, 0, false, VehicleClass.Class2, 1900, 3400, + TestName = "SegmentLookupBodyWeight Class2 Tractor"), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 16000, 0, false, VehicleClass.Class3, 2000, null, + TestName = "SegmentLookupBodyWeight Class3 Rigid"), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 16000, 0, false, VehicleClass.Class3, 2000, null, + TestName = "SegmentLookupBodyWeight Class3 Tractor"), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 18000, 0, false, VehicleClass.Class4, 2100, 5400, + TestName = "SegmentLookupBodyWeight Class4"), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 18000, 0, false, VehicleClass.Class5, null, 7500, + TestName = "SegmentLookupBodyWeight Class5"), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 40000, 0, false, VehicleClass.Class9, 2200, 5400, + TestName = "SegmentLookupBodyWeight Class9"), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 40000, 0, false, VehicleClass.Class10, null, 7500, + TestName = "SegmentLookupBodyWeight Class10"), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x4, 12000, 0, false, VehicleClass.Class11, 2200, 5400, + TestName = "SegmentLookupBodyWeight Class11"), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x4, 12000, 0, false, VehicleClass.Class12, null, 7500, + TestName = "SegmentLookupBodyWeight Class12"), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_8x4, 12000, 0, false, VehicleClass.Class16, null, null, + TestName = "SegmentLookupBodyWeight Class16")] + public void SegmentLookupBodyTest(VehicleCategory category, AxleConfiguration axleConfiguration, double grossWeight, + double curbWeight, bool vocational, VehicleClass expectedClass, int? expectedBodyWeight, int? expectedTrailerWeight) + { + var segment = DeclarationData.Segments.Lookup(category, axleConfiguration, grossWeight.SI<Kilogram>(), + curbWeight.SI<Kilogram>(), vocational); + Assert.AreEqual(expectedClass, segment.VehicleClass); + + if (expectedBodyWeight.HasValue) + { + Assert.AreEqual(expectedBodyWeight, segment.Missions[0].BodyCurbWeight.Value()); + } + if (expectedTrailerWeight.HasValue) + { + var trailerMission = segment.Missions.Where(m => m.Trailer.Count > 0).ToList(); + if (trailerMission.Count > 0) + { + Assert.AreEqual(expectedTrailerWeight, trailerMission.First().Trailer.First().TrailerCurbWeight.Value()); + } + } + } + + [Test, + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2F, 7400, 0, false, VehicleClass.ClassML2r, 3.5, + TestName = "SegmentLookupHeight ClassML2r Rigid"), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2F, 7400, 0, false, VehicleClass.ClassML2r, 3.5, + TestName = "SegmentLookupHeight ClassML2r Tractor"), + TestCase(VehicleCategory.Van, AxleConfiguration.AxleConfig_4x2F, 7400, 0, false, VehicleClass.ClassML2van, 2.9, + TestName = "SegmentLookupHeight ClassML2van Van"), + + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 7400, 0, false, VehicleClass.ClassML3r, 3.5, + TestName = "SegmentLookupHeight ClassML3r Rigid"), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 7400, 0, false, VehicleClass.ClassML3r, 3.5, + TestName = "SegmentLookupHeight ClassML3r Tractor"), + TestCase(VehicleCategory.Van, AxleConfiguration.AxleConfig_4x2, 7400, 0, false, VehicleClass.ClassML3van, 2.9, + TestName = "SegmentLookupHeight ClassML3van Van"), + + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x4, 7400, 0, false, VehicleClass.ClassML4r, 3.5, + TestName = "SegmentLookupHeight ClassML4r Rigid"), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x4, 7400, 0, false, VehicleClass.ClassML4r, 3.5, + TestName = "SegmentLookupHeight ClassML4r Tractor"), + TestCase(VehicleCategory.Van, AxleConfiguration.AxleConfig_4x4, 7400, 0, false, VehicleClass.ClassML4van, 2.9, + TestName = "SegmentLookupHeight ClassML4van Van"), + + + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 7500, 0, false, VehicleClass.Class1s, 3.6, + TestName = "SegmentLookupHeight Class1s Rigid"), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 7500, 0, false, VehicleClass.Class1s, 3.6, + TestName = "SegmentLookupHeight Class1s Tractor"), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 10000, 0, false, VehicleClass.Class1, 3.6, + TestName = "SegmentLookupHeight Class1 Rigid"), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 10000, 0, false, VehicleClass.Class1, 3.6, + TestName = "SegmentLookupHeight Class1 Tractor"), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 12000, 0, false, VehicleClass.Class2, 3.75, + TestName = "SegmentLookupHeight Class2 Rigid"), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 12000, 0, false, VehicleClass.Class2, 3.75, + TestName = "SegmentLookupHeight Class2 Tractor"), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 16000, 0, false, VehicleClass.Class3, 3.9, + TestName = "SegmentLookupHeight Class3 Rigid"), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 16000, 0, false, VehicleClass.Class3, 3.9, + TestName = "SegmentLookupHeight Class3 Tractor"), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 18000, 0, false, VehicleClass.Class4, 4.0, + TestName = "SegmentLookupHeight Class4"), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 18000, 0, true, VehicleClass.Class4, 4.0, + TestName = "SegmentLookupHeight Class4v"), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 18000, 0, false, VehicleClass.Class5, 4.0, + TestName = "SegmentLookupHeight Class5"), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 18000, 0, true, VehicleClass.Class5, 4.0, + TestName = "SegmentLookupHeight Class5v"), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 10000, 0, false, VehicleClass.Class9, 3.6, + TestName = "SegmentLookupHeight Class9 - 1"), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 12000, 0, false, VehicleClass.Class9, 3.75, + TestName = "SegmentLookupHeight Class9 - 2"), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 16000, 0, false, VehicleClass.Class9, 3.9, + TestName = "SegmentLookupHeight Class9 - 3"), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 18000, 0, false, VehicleClass.Class9, 4.0, + TestName = "SegmentLookupHeight Class9 - 4"), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 40000, 0, false, VehicleClass.Class9, 4.0, + TestName = "SegmentLookupHeight Class9 - other"), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 40000, 0, true, VehicleClass.Class9, 4.0, + TestName = "SegmentLookupHeight Class9v - other"), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 40000, 0, false, VehicleClass.Class10, 4.0, + TestName = "SegmentLookupHeight Class10"), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 40000, 0, true, VehicleClass.Class10, 4.0, + TestName = "SegmentLookupHeight Class10v"), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x4, 12000, 0, false, VehicleClass.Class11, 4.0, + TestName = "SegmentLookupHeight Class11"), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x4, 12000, 0, false, VehicleClass.Class12, 4.0, + TestName = "SegmentLookupHeight Class12"), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_8x4, 12000, 0, false, VehicleClass.Class16, 3.6, + TestName = "SegmentLookupHeight Class16")] + public void SegmentLookupHeightTest(VehicleCategory category, AxleConfiguration axleConfiguration, double grossWeight, + double curbWeight, bool vocational, VehicleClass expectedClass, double expectedHeight) + { + var segment = DeclarationData.Segments.Lookup(category, axleConfiguration, grossWeight.SI<Kilogram>(), + curbWeight.SI<Kilogram>(), vocational); + Assert.AreEqual(expectedClass, segment.VehicleClass); + AssertHelper.AreRelativeEqual(expectedHeight, segment.VehicleHeight); + } + + [Test, + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 7401, 0, false, VehicleClass.Class1s, new[] { 36.5, 36.5 }), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 7501, 0, false, VehicleClass.Class1, + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 7401, 0, false, VehicleClass.Class1s, new[] { 36.5, 36.5 }), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 12000, 0, false, VehicleClass.Class2, - new[] { 85.0, 45.2, 45.2 }), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 12000, 0, false, VehicleClass.Class2, - new[] { 85.0, 45.2, 45.2 }), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 16000, 0, false, VehicleClass.Class3, - new[] { 47.7, 47.7 }), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 16000, 0, false, VehicleClass.Class3, - new[] { 47.7, 47.7 }), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 18000, 0, false, VehicleClass.Class4, - new[] { 98.9, 49.4, 49.4, 0.0 }), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 18000, 0, true, VehicleClass.Class4, - new[] { 0.0, 0.0 }), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 18000, 0, false, VehicleClass.Class5, - new[] { 91.0, 140.5, 91.0, 140.5, 91.0 }), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 18000, 0, true, VehicleClass.Class5, - new[] { 0.0 }), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 16000, 0, false, VehicleClass.Class9, - new[] { 101.4, 142.9, 51.9, 142.9, 0.0 }), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 16000, 0, true, VehicleClass.Class9, - new[] { 0.0, 0.0 }), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 16000, 0, false, VehicleClass.Class10, - new[] { 91.0, 140.5, 91.0, 140.5 }), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 16000, 0, true, VehicleClass.Class10, - new[] { 0.0 }), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x4, 40000, 0, false, VehicleClass.Class11, - new[] { 101.4, 142.9, 51.9, 142.9, 0.0, 0.0 }), - TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x4, 99000, 0, false, VehicleClass.Class12, - new[] { 91.0, 140.5, 91.0, 140.5, 0.0 }), - TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_8x4, 99000, 0, false, VehicleClass.Class16, - new[] { 0.0 }) - ] - public void SegmentLookupCargoVolumeTest(VehicleCategory category, AxleConfiguration axleConfiguration, - double grossWeight, - double curbWeight, bool vocational, VehicleClass expectedClass, double[] expectedCargoVolume) - { - var segment = DeclarationData.Segments.Lookup(category, axleConfiguration, grossWeight.SI<Kilogram>(), - curbWeight.SI<Kilogram>(), vocational); - Assert.AreEqual(expectedClass, segment.VehicleClass); - Assert.AreEqual(expectedCargoVolume.Length, segment.Missions.Length); - for (var i = 0; i < expectedCargoVolume.Length; i++) { - Assert.AreEqual(expectedCargoVolume[i], segment.Missions[i].TotalCargoVolume.Value()); - } - } - - /// <summary> - /// trailer in longhaul, always pc formula - /// </summary> - [TestCase] - public void Segment2Test() - { - var vehicleData = new { - VehicleCategory = VehicleCategory.RigidTruck, - AxleConfiguration = AxleConfiguration.AxleConfig_4x2, - GrossVehicleMassRating = 11900.SI<Kilogram>(), - CurbWeight = 5850.SI<Kilogram>() - }; - - var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, - vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, false); - - Assert.AreEqual(VehicleClass.Class2, segment.VehicleClass); - - var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); - TestAcceleration(data); - - Assert.AreEqual(3, segment.Missions.Length); - - AssertMission(segment.Missions[0], - vehicleData: vehicleData, - missionType: MissionType.LongHaul, - cosswindCorrection: "RigidTrailer", - axleWeightDistribution: new[] { 0.225, 0.325 }, - trailerAxleWeightDistribution: new[] { 0.45 }, - trailerAxleCount: new[] { 2 }, - bodyCurbWeight: 1900, - trailerCurbWeight: new[] { 3400.0 }, - trailerType: new[] { TrailerType.T1 }, - lowLoad: 1296.8235, - refLoad: 9450, - trailerGrossVehicleWeight: new[] { 10500.0 }, - deltaCdA: 1.3, - maxLoad: 11250); - - AssertMission(segment.Missions[1], - vehicleData: vehicleData, - missionType: MissionType.RegionalDelivery, - cosswindCorrection: "RigidSolo", - axleWeightDistribution: new[] { 0.45, 0.55 }, - trailerAxleWeightDistribution: new double[] { }, - trailerAxleCount: new int[] { }, - bodyCurbWeight: 1900, - trailerCurbWeight: new double[] { }, - trailerType: new TrailerType[] { }, - lowLoad: 596.8235, - refLoad: 2984.1176, - trailerGrossVehicleWeight: new double[] { }, - deltaCdA: 0, - maxLoad: 4150); - - AssertMission(segment.Missions[2], - vehicleData: vehicleData, - missionType: MissionType.UrbanDelivery, - cosswindCorrection: "RigidSolo", - axleWeightDistribution: new[] { 0.45, 0.55 }, - trailerAxleWeightDistribution: new double[] { }, - trailerAxleCount: new int[] { }, - bodyCurbWeight: 1900, - trailerCurbWeight: new double[] { }, - trailerType: new TrailerType[] { }, - lowLoad: 596.8235, - refLoad: 2984.1176, - trailerGrossVehicleWeight: new double[] { }, - deltaCdA: 0, - maxLoad: 4150); - } - - - /// <summary> - /// trailer in longhaul, always pc formula - /// </summary> - [TestCase] - public void Segment2TestHeavy() - { - var vehicleData = new { - VehicleCategory = VehicleCategory.RigidTruck, - AxleConfiguration = AxleConfiguration.AxleConfig_4x2, - GrossVehicleMassRating = 11990.SI<Kilogram>(), - CurbWeight = 9500.SI<Kilogram>() - }; - - var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, - vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, false); - - Assert.AreEqual(VehicleClass.Class2, segment.VehicleClass); - - var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); - TestAcceleration(data); - - Assert.AreEqual(3, segment.Missions.Length); - - AssertMission(segment.Missions[0], - vehicleData: vehicleData, - missionType: MissionType.LongHaul, - cosswindCorrection: "RigidTrailer", - axleWeightDistribution: new[] { 0.225, 0.325 }, - trailerAxleWeightDistribution: new[] { 0.45 }, - trailerAxleCount: new[] { 2 }, - bodyCurbWeight: 1900, - trailerCurbWeight: new[] { 3400.0 }, - trailerType: new[] { TrailerType.T1 }, - lowLoad: 1290, - refLoad: 5890, - trailerGrossVehicleWeight: new[] { 10500.0 }, - deltaCdA: 1.3, - maxLoad: 7690); - - AssertMission(segment.Missions[1], - vehicleData: vehicleData, - missionType: MissionType.RegionalDelivery, - cosswindCorrection: "RigidSolo", - axleWeightDistribution: new[] { 0.45, 0.55 }, - trailerAxleWeightDistribution: new double[] { }, - trailerAxleCount: new int[] { }, - bodyCurbWeight: 1900, - trailerCurbWeight: new double[] { }, - trailerType: new TrailerType[] { }, - lowLoad: 590, - refLoad: 590, - trailerGrossVehicleWeight: new double[] { }, - deltaCdA: 0, - maxLoad: 590); - - AssertMission(segment.Missions[2], - vehicleData: vehicleData, - missionType: MissionType.UrbanDelivery, - cosswindCorrection: "RigidSolo", - axleWeightDistribution: new[] { 0.45, 0.55 }, - trailerAxleWeightDistribution: new double[] { }, - trailerAxleCount: new int[] { }, - bodyCurbWeight: 1900, - trailerCurbWeight: new double[] { }, - trailerType: new TrailerType[] { }, - lowLoad: 590, - refLoad: 590, - trailerGrossVehicleWeight: new double[] { }, - deltaCdA: 0, - maxLoad: 590); - } - - - /// <summary> - /// normal pc formula, no trailer - /// </summary> - [TestCase] - public void Segment3Test() - { - var vehicleData = new { - VehicleCategory = VehicleCategory.RigidTruck, - AxleConfiguration = AxleConfiguration.AxleConfig_4x2, - GrossVehicleMassRating = 14000.SI<Kilogram>(), - CurbWeight = 5850.SI<Kilogram>() - }; - - var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, - vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, false); - - Assert.AreEqual(VehicleClass.Class3, segment.VehicleClass); - - Assert.AreEqual(2, segment.Missions.Length); - - AssertMission(segment.Missions[0], - vehicleData: vehicleData, - missionType: MissionType.RegionalDelivery, - cosswindCorrection: "RigidSolo", - axleWeightDistribution: new[] { 0.4, 0.6 }, - trailerAxleWeightDistribution: new double[] { }, - trailerAxleCount: new int[] { }, - bodyCurbWeight: 2000, - trailerCurbWeight: new double[] { }, - trailerType: new TrailerType[] { }, - lowLoad: 762.3529, - refLoad: 3811.7647, - trailerGrossVehicleWeight: new double[] { }, - deltaCdA: 0, - maxLoad: 6150); - - AssertMission(segment.Missions[1], - vehicleData: vehicleData, - missionType: MissionType.UrbanDelivery, - cosswindCorrection: "RigidSolo", - axleWeightDistribution: new[] { 0.4, 0.6 }, - trailerAxleWeightDistribution: new double[] { }, - trailerAxleCount: new int[] { }, - bodyCurbWeight: 2000, - trailerCurbWeight: new double[] { }, - trailerType: new TrailerType[] { }, - lowLoad: 762.3529, - refLoad: 3811.7647, - trailerGrossVehicleWeight: new double[] { }, - deltaCdA: 0, - maxLoad: 6150); - } - - /// <summary> - /// fixed reference weight, trailer only in longhaul - /// </summary> - [TestCase] - public void Segment4Test() - { - var vehicleData = new { - VehicleCategory = VehicleCategory.RigidTruck, - AxleConfiguration = AxleConfiguration.AxleConfig_4x2, - GrossVehicleMassRating = 18000.SI<Kilogram>(), - CurbWeight = 7500.SI<Kilogram>() - }; - - var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, - vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, false); - - Assert.AreEqual(VehicleClass.Class4, segment.VehicleClass); - - var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); - TestAcceleration(data); - - Assert.AreEqual(4, segment.Missions.Length); - - AssertMission(segment.Missions[0], - vehicleData: vehicleData, - missionType: MissionType.LongHaul, - cosswindCorrection: "RigidTrailer", - axleWeightDistribution: new[] { 0.2, 0.3 }, - trailerAxleWeightDistribution: new[] { 0.5 }, - trailerAxleCount: new[] { 2 }, - bodyCurbWeight: 2100, - trailerCurbWeight: new[] { 5400.0 }, - trailerType: new[] { TrailerType.T2 }, - lowLoad: 1900, - refLoad: 14000, - trailerGrossVehicleWeight: new[] { 18000.0 }, - deltaCdA: 1.5, - maxLoad: 21000); - - AssertMission(segment.Missions[1], - vehicleData: vehicleData, - missionType: MissionType.RegionalDelivery, - cosswindCorrection: "RigidSolo", - axleWeightDistribution: new[] { 0.45, 0.55 }, - trailerAxleWeightDistribution: new double[] { }, - trailerAxleCount: new int[] { }, - bodyCurbWeight: 2100, - trailerCurbWeight: new double[] { }, - trailerType: new TrailerType[] { }, - lowLoad: 900, - refLoad: 4400, - trailerGrossVehicleWeight: new double[] { }, - deltaCdA: 0, - maxLoad: 8400); - - AssertMission(segment.Missions[2], - vehicleData: vehicleData, - missionType: MissionType.UrbanDelivery, - cosswindCorrection: "RigidSolo", - axleWeightDistribution: new[] { 0.45, 0.55 }, - trailerAxleWeightDistribution: new double[] { }, - trailerAxleCount: new int[] { }, - bodyCurbWeight: 2100, - trailerCurbWeight: new double[] { }, - trailerType: new TrailerType[] { }, - lowLoad: 900, - refLoad: 4400, - trailerGrossVehicleWeight: new double[] { }, - deltaCdA: 0, - maxLoad: 8400); - - AssertMission(segment.Missions[3], - vehicleData: vehicleData, - missionType: MissionType.MunicipalUtility, - cosswindCorrection: "RigidSolo", - axleWeightDistribution: new[] { 0.45, 0.55 }, - trailerAxleWeightDistribution: new double[] { }, - trailerAxleCount: new int[] { }, - bodyCurbWeight: 6000, - trailerCurbWeight: new double[] { }, - trailerType: new TrailerType[] { }, - lowLoad: 600, - refLoad: 3000, - trailerGrossVehicleWeight: new double[] { }, - deltaCdA: 0, - maxLoad: 4500); - } - - /// <summary> - /// fixed reference weight, trailer only in longhaul - /// </summary> - [TestCase] - public void Segment4VocationalTest() - { - var vehicleData = new { - VehicleCategory = VehicleCategory.RigidTruck, - AxleConfiguration = AxleConfiguration.AxleConfig_4x2, - GrossVehicleMassRating = 18000.SI<Kilogram>(), - CurbWeight = 7500.SI<Kilogram>() - }; - - var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, - vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, true); - - Assert.AreEqual(VehicleClass.Class4, segment.VehicleClass); - - var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); - TestAcceleration(data); - - Assert.AreEqual(2, segment.Missions.Length); - - AssertMission(segment.Missions[0], - vehicleData: vehicleData, - missionType: MissionType.MunicipalUtility, - cosswindCorrection: "RigidSolo", - axleWeightDistribution: new[] { 0.45, 0.55 }, - trailerAxleWeightDistribution: new double[] { }, - trailerAxleCount: new int[] { }, - bodyCurbWeight: 6000, - trailerCurbWeight: new double[] { }, - trailerType: new TrailerType[] { }, - lowLoad: 600, - refLoad: 3000, - trailerGrossVehicleWeight: new double[] { }, - deltaCdA: 0, - maxLoad: 4500); - - AssertMission(segment.Missions[1], - vehicleData: vehicleData, - missionType: MissionType.Construction, - cosswindCorrection: "RigidSolo", - axleWeightDistribution: new[] { 0.45, 0.55 }, - trailerAxleWeightDistribution: new double[] { }, - trailerAxleCount: new int[] { }, - bodyCurbWeight: 2000, - trailerCurbWeight: new double[] { }, - trailerType: new TrailerType[] { }, - lowLoad: 900, - refLoad: 4400, - trailerGrossVehicleWeight: new double[] { }, - deltaCdA: 0, - maxLoad: 8500); - } - - /// <summary> - /// Segment 5: fixed reference weight, trailer always used - /// </summary> - [TestCase] - public void Segment5Test() - { - var vehicleData = new { - VehicleCategory = VehicleCategory.Tractor, - AxleConfiguration = AxleConfiguration.AxleConfig_4x2, - GrossVehicleMassRating = 18000.SI<Kilogram>(), - CurbWeight = 7500.SI<Kilogram>() - }; - - var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, - vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, false); - - Assert.AreEqual(VehicleClass.Class5, segment.VehicleClass); - - var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); - TestAcceleration(data); - - Assert.AreEqual(5, segment.Missions.Length); - - AssertMission(segment.Missions[0], - vehicleData: vehicleData, - missionType: MissionType.LongHaul, - cosswindCorrection: "TractorSemitrailer", - axleWeightDistribution: new[] { 0.2, 0.25 }, - trailerAxleWeightDistribution: new[] { 0.55 }, - trailerAxleCount: new[] { 3 }, bodyCurbWeight: 0, - trailerCurbWeight: new[] { 7500.0 }, - trailerType: new[] { TrailerType.ST1 }, - lowLoad: 2600, - refLoad: 19300, - trailerGrossVehicleWeight: new[] { 24000.0 }, - deltaCdA: 0, - maxLoad: 25000); - - AssertMission(segment.Missions[1], - vehicleData: vehicleData, - missionType: MissionType.LongHaulEMS, - cosswindCorrection: "RigidTrailer", - axleWeightDistribution: new[] { 0.15, 0.2 }, - trailerAxleWeightDistribution: new[] { 0.40, 0.25 }, - trailerAxleCount: new[] { 3, 2 }, - bodyCurbWeight: 0, - trailerCurbWeight: new[] { 7500.0, 5400 }, - trailerType: new[] { TrailerType.ST1, TrailerType.T2 }, - lowLoad: 3500, - refLoad: 26500, - trailerGrossVehicleWeight: new[] { 24000.0, 18000 }, - deltaCdA: 1.5, - maxLoad: 39600, - ems: true); - - AssertMission(segment.Missions[2], - vehicleData: vehicleData, - missionType: MissionType.RegionalDelivery, - cosswindCorrection: "TractorSemitrailer", - axleWeightDistribution: new[] { 0.25, 0.25 }, - trailerAxleWeightDistribution: new[] { 0.5 }, - trailerAxleCount: new[] { 3 }, - bodyCurbWeight: 0, - trailerCurbWeight: new[] { 7500.0 }, - trailerType: new[] { TrailerType.ST1 }, - lowLoad: 2600, - refLoad: 12900, - trailerGrossVehicleWeight: new[] { 24000.0 }, - deltaCdA: 0, maxLoad: 25000); - - AssertMission(segment.Missions[3], - vehicleData: vehicleData, - missionType: MissionType.RegionalDeliveryEMS, - cosswindCorrection: "RigidTrailer", - axleWeightDistribution: new[] { 0.175, 0.25 }, - trailerAxleWeightDistribution: new[] { 0.35, 0.225 }, - trailerAxleCount: new[] { 3, 2 }, - bodyCurbWeight: 0, - trailerCurbWeight: new[] { 7500.0, 5400 }, - trailerType: new[] { TrailerType.ST1, TrailerType.T2 }, - lowLoad: 3500, - refLoad: 17500, - trailerGrossVehicleWeight: new[] { 24000.0, 18000 }, - deltaCdA: 1.5, - maxLoad: 39600, - ems: true); - } - - /// <summary> - /// Segment 5: fixed reference weight, trailer always used - /// </summary> - [TestCase] - public void Segment5VocationalTest() - { - var vehicleData = new { - VehicleCategory = VehicleCategory.Tractor, - AxleConfiguration = AxleConfiguration.AxleConfig_4x2, - GrossVehicleMassRating = 18000.SI<Kilogram>(), - CurbWeight = 7500.SI<Kilogram>() - }; - - var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, - vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, true); - - Assert.AreEqual(VehicleClass.Class5, segment.VehicleClass); - - var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); - TestAcceleration(data); - - Assert.AreEqual(1, segment.Missions.Length); - - AssertMission(segment.Missions[0], - vehicleData: vehicleData, - missionType: MissionType.Construction, - cosswindCorrection: "TractorSemitrailer", - axleWeightDistribution: new[] { 0.25, 0.25 }, - trailerAxleWeightDistribution: new[] { 0.5 }, - trailerAxleCount: new[] { 3 }, bodyCurbWeight: 0, - trailerCurbWeight: new[] { 6100.0 }, - trailerType: new[] { TrailerType.STT1 }, - lowLoad: 2600, - refLoad: 12900, - trailerGrossVehicleWeight: new[] { 24000.0 }, - deltaCdA: 0, - maxLoad: 26400); - - } - - /// <summary> - /// Segment 9: fixed reference weight, trailer always used - /// </summary> - [TestCase] - public void Segment9Test() - { - var vehicleData = new { - VehicleCategory = VehicleCategory.RigidTruck, - AxleConfiguration = AxleConfiguration.AxleConfig_6x2, - GrossVehicleMassRating = 24000.SI<Kilogram>(), - CurbWeight = 7500.SI<Kilogram>() - }; - - var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, - vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, false); - - Assert.AreEqual(VehicleClass.Class9, segment.VehicleClass); - - var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); - TestAcceleration(data); - - Assert.AreEqual(5, segment.Missions.Length); - - AssertMission(segment.Missions[0], - vehicleData: vehicleData, - missionType: MissionType.LongHaul, - cosswindCorrection: "RigidTrailer", - axleWeightDistribution: new[] { 0.2, 0.3, 0.15 }, - trailerAxleWeightDistribution: new[] { 0.35 }, - trailerAxleCount: new[] { 2 }, - bodyCurbWeight: 2200, - trailerCurbWeight: new[] { 5400.0 }, - trailerType: new[] { TrailerType.T2 }, - lowLoad: 2600, - refLoad: 19300, - trailerGrossVehicleWeight: new[] { 18000.0 }, - deltaCdA: 1.5, - maxLoad: 24900); - - AssertMission(segment.Missions[1], - vehicleData: vehicleData, - missionType: MissionType.LongHaulEMS, - cosswindCorrection: "RigidTrailer", - axleWeightDistribution: new[] { 0.15, 0.2, 0.1 }, - trailerAxleWeightDistribution: new[] { 0.225, 0.325 }, - trailerAxleCount: new[] { 2, 3 }, - bodyCurbWeight: 2200, - trailerCurbWeight: new[] { 2500, 7500.0 }, - trailerType: new[] { TrailerType.Dolly, TrailerType.ST1 }, - lowLoad: 3500, - refLoad: 26500, - trailerGrossVehicleWeight: new[] { 12000.0, 24000 }, - deltaCdA: 2.1, - maxLoad: 40300, - ems: true); - - AssertMission(segment.Missions[2], - vehicleData: vehicleData, - missionType: MissionType.RegionalDelivery, - cosswindCorrection: "RigidSolo", - axleWeightDistribution: new[] { 0.35, 0.4, 0.25 }, - trailerAxleWeightDistribution: new double[] { }, - trailerAxleCount: new int[] { }, - bodyCurbWeight: 2200, - trailerCurbWeight: new double[] { }, - trailerType: new TrailerType[] { }, - lowLoad: 1400, - refLoad: 7100, - trailerGrossVehicleWeight: new double[] { }, - deltaCdA: 0, - maxLoad: 14300); - - AssertMission(segment.Missions[3], - vehicleData: vehicleData, - missionType: MissionType.RegionalDeliveryEMS, - cosswindCorrection: "RigidTrailer", - axleWeightDistribution: new[] { 0.175, 0.2, 0.1 }, - trailerAxleWeightDistribution: new[] { 0.225, 0.3 }, - trailerAxleCount: new[] { 2, 3 }, - bodyCurbWeight: 2200, - trailerCurbWeight: new[] { 2500, 7500.0 }, - trailerType: new[] { TrailerType.Dolly, TrailerType.ST1 }, - lowLoad: 3500, - refLoad: 17500, - trailerGrossVehicleWeight: new[] { 12000.0, 24000 }, - deltaCdA: 2.1, - maxLoad: 40300, - ems: true); - - AssertMission(segment.Missions[4], - vehicleData: vehicleData, - missionType: MissionType.MunicipalUtility, - cosswindCorrection: "RigidSolo", - axleWeightDistribution: new[] { 0.35, 0.4, 0.25 }, - trailerAxleWeightDistribution: new double[] { }, - trailerAxleCount: new int[] { }, - bodyCurbWeight: 6750, - trailerCurbWeight: new double[] { }, - trailerType: new TrailerType[] { }, - lowLoad: 1200, - refLoad: 6000, - trailerGrossVehicleWeight: new double[] { }, - deltaCdA: 0, - maxLoad: 9750); - } - - /// <summary> - /// Segment 9: fixed reference weight, trailer always used - /// </summary> - [TestCase] - public void Segment9VocationalTest() - { - var vehicleData = new { - VehicleCategory = VehicleCategory.RigidTruck, - AxleConfiguration = AxleConfiguration.AxleConfig_6x2, - GrossVehicleMassRating = 24000.SI<Kilogram>(), - CurbWeight = 7500.SI<Kilogram>() - }; - - var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, - vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, true); - - Assert.AreEqual(VehicleClass.Class9, segment.VehicleClass); - - var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); - TestAcceleration(data); - - Assert.AreEqual(2, segment.Missions.Length); - - AssertMission(segment.Missions[0], - vehicleData: vehicleData, - missionType: MissionType.MunicipalUtility, - cosswindCorrection: "RigidSolo", - axleWeightDistribution: new[] { 0.35, 0.4, 0.25 }, - trailerAxleWeightDistribution: new double[] { }, - trailerAxleCount: new int[] { }, - bodyCurbWeight: 6750, - trailerCurbWeight: new double[] { }, - trailerType: new TrailerType[] { }, - lowLoad: 1200, - refLoad: 6000, - trailerGrossVehicleWeight: new double[] { }, - deltaCdA: 0, - maxLoad: 9750); - - AssertMission(segment.Missions[1], - vehicleData: vehicleData, - missionType: MissionType.Construction, - cosswindCorrection: "RigidSolo", - axleWeightDistribution: new[] { 0.35, 0.4, 0.25 }, - trailerAxleWeightDistribution: new double[] { }, - trailerAxleCount: new int[] { }, - bodyCurbWeight: 3230, - trailerCurbWeight: new double[] { }, - trailerType: new TrailerType[] { }, - lowLoad: 1400, - refLoad: 7100, - trailerGrossVehicleWeight: new double[] { }, - deltaCdA: 0, - maxLoad: 13270); - - } - - /// <summary> - /// Segment 10: fixed reference weight, trailer always used - /// </summary> - [TestCase] - public void Segment10Test() - { - var vehicleData = new { - VehicleCategory = VehicleCategory.Tractor, - AxleConfiguration = AxleConfiguration.AxleConfig_6x2, - GrossVehicleMassRating = 24000.SI<Kilogram>(), - CurbWeight = 7500.SI<Kilogram>() - }; - - var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, - vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, false); - - Assert.AreEqual(VehicleClass.Class10, segment.VehicleClass); - - var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); - TestAcceleration(data); - - Assert.AreEqual(4, segment.Missions.Length); - - AssertMission(segment.Missions[0], - vehicleData: vehicleData, - missionType: MissionType.LongHaul, - cosswindCorrection: "TractorSemitrailer", - axleWeightDistribution: new[] { 0.15, 0.1, 0.2 }, - trailerAxleWeightDistribution: new[] { 0.55 }, - trailerAxleCount: new[] { 3 }, - bodyCurbWeight: 0, - trailerCurbWeight: new[] { 7500.0 }, - trailerType: new[] { TrailerType.ST1 }, - lowLoad: 2600, - refLoad: 19300, - trailerGrossVehicleWeight: new[] { 24000.0 }, - deltaCdA: 0, - maxLoad: 25000); - - AssertMission(segment.Missions[1], - vehicleData: vehicleData, - missionType: MissionType.LongHaulEMS, - cosswindCorrection: "RigidTrailer", - axleWeightDistribution: new[] { 0.125, 0.15, 0.1 }, - trailerAxleWeightDistribution: new[] { 0.375, 0.25 }, - trailerAxleCount: new[] { 3, 2 }, - bodyCurbWeight: 0, - trailerCurbWeight: new[] { 7500.0, 5400 }, - trailerType: new[] { TrailerType.ST1, TrailerType.T2 }, - lowLoad: 3500, - refLoad: 26500, - trailerGrossVehicleWeight: new[] { 24000.0, 18000 }, - deltaCdA: 1.5, - maxLoad: 39600, - ems: true); - - AssertMission(segment.Missions[2], - vehicleData: vehicleData, - missionType: MissionType.RegionalDelivery, - cosswindCorrection: "TractorSemitrailer", - axleWeightDistribution: new[] { 0.2, 0.1, 0.2 }, - trailerAxleWeightDistribution: new[] { 0.5 }, - trailerAxleCount: new[] { 3 }, - bodyCurbWeight: 0, - trailerCurbWeight: new[] { 7500.0 }, - trailerType: new[] { TrailerType.ST1 }, - lowLoad: 2600, - refLoad: 12900, - trailerGrossVehicleWeight: new[] { 24000.0 }, - deltaCdA: 0, - maxLoad: 25000); - - AssertMission(segment.Missions[3], - vehicleData: vehicleData, - missionType: MissionType.RegionalDeliveryEMS, - cosswindCorrection: "RigidTrailer", - axleWeightDistribution: new[] { 0.15, 0.15, 0.1 }, - trailerAxleWeightDistribution: new[] { 0.35, 0.25 }, - trailerAxleCount: new[] { 3, 2 }, - bodyCurbWeight: 0, - trailerCurbWeight: new[] { 7500.0, 5400 }, - trailerType: new[] { TrailerType.ST1, TrailerType.T2 }, - lowLoad: 3500, - refLoad: 17500, - trailerGrossVehicleWeight: new[] { 24000.0, 18000 }, - deltaCdA: 1.5, - maxLoad: 39600, - ems: true); - } - - /// <summary> - /// Segment 10: fixed reference weight, trailer always used - /// </summary> - [TestCase] - public void Segment10VocationalTest() - { - var vehicleData = new { - VehicleCategory = VehicleCategory.Tractor, - AxleConfiguration = AxleConfiguration.AxleConfig_6x2, - GrossVehicleMassRating = 24000.SI<Kilogram>(), - CurbWeight = 7500.SI<Kilogram>() - }; - - var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, - vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, true); - - Assert.AreEqual(VehicleClass.Class10, segment.VehicleClass); - - var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); - TestAcceleration(data); - - Assert.AreEqual(1, segment.Missions.Length); - - AssertMission(segment.Missions[0], - vehicleData: vehicleData, - missionType: MissionType.Construction, - cosswindCorrection: "TractorSemitrailer", - axleWeightDistribution: new[] { 0.2, 0.1, 0.2 }, - trailerAxleWeightDistribution: new[] { 0.5 }, - trailerAxleCount: new[] { 2 }, - bodyCurbWeight: 0, - trailerCurbWeight: new[] { 5600.0 }, - trailerType: new[] { TrailerType.STT2 }, - lowLoad: 2600, - refLoad: 12900, - trailerGrossVehicleWeight: new[] { 18000.0 }, - deltaCdA: 0, - maxLoad: 26900); - - } - - /// <summary> - /// Segment 11: fixed reference weight, trailer always used - /// </summary> - [TestCase] - public void Segment11Test() - { - var vehicleData = new { - VehicleCategory = VehicleCategory.RigidTruck, - AxleConfiguration = AxleConfiguration.AxleConfig_6x4, - GrossVehicleMassRating = 24000.SI<Kilogram>(), - CurbWeight = 7500.SI<Kilogram>() - }; - - var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, - vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, false); - - Assert.AreEqual(VehicleClass.Class11, segment.VehicleClass); - - var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); - TestAcceleration(data); - - Assert.AreEqual(6, segment.Missions.Length); - - AssertMission(segment.Missions[0], - vehicleData: vehicleData, - missionType: MissionType.LongHaul, - cosswindCorrection: "RigidTrailer", - axleWeightDistribution: new[] { 0.2, 0.225, 0.225 }, - trailerAxleWeightDistribution: new[] { 0.35 }, - trailerAxleCount: new[] { 2 }, - bodyCurbWeight: 2200, - trailerCurbWeight: new[] { 5400.0 }, - trailerType: new[] { TrailerType.T2 }, - lowLoad: 2600, - refLoad: 19300, - trailerGrossVehicleWeight: new[] { 18000.0 }, - deltaCdA: 1.5, - maxLoad: 24900); - - AssertMission(segment.Missions[1], - vehicleData: vehicleData, - missionType: MissionType.LongHaulEMS, - cosswindCorrection: "RigidTrailer", - axleWeightDistribution: new[] { 0.15, 0.2, 0.1 }, - trailerAxleWeightDistribution: new[] { 0.225, 0.325 }, - trailerAxleCount: new[] { 2, 3 }, - bodyCurbWeight: 2200, - trailerCurbWeight: new[] { 2500, 7500.0 }, - trailerType: new[] { TrailerType.Dolly, TrailerType.ST1 }, - lowLoad: 3500, - refLoad: 26500, - trailerGrossVehicleWeight: new[] { 12000.0, 24000 }, - deltaCdA: 2.1, - maxLoad: 40300, - ems: true); - - AssertMission(segment.Missions[2], - vehicleData: vehicleData, - missionType: MissionType.RegionalDelivery, - cosswindCorrection: "RigidSolo", - axleWeightDistribution: new[] { 0.35, 0.35, 0.3 }, - trailerAxleWeightDistribution: new double[] { }, - trailerAxleCount: new int[] { }, bodyCurbWeight: 2200, - trailerCurbWeight: new double[] { }, - trailerType: new TrailerType[] { }, - lowLoad: 1400, - refLoad: 7100, - trailerGrossVehicleWeight: new double[] { }, - deltaCdA: 0, - maxLoad: 14300); - - AssertMission(segment.Missions[3], - vehicleData: vehicleData, - missionType: MissionType.RegionalDeliveryEMS, - cosswindCorrection: "RigidTrailer", - axleWeightDistribution: new[] { 0.175, 0.2, 0.1 }, - trailerAxleWeightDistribution: new[] { 0.225, 0.3 }, - trailerAxleCount: new[] { 2, 3 }, - bodyCurbWeight: 2200, - trailerCurbWeight: new[] { 2500, 7500.0 }, - trailerType: new[] { TrailerType.Dolly, TrailerType.ST1 }, - lowLoad: 3500, - refLoad: 17500, - trailerGrossVehicleWeight: new[] { 12000.0, 24000 }, - deltaCdA: 2.1, - maxLoad: 40300, - ems: true); - - AssertMission(segment.Missions[4], - vehicleData: vehicleData, - missionType: MissionType.MunicipalUtility, - cosswindCorrection: "RigidSolo", - axleWeightDistribution: new[] { 0.35, 0.35, 0.3 }, - trailerAxleWeightDistribution: new double[] { }, - trailerAxleCount: new int[] { }, - bodyCurbWeight: 6750, - trailerCurbWeight: new double[] { }, - trailerType: new TrailerType[] { }, - lowLoad: 1200, - refLoad: 6000, - trailerGrossVehicleWeight: new double[] { }, - deltaCdA: 0, - maxLoad: 9750); - - AssertMission(segment.Missions[5], - vehicleData: vehicleData, - missionType: MissionType.Construction, - cosswindCorrection: "RigidSolo", - axleWeightDistribution: new[] { 0.35, 0.35, 0.3 }, - trailerAxleWeightDistribution: new double[] { }, - trailerAxleCount: new int[] { }, - bodyCurbWeight: 3230, - trailerCurbWeight: new double[] { }, - trailerType: new TrailerType[] { }, - lowLoad: 1400, - refLoad: 7100, - trailerGrossVehicleWeight: new double[] { }, - deltaCdA: 0, - maxLoad: 13270); - } - - /// <summary> - /// Segment 10: fixed reference weight, trailer always used - /// </summary> - [TestCase] - public void Segment12Test() - { - var vehicleData = new { - VehicleCategory = VehicleCategory.Tractor, - AxleConfiguration = AxleConfiguration.AxleConfig_6x4, - GrossVehicleMassRating = 24000.SI<Kilogram>(), - CurbWeight = 7500.SI<Kilogram>() - }; - - var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, - vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, false); - - Assert.AreEqual(VehicleClass.Class12, segment.VehicleClass); - - var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); - TestAcceleration(data); - - Assert.AreEqual(5, segment.Missions.Length); - - AssertMission(segment.Missions[0], - vehicleData: vehicleData, - missionType: MissionType.LongHaul, - cosswindCorrection: "TractorSemitrailer", - axleWeightDistribution: new[] { 0.15, 0.15, 0.15 }, - trailerAxleWeightDistribution: new[] { 0.55 }, - trailerAxleCount: new[] { 3 }, - bodyCurbWeight: 0, - trailerCurbWeight: new[] { 7500.0 }, - trailerType: new[] { TrailerType.ST1 }, - lowLoad: 2600, - refLoad: 19300, - trailerGrossVehicleWeight: new[] { 24000.0 }, - deltaCdA: 0, - maxLoad: 25000); - - AssertMission(segment.Missions[1], - vehicleData: vehicleData, - missionType: MissionType.LongHaulEMS, - cosswindCorrection: "RigidTrailer", - axleWeightDistribution: new[] { 0.125, 0.15, 0.1 }, - trailerAxleWeightDistribution: new[] { 0.375, 0.25 }, - trailerAxleCount: new[] { 3, 2 }, - bodyCurbWeight: 0, - trailerCurbWeight: new[] { 7500.0, 5400 }, - trailerType: new[] { TrailerType.ST1, TrailerType.T2 }, - lowLoad: 3500, - refLoad: 26500, - trailerGrossVehicleWeight: new[] { 24000.0, 18000 }, - deltaCdA: 1.5, - maxLoad: 39600, - ems: true); - - AssertMission(segment.Missions[2], - vehicleData: vehicleData, - missionType: MissionType.RegionalDelivery, - cosswindCorrection: "TractorSemitrailer", - axleWeightDistribution: new[] { 0.2, 0.15, 0.15 }, - trailerAxleWeightDistribution: new[] { 0.5 }, - trailerAxleCount: new[] { 3 }, - bodyCurbWeight: 0, - trailerCurbWeight: new[] { 7500.0 }, - trailerType: new[] { TrailerType.ST1 }, - lowLoad: 2600, - refLoad: 12900, - trailerGrossVehicleWeight: new[] { 24000.0 }, - deltaCdA: 0, - maxLoad: 25000); - - AssertMission(segment.Missions[3], - vehicleData: vehicleData, - missionType: MissionType.RegionalDeliveryEMS, - cosswindCorrection: "RigidTrailer", - axleWeightDistribution: new[] { 0.15, 0.15, 0.1 }, - trailerAxleWeightDistribution: new[] { 0.35, 0.25 }, - trailerAxleCount: new[] { 3, 2 }, - bodyCurbWeight: 0, - trailerCurbWeight: new[] { 7500.0, 5400 }, - trailerType: new[] { TrailerType.ST1, TrailerType.T2 }, - lowLoad: 3500, - refLoad: 17500, - trailerGrossVehicleWeight: new[] { 24000.0, 18000 }, - deltaCdA: 1.5, - maxLoad: 39600, - ems: true); - - AssertMission(segment.Missions[4], - vehicleData: vehicleData, - missionType: MissionType.Construction, - cosswindCorrection: "TractorSemitrailer", - axleWeightDistribution: new[] { 0.2, 0.15, 0.15 }, - trailerAxleWeightDistribution: new[] { 0.5 }, - trailerAxleCount: new[] { 2 }, - bodyCurbWeight: 0, - trailerCurbWeight: new[] { 5600.0 }, - trailerType: new[] { TrailerType.STT2 }, - lowLoad: 2600, - refLoad: 12900, - trailerGrossVehicleWeight: new[] { 18000.0 }, - deltaCdA: 0, - maxLoad: 26900, - ems: false); - } - - /// <summary> - /// Segment 9: fixed reference weight, trailer always used - /// </summary> - [TestCase] - public void Segment16Test() - { - var vehicleData = new { - VehicleCategory = VehicleCategory.RigidTruck, - AxleConfiguration = AxleConfiguration.AxleConfig_8x4, - GrossVehicleMassRating = 36000.SI<Kilogram>(), - CurbWeight = 7500.SI<Kilogram>() - }; - - var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, - vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, false); - - Assert.AreEqual(VehicleClass.Class16, segment.VehicleClass); - - var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); - TestAcceleration(data); - - Assert.AreEqual(1, segment.Missions.Length); - - AssertMission(segment.Missions[0], - vehicleData: vehicleData, - missionType: MissionType.Construction, - cosswindCorrection: "RigidSolo", - axleWeightDistribution: new[] { 0.25, 0.25, 0.25, 0.25 }, - trailerAxleWeightDistribution: new double[] { }, - trailerAxleCount: new int[] { }, - bodyCurbWeight: 4355, - trailerCurbWeight: new double[] { }, - trailerType: new TrailerType[] { }, - lowLoad: 2600, - refLoad: 12900, - trailerGrossVehicleWeight: new double[] { }, - deltaCdA: 0, - maxLoad: 24145); - } - - public static void AssertMission(Mission m, dynamic vehicleData, MissionType missionType, string cosswindCorrection, - double[] axleWeightDistribution, double[] trailerAxleWeightDistribution, int[] trailerAxleCount, - double bodyCurbWeight, double[] trailerCurbWeight, TrailerType[] trailerType, double lowLoad, double refLoad, - double maxLoad, double[] trailerGrossVehicleWeight, double deltaCdA, bool ems = false) - { - Assert.AreEqual(missionType, m.MissionType); - Assert.AreEqual(cosswindCorrection, m.CrossWindCorrectionParameters); - CollectionAssert.AreEqual(axleWeightDistribution, m.AxleWeightDistribution, - "Axle distribution not equal.\nexpected: {0}\nactual: {1}", string.Join(",", axleWeightDistribution), - string.Join(",", m.AxleWeightDistribution)); - CollectionAssert.AreEqual(trailerAxleWeightDistribution, m.Trailer.Select(t => t.TrailerAxleWeightShare), - "Trailer axle distribution not equal.\nexpected: {0}\nactual: {1}", string.Join(",", trailerAxleWeightDistribution), - string.Join(",", m.Trailer.Select(t => t.TrailerAxleWeightShare))); - Assert.AreEqual(bodyCurbWeight.SI<Kilogram>(), m.BodyCurbWeight); - CollectionAssert.AreEqual(trailerCurbWeight, m.Trailer.Select(t => t.TrailerCurbWeight.Value())); - CollectionAssert.AreEqual(trailerType, m.Trailer.Select(t => t.TrailerType)); - CollectionAssert.AreEqual(trailerAxleCount, m.Trailer.Select(t => t.TrailerWheels.Count)); - Assert.IsNotNull(m.CycleFile); - Assert.IsTrue(!string.IsNullOrEmpty(new StreamReader(m.CycleFile).ReadLine())); - Assert.AreEqual(0.SI<Kilogram>(), m.MinLoad); - AssertHelper.AreRelativeEqual(lowLoad, m.LowLoad); - AssertHelper.AreRelativeEqual(refLoad, m.RefLoad); - Assert.AreEqual(maxLoad.SI<Kilogram>(), m.MaxLoad); - CollectionAssert.AreEqual(trailerGrossVehicleWeight, m.Trailer.Select(t => t.TrailerGrossVehicleWeight.Value())); - Assert.AreEqual( - VectoMath.Min( - vehicleData.GrossVehicleMassRating + - m.Trailer.Sum(t => t.TrailerGrossVehicleWeight).DefaultIfNull(0), - ems ? 60000.SI<Kilogram>() : 40000.SI<Kilogram>()) - - m.BodyCurbWeight - m.Trailer.Sum(t => t.TrailerCurbWeight).DefaultIfNull(0) - - vehicleData.CurbWeight, - m.MaxLoad); - Assert.AreEqual(deltaCdA.SI<SquareMeter>(), - m.Trailer.Sum(t => t.DeltaCdA).DefaultIfNull(0)); - } - - private static void EqualAcceleration(AccelerationCurveData data, double velocity, double acceleration, - double deceleration) - { - var entry = data.Lookup(velocity.KMPHtoMeterPerSecond()); - Assert.AreEqual(entry.Acceleration.Value(), acceleration, Tolerance); - Assert.AreEqual(entry.Deceleration.Value(), deceleration, Tolerance); - } - - private static void TestAcceleration(AccelerationCurveData data) - { - // FIXED POINTS - EqualAcceleration(data, 0, 1, -1); - EqualAcceleration(data, 25, 1, -1); - EqualAcceleration(data, 50, 0.642857143, -1); - EqualAcceleration(data, 60, 0.5, -0.5); - EqualAcceleration(data, 120, 0.5, -0.5); - - // INTERPOLATED POINTS - EqualAcceleration(data, 20, 1, -1); - EqualAcceleration(data, 40, 0.785714286, -1); - EqualAcceleration(data, 55, 0.571428572, -0.75); - EqualAcceleration(data, 80, 0.5, -0.5); - EqualAcceleration(data, 100, 0.5, -0.5); - - // EXTRAPOLATE - EqualAcceleration(data, -20, 1, -1); - EqualAcceleration(data, 140, 0.5, -0.5); - } - - [TestCase] - public void Declaration_WheelsForT1_Class2() - { - var dataProvider = - JSONInputDataFactory.ReadJsonJob(@"TestData\Jobs\12t Delivery Truck.vecto") as IDeclarationInputDataProvider; - var dataReader = new DeclarationModeVectoRunDataFactory(dataProvider, null); - - var runs = dataReader.NextRun().ToList(); - Assert.AreEqual(6, runs.Count); - var withT1 = new[] { 6.0, 6.0, 4.5, 4.5 }; - - CollectionAssert.AreEqual(withT1, runs[0].VehicleData.AxleData.Select(a => a.Inertia.Value())); - CollectionAssert.AreEqual(withT1, runs[1].VehicleData.AxleData.Select(a => a.Inertia.Value())); - - var bodyOnly = new[] { 6.0, 6.0 }; - - CollectionAssert.AreEqual(bodyOnly, runs[2].VehicleData.AxleData.Select(a => a.Inertia.Value())); - CollectionAssert.AreEqual(bodyOnly, runs[3].VehicleData.AxleData.Select(a => a.Inertia.Value())); - - CollectionAssert.AreEqual(bodyOnly, runs[4].VehicleData.AxleData.Select(a => a.Inertia.Value())); - CollectionAssert.AreEqual(bodyOnly, runs[5].VehicleData.AxleData.Select(a => a.Inertia.Value())); - } - - [TestCase] - public void Declaration_WheelsForT2_Class4() - { - var dataProvider = - JSONInputDataFactory.ReadJsonJob( - @"TestData\Jobs\Class4_40t_Long_Haul_Truck.vecto") as IDeclarationInputDataProvider; - var dataReader = new DeclarationModeVectoRunDataFactory(dataProvider, null); - - var runs = dataReader.NextRun().ToList(); - Assert.AreEqual(8, runs.Count); - var withT1 = new[] { 14.9, 14.9, 19.2, 19.2 }; - CollectionAssert.AreEqual(withT1, runs[0].VehicleData.AxleData.Select(a => a.Inertia.Value())); - CollectionAssert.AreEqual(withT1, runs[1].VehicleData.AxleData.Select(a => a.Inertia.Value())); - - var bodyOnly = new[] { 14.9, 14.9 }; - CollectionAssert.AreEqual(bodyOnly, runs[2].VehicleData.AxleData.Select(a => a.Inertia.Value())); - CollectionAssert.AreEqual(bodyOnly, runs[3].VehicleData.AxleData.Select(a => a.Inertia.Value())); - - CollectionAssert.AreEqual(bodyOnly, runs[4].VehicleData.AxleData.Select(a => a.Inertia.Value())); - CollectionAssert.AreEqual(bodyOnly, runs[5].VehicleData.AxleData.Select(a => a.Inertia.Value())); - - CollectionAssert.AreEqual(bodyOnly, runs[6].VehicleData.AxleData.Select(a => a.Inertia.Value())); - CollectionAssert.AreEqual(bodyOnly, runs[7].VehicleData.AxleData.Select(a => a.Inertia.Value())); - } - - [TestCase] - public void Declaration_WheelsForDefault_Class5() - { - var dataProvider = - JSONInputDataFactory.ReadJsonJob(@"TestData\Jobs\40t_Long_Haul_Truck.vecto") as IDeclarationInputDataProvider; - var dataReader = new DeclarationModeVectoRunDataFactory(dataProvider, null); - - var runs = dataReader.NextRun().ToList(); - - Assert.AreEqual(VehicleClass.Class5, runs[0].VehicleData.VehicleClass); - Assert.AreEqual(10, runs.Count); - - //var bodyOnly = new[] { 14.9, 14.9 }; - var withST1 = new[] { 14.9, 14.9, 19.2, 19.2, 19.2 }; - var withSTT1 = new[] { 14.9, 14.9, 19.2, 19.2, 19.2 }; - var withST1andT2 = new[] { 14.9, 14.9, 19.2, 19.2, 19.2, 19.2, 19.2 }; - - CollectionAssert.AreEqual(withST1, runs[0].VehicleData.AxleData.Select(a => a.Inertia.Value())); - CollectionAssert.AreEqual(withST1, runs[1].VehicleData.AxleData.Select(a => a.Inertia.Value())); - - CollectionAssert.AreEqual(withST1andT2, runs[2].VehicleData.AxleData.Select(a => a.Inertia.Value())); - CollectionAssert.AreEqual(withST1andT2, runs[3].VehicleData.AxleData.Select(a => a.Inertia.Value())); - - CollectionAssert.AreEqual(withST1, runs[4].VehicleData.AxleData.Select(a => a.Inertia.Value())); - CollectionAssert.AreEqual(withST1, runs[5].VehicleData.AxleData.Select(a => a.Inertia.Value())); - - CollectionAssert.AreEqual(withST1andT2, runs[6].VehicleData.AxleData.Select(a => a.Inertia.Value())); - CollectionAssert.AreEqual(withST1andT2, runs[7].VehicleData.AxleData.Select(a => a.Inertia.Value())); - - CollectionAssert.AreEqual(withSTT1, runs[8].VehicleData.AxleData.Select(a => a.Inertia.Value())); - CollectionAssert.AreEqual(withSTT1, runs[9].VehicleData.AxleData.Select(a => a.Inertia.Value())); - } - - - [ - TestCase("Diesel CI", null, 1.0), - TestCase("Ethanol CI", null, 1.011811), - TestCase("Petrol PI", null, 1.0), - TestCase("Ethanol PI", null, 0.993174), - TestCase("NG PI", TankSystem.Liquefied, 0.918533), - TestCase("NG PI", TankSystem.Compressed, 0.939583) - ] - public void TestNCVCorrection(string fuelTypeStr, TankSystem? tankSystem, double expectedCorrectionFactor) - { - var fuelType = fuelTypeStr.ParseEnum<FuelType>(); - var cf = DeclarationData.FuelData.Lookup(fuelType, tankSystem).HeatingValueCorrection; - - Assert.AreEqual(expectedCorrectionFactor, cf, 1e-6); - } - - [ - TestCase(VehicleClass.Class4, true, 169.9, WeightingGroup.Group4UD), - TestCase(VehicleClass.Class4, false, 169.9, WeightingGroup.Group4UD), - TestCase(VehicleClass.Class4, false, 170, WeightingGroup.Group4RD), - TestCase(VehicleClass.Class4, true, 170, WeightingGroup.Group4RD), - TestCase(VehicleClass.Class4, true, 264.9, WeightingGroup.Group4RD), - TestCase(VehicleClass.Class4, true, 265, WeightingGroup.Group4LH), - - TestCase(VehicleClass.Class5, false, 169.9, WeightingGroup.Group5RD), - TestCase(VehicleClass.Class5, false, 170, WeightingGroup.Group5RD), - TestCase(VehicleClass.Class5, false, 264.9, WeightingGroup.Group5RD), - TestCase(VehicleClass.Class5, false, 265, WeightingGroup.Group5RD), - TestCase(VehicleClass.Class5, true, 264.9, WeightingGroup.Group5RD), - TestCase(VehicleClass.Class5, true, 265, WeightingGroup.Group5LH), - - TestCase(VehicleClass.Class9, false, 169.9, WeightingGroup.Group9RD), - TestCase(VehicleClass.Class9, false, 264.9, WeightingGroup.Group9RD), - TestCase(VehicleClass.Class9, false, 265, WeightingGroup.Group9RD), - TestCase(VehicleClass.Class9, true, 169.9, WeightingGroup.Group9LH), - TestCase(VehicleClass.Class9, true, 264.9, WeightingGroup.Group9LH), - TestCase(VehicleClass.Class9, true, 265, WeightingGroup.Group9LH), - - TestCase(VehicleClass.Class10, false, 169.9, WeightingGroup.Group10RD), - TestCase(VehicleClass.Class10, false, 264.9, WeightingGroup.Group10RD), - TestCase(VehicleClass.Class10, false, 265, WeightingGroup.Group10RD), - TestCase(VehicleClass.Class10, true, 169.9, WeightingGroup.Group10LH), - TestCase(VehicleClass.Class10, true, 264.9, WeightingGroup.Group10LH), - TestCase(VehicleClass.Class10, true, 265, WeightingGroup.Group10LH), - ] - public void TestWeightingGroupLookup( - VehicleClass vehicleGroup, bool sleeperCab, double ratedPowerkWm, WeightingGroup expectedWeightingGroup) - { - var wGroup = DeclarationData.WeightingGroup.Lookup( - vehicleGroup, sleeperCab, ratedPowerkWm.SI(Unit.SI.Kilo.Watt).Cast<Watt>()); - Assert.AreEqual(expectedWeightingGroup, wGroup); - } - - [ - TestCase(WeightingGroup.Group4UD, 0, 0, 0, 0, 0.5, 0.5), - TestCase(WeightingGroup.Group4RD, 0.45, 0.45, 0.05, 0.05, 0, 0), - TestCase(WeightingGroup.Group4LH, 0.05, 0.05, 0.45, 0.45, 0, 0), - - TestCase(WeightingGroup.Group5RD, 0.27, 0.63, 0.03, 0.07, 0, 0), - TestCase(WeightingGroup.Group5LH, 0.03, 0.07, 0.27, 0.63, 0, 0), - - TestCase(WeightingGroup.Group9RD, 0.27, 0.63, 0.03, 0.07, 0, 0), - TestCase(WeightingGroup.Group9LH, 0.03, 0.07, 0.27, 0.63, 0, 0), - - TestCase(WeightingGroup.Group10RD, 0.27, 0.63, 0.03, 0.07, 0, 0), - TestCase(WeightingGroup.Group10LH, 0.03, 0.07, 0.27, 0.63, 0, 0), - ] - public void TestMissionProfileWeights( - WeightingGroup group, double eRdLow, double eRdRef, double eLhLow, double eLhRef, double eUdLow, double eUdRef) - { - var factors = DeclarationData.WeightingFactors.Lookup(group); - - Assert.AreEqual(1, factors.Values.Sum(x => x), 1e-9); - - Assert.AreEqual(eLhLow, factors[Tuple.Create(MissionType.LongHaul, LoadingType.LowLoading)], 1e-9); - Assert.AreEqual(eLhRef, factors[Tuple.Create(MissionType.LongHaul, LoadingType.ReferenceLoad)], 1e-9); - Assert.AreEqual(eRdLow, factors[Tuple.Create(MissionType.RegionalDelivery, LoadingType.LowLoading)], 1e-9); - Assert.AreEqual(eRdRef, factors[Tuple.Create(MissionType.RegionalDelivery, LoadingType.ReferenceLoad)], 1e-9); - Assert.AreEqual(eUdLow, factors[Tuple.Create(MissionType.UrbanDelivery, LoadingType.LowLoading)], 1e-9); - Assert.AreEqual(eUdRef, factors[Tuple.Create(MissionType.UrbanDelivery, LoadingType.ReferenceLoad)], 1e-9); - - Assert.AreEqual(0, factors[Tuple.Create(MissionType.Construction, LoadingType.LowLoading)], 1e-9); - Assert.AreEqual(0, factors[Tuple.Create(MissionType.Construction, LoadingType.LowLoading)], 1e-9); - Assert.AreEqual(0, factors[Tuple.Create(MissionType.MunicipalUtility, LoadingType.LowLoading)], 1e-9); - Assert.AreEqual(0, factors[Tuple.Create(MissionType.MunicipalUtility, LoadingType.ReferenceLoad)], 1e-9); - Assert.AreEqual(0, factors[Tuple.Create(MissionType.LongHaulEMS, LoadingType.LowLoading)], 1e-9); - Assert.AreEqual(0, factors[Tuple.Create(MissionType.LongHaulEMS, LoadingType.ReferenceLoad)], 1e-9); - Assert.AreEqual(0, factors[Tuple.Create(MissionType.RegionalDeliveryEMS, LoadingType.LowLoading)], 1e-9); - Assert.AreEqual(0, factors[Tuple.Create(MissionType.RegionalDeliveryEMS, LoadingType.ReferenceLoad)], 1e-9); - } - - - [ - TestCase(0.0030, "A"), - TestCase(0.0040, "A"), - TestCase(0.0050, "B"), - TestCase(0.0060, "C"), - TestCase(0.0070, "D"), - TestCase(0.0080, "E"), - - TestCase(0.0041, "B"), - TestCase(0.0051, "C"), - TestCase(0.0061, "D"), - TestCase(0.0071, "E"), - TestCase(0.0081, "F"), - - TestCase(0.00402, "A"), - TestCase(0.004049, "A"), - TestCase(0.00405, "B"), - TestCase(0.00407, "B"), - - TestCase(0.00502, "B"), - TestCase(0.005049, "B"), - TestCase(0.00505, "C"), - TestCase(0.00507, "C"), - ] - public void TestTyreLabelLookup(double rrc, string expectedClass) + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 7501, 0, false, VehicleClass.Class1, + new[] { 36.5, 36.5 }), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 7501, 0, false, VehicleClass.Class1, + new[] { 36.5, 36.5 }), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 12000, 0, false, VehicleClass.Class2, + new[] { 85.0, 45.2, 45.2 }), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 12000, 0, false, VehicleClass.Class2, + new[] { 85.0, 45.2, 45.2 }), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 16000, 0, false, VehicleClass.Class3, + new[] { 47.7, 47.7 }), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 16000, 0, false, VehicleClass.Class3, + new[] { 47.7, 47.7 }), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 18000, 0, false, VehicleClass.Class4, + new[] { 98.9, 49.4, 49.4, 0.0 }), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_4x2, 18000, 0, true, VehicleClass.Class4, + new[] { 0.0, 0.0 }), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 18000, 0, false, VehicleClass.Class5, + new[] { 91.0, 140.5, 91.0, 140.5, 91.0 }), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_4x2, 18000, 0, true, VehicleClass.Class5, + new[] { 0.0 }), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 16000, 0, false, VehicleClass.Class9, + new[] { 101.4, 142.9, 51.9, 142.9, 0.0 }), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x2, 16000, 0, true, VehicleClass.Class9, + new[] { 0.0, 0.0 }), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 16000, 0, false, VehicleClass.Class10, + new[] { 91.0, 140.5, 91.0, 140.5 }), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x2, 16000, 0, true, VehicleClass.Class10, + new[] { 0.0 }), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_6x4, 40000, 0, false, VehicleClass.Class11, + new[] { 101.4, 142.9, 51.9, 142.9, 0.0, 0.0 }), + TestCase(VehicleCategory.Tractor, AxleConfiguration.AxleConfig_6x4, 99000, 0, false, VehicleClass.Class12, + new[] { 91.0, 140.5, 91.0, 140.5, 0.0 }), + TestCase(VehicleCategory.RigidTruck, AxleConfiguration.AxleConfig_8x4, 99000, 0, false, VehicleClass.Class16, + new[] { 0.0 }) + ] + public void SegmentLookupCargoVolumeTest(VehicleCategory category, AxleConfiguration axleConfiguration, + double grossWeight, + double curbWeight, bool vocational, VehicleClass expectedClass, double[] expectedCargoVolume) + { + var segment = DeclarationData.Segments.Lookup(category, axleConfiguration, grossWeight.SI<Kilogram>(), + curbWeight.SI<Kilogram>(), vocational); + Assert.AreEqual(expectedClass, segment.VehicleClass); + Assert.AreEqual(expectedCargoVolume.Length, segment.Missions.Length); + for (var i = 0; i < expectedCargoVolume.Length; i++) + { + Assert.AreEqual(expectedCargoVolume[i], segment.Missions[i].TotalCargoVolume.Value()); + } + } + + /// <summary> + /// trailer in longhaul, always pc formula + /// </summary> + [TestCase] + public void Segment2Test() + { + var vehicleData = new + { + VehicleCategory = VehicleCategory.RigidTruck, + AxleConfiguration = AxleConfiguration.AxleConfig_4x2, + GrossVehicleMassRating = 11900.SI<Kilogram>(), + CurbWeight = 5850.SI<Kilogram>() + }; + + var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, + vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, false); + + Assert.AreEqual(VehicleClass.Class2, segment.VehicleClass); + + var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); + TestAcceleration(data); + + Assert.AreEqual(3, segment.Missions.Length); + + AssertMission(segment.Missions[0], + vehicleData: vehicleData, + missionType: MissionType.LongHaul, + cosswindCorrection: "RigidTrailer", + axleWeightDistribution: new[] { 0.225, 0.325 }, + trailerAxleWeightDistribution: new[] { 0.45 }, + trailerAxleCount: new[] { 2 }, + bodyCurbWeight: 1900, + trailerCurbWeight: new[] { 3400.0 }, + trailerType: new[] { TrailerType.T1 }, + lowLoad: 1296.8235, + refLoad: 9450, + trailerGrossVehicleWeight: new[] { 10500.0 }, + deltaCdA: 1.3, + maxLoad: 11250); + + AssertMission(segment.Missions[1], + vehicleData: vehicleData, + missionType: MissionType.RegionalDelivery, + cosswindCorrection: "RigidSolo", + axleWeightDistribution: new[] { 0.45, 0.55 }, + trailerAxleWeightDistribution: new double[] { }, + trailerAxleCount: new int[] { }, + bodyCurbWeight: 1900, + trailerCurbWeight: new double[] { }, + trailerType: new TrailerType[] { }, + lowLoad: 596.8235, + refLoad: 2984.1176, + trailerGrossVehicleWeight: new double[] { }, + deltaCdA: 0, + maxLoad: 4150); + + AssertMission(segment.Missions[2], + vehicleData: vehicleData, + missionType: MissionType.UrbanDelivery, + cosswindCorrection: "RigidSolo", + axleWeightDistribution: new[] { 0.45, 0.55 }, + trailerAxleWeightDistribution: new double[] { }, + trailerAxleCount: new int[] { }, + bodyCurbWeight: 1900, + trailerCurbWeight: new double[] { }, + trailerType: new TrailerType[] { }, + lowLoad: 596.8235, + refLoad: 2984.1176, + trailerGrossVehicleWeight: new double[] { }, + deltaCdA: 0, + maxLoad: 4150); + } + + + /// <summary> + /// trailer in longhaul, always pc formula + /// </summary> + [TestCase] + public void Segment2TestHeavy() + { + var vehicleData = new + { + VehicleCategory = VehicleCategory.RigidTruck, + AxleConfiguration = AxleConfiguration.AxleConfig_4x2, + GrossVehicleMassRating = 11990.SI<Kilogram>(), + CurbWeight = 9500.SI<Kilogram>() + }; + + var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, + vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, false); + + Assert.AreEqual(VehicleClass.Class2, segment.VehicleClass); + + var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); + TestAcceleration(data); + + Assert.AreEqual(3, segment.Missions.Length); + + AssertMission(segment.Missions[0], + vehicleData: vehicleData, + missionType: MissionType.LongHaul, + cosswindCorrection: "RigidTrailer", + axleWeightDistribution: new[] { 0.225, 0.325 }, + trailerAxleWeightDistribution: new[] { 0.45 }, + trailerAxleCount: new[] { 2 }, + bodyCurbWeight: 1900, + trailerCurbWeight: new[] { 3400.0 }, + trailerType: new[] { TrailerType.T1 }, + lowLoad: 1290, + refLoad: 5890, + trailerGrossVehicleWeight: new[] { 10500.0 }, + deltaCdA: 1.3, + maxLoad: 7690); + + AssertMission(segment.Missions[1], + vehicleData: vehicleData, + missionType: MissionType.RegionalDelivery, + cosswindCorrection: "RigidSolo", + axleWeightDistribution: new[] { 0.45, 0.55 }, + trailerAxleWeightDistribution: new double[] { }, + trailerAxleCount: new int[] { }, + bodyCurbWeight: 1900, + trailerCurbWeight: new double[] { }, + trailerType: new TrailerType[] { }, + lowLoad: 590, + refLoad: 590, + trailerGrossVehicleWeight: new double[] { }, + deltaCdA: 0, + maxLoad: 590); + + AssertMission(segment.Missions[2], + vehicleData: vehicleData, + missionType: MissionType.UrbanDelivery, + cosswindCorrection: "RigidSolo", + axleWeightDistribution: new[] { 0.45, 0.55 }, + trailerAxleWeightDistribution: new double[] { }, + trailerAxleCount: new int[] { }, + bodyCurbWeight: 1900, + trailerCurbWeight: new double[] { }, + trailerType: new TrailerType[] { }, + lowLoad: 590, + refLoad: 590, + trailerGrossVehicleWeight: new double[] { }, + deltaCdA: 0, + maxLoad: 590); + } + + + /// <summary> + /// normal pc formula, no trailer + /// </summary> + [TestCase] + public void Segment3Test() + { + var vehicleData = new + { + VehicleCategory = VehicleCategory.RigidTruck, + AxleConfiguration = AxleConfiguration.AxleConfig_4x2, + GrossVehicleMassRating = 14000.SI<Kilogram>(), + CurbWeight = 5850.SI<Kilogram>() + }; + + var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, + vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, false); + + Assert.AreEqual(VehicleClass.Class3, segment.VehicleClass); + + Assert.AreEqual(2, segment.Missions.Length); + + AssertMission(segment.Missions[0], + vehicleData: vehicleData, + missionType: MissionType.RegionalDelivery, + cosswindCorrection: "RigidSolo", + axleWeightDistribution: new[] { 0.4, 0.6 }, + trailerAxleWeightDistribution: new double[] { }, + trailerAxleCount: new int[] { }, + bodyCurbWeight: 2000, + trailerCurbWeight: new double[] { }, + trailerType: new TrailerType[] { }, + lowLoad: 762.3529, + refLoad: 3811.7647, + trailerGrossVehicleWeight: new double[] { }, + deltaCdA: 0, + maxLoad: 6150); + + AssertMission(segment.Missions[1], + vehicleData: vehicleData, + missionType: MissionType.UrbanDelivery, + cosswindCorrection: "RigidSolo", + axleWeightDistribution: new[] { 0.4, 0.6 }, + trailerAxleWeightDistribution: new double[] { }, + trailerAxleCount: new int[] { }, + bodyCurbWeight: 2000, + trailerCurbWeight: new double[] { }, + trailerType: new TrailerType[] { }, + lowLoad: 762.3529, + refLoad: 3811.7647, + trailerGrossVehicleWeight: new double[] { }, + deltaCdA: 0, + maxLoad: 6150); + } + + /// <summary> + /// fixed reference weight, trailer only in longhaul + /// </summary> + [TestCase] + public void Segment4Test() + { + var vehicleData = new + { + VehicleCategory = VehicleCategory.RigidTruck, + AxleConfiguration = AxleConfiguration.AxleConfig_4x2, + GrossVehicleMassRating = 18000.SI<Kilogram>(), + CurbWeight = 7500.SI<Kilogram>() + }; + + var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, + vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, false); + + Assert.AreEqual(VehicleClass.Class4, segment.VehicleClass); + + var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); + TestAcceleration(data); + + Assert.AreEqual(4, segment.Missions.Length); + + AssertMission(segment.Missions[0], + vehicleData: vehicleData, + missionType: MissionType.LongHaul, + cosswindCorrection: "RigidTrailer", + axleWeightDistribution: new[] { 0.2, 0.3 }, + trailerAxleWeightDistribution: new[] { 0.5 }, + trailerAxleCount: new[] { 2 }, + bodyCurbWeight: 2100, + trailerCurbWeight: new[] { 5400.0 }, + trailerType: new[] { TrailerType.T2 }, + lowLoad: 1900, + refLoad: 14000, + trailerGrossVehicleWeight: new[] { 18000.0 }, + deltaCdA: 1.5, + maxLoad: 21000); + + AssertMission(segment.Missions[1], + vehicleData: vehicleData, + missionType: MissionType.RegionalDelivery, + cosswindCorrection: "RigidSolo", + axleWeightDistribution: new[] { 0.45, 0.55 }, + trailerAxleWeightDistribution: new double[] { }, + trailerAxleCount: new int[] { }, + bodyCurbWeight: 2100, + trailerCurbWeight: new double[] { }, + trailerType: new TrailerType[] { }, + lowLoad: 900, + refLoad: 4400, + trailerGrossVehicleWeight: new double[] { }, + deltaCdA: 0, + maxLoad: 8400); + + AssertMission(segment.Missions[2], + vehicleData: vehicleData, + missionType: MissionType.UrbanDelivery, + cosswindCorrection: "RigidSolo", + axleWeightDistribution: new[] { 0.45, 0.55 }, + trailerAxleWeightDistribution: new double[] { }, + trailerAxleCount: new int[] { }, + bodyCurbWeight: 2100, + trailerCurbWeight: new double[] { }, + trailerType: new TrailerType[] { }, + lowLoad: 900, + refLoad: 4400, + trailerGrossVehicleWeight: new double[] { }, + deltaCdA: 0, + maxLoad: 8400); + + AssertMission(segment.Missions[3], + vehicleData: vehicleData, + missionType: MissionType.MunicipalUtility, + cosswindCorrection: "RigidSolo", + axleWeightDistribution: new[] { 0.45, 0.55 }, + trailerAxleWeightDistribution: new double[] { }, + trailerAxleCount: new int[] { }, + bodyCurbWeight: 6000, + trailerCurbWeight: new double[] { }, + trailerType: new TrailerType[] { }, + lowLoad: 600, + refLoad: 3000, + trailerGrossVehicleWeight: new double[] { }, + deltaCdA: 0, + maxLoad: 4500); + } + + /// <summary> + /// fixed reference weight, trailer only in longhaul + /// </summary> + [TestCase] + public void Segment4VocationalTest() + { + var vehicleData = new + { + VehicleCategory = VehicleCategory.RigidTruck, + AxleConfiguration = AxleConfiguration.AxleConfig_4x2, + GrossVehicleMassRating = 18000.SI<Kilogram>(), + CurbWeight = 7500.SI<Kilogram>() + }; + + var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, + vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, true); + + Assert.AreEqual(VehicleClass.Class4, segment.VehicleClass); + + var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); + TestAcceleration(data); + + Assert.AreEqual(2, segment.Missions.Length); + + AssertMission(segment.Missions[0], + vehicleData: vehicleData, + missionType: MissionType.MunicipalUtility, + cosswindCorrection: "RigidSolo", + axleWeightDistribution: new[] { 0.45, 0.55 }, + trailerAxleWeightDistribution: new double[] { }, + trailerAxleCount: new int[] { }, + bodyCurbWeight: 6000, + trailerCurbWeight: new double[] { }, + trailerType: new TrailerType[] { }, + lowLoad: 600, + refLoad: 3000, + trailerGrossVehicleWeight: new double[] { }, + deltaCdA: 0, + maxLoad: 4500); + + AssertMission(segment.Missions[1], + vehicleData: vehicleData, + missionType: MissionType.Construction, + cosswindCorrection: "RigidSolo", + axleWeightDistribution: new[] { 0.45, 0.55 }, + trailerAxleWeightDistribution: new double[] { }, + trailerAxleCount: new int[] { }, + bodyCurbWeight: 2000, + trailerCurbWeight: new double[] { }, + trailerType: new TrailerType[] { }, + lowLoad: 900, + refLoad: 4400, + trailerGrossVehicleWeight: new double[] { }, + deltaCdA: 0, + maxLoad: 8500); + } + + /// <summary> + /// Segment 5: fixed reference weight, trailer always used + /// </summary> + [TestCase] + public void Segment5Test() + { + var vehicleData = new + { + VehicleCategory = VehicleCategory.Tractor, + AxleConfiguration = AxleConfiguration.AxleConfig_4x2, + GrossVehicleMassRating = 18000.SI<Kilogram>(), + CurbWeight = 7500.SI<Kilogram>() + }; + + var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, + vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, false); + + Assert.AreEqual(VehicleClass.Class5, segment.VehicleClass); + + var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); + TestAcceleration(data); + + Assert.AreEqual(5, segment.Missions.Length); + + AssertMission(segment.Missions[0], + vehicleData: vehicleData, + missionType: MissionType.LongHaul, + cosswindCorrection: "TractorSemitrailer", + axleWeightDistribution: new[] { 0.2, 0.25 }, + trailerAxleWeightDistribution: new[] { 0.55 }, + trailerAxleCount: new[] { 3 }, bodyCurbWeight: 0, + trailerCurbWeight: new[] { 7500.0 }, + trailerType: new[] { TrailerType.ST1 }, + lowLoad: 2600, + refLoad: 19300, + trailerGrossVehicleWeight: new[] { 24000.0 }, + deltaCdA: 0, + maxLoad: 25000); + + AssertMission(segment.Missions[1], + vehicleData: vehicleData, + missionType: MissionType.LongHaulEMS, + cosswindCorrection: "RigidTrailer", + axleWeightDistribution: new[] { 0.15, 0.2 }, + trailerAxleWeightDistribution: new[] { 0.40, 0.25 }, + trailerAxleCount: new[] { 3, 2 }, + bodyCurbWeight: 0, + trailerCurbWeight: new[] { 7500.0, 5400 }, + trailerType: new[] { TrailerType.ST1, TrailerType.T2 }, + lowLoad: 3500, + refLoad: 26500, + trailerGrossVehicleWeight: new[] { 24000.0, 18000 }, + deltaCdA: 1.5, + maxLoad: 39600, + ems: true); + + AssertMission(segment.Missions[2], + vehicleData: vehicleData, + missionType: MissionType.RegionalDelivery, + cosswindCorrection: "TractorSemitrailer", + axleWeightDistribution: new[] { 0.25, 0.25 }, + trailerAxleWeightDistribution: new[] { 0.5 }, + trailerAxleCount: new[] { 3 }, + bodyCurbWeight: 0, + trailerCurbWeight: new[] { 7500.0 }, + trailerType: new[] { TrailerType.ST1 }, + lowLoad: 2600, + refLoad: 12900, + trailerGrossVehicleWeight: new[] { 24000.0 }, + deltaCdA: 0, maxLoad: 25000); + + AssertMission(segment.Missions[3], + vehicleData: vehicleData, + missionType: MissionType.RegionalDeliveryEMS, + cosswindCorrection: "RigidTrailer", + axleWeightDistribution: new[] { 0.175, 0.25 }, + trailerAxleWeightDistribution: new[] { 0.35, 0.225 }, + trailerAxleCount: new[] { 3, 2 }, + bodyCurbWeight: 0, + trailerCurbWeight: new[] { 7500.0, 5400 }, + trailerType: new[] { TrailerType.ST1, TrailerType.T2 }, + lowLoad: 3500, + refLoad: 17500, + trailerGrossVehicleWeight: new[] { 24000.0, 18000 }, + deltaCdA: 1.5, + maxLoad: 39600, + ems: true); + } + + /// <summary> + /// Segment 5: fixed reference weight, trailer always used + /// </summary> + [TestCase] + public void Segment5VocationalTest() + { + var vehicleData = new + { + VehicleCategory = VehicleCategory.Tractor, + AxleConfiguration = AxleConfiguration.AxleConfig_4x2, + GrossVehicleMassRating = 18000.SI<Kilogram>(), + CurbWeight = 7500.SI<Kilogram>() + }; + + var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, + vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, true); + + Assert.AreEqual(VehicleClass.Class5, segment.VehicleClass); + + var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); + TestAcceleration(data); + + Assert.AreEqual(1, segment.Missions.Length); + + AssertMission(segment.Missions[0], + vehicleData: vehicleData, + missionType: MissionType.Construction, + cosswindCorrection: "TractorSemitrailer", + axleWeightDistribution: new[] { 0.25, 0.25 }, + trailerAxleWeightDistribution: new[] { 0.5 }, + trailerAxleCount: new[] { 3 }, bodyCurbWeight: 0, + trailerCurbWeight: new[] { 6100.0 }, + trailerType: new[] { TrailerType.STT1 }, + lowLoad: 2600, + refLoad: 12900, + trailerGrossVehicleWeight: new[] { 24000.0 }, + deltaCdA: 0, + maxLoad: 26400); + + } + + /// <summary> + /// Segment 9: fixed reference weight, trailer always used + /// </summary> + [TestCase] + public void Segment9Test() + { + var vehicleData = new + { + VehicleCategory = VehicleCategory.RigidTruck, + AxleConfiguration = AxleConfiguration.AxleConfig_6x2, + GrossVehicleMassRating = 24000.SI<Kilogram>(), + CurbWeight = 7500.SI<Kilogram>() + }; + + var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, + vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, false); + + Assert.AreEqual(VehicleClass.Class9, segment.VehicleClass); + + var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); + TestAcceleration(data); + + Assert.AreEqual(5, segment.Missions.Length); + + AssertMission(segment.Missions[0], + vehicleData: vehicleData, + missionType: MissionType.LongHaul, + cosswindCorrection: "RigidTrailer", + axleWeightDistribution: new[] { 0.2, 0.3, 0.15 }, + trailerAxleWeightDistribution: new[] { 0.35 }, + trailerAxleCount: new[] { 2 }, + bodyCurbWeight: 2200, + trailerCurbWeight: new[] { 5400.0 }, + trailerType: new[] { TrailerType.T2 }, + lowLoad: 2600, + refLoad: 19300, + trailerGrossVehicleWeight: new[] { 18000.0 }, + deltaCdA: 1.5, + maxLoad: 24900); + + AssertMission(segment.Missions[1], + vehicleData: vehicleData, + missionType: MissionType.LongHaulEMS, + cosswindCorrection: "RigidTrailer", + axleWeightDistribution: new[] { 0.15, 0.2, 0.1 }, + trailerAxleWeightDistribution: new[] { 0.225, 0.325 }, + trailerAxleCount: new[] { 2, 3 }, + bodyCurbWeight: 2200, + trailerCurbWeight: new[] { 2500, 7500.0 }, + trailerType: new[] { TrailerType.Dolly, TrailerType.ST1 }, + lowLoad: 3500, + refLoad: 26500, + trailerGrossVehicleWeight: new[] { 12000.0, 24000 }, + deltaCdA: 2.1, + maxLoad: 40300, + ems: true); + + AssertMission(segment.Missions[2], + vehicleData: vehicleData, + missionType: MissionType.RegionalDelivery, + cosswindCorrection: "RigidSolo", + axleWeightDistribution: new[] { 0.35, 0.4, 0.25 }, + trailerAxleWeightDistribution: new double[] { }, + trailerAxleCount: new int[] { }, + bodyCurbWeight: 2200, + trailerCurbWeight: new double[] { }, + trailerType: new TrailerType[] { }, + lowLoad: 1400, + refLoad: 7100, + trailerGrossVehicleWeight: new double[] { }, + deltaCdA: 0, + maxLoad: 14300); + + AssertMission(segment.Missions[3], + vehicleData: vehicleData, + missionType: MissionType.RegionalDeliveryEMS, + cosswindCorrection: "RigidTrailer", + axleWeightDistribution: new[] { 0.175, 0.2, 0.1 }, + trailerAxleWeightDistribution: new[] { 0.225, 0.3 }, + trailerAxleCount: new[] { 2, 3 }, + bodyCurbWeight: 2200, + trailerCurbWeight: new[] { 2500, 7500.0 }, + trailerType: new[] { TrailerType.Dolly, TrailerType.ST1 }, + lowLoad: 3500, + refLoad: 17500, + trailerGrossVehicleWeight: new[] { 12000.0, 24000 }, + deltaCdA: 2.1, + maxLoad: 40300, + ems: true); + + AssertMission(segment.Missions[4], + vehicleData: vehicleData, + missionType: MissionType.MunicipalUtility, + cosswindCorrection: "RigidSolo", + axleWeightDistribution: new[] { 0.35, 0.4, 0.25 }, + trailerAxleWeightDistribution: new double[] { }, + trailerAxleCount: new int[] { }, + bodyCurbWeight: 6750, + trailerCurbWeight: new double[] { }, + trailerType: new TrailerType[] { }, + lowLoad: 1200, + refLoad: 6000, + trailerGrossVehicleWeight: new double[] { }, + deltaCdA: 0, + maxLoad: 9750); + } + + /// <summary> + /// Segment 9: fixed reference weight, trailer always used + /// </summary> + [TestCase] + public void Segment9VocationalTest() + { + var vehicleData = new + { + VehicleCategory = VehicleCategory.RigidTruck, + AxleConfiguration = AxleConfiguration.AxleConfig_6x2, + GrossVehicleMassRating = 24000.SI<Kilogram>(), + CurbWeight = 7500.SI<Kilogram>() + }; + + var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, + vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, true); + + Assert.AreEqual(VehicleClass.Class9, segment.VehicleClass); + + var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); + TestAcceleration(data); + + Assert.AreEqual(2, segment.Missions.Length); + + AssertMission(segment.Missions[0], + vehicleData: vehicleData, + missionType: MissionType.MunicipalUtility, + cosswindCorrection: "RigidSolo", + axleWeightDistribution: new[] { 0.35, 0.4, 0.25 }, + trailerAxleWeightDistribution: new double[] { }, + trailerAxleCount: new int[] { }, + bodyCurbWeight: 6750, + trailerCurbWeight: new double[] { }, + trailerType: new TrailerType[] { }, + lowLoad: 1200, + refLoad: 6000, + trailerGrossVehicleWeight: new double[] { }, + deltaCdA: 0, + maxLoad: 9750); + + AssertMission(segment.Missions[1], + vehicleData: vehicleData, + missionType: MissionType.Construction, + cosswindCorrection: "RigidSolo", + axleWeightDistribution: new[] { 0.35, 0.4, 0.25 }, + trailerAxleWeightDistribution: new double[] { }, + trailerAxleCount: new int[] { }, + bodyCurbWeight: 3230, + trailerCurbWeight: new double[] { }, + trailerType: new TrailerType[] { }, + lowLoad: 1400, + refLoad: 7100, + trailerGrossVehicleWeight: new double[] { }, + deltaCdA: 0, + maxLoad: 13270); + + } + + /// <summary> + /// Segment 10: fixed reference weight, trailer always used + /// </summary> + [TestCase] + public void Segment10Test() + { + var vehicleData = new + { + VehicleCategory = VehicleCategory.Tractor, + AxleConfiguration = AxleConfiguration.AxleConfig_6x2, + GrossVehicleMassRating = 24000.SI<Kilogram>(), + CurbWeight = 7500.SI<Kilogram>() + }; + + var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, + vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, false); + + Assert.AreEqual(VehicleClass.Class10, segment.VehicleClass); + + var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); + TestAcceleration(data); + + Assert.AreEqual(4, segment.Missions.Length); + + AssertMission(segment.Missions[0], + vehicleData: vehicleData, + missionType: MissionType.LongHaul, + cosswindCorrection: "TractorSemitrailer", + axleWeightDistribution: new[] { 0.15, 0.1, 0.2 }, + trailerAxleWeightDistribution: new[] { 0.55 }, + trailerAxleCount: new[] { 3 }, + bodyCurbWeight: 0, + trailerCurbWeight: new[] { 7500.0 }, + trailerType: new[] { TrailerType.ST1 }, + lowLoad: 2600, + refLoad: 19300, + trailerGrossVehicleWeight: new[] { 24000.0 }, + deltaCdA: 0, + maxLoad: 25000); + + AssertMission(segment.Missions[1], + vehicleData: vehicleData, + missionType: MissionType.LongHaulEMS, + cosswindCorrection: "RigidTrailer", + axleWeightDistribution: new[] { 0.125, 0.15, 0.1 }, + trailerAxleWeightDistribution: new[] { 0.375, 0.25 }, + trailerAxleCount: new[] { 3, 2 }, + bodyCurbWeight: 0, + trailerCurbWeight: new[] { 7500.0, 5400 }, + trailerType: new[] { TrailerType.ST1, TrailerType.T2 }, + lowLoad: 3500, + refLoad: 26500, + trailerGrossVehicleWeight: new[] { 24000.0, 18000 }, + deltaCdA: 1.5, + maxLoad: 39600, + ems: true); + + AssertMission(segment.Missions[2], + vehicleData: vehicleData, + missionType: MissionType.RegionalDelivery, + cosswindCorrection: "TractorSemitrailer", + axleWeightDistribution: new[] { 0.2, 0.1, 0.2 }, + trailerAxleWeightDistribution: new[] { 0.5 }, + trailerAxleCount: new[] { 3 }, + bodyCurbWeight: 0, + trailerCurbWeight: new[] { 7500.0 }, + trailerType: new[] { TrailerType.ST1 }, + lowLoad: 2600, + refLoad: 12900, + trailerGrossVehicleWeight: new[] { 24000.0 }, + deltaCdA: 0, + maxLoad: 25000); + + AssertMission(segment.Missions[3], + vehicleData: vehicleData, + missionType: MissionType.RegionalDeliveryEMS, + cosswindCorrection: "RigidTrailer", + axleWeightDistribution: new[] { 0.15, 0.15, 0.1 }, + trailerAxleWeightDistribution: new[] { 0.35, 0.25 }, + trailerAxleCount: new[] { 3, 2 }, + bodyCurbWeight: 0, + trailerCurbWeight: new[] { 7500.0, 5400 }, + trailerType: new[] { TrailerType.ST1, TrailerType.T2 }, + lowLoad: 3500, + refLoad: 17500, + trailerGrossVehicleWeight: new[] { 24000.0, 18000 }, + deltaCdA: 1.5, + maxLoad: 39600, + ems: true); + } + + /// <summary> + /// Segment 10: fixed reference weight, trailer always used + /// </summary> + [TestCase] + public void Segment10VocationalTest() + { + var vehicleData = new + { + VehicleCategory = VehicleCategory.Tractor, + AxleConfiguration = AxleConfiguration.AxleConfig_6x2, + GrossVehicleMassRating = 24000.SI<Kilogram>(), + CurbWeight = 7500.SI<Kilogram>() + }; + + var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, + vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, true); + + Assert.AreEqual(VehicleClass.Class10, segment.VehicleClass); + + var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); + TestAcceleration(data); + + Assert.AreEqual(1, segment.Missions.Length); + + AssertMission(segment.Missions[0], + vehicleData: vehicleData, + missionType: MissionType.Construction, + cosswindCorrection: "TractorSemitrailer", + axleWeightDistribution: new[] { 0.2, 0.1, 0.2 }, + trailerAxleWeightDistribution: new[] { 0.5 }, + trailerAxleCount: new[] { 2 }, + bodyCurbWeight: 0, + trailerCurbWeight: new[] { 5600.0 }, + trailerType: new[] { TrailerType.STT2 }, + lowLoad: 2600, + refLoad: 12900, + trailerGrossVehicleWeight: new[] { 18000.0 }, + deltaCdA: 0, + maxLoad: 26900); + + } + + /// <summary> + /// Segment 11: fixed reference weight, trailer always used + /// </summary> + [TestCase] + public void Segment11Test() + { + var vehicleData = new + { + VehicleCategory = VehicleCategory.RigidTruck, + AxleConfiguration = AxleConfiguration.AxleConfig_6x4, + GrossVehicleMassRating = 24000.SI<Kilogram>(), + CurbWeight = 7500.SI<Kilogram>() + }; + + var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, + vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, false); + + Assert.AreEqual(VehicleClass.Class11, segment.VehicleClass); + + var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); + TestAcceleration(data); + + Assert.AreEqual(6, segment.Missions.Length); + + AssertMission(segment.Missions[0], + vehicleData: vehicleData, + missionType: MissionType.LongHaul, + cosswindCorrection: "RigidTrailer", + axleWeightDistribution: new[] { 0.2, 0.225, 0.225 }, + trailerAxleWeightDistribution: new[] { 0.35 }, + trailerAxleCount: new[] { 2 }, + bodyCurbWeight: 2200, + trailerCurbWeight: new[] { 5400.0 }, + trailerType: new[] { TrailerType.T2 }, + lowLoad: 2600, + refLoad: 19300, + trailerGrossVehicleWeight: new[] { 18000.0 }, + deltaCdA: 1.5, + maxLoad: 24900); + + AssertMission(segment.Missions[1], + vehicleData: vehicleData, + missionType: MissionType.LongHaulEMS, + cosswindCorrection: "RigidTrailer", + axleWeightDistribution: new[] { 0.15, 0.2, 0.1 }, + trailerAxleWeightDistribution: new[] { 0.225, 0.325 }, + trailerAxleCount: new[] { 2, 3 }, + bodyCurbWeight: 2200, + trailerCurbWeight: new[] { 2500, 7500.0 }, + trailerType: new[] { TrailerType.Dolly, TrailerType.ST1 }, + lowLoad: 3500, + refLoad: 26500, + trailerGrossVehicleWeight: new[] { 12000.0, 24000 }, + deltaCdA: 2.1, + maxLoad: 40300, + ems: true); + + AssertMission(segment.Missions[2], + vehicleData: vehicleData, + missionType: MissionType.RegionalDelivery, + cosswindCorrection: "RigidSolo", + axleWeightDistribution: new[] { 0.35, 0.35, 0.3 }, + trailerAxleWeightDistribution: new double[] { }, + trailerAxleCount: new int[] { }, bodyCurbWeight: 2200, + trailerCurbWeight: new double[] { }, + trailerType: new TrailerType[] { }, + lowLoad: 1400, + refLoad: 7100, + trailerGrossVehicleWeight: new double[] { }, + deltaCdA: 0, + maxLoad: 14300); + + AssertMission(segment.Missions[3], + vehicleData: vehicleData, + missionType: MissionType.RegionalDeliveryEMS, + cosswindCorrection: "RigidTrailer", + axleWeightDistribution: new[] { 0.175, 0.2, 0.1 }, + trailerAxleWeightDistribution: new[] { 0.225, 0.3 }, + trailerAxleCount: new[] { 2, 3 }, + bodyCurbWeight: 2200, + trailerCurbWeight: new[] { 2500, 7500.0 }, + trailerType: new[] { TrailerType.Dolly, TrailerType.ST1 }, + lowLoad: 3500, + refLoad: 17500, + trailerGrossVehicleWeight: new[] { 12000.0, 24000 }, + deltaCdA: 2.1, + maxLoad: 40300, + ems: true); + + AssertMission(segment.Missions[4], + vehicleData: vehicleData, + missionType: MissionType.MunicipalUtility, + cosswindCorrection: "RigidSolo", + axleWeightDistribution: new[] { 0.35, 0.35, 0.3 }, + trailerAxleWeightDistribution: new double[] { }, + trailerAxleCount: new int[] { }, + bodyCurbWeight: 6750, + trailerCurbWeight: new double[] { }, + trailerType: new TrailerType[] { }, + lowLoad: 1200, + refLoad: 6000, + trailerGrossVehicleWeight: new double[] { }, + deltaCdA: 0, + maxLoad: 9750); + + AssertMission(segment.Missions[5], + vehicleData: vehicleData, + missionType: MissionType.Construction, + cosswindCorrection: "RigidSolo", + axleWeightDistribution: new[] { 0.35, 0.35, 0.3 }, + trailerAxleWeightDistribution: new double[] { }, + trailerAxleCount: new int[] { }, + bodyCurbWeight: 3230, + trailerCurbWeight: new double[] { }, + trailerType: new TrailerType[] { }, + lowLoad: 1400, + refLoad: 7100, + trailerGrossVehicleWeight: new double[] { }, + deltaCdA: 0, + maxLoad: 13270); + } + + /// <summary> + /// Segment 10: fixed reference weight, trailer always used + /// </summary> + [TestCase] + public void Segment12Test() + { + var vehicleData = new + { + VehicleCategory = VehicleCategory.Tractor, + AxleConfiguration = AxleConfiguration.AxleConfig_6x4, + GrossVehicleMassRating = 24000.SI<Kilogram>(), + CurbWeight = 7500.SI<Kilogram>() + }; + + var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, + vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, false); + + Assert.AreEqual(VehicleClass.Class12, segment.VehicleClass); + + var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); + TestAcceleration(data); + + Assert.AreEqual(5, segment.Missions.Length); + + AssertMission(segment.Missions[0], + vehicleData: vehicleData, + missionType: MissionType.LongHaul, + cosswindCorrection: "TractorSemitrailer", + axleWeightDistribution: new[] { 0.15, 0.15, 0.15 }, + trailerAxleWeightDistribution: new[] { 0.55 }, + trailerAxleCount: new[] { 3 }, + bodyCurbWeight: 0, + trailerCurbWeight: new[] { 7500.0 }, + trailerType: new[] { TrailerType.ST1 }, + lowLoad: 2600, + refLoad: 19300, + trailerGrossVehicleWeight: new[] { 24000.0 }, + deltaCdA: 0, + maxLoad: 25000); + + AssertMission(segment.Missions[1], + vehicleData: vehicleData, + missionType: MissionType.LongHaulEMS, + cosswindCorrection: "RigidTrailer", + axleWeightDistribution: new[] { 0.125, 0.15, 0.1 }, + trailerAxleWeightDistribution: new[] { 0.375, 0.25 }, + trailerAxleCount: new[] { 3, 2 }, + bodyCurbWeight: 0, + trailerCurbWeight: new[] { 7500.0, 5400 }, + trailerType: new[] { TrailerType.ST1, TrailerType.T2 }, + lowLoad: 3500, + refLoad: 26500, + trailerGrossVehicleWeight: new[] { 24000.0, 18000 }, + deltaCdA: 1.5, + maxLoad: 39600, + ems: true); + + AssertMission(segment.Missions[2], + vehicleData: vehicleData, + missionType: MissionType.RegionalDelivery, + cosswindCorrection: "TractorSemitrailer", + axleWeightDistribution: new[] { 0.2, 0.15, 0.15 }, + trailerAxleWeightDistribution: new[] { 0.5 }, + trailerAxleCount: new[] { 3 }, + bodyCurbWeight: 0, + trailerCurbWeight: new[] { 7500.0 }, + trailerType: new[] { TrailerType.ST1 }, + lowLoad: 2600, + refLoad: 12900, + trailerGrossVehicleWeight: new[] { 24000.0 }, + deltaCdA: 0, + maxLoad: 25000); + + AssertMission(segment.Missions[3], + vehicleData: vehicleData, + missionType: MissionType.RegionalDeliveryEMS, + cosswindCorrection: "RigidTrailer", + axleWeightDistribution: new[] { 0.15, 0.15, 0.1 }, + trailerAxleWeightDistribution: new[] { 0.35, 0.25 }, + trailerAxleCount: new[] { 3, 2 }, + bodyCurbWeight: 0, + trailerCurbWeight: new[] { 7500.0, 5400 }, + trailerType: new[] { TrailerType.ST1, TrailerType.T2 }, + lowLoad: 3500, + refLoad: 17500, + trailerGrossVehicleWeight: new[] { 24000.0, 18000 }, + deltaCdA: 1.5, + maxLoad: 39600, + ems: true); + + AssertMission(segment.Missions[4], + vehicleData: vehicleData, + missionType: MissionType.Construction, + cosswindCorrection: "TractorSemitrailer", + axleWeightDistribution: new[] { 0.2, 0.15, 0.15 }, + trailerAxleWeightDistribution: new[] { 0.5 }, + trailerAxleCount: new[] { 2 }, + bodyCurbWeight: 0, + trailerCurbWeight: new[] { 5600.0 }, + trailerType: new[] { TrailerType.STT2 }, + lowLoad: 2600, + refLoad: 12900, + trailerGrossVehicleWeight: new[] { 18000.0 }, + deltaCdA: 0, + maxLoad: 26900, + ems: false); + } + + /// <summary> + /// Segment 9: fixed reference weight, trailer always used + /// </summary> + [TestCase] + public void Segment16Test() + { + var vehicleData = new + { + VehicleCategory = VehicleCategory.RigidTruck, + AxleConfiguration = AxleConfiguration.AxleConfig_8x4, + GrossVehicleMassRating = 36000.SI<Kilogram>(), + CurbWeight = 7500.SI<Kilogram>() + }; + + var segment = DeclarationData.Segments.Lookup(vehicleData.VehicleCategory, vehicleData.AxleConfiguration, + vehicleData.GrossVehicleMassRating, vehicleData.CurbWeight, false); + + Assert.AreEqual(VehicleClass.Class16, segment.VehicleClass); + + var data = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); + TestAcceleration(data); + + Assert.AreEqual(1, segment.Missions.Length); + + AssertMission(segment.Missions[0], + vehicleData: vehicleData, + missionType: MissionType.Construction, + cosswindCorrection: "RigidSolo", + axleWeightDistribution: new[] { 0.25, 0.25, 0.25, 0.25 }, + trailerAxleWeightDistribution: new double[] { }, + trailerAxleCount: new int[] { }, + bodyCurbWeight: 4355, + trailerCurbWeight: new double[] { }, + trailerType: new TrailerType[] { }, + lowLoad: 2600, + refLoad: 12900, + trailerGrossVehicleWeight: new double[] { }, + deltaCdA: 0, + maxLoad: 24145); + } + + public static void AssertMission(Mission m, dynamic vehicleData, MissionType missionType, string cosswindCorrection, + double[] axleWeightDistribution, double[] trailerAxleWeightDistribution, int[] trailerAxleCount, + double bodyCurbWeight, double[] trailerCurbWeight, TrailerType[] trailerType, double lowLoad, double refLoad, + double maxLoad, double[] trailerGrossVehicleWeight, double deltaCdA, bool ems = false) + { + Assert.AreEqual(missionType, m.MissionType); + Assert.AreEqual(cosswindCorrection, m.CrossWindCorrectionParameters); + CollectionAssert.AreEqual(axleWeightDistribution, m.AxleWeightDistribution, + "Axle distribution not equal.\nexpected: {0}\nactual: {1}", string.Join(",", axleWeightDistribution), + string.Join(",", m.AxleWeightDistribution)); + CollectionAssert.AreEqual(trailerAxleWeightDistribution, m.Trailer.Select(t => t.TrailerAxleWeightShare), + "Trailer axle distribution not equal.\nexpected: {0}\nactual: {1}", string.Join(",", trailerAxleWeightDistribution), + string.Join(",", m.Trailer.Select(t => t.TrailerAxleWeightShare))); + Assert.AreEqual(bodyCurbWeight.SI<Kilogram>(), m.BodyCurbWeight); + CollectionAssert.AreEqual(trailerCurbWeight, m.Trailer.Select(t => t.TrailerCurbWeight.Value())); + CollectionAssert.AreEqual(trailerType, m.Trailer.Select(t => t.TrailerType)); + CollectionAssert.AreEqual(trailerAxleCount, m.Trailer.Select(t => t.TrailerWheels.Count)); + Assert.IsNotNull(m.CycleFile); + Assert.IsTrue(!string.IsNullOrEmpty(new StreamReader(m.CycleFile).ReadLine())); + Assert.AreEqual(0.SI<Kilogram>(), m.MinLoad); + AssertHelper.AreRelativeEqual(lowLoad, m.LowLoad); + AssertHelper.AreRelativeEqual(refLoad, m.RefLoad); + Assert.AreEqual(maxLoad.SI<Kilogram>(), m.MaxLoad); + CollectionAssert.AreEqual(trailerGrossVehicleWeight, m.Trailer.Select(t => t.TrailerGrossVehicleWeight.Value())); + Assert.AreEqual( + VectoMath.Min( + vehicleData.GrossVehicleMassRating + + m.Trailer.Sum(t => t.TrailerGrossVehicleWeight).DefaultIfNull(0), + ems ? 60000.SI<Kilogram>() : 40000.SI<Kilogram>()) + - m.BodyCurbWeight - m.Trailer.Sum(t => t.TrailerCurbWeight).DefaultIfNull(0) - + vehicleData.CurbWeight, + m.MaxLoad); + Assert.AreEqual(deltaCdA.SI<SquareMeter>(), + m.Trailer.Sum(t => t.DeltaCdA).DefaultIfNull(0)); + } + + private static void EqualAcceleration(AccelerationCurveData data, double velocity, double acceleration, + double deceleration) + { + var entry = data.Lookup(velocity.KMPHtoMeterPerSecond()); + Assert.AreEqual(entry.Acceleration.Value(), acceleration, Tolerance); + Assert.AreEqual(entry.Deceleration.Value(), deceleration, Tolerance); + } + + private static void TestAcceleration(AccelerationCurveData data) + { + // FIXED POINTS + EqualAcceleration(data, 0, 1, -1); + EqualAcceleration(data, 25, 1, -1); + EqualAcceleration(data, 50, 0.642857143, -1); + EqualAcceleration(data, 60, 0.5, -0.5); + EqualAcceleration(data, 120, 0.5, -0.5); + + // INTERPOLATED POINTS + EqualAcceleration(data, 20, 1, -1); + EqualAcceleration(data, 40, 0.785714286, -1); + EqualAcceleration(data, 55, 0.571428572, -0.75); + EqualAcceleration(data, 80, 0.5, -0.5); + EqualAcceleration(data, 100, 0.5, -0.5); + + // EXTRAPOLATE + EqualAcceleration(data, -20, 1, -1); + EqualAcceleration(data, 140, 0.5, -0.5); + } + + [TestCase] + public void Declaration_WheelsForT1_Class2() + { + var dataProvider = + JSONInputDataFactory.ReadJsonJob(@"TestData\Jobs\12t Delivery Truck.vecto") as IDeclarationInputDataProvider; + var dataReader = new DeclarationModeVectoRunDataFactory(dataProvider, null); + + var runs = dataReader.NextRun().ToList(); + Assert.AreEqual(6, runs.Count); + var withT1 = new[] { 6.0, 6.0, 4.5, 4.5 }; + + CollectionAssert.AreEqual(withT1, runs[0].VehicleData.AxleData.Select(a => a.Inertia.Value())); + CollectionAssert.AreEqual(withT1, runs[1].VehicleData.AxleData.Select(a => a.Inertia.Value())); + + var bodyOnly = new[] { 6.0, 6.0 }; + + CollectionAssert.AreEqual(bodyOnly, runs[2].VehicleData.AxleData.Select(a => a.Inertia.Value())); + CollectionAssert.AreEqual(bodyOnly, runs[3].VehicleData.AxleData.Select(a => a.Inertia.Value())); + + CollectionAssert.AreEqual(bodyOnly, runs[4].VehicleData.AxleData.Select(a => a.Inertia.Value())); + CollectionAssert.AreEqual(bodyOnly, runs[5].VehicleData.AxleData.Select(a => a.Inertia.Value())); + } + + [TestCase] + public void Declaration_WheelsForT2_Class4() + { + var dataProvider = + JSONInputDataFactory.ReadJsonJob( + @"TestData\Jobs\Class4_40t_Long_Haul_Truck.vecto") as IDeclarationInputDataProvider; + var dataReader = new DeclarationModeVectoRunDataFactory(dataProvider, null); + + var runs = dataReader.NextRun().ToList(); + Assert.AreEqual(8, runs.Count); + var withT1 = new[] { 14.9, 14.9, 19.2, 19.2 }; + CollectionAssert.AreEqual(withT1, runs[0].VehicleData.AxleData.Select(a => a.Inertia.Value())); + CollectionAssert.AreEqual(withT1, runs[1].VehicleData.AxleData.Select(a => a.Inertia.Value())); + + var bodyOnly = new[] { 14.9, 14.9 }; + CollectionAssert.AreEqual(bodyOnly, runs[2].VehicleData.AxleData.Select(a => a.Inertia.Value())); + CollectionAssert.AreEqual(bodyOnly, runs[3].VehicleData.AxleData.Select(a => a.Inertia.Value())); + + CollectionAssert.AreEqual(bodyOnly, runs[4].VehicleData.AxleData.Select(a => a.Inertia.Value())); + CollectionAssert.AreEqual(bodyOnly, runs[5].VehicleData.AxleData.Select(a => a.Inertia.Value())); + + CollectionAssert.AreEqual(bodyOnly, runs[6].VehicleData.AxleData.Select(a => a.Inertia.Value())); + CollectionAssert.AreEqual(bodyOnly, runs[7].VehicleData.AxleData.Select(a => a.Inertia.Value())); + } + + [TestCase] + public void Declaration_WheelsForDefault_Class5() + { + var dataProvider = + JSONInputDataFactory.ReadJsonJob(@"TestData\Jobs\40t_Long_Haul_Truck.vecto") as IDeclarationInputDataProvider; + var dataReader = new DeclarationModeVectoRunDataFactory(dataProvider, null); + + var runs = dataReader.NextRun().ToList(); + + Assert.AreEqual(VehicleClass.Class5, runs[0].VehicleData.VehicleClass); + Assert.AreEqual(10, runs.Count); + + //var bodyOnly = new[] { 14.9, 14.9 }; + var withST1 = new[] { 14.9, 14.9, 19.2, 19.2, 19.2 }; + var withSTT1 = new[] { 14.9, 14.9, 19.2, 19.2, 19.2 }; + var withST1andT2 = new[] { 14.9, 14.9, 19.2, 19.2, 19.2, 19.2, 19.2 }; + + CollectionAssert.AreEqual(withST1, runs[0].VehicleData.AxleData.Select(a => a.Inertia.Value())); + CollectionAssert.AreEqual(withST1, runs[1].VehicleData.AxleData.Select(a => a.Inertia.Value())); + + CollectionAssert.AreEqual(withST1andT2, runs[2].VehicleData.AxleData.Select(a => a.Inertia.Value())); + CollectionAssert.AreEqual(withST1andT2, runs[3].VehicleData.AxleData.Select(a => a.Inertia.Value())); + + CollectionAssert.AreEqual(withST1, runs[4].VehicleData.AxleData.Select(a => a.Inertia.Value())); + CollectionAssert.AreEqual(withST1, runs[5].VehicleData.AxleData.Select(a => a.Inertia.Value())); + + CollectionAssert.AreEqual(withST1andT2, runs[6].VehicleData.AxleData.Select(a => a.Inertia.Value())); + CollectionAssert.AreEqual(withST1andT2, runs[7].VehicleData.AxleData.Select(a => a.Inertia.Value())); + + CollectionAssert.AreEqual(withSTT1, runs[8].VehicleData.AxleData.Select(a => a.Inertia.Value())); + CollectionAssert.AreEqual(withSTT1, runs[9].VehicleData.AxleData.Select(a => a.Inertia.Value())); + } + + + [ + TestCase("Diesel CI", null, 1.0), + TestCase("Ethanol CI", null, 1.011811), + TestCase("Petrol PI", null, 1.0), + TestCase("Ethanol PI", null, 0.993174), + TestCase("NG PI", TankSystem.Liquefied, 0.918533), + TestCase("NG PI", TankSystem.Compressed, 0.939583) + ] + public void TestNCVCorrection(string fuelTypeStr, TankSystem? tankSystem, double expectedCorrectionFactor) + { + var fuelType = fuelTypeStr.ParseEnum<FuelType>(); + var cf = DeclarationData.FuelData.Lookup(fuelType, tankSystem).HeatingValueCorrection; + + Assert.AreEqual(expectedCorrectionFactor, cf, 1e-6); + } + + [ + TestCase(VehicleClass.Class4, true, 169.9, WeightingGroup.Group4UD), + TestCase(VehicleClass.Class4, false, 169.9, WeightingGroup.Group4UD), + TestCase(VehicleClass.Class4, false, 170, WeightingGroup.Group4RD), + TestCase(VehicleClass.Class4, true, 170, WeightingGroup.Group4RD), + TestCase(VehicleClass.Class4, true, 264.9, WeightingGroup.Group4RD), + TestCase(VehicleClass.Class4, true, 265, WeightingGroup.Group4LH), + + TestCase(VehicleClass.Class5, false, 169.9, WeightingGroup.Group5RD), + TestCase(VehicleClass.Class5, false, 170, WeightingGroup.Group5RD), + TestCase(VehicleClass.Class5, false, 264.9, WeightingGroup.Group5RD), + TestCase(VehicleClass.Class5, false, 265, WeightingGroup.Group5RD), + TestCase(VehicleClass.Class5, true, 264.9, WeightingGroup.Group5RD), + TestCase(VehicleClass.Class5, true, 265, WeightingGroup.Group5LH), + + TestCase(VehicleClass.Class9, false, 169.9, WeightingGroup.Group9RD), + TestCase(VehicleClass.Class9, false, 264.9, WeightingGroup.Group9RD), + TestCase(VehicleClass.Class9, false, 265, WeightingGroup.Group9RD), + TestCase(VehicleClass.Class9, true, 169.9, WeightingGroup.Group9LH), + TestCase(VehicleClass.Class9, true, 264.9, WeightingGroup.Group9LH), + TestCase(VehicleClass.Class9, true, 265, WeightingGroup.Group9LH), + + TestCase(VehicleClass.Class10, false, 169.9, WeightingGroup.Group10RD), + TestCase(VehicleClass.Class10, false, 264.9, WeightingGroup.Group10RD), + TestCase(VehicleClass.Class10, false, 265, WeightingGroup.Group10RD), + TestCase(VehicleClass.Class10, true, 169.9, WeightingGroup.Group10LH), + TestCase(VehicleClass.Class10, true, 264.9, WeightingGroup.Group10LH), + TestCase(VehicleClass.Class10, true, 265, WeightingGroup.Group10LH), + ] + public void TestWeightingGroupLookup( + VehicleClass vehicleGroup, bool sleeperCab, double ratedPowerkWm, WeightingGroup expectedWeightingGroup) + { + var wGroup = DeclarationData.WeightingGroup.Lookup( + vehicleGroup, sleeperCab, ratedPowerkWm.SI(Unit.SI.Kilo.Watt).Cast<Watt>()); + Assert.AreEqual(expectedWeightingGroup, wGroup); + } + + [ + + TestCase(WeightingGroup.GroupML2r, 0.25, 0.25, 0, 0, 0.25, 0.25), + TestCase(WeightingGroup.GroupML2van, 0.25, 0.25, 0, 0, 0.25, 0.25), + TestCase(WeightingGroup.GroupML3r, 0.25, 0.25, 0, 0, 0.25, 0.25), + TestCase(WeightingGroup.GroupML3van, 0.25, 0.25, 0, 0, 0.25, 0.25), + TestCase(WeightingGroup.GroupML4r, 0.25, 0.25, 0, 0, 0.25, 0.25), + TestCase(WeightingGroup.GroupML4van, 0.25, 0.25, 0, 0, 0.25, 0.25), + + TestCase(WeightingGroup.Group1s, 0.1, 0.4, 0, 0, 0.15, 0.35), + TestCase(WeightingGroup.Group1, 0.1, 0.4, 0, 0, 0.15, 0.35), + TestCase(WeightingGroup.Group2, 0.06, 0.24, 0.06, 0.14, 0.15, 0.35), + TestCase(WeightingGroup.Group3, 0.1, 0.4, 0, 0, 0.15, 0.35), + + TestCase(WeightingGroup.Group4UD, 0, 0, 0, 0, 0.5, 0.5), + TestCase(WeightingGroup.Group4RD, 0.45, 0.45, 0.05, 0.05, 0, 0), + TestCase(WeightingGroup.Group4LH, 0.05, 0.05, 0.45, 0.45, 0, 0), + + TestCase(WeightingGroup.Group5RD, 0.27, 0.63, 0.03, 0.07, 0, 0), + TestCase(WeightingGroup.Group5LH, 0.03, 0.07, 0.27, 0.63, 0, 0), + + TestCase(WeightingGroup.Group9RD, 0.27, 0.63, 0.03, 0.07, 0, 0), + TestCase(WeightingGroup.Group9LH, 0.03, 0.07, 0.27, 0.63, 0, 0), + + TestCase(WeightingGroup.Group10RD, 0.27, 0.63, 0.03, 0.07, 0, 0), + TestCase(WeightingGroup.Group10LH, 0.03, 0.07, 0.27, 0.63, 0, 0), + TestCase(WeightingGroup.Group11, 0.11, 0.25, 0.01, 0.02, 0, 0, 0.08, 0.19, 0.09, 0.25), + TestCase(WeightingGroup.Group12, 0.03, 0.07, 0.16, 0.36, 0, 0, 0, 0, 0.11, 0.27), + TestCase(WeightingGroup.Group16, 0, 0, 0, 0, 0, 0, 0, 0, 0.3, 0.7), + ] + public void TestMissionProfileWeights( + WeightingGroup group, double eRdLow, double eRdRef, double eLhLow, double eLhRef, double eUdLow, double eUdRef, double eMuLow = 0, double eMuRef = 0, double eCoLow = 0, double eCoRef = 0, double eLhEmsRef = 0, double elhEmsLow = 0, double eRdEmsLow = 0, double eRdEmsRef = 0) { - var tyreClass = DeclarationData.Wheels.TyreClass.Lookup(rrc); - //Assert.IsTrue(expectedClass.Equals(tyreClass, StringComparison.InvariantCultureIgnoreCase)); - Assert.AreEqual(expectedClass, tyreClass); - } - } + var factors = DeclarationData.WeightingFactors.Lookup(group); + + Assert.AreEqual(1, factors.Values.Sum(x => x), 1e-9); + + Assert.AreEqual(eLhLow, factors[Tuple.Create(MissionType.LongHaul, LoadingType.LowLoading)], 1e-9); + Assert.AreEqual(eLhRef, factors[Tuple.Create(MissionType.LongHaul, LoadingType.ReferenceLoad)], 1e-9); + Assert.AreEqual(eRdLow, factors[Tuple.Create(MissionType.RegionalDelivery, LoadingType.LowLoading)], 1e-9); + Assert.AreEqual(eRdRef, factors[Tuple.Create(MissionType.RegionalDelivery, LoadingType.ReferenceLoad)], 1e-9); + Assert.AreEqual(eUdLow, factors[Tuple.Create(MissionType.UrbanDelivery, LoadingType.LowLoading)], 1e-9); + Assert.AreEqual(eUdRef, factors[Tuple.Create(MissionType.UrbanDelivery, LoadingType.ReferenceLoad)], 1e-9); + + //Assert.AreEqual(0, factors[Tuple.Create(MissionType.Construction, LoadingType.LowLoading)], 1e-9); + //Assert.AreEqual(0, factors[Tuple.Create(MissionType.Construction, LoadingType.LowLoading)], 1e-9); + //Assert.AreEqual(0, factors[Tuple.Create(MissionType.MunicipalUtility, LoadingType.LowLoading)], 1e-9); + //Assert.AreEqual(0, factors[Tuple.Create(MissionType.MunicipalUtility, LoadingType.ReferenceLoad)], 1e-9); + //Assert.AreEqual(0, factors[Tuple.Create(MissionType.LongHaulEMS, LoadingType.LowLoading)], 1e-9); + //Assert.AreEqual(0, factors[Tuple.Create(MissionType.LongHaulEMS, LoadingType.ReferenceLoad)], 1e-9); + //Assert.AreEqual(0, factors[Tuple.Create(MissionType.RegionalDeliveryEMS, LoadingType.LowLoading)], 1e-9); + //Assert.AreEqual(0, factors[Tuple.Create(MissionType.RegionalDeliveryEMS, LoadingType.ReferenceLoad)], 1e-9); + } + + [ + TestCase(0.0030, "A"), + TestCase(0.0040, "A"), + TestCase(0.0050, "B"), + TestCase(0.0060, "C"), + TestCase(0.0070, "D"), + TestCase(0.0080, "E"), + + TestCase(0.0041, "B"), + TestCase(0.0051, "C"), + TestCase(0.0061, "D"), + TestCase(0.0071, "E"), + TestCase(0.0081, "F"), + + TestCase(0.00402, "A"), + TestCase(0.004049, "A"), + TestCase(0.00405, "B"), + TestCase(0.00407, "B"), + + TestCase(0.00502, "B"), + TestCase(0.005049, "B"), + TestCase(0.00505, "C"), + TestCase(0.00507, "C"), + ] + public void TestTyreLabelLookup(double rrc, string expectedClass) + { + var tyreClass = DeclarationData.Wheels.TyreClass.Lookup(rrc); + //Assert.IsTrue(expectedClass.Equals(tyreClass, StringComparison.InvariantCultureIgnoreCase)); + Assert.AreEqual(expectedClass, tyreClass); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Models/Simulation/AuxTests.cs b/VectoCore/VectoCoreTest/Models/Simulation/AuxTests.cs index 701d752db1..1088eff542 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/AuxTests.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/AuxTests.cs @@ -91,7 +91,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation var mission = MissionType.LongHaul; aux.AddConstant("FAN", - DeclarationData.Fan.Lookup(MissionType.LongHaul, "Hydraulic driven - Constant displacement pump").PowerDemand); + DeclarationData.Fan.Lookup(hdvClass,MissionType.LongHaul, "Hydraulic driven - Constant displacement pump").PowerDemand); aux.AddConstant("PS", DeclarationData.PneumaticSystem.Lookup(mission, "Medium Supply 1-stage").PowerDemand); aux.AddConstant("STP", DeclarationData.SteeringPump.Lookup(MissionType.LongHaul, hdvClass, diff --git a/VectoCore/VectoCoreTest/VectoCoreTest.csproj b/VectoCore/VectoCoreTest/VectoCoreTest.csproj index a6ffc98a1b..cd39f950c4 100644 --- a/VectoCore/VectoCoreTest/VectoCoreTest.csproj +++ b/VectoCore/VectoCoreTest/VectoCoreTest.csproj @@ -45,6 +45,9 @@ <Private>True</Private> </Reference> <Reference Include="Microsoft.CSharp" /> + <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <Private>False</Private> + </Reference> <Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> -- GitLab