From 7e7a27c2d968530143a03c22d9109543be01b8fe Mon Sep 17 00:00:00 2001
From: "VKMTHD\\haraldmartini" <harald.martini@student.tugraz.at>
Date: Wed, 12 Oct 2022 09:33:19 +0200
Subject: [PATCH] implement generic detoriation for in batterydataadapter

---
 .../SimulationComponents/BatteryDataAdapter.cs       | 12 +++++++-----
 .../VectoCore/Models/Declaration/DeclarationData.cs  |  6 ++++--
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/SimulationComponents/BatteryDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/SimulationComponents/BatteryDataAdapter.cs
index 2fa8be26d9..df6bf39ddc 100644
--- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/SimulationComponents/BatteryDataAdapter.cs
+++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/SimulationComponents/BatteryDataAdapter.cs
@@ -20,15 +20,15 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponen
 				return null;
 			}
 
-			var bat = batteryInputData.ElectricStorageElements.Where(x => x.REESSPack.StorageType == REESSType.Battery).ToArray();
+			var batteries = batteryInputData.ElectricStorageElements.Where(x => x.REESSPack.StorageType == REESSType.Battery).ToArray();
 
-			if (bat.Length == 0)
+			if (batteries.Length == 0)
 			{
 				return null;
 			}
 
 			var retVal = new BatterySystemData();
-			foreach (var entry in bat)
+			foreach (var entry in batteries)
 			{
 				var b = entry.REESSPack as IBatteryPackDeclarationInputData;
 				if (b == null)
@@ -47,8 +47,10 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponen
 					}
 				
 					var batteryData = new BatteryData() {
-						MinSOC = minSoc,
-						MaxSOC = maxSoc,
+						MinSOC = maxSoc  * ((1d/2) * DeclarationData.Battery.GenericDeterioration)
+								+ minSoc * (1 - (1d/2) * DeclarationData.Battery.GenericDeterioration),
+						MaxSOC = (maxSoc * (1 - (1d/2) * DeclarationData.Battery.GenericDeterioration)
+								+ minSoc * ((1d/2) * DeclarationData.Battery.GenericDeterioration)),
 						MaxCurrent = BatteryMaxCurrentReader.Create(b.MaxCurrentMap),
 						Capacity = b.Capacity,
 						InternalResistance =
diff --git a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs
index 284184cc61..9c19fa28e5 100644
--- a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs
+++ b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs
@@ -1228,8 +1228,8 @@ namespace TUGraz.VectoCore.Models.Declaration
 			/// <summary>
 			/// Percentage of the maximum voltage of the battery
 			/// </summary>
-			private const double SOCMinHP = 0.2;
-			private const double SOCMaxHP = 0.8;
+			private const double SOCMinHP = 0.05;
+			private const double SOCMaxHP = 0.95;
 
 			private const double SOCMinHE = 0.05;
 			private const double SOCMaxHE = 0.95;
@@ -1248,6 +1248,8 @@ namespace TUGraz.VectoCore.Models.Declaration
 				}
 			}
 
+			public static double GenericDeterioration => 0.05;
+
 
 			public static double GetMaxSoc(BatteryType type)
 			{
-- 
GitLab