From d7ef9326eb16cbc3e113eeffa49406adb34ea7ce Mon Sep 17 00:00:00 2001
From: "VKMTHD\\franzjosefkober" <franz.josef.kober@ivt.tugraz.at>
Date: Sun, 3 May 2020 17:30:23 +0200
Subject: [PATCH] fixed AlternatorTechnology and NgTanksystem input

---
 VECTO3GUI/App.xaml                            |   4 +-
 VECTO3GUI/Model/AlternatorTechnologyModel.cs  |  50 +++++++++
 VECTO3GUI/Model/InterfacesImpl.cs             |  17 ---
 .../AuxiliariesBusComponentData.cs            |  35 +++++-
 VECTO3GUI/Util/XML/XMLCompletedBus.cs         |  14 ++-
 VECTO3GUI/VECTO3GUI.csproj                    |   3 +-
 .../ViewModel/Impl/AuxiliariesViewModel.cs    | 100 +++++++++++++-----
 .../Impl/CompleteVehicleBusViewModel.cs       |   9 +-
 .../ViewModel/Interfaces/IAuxiliariesBus.cs   |   4 +-
 .../Interfaces/IAuxiliariesViewModel.cs       |   3 +-
 .../ICompleteVehicleBusViewModel.cs           |   2 +-
 .../AuxiliariesDeclarationView.xaml           |  21 ++--
 .../InputData/DeclarationInputData.cs         |  16 +++
 .../XMLDeclarationVehicleDataProvider.cs      |   7 +-
 14 files changed, 213 insertions(+), 72 deletions(-)
 create mode 100644 VECTO3GUI/Model/AlternatorTechnologyModel.cs
 delete mode 100644 VECTO3GUI/Model/InterfacesImpl.cs

diff --git a/VECTO3GUI/App.xaml b/VECTO3GUI/App.xaml
index f5680c7615..b87d524d8e 100644
--- a/VECTO3GUI/App.xaml
+++ b/VECTO3GUI/App.xaml
@@ -10,7 +10,7 @@
                         <Setter Property="Focusable" Value="False"/>
                     </Style>
                     <Style TargetType="{x:Type TextBox}">
-                        <Setter Property="Validation.ErrorTemplate">
+                        <!--<Setter Property="Validation.ErrorTemplate">
                             <Setter.Value>
                                 <ControlTemplate>
                                     <DockPanel>
@@ -30,7 +30,7 @@
                             <Trigger Property="Validation.HasError" Value="true">
                                 <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}"/>
                             </Trigger>
-                        </Style.Triggers>
+                        </Style.Triggers>-->
                     </Style>
                 </ResourceDictionary>
 
diff --git a/VECTO3GUI/Model/AlternatorTechnologyModel.cs b/VECTO3GUI/Model/AlternatorTechnologyModel.cs
new file mode 100644
index 0000000000..010d6be42c
--- /dev/null
+++ b/VECTO3GUI/Model/AlternatorTechnologyModel.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Remoting.Channels;
+using System.Text;
+using System.Threading.Tasks;
+using VECTO3GUI.ViewModel.Impl;
+
+namespace VECTO3GUI.Model
+{
+	public enum AlternatorTechnology
+	{
+		Empty,
+		Default
+	}
+	
+	public static class AlternatorTechnologyHelper 
+	{
+		public static string GetLabel(this AlternatorTechnology technology)
+		{
+			switch (technology) {
+				case AlternatorTechnology.Default:
+					return nameof(AlternatorTechnology.Default).ToLower();
+				default:
+					return string.Empty;
+			}
+		}
+
+		public static AlternatorTechnology Parse(string technologyName)
+		{
+			switch (technologyName.ToLower()) {
+				case "default":
+					return AlternatorTechnology.Default;
+				default:
+					return AlternatorTechnology.Empty;
+			}
+		}
+	}
+	
+	public class AlternatorTechnologyModel : ObservableObject
+	{
+		public AlternatorTechnology _alternatorTechnology;
+
+		public AlternatorTechnology AlternatorTechnology
+		{
+			get { return _alternatorTechnology; }
+			set { SetProperty(ref _alternatorTechnology, value); }
+		}
+	}
+}
diff --git a/VECTO3GUI/Model/InterfacesImpl.cs b/VECTO3GUI/Model/InterfacesImpl.cs
deleted file mode 100644
index fbd920efde..0000000000
--- a/VECTO3GUI/Model/InterfacesImpl.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using TUGraz.VectoCommon.InputData;
-
-namespace VECTO3GUI.Model
-{
-
-	public class AlternatorDeclarationInputData : IAlternatorDeclarationInputData
-	{
-		public string Technology { get; set; }
-		public double Ratio { get; set; }
-	}
-
-}
diff --git a/VECTO3GUI/Model/TempDataObject/AuxiliariesBusComponentData.cs b/VECTO3GUI/Model/TempDataObject/AuxiliariesBusComponentData.cs
index 678c6f0b9b..e855a78dac 100644
--- a/VECTO3GUI/Model/TempDataObject/AuxiliariesBusComponentData.cs
+++ b/VECTO3GUI/Model/TempDataObject/AuxiliariesBusComponentData.cs
@@ -1,11 +1,11 @@
 using System;
 using System.Collections.Generic;
