diff --git a/HashingTool/ViewModel/HashComponentDataViewModel.cs b/HashingTool/ViewModel/HashComponentDataViewModel.cs index fe6ab69fce98ec8b63993b42e7d9e85e062db4c8..250f91d82a9cb68128329f5c3ae9f2e6f925ab99 100644 --- a/HashingTool/ViewModel/HashComponentDataViewModel.cs +++ b/HashingTool/ViewModel/HashComponentDataViewModel.cs @@ -94,8 +94,7 @@ namespace HashingTool.ViewModel private void SaveDocument() { - string filename; - var stream = IoService.SaveData(null, ".xml", "VECTO XML file|*.xml", out filename); + var stream = IoService.SaveData(null, ".xml", "VECTO XML file|*.xml", out var filename); if (stream == null) { return; } diff --git a/HashingTool/ViewModel/UserControl/XMLFileSelector.cs b/HashingTool/ViewModel/UserControl/XMLFileSelector.cs index 4db604806c8c22e4af49340ffbbc4696e3e89032..17cadc6c8c7b531b100b63dd4d889e6fad8327fb 100644 --- a/HashingTool/ViewModel/UserControl/XMLFileSelector.cs +++ b/HashingTool/ViewModel/UserControl/XMLFileSelector.cs @@ -188,9 +188,8 @@ namespace HashingTool.ViewModel.UserControl private async void BrowseXMLFile() { - string filename; try { - using (var stream = IoService.OpenFileDialog(null, ".xml", "VECTO XML file|*.xml", out filename)) { + using (var stream = IoService.OpenFileDialog(null, ".xml", "VECTO XML file|*.xml", out var filename)) { if (stream == null) { return; } diff --git a/VectoCommon/VectoCommon/Utils/EnumerableExtensionMethods.cs b/VectoCommon/VectoCommon/Utils/EnumerableExtensionMethods.cs index 91fc0e370f766495a5f96e2b0aae6654199bce5c..71ce8990d59211bd8d31b4e49ab1fc450bf5794d 100644 --- a/VectoCommon/VectoCommon/Utils/EnumerableExtensionMethods.cs +++ b/VectoCommon/VectoCommon/Utils/EnumerableExtensionMethods.cs @@ -163,8 +163,7 @@ namespace TUGraz.VectoCommon.Utils /// <example>GetSection(data => data.X < searchedX); //returns the pair where first < searchedX and second >= searchedX</example>> public static Tuple<T, T> GetSection<T>(this IEnumerable<T> self, Func<T, bool> predicate, string message = null) { - int unused; - return self.GetSection(predicate, out unused, message); + return self.GetSection(predicate, out var unused, message); } public static TSource MinBy<TSource>(this IEnumerable<TSource> source, diff --git a/VectoCore/VectoCore/InputData/Reader/ComponentData/TransmissionLossMapReader.cs b/VectoCore/VectoCore/InputData/Reader/ComponentData/TransmissionLossMapReader.cs index 148820f493d408ccec4c2639795e99b9bcfcb0f9..2ca923c591f8377561b415549ec47c662cad5903 100644 --- a/VectoCore/VectoCore/InputData/Reader/ComponentData/TransmissionLossMapReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/ComponentData/TransmissionLossMapReader.cs @@ -157,9 +157,9 @@ namespace TUGraz.VectoCore.InputData.Reader.ComponentData if (speedBucket.Value.Count < 2) { continue; } - double k, d, r; - VectoMath.LeastSquaresFitting(speedBucket.Value, x => x.InputTorque.Value(), x => x.TorqueLoss.Value(), out k, out d, - out r); + + VectoMath.LeastSquaresFitting(speedBucket.Value, x => x.InputTorque.Value(), x => x.TorqueLoss.Value(), out var k, out var d, + out var r); for (var i = 2; i <= DeclarationData.LossMapExtrapolationFactor; i++) { var inTq = i * maxTorque; diff --git a/VectoCore/VectoCore/Models/Declaration/AuxiliaryTypeHelper.cs b/VectoCore/VectoCore/Models/Declaration/AuxiliaryTypeHelper.cs index be9d3aed494da2286ae40719ff255b8e9b953a5a..4d9216c12fa3365fe27c4640996db65cb0b25541 100644 --- a/VectoCore/VectoCore/Models/Declaration/AuxiliaryTypeHelper.cs +++ b/VectoCore/VectoCore/Models/Declaration/AuxiliaryTypeHelper.cs @@ -60,8 +60,7 @@ namespace TUGraz.VectoCore.Models.Declaration public static AuxiliaryType Parse(string s) { - AuxiliaryType aux; - return StrToAux.TryGetValue(s, out aux) ? aux : AuxiliaryType.Fan; + return StrToAux.TryGetValue(s, out var aux) ? aux : AuxiliaryType.Fan; } public static AuxiliaryType ParseKey(string s) diff --git a/VectoCore/VectoCore/Models/Declaration/TruckSegments.cs b/VectoCore/VectoCore/Models/Declaration/TruckSegments.cs index 7c781379368e13e99228e850b143579510564581..623c4f7af9fc084b08b45aa13613753bbbfb8f02 100644 --- a/VectoCore/VectoCore/Models/Declaration/TruckSegments.cs +++ b/VectoCore/VectoCore/Models/Declaration/TruckSegments.cs @@ -194,10 +194,9 @@ namespace TUGraz.VectoCore.Models.Declaration var payloads = row.Field<string>(missionType.ToString()); - Kilogram refLoad, lowLoad; var weight = grossVehicleWeight; GetLoadings( - out lowLoad, out refLoad, payloads, (p, l) => GetLoading(p, weight, vehicleWeight, trailers, l), maxLoad); + out var lowLoad, out var refLoad, payloads, (p, l) => GetLoading(p, weight, vehicleWeight, trailers, l), maxLoad); var mission = new Mission { MissionType = missionType, diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs b/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs index bddcacb7b1bd208134967d46255bbed923fd45c0..3f301f8510dff97d6fc28657f4500069d2c5b1c6 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs @@ -73,9 +73,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl ModWriter = writer; Validate = validate; - int workerThreads; - int completionThreads; - ThreadPool.GetMinThreads(out workerThreads, out completionThreads); + ThreadPool.GetMinThreads(out var workerThreads, out var completionThreads); if (workerThreads < 12) { workerThreads = 12; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/CrosswindCorrectionVAirBeta.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/CrosswindCorrectionVAirBeta.cs index dfcfbfbd5e8cb52dcf256563b74681175fc1d868..0e63c8286c4c9761f33a4629698cc2180fe48e92 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/CrosswindCorrectionVAirBeta.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/CrosswindCorrectionVAirBeta.cs @@ -95,8 +95,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data if (beta > AirDragEntries.Last().Beta) { throw new VectoSimulationException("Beta / CdxA Lookup table does not cover beta={0}", beta); } - int index; - AirDragEntries.GetSection(x => x.Beta < beta, out index); + + AirDragEntries.GetSection(x => x.Beta < beta, out var index); return index + 1; } } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Clutch.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Clutch.cs index ea68172d4584fa428267deb2c4839a76a4650ace..e8a0b34f8e8d7b4a263057488dcb84ae950025d3 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Clutch.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Clutch.cs @@ -173,16 +173,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl protected virtual IResponse HandleClutchClosed(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, bool dryRun) { - NewtonMeter torqueIn; - PerSecond angularVelocityIn; - var startClutch = DataBus.VehicleInfo.VehicleStopped || !PreviousState.ClutchLoss.IsEqual(0, 1e-3) || (outAngularVelocity.IsSmaller(DataBus.EngineInfo.EngineSpeed, 1e-3) && !DataBus.EngineInfo.EngineOn); // || (PreviousState.ClutchLoss.IsEqual(0) && outAngularVelocity.IsSmaller(DataBus.EngineInfo.EngineIdleSpeed)); var slippingClutchWhenDriving = (DataBus.GearboxInfo.Gear.Gear <= 2 && DataBus.DriverInfo.DriverBehavior != DrivingBehavior.Braking); var slippingClutchDuringBraking = DataBus.GearboxInfo.Gear.Gear == 1 && DataBus.DriverInfo.DriverBehavior == DrivingBehavior.Braking && outTorque > 0 && DataBus.Brakes.BrakePower.IsEqual(0); //var slippingClutchWhenDriving = (DataBus.Gear == 1 && outTorque > 0); AddClutchLoss(outTorque, outAngularVelocity, slippingClutchWhenDriving || slippingClutchDuringBraking || startClutch || outAngularVelocity.IsEqual(0), - out torqueIn, out angularVelocityIn); + out var torqueIn, out var angularVelocityIn); Log.Debug("to Engine: torque: {0}, angularVelocity: {1}, power {2}", torqueIn, angularVelocityIn, Formulas.TorqueToPower(torqueIn, angularVelocityIn)); diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs index ad284fb5adbb12b223f18ea514aca7dfeaf2d848..219dfb35141ef596909c8f9f1266ea182019b816 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs @@ -804,8 +804,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return response; } - Meter newds; - response = CheckRequestDoesNotExceedNextAction(absTime, ds, targetVelocity, gradient, response, out newds); + response = CheckRequestDoesNotExceedNextAction(absTime, ds, targetVelocity, gradient, response, out var newds); if (ds.IsEqual(newds, 1e-3.SI<Meter>())) { return response; diff --git a/VectoCore/VectoCore/OutputData/ModalDataContainer.cs b/VectoCore/VectoCore/OutputData/ModalDataContainer.cs index 4010b4f04b0948762c980b40ce26a15cb2895b36..69b0902db8ddc8591f188e3247ca3a6c7ff6ced0 100644 --- a/VectoCore/VectoCore/OutputData/ModalDataContainer.cs +++ b/VectoCore/VectoCore/OutputData/ModalDataContainer.cs @@ -201,7 +201,6 @@ namespace TUGraz.VectoCore.OutputData return _engLine[fuel.FuelType]; } - double k, d, r; VectoMath.LeastSquaresFitting( GetValues( x => x.Field<bool>(ModalResultField.ICEOn.GetName()) @@ -209,7 +208,7 @@ namespace TUGraz.VectoCore.OutputData x.Field<SI>(ModalResultField.P_ice_fcmap.GetName()).Value(), x.Field<SI>(GetColumnName(fuel, ModalResultField.FCFinal)).Value()) : null).Where(x => x != null && x.Y > 0), - out k, out d, out r); + out var k, out var d, out var r); if (double.IsInfinity(k) || double.IsNaN(k)) { LogManager.GetLogger(typeof(ModalDataContainer).FullName).Warn("could not calculate engine correction line - k: {0}", k); k = 0; @@ -226,7 +225,6 @@ namespace TUGraz.VectoCore.OutputData } if (Data.AsEnumerable().Any(r => r.Field<SI>(ModalResultField.P_wheel_in.GetName()) != null)) { - double k, d, r; VectoMath.LeastSquaresFitting( GetValues( row => row.Field<bool>(ModalResultField.ICEOn.GetName()) @@ -234,7 +232,7 @@ namespace TUGraz.VectoCore.OutputData row.Field<SI>(ModalResultField.P_wheel_in.GetName()).Value(), row.Field<SI>(GetColumnName(fuel, ModalResultField.FCFinal)).Value()) : null) - .Where(x => x != null && x.X > 0 && x.Y > 0), out k, out d, out r); + .Where(x => x != null && x.X > 0 && x.Y > 0), out var k, out var d, out var r); if (double.IsInfinity(k) || double.IsNaN(k)) { LogManager.GetLogger(typeof(ModalDataContainer).FullName).Warn("could not calculate vehicle correction line - k: {0}", k); k = 0; diff --git a/VectoCore/VectoCore/OutputData/XML/Engineering/Factory/EngineeringWriterFactory.cs b/VectoCore/VectoCore/OutputData/XML/Engineering/Factory/EngineeringWriterFactory.cs index 2bfc8b02888a584adcd3d963ba7604cf47fc703e..a352fea41f1a211e1873e03516e48d96777e24f9 100644 --- a/VectoCore/VectoCore/OutputData/XML/Engineering/Factory/EngineeringWriterFactory.cs +++ b/VectoCore/VectoCore/OutputData/XML/Engineering/Factory/EngineeringWriterFactory.cs @@ -112,8 +112,7 @@ namespace TUGraz.VectoCore.OutputData.XML.Engineering.Factory var bindings = Kernel.GetBindings(writerType).ToArray(); if (bindings.Any()) { var mostRecent = bindings.MaxBy(b => { - double retVal; - var success = double.TryParse(b.Metadata.Name, NumberStyles.Float, CultureInfo.InvariantCulture, out retVal); + var success = double.TryParse(b.Metadata.Name, NumberStyles.Float, CultureInfo.InvariantCulture, out var retVal); return success ? retVal : -1; }).Metadata.Name; return GetEngineeringWriter(inputDataType, mostRecent, writerType, xmlEngineeringWriter); diff --git a/VectoCore/VectoCore/Utils/DataTableExtensionMethods.cs b/VectoCore/VectoCore/Utils/DataTableExtensionMethods.cs index 3df85156f273bd618f0c2965206db6d3e05cbafd..2c2813ab4a3e0a4aed9a09315e06f409caffb105 100644 --- a/VectoCore/VectoCore/Utils/DataTableExtensionMethods.cs +++ b/VectoCore/VectoCore/Utils/DataTableExtensionMethods.cs @@ -44,8 +44,7 @@ namespace TUGraz.VectoCore.Utils double defaultValue = default(double)) { if (row.Table.Columns.Contains(columnName)) { - double result; - if (double.TryParse(row.Field<string>(columnName), NumberStyles.Any, CultureInfo.InvariantCulture, out result)) { + if (double.TryParse(row.Field<string>(columnName), NumberStyles.Any, CultureInfo.InvariantCulture, out var result)) { return result; } } diff --git a/VectoCore/VectoCore/Utils/DateTimeFallbackDeserializer.cs b/VectoCore/VectoCore/Utils/DateTimeFallbackDeserializer.cs index ee28f9a92573b151b337bd5384062f2016830d13..0a88875261952993ec0782caae7f2cfa4d073f07 100644 --- a/VectoCore/VectoCore/Utils/DateTimeFallbackDeserializer.cs +++ b/VectoCore/VectoCore/Utils/DateTimeFallbackDeserializer.cs @@ -48,12 +48,11 @@ namespace TUGraz.VectoCore.Utils { public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { - DateTime dateTime; if (reader.TokenType == JsonToken.Date) { return reader.Value; } if (DateTime.TryParseExact((string)reader.Value, new[] { "d.M.yyyy HH:mm:ss", "M/d/yyyy HH:mm:ss tt" }, - CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime)) { + CultureInfo.InvariantCulture, DateTimeStyles.None, out var dateTime)) { return DateTime.SpecifyKind(dateTime, DateTimeKind.Utc); } diff --git a/VectoCore/VectoCore/Utils/DictionaryExtensionMethods.cs b/VectoCore/VectoCore/Utils/DictionaryExtensionMethods.cs index 1261eff951874662e935c8987dfbda3a63c7dc2a..c4949b7be81fa89e4b28578590344a9cc5f9063c 100644 --- a/VectoCore/VectoCore/Utils/DictionaryExtensionMethods.cs +++ b/VectoCore/VectoCore/Utils/DictionaryExtensionMethods.cs @@ -39,15 +39,13 @@ namespace TUGraz.VectoCore.Utils { public static object GetValueOrNull<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key) { - TValue value; - return dictionary.TryGetValue(key, out value) ? (object)value : DBNull.Value; + return dictionary.TryGetValue(key, out var value) ? (object)value : DBNull.Value; } public static TValue GetValueOrZero<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key) where TValue : SIBase<TValue> { - TValue value; - return dictionary.TryGetValue(key, out value) ? value : 0.SI<TValue>(); + return dictionary.TryGetValue(key, out var value) ? value : 0.SI<TValue>(); } } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Integration/BusAuxiliaries/AuxDemandTest.cs b/VectoCore/VectoCoreTest/Integration/BusAuxiliaries/AuxDemandTest.cs index 980c220ad349893a633582bf10387e7de70e2e03..3d12cc847962767a2d3940fc54865b367b7149d2 100644 --- a/VectoCore/VectoCoreTest/Integration/BusAuxiliaries/AuxDemandTest.cs +++ b/VectoCore/VectoCoreTest/Integration/BusAuxiliaries/AuxDemandTest.cs @@ -67,8 +67,7 @@ namespace TUGraz.VectoCore.Tests.Integration.BusAuxiliaries public void AuxDemandtest(double vehicleWeight, double engineSpeedRpm, double driveLinePower, double internalPower, double expectedPowerDemand) { - MockDriver driver; - var busAux = CreateBusAuxAdapterForTesting(vehicleWeight, out driver); + var busAux = CreateBusAuxAdapterForTesting(vehicleWeight, out var driver); var engineDrivelinePower = (driveLinePower * 1000).SI<Watt>(); var engineSpeed = engineSpeedRpm.RPMtoRad(); @@ -86,8 +85,7 @@ namespace TUGraz.VectoCore.Tests.Integration.BusAuxiliaries var engineSpeedRpm = 1256; var internalPower = 148; - MockDriver driver; - var busAux = CreateBusAuxAdapterForTesting(12000, out driver); + var busAux = CreateBusAuxAdapterForTesting(12000, out var driver); var engineDrivelinePower = (driveLinePower * 1000).SI<Watt>(); var engineSpeed = engineSpeedRpm.RPMtoRad(); diff --git a/VectoCore/VectoCoreTest/Integration/BusAuxiliaries/BusAdapterTest.cs b/VectoCore/VectoCoreTest/Integration/BusAuxiliaries/BusAdapterTest.cs index 235238dfcb6bd86686ba4b2b189f282ae23bf9a3..97edc78a5877fe3468dbe3a5ff2028f9f82dcb36 100644 --- a/VectoCore/VectoCoreTest/Integration/BusAuxiliaries/BusAdapterTest.cs +++ b/VectoCore/VectoCoreTest/Integration/BusAuxiliaries/BusAdapterTest.cs @@ -61,8 +61,7 @@ namespace TUGraz.VectoCore.Tests.Integration.BusAuxiliaries public void TestNoSmartAuxDuringDrive(double vehicleWeight, double engineSpeedRpm, double driveLinePower, double internalPower, double expectedPowerDemand) { - MockDriver driver; - var busAux = AuxDemandTest.CreateBusAuxAdapterForTesting(vehicleWeight, out driver); + var busAux = AuxDemandTest.CreateBusAuxAdapterForTesting(vehicleWeight, out var driver); driver.DriverBehavior = DrivingBehavior.Driving; driver.DrivingAction = DrivingAction.Accelerate; @@ -93,8 +92,7 @@ namespace TUGraz.VectoCore.Tests.Integration.BusAuxiliaries // this test is to make sure that the aux power-demand does not jump between average and smart power demand // when searching for the operating point for coasting (i.e. power demand (internal Power) is close to the motoring curve, // intependent of power demand of power train) - MockDriver driver; - var busAux = AuxDemandTest.CreateBusAuxAdapterForTesting(vehicleWeight, out driver); + var busAux = AuxDemandTest.CreateBusAuxAdapterForTesting(vehicleWeight, out var driver); driver.DriverBehavior = DrivingBehavior.Coasting; driver.DrivingAction = DrivingAction.Coast; @@ -116,8 +114,7 @@ namespace TUGraz.VectoCore.Tests.Integration.BusAuxiliaries public void TestSmartAuxDuringBrake(double vehicleWeight, double engineSpeedRpm, double driveLinePower, double internalPower, double expectedPowerDemand) { - MockDriver driver; - var busAux = AuxDemandTest.CreateBusAuxAdapterForTesting(vehicleWeight, out driver); + var busAux = AuxDemandTest.CreateBusAuxAdapterForTesting(vehicleWeight, out var driver); driver.DriverBehavior = DrivingBehavior.Braking; driver.DrivingAction = DrivingAction.Brake; @@ -135,8 +132,7 @@ namespace TUGraz.VectoCore.Tests.Integration.BusAuxiliaries TestCase(19000)] public void AuxDemandContinuityTest(double vehicleWeight) { - MockDriver driver; - var busAux = AuxDemandTest.CreateBusAuxAdapterForTesting(vehicleWeight, out driver); + var busAux = AuxDemandTest.CreateBusAuxAdapterForTesting(vehicleWeight, out var driver); driver.DriverBehavior = DrivingBehavior.Driving; diff --git a/VectoCore/VectoCoreTest/Models/Declaration/ShiftPolygonTest.cs b/VectoCore/VectoCoreTest/Models/Declaration/ShiftPolygonTest.cs index 9da5f36fb6d7333ea7538b64775604be6302f518..c6d4382d705f21cdd8d3618c384f762275637ab6 100644 --- a/VectoCore/VectoCoreTest/Models/Declaration/ShiftPolygonTest.cs +++ b/VectoCore/VectoCoreTest/Models/Declaration/ShiftPolygonTest.cs @@ -576,10 +576,9 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration shiftPolygons.Add(DeclarationData.Gearbox.ComputeShiftPolygon(GearboxType.AMT, i, fullLoadCurves[(uint)(i + 1)], gearboxData.Gears, engineData, axlegearRatio, rdyn, null)); - List<Point> tmp1, tmp2, tmp3; ShiftPolygonComparison.ComputShiftPolygonPoints(i, fullLoadCurves[(uint)(i + 1)], gearboxData.Gears, - engineData, axlegearRatio, rdyn, out tmp1, out tmp2, out tmp3); + engineData, axlegearRatio, rdyn, out var tmp1, out var tmp2, out var tmp3); upshiftOrig.Add(tmp1); downshiftTransformed.Add(tmp2); downshiftOrig.Add(tmp3); @@ -636,10 +635,9 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration shiftPolygons.Add(DeclarationData.Gearbox.ComputeShiftPolygon(GearboxType.AMT, i, fullLoadCurves[(uint)(i + 1)], gearboxData.Gears, engineData, axlegearRatio, rdyn, null)); - List<Point> tmp1, tmp2, tmp3; ShiftPolygonComparison.ComputShiftPolygonPoints(i, fullLoadCurves[(uint)(i + 1)], gearboxData.Gears, - engineData, axlegearRatio, rdyn, out tmp1, out tmp2, out tmp3); + engineData, axlegearRatio, rdyn, out var tmp1, out var tmp2, out var tmp3); upshiftOrig.Add(tmp1); downshiftTransformed.Add(tmp2); downshiftOrig.Add(tmp3); @@ -739,9 +737,8 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration DeclarationData.Gearbox.ComputeShiftPolygon(gearboxData.Type, i, fullLoadCurves[(uint)(i + 1)], gearboxData.Gears, engineData, axlegearRatio, rdyn.SI<Meter>(), null) ); - List<Point> tmp1, tmp2, tmp3; ComputShiftPolygonPoints(i, fullLoadCurves[(uint)(i + 1)], gearboxData.Gears, - engineData, axlegearRatio, rdyn.SI<Meter>(), out tmp1, out tmp2, out tmp3); + engineData, axlegearRatio, rdyn.SI<Meter>(), out var tmp1, out var tmp2, out var tmp3); upshiftOrig.Add(tmp1); downshiftTransformed.Add(tmp2); } @@ -897,9 +894,8 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration DeclarationData.Gearbox.ComputeShiftPolygon(gearboxData.Type, i, fullLoadCurves[(uint)(i + 1)], gearboxData.Gears, engineData, axlegearRatio, rdyn, null) ); - List<Point> tmp1, tmp2, tmp3; ComputShiftPolygonPoints(i, fullLoadCurves[(uint)(i + 1)], gearboxData.Gears, - engineData, axlegearRatio, rdyn, out tmp1, out tmp2, out tmp3); + engineData, axlegearRatio, rdyn, out var tmp1, out var tmp2, out var tmp3); upshiftOrig.Add(tmp1); downshiftTransformed.Add(tmp2); } diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/CombustionEngineTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/CombustionEngineTest.cs index b0c6c9d4d8351cac25c758e6cd95a77372a91016..a5c6c0c3da5393aa6efeed20604ba53025aefeb9 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/CombustionEngineTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/CombustionEngineTest.cs @@ -349,11 +349,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent [TestCase] public void EngineIdleControllerTestCoach() { - VehicleContainer container; - CombustionEngine engine; - ITnOutPort requestPort; - MockGearbox gearbox; - VehicleContainer(CoachEngine, out container, out engine, out requestPort, out gearbox); + VehicleContainer(CoachEngine, out var container, out var engine, out var requestPort, out var gearbox); var absTime = 0.SI<Second>(); var dt = Constants.SimulationSettings.TargetTimeInterval; @@ -404,11 +400,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent [TestCase] public void EngineIdleControllerTestTruck() { - VehicleContainer container; - CombustionEngine engine; - ITnOutPort requestPort; - MockGearbox gearbox; - VehicleContainer(TruckEngine, out container, out engine, out requestPort, out gearbox); + VehicleContainer(TruckEngine, out var container, out var engine, out var requestPort, out var gearbox); //var dataWriter = new ModalDataWriter("EngineIdle.vmod"); //container.DataWriter = dataWriter; @@ -458,11 +450,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent [TestCase] public void EngineIdleControllerTest2Truck() { - VehicleContainer container; - CombustionEngine engine; - ITnOutPort requestPort; - MockGearbox gearbox; - VehicleContainer(TruckEngine, out container, out engine, out requestPort, out gearbox); + VehicleContainer(TruckEngine, out var container, out var engine, out var requestPort, out var gearbox); //var dataWriter = new ModalDataWriter("EngienIdle.vmod"); //container.DataWriter = dataWriter; diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxShiftLossesTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxShiftLossesTest.cs index cf51cae361edd0889b207b6963835d6813f780f4..08dbcfdcd569eed5cea2c2cec7c32baf7502cdf1 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxShiftLossesTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxShiftLossesTest.cs @@ -86,11 +86,8 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent public void TestShiftLossComputation(double torqueDemand, uint gear, double preShiftRpm, double postShiftRpm, double expectedShiftLoss, double expectedShiftLossEnergy) { - AxleGear axleGear; - ATGearbox gbx; - CombustionEngine engine; var cycleDataStr = "0, 0, 0, 2\n100, 20, 0, 0\n1000, 50, 0, 0"; - var container = CreateVehicle(cycleDataStr, preShiftRpm, out axleGear, out gbx, out engine); + var container = CreateVehicle(cycleDataStr, preShiftRpm, out var axleGear, out var gbx, out var engine); new ATClutchInfo(container); gbx.Gear = new GearshiftPosition(gear, true); @@ -138,11 +135,8 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent public void TestSplittingShiftLossesTwoIntervals(double torqueDemand, uint gear, double preShiftRpm, double postShiftRpm, double expectedShiftLoss, double expectedShiftLossEnergy) { - AxleGear axleGear; - ATGearbox gbx; - CombustionEngine engine; var cycleDataStr = "0, 0, 0, 2\n100, 20, 0, 0\n1000, 50, 0, 0"; - var container = CreateVehicle(cycleDataStr, preShiftRpm, out axleGear, out gbx, out engine); + var container = CreateVehicle(cycleDataStr, preShiftRpm, out var axleGear, out var gbx, out var engine); var modData = new MockModalDataContainer(); gbx.Gear = new GearshiftPosition(gear, true); diff --git a/VectoCore/VectoCoreTest/Utils/VectoMathTest.cs b/VectoCore/VectoCoreTest/Utils/VectoMathTest.cs index 4b9113905dc41ad27a7b3ab3925f840f7d94253b..57988c3f48e35eded9d4456ae6c766f5ea49b714 100644 --- a/VectoCore/VectoCoreTest/Utils/VectoMathTest.cs +++ b/VectoCore/VectoCoreTest/Utils/VectoMathTest.cs @@ -140,8 +140,7 @@ namespace TUGraz.VectoCore.Tests.Utils new { X = 20, Y = 12 } }; - double k, d, r; - VectoMath.LeastSquaresFitting(entries, x => x.X, x => x.Y, out k, out d, out r); + VectoMath.LeastSquaresFitting(entries, x => x.X, x => x.Y, out var k, out var d, out var r); Assert.AreEqual(4, d, 1e-6); Assert.AreEqual(0.4, k, 1e-6); @@ -164,8 +163,7 @@ namespace TUGraz.VectoCore.Tests.Utils new { X = 11, Y = 30.55 }, }; - double k, d, r; - VectoMath.LeastSquaresFitting(entries, x => x.X, x => x.Y, out k, out d, out r); + VectoMath.LeastSquaresFitting(entries, x => x.X, x => x.Y, out var k, out var d, out var r); Assert.AreEqual(27.003529, d, 1e-6); Assert.AreEqual(0.431535, k, 1e-6);