Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit ff01645c authored by Markus QUARITSCH's avatar Markus QUARITSCH
Browse files

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

* commit '671845e1':
  print warning from search algorithm only in debug mode
  fix: cycle gearbox: torque converter was called with wrong speed & torque; disengage if engine speed is below idle speed
parents a71abdd7 671845e1
No related branches found
No related tags found
No related merge requests found
...@@ -145,7 +145,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -145,7 +145,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
retVal.GearboxPowerRequest = outTorque * outAngularVelocity; retVal.GearboxPowerRequest = outTorque * outAngularVelocity;
return retVal; return retVal;
} }
/// <summary> /// <summary>
...@@ -184,7 +183,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -184,7 +183,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
if (dryRun) { if (dryRun) {
if (TorqueConverter != null && TorqueConverterActive != null && TorqueConverterActive.Value) { if (TorqueConverter != null && TorqueConverterActive != null && TorqueConverterActive.Value) {
return RequestTorqueConverter(absTime, dt, outTorque, outAngularVelocity, true); return RequestTorqueConverter(absTime, dt, inTorque, inAngularVelocity, true);
}
if (outTorque.IsSmaller(0) && inAngularVelocity.IsSmaller(DataBus.EngineIdleSpeed)) {
//Log.Warn("engine speed would fall below idle speed - disengage! gear from cycle: {0}, vehicle speed: {1}", Gear,
// DataBus.VehicleSpeed);
Gear = 0;
return RequestDisengaged(absTime, dt, outTorque, outAngularVelocity, dryRun);
} }
var dryRunResponse = NextComponent.Request(absTime, dt, inTorque, inAngularVelocity, true); var dryRunResponse = NextComponent.Request(absTime, dt, inTorque, inAngularVelocity, true);
dryRunResponse.GearboxPowerRequest = outTorque * avgOutAngularVelocity; dryRunResponse.GearboxPowerRequest = outTorque * avgOutAngularVelocity;
...@@ -201,9 +206,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -201,9 +206,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
if (TorqueConverter != null && TorqueConverterActive != null && TorqueConverterActive.Value) { if (TorqueConverter != null && TorqueConverterActive != null && TorqueConverterActive.Value) {
CurrentState.TorqueConverterActive = true; CurrentState.TorqueConverterActive = true;
return RequestTorqueConverter(absTime, dt, outTorque, outAngularVelocity); return RequestTorqueConverter(absTime, dt, inTorque, inAngularVelocity);
}
if (outTorque.IsSmaller(0) && inAngularVelocity.IsSmaller(DataBus.EngineIdleSpeed)) {
Log.Warn("engine speed would fall below idle speed - disengage! gear from cycle: {0}, vehicle speed: {1}", Gear,
DataBus.VehicleSpeed);
Gear = 0;
return RequestDisengaged(absTime, dt, outTorque, outAngularVelocity, dryRun);
} }
var response = NextComponent.Request(absTime, dt, inTorque, inAngularVelocity); var response = NextComponent.Request(absTime, dt, inTorque, inAngularVelocity);
response.GearboxPowerRequest = outTorque * avgOutAngularVelocity; response.GearboxPowerRequest = outTorque * avgOutAngularVelocity;
return response; return response;
...@@ -214,8 +224,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -214,8 +224,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
/// </summary> /// </summary>
/// <param name="absTime"></param> /// <param name="absTime"></param>
/// <param name="dt"></param> /// <param name="dt"></param>
/// <param name="outTorque"></param> /// <param name="outTorque">torque at the output of the torque converter (to the mechanical gear)</param>
/// <param name="outAngularVelocity"></param> /// <param name="outAngularVelocity">angular velocity at the output of the torque converter (to the mechanical gear)</param>
/// <param name="dryRun"></param> /// <param name="dryRun"></param>
/// <returns></returns> /// <returns></returns>
private IResponse RequestTorqueConverter(Second absTime, Second dt, NewtonMeter outTorque, private IResponse RequestTorqueConverter(Second absTime, Second dt, NewtonMeter outTorque,
...@@ -225,6 +235,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -225,6 +235,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
return RequestTorqueConverterDryRun(absTime, dt, outTorque, outAngularVelocity); return RequestTorqueConverterDryRun(absTime, dt, outTorque, outAngularVelocity);
} }
var operatingPoint = FindOperatingPoint(outTorque, outAngularVelocity); var operatingPoint = FindOperatingPoint(outTorque, outAngularVelocity);
CurrentState.TorqueConverterOperatingPoint = operatingPoint;
if (!outAngularVelocity.IsEqual(operatingPoint.OutAngularVelocity) || !outTorque.IsEqual(operatingPoint.OutTorque)) { if (!outAngularVelocity.IsEqual(operatingPoint.OutAngularVelocity) || !outTorque.IsEqual(operatingPoint.OutTorque)) {
// a different operating point was found... // a different operating point was found...
var delta = (outTorque - operatingPoint.OutTorque) * var delta = (outTorque - operatingPoint.OutTorque) *
...@@ -404,6 +415,47 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -404,6 +415,47 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
container[ModalResultField.P_gbx_loss] = CurrentState.TransmissionTorqueLoss * avgInAngularSpeed; container[ModalResultField.P_gbx_loss] = CurrentState.TransmissionTorqueLoss * avgInAngularSpeed;
container[ModalResultField.P_gbx_inertia] = CurrentState.InertiaTorqueLossOut * avgInAngularSpeed; container[ModalResultField.P_gbx_inertia] = CurrentState.InertiaTorqueLossOut * avgInAngularSpeed;
container[ModalResultField.P_gbx_in] = CurrentState.InTorque * avgInAngularSpeed; container[ModalResultField.P_gbx_in] = CurrentState.InTorque * avgInAngularSpeed;
if (TorqueConverter != null) {
DoWriteTorqueConverterModalResults(container, avgInAngularSpeed);
}
}
private void DoWriteTorqueConverterModalResults(IModalDataContainer container, PerSecond avgInAngularSpeed)
{
if (CurrentState.TorqueConverterOperatingPoint == null) {
container[ModalResultField.TorqueConverterTorqueRatio] = 1.0;
container[ModalResultField.TorqueConverterSpeedRatio] = 1.0;
container[ModalResultField.TC_TorqueIn] = CurrentState.InTorque;
container[ModalResultField.TC_TorqueOut] = CurrentState.InTorque;
container[ModalResultField.TC_angularSpeedIn] = CurrentState.InAngularVelocity;
container[ModalResultField.TC_angularSpeedOut] = CurrentState.OutAngularVelocity;
container[ModalResultField.P_TC_out] = CurrentState.InTorque * avgInAngularSpeed;
container[ModalResultField.P_TC_loss] = 0.SI<Watt>();
} else {
container[ModalResultField.TorqueConverterTorqueRatio] = CurrentState.TorqueConverterOperatingPoint.TorqueRatio;
container[ModalResultField.TorqueConverterSpeedRatio] = CurrentState.TorqueConverterOperatingPoint.SpeedRatio;
container[ModalResultField.TC_TorqueIn] = CurrentState.TorqueConverterOperatingPoint.InTorque;
container[ModalResultField.TC_TorqueOut] = CurrentState.TorqueConverterOperatingPoint.OutTorque;
container[ModalResultField.TC_angularSpeedIn] = CurrentState.TorqueConverterOperatingPoint.InAngularVelocity;
container[ModalResultField.TC_angularSpeedOut] = CurrentState.TorqueConverterOperatingPoint.OutAngularVelocity;
var avgOutVelocity = ((PreviousState.TorqueConverterOperatingPoint != null
? PreviousState.TorqueConverterOperatingPoint.OutAngularVelocity
: PreviousState.InAngularVelocity) +
CurrentState.TorqueConverterOperatingPoint.OutAngularVelocity) / 2.0;
var avgInVelocity = ((PreviousState.TorqueConverterOperatingPoint != null
? PreviousState.TorqueConverterOperatingPoint.InAngularVelocity
: PreviousState.InAngularVelocity) +
CurrentState.TorqueConverterOperatingPoint.InAngularVelocity) / 2.0;
container[ModalResultField.P_TC_out] = CurrentState.OutTorque * avgOutVelocity;
container[ModalResultField.P_TC_loss] = CurrentState.InTorque * avgInVelocity -
CurrentState.OutTorque * avgOutVelocity;
}
} }
protected override void DoCommitSimulationStep() protected override void DoCommitSimulationStep()
...@@ -435,6 +487,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -435,6 +487,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
public class CycleGearboxState : GearboxState public class CycleGearboxState : GearboxState
{ {
public bool TorqueConverterActive; public bool TorqueConverterActive;
public TorqueConverterOperatingPoint TorqueConverterOperatingPoint;
} }
} }
} }
\ No newline at end of file
...@@ -228,7 +228,7 @@ namespace TUGraz.VectoCore.Utils ...@@ -228,7 +228,7 @@ namespace TUGraz.VectoCore.Utils
LogManager.DisableLogging(); LogManager.DisableLogging();
AppendDebug(debug); AppendDebug(debug);
//iterationCount += count; //iterationCount += count;
//return x1.SI<T>(); //return x1.SI<T>();
throw new VectoSearchAbortedException("InterpolateLinearSearch"); throw new VectoSearchAbortedException("InterpolateLinearSearch");
} }
...@@ -255,9 +255,10 @@ namespace TUGraz.VectoCore.Utils ...@@ -255,9 +255,10 @@ namespace TUGraz.VectoCore.Utils
} }
log.Debug("InterpolateSearch could not find an operating point."); log.Debug("InterpolateSearch could not find an operating point.");
log.Error("Exceeded max iterations when searching for operating point!"); #if DEBUG
log.Error("InterpolateSearch exceeded max iterations when searching for operating point!");
log.Error("debug: {0}", debug); log.Error("debug: {0}", debug);
#endif
WriteSearch(debug, "InterpolateSearch.csv"); WriteSearch(debug, "InterpolateSearch.csv");
throw new VectoSearchFailedException("Failed to find operating point! points: {0}", debug); throw new VectoSearchFailedException("Failed to find operating point! points: {0}", debug);
} }
......
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