From 9e11fcdee3dc41081229bd8deddebcf81e4cfd3a Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <quaritsch@ivt.tugraz.at> Date: Mon, 28 Nov 2022 17:52:54 +0100 Subject: [PATCH] working on buses declaration mode: make conventional buses testcases work again new CIF reports for single bus simulations removing unnecessary methods and classes (Dead code) --- .../VectoCommon/Models/VehicleCategory.cs | 1 + .../AuxiliaryDataAdapter.cs | 77 +++++++++++++++---- .../SimulationComponents/DriverDataAdapter.cs | 2 +- .../AbstractDeclarationVectoRunDataFactory.cs | 1 - ...DeclarationModeHeavyLorryRunDataFactory.cs | 53 ------------- ...tionModeHeavyLorryRunDataFactory_Hybrid.cs | 14 ---- ...DeclarationModePrimaryBusRunDataFactory.cs | 77 ++++--------------- ...arationModeSingleBusVectoRunDataFactory.cs | 68 ++++++++++++---- .../DownstreamModules/Impl/HVAC/SSMInputs.cs | 2 + .../VectoCore/OutputData/DeclarationReport.cs | 2 +- .../CIFNinjectModule.cs | 23 ++++++ .../CIFWriter/ComponentGroupWriters.cs | 74 ++++++++++++++++++ .../CIFWriter/VehicleGroups.cs | 66 ++++++++++++++++ .../CIFWriter/VehicleWriter.cs | 32 ++++++++ .../CustomerInformationFile.cs | 69 +++++++++++++++++ .../ICustomerInformationFileFactory.cs | 12 ++- ...MLDeclarationReportMultistageBusVehicle.cs | 54 ------------- .../XML/XMLDeclarationReport_0_9.cs | 5 +- .../XML/XMLDeclarationInputv210.cs | 3 + 19 files changed, 411 insertions(+), 224 deletions(-) delete mode 100644 VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportMultistageBusVehicle.cs diff --git a/VectoCommon/VectoCommon/Models/VehicleCategory.cs b/VectoCommon/VectoCommon/Models/VehicleCategory.cs index 73b19f61e3..dae81bc982 100644 --- a/VectoCommon/VectoCommon/Models/VehicleCategory.cs +++ b/VectoCommon/VectoCommon/Models/VehicleCategory.cs @@ -57,6 +57,7 @@ namespace TUGraz.VectoCommon.Models public const string Lorry = "Lorry"; public const string CompletedBus = "CompletedBus"; public const string Van = "Van"; + public static HashSet<string> SuperCategories { get; } = new HashSet<string>() { PrimaryBus, Lorry, diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/SimulationComponents/AuxiliaryDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/SimulationComponents/AuxiliaryDataAdapter.cs index d885d28031..61bc9bcdba 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/SimulationComponents/AuxiliaryDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/SimulationComponents/AuxiliaryDataAdapter.cs @@ -17,6 +17,7 @@ using TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Pneumatics; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.DataBus; +using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponents @@ -585,11 +586,11 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponen - public virtual ISSMDeclarationInputs CreateSSMModelParameters(IBusAuxiliariesDeclarationData busAuxInputData, + public virtual SSMInputs CreateSSMModelParameters(IBusAuxiliariesDeclarationData busAuxInputData, Mission mission, LoadingType loadingType, BusHVACSystemConfiguration applicableHVACConfiguration, HeatPumpType driverHeatpumpType, HeatPumpType passengerHeatpumpType, Watt auxHeaterPower, - IFuelProperties heatingFuel) + IFuelProperties heatingFuel, bool cooling) { var busParams = mission.BusParameter; @@ -636,16 +637,28 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponen //retVal.HVACCompressorType = passengerHeatpumpType; // use passenger compartment - retVal.DriverCompartmentLength = applicableHVACConfiguration.RequiresDriverAC() - ? applicableHVACConfiguration.IsOneOf(BusHVACSystemConfiguration.Configuration2, BusHVACSystemConfiguration.Configuration4) - ? 2 * Constants.BusParameters.DriverCompartmentLength - : Constants.BusParameters.DriverCompartmentLength - : 0.SI<Meter>(); - retVal.PassengerCompartmentLength = applicableHVACConfiguration.RequiresPassengerAC() - ? applicableHVACConfiguration.IsOneOf(BusHVACSystemConfiguration.Configuration2, BusHVACSystemConfiguration.Configuration4) - ? 0.SI<Meter>() - : internalLength - Constants.BusParameters.DriverCompartmentLength - : 0.SI<Meter>(); + if (cooling) { + retVal.DriverCompartmentLength = applicableHVACConfiguration.RequiresDriverAC() + ? applicableHVACConfiguration.IsOneOf(BusHVACSystemConfiguration.Configuration2, + BusHVACSystemConfiguration.Configuration4) + ? 2 * Constants.BusParameters.DriverCompartmentLength + : Constants.BusParameters.DriverCompartmentLength + : 0.SI<Meter>(); + retVal.PassengerCompartmentLength = applicableHVACConfiguration.RequiresPassengerAC() + ? applicableHVACConfiguration.IsOneOf(BusHVACSystemConfiguration.Configuration2, + BusHVACSystemConfiguration.Configuration4) + ? 0.SI<Meter>() + : internalLength - Constants.BusParameters.DriverCompartmentLength + : 0.SI<Meter>(); + } else { + retVal.DriverCompartmentLength = applicableHVACConfiguration.RequiresDriverAC() + ? Constants.BusParameters.DriverCompartmentLength + : 0.SI<Meter>(); + retVal.PassengerCompartmentLength = applicableHVACConfiguration.RequiresDriverAC() + ? internalLength - Constants.BusParameters.DriverCompartmentLength + : internalLength; + } + return retVal; } @@ -798,6 +811,16 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponen var applicableHVACConfigHeating = DeclarationData.BusAuxiliaries.GetHVACConfig(hvacParams.HVACConfiguration, HeatPumpType.none, hvacParams.HeatPumpTypePassengerCompartmentHeating); + var ssmCooling = CreateSSMModelParameters(primaryVehicle.Components.BusAuxiliaries, mission, + runData.Loading, applicableHVACConfigCooling, HeatPumpType.none, + hvacParams.HeatPumpTypePassengerCompartmentCooling, hvacParams.HVACAuxHeaterPower, FuelData.Diesel, true); + var ssmHeating = CreateSSMModelParameters(primaryVehicle.Components.BusAuxiliaries, mission, + runData.Loading, applicableHVACConfigHeating, HeatPumpType.none, + hvacParams.HeatPumpTypePassengerCompartmentHeating, hvacParams.HVACAuxHeaterPower, FuelData.Diesel, + false); + ssmHeating.ElectricHeater = GetElectricHeater(mission, runData); + ssmHeating.HeatingDistributions = DeclarationData.BusAuxiliaries.HeatingDistributionCases; + var retVal = new AuxiliaryConfig { InputData = primaryVehicle.Components.BusAuxiliaries, @@ -805,16 +828,38 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponen PneumaticUserInputsConfig = GetPneumaticUserConfig(primaryVehicle, mission), PneumaticAuxillariesConfig = CreatePneumaticAuxConfig(runData.Retarder.Type), Actuations = actuations, - SSMInputsCooling = CreateSSMModelParameters(primaryVehicle.Components.BusAuxiliaries, mission, - runData.Loading, applicableHVACConfigCooling, HeatPumpType.none, hvacParams.HeatPumpTypePassengerCompartmentCooling, hvacParams.HVACAuxHeaterPower, FuelData.Diesel), - SSMInputsHeating = CreateSSMModelParameters(primaryVehicle.Components.BusAuxiliaries, mission, - runData.Loading, applicableHVACConfigCooling, HeatPumpType.none, hvacParams.HeatPumpTypePassengerCompartmentHeating, hvacParams.HVACAuxHeaterPower, FuelData.Diesel), + SSMInputsCooling = ssmCooling, + SSMInputsHeating = ssmHeating, VehicleData = runData.VehicleData, }; return retVal; } + private HeaterType GetElectricHeater(Mission mission, VectoRunData runData) + { + HVACParameters hvacParams = null; + switch (runData.JobType) { + case VectoSimulationJobType.ConventionalVehicle: + hvacParams = mission.BusParameter.HVACConventional; + break; + case VectoSimulationJobType.ParallelHybridVehicle: + case VectoSimulationJobType.SerialHybridVehicle: + case VectoSimulationJobType.IEPC_S: + case VectoSimulationJobType.IHPC: + hvacParams = mission.BusParameter.HVACHEV; + break; + case VectoSimulationJobType.BatteryElectricVehicle: + case VectoSimulationJobType.IEPC_E: + hvacParams = mission.BusParameter.HVACPEV; + break; + default: + throw new ArgumentOutOfRangeException(); + } + + return hvacParams.WaterElectricHeater ? HeaterType.WaterElectricHeater : HeaterType.None; + } + protected override IList<VectoRunData.AuxData> DoCreateAuxiliaryData( IAuxiliariesDeclarationInputData auxInputData, IBusAuxiliariesDeclarationData busAuxData, MissionType mission, VehicleClass hdvClass, Meter vehicleLength, int? numSteeredAxles, diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/SimulationComponents/DriverDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/SimulationComponents/DriverDataAdapter.cs index 9c3bcf27e7..16105fddcf 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/SimulationComponents/DriverDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/SimulationComponents/DriverDataAdapter.cs @@ -65,7 +65,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponen } }; - retVal.AccelerationCurve = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); + retVal.AccelerationCurve = AccelerationCurveReader.ReadFromStream(segment.AccelerationFile); return retVal; } #endregion diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/AbstractDeclarationVectoRunDataFactory.cs b/VectoCore/VectoCore/InputData/Reader/Impl/AbstractDeclarationVectoRunDataFactory.cs index db27d2cbab..0355db2503 100644 --- a/VectoCore/VectoCore/InputData/Reader/Impl/AbstractDeclarationVectoRunDataFactory.cs +++ b/VectoCore/VectoCore/InputData/Reader/Impl/AbstractDeclarationVectoRunDataFactory.cs @@ -87,7 +87,6 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl { protected virtual void InitializeReport() { - return; // TODO <- remove VectoRunData powertrainConfig; List<List<FuelData.Entry>> fuels; var vehicle = InputDataProvider.JobInputData.Vehicle; diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationMode/HeavyLorryRunDataFactory/DeclarationModeHeavyLorryRunDataFactory.cs b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationMode/HeavyLorryRunDataFactory/DeclarationModeHeavyLorryRunDataFactory.cs index 81355544f2..b1d07c442c 100644 --- a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationMode/HeavyLorryRunDataFactory/DeclarationModeHeavyLorryRunDataFactory.cs +++ b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationMode/HeavyLorryRunDataFactory/DeclarationModeHeavyLorryRunDataFactory.cs @@ -120,8 +120,6 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl.DeclarationMode.HeavyLorryRunDa } _angledriveData = DataAdapter.CreateAngledriveData(InputDataProvider.JobInputData.Vehicle.Components.AngledriveInputData); - - _retarderData = DataAdapter.CreateRetarderData(vehicle.Components.RetarderInputData); _ptoTransmissionData = DataAdapter.CreatePTOTransmissionData(vehicle.Components.PTOTransmissionInputData, vehicle.Components.GearboxInputData); @@ -131,8 +129,6 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl.DeclarationMode.HeavyLorryRunDa } - protected abstract void SetGearboxAndGearshiftData(IVehicleDeclarationInputData vehicle, AxleGearData axleGearData, AngledriveData angledriveData); - #region Implementation of IVectoRunDataFactory public override IEnumerable<VectoRunData> NextRun() @@ -214,12 +210,6 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl.DeclarationMode.HeavyLorryRunDa } } - protected override void SetGearboxAndGearshiftData(IVehicleDeclarationInputData vehicle, - AxleGearData axleGearData, AngledriveData angledriveData) - { - - } - protected override VectoRunData CreateVectoRunData(IVehicleDeclarationInputData vehicle, Mission mission, @@ -416,40 +406,6 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl.DeclarationMode.HeavyLorryRunDa } - #region Overrides of LorryBase - - protected override void SetGearboxAndGearshiftData(IVehicleDeclarationInputData vehicle, AxleGearData axleGearData, AngledriveData angledriveData) - { - - //if (vehicle.ArchitectureID != ArchitectureID.E2) { - // DataAdapter.CreateDummyGearshiftStrategy(); - - - - // return; - //} - //var tmpRunData = new VectoRunData() - //{ - // GearboxData = new GearboxData() - // { - // Type = vehicle.Components.GearboxInputData.Type, - // } - //}; - //var tempVehicle = DataAdapter.CreateVehicleData(vehicle, _segment, _segment.Missions.First(), - // _segment.Missions.First().Loadings.First(), _allowVocational); - //var tmpStrategy = PowertrainBuilder.GetShiftStrategy(new SimplePowertrainContainer(tmpRunData)); - ////var electricMachineData = DataAdapter.CreateElectricMachines(vehicle.Components.ElectricMachines, vehicle.ElectricMotorTorqueLimits, ) - //_gearboxData = DataAdapter.CreateGearboxData( - // vehicle, new VectoRunData() { ElectricMachinesData = null, AxleGearData = axleGearData, VehicleData = tempVehicle }, - // tmpStrategy); - //_gearshiftData = DataAdapter.CreateGearshiftData( - // _gearboxData, axleGearData.AxleGear.Ratio * (angledriveData?.Angledrive.Ratio ?? 1.0), - // null, _gearboxData.Type, _gearboxData.Gears.Count); - } - - - #endregion - #endregion } @@ -500,15 +456,6 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl.DeclarationMode.HeavyLorryRunDa #endregion - #region Overrides of LorryBase - - protected override void SetGearboxAndGearshiftData(IVehicleDeclarationInputData vehicle, AxleGearData axleGearData, - AngledriveData angledriveData) - { - throw new NotImplementedException(); - } - - #endregion } } diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationMode/HeavyLorryRunDataFactory/DeclarationModeHeavyLorryRunDataFactory_Hybrid.cs b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationMode/HeavyLorryRunDataFactory/DeclarationModeHeavyLorryRunDataFactory_Hybrid.cs index 833b55a5e4..68c141e815 100644 --- a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationMode/HeavyLorryRunDataFactory/DeclarationModeHeavyLorryRunDataFactory_Hybrid.cs +++ b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationMode/HeavyLorryRunDataFactory/DeclarationModeHeavyLorryRunDataFactory_Hybrid.cs @@ -138,11 +138,6 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl.DeclarationMode.HeavyLorryRunDa #region Overrides of LorryBase - protected override void SetGearboxAndGearshiftData(IVehicleDeclarationInputData vehicle, AxleGearData axleGearData, - AngledriveData angledriveData) - { - throw new NotImplementedException(); - } protected override void Initialize() { _segment = GetSegment(InputDataProvider.JobInputData.Vehicle, false); @@ -157,15 +152,6 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl.DeclarationMode.HeavyLorryRunDa ILorryDeclarationDataAdapter declarationDataAdapter) : base(dataProvider, report, declarationDataAdapter) { } - #region Overrides of LorryBase - - protected override void SetGearboxAndGearshiftData(IVehicleDeclarationInputData vehicle, AxleGearData axleGearData, - AngledriveData angledriveData) - { - throw new NotImplementedException(); - } - - #endregion #region Overrides of AbstractDeclarationVectoRunDataFactory diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationMode/PrimaryBusRunDataFactory/DeclarationModePrimaryBusRunDataFactory.cs b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationMode/PrimaryBusRunDataFactory/DeclarationModePrimaryBusRunDataFactory.cs index f651db58dd..cb35f6649b 100644 --- a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationMode/PrimaryBusRunDataFactory/DeclarationModePrimaryBusRunDataFactory.cs +++ b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationMode/PrimaryBusRunDataFactory/DeclarationModePrimaryBusRunDataFactory.cs @@ -13,6 +13,7 @@ using TUGraz.VectoCore.Models.Simulation.Impl; using TUGraz.VectoCore.Models.SimulationComponent; using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Models.SimulationComponent.Impl; +using TUGraz.VectoCore.Models.SimulationComponent.Impl.Shiftstrategies; using TUGraz.VectoCore.OutputData; namespace TUGraz.VectoCore.InputData.Reader.Impl.DeclarationMode.PrimaryBusRunDataFactory @@ -106,22 +107,11 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl.DeclarationMode.PrimaryBusRunDa _axlegearData = DataAdapter.CreateAxleGearData(InputDataProvider.JobInputData.Vehicle.Components.AxleGearInputData); } _angledriveData = DataAdapter.CreateAngledriveData(InputDataProvider.JobInputData.Vehicle.Components.AngledriveInputData); - - var tmpEngine = DataAdapter.CreateEngineData( - vehicle, vehicle.Components.EngineInputData.EngineModes[0], _segment.Missions.First()); - InitGearboxAndGearshiftData(vehicle, tmpEngine, tempVehicle); - _retarderData = DataAdapter.CreateRetarderData(vehicle.Components.RetarderInputData); - //_ptoTransmissionData = DataAdapter.CreatePTOTransmissionData(vehicle.Components.PTOTransmissionInputData); - - } - protected abstract void InitGearboxAndGearshiftData(IVehicleDeclarationInputData vehicle, - CombustionEngineData tmpEngine, VehicleData tempVehicle); - #endregion protected override VectoRunData CreateVectoRunData(IVehicleDeclarationInputData vehicle, Mission mission, KeyValuePair<LoadingType, Tuple<Kilogram, double?>> loading, @@ -185,6 +175,18 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl.DeclarationMode.PrimaryBusRunDa simulationRunData.VehicleData.VehicleClass = _segment.VehicleClass; simulationRunData.BusAuxiliaries = DataAdapter.CreateBusAuxiliariesData( mission, InputDataProvider.JobInputData.Vehicle, simulationRunData); + var shiftStrategyName = + PowertrainBuilder.GetShiftStrategyName(vehicle.Components.GearboxInputData.Type, + vehicle.VehicleType); + simulationRunData.GearboxData = DataAdapter.CreateGearboxData(vehicle, simulationRunData, + ShiftPolygonCalculator.Create(shiftStrategyName, simulationRunData.GearshiftParameters)); + simulationRunData.GearshiftParameters = + DataAdapter.CreateGearshiftData( + simulationRunData.GearboxData, + (simulationRunData.AxleGearData?.AxleGear.Ratio ?? 1.0) * (simulationRunData.AngledriveData?.Angledrive.Ratio ?? 1.0), + vehicle.EngineIdleSpeed + ); + return simulationRunData; } } @@ -221,29 +223,6 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl.DeclarationMode.PrimaryBusRunDa #endregion - #region Overrides of AbstractDeclarationVectoRunDataFactory - protected override void InitGearboxAndGearshiftData(IVehicleDeclarationInputData vehicle, - CombustionEngineData tmpEngine, - VehicleData tempVehicle) - { - var tmpRunData = new VectoRunData() - { - GearboxData = new GearboxData() - { - Type = vehicle.Components.GearboxInputData.Type, - } - }; - var tmpStrategy = PowertrainBuilder.GetShiftStrategy(new SimplePowertrainContainer(tmpRunData)); - _gearboxData = DataAdapter.CreateGearboxData( - vehicle, new VectoRunData() { EngineData = tmpEngine, AxleGearData = _axlegearData, VehicleData = tempVehicle }, - tmpStrategy); - - _gearshiftData = DataAdapter.CreateGearshiftData( - _gearboxData, _axlegearData.AxleGear.Ratio * (_angledriveData?.Angledrive.Ratio ?? 1.0), tmpEngine.IdleSpeed); - } - - - #endregion } public abstract class Hybrid : PrimaryBusBase @@ -283,13 +262,6 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl.DeclarationMode.PrimaryBusRunDa } - protected override void InitGearboxAndGearshiftData(IVehicleDeclarationInputData vehicle, - CombustionEngineData tmpEngine, - VehicleData tempVehicle) - { - //_gearboxData = ; - _gearshiftData = null; - } } @@ -361,15 +333,6 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl.DeclarationMode.PrimaryBusRunDa throw new NotImplementedException(); } - protected override void InitGearboxAndGearshiftData(IVehicleDeclarationInputData vehicle, - CombustionEngineData tmpEngine, - VehicleData tempVehicle) - { - - - } - - #endregion } @@ -438,13 +401,6 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl.DeclarationMode.PrimaryBusRunDa throw new NotImplementedException(); } - protected override void InitGearboxAndGearshiftData(IVehicleDeclarationInputData vehicle, - CombustionEngineData tmpEngine, - VehicleData tempVehicle) - { - throw new NotImplementedException(); - } - #endregion } @@ -516,13 +472,6 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl.DeclarationMode.PrimaryBusRunDa throw new NotImplementedException(); } - protected override void InitGearboxAndGearshiftData(IVehicleDeclarationInputData vehicle, - CombustionEngineData tmpEngine, - VehicleData tempVehicle) - { - throw new NotImplementedException(); - } - #endregion } } diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationMode/SingleBus/DeclarationModeSingleBusVectoRunDataFactory.cs b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationMode/SingleBus/DeclarationModeSingleBusVectoRunDataFactory.cs index 17ebb2ce1d..84376c00ab 100644 --- a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationMode/SingleBus/DeclarationModeSingleBusVectoRunDataFactory.cs +++ b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationMode/SingleBus/DeclarationModeSingleBusVectoRunDataFactory.cs @@ -15,6 +15,7 @@ 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.Models.SimulationComponent.Impl.Shiftstrategies; using TUGraz.VectoCore.OutputData; namespace TUGraz.VectoCore.InputData.Reader.Impl.DeclarationMode.SingleBus @@ -94,7 +95,29 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl.DeclarationMode.SingleBus protected void InitializeReport() { - //Do nothing + //var powertrainConfig = CreateVectoRunData(DataProvider, 0, null, new KeyValuePair<LoadingType, Tuple<Kilogram, double?>>()); + //var fuels = new List<List<FuelData.Entry>>(); + //Report.InitializeReport(powertrainConfig, fuels); + + VectoRunData powertrainConfig; + List<List<FuelData.Entry>> fuels; + var vehicle = DataProvider.JobInputData.Vehicle; + if (vehicle.ExemptedVehicle) { + powertrainConfig = CreateVectoRunData(DataProvider, 0, null, new KeyValuePair<LoadingType, Tuple<Kilogram, double?>>()); + fuels = new List<List<FuelData.Entry>>(); + } else { + powertrainConfig = _segment.Missions.Select( + mission => CreateVectoRunData( + DataProvider, 0, mission, mission.Loadings.First())) + .FirstOrDefault(x => x != null); + fuels = vehicle.Components.EngineInputData.EngineModes.Select(x => + x.Fuels.Select(f => + DeclarationData.FuelData.Lookup(f.FuelType, + DataProvider.CompletedVehicle.TankSystem)) + .ToList()) + .ToList(); + } + Report.InitializeReport(powertrainConfig, fuels); } protected void Initialize() @@ -107,7 +130,7 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl.DeclarationMode.SingleBus _segment = GetSegment(DataProvider); _driverdata = DataAdapter.CreateDriverData(_segment); //PrimaryBus - _driverdata.AccelerationCurve = AccelerationCurveReader.ReadFromStream(_segment.AccelerationFile); + //_driverdata.AccelerationCurve = AccelerationCurveReader.ReadFromStream(_segment.AccelerationFile); var tempVehicle = DataAdapter.CreateVehicleData(DataProvider, _segment, _segment.Missions.First(), _segment.Missions.First().Loadings.First(), _allowVocational); if (vehicle.AxleConfiguration.AxlegearIncludedInGearbox()) @@ -119,24 +142,24 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl.DeclarationMode.SingleBus _axlegearData = DataAdapter.CreateAxleGearData(vehicle.Components.AxleGearInputData); } _angledriveData = DataAdapter.CreateAngledriveData(vehicle.Components.AngledriveInputData); - var tmpRunData = new VectoRunData() - { - GearboxData = new GearboxData() - { - Type = vehicle.Components.GearboxInputData.Type, - } - }; - var tmpStrategy = PowertrainBuilder.GetShiftStrategy(new SimplePowertrainContainer(tmpRunData)); - var tmpEngine = DataAdapter.CreateEngineData( - vehicle, vehicle.Components.EngineInputData.EngineModes[0], _segment.Missions.First()); - _gearboxData = DataAdapter.CreateGearboxData( - vehicle, new VectoRunData() { EngineData = tmpEngine, AxleGearData = _axlegearData, VehicleData = tempVehicle }, - tmpStrategy); + //var tmpRunData = new VectoRunData() + //{ + // GearboxData = new GearboxData() + // { + // Type = vehicle.Components.GearboxInputData.Type, + // } + //}; + //var tmpStrategy = PowertrainBuilder.GetShiftStrategy(new SimplePowertrainContainer(tmpRunData)); + //var tmpEngine = DataAdapter.CreateEngineData( + // vehicle, vehicle.Components.EngineInputData.EngineModes[0], _segment.Missions.First()); + //_gearboxData = DataAdapter.CreateGearboxData( + // vehicle, new VectoRunData() { EngineData = tmpEngine, AxleGearData = _axlegearData, VehicleData = tempVehicle }, + // tmpStrategy); _retarderData = DataAdapter.CreateRetarderData(vehicle.Components.RetarderInputData); - _gearshiftData = DataAdapter.CreateGearshiftData( - _gearboxData, _axlegearData.AxleGear.Ratio * (_angledriveData?.Angledrive.Ratio ?? 1.0), tmpEngine.IdleSpeed); + //_gearshiftData = DataAdapter.CreateGearshiftData( + // _gearboxData, _axlegearData.AxleGear.Ratio * (_angledriveData?.Angledrive.Ratio ?? 1.0), tmpEngine.IdleSpeed); } protected VectoRunData CreateVectoRunData(ISingleBusInputDataProvider singleBus, int modeIdx, Mission mission, @@ -190,6 +213,17 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl.DeclarationMode.SingleBus simulationRunData.EngineData.FuelMode = modeIdx; simulationRunData.VehicleData.VehicleClass = _segment.VehicleClass; simulationRunData.BusAuxiliaries = DataAdapter.CreateBusAuxiliariesData(mission, primaryVehicle, completedVehicle, simulationRunData); + var shiftStrategyName = + PowertrainBuilder.GetShiftStrategyName(vehicle.Components.GearboxInputData.Type, + vehicle.VehicleType); + simulationRunData.GearboxData = DataAdapter.CreateGearboxData(vehicle, simulationRunData, + ShiftPolygonCalculator.Create(shiftStrategyName, simulationRunData.GearshiftParameters)); + simulationRunData.GearshiftParameters = + DataAdapter.CreateGearshiftData( + simulationRunData.GearboxData, + (simulationRunData.AxleGearData?.AxleGear.Ratio ?? 1.0) * (simulationRunData.AngledriveData?.Angledrive.Ratio ?? 1.0), + vehicle.EngineIdleSpeed + ); return simulationRunData; } diff --git a/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMInputs.cs b/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMInputs.cs index fc747bb3e8..5a07abf51d 100644 --- a/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMInputs.cs +++ b/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/HVAC/SSMInputs.cs @@ -20,6 +20,8 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.HVAC { Source = source; HeatingFuel = heatingFuel ?? FuelData.Diesel; + DriverCompartmentLength = 0.SI<Meter>(); + PassengerCompartmentLength = 0.SI<Meter>(); } public string Source { get; } diff --git a/VectoCore/VectoCore/OutputData/DeclarationReport.cs b/VectoCore/VectoCore/OutputData/DeclarationReport.cs index eb901c2132..35e1825e93 100644 --- a/VectoCore/VectoCore/OutputData/DeclarationReport.cs +++ b/VectoCore/VectoCore/OutputData/DeclarationReport.cs @@ -151,7 +151,7 @@ namespace TUGraz.VectoCore.OutputData LoadingType loadingType, Mission mission, int fuelMode, VectoRunData runData, IModalDataContainer modData) { - return; + //return; if (mission.MissionType != MissionType.ExemptedMission) { var entry = new T { Mission = mission.MissionType, diff --git a/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/CIFNinjectModule.cs b/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/CIFNinjectModule.cs index 16ba40067b..d18b5156e0 100644 --- a/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/CIFNinjectModule.cs +++ b/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/CIFNinjectModule.cs @@ -239,6 +239,17 @@ namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.CustomerInformation false))); #endregion + #region SingleBusCIF + + Bind<IXMLCustomerReport>().To<Conventional_SingleBusCIF>().Named(MRFNinjectModule.VehicleTypeAndArchitectureStringHelper.CreateName.Invoke(MRFNinjectModule.VehicleTypeAndArchitectureStringHelper.ToParams(VehicleCategoryHelper.PrimaryBus, + VectoSimulationJobType.ConventionalVehicle, + ArchitectureID.UNKNOWN, + false, + false, + false))); + + #endregion + #region VehicleTypes Bind<IXmlTypeWriter>().To<CIFConventionalLorryVehicleWriter>().When(AccessedViaCIFFactory) .NamedLikeFactoryMethod((ICustomerInformationFileFactory f) => f.GetConventionalLorryVehicleType()); @@ -310,6 +321,12 @@ namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.CustomerInformation Bind<IXmlTypeWriter>().To<CIF_ExemptedCompletedBusVehicleWriter>().When(AccessedViaCIFFactory) .NamedLikeFactoryMethod((ICustomerInformationFileFactory f) => f.GetExemptedCompletedBusVehicleType()); + + // ==== + + Bind<IXmlTypeWriter>().To<CIF_Conventional_SingleBusVehicleWriter>().When(AccessedViaCIFFactory) + .NamedLikeFactoryMethod((ICustomerInformationFileFactory f) => f.GetConventional_SingleBusVehicleType()); + #endregion #region VehicleGroups @@ -344,6 +361,10 @@ namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.CustomerInformation Bind<IReportOutputGroup>().To<ConventionalCompletedBusVehicleSequenceGroupCIF>().When(AccessedViaCIFFactory) .NamedLikeFactoryMethod((ICustomerInformationFileFactory f) => f.GetConventionalCompletedBusVehicleSequenceGroupWriter()); + Bind<IReportOutputGroup>().To<SingleBusVehicleTypeGroup>().When(AccessedViaCIFFactory) + .NamedLikeFactoryMethod((ICustomerInformationFileFactory f) => f.GetSingleBusVehicleTypeGroup()); + + #endregion #region ComponentGroups Bind<IReportOutputGroup>().To<EngineGroup>().When(AccessedViaCIFFactory) @@ -371,6 +392,8 @@ namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.CustomerInformation Bind<IReportOutputGroup>().To<PEVCompletedBusAuxGroup>().When(AccessedViaCIFFactory) .NamedLikeFactoryMethod((ICustomerInformationFileFactory f) => f.GetPEV_CompletedBusAuxGroup()); + Bind<IReportOutputGroup>().To<ConventionalSingleBusAuxGroup>().When(AccessedViaCIFFactory) + .NamedLikeFactoryMethod((ICustomerInformationFileFactory f) => f.GetConventionalSingleBusAuxGroup()); #endregion diff --git a/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/CIFWriter/ComponentGroupWriters.cs b/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/CIFWriter/ComponentGroupWriters.cs index d2d0ac0c48..555c08910f 100644 --- a/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/CIFWriter/ComponentGroupWriters.cs +++ b/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/CIFWriter/ComponentGroupWriters.cs @@ -401,4 +401,78 @@ namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.CustomerInformation #endregion } + + public class ConventionalSingleBusAuxGroup : AbstractCIFGroupWriter + { + public ConventionalSingleBusAuxGroup(ICustomerInformationFileFactory cifFactory) : base(cifFactory) { } + + #region Overrides of AbstractCIFGroupWriter + + public override IList<XElement> GetElements(IDeclarationInputDataProvider inputData) + { + var singleBus = inputData as ISingleBusInputDataProvider; + if (singleBus == null) { + throw new VectoException("BusAuxGroupWriter requires SingleBusInputData"); + } + + var completedBusAux = singleBus.CompletedVehicle.Components.BusAuxiliaries; + var primaryBusAux = singleBus.PrimaryVehicle.Components.BusAuxiliaries; + var retVal = new List<XElement>(); + retVal.Add(new XElement(_cif + XMLNames.BusAux_SteeringPump, GetSteeringPumpTech(completedBusAux, primaryBusAux))); + retVal.Add(new XElement(_cif + XMLNames.BusAux_ElectricSystem, GetElectricSystem(completedBusAux, primaryBusAux))); + retVal.Add(new XElement(_cif + XMLNames.BusAux_PneumaticSystem, GetPneumaticSystem(completedBusAux, primaryBusAux))); + retVal.Add(new XElement(_cif + XMLNames.BusAux_HVAC, GetHVAC(completedBusAux, primaryBusAux))); + return retVal; + + } + + protected virtual IList<XElement> GetPneumaticSystem( + IBusAuxiliariesDeclarationData completedBusAux, IBusAuxiliariesDeclarationData primaryBusAux) + { + return new[] { + new XElement(_cif + XMLNames.BusAux_PneumaticSystem_SmartcompressionSystem, + primaryBusAux.PneumaticSupply.SmartAirCompression), + new XElement(_cif + XMLNames.BusAux_PneumaticSystem_SmartRegenerationSystem, + primaryBusAux.PneumaticSupply.SmartRegeneration) + }; + } + + protected virtual IList<XElement> GetElectricSystem( + IBusAuxiliariesDeclarationData completedBusAux, IBusAuxiliariesDeclarationData primaryBusAux) + { + var retVal = new List<XElement>() { + new XElement(_cif + "AlternatorTechnology", primaryBusAux.ElectricSupply.AlternatorTechnology.ToXMLFormat()) + }; + if (primaryBusAux.ElectricSupply.AlternatorTechnology == AlternatorType.Smart) { + retVal.Add(new XElement(_cif + "MaxAlternatorPower", + primaryBusAux.ElectricSupply.Alternators.Sum(x => x.RatedCurrent * x.RatedVoltage).ValueAsUnit("kW", 0))); + retVal.Add(new XElement(_cif + "ElectricStorageCapacity", + primaryBusAux.ElectricSupply.ElectricStorage.Sum(x => x.ElectricStorageCapacity).ValueAsUnit("kWh", 0))); + } + + return retVal; + } + + protected virtual IList<XElement> GetSteeringPumpTech( + IBusAuxiliariesDeclarationData completedBusAux, IBusAuxiliariesDeclarationData primaryBusAux) + { + return primaryBusAux.SteeringPumpTechnology.Select(x => new XElement(_cif + XMLNames.BusAux_Technology, x)) + .ToArray(); + } + + protected virtual IList<XElement> GetHVAC(IBusAuxiliariesDeclarationData completedBusAux, + IBusAuxiliariesDeclarationData primaryBusAux) + { + return new[] { + new XElement(_cif + XMLNames.Bus_SystemConfiguration, + completedBusAux.HVACAux.SystemConfiguration.ToXmlFormat()), + new XElement(_cif + "AuxiliaryHeaterPower", + completedBusAux.HVACAux.AuxHeaterPower.ValueAsUnit("kW", 0)), + new XElement(_cif + XMLNames.Bus_DoubleGlazing, completedBusAux.HVACAux.DoubleGlazing) + }; + } + + #endregion + } + } diff --git a/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/CIFWriter/VehicleGroups.cs b/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/CIFWriter/VehicleGroups.cs index 119a65fa87..efe80c1e44 100644 --- a/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/CIFWriter/VehicleGroups.cs +++ b/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/CIFWriter/VehicleGroups.cs @@ -445,4 +445,70 @@ namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.CustomerInformation } } + + + public class SingleBusVehicleTypeGroup : AbstractCIFGroupWriter + { + private XElement GetManufacturerAndAddress(string manufacturer, string manufacturerAddress, int stepCount) + { + return new XElement(_cif + "Step", + new XAttribute(XMLNames.ManufacturingStep_StepCount, stepCount), + new XElement(_cif + XMLNames.Component_Manufacturer, manufacturer), + new XElement(_cif + XMLNames.Component_ManufacturerAddress, manufacturerAddress)); + } + public SingleBusVehicleTypeGroup(ICustomerInformationFileFactory cifFactory) : base(cifFactory) { } + + #region Overrides of AbstractCIFGroupWriter + + public override IList<XElement> GetElements(IDeclarationInputDataProvider inputData) + { + var singleBusData = inputData as ISingleBusInputDataProvider; + if (singleBusData == null) { + throw new ArgumentException( + $"{nameof(inputData)} must implement {nameof(IMultistepBusInputDataProvider)}"); + } + var result = new List<XElement>(); + result.AddRange( + _cifFactory.GetGeneralVehicleSequenceGroupWriter().GetElements(singleBusData.JobInputData.Vehicle)); + result.Add(GetManufacturers(singleBusData)); + + + + var primaryVehicle = singleBusData.PrimaryVehicle; + var completedVehicle = singleBusData.CompletedVehicle; + var dualFuel = singleBusData.JobInputData.Vehicle.Components.EngineInputData.EngineModes.Any(x => x.Fuels.Count > 1); + + result.AddRange(new List<XElement>() { + new XElement(_cif + XMLNames.Component_Model, primaryVehicle.Model), + new XElement(_cif + XMLNames.CorrectedActualMass, completedVehicle.CurbMassChassis.ValueAsUnit("kg", 0)), + new XElement(_cif + XMLNames.Vehicle_ZeroEmissionVehicle, primaryVehicle.ZeroEmissionVehicle), + new XElement(_cif + XMLNames.Vehicle_HybridElectricHDV, primaryVehicle.HybridElectricHDV), + new XElement(_cif + "WasteHeatRecovery", singleBusData.JobInputData.Vehicle.Components.EngineInputData.WHRType != WHRType.None), + new XElement(_cif + XMLNames.Vehicle_DualFuelVehicle, dualFuel), + new XElement(_cif + XMLNames.Vehicle_RegisteredClass, primaryVehicle.RegisteredClass.ToXMLFormat()), + new XElement(_cif + "TotalNumberOfPassengers", primaryVehicle.NumberPassengerSeatsLowerDeck + + primaryVehicle.NumberPassengerSeatsUpperDeck + + primaryVehicle.NumberPassengersStandingLowerDeck + + primaryVehicle.NumberPassengersStandingUpperDeck), + !primaryVehicle.VehicleTypeApprovalNumber.IsNullOrEmpty() ? new XElement(_cif + XMLNames.VehicleTypeApprovalNumber, primaryVehicle.VehicleTypeApprovalNumber) : null + }); + + return result; + } + + protected XElement GetManufacturers(ISingleBusInputDataProvider completedBusData) + { + var manufacturers = new XElement(_cif + "Manufacturers", + GetManufacturerAndAddress(completedBusData.JobInputData.Vehicle.Manufacturer, + completedBusData.JobInputData.Vehicle.ManufacturerAddress, 1)); + //foreach (var step in completedBusData.JobInputData.ManufacturingStages) { + // manufacturers.Add(GetManufacturerAndAddress(step.Vehicle.Manufacturer, step.Vehicle.ManufacturerAddress, + // step.StepCount)); + //} + + return manufacturers; + } + + #endregion + } } diff --git a/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/CIFWriter/VehicleWriter.cs b/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/CIFWriter/VehicleWriter.cs index 9cdd1052ab..21550a41c8 100644 --- a/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/CIFWriter/VehicleWriter.cs +++ b/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/CIFWriter/VehicleWriter.cs @@ -662,4 +662,36 @@ namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.CustomerInformation #endregion } + + + // ---- + + public class CIF_Conventional_SingleBusVehicleWriter : VehicleWriter + { + public CIF_Conventional_SingleBusVehicleWriter(ICustomerInformationFileFactory cifFactory, IManufacturerReportFactory mrfFactory) : base(cifFactory, mrfFactory) { } + + #region Overrides of VehicleWriter + + public override XElement GetElement(IDeclarationInputDataProvider inputData) + { + var singleBus = (ISingleBusInputDataProvider)inputData; + var adas = singleBus.CompletedVehicle.ADAS ?? singleBus.PrimaryVehicle.ADAS; + return new XElement(_cif + XMLNames.Component_Vehicle, + new XAttribute(_xsi + XMLNames.XSIType, "Conventional_CompletedBusVehicleType"), + _cifFactory.GetSingleBusVehicleTypeGroup().GetElements(inputData), + _cifFactory.GetConventionalADASType().GetXmlType(adas).WithXName(_cif + "ADAS"), + _cifFactory.GetEngineGroup().GetElements(inputData), + _cifFactory.GetTransmissionGroup().GetElements(inputData), + GetRetarder(inputData), + GetAxleRatio(inputData), + _cifFactory.GetAxleWheelsGroup().GetElements(inputData), + + _cifFactory.GetConventionalSingleBusAuxGroup().GetElements(inputData) + ); + } + + #endregion + } + + } diff --git a/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/CustomerInformationFile/CustomerInformationFile.cs b/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/CustomerInformationFile/CustomerInformationFile.cs index e01d3d70a4..01b767199f 100644 --- a/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/CustomerInformationFile/CustomerInformationFile.cs +++ b/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/CustomerInformationFile/CustomerInformationFile.cs @@ -413,4 +413,73 @@ namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.CustomerInformation } #endregion + + #region SingleBus + + public abstract class CustomerInformationFileSingleBus : CustomerInformationFile + { + protected XElement InputDataIntegrityPrimaryVehicle { get; set; } + + protected XElement ManufacturerReportIntegrityPrimaryVehicle { get; set; } + + protected CustomerInformationFileSingleBus(ICustomerInformationFileFactory cifFactory) : + base(cifFactory) + { } + + public override void Initialize(VectoRunData modelData, List<List<FuelData.Entry>> fuelModes) + { + InitializeVehicleData(modelData.InputData); + _ovc = modelData.VehicleData.Ocv; + + var inputData = modelData.InputData as ISingleBusInputDataProvider; + if (inputData == null) { + throw new VectoException("CompletedBus CustomerInformationFile requires SingleBusInputData"); + } + Results = new XElement(Cif_0_9 + "Results"); + InputDataIntegrity = new XElement(Cif_0_9 + XMLNames.Report_InputDataSignature, + //inputData.JobInputData.ConsolidateManufacturingStage.Signature == null ? + XMLHelper.CreateDummySig(_di) + //: inputData.JobInputData.ConsolidateManufacturingStage.Signature.ToXML(_di) + ); + //new XElement()); + InputDataIntegrityPrimaryVehicle = new XElement(Cif_0_9 + "InputDataSignaturePrimaryVehicle", + //inputData.PrimaryVehicle..ToXML(_di) + XMLHelper.CreateDummySig(_di) + ); + ManufacturerReportIntegrityPrimaryVehicle = + new XElement(Cif_0_9 + "ManufacturerRecordSignaturePrimaryVehicle", + XMLHelper.CreateDummySig(_di) + //inputData.JobInputData.PrimaryVehicle.ManufacturerRecordHash.ToXML(_di) + ); + } + + protected override IList<XElement> GetReportContents(XElement resultSignature) + { + return new[] { + Vehicle, + InputDataIntegrityPrimaryVehicle, + ManufacturerReportIntegrityPrimaryVehicle, + InputDataIntegrity, + new XElement(Cif_0_9 + XMLNames.Report_ManufacturerRecord_Signature, resultSignature), + Results, + XMLHelper.GetApplicationInfo(Cif_0_9) + }; + } + } + + public class Conventional_SingleBusCIF : CustomerInformationFileSingleBus + { + public override string OutputDataType => "Conventional_CompletedBusOutputType"; + + public Conventional_SingleBusCIF(ICustomerInformationFileFactory cifFactory) : base(cifFactory) + { + } + + public override void InitializeVehicleData(IDeclarationInputDataProvider inputData) + { + Vehicle = _cifFactory.GetConventional_SingleBusVehicleType().GetElement(inputData); + } + } + + #endregion } diff --git a/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/ICustomerInformationFileFactory.cs b/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/ICustomerInformationFileFactory.cs index 58816ff398..ba8c8a6b77 100644 --- a/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/ICustomerInformationFileFactory.cs +++ b/VectoCore/VectoCore/OutputData/XML/DeclarationReports/CustomerInformationFile/CustomerInformationFile_0_9/ICustomerInformationFileFactory.cs @@ -44,6 +44,10 @@ namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.CustomerInformation IXmlTypeWriter GetPEV_IEPC_CompletedBusVehicleType(); + IXmlTypeWriter GetConventional_SingleBusVehicleType(); + + + //IXmlTypeWriter GetPEV_CompletedBusVehicleType(); IXmlTypeWriter GetExemptedCompletedBusVehicleType(); @@ -74,13 +78,19 @@ namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.CustomerInformation IReportOutputGroup GetPEV_CompletedBusVehicleSequenceGroupWriter(); IReportOutputGroup GetCompletedBusVehicleTypeGroup(); IReportOutputGroup GetExemptedCompletedBusVehicleTypeGroup(); + IReportCompletedBusOutputGroup GetGeneralVehicleSequenceGroupWriterCompletedBus(); + IReportOutputGroup GetConventionalSingleBusAuxGroup(); + + + IReportOutputGroup GetSingleBusVehicleTypeGroup(); + ICIFAdasType GetConventionalADASType(); ICIFAdasType GetHEVADASType(); ICIFAdasType GetPEVADASType(); - //IReportOutputGroup GetHEV_VehicleSequenceGroup(); + IReportOutputGroup GetPEVCompletedBusVehicleTypeGroup(); IReportOutputGroup GetIEPCTransmissionGroup(); } diff --git a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportMultistageBusVehicle.cs b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportMultistageBusVehicle.cs deleted file mode 100644 index f43b744104..0000000000 --- a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReportMultistageBusVehicle.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCore.Models.Declaration; -using TUGraz.VectoCore.Models.Simulation.Data; -using TUGraz.VectoCore.OutputData.XML.DeclarationReports.VehicleInformationFile; - -namespace TUGraz.VectoCore.OutputData.XML -{ - /// <summary> - /// Create VIF of an interim (or the complete(d) step - /// </summary> - public class XMLDeclarationReportMultistageBusVehicle : XMLDeclarationReport - { - protected IXMLMultistepIntermediateReport _multistageBusReport; - - public XMLDeclarationReportMultistageBusVehicle(IReportWriter writer) - : base(writer) - { - throw new NotImplementedException(); - //throw new VectoException("Used here"); - //_multistageBusReport = new XMLMultistageBusReport(); - } - - public override void InitializeReport(VectoRunData modelData, List<List<FuelData.Entry>> fuelModes) - { - _multistageBusReport = - modelData.Exempted ? new XMLMultistageExemptedBusReport() : new XMLMultistageBusReport(); - _multistageBusReport.Initialize(modelData); - } - - protected override void GenerateReports() - { - _multistageBusReport.GenerateReport(); - } - - protected override void OutputReports() - { - Writer.WriteReport(ReportType.DeclarationReportMultistageVehicleXML, _multistageBusReport.Report); - } - - protected override void DoStoreResult(ResultEntry entry, VectoRunData runData, IModalDataContainer modData) - { - throw new NotSupportedException(); - } - protected override void WriteResult(ResultEntry result) - { - throw new NotSupportedException(); - } - } -} diff --git a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReport_0_9.cs b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReport_0_9.cs index 1255de6fb7..127449661c 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReport_0_9.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReport_0_9.cs @@ -46,7 +46,8 @@ namespace TUGraz.VectoCore.OutputData.XML protected override void WriteResult(ResultEntry result) { - base.WriteResult(result); + ManufacturerRpt.WriteResult(result); + //base.WriteResult(result); VehicleInformationFile.WriteResult(result); } @@ -54,7 +55,7 @@ namespace TUGraz.VectoCore.OutputData.XML { ManufacturerRpt.GenerateReport(); var fullReportHash = GetSignature(ManufacturerRpt.Report); - CustomerRpt.GenerateReport(fullReportHash); + //CustomerRpt.GenerateReport(fullReportHash); VehicleInformationFile.GenerateReport(fullReportHash); } diff --git a/VectoCore/VectoCoreTest/XML/XMLDeclarationInputv210.cs b/VectoCore/VectoCoreTest/XML/XMLDeclarationInputv210.cs index 956dc98ce0..e733fc8008 100644 --- a/VectoCore/VectoCoreTest/XML/XMLDeclarationInputv210.cs +++ b/VectoCore/VectoCoreTest/XML/XMLDeclarationInputv210.cs @@ -9,6 +9,7 @@ using TUGraz.VectoCore.InputData.FileIO.XML; using TUGraz.VectoCore.Models.Simulation; using TUGraz.VectoCore.Models.Simulation.Impl; using TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory; +using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.OutputData.FileIO; namespace TUGraz.VectoCore.Tests.XML @@ -113,12 +114,14 @@ namespace TUGraz.VectoCore.Tests.XML var fileWriter = new FileOutputWriter(filename); //var sumWriter = new SummaryDataContainer(fileWriter); //var jobContainer = new JobContainer(sumWriter); + var sumContainer = new SummaryDataContainer(fileWriter); var dataProvider = xmlInputReader.CreateDeclaration(XmlReader.Create(filename)); var runsFactory = SimulatorFactory.CreateSimulatorFactory(ExecutionMode.Declaration, dataProvider, fileWriter); runsFactory.ModalResults1Hz = false; runsFactory.WriteModalResults = false; runsFactory.ActualModalData = false; runsFactory.Validate = false; + runsFactory.SumData = sumContainer; var runs = runsFactory.SimulationRuns().ToArray(); Assert.IsTrue(runs.Length > 0); -- GitLab