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 dd09cd94 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

Merge pull request #611 in VECTO/vecto-sim from...

Merge pull request #611 in VECTO/vecto-sim from ~EMQUARIMA/vecto-sim:bugfix/VECTO-696-problem-with-primary-retarder to develop

* commit 'a833e584':
  fix job file, comment out test debugging
  apply torque losses only when avgspeed >0
  fix: retarder does not apply its torque loss when used as primary retarder and clutch is open
  adding testcase illustrating bug when using primary retarder
parents 3344428c a833e584
No related branches found
No related tags found
No related merge requests found
Showing
with 175 additions and 9 deletions
......@@ -10,7 +10,7 @@
<VehicleCategory>Rigid Truck</VehicleCategory>
<AxleConfiguration>4x2</AxleConfiguration>
<CurbMassChassis>4010</CurbMassChassis>
<GrossVehicleMass>7500</GrossVehicleMass>
<GrossVehicleMass>7501</GrossVehicleMass>
<IdlingSpeed>600</IdlingSpeed>
<RetarderType>None</RetarderType>
<AngledriveType>None</AngledriveType>
......
......@@ -218,6 +218,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var avgOutAngularVelocity = (PreviousState.OutAngularVelocity + outAngularVelocity) / 2.0;
var inTorqueLossResult = ModelData.Gears[gear].LossMap.GetTorqueLoss(avgOutAngularVelocity, outTorque);
if (avgOutAngularVelocity.IsEqual(0, 1e-9)) {
inTorqueLossResult.Value = 0.SI<NewtonMeter>();
}
var inTorque = outTorque / ModelData.Gears[gear].Ratio + inTorqueLossResult.Value;
var inAngularVelocity = outAngularVelocity * ModelData.Gears[gear].Ratio;
......@@ -411,12 +414,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
if (CurrentState.TorqueLossResult != null && CurrentState.TorqueLossResult.Extrapolated) {
Log.Warn(
"Gear {0} LossMap data was extrapolated: range for loss map is not sufficient: n:{1}, torque:{2}, ratio:{3}",
Gear, CurrentState.OutAngularVelocity.ConvertToRoundsPerMinute(), CurrentState.OutTorque,
Gear, CurrentState.OutAngularVelocity.ConvertToRoundsPerMinute(), CurrentState.OutTorque,
ModelData.Gears[Gear].Ratio);
if (DataBus.ExecutionMode == ExecutionMode.Declaration) {
throw new VectoException(
"Gear {0} LossMap data was extrapolated in Declaration Mode: range for loss map is not sufficient: n:{1}, torque:{2}, ratio:{3}",
Gear, CurrentState.InAngularVelocity.ConvertToRoundsPerMinute(), CurrentState.InTorque,
Gear, CurrentState.InAngularVelocity.ConvertToRoundsPerMinute(), CurrentState.InTorque,
ModelData.Gears[Gear].Ratio);
}
}
......
......@@ -49,6 +49,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
{
private readonly RetarderLossMap _lossMap;
private readonly double _ratio;
private bool _primaryRetarder;
/// <summary>
/// Creates a new Retarder.
......@@ -60,6 +61,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
{
_lossMap = lossMap;
_ratio = ratio;
_primaryRetarder = container.RunData != null && container.RunData.Retarder.Type == RetarderType.TransmissionInputRetarder;
}
public IResponse Initialize(NewtonMeter torque, PerSecond angularVelocity)
......@@ -71,11 +73,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
public IResponse Request(Second absTime, Second dt, NewtonMeter torque, PerSecond angularVelocity, bool dryRun = false)
{
if (angularVelocity == null) {
return NextComponent.Request(absTime, dt, torque, null, dryRun);
if (angularVelocity == null || (_primaryRetarder && !DataBus.ClutchClosed(absTime))) {
return NextComponent.Request(absTime, dt, torque, angularVelocity, dryRun);
}
var avgAngularSpeed = (PreviousState.InAngularVelocity + angularVelocity) / 2.0;
var retarderTorqueLoss = _lossMap.GetTorqueLoss(avgAngularSpeed * _ratio) * _ratio;
var retarderTorqueLoss = avgAngularSpeed.IsEqual(0, 1e-9) ? 0.SI<NewtonMeter>() : _lossMap.GetTorqueLoss(avgAngularSpeed * _ratio) * _ratio;
CurrentState.SetState(torque + retarderTorqueLoss, angularVelocity, torque, angularVelocity);
return NextComponent.Request(absTime, dt, CurrentState.InTorque, CurrentState.InAngularVelocity, dryRun);
}
......
......@@ -80,6 +80,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var avgOutAngularVelocity = (PreviousState.OutAngularVelocity + outAngularVelocity) / 2.0;
var torqueLossResult = ModelData.LossMap.GetTorqueLoss(avgOutAngularVelocity, outTorque);
if (avgOutAngularVelocity.IsEqual(0, 1e-9)) {
torqueLossResult.Value = 0.SI<NewtonMeter>();
}
var inTorque = outTorque / ModelData.Ratio + torqueLossResult.Value;
CurrentState.SetState(inTorque, inAngularVelocity, outTorque, outAngularVelocity);
......@@ -105,12 +108,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
{
if (CurrentState.TorqueLossResult.Extrapolated) {
Log.Warn("{2} LossMap data was extrapolated: range for loss map is not sufficient: n:{0}, torque:{1}",
CurrentState.OutAngularVelocity.ConvertToRoundsPerMinute(), CurrentState.OutTorque, GetType().Name);
CurrentState.OutAngularVelocity.ConvertToRoundsPerMinute(), CurrentState.OutTorque, GetType().Name);
if (DataBus.ExecutionMode == ExecutionMode.Declaration) {
throw new VectoException(
"{2} LossMap data was extrapolated in Declaration Mode: range for loss map is not sufficient: n:{0}, torque:{1}",
CurrentState.OutAngularVelocity.ConvertToRoundsPerMinute(), CurrentState.OutTorque, GetType().Name);
CurrentState.OutAngularVelocity.ConvertToRoundsPerMinute(), CurrentState.OutTorque, GetType().Name);
}
}
AdvanceState();
......
......@@ -107,7 +107,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
CurrentState.Distance = PreviousState.Distance + PreviousState.Velocity * dt + acceleration * dt * dt / 2;
CurrentState.DriverAcceleration = DriverAcceleration(acceleration);
CurrentState.RollingResistance = RollingResistance(gradient);
CurrentState.RollingResistance = (PreviousState.Velocity + CurrentState.Velocity).IsEqual(0, 1e-9) ? 0.SI<Newton>() : RollingResistance(gradient);
try {
CurrentState.AirDragResistance = AirDragResistance(PreviousState.Velocity, CurrentState.Velocity);
} catch (VectoException ex) {
......
......@@ -60,6 +60,14 @@ namespace TUGraz.VectoCore.Tests.Integration
public const string Class9RigidTruckPTOJob =
@"TestData\Integration\DeclarationMode\Class9_RigidTruck_6x2\Class9_RigidTruck_DECL.vecto";
public const string Class5TractorDeclPrimaryRetarder =
@"TestData\Integration\DeclarationMode\Class5_Tractor_4x2\Class5_Tractor_DECL_primRet.vecto";
[OneTimeSetUp]
public void RunBeforeAnyTests()
{
Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory);
}
[TestCase]
public void Truck40t_LongHaulCycle_RefLoad()
......@@ -358,5 +366,26 @@ namespace TUGraz.VectoCore.Tests.Integration
Assert.IsTrue(jobContainer.Runs.All(r => r.Success), string.Concat(jobContainer.Runs.Select(r => r.ExecException)));
}
[TestCase]
public void DeclarationClass5PrimaryRetarder()
{
var inputData = JSONInputDataFactory.ReadJsonJob(Class5TractorDeclPrimaryRetarder);
var fileWriter = new FileOutputWriter(Class5TractorDeclPrimaryRetarder);
var factory = new SimulatorFactory(ExecutionMode.Declaration, inputData, fileWriter) {
WriteModalResults = true
};
var sumData = new SummaryDataContainer(fileWriter);
var jobContainer = new JobContainer(sumData);
jobContainer.AddRuns(factory);
//var runs = jobContainer.Runs;
//runs[0].Run.Run();
jobContainer.Execute();
jobContainer.WaitFinished();
Assert.IsTrue(jobContainer.Runs.All(r => r.Success), string.Concat(jobContainer.Runs.Select(r => r.ExecException)));
}
}
}
\ No newline at end of file
{
"Header": {
"CreatedBy": " ()",
"Date": "2016-10-13T10:08:21.7776564Z",
"AppVersion": "3",
"FileVersion": 3
},
"Body": {
"SavedInDeclMode": true,
"EngineOnlyMode": false,
"VehicleFile": "Class5_Tractor_primRet.vveh",
"EngineFile": "Engine_325kW_12.7l.veng",
"GearboxFile": "AMT_12.vgbx",
"AuxiliaryAssembly": "Classic",
"AuxiliaryVersion": "CLASSIC",
"AdvancedAuxiliaryFilePath": "",
"Aux": [
{
"ID": "FAN",
"Type": "Fan",
"Technology": [
"Belt driven or driven via transm. - Electronically controlled visco clutch"
]
},
{
"ID": "STP",
"Type": "Steering pump",
"Technology": [
"Fixed displacement with elec. control"
]
},
{
"ID": "AC",
"Type": "HVAC",
"Technology": [
"Default"
]
},
{
"ID": "ES",
"Type": "Electric System",
"Technology": [
"Standard technology"
]
},
{
"ID": "PS",
"Type": "Pneumatic System",
"Technology": [
"Medium Supply 2-stage + ESS + AMS"
]
}
],
"StartStop": {
"Enabled": false,
"MaxSpeed": 5.0,
"MinTime": 5.0,
"Delay": 5.0
},
"OverSpeedEcoRoll": {
"Mode": "Overspeed",
"MinSpeed": 50.0,
"OverSpeed": 5.0,
"UnderSpeed": 5.0
}
}
}
\ No newline at end of file
{
"Header": {
"CreatedBy": " ()",
"Date": "2016-10-13T10:08:01.8366564Z",
"AppVersion": "3",
"FileVersion": 7
},
"Body": {
"SavedInDeclMode": true,
"VehCat": "Tractor",
"CurbWeight": 8229.0,
"CurbWeightExtra": 0.0,
"Loading": 0.0,
"MassMax": 18.0,
"CdA": 5.3,
"rdyn": 0.0,
"CdCorrMode": "CdofVdecl",
"CdCorrFile": "",
"Retarder": {
"Type": "primary",
"Ratio": 1.0,
"File": "Default.vrlm"
},
"Angledrive": {
"Type": "None",
"Ratio": 0.0,
"LossMap": ""
},
"PTO": {
"Type": "None",
"LossMap": "",
"Cycle": ""
},
"AxleConfig": {
"Type": "4x2",
"Axles": [
{
"Inertia": 14.9,
"Wheels": "315/70 R22.5",
"AxleWeightShare": 0.0,
"TwinTyres": false,
"RRCISO": 0.0055,
"FzISO": 33350.0
},
{
"Inertia": 14.9,
"Wheels": "315/70 R22.5",
"AxleWeightShare": 0.0,
"TwinTyres": true,
"RRCISO": 0.0065,
"FzISO": 33350.0
}
]
}
}
}
\ No newline at end of file
......@@ -979,6 +979,12 @@
<None Include="TestData\Integration\DeclarationMode\Class5_Tractor_4x2\Axle_4x2_Tractor.vtlm">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="TestData\Integration\DeclarationMode\Class5_Tractor_4x2\Class5_Tractor_DECL_primRet.vecto">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="TestData\Integration\DeclarationMode\Class5_Tractor_4x2\Class5_Tractor_primRet.vveh">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="TestData\Integration\DeclarationMode\Class5_Tractor_4x2\Class5_Tractor_NoAirdrag.vveh">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
......
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