From a8192565d1258819833a35f58a612177bf1c1fa9 Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Fri, 9 Nov 2018 08:40:39 +0100 Subject: [PATCH] adapting fuel types --- VectoCommon/VectoCommon/Models/FuelType.cs | 89 ++++++++++--------- .../Models/Declaration/LookupData.cs | 2 + .../Resources/Declaration/FuelTypes.csv | 5 +- 3 files changed, 51 insertions(+), 45 deletions(-) diff --git a/VectoCommon/VectoCommon/Models/FuelType.cs b/VectoCommon/VectoCommon/Models/FuelType.cs index 489b50d601..9f55f52dcb 100644 --- a/VectoCommon/VectoCommon/Models/FuelType.cs +++ b/VectoCommon/VectoCommon/Models/FuelType.cs @@ -29,47 +29,50 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using System; - -namespace TUGraz.VectoCommon.Models -{ - public enum FuelType - { - // ReSharper disable InconsistentNaming - DieselCI, - EthanolCI, - PetrolPI, - EthanolPI, - LPG, - NG, - // ReSharper restore InconsistentNaming - } - - public static class FuelTypeHelper - { - public static string GetLabel(this FuelType ftype) - { - switch (ftype) { - case FuelType.DieselCI: - return "Diesel CI"; - case FuelType.EthanolCI: - return "Ethanol CI"; - case FuelType.PetrolPI: - return "Petrol PI"; - case FuelType.EthanolPI: - return "Ethanol PI"; - case FuelType.LPG: - return "LPG"; - case FuelType.NG: - return "NG"; - default: - throw new ArgumentOutOfRangeException("fuel type", ftype, null); - } - } - - public static string ToXMLFormat(this FuelType ftype) - { - return ftype.GetLabel(); - } - } +using System; + +namespace TUGraz.VectoCommon.Models +{ + public enum FuelType + { + // ReSharper disable InconsistentNaming + DieselCI, + EthanolCI, + PetrolPI, + EthanolPI, + LPGPI, + NGPI, + NGCI, + // ReSharper restore InconsistentNaming + } + + public static class FuelTypeHelper + { + public static string GetLabel(this FuelType ftype) + { + switch (ftype) { + case FuelType.DieselCI: + return "Diesel CI"; + case FuelType.EthanolCI: + return "Ethanol CI"; + case FuelType.PetrolPI: + return "Petrol PI"; + case FuelType.EthanolPI: + return "Ethanol PI"; + case FuelType.LPGPI: + return "LPG PI"; + case FuelType.NGPI: + return "NG PI"; + case FuelType.NGCI: + return "NG CI"; + default: + throw new ArgumentOutOfRangeException("fuel type", ftype, null); + } + } + + public static string ToXMLFormat(this FuelType ftype) + { + return ftype.GetLabel(); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Declaration/LookupData.cs b/VectoCore/VectoCore/Models/Declaration/LookupData.cs index 7c5b2ad730..89da7b2ef1 100644 --- a/VectoCore/VectoCore/Models/Declaration/LookupData.cs +++ b/VectoCore/VectoCore/Models/Declaration/LookupData.cs @@ -71,6 +71,8 @@ namespace TUGraz.VectoCore.Models.Declaration { protected Dictionary<TKey, TValue> Data = new Dictionary<TKey, TValue>(); + protected override string ErrorMessage { get { return "key {0} not found in lookup data"; } } + public virtual TValue Lookup(TKey key) { try { diff --git a/VectoCore/VectoCore/Resources/Declaration/FuelTypes.csv b/VectoCore/VectoCore/Resources/Declaration/FuelTypes.csv index 975fa890ae..117843e721 100644 --- a/VectoCore/VectoCore/Resources/Declaration/FuelTypes.csv +++ b/VectoCore/VectoCore/Resources/Declaration/FuelTypes.csv @@ -3,5 +3,6 @@ Diesel CI , 836 , 3.13 , 42700 Ethanol CI , 820 , 1.83 , 25700 Petrol PI , 750 , 3.04 , 41500 Ethanol PI , 786 , 2.09 , 29100 -LPG , , 3.02 , 46000 -NG , , 2.54 , 45100 \ No newline at end of file +LPG PI , , 3.02 , 46000 +NG PI , , 2.54 , 45100 +NG CI , , 1000 , 100000 \ No newline at end of file -- GitLab