-using System.Collections.ObjectModel;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using TUGraz.VectoCommon.BusAuxiliaries;
 using TUGraz.VectoCommon.Utils;
+using VECTO3GUI.Helper;
 using VECTO3GUI.ViewModel.Interfaces;
 
 namespace VECTO3GUI.Model.TempDataObject
@@ -14,7 +14,8 @@ namespace VECTO3GUI.Model.TempDataObject
 	{
 		#region IAuxiliariesBus Interface
 
-		public ObservableCollection<string> AlternatorTechnologies { get; set; }
+		public ObservableCollectionEx<AlternatorTechnologyModel> AlternatorTechnologies { get; set; }
+		public List<AlternatorTechnologyModel> OriginAlternatorTechnologies { get; private set; }
 		public bool DayrunninglightsLED { get; set; }
 		public bool HeadlightsLED { get; set; }
 		public bool PositionlightsLED { get; set; }
@@ -50,7 +51,7 @@ namespace VECTO3GUI.Model.TempDataObject
 
 		public void ResetToComponentValues(IAuxiliariesViewModel viewModel)
 		{
-			viewModel.AlternatorTechnologies = AlternatorTechnologies;
+			viewModel.AlternatorTechnologies = GetAlternatorTechnology();
 			viewModel.DayrunninglightsLED = DayrunninglightsLED;
 			viewModel.HeadlightsLED = HeadlightsLED;
 			viewModel.PositionlightsLED = PositionlightsLED;
@@ -67,9 +68,19 @@ namespace VECTO3GUI.Model.TempDataObject
 			viewModel.DoorDriveTechnology = viewModel.DoorDriveTechnology;
 		}
 
+		private ObservableCollectionEx<AlternatorTechnologyModel> GetAlternatorTechnology()
+		{
+			var res = new ObservableCollectionEx<AlternatorTechnologyModel>();
+			for (int i = 0; i < OriginAlternatorTechnologies.Count; i++) {
+				res.Add(new AlternatorTechnologyModel{AlternatorTechnology = OriginAlternatorTechnologies[i].AlternatorTechnology});
+			}
+
+			return res;
+		}
+		
 		public void ClearValues(IAuxiliariesViewModel viewModel)
 		{
-			viewModel.AlternatorTechnologies = default(ObservableCollection<string>);
+			viewModel.AlternatorTechnologies = default(ObservableCollectionEx<AlternatorTechnologyModel>);
 			viewModel.DayrunninglightsLED = default(bool);
 			viewModel.HeadlightsLED = default(bool);
 			viewModel.PositionlightsLED = default(bool);
@@ -88,7 +99,8 @@ namespace VECTO3GUI.Model.TempDataObject
 		
 		private void SetValues(IAuxiliariesViewModel auxiliaries)
 		{
-			AlternatorTechnologies = new ObservableCollection<string>(auxiliaries.AlternatorTechnologies);
+			OriginAlternatorTechnologies = GetOriginAlternatorTechnologies(auxiliaries);
+			AlternatorTechnologies = GetAlternatorTechnology();
 			DayrunninglightsLED = auxiliaries.DayrunninglightsLED;
 			HeadlightsLED = auxiliaries.HeadlightsLED;
 			PositionlightsLED = auxiliaries.PositionlightsLED;
@@ -105,5 +117,18 @@ namespace VECTO3GUI.Model.TempDataObject
 			DoorDriveTechnology = auxiliaries.DoorDriveTechnology;
 		}
 
+		private List<AlternatorTechnologyModel> GetOriginAlternatorTechnologies(IAuxiliariesViewModel auxiliaries)
+		{
+			if (auxiliaries.AlternatorTechnologies == null)
+				return null;
+
+			var result = new List<AlternatorTechnologyModel>();
+			for (int i = 0; i < auxiliaries.AlternatorTechnologies.Count; i++) {
+				result.Add(new AlternatorTechnologyModel {
+					AlternatorTechnology =  auxiliaries.AlternatorTechnologies[i].AlternatorTechnology
+				});
+			}
+			return result;
+		}
 	}
 }
