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

new classes for measured speed mode

parent b470bc2a
Branches
Tags
No related merge requests found
...@@ -28,8 +28,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data ...@@ -28,8 +28,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
TimeBased, TimeBased,
DistanceBased, DistanceBased,
PWheel, PWheel,
MeasuredSpeedDyno, MeasuredSpeed,
MeasuredSpeedTrack MeasuredSpeedShift
} }
public class DrivingCycleData : SimulationComponentData public class DrivingCycleData : SimulationComponentData
......
...@@ -24,7 +24,6 @@ using TUGraz.VectoCore.Configuration; ...@@ -24,7 +24,6 @@ using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.Exceptions; using TUGraz.VectoCore.Exceptions;
using TUGraz.VectoCore.Models.Connector.Ports; using TUGraz.VectoCore.Models.Connector.Ports;
using TUGraz.VectoCore.Models.Connector.Ports.Impl; using TUGraz.VectoCore.Models.Connector.Ports.Impl;
using TUGraz.VectoCore.Models.Declaration;
using TUGraz.VectoCore.Models.Simulation; using TUGraz.VectoCore.Models.Simulation;
using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.Data;
using TUGraz.VectoCore.Models.Simulation.DataBus; using TUGraz.VectoCore.Models.Simulation.DataBus;
......
...@@ -257,7 +257,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -257,7 +257,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
/// <summary> /// <summary>
/// Driving Cycle for the PWheel driving cycle. /// Driving Cycle for the PWheel driving cycle.
/// </summary> /// </summary>
public class MeasuredSpeedDynoCycle : VectoSimulationComponent, IDriverInfo, IDrivingCycleInfo, IDriverDemandInProvider, public class MeasuredSpeedCycle : VectoSimulationComponent, IDriverInfo, IDrivingCycleInfo, IDriverDemandInProvider,
IDriverDemandInPort, ISimulationOutProvider, ISimulationOutPort, IClutchInfo IDriverDemandInPort, ISimulationOutProvider, ISimulationOutPort, IClutchInfo
{ {
protected DrivingCycleData Data; protected DrivingCycleData Data;
...@@ -274,7 +274,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -274,7 +274,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
/// <param name="container">The container.</param> /// <param name="container">The container.</param>
/// <param name="cycle">The cycle.</param> /// <param name="cycle">The cycle.</param>
/// <param name="gearbox">the gearbox.</param> /// <param name="gearbox">the gearbox.</param>
public MeasuredSpeedDynoCycle(IVehicleContainer container, DrivingCycleData cycle, Gearbox gearbox) public MeasuredSpeedCycle(IVehicleContainer container, DrivingCycleData cycle, Gearbox gearbox)
: base(container) : base(container)
{ {
Gearbox = gearbox; Gearbox = gearbox;
...@@ -453,32 +453,4 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -453,32 +453,4 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
return LeftSample.Current.Gear != 0; return LeftSample.Current.Gear != 0;
} }
} }
public class MeasuredSpeedTrackCycle : MeasuredSpeedDynoCycle
{
public MeasuredSpeedTrackCycle(IVehicleContainer container, DrivingCycleData cycle, Gearbox gearbox, double axleRatio,
Meter dynamicTyreRadius, PerSecond engineIdleSpeed, PerSecond ratedSpeed) : base(container, cycle, gearbox)
{
foreach (var entry in cycle.Entries) {
// working hypothesis (mk, 2016-02-11): if the engine speed is approximately idle the gearbox is disengaged => gear 0
// for approximately idling the same rule as in the clutch-slipping was used.
var engineSpeedNorm = (entry.AngularVelocity - engineIdleSpeed) / (ratedSpeed - engineIdleSpeed);
if (engineSpeedNorm < Constants.SimulationSettings.CluchNormSpeed) {
entry.Gear = 0;
continue;
}
// find the gear which matches the target speed.
// working hypothesis (mk, 2016-02-11): choose gear with smallest vehicle speed error (n is fixed, v will be approximated)
// n_engine = (v / rdyn) * ratio_axle * ratio_gear
// => v = (n_engine * rdyn) / (ratio_axle * ratio_gear)
// error = |v_target - v_calc|
// = |v_target - (n_engine * rdyn) / (ratio_axle * ratio_gear)|
entry.Gear = gearbox.Data.Gears.MinBy(
g => (entry.VehicleTargetSpeed - dynamicTyreRadius * entry.AngularVelocity / (g.Value.Ratio * axleRatio)).Abs())
.Key;
}
}
}
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment