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 a6b4a69e authored by Michael KRISPER's avatar Michael KRISPER
Browse files

ComputeAcceleration: more intuitive formulas

parent bb38d661
Branches
Tags
No related merge requests found
......@@ -650,9 +650,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var currentSpeed = DataBus.VehicleSpeed;
var retVal = new OperatingPoint() { SimulationDistance = ds };
var requiredAverageSpeed = (targetVelocity + currentSpeed) / 2.0;
var requiredAcceleration =
(((targetVelocity - currentSpeed) * requiredAverageSpeed) / ds).Cast<MeterPerSquareSecond>();
// Δx = (v0+v1)/2 * Δt
// => Δt = 2*Δx/(v0+v1)
var dt = 2 * ds / (currentSpeed + targetVelocity);
// a = Δv / Δt
var requiredAcceleration = (targetVelocity - currentSpeed) / dt;
if (!limitByDriverModel) {
return ComputeTimeInterval(requiredAcceleration, ds);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment