diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs index 8d91d86dfdfc25adbf9196706f1e9eef93988e7b..41657c7df7cb3947029dcbc05d644b71076273ca 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs @@ -310,7 +310,8 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter aux.ID = Constants.Auxiliaries.IDs.SteeringPump; break; case AuxiliaryType.HVAC: - aux.PowerDemand = DeclarationData.HeatingVentilationAirConditioning.Lookup(mission, hvdClass); + aux.PowerDemand = DeclarationData.HeatingVentilationAirConditioning.Lookup(mission, + auxData.Technology.FirstOrDefault(), hvdClass); aux.ID = Constants.Auxiliaries.IDs.HeatingVentilationAirCondition; break; case AuxiliaryType.PneumaticSystem: diff --git a/VectoCore/VectoCore/Models/Declaration/HVAC.cs b/VectoCore/VectoCore/Models/Declaration/HVAC.cs index 231e09235f2b756ee0c7f013933c8948780e29b3..07d882b97899192456c75877522c6b3be49fbfe4 100644 --- a/VectoCore/VectoCore/Models/Declaration/HVAC.cs +++ b/VectoCore/VectoCore/Models/Declaration/HVAC.cs @@ -30,15 +30,19 @@ */ using System; +using System.Collections.Generic; using System.Data; +using System.Linq; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.Declaration { - public sealed class HeatingVentilationAirConditioning : LookupData<MissionType, VehicleClass, Watt>, + public sealed class HeatingVentilationAirConditioning : LookupData<MissionType, string, VehicleClass, Watt>, IDeclarationAuxiliaryTable { + private List<string> Technologies; + protected override string ResourceId { get { return DeclarationData.DeclarationDataResourcePrefix + ".VAUX.HVAC-Table.csv"; } @@ -46,25 +50,29 @@ namespace TUGraz.VectoCore.Models.Declaration protected override string ErrorMessage { - get { return "Auxiliary Lookup Error: No value found for HVAC. Mission: '{0}', HDVClass: '{1}'"; } + get { + return "Auxiliary Lookup Error: No value found for HVAC. Mission: '{0}', Technology: '{1}' , HDVClass: '{2}'"; + } } protected override void ParseData(DataTable table) { foreach (DataRow row in table.Rows) { var hdvClass = VehicleClassHelper.Parse(row.Field<string>("hdvclass")); + var technology = row.Field<string>("technology"); foreach (DataColumn col in table.Columns) { var value = row.ParseDoubleOrGetDefault(col.Caption, double.NaN); - if (col.Caption != "hdvclass" && !double.IsNaN(value)) { - Data[Tuple.Create(col.Caption.ParseEnum<MissionType>(), hdvClass)] = value.SI<Watt>(); + if (col.Caption != "hdvclass" && col.Caption != "technology" && !double.IsNaN(value)) { + Data[Tuple.Create(col.Caption.ParseEnum<MissionType>(), technology, hdvClass)] = value.SI<Watt>(); } } } + Technologies = Data.Select(x => x.Key.Item2).Distinct().ToList(); } public string[] GetTechnologies() { - return new[] { "Default" }; + return Technologies.ToArray(); } } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Declaration/LookupData.cs b/VectoCore/VectoCore/Models/Declaration/LookupData.cs index 5a1543ca639ed759a1e56de19919d65141aa0497..58919c1ec6f354de56ddd11d7a50681d5fc55f6e 100644 --- a/VectoCore/VectoCore/Models/Declaration/LookupData.cs +++ b/VectoCore/VectoCore/Models/Declaration/LookupData.cs @@ -88,13 +88,30 @@ namespace TUGraz.VectoCore.Models.Declaration public virtual TValue Lookup(TKey1 key1, TKey2 key2) { try { - return Data[new Tuple<TKey1, TKey2>(key1, key2)]; + return Data[Tuple.Create(key1, key2)]; } catch (KeyNotFoundException) { throw new VectoException(string.Format(ErrorMessage, key1, key2)); } } } + public abstract class LookupData<TKey1, TKey2, TKey3, TValue> : LookupData + { + protected readonly Dictionary<Tuple<TKey1, TKey2, TKey3>, TValue> Data = + new Dictionary<Tuple<TKey1, TKey2, TKey3>, TValue>(); + + public virtual TValue Lookup(TKey1 key1, TKey2 key2, TKey3 key3) + { + try { + return Data[Tuple.Create(key1, key2, key3)]; + } catch (KeyNotFoundException) { + throw new VectoException(string.Format(ErrorMessage, key1, key2, key3)); + } + } + + //public abstract TValue Lookup(TKey1 key1, TKey2 key2, TKey3 key3); + } + public abstract class LookupData<TKey1, TKey2, TKey3, TKey4, TValue> : LookupData { public abstract TValue Lookup(TKey1 key1, TKey2 key2, TKey3 key3, TKey4 key4); diff --git a/VectoCore/VectoCore/Resources/Declaration/VAUX/HVAC-Table.csv b/VectoCore/VectoCore/Resources/Declaration/VAUX/HVAC-Table.csv index faddf16733ed5d12e1ec51045ec4f3b157038405..5cb1fa8f1f3a0fee36acb0743463aa51636f4b2e 100644 --- a/VectoCore/VectoCore/Resources/Declaration/VAUX/HVAC-Table.csv +++ b/VectoCore/VectoCore/Resources/Declaration/VAUX/HVAC-Table.csv @@ -1,11 +1,22 @@ -HDV Class , Long haul , Regional delivery , Urban delivery , Municipal utility , Construction -1 , , 150 , 150 , , -2 , 200 , 200 , 150 , , -3 , , 200 , 150 , , -4 , 350 , 200 , , 300 , -5 , 350 , 200 , , , -9 , 350 , 200 , , 300 , -10 , 350 , 200 , , , -11 , 350 , 200 , , 300 , 200 -12 , 350 , 200 , , , 200 -16 , , , , , 200 +Technology , HDV Class , Long haul , Regional delivery , Urban delivery , Municipal utility , Construction +None , 1 , 0 , 0 , 0 , 0 , 0 +None , 2 , 0 , 0 , 0 , 0 , 0 +None , 3 , 0 , 0 , 0 , 0 , 0 +None , 4 , 0 , 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 , 12 , 0 , 0 , 0 , 0 , 0 +None , 16 , 0 , 0 , 0 , 0 , 0 +# +Default , 1 , , 150 , 150 , , +Default , 2 , 200 , 200 , 150 , , +Default , 3 , , 200 , 150 , , +Default , 4 , 350 , 200 , , 300 , +Default , 5 , 350 , 200 , , , +Default , 9 , 350 , 200 , , 300 , +Default , 10 , 350 , 200 , , , +Default , 11 , 350 , 200 , , 300 , 200 +Default , 12 , 350 , 200 , , , 200 +Default , 16 , , , , , 200