Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit e0c5ae6e authored by Michael KRISPER's avatar Michael KRISPER
Browse files

Faster IsSmaller and IsGreater

parent b4f0cebc
No related branches found
No related tags found
No related merge requests found
......@@ -65,7 +65,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
}
if (DataBus.DriverBehavior == DrivingBehavior.Braking &&
DataBus.VehicleSpeed.IsSmaller(Constants.SimulationSettings.ATGearboxDisengageWhenHaltingSpeed) &&
outTorque.IsSmaller(0.SI<NewtonMeter>())) {
outTorque.IsSmaller(0)) {
// disengage before halting
NextGear.SetState(absTime, true, 1, false);
return true;
......
......@@ -492,7 +492,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
IResponse response = null;
if (DataBus.VehicleSpeed <= DriverStrategy.BrakeTrigger.NextTargetSpeed) {
if (DataBus.ClutchClosed(absTime)) {
if (DataBus.VehicleSpeed.IsGreater(0.SI<MeterPerSecond>())) {
if (DataBus.VehicleSpeed.IsGreater(0)) {
response = Driver.DrivingActionAccelerate(absTime, ds, DriverStrategy.BrakeTrigger.NextTargetSpeed, gradient);
} else {
if (RetryDistanceExceeded) {
......
......@@ -309,7 +309,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
// compute speed at the end of the simulation interval. if it exceeds the limit -> return
var v2 = DataBus.VehicleSpeed + limitedOperatingPoint.Acceleration * limitedOperatingPoint.SimulationInterval;
if (v2 > maxVelocity && limitedOperatingPoint.Acceleration.IsGreaterOrEqual(0.SI<MeterPerSquareSecond>())) {
if (v2 > maxVelocity && limitedOperatingPoint.Acceleration.IsGreaterOrEqual(0)) {
Log.Debug("vehicle's velocity would exceed given max speed. v2: {0}, max speed: {1}", v2, maxVelocity);
return new ResponseSpeedLimitExceeded() { Source = this };
}
......
......@@ -175,7 +175,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var engineSpeedNorm = (outAngularVelocity - DataBus.EngineIdleSpeed) /
(DataBus.EngineRatedSpeed - DataBus.EngineIdleSpeed);
if (DataBus.DriverBehavior == DrivingBehavior.Braking && DataBus.BrakePower.IsGreater(0.SI<Watt>()) &&
if (DataBus.DriverBehavior == DrivingBehavior.Braking && DataBus.BrakePower.IsGreater(0) &&
engineSpeedNorm < Constants.SimulationSettings.ClutchClosingSpeedNorm &&
DataBus.VehicleSpeed.IsSmaller(Constants.SimulationSettings.ClutchDisengageWhenHaltingSpeed)) {
_engageTime = absTime + dt;
......
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