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
Unverified Commit 023f4940 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

extend testcase for efficiency correction: make sure efficiency in input is >1

parent 817394e5
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,7 @@ using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.InputData.FileIO.JSON;
using TUGraz.VectoCore.InputData.FileIO.XML;
using TUGraz.VectoCore.InputData.FileIO.XML.Declaration;
using TUGraz.VectoCore.InputData.Reader.ComponentData;
using TUGraz.VectoCore.Models.Declaration;
using TUGraz.VectoCore.Models.Simulation;
using TUGraz.VectoCore.Models.Simulation.Data;
......@@ -857,15 +858,29 @@ public class LorrySimulation
var entry = map.Entries.First(x => x.Torque.IsEqual(tq, 0.1) && x.MotorSpeed.AsRPM.IsEqual(rpm, 0.1));
var input = run.InputData.JobInputData.Vehicle.Components.IEPC
.VoltageLevels.First().PowerMap.First();
var ratio = run.InputData.JobInputData.Vehicle.Components.IEPC.Gears.First().Ratio;
var inputRow = input.PowerMap.AsEnumerable().First(r => r.ParseDouble(IEPCMapReader.Fields.MotorSpeed).IsEqual(rpm / ratio, 0.1) &&
r.ParseDouble(IEPCMapReader.Fields.Torque).IsEqual(-tq * ratio, 0.1));
var inputPwrEl = inputRow.ParseDouble(IEPCMapReader.Fields.PowerElectrical);
// check that in the input the efficiency is greater than 1
Assert.IsTrue(-inputPwrEl > expectedPel);
if (tq < 0) {
// propulsion
Assert.IsTrue(rpm.RPMtoRad() * -tq.SI<NewtonMeter>() / inputPwrEl > 1);
} else {
// recuperation
Assert.IsTrue(inputPwrEl / (rpm.RPMtoRad() * -tq.SI<NewtonMeter>()) > 1);
}
// calculate electric power as the raw map contains a virtual 'torque loss' of the EM.
var elPower = entry.MotorSpeed * entry.Torque + entry.PowerElectrical.Value().SI<NewtonMeter>() * entry.MotorSpeed;
// < 0 means propulsion, hence the electric power needs to be 'more negative'
if (tq < 0) {
Assert.IsTrue(entry.MotorSpeed * entry.Torque > elPower);
} else {
Assert.IsTrue(entry.MotorSpeed * entry.Torque > elPower);
}
Assert.AreEqual(expectedPel, elPower.Value(), 0.1);
}
......@@ -886,15 +901,27 @@ public class LorrySimulation
var entry = map.Entries.First(x => x.Torque.IsEqual(tq, 0.1) && x.MotorSpeed.AsRPM.IsEqual(rpm, 0.1));
var input = run.InputData.JobInputData.Vehicle.Components.ElectricMachines.Entries.First().ElectricMachine
.VoltageLevels.First().PowerMap.First();
var inputRow = input.PowerMap.AsEnumerable().First(r => r.ParseDouble(ElectricMotorMapReader.Fields.MotorSpeed).IsEqual(rpm, 0.1) &&
r.ParseDouble(ElectricMotorMapReader.Fields.Torque).IsEqual(-tq, 0.1));
var inputPwrEl = inputRow.ParseDouble(ElectricMotorMapReader.Fields.PowerElectrical);
// check that in the input the efficiency is greater than 1
Assert.IsTrue(-inputPwrEl > expectedPel);
if (tq < 0) {
// propulsion
Assert.IsTrue(rpm.RPMtoRad() * -tq.SI<NewtonMeter>() / inputPwrEl > 1);
} else {
// recuperation
Assert.IsTrue(inputPwrEl / (rpm.RPMtoRad() * -tq.SI<NewtonMeter>()) > 1);
}
// calculate electric power as the raw map contains a virtual 'torque loss' of the EM.
var elPower = entry.MotorSpeed * entry.Torque + entry.PowerElectrical.Value().SI<NewtonMeter>() * entry.MotorSpeed;
// < 0 means propulsion, hence the electric power needs to be 'more negative'
if (tq < 0) {
Assert.IsTrue(entry.MotorSpeed * entry.Torque > elPower);
} else {
Assert.IsTrue(entry.MotorSpeed * entry.Torque > elPower);
}
Assert.AreEqual(expectedPel, elPower.Value(), 0.1);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment