diff --git a/VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs b/VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs index 6e87b019a0c0d857210ce2529f06ebdf0727fcb5..cb581783da2d9e25a69528389ce9c48be079c89c 100644 --- a/VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs +++ b/VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs @@ -3787,7 +3787,7 @@ namespace TUGraz.VectoCommon.Resources { } /// <summary> - /// Looks up a localized string similar to ATEcoRollReleaseLockupClutch. + /// Looks up a localized string similar to APTEcoRollReleaseLockupClutch. /// </summary> public static string Vehicle_ADAS_ATEcoRollReleaseLockupClutch { get { diff --git a/VectoCommon/VectoCommon/Resources/XMLNames.resx b/VectoCommon/VectoCommon/Resources/XMLNames.resx index a5029ad819dc4661e6973774b7039c6fa2dfefa7..5bec7fe60f9e414a7e385302752e5729e1f2cc28 100644 --- a/VectoCommon/VectoCommon/Resources/XMLNames.resx +++ b/VectoCommon/VectoCommon/Resources/XMLNames.resx @@ -1135,7 +1135,7 @@ <value>TechnicalPermissibleMaximumLadenMass</value> </data> <data name="Vehicle_ADAS_ATEcoRollReleaseLockupClutch" xml:space="preserve"> - <value>ATEcoRollReleaseLockupClutch</value> + <value>APTEcoRollReleaseLockupClutch</value> </data> <data name="ManufacturerPrimaryVehicle" xml:space="preserve"> <value>ManufacturerPrimaryVehicle</value> diff --git a/VectoCore/VectoCore/Models/Simulation/DataBus/IRESSInfo.cs b/VectoCore/VectoCore/Models/Simulation/DataBus/IRESSInfo.cs index 4f14b5555dc9342c1482cddf0792bb29becb88ec..9fc7a1afb1ac9b75bd62e4445b4a644d285a060b 100644 --- a/VectoCore/VectoCore/Models/Simulation/DataBus/IRESSInfo.cs +++ b/VectoCore/VectoCore/Models/Simulation/DataBus/IRESSInfo.cs @@ -19,5 +19,7 @@ namespace TUGraz.VectoCore.Models.Simulation.DataBus double MinSoC { get; } double MaxSoC { get; } + AmpereSecond Capacity { get; } + Volt NominalVoltage { get; } } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/DCDCConverter.cs b/VectoCore/VectoCore/Models/SimulationComponent/DCDCConverter.cs index c697576c804c6ab16502f78d5c0a4d9ad98ec549..fd0a9d86a575d6bec92fb8af61a2c77e5e059feb 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/DCDCConverter.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/DCDCConverter.cs @@ -31,7 +31,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent public Watt PowerDemand(Second absTime, Second dt, bool dryRun) { - if ((-DataBus.BatteryInfo.MaxDischargePower(dt) * dt).IsGreater(PreviousState.ConsumedEnergy)) { + var dischargeEnergy = (-DataBus.BatteryInfo.MaxDischargePower(dt) * dt); + var chargeEnergy = (-DataBus.BatteryInfo.MaxChargePower(dt) * dt); + if (PreviousState.ConsumedEnergy.IsBetween(chargeEnergy, dischargeEnergy)) { return PreviousState.ConsumedEnergy / dt / Efficiency; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/Battery/BatteryData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/Battery/BatteryData.cs index 89c372d893af444fd36420651a6c14acea368c0b..2af79ad862de7515630af7a79d321f9ca293babe 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/Battery/BatteryData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/Battery/BatteryData.cs @@ -25,7 +25,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Battery { (current, s) => current + Batteries.Where(x => x.Item1 == s).Min(x => x.Item2.Capacity)); } } - } + + + } public class BatteryData { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Battery.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Battery.cs index 4bb71949124051a0056c304e5cc2fa89ab6bc75c..2d131e2d6177c1e0abcbe683102e4037f6f22c30 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Battery.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Battery.cs @@ -234,7 +234,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } public AmpereSecond Capacity => ModelData.Capacity; - + + public Volt NominalVoltage => ModelData.SOCMap.Lookup(0.5); + public Ampere MaxChargeCurrent(Second dt) { return VectoMath.Min( diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/BatterySystem.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/BatterySystem.cs index a65a105cdffa22cb5363c62d47c93733456351bc..b2856aa3036b53f3113f3b609b6c23ce36512ab2 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/BatterySystem.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/BatterySystem.cs @@ -21,6 +21,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl protected readonly List<Battery> _batteries; private AmpereSecond _capacity; + private AmpereSecond _capacityMinSoc; + private AmpereSecond _capacityMaxSoc; public BatteryString() { @@ -94,6 +96,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public Ampere Current { get; set; } + public AmpereSecond CapacityMinSoc => + _capacityMinSoc ?? (_capacityMinSoc = _batteries.Min(x => x.Capacity * x.MinSoC)); + + public AmpereSecond CapacityMaxSoc => + _capacityMaxSoc ?? (_capacityMaxSoc = _batteries.Min(x => x.Capacity * x.MaxSoC)); + + public Volt NominalVoltage => Batteries.Sum(x => x.NominalVoltage); + private Ampere SelectSolution(double[] solutions, double sign, Second dt) { var maxCurrent = Math.Sign(sign) < 0 @@ -106,6 +116,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl protected internal readonly Dictionary<int, BatteryString> Batteries = new Dictionary<int, BatteryString>(); private AmpereSecond _totalCapacity; + private Scalar _minSoc; + private Scalar _maxSoc; public BatterySystem(IVehicleContainer dataBus, BatterySystemData batterySystemData) : base(dataBus) { @@ -206,9 +218,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return Batteries.Values.Sum(bs => bs.MaxDischargePower(dt, tPulse)); } - public double MinSoC { get; } - public double MaxSoC { get; } + public double MinSoC => _minSoc ?? (_minSoc = Batteries.Values.Sum(x => x.CapacityMinSoc) / TotalCapacity); + public double MaxSoC => _maxSoc ?? (_maxSoc = Batteries.Values.Sum(x => x.CapacityMinSoc) / TotalCapacity); + public AmpereSecond Capacity => TotalCapacity; + public Volt NominalVoltage => Batteries.Values.Select(x => x.NominalVoltage).Average(); #endregion #region Implementation of IElectricEnergyStoragePort diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricMotor.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricMotor.cs index 564b82d29842b164e803bd9fb948388dcc8031c9..ba785ec3398ef869da8238ae442cf2174f34e8ba 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricMotor.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricMotor.cs @@ -289,6 +289,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl IResponse retVal = null; if (NextComponent == null) { + if (electricSupplyResponse.MaxPowerDrive.IsEqual(0.SI<Watt>(), 100.SI<Watt>())) { + retVal = new ResponseBatteryEmpty(this, electricSupplyResponse); + return retVal; + } // electric motor only var remainingPower = inTorqueDt * avgDtSpeed; if (dryRun) { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/SuperCap.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/SuperCap.cs index f786f997b509c0a119549b553f7d252c6c777ef4..041129065c6396b2a5e366e47eb03ed60b4fb1ea 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/SuperCap.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/SuperCap.cs @@ -56,6 +56,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public double MinSoC => ModelData.MinVoltage / ModelData.MaxVoltage; public double MaxSoC => 1; + public AmpereSecond Capacity => null; + public Volt NominalVoltage => null; public void Initialize(double initialSoC) { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs index ac34ce3e785f2f0071d15bb511ccac262fc868f0..0b2446c82e25aebf81051157b2221534d6971136 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs @@ -586,17 +586,17 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies shiftStrategyParameters.AllowedGearRangeFC = shiftStrategyParameters.AllowedGearRangeFC.LimitTo(1, 2); } - // TODO: MQ 20210712 how to handle with batterysystem - //var auxEnergyReserve = ModelData.ElectricAuxDemand * StrategyParameters.AuxReserveTime; - BatteryDischargeEnergyThreshold = 0.SI<WattSecond>(); - //if (auxEnergyReserve > 0) { - // var minSoc = Math.Max(ModelData.BatteryData?.MinSOC ?? ModelData.SuperCapData.MinVoltage / ModelData.SuperCapData.MaxVoltage, - // StrategyParameters.MinSoC); - // BatteryDischargeEnergyThreshold = - // ModelData.BatteryData.Capacity * minSoc * ModelData.BatteryData.SOCMap.Lookup(minSoc) + - // auxEnergyReserve; - //} - AllowEmergencyShift = false; + // TODO: MQ 20210712 how to handle with batterysystem + //var auxEnergyReserve = ModelData.ElectricAuxDemand * StrategyParameters.AuxReserveTime; + BatteryDischargeEnergyThreshold = 0.SI<WattSecond>(); + //if (auxEnergyReserve > 0) { + // var minSoc = Math.Max(ModelData.BatteryData?.MinSOC ?? ModelData.SuperCapData.MinVoltage / ModelData.SuperCapData.MaxVoltage, + // StrategyParameters.MinSoC); + // BatteryDischargeEnergyThreshold = + // ModelData.BatteryData.Capacity * minSoc * ModelData.BatteryData.SOCMap.Lookup(minSoc) + + // auxEnergyReserve; + //} + AllowEmergencyShift = false; } public virtual IHybridController Controller { protected get; set; } @@ -2261,14 +2261,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies } // TODO: MQ 20210712 how to handle with batterysystem - //var auxEnergyReserve = ModelData.ElectricAuxDemand * StrategyParameters.AuxReserveTime; - //if (auxEnergyReserve > 0) { - // var minSoc = Math.Max(ModelData.BatteryData?.MinSOC ?? ModelData.SuperCapData.MinVoltage / ModelData.SuperCapData.MaxVoltage, - // StrategyParameters.MinSoC); - // BatteryDischargeEnergyThreshold = - // ModelData.BatteryData.Capacity * minSoc * ModelData.BatteryData.SOCMap.Lookup(minSoc) + - // auxEnergyReserve; - //} + var auxEnergyReserve = ModelData.ElectricAuxDemand * StrategyParameters.AuxReserveTime; + if (auxEnergyReserve > 0) { + var minSoc = Math.Max(DataBus.BatteryInfo.MinSoC, StrategyParameters.MinSoC); + BatteryDischargeEnergyThreshold = + DataBus.BatteryInfo.Capacity * minSoc * DataBus.BatteryInfo.NominalVoltage + + auxEnergyReserve; + } PreviousState.AngularVelocity = outAngularVelocity; PreviousState.GearboxEngaged = true; diff --git a/VectoCore/VectoCoreTest/Integration/Hybrid/ParallelHybridTest.cs b/VectoCore/VectoCoreTest/Integration/Hybrid/ParallelHybridTest.cs index e462b54c99d4f2170b0ed1108941c0200f8bbbce..8b81313065eef18eb73c750d8abf51bcaff8fe8c 100644 --- a/VectoCore/VectoCoreTest/Integration/Hybrid/ParallelHybridTest.cs +++ b/VectoCore/VectoCoreTest/Integration/Hybrid/ParallelHybridTest.cs @@ -409,7 +409,7 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid TestCase(80, 0.5, -5, 0, TestName = "P2 Hybrid ConstantSpeed 80km/h SoC: 0.5, DH 5%"), TestCase(30, 0.25, 0, 1000, TestName = "P2 Hybrid ConstantSpeed 30km/h SoC: 0.25, level P_auxEl: 1kW"), - TestCase(30, 0.25, 0, 5000, TestName = "P2 Hybrid ConstantSpeed 30km/h SoC: 0.25, level P_auxEl: 5kW"), + TestCase(30, 0.25, 0, 0, TestName = "P2 Hybrid ConstantSpeed 30km/h SoC: 0.25, level P_auxEl: 0kW"), ] public void P2HybridConstantSpeed(double vmax, double initialSoC, double slope, double pAuxEl) { diff --git a/VectoCore/VectoCoreTest/TestData/Generic Vehicles/Engineering Mode/HeavyBusPrimary/HeavyBusPrimaryVehicle.vveh b/VectoCore/VectoCoreTest/TestData/Generic Vehicles/Engineering Mode/HeavyBusPrimary/HeavyBusPrimaryVehicle.vveh index 08fc17fd5e3ca1a5b942f21cd21b9ed83e7e7f64..166c5193b62fe068ae0d94a9ba7e8a781b2c706a 100644 --- a/VectoCore/VectoCoreTest/TestData/Generic Vehicles/Engineering Mode/HeavyBusPrimary/HeavyBusPrimaryVehicle.vveh +++ b/VectoCore/VectoCoreTest/TestData/Generic Vehicles/Engineering Mode/HeavyBusPrimary/HeavyBusPrimaryVehicle.vveh @@ -62,13 +62,15 @@ "SteeringPumpTechnology": [ "Dual displacement with mech. control" ], - "ElectricSupply": { - "Alternators": [ - { - "Technology": "standard alternator", - "Ratio": 1.0 - } - ], + "ElectricSupply": { + "Alternators": [ + { + "Technology": "standard alternator", + "Ratio": 1.0 + } + ], + "MaxAlternatorPower": 0, + "Technology": "conventional", "ResultCards": { "Idle": [ { @@ -114,7 +116,7 @@ ] }, "SmartElectrics": false - }, + }, "ElectricConsumers": { }, "PneumaticSupply": { diff --git a/VectoCore/VectoCoreTest/TestData/Integration/Buses/FactorMethod/vecto_vehicle-completed_heavyBus_42.xml b/VectoCore/VectoCoreTest/TestData/Integration/Buses/FactorMethod/vecto_vehicle-completed_heavyBus_42.xml index 102d148e65ba6cd3cae6feb7905a68470e9cae07..6fbd95682f22879d8226585099b06ed5c3cc9e23 100644 --- a/VectoCore/VectoCoreTest/TestData/Integration/Buses/FactorMethod/vecto_vehicle-completed_heavyBus_42.xml +++ b/VectoCore/VectoCoreTest/TestData/Integration/Buses/FactorMethod/vecto_vehicle-completed_heavyBus_42.xml @@ -18,8 +18,10 @@ xsi:schemaLocation="urn:tugraz:ivt:VectoAPI:DeclarationJob v:\VectoCore\VectoCor <TechnicalPermissibleMaximumLadenMass>18000</TechnicalPermissibleMaximumLadenMass> <AirdragModifiedMultistage>false</AirdragModifiedMultistage> <ClassBus>I+II</ClassBus> - <NumberPassengersLowerDeck>30</NumberPassengersLowerDeck> - <NumberPassengersUpperDeck>0</NumberPassengersUpperDeck> + <NumberPassengerSeatsLowerDeck>30</NumberPassengerSeatsLowerDeck> + <NumberPassengersStandingLowerDeck>0</NumberPassengersStandingLowerDeck> + <NumberPassengerSeatsUpperDeck>0</NumberPassengerSeatsUpperDeck> + <NumberPassengersStandingUpperDeck>0</NumberPassengersStandingUpperDeck> <BodyworkCode>CE</BodyworkCode> <LowEntry>true</LowEntry> <HeightIntegratedBody>3000</HeightIntegratedBody> diff --git a/VectoCore/VectoCoreTest/TestData/Integration/Buses/vecto_vehicle-completed_heavyBus.xml b/VectoCore/VectoCoreTest/TestData/Integration/Buses/vecto_vehicle-completed_heavyBus.xml index f00a8112fe4e09d458a0badf8177bf8fa22a0d60..1218ea9e6c58183cac5e710f12f7428d6badae43 100644 --- a/VectoCore/VectoCoreTest/TestData/Integration/Buses/vecto_vehicle-completed_heavyBus.xml +++ b/VectoCore/VectoCoreTest/TestData/Integration/Buses/vecto_vehicle-completed_heavyBus.xml @@ -18,8 +18,10 @@ xsi:schemaLocation="urn:tugraz:ivt:VectoAPI:DeclarationJob v:\VectoCore\VectoCor <TechnicalPermissibleMaximumLadenMass>15400</TechnicalPermissibleMaximumLadenMass> <AirdragModifiedMultistage>true</AirdragModifiedMultistage> <ClassBus>II+III</ClassBus> - <NumberPassengersLowerDeck>50</NumberPassengersLowerDeck> - <NumberPassengersUpperDeck>0</NumberPassengersUpperDeck> + <NumberPassengerSeatsLowerDeck>50</NumberPassengerSeatsLowerDeck> + <NumberPassengersStandingLowerDeck>0</NumberPassengersStandingLowerDeck> + <NumberPassengerSeatsUpperDeck>0</NumberPassengerSeatsUpperDeck> + <NumberPassengersStandingUpperDeck>0</NumberPassengersStandingUpperDeck> <BodyworkCode>CA</BodyworkCode> <LowEntry>true</LowEntry> <HeightIntegratedBody>2700</HeightIntegratedBody> diff --git a/VectoCore/VectoCoreTest/Utils/MockBattery.cs b/VectoCore/VectoCoreTest/Utils/MockBattery.cs index 03343905049a3d04963e294f2cefc340a7178e37..9dd7e3a1e68ed17246d03710a1091b9f26989ef5 100644 --- a/VectoCore/VectoCoreTest/Utils/MockBattery.cs +++ b/VectoCore/VectoCoreTest/Utils/MockBattery.cs @@ -40,6 +40,8 @@ namespace TUGraz.VectoCore.Tests.Utils { public double MinSoC => 0; public double MaxSoC => 1; + public AmpereSecond Capacity => null; + public Volt NominalVoltage => null; public IElectricEnergyStoragePort MainBatteryPort => this;