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

fix in mod-data test, stay disengaged (clutch/gbx) when vehicle stops

parent 13cd14c4
No related branches found
No related tags found
No related merge requests found
......@@ -114,7 +114,7 @@ namespace TUGraz.VectoCore.Configuration
public static readonly Watt EnginePowerSearchTolerance = 0.50.SI<Watt>(); // Watt
public const double CluchNormSpeed = 0.03;
public const double ClutchNormSpeed = 0.03;
public static readonly MeterPerSquareSecond MinimumAcceleration = 0.1.SI<MeterPerSquareSecond>();
......
......@@ -66,23 +66,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
return _clutchState;
}
protected override void DoWriteModalResults(IModalDataContainer container)
{
if (PreviousState.InAngularVelocity == null || CurrentState.InAngularVelocity == null) {
container[ModalResultField.P_clutch_out] = 0.SI<Watt>();
container[ModalResultField.P_clutch_loss] = 0.SI<Watt>();
} else {
var avgAngularVelocity = (PreviousState.InAngularVelocity + CurrentState.InAngularVelocity) / 2.0;
container[ModalResultField.P_clutch_out] = CurrentState.OutTorque * avgAngularVelocity;
container[ModalResultField.P_clutch_loss] = (CurrentState.InTorque - CurrentState.OutTorque) * avgAngularVelocity;
}
}
protected override void DoCommitSimulationStep()
{
AdvanceState();
}
public ITnInPort InPort()
{
return this;
......@@ -93,11 +76,29 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
return this;
}
public void Connect(ITnOutPort other)
{
NextComponent = other;
}
public ITnOutPort IdleControlPort
{
get { return NextComponent; }
}
public virtual IResponse Initialize(NewtonMeter torque, PerSecond angularVelocity)
{
NewtonMeter torqueIn;
PerSecond engineSpeedIn;
AddClutchLoss(torque, angularVelocity, out torqueIn, out engineSpeedIn);
PreviousState.SetState(torqueIn, angularVelocity, torque, angularVelocity);
var retVal = NextComponent.Initialize(torqueIn, engineSpeedIn);
retVal.ClutchPowerRequest = torque * angularVelocity;
return retVal;
}
public virtual IResponse Request(Second absTime, Second dt, NewtonMeter torque, PerSecond angularVelocity,
bool dryRun = false)
{
......@@ -125,23 +126,28 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
return retVal;
}
public virtual IResponse Initialize(NewtonMeter torque, PerSecond angularVelocity)
{
NewtonMeter torqueIn;
PerSecond engineSpeedIn;
AddClutchLoss(torque, angularVelocity, out torqueIn, out engineSpeedIn);
PreviousState.SetState(torqueIn, angularVelocity, torque, angularVelocity);
var retVal = NextComponent.Initialize(torqueIn, engineSpeedIn);
retVal.ClutchPowerRequest = torque * angularVelocity;
return retVal;
protected override void DoWriteModalResults(IModalDataContainer container)
{
if (PreviousState.InAngularVelocity == null || CurrentState.InAngularVelocity == null) {
container[ModalResultField.P_clutch_out] = 0.SI<Watt>();
container[ModalResultField.P_clutch_loss] = 0.SI<Watt>();
} else {
var avgOutAngularVelocity = (PreviousState.OutAngularVelocity + CurrentState.OutAngularVelocity) / 2.0;
var avgInAngularVelocity = (PreviousState.InAngularVelocity + CurrentState.InAngularVelocity) / 2.0;
container[ModalResultField.P_clutch_out] = CurrentState.OutTorque * avgOutAngularVelocity;
container[ModalResultField.P_clutch_loss] = CurrentState.InTorque * avgInAngularVelocity -
CurrentState.OutTorque * avgOutAngularVelocity;
//(CurrentState.InTorque - CurrentState.OutTorque) * avgInAngularVelocity;
}
}
public void Connect(ITnOutPort other)
protected override void DoCommitSimulationStep()
{
NextComponent = other;
AdvanceState();
}
private void AddClutchLoss(NewtonMeter torque, PerSecond angularVelocity, out NewtonMeter torqueIn,
out PerSecond angularVelocityIn)
{
......@@ -156,12 +162,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
torqueIn = 0.SI<NewtonMeter>();
} else {
var engineSpeedNorm = (angularVelocity - _idleSpeed) / (_ratedSpeed - _idleSpeed);
if (engineSpeedNorm < Constants.SimulationSettings.CluchNormSpeed) {
if (engineSpeedNorm < Constants.SimulationSettings.ClutchNormSpeed) {
_clutchState = ClutchState.ClutchSlipping;
var engineSpeed0 = VectoMath.Max(_idleSpeed, angularVelocity);
var clutchSpeedNorm = Constants.SimulationSettings.CluchNormSpeed /
((_idleSpeed + Constants.SimulationSettings.CluchNormSpeed * (_ratedSpeed - _idleSpeed)) / _ratedSpeed);
var clutchSpeedNorm = Constants.SimulationSettings.ClutchNormSpeed /
((_idleSpeed + Constants.SimulationSettings.ClutchNormSpeed * (_ratedSpeed - _idleSpeed)) / _ratedSpeed);
angularVelocityIn =
((clutchSpeedNorm * engineSpeed0 / _ratedSpeed) * (_ratedSpeed - _idleSpeed) + _idleSpeed).Radian.Cast<PerSecond>();
......
......@@ -242,7 +242,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
if (!IsBelowDownShiftCurve(gear, inTorque, inAngularSpeed) && !IsAboveUpShiftCurve(gear, inTorque, inAngularSpeed) &&
reserve >= Data.StartTorqueReserve) {
if ((inAngularSpeed - DataBus.EngineIdleSpeed) / (DataBus.EngineRatedSpeed - DataBus.EngineIdleSpeed) <
Constants.SimulationSettings.CluchNormSpeed && gear > 1) {
Constants.SimulationSettings.ClutchNormSpeed && gear > 1) {
gear--;
}
......@@ -350,7 +350,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
if ((Data.Gears[NextGear].Ratio * outAngularVelocity - DataBus.EngineIdleSpeed) /
(DataBus.EngineRatedSpeed - DataBus.EngineIdleSpeed) <
Constants.SimulationSettings.CluchNormSpeed && NextGear > 1) {
Constants.SimulationSettings.ClutchNormSpeed && NextGear > 1) {
NextGear--;
}
......
......@@ -67,12 +67,16 @@ namespace TUGraz.VectoCore.Tests.Reports
run.Run();
Assert.IsTrue(run.FinishedWithoutErrors);
var skipNext = false;
var lastGear = 0u;
foreach (DataRow row in modData.Data.Rows) {
if (skipNext) {
var gear = (uint)row[(int)ModalResultField.Gear];
var time = (Second)row[(int)ModalResultField.time];
if ((lastGear == 0 && gear != 0) || (lastGear != 0 && gear == 0)) {
//skipNext = (uint)row[(int)ModalResultField.Gear] == 0;
lastGear = gear;
continue;
}
var time = (Second)row[(int)ModalResultField.time];
var distance = (Meter)row[(int)ModalResultField.dist];
var tqEngFcmap = (NewtonMeter)row[(int)ModalResultField.T_eng_fcmap];
var nEngFcMap = (PerSecond)row[(int)ModalResultField.n_eng_avg];
......@@ -113,7 +117,7 @@ namespace TUGraz.VectoCore.Tests.Reports
var pClutchLoss = (Watt)row[(int)ModalResultField.P_clutch_loss];
var pClutchOut = (Watt)row[(int)ModalResultField.P_clutch_out];
var pWheelInertia = (Watt)row[(int)ModalResultField.P_wheel_inertia];
var gear = (uint)row[(int)ModalResultField.Gear];
// P_trac = P_veh_inertia + P_roll + P_air + P_slope
Assert.AreEqual(pTrac.Value(), (pAir + pRoll + pGrad + pVehInertia).Value(), 1E-3, "time: {0} distance: {1}", time,
......@@ -140,10 +144,9 @@ namespace TUGraz.VectoCore.Tests.Reports
if (gear != 0) {
Assert.AreEqual(pEngFcmap.Value(),
(pTrac + pWheelInertia + pBrakeLoss + pLossAxle + pLossRet + pLossGbx + pGbxInertia + pEngInertia + pAux +
pClutchLoss)
.Value(), 1E-3, "time: {0} distance: {1}", time, distance);
pClutchLoss).Value(), 0.5, "time: {0} distance: {1}", time, distance);
}
skipNext = gear == 0;
lastGear = gear;
}
}
}
......
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