diff --git a/VectoCore/VectoCore/Models/Declaration/BusSegments.cs b/VectoCore/VectoCore/Models/Declaration/BusSegments.cs index b92f202264db79c715460e6c0af569eb7948e991..87b4acacfcaa4adcc0484d9febf372d22a5592dd 100644 --- a/VectoCore/VectoCore/Models/Declaration/BusSegments.cs +++ b/VectoCore/VectoCore/Models/Declaration/BusSegments.cs @@ -137,7 +137,8 @@ namespace TUGraz.VectoCore.Models.Declaration HVACDoubleGlasing = row.ParseBoolean("hvacdoubleglasing"), HVACHeatpump = row.ParseBoolean("hvacheatpump"), HVACAdjustableAuxHeater = row.ParseBoolean("hvacadjustableauxiliaryheater"), - HVACSeparateAirDistributionDucts = row.ParseBoolean("hvacseparateairdistributionducts") + HVACSeparateAirDistributionDucts = row.ParseBoolean("hvacseparateairdistributionducts"), + VehicleEquipment = GetVehicleEquipment(row) } }; missions.Add(mission); @@ -167,5 +168,32 @@ namespace TUGraz.VectoCore.Models.Declaration return axleDistribution.Split('/').ToDouble().Select(x => x / 100.0).ToArray(); } + + private VehicleEquipment GetVehicleEquipment(DataRow row) + { + var externalDisplays = row.Field<string>("externaldisplays") == string.Empty + ? (double?)null + : row.ParseDouble("externaldisplays"); + + var internalDisplays = row.Field<string>("internaldisplays") == string.Empty + ? (double?)null + : row.ParseDouble("internaldisplays"); + + var fridge = row.Field<string>("fridge") == string.Empty + ? (double?)null + : row.ParseDouble("fridge"); + + var kitchenStandard = row.Field<string>("kitchenStandard") == string.Empty + ? (double?)null + : row.ParseDouble("kitchenStandard"); + + return new VehicleEquipment + { + ExternalDisplays = externalDisplays, + InternalDisplays = internalDisplays, + Fridge = fridge, + KitchenStandard = kitchenStandard + }; + } } } diff --git a/VectoCore/VectoCore/Models/Declaration/Mission.cs b/VectoCore/VectoCore/Models/Declaration/Mission.cs index 2c3041f64b21d74f44d7931f60c330f01449d7a2..be14f66dc13898c3455e9adb3e4b40f8f6eef9d9 100644 --- a/VectoCore/VectoCore/Models/Declaration/Mission.cs +++ b/VectoCore/VectoCore/Models/Declaration/Mission.cs @@ -147,10 +147,10 @@ namespace TUGraz.VectoCore.Models.Declaration public class VehicleEquipment { - public double ExternalDisplays { get; internal set; } - public double InternalDisplays { get; internal set; } - public double Fridge { get; internal set; } - public double KitchenStandard { get; internal set; } + public double? ExternalDisplays { get; internal set; } + public double? InternalDisplays { get; internal set; } + public double? Fridge { get; internal set; } + public double? KitchenStandard { get; internal set; } } public class AxleLoadDistribution diff --git a/VectoCore/VectoCore/Resources/Declaration/HeavyBusSegmentationTable.csv b/VectoCore/VectoCore/Resources/Declaration/HeavyBusSegmentationTable.csv index 32f87e1ba103d57988d71838a2b7ceff0801720b..b2a63c97f832509e4c0de6f3d945bbdc45d1665c 100644 --- a/VectoCore/VectoCore/Resources/Declaration/HeavyBusSegmentationTable.csv +++ b/VectoCore/VectoCore/Resources/Declaration/HeavyBusSegmentationTable.csv @@ -8,7 +8,7 @@ P32DD , 1 , HeavyBus , PB41 , - , P33SD , 1 , HeavyBus , PB42 , 0 , 3 , 7.4 , 999 , 0 , low , 100 , , Bus.vacc , CoachBus , 5.0 , 27.3/45.4/27.3 , 2.55 , 14.2 , 2.8 , 12000 , 104 , 0 , 3 , 3 , 3 , , , 3 , 2 , 0 , 0 , 6 , 2-stage , 15 , 0 , 0 , 0 , 0 P33DD , 1 , HeavyBus , PB42 , 0 , 3 , 7.4 , 999 , 1 , low , 100 , , Bus.vacc , CoachBus , 6.3 , 27.3/45.4/27.3 , 2.55 , 13.5 , 3.8 , 12000 , 78 , 52 , 3.7 , 3.7 , 3.7 , , , 3 , 3 , 0 , 0 , 6 , 2-stage , 15 , 0 , 0 , 0 , 0 P34SD , 1 , HeavyBus , PB42 , 0 , 3 , 7.4 , 999 , 0 , high , 100 , , Bus.vacc , CoachBus , 4.7 , 27.3/45.4/27.3 , 2.55 , 13.8 , 3.15 , 12000 , 59 , 0 , , , , 2.2 , 1.4 , 2 , 2 , 0.5 , 0.5 , 6 , 2-stage , 30 , 1 , 0 , 0 , 1 -P34DD , 1 , HeavyBus , PB42 , 0 , 3 , 7.4 , 999 , 1 , high , 100 , , Bus.vacc , CoachBus , 5.3 , 27.3/45.4/27.3 , 2.55 , 14 , 3.7 , 12000 , 33 , 46 , , , , 3 , 2 , 1 , 4 , 1 , 1.0 , 6 , 2-stage , 30 , 1 , 0 , 0 , 1 +P34DD , 1 , HeavyBus , PB42 , 0 , 3 , 7.4 , 999 , 1 , high , 100 , , Bus.vacc , CoachBus , 5.3 , 27.3/45.4/27.3 , 2.55 , 14 , 3.7 , 12000 , 33 , 46 , , , , 3 , 2 , 1 , 4 , 1 , 1.5 , 6 , 2-stage , 30 , 1 , 0 , 0 , 1 # P35SD , 1 , HeavyBus , PB43 , 1 , 3 , 7.4 , 999 , 0 , low , 100 , , Bus.vacc , CoachBus , 5.1 , 24.3/35.2/40.5 , 2.55 , 18.2 , 2.8 , 12000 , 104 , 0 , 3 , 3 , 3 , , , 3 , 3 , 0 , 0 , 6 , 2-stage , 15 , 0 , 0 , 0 , 0 P35DD , 1 , HeavyBus , PB43 , 1 , 3 , 7.4 , 999 , 1 , low , 100 , , Bus.vacc , CoachBus , 6.4 , 24.3/35.2/40.5 , 2.55 , 18.2 , 3.8 , 12000 , 78 , 52 , 3.7 , 3.7 , 3.7 , , , , , , , 6 , 2-stage , 15 , 0 , 0 , 0 , 0 diff --git a/VectoCore/VectoCoreTest/Models/Declaration/DeclarationSegmentHeavyBusesTest.cs b/VectoCore/VectoCoreTest/Models/Declaration/DeclarationSegmentHeavyBusesTest.cs index 10f0b03fca42340a04f6979f9ce3a08bdef9e192..53381649af2c6700e3404d44229c880843c20c4c 100644 --- a/VectoCore/VectoCoreTest/Models/Declaration/DeclarationSegmentHeavyBusesTest.cs +++ b/VectoCore/VectoCoreTest/Models/Declaration/DeclarationSegmentHeavyBusesTest.cs @@ -117,7 +117,8 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration curbMass: 10000, refLoad: 5618.16, lowLoad: 1123.632, - axleWeightDistribution: new[] { 0.375, 0.625 } + axleWeightDistribution: new[] { 0.375, 0.625 }, + expVehicleEquipment: GetExpectedVehicleEquipment(3, 2, 0, 0) ); } for (var i = 3; i < 6; i++) { @@ -131,10 +132,11 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration curbMass: 10000, refLoad: 5966.694, lowLoad: 1193.3388, - axleWeightDistribution: new[] { 0.375, 0.625 } + axleWeightDistribution: new[] { 0.375, 0.625 }, + expVehicleEquipment: GetExpectedVehicleEquipment(3, 3, 0, 0) ); } - + AssertMission( segment.Missions[6], missionType: MissionType.Interurban, @@ -144,8 +146,9 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration height: 3.15, curbMass: 10000, refLoad: 4301.748, - lowLoad: 860.3496, - axleWeightDistribution: new[] { 0.375, 0.625 } + lowLoad: 1720.6992, + axleWeightDistribution: new[] { 0.375, 0.625 }, + expVehicleEquipment: GetExpectedVehicleEquipment(2, 2, 0.5, 0.5) ); AssertMission( segment.Missions[7], @@ -156,8 +159,9 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration height: 3.15, curbMass: 10000, refLoad: 2737.476, - lowLoad: 547.4952, - axleWeightDistribution: new[] { 0.375, 0.625 } + lowLoad: 1094.9904, + axleWeightDistribution: new[] { 0.375, 0.625 }, + expVehicleEquipment: GetExpectedVehicleEquipment(2, 2, 0.5, 0.5) ); AssertMission( @@ -169,8 +173,9 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration height: 3.7, curbMass: 10000, refLoad: 5051.295, - lowLoad: 1010.259, - axleWeightDistribution: new[] { 0.375, 0.625 } + lowLoad: 2020.518, + axleWeightDistribution: new[] { 0.375, 0.625 }, + expVehicleEquipment: GetExpectedVehicleEquipment(1, 2, 1, 1) ); AssertMission( segment.Missions[9], @@ -181,8 +186,9 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration height: 3.7, curbMass: 10000, refLoad: 3367.53, - lowLoad: 673.506, - axleWeightDistribution: new[] { 0.375, 0.625 } + lowLoad: 1347.012, + axleWeightDistribution: new[] { 0.375, 0.625 }, + expVehicleEquipment: GetExpectedVehicleEquipment(1, 2, 1, 1) ); } @@ -218,7 +224,8 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration curbMass: 12000, refLoad: 6762.6, lowLoad: 1352.52, - axleWeightDistribution: new[] { 0.273, 0.454, 0.273 } + axleWeightDistribution: new[] { 0.273, 0.454, 0.273 }, + expVehicleEquipment: GetExpectedVehicleEquipment(3, 2, 0, 0) ); } for (var i = 3; i < 6; i++) { @@ -232,7 +239,8 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration curbMass: 12000, refLoad: 7891.434, lowLoad: 1578.2868, - axleWeightDistribution: new[] { 0.273, 0.454, 0.273 } + axleWeightDistribution: new[] { 0.273, 0.454, 0.273 }, + expVehicleEquipment: GetExpectedVehicleEquipment(3, 3, 0, 0) ); } @@ -245,8 +253,9 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration height: 3.15, curbMass: 12000, refLoad: 5018.706, - lowLoad: 1003.7412, - axleWeightDistribution: new[] { 0.273, 0.454, 0.273 } + lowLoad: 2007.4824, + axleWeightDistribution: new[] { 0.273, 0.454, 0.273 }, + expVehicleEquipment: GetExpectedVehicleEquipment(2, 2, 0.5, 0.5) ); AssertMission( segment.Missions[7], @@ -257,8 +266,9 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration height: 3.15, curbMass: 12000, refLoad: 3193.722, - lowLoad: 638.7444, - axleWeightDistribution: new[] { 0.273, 0.454, 0.273 } + lowLoad: 1277.4888, + axleWeightDistribution: new[] { 0.273, 0.454, 0.273 }, + expVehicleEquipment: GetExpectedVehicleEquipment(2, 2, 0.5, 0.5) ); AssertMission( @@ -270,8 +280,9 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration height: 3.7, curbMass: 12000, refLoad: 6952.32, - lowLoad: 1390.464, - axleWeightDistribution: new[] { 0.273, 0.454, 0.273 } + lowLoad: 2780.928, + axleWeightDistribution: new[] { 0.273, 0.454, 0.273 }, + expVehicleEquipment: GetExpectedVehicleEquipment(1, 4, 1, 1.5) ); AssertMission( segment.Missions[9], @@ -282,8 +293,9 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration height: 3.7, curbMass: 12000, refLoad: 4634.88, - lowLoad: 926.976, - axleWeightDistribution: new[] { 0.273, 0.454, 0.273 } + lowLoad: 1853.952, + axleWeightDistribution: new[] { 0.273, 0.454, 0.273 }, + expVehicleEquipment: GetExpectedVehicleEquipment(1, 4, 1, 1.5) ); } @@ -319,7 +331,8 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration curbMass: 12000, refLoad: 8843.4, lowLoad: 1768.68, - axleWeightDistribution: new[] { 0.243, 0.352, 0.405 } + axleWeightDistribution: new[] { 0.243, 0.352, 0.405 }, + expVehicleEquipment: GetExpectedVehicleEquipment(3, 3, 0, 0) ); } for (var i = 3; i < 6; i++) { @@ -333,7 +346,8 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration curbMass: 12000, refLoad: 10906.86, lowLoad: 2181.372, - axleWeightDistribution: new[] { 0.243, 0.352, 0.405 } + axleWeightDistribution: new[] { 0.243, 0.352, 0.405 }, + expVehicleEquipment: GetExpectedVehicleEquipment(null, null, null, null) ); } @@ -346,8 +360,9 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration height: 3.15, curbMass: 12000, refLoad: 6771.27, - lowLoad: 1354.254, - axleWeightDistribution: new[] { 0.243, 0.352, 0.405 } + lowLoad: 2708.508, + axleWeightDistribution: new[] { 0.243, 0.352, 0.405 }, + expVehicleEquipment: GetExpectedVehicleEquipment(null, null, null, null) ); AssertMission( segment.Missions[7], @@ -358,10 +373,10 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration height: 3.15, curbMass: 12000, refLoad: 4308.99, - lowLoad: 861.798, - axleWeightDistribution: new[] { 0.243, 0.352, 0.405 } + lowLoad: 1723.596, + axleWeightDistribution: new[] { 0.243, 0.352, 0.405 }, + expVehicleEquipment: GetExpectedVehicleEquipment(null, null, null, null) ); - AssertMission( segment.Missions[8], missionType: MissionType.Interurban, @@ -371,9 +386,10 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration height: 3.7, curbMass: 12000, refLoad: 9233.55, - lowLoad: 1846.71, - axleWeightDistribution: new[] { 0.243, 0.352, 0.405 } - ); + lowLoad: 3693.42, + axleWeightDistribution: new[] { 0.243, 0.352, 0.405 }, + expVehicleEquipment: GetExpectedVehicleEquipment(null, null, null, null) + ); AssertMission( segment.Missions[9], missionType: MissionType.Coach, @@ -383,8 +399,9 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration height: 3.7, curbMass: 12000, refLoad: 6155.7, - lowLoad: 1231.14, - axleWeightDistribution: new[] { 0.243, 0.352, 0.405 } + lowLoad: 2462.28, + axleWeightDistribution: new[] { 0.243, 0.352, 0.405 }, + expVehicleEquipment: GetExpectedVehicleEquipment(null, null, null, null) ); } @@ -420,7 +437,8 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration curbMass: 14000, refLoad: 7178.76, lowLoad: 1435.752, - axleWeightDistribution: new[] { 0.214, 0.214, 0.358, 0.214 } + axleWeightDistribution: new[] { 0.214, 0.214, 0.358, 0.214 }, + expVehicleEquipment: GetExpectedVehicleEquipment(null, null, null, null) ); } for (var i = 3; i < 6; i++) { @@ -434,7 +452,8 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration curbMass: 14000, refLoad: 8853.804, lowLoad: 1770.7608, - axleWeightDistribution: new[] { 0.214, 0.214, 0.358, 0.214 } + axleWeightDistribution: new[] { 0.214, 0.214, 0.358, 0.214 }, + expVehicleEquipment: GetExpectedVehicleEquipment(null, null, null, null) ); } @@ -447,8 +466,9 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration height: 3.15, curbMass: 14000, refLoad: 5496.6780, - lowLoad: 1099.3356, - axleWeightDistribution: new[] { 0.214, 0.214, 0.358, 0.214 } + lowLoad: 2198.6712, + axleWeightDistribution: new[] { 0.214, 0.214, 0.358, 0.214 }, + expVehicleEquipment: GetExpectedVehicleEquipment(null, null, null, null) ); AssertMission( segment.Missions[7], @@ -459,8 +479,9 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration height: 3.15, curbMass: 14000, refLoad: 3497.886, - lowLoad: 699.5772, - axleWeightDistribution: new[] { 0.214, 0.214, 0.358, 0.214 } + lowLoad: 1399.1544, + axleWeightDistribution: new[] { 0.214, 0.214, 0.358, 0.214 }, + expVehicleEquipment: GetExpectedVehicleEquipment(null, null, null, null) ); AssertMission( @@ -472,8 +493,9 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration height: 3.7, curbMass: 14000, refLoad: 7495.47, - lowLoad: 1499.094, - axleWeightDistribution: new[] { 0.214, 0.214, 0.358, 0.214 } + lowLoad: 2998.188, + axleWeightDistribution: new[] { 0.214, 0.214, 0.358, 0.214 }, + expVehicleEquipment: GetExpectedVehicleEquipment(null, null, null, null) ); AssertMission( segment.Missions[9], @@ -484,8 +506,9 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration height: 3.7, curbMass: 14000, refLoad: 4996.98, - lowLoad: 999.396, - axleWeightDistribution: new[] { 0.214, 0.214, 0.358, 0.214 } + lowLoad: 1998.792, + axleWeightDistribution: new[] { 0.214, 0.214, 0.358, 0.214 }, + expVehicleEquipment: GetExpectedVehicleEquipment(null, null, null, null) ); } @@ -521,7 +544,8 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration curbMass: 14000, refLoad: 10299.96, lowLoad: 2059.992, - axleWeightDistribution: new[] { 0.200, 0.282, 0.324, 0.194 } + axleWeightDistribution: new[] { 0.200, 0.282, 0.324, 0.194 }, + expVehicleEquipment: GetExpectedVehicleEquipment(3, 3, 0, 0) ); } for (var i = 3; i < 6; i++) { @@ -535,7 +559,8 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration curbMass: 14000, refLoad: 12703.284, lowLoad: 2540.6568, - axleWeightDistribution: new[] { 0.200, 0.282, 0.324, 0.194 } + axleWeightDistribution: new[] { 0.200, 0.282, 0.324, 0.194 }, + expVehicleEquipment: GetExpectedVehicleEquipment(null, null, null, null) ); } @@ -548,8 +573,9 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration height: 3.15, curbMass: 14000, refLoad: 7886.538, - lowLoad: 1577.3076, - axleWeightDistribution: new[] { 0.200, 0.282, 0.324, 0.194 } + lowLoad: 3154.6152, + axleWeightDistribution: new[] { 0.200, 0.282, 0.324, 0.194 }, + expVehicleEquipment: GetExpectedVehicleEquipment(null, null, null, null) ); AssertMission( segment.Missions[7], @@ -560,8 +586,9 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration height: 3.15, curbMass: 14000, refLoad: 5018.706, - lowLoad: 1003.7412, - axleWeightDistribution: new[] { 0.200, 0.282, 0.324, 0.194 } + lowLoad: 2007.4824, + axleWeightDistribution: new[] { 0.200, 0.282, 0.324, 0.194 }, + expVehicleEquipment: GetExpectedVehicleEquipment(null, null, null, null) ); AssertMission( @@ -573,8 +600,9 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration height: 3.7, curbMass: 14000, refLoad: 10754.37, - lowLoad: 2150.874, - axleWeightDistribution: new[] { 0.200, 0.282, 0.324, 0.194 } + lowLoad: 4301.748, + axleWeightDistribution: new[] { 0.200, 0.282, 0.324, 0.194 }, + expVehicleEquipment: GetExpectedVehicleEquipment(null, null, null, null) ); AssertMission( segment.Missions[9], @@ -585,16 +613,17 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration height: 3.7, curbMass: 14000, refLoad: 7169.58, - lowLoad: 1433.916, - axleWeightDistribution: new[] { 0.200, 0.282, 0.324, 0.194 } + lowLoad: 2867.832, + axleWeightDistribution: new[] { 0.200, 0.282, 0.324, 0.194 }, + expVehicleEquipment: GetExpectedVehicleEquipment(null, null, null, null) ); } - + private void AssertMission( Mission m, MissionType missionType, double cdxA, double length, double width, double height, double curbMass, - double refLoad, double lowLoad, double[] axleWeightDistribution) + double refLoad, double lowLoad, double[] axleWeightDistribution, VehicleEquipment expVehicleEquipment) { Assert.AreEqual(missionType, m.MissionType); Assert.AreEqual(cdxA, m.DefaultCDxA.Value(), 1e-9); @@ -604,11 +633,28 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration Assert.AreEqual(curbMass, m.CurbMass.Value(), 1e-9); Assert.AreEqual(refLoad, m.RefLoad.Value(), 1e-9); Assert.AreEqual(lowLoad, m.LowLoad.Value(), 1e-9); - foreach (var tuple in axleWeightDistribution.ZipAll(m.AxleWeightDistribution, Tuple.Create)) { + foreach (var tuple in axleWeightDistribution.ZipAll(m.AxleWeightDistribution, Tuple.Create)) + { Assert.AreEqual(tuple.Item1, tuple.Item2, 1e-0, "Axle distribution not equal.\nexpected: {0}\nactual: {1}", string.Join(",", axleWeightDistribution), - string.Join(",", m.AxleWeightDistribution)); + string.Join(",", m.AxleWeightDistribution)); } + Assert.AreEqual(expVehicleEquipment.ExternalDisplays, m.BusParameter.VehicleEquipment.ExternalDisplays); + Assert.AreEqual(expVehicleEquipment.InternalDisplays, m.BusParameter.VehicleEquipment.InternalDisplays); + Assert.AreEqual(expVehicleEquipment.Fridge, m.BusParameter.VehicleEquipment.Fridge); + Assert.AreEqual(expVehicleEquipment.KitchenStandard, m.BusParameter.VehicleEquipment.KitchenStandard); + } + + private VehicleEquipment GetExpectedVehicleEquipment(double? externalDisplays, double? internalDisplays, double? fridge, + double? kitchenStandard) + { + return new VehicleEquipment + { + ExternalDisplays = externalDisplays, + InternalDisplays = internalDisplays, + Fridge = fridge, + KitchenStandard = kitchenStandard + }; } } }