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

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

driving until first stop...

parent a7bc2b2e
No related branches found
No related tags found
No related merge requests found
......@@ -46,8 +46,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
protected override void DoWriteModalResults(IModalDataWriter writer)
{
writer[ModalResultField.v_act] = (_previousState.Velocity + _currentState.Velocity) / 2;
writer[ModalResultField.dist] = (_previousState.Distance - _currentState.Distance) / 2;
writer[ModalResultField.v_act] = (_currentState.Velocity + _previousState.Velocity) / 2;
writer[ModalResultField.dist] = _previousState.Distance + (_currentState.Distance - _previousState.Distance) / 2;
}
protected override void DoCommitSimulationStep()
......@@ -60,7 +60,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
{
_currentState.Velocity = (_previousState.Velocity + (accelleration * dt)).Cast<MeterPerSecond>();
_currentState.dt = dt;
_currentState.Distance = ((_previousState.Velocity + _currentState.Velocity) / 2 * _currentState.dt).Cast<Meter>();
_currentState.Distance = _previousState.Distance +
((_previousState.Velocity + _currentState.Velocity) / 2 * _currentState.dt).Cast<Meter>();
// DriverAcceleration = vehicleAccelerationForce - RollingResistance - AirDragResistance - SlopeResistance
var vehicleAccelerationForce = DriverAcceleration(accelleration) + RollingResistance(gradient) +
......
......@@ -87,7 +87,7 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns
gbx.CurrentGear = 1;
var ds = Constants.SimulationSettings.DriveOffDistance;
while (vehicleContainer.Distance().Value() < 825) {
while (vehicleContainer.Distance().Value() < 2000) {
response = cyclePort.Request(absTime, ds);
switch (response.ResponseType) {
......@@ -98,12 +98,15 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns
}
Assert.IsInstanceOfType(response, typeof(ResponseSuccess));
vehicleContainer.CommitSimulationStep(absTime, response.SimulationInterval);
absTime += response.SimulationInterval;
ds = vehicleContainer.VehicleSpeed().IsEqual(0)
? Constants.SimulationSettings.DriveOffDistance
: (Constants.SimulationSettings.TargetTimeInterval * vehicleContainer.VehicleSpeed()).Cast<Meter>();
vehicleContainer.CommitSimulationStep(absTime, response.SimulationInterval);
absTime += response.SimulationInterval;
modalWriter.Finish();
}
modalWriter.Finish();
......
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