diff --git a/VECTO/Input Files/Engine.vb b/VECTO/Input Files/Engine.vb index 8e87c3b3a68b9e5f423ce6bbe18be8877bd6211c..a7b802f247852a632347feec06c2858bffb6d1b7 100644 --- a/VECTO/Input Files/Engine.vb +++ b/VECTO/Input Files/Engine.vb @@ -643,7 +643,7 @@ Public Class DummyVehicle Public Property DualFuelVehicle As Boolean Implements IVehicleDeclarationInputData.DualFuelVehicle Public Property MaxNetPower1 As Watt Implements IVehicleDeclarationInputData.MaxNetPower1 Public Property MaxNetPower2 As Watt Implements IVehicleDeclarationInputData.MaxNetPower2 - Public ReadOnly Property RegisteredClass As String Implements IVehicleDeclarationInputData.RegisteredClass + Public ReadOnly Property RegisteredClass As RegistrationClass Implements IVehicleDeclarationInputData.RegisteredClass Public ReadOnly Property NuberOfPassengersUpperDeck As Integer Implements IVehicleDeclarationInputData.NuberOfPassengersUpperDeck Public ReadOnly Property NumberOfPassengersLowerDeck As Integer Implements IVehicleDeclarationInputData.NumberOfPassengersLowerDeck Public ReadOnly Property VehicleCode As VehicleCode Implements IVehicleDeclarationInputData.VehicleCode diff --git a/VECTO/Input Files/Gearbox.vb b/VECTO/Input Files/Gearbox.vb index 771b29b61e4af589a8dcdb32cd378c0614f30e00..26c055418f00655cfa1bd8ae1815fde20d0fac04 100644 --- a/VECTO/Input Files/Gearbox.vb +++ b/VECTO/Input Files/Gearbox.vb @@ -831,7 +831,7 @@ Public Class MockEngineeringVehicle Public Property DualFuelVehicle As Boolean Implements IVehicleDeclarationInputData.DualFuelVehicle Public Property MaxNetPower1 As Watt Implements IVehicleDeclarationInputData.MaxNetPower1 Public Property MaxNetPower2 As Watt Implements IVehicleDeclarationInputData.MaxNetPower2 - Public ReadOnly Property RegisteredClass As String Implements IVehicleDeclarationInputData.RegisteredClass + Public ReadOnly Property RegisteredClass As RegistrationClass Implements IVehicleDeclarationInputData.RegisteredClass Public ReadOnly Property NuberOfPassengersUpperDeck As Integer Implements IVehicleDeclarationInputData.NuberOfPassengersUpperDeck Public ReadOnly Property NumberOfPassengersLowerDeck As Integer Implements IVehicleDeclarationInputData.NumberOfPassengersLowerDeck Public ReadOnly Property VehicleCode As VehicleCode Implements IVehicleDeclarationInputData.VehicleCode diff --git a/VECTO/Input Files/MockVehicleInputData.vb b/VECTO/Input Files/MockVehicleInputData.vb index 1cca56259f65b98f007f334e3c9c6e116f6557ec..1d4db634d740657ab876311d7fd95e5b94607126 100644 --- a/VECTO/Input Files/MockVehicleInputData.vb +++ b/VECTO/Input Files/MockVehicleInputData.vb @@ -39,7 +39,7 @@ Public Class MockVehicleInputData Public Property DualFuelVehicle As Boolean Implements IVehicleDeclarationInputData.DualFuelVehicle Public Property MaxNetPower1 As Watt Implements IVehicleDeclarationInputData.MaxNetPower1 Public Property MaxNetPower2 As Watt Implements IVehicleDeclarationInputData.MaxNetPower2 - Public ReadOnly Property RegisteredClass As String Implements IVehicleDeclarationInputData.RegisteredClass + Public ReadOnly Property RegisteredClass As RegistrationClass Implements IVehicleDeclarationInputData.RegisteredClass Public ReadOnly Property NuberOfPassengersUpperDeck As Integer Implements IVehicleDeclarationInputData.NuberOfPassengersUpperDeck Public ReadOnly Property NumberOfPassengersLowerDeck As Integer Implements IVehicleDeclarationInputData.NumberOfPassengersLowerDeck Public ReadOnly Property VehicleCode As VehicleCode Implements IVehicleDeclarationInputData.VehicleCode diff --git a/VECTO/Input Files/VectoJob.vb b/VECTO/Input Files/VectoJob.vb index 3e800bc1c7d7b38a9f5677c0c31adbb9b137736c..7a2be139a8bccac5040963dc62a4c0ef85c35b45 100644 --- a/VECTO/Input Files/VectoJob.vb +++ b/VECTO/Input Files/VectoJob.vb @@ -550,6 +550,8 @@ Public Class VectoJob End Get End Property + Public ReadOnly Property PrimaryVehicleData As IPrimaryVehicleInformationInputDataProvider Implements IDeclarationInputDataProvider.PrimaryVehicleData + Public ReadOnly Property IDeclarationInputDataProvider_JobInputData As IDeclarationJobInputData _ Implements IDeclarationInputDataProvider.JobInputData Get diff --git a/VECTO/Input Files/Vehicle.vb b/VECTO/Input Files/Vehicle.vb index 828418783bb501462edf2dfba21c73a66149b64f..a58e6ba3569f600b30ea2ad6ee1913ebe51b1cc2 100644 --- a/VECTO/Input Files/Vehicle.vb +++ b/VECTO/Input Files/Vehicle.vb @@ -758,7 +758,7 @@ Public Class Vehicle End Get End Property - Public ReadOnly Property RegisteredClass As String Implements IVehicleDeclarationInputData.RegisteredClass + Public ReadOnly Property RegisteredClass As RegistrationClass Implements IVehicleDeclarationInputData.RegisteredClass Public ReadOnly Property NuberOfPassengersUpperDeck As Integer Implements IVehicleDeclarationInputData.NuberOfPassengersUpperDeck Public ReadOnly Property NumberOfPassengersLowerDeck As Integer Implements IVehicleDeclarationInputData.NumberOfPassengersLowerDeck Public ReadOnly Property VehicleCode As VehicleCode Implements IVehicleDeclarationInputData.VehicleCode diff --git a/VECTO3GUI/ViewModel/Adapter/Declaration/DeclarationJobAdapter.cs b/VECTO3GUI/ViewModel/Adapter/Declaration/DeclarationJobAdapter.cs index e0ae6e3810db06ebe0fceae0a8d33c6c3aa8b2aa..ebec06de9d60104d3e950f1b2f93f0ddbc5f38ef 100644 --- a/VECTO3GUI/ViewModel/Adapter/Declaration/DeclarationJobAdapter.cs +++ b/VECTO3GUI/ViewModel/Adapter/Declaration/DeclarationJobAdapter.cs @@ -20,6 +20,8 @@ namespace VECTO3GUI.ViewModel.Adapter.Declaration { get { return this; } } + public IPrimaryVehicleInformationInputDataProvider PrimaryVehicleData { get; } + public XElement XMLHash { get { return null; } } #endregion diff --git a/VECTO3GUI/ViewModel/Adapter/Declaration/VehicleDeclarationAdapter.cs b/VECTO3GUI/ViewModel/Adapter/Declaration/VehicleDeclarationAdapter.cs index 7cc42ef29d3096a3f63e27bc211ddcc3f5b6b243..474f1a140c55bba96b079ab5a71f20abd357e45b 100644 --- a/VECTO3GUI/ViewModel/Adapter/Declaration/VehicleDeclarationAdapter.cs +++ b/VECTO3GUI/ViewModel/Adapter/Declaration/VehicleDeclarationAdapter.cs @@ -107,7 +107,7 @@ namespace VECTO3GUI.ViewModel.Adapter.Declaration public bool DualFuelVehicle { get; } public Watt MaxNetPower1 { get; } public Watt MaxNetPower2 { get; } - public string RegisteredClass { get; } + public RegistrationClass RegisteredClass { get; } public int NuberOfPassengersUpperDeck { get; } public int NumberOfPassengersLowerDeck { get; } public VehicleCode VehicleCode { get; } diff --git a/VECTO3GUI/ViewModel/Impl/CompleteVehicleBusViewModel.cs b/VECTO3GUI/ViewModel/Impl/CompleteVehicleBusViewModel.cs index 1889918ddfbc02ac77016857bcb95d0c551d043d..5165e4625461148e3b6631c275a2e743fd03e246 100644 --- a/VECTO3GUI/ViewModel/Impl/CompleteVehicleBusViewModel.cs +++ b/VECTO3GUI/ViewModel/Impl/CompleteVehicleBusViewModel.cs @@ -25,7 +25,7 @@ namespace VECTO3GUI.ViewModel.Impl private string _vin; private DateTime _date; private LegislativeClass _legislativeClass; - private string _registeredClass; + private RegistrationClass _registeredClass; private VehicleCode _vehicleCode; private Kilogram _curbMassChassis; private Kilogram _technicalPermissibleMaximumLadenMass; @@ -73,7 +73,7 @@ namespace VECTO3GUI.ViewModel.Impl get { return _legislativeClass; } set { SetProperty(ref _legislativeClass, value); } } - public string RegisteredClass + public RegistrationClass RegisteredClass { get { return _registeredClass; } set { SetProperty(ref _registeredClass, value); } diff --git a/VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs b/VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs index 041be9aa062792bfc64136648396a80b96302fde..aabaa11bb279b4f46a214be9ea293a37f82a0e01 100644 --- a/VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs +++ b/VECTO3GUI/ViewModel/Impl/JoblistViewModel.cs @@ -187,7 +187,7 @@ namespace VECTO3GUI.ViewModel.Impl private IJobEditViewModel CreatePrimaryBusVehicleViewModel(IInputDataProvider inputData) { - var dataProvider = inputData as IPrimaryVehicleInputDataProvider; + var dataProvider = inputData as IPrimaryVehicleInformationInputDataProvider; return dataProvider == null ? null : new PrimaryVehicleBusJobViewModel(Kernel, dataProvider); } diff --git a/VECTO3GUI/ViewModel/Impl/PrimaryVehicleBusJobViewModel.cs b/VECTO3GUI/ViewModel/Impl/PrimaryVehicleBusJobViewModel.cs index b4fcb035ce9f25a39e5949107a2138d7b29f270d..e0b97c66b02e5c93d3fa1a410e23c767ca152998 100644 --- a/VECTO3GUI/ViewModel/Impl/PrimaryVehicleBusJobViewModel.cs +++ b/VECTO3GUI/ViewModel/Impl/PrimaryVehicleBusJobViewModel.cs @@ -14,7 +14,7 @@ namespace VECTO3GUI.ViewModel.Impl public class PrimaryVehicleBusJobViewModel : AbstractJobViewModel, IJobEditViewModel { - public PrimaryVehicleBusJobViewModel(IKernel kernel, IPrimaryVehicleInputDataProvider inputData) + public PrimaryVehicleBusJobViewModel(IKernel kernel, IPrimaryVehicleInformationInputDataProvider inputData) { Kernel = kernel; InputDataProvider = inputData; diff --git a/VECTO3GUI/ViewModel/Impl/PrimaryVehicleBusViewModel.cs b/VECTO3GUI/ViewModel/Impl/PrimaryVehicleBusViewModel.cs index 616b97e4f96d6d95087015051709bac5aceb32e2..b25ca814f747f20f79c35361cb7cd3b126e54ea7 100644 --- a/VECTO3GUI/ViewModel/Impl/PrimaryVehicleBusViewModel.cs +++ b/VECTO3GUI/ViewModel/Impl/PrimaryVehicleBusViewModel.cs @@ -223,7 +223,7 @@ namespace VECTO3GUI.ViewModel.Impl protected override void InputDataChanged() { - var inputData = JobViewModel.InputDataProvider as IPrimaryVehicleInputDataProvider; + var inputData = JobViewModel.InputDataProvider as IPrimaryVehicleInformationInputDataProvider; SetVehicleData(inputData?.Vehicle); } diff --git a/VECTO3GUI/ViewModel/Interfaces/ICompleteVehicleBusViewModel.cs b/VECTO3GUI/ViewModel/Interfaces/ICompleteVehicleBusViewModel.cs index 5b43fb46b6a5d2b7c28e8e33d74d544a31c10542..aba88c5e9aa7208e166e4ad378c125dbfee71aed 100644 --- a/VECTO3GUI/ViewModel/Interfaces/ICompleteVehicleBusViewModel.cs +++ b/VECTO3GUI/ViewModel/Interfaces/ICompleteVehicleBusViewModel.cs @@ -16,7 +16,7 @@ namespace VECTO3GUI.ViewModel.Interfaces string VIN { get; set; } DateTime Date { get; set; } LegislativeClass LegislativeClass { get; set; } - string RegisteredClass { get; set; } + RegistrationClass RegisteredClass { get; set; } VehicleCode VehicleCode { get; set; } Kilogram CurbMassChassis { get; set; } Kilogram TechnicalPermissibleMaximumLadenMass { get; set; } diff --git a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs index a4c0b27b38b70830d292ccf625447e2f7b99e11e..3a50dc4d4416a1e003fff4320c45df646bca97d4 100644 --- a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs +++ b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs @@ -163,7 +163,7 @@ namespace TUGraz.VectoCommon.InputData Watt MaxNetPower2 { get; } - string RegisteredClass { get; } + RegistrationClass RegisteredClass { get; } int NuberOfPassengersUpperDeck { get; } diff --git a/VectoCommon/VectoCommon/InputData/IInputDataProvider.cs b/VectoCommon/VectoCommon/InputData/IInputDataProvider.cs index 5bb6a4f25ee94419c4e0dceb21b49a7fbaaa9ebe..15890e7a8cd850d93870e4434a888248f8f67fdf 100644 --- a/VectoCommon/VectoCommon/InputData/IInputDataProvider.cs +++ b/VectoCommon/VectoCommon/InputData/IInputDataProvider.cs @@ -42,6 +42,8 @@ namespace TUGraz.VectoCommon.InputData { IDeclarationJobInputData JobInputData { get; } + IPrimaryVehicleInformationInputDataProvider PrimaryVehicleData { get; } + XElement XMLHash { get; } } @@ -54,7 +56,7 @@ namespace TUGraz.VectoCommon.InputData } - public interface IPrimaryVehicleInputDataProvider : IInputDataProvider + public interface IPrimaryVehicleInformationInputDataProvider : IInputDataProvider { IVehicleDeclarationInputData Vehicle { get; } diff --git a/VectoCommon/VectoCommon/Models/VehicleCategory.cs b/VectoCommon/VectoCommon/Models/VehicleCategory.cs index 7b6d08be3f8c601ac92da26e661bb7a066671e0a..732ed89df177098c8a543c231454a8da546019ab 100644 --- a/VectoCommon/VectoCommon/Models/VehicleCategory.cs +++ b/VectoCommon/VectoCommon/Models/VehicleCategory.cs @@ -42,7 +42,8 @@ namespace TUGraz.VectoCommon.Models CityBus, //InterurbanBus, Coach, - HeavyBusPrimaryVehicle + HeavyBusPrimaryVehicle, + HeavyBusCompletedVehicle } public static class VehicleCategoryHelper @@ -64,6 +65,8 @@ namespace TUGraz.VectoCommon.Models // return "Coach"; case VehicleCategory.HeavyBusPrimaryVehicle: return "Heavy Bus, Primary Vehicle"; + case VehicleCategory.HeavyBusCompletedVehicle: + return "Heavy Bus, Completed Vehicle"; default: return category.ToString(); } @@ -86,6 +89,8 @@ namespace TUGraz.VectoCommon.Models // return "Coach"; case VehicleCategory.HeavyBusPrimaryVehicle: return "Heavy Bus, Primary Vehicle"; + case VehicleCategory.HeavyBusCompletedVehicle: + return "Heavy Bus, Completed Vehicle"; default: return category.ToString(); } @@ -105,6 +110,8 @@ namespace TUGraz.VectoCommon.Models return "Rigid Lorry"; case VehicleCategory.HeavyBusPrimaryVehicle: return "Bus"; + case VehicleCategory.HeavyBusCompletedVehicle: + return "Bus"; default: throw new ArgumentOutOfRangeException("vehicleCategory", vehicleCategory, null); } @@ -121,6 +128,7 @@ namespace TUGraz.VectoCommon.Models //case VehicleCategory.InterurbanBus: case VehicleCategory.Coach: case VehicleCategory.HeavyBusPrimaryVehicle: + case VehicleCategory.HeavyBusCompletedVehicle: return false; default: throw new ArgumentOutOfRangeException("VehicleCategory", category, null); @@ -132,7 +140,8 @@ namespace TUGraz.VectoCommon.Models switch (category) { case VehicleCategory.Coach: case VehicleCategory.CityBus: - case VehicleCategory.HeavyBusPrimaryVehicle: return true; + case VehicleCategory.HeavyBusPrimaryVehicle: + case VehicleCategory.HeavyBusCompletedVehicle: return true; default: return false; } } diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs index 083d03a68d7b06f97f31fed884035b1ba8276ad0..0c51525c307955e39b7c988f16b30f3d50139ebc 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs @@ -106,6 +106,8 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON get { return this; } } + public virtual IPrimaryVehicleInformationInputDataProvider PrimaryVehicleData { get { return null; } } + public XElement XMLHash { get { return new XElement(XMLNames.DI_Signature); } @@ -416,7 +418,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON get { return null; } } - public string RegisteredClass { get { return string.Empty; } } + public RegistrationClass RegisteredClass { get { return RegistrationClass.unknown; } } public int NuberOfPassengersUpperDeck { get { return 0; } } public int NumberOfPassengersLowerDeck { get { return 0; } } public VehicleCode VehicleCode { get { return VehicleCode.NOT_APPLICABLE; } } diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs index 2ea76c894d71803fc46f868246156b0cc9c13ca0..e89bcaf6767b7c14fb445bc88afbfe0588607b8b 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs @@ -278,6 +278,10 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON get { return this; } } + public virtual IPrimaryVehicleInformationInputDataProvider PrimaryVehicleData { + get { return null; } + } + public XElement XMLHash { get { return new XElement(XMLNames.DI_Signature); } @@ -1005,6 +1009,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON #region Implementation of IDeclarationInputDataProvider public IDeclarationJobInputData JobInputData { get { return this; } } + public virtual IPrimaryVehicleInformationInputDataProvider PrimaryVehicleData { get { return null; } } public XElement XMLHash { get { return new XElement(XMLNames.DI_Signature); } } #endregion @@ -1017,4 +1022,52 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON #endregion } + + + public class JSONInputDataComptededBusFactorMethodV7 : JSONFile, IDeclarationInputDataProvider, IDeclarationJobInputData + { + private readonly IXMLInputDataReader _xmlInputReader; + + public JSONInputDataComptededBusFactorMethodV7(JObject data, string filename, bool tolerateMissing = false) : base( + data, filename, tolerateMissing) + { + var kernel = new StandardKernel(new VectoNinjectModule()); + _xmlInputReader = kernel.Get<IXMLInputDataReader>(); + + var primaryInputData = Path.Combine(BasePath, Body.GetEx<string>("PrimaryVehicleResults")); + var completedInputData = Path.Combine(BasePath, Body.GetEx<string>("CompletedVehicle")); + + //PrimaryVehicle = CreateReader(primaryInputData); + + Vehicle = _xmlInputReader.CreateDeclaration(completedInputData).JobInputData.Vehicle; + PrimaryVehicleData = (_xmlInputReader.Create(primaryInputData) as IPrimaryVehicleInformationInputDataProvider); + JobName = Vehicle.VIN; + } + + + //private IDeclarationInputDataProvider CreateReader(string vehicleFileName) + //{ + // if (Path.GetExtension(vehicleFileName) != ".xml") { + // throw new VectoException("unsupported vehicle file format {0}", vehicleFileName); + // } + + // return ; + //} + + #region Implementation of IDeclarationInputDataProvider + + public IDeclarationJobInputData JobInputData { get { return this; } } + public IPrimaryVehicleInformationInputDataProvider PrimaryVehicleData { get; } + public XElement XMLHash { get; } + + #endregion + + #region Implementation of IDeclarationJobInputData + + public IVehicleDeclarationInputData Vehicle { get; } + public string JobName { get; } + public string ShiftStrategy { get { return ""; } } + + #endregion + } } diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputDataFactory.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputDataFactory.cs index 1edf824646ef8656592ed330da1f84c266ad95c2..6cc09a96bbe9e6f8c153fd110f20306704f8248a 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputDataFactory.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputDataFactory.cs @@ -95,6 +95,8 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON return new JSONInputDataV5(json, filename, tolerateMissing); case 6: return new JSONInputDataSingleBusV6(json, filename, tolerateMissing); + case 7: + return new JSONInputDataComptededBusFactorMethodV7(json, filename, tolerateMissing); default: throw new VectoException("Job-File: Unsupported FileVersion. Got: {0} ", version); } diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs index 53cb71627c44c93eb9fbc9013f1da3de9c10d570..bbc71331921ec93185065d0d2f18461cb5a000dd 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs @@ -588,9 +588,9 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON get { return null; } } - public virtual string RegisteredClass + public virtual RegistrationClass RegisteredClass { - get { return string.Empty; } + get { return RegistrationClass.unknown; } } public virtual int NuberOfPassengersUpperDeck diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationInputDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationInputDataProvider.cs index 490086b8c99419d08335ff8453cb2eb5a0ee6d85..bae1003efdb058982dff809699f4488b708801cf 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationInputDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationInputDataProvider.cs @@ -87,6 +87,8 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration get { return JobData ?? (JobData = Reader.JobData); } } + public virtual IPrimaryVehicleInformationInputDataProvider PrimaryVehicleData { get { return null; } } + public virtual XElement XMLHash { get; private set; } } diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs index afe1702560c9681aa03db2f9204b243c755506e0..940884541bf7dc1b72d2a486ee160473015bbe54 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs @@ -31,6 +31,7 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Runtime.InteropServices; using System.Windows.Forms.VisualStyles; using System.Xml; @@ -272,9 +273,9 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider } } - public virtual string RegisteredClass + public virtual RegistrationClass RegisteredClass { - get { return string.Empty; } + get { return RegistrationClass.unknown; } } public virtual int NuberOfPassengersUpperDeck @@ -786,9 +787,14 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider #region Overrides of XMLDeclarationVehicleDataProviderV10 - public override string RegisteredClass + public override VehicleCategory VehicleCategory + { + get { return VehicleCategory.HeavyBusCompletedVehicle; } + } + + public override RegistrationClass RegisteredClass { - get { return GetString(XMLNames.Vehicle_RegisteredClass); } + get { return RegistrationClassHelper.Parse(GetString(XMLNames.Vehicle_RegisteredClass)).First(); } } public override VehicleCode VehicleCode @@ -1020,7 +1026,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider public bool DualFuelVehicle { get; } public Watt MaxNetPower1 { get; } public Watt MaxNetPower2 { get; } - public string RegisteredClass { get; } + public RegistrationClass RegisteredClass { get; } public VehicleCode VehicleCode { get; } public FloorType FloorType { get; } public bool Articulated { get; } diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/Interfaces/IXMLDeclarationInputData.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/Interfaces/IXMLDeclarationInputData.cs index 1ad7902920c9e411d0a1a7f3e55786997e8df3e0..be78f071e6b119b403e2e5a91c5b060a979654de 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/Interfaces/IXMLDeclarationInputData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/Interfaces/IXMLDeclarationInputData.cs @@ -10,7 +10,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.Interfaces - public interface IXMLPrimaryVehicleBusInputData : IPrimaryVehicleInputDataProvider, IXMLResource + public interface IXMLPrimaryVehicleBusInputData : IPrimaryVehicleInformationInputDataProvider, IXMLResource { IXMLDeclarationPrimaryVehicleBusInputDataReader Reader { set; } diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/DataProvider/XMLEngineeringVehicleDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/DataProvider/XMLEngineeringVehicleDataProvider.cs index 0734e05b54ccbe760e9bac29d25ee3839658d728..b01449cf18aae376b67f08996169ad6524e5b27a 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/DataProvider/XMLEngineeringVehicleDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/DataProvider/XMLEngineeringVehicleDataProvider.cs @@ -164,7 +164,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering.DataProvider get { return null; } } - public virtual string RegisteredClass { get { return string.Empty;} } + public virtual RegistrationClass RegisteredClass { get { return RegistrationClass.unknown;} } public virtual int NuberOfPassengersUpperDeck { get { return 0; } } public virtual int NumberOfPassengersLowerDeck { get { return 0; } } public virtual VehicleCode VehicleCode { get { return VehicleCode.NOT_APPLICABLE; } } diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/XMLInputDataFactory.cs b/VectoCore/VectoCore/InputData/FileIO/XML/XMLInputDataFactory.cs index 9ed6cdf680b9278cdc9e02573153c9710c67c328..100cea5e5caee7cb49d1787ac24dda0cfc3febf3 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/XMLInputDataFactory.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/XMLInputDataFactory.cs @@ -144,7 +144,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML } } - private IPrimaryVehicleInputDataProvider ReadPrimaryVehicleDeclarationJob(XmlDocument xmlDoc, string source) + private IPrimaryVehicleInformationInputDataProvider ReadPrimaryVehicleDeclarationJob(XmlDocument xmlDoc, string source) { var versionNumber = XMLHelper.GetXsdType(xmlDoc.DocumentElement?.SchemaInfo.SchemaType); try { diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/CombinedBusAuxiliaries.cs b/VectoCore/VectoCore/InputData/Reader/Impl/CombinedBusAuxiliaries.cs new file mode 100644 index 0000000000000000000000000000000000000000..7876b44cca7b0aa370b8d20caa647cdc0f07eb19 --- /dev/null +++ b/VectoCore/VectoCore/InputData/Reader/Impl/CombinedBusAuxiliaries.cs @@ -0,0 +1,89 @@ +using System.Collections.Generic; +using System.Linq; +using System.Xml; +using TUGraz.VectoCommon.BusAuxiliaries; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.InputData.Reader.Impl { + public class CombinedBusAuxiliaries : IBusAuxiliariesDeclarationData, IElectricSupplyDeclarationData, IPneumaticSupplyDeclarationData, IElectricConsumersDeclarationData, IPneumaticConsumersDeclarationData, IHVACBusAuxiliariesDeclarationData + { + private IBusAuxiliariesDeclarationData CompletedAux; + private IBusAuxiliariesDeclarationData PrimaryAux; + + public CombinedBusAuxiliaries(IBusAuxiliariesDeclarationData primary, IBusAuxiliariesDeclarationData completed) + { + PrimaryAux = primary; + CompletedAux = completed; + } + + #region Implementation of IBusAuxiliariesDeclarationData + + public XmlNode XMLSource { get { return null; } } + public string FanTechnology { get { return PrimaryAux.FanTechnology; } } + public IList<string> SteeringPumpTechnology { get { return PrimaryAux.SteeringPumpTechnology; } } + public IElectricSupplyDeclarationData ElectricSupply { get { return this; } } + public IElectricConsumersDeclarationData ElectricConsumers { get { return this; } } + public IPneumaticSupplyDeclarationData PneumaticSupply { get { return this; } } + public IPneumaticConsumersDeclarationData PneumaticConsumers { get { return this; } } + public IHVACBusAuxiliariesDeclarationData HVACAux { get { return this; } } + + #endregion + + #region Implementation of IElectricSupplyDeclarationData + + public IList<IAlternatorDeclarationInputData> Alternators + { + get { return PrimaryAux.ElectricSupply.Alternators.Concat(CompletedAux.ElectricSupply.Alternators).ToList(); } + } + + public bool SmartElectrics { get; } + public Watt MaxAlternatorPower { get; } + public WattSecond ElectricStorageCapacity { get; } + + #endregion + + #region Implementation of IPneumaticSupplyDeclarationData + + public string Clutch { get; } + public double Ratio { get; } + public string CompressorSize { get; } + public bool SmartAirCompression { get; } + public bool SmartRegeneration { get; } + + #endregion + + #region Implementation of IElectricConsumersDeclarationData + + public bool InteriorLightsLED { get; } + public bool DayrunninglightsLED { get; } + public bool PositionlightsLED { get; } + public bool HeadlightsLED { get; } + public bool BrakelightsLED { get; } + + #endregion + + #region Implementation of IPneumaticConsumersDeclarationData + + public ConsumerTechnology AirsuspensionControl { get; } + public ConsumerTechnology AdBlueDosing { get; } + public ConsumerTechnology DoorDriveTechnology { get; } + + #endregion + + #region Implementation of IHVACBusAuxiliariesDeclarationData + + public BusHVACSystemConfiguration SystemConfiguration { get; } + public ACCompressorType CompressorTypeDriver { get; } + public ACCompressorType CompressorTypePassenger { get; } + public Watt AuxHeaterPower { get; } + public bool DoubleGlasing { get; } + public bool HeatPump { get; } + public bool AdjustableCoolantThermostat { get; } + public bool AdjustableAuxiliaryHeater { get; } + public bool EngineWasteGasHeatExchanger { get; } + public bool SeparateAirDistributionDucts { get; } + + #endregion + } +} \ No newline at end of file diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationDataAdapterCompletedBus.cs b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationDataAdapterCompletedBus.cs new file mode 100644 index 0000000000000000000000000000000000000000..d585572d10068a613c375f534d3ab34b18e63b03 --- /dev/null +++ b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationDataAdapterCompletedBus.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Declaration; +using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.Models.SimulationComponent.Data; + +namespace TUGraz.VectoCore.InputData.Reader.Impl +{ + public class DeclarationDataAdapterCompletedBus + { + public DriverData CreateDriverData() + { + throw new System.NotImplementedException(); + } + + public AirdragData CreateAirdragData(IAirdragDeclarationInputData airdragInputData, Mission mission, Segment segment) + { + throw new System.NotImplementedException(); + } + + public RetarderData CreateRetarderData(IRetarderInputData retarderInputData) + { + throw new System.NotImplementedException(); + } + + public ShiftStrategyParameters CreateGearshiftData(GearboxData gearboxData, double axleRatio, PerSecond idleSpeed) + { + throw new System.NotImplementedException(); + } + + public VehicleData CreateVehicleData( + IVehicleDeclarationInputData vehicle, Mission mission, KeyValuePair<LoadingType, Kilogram> loading) + { + throw new System.NotImplementedException(); + } + + public IEnumerable<VectoRunData.AuxData> CreateAuxiliaryData( + IAuxiliariesDeclarationInputData auxiliaryInputData, IBusAuxiliariesDeclarationData mergedBusAux, + MissionType mission, VehicleClass vehicleClass, Meter vehicleLength) + { + throw new System.NotImplementedException(); + } + } +} diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeBusVectoRunDataFactory.cs b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeBusVectoRunDataFactory.cs index 6ace7b0411608d99601b4cef83fe4faad30e952e..51414abe596759cde8584008e6e75832b191e8d1 100644 --- a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeBusVectoRunDataFactory.cs +++ b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeBusVectoRunDataFactory.cs @@ -44,8 +44,8 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl "Invalid vehicle category for bus factory! {0}", vehicle.VehicleCategory.GetCategoryName()); } - var segment = DeclarationData.BusSegments.Lookup( - vehicle.VehicleCategory, vehicle.AxleConfiguration, vehicle.Articulated, vehicle.FloorType, false, true); + var segment = DeclarationData.PrimaryBusSegments.Lookup( + vehicle.VehicleCategory, vehicle.AxleConfiguration, vehicle.Articulated, vehicle.FloorType, false); if (!segment.Found) { throw new VectoException( "no segment found for vehicle configruation: vehicle category: {0}, axle configuration: {1}, articulated: {2}, primary", diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeCompletedBusVectoRunDataFactory.cs b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeCompletedBusVectoRunDataFactory.cs new file mode 100644 index 0000000000000000000000000000000000000000..513fef661560b532d1c3c7a102c1abcc93ceeae7 --- /dev/null +++ b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeCompletedBusVectoRunDataFactory.cs @@ -0,0 +1,268 @@ +using System.Collections.Generic; +using System.Linq; +using TUGraz.VectoCommon.BusAuxiliaries; +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +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 + { + protected static readonly object CyclesCacheLock = new object(); + + protected static readonly Dictionary<MissionType, DrivingCycleData> CyclesCache = + new Dictionary<MissionType, DrivingCycleData>(); + + protected readonly IDeclarationInputDataProvider InputDataProvider; + protected IDeclarationReport Report; + + + protected Segment _segment; + protected DriverData _driverdata; + protected AirdragData _airdragData; + protected AxleGearData _axlegearData; + protected AngledriveData _angledriveData; + protected GearboxData _gearboxData; + protected RetarderData _retarderData; + protected PTOData _ptoTransmissionData; + + protected PTOData _municipalPtoTransmissionData; + + //protected Exception InitException; + protected ShiftStrategyParameters _gearshiftData; + + protected DeclarationDataAdapterCompletedBus DataAdapterCompleted = new DeclarationDataAdapterCompletedBus(); + + protected DeclarationDataAdapterPrimaryBus DataAdapterPrimary = new DeclarationDataAdapterPrimaryBus(); + + public DeclarationModeCompletedBusVectoRunDataFactory( + IDeclarationInputDataProvider dataProvider, IDeclarationReport report) + { + InputDataProvider = dataProvider; + Report = report; + } + + public IEnumerable<VectoRunData> NextRun() + { + Initialize(); + if (Report != null) { + InitializeReport(); + } + + return GetNextRun(); + } + + protected virtual void InitializeReport() + { + var vehicle = InputDataProvider.JobInputData.Vehicle; + + var powertrainConfig = _segment.Missions.Select( + mission => CreateVectoRunDataSpecific( + vehicle, InputDataProvider.PrimaryVehicleData.Vehicle, mission, mission.Loadings.First())) + .FirstOrDefault(x => x != null); + + Report.InitializeReport(powertrainConfig, new List<List<FuelData.Entry>>()); + } + + + + protected virtual void Initialize() + { + var vehicle = InputDataProvider.JobInputData.Vehicle; + var primaryVehicle = InputDataProvider.PrimaryVehicleData.Vehicle; + if (vehicle.ExemptedVehicle) { + return; + } + + _segment = GetSegment(vehicle, primaryVehicle.AxleConfiguration); + _driverdata = DataAdapterCompleted.CreateDriverData(); + _driverdata.AccelerationCurve = AccelerationCurveReader.ReadFromStream(_segment.AccelerationFile); + //var tempVehicle = DataAdapter.CreateVehicleData( + // vehicle, _segment.Missions.First(), + // _segment.Missions.First().Loadings.First()); + _airdragData = DataAdapterCompleted.CreateAirdragData( + vehicle.Components.AirdragInputData, + _segment.Missions.First(), _segment); + + _axlegearData = DeclarationData.FactorMethodBus.CreateAxlegearData(primaryVehicle.Components.AxleGearInputData); + + _angledriveData = null; + var tmpRunData = new VectoRunData() { + ShiftStrategy = InputDataProvider.JobInputData.ShiftStrategy, + GearboxData = new GearboxData() { + Type = vehicle.Components.GearboxInputData.Type, + } + }; + + //var tmpStrategy = PowertrainBuilder.GetShiftStrategy(tmpRunData, new SimplePowertrainContainer(tmpRunData)); + var tmpEngine = DeclarationData.FactorMethodBus.CreateBusEngineData(primaryVehicle.Components.EngineInputData); + _gearboxData = DeclarationData.FactorMethodBus.CreateGearboxData(primaryVehicle.Components.GearboxInputData); + + _retarderData = DataAdapterCompleted.CreateRetarderData(vehicle.Components.RetarderInputData); + + _ptoTransmissionData = null; + + _municipalPtoTransmissionData = null; + _gearshiftData = DataAdapterCompleted.CreateGearshiftData( + _gearboxData, _axlegearData.AxleGear.Ratio * (_angledriveData?.Angledrive.Ratio ?? 1.0), tmpEngine.IdleSpeed); + } + + protected virtual IEnumerable<VectoRunData> GetNextRun() + { + if (InputDataProvider.JobInputData.Vehicle.VehicleCategory == VehicleCategory.HeavyBusCompletedVehicle) { + return VectoRunDataHeavyBusCompleted(); + } + + return new List<VectoRunData>(); + } + + private IEnumerable<VectoRunData> VectoRunDataHeavyBusCompleted() + { + var completedVehicle = InputDataProvider.JobInputData.Vehicle; + var primaryVehicle = InputDataProvider.PrimaryVehicleData.Vehicle; + foreach (var mission in _segment.Missions) { + foreach (var loading in mission.Loadings) { + var simulationRunData = CreateVectoRunDataSpecific(primaryVehicle, completedVehicle, mission, loading); + if (simulationRunData != null) { + yield return simulationRunData; + } + + var primarySegment = DeclarationData.PrimaryBusSegments.Lookup( + primaryVehicle.VehicleCategory, primaryVehicle.AxleConfiguration, primaryVehicle.Articulated, + primaryVehicle.FloorType, completedVehicle.VehicleCode.IsDoubleDeckBus()); + var primaryMission = primarySegment.Missions.Where( + m => { + return m.BusParameter.DoubleDecker == completedVehicle.VehicleCode.IsDoubleDeckBus() && + m.MissionType == mission.MissionType; + }).First(); + simulationRunData = CreateVectoRunDataGeneric(primaryVehicle, completedVehicle, primaryMission, loading); + yield return simulationRunData; + } + } + } + + protected virtual Segment GetSegment(IVehicleDeclarationInputData vehicle, AxleConfiguration axleConfiguration) + { + if (vehicle.VehicleCategory != VehicleCategory.HeavyBusCompletedVehicle) { + throw new VectoException( + "Invalid vehicle category for bus factory! {0}", vehicle.VehicleCategory.GetCategoryName()); + } + + var segment = DeclarationData.CompletedBusSegments.Lookup( + axleConfiguration.NumAxles(), vehicle.VehicleCode, vehicle.RegisteredClass, vehicle.NumberOfPassengersLowerDeck, vehicle.Height, vehicle.FloorType == FloorType.LowFloor); + if (!segment.Found) { + throw new VectoException( + "no segment found for vehicle configruation: vehicle category: {0}, axle configuration: {1}, articulated: {2}, primary", + vehicle.VehicleCategory, axleConfiguration, + vehicle.Articulated); + } + + return segment; + } + + + protected VectoRunData CreateVectoRunDataSpecific( + IVehicleDeclarationInputData primaryVehicle, IVehicleDeclarationInputData completedVehicle, + Mission mission, KeyValuePair<LoadingType, Kilogram> loading) + { + DrivingCycleData cycle; + lock (CyclesCacheLock) { + if (CyclesCache.ContainsKey(mission.MissionType)) { + cycle = CyclesCache[mission.MissionType]; + } else { + cycle = DrivingCycleDataReader.ReadFromStream(mission.CycleFile, CycleType.DistanceBased, "", false); + CyclesCache.Add(mission.MissionType, cycle); + } + } + var mergedBusAux = new CombinedBusAuxiliaries( + primaryVehicle.Components.BusAuxiliaries, completedVehicle.Components.BusAuxiliaries); + + var simulationRunData = new VectoRunData { + Loading = loading.Key, + VehicleData = DataAdapterCompleted.CreateVehicleData(primaryVehicle, mission, loading), + AirdragData = DataAdapterCompleted.CreateAirdragData(null, mission, new Segment()), + EngineData = DeclarationData.FactorMethodBus.CreateBusEngineData(primaryVehicle.Components.EngineInputData), + GearboxData = _gearboxData, + AxleGearData = _axlegearData, + AngledriveData = _angledriveData, + Aux = DataAdapterCompleted.CreateAuxiliaryData( + primaryVehicle.Components.AuxiliaryInputData, + mergedBusAux, mission.MissionType, _segment.VehicleClass, + primaryVehicle.Length ?? mission.BusParameter.VehicleLength), + Cycle = new DrivingCycleProxy(cycle, mission.MissionType.ToString()), + Retarder = _retarderData, + DriverData = _driverdata, + ExecutionMode = ExecutionMode.Declaration, + JobName = InputDataProvider.JobInputData.JobName, + ModFileSuffix = "_specific_" + mission.BusParameter.BusGroup.GetClassNumber() + "_" + loading.Key.ToString(), + Report = Report, + Mission = mission, + InputDataHash = InputDataProvider.XMLHash, + SimulationType = SimulationType.DistanceCycle, + GearshiftParameters = _gearshiftData, + ShiftStrategy = InputDataProvider.JobInputData.ShiftStrategy + }; + simulationRunData.EngineData.FuelMode = 0; + simulationRunData.VehicleData.VehicleClass = _segment.VehicleClass; + simulationRunData.BusAuxiliaries = DataAdapterPrimary.CreateBusAuxiliariesData( + mission, InputDataProvider.JobInputData.Vehicle, simulationRunData); + return simulationRunData; + } + + + protected VectoRunData CreateVectoRunDataGeneric( + IVehicleDeclarationInputData primaryVehicle, IVehicleDeclarationInputData completedVehicle, + Mission mission, KeyValuePair<LoadingType, Kilogram> loading) + { + DrivingCycleData cycle; + lock (CyclesCacheLock) { + if (CyclesCache.ContainsKey(mission.MissionType)) { + cycle = CyclesCache[mission.MissionType]; + } else { + cycle = DrivingCycleDataReader.ReadFromStream(mission.CycleFile, CycleType.DistanceBased, "", false); + CyclesCache.Add(mission.MissionType, cycle); + } + } + var simulationRunData = new VectoRunData { + Loading = loading.Key, + VehicleData = DataAdapterPrimary.CreateVehicleData(primaryVehicle, mission, loading), + AirdragData = DataAdapterPrimary.CreateAirdragData(null, mission, new Segment()), + EngineData = DeclarationData.FactorMethodBus.CreateBusEngineData(primaryVehicle.Components.EngineInputData), + GearboxData = _gearboxData, + AxleGearData = _axlegearData, + AngledriveData = _angledriveData, + Aux = DataAdapterPrimary.CreateAuxiliaryData( + primaryVehicle.Components.AuxiliaryInputData, + completedVehicle.Components.BusAuxiliaries, mission.MissionType, _segment.VehicleClass, + primaryVehicle.Length ?? mission.BusParameter.VehicleLength), + Cycle = new DrivingCycleProxy(cycle, mission.MissionType.ToString()), + Retarder = _retarderData, + DriverData = _driverdata, + ExecutionMode = ExecutionMode.Declaration, + JobName = InputDataProvider.JobInputData.JobName, + ModFileSuffix = "_generic_" + mission.BusParameter.BusGroup.GetClassNumber() + "_" + loading.Key.ToString(), + Report = Report, + Mission = mission, + InputDataHash = InputDataProvider.XMLHash, + SimulationType = SimulationType.DistanceCycle, + GearshiftParameters = _gearshiftData, + ShiftStrategy = InputDataProvider.JobInputData.ShiftStrategy + }; + simulationRunData.EngineData.FuelMode = 0; + simulationRunData.VehicleData.VehicleClass = _segment.VehicleClass; + simulationRunData.BusAuxiliaries = DataAdapterPrimary.CreateBusAuxiliariesData( + mission, InputDataProvider.JobInputData.Vehicle, simulationRunData); + return simulationRunData; + } + } +} diff --git a/VectoCore/VectoCore/Models/Declaration/CompletedBusSegments.cs b/VectoCore/VectoCore/Models/Declaration/CompletedBusSegments.cs index 4c5d99e123e947f8e5db3d1eab45d64eb6b61090..5d7eb4258b3fa0e8e6a6274e26baa1f2b61d5e42 100644 --- a/VectoCore/VectoCore/Models/Declaration/CompletedBusSegments.cs +++ b/VectoCore/VectoCore/Models/Declaration/CompletedBusSegments.cs @@ -122,7 +122,6 @@ namespace TUGraz.VectoCore.Models.Declaration AxleWeightDistribution = GetAxleWeightDistribution(row), DefaultCDxA = row.ParseDouble("cdxastandard").SI<SquareMeter>(), BusParameter = new BusParameters { - FloorType = GetFloorType(row.Field<string>("floortype")), PassengerDensity = row.ParseDouble(missionType.ToString()).SI<PerSquareMeter>(), AirDragMeasurementAllowed = row.ParseBoolean("airdragmeasurement"), VehicleEquipment = GetVehicleEquipment(row), diff --git a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs index 5997ae1d68e8ad3be4b6b8985acafcd660b9c8ae..6cc992bfeee909a9e7dd7b0c4b74dcd430e23c29 100644 --- a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs +++ b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs @@ -69,7 +69,7 @@ namespace TUGraz.VectoCore.Models.Declaration public static readonly Watt MinEnginePowerForEMS = 300e3.SI<Watt>(); public static readonly TruckSegments TruckSegments = new TruckSegments(); - public static readonly BusSegments BusSegments = new BusSegments(); + public static readonly PrimaryBusSegments PrimaryBusSegments = new PrimaryBusSegments(); public static readonly CompletedBusSegments CompletedBusSegments = new CompletedBusSegments(); public static readonly Wheels Wheels = new Wheels(); public static readonly PT1 PT1 = new PT1(); @@ -134,6 +134,24 @@ namespace TUGraz.VectoCore.Models.Declaration return 1; } + public static class FactorMethodBus + { + public static CombustionEngineData CreateBusEngineData(IEngineDeclarationInputData componentsEngineInputData) + { + throw new NotImplementedException(); + } + + public static AxleGearData CreateAxlegearData(IAxleGearInputData axlegearData) + { + throw new NotImplementedException(); + } + + public static GearboxData CreateGearboxData(IGearboxDeclarationInputData gearboxData) + { + throw new NotImplementedException(); + } + } + public static class BusAuxiliaries { //private static ISSMInputs ssmInputs = null; diff --git a/VectoCore/VectoCore/Models/Declaration/BusSegments.cs b/VectoCore/VectoCore/Models/Declaration/PrimaryBusSegments.cs similarity index 95% rename from VectoCore/VectoCore/Models/Declaration/BusSegments.cs rename to VectoCore/VectoCore/Models/Declaration/PrimaryBusSegments.cs index 87b4acacfcaa4adcc0484d9febf372d22a5592dd..b5a2d3f5257cf484f48193a3f5be89a4bb26597a 100644 --- a/VectoCore/VectoCore/Models/Declaration/BusSegments.cs +++ b/VectoCore/VectoCore/Models/Declaration/PrimaryBusSegments.cs @@ -10,7 +10,7 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.Declaration { - public sealed class BusSegments : LookupData<VehicleCategory, AxleConfiguration, bool, FloorType, bool, bool, Segment> + public sealed class PrimaryBusSegments : LookupData<VehicleCategory, AxleConfiguration, bool, FloorType, bool, Segment> { private DataTable _segmentTable; @@ -37,13 +37,9 @@ namespace TUGraz.VectoCore.Models.Declaration public override Segment Lookup( VehicleCategory vehicleCategory, AxleConfiguration axleConfiguration, bool articulated, FloorType entrance, - bool doubleDecker, bool primaryVehicle) + bool doubleDecker) { - if (primaryVehicle) { - return LookupPrimaryVehicle(vehicleCategory, axleConfiguration, articulated); - } - - throw new NotImplementedException("Completed Vehicles not implemented"); + return LookupPrimaryVehicle(vehicleCategory, axleConfiguration, articulated); } #endregion diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs b/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs index 632622157b5c6f13e9e04654350dd8a85eb3bf16..4265f61e301722db4b0e360fce459e4646899fba 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs @@ -103,10 +103,20 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl if (dataProvider is IDeclarationInputDataProvider) { var declDataProvider = dataProvider as IDeclarationInputDataProvider; var report = declarationReport ?? new XMLDeclarationReport(ModWriter, declDataProvider.JobInputData.Vehicle.VehicleCategory == VehicleCategory.HeavyBusPrimaryVehicle); - DataReader = declDataProvider.JobInputData.Vehicle.VehicleCategory.IsTruck() - ? (IVectoRunDataFactory)new DeclarationModeTruckVectoRunDataFactory(declDataProvider, report) - : new DeclarationModeBusVectoRunDataFactory(declDataProvider, report); - return; + if (declDataProvider.JobInputData.Vehicle.VehicleCategory.IsTruck()) { + DataReader = new DeclarationModeTruckVectoRunDataFactory(declDataProvider, report); + return; + } + + switch (declDataProvider.JobInputData.Vehicle.VehicleCategory) { + case VehicleCategory.HeavyBusCompletedVehicle: + DataReader = new DeclarationModeCompletedBusVectoRunDataFactory(declDataProvider, report); + report.PrimaryResults = declDataProvider.PrimaryVehicleData; + return; + case VehicleCategory.HeavyBusPrimaryVehicle: + DataReader = new DeclarationModeBusVectoRunDataFactory(declDataProvider, report); + return; + } } throw new VectoException("Unknown InputData for Declaration Mode!"); } diff --git a/VectoCore/VectoCore/Models/Simulation/SimulationFactoryNinjectModule.cs b/VectoCore/VectoCore/Models/Simulation/SimulationFactoryNinjectModule.cs index 7424691949a2f883cce7ccf01507ec25c3f605a1..34681b65e5d48bd41ae2d28951d549c38e894f68 100644 --- a/VectoCore/VectoCore/Models/Simulation/SimulationFactoryNinjectModule.cs +++ b/VectoCore/VectoCore/Models/Simulation/SimulationFactoryNinjectModule.cs @@ -50,6 +50,8 @@ namespace TUGraz.VectoCore.Models.Simulation } + public IPrimaryVehicleInformationInputDataProvider PrimaryResults { get; set; } + #endregion } @@ -72,6 +74,8 @@ namespace TUGraz.VectoCore.Models.Simulation } + public IPrimaryVehicleInformationInputDataProvider PrimaryResults { get; set; } + #endregion #region Implementation of IVTPReport diff --git a/VectoCore/VectoCore/OutputData/DeclarationReport.cs b/VectoCore/VectoCore/OutputData/DeclarationReport.cs index 44156fa6266dd2183d16ee21a1f3ed05037de220..72bf8f83400053f3acf39158b3ca60816738a615 100644 --- a/VectoCore/VectoCore/OutputData/DeclarationReport.cs +++ b/VectoCore/VectoCore/OutputData/DeclarationReport.cs @@ -34,6 +34,7 @@ using System.Linq; using System.Runtime.CompilerServices; using TUGraz.VectoCommon.BusAuxiliaries; using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.Declaration; @@ -65,6 +66,8 @@ namespace TUGraz.VectoCore.OutputData */ void AddResult( LoadingType loadingType, Mission mission, int fuelMode, VectoRunData runData, IModalDataContainer modData); + + IPrimaryVehicleInformationInputDataProvider PrimaryResults { get; set; } } public interface IResultEntry @@ -208,6 +211,8 @@ namespace TUGraz.VectoCore.OutputData WriteResults(); } + public IPrimaryVehicleInformationInputDataProvider PrimaryResults { get; set; } + protected IEnumerable<T> OrderedResults { get { diff --git a/VectoCore/VectoCore/VectoCore.csproj b/VectoCore/VectoCore/VectoCore.csproj index ce609e907c7797d05285e68342bd6a66d6b8a95d..0daffe7f5533f19f8ea174e201e5dde1dc0098cd 100644 --- a/VectoCore/VectoCore/VectoCore.csproj +++ b/VectoCore/VectoCore/VectoCore.csproj @@ -277,6 +277,9 @@ <Compile Include="InputData\FileIO\XML\IXMLInputDataReader.cs" /> <Compile Include="InputData\FileIO\XML\XMLInputDataNinjectModule.cs" /> <Compile Include="InputData\Reader\DataObjectAdapter\DeclarationDataAdapterSingleBus.cs" /> + <Compile Include="InputData\Reader\Impl\CombinedBusAuxiliaries.cs" /> + <Compile Include="InputData\Reader\Impl\DeclarationDataAdapterCompletedBus.cs" /> + <Compile Include="InputData\Reader\Impl\DeclarationModeCompletedBusVectoRunDataFactory.cs" /> <Compile Include="Models\BusAuxiliaries\DownstreamModules\Impl\Electrics\SimpleBattery.cs" /> <Compile Include="Models\BusAuxiliaries\Interfaces\DownstreamModules\Electrics\ISimpleBattery.cs" /> <Compile Include="Models\BusAuxiliaries\DownstreamModules\Impl\Electrics\M05Impl_P0.cs" /> @@ -362,7 +365,7 @@ <Compile Include="Models\BusAuxiliaries\Interfaces\Signals.cs" /> <Compile Include="Models\BusAuxiliaries\Util\FilePathUtils.cs" /> <Compile Include="Models\Declaration\BusAlternatorTechnologies.cs" /> - <Compile Include="Models\Declaration\BusSegments.cs" /> + <Compile Include="Models\Declaration\PrimaryBusSegments.cs" /> <Compile Include="Models\Declaration\HVACCoolingPower.cs" /> <Compile Include="Models\Declaration\SteeringPumpBus.cs" /> <Compile Include="Models\SimulationComponent\Data\Engine\WHRPowerMap.cs" /> diff --git a/VectoCore/VectoCore/VersionNumber1.cs b/VectoCore/VectoCore/VersionNumber1.cs new file mode 100644 index 0000000000000000000000000000000000000000..5f282702bb03ef11d7184d19c80927b47f919764 --- /dev/null +++ b/VectoCore/VectoCore/VersionNumber1.cs @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Integration/CompletedBus/CompletedBusFactorMethodTest.cs b/VectoCore/VectoCoreTest/Integration/CompletedBus/CompletedBusFactorMethodTest.cs new file mode 100644 index 0000000000000000000000000000000000000000..66554b17ac7376af6ca5731679e73d00ad2d1e49 --- /dev/null +++ b/VectoCore/VectoCoreTest/Integration/CompletedBus/CompletedBusFactorMethodTest.cs @@ -0,0 +1,53 @@ +using System; +using System.IO; +using System.Linq; +using Ninject; +using NUnit.Framework; +using NUnit.Framework.Internal; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCore.InputData.FileIO.JSON; +using TUGraz.VectoCore.InputData.FileIO.XML; +using TUGraz.VectoCore.Models.Simulation.Impl; +using TUGraz.VectoCore.OutputData; +using TUGraz.VectoCore.OutputData.FileIO; + +namespace TUGraz.VectoCore.Tests.Integration.CompletedBus +{ + + [TestFixture()] + public class CompletedBusFactorMethodTest + { + [OneTimeSetUp] + public void RunBeforeAnyTests() + { + Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory); + + + + } + + [TestCase()] + public void TestCompletedBus() + { + var relativeJobPath = @"TestData\Integration\Buses\FactorMethod\CompletedBus.vecto"; + + 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) { + WriteModalResults = true, + //ActualModalData = true, + Validate = false + }; + var sumContainer = new SummaryDataContainer(writer); + var jobContainer = new JobContainer(sumContainer); + jobContainer.AddRuns(factory); + jobContainer.Execute(); + jobContainer.WaitFinished(); + var progress = jobContainer.GetProgress(); + + Assert.IsTrue(progress.All(r => r.Value.Success), string.Concat<Exception>(progress.Select(r => r.Value.Error))); + + //return jobContainer; + } + } +} diff --git a/VectoCore/VectoCoreTest/Models/Declaration/DeclarationSegmentHeavyBusesTest.cs b/VectoCore/VectoCoreTest/Models/Declaration/DeclarationSegmentHeavyBusesTest.cs index 53381649af2c6700e3404d44229c880843c20c4c..2846b5ca78b233ae8ae9d3946f454966c03a97fc 100644 --- a/VectoCore/VectoCoreTest/Models/Declaration/DeclarationSegmentHeavyBusesTest.cs +++ b/VectoCore/VectoCoreTest/Models/Declaration/DeclarationSegmentHeavyBusesTest.cs @@ -76,8 +76,8 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration VehicleCategory category, AxleConfiguration axleConfiguration, FloorType floorType, bool doubleDecker, bool articulated, VehicleClass expectedClass) { - var segment = DeclarationData.BusSegments.Lookup( - category, axleConfiguration, articulated, floorType, doubleDecker, true); + var segment = DeclarationData.PrimaryBusSegments.Lookup( + category, axleConfiguration, articulated, floorType, doubleDecker); Assert.AreEqual(10, segment.Missions.Length); Assert.AreEqual(expectedClass, segment.VehicleClass); @@ -94,9 +94,9 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration FloorType = FloorType.LowFloor, DoubleDecker = false }; - var segment = DeclarationData.BusSegments.Lookup( + var segment = DeclarationData.PrimaryBusSegments.Lookup( vehicleData.VehicleCategory, vehicleData.AxleConfiguration, vehicleData.Articulated, vehicleData.FloorType, - vehicleData.DoubleDecker, true); + vehicleData.DoubleDecker); Assert.AreEqual(10, segment.Missions.Length); Assert.AreEqual(VehicleClass.ClassPB41, segment.VehicleClass); @@ -203,9 +203,9 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration FloorType = FloorType.LowFloor, DoubleDecker = false }; - var segment = DeclarationData.BusSegments.Lookup( + var segment = DeclarationData.PrimaryBusSegments.Lookup( vehicleData.VehicleCategory, vehicleData.AxleConfiguration, vehicleData.Articulated, vehicleData.FloorType, - vehicleData.DoubleDecker, true); + vehicleData.DoubleDecker); Assert.AreEqual(10, segment.Missions.Length); Assert.AreEqual(VehicleClass.ClassPB42, segment.VehicleClass); @@ -310,9 +310,9 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration FloorType = FloorType.LowFloor, DoubleDecker = false }; - var segment = DeclarationData.BusSegments.Lookup( + var segment = DeclarationData.PrimaryBusSegments.Lookup( vehicleData.VehicleCategory, vehicleData.AxleConfiguration, vehicleData.Articulated, vehicleData.FloorType, - vehicleData.DoubleDecker, true); + vehicleData.DoubleDecker); Assert.AreEqual(10, segment.Missions.Length); Assert.AreEqual(VehicleClass.ClassPB43, segment.VehicleClass); @@ -416,9 +416,9 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration FloorType = FloorType.LowFloor, DoubleDecker = false }; - var segment = DeclarationData.BusSegments.Lookup( + var segment = DeclarationData.PrimaryBusSegments.Lookup( vehicleData.VehicleCategory, vehicleData.AxleConfiguration, vehicleData.Articulated, vehicleData.FloorType, - vehicleData.DoubleDecker, true); + vehicleData.DoubleDecker); Assert.AreEqual(10, segment.Missions.Length); Assert.AreEqual(VehicleClass.ClassPB44, segment.VehicleClass); @@ -523,9 +523,9 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration FloorType = FloorType.LowFloor, DoubleDecker = false }; - var segment = DeclarationData.BusSegments.Lookup( + var segment = DeclarationData.PrimaryBusSegments.Lookup( vehicleData.VehicleCategory, vehicleData.AxleConfiguration, vehicleData.Articulated, vehicleData.FloorType, - vehicleData.DoubleDecker, true); + vehicleData.DoubleDecker); Assert.AreEqual(10, segment.Missions.Length); Assert.AreEqual(VehicleClass.ClassPB45, segment.VehicleClass); diff --git a/VectoCore/VectoCoreTest/TestData/Integration/Buses/FactorMethod/CompletedBus.vecto b/VectoCore/VectoCoreTest/TestData/Integration/Buses/FactorMethod/CompletedBus.vecto new file mode 100644 index 0000000000000000000000000000000000000000..14920f1a1799ce0f8da8a8366b7b56e288b087be --- /dev/null +++ b/VectoCore/VectoCoreTest/TestData/Integration/Buses/FactorMethod/CompletedBus.vecto @@ -0,0 +1,12 @@ +{ + "Header": { + "CreatedBy": "Markus Quaritsch, IVT, Graz University of Technology", + "Date": "2020-02-07T15:06:30.9725917Z", + "AppVersion": "2.2", + "FileVersion": 7 + }, + "Body": { + "CompletedVehicle": "vecto_vehicle-completed_heavyBus.xml", + "PrimaryVehicleResults": "PIF-heavyBus-sample.xml" + } +} \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/TestData/Integration/Buses/FactorMethod/PIF-heavyBus-sample.xml b/VectoCore/VectoCoreTest/TestData/Integration/Buses/FactorMethod/PIF-heavyBus-sample.xml new file mode 100644 index 0000000000000000000000000000000000000000..cf15f5da8a991be78b6d3721304f9c8fb562cb2e --- /dev/null +++ b/VectoCore/VectoCoreTest/TestData/Integration/Buses/FactorMethod/PIF-heavyBus-sample.xml @@ -0,0 +1,332 @@ +<?xml version="1.0" encoding="UTF-8"?> +<tns:VectoOutputPrimaryVehicle xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:tugraz:ivt:VectoAPI:DeclarationOutput:PrimaryVehicleInformation" xmlns:tns="urn:tugraz:ivt:VectoAPI:DeclarationOutput:PrimaryVehicleInformation" xmlns:v2.6="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:DEV:v2.6" xmlns:v2.3="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:DEV:v2.3" xmlns:v2.1="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v2.1" xmlns:v2.0="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v2.0" xmlns:pif="urn:tugraz:ivt:VectoAPI:PrimaryVehicleInformation" xmlns:pbus="urn:tugraz:ivt:VectoAPI:DeclarationOutput:PrimaryVehicleInformation:HeavyBus:v0.1" xmlns:di="http://www.w3.org/2000/09/xmldsig#" xsi:schemaLocation="urn:tugraz:ivt:VectoAPI:DeclarationOutput:PrimaryVehicleInformation E:\QUAM\Workspace\VECTO_DEV_Buses\VectoCore\VectoCore\Resources\XSD/VectoOutputPrimaryVehicleInformation.xsd urn:tugraz:ivt:VectoAPI:DeclarationOutput:PrimaryVehicleInformation:HeavyBus:v0.1 E:\QUAM\Workspace\VECTO_DEV_Buses\VectoCore\VectoCore\Resources\XSD/VectoOutputPrimaryBus.xsd urn:tugraz:ivt:VectoAPI:DeclarationDefinitions E:\QUAM\Workspace\VECTO_DEV_Buses\VectoCore\VectoCore\Resources\XSD/VectoDeclarationDefinitions.xsd urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v2.1 E:\QUAM\Workspace\VECTO_DEV_Buses\VectoCore\VectoCore\Resources\XSD/VectoDeclarationDefinitions.2.1.xsd"> + <!-- +xsi:schemaLocation="urn:tugraz:ivt:VectoAPI:PrimaryVehicleInformation E:\QUAM\Workspace\VECTO_DEV_Buses\VectoCore\VectoCore\Resources\XSD/VectoOutputPrimaryVehicleInformation.xsd urn:tugraz:ivt:VectoAPI:DeclarationOutput:PrimaryVehicleInformation:HeavyBus:v0.1 E:\QUAM\Workspace\VECTO_DEV_Buses\VectoCore\VectoCore\Resources\XSD/VectoOutputPrimaryBus.xsd" +--> + <tns:Data id="PIFHB-VEH-1234567890" xsi:type="pbus:PrimaryVehicleHeavyBusDataType" xmlns="urn:tugraz:ivt:VectoAPI:DeclarationOutput:PrimaryVehicleInformation:HeavyBus:v0.1"> + <Vehicle xsi:type="VehiclePIFType"> + <ManufacturerPrimaryVehicle>Generic Truck Manufacturer</ManufacturerPrimaryVehicle> + <ManufacturerAddressPrimaryVehicle>Street, ZIP City</ManufacturerAddressPrimaryVehicle> + <Model>Generic Model</Model> + <VIN>VEH-1234567890</VIN> + <Date>2017-02-15T11:00:00Z</Date> + <VehicleCategory>Bus</VehicleCategory> + <AxleConfiguration>4x2</AxleConfiguration> + <Articulated>false</Articulated> + <TechnicalPermissibleMaximumLadenMass>25000</TechnicalPermissibleMaximumLadenMass> + <IdlingSpeed>600</IdlingSpeed> + <RetarderType>Transmission Output Retarder</RetarderType> + <RetarderRatio>1.000</RetarderRatio> + <AngledriveType>None</AngledriveType> + <ZeroEmissionVehicle>false</ZeroEmissionVehicle> + <pbus:ADAS xsi:type="v2.1:AdvancedDriverAssistantSystemsType" xmlns="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v2.1"> + <EngineStopStart>false</EngineStopStart> + <EcoRollWithoutEngineStop>false</EcoRollWithoutEngineStop> + <EcoRollWithEngineStop>false</EcoRollWithEngineStop> + <PredictiveCruiseControl>none</PredictiveCruiseControl> + </pbus:ADAS> + <pbus:TorqueLimits xsi:type="TorqueLimitsType" xmlns="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v2.0"> + <Entry gear="6" maxTorque="1800"/> + <Entry gear="1" maxTorque="2500"/> + <Entry gear="12" maxTorque="1900"/> + </pbus:TorqueLimits> + <Components xsi:type="VehicleComponentsPIFType"> + <Engine> + <Data xsi:type="EngineDataPIFType"> + <Manufacturer>Generic Engine Manufacturer</Manufacturer> + <Model>Generic 40t Long Haul Truck Engine</Model> + <CertificationNumber>e12*0815/8051*2017/05E0000*00</CertificationNumber> + <Date>2017-02-15T11:00:00Z</Date> + <AppVersion>VectoEngine x.y</AppVersion> + <Displacement>12730</Displacement> + <RatedSpeed>2200</RatedSpeed> + <RatedPower>380000</RatedPower> + <MaxEngineTorque>2400</MaxEngineTorque> + <WHRType> + <v2.3:MechanicalOutputICE>false</v2.3:MechanicalOutputICE> + <v2.3:MechanicalOutputDrivetrain>false</v2.3:MechanicalOutputDrivetrain> + <v2.3:ElectricalOutput>false</v2.3:ElectricalOutput> + </WHRType> + <Mode> + <IdlingSpeed>560</IdlingSpeed> + <FullLoadAndDragCurve> + <Entry engineSpeed="560.00" maxTorque="1180.00" dragTorque="-149.00"/> + <Entry engineSpeed="600.00" maxTorque="1282.00" dragTorque="-148.00"/> + <Entry engineSpeed="800.00" maxTorque="1791.00" dragTorque="-149.00"/> + <Entry engineSpeed="1000.00" maxTorque="2300.00" dragTorque="-160.00"/> + <Entry engineSpeed="1200.00" maxTorque="2300.00" dragTorque="-179.00"/> + <Entry engineSpeed="1400.00" maxTorque="2300.00" dragTorque="-203.00"/> + <Entry engineSpeed="1600.00" maxTorque="2079.00" dragTorque="-235.00"/> + <Entry engineSpeed="1800.00" maxTorque="1857.00" dragTorque="-264.00"/> + <Entry engineSpeed="2000.00" maxTorque="1352.00" dragTorque="-301.00"/> + <Entry engineSpeed="2100.00" maxTorque="1100.00" dragTorque="-320.00"/> + </FullLoadAndDragCurve> + <Fuels> + <FuelType>Diesel CI</FuelType> + </Fuels> + </Mode> + </Data> + </Engine> + <Transmission> + <Data xsi:type="pbus:TransmissionDataPIFType"> + <Manufacturer>Generic Gearbox Manufacturer</Manufacturer> + <Model>Generic 40t Long Haul Truck Gearbox</Model> + <MainCertificationMethod>Standard values</MainCertificationMethod> + <CertificationNumber>e12*0815/8051*2017/05E0000*00</CertificationNumber> + <Date>2017-01-11T11:00:00Z</Date> + <AppVersion>3.0.1</AppVersion> + <TransmissionType>AMT</TransmissionType> + <Gears xsi:type="TransmissionGearsPIFType"> + <Gear number="1"> + <Ratio>14.930</Ratio> + <MaxTorque>1900</MaxTorque> + <MaxSpeed>2000</MaxSpeed> + </Gear> + <Gear number="2"> + <Ratio>11.640</Ratio> + <MaxTorque>1900</MaxTorque> + <MaxSpeed>2000</MaxSpeed> + </Gear> + <Gear number="3"> + <Ratio>9.020</Ratio> + <MaxSpeed>2000</MaxSpeed> + </Gear> + <Gear number="4"> + <Ratio>7.040</Ratio> + <MaxSpeed>2000</MaxSpeed> + </Gear> + <Gear number="5"> + <Ratio>5.640</Ratio> + <MaxSpeed>2000</MaxSpeed> + </Gear> + <Gear number="6"> + <Ratio>4.400</Ratio> + <MaxSpeed>2000</MaxSpeed> + </Gear> + <Gear number="7"> + <Ratio>3.390</Ratio> + <MaxSpeed>2000</MaxSpeed> + </Gear> + <Gear number="8"> + <Ratio>2.650</Ratio> + <MaxSpeed>2000</MaxSpeed> + </Gear> + <Gear number="9"> + <Ratio>2.050</Ratio> + <MaxSpeed>2000</MaxSpeed> + </Gear> + <Gear number="10"> + <Ratio>1.600</Ratio> + <MaxSpeed>2000</MaxSpeed> + </Gear> + <Gear number="11"> + <Ratio>1.280</Ratio> + <MaxSpeed>2000</MaxSpeed> + </Gear> + <Gear number="12"> + <Ratio>1.000</Ratio> + </Gear> + </Gears> + </Data> + </Transmission> + <!-- Torque Converter --> + <Angledrive> + <Data xsi:type="pbus:AngledriveDataPIFType"> + <Manufacturer>Generic Gearbox Manufacturer</Manufacturer> + <Model>Generic 40t Long Haul Truck Gearbox</Model> + <CertificationMethod>Standard values</CertificationMethod> + <CertificationNumber>e12*0815/8051*2017/05E0000*00</CertificationNumber> + <Date>2017-01-11T11:00:00Z</Date> + <AppVersion>3.0.1</AppVersion> + <Ratio>2.345</Ratio> + </Data> + </Angledrive> + <!-- Retarder --> + <Axlegear> + <Data xsi:type="pbus:AxlegearDataPIFType"> + <Manufacturer>Generic Gearbox Manufacturer</Manufacturer> + <Model>Generic 40t Long Haul Truck AxleGear</Model> + <CertificationMethod>Standard values</CertificationMethod> + <CertificationNumber>e12*0815/8051*2017/05E0000*00</CertificationNumber> + <Date>2017-01-11T11:00:00Z</Date> + <AppVersion>3.0.1</AppVersion> + <LineType>Single portal axle</LineType> + <Ratio>2.590</Ratio> + </Data> + </Axlegear> + <AxleWheels xsi:type="v2.0:AxleWheelsComponentDeclarationType"> + <v2.0:Data xsi:type="v2.0:AxleWheelsDataDeclarationType" xmlns="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v2.0"> + <Axles> + <Axle axleNumber="1" xsi:type="AxleDataDeclarationType"> + <AxleType>VehicleNonDriven</AxleType> + <TwinTyres>false</TwinTyres> + <Steered>true</Steered> + <Tyre> + <Data id="WHL-5432198760-315-70-R22.5" xsi:type="TyreDataDeclarationType"> + <Manufacturer>Generic Wheels Manufacturer</Manufacturer> + <Model>Generic Wheel</Model> + <CertificationNumber>e12*0815/8051*2017/05E0000*00</CertificationNumber> + <Date>2017-01-11T14:00:00Z</Date> + <AppVersion>Tyre Generation App 1.0</AppVersion> + <Dimension>315/70 R22.5</Dimension> + <RRCDeclared>0.0055</RRCDeclared> + <FzISO>31300</FzISO> + </Data> + <Signature> + <di:Reference URI="#WHL-5432198760-315-70-R22.5"> + <di:Transforms> + <di:Transform Algorithm="urn:vecto:xml:2017:canonicalization"/> + <di:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> + </di:Transforms> + <di:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/> + <di:DigestValue>4TkUGQTX8tevHOU9Cj9uyCFuI/aqcEYlo/gyVjVQmv0=</di:DigestValue> + </di:Reference> + </Signature> + </Tyre> + </Axle> + <Axle axleNumber="2" xsi:type="AxleDataDeclarationType"> + <AxleType>VehicleDriven</AxleType> + <TwinTyres>true</TwinTyres> + <Steered>false</Steered> + <Tyre> + <Data id="WHL-5432198760-315-70-R22.5" xsi:type="TyreDataDeclarationType"> + <Manufacturer>Generic Wheels Manufacturer</Manufacturer> + <Model>Generic Wheel</Model> + <CertificationNumber>e12*0815/8051*2017/05E0000*00</CertificationNumber> + <Date>2017-01-11T14:00:00Z</Date> + <AppVersion>Tyre Generation App 1.0</AppVersion> + <Dimension>315/70 R22.5</Dimension> + <RRCDeclared>0.0063</RRCDeclared> + <FzISO>31300</FzISO> + </Data> + <Signature> + <di:Reference URI="#WHL-5432198760-315-70-R22.5"> + <di:Transforms> + <di:Transform Algorithm="urn:vecto:xml:2017:canonicalization"/> + <di:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> + </di:Transforms> + <di:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/> + <di:DigestValue>KljvtvGUUQ/L7MiLVAqU+bckL5PNDNNwdeLH9kUVrfM=</di:DigestValue> + </di:Reference> + </Signature> + </Tyre> + </Axle> + </Axles> + </v2.0:Data> + </AxleWheels> + <Auxiliaries> + <pbus:Data xsi:type="PrimaryVehicleAuxiliaryDataDeclarationType" xmlns="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:DEV:v2.6"> + <Fan> + <Technology>Hydraulic driven - Constant displacement pump</Technology> + </Fan> + <SteeringPump> + <Technology axleNumber="1">Variable displacement elec. controlled</Technology> + </SteeringPump> + <ElectricSystem> + <AlternatorTechnology>default</AlternatorTechnology> + <SmartElectrics>false</SmartElectrics> + <MaxAlternatorPower>10000</MaxAlternatorPower> + <ElectricStorageCapacity>800</ElectricStorageCapacity> + </ElectricSystem> + <PneumaticSystem> + <SizeOfAirSupply>Small</SizeOfAirSupply> + <Clutch>none</Clutch> + <CompressorRatio>1.000</CompressorRatio> + <SmartCompressionSystem>false</SmartCompressionSystem> + <SmartRegenerationSystem>false</SmartRegenerationSystem> + <AirsuspensionControl>mechanically</AirsuspensionControl> + <AdBlueDosing>true</AdBlueDosing> + </PneumaticSystem> + <HVAC> + <AdjustableCoolantThermostat>true</AdjustableCoolantThermostat> + <EngineWasteGasHeatExchanger>true</EngineWasteGasHeatExchanger> + </HVAC> + </pbus:Data> + </Auxiliaries> + </Components> + </Vehicle> + <ResultDataSignature> + <di:Reference URI="#MRF-VEH-1234567890"> + <di:Transforms> + <di:Transform Algorithm="urn:vecto:xml:2017:canonicalization"/> + <di:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> + </di:Transforms> + <di:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/> + <di:DigestValue>4TkUGQTX8tevHOU9Cj9uyCFuI/aqcEYlo/gyVjVQmv0=</di:DigestValue> + </di:Reference> + </ResultDataSignature> + <Results> + <Status>success</Status> + <Result status="success"> + <VehicleGroup>P31SD</VehicleGroup> + <Mission>Regional Delivery</Mission> + <SimulationParameters> + <TotalVehicleMass unit="kg">8810</TotalVehicleMass> + <Payload unit="kg">920</Payload> + <PassengerCount>20</PassengerCount> + <FuelMode>single fuel mode</FuelMode> + </SimulationParameters> + <Fuel type="Diesel CI"> + <EnergyConsumption unit="MJ/km">8.99</EnergyConsumption> + </Fuel> + <CO2 unit="g/km">658.9</CO2> + </Result> + <Result status="success"> + <VehicleGroup>P31SD</VehicleGroup> + <Mission>Regional Delivery</Mission> + <SimulationParameters> + <TotalVehicleMass unit="kg">12490</TotalVehicleMass> + <Payload unit="kg">4600</Payload> + <PassengerCount>80</PassengerCount> + <FuelMode>single fuel mode</FuelMode> + </SimulationParameters> + <Fuel type="Diesel CI"> + <EnergyConsumption unit="MJ/km">9.88</EnergyConsumption> + </Fuel> + <CO2 unit="g/km">724.4</CO2> + </Result> + <Result status="success"> + <VehicleGroup>P31DD</VehicleGroup> + <Mission>Urban Delivery</Mission> + <SimulationParameters> + <TotalVehicleMass unit="kg">8810</TotalVehicleMass> + <Payload unit="kg">920</Payload> + <PassengerCount>20</PassengerCount> + <FuelMode>single fuel mode</FuelMode> + </SimulationParameters> + <Fuel type="Diesel CI"> + <EnergyConsumption unit="MJ/km">10.4</EnergyConsumption> + </Fuel> + <CO2 unit="g/km">763.9</CO2> + </Result> + <Result status="success"> + <VehicleGroup>P31DD</VehicleGroup> + <Mission>Urban Delivery</Mission> + <SimulationParameters> + <TotalVehicleMass unit="kg">12490</TotalVehicleMass> + <Payload unit="kg">4600</Payload> + <PassengerCount>80</PassengerCount> + <FuelMode>single fuel mode</FuelMode> + </SimulationParameters> + <Fuel type="Diesel CI"> + <EnergyConsumption unit="MJ/km">12.7</EnergyConsumption> + </Fuel> + <CO2 unit="g/km">927.7</CO2> + </Result> + </Results> + <ApplicationInformation> + <SimulationToolVersion>Sample File Generator</SimulationToolVersion> + <Date>2017-01-01T00:00:00Z</Date> + </ApplicationInformation> + </tns:Data> + <Signature> + <di:Reference URI="#PIFHB-VEH-1234567890"> + <di:Transforms> + <di:Transform Algorithm="urn:vecto:xml:2017:canonicalization"/> + <di:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> + </di:Transforms> + <di:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/> + <di:DigestValue>4TkUGQTX8tevHOU9Cj9uyCFuI/aqcEYlo/gyVjVQmv0=</di:DigestValue> + </di:Reference> + </Signature> +</tns:VectoOutputPrimaryVehicle> diff --git a/VectoCore/VectoCoreTest/TestData/Integration/Buses/FactorMethod/vecto_vehicle-completed_heavyBus.xml b/VectoCore/VectoCoreTest/TestData/Integration/Buses/FactorMethod/vecto_vehicle-completed_heavyBus.xml new file mode 100644 index 0000000000000000000000000000000000000000..e766633a413d38249d59c7e4178c43d3b7472a84 --- /dev/null +++ b/VectoCore/VectoCoreTest/TestData/Integration/Buses/FactorMethod/vecto_vehicle-completed_heavyBus.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<tns:VectoInputDeclaration schemaVersion="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v2.1" xmlns:tns="urn:tugraz:ivt:VectoAPI:DeclarationInput:v2.0" xmlns:v2.6="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:DEV:v2.6" xmlns:v2.1="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v2.1" xmlns:v2.0="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v2.0" xmlns:di="http://www.w3.org/2000/09/xmldsig#" xsi:schemaLocation="urn:tugraz:ivt:VectoAPI:DeclarationJob E:\QUAM\Workspace\VECTO_DEV_Buses\VectoCore\VectoCore\Resources\XSD/VectoDeclarationJob.xsd"> + <v2.0:Vehicle id="VEH-1234567890" xsi:type="CompletedVehicleDeclarationType" xmlns="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:DEV:v2.6"> + <Manufacturer>Some Manufacturer</Manufacturer> + <ManufacturerAddress>Infinite Loop 1</ManufacturerAddress> + <Model>Sample Bus Model</Model> + <VIN>VEH-1234567890</VIN> + <Date>2020-01-09T11:00:00Z</Date> + <LegislativeClass>N2</LegislativeClass> + <RegisteredClass>I+II</RegisteredClass> + <VehicleCode>CF</VehicleCode> + <CurbMassChassis>8300</CurbMassChassis> + <TechnicalPermissibleMaximumLadenMass>15400</TechnicalPermissibleMaximumLadenMass> + <RegisteredPassengers> + <LowerDeck>50</LowerDeck> + <UpperDeck>0</UpperDeck> + </RegisteredPassengers> + <LowEntry>true</LowEntry> + <HeightIntegratedBody>2.700</HeightIntegratedBody> + <VehicleLength>11.830</VehicleLength> + <VehicleWidth>2.550</VehicleWidth> + <EntranceHeight>0.120</EntranceHeight> + <DoorDriveTechnology>pneumatic</DoorDriveTechnology> + <Components xsi:type="CompletedVehicleComponentsDeclarationType"> + <v2.6:AirDrag xmlns="urn:tugraz:ivt:VectoAPI:DeclarationDefinitions:v2.0"> + <Data id="CabinX23h" xsi:type="AirDragDataDeclarationType"> + <Manufacturer>Generic Manufacturer</Manufacturer> + <Model>Generic Model</Model> + <CertificationNumber>e12*0815/8051*2017/05E0000*00</CertificationNumber> + <Date>2017-03-24T15:00:00Z</Date> + <AppVersion>Vecto AirDrag x.y</AppVersion> + <CdxA_0>6.31</CdxA_0> + <TransferredCdxA>6.32</TransferredCdxA> + <DeclaredCdxA>6.34</DeclaredCdxA> + </Data> + <Signature> + <di:Reference URI="#CabinX23h"> + <di:Transforms> + <di:Transform Algorithm="urn:vecto:xml:2017:canonicalization"/> + <di:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> + </di:Transforms> + <di:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/> + <di:DigestValue>b9SHCfOoVrBxFQ8wwDK32OO+9bd85DuaUdgs6j/29N8=</di:DigestValue> + </di:Reference> + </Signature> + </v2.6:AirDrag> + <Auxiliaries> + <Data xsi:type="CompletedVehicleAuxiliaryDataDeclarationType"> + <ElectricSystem> + <AlternatorTechnology>default</AlternatorTechnology> + <LEDLights> + <Dayrunninglights>false</Dayrunninglights> + <Headlights>false</Headlights> + <Positionlights>false</Positionlights> + <Brakelights>false</Brakelights> + <Interiorlights>false</Interiorlights> + </LEDLights> + </ElectricSystem> + <PneumaticSystem> + <DoorDriveTechnology>pneumatic</DoorDriveTechnology> + </PneumaticSystem> + <HVAC> + <SystemConfiguration>7</SystemConfiguration> + <CompressorType> + <DriverAC>2-stage</DriverAC> + <PassengerAC>4-stage</PassengerAC> + </CompressorType> + <AuxiliaryHeaterPower>0</AuxiliaryHeaterPower> + <DoubleGlasing>true</DoubleGlasing> + <HeatPump>false</HeatPump> + <AdjustableAuxiliaryHeater>true</AdjustableAuxiliaryHeater> + <SeparateAirDistributionDucts>true</SeparateAirDistributionDucts> + </HVAC> + </Data> + </Auxiliaries> + </Components> + </v2.0:Vehicle> +</tns:VectoInputDeclaration> diff --git a/VectoCore/VectoCoreTest/Utils/MockDeclarationVehicleInputData.cs b/VectoCore/VectoCoreTest/Utils/MockDeclarationVehicleInputData.cs index e92696fac97664c18ea869d98c55535447973634..d72f1d8040943e55f65bba6dfa59f725ea108e0e 100644 --- a/VectoCore/VectoCoreTest/Utils/MockDeclarationVehicleInputData.cs +++ b/VectoCore/VectoCoreTest/Utils/MockDeclarationVehicleInputData.cs @@ -45,7 +45,7 @@ namespace TUGraz.VectoCore.Tests.Utils { public bool DualFuelVehicle { get; } public Watt MaxNetPower1 { get; } public Watt MaxNetPower2 { get; } - public string RegisteredClass { get; set; } + public RegistrationClass RegisteredClass { get; set; } public int NuberOfPassengersUpperDeck { get; set; } public int NumberOfPassengersLowerDeck { get; set; } public VehicleCode VehicleCode { get; set; } @@ -107,7 +107,7 @@ namespace TUGraz.VectoCore.Tests.Utils { public Meter Width { get; set; } public Meter EntranceHeight { get; } public Watt MaxNetPower2 { get; } - public string RegisteredClass { get; set; } + public RegistrationClass RegisteredClass { get; set; } public int NuberOfPassengersUpperDeck { get; set; } public int NumberOfPassengersLowerDeck { get; set; } public VehicleCode VehicleCode { get; set; } diff --git a/VectoCore/VectoCoreTest/VectoCoreTest.csproj b/VectoCore/VectoCoreTest/VectoCoreTest.csproj index 4ebdd41aa956860d32024990a64dc54772a6d765..97d281e71c7905665b6be3641df33aa39ea4adf7 100644 --- a/VectoCore/VectoCoreTest/VectoCoreTest.csproj +++ b/VectoCore/VectoCoreTest/VectoCoreTest.csproj @@ -104,6 +104,7 @@ <Compile Include="Integration\BusAuxiliaries\AAuxTests.cs" /> <Compile Include="Integration\CoachAdvancedAuxPowertrain.cs" /> <Compile Include="Integration\CoachPowerTrain.cs" /> + <Compile Include="Integration\CompletedBus\CompletedBusFactorMethodTest.cs" /> <Compile Include="Integration\Declaration\ADASVehicleTest.cs" /> <Compile Include="Integration\Declaration\EngineInputDataTests.cs" /> <Compile Include="Integration\Declaration\NaturalGasVehicles.cs" /> @@ -297,6 +298,9 @@ <None Include="TestData\Generic Vehicles\Engineering Mode\HeavyBusPrimary\HeavyBusPrimary_DECL.vecto"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> + <None Include="TestData\Integration\Buses\FactorMethod\CompletedBus.vecto"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> <None Include="TestData\Integration\Buses\SingleBus.vecto"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> @@ -3446,6 +3450,13 @@ <Content Include="TestData\Integration\ADAS\Group9_AT_PCCEcoRoll.xml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> + <Content Include="TestData\Integration\Buses\FactorMethod\PIF-heavyBus-sample.xml"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + <Content Include="TestData\Integration\Buses\FactorMethod\vecto_vehicle-completed_heavyBus.xml"> + <SubType>Designer</SubType> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> <Content Include="TestData\Integration\Buses\vecto_vehicle-completed_heavyBus.xml"> <SubType>Designer</SubType> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> diff --git a/VectoCore/VectoCoreTest/XML/XMLPrimaryVehicleReportBusReaderTest.cs b/VectoCore/VectoCoreTest/XML/XMLPrimaryVehicleReportBusReaderTest.cs index f55ccc30daf29d00fb7af1253117a2602014d735..da65eb60efbe92d2d1c0abf52bf62ac734d601d9 100644 --- a/VectoCore/VectoCoreTest/XML/XMLPrimaryVehicleReportBusReaderTest.cs +++ b/VectoCore/VectoCoreTest/XML/XMLPrimaryVehicleReportBusReaderTest.cs @@ -47,7 +47,7 @@ namespace TUGraz.VectoCore.Tests.XML { var reader = XmlReader.Create(vehilcePIFExample); - var inputDataProvider = xmlInputReader.Create(reader) as IPrimaryVehicleInputDataProvider; + var inputDataProvider = xmlInputReader.Create(reader) as IPrimaryVehicleInformationInputDataProvider; var vehicle = inputDataProvider.Vehicle;