diff --git a/VECTO3GUI/Util/XML/XMLCompletedBus.cs b/VECTO3GUI/Util/XML/XMLCompletedBus.cs
index 078b13ad18..7ab379e144 100644
--- a/VECTO3GUI/Util/XML/XMLCompletedBus.cs
+++ b/VECTO3GUI/Util/XML/XMLCompletedBus.cs
@@ -12,6 +12,7 @@ using TUGraz.VectoCommon.BusAuxiliaries;
 using TUGraz.VectoCommon.Models;
 using TUGraz.VectoCommon.Resources;
 using TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider;
+using VECTO3GUI.Model;
 using VECTO3GUI.ViewModel.Interfaces;
 
 
@@ -191,18 +192,23 @@ namespace VECTO3GUI.Util.XML
 			);
 		}
 		
-		private XElement[] GetAlternatorTechnology(IList<string> alternatorTechnologies)
+		private XElement[] GetAlternatorTechnology(IList<AlternatorTechnologyModel> alternatorTechnologies)
 		{
 			if (alternatorTechnologies.IsNullOrEmpty())
 				return null;
 
-			var result = new XElement[alternatorTechnologies.Count];
+			var result = new List<XElement>();
 
 			for (int i = 0; i < alternatorTechnologies.Count; i++) {
-				result [i] = new XElement(_v26 + XMLNames.BusAux_ElectricSystem_AlternatorTechnology, alternatorTechnologies[i]);	
+
+				if(alternatorTechnologies[i].AlternatorTechnology == AlternatorTechnology.Empty)
+					continue;
+				
+				result.Add(new XElement(_v26 + XMLNames.BusAux_ElectricSystem_AlternatorTechnology, 
+					alternatorTechnologies[i].AlternatorTechnology.GetLabel()));	
 			}
 
-			return result;
+			return result.Count > 0 ? result.ToArray() : null;
 		}
 	}
 }
diff --git a/VECTO3GUI/VECTO3GUI.csproj b/VECTO3GUI/VECTO3GUI.csproj
index 0d9cbb0c79..cc8bb460cf 100644
--- a/VECTO3GUI/VECTO3GUI.csproj
+++ b/VECTO3GUI/VECTO3GUI.csproj
@@ -117,6 +117,7 @@
     <Reference Include="Microsoft.Expression.Interactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\packages\System.Windows.Interactivity.WPF.2.0.20525\lib\net40\Microsoft.Expression.Interactions.dll</HintPath>
     </Reference>
+    <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
     <Reference Include="Microsoft.WindowsAPICodePack, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL">
       <HintPath>..\packages\WindowsAPICodePack-Core.1.1.2\lib\Microsoft.WindowsAPICodePack.dll</HintPath>
     </Reference>
@@ -176,7 +177,7 @@
     <Compile Include="Helper\ViewModelBase.cs" />
     <Compile Include="Helper\XmlComponentReaderHelper.cs" />
     <Compile Include="Helper\XmlHelper.cs" />
-    <Compile Include="Model\InterfacesImpl.cs" />
+    <Compile Include="Model\AlternatorTechnologyModel.cs" />
     <Compile Include="Model\JobListModel.cs" />
     <Compile Include="Model\SettingsModel.cs" />
     <Compile Include="Model\TempDataObject\AirdragComponentData.cs" />
