diff --git a/VectoCommon/VectoHashing/VectoHash.cs b/VectoCommon/VectoHashing/VectoHash.cs index 31f22e326fa2d3d2841f2362b2ea2ff1e69070cd..113a409a07b07ce9831a3435b8e77ef3dcfddfbe 100644 --- a/VectoCommon/VectoHashing/VectoHash.cs +++ b/VectoCommon/VectoHashing/VectoHash.cs @@ -59,8 +59,8 @@ namespace TUGraz.VectoHashing var retVal = new List<VectoComponents>(); foreach (var component in EnumHelper.GetValues<VectoComponents>()) { var count = - Document.SelectNodes(string.Format("//*[local-name()='VectoInputDeclaration']/*[local-name()='{0}']", - component.XMLElementName())).Count; + Document.SelectNodes(string.Format("//*[local-name()='{0}']//*[local-name()='{1}']", + XMLNames.VectoInputDeclaration,component.XMLElementName())).Count; for (var i = 0; i < count; i++) { retVal.Add(component); } diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/AbstractDeclarationXMLComponentDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/AbstractDeclarationXMLComponentDataProvider.cs index 95d726f8adbb589029a2a1914b3d2ecc84a1dc40..49d0f2344962b1f38c8ecfbb2df119aea0bb3388 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/AbstractDeclarationXMLComponentDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/AbstractDeclarationXMLComponentDataProvider.cs @@ -63,10 +63,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration get { return GetElementValue(XMLNames.Component_Model); } } - public virtual string Creator - { - get { return "N.A."; } - } + public virtual string Date { @@ -78,7 +75,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration get { return GetElementValue(XMLNames.Component_TechnicalReportId); } } - public CertificationMethod CertificationMethod + public virtual CertificationMethod CertificationMethod { get { var value = GetElementValue(XMLNames.Component_CertificationMethod); @@ -86,7 +83,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration } } - public string CertificationNumber + public virtual string CertificationNumber { get { return GetAttributeValue("..", "certificationNumber"); } } @@ -96,10 +93,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration get { return GetElementValue("..//*[local-name()='DigestValue']"); } } - public virtual IntegrityStatus IntegrityStatus - { - get { return IntegrityStatus.Unknown; } - } + protected bool ElementExists(string relativePath) { diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/AbstractEngineeringXMLComponentDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/AbstractEngineeringXMLComponentDataProvider.cs index 6ef8935c831b9ad3011a04fb0b26bfb3d707cba0..ba7ace4b1058ea2b3af3ba48bb2f3e78af7b0dfa 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/AbstractEngineeringXMLComponentDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/AbstractEngineeringXMLComponentDataProvider.cs @@ -53,11 +53,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering get { return GetElementValue(XMLNames.Component_Model); } } - public override string Creator - { - get { return GetElementValue(XMLNames.Component_Creator); } - } - + public override string Date { get { return GetElementValue(XMLNames.Component_Date); } @@ -73,12 +69,12 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering get { return ""; } } - public override IntegrityStatus IntegrityStatus + public override CertificationMethod CertificationMethod { - get { return IntegrityStatus.Unknown; } + get { return CertificationMethod.NotCertified;} } - + protected TableData ReadCSVResourceFile(string relPath) { if (!ElementExists(Helper.Query(relPath, ExtCsvResourceTag))) { diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAxlegearDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAxlegearDataProvider.cs index d0ff022d7387275ff1cb2b797cf77bbbe7ec4c6e..f5837fcbcd69e451c5ebfa1eb80f7237c30ee5fb 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAxlegearDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAxlegearDataProvider.cs @@ -36,7 +36,11 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering public AxleLineType LineType { - get { return GetElementValue(XMLNames.Axlegear_LineType).ParseEnum<AxleLineType>(); } + get { + return ElementExists(XMLNames.Axlegear_LineType) + ? GetElementValue(XMLNames.Axlegear_LineType).ParseEnum<AxleLineType>() + : AxleLineType.SinglePortalAxle; + } } } } \ No newline at end of file diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/AbstractSimulationDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/AbstractSimulationDataAdapter.cs index c763eeeacb4f0989c151a52cb17b43d3ff0193be..035586c46647f9d78cd25156af95c515a85239f7 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/AbstractSimulationDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/AbstractSimulationDataAdapter.cs @@ -52,13 +52,11 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter { var retVal = new VehicleData { SavedInDeclarationMode = data.SavedInDeclarationMode, - VIN = data.VIN, Manufacturer = data.Manufacturer, ModelName = data.Model, Date = data.Date, //CertificationNumber = data.CertificationNumber, DigestValueInput = data.DigestValue, - LegislativeClass = data.LegislativeClass, VehicleCategory = data.VehicleCategory, AxleConfiguration = data.AxleConfiguration, CurbWeight = data.CurbMassChassis, @@ -155,7 +153,14 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter }; } - internal AxleGearData CreateAxleGearData(IAxleGearInputData data, bool useEfficiencyFallback) + public AxleGearData CreateAxleGearData(IAxleGearInputData data, bool useEfficiencyFallback) + { + var retVal = SetCommonAxleGearData(data); + retVal.AxleGear.LossMap = ReadAxleLossMap(data, useEfficiencyFallback); + return retVal; + } + + internal TransmissionLossMap ReadAxleLossMap(IAxleGearInputData data, bool useEfficiencyFallback) { TransmissionLossMap axleLossMap; if (data.LossMap == null && useEfficiencyFallback) { @@ -169,7 +174,11 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter if (axleLossMap == null) { throw new InvalidFileFormatException("LossMap for Axlegear is missing."); } + return axleLossMap; + } + internal AxleGearData SetCommonAxleGearData(IAxleGearInputData data) + { return new AxleGearData { SavedInDeclarationMode = data.SavedInDeclarationMode, Manufacturer = data.Manufacturer, @@ -179,7 +188,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter CertificationMethod = data.CertificationMethod, CertificationNumber = data.CertificationNumber, DigestValueInput = data.DigestValue, - AxleGear = new GearData { LossMap = axleLossMap, Ratio = data.Ratio } + AxleGear = new GearData { Ratio = data.Ratio } }; } diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs index 3556dae703864621fcb455136fd1302cd27cea20..b33ae94d72a0bb51987c7f5a3208f7bcd4c24868 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs @@ -88,6 +88,8 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter } var retVal = SetCommonVehicleData(data); + retVal.VIN = data.VIN; + retVal.LegislativeClass = data.LegislativeClass; retVal.TrailerGrossVehicleWeight = mission.Trailer.Sum(t => t.TrailerGrossVehicleWeight).DefaultIfNull(0); retVal.BodyAndTrailerWeight = (mission.MissionType == MissionType.MunicipalUtility diff --git a/VectoCore/VectoCore/Models/Simulation/Data/VectoRunData.cs b/VectoCore/VectoCore/Models/Simulation/Data/VectoRunData.cs index cf94796b322c574f3b3e6a5957614dc1e3e1eefe..5eb3f3e2c1200ab8988addbe7ff6a464547973ae 100644 --- a/VectoCore/VectoCore/Models/Simulation/Data/VectoRunData.cs +++ b/VectoCore/VectoCore/Models/Simulation/Data/VectoRunData.cs @@ -50,7 +50,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Data [ValidateObject] public VehicleData VehicleData { get; internal set; } - [Required, ValidateObject] + [ValidateObject] public AirdragData AirdragData { get; internal set; } [ValidateObject] diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/VehicleData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/VehicleData.cs index c25999c543fd9f2989b58d77af80d8d50acfd843..0ce74d45a22b36fbba74625a310c32304644ff92 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/VehicleData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/VehicleData.cs @@ -42,10 +42,8 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.SimulationComponent.Data { - public class AirdragData : SimulationComponentData { - public CrossWindCorrectionMode CrossWindCorrectionMode { get; set; } [Required, ValidateObject] @@ -70,7 +68,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data public AxleConfiguration AxleConfiguration { get; internal set; } - + [Required, ValidateObject] private List<Axle> _axleData; private KilogramSquareMeter _wheelsInertia; @@ -165,14 +163,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data public Kilogram TotalVehicleWeight { get { - var retVal = 0.0; - if (CurbWeight != null) { - retVal += CurbWeight.Value(); - } - if (Loading != null) { - retVal += Loading.Value(); - } - return retVal.SI<Kilogram>(); + var retVal = 0.0.SI<Kilogram>(); + retVal += CurbWeight ?? 0.SI<Kilogram>(); + retVal += BodyAndTrailerWeight ?? 0.SI<Kilogram>(); + retVal += Loading ?? 0.SI<Kilogram>(); + return retVal; } } diff --git a/VectoCore/VectoCore/Resources/Declaration/SegmentTable.csv b/VectoCore/VectoCore/Resources/Declaration/SegmentTable.csv index 44b2ad00f76d6d3e8da50b6cb5b135a24a2fdae5..341ab33a60c200c7e1ae4550930aed94b6ea3b4b 100644 --- a/VectoCore/VectoCore/Resources/Declaration/SegmentTable.csv +++ b/VectoCore/VectoCore/Resources/Declaration/SegmentTable.csv @@ -18,8 +18,8 @@ Valid,Vehicle Category,Axle Conf.,GVW_Min,GVW_Max,HDV class,Height,DesignSpeed,B 0 ,RigidTruck ,6x6 ,0 ,99 ,13 ,3.6 ,85 , , , ,Truck.vacc, , ,RigidSolo , , , , , , , , ,- ,- ,- ,- ,- ,- ,??? ,- ,- ,- ,- ,- , , , 0 ,Tractor ,6x6 ,0 ,99 ,14 ,3.6 ,85 , , , ,Truck.vacc, , ,TractorSemitrailer , , , , , , , , ,- ,- ,- ,- ,- ,- ,??? ,- ,- ,- ,- ,- , , , 0 ,RigidTruck ,8x2 ,0 ,99 ,15 ,3.6 ,85 , , , ,Truck.vacc, , ,RigidSolo , , , , , , , , ,- ,- ,??? ,- ,- ,- ,- ,- ,- ,- ,- ,- , , , -1 ,RigidTruck ,8x4 ,0 ,99 ,16 ,3.6 ,85 , , , ,Truck.vacc, , ,RigidSolo , ,25/25/25/25 , , , , , , ,- ,- ,- ,- ,- ,- ,2600/12900 ,- ,- ,- ,- ,- , , , -0 ,RigidTruck ,8x6 ,0 ,99 ,17 ,3.6 ,85 , , , ,Truck.vacc, , ,RigidSolo , , , , , , , , ,- ,- ,- ,- ,- ,- ,??? ,- ,- ,- ,- ,- ,9.0 ,9.0 , +1 ,RigidTruck ,8x4 ,0 ,99 ,16 ,3.6 ,85 , , , ,Truck.vacc, , ,RigidSolo , ,25/25/25/25 , , , , , , ,- ,- ,- ,- ,- ,- ,2600/12900 ,- ,- ,- ,- ,- ,9.0 ,9.0 , +0 ,RigidTruck ,8x6 ,0 ,99 ,17 ,3.6 ,85 , , , ,Truck.vacc, , ,RigidSolo , , , , , , , , ,- ,- ,- ,- ,- ,- ,??? ,- ,- ,- ,- ,- , , , 0 ,RigidTruck ,8x8 ,0 ,99 ,17 ,4.0 ,85 , , , ,Truck.vacc, , ,RigidSolo , , , , , , , , ,- ,- ,- ,- ,- ,- ,??? ,- ,- ,- ,- ,- , , , 0 ,CityBus ,4x2 ,0 ,18 ,B1 ,4.0 ,85 , , , , , , ,CoachBus , , , , , , , , ,- ,- ,- ,- ,- ,- ,- ,??? ,??? ,??? ,- ,- , , , 0 ,InterurbanBus ,4x2 ,0 ,18 ,B2 ,4.0 ,85 , , , , , , ,CoachBus , , , , , , , , ,- ,- ,- ,- ,- ,- ,- ,- ,- ,- ,??? ,- , , , diff --git a/VectoCore/VectoCoreTest/FileIO/SimulationDataReaderTest.cs b/VectoCore/VectoCoreTest/FileIO/SimulationDataReaderTest.cs index 854f752b0f498e6e33eef879c4a15d63452e7276..1a36cd2d9467cede9f580508a1d195601e325661 100644 --- a/VectoCore/VectoCoreTest/FileIO/SimulationDataReaderTest.cs +++ b/VectoCore/VectoCoreTest/FileIO/SimulationDataReaderTest.cs @@ -68,7 +68,7 @@ namespace TUGraz.VectoCore.Tests.FileIO Assert.AreEqual(Path.GetFileNameWithoutExtension(DeclarationJob), runData.JobName); // curbweight + bodyCurbWeight + trailerCurbWeight (for Long Haul only) - Assert.AreEqual(5850 + 1900 + 3400, runData.VehicleData.CurbWeight.Value()); + Assert.AreEqual(5850 + 1900 + 3400, runData.VehicleData.TotalCurbWeight.Value()); Assert.AreEqual(11900, runData.VehicleData.GrossVehicleWeight.Value()); Assert.AreEqual(AxleConfiguration.AxleConfig_4x2, runData.VehicleData.AxleConfiguration);