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

Skip to content
Snippets Groups Projects
Commit 366b9643 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

measured speed: issue brakes when disengaged and overload

parent f20cc70b
No related branches found
No related tags found
No related merge requests found
......@@ -196,16 +196,45 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
response = NextComponent.Request(absTime, dt, acceleration, gradient);
})
.Case<ResponseOverload>(r => {
acceleration = SearchAlgorithm.Search(acceleration, r.Delta,
Constants.SimulationSettings.OperatingPointInitialSearchIntervalAccelerating,
getYValue: result => ((ResponseDryRun)result).DeltaFullLoad,
evaluateFunction: x => NextComponent.Request(absTime, dt, x, gradient, true),
criterion:
y => ((ResponseDryRun)y).DeltaFullLoad.Value());
Log.Info(
"Found operating point for driver acceleration. absTime: {0}, dt: {1}, acceleration: {2}, gradient: {3}",
absTime,
dt, acceleration, gradient);
if (DataBus.ClutchClosed(absTime)) {
acceleration = SearchAlgorithm.Search(acceleration, r.Delta,
Constants.SimulationSettings.OperatingPointInitialSearchIntervalAccelerating,
getYValue: result => ((ResponseDryRun)result).DeltaFullLoad,
evaluateFunction: x => NextComponent.Request(absTime, dt, x, gradient, true),
criterion:
y => ((ResponseDryRun)y).DeltaFullLoad.Value());
Log.Info(
"Found operating point for driver acceleration. absTime: {0}, dt: {1}, acceleration: {2}, gradient: {3}",
absTime,
dt, acceleration, gradient);
} else {
DataBus.BrakePower = SearchAlgorithm.Search(DataBus.BrakePower, r.Delta, -r.Delta,
getYValue: result => DataBus.ClutchClosed(absTime)
? ((ResponseDryRun)result).DeltaDragLoad
: ((ResponseDryRun)result).GearboxPowerRequest,
evaluateFunction: x => {
DataBus.BrakePower = x;
return NextComponent.Request(absTime, dt, acceleration, gradient, true);
},
criterion: y => DataBus.ClutchClosed(absTime)
? ((ResponseDryRun)y).DeltaDragLoad.Value()
: ((ResponseDryRun)y).GearboxPowerRequest.Value());
Log.Info(
"Found operating point for braking. absTime: {0}, dt: {1}, acceleration: {2}, gradient: {3}, BrakePower: {4}",
absTime, dt, acceleration, gradient, DataBus.BrakePower);
if (DataBus.BrakePower.IsSmaller(0)) {
Log.Info(
"BrakePower was negative: {4}. Setting to 0 and searching for acceleration operating point. absTime: {0}, dt: {1}, acceleration: {2}, gradient: {3}",
absTime, dt, acceleration, gradient, DataBus.BrakePower);
DataBus.BrakePower = 0.SI<Watt>();
acceleration = SearchAlgorithm.Search(acceleration, r.Delta,
Constants.SimulationSettings.OperatingPointInitialSearchIntervalAccelerating,
getYValue: result => ((ResponseDryRun)result).DeltaFullLoad,
evaluateFunction: x => NextComponent.Request(absTime, dt, x, gradient, true),
criterion: y => ((ResponseDryRun)y).DeltaFullLoad.Value());
}
}
response = NextComponent.Request(absTime, dt, acceleration, gradient);
})
.Case<ResponseFailTimeInterval>(r => { dt = r.DeltaT; })
......
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