diff --git a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs index 38cdcafb7a877c6a331aa963270c25c6273dc5cd..235b355f3b1a6a51cf4155eda307a948599cb972 100644 --- a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs +++ b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs @@ -35,7 +35,6 @@ using System.IO; using System.Linq; using Newtonsoft.Json.Linq; using System.Collections.Concurrent; -using Castle.DynamicProxy.Generators.Emitters.SimpleAST; using TUGraz.VectoCommon.BusAuxiliaries; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.InputData; diff --git a/VectoCore/VectoCore/Models/GenericModelData/GenericBusBatteryData.cs b/VectoCore/VectoCore/Models/GenericModelData/GenericBusBatteryData.cs index 3097eed69b70cdadbab6f21cf5b800d5b78619b3..613baf2654225e361724c28d02dce13fb1eac631 100644 --- a/VectoCore/VectoCore/Models/GenericModelData/GenericBusBatteryData.cs +++ b/VectoCore/VectoCore/Models/GenericModelData/GenericBusBatteryData.cs @@ -111,10 +111,10 @@ namespace TUGraz.VectoCore.Models.GenericModelData secIndex = i; } - var fstSoC = sortedOcvData[fstIndex].ParseDouble(XMLNames.REESS_OCV_SoC); - var secSoC = sortedOcvData[secIndex].ParseDouble(XMLNames.REESS_OCV_SoC); - var fstOCV = sortedOcvData[fstIndex].ParseDouble(XMLNames.REESS_OCV_OCV); - var secOCV = sortedOcvData[secIndex].ParseDouble(XMLNames.REESS_OCV_OCV); + var fstSoC = sortedOcvData[fstIndex].ParseDouble(BatterySOCReader.Fields.StateOfCharge); + var secSoC = sortedOcvData[secIndex].ParseDouble(BatterySOCReader.Fields.StateOfCharge); + var fstOCV = sortedOcvData[fstIndex].ParseDouble(BatterySOCReader.Fields.BatteryVoltage); + var secOCV = sortedOcvData[secIndex].ParseDouble(BatterySOCReader.Fields.BatteryVoltage); return VectoMath.Interpolate(fstSoC, secSoC, fstOCV, secOCV, 50).SI<Volt>(); } diff --git a/VectoCore/VectoCore/Models/GenericModelData/GenericRatedPointHelper.cs b/VectoCore/VectoCore/Models/GenericModelData/GenericRatedPointHelper.cs index df96a1fed9b62245679708e26d940795d0ebcdb9..ed97809858bec398d751a0a412a01f5f993e99c2 100644 --- a/VectoCore/VectoCore/Models/GenericModelData/GenericRatedPointHelper.cs +++ b/VectoCore/VectoCore/Models/GenericModelData/GenericRatedPointHelper.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using Castle.Core.Internal; +using System.Linq; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Utils; @@ -117,7 +117,7 @@ namespace TUGraz.VectoCore.Models.GenericModelData var slopeValue = (fullLoadCurveEntries[r].PowerDrive.Value() - fullLoadCurveEntries[r - 1].PowerDrive.Value()) / (fullLoadCurveEntries[r].MotorSpeed.Value() - fullLoadCurveEntries[r - 1].MotorSpeed.Value()); - var deltaValue = slopeValue / (slopeValueEntries.IsNullOrEmpty() ? slopeValue : slopeValueEntries[0].Slope ) -1; + var deltaValue = slopeValue / (!slopeValueEntries.Any() ? slopeValue : slopeValueEntries[0].Slope ) -1; slopeValueEntries.Add(new SlopeValueEntry(slopeValue, deltaValue)); } diff --git a/VectoCore/VectoCore/Models/Simulation/IVehicleContainer.cs b/VectoCore/VectoCore/Models/Simulation/IVehicleContainer.cs index 3d3cf62f7576bad869805aabc2af1e9672acdf3f..8d3971da6ed06bc30e4f5f7f3e1d2943413adf5f 100644 --- a/VectoCore/VectoCore/Models/Simulation/IVehicleContainer.cs +++ b/VectoCore/VectoCore/Models/Simulation/IVehicleContainer.cs @@ -83,5 +83,7 @@ namespace TUGraz.VectoCore.Models.Simulation IEnumerable<ISimulationPreprocessor> GetPreprocessingRuns { get; } ISumData SumData { get; } void AddPreprocessor(ISimulationPreprocessor simulationPreprocessor); + + IReadOnlyList<VectoSimulationComponent> Components { get; } } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs b/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs index d600d724a0b7bfa526589f884ddffcf971febbc6..6e5d61c6c22b54611b703ad4b575280cbb36636c 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs @@ -218,12 +218,16 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl target.UpdateFrom(source); } } else { + var realComponents = (realContainer as IVehicleContainer)?.Components; + if (realComponents == null) { + throw new VectoException("RealContainer has to implement IVehicleContainer interface!"); + } foreach (var (_, c) in _components) { #if DEBUG var found = false; #endif if (c is IUpdateable target) { - foreach (var (_, source) in (realContainer as VehicleContainer)._components) { + foreach (var source in realComponents) { if (target.UpdateFrom(source)) { ComponentUpdateList.Add((target, source)); #if DEBUG @@ -242,7 +246,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl #if DEBUG var sourceList = ComponentUpdateList.Select(st => st.Item2).ToArray(); - foreach (var (_, source) in (realContainer as VehicleContainer)._components) { + foreach (var source in realComponents) { if (!sourceList.Contains(source)){ Console.WriteLine("Real Component is not used for update: " + source.GetType()); } @@ -290,6 +294,8 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl Preprocessors.Add(simulationPreprocessor); } + public IReadOnlyList<VectoSimulationComponent> Components => _components.Select(x => x.Item2).ToList(); + public virtual void StartSimulationRun() { ModData?.Reset();