diff --git a/VECTO/GUI/VehicleForm.vb b/VECTO/GUI/VehicleForm.vb index 876aa8de62b9ffa06d15b55480d32b6f4dcf9259..d008a52fabb3359b17714b71a27ea7846d0aa628 100644 --- a/VECTO/GUI/VehicleForm.vb +++ b/VECTO/GUI/VehicleForm.vb @@ -533,9 +533,7 @@ Public Class VehicleForm Case CrossWindCorrectionMode.SpeedDependentCorrectionFactor bEnabled = True - LbCdMode.Text = "Input file: Vehicle Speed [km/h], Cd Scaling Factor [-]" _ - 'TODO: MQ 20160901: check if scaling factor or absolue value! - + LbCdMode.Text = "Input file: Vehicle Speed [km/h], Cd Scaling Factor [-]" Case Else ' tCdMode.ConstCd0, tCdMode.CdOfVdecl bEnabled = False LbCdMode.Text = "" diff --git a/VECTO/Input Files/Engine.vb b/VECTO/Input Files/Engine.vb index cc105e3beecde03d7813b6ab9ef4e98196c94138..0fe8dece66939dcfd284f5ab224f354c3a96456d 100644 --- a/VECTO/Input Files/Engine.vb +++ b/VECTO/Input Files/Engine.vb @@ -290,7 +290,8 @@ Public Class Engine Public ReadOnly Property Manufacturer As String Implements IComponentInputData.Manufacturer Get - Return "N.A." ' TODO: MQ 20160919 + ' Just for the interface. Value is not available in GUI yet. + Return "N.A." End Get End Property @@ -308,6 +309,7 @@ Public Class Engine Public ReadOnly Property CertificationNumber As String Implements IComponentInputData.CertificationNumber Get + ' Just for the interface. Value is not available in GUI yet. Return "N.A." End Get End Property diff --git a/VECTO/Input Files/Gearbox.vb b/VECTO/Input Files/Gearbox.vb index 4849eba590ffb2b27050f5aafbbf51b1a7165500..86298b9f48af9c15df57585e367e3da18b6b32f8 100644 --- a/VECTO/Input Files/Gearbox.vb +++ b/VECTO/Input Files/Gearbox.vb @@ -299,7 +299,8 @@ Public Class Gearbox Public ReadOnly Property Manufacturer As String Implements IComponentInputData.Manufacturer Get - Return "N.A." ' Todo MQ 20160915 + ' Just for the interface. Value is not available in GUI yet. + Return "N.A." End Get End Property @@ -318,6 +319,7 @@ Public Class Gearbox Public ReadOnly Property CertificationNumber As String Implements IComponentInputData.CertificationNumber Get + ' Just for the interface. Value is not available in GUI yet. Return "N.A." End Get End Property diff --git a/VECTO/Input Files/Vehicle.vb b/VECTO/Input Files/Vehicle.vb index 980d3f7f42c030a7458be5a164d9edfc46f1d97a..cf4a0695ef2fe9b00a4f04d00f08bdee49387ab1 100644 --- a/VECTO/Input Files/Vehicle.vb +++ b/VECTO/Input Files/Vehicle.vb @@ -265,13 +265,15 @@ Public Class Vehicle Public ReadOnly Property Manufacturer As String Implements IComponentInputData.Manufacturer Get - Return "N.A." ' TODO: MQ 20160908 + ' Just for the interface. Value is not available in GUI yet. + Return "N.A." End Get End Property Public ReadOnly Property Model As String Implements IComponentInputData.Model Get - Return "N.A." ' Todo: MQ 20160908 + ' Just for the interface. Value is not available in GUI yet. + Return "N.A." End Get End Property @@ -290,7 +292,8 @@ Public Class Vehicle Public ReadOnly Property CertificationNumber As String Implements IComponentInputData.CertificationNumber Get - Return "N.A." 'ToDo + ' Just for the interface. Value is not available in GUI yet. + Return "N.A." End Get End Property diff --git a/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb b/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb index 47d9a7596d401e65d163ec184bdabc5fc9a765f1..9cd035d9f5bfa51cc7c6cf9f02303112f43f2aff 100644 --- a/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb +++ b/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb @@ -474,62 +474,4 @@ Public Class AdvancedAuxiliaries Return M9.TotalCycleFuelConsumptionCompressorOnContinuously End Get End Property - - - 'TODO:REMOVE WHEN TESTING IS COMPLETE - '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 - Get - Return M12.INTRP1() - End Get - End Property - - Public ReadOnly Property AA_D_M12_INTERP2 As Kilogram Implements IAdvancedAuxiliaries.AA_D_M12_INTERP2 - Get - Return M12.INTRP2() - End Get - End Property - - Public ReadOnly Property AA_D_M12_P1X As Joule Implements IAdvancedAuxiliaries.AA_D_M12_P1X - Get - Return M12.P1X() - End Get - End Property - - Public ReadOnly Property AA_D_M12_P1Y As Kilogram Implements IAdvancedAuxiliaries.AA_D_M12_P1Y - Get - Return M12.P1Y() - End Get - End Property - - Public ReadOnly Property AA_D_M12_P2X As Joule Implements IAdvancedAuxiliaries.AA_D_M12_P2X - Get - Return M12.P2X() - End Get - End Property - - Public ReadOnly Property AA_D_M12_P2Y As Kilogram Implements IAdvancedAuxiliaries.AA_D_M12_P2Y - Get - Return M12.P2Y() - End Get - End Property - - Public ReadOnly Property AA_D_M12_P3X As Joule Implements IAdvancedAuxiliaries.AA_D_M12_P3X - Get - Return M12.P3X() - End Get - End Property - - Public ReadOnly Property AA_D_M12_P3Y As Kilogram Implements IAdvancedAuxiliaries.AA_D_M12_P3Y - Get - Return M12.P3Y() - End Get - End Property - - Public ReadOnly Property AA_D_M12_XTAIN As Joule Implements IAdvancedAuxiliaries.AA_D_M12_XTAIN - Get - Return M12.XTAIN() - End Get - End Property End Class diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/cMAP.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/cMAP.vb index b32e65b86b56326e8187d65922a56f3c90787e2d..7b8c13d27d42bff352cbea31fec97461f7564548 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/VectoCommon/AdvancedAuxiliaryInterfaces/IAdvancedAuxiliaries.vb b/VectoCommon/AdvancedAuxiliaryInterfaces/IAdvancedAuxiliaries.vb index a07e798bf89202a68d4507932c23f8cd52a2c102..233cdb1d58a98d13321a44e3939b103f17fb3927 100644 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/IAdvancedAuxiliaries.vb +++ b/VectoCommon/AdvancedAuxiliaryInterfaces/IAdvancedAuxiliaries.vb @@ -22,18 +22,6 @@ Public Interface IAdvancedAuxiliaries ReadOnly Property AuxiliaryName As String ReadOnly Property AuxiliaryVersion As String - - 'Diagnostic Only - Remove when beta over. - ReadOnly Property AA_D_M12_P1X As Joule - ReadOnly Property AA_D_M12_P1Y As Kilogram - ReadOnly Property AA_D_M12_P2X As Joule - ReadOnly Property AA_D_M12_P2Y As Kilogram - ReadOnly Property AA_D_M12_P3X As Joule - ReadOnly Property AA_D_M12_P3Y As Kilogram - ReadOnly Property AA_D_M12_XTAIN As Joule - ReadOnly Property AA_D_M12_INTERP1 As Kilogram - ReadOnly Property AA_D_M12_INTERP2 As Kilogram - 'Additional Permenent Monitoring Signals - Required by engineering ReadOnly Property AA_NonSmartAlternatorsEfficiency As Double ReadOnly Property AA_SmartIdleCurrent_Amps As Ampere diff --git a/VectoCore/VectoCore/Configuration/Constants.cs b/VectoCore/VectoCore/Configuration/Constants.cs index 39866f24b040a941f7486b21034505e4851b898c..1bfde99ff9e9708a085b97eb99d6a62733e57ca8 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 4a0aaca25f61f92a241022b8024e2d2114fac47f..f4a16976b992e192e771f1fd0b5348d41009c8cc 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs @@ -38,6 +38,7 @@ using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.InputData.Impl; using TUGraz.VectoCore.Models.Declaration; @@ -389,7 +390,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 4321fb273c867e832cbabb552e6afae6bf8311d9..2e17f9602e86bcbc7916ad2014d5dc44e21f13f1 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 8609584f951d3d9cdcdd94031ff90b85f557cc59..1b384fa2ae89ec89de42f3e24704ebded0ef4945 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 485e4be47eed6f39d59f07d33d94fb529f1ed29c..1145e04f6ee00cd3978352618cf2db0f19f0d332 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; @@ -602,7 +601,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl Case<ResponseDrivingCycleDistanceExceeded>(r => { if (!ds.IsEqual(r.MaxDistance)) { // distance has been reduced due to vehicle stop in coast/roll action => use brake action to get exactly to the stop-distance - // TODO what if no gear is enaged (and we need driveline power to get to the stop-distance? response = Driver.DrivingActionBrake(absTime, ds, DriverStrategy.BrakeTrigger.NextTargetSpeed, gradient); } }). diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs index dbae9245a3542a478016f308e9015468cad9c090..5ef7c018e3e3a1d472b5b76b296da1fe215ec3f5 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 709c66864d9be213919b137e9d8b77cac657237a..fe9019df7c625a08db87a1afcf45d61da2ebb12a 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationWriter.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationWriter.cs @@ -49,8 +49,6 @@ namespace TUGraz.VectoCore.OutputData.XML public class XMLDeclarationWriter : AbstractXMLWriter { private XNamespace componentNamespace; - //private readonly XNamespace _vectoNs = @"../../../API/VectoInput.xsd"; - public XMLDeclarationWriter(string vendor) : base(null, vendor) { @@ -77,7 +75,7 @@ namespace TUGraz.VectoCore.OutputData.XML new XAttribute(xsi + "schemaLocation", string.Format("{0} {1}VectoInput.xsd", rootNamespace, SchemaLocationBaseUrl)), CreateDeclarationJob(data)) - ); + ); return job; } @@ -104,7 +102,7 @@ namespace TUGraz.VectoCore.OutputData.XML new XAttribute(xsi + "schemaLocation", string.Format("{0} {1}VectoComponent.xsd", componentNamespace, SchemaLocationBaseUrl)), content) - ); + ); return component; } @@ -149,17 +147,15 @@ namespace TUGraz.VectoCore.OutputData.XML CreateAxleWheels(data.VehicleInputData), CreateAuxiliaries(data.AuxiliaryInputData()), CreateAirdrag(data.AirdragInputData) - ) - ); + ) + ); } - protected XElement CreateEngine(IEngineDeclarationInputData data, XNamespace ns = null) { var id = string.Format("ENG-{0}", data.Model.RemoveWhitespace()); var fld = FullLoadCurveReader.Create(data.FullLoadCurve, true); return new XElement((ns ?? tns) + XMLNames.Component_Engine, - //new XAttribute(XMLNames.Component_CertificationNumber_Attr, string.Format("ENG-{0}", data.Model)), new XElement(tns + XMLNames.ComponentDataWrapper, new XAttribute(XMLNames.Component_ID_Attr, id), GetDefaultComponentElements(string.Format("ENG-{0}", data.Model), data.Model), @@ -179,13 +175,12 @@ namespace TUGraz.VectoCore.OutputData.XML EmbedDataTable(data.FuelConsumptionMap, AttributeMappings.FuelConsumptionMapMapping)), new XElement(tns + XMLNames.Engine_FullLoadAndDragCurve, EmbedDataTable(data.FullLoadCurve, AttributeMappings.EngineFullLoadCurveMapping) - ) - ), + ) + ), AddSignatureDummy(id) - ); + ); } - protected XElement CreateGearbox(IGearboxDeclarationInputData gbxData, ITorqueConverterDeclarationInputData torqueConverter, XNamespace ns = null) { @@ -203,25 +198,23 @@ namespace TUGraz.VectoCore.OutputData.XML : null, new XElement(tns + XMLNames.Gearbox_Gear_TorqueLossMap, EmbedDataTable(gearData.LossMap, AttributeMappings.TransmissionLossmapMapping)) - ); + ); gears.Add(gear); } var id = string.Format("GBX-{0}", gbxData.Model.RemoveWhitespace()); return new XElement((ns ?? tns) + XMLNames.Component_Gearbox, - //new XAttribute(XMLNames.Component_CertificationNumber_Attr, string.Format("GBX-{0}", gbxData.Model)), new XElement(tns + XMLNames.ComponentDataWrapper, new XAttribute(XMLNames.Component_ID_Attr, id), GetDefaultComponentElements(string.Format("GBX-{0}", gbxData.Model), gbxData.Model), new XElement(tns + XMLNames.Gearbox_TransmissionType, gbxData.Type.ToXMLFormat()), new XElement(tns + XMLNames.Component_Gearbox_CertificationMethod, "Standard values"), gears - ), + ), AddSignatureDummy(id), gbxData.Type.AutomaticTransmission() ? CreateTorqueConverter(torqueConverter) : null - ); + ); } - private XElement CreateTorqueConverter(ITorqueConverterDeclarationInputData data) { if (data == null) { @@ -229,7 +222,6 @@ namespace TUGraz.VectoCore.OutputData.XML } var id = string.Format("TC-{0}", data.Model.RemoveWhitespace()); return new XElement(tns + XMLNames.Component_TorqueConverter, - //new XAttribute(XMLNames.Component_CertificationNumber_Attr, id), new XElement(tns + XMLNames.ComponentDataWrapper, new XAttribute(XMLNames.Component_ID_Attr, id), GetDefaultComponentElements(data.CertificationNumber, data.Model), @@ -239,8 +231,8 @@ namespace TUGraz.VectoCore.OutputData.XML precision: new Dictionary<string, uint>() { { TorqueConverterDataReader.Fields.SpeedRatio, 4 } }) - ) - ), + ) + ), AddSignatureDummy(id)); } @@ -248,7 +240,6 @@ namespace TUGraz.VectoCore.OutputData.XML { var id = string.Format("ANGL-{0}", data.Model.RemoveWhitespace()); return new XElement((ns ?? tns) + XMLNames.Component_Angledrive, - //new XAttribute(XMLNames.Component_CertificationNumber_Attr, "ANGL-" + data.Model), new XElement(tns + XMLNames.ComponentDataWrapper, new XAttribute(XMLNames.Component_ID_Attr, id), GetDefaultComponentElements(data.CertificationNumber, data.Model), @@ -263,24 +254,22 @@ namespace TUGraz.VectoCore.OutputData.XML { var id = string.Format("RET-{0}", data.Model.RemoveWhitespace()); return new XElement((ns ?? tns) + XMLNames.Component_Retarder, - //new XAttribute(XMLNames.Component_CertificationNumber_Attr, "RET-none"), new XElement(tns + XMLNames.ComponentDataWrapper, new XAttribute(XMLNames.Component_ID_Attr, id), GetDefaultComponentElements(data.CertificationNumber, data.Model), new XElement(tns + XMLNames.Component_CertificationMethod, "Standard values"), new XElement(tns + XMLNames.Retarder_RetarderLossMap, EmbedDataTable(data.LossMap, AttributeMappings.RetarderLossmapMapping) - ) - ), + ) + ), AddSignatureDummy(id) - ); + ); } public XElement CreateAxlegear(IAxleGearInputData data, XNamespace ns = null) { var typeId = string.Format("AXLGEAR-{0}", data.Ratio.ToString("F3", CultureInfo.InvariantCulture)); return new XElement((ns ?? tns) + XMLNames.Component_Axlegear, - //new XAttribute(XMLNames.Component_CertificationNumber_Attr, string.Format("AXL-{0}", data.Model)), new XElement(tns + XMLNames.ComponentDataWrapper, new XAttribute(XMLNames.Component_ID_Attr, typeId), GetDefaultComponentElements(typeId, "N.A."), @@ -290,7 +279,7 @@ namespace TUGraz.VectoCore.OutputData.XML new XElement(tns + XMLNames.Axlegear_TorqueLossMap, EmbedDataTable(data.LossMap, AttributeMappings.TransmissionLossmapMapping))), AddSignatureDummy(typeId) - ); + ); } public XElement CreateAxleWheels(IVehicleDeclarationInputData data, XNamespace ns = null) @@ -307,29 +296,26 @@ namespace TUGraz.VectoCore.OutputData.XML new XElement(tns + XMLNames.AxleWheels_Axles_Axle_TwinTyres_Attr, axle.TwinTyres), new XElement(tns + XMLNames.AxleWheels_Axles_Axle_Steered, i == 0), CreateTyre(axle) - )); + )); } return new XElement((ns ?? tns) + XMLNames.Component_AxleWheels, new XElement(tns + XMLNames.ComponentDataWrapper, - //new XAttribute(XMLNames.Component_ID_Attr, - // string.Format("AXLWHL-{0}", data.AxleConfiguration.GetName())), new XElement(tns + XMLNames.AxleWheels_Axles, axles)) - ); + ); } private XElement CreateTyre(IAxleDeclarationInputData axle) { var id = string.Format("TYRE-{0}", axle.Wheels).RemoveWhitespace().Replace("/", "_"); return new XElement(tns + "Tyre", - //new XAttribute(XMLNames.Component_CertificationNumber_Attr, id), new XElement(tns + XMLNames.ComponentDataWrapper, new XAttribute(XMLNames.Component_ID_Attr, id), GetDefaultComponentElements(string.Format("TYRE-{0}", axle.Wheels), axle.Wheels), new XElement(tns + XMLNames.AxleWheels_Axles_Axle_Dimension, axle.Wheels), new XElement(tns + XMLNames.AxleWheels_Axles_Axle_RRCDeclared, axle.RollResistanceCoefficient.ToXMLFormat(4)), new XElement(tns + XMLNames.AxleWheels_Axles_Axle_FzISO, axle.TyreTestLoad.Value().ToXMLFormat(0)) - ), + ), AddSignatureDummy(id)); } @@ -344,10 +330,10 @@ namespace TUGraz.VectoCore.OutputData.XML var aux = new XElement(tns + XMLNames.ComponentDataWrapper); foreach ( var key in - new[] { - AuxiliaryType.Fan, AuxiliaryType.SteeringPump, AuxiliaryType.ElectricSystem, AuxiliaryType.PneumaticSystem, - AuxiliaryType.HVAC - }) { + new[] { + AuxiliaryType.Fan, AuxiliaryType.SteeringPump, AuxiliaryType.ElectricSystem, AuxiliaryType.PneumaticSystem, + AuxiliaryType.HVAC + }) { aux.Add(auxList[key]); } return new XElement(tns + XMLNames.Component_Auxiliaries, aux); @@ -357,15 +343,14 @@ namespace TUGraz.VectoCore.OutputData.XML { var id = string.Format("Airdrag-{0}", data.Model); return new XElement((ns ?? tns) + XMLNames.Component_AirDrag, - //new XAttribute(XMLNames.Component_CertificationNumber_Attr, string.Format("AD-{0}", data.Model)), 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)), + new XElement(tns + "TransferredCdxA", data.AirDragArea.Value().ToXMLFormat(2)), new XElement(tns + XMLNames.AirDrag_DeclaredCdxA, data.AirDragArea.Value().ToXMLFormat(2))), AddSignatureDummy(id) - ); + ); } private string AuxTypeToXML(AuxiliaryType type) @@ -373,7 +358,6 @@ namespace TUGraz.VectoCore.OutputData.XML return type.ToString(); } - private XElement AddSignatureDummy(string id) { return new XElement(tns + XMLNames.DI_Signature, @@ -385,12 +369,12 @@ namespace TUGraz.VectoCore.OutputData.XML "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithoutComments")), new XElement(di + XMLNames.DI_Signature_Reference_Transforms_Transform, new XAttribute(XMLNames.DI_Signature_Algorithm_Attr, "urn:vecto:xml:2017:canonicalization")) - ), + ), new XElement(di + XMLNames.DI_Signature_Reference_DigestMethod, new XAttribute(XMLNames.DI_Signature_Algorithm_Attr, "http://www.w3.org/2001/04/xmlenc#sha256")), new XElement(di + XMLNames.DI_Signature_Reference_DigestValue, "") - ) - ); + ) + ); } protected XElement[] GetDefaultComponentElements(string componentId, string makeAndModel) diff --git a/VectoCore/VectoCoreTest/XML/XMLEngineeringInputSingleTest.cs b/VectoCore/VectoCoreTest/XML/XMLEngineeringInputSingleTest.cs index b04558a032a19f417e6e7b5efd78f3bd41e4bc67..0d28bcb8b48511ede6cd2a63f058d931479ab878 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]