From d36952f9a8fb925fce405b52d0165d410ab7b89e Mon Sep 17 00:00:00 2001 From: Michael Krisper <michael.krisper@tugraz.at> Date: Thu, 29 Jun 2017 16:21:25 +0200 Subject: [PATCH] Cleaned up many TODO comments and removed some commented code which is not needed anymore --- VECTO/Input Files/Vehicle.vb | 2 +- .../VectoAuxiliaries/AdvancedAuxiliaries.vb | 2 +- .../DownstreamModules/cMAP.vb | 14 +++--- .../VectoCore/Configuration/Constants.cs | 1 + .../InputData/FileIO/JSON/JSONGearboxData.cs | 2 +- .../Impl/CombustionEngine.cs | 1 - .../SimulationComponent/Impl/CycleGearbox.cs | 46 +------------------ .../Impl/DefaultDriverStrategy.cs | 1 - .../Impl/DistanceBasedDrivingCycle.cs | 4 +- .../OutputData/XML/XMLDeclarationWriter.cs | 4 +- .../XML/XMLEngineeringInputSingleTest.cs | 9 ++-- 11 files changed, 21 insertions(+), 65 deletions(-) diff --git a/VECTO/Input Files/Vehicle.vb b/VECTO/Input Files/Vehicle.vb index 980d3f7f42..a60da3c75b 100644 --- a/VECTO/Input Files/Vehicle.vb +++ b/VECTO/Input Files/Vehicle.vb @@ -290,7 +290,7 @@ Public Class Vehicle Public ReadOnly Property CertificationNumber As String Implements IComponentInputData.CertificationNumber Get - Return "N.A." 'ToDo + Return "N.A." ' Todo: MQ 20160908 End Get End Property diff --git a/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb b/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb index 47d9a7596d..47ad622181 100644 --- a/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb +++ b/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb @@ -476,7 +476,7 @@ Public Class AdvancedAuxiliaries End Property - 'TODO:REMOVE WHEN TESTING IS COMPLETE + 'TODO:REMOVE WHEN TESTING IS COMPLETE - MK2017-06-26: what should be removed? I can't see the "pure-diagnostics" 'PURE DIAGNOSTICS SHOULD ONLY BE USED IN MOD FOR ENGINEERING TESTS Public ReadOnly Property AA_D_M12_INTERP1 As Kilogram Implements IAdvancedAuxiliaries.AA_D_M12_INTERP1 diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/cMAP.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/cMAP.vb index b32e65b86b..7b8c13d27d 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/cMAP.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/cMAP.vb @@ -28,7 +28,7 @@ Public Class cMAP lFC = Nothing LTq = Nothing LnU = Nothing - iMapDim = -1 + iMapDim = - 1 FuelMap = New cDelaunayMap End Sub @@ -46,7 +46,6 @@ Public Class cMAP 'Stop if there's no file If sFilePath = "" OrElse Not IO.File.Exists(sFilePath) Then - 'If ShowMsg Then WorkerMsg(tMsgID.Err, "Map file not found! (" & sFilePath & ")", MsgSrc) Return False End If @@ -54,7 +53,6 @@ Public Class cMAP file = New cFile_V3 If Not file.OpenRead(sFilePath) Then file = Nothing - 'TODO:WORKERMESSAGE If ShowMsg Then WorkerMsg(tMsgID.Err, "Failed to open file (" & sFilePath & ") !", MsgSrc) Return False End If @@ -87,7 +85,7 @@ Public Class cMAP 'Check sign If CSng(line(2)) < 0 Then file.Close() - 'TODO:WORKERMESSAGEIf ShowMsg Then WorkerMsg(tMsgID.Err, "FC < 0 in map at " & nU & " [1/min], " & line(1) & " [Nm]", MsgSrc) + Return False End If @@ -97,7 +95,7 @@ Public Class cMAP Loop Catch ex As Exception - 'TODO:WORKERMESSAGE If ShowMsg Then WorkerMsg(tMsgID.Err, "Error during file read! Line number " & iMapDim + 1 & " (" & sFilePath & ")", MsgSrc, sFilePath) + GoTo lbEr End Try @@ -111,7 +109,7 @@ Public Class cMAP 'ERROR-label for clean Abort -lbEr: + lbEr: file.Close() file = Nothing @@ -140,8 +138,8 @@ lbEr: val = CType(FuelMap.Intpol(nU, Tq), Single) If FuelMap.ExtrapolError Then - 'TODO:WORKERMESSAGE WorkerMsg(tMsgID.Err, "Cannot extrapolate FC map! n= " & nU.ToString("0.0") & " [1/min], Me= " & Tq.ToString("0.0") & " [Nm]", "MAP/FC_Intp") - Return -10000 + + Return - 10000 Else Return val End If diff --git a/VectoCore/VectoCore/Configuration/Constants.cs b/VectoCore/VectoCore/Configuration/Constants.cs index 39866f24b0..1bfde99ff9 100644 --- a/VectoCore/VectoCore/Configuration/Constants.cs +++ b/VectoCore/VectoCore/Configuration/Constants.cs @@ -36,6 +36,7 @@ namespace TUGraz.VectoCore.Configuration { public static class Constants { + public static Second DefaultPowerShiftTime = 0.8.SI<Second>(); public const double RPMToRad = 2 * Math.PI / 60; public const double Kilo = 1000; public const double MeterPerSecondToKMH = 3.6; diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs index 4a0aaca25f..192771cdbb 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs @@ -389,7 +389,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON { get { return Body["PowershiftShiftTime"] == null - ? 0.8.SI<Second>() + ? Constants.DefaultPowerShiftTime : Body.GetEx<double>("PowershiftShiftTime").SI<Second>(); } } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs index 4321fb273c..2e17f9602e 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs @@ -386,7 +386,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } var fc = result.Value; - //TODO mk-2015-11-11: calculate aux start stop correction var fcAux = fc; var fcWHTC = fcAux * ModelData.FuelConsumptionCorrectionFactor; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs index 8609584f95..1b384fa2ae 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs @@ -206,15 +206,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var inAngularVelocity = outAngularVelocity * effectiveRatio; - // TODO: MQ 20170111 - disabled this check, caused more problems than it actually solved... -- re-think - //if (!dryRun && ModelData.Type.AutomaticTransmission() && torqueConverterLocked && - // inAngularVelocity.IsSmaller(DataBus.EngineIdleSpeed) && !dryRun) { - // Log.Error( - // "ERROR: EngineSpeed is lower than Idlespeed in Measuredspeed-Cycle with given Gear (Automatic Transmission). AbsTime: {0}, Gear: {1} TC-Active: {2}, EngineSpeed: {3}", - // absTime, Gear, !torqueConverterLocked, inAngularVelocity.AsRPM); - // return new ResponseEngineSpeedTooLow { Source = this, EngineSpeed = inAngularVelocity }; - //} - if (!inAngularVelocity.IsEqual(0)) { // MQ 19.2.2016: check! inertia is related to output side, torque loss accounts to input side CurrentState.InertiaTorqueLossOut = @@ -236,13 +227,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (TorqueConverter != null && !torqueConverterLocked) { return TorqueConverter.Request(absTime, dt, inTorque, inAngularVelocity, true); } - // mk 2016-12-13 - //if (outTorque.IsSmaller(0) && inAngularVelocity.IsSmaller(DataBus.EngineIdleSpeed)) { - // //Log.Warn("engine speed would fall below idle speed - disengage! gear from cycle: {0}, vehicle speed: {1}", Gear, - // // DataBus.VehicleSpeed); - // Gear = 0; - // return RequestDisengaged(absTime, dt, outTorque, outAngularVelocity, dryRun); - //} + var dryRunResponse = NextComponent.Request(absTime, dt, inTorque, inAngularVelocity, true); dryRunResponse.GearboxPowerRequest = outTorque * avgOutAngularVelocity; return dryRunResponse; @@ -250,7 +235,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl CurrentState.TransmissionTorqueLoss = inTorque * effectiveRatio - outTorque; - CurrentState.SetState(inTorque, inAngularVelocity, outTorque, outAngularVelocity); CurrentState.Gear = Gear; // end critical section @@ -259,13 +243,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl CurrentState.TorqueConverterActive = true; return TorqueConverter.Request(absTime, dt, inTorque, inAngularVelocity); } - // mk 2016-12-13 - //if (outTorque.IsSmaller(0) && inAngularVelocity.IsSmaller(DataBus.EngineIdleSpeed)) { - // Log.Warn("engine speed would fall below idle speed - disengage! gear from cycle: {0}, vehicle speed: {1}", Gear, - // DataBus.VehicleSpeed); - // Gear = 0; - // return RequestDisengaged(absTime, dt, outTorque, outAngularVelocity, dryRun); - //} + if (TorqueConverter != null) { TorqueConverter.Locked(CurrentState.InTorque, CurrentState.InAngularVelocity, CurrentState.InTorque, CurrentState.InAngularVelocity); @@ -319,26 +297,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl }; } - - //var motoringSpeed = DataBus.EngineIdleSpeed; - //var disengagedResponse = NextComponent.Request(absTime, dt, 0.SI<NewtonMeter>(), DataBus.EngineIdleSpeed); - //if (!(disengagedResponse is ResponseSuccess)) { - // motoringSpeed = DataBus.EngineSpeed; - // if (motoringSpeed.IsGreater(DataBus.EngineIdleSpeed)) { - // var first = (ResponseDryRun)NextComponent.Request(absTime, dt, 0.SI<NewtonMeter>(), motoringSpeed, true); - // try { - // motoringSpeed = SearchAlgorithm.Search(motoringSpeed, first.DeltaDragLoad, - // Constants.SimulationSettings.EngineIdlingSearchInterval, - // getYValue: result => ((ResponseDryRun)result).DeltaDragLoad, - // evaluateFunction: n => NextComponent.Request(absTime, dt, 0.SI<NewtonMeter>(), n, true), - // criterion: result => ((ResponseDryRun)result).DeltaDragLoad.Value()); - // } catch (VectoException) { - // Log.Warn("CycleGearbox could not find motoring speed for disengaged state."); - // } - // motoringSpeed = motoringSpeed.LimitTo(DataBus.EngineIdleSpeed, DataBus.EngineSpeed); - // } - // disengagedResponse = NextComponent.Request(absTime, dt, 0.SI<NewtonMeter>(), motoringSpeed); - //} IResponse disengagedResponse; if (GearboxType.AutomaticTransmission()) { disengagedResponse = EngineIdleRequest(absTime, dt); diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs index 485e4be47e..32e606de4d 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs @@ -450,7 +450,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } else { if (DataBus.VehicleSpeed.IsSmallerOrEqual(0.SI<MeterPerSecond>())) { // the clutch is disengaged, and the vehicle stopped - we can't perform a roll action. wait for the clutch to be engaged - // todo mk 2016-08-23: is this still needed? var remainingShiftTime = Constants.SimulationSettings.TargetTimeInterval; while (!DataBus.ClutchClosed(absTime + remainingShiftTime)) { remainingShiftTime += Constants.SimulationSettings.TargetTimeInterval; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs index dbae9245a3..5ef7c018e3 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs @@ -419,10 +419,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl // only use the one with min. speed if (cycleIterator.RightSample.VehicleTargetSpeed < lookaheadEntry.VehicleTargetSpeed) { retVal.Remove(lookaheadEntry); - retVal.Add(cycleIterator.RightSample); // TODO: MQ 2016-05-13: use clone of iterator here? + retVal.Add(cycleIterator.RightSample); } } else { - retVal.Add(cycleIterator.RightSample); // TODO: MQ 2016-05-13: use clone of iterator here? + retVal.Add(cycleIterator.RightSample); } velocity = cycleIterator.RightSample.VehicleTargetSpeed; if (velocity.IsEqual(0.KMPHtoMeterPerSecond())) { diff --git a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationWriter.cs b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationWriter.cs index 87fb34848e..bff1895e92 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationWriter.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationWriter.cs @@ -360,8 +360,8 @@ namespace TUGraz.VectoCore.OutputData.XML new XElement(tns + XMLNames.ComponentDataWrapper, new XAttribute(XMLNames.Component_ID_Attr, id), GetDefaultComponentElements(data.Model, "N.A."), - new XElement(tns + "CdxA_0", data.AirDragArea.Value().ToXMLFormat(2)), // TODO - new XElement(tns + "TransferredCdxA", data.AirDragArea.Value().ToXMLFormat(2)), // TODO + new XElement(tns + "CdxA_0", data.AirDragArea.Value().ToXMLFormat(2)), // TODO MQ + new XElement(tns + "TransferredCdxA", data.AirDragArea.Value().ToXMLFormat(2)), // TODO MQ new XElement(tns + XMLNames.AirDrag_DeclaredCdxA, data.AirDragArea.Value().ToXMLFormat(2))), AddSignatureDummy(id) ); diff --git a/VectoCore/VectoCoreTest/XML/XMLEngineeringInputSingleTest.cs b/VectoCore/VectoCoreTest/XML/XMLEngineeringInputSingleTest.cs index b04558a032..0d28bcb8b4 100644 --- a/VectoCore/VectoCoreTest/XML/XMLEngineeringInputSingleTest.cs +++ b/VectoCore/VectoCoreTest/XML/XMLEngineeringInputSingleTest.cs @@ -436,13 +436,14 @@ namespace TUGraz.VectoCore.Tests.XML Assert.AreEqual(DeclarationData.Gearbox.StartAcceleration.Value(), shiftStrategy.StartAcceleration.Value(), 1e-6); Assert.AreEqual(DeclarationData.Gearbox.TorqueReserveStart, shiftStrategy.StartTorqueReserve, 1e-6); - // TODO: MQ 2017-01-16: introduce constants, use also in input data provider! - Assert.AreEqual(0.8, shiftStrategy.PowershiftShiftTime.Value(), 1e-6); + AssertHelper.AreRelativeEqual(Constants.DefaultPowerShiftTime, shiftStrategy.PowershiftShiftTime); var tcShiftStrategy = inputDataProvider.GearboxInputData.TorqueConverter; - Assert.AreEqual(0.1, tcShiftStrategy.CCUpshiftMinAcceleration.Value(), 1e-6); - Assert.AreEqual(0.1, tcShiftStrategy.CLUpshiftMinAcceleration.Value(), 1e-6); + AssertHelper.AreRelativeEqual(DeclarationData.TorqueConverter.CCUpshiftMinAcceleration, + tcShiftStrategy.CCUpshiftMinAcceleration); + AssertHelper.AreRelativeEqual(DeclarationData.TorqueConverter.CLUpshiftMinAcceleration, + tcShiftStrategy.CLUpshiftMinAcceleration); } [TestMethod] -- GitLab