diff --git a/VECTO3GUI/ViewModel/Impl/AuxiliariesViewModel.cs b/VECTO3GUI/ViewModel/Impl/AuxiliariesViewModel.cs
index 61fa55736a..f977b6e463 100644
--- a/VECTO3GUI/ViewModel/Impl/AuxiliariesViewModel.cs
+++ b/VECTO3GUI/ViewModel/Impl/AuxiliariesViewModel.cs
@@ -1,26 +1,27 @@
 using System;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
+using System.Collections.Specialized;
 using System.ComponentModel;
 using System.Linq;
-using System.Windows.Documents;
 using System.Windows.Input;
 using Castle.Core.Internal;
-using Ninject;
 using TUGraz.VectoCommon.BusAuxiliaries;
 using TUGraz.VectoCommon.InputData;
-using TUGraz.VectoCommon.Models;
 using TUGraz.VectoCommon.Utils;
 using TUGraz.VectoCore.Models.Declaration;
+using VECTO3GUI.Helper;
 using VECTO3GUI.Util;
-using VECTO3GUI.ViewModel.Adapter;
 using VECTO3GUI.ViewModel.Interfaces;
 using VECTO3GUI.Model;
 using VECTO3GUI.Model.TempDataObject;
-using Component = VECTO3GUI.Util.Component;
+
 
 namespace VECTO3GUI.ViewModel.Impl
 {
+
+
+
 	public class AuxiliariesViewModel : AbstractComponentViewModel, IAuxiliariesViewModel
 	{
 		#region Members
@@ -33,7 +34,8 @@ namespace VECTO3GUI.ViewModel.Impl
 		private IAxlesViewModel axlesViewModel;
 		private IBusAuxiliariesDeclarationData _busAuxiliaries;
 
-		private ObservableCollection<string> _alternatorTechnologies;
+	
+		private ObservableCollectionEx<AlternatorTechnologyModel> _alternatorTechnologies;
 		private bool _dayRunningLightsLED;
 		private bool _headlightyLED;
 		private bool _positionlightsLED;
@@ -57,7 +59,7 @@ namespace VECTO3GUI.ViewModel.Impl
 
 
 		#region Implementation of IAuxiliariesViewModel
-		
+
 		public IAuxiliariesDeclarationInputData ModelData { get { return AdapterFactory.AuxiliariesDeclarationAdapter(this); } }
 
 		public string PneumaticSystemTechnology
@@ -131,9 +133,10 @@ namespace VECTO3GUI.ViewModel.Impl
 		#endregion
 
 
+
 		#region Implementation of IBusAuxiliaries
 
-		public ObservableCollection<string> AlternatorTechnologies
+		public ObservableCollectionEx<AlternatorTechnologyModel> AlternatorTechnologies
 		{
 			get { return _alternatorTechnologies; }
 			set { SetProperty(ref _alternatorTechnologies, value); }
@@ -149,6 +152,7 @@ namespace VECTO3GUI.ViewModel.Impl
 				IsDataChanged(_dayRunningLightsLED, _componentData);
 			}
 		}
+
 		public bool HeadlightsLED
 		{
 			get { return _headlightyLED; }
@@ -160,6 +164,7 @@ namespace VECTO3GUI.ViewModel.Impl
 				IsDataChanged(_headlightyLED, _componentData);
 			}
 		}
+
 		public bool PositionlightsLED
 		{
 			get { return _positionlightsLED; }
@@ -170,6 +175,7 @@ namespace VECTO3GUI.ViewModel.Impl
 				IsDataChanged(_positionlightsLED, _componentData);
 			}
 		}
+
 		public bool BrakelightsLED
 		{
 			get { return _breaklightsLED; }
@@ -180,6 +186,7 @@ namespace VECTO3GUI.ViewModel.Impl
 				IsDataChanged(_breaklightsLED, _componentData);
 			}
 		}
+
 		public bool InteriorLightsLED
 		{
 			get { return _interiorLightsLED; }
@@ -202,6 +209,7 @@ namespace VECTO3GUI.ViewModel.Impl
 				IsDataChanged(_systemConfiguration, _componentData);
 			}
 		}
+
 		public ACCompressorType CompressorTypeDriver
 		{
 			get { return _compressorTypeDriver; }
@@ -212,6 +220,7 @@ namespace VECTO3GUI.ViewModel.Impl
 				IsDataChanged(_compressorTypeDriver, _componentData);
 			}
 		}
