Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

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

Merge branch 'amdm2/develop' into 'amdm2/develop'

correcting max power calculation in case of a junction box, adding testcase...

See merge request !33
parents 9b2877d5 78a00b10
Branches
Tags
No related merge requests found
...@@ -87,12 +87,13 @@ namespace TUGraz.VectoCore.Models.Connector.Ports.Impl ...@@ -87,12 +87,13 @@ namespace TUGraz.VectoCore.Models.Connector.Ports.Impl
{ {
//Note: consider losses of electric system (cables, junction box) when calculating max drive power //Note: consider losses of electric system (cables, junction box) when calculating max drive power
// see ElectricSystem implementation... // see ElectricSystem implementation...
// P_Bat = P_EM + P_Chg - P_aux - P_Conn
// I_est = P_EM / U_Int // I_est = P_EM / U_Int
// P_Conn = I_est ^ 2 * R_Conn = (P_EM / U_Int) ^ 2 * R_Conn // P_Conn = I_est ^ 2 * R_Conn = (P_EM / U_Int) ^ 2 * R_Conn
// P_EM_max = P_Bat_max - P_Chg + P_aux - P_Conn(P_EM) // P_EM_max = P_Bat_max - P_Chg + P_aux + P_Conn(P_EM)
// P_EM_max + P_Conn = P_Bat_max - P_Chg + P_aux // P_EM_max - P_Conn = P_Bat_max - P_Chg + P_aux
// P_EM_max + ((P_EM_max + P_Chg - P_aux) / U_Int) ^ 2 * R_Conn = P_Bat_max - P_Chg + P_aux // P_EM_max - ((P_EM_max + P_Chg - P_aux) / U_Int) ^ 2 * R_Conn = P_Bat_max - P_Chg + P_aux
// P_EM_max^2 * R_Conn / U_Int^2 + P_EM_max - (P_Bat_max - P_Chg + P_aux) = 0 // -P_EM_max^2 * R_Conn / U_Int^2 + P_EM_max - (P_Bat_max - P_Chg + P_aux) = 0
// Px = P_Bat_max - P_Chg + P_aux // Px = P_Bat_max - P_Chg + P_aux
var Px = P_batMax - var Px = P_batMax -
...@@ -103,7 +104,7 @@ namespace TUGraz.VectoCore.Models.Connector.Ports.Impl ...@@ -103,7 +104,7 @@ namespace TUGraz.VectoCore.Models.Connector.Ports.Impl
return Px; return Px;
} }
var a = (ConnectionSystemResistance / U_int / U_int).Value(); var a = -(ConnectionSystemResistance / U_int / U_int).Value();
var b = 1.0; var b = 1.0;
var c = -Px.Value(); var c = -Px.Value();
var solutions = VectoMath.QuadraticEquationSolver(a, b, c); var solutions = VectoMath.QuadraticEquationSolver(a, b, c);
......
...@@ -82,12 +82,16 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -82,12 +82,16 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
if (operatingPointList.Count > 0) { if (operatingPointList.Count > 0) {
operatingPoint = SelectOperatingPoint(operatingPointList); operatingPoint = SelectOperatingPoint(operatingPointList);
} else { } else {
if (!DataBus.IsTestPowertrain) {
if (outTorque.IsEqual(0) && outAngularVelocity.IsEqual(0)) { if (outTorque.IsEqual(0) && outAngularVelocity.IsEqual(0)) {
Log.Info("TorqueConverter Initialize: No operating point found. Using output as input values as fallback for initialize."); Log.Info(
"TorqueConverter Initialize: No operating point found. Using output as input values as fallback for initialize.");
} else {
Log.Warn(
"TorqueConverter Initialize: No operating point found. Using output as input values as fallback for initialize.");
} }
else {
Log.Warn("TorqueConverter Initialize: No operating point found. Using output as input values as fallback for initialize.");
} }
var inAngularVelocity = outAngularVelocity.LimitTo(DataBus.EngineInfo.EngineIdleSpeed, DataBus.EngineInfo.EngineN95hSpeed); var inAngularVelocity = outAngularVelocity.LimitTo(DataBus.EngineInfo.EngineIdleSpeed, DataBus.EngineInfo.EngineN95hSpeed);
operatingPoint = new TorqueConverterOperatingPoint { operatingPoint = new TorqueConverterOperatingPoint {
OutAngularVelocity = outAngularVelocity, OutAngularVelocity = outAngularVelocity,
......
...@@ -297,9 +297,9 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS ...@@ -297,9 +297,9 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
(5969, 6043, WithinSegment, Brake), // len: 74m (5969, 6043, WithinSegment, Brake), // len: 74m
(6043, 6117, WithinSegment, Coast), // len: 74m (6043, 6117, WithinSegment, Coast), // len: 74m
(6117, 6456, OutsideSegment, Coast), // len: 339m (6117, 6456, OutsideSegment, Coast), // len: 339m
(6456, 6759, OutsideSegment, Accelerate), // len: 303m (6456, 6747, OutsideSegment, Accelerate), // len: 291m
(6759, 6782, OutsideSegment, Roll), // len: 23m (6747, 6771, OutsideSegment, Roll), // len: 24m
(6782, 1e6, OutsideSegment, Accelerate)); (6771, 1e6, OutsideSegment, Accelerate));
[TestCase] [TestCase]
public void Class5_PCC123_CrestCoast1_HEV() => TestPCC(MethodBase.GetCurrentMethod().Name, public void Class5_PCC123_CrestCoast1_HEV() => TestPCC(MethodBase.GetCurrentMethod().Name,
...@@ -1266,9 +1266,9 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS ...@@ -1266,9 +1266,9 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
(5969, 6043, WithinSegment, Brake), // len: 74m (5969, 6043, WithinSegment, Brake), // len: 74m
(6043, 6117, WithinSegment, Coast), // len: 74m (6043, 6117, WithinSegment, Coast), // len: 74m
(6117, 6456, OutsideSegment, Coast), // len: 339m (6117, 6456, OutsideSegment, Coast), // len: 339m
(6456, 6759, OutsideSegment, Accelerate), // len: 303m (6456, 6747, OutsideSegment, Accelerate), // len: 291m
(6759, 6782, OutsideSegment, Roll), // len: 23m (6747, 6771, OutsideSegment, Roll), // len: 24m
(6782, 1e6, OutsideSegment, Accelerate)); (6771, 1e6, OutsideSegment, Accelerate));
[TestCase] [TestCase]
...@@ -1399,9 +1399,9 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS ...@@ -1399,9 +1399,9 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
(5969, 6043, WithinSegment, Brake), // len: 74m (5969, 6043, WithinSegment, Brake), // len: 74m
(6043, 6117, WithinSegment, Coast), // len: 74m (6043, 6117, WithinSegment, Coast), // len: 74m
(6117, 6456, OutsideSegment, Coast), // len: 339m (6117, 6456, OutsideSegment, Coast), // len: 339m
(6456, 6759, OutsideSegment, Accelerate), // len: 303m (6456, 6747, OutsideSegment, Accelerate), // len: 291m
(6759, 6782, OutsideSegment, Roll), // len: 23m (6747, 6771, OutsideSegment, Roll), // len: 24m
(6782, 1e6, OutsideSegment, Accelerate)); (6771, 1e6, OutsideSegment, Accelerate));
[TestCase] [TestCase]
public void Class5_PCC123EcoRollEngineStop_CrestCoast1_HEV() => TestPCC(MethodBase.GetCurrentMethod().Name, public void Class5_PCC123EcoRollEngineStop_CrestCoast1_HEV() => TestPCC(MethodBase.GetCurrentMethod().Name,
......
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using Moq;
using NUnit.Framework; using NUnit.Framework;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils; using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.InputData.FileIO.JSON; using TUGraz.VectoCore.InputData.FileIO.JSON;
using TUGraz.VectoCore.InputData.Reader.ComponentData; using TUGraz.VectoCore.InputData.Reader.ComponentData;
...@@ -691,5 +693,37 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent ...@@ -691,5 +693,37 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent
absTime += dt.SI<Second>(); absTime += dt.SI<Second>();
} }
} }
[TestCase(-30000, 600, 0.019, 0 ,0, -29952.649, TestName = "ESMaxEMPowerTest 1"),
TestCase(30000, 600, 0.019, 0, 0, 30047.651, TestName = "ESMaxEMPowerTest 2"),
TestCase(-30000, 600, 0.019, 0, 1000, -28955.7492, TestName = "ESMaxEMPowerTest 3"),
TestCase(-30000, 600, 0.019, 5000, 0, -34935.584, TestName = "ESMaxEMPowerTest 4"),
TestCase(-30000, 600, 0.019, 5000, 1000, -33939.2068, TestName = "ESMaxEMPowerTest 5"),
TestCase(30000, 600, 0.019, 0, 1000, 31050.8860, TestName = "ESMaxEMPowerTest 6"),
TestCase(30000, 600, 0.019, 5000, 0, 25033.0734, TestName = "ESMaxEMPowerTest 7"),
TestCase(30000, 600, 0.019, 5000, 1000, 26035.7760, TestName = "ESMaxEMPowerTest 8"),
TestCase(30000, 600, 0, 5000, 1000, 26000, TestName = "ESMaxEMPowerTest 9"),
TestCase(-30000, 600, 0, 5000, 1000, -34000, TestName = "ESMaxEMPowerTest A"),
]
public void ESMaxEMPowerTest(double P_batMax, double U_bat, double R_conn, double P_Chg, double P_Aux,
double expected_P_EmMax)
{
var reessResponse = new Mock<IRESSResponse>();
reessResponse.Setup(x => x.MaxChargePower).Returns(P_batMax.SI<Watt>());
reessResponse.Setup(x => x.MaxDischargePower).Returns(P_batMax.SI<Watt>());
reessResponse.Setup(x => x.InternalVoltage).Returns(U_bat.SI<Volt>());
var response = new ElectricSystemResponseSuccess(this) {
AbsTime = 0.SI<Second>(),
AuxPower = P_Aux.SI<Watt>(),
ChargingPower = P_Chg.SI<Watt>(),
ConnectionSystemResistance = R_conn.SI<Ohm>(),
RESSResponse = reessResponse.Object,
};
var maxEMPower = P_batMax > 0 ? response.MaxPowerDrag : response.MaxPowerDrive;
Assert.AreEqual(expected_P_EmMax, maxEMPower.Value(), 1e-3);
}
} }
} }
\ No newline at end of file
...@@ -105,12 +105,12 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent ...@@ -105,12 +105,12 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent
container.CommitSimulationStep(absTime, retVal.SimulationInterval); container.CommitSimulationStep(absTime, retVal.SimulationInterval);
absTime += retVal.SimulationInterval; absTime += retVal.SimulationInterval;
AssertHelper.AreRelativeEqual(560.RPMtoRad(), container.EngineInfo.EngineSpeed); AssertHelper.AreRelativeEqual(560, container.EngineInfo.EngineSpeed.AsRPM);
container.Cycle.Request(absTime, ds); container.Cycle.Request(absTime, ds);
container.CommitSimulationStep(absTime, retVal.SimulationInterval); container.CommitSimulationStep(absTime, retVal.SimulationInterval);
AssertHelper.AreRelativeEqual(87.3192, container.EngineInfo.EngineSpeed); AssertHelper.AreRelativeEqual(646.152, container.EngineInfo.EngineSpeed.AsRPM);
} }
[TestCase] [TestCase]
......
...@@ -465,12 +465,12 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent ...@@ -465,12 +465,12 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent
} }
} }
[TestCase(1, -1000, 600, 28.096, typeof(ResponseSuccess)), [TestCase(2, -1000, 600, 28.096, typeof(ResponseSuccess)),
TestCase(2, -1000, 600, 28.096, typeof(ResponseSuccess)), TestCase(2, -1000, 600, 28.096, typeof(ResponseSuccess)),
TestCase(1, 50, 600, 9.096, typeof(ResponseSuccess)), TestCase(2, 50, 600, 9.096, typeof(ResponseSuccess)),
TestCase(2, 2450, 800, 58.11, typeof(ResponseSuccess)), TestCase(1, 2450, 800, 58.11, typeof(ResponseSuccess)),
TestCase(2, 850, 800, 26.11, typeof(ResponseSuccess)), TestCase(2, 850, 800, 26.11, typeof(ResponseSuccess)),
TestCase(1, 850, 200, 23.07, typeof(ResponseSuccess)), TestCase(2, 850, 200, 23.07, typeof(ResponseSuccess)),
TestCase(2, 50, 600, 9.096, typeof(ResponseSuccess)), TestCase(2, 50, 600, 9.096, typeof(ResponseSuccess)),
TestCase(2, 2050, 1200, 52.132, typeof(ResponseSuccess)), TestCase(2, 2050, 1200, 52.132, typeof(ResponseSuccess)),
TestCase(2, 850, 600, 25.096, typeof(ResponseSuccess)), TestCase(2, 850, 600, 25.096, typeof(ResponseSuccess)),
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<AxleConfiguration>4x2</AxleConfiguration> <AxleConfiguration>4x2</AxleConfiguration>
<Articulated>false</Articulated> <Articulated>false</Articulated>
<TechnicalPermissibleMaximumLadenMass>25000</TechnicalPermissibleMaximumLadenMass> <TechnicalPermissibleMaximumLadenMass>25000</TechnicalPermissibleMaximumLadenMass>
<RetarderType>Transmission Output Retarder</RetarderType> <RetarderType>Axlegear Input Retarder</RetarderType>
<RetarderRatio>1.000</RetarderRatio> <RetarderRatio>1.000</RetarderRatio>
<AngledriveType>None</AngledriveType> <AngledriveType>None</AngledriveType>
<ZeroEmissionVehicle>true</ZeroEmissionVehicle> <ZeroEmissionVehicle>true</ZeroEmissionVehicle>
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<AxleConfiguration>4x2</AxleConfiguration> <AxleConfiguration>4x2</AxleConfiguration>
<Articulated>false</Articulated> <Articulated>false</Articulated>
<TechnicalPermissibleMaximumLadenMass>25000</TechnicalPermissibleMaximumLadenMass> <TechnicalPermissibleMaximumLadenMass>25000</TechnicalPermissibleMaximumLadenMass>
<RetarderType>Transmission Output Retarder</RetarderType> <RetarderType>None</RetarderType>
<RetarderRatio>1.000</RetarderRatio> <RetarderRatio>1.000</RetarderRatio>
<AngledriveType>None</AngledriveType> <AngledriveType>None</AngledriveType>
<ZeroEmissionVehicle>true</ZeroEmissionVehicle> <ZeroEmissionVehicle>true</ZeroEmissionVehicle>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment