diff --git a/VectoCore/VectoCore/Configuration/Constants.cs b/VectoCore/VectoCore/Configuration/Constants.cs index e557706113b079004423c6d76afb963630e2cfba..f28214c356e94063905c3a1c0d2e3e8a814e92a1 100644 --- a/VectoCore/VectoCore/Configuration/Constants.cs +++ b/VectoCore/VectoCore/Configuration/Constants.cs @@ -350,5 +350,22 @@ namespace TUGraz.VectoCore.Configuration public const string VectoEngineeringInputNS = "urn:tugraz:ivt:VectoAPI:EngineeringInput:v" + XSDEngineeringVersion; } + + public static class GenericLossMapSettings + { + public const double OutputSpeedStart = 50; + public const double OutputSpeedEnd = 5000; + public const double OutputTorqueStart = 250; + public const double OutputTorqueEnd = 10000; + + public const double IAxl = 6.5; + public const double Efficiency = 0.98; + + public const double T0 = 52.5; + public const double T1 = 15; + public const double Td_n = 150; + + public const double FactorAngleDrive = 0.75; + } } } \ No newline at end of file diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterHeavyLorry.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterHeavyLorry.cs index 29073277e1d46f1a13fdbbb707fa2a1289829d37..7c75bf58486d9a03ac4729fc806d7167bdb8725e 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterHeavyLorry.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterHeavyLorry.cs @@ -274,7 +274,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter return whr; } - private static NewtonMeter VehMaxTorque( + public static NewtonMeter VehMaxTorque( ITransmissionInputData gear, int numGears, Dictionary<int, ITorqueLimitInputData> limits, NewtonMeter maxEngineTorque) @@ -290,7 +290,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter return null; } - private static NewtonMeter GbxMaxTorque( + public static NewtonMeter GbxMaxTorque( ITransmissionInputData gear, int numGears, NewtonMeter maxEngineTorque ) { diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeCompletedBusVectoRunDataFactory.cs b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeCompletedBusVectoRunDataFactory.cs index cd8ed58e478f77cb4c9fdf48354d0239d356f961..939ea08df1c16e7befaa7db8bb298428ee12f36c 100644 --- a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeCompletedBusVectoRunDataFactory.cs +++ b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeCompletedBusVectoRunDataFactory.cs @@ -9,11 +9,10 @@ using TUGraz.VectoCore.InputData.Reader.ComponentData; using TUGraz.VectoCore.InputData.Reader.DataObjectAdapter; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation.Data; -using TUGraz.VectoCore.Models.Simulation.Impl; using TUGraz.VectoCore.Models.SimulationComponent.Data; -using TUGraz.VectoCore.Models.SimulationComponent.Impl; using TUGraz.VectoCore.OutputData; + namespace TUGraz.VectoCore.InputData.Reader.Impl { public class DeclarationModeCompletedBusVectoRunDataFactory : LoggingObject, IVectoRunDataFactory @@ -36,11 +35,16 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl protected RetarderData _retarderData; protected PTOData _ptoTransmissionData; + protected CombustionEngineData _combustionEngineData; + protected PTOData _municipalPtoTransmissionData; //protected Exception InitException; protected ShiftStrategyParameters _gearshiftData; + protected IDeclarationDataAdapter DataAdapter { get; } + + protected DeclarationDataAdapterCompletedBus DataAdapterCompleted = new DeclarationDataAdapterCompletedBus(); protected DeclarationDataAdapterPrimaryBus DataAdapterPrimary = new DeclarationDataAdapterPrimaryBus(); @@ -113,8 +117,23 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl //_ptoTransmissionData = null; //_municipalPtoTransmissionData = null; - //_gearshiftData = DataAdapterCompleted.CreateGearshiftData( - //_gearboxData, _axlegearData.AxleGear.Ratio * (_angledriveData?.Angledrive.Ratio ?? 1.0), tmpEngine.IdleSpeed); + + + _combustionEngineData = DeclarationData.FactorMethodBus.CreateBusEngineData(primaryVehicle); + + _axlegearData = DeclarationData.FactorMethodBus.CreateAxlegearData(primaryVehicle.Components.AxleGearInputData); + _angledriveData = + DeclarationData.FactorMethodBus.CreateAngledriveData(primaryVehicle.Components.AngledriveInputData); + + _gearboxData = DeclarationData.FactorMethodBus.CreateGearboxData(primaryVehicle, _combustionEngineData.FullLoadCurves[0].MaxTorque); + + var torqueConverterData = DeclarationData.FactorMethodBus.CreateTorqueConverterData(_gearboxData); + _gearboxData.TorqueConverterData = torqueConverterData; + + _gearshiftData = DataAdapterPrimary.CreateGearshiftData( + _gearboxData, _axlegearData.AxleGear.Ratio * (_angledriveData?.Angledrive.Ratio ?? 1.0), _combustionEngineData.IdleSpeed); + + } protected virtual IEnumerable<VectoRunData> GetNextRun() @@ -222,12 +241,12 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl simulationRunData.Loading = loading.Key; simulationRunData.VehicleData = DataAdapterCompleted.CreateVehicleData(primaryVehicle, completedVehicle, mission, loading); simulationRunData.AirdragData = DataAdapterCompleted.CreateAirdragData(completedVehicle, mission); - //simulationRunData.EngineData = DeclarationData.FactorMethodBus.CreateBusEngineData(primaryVehicle); + simulationRunData.EngineData = _combustionEngineData; + simulationRunData.GearboxData = _gearboxData; + simulationRunData.AxleGearData = _axlegearData; + simulationRunData.AngledriveData = _angledriveData; + simulationRunData.GearshiftParameters = _gearshiftData; - - - - simulationRunData.Cycle = new DrivingCycleProxy(cycle, mission.MissionType.ToString()); @@ -283,7 +302,11 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl simulationRunData.Loading = loading.Key; simulationRunData.VehicleData = DataAdapterPrimary.CreateVehicleData(primaryVehicle, mission, loading); simulationRunData.AirdragData = DataAdapterPrimary.CreateAirdragData(null, mission, new Segment()); - //simulationRunData.EngineData = DeclarationData.FactorMethodBus.CreateBusEngineData(primaryVehicle); + simulationRunData.EngineData = _combustionEngineData; + simulationRunData.GearboxData = _gearboxData; + simulationRunData.AxleGearData = _axlegearData; + simulationRunData.AngledriveData = _angledriveData; + simulationRunData.GearshiftParameters = _gearshiftData; simulationRunData.Cycle = new DrivingCycleProxy(cycle, mission.MissionType.ToString()); diff --git a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs index 6cc992bfeee909a9e7dd7b0c4b74dcd430e23c29..121e7bb46b559518d3b973a1633cb7e286204aa1 100644 --- a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs +++ b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs @@ -43,6 +43,7 @@ using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.InputData.FileIO.JSON; using TUGraz.VectoCore.InputData.Reader.ComponentData; +using TUGraz.VectoCore.InputData.Reader.DataObjectAdapter; using TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electrics; using TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.HVAC; using TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Pneumatics; @@ -51,6 +52,7 @@ using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine; using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; using TUGraz.VectoCore.Utils; + namespace TUGraz.VectoCore.Models.Declaration { public static class DeclarationData @@ -75,8 +77,8 @@ namespace TUGraz.VectoCore.Models.Declaration public static readonly PT1 PT1 = new PT1(); public static readonly FuelData FuelData = FuelData.Instance(); public static readonly ElectricSystem ElectricSystem = new ElectricSystem(); - public static readonly Fan Fan=new Fan(); - + public static readonly Fan Fan = new Fan(); + public static readonly HeatingVentilationAirConditioning HeatingVentilationAirConditioning = new HeatingVentilationAirConditioning(); @@ -107,10 +109,13 @@ namespace TUGraz.VectoCore.Models.Declaration /// </summary> public static Kilogram GetPayloadForGrossVehicleWeight(Kilogram grossVehicleWeight, string equationName) { - if (equationName.ToLower().StartsWith("pc10")) { + if (equationName.ToLower().StartsWith("pc10")) + { return Payloads.Lookup10Percent(grossVehicleWeight); } - if (equationName.ToLower().StartsWith("pc75")) { + + if (equationName.ToLower().StartsWith("pc75")) + { return Payloads.Lookup75Percent(grossVehicleWeight); } @@ -120,13 +125,14 @@ namespace TUGraz.VectoCore.Models.Declaration /// <summary> /// Returns the payload for a trailer. This is 75% of (GVW-CurbWeight). /// </summary> - public static Kilogram GetPayloadForTrailerWeight(Kilogram grossVehicleWeight, Kilogram curbWeight, bool lowLoading) + public static Kilogram GetPayloadForTrailerWeight(Kilogram grossVehicleWeight, Kilogram curbWeight, + bool lowLoading) { return - (Math.Round( - (Payloads.LookupTrailer(grossVehicleWeight, curbWeight) / (lowLoading ? 7.5 : 1)).LimitTo( - 0.SI<Kilogram>(), - grossVehicleWeight - curbWeight).Value() / 100, 0) * 100).SI<Kilogram>(); + (Math.Round( + (Payloads.LookupTrailer(grossVehicleWeight, curbWeight) / (lowLoading ? 7.5 : 1)).LimitTo( + 0.SI<Kilogram>(), + grossVehicleWeight - curbWeight).Value() / 100, 0) * 100).SI<Kilogram>(); } public static int PoweredAxle() @@ -136,22 +142,398 @@ namespace TUGraz.VectoCore.Models.Declaration public static class FactorMethodBus { - public static CombustionEngineData CreateBusEngineData(IEngineDeclarationInputData componentsEngineInputData) + #region Constans + private static string GenericEngineCM_Normed_CI = + $"{DeclarationDataResourcePrefix}.GenericBusData.EngineConsumptionMap_CI_Normed.vmap"; + + private static string GenericEngineCM_Normed_PI = + $"{DeclarationDataResourcePrefix}.GenericBusData.EngineConsumptionMap_PI_Normed.vmap"; + + private static string GenericTorqueConvert = + $"{DeclarationDataResourcePrefix}.GenericBusData.GenericTorqueConverter.csv"; + #endregion + + + #region Create Engine Data + + public static CombustionEngineData CreateBusEngineData(IVehicleDeclarationInputData pifVehicle) + { + var enginePif = pifVehicle.Components.EngineInputData; + var gearbox = pifVehicle.Components.GearboxInputData; + + var engine = new CombustionEngineData(); + + var fullLoadCurves = new Dictionary<uint, EngineFullLoadCurve> + { + [0] = FullLoadCurveReader.Create(enginePif.EngineModes.First().FullLoadCurve, true) + }; + engine.FullLoadCurves = fullLoadCurves; + + + engine.IdleSpeed = enginePif.EngineModes[0].IdleSpeed; + engine.Displacement = enginePif.Displacement; + + //engine.Fuels ?!?!? + + var fuel = GetCombustionEngineFuelData(enginePif.EngineModes.First().Fuels.First().FuelType, + pifVehicle.DualFuelVehicle); + + + engine.WHRType = WHRType.None; + + engine.Fuels = new List<CombustionEngineFuelData> { fuel }; + + engine.Inertia = Engine.EngineInertia(engine.Displacement, gearbox.Type); + return engine; + } + + + private static CombustionEngineFuelData GetCombustionEngineFuelData(FuelType fuelType, bool isDualFuel) + { + var ressourceId = string.Empty; + + if (isDualFuel) + { + ressourceId = GenericEngineCM_Normed_CI; + } + else + { + switch (fuelType) + { + case FuelType.DieselCI: + case FuelType.EthanolCI: + case FuelType.NGCI: + ressourceId = GenericEngineCM_Normed_CI; + break; + case FuelType.EthanolPI: + case FuelType.LPGPI: + case FuelType.PetrolPI: + case FuelType.NGPI: + ressourceId = GenericEngineCM_Normed_PI; + break; + } + } + //ToDo ConsumptionMap + //var denormalizedData = DenormalizeData(ressourceId); + //var fcMap = FuelConsumptionMapReader.Create(denormalizedData); + + var fuel = new CombustionEngineFuelData + { + WHTCUrban = 1, + WHTCRural = 1, + WHTCMotorway = 1, + ColdHotCorrectionFactor = 1, + CorrectionFactorRegPer = 1, + //ConsumptionMap = fcMap + }; + + return fuel; + + } + + private static DataTable DenormalizeData(string ressourceId) + { + var nIdle = 600.0; + var nRated = 1800.0; + var mRated = 1750.0; + + var normedData = VectoCSVFile.ReadStream(RessourceHelper.ReadStream(ressourceId), source: ressourceId); + + var result = new DataTable(); + result.Columns.Add(FuelConsumptionMapReader.Fields.EngineSpeed); + result.Columns.Add(FuelConsumptionMapReader.Fields.Torque); + result.Columns.Add(FuelConsumptionMapReader.Fields.FuelConsumption); + + foreach (DataRow row in normedData.Rows) + { + var engineSpeed = DenormalizeEngineSpeed((string)row[FuelConsumptionMapReader.Fields.EngineSpeed], + nIdle, nRated); + var torque = DenormalizeTorque((string)row[FuelConsumptionMapReader.Fields.Torque], mRated); + var fc = DenormalizeFC((string)row[FuelConsumptionMapReader.Fields.FuelConsumption], mRated); + + var newRow = result.NewRow(); + newRow[FuelConsumptionMapReader.Fields.EngineSpeed] = engineSpeed; + newRow[FuelConsumptionMapReader.Fields.Torque] = torque; + newRow[FuelConsumptionMapReader.Fields.FuelConsumption] = fc; + result.Rows.Add(newRow); + } + + return result; + } + + private static double DenormalizeFC(string fc, double mRated) + { + return fc.ToDouble() * mRated; + } + + private static double DenormalizeTorque(string torque, double mRated) + { + return torque.ToDouble() * mRated; + } + + private static double DenormalizeEngineSpeed(string engineSpeed, double nIdle, double nRated) { - throw new NotImplementedException(); + return engineSpeed.ToDouble() * (nRated - nIdle) + nIdle; } + + #endregion + #region Create Axlegear Data public static AxleGearData CreateAxlegearData(IAxleGearInputData axlegearData) { - throw new NotImplementedException(); + var axleGear = new AxleGearData + { + LineType = axlegearData.LineType, + InputData = axlegearData + }; + + var outputLossMap = CreateAxlegearOutputLossMap(); + var inputLossMap = CalculateAxleInputLossMap(outputLossMap); + + var transmissionData = new TransmissionData + { + Ratio = axlegearData.Ratio, + LossMap = TransmissionLossMapReader.Create(inputLossMap, axlegearData.Ratio, "Axlegear") + }; + + axleGear.AxleGear = transmissionData; + + return axleGear; } + + private static DataTable CreateAxlegearOutputLossMap() + { + var lossMap = new DataTable(); + lossMap.Columns.Add("output speed"); + lossMap.Columns.Add("output torque"); + lossMap.Columns.Add("output torque loss"); + + var torques = new [] { + Constants.GenericLossMapSettings.OutputTorqueEnd * -1.0, + Constants.GenericLossMapSettings.OutputTorqueStart *-1.0, + Constants.GenericLossMapSettings.OutputTorqueStart, + Constants.GenericLossMapSettings.OutputTorqueEnd + }; + + var td0 = Constants.GenericLossMapSettings.T0 + + Constants.GenericLossMapSettings.IAxl * + Constants.GenericLossMapSettings.T1; + + var td0_ = td0 * 0.5; + var td150_ = td0 * 0.5; + var td_n = Constants.GenericLossMapSettings.Td_n; + var efficiency = Constants.GenericLossMapSettings.Efficiency; + + var torqueIndex = 0; + + for (int i = 0; i < 12; i++) { + var speed = 0.0; + double calculationSpeed; + double torque; + + if (i % 4 == 0) + torqueIndex = 0; + + if (i < 4) + speed = 0.0; + else if (i >= 4 && i < 8) + speed = Constants.GenericLossMapSettings.OutputSpeedStart; + else if (i >= 8 && i < 12) + speed = Constants.GenericLossMapSettings.OutputSpeedEnd; + + calculationSpeed = speed.Equals(0.0) + ? Constants.GenericLossMapSettings.OutputSpeedStart + : speed; - public static GearboxData CreateGearboxData(IGearboxDeclarationInputData gearboxData) + torque = torques[torqueIndex++]; + + var newRow = lossMap.NewRow(); + newRow[lossMap.Columns[0]] = speed; + newRow[lossMap.Columns[1]] = torque; + newRow[lossMap.Columns[2]] = + CalculateOutputTorqueLoss(td0_, td150_, td_n, calculationSpeed, torque, efficiency); + + lossMap.Rows.Add(newRow); + } + + return lossMap; + } + + private static double CalculateOutputTorqueLoss(double td0_, double td150_, double td_n, + double outputspeed, double ouputTorque, double efficiency) { - throw new NotImplementedException(); + if (ouputTorque < 0) + ouputTorque = ouputTorque * -1.0; + + return td0_+ td150_ * outputspeed/td_n + ouputTorque/ efficiency - ouputTorque; } + + private static DataTable CalculateAxleInputLossMap(DataTable outputLossMap) + { + var inputLossMap = new DataTable(); + + inputLossMap.Columns.Add(TransmissionLossMapReader.Fields.InputSpeed); + inputLossMap.Columns.Add(TransmissionLossMapReader.Fields.InputTorque); + inputLossMap.Columns.Add(TransmissionLossMapReader.Fields.TorqeLoss); + + var iAxle = Constants.GenericLossMapSettings.IAxl; + + foreach (DataRow row in outputLossMap.Rows) { + var outputSpeed = row[0].ToString().ToDouble(); + var outputTorque = row[1].ToString().ToDouble(); + var outputLoss = row[2].ToString().ToDouble(); + + var newRow = inputLossMap.NewRow(); + newRow[0] = GetInputSpeed(outputSpeed, iAxle); + newRow[1] = GetInputTorque(outputTorque, outputLoss, iAxle); + newRow[2] = GetInputTorqueLoss(outputLoss, iAxle); + inputLossMap.Rows.Add(newRow); + } + + return inputLossMap; + } + + private static double GetInputSpeed(double outputSpeed, double iAxle) + { + return outputSpeed * iAxle; + } + + private static double GetInputTorque(double outputTorque, double outputLoss, double iAxle) + { + return (outputTorque + outputLoss) / iAxle; + } + + private static double GetInputTorqueLoss(double outputLoss, double iAxle) + { + return outputLoss / iAxle; + } + + #endregion + + #region Create Angledrive Data + + public static AngledriveData CreateAngledriveData(IAngledriveInputData angledriveInputData) + { + if (angledriveInputData.DataSource.SourceFile == null) + return null; + + var angledriveData = new AngledriveData + { + Type = angledriveInputData.Type, + InputData = angledriveInputData + }; + + var axleGearOutputLossMap = CreateAxlegearOutputLossMap(); + var axleGearInputLossMap = CalculateAxleInputLossMap(axleGearOutputLossMap); + + var transmissionAngleDrive = new TransmissionData + { + Ratio = angledriveInputData.Ratio, + LossMap = GetAngleDriveLossMap(axleGearInputLossMap, angledriveInputData.Ratio) + }; + + + angledriveData.Angledrive = transmissionAngleDrive; + + return angledriveData; + } + + private static TransmissionLossMap GetAngleDriveLossMap(DataTable axleGearInputTable, double ratio) + { + var angleDriveLossMap = new DataTable(); + angleDriveLossMap.Columns.Add(TransmissionLossMapReader.Fields.InputSpeed); + angleDriveLossMap.Columns.Add(TransmissionLossMapReader.Fields.InputTorque); + angleDriveLossMap.Columns.Add(TransmissionLossMapReader.Fields.TorqeLoss); + + var angleDriveFactor = Constants.GenericLossMapSettings.FactorAngleDrive; + foreach (DataRow row in axleGearInputTable.Rows) { + var inputSpeed = row[0].ToString().ToDouble(); + var inputTorque = row[1].ToString().ToDouble(); + var inputTorqueLoss = row[2].ToString().ToDouble() * angleDriveFactor; + + var newRow = angleDriveLossMap.NewRow(); + newRow[0] = inputSpeed; + newRow[1] = inputTorque; + newRow[2] = inputTorqueLoss; + angleDriveLossMap.Rows.Add(newRow); + } + + return TransmissionLossMapReader.Create(angleDriveFactor, ratio, "AngleDrive"); + } + + #endregion + + #region Create Gearbox Data + + public static GearboxData CreateGearboxData(IVehicleDeclarationInputData pifVehicle, NewtonMeter fullLoadMaxTorque) + { + var gearbox = new GearboxData + { + Inertia = 0.SI<KilogramSquareMeter>(), + TractionInterruption = + GearBoxTypeHelper.TractionInterruption(pifVehicle.Components.GearboxInputData.Type), + Gears = GetGearData(pifVehicle.Components.GearboxInputData, + pifVehicle.TorqueLimits.ToDictionary(e => e.Gear), fullLoadMaxTorque) + }; + + return gearbox; + } + + private static Dictionary<uint, GearData> GetGearData(IGearboxDeclarationInputData gearboxData, + Dictionary<int, ITorqueLimitInputData> torqueLimits, NewtonMeter fullLoadMaxTorque) + { + var gearData = new Dictionary<uint, GearData>(); + var numberOfGears = gearboxData.Gears.Count; + var currentGearNumber = (uint)1; + + foreach (var gear in gearboxData.Gears) + { + var maxTorque = VectoMath.Min( + DeclarationDataAdapterHeavyLorry.GbxMaxTorque(gear, numberOfGears, fullLoadMaxTorque), + DeclarationDataAdapterHeavyLorry.VehMaxTorque(gear, numberOfGears, torqueLimits, fullLoadMaxTorque)); + + var currentGear = new GearData + { + Ratio = gear.Ratio, + LossMap = gear.Ratio.IsEqual(1) + ? TransmissionLossMapReader.Create(0.98, gear.Ratio, $"Gear {currentGearNumber}") + : TransmissionLossMapReader.Create(0.96, gear.Ratio, $"Gear {currentGearNumber}"), + MaxSpeed = gear.MaxInputSpeed, + MaxTorque = maxTorque + }; + + gearData.Add(currentGearNumber, currentGear); + currentGearNumber++; + } + + return gearData; + } + + #endregion + + #region Create Torque Converter Data + + public static TorqueConverterData CreateTorqueConverterData(GearboxData gearboxData) + { + var firstRatio = gearboxData.Gears.Values.First().Ratio; + var fileStream = RessourceHelper.ReadStream(GenericTorqueConvert); + + return TorqueConverterDataReader.ReadFromStream(fileStream, + 1000.RPMtoRad(), + TorqueConverter.MaxInputSpeed, + ExecutionMode.Declaration, + gearboxData.Type == GearboxType.ATSerial ? 1 : 1 / firstRatio, + Gearbox.UpshiftMinAcceleration, Gearbox.UpshiftMinAcceleration); + } + + #endregion + } + + + + public static class BusAuxiliaries { //private static ISSMInputs ssmInputs = null; @@ -467,53 +849,66 @@ namespace TUGraz.VectoCore.Models.Declaration // TODO: MQ 2019-11-26 remove, once the parameters are fixed! make fields above read-only or const static GearboxTCU() { -//#if RELEASE_CANDIDATE + //#if RELEASE_CANDIDATE var expectedFile = @"Declaration\EffShiftParameters.vtcu"; - if (!File.Exists(expectedFile)) { + if (!File.Exists(expectedFile)) + { return; } var tcuData = JSONInputDataFactory.ReadShiftParameters(expectedFile, true); - if (tcuData.RatingFactorCurrentGear.HasValue) { + if (tcuData.RatingFactorCurrentGear.HasValue) + { RatingFactorCurrentGear = tcuData.RatingFactorCurrentGear.Value; RatingFactorCurrentGearAT = tcuData.RatingFactorCurrentGear.Value; } - if (tcuData.RatioEarlyDownshiftFC.HasValue) { + if (tcuData.RatioEarlyDownshiftFC.HasValue) + { RatioEarlyDownshiftFC = tcuData.RatioEarlyDownshiftFC.Value; } - if (tcuData.RatioEarlyUpshiftFC.HasValue) { + if (tcuData.RatioEarlyUpshiftFC.HasValue) + { RatioEarlyUpshiftFC = tcuData.RatioEarlyUpshiftFC.Value; } - if (tcuData.AllowedGearRangeFC.HasValue) { + if (tcuData.AllowedGearRangeFC.HasValue) + { AllowedGearRangeFCAMT = tcuData.AllowedGearRangeFC.Value; AllowedGearRangeFCAT = tcuData.AllowedGearRangeFC.Value; } - if (tcuData.VeloictyDropFactor.HasValue) { + if (tcuData.VeloictyDropFactor.HasValue) + { VelocityDropFactor = tcuData.VeloictyDropFactor.Value; } - if (tcuData.AccelerationFactor.HasValue) { + if (tcuData.AccelerationFactor.HasValue) + { AccelerationFactor = tcuData.AccelerationFactor.Value; } - if (tcuData.ATLookAheadTime != null) { + if (tcuData.ATLookAheadTime != null) + { ATLookAheadTime = tcuData.ATLookAheadTime; } - if (tcuData.LoadStageThresholdsDown != null && LoadStageThresoldsDown.Length > 0) { + if (tcuData.LoadStageThresholdsDown != null && LoadStageThresoldsDown.Length > 0) + { LoadStageThresoldsDown = tcuData.LoadStageThresholdsDown.ToArray(); } - if (tcuData.LoadStageThresholdsUp != null && LoadStageThresholdsUp.Length > 0) { + if (tcuData.LoadStageThresholdsUp != null && LoadStageThresholdsUp.Length > 0) + { LoadStageThresholdsUp = tcuData.LoadStageThresholdsUp.ToArray(); } - if (tcuData.ShiftSpeedsTCToLocked != null && ShiftSpeedsTCToLocked.Length > 0) { + if (tcuData.ShiftSpeedsTCToLocked != null && ShiftSpeedsTCToLocked.Length > 0) + { ShiftSpeedsTCToLocked = tcuData.ShiftSpeedsTCToLocked; } - if (tcuData.MinEngineSpeedPostUpshift != null) { + if (tcuData.MinEngineSpeedPostUpshift != null) + { MinEngineSpeedPostUpshift = tcuData.MinEngineSpeedPostUpshift; } var tmp = tcuData as JSONFile; - if (tmp != null && tmp.Body["ShiftStrategy"] != null) { + if (tmp != null && tmp.Body["ShiftStrategy"] != null) + { DefaultShiftStrategy = tmp.Body["ShiftStrategy"].Value<string>(); } -//#endif + //#endif } } @@ -554,7 +949,8 @@ namespace TUGraz.VectoCore.Models.Declaration GearboxType type, int gearIdx, EngineFullLoadCurve fullLoadCurve, IList<ITransmissionInputData> gears, CombustionEngineData engine, double axlegearRatio, Meter dynamicTyreRadius) { - switch (type) { + switch (type) + { case GearboxType.AMT: //return ComputeEfficiencyShiftPolygon(gearIdx, fullLoadCurve, gears, engine, axlegearRatio, dynamicTyreRadius); @@ -579,7 +975,8 @@ namespace TUGraz.VectoCore.Models.Declaration int gearIdx, EngineFullLoadCurve fullLoadCurve, IList<ITransmissionInputData> gears, CombustionEngineData engine, double axlegearRatio, Meter dynamicTyreRadius) { - if (gears.Count < 2) { + if (gears.Count < 2) + { throw new VectoException("ComputeShiftPolygon needs at least 2 gears. {0} gears given.", gears.Count); } @@ -589,7 +986,8 @@ namespace TUGraz.VectoCore.Models.Declaration var downShift = new List<ShiftPolygon.ShiftPolygonEntry>(); - if (gearIdx > 0) { + if (gearIdx > 0) + { var downShiftPoints = fullLoadCurve .FullLoadEntries.Where(fldEntry => fldEntry.EngineSpeed >= p2.X && fldEntry.EngineSpeed <= p3.X) .Select( @@ -597,7 +995,8 @@ namespace TUGraz.VectoCore.Models.Declaration new Point(fldEntry.EngineSpeed.Value(), fldEntry.TorqueFullLoad.Value() * ShiftPolygonEngineFldMargin)) .ToList(); downShift.Add(new ShiftPolygon.ShiftPolygonEntry(fullLoadCurve.MaxDragTorque * 1.1, p2.X.SI<PerSecond>())); - if (downShiftPoints.Count == 0) { + if (downShiftPoints.Count == 0) + { // coarse grid points in FLD downShift.Add( new ShiftPolygon.ShiftPolygonEntry( @@ -607,8 +1006,11 @@ namespace TUGraz.VectoCore.Models.Declaration new ShiftPolygon.ShiftPolygonEntry( fullLoadCurve.FullLoadStationaryTorque(p3.X.SI<PerSecond>()) * ShiftPolygonEngineFldMargin, p3.X.SI<PerSecond>())); - } else { - if (downShiftPoints.Min(x => x.X) > p2.X) { + } + else + { + if (downShiftPoints.Min(x => x.X) > p2.X) + { downShift.Add( new ShiftPolygon.ShiftPolygonEntry( fullLoadCurve.FullLoadStationaryTorque(p2.X.SI<PerSecond>()) * ShiftPolygonEngineFldMargin, @@ -619,7 +1021,8 @@ namespace TUGraz.VectoCore.Models.Declaration downShiftPoints.Select( x => new ShiftPolygon.ShiftPolygonEntry( x.Y.SI<NewtonMeter>() * ShiftPolygonEngineFldMargin, x.X.SI<PerSecond>()))); - if (downShiftPoints.Max(x => x.X) < p3.X) { + if (downShiftPoints.Max(x => x.X) < p3.X) + { downShift.Add( new ShiftPolygon.ShiftPolygonEntry( fullLoadCurve.FullLoadStationaryTorque(p3.X.SI<PerSecond>()) * ShiftPolygonEngineFldMargin, @@ -629,7 +1032,8 @@ namespace TUGraz.VectoCore.Models.Declaration downShift.Add(new ShiftPolygon.ShiftPolygonEntry(fullLoadCurve.MaxTorque * 1.1, p3.X.SI<PerSecond>())); } var upShift = new List<ShiftPolygon.ShiftPolygonEntry>(); - if (gearIdx >= gears.Count - 1) { + if (gearIdx >= gears.Count - 1) + { return new ShiftPolygon(downShift, upShift); } @@ -643,7 +1047,8 @@ namespace TUGraz.VectoCore.Models.Declaration int gearIdx, EngineFullLoadCurve fullLoadCurve, IList<ITransmissionInputData> gears, CombustionEngineData engine, double axlegearRatio, Meter dynamicTyreRadius) { - if (gears.Count < 2) { + if (gears.Count < 2) + { throw new VectoException("ComputeShiftPolygon needs at least 2 gears. {0} gears given.", gears.Count); } @@ -672,7 +1077,8 @@ namespace TUGraz.VectoCore.Models.Declaration var downshiftCorr = MoveDownshiftBelowFld(Edge.Create(p6, p3), fldMargin, 1.1 * fullLoadCurve.MaxTorque); var downShift = new List<ShiftPolygon.ShiftPolygonEntry>(); - if (gearIdx > 0) { + if (gearIdx > 0) + { downShift = new[] { p2, downshiftCorr.P1, downshiftCorr.P2 }.Select( point => new ShiftPolygon.ShiftPolygonEntry(point.Y.SI<NewtonMeter>(), point.X.SI<PerSecond>())) @@ -681,7 +1087,8 @@ namespace TUGraz.VectoCore.Models.Declaration downShift[0].Torque = maxDragTorque; } var upShift = new List<ShiftPolygon.ShiftPolygonEntry>(); - if (gearIdx >= gears.Count - 1) { + if (gearIdx >= gears.Count - 1) + { return new ShiftPolygon(downShift, upShift); } @@ -698,7 +1105,8 @@ namespace TUGraz.VectoCore.Models.Declaration // ReSharper restore InconsistentNaming var upShiftPts = IntersectTakeHigherShiftLine(new[] { p4, p7, p5 }, new[] { p2p, p6p, p3pExt }); - if (gears[gearIdx].MaxInputSpeed != null) { + if (gears[gearIdx].MaxInputSpeed != null) + { var maxSpeed = gears[gearIdx].MaxInputSpeed.Value(); upShiftPts = IntersectTakeLowerShiftLine( upShiftPts, @@ -768,12 +1176,14 @@ namespace TUGraz.VectoCore.Models.Declaration // line sweeping from max_X to 0: select point with lowest Y coordinate, abort if a point has Y = 0 var shiftPolygon = new List<Point>(); - foreach (var xCoord in pointSet.Select(pt => pt.X).Distinct().OrderBy(x => x).Reverse()) { + foreach (var xCoord in pointSet.Select(pt => pt.X).Distinct().OrderBy(x => x).Reverse()) + { var coord = xCoord; var xPoints = pointSet.Where(pt => pt.X.IsEqual(coord) && !pt.Y.IsEqual(0)).ToList(); shiftPolygon.Add(xPoints.MinBy(pt => pt.Y)); var tmp = pointSet.Where(pt => pt.X.IsEqual(coord)).Where(pt => pt.Y.IsEqual(0)).ToList(); - if (!tmp.Any()) { + if (!tmp.Any()) + { continue; } @@ -783,13 +1193,16 @@ namespace TUGraz.VectoCore.Models.Declaration // find and remove colinear points var toRemove = new List<Point>(); - for (var i = 0; i < shiftPolygon.Count - 2; i++) { + for (var i = 0; i < shiftPolygon.Count - 2; i++) + { var edge = new Edge(shiftPolygon[i], shiftPolygon[i + 2]); - if (edge.ContainsXY(shiftPolygon[i + 1])) { + if (edge.ContainsXY(shiftPolygon[i + 1])) + { toRemove.Add(shiftPolygon[i + 1]); } } - foreach (var point in toRemove) { + foreach (var point in toRemove) + { shiftPolygon.Remove(point); } @@ -800,7 +1213,8 @@ namespace TUGraz.VectoCore.Models.Declaration internal static Point[] IntersectTakeLowerShiftLine(Point[] upShiftPts, Point[] upperLimit) { var intersections = Intersect(upShiftPts, upperLimit); - if (!intersections.Any()) { + if (!intersections.Any()) + { return upShiftPts[0].X < upperLimit[0].X ? upShiftPts : upperLimit; } @@ -811,20 +1225,24 @@ namespace TUGraz.VectoCore.Models.Declaration pointSet.AddRange(ProjectPointsToLineSegments(upperLimit, upShiftPts, true)); var shiftPolygon = new List<Point>(); - foreach (var yCoord in pointSet.Select(pt => pt.Y).Distinct().OrderBy(y => y).Reverse()) { + foreach (var yCoord in pointSet.Select(pt => pt.Y).Distinct().OrderBy(y => y).Reverse()) + { var yPoints = pointSet.Where(pt => pt.Y.IsEqual(yCoord)).ToList(); shiftPolygon.Add(yPoints.MinBy(pt => pt.X)); } // find and remove colinear points var toRemove = new List<Point>(); - for (var i = 0; i < shiftPolygon.Count - 2; i++) { + for (var i = 0; i < shiftPolygon.Count - 2; i++) + { var edge = new Edge(shiftPolygon[i], shiftPolygon[i + 2]); - if (edge.ContainsXY(shiftPolygon[i + 1])) { + if (edge.ContainsXY(shiftPolygon[i + 1])) + { toRemove.Add(shiftPolygon[i + 1]); } } - foreach (var point in toRemove) { + foreach (var point in toRemove) + { shiftPolygon.Remove(point); } @@ -838,11 +1256,14 @@ namespace TUGraz.VectoCore.Models.Declaration // compute all intersection points between both line segments // ReSharper disable once LoopCanBeConvertedToQuery - foreach (var origLine in orig.Pairwise(Edge.Create)) { + foreach (var origLine in orig.Pairwise(Edge.Create)) + { // ReSharper disable once LoopCanBeConvertedToQuery - foreach (var transformedLine in transformedDownshift.Pairwise(Edge.Create)) { + foreach (var transformedLine in transformedDownshift.Pairwise(Edge.Create)) + { var isect = VectoMath.Intersect(origLine, transformedLine); - if (isect != null) { + if (isect != null) + { intersections.Add(isect); } } @@ -856,9 +1277,12 @@ namespace TUGraz.VectoCore.Models.Declaration bool projectToVertical = false) { var pointSet = new List<Point>(); - foreach (var segment in lineSegments.Pairwise(Edge.Create)) { - if (segment.P1.X.IsEqual(segment.P2.X)) { - if (projectToVertical) { + foreach (var segment in lineSegments.Pairwise(Edge.Create)) + { + if (segment.P1.X.IsEqual(segment.P2.X)) + { + if (projectToVertical) + { pointSet.AddRange( points.Select(point => new Point(segment.P1.X, point.Y)) .Where(pt => pt.Y.IsBetween(segment.P1.Y, segment.P2.Y))); @@ -925,7 +1349,8 @@ namespace TUGraz.VectoCore.Models.Declaration Torque = -4 * first.Torque }, }; - foreach (var torqueConverterEntry in characteristicTorque) { + foreach (var torqueConverterEntry in characteristicTorque) + { torqueConverterEntry.SpeedRatio = torqueConverterEntry.SpeedRatio * ratio; torqueConverterEntry.TorqueRatio = torqueConverterEntry.TorqueRatio / ratio; } diff --git a/VectoCore/VectoCore/Resources/Declaration/GenericBusData/EngineConsumptionMap_CI_Normed.vmap b/VectoCore/VectoCore/Resources/Declaration/GenericBusData/EngineConsumptionMap_CI_Normed.vmap new file mode 100644 index 0000000000000000000000000000000000000000..cc23f23c78759b813d2db4160a8c5c05b2c907f5 --- /dev/null +++ b/VectoCore/VectoCore/Resources/Declaration/GenericBusData/EngineConsumptionMap_CI_Normed.vmap @@ -0,0 +1,133 @@ +engine speed,torque,fuel consumption +0,0,0.833714286 +0,0.123942857,2.022142857 +0,0.247885714,3.39252 +0,0.371828571,4.905685714 +0,0.495771429,6.119011429 +0,0.619714286,7.459428571 +0,0.743657143,8.900257143 +0,0.8676,10.34146857 +0,0.991542857,11.78267429 +0,1.115485714,13.22388571 +0,1.239428571,14.66509714 +0.124083333,0,1.012394286 +0.124083333,0.123942857,2.450154286 +0.124083333,0.247885714,4.188034286 +0.124083333,0.371828571,5.858811429 +0.124083333,0.495771429,7.551171429 +0.124083333,0.619714286,9.297765714 +0.124083333,0.743657143,11.14539429 +0.124083333,0.8676,12.98051429 +0.124083333,0.991542857,14.89544 +0.124083333,1.115485714,16.78917143 +0.124083333,1.239428571,18.68569143 +0.248166667,0,1.349228571 +0.248166667,0.123942857,3.069422857 +0.248166667,0.247885714,4.998531429 +0.248166667,0.371828571,6.868497143 +0.248166667,0.495771429,8.938565714 +0.248166667,0.619714286,11.05635429 +0.248166667,0.743657143,13.18348571 +0.248166667,0.8676,15.35103429 +0.248166667,0.991542857,17.60867429 +0.248166667,1.115485714,19.9168 +0.248166667,1.239428571,22.37433714 +0.37225,0,1.69612 +0.37225,0.123942857,3.693537143 +0.37225,0.247885714,5.772954286 +0.37225,0.371828571,7.916434286 +0.37225,0.495771429,10.32497714 +0.37225,0.619714286,12.79068571 +0.37225,0.743657143,15.16765714 +0.37225,0.8676,17.62722857 +0.37225,0.991542857,20.17409714 +0.37225,1.115485714,22.88359429 +0.37225,1.239428571,25.80726857 +0.496308333,0,1.88412 +0.496308333,0.123942857,4.109457143 +0.496308333,0.247885714,6.451142857 +0.496308333,0.371828571,8.983194286 +0.496308333,0.495771429,11.76012571 +0.496308333,0.619714286,14.56274857 +0.496308333,0.743657143,17.27015429 +0.496308333,0.8676,20.00355429 +0.496308333,0.991542857,22.87234286 +0.496308333,1.115485714,25.99822286 +0.496308333,1.239428571,29.05948571 +0.632658333,0,2.344085714 +0.632658333,0.123942857,4.720297143 +0.632658333,0.247885714,7.47568 +0.632658333,0.371828571,10.35794857 +0.632658333,0.495771429,13.28320571 +0.632658333,0.619714286,16.34954857 +0.632658333,0.743657143,19.53486286 +0.632658333,0.8676,22.72797714 +0.632658333,0.991542857,26.25164 +0.632658333,1.115485714,29.99198286 +0.632658333,1.239428571,33.34870286 +0.736666667,0,2.677051429 +0.736666667,0.123942857,5.251885714 +0.736666667,0.247885714,8.260394286 +0.736666667,0.371828571,11.38810286 +0.736666667,0.495771429,14.6036 +0.736666667,0.619714286,17.90076 +0.736666667,0.743657143,21.35075429 +0.736666667,0.8676,24.89823429 +0.736666667,0.991542857,28.83475429 +0.736666667,1.115485714,32.91686857 +0.736666667,1.239428571,36.67493714 +0.84075,0,3.006514286 +0.84075,0.123942857,5.82852 +0.84075,0.247885714,9.054965714 +0.84075,0.371828571,12.42696 +0.84075,0.495771429,16.02126286 +0.84075,0.619714286,19.56134857 +0.84075,0.743657143,23.23957143 +0.84075,0.8676,27.14198857 +0.84075,0.991542857,31.43714857 +0.84075,1.115485714,35.80281143 +0.84075,1.239428571,40.041 +0.944833333,0,3.434742857 +0.944833333,0.123942857,6.592051663 +0.944833333,0.247885714,9.988029651 +0.944833333,0.371828571,13.71403235 +0.944833333,0.495771429,17.68206855 +0.944833333,0.619714286,21.41857826 +0.944833333,0.743657143,25.49572247 +0.944833333,0.8676,29.75499887 +0.944833333,0.991542857,34.28816316 +0.944833333,1.115485714,39.00082984 +0.944833333,1.239428571,43.64633474 +1.048841667,0,4.1168628 +1.048841667,0.123942857,7.510599514 +1.048841667,0.247885714,11.05083632 +1.048841667,0.371828571,15.01283399 +1.048841667,0.495771429,19.33653626 +1.048841667,0.619714286,23.5892016 +1.048841667,0.743657143,28.03754633 +1.048841667,0.8676,32.60922662 +1.048841667,0.991542857,37.32819753 +1.048841667,1.115485714,42.21491227 +1.048841667,1.239428571,47.07674427 +1.15285,0,4.798982743 +1.15285,0.123942857,8.429147366 +1.15285,0.247885714,12.11364299 +1.15285,0.371828571,16.31163564 +1.15285,0.495771429,20.99100397 +1.15285,0.619714286,25.75982494 +1.15285,0.743657143,30.57937019 +1.15285,0.8676,35.46345438 +1.15285,0.991542857,40.3682319 +1.15285,1.115485714,45.42899471 +1.15285,1.239428571,50.5071538 +1.256858333,0,5.481102686 +1.256858333,0.123942857,9.347695217 +1.256858333,0.247885714,13.17644966 +1.256858333,0.371828571,17.61043729 +1.256858333,0.495771429,22.64547167 +1.256858333,0.619714286,27.93044827 +1.256858333,0.743657143,33.12119405 +1.256858333,0.8676,38.31768213 +1.256858333,0.991542857,43.40826627 +1.256858333,1.115485714,48.64307714 +1.256858333,1.239428571,53.93756333 \ No newline at end of file diff --git a/VectoCore/VectoCore/Resources/Declaration/GenericBusData/EngineConsumptionMap_PI_Normed.vmap b/VectoCore/VectoCore/Resources/Declaration/GenericBusData/EngineConsumptionMap_PI_Normed.vmap new file mode 100644 index 0000000000000000000000000000000000000000..85bff3d39798d4a9265ffd01422c3adb283c22b4 --- /dev/null +++ b/VectoCore/VectoCore/Resources/Declaration/GenericBusData/EngineConsumptionMap_PI_Normed.vmap @@ -0,0 +1,155 @@ +engine speed,torque,fuel consumption +-0.08,0,1.281070561 +-0.08,0.17352,4.724945985 +-0.08,0.34704,7.12113949 +-0.08,0.52056,10.26908983 +-0.08,0.69408,13.2754553 +-0.08,0.8676,14.63223437 +-0.08,1.04112,17.31655897 +-0.08,1.21464,20.00088357 +-0.08,1.38816,22.68520817 +-0.08,1.56168,25.36953277 +-0.08,1.7352,28.05385737 +0.03912,0,1.785514403 +0.03912,0.17352,5.706519778 +0.03912,0.34704,8.420120444 +0.03912,0.52056,11.93490905 +0.03912,0.69408,15.49442686 +0.03912,0.8676,17.15847024 +0.03912,1.04112,20.3719563 +0.03912,1.21464,23.58544236 +0.03912,1.38816,26.79892843 +0.03912,1.56168,30.01241449 +0.03912,1.7352,33.22590056 +0.15824,0,2.205694167 +0.15824,0.17352,6.513364853 +0.15824,0.34704,10.45224435 +0.15824,0.52056,13.8791352 +0.15824,0.69408,16.96052141 +0.15824,0.8676,20.70168531 +0.15824,1.04112,24.4303356 +0.15824,1.21464,28.15898589 +0.15824,1.38816,31.88763618 +0.15824,1.56168,35.61628647 +0.15824,1.7352,39.34493676 +0.27736,0,2.248609885 +0.27736,0.17352,7.014365499 +0.27736,0.34704,11.18511458 +0.27736,0.52056,15.50407158 +0.27736,0.69408,18.9852033 +0.27736,0.8676,22.34718274 +0.27736,1.04112,26.7306822 +0.27736,1.21464,31.08281531 +0.27736,1.38816,35.43494841 +0.27736,1.56168,39.78708152 +0.27736,1.7352,44.13921462 +0.396456,0,2.103031701 +0.396456,0.17352,7.258840382 +0.396456,0.34704,11.65905911 +0.396456,0.52056,16.27931171 +0.396456,0.69408,20.97835005 +0.396456,0.8676,24.84639642 +0.396456,1.04112,28.39387396 +0.396456,1.21464,33.09327515 +0.396456,1.38816,37.79267633 +0.396456,1.56168,42.49207752 +0.396456,1.7352,47.19147871 +0.527352,0,2.471029987 +0.527352,0.17352,8.349737913 +0.527352,0.34704,13.44106853 +0.527352,0.52056,18.67999399 +0.527352,0.69408,24.11207405 +0.527352,0.8676,28.46131745 +0.527352,1.04112,32.34773468 +0.527352,1.21464,37.58074743 +0.527352,1.38816,42.81376017 +0.527352,1.56168,48.04677291 +0.527352,1.7352,53.27978566 +0.6272,0,2.889261833 +0.6272,0.17352,9.306087584 +0.6272,0.34704,14.89838527 +0.6272,0.52056,20.61579076 +0.6272,0.69408,26.65037247 +0.6272,0.8676,31.28839855 +0.6272,1.04112,35.39006764 +0.6272,1.21464,40.9884729 +0.6272,1.38816,46.58687815 +0.6272,1.56168,52.18528341 +0.6272,1.7352,57.78368866 +0.72712,0,3.246398557 +0.72712,0.17352,10.34201941 +0.72712,0.34704,16.46032694 +0.72712,0.52056,22.70891512 +0.72712,0.69408,29.35895087 +0.72712,0.8676,34.56642073 +0.72712,1.04112,38.99393332 +0.72712,1.21464,45.12686003 +0.72712,1.38816,51.25978674 +0.72712,1.56168,57.39271345 +0.72712,1.7352,63.52564016 +0.82704,0,3.721472295 +0.82704,0.17352,11.38474213 +0.82704,0.34704,17.98675799 +0.82704,0.52056,24.8752689 +0.82704,0.69408,32.01254743 +0.82704,0.8676,37.51079387 +0.82704,1.04112,42.34495891 +0.82704,1.21464,48.97198642 +0.82704,1.38816,55.59901392 +0.82704,1.56168,62.22604142 +0.82704,1.7352,68.85306893 +0.926888,0,4.502697002 +0.926888,0.17352,12.56627192 +0.926888,0.34704,19.68422557 +0.926888,0.52056,27.10351372 +0.926888,0.69408,34.53788245 +0.926888,0.8676,40.22106557 +0.926888,1.04112,45.38305504 +0.926888,1.21464,52.49376383 +0.926888,1.38816,59.60447263 +0.926888,1.56168,66.71518142 +0.926888,1.7352,73.82589021 +1.026808,0,5.28392171 +1.026808,0.17352,13.74780171 +1.026808,0.34704,21.38169315 +1.026808,0.52056,29.33175853 +1.026808,0.69408,37.06321748 +1.026808,0.8676,42.93133727 +1.026808,1.04112,48.42115117 +1.026808,1.21464,56.01554125 +1.026808,1.38816,63.60993134 +1.026808,1.56168,71.20432142 +1.026808,1.7352,78.7987115 +1.126728,0,6.065146418 +1.126728,0.17352,14.92933149 +1.126728,0.34704,23.07916074 +1.126728,0.52056,31.56000335 +1.126728,0.69408,39.58855251 +1.126728,0.8676,45.64160896 +1.126728,1.04112,51.4592473 +1.126728,1.21464,59.53731867 +1.126728,1.38816,67.61539004 +1.126728,1.56168,75.69346142 +1.126728,1.7352,83.77153279 +1.226648,0,6.089397149 +1.226648,0.17352,16.10735921 +1.226648,0.34704,25.06638993 +1.226648,0.52056,34.69587946 +1.226648,0.69408,43.26828054 +1.226648,0.8676,48.01774094 +1.226648,1.04112,56.06951404 +1.226648,1.21464,63.05909609 +1.226648,1.38816,71.62084875 +1.226648,1.56168,80.18260141 +1.226648,1.7352,88.74435408 +1.326568,0,7.828693432 +1.326568,0.17352,17.20854332 +1.326568,0.34704,27.01598305 +1.326568,0.52056,36.85856845 +1.326568,0.69408,43.22300046 +1.326568,0.8676,50.64725607 +1.326568,1.04112,67.5775586 +1.326568,1.21464,72.63368019 +1.326568,1.38816,82.50142632 +1.326568,1.56168,92.36917245 +1.326568,1.7352,102.2369186 \ No newline at end of file diff --git a/VectoCore/VectoCore/Resources/Declaration/GenericBusData/GenericTorqueConverter.csv b/VectoCore/VectoCore/Resources/Declaration/GenericBusData/GenericTorqueConverter.csv new file mode 100644 index 0000000000000000000000000000000000000000..cfa4cc5cc7d2f571bcfbcf5dc84833b78dac69a9 --- /dev/null +++ b/VectoCore/VectoCore/Resources/Declaration/GenericBusData/GenericTorqueConverter.csv @@ -0,0 +1,42 @@ +Speed Ratio, Torque Ratio, MP1000 +1,0.999,0 +1.1,0.998,-103 +1.2,0.997,-172 +1.3,0.996,-229 +1.4,0.995,-286 +1.5,0.994,-346 +1.6,0.993,-407 +1.7,0.992,-460 +1.8,0.991,-546 +1.9,0.99,-616 +2,0.989,-685 +2.1,0.988,-753 +2.2,0.987,-820 +2.3,0.986,-886 +2.4,0.985,-951 +2.5,0.984,-1015 +2.6,0.983,-1078 +2.7,0.982,-1140 +2.8,0.981,-1201 +2.9,0.98,-1261 +3,0.979,-1320 +3.1,0.978,-1378 +3.2,0.977,-1435 +3.3,0.976,-1491 +3.4,0.975,-1546 +3.5,0.974,-1500 +3.6,0.973,-1653 +3.7,0.972,-1705 +3.8,0.971,-1756 +3.9,0.97,-1806 +4,0.969,-1855 +4.1,0.968,-1903 +4.2,0.967,-1945 +4.3,0.966,-1996 +4.4,0.965,-2041 +4.5,0.964,-2085 +4.6,0.963,-2128 +4.7,0.962,-2167 +4.8,0.961,-2211 +4.9,0.96,-2251 +5,0.959,-2290 \ No newline at end of file diff --git a/VectoCore/VectoCore/VectoCore.csproj b/VectoCore/VectoCore/VectoCore.csproj index 0daffe7f5533f19f8ea174e201e5dde1dc0098cd..122ebd80b08065037bd66b794c8f70a685621b61 100644 --- a/VectoCore/VectoCore/VectoCore.csproj +++ b/VectoCore/VectoCore/VectoCore.csproj @@ -896,6 +896,9 @@ <SubType>Designer</SubType> </EmbeddedResource> <EmbeddedResource Include="Resources\Declaration\CompletedBusSegmentationTable.csv" /> + <EmbeddedResource Include="Resources\Declaration\GenericBusData\EngineConsumptionMap_CI_Normed.vmap" /> + <EmbeddedResource Include="Resources\Declaration\GenericBusData\EngineConsumptionMap_PI_Normed.vmap" /> + <EmbeddedResource Include="Resources\Declaration\GenericBusData\GenericTorqueConverter.csv" /> <None Include="Resources\Declaration\VAUXBus\SP-AxleFactor.csv" /> <None Include="Resources\Declaration\VAUXBus\SP-Axles_Bus.csv" /> <None Include="Resources\Declaration\VAUXBus\SP-Factors_Bus.csv" /> @@ -934,6 +937,7 @@ <Name>VectoHashing</Name> </ProjectReference> </ItemGroup> + <ItemGroup /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. diff --git a/VectoCore/VectoCoreTest/Integration/CompletedBus/CompletedBusFactorMethodTest.cs b/VectoCore/VectoCoreTest/Integration/CompletedBus/CompletedBusFactorMethodTest.cs index a1f65c5b26b27b7f853843cb433e1bb4f295d796..7e0332c305f2621eb60b440258c941eded104099 100644 --- a/VectoCore/VectoCoreTest/Integration/CompletedBus/CompletedBusFactorMethodTest.cs +++ b/VectoCore/VectoCoreTest/Integration/CompletedBus/CompletedBusFactorMethodTest.cs @@ -6,17 +6,22 @@ using System.Runtime.InteropServices.WindowsRuntime; using Ninject; using Ninject.Planning.Bindings.Resolvers; using NUnit.Framework; +using TUGraz.VECTO; using TUGraz.VectoCommon.BusAuxiliaries; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.InputData.FileIO.JSON; +using TUGraz.VectoCore.InputData.Reader.ComponentData; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.Impl; using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.OutputData.FileIO; using TUGraz.VectoCore.InputData.Reader.DataObjectAdapter; +using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine; +using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Tests.Integration.CompletedBus @@ -53,7 +58,7 @@ namespace TUGraz.VectoCore.Tests.Integration.CompletedBus PrimaryBusSegment(); CompletedBusSegment(); } - + private void PrimaryBusSegment() { var category = VehicleCategory.HeavyBusPrimaryVehicle; @@ -61,7 +66,7 @@ namespace TUGraz.VectoCore.Tests.Integration.CompletedBus var floorType = FloorType.HighFloor; var articulated = false; var doubleDecker = true; - + primarySegment = DeclarationData.PrimaryBusSegments.Lookup(category, axleConfiguration, articulated, floorType, doubleDecker); } @@ -85,7 +90,8 @@ namespace TUGraz.VectoCore.Tests.Integration.CompletedBus var writer = new FileOutputWriter(Path.Combine(Path.GetDirectoryName(relativeJobPath), Path.GetFileName(relativeJobPath))); var inputData = JSONInputDataFactory.ReadJsonJob(relativeJobPath); - var factory = new SimulatorFactory(ExecutionMode.Declaration, inputData, writer) { + var factory = new SimulatorFactory(ExecutionMode.Declaration, inputData, writer) + { WriteModalResults = true, //ActualModalData = true, Validate = false @@ -100,12 +106,17 @@ namespace TUGraz.VectoCore.Tests.Integration.CompletedBus SetRelatedVehicleParts(runs); var index = 0; - for (int i = 0; i < relatedRuns.Count; i++) { + for (int i = 0; i < relatedRuns.Count; i++) + { AssertVehicleData(relatedRuns[i], ref index); AssertAirdragData(relatedRuns[i]); - //AssertEngineData(relatedRuns[i]); + AssertEngineData(relatedRuns[i]); + AssertGearbox(relatedRuns[i]); + AssertTorqueConverter(relatedRuns[i]); + AssertAxlegearData(relatedRuns[i]); + AssertAngledriveData(relatedRuns[i]); } - + } #region Vehicle Data Asserts @@ -123,7 +134,7 @@ namespace TUGraz.VectoCore.Tests.Integration.CompletedBus Assert.AreEqual(0, genericVehicleData.BodyAndTrailerMass.Value()); Assert.AreEqual(genericVehicleData.BodyAndTrailerMass, specificVehicleData.BodyAndTrailerMass); - + AssertLoading(genericVehicleData.Loading, specificVehicleData.Loading, ref index); Assert.AreEqual(0.4992, genericVehicleData.DynamicTyreRadius.Value(), 1e-0); @@ -136,13 +147,14 @@ namespace TUGraz.VectoCore.Tests.Integration.CompletedBus private void AssertLoading(Kilogram genericLoading, Kilogram specificLoading, ref int index) { - switch (index) { + switch (index) + { case 0: Assert.AreEqual(5051.2950, genericLoading.Value(), 1e-0); Assert.AreEqual(2309.4738, specificLoading.Value(), 1e-0);//lowLoading break; case 1: - Assert.AreEqual(5051.2950, genericLoading.Value(),1e-0); + Assert.AreEqual(5051.2950, genericLoading.Value(), 1e-0); Assert.AreEqual(2130, specificLoading.Value(), 1e-0); break; case 2: @@ -208,7 +220,7 @@ namespace TUGraz.VectoCore.Tests.Integration.CompletedBus { var genericAirdragData = relatedRun.VectoRunDataGenericBody.AirdragData; var specificAirdragData = relatedRun.VectoRunDataSpezificBody.AirdragData; - + var genericDragArea = 5.2.SI<SquareMeter>(); var specificDragArea = 6.34.SI<SquareMeter>(); @@ -217,12 +229,12 @@ namespace TUGraz.VectoCore.Tests.Integration.CompletedBus var genericCrosswind = GetCrosswindCorrection("CoachBus", genericDragArea, genericVehicleHeight); var specificCrosswind = GetCrosswindCorrection("CoachBus", specificDragArea, specificVehicleHeight); - + var genericValueExpected = genericCrosswind.AverageAirDragPowerLoss(20.KMPHtoMeterPerSecond(), 21.KMPHtoMeterPerSecond(), Physics.AirDensity).Value(); var currentGenericValue = genericAirdragData.CrossWindCorrectionCurve.AverageAirDragPowerLoss( - 20.KMPHtoMeterPerSecond(),21.KMPHtoMeterPerSecond(), Physics.AirDensity).Value(); + 20.KMPHtoMeterPerSecond(), 21.KMPHtoMeterPerSecond(), Physics.AirDensity).Value(); var expectedSpecificValue = specificCrosswind.AverageAirDragPowerLoss(21.KMPHtoMeterPerSecond(), 22.KMPHtoMeterPerSecond(), Physics.AirDensity).Value(); @@ -236,11 +248,11 @@ namespace TUGraz.VectoCore.Tests.Integration.CompletedBus Assert.AreEqual(genericValueExpected, currentGenericValue); Assert.AreEqual(expectedSpecificValue, currentSpecificValue); - - Assert.AreEqual(genericDragArea, genericAirdragData.DeclaredAirdragArea); + + Assert.AreEqual(genericDragArea, genericAirdragData.DeclaredAirdragArea); Assert.AreEqual(genericDragArea, genericAirdragData.CrossWindCorrectionCurve.AirDragArea); - Assert.AreEqual(specificDragArea, specificAirdragData.DeclaredAirdragArea); - Assert.AreEqual(specificDragArea, specificAirdragData.CrossWindCorrectionCurve.AirDragArea); + Assert.AreEqual(specificDragArea, specificAirdragData.DeclaredAirdragArea); + Assert.AreEqual(specificDragArea, specificAirdragData.CrossWindCorrectionCurve.AirDragArea); } @@ -253,35 +265,245 @@ namespace TUGraz.VectoCore.Tests.Integration.CompletedBus var genericEngine = relatedRun.VectoRunDataGenericBody.EngineData; var specificEngine = relatedRun.VectoRunDataSpezificBody.EngineData; - + Assert.AreEqual(1, genericEngine.FullLoadCurves.Count); + AssertFullLoadAndDragCurve(genericEngine.FullLoadCurves[0].FullLoadEntries); + AssertFullLoadAndDragCurve(specificEngine.FullLoadCurves[0].FullLoadEntries); + + Assert.AreEqual(700 * Constants.RPMToRad, genericEngine.IdleSpeed.Value(), 1e-9); + Assert.AreEqual(genericEngine.IdleSpeed, specificEngine.IdleSpeed); + + Assert.AreEqual(8.SI<CubicMeter>().Value() * 1E-6, genericEngine.Displacement.Value()); + Assert.AreEqual(genericEngine.Displacement, specificEngine.Displacement); + + Assert.AreEqual( + DeclarationData.Engine.TorqueConverterInertia + + DeclarationData.Engine.EngineBaseInertia + + DeclarationData.Engine.EngineDisplacementInertia * genericEngine.Displacement, genericEngine.Inertia); + Assert.AreEqual(genericEngine.Inertia, specificEngine.Inertia); + + Assert.AreEqual(WHRType.None, genericEngine.WHRType); + Assert.AreEqual(genericEngine.WHRType, specificEngine.WHRType); + + Assert.AreEqual(null, genericEngine.ElectricalWHR); + Assert.AreEqual(genericEngine.ElectricalWHR, specificEngine.ElectricalWHR); + + Assert.AreEqual(null, genericEngine.MechanicalWHR); + Assert.AreEqual(genericEngine.MechanicalWHR, specificEngine.MechanicalWHR); + + Assert.AreEqual(1, genericEngine.Fuels.Count); + Assert.AreEqual(genericEngine.Fuels.Count, specificEngine.Fuels.Count); + + AssertFuel(genericEngine.Fuels[0]); + AssertFuel(specificEngine.Fuels[0]); + } + + + private void AssertFullLoadAndDragCurve(List<EngineFullLoadCurve.FullLoadCurveEntry> entries) + { + Assert.AreEqual(12, entries.Count); + AssertFullLoadAndDragCurveEntry(600.00, 546.02, -39.66, entries[0]); + AssertFullLoadAndDragCurveEntry(800.00, 760.78, -48.83, entries[1]); + AssertFullLoadAndDragCurveEntry(1000.00, 973.29, -56.44, entries[2]); + AssertFullLoadAndDragCurveEntry(1200.00, 1092.03, -67.29, entries[3]); + AssertFullLoadAndDragCurveEntry(1400.00, 1092.03, -77.58, entries[4]); + AssertFullLoadAndDragCurveEntry(1600.00, 1092.03, -87.88, entries[5]); + AssertFullLoadAndDragCurveEntry(1800.00, 1022.52, -94.11, entries[6]); + AssertFullLoadAndDragCurveEntry(2000.00, 944.17, -100.76, entries[7]); + AssertFullLoadAndDragCurveEntry(2200.00, 868.12, -113.36, entries[8]); + AssertFullLoadAndDragCurveEntry(2400.00, 741.99, -122.60, entries[9]); + AssertFullLoadAndDragCurveEntry(2500.00, 647.29, -126.66, entries[10]); + AssertFullLoadAndDragCurveEntry(2600.00, 0.00, -132.07, entries[11]); + } + + private void AssertFullLoadAndDragCurveEntry(double engineSpeed, double maxTorque, double dragTorque, + EngineFullLoadCurve.FullLoadCurveEntry entry) + { + Assert.AreEqual(engineSpeed * Constants.RPMToRad, entry.EngineSpeed.Value(), 1e-9); + Assert.AreEqual(maxTorque.SI<NewtonMeter>(), entry.TorqueFullLoad); + Assert.AreEqual(dragTorque.SI<NewtonMeter>(), entry.TorqueDrag); + } + + private void AssertFuel(CombustionEngineFuelData fuel) + { + Assert.AreEqual(1, fuel.WHTCMotorway); + Assert.AreEqual(1, fuel.WHTCRural); + Assert.AreEqual(1, fuel.WHTCUrban); + Assert.AreEqual(1, fuel.ColdHotCorrectionFactor); + Assert.AreEqual(1, fuel.CorrectionFactorRegPer); + + //fuel.ConsumptionMap ??? + } + + #endregion + + #region Gearbox Asserts + + private void AssertGearbox(RelatedRun relatedRun) + { + var genericGearbox = relatedRun.VectoRunDataGenericBody.GearboxData; + var specificGearbox = relatedRun.VectoRunDataSpezificBody.GearboxData; + + Assert.AreEqual(0, genericGearbox.Inertia.Value()); + Assert.AreEqual(genericGearbox.Inertia, specificGearbox.Inertia); + + Assert.AreEqual(0.0.SI<Second>(), genericGearbox.TractionInterruption); + Assert.AreEqual(specificGearbox.TractionInterruption, genericGearbox.TractionInterruption); + + Assert.AreEqual(6, genericGearbox.Gears.Count); + Assert.AreEqual(genericGearbox.Gears.Count, specificGearbox.Gears.Count); + + AssertGearShiftParameters(relatedRun); + AssertGears(genericGearbox.Gears.Values.ToList()); + AssertGears(specificGearbox.Gears.Values.ToList()); + AssertGearsLossmap( + genericGearbox.Gears.Values.ToList(), specificGearbox.Gears.Values.ToList()); + } + + private void AssertGears(IList<GearData> gears) + { + AssertGear(3.364, 1900.SI<NewtonMeter>(), 262, gears[0]); + AssertGear(1.909, 1900.SI<NewtonMeter>(), 262, gears[1]); + AssertGear(1.421, null, 262, gears[2]); + AssertGear(1.000, null, 262, gears[3]); + AssertGear(0.720, null, 262, gears[4]); + AssertGear(0.615, null, 262, gears[5]); + } + + private void AssertGear(double ratio, NewtonMeter maxTorque, double maxSpeed, GearData gear) + { + Assert.AreEqual(ratio, gear.Ratio); + Assert.AreEqual(maxTorque, gear.MaxTorque); + Assert.AreEqual(maxSpeed, gear.MaxSpeed.AsRPM); + } + private void AssertGearsLossmap(IList<GearData> genericGearData, IList<GearData> specificGearData) + { + Assert.AreEqual(6, genericGearData.Count); + Assert.AreEqual(genericGearData.Count, specificGearData.Count); + for (int i = 0; i < genericGearData.Count; i++) { + Assert.IsNotNull(genericGearData[i].LossMap); + Assert.AreEqual(genericGearData[i].LossMap, specificGearData[i].LossMap); + } } + private void AssertGearShiftParameters(RelatedRun relatedRun) + { + Assert.AreEqual(relatedRun.VectoRunDataGenericBody.ShiftStrategy, relatedRun.VectoRunDataSpezificBody.ShiftStrategy); + } #endregion + #region Torque Converter Asserts + + private void AssertTorqueConverter(RelatedRun relatedRun) + { + var genericTorqueConverterData= relatedRun.VectoRunDataGenericBody.GearboxData.TorqueConverterData; + var specificTorqueConverterData = relatedRun.VectoRunDataSpezificBody.GearboxData.TorqueConverterData; + + Assert.AreEqual(1000.RPMtoRad(), genericTorqueConverterData.ReferenceSpeed); + Assert.AreEqual(genericTorqueConverterData.ReferenceSpeed, specificTorqueConverterData.ReferenceSpeed); + + Assert.AreEqual(DeclarationData.TorqueConverter.MaxInputSpeed, genericTorqueConverterData.TorqueConverterSpeedLimit); + Assert.AreEqual(genericTorqueConverterData.TorqueConverterSpeedLimit, specificTorqueConverterData.TorqueConverterSpeedLimit); + + Assert.AreEqual(0.1.SI<MeterPerSquareSecond>(), genericTorqueConverterData.CCUpshiftMinAcceleration); + Assert.AreEqual(0.1.SI<MeterPerSquareSecond>(), genericTorqueConverterData.CLUpshiftMinAcceleration); + + Assert.AreEqual(genericTorqueConverterData.CCUpshiftMinAcceleration, specificTorqueConverterData.CCUpshiftMinAcceleration); + Assert.AreEqual(genericTorqueConverterData.CLUpshiftMinAcceleration, specificTorqueConverterData.CLUpshiftMinAcceleration); - private CrosswindCorrectionCdxALookup GetCrosswindCorrection(string crossWindCorrectionParams, + Assert.AreEqual(genericTorqueConverterData.TorqueConverterEntries, specificTorqueConverterData.TorqueConverterEntries); + } + + + #endregion + + #region Axlegear Data Asserts + + private void AssertAxlegearData(RelatedRun relatedRun) + { + var genericAxlegearData = relatedRun.VectoRunDataGenericBody.AxleGearData; + var specificAxlegearData = relatedRun.VectoRunDataSpezificBody.AxleGearData; + + Assert.AreEqual(6.500, genericAxlegearData.AxleGear.Ratio); + Assert.AreEqual(genericAxlegearData.AxleGear.Ratio, specificAxlegearData.AxleGear.Ratio); + + Assert.AreEqual(AxleLineType.SinglePortalAxle, genericAxlegearData.LineType); + Assert.AreEqual(genericAxlegearData.LineType, specificAxlegearData.LineType); + + Assert.IsNotNull(genericAxlegearData.AxleGear.LossMap); + AssertAxlegearLossMap(genericAxlegearData.AxleGear.LossMap); + Assert.AreEqual(genericAxlegearData.AxleGear.LossMap, specificAxlegearData.AxleGear.LossMap); + } + + private void AssertAxlegearLossMap(TransmissionLossMap lossMap) + { + Assert.AreEqual(12, lossMap._entries.Count); + + AssertLossmapEntry(0, -1491.6797, 46.7818, lossMap._entries[0]); + AssertLossmapEntry(0, -22.2920, 16.1695, lossMap._entries[1]); + AssertLossmapEntry(0, 54.6311, 16.1695, lossMap._entries[2]); + AssertLossmapEntry(0, 1585.2433, 46.7818, lossMap._entries[3]); + AssertLossmapEntry(325, -1491.6797, 46.7818, lossMap._entries[4]); + AssertLossmapEntry(325, -22.2920, 16.1695, lossMap._entries[5]); + AssertLossmapEntry(325, 54.6311, 16.1695, lossMap._entries[6]); + AssertLossmapEntry(325, 1585.2433, 46.7818, lossMap._entries[7]); + AssertLossmapEntry(32500, -1110.9105, 427.5510, lossMap._entries[8]); + AssertLossmapEntry(32500, 358.4772, 396.9388, lossMap._entries[9]); + AssertLossmapEntry(32500, 435.4003, 396.9388, lossMap._entries[10]); + AssertLossmapEntry(32500, 1966.0126, 427.5510, lossMap._entries[11]); + + } + + private void AssertLossmapEntry(double inputSpeed, double inputTorque, double torqueLoss, + TransmissionLossMap.GearLossMapEntry entry) + { + Assert.AreEqual(inputSpeed.RPMtoRad(), entry.InputSpeed); + Assert.AreEqual(inputTorque, entry.InputTorque.Value(),1e-4); + Assert.AreEqual(torqueLoss, entry.TorqueLoss.Value(), 1e-4); + } + + #endregion + + + #region Angledrive Data Asserts + + private void AssertAngledriveData(RelatedRun relatedRun) + { + var genericAngledriveData = relatedRun.VectoRunDataGenericBody.AngledriveData; + var specificAngledriveData = relatedRun.VectoRunDataSpezificBody.AngledriveData; + + Assert.AreEqual(null, genericAngledriveData); + Assert.AreEqual(genericAngledriveData, specificAngledriveData); + } + + + #endregion + + + private CrosswindCorrectionCdxALookup GetCrosswindCorrection(string crossWindCorrectionParams, SquareMeter aerodynamicDragArea, Meter vehicleHeight) { - return new CrosswindCorrectionCdxALookup( - aerodynamicDragArea, - DeclarationDataAdapterHeavyLorry.GetDeclarationAirResistanceCurve( - crossWindCorrectionParams, - aerodynamicDragArea, - vehicleHeight), - CrossWindCorrectionMode.DeclarationModeCorrection); + return new CrosswindCorrectionCdxALookup( + aerodynamicDragArea, + DeclarationDataAdapterHeavyLorry.GetDeclarationAirResistanceCurve( + crossWindCorrectionParams, + aerodynamicDragArea, + vehicleHeight), + CrossWindCorrectionMode.DeclarationModeCorrection); } private void SetRelatedVehicleParts(List<VectoRunData> runs) { - for (int i = 0; i < runs.Count; i++) { - var relatedRun = new RelatedRun { + for (int i = 0; i < runs.Count; i++) + { + var relatedRun = new RelatedRun + { VectoRunDataSpezificBody = runs[i], - VectoRunDataGenericBody = runs[i+1] + VectoRunDataGenericBody = runs[i + 1] }; relatedRuns.Add(relatedRun); i++;