Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit b008bf4b authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

adding serialization methods for battery parameters (necessary for exporting...

adding serialization methods for battery parameters (necessary for exporting JSON data to validate factor method params)
parent 7442cc05
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using Newtonsoft.Json;
using TUGraz.VectoCommon.Exceptions;
using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Utils;
......@@ -71,6 +72,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.ElectricComponents.Ba
public WattSecond TotalStoredEnergy => _totaltoredEnergy ?? (_totaltoredEnergy = CalculateBatteryEnergy(0, 1));
public WattSecond UseableStoredEnergy => _useableStoredEnergy ?? (_useableStoredEnergy = CalculateBatteryEnergy(MinSOC, MaxSOC));
[JsonIgnore]
public IElectricStorageDeclarationInputData InputData { get; internal set; }
protected WattSecond CalculateBatteryEnergy(double minSoc, double maxSoc)
......@@ -118,6 +121,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.ElectricComponents.Ba
Entries = entries;
}
public string[] SerializedEntries
{
get
{
return Entries.Select(x => $"{x.SOC} - {x.BatteryVolts}").ToArray();
}
}
public Volt Lookup(double soc)
{
var idx = FindIndex(soc);
......@@ -163,6 +174,16 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.ElectricComponents.Ba
Entries = entries;
}
public string[] SerializedEntries
{
get
{
return Entries.Select(x =>
$"{x.SoC}: " + x.Resistance.OrderBy(r => r.Item1.Value()).Select(r => $"{r.Item1}: {r.Item2}")
.Join(";")).ToArray();
}
}
public Ohm Lookup(double SoC, Second tPulse)
{
var idx = FindIndex(SoC);
......@@ -242,6 +263,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.ElectricComponents.Ba
Entries = entries;
}
public string[] SerializedEntries
{
get
{
return Entries.Select(x => $"{x.SoC}: {x.MaxChargeCurrent} / {x.MaxDischargeCurrent}").ToArray();
}
}
public Ampere LookupMaxChargeCurrent(double soc)
{
var idx = FindIndex(soc);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment