Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Select Git revision
  • e953a90fa41a0a4d1c3234b9d3ec3b96e23e7f02
  • stable default
  • feat-fchv-bus
  • fix-h2-ice-bus
  • powertrains-multiple-axles
  • amdm3/develop
  • issue-1039
  • amdm3/main
  • test/nuget_publish
  • IEPC-experiments
  • amdm2/main
  • amdm2/develop
  • aptngearbox-not-auto
  • playground
  • official/main
  • official/develop
  • issue-templates
  • pdf-reports
  • HEV-timeruns-dev
  • timerun-empower-hybrids
  • timerun-pwheel-hybrids
  • Release/v5.0.3
  • Release/v5.0.1
  • Release/5.0.0-RC
  • Nuget/v0.11.4-DEV
  • Release/v0.11.4-DEV
  • Release/4.3.4-DEV
  • Release/4.3.3
  • Release/4.3.2-RC
  • Release/v4.3.0-DEV
  • Release/4.2.7
  • XMLConverterTool/4.2.6.0
  • Release/4.2.6-RC
  • Release/v4.2.5
  • Release/v4.2.3
  • Release/v4.2.2.3539-RC
  • Release/v4.2.1.3469
  • Release/v0.11.2.3456-DEV
  • Release/v4.2.0.3448-RC
  • Release/v4.1.3.3415
  • Release/v4.1.1.3413
41 results

DeclarationModeVectoRunDataFactory.cs

Blame
  • Forked from VECTO / VECTO Sim
    10496 commits behind the upstream repository.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    DeclarationModeVectoRunDataFactory.cs 5.41 KiB
    /*
    * This file is part of VECTO.
    *
    * Copyright © 2012-2016 European Union
    *
    * Developed by Graz University of Technology,
    *              Institute of Internal Combustion Engines and Thermodynamics,
    *              Institute of Technical Informatics
    *
    * VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved
    * by the European Commission - subsequent versions of the EUPL (the "Licence");
    * You may not use VECTO except in compliance with the Licence.
    * You may obtain a copy of the Licence at:
    *
    * https://joinup.ec.europa.eu/community/eupl/og_page/eupl
    *
    * Unless required by applicable law or agreed to in writing, VECTO
    * distributed under the Licence is distributed on an "AS IS" basis,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    * See the Licence for the specific language governing permissions and
    * limitations under the Licence.
    *
    * Authors:
    *   Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology
    *   Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology
    *   Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology
    *   Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology
    *   Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology
    *   Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology
    */
    
    using System.Collections.Generic;
    using System.Linq;
    using TUGraz.VectoCore.InputData.Reader.DataObjectAdaper;
    using TUGraz.VectoCore.Models;
    using TUGraz.VectoCore.Models.Declaration;
    using TUGraz.VectoCore.Models.Simulation.Data;
    using TUGraz.VectoCore.Models.SimulationComponent.Data;
    using TUGraz.VectoCore.OutputData;
    using TUGraz.VectoCore.OutputData.PDF;
    using TUGraz.VectoCore.Utils;
    
    namespace TUGraz.VectoCore.InputData.Reader.Impl
    {
    	public class DeclarationModeVectoRunDataFactory : LoggingObject, IVectoRunDataFactory
    	{
    		protected static Dictionary<MissionType, DrivingCycleData> CyclesCache =
    			new Dictionary<MissionType, DrivingCycleData>();
    
    		protected IDeclarationInputDataProvider InputDataProvider;
    
    		protected DeclarationReport Report;
    
    		internal DeclarationModeVectoRunDataFactory(IDeclarationInputDataProvider dataProvider, DeclarationReport report)
    		{
    			InputDataProvider = dataProvider;
    			Report = report;
    		}
    
    		public IEnumerable<VectoRunData> NextRun()
    		{
    			var dao = new DeclarationDataAdapter();
    			var segment = GetVehicleClassification(InputDataProvider.VehicleInputData.VehicleCategory,
    				InputDataProvider.VehicleInputData.AxleConfiguration,
    				InputDataProvider.VehicleInputData.GrossVehicleMassRating, InputDataProvider.VehicleInputData.CurbWeightChassis);
    			var driverdata = dao.CreateDriverData(InputDataProvider.DriverInputData);
    			driverdata.AccelerationCurve = AccelerationCurveData.ReadFromStream(segment.AccelerationFile);
    
    			var engineData = dao.CreateEngineData(InputDataProvider.EngineInputData);
    
    			var gearboxData = dao.CreateGearboxData(InputDataProvider.GearboxInputData, engineData);
    			var axlegearData = dao.CreateAxleGearData(InputDataProvider.AxleGearInputData);
    			var retarderData = dao.CreateRetarderData(InputDataProvider.RetarderInputData, InputDataProvider.VehicleInputData);
    
    			if (Report != null) {
    				var powertrainConfig = new VectoRunData() {
    					VehicleData = dao.CreateVehicleData(InputDataProvider.VehicleInputData, segment.Missions.First(),
    						segment.Missions.First().Loadings.First().Value),
    					EngineData = engineData,
    					GearboxData = gearboxData,
    					AxleGearData = axlegearData,
    					Retarder = retarderData,
    					Aux = dao.CreateAuxiliaryData(InputDataProvider.AuxiliaryInputData(), segment.Missions.First().MissionType,
    						segment.VehicleClass)
    				};
    				Report.InitializeReport(powertrainConfig, segment);
    			}
    
    			foreach (var mission in segment.Missions) {
    				DrivingCycleData cycle;
    				if (CyclesCache.ContainsKey(mission.MissionType)) {
    					cycle = CyclesCache[mission.MissionType];
    				} else {
    					cycle = DrivingCycleDataReader.ReadFromStream(mission.CycleFile, CycleType.DistanceBased, "", false);
    					CyclesCache.Add(mission.MissionType, cycle);
    				}
    				foreach (var loading in mission.Loadings) {
    					var simulationRunData = new VectoRunData {
    						Loading = loading.Key,
    						VehicleData = dao.CreateVehicleData(InputDataProvider.VehicleInputData, mission, loading.Value),
    						EngineData = engineData,
    						GearboxData = gearboxData,
    						AxleGearData = axlegearData,
    						Aux = dao.CreateAuxiliaryData(InputDataProvider.AuxiliaryInputData(), mission.MissionType,
    							segment.VehicleClass),
    						Cycle = cycle,
    						Retarder = retarderData,
    						DriverData = driverdata,
    						IsEngineOnly = false,
    						JobName = InputDataProvider.JobInputData().JobName,
    						ModFileSuffix = loading.Key.ToString(),
    						Report = Report,
    						Mission = mission,
    					};
    					simulationRunData.EngineData.WHTCCorrectionFactor = DeclarationData.WHTCCorrection.Lookup(mission.MissionType,
    						engineData.WHTCRural, engineData.WHTCUrban, engineData.WHTCMotorway);
    					simulationRunData.Cycle.Name = mission.MissionType.ToString();
    					simulationRunData.VehicleData.VehicleClass = segment.VehicleClass;
    					yield return simulationRunData;
    				}
    			}
    		}
    
    		internal Segment GetVehicleClassification(VehicleCategory category, AxleConfiguration axles, Kilogram grossMassRating,
    			Kilogram curbWeight)
    		{
    			return DeclarationData.Segments.Lookup(category, axles, grossMassRating, curbWeight);
    		}
    	}
    }