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

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

* commit 'f76a74e6':
  modify abstract simulation data adapter to read retarder data only if its a separate component
  gearbox: allow shortening the traction interruption interval by a small amount if the next time interval would become too small (e.g. due to inaccurate estimation of the remaining distance from the remaining time interval)
  prohibit overspeed when accelerating before braking and next timestep would get too short so we're driving along at the current speed
  add abstime to response
  better search for input data plugin
  update assembly settings
parents 5f3029fc f76a74e6
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CSV/@EntryIndexedValue">CSV</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HVAC/@EntryIndexedValue">HVAC</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MT/@EntryIndexedValue">MT</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NS/@EntryIndexedValue">NS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PT/@EntryIndexedValue">PT</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PTO/@EntryIndexedValue">PTO</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RP/@EntryIndexedValue">RP</s:String>
......
......@@ -70,17 +70,8 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
internal RetarderData SetCommonRetarderData(IRetarderInputData data)
{
try {
var retarder = new RetarderData {
SavedInDeclarationMode = data.SavedInDeclarationMode,
Vendor = data.Vendor,
ModelName = data.ModelName,
Creator = data.Creator,
Date = data.Date,
TypeId = data.TypeId,
DigestValue = data.DigestValue,
IntegrityStatus = data.IntegrityStatus,
Type = data.Type,
};
var retarder = new RetarderData { Type = data.Type };
switch (retarder.Type) {
//case RetarderType.EngineRetarder:
case RetarderType.TransmissionInputRetarder:
......@@ -98,6 +89,18 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
throw new ArgumentOutOfRangeException("retarder.Type", "RetarderType unknown");
}
if (!retarder.Type.IsDedicatedComponent()) {
return retarder;
}
retarder.SavedInDeclarationMode = data.SavedInDeclarationMode;
retarder.Vendor = data.Vendor;
retarder.ModelName = data.ModelName;
retarder.Creator = data.Creator;
retarder.Date = data.Date;
retarder.TypeId = data.TypeId;
retarder.DigestValue = data.DigestValue;
retarder.IntegrityStatus = data.IntegrityStatus;
return retarder;
} catch (Exception e) {
throw new VectoException("Error while Reading Retarder Data: {0}", e.Message);
......
......@@ -79,6 +79,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
IterationStatistics.Increment(this, "Distance", Container.Distance.Value());
IterationStatistics.Increment(this, "Time", AbsTime.Value());
IterationStatistics.FinishIteration(AbsTime);
response.AbsTime = AbsTime;
return response;
}
......
......@@ -266,9 +266,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
return coastingDistance;
}
public bool OverspeedAllowed(MeterPerSecond velocity)
public bool OverspeedAllowed(MeterPerSecond velocity, bool prohibitOverspeed = false)
{
return Driver.DriverData.OverSpeedEcoRoll.Mode == DriverMode.Overspeed && velocity > Driver.DriverData.OverSpeedEcoRoll.MinSpeed;
if (prohibitOverspeed) {
return false;
}
return Driver.DriverData.OverSpeedEcoRoll.Mode == DriverMode.Overspeed &&
velocity > Driver.DriverData.OverSpeedEcoRoll.MinSpeed;
}
}
......@@ -344,7 +348,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
if (newOperatingPoint.SimulationInterval.IsSmaller(Constants.SimulationSettings.LowerBoundTimeInterval)) {
// the next time interval will be too short, this may lead to issues with inertia etc.
// instead of accelerating, drive at constant speed.
response = DoHandleRequest(absTime, ds, Driver.DataBus.VehicleSpeed, gradient);
response = DoHandleRequest(absTime, ds, Driver.DataBus.VehicleSpeed, gradient, true);
return response;
}
Log.Debug("Exceeding next ActionDistance at {0}. Reducing max Distance from {2} to {1}",
......@@ -355,7 +359,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
};
}
protected abstract IResponse DoHandleRequest(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient);
protected abstract IResponse DoHandleRequest(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient,
bool prohibitOverspeed = false);
protected abstract IResponse CheckRequestDoesNotExceedNextAction(Second absTime, Meter ds,
MeterPerSecond targetVelocity, Radian gradient, IResponse response, out Meter newSimulationDistance);
......@@ -367,18 +372,20 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
public class DriverModeDrive : AbstractDriverMode
{
protected override IResponse DoHandleRequest(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient)
protected override IResponse DoHandleRequest(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient,
bool prohibitOverspeed = false)
{
IResponse response;
Driver.DriverBehavior = DrivingBehavior.Driving;
var velocity = targetVelocity;
if (DriverStrategy.OverspeedAllowed(targetVelocity)) {
if (DriverStrategy.OverspeedAllowed(targetVelocity, prohibitOverspeed)) {
velocity += DriverData.OverSpeedEcoRoll.OverSpeed;
}
if (DataBus.ClutchClosed(absTime)) {
// drive along
if (DriverStrategy.OverspeedAllowed(targetVelocity) && DataBus.VehicleSpeed.IsEqual(targetVelocity)) {
if (DriverStrategy.OverspeedAllowed(targetVelocity, prohibitOverspeed) &&
DataBus.VehicleSpeed.IsEqual(targetVelocity)) {
response = Driver.DrivingActionCoast(absTime, ds, velocity, gradient);
if (response is ResponseSuccess && response.Acceleration < 0) {
response = Driver.DrivingActionAccelerate(absTime, ds, targetVelocity, gradient);
......@@ -388,7 +395,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
}
response.Switch().
Case<ResponseUnderload>(r => {
if (DriverStrategy.OverspeedAllowed(targetVelocity)) {
if (DriverStrategy.OverspeedAllowed(targetVelocity, prohibitOverspeed)) {
response = Driver.DrivingActionCoast(absTime, ds, velocity, gradient);
if (response is ResponseUnderload || response is ResponseSpeedLimitExceeded) {
response = Driver.DrivingActionBrake(absTime, ds, velocity, gradient);
......@@ -488,7 +495,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
protected BrakingPhase Phase;
protected bool RetryDistanceExceeded;
protected override IResponse DoHandleRequest(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient)
protected override IResponse DoHandleRequest(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient,
bool prohibitOverspeed = false)
{
IResponse response = null;
if (DataBus.VehicleSpeed <= DriverStrategy.BrakeTrigger.NextTargetSpeed) {
......
......@@ -223,7 +223,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var shiftTimeExceeded = absTime.IsSmaller(_engageTime) &&
_engageTime.IsSmaller(absTime + dt, Constants.SimulationSettings.LowerBoundTimeInterval);
// allow 5% tolerance of shift time
if (shiftTimeExceeded) {
if (shiftTimeExceeded && (_engageTime - absTime) > Constants.SimulationSettings.LowerBoundTimeInterval/2) {
return new ResponseFailTimeInterval {
Source = this,
DeltaT = _engageTime - absTime,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment