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

Merge pull request #370 in VECTO/vecto-sim from ~EMQUARIMA/vecto-sim:develop to develop

* commit 'a0f4bb7f':
  remove testcases with very high slope
  torque converter: introduce creeping flag; dry-run: return delta drag-load and delta full-load (don't guess what's required); set creeping flag accordingly
  adapt testcase for shift-losses
  driverStrategy: allow coasting (overspeed) only when vehicle speed > 0
  driver: do not limit deceleration when disengaged; search for acceleration if negative braking power occurs
  shift loss computation: compute shift loss energy, allow splitting into multiple simulation intervalls
  save test for cargo volume
  don't write sum-data if no sum-writer is set
  torque converter: compute both delta values on dry-run (full-load & drag load)
parents d7ed1574 a0f4bb7f
Branches
Tags
No related merge requests found
Showing
with 98 additions and 44 deletions
......@@ -154,9 +154,12 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
WriteModalResults = _mode != ExecutionMode.Declaration || WriteModalResults
};
var current = i++;
var builder = new PowertrainBuilder(modContainer, (writer, mass, loading, volume, gearCount) =>
var builder = new PowertrainBuilder(modContainer, (writer, mass, loading, volume, gearCount) => {
if (SumData != null) {
SumData.Write(modContainer, d.JobName, string.Format("{0}-{1}", JobNumber, current),
d.Cycle.Name + Constants.FileExtensions.CycleFile, mass, loading, volume, gearCount));
d.Cycle.Name + Constants.FileExtensions.CycleFile, mass, loading, volume ?? 0.SI<CubicMeter>(), gearCount);
}
});
VectoRun run;
......
......@@ -327,7 +327,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
Log.Info("VehicleContainer finishing simulation.");
ModData.Finish(RunStatus);
WriteSumData(ModData, VehicleMass, VehicleLoading, Vehicle != null ? Vehicle.CargoVolume : 0.SI<CubicMeter>(),
WriteSumData(ModData, VehicleMass, VehicleLoading, Vehicle != null && Vehicle.CargoVolume != null ? Vehicle.CargoVolume : 0.SI<CubicMeter>(),
Gearbox != null ? Gearbox.NumGears : 0u);
ModData.FinishSimulation();
......
......@@ -275,6 +275,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox
public double SpeedRatio;
public double TorqueRatio;
public bool Creeping;
public override string ToString()
{
......
......@@ -204,7 +204,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
if (_requestAfterGearshift) {
LastShift = absTime;
Gear = _strategy.Engage(absTime, dt, outTorque, outAngularVelocity);
CurrentState.PowershiftLosses = ComputeShiftLosses(dt, outTorque, outAngularVelocity);
CurrentState.PowershiftLossEnergy = ComputeShiftLosses(outTorque, outAngularVelocity);
} else {
if (PreviousState.PowershiftLossEnergy != null && PreviousState.PowershiftLossEnergy.IsGreater(0)) {
CurrentState.PowershiftLossEnergy = PreviousState.PowershiftLossEnergy;
}
}
do {
if (CurrentState.Disengaged || (DataBus.DriverBehavior == DrivingBehavior.Halted)) {
......@@ -264,8 +268,16 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
: 0.SI<NewtonMeter>();
inTorque += inertiaTorqueLossOut / effectiveRatio;
if (CurrentState.PowershiftLosses != null) {
inTorque += CurrentState.PowershiftLosses;
if (CurrentState.PowershiftLossEnergy != null) {
var remainingShiftLossLime = ModelData.PowershiftShiftTime - (absTime - LastShift);
if (remainingShiftLossLime.IsGreater(0)) {
var aliquotEnergyLoss = CurrentState.PowershiftLossEnergy * VectoMath.Min(1.0, dt / remainingShiftLossLime);
var avgEngineSpeed = (DataBus.EngineSpeed + outAngularVelocity * ModelData.Gears[Gear].Ratio) / 2;
CurrentState.PowershiftLoss = aliquotEnergyLoss / dt / avgEngineSpeed;
inTorque += CurrentState.PowershiftLoss;
CurrentState.PowershiftLossEnergy -= aliquotEnergyLoss;
//inTorque += CurrentState.PowershiftLossEnergy;
}
}
if (!dryRun) {
......@@ -359,7 +371,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
CurrentState.OutTorque * avgOutAngularSpeed;
container[ModalResultField.P_gbx_inertia] = CurrentState.InertiaTorqueLossOut * avgOutAngularSpeed;
container[ModalResultField.P_gbx_in] = CurrentState.InTorque * avgInAngularSpeed;
container[ModalResultField.P_gbx_shift_loss] = CurrentState.PowershiftLosses.DefaultIfNull(0) * avgInAngularSpeed;
container[ModalResultField.P_gbx_shift_loss] = CurrentState.PowershiftLoss.DefaultIfNull(0) * avgInAngularSpeed;
container[ModalResultField.n_gbx_out_avg] = avgOutAngularSpeed;
container[ModalResultField.T_gbx_out] = CurrentState.OutTorque;
}
......@@ -395,7 +407,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
{
public bool TorqueConverterLocked;
public bool Disengaged = true;
public NewtonMeter PowershiftLosses;
public WattSecond PowershiftLossEnergy;
public NewtonMeter PowershiftLoss;
}
}
}
\ No newline at end of file
......@@ -124,7 +124,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
get { return ModelData.TractionInterruption; }
}
public uint NumGears { get { return (uint)ModelData.Gears.Count; } }
public uint NumGears
{
get { return (uint)ModelData.Gears.Count; }
}
#endregion
......@@ -147,17 +150,16 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
return nextGear.TorqueConverterLocked;
}
protected internal NewtonMeter ComputeShiftLosses(Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity)
protected internal WattSecond ComputeShiftLosses(NewtonMeter outTorque, PerSecond outAngularVelocity)
{
var torqueGbxIn = outTorque / ModelData.Gears[Gear].Ratio;
var deltaEngineSpeed = DataBus.EngineSpeed - outAngularVelocity * ModelData.Gears[Gear].Ratio;
var deltaClutchSpeed = (DataBus.EngineSpeed - PreviousState.OutAngularVelocity * ModelData.Gears[Gear].Ratio) / 2;
var torqueInertia = ModelData.PowershiftInertiaFactor * EngineInertia * deltaEngineSpeed / dt;
var averageEngineSpeed = (DataBus.EngineSpeed + outAngularVelocity * ModelData.Gears[Gear].Ratio) / 2;
var torqueLoss = (torqueGbxIn + torqueInertia) * deltaClutchSpeed / averageEngineSpeed *
(ModelData.PowershiftShiftTime / dt);
var torqueInertia = ModelData.PowershiftInertiaFactor * EngineInertia * deltaEngineSpeed /
ModelData.PowershiftShiftTime;
var shiftLossEnergy = (torqueGbxIn + torqueInertia) * deltaClutchSpeed * ModelData.PowershiftShiftTime;
return torqueLoss.Abs();
return shiftLossEnergy.Abs();
}
}
......
......@@ -226,9 +226,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
}
if (Gear != PreviousState.Gear &&
ConsiderShiftLosses(new GearInfo(Gear, torqueConverterLocked), outTorque)) {
CurrentState.PowershiftLosses = ComputeShiftLosses(dt, outTorque, outAngularVelocity);
CurrentState.PowershiftLosses = ComputeShiftLosses(outTorque, outAngularVelocity);
}
if (CurrentState.PowershiftLosses != null) {
var averageEngineSpeed = (DataBus.EngineSpeed + outAngularVelocity * ModelData.Gears[Gear].Ratio) / 2;
inTorque += CurrentState.PowershiftLosses / dt / averageEngineSpeed;
}
inTorque += CurrentState.PowershiftLosses ?? 0.SI<NewtonMeter>();
if (dryRun) {
if (TorqueConverter != null && !torqueConverterLocked) {
return TorqueConverter.Request(absTime, dt, inTorque, inAngularVelocity, true);
......@@ -491,7 +494,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
public class CycleGearboxState : GearboxState
{
public bool TorqueConverterActive;
public NewtonMeter PowershiftLosses { get; set; }
public WattSecond PowershiftLosses { get; set; }
}
public class CycleShiftStrategy : BaseShiftStrategy
......
......@@ -401,7 +401,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var second = first;
first.Switch().
Case<ResponseUnderload>(r => {
if (DriverStrategy.OverspeedAllowed(targetVelocity, prohibitOverspeed)) {
if (DataBus.VehicleSpeed.IsGreater(0) && DriverStrategy.OverspeedAllowed(targetVelocity, prohibitOverspeed)) {
second = Driver.DrivingActionCoast(absTime, ds, velocity, gradient);
debug.Add(new { action = "first:(Underload & Overspeed)-> Coast", second });
if (second is ResponseUnderload || second is ResponseSpeedLimitExceeded) {
......
......@@ -196,12 +196,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
// search again for operating point, transmission may have shifted inbetween
nextOperatingPoint = SearchOperatingPoint(absTime, ds, gradient, operatingPoint.Acceleration,
response);
limitedOperatingPoint = LimitAccelerationByDriverModel(nextOperatingPoint,
LimitationMode.LimitDecelerationDriver);
DriverAcceleration = limitedOperatingPoint.Acceleration;
retVal = NextComponent.Request(absTime, limitedOperatingPoint.SimulationInterval,
limitedOperatingPoint.Acceleration,
gradient);
DriverAcceleration = nextOperatingPoint.Acceleration;
retVal = NextComponent.Request(absTime, nextOperatingPoint.SimulationInterval,
nextOperatingPoint.Acceleration, gradient);
} else {
if (absTime > 0 && DataBus.VehicleStopped) {
Log.Info(
......@@ -526,6 +523,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
operatingPoint = SearchBrakingPower(absTime, operatingPoint.SimulationDistance, gradient,
operatingPoint.Acceleration, response);
DriverAcceleration = operatingPoint.Acceleration;
if (DataBus.BrakePower.IsSmaller(0)) {
DataBus.BrakePower = 0.SI<Watt>();
operatingPoint = SearchOperatingPoint(absTime, ds, gradient, 0.SI<MeterPerSquareSecond>(), r);
}
retVal = NextComponent.Request(absTime, operatingPoint.SimulationInterval,
operatingPoint.Acceleration, gradient);
} else {
......
......@@ -107,25 +107,47 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var engineResponse = (ResponseDryRun)
NextComponent.Request(absTime, dt, inTorque, operatingPoint.InAngularVelocity, true);
TorqueConverterOperatingPoint dryOperatingPoint;
//TorqueConverterOperatingPoint dryOperatingPoint;
//if (false && DataBus.VehicleStopped && DataBus.DriverBehavior == DrivingBehavior.Driving && outTorque.IsGreater(0)) {
// dryOperatingPoint = ModelData.FindOperatingPoint(DataBus.EngineIdleSpeed, outAngularVelocity);
//} else {
dryOperatingPoint = (DataBus.DriverBehavior != DrivingBehavior.Braking && DataBus.BrakePower.IsEqual(0)) ||
(outTorque.IsGreater(0) && DataBus.BrakePower.IsEqual(0))
? GetMaxPowerOperatingPoint(dt, outAngularVelocity, engineResponse,
PreviousState.InTorque * PreviousState.InAngularVelocity)
: GetDragPowerOperatingPoint(dt, outAngularVelocity, engineResponse,
PreviousState.InTorque * PreviousState.InAngularVelocity);
//dryOperatingPoint = (DataBus.DriverBehavior != DrivingBehavior.Braking && DataBus.BrakePower.IsEqual(0)) ||
// (outTorque.IsGreater(0) && DataBus.BrakePower.IsEqual(0))
// ? GetMaxPowerOperatingPoint(dt, outAngularVelocity, engineResponse,
// PreviousState.InTorque * PreviousState.InAngularVelocity)
// : GetDragPowerOperatingPoint(dt, outAngularVelocity, engineResponse,
// PreviousState.InTorque * PreviousState.InAngularVelocity);
//}
var avgOutSpeed = (PreviousState.OutAngularVelocity + dryOperatingPoint.OutAngularVelocity) / 2.0;
var delta = (outTorque - dryOperatingPoint.OutTorque) * avgOutSpeed;
var condition1 = (DataBus.DriverBehavior != DrivingBehavior.Braking && DataBus.BrakePower.IsEqual(0));
var condition2 = (outTorque.IsGreater(0) && DataBus.BrakePower.IsEqual(0));
var engineOK = engineResponse.DeltaDragLoad.IsGreaterOrEqual(0) && engineResponse.DeltaFullLoad.IsSmallerOrEqual(0);
if (DataBus.DriverBehavior != DrivingBehavior.Braking && engineOK && operatingPoint.Creeping) {
var delta = (outTorque - operatingPoint.OutTorque) *
(PreviousState.OutAngularVelocity + operatingPoint.OutAngularVelocity) / 2.0;
return new ResponseDryRun() {
Source = this,
DeltaFullLoad = delta,
DeltaDragLoad = delta,
TorqueConverterOperatingPoint = operatingPoint
};
}
var dryOperatingPointMax = GetMaxPowerOperatingPoint(dt, outAngularVelocity, engineResponse,
PreviousState.InTorque * PreviousState.InAngularVelocity);
var avgOutSpeedMax = (PreviousState.OutAngularVelocity + dryOperatingPointMax.OutAngularVelocity) / 2.0;
var deltaMax = (outTorque - dryOperatingPointMax.OutTorque) * avgOutSpeedMax;
var dryOperatingPointMin = GetDragPowerOperatingPoint(dt, outAngularVelocity, engineResponse,
PreviousState.InTorque * PreviousState.InAngularVelocity);
var avgOutSpeedMin = (PreviousState.OutAngularVelocity + dryOperatingPointMin.OutAngularVelocity) / 2.0;
var deltaMin = (outTorque - dryOperatingPointMin.OutTorque) * avgOutSpeedMin;
return new ResponseDryRun {
Source = this,
DeltaFullLoad = 2 * delta,
DeltaDragLoad = 2 * delta,
TorqueConverterOperatingPoint = dryOperatingPoint
DeltaFullLoad = 2 * deltaMax,
DeltaDragLoad = 2 * deltaMin,
TorqueConverterOperatingPoint = dryOperatingPointMax
};
}
......@@ -176,7 +198,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
return operatingPoint;
} catch (VectoException ve) {
Log.Error(ve, "TorqueConverter: Failed to find operating point for DragPower {0}", engineResponse.DragPower);
return ModelData.FindOperatingPoint(engineResponse.EngineSpeed, outAngularVelocity);
var retVal = ModelData.FindOperatingPoint(engineResponse.EngineSpeed, outAngularVelocity);
retVal.Creeping = true;
return retVal;
}
}
......@@ -195,7 +219,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
} catch (VectoException ve) {
Log.Error(ve, "TorqueConverter: Failed to find operating point for MaxPower {0}",
engineResponse.DynamicFullLoadPower);
throw;
var tqOperatingPoint = ModelData.FindOperatingPoint(DataBus.EngineIdleSpeed, outAngularVelocity);
tqOperatingPoint.Creeping = true;
return tqOperatingPoint;
}
}
......@@ -206,6 +232,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
if (operatingPointList.Count == 0) {
Log.Debug("TorqueConverter: Failed to find torque converter operating point, fallback: creeping");
var tqOperatingPoint = ModelData.FindOperatingPoint(DataBus.EngineIdleSpeed, outAngularVelocity);
tqOperatingPoint.Creeping = true;
return tqOperatingPoint;
}
......
......@@ -84,6 +84,7 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="itextsharp">
<HintPath>..\..\packages\iTextSharp.5.5.9\lib\itextsharp.dll</HintPath>
</Reference>
......
......@@ -153,7 +153,7 @@ namespace TUGraz.VectoCore.Tests.Integration.DriverStrategy
TestCase(80, 0, -25),
TestCase(80, 0, -5),
TestCase(80, 0, 0),
TestCase(80, 0, 18),
//TestCase(80, 0, 18),
TestCase(80, 0, 15),
TestCase(80, 0, 3),
TestCase(80, 0, 5),
......@@ -297,7 +297,7 @@ namespace TUGraz.VectoCore.Tests.Integration.DriverStrategy
TestCase(0, 85, 1),
TestCase(0, 85, 10),
TestCase(0, 85, 2),
TestCase(0, 85, 25),
//TestCase(0, 85, 25),
TestCase(0, 85, 5),
TestCase(20, 22, 5),
TestCase(20, 60, -15),
......
......@@ -41,6 +41,7 @@ using TUGraz.VectoCore.Models.Simulation.Impl;
using TUGraz.VectoCore.Models.SimulationComponent.Data;
using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox;
using TUGraz.VectoCore.Models.SimulationComponent.Impl;
using TUGraz.VectoCore.OutputData;
using TUGraz.VectoCore.Tests.Integration;
using TUGraz.VectoCore.Tests.Utils;
......@@ -93,6 +94,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent
var container = new VehicleContainer(ExecutionMode.Engineering);
gearboxData.PowershiftInertiaFactor = inertiaFactor;
gearboxData.PowershiftShiftTime = 0.8.SI<Second>();
var cycleDataStr = "0, 0, 0, 2\n100, 20, 0, 0\n1000, 50, 0, 0";
var cycleData = SimpleDrivingCycles.CreateCycleData(cycleDataStr);
......@@ -138,7 +140,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent
response = gbx.Request(absTime, dt, torqueDemand.SI<NewtonMeter>(), postShiftRpm.RPMtoRad());
Assert.IsInstanceOf<ResponseSuccess>(response);
Assert.AreEqual(expectedShiftLoss, gbx.CurrentState.PowershiftLosses.Value(), 1e-3);
Assert.AreEqual(expectedShiftLoss, gbx.CurrentState.PowershiftLoss.Value(), 1e-3);
Assert.AreEqual(gear + (postShiftRpm > preShiftRpm ? 1 : -1), gbx.Gear);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment