diff --git a/VectoCore/VectoCore/Models/Simulation/DataBus/IAxlegearInfo.cs b/VectoCore/VectoCore/Models/Simulation/DataBus/IAxlegearInfo.cs new file mode 100644 index 0000000000000000000000000000000000000000..955d81583c30b912ecdc556bdfb1750ebcff88d1 --- /dev/null +++ b/VectoCore/VectoCore/Models/Simulation/DataBus/IAxlegearInfo.cs @@ -0,0 +1,9 @@ +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Models.Simulation.DataBus +{ + public interface IAxlegearInfo + { + Watt AxlegearLoss(); + } +} \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Simulation/DataBus/IDataBus.cs b/VectoCore/VectoCore/Models/Simulation/DataBus/IDataBus.cs index 3f96821e2a0b0adaee5e8d93cd85bc57c7e0a11c..cba61a715bda4b81100e53752f514b69d7107cfe 100644 --- a/VectoCore/VectoCore/Models/Simulation/DataBus/IDataBus.cs +++ b/VectoCore/VectoCore/Models/Simulation/DataBus/IDataBus.cs @@ -37,7 +37,8 @@ namespace TUGraz.VectoCore.Models.Simulation.DataBus /// <summary> /// Defines interfaces for all different cockpits to access shared data of the powertrain. /// </summary> - public interface IDataBus : IGearboxInfo, IEngineInfo, IVehicleInfo, IMileageCounter, IClutchInfo, IBrakes, + public interface IDataBus : IGearboxInfo, IAxlegearInfo, IEngineInfo, IVehicleInfo, IMileageCounter, IClutchInfo, + IBrakes, IRoadLookAhead, IDriverInfo, IDrivingCycleInfo { ExecutionMode ExecutionMode { get; set; } diff --git a/VectoCore/VectoCore/Models/Simulation/DataBus/IGearboxInfo.cs b/VectoCore/VectoCore/Models/Simulation/DataBus/IGearboxInfo.cs index a675388706bb119686f47bf9e03b20e5b1ed5be3..3de4244ed297c935526a9027278016fee838be2f 100644 --- a/VectoCore/VectoCore/Models/Simulation/DataBus/IGearboxInfo.cs +++ b/VectoCore/VectoCore/Models/Simulation/DataBus/IGearboxInfo.cs @@ -51,6 +51,6 @@ namespace TUGraz.VectoCore.Models.Simulation.DataBus FullLoadCurve GearFullLoadCurve { get; } - Watt GearboxLoss(PerSecond inAngularVelocity, NewtonMeter inTorque); + Watt GearboxLoss(); } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs b/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs index 3dd0227bf3c4774b2a56fab06eaf66d2109737ed..14d75f6d83f7054784761c5528b68376207b0d13 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs @@ -53,6 +53,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl internal IEngineInfo Engine; internal IGearboxInfo Gearbox; + internal IAxlegearInfo Axlegear; internal IVehicleInfo Vehicle; internal IBrakes Brakes; internal IDriverInfo Driver; @@ -116,9 +117,9 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl get { return Gearbox != null ? Gearbox.GearFullLoadCurve : null; } } - public Watt GearboxLoss(PerSecond inAngularVelocity, NewtonMeter inTorque) + public Watt GearboxLoss() { - return Gearbox.GearboxLoss(inAngularVelocity, inTorque); + return Gearbox.GearboxLoss(); } #endregion @@ -233,6 +234,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl Gearbox = c; commitPriority = 4; }) + .If<IAxlegearInfo>(c => Axlegear = c) .If<IVehicleInfo>(c => { Vehicle = c; commitPriority = 5; @@ -348,5 +350,10 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl { get { return DrivingCycle.Altitude; } } + + public Watt AxlegearLoss() + { + return Axlegear.AxlegearLoss(); + } } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IAxlegear.cs b/VectoCore/VectoCore/Models/SimulationComponent/IAxlegear.cs new file mode 100644 index 0000000000000000000000000000000000000000..9fbe29b51c784295c997334343454afef1b4c3fb --- /dev/null +++ b/VectoCore/VectoCore/Models/SimulationComponent/IAxlegear.cs @@ -0,0 +1,6 @@ +using TUGraz.VectoCore.Models.Simulation.DataBus; + +namespace TUGraz.VectoCore.Models.SimulationComponent +{ + public interface IAxlegear : IPowerTrainComponent, IAxlegearInfo {} +} \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AxleGear.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AxleGear.cs index f8fa67be3dcf17749bb124e6df0d555a13e97968..f8c66aa9c33af33670386b27f5c26b782ae17ac9 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AxleGear.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AxleGear.cs @@ -40,7 +40,7 @@ using TUGraz.VectoCore.OutputData; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { - public class AxleGear : StatefulVectoSimulationComponent<SimpleComponentState>, IPowerTrainComponent, ITnInPort, + public class AxleGear : StatefulVectoSimulationComponent<AxleGear.AxlegearState>, IAxlegear, ITnInPort, ITnOutPort { protected ITnOutPort NextComponent; @@ -79,6 +79,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var inTorque = torque / ModelData.AxleGear.Ratio + torqueLoss; CurrentState.SetState(inTorque, inAngularVelocity, torque, angularVelocity); + CurrentState.TransmissionTorqueLoss = torqueLoss; var retVal = NextComponent.Request(absTime, dt, inTorque, inAngularVelocity, dryRun); @@ -119,5 +120,15 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } AdvanceState(); } + + public Watt AxlegearLoss() + { + return (PreviousState.TransmissionTorqueLoss) * PreviousState.InAngularVelocity; + } + + public class AxlegearState : SimpleComponentState + { + public NewtonMeter TransmissionTorqueLoss = 0.SI<NewtonMeter>(); + } } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs index 6a32160a24a0754063f1268cc4ed39ae7c42bea7..21a091f4877d3db7f43d2a167923d80be06e4f1a 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs @@ -112,12 +112,15 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl get { return Gear == 0 ? null : ModelData.Gears[Gear].FullLoadCurve; } } - public Watt GearboxLoss(PerSecond inAngularVelocity, NewtonMeter inTorque) + public Watt GearboxLoss() { - var outTorque = ModelData.Gears[Gear].LossMap.GetOutTorque(inAngularVelocity, inTorque, true); - var torqueLoss = inTorque - outTorque * ModelData.Gears[Gear].Ratio; + //var outTorque = ModelData.Gears[Gear].LossMap.GetOutTorque(inAngularVelocity, inTorque, true); + //var torqueLoss = inTorque - outTorque * ModelData.Gears[Gear].Ratio; - return torqueLoss * inAngularVelocity; + //return torqueLoss * inAngularVelocity; + + return (PreviousState.TransmissionTorqueLoss + + PreviousState.InertiaTorqueLossOut / ModelData.Gears[PreviousState.Gear].Ratio) * PreviousState.InAngularVelocity; } #endregion diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs index c2ebce67e71082662da050ece3d13f0006acec1e..da4bd3f849ebde04a7d11af462685e78d9f91c0c 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs @@ -330,47 +330,39 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return nextBrakingAction; } - protected internal virtual Meter ComputeCoastingDistance(MeterPerSecond v_veh, + protected internal virtual Meter ComputeCoastingDistance(MeterPerSecond vehicleSpeed, DrivingCycleData.DrivingCycleEntry actionEntry) { - var v_target = OverspeedAllowed(actionEntry.RoadGradient, actionEntry.VehicleTargetSpeed) + var targetSpeed = OverspeedAllowed(actionEntry.RoadGradient, actionEntry.VehicleTargetSpeed) ? actionEntry.VehicleTargetSpeed + Driver.DriverData.OverSpeedEcoRoll.OverSpeed : actionEntry.VehicleTargetSpeed; - var m = Driver.DataBus.TotalMass; - var g = Physics.GravityAccelleration; - var h_target = actionEntry.Altitude; //dec.Altitude; + var vehicleMass = Driver.DataBus.TotalMass; + var targetAltitude = actionEntry.Altitude; //dec.Altitude; - var h_vehicle = Driver.DataBus.Altitude; + var vehicleAltitude = Driver.DataBus.Altitude; - var E_kin_veh = m * v_veh * v_veh / 2; - var E_kin_target = m * v_target * v_target / 2; - var E_pot_target = m * g * h_target; - var E_pot_veh = m * g * h_vehicle; + var targetEnergy = vehicleMass * Physics.GravityAccelleration * targetAltitude + + vehicleMass * targetSpeed * targetSpeed / 2; + var vehicleEnergy = vehicleMass * Physics.GravityAccelleration * vehicleAltitude + + vehicleMass * vehicleSpeed * vehicleSpeed / 2; - var delta_E = (E_kin_veh + E_pot_veh) - (E_kin_target + E_pot_target); + var energyDifference = vehicleEnergy - targetEnergy; - //var F_dec_average = delta_E / x_delta; + var airDragForce = Driver.DataBus.AirDragResistance(vehicleSpeed, targetSpeed); + var rollResistanceForce = Driver.DataBus.RollingResistance( + ((targetAltitude - vehicleAltitude) / (actionEntry.Distance - Driver.DataBus.Distance)).Value().SI<Radian>()); + var engineDragLoss = Driver.DataBus.EngineDragPower(Driver.DataBus.EngineSpeed); + var gearboxLoss = Driver.DataBus.GearboxLoss(); + var axleLoss = Driver.DataBus.AxlegearLoss(); - var F_air = Driver.DataBus.AirDragResistance(v_veh, v_target); - var F_roll = - Driver.DataBus.RollingResistance( - ((h_target - h_vehicle) / (actionEntry.Distance - Driver.DataBus.Distance)).Value().SI<Radian>()); - var F_enginedrag = Driver.DataBus.EngineDragPower(Driver.DataBus.EngineSpeed) / v_veh; - var F_loss_gb = Driver.DataBus.GearboxLoss(Driver.DataBus.EngineSpeed, Driver.DataBus.EngineTorque) / v_veh; + var coastingResistanceForce = airDragForce + rollResistanceForce + + (gearboxLoss + axleLoss - engineDragLoss) / vehicleSpeed; - // todo mk-2016-05-11 calculate ra loss - var F_loss_ra = 0.SI<Newton>(); - - var F_coasting = F_air + F_roll + F_loss_gb + F_loss_ra - F_enginedrag; - - //var CDP = F_dec_average / -F_coasting; - - var DF_coasting = Driver.DriverData.LookAheadCoasting.LookAheadDecisionFactor.Lookup(v_target, v_veh - v_target); - - var delta_x = (delta_E / (DF_coasting * F_coasting)).Cast<Meter>(); - - return delta_x; + var coastingDecisionFactor = Driver.DriverData.LookAheadCoasting.LookAheadDecisionFactor.Lookup(targetSpeed, + vehicleSpeed - targetSpeed); + var coastingDistance = (energyDifference / (coastingDecisionFactor * coastingResistanceForce)).Cast<Meter>(); + return coastingDistance; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs index d20b7faee1ebb223e8c7e5b24002e22e5a1932bb..e5faa54d24d94fab64da44479e28e697a51dde18 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs @@ -128,12 +128,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl get { return Gear == 0 ? null : ModelData.Gears[Gear].FullLoadCurve; } } - public Watt GearboxLoss(PerSecond inAngularVelocity, NewtonMeter inTorque) + public Watt GearboxLoss() { - var outTorque = ModelData.Gears[Gear].LossMap.GetOutTorque(inAngularVelocity, inTorque, true); - var torqueLoss = inTorque - outTorque * ModelData.Gears[Gear].Ratio; + //var outTorque = ModelData.Gears[Gear].LossMap.GetOutTorque(inAngularVelocity, inTorque, true); + //var torqueLoss = inTorque - outTorque * ModelData.Gears[Gear].Ratio; - return torqueLoss * inAngularVelocity; + //return torqueLoss * inAngularVelocity; + return (PreviousState.TransmissionTorqueLoss + + PreviousState.InertiaTorqueLossOut / ModelData.Gears[PreviousState.Gear].Ratio) * PreviousState.InAngularVelocity; } #endregion diff --git a/VectoCore/VectoCore/VectoCore.csproj b/VectoCore/VectoCore/VectoCore.csproj index 5cea0c4b85482bfd52ed426a1a5e7d9ae48c8b29..840900d9916fa723d55fd5c0519b0cedf780b7cc 100644 --- a/VectoCore/VectoCore/VectoCore.csproj +++ b/VectoCore/VectoCore/VectoCore.csproj @@ -162,6 +162,7 @@ <Compile Include="Models\SimulationComponent\Data\ICrossWindCorrection.cs" /> <Compile Include="Models\SimulationComponent\Data\CrosswindCorrectionVAirBeta.cs" /> <Compile Include="Models\SimulationComponent\IAuxiliary.cs" /> + <Compile Include="Models\SimulationComponent\IAxlegear.cs" /> <Compile Include="Models\SimulationComponent\IBrakes.cs" /> <Compile Include="Models\SimulationComponent\ICombustionEngineIdleController.cs" /> <Compile Include="Models\SimulationComponent\IDriverActions.cs" /> @@ -178,6 +179,7 @@ <Compile Include="Models\SimulationComponent\Impl\CycleClutch.cs" /> <Compile Include="Models\SimulationComponent\IShiftStrategy.cs" /> <Compile Include="Models\SimulationComponent\Impl\ShiftStrategy.cs" /> + <Compile Include="Models\Simulation\DataBus\IAxlegearInfo.cs" /> <Compile Include="Models\Simulation\DataBus\IClutchInfo.cs" /> <Compile Include="Models\Simulation\DataBus\IDriverInfo.cs" /> <Compile Include="Models\Simulation\Data\AuxiliaryDemandType.cs" /> diff --git a/VectoCore/VectoCoreTest/Models/Declaration/ShiftPolygonTest.cs b/VectoCore/VectoCoreTest/Models/Declaration/ShiftPolygonTest.cs index 8f668c1e9d525bda238a126ece0460d99b4c5eb0..99d82a1d7c4377373d27a0d2a81a1e171d11278b 100644 --- a/VectoCore/VectoCoreTest/Models/Declaration/ShiftPolygonTest.cs +++ b/VectoCore/VectoCoreTest/Models/Declaration/ShiftPolygonTest.cs @@ -377,14 +377,15 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration { //var engineFldFile = @"E:\QUAM\Downloads\EngineFLD\Map_375c_BB1390_modTUG_R49_375c_BB1386.vfld"; var engineFldFile = @"E:\QUAM\tmp\scania_fullload_shiftpolygon-test.csv"; - var gearboxFile = @"TestData\Components\40t_Long_Haul_Truck.vgbx"; + var gearboxFile = @"E:\QUAM\Downloads\TUG_dev_gbx\TUG_dev\GRS905R.vgbx"; + //@"TestData\Components\40t_Long_Haul_Truck.vgbx"; if (!File.Exists(engineFldFile)) { Assert.Inconclusive("Confidential File not found. Test cannot run without file."); } var rdyn = 0.4882675.SI<Meter>(); - var axlegearRatio = 2.31; // 3.71; //2.59; + var axlegearRatio = 3.71; //2.31; // 3.71; //2.59; var engineData = new CombustionEngineData() { IdleSpeed = 509.RPMtoRad(), diff --git a/VectoCore/VectoCoreTest/Models/Simulation/LACDecisionFactorTest.cs b/VectoCore/VectoCoreTest/Models/Simulation/LACDecisionFactorTest.cs index 39a76e1eb8d060af1f0ce003be36e237c7cc34b7..c6ff1ef7ddddbbf8a57e3a688a0bcd405472b259 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/LACDecisionFactorTest.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/LACDecisionFactorTest.cs @@ -15,15 +15,18 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation vVehicle < 100.KMPHtoMeterPerSecond(); vVehicle += 1.KMPHtoMeterPerSecond()) { for (var vTarget = vVehicle; vTarget > 0; vTarget -= 1.KMPHtoMeterPerSecond()) { - var df_coast = LACDecisionFactor.Lookup(vTarget, vVehicle - vTarget); - if (vTarget < 48.KMPHtoMeterPerSecond()) + var df_coast = new LACDecisionFactor().Lookup(vTarget, vVehicle - vTarget); + if (vTarget < 48.KMPHtoMeterPerSecond()) { AssertHelper.AreRelativeEqual(df_coast, 2.5, string.Format("vVehicle: {0}, vTarget: {1}", vVehicle, vTarget)); + } - if (vVehicle - vTarget > 11) + if (vVehicle - vTarget > 11) { AssertHelper.AreRelativeEqual(df_coast, 2.5, string.Format("vVehicle: {0}, vTarget: {1}", vVehicle, vTarget)); + } - if (vTarget > 52.KMPHtoMeterPerSecond() && vVehicle - vTarget < 9.KMPHtoMeterPerSecond()) + if (vTarget > 52.KMPHtoMeterPerSecond() && vVehicle - vTarget < 9.KMPHtoMeterPerSecond()) { AssertHelper.AreRelativeEqual(df_coast, 1.0, string.Format("vVehicle: {0}, vTarget: {1}", vVehicle, vTarget)); + } } } } diff --git a/VectoCore/VectoCoreTest/Utils/MockGearbox.cs b/VectoCore/VectoCoreTest/Utils/MockGearbox.cs index 0cd19ce42f01c16ee22a72163f005e58adb5ce5f..f4cfe8eb3542b70261d10c97e038a55ec2460f03 100644 --- a/VectoCore/VectoCoreTest/Utils/MockGearbox.cs +++ b/VectoCore/VectoCoreTest/Utils/MockGearbox.cs @@ -74,7 +74,7 @@ namespace TUGraz.VectoCore.Tests.Utils get { return null; } } - public Watt GearboxLoss(PerSecond inAngularVelocity, NewtonMeter inTorque) + public Watt GearboxLoss() { return 0.SI<Watt>(); } diff --git a/VectoCore/VectoCoreTest/Utils/MockVairVehicleContainer.cs b/VectoCore/VectoCoreTest/Utils/MockVairVehicleContainer.cs index 84df8c4615068dae534673e1d601aa98d6dcb6e6..742cf7f41b01e1543081e58f7aadf09e9f0bf57f 100644 --- a/VectoCore/VectoCoreTest/Utils/MockVairVehicleContainer.cs +++ b/VectoCore/VectoCoreTest/Utils/MockVairVehicleContainer.cs @@ -52,7 +52,7 @@ namespace TUGraz.VectoCore.Tests.Utils public MeterPerSquareSecond StartAcceleration { get; private set; } public FullLoadCurve GearFullLoadCurve { get; private set; } - public Watt GearboxLoss(PerSecond inAngularVelocity, NewtonMeter inTorque) + public Watt GearboxLoss() { throw new System.NotImplementedException(); } @@ -136,5 +136,10 @@ namespace TUGraz.VectoCore.Tests.Utils { throw new System.NotImplementedException(); } + + public Watt AxlegearLoss() + { + throw new System.NotImplementedException(); + } } } \ No newline at end of file