diff --git a/VectoCore/VectoCore/Models/Declaration/ElectricSystem.cs b/VectoCore/VectoCore/Models/Declaration/ElectricSystem.cs index f183e9e5037932a2181b08dee8253d23cedf908d..3d3e787b42b492fcdd4d95c6ecd393fa55a80131 100644 --- a/VectoCore/VectoCore/Models/Declaration/ElectricSystem.cs +++ b/VectoCore/VectoCore/Models/Declaration/ElectricSystem.cs @@ -47,7 +47,7 @@ namespace TUGraz.VectoCore.Models.Declaration private readonly Dictionary<Tuple<MissionType, string>, Watt> _data = new Dictionary<Tuple<MissionType, string>, Watt>(); - + public ElectricSystem() { ParseData(ReadCsvResource(ResourceId)); @@ -84,14 +84,14 @@ namespace TUGraz.VectoCore.Models.Declaration return sum / _alternator.Lookup(missionType, null); } - private sealed class Alternator : LookupData<MissionType, string, double> + internal sealed class Alternator : LookupData<MissionType, string, double> { private const string ResourceId = "TUGraz.VectoCore.Resources.Declaration.VAUX.ALT-Tech.csv"; private const string Default = "Standard alternator"; private readonly Dictionary<Tuple<MissionType, string>, double> _data = new Dictionary<Tuple<MissionType, string>, double>(); - + public Alternator() { ParseData(ReadCsvResource(ResourceId)); diff --git a/VectoCore/VectoCore/Models/Declaration/SteeringPump.cs b/VectoCore/VectoCore/Models/Declaration/SteeringPump.cs index 4fbaf72c36eb87a08c36d975902cc3cc8fabf553..e411a7be0b2fe79ed725055132b56241b00011c8 100644 --- a/VectoCore/VectoCore/Models/Declaration/SteeringPump.cs +++ b/VectoCore/VectoCore/Models/Declaration/SteeringPump.cs @@ -43,9 +43,12 @@ namespace TUGraz.VectoCore.Models.Declaration { private const string ResourceId = "TUGraz.VectoCore.Resources.Declaration.VAUX.SP-Table.csv"; private readonly SteeringPumpTechnologies _technologies = new SteeringPumpTechnologies(); + private readonly SteeringPumpAxles _axles = new SteeringPumpAxles(); + private readonly ElectricSystem.Alternator _alternator = new ElectricSystem.Alternator(); + private readonly Dictionary<Tuple<MissionType, VehicleClass>, Watt[]> _data = new Dictionary<Tuple<MissionType, VehicleClass>, Watt[]>(); - + public SteeringPump() { ParseData(ReadCsvResource(ResourceId)); @@ -56,12 +59,7 @@ namespace TUGraz.VectoCore.Models.Declaration try { var shares = _data[Tuple.Create(mission, hdvClass)]; var factors = _technologies.Lookup(technology); - - var sum = 0.SI<Watt>(); - for (var i = 0; i < factors.Length; i++) { - sum += shares[i] * factors[i]; - } - return sum; + return shares[0] * factors.UnloadedFriction + shares[1] * factors.Banking + shares[2] * factors.Steering; } catch (KeyNotFoundException) { throw new VectoException( "Auxiliary Lookup Error: No value found for Steering Pump with mission '{0}', HDVClass '{1}' and technology '{3}'", @@ -85,15 +83,55 @@ namespace TUGraz.VectoCore.Models.Declaration } } - private sealed class SteeringPumpTechnologies : LookupData<string, double[]> + private sealed class SteeringPumpTechnologies : LookupData<string, SteeringPumpTechnologies.CorrectionFactors> { private const string ResourceId = "TUGraz.VectoCore.Resources.Declaration.VAUX.SP-Tech.csv"; + internal struct CorrectionFactors + { + public double UnloadedFriction; + public double Banking; + public double Steering; + + public CorrectionFactors(double unloadedFriction, double banking, double steering) + { + UnloadedFriction = unloadedFriction; + Banking = banking; + Steering = steering; + } + } + public SteeringPumpTechnologies() { ParseData(ReadCsvResource(ResourceId)); } + protected override void ParseData(DataTable table) + { + Data = table.Rows.Cast<DataRow>().ToDictionary( + key => key.Field<string>("Scaling Factors"), + value => new CorrectionFactors(value.ParseDouble("UF"), value.ParseDouble("B"), value.ParseDouble("S"))); + } + + public override CorrectionFactors Lookup(string tech) + { + try { + return Data[tech]; + } catch (KeyNotFoundException) { + throw new VectoException("Auxiliary Lookup Error: No value found for SteeringPump Technology with key '{0}'", tech); + } + } + } + + private sealed class SteeringPumpAxles : LookupData<string, double[]> + { + private const string ResourceId = "TUGraz.VectoCore.Resources.Declaration.VAUX.SP-Tech.csv"; + + public SteeringPumpAxles() + { + ParseData(ReadCsvResource(ResourceId)); + } + protected override void ParseData(DataTable table) { Data = table.Rows.Cast<DataRow>().ToDictionary( diff --git a/VectoCore/VectoCore/Resources/Declaration/VAUX/SP-Axles.csv b/VectoCore/VectoCore/Resources/Declaration/VAUX/SP-Axles.csv new file mode 100644 index 0000000000000000000000000000000000000000..307e4278aefc6a7223342c4460069d6abfee3f95 --- /dev/null +++ b/VectoCore/VectoCore/Resources/Declaration/VAUX/SP-Axles.csv @@ -0,0 +1,5 @@ +No steered axles / power demand percentage [%],Long haul,Regional delivery,Urban delivery,Municipal utility,construction +1,100/100/100,100/100/100,100/100/100,100/100/100,100/100/100 +2,100/70/70,100/70/70,100/70/70,100/70/70,100/70/70 +3,100/50/50,100/50/50,100/50/50,100/50/50,100/50/50 +4,100/50/50,100/50/50,100/50/50,100/50/50,100/50/50 diff --git a/VectoCore/VectoCore/Resources/Declaration/VAUX/SP-Table.csv b/VectoCore/VectoCore/Resources/Declaration/VAUX/SP-Table.csv index 53a2136afe86d583e780cb3928dcac2ca9f0f415..33891fa91584310d1c50915a38bb783182fbb347 100644 --- a/VectoCore/VectoCore/Resources/Declaration/VAUX/SP-Table.csv +++ b/VectoCore/VectoCore/Resources/Declaration/VAUX/SP-Table.csv @@ -1,11 +1,14 @@ -HDV Class / Power demand per share,Long haul,Regional delivery,Urban delivery,Municipal utility,Construction,Heavy Urban,Urban,Suburban,Interurban,Coach -1,0,110/130/20/0,100/120/20/30,0,0,0,0,0,0,0 -2,150/190/30/0,130/160/30/0,120/140/20/30,0,0,0,0,0,0,0 -3,0,140/170/30/0,130/150/30/40,0,0,0,0,0,0,0 -4,230/280/100/0,220/270/40/0,0,220/270/40/0,0,0,0,0,0,0 -5,270/330/120/0,250/290/90/0,220/260/80/60,0,0,0,0,0,0,0 -6,0,0,0,0,0,0,0,0,0,0 -7,0,0,0,0,0,0,0,0,0,0 -8,0,0,0,0,0,0,0,0,0,0 -9,270/330/120/0,220/270/60/0,0,220/270/60/0,0,0,0,0,0,0 -10,200/250/120/0,200/240/90/0,0,0,0,0,0,0,0,0 +HDV Class / Power demand per share [W],Long haul,Regional delivery,Urban delivery,Municipal utility,Construction +1,,240/20/20,220/20/30,, +2,340/30/0,290/30/20,260/20/30,, +3,,310/30/30,280/30/40,, +4,510/100/0,490/40/40,,430/30/50, +5,600/120/0,540/90/40,480/80/60,, +6,,,,, +7,,,,, +8,,,,, +9,600/120/0,490/60/40,,430/30/50, +10,450/120/0,440/90/40,,, +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 diff --git a/VectoCore/VectoCore/Resources/Declaration/VAUX/SP-Tech.csv b/VectoCore/VectoCore/Resources/Declaration/VAUX/SP-Tech.csv index ca7ebfb7833faa126ff5108c221b3a805d55929f..00253f7d7065ccb95aecc4aa7ffcf71a9ea409ce 100644 --- a/VectoCore/VectoCore/Resources/Declaration/VAUX/SP-Tech.csv +++ b/VectoCore/VectoCore/Resources/Declaration/VAUX/SP-Tech.csv @@ -1,4 +1,7 @@ -Scaling Factors,U,F,B,S -Fixed displacement,1,1,1,1 -Variable displacement,0.6,0.6,0.6,0.6 -Hydraulic supported by electric,0.7,1,0.9,0.9 +Technology / Scaling Factors [-],CF_UF,CF_B,CF_S +Fixed displacement,1,1,1 +Fixed displacement elec. controlled,0.95,1,1 +Dual displacement,0.85,0.85,0.85 +Variable displacement mech. controlled,0.75,0.75,0.75 +Variable displacement elec. controlled,0.6,0.6,0.6 +Electric,0,1.5/eff_alt,1/eff_alt