+
 		public ACCompressorType CompressorTypePassenger
 		{
 			get { return _compressorTypePassenger; }
@@ -232,6 +241,7 @@ namespace VECTO3GUI.ViewModel.Impl
 				IsDataChanged(_auxHeaterPower, _componentData);
 			}
 		}
+
 		public bool DoubleGlasing
 		{
 			get { return _doubleGlasing; }
@@ -242,6 +252,7 @@ namespace VECTO3GUI.ViewModel.Impl
 				IsDataChanged(_doubleGlasing, _componentData);
 			}
 		}
+
 		public bool HeatPump
 		{
 			get { return _heatPump; }
@@ -252,6 +263,7 @@ namespace VECTO3GUI.ViewModel.Impl
 				IsDataChanged(_heatPump, _componentData);
 			}
 		}
+
 		public bool AdjustableAuxiliaryHeater
 		{
 			get { return _adjustableAuxiliaryHeater; }
@@ -262,6 +274,7 @@ namespace VECTO3GUI.ViewModel.Impl
 				IsDataChanged(_adjustableAuxiliaryHeater, _componentData);
 			}
 		}
+
 		public bool SeparateAirDistributionDucts
 		{
 			get { return _separateAirDistributionDucts; }
@@ -279,9 +292,7 @@ namespace VECTO3GUI.ViewModel.Impl
 		public AllowedEntry<BusHVACSystemConfiguration>[] AllowedSystemConfigurations { get; private set; }
 		public AllowedEntry<ACCompressorType>[] AllowedDriverACCompressorTypes { get; private set; }
 		public AllowedEntry<ACCompressorType>[] AllowedPassengerACCompressorTypes { get; private set; }
-		public AllowedEntry<ConsumerTechnology>[] AllowedConsumerTechnologies { get; private set; }
-
-
+		public AllowedEntry<AlternatorTechnology>[] AllowedAlternatorTechnology { get; private set; }
 		#endregion
 
 
@@ -314,15 +325,18 @@ namespace VECTO3GUI.ViewModel.Impl
 
 			if (!busAux.ElectricSupply.Alternators.IsNullOrEmpty())
 			{
-				AlternatorTechnologies = new ObservableCollection<string>();
+				AlternatorTechnologies = new ObservableCollectionEx<AlternatorTechnologyModel>();
+
+				AlternatorTechnologies.CollectionChanged += AlternatorTechnologiesOnCollectionChanged;
+				AlternatorTechnologies.CollectionItemChanged += AlternatorTechnologiesOnCollectionItemChanged;
 
 				for (int i = 0; i < busAux.ElectricSupply.Alternators.Count; i++)
 				{
-					AlternatorTechnologies.Add(busAux.ElectricSupply.Alternators[i].Technology);
+					AlternatorTechnologies.Add(new AlternatorTechnologyModel
+					{
+						AlternatorTechnology = AlternatorTechnologyHelper.Parse(busAux.ElectricSupply.Alternators[i].Technology)
+					});
 				}
-
-				//AlternatorTechnologies.Add("blu");
-				//AlternatorTechnologies.Add("bla");
 			}
 
 			DayrunninglightsLED = busAux.ElectricConsumers.DayrunninglightsLED;
@@ -344,6 +358,39 @@ namespace VECTO3GUI.ViewModel.Impl
 			ClearChangedProperties();
 		}
 
+		private void AlternatorTechnologiesOnCollectionItemChanged(object sender, PropertyChangedEventArgs e)
+		{
+			if (e.PropertyName != "AlternatorTechnology")
+				return;
+
+			var changed = IsAlternatorTechnologyChanged();
+			SetChangedProperty(changed, nameof(AlternatorTechnologies));
+		}
+
+		private void AlternatorTechnologiesOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
+		{
+			var changed = IsAlternatorTechnologyChanged();
+			SetChangedProperty(changed, nameof(AlternatorTechnologies));
+		}
+
+		private bool IsAlternatorTechnologyChanged()
+		{
+			if (AlternatorTechnologies == null || _componentData?.OriginAlternatorTechnologies == null)
+				return true;
+
+			if (AlternatorTechnologies.Count != _componentData.OriginAlternatorTechnologies.Count)
+				return true;
+
+			for (int i = 0; i < AlternatorTechnologies.Count; i++)
+			{
+				if (AlternatorTechnologies[i].AlternatorTechnology !=
+					_componentData.OriginAlternatorTechnologies[i].AlternatorTechnology)
+					return true;
+			}
+
+			return false;
+		}
+
 		private void SetAllowedValues()
 		{
 			AllowedSystemConfigurations = Enum.GetValues(typeof(BusHVACSystemConfiguration)).Cast<BusHVACSystemConfiguration>()
@@ -354,13 +401,18 @@ namespace VECTO3GUI.ViewModel.Impl
 
 			AllowedPassengerACCompressorTypes = AllowedDriverACCompressorTypes;
 
-			AllowedConsumerTechnologies = Enum.GetValues(typeof(ConsumerTechnology)).Cast<ConsumerTechnology>()
+			AllowedAlternatorTechnology = Enum.GetValues(typeof(AlternatorTechnology)).Cast<AlternatorTechnology>()
 				.Select(sc => AllowedEntry.Create(sc, sc.GetLabel())).ToArray();
 		}
 
 		public override void ResetComponentData()
 		{
 			_componentData.ResetToComponentValues(this);
+			AlternatorTechnologies.CollectionChanged += AlternatorTechnologiesOnCollectionChanged;
+			AlternatorTechnologies.CollectionItemChanged += AlternatorTechnologiesOnCollectionItemChanged;
+
+			var changed = IsAlternatorTechnologyChanged();
+			SetChangedProperty(changed, nameof(AlternatorTechnologies));
 		}
 
 		public override object SaveComponentData()
@@ -406,20 +458,16 @@ namespace VECTO3GUI.ViewModel.Impl
 			get
 			{
 				return _addAlternatorCommand ??
-						(_addAlternatorCommand = new RelayCommand(DoAddAlternator, CanAddAlternator));
+						(_addAlternatorCommand = new RelayCommand(DoAddAlternator));
 			}
 		}
 
-		private bool CanAddAlternator()
-		{
-			return false;
-		}
-
 		private void DoAddAlternator()
 		{
-			AlternatorTechnologies?.Add(string.Empty);
-			OnPropertyChanged(nameof(AlternatorTechnologies));
-
+			AlternatorTechnologies.Add(new AlternatorTechnologyModel
+			{
+				AlternatorTechnology = AlternatorTechnology.Empty
+			});
 		}
 
 		#endregion
diff --git a/VECTO3GUI/ViewModel/Impl/CompleteVehicleBusViewModel.cs b/VECTO3GUI/ViewModel/Impl/CompleteVehicleBusViewModel.cs
index 0f525e97a1..02c067acca 100644
--- a/VECTO3GUI/ViewModel/Impl/CompleteVehicleBusViewModel.cs
+++ b/VECTO3GUI/ViewModel/Impl/CompleteVehicleBusViewModel.cs
@@ -247,7 +247,7 @@ namespace VECTO3GUI.ViewModel.Impl
 		public AllowedEntry<VehicleCode>[] AllowedVehicleCodes { get; private set; }
 		public AllowedEntry<ConsumerTechnology>[] AllowedConsumerTechnologies { get; private set; }
 		public AllowedEntry<RegistrationClass>[] AllowedRegisteredClasses { get; private set; }
-		public AllowedEntry<TankSystem>[] AllowedTankSystems { get; private set; }
+		public AllowedEntry<TankSystem?>[] AllowedTankSystems { get; private set; }
 
 		#endregion
 
@@ -310,11 +310,12 @@ namespace VECTO3GUI.ViewModel.Impl
 				.Select(vc => AllowedEntry.Create(vc, vc.GetLabel())).ToArray();
 			
 			var tankSystems = Enum.GetValues(typeof(TankSystem)).Cast<TankSystem>().ToArray();
-			var tank = new AllowedEntry<TankSystem> [tankSystems.Length+1];
+			var tank = new AllowedEntry<TankSystem?> [tankSystems.Length+1];
 
-			tank[0] = AllowedEntry.Create(TankSystem.Compressed, null);
+			tank[0] = AllowedEntry.Create((TankSystem?)null, null);
 			for (int i = 1; i < tankSystems.Length + 1; i++) {
-				tank[i] = AllowedEntry.Create(tankSystems[i-1], tankSystems[i-1].ToString());
+
+				tank[i] = AllowedEntry.Create<TankSystem?>(tankSystems[i-1], tankSystems[i-1].ToString());
 			}
 
 			AllowedTankSystems = tank;
diff --git a/VECTO3GUI/ViewModel/Interfaces/IAuxiliariesBus.cs b/VECTO3GUI/ViewModel/Interfaces/IAuxiliariesBus.cs
index 2e849ec87e..360c983d94 100644
--- a/VECTO3GUI/ViewModel/Interfaces/IAuxiliariesBus.cs
+++ b/VECTO3GUI/ViewModel/Interfaces/IAuxiliariesBus.cs
@@ -6,6 +6,8 @@ using System.Text;
 using System.Threading.Tasks;
 using TUGraz.VectoCommon.BusAuxiliaries;
 using TUGraz.VectoCommon.Utils;
+using VECTO3GUI.Helper;
+using VECTO3GUI.Model;
 
 namespace VECTO3GUI.ViewModel.Interfaces
 {
@@ -13,7 +15,7 @@ namespace VECTO3GUI.ViewModel.Interfaces
 	{
 		#region Electric System
 
-		ObservableCollection<string> AlternatorTechnologies { get; set; }
+		ObservableCollectionEx<AlternatorTechnologyModel> AlternatorTechnologies { get; set; }
 		bool DayrunninglightsLED { get; set; }
 		bool HeadlightsLED { get; set; }
 		bool PositionlightsLED { get; set; }
diff --git a/VECTO3GUI/ViewModel/Interfaces/IAuxiliariesViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/IAuxiliariesViewModel.cs
index 74a5851b89..04e2f00b54 100644
--- a/VECTO3GUI/ViewModel/Interfaces/IAuxiliariesViewModel.cs
+++ b/VECTO3GUI/ViewModel/Interfaces/IAuxiliariesViewModel.cs
@@ -4,6 +4,7 @@ using System.Windows.Input;
 using TUGraz.VectoCommon.BusAuxiliaries;
 using TUGraz.VectoCommon.InputData;
 using TUGraz.VectoCommon.Utils;
+using VECTO3GUI.Model;
 using VECTO3GUI.Util;
 
 namespace VECTO3GUI.ViewModel.Interfaces {
@@ -41,7 +42,7 @@ namespace VECTO3GUI.ViewModel.Interfaces {
 		AllowedEntry<BusHVACSystemConfiguration>[] AllowedSystemConfigurations { get; }
 		AllowedEntry<ACCompressorType>[] AllowedDriverACCompressorTypes { get; }
 		AllowedEntry<ACCompressorType>[] AllowedPassengerACCompressorTypes { get; }
-		AllowedEntry<ConsumerTechnology>[] AllowedConsumerTechnologies { get; }
+		AllowedEntry<AlternatorTechnology>[] AllowedAlternatorTechnology { get;  }
 
 		#endregion
 	}
diff --git a/VECTO3GUI/ViewModel/Interfaces/ICompleteVehicleBusViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/ICompleteVehicleBusViewModel.cs
index 58cb9e56c6..ac3472e25b 100644
--- a/VECTO3GUI/ViewModel/Interfaces/ICompleteVehicleBusViewModel.cs
+++ b/VECTO3GUI/ViewModel/Interfaces/ICompleteVehicleBusViewModel.cs
@@ -13,6 +13,6 @@ namespace VECTO3GUI.ViewModel.Interfaces
 		AllowedEntry<VehicleCode>[] AllowedVehicleCodes { get; }
 		AllowedEntry<ConsumerTechnology>[] AllowedConsumerTechnologies { get; }
 		AllowedEntry<RegistrationClass>[] AllowedRegisteredClasses { get; }
-		AllowedEntry<TankSystem>[] AllowedTankSystems { get; }
+		AllowedEntry<TankSystem?>[] AllowedTankSystems { get; }
 	}
 }
diff --git a/VECTO3GUI/Views/ComponentViews/Declaration/AuxiliariesDeclarationView.xaml b/VECTO3GUI/Views/ComponentViews/Declaration/AuxiliariesDeclarationView.xaml
index 0ba6e18485..e918f7beea 100644
--- a/VECTO3GUI/Views/ComponentViews/Declaration/AuxiliariesDeclarationView.xaml
+++ b/VECTO3GUI/Views/ComponentViews/Declaration/AuxiliariesDeclarationView.xaml
@@ -49,32 +49,35 @@
                 </Grid>
 
             
-                <DataGrid x:Name="AlternatorDataGrid" AutoGenerateColumns="False" ColumnWidth="*" IsReadOnly="False"  CanUserAddRows="False" VerticalAlignment="Top"
-                          HeadersVisibility="All" RowHeaderWidth="10"  Height="150" Margin="0,10,0,0" BorderThickness="1"
+                <DataGrid x:Name="AlternatorDataGrid" AutoGenerateColumns="False" ColumnWidth="*" IsReadOnly="False" CanUserAddRows="False" VerticalAlignment="Top"
+                          HeadersVisibility="All" RowHeaderWidth="10"  Height="120" Margin="0,10,0,0" BorderThickness="1"
                           ItemsSource="{Binding AlternatorTechnologies}">
 
                     <DataGrid.Resources>
                         <DataTemplate x:Key="EntryDeleteControl">
                             <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
-                                <Button Width="100" Content="Remove" 
+                                <Button Width="30" 
                                         Command="{Binding DataContext.RemoveAlternatorCommand, 
                                         RelativeSource={RelativeSource AncestorType=local:AuxiliariesDeclarationView}}"
                                         CommandParameter="{Binding ElementName=AlternatorDataGrid, Path=SelectedIndex}">
+                                    <iconPacks:PackIconModern  Width="30" Height="15" Kind="Delete" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                 </Button>
                             </StackPanel>
                         </DataTemplate>
-                        
-                        <DataTemplate x:Key="AtlernatorText">
-                            <TextBox  Text="{Binding}" />
 
+                        <DataTemplate x:Key="AlternatorTechCombobox">
+                            <ComboBox DisplayMemberPath="Label" SelectedValuePath="Value"
+                                    ItemsSource="{Binding DataContext.AllowedAlternatorTechnology,  
+                                    RelativeSource={RelativeSource AncestorType=local:AuxiliariesDeclarationView}}"
+                                    SelectedValue="{Binding AlternatorTechnology, UpdateSourceTrigger=PropertyChanged}">
+                            </ComboBox>
                         </DataTemplate>
 
                     </DataGrid.Resources>
 
                     <DataGrid.Columns>
-                        <!--<DataGridTemplateColumn Header="Technology" CellTemplate="{StaticResource AtlernatorText}" Width="110" />-->
-                        <DataGridTextColumn Header="Alternator Technology" Binding="{Binding }" />
-                        <DataGridTemplateColumn CellTemplate="{StaticResource EntryDeleteControl}" Width="110" />
+                        <DataGridTemplateColumn Header="Alternator Technology" CellTemplate="{StaticResource AlternatorTechCombobox}"/>
+                        <DataGridTemplateColumn CellTemplate="{StaticResource EntryDeleteControl}" Width="40" />
                     </DataGrid.Columns>
 
                 </DataGrid>
diff --git a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs
index 3a50dc4d44..1e6effac9c 100644
--- a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs
+++ b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs
@@ -333,6 +333,22 @@ namespace TUGraz.VectoCommon.InputData
 		Compressed
 	}
 
+	public static class TankSystemHelper
+	{
+		public static TankSystem? Parse(string parse)
+		{
+			switch (parse) {
+				case nameof(TankSystem.Liquefied):
+					return TankSystem.Liquefied;
+				case nameof(TankSystem.Compressed):
+					return TankSystem.Compressed;
+				default:
+					return null;
+			}
+		}
+	}
+
+
 	public interface IAirdragDeclarationInputData : IComponentInputData
 	{
 		/// <summary>
diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs
index fb510ae838..1f18a9bcdd 100644
--- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs
+++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs
@@ -811,7 +811,12 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider
 
 		public override TankSystem? TankSystem
 		{
-			get { return GetNode(XMLNames.Vehicle_NgTankSystem, required: false)?.ToString().ParseEnum<TankSystem>(); }
+			get
+			{
+				return ElementExists(XMLNames.Vehicle_NgTankSystem)
+						? EnumHelper.ParseEnum<TankSystem>(GetString(XMLNames.Vehicle_NgTankSystem))
+						: (TankSystem?)null;
+			}
 		}
 
 		public override int NumberOfPassengersLowerDeck
-- 
GitLab