Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 793dabae authored by Harald Martini's avatar Harald Martini
Browse files

Use new dataadapter in DeclarationVTPModeVectoRunDataFactoryLorries,...

Use new dataadapter in DeclarationVTPModeVectoRunDataFactoryLorries, DeclarationVTPModeVectoRunDataFactoryHeavyBusPrimary
parent 132b2d77
No related branches found
No related tags found
No related merge requests found
//using System; using System;
//using System.Collections.Generic; using System.Collections.Generic;
//using System.Linq; using System.Linq;
//using TUGraz.VectoCommon.BusAuxiliaries; using TUGraz.VectoCommon.BusAuxiliaries;
//using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Exceptions;
//using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.InputData;
//using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Models;
//using TUGraz.VectoCommon.Utils; using TUGraz.VectoCommon.Utils;
//using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.Configuration;
//using TUGraz.VectoCore.InputData.Reader.ComponentData; using TUGraz.VectoCore.InputData.Reader.ComponentData;
//using TUGraz.VectoCore.InputData.Reader.DataObjectAdapter; using TUGraz.VectoCore.InputData.Reader.DataObjectAdapter;
//using TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.PrimaryBus; using TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.PrimaryBus;
//using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Declaration;
//using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.Data;
//using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Models.SimulationComponent.Data;
//using TUGraz.VectoCore.Models.SimulationComponent.Impl; using TUGraz.VectoCore.Models.SimulationComponent.Impl;
//using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.OutputData;
//namespace TUGraz.VectoCore.InputData.Reader.Impl { namespace TUGraz.VectoCore.InputData.Reader.Impl
// internal class DeclarationVTPModeVectoRunDataFactoryHeavyBusPrimary : AbstractVTPModeVectoRunDataFactory {
// { internal class DeclarationVTPModeVectoRunDataFactoryHeavyBusPrimary : AbstractVTPModeVectoRunDataFactory
// private DeclarationDataAdapterPrimaryBus _dao; {
private IPrimaryBusDeclarationDataAdapter _dao;
// public DeclarationVTPModeVectoRunDataFactoryHeavyBusPrimary(
// IVTPDeclarationInputDataProvider ivtpProvider, IVTPReport report) : base(ivtpProvider.JobInputData, report) public DeclarationVTPModeVectoRunDataFactoryHeavyBusPrimary(
// { IVTPDeclarationInputDataProvider ivtpProvider, IVTPReport report) : base(ivtpProvider.JobInputData, report)
{
// }
}
// protected DeclarationVTPModeVectoRunDataFactoryHeavyBusPrimary(IVTPDeclarationJobInputData vtpJob, IVTPReport report): base(vtpJob, report) { }
protected DeclarationVTPModeVectoRunDataFactoryHeavyBusPrimary(IVTPDeclarationJobInputData vtpJob, IVTPReport report) : base(vtpJob, report) { }
// #region Implementation of IVectoRunDataFactory
#region Implementation of IVectoRunDataFactory
// protected override IDeclarationDataAdapter Dao => _dao ?? (_dao = new DeclarationDataAdapterPrimaryBus());
// #endregion protected IPrimaryBusDeclarationDataAdapter DataAdapter => _dao ?? (_dao = new DeclarationDataAdapterPrimaryBus.Conventional());
// protected override void Initialize() #endregion
// {
// var vehicle = JobInputData.Vehicle; protected override IDeclarationDataAdapter Dao => DataAdapter;
// Segment = DeclarationData.PrimaryBusSegments.Lookup(
// vehicle.VehicleCategory, vehicle.AxleConfiguration, vehicle.Articulated); protected override void Initialize()
{
// Driverdata = Dao.CreateDriverData(); var vehicle = JobInputData.Vehicle;
// Driverdata.AccelerationCurve = AccelerationCurveReader.ReadFromStream(Segment.AccelerationFile); Segment = DeclarationData.PrimaryBusSegments.Lookup(
// var tempVehicle = Dao.CreateVehicleData( vehicle.VehicleCategory, vehicle.AxleConfiguration, vehicle.Articulated);
// vehicle, Segment, Segment.Missions.First(),
// Segment.Missions.First().Loadings.First(), _allowVocational); Driverdata = DataAdapter.CreateDriverData();
// tempVehicle.VehicleClass = JobInputData.ManufacturerReportInputData.VehicleClass; Driverdata.AccelerationCurve = AccelerationCurveReader.ReadFromStream(Segment.AccelerationFile);
// tempVehicle.VehicleCode = JobInputData.ManufacturerReportInputData.VehicleCode; var tempVehicle = DataAdapter.CreateVehicleData(
vehicle, Segment, Segment.Missions.First(),
// var vtpMission = tempVehicle.VehicleCode.GetFloorType() == FloorType.LowFloor Segment.Missions.First().Loadings.First(), _allowVocational);
// ? DeclarationData.VTPMode.SelectedMissionLowFloorBus tempVehicle.VehicleClass = JobInputData.ManufacturerReportInputData.VehicleClass;
// : DeclarationData.VTPMode.SelectedMissionHighFloorBus; tempVehicle.VehicleCode = JobInputData.ManufacturerReportInputData.VehicleCode;
// AirdragData = Dao.CreateAirdragData(
// vehicle.Components.AirdragInputData, var vtpMission = tempVehicle.VehicleCode.GetFloorType() == FloorType.LowFloor
// Segment.Missions.First(), Segment); ? DeclarationData.VTPMode.SelectedMissionLowFloorBus
// EngineData = Dao.CreateEngineData( : DeclarationData.VTPMode.SelectedMissionHighFloorBus;
// vehicle, vehicle.Components.EngineInputData.EngineModes.First(), AirdragData = DataAdapter.CreateAirdragData(
// new Mission() { MissionType = vtpMission }); vehicle.Components.AirdragInputData,
// AxlegearData = JobInputData.Vehicle.Components.GearboxInputData.DifferentialIncluded Segment.Missions.First(), Segment);
// ? Dao.CreateDummyAxleGearData(JobInputData.Vehicle.Components.GearboxInputData) EngineData = DataAdapter.CreateEngineData(
// : Dao.CreateAxleGearData(vehicle.Components.AxleGearInputData); vehicle, vehicle.Components.EngineInputData.EngineModes.First(),
// AngledriveData = Dao.CreateAngledriveData(vehicle.Components.AngledriveInputData); new Mission() { MissionType = vtpMission });
AxlegearData = JobInputData.Vehicle.Components.GearboxInputData.DifferentialIncluded
// GearboxData = Dao.CreateGearboxData( ? DataAdapter.CreateDummyAxleGearData(JobInputData.Vehicle.Components.GearboxInputData)
// vehicle, new VectoRunData() { EngineData = EngineData, AxleGearData = AxlegearData, VehicleData = tempVehicle }, : DataAdapter.CreateAxleGearData(vehicle.Components.AxleGearInputData);
// null); AngledriveData = DataAdapter.CreateAngledriveData(vehicle.Components.AngledriveInputData);
// RetarderData = Dao.CreateRetarderData(vehicle.Components.RetarderInputData);
GearboxData = DataAdapter.CreateGearboxData(
// PTOTransmissionData = vehicle, new VectoRunData() { EngineData = EngineData, AxleGearData = AxlegearData, VehicleData = tempVehicle },
// Dao.CreatePTOTransmissionData(vehicle.Components.PTOTransmissionInputData); null);
RetarderData = DataAdapter.CreateRetarderData(vehicle.Components.RetarderInputData);
// GearshiftData = Dao.CreateGearshiftData(
// GearboxData, AxlegearData.AxleGear.Ratio * (AngledriveData?.Angledrive.Ratio ?? 1.0), EngineData.IdleSpeed); PTOTransmissionData =
DataAdapter.CreatePTOTransmissionData(vehicle.Components.PTOTransmissionInputData);
// AuxVTP = CreateVTPAuxData(vehicle);
// } GearshiftData = DataAdapter.CreateGearshiftData(
GearboxData, AxlegearData.AxleGear.Ratio * (AngledriveData?.Angledrive.Ratio ?? 1.0), EngineData.IdleSpeed);
// protected override void InitializeReport()
// { AuxVTP = CreateVTPAuxData(vehicle);
// var vehicle = JobInputData.Vehicle; }
// var tempVehicle = Dao.CreateVehicleData(
// vehicle, Segment, Segment.Missions.First(), protected override void InitializeReport()
// Segment.Missions.First().Loadings.First(), _allowVocational); {
// tempVehicle.VehicleClass = JobInputData.ManufacturerReportInputData.VehicleClass; var vehicle = JobInputData.Vehicle;
// tempVehicle.VehicleCode = JobInputData.ManufacturerReportInputData.VehicleCode; var tempVehicle = DataAdapter.CreateVehicleData(
// var powertrainConfig = new VectoRunData() { vehicle, Segment, Segment.Missions.First(),
// VehicleData = tempVehicle, Segment.Missions.First().Loadings.First(), _allowVocational);
// AirdragData = AirdragData, tempVehicle.VehicleClass = JobInputData.ManufacturerReportInputData.VehicleClass;
// EngineData = EngineData, tempVehicle.VehicleCode = JobInputData.ManufacturerReportInputData.VehicleCode;
// GearboxData = GearboxData, var powertrainConfig = new VectoRunData()
// AxleGearData = AxlegearData, {
// Retarder = RetarderData, VehicleData = tempVehicle,
// Aux = GetAuxiliaryData(Segment.Missions.First().MissionType), AirdragData = AirdragData,
// }; EngineData = EngineData,
// //powertrainConfig.VehicleData.VehicleClass = Segment.VehicleClass; GearboxData = GearboxData,
// Report.InputDataHash = JobInputData.VectoJobHash; AxleGearData = AxlegearData,
// Report.ManufacturerRecord = JobInputData.ManufacturerReportInputData; Retarder = RetarderData,
// Report.ManufacturerRecordHash = JobInputData.VectoManufacturerReportHash; Aux = GetAuxiliaryData(Segment.Missions.First().MissionType),
// var fuels = JobInputData.Vehicle.Components.EngineInputData.EngineModes.Select( };
// x => x.Fuels.Select(f => DeclarationData.FuelData.Lookup(f.FuelType, JobInputData.Vehicle.TankSystem)) //powertrainConfig.VehicleData.VehicleClass = Segment.VehicleClass;
// .ToList()) Report.InputDataHash = JobInputData.VectoJobHash;
// .ToList(); Report.ManufacturerRecord = JobInputData.ManufacturerReportInputData;
// Report.InitializeReport(powertrainConfig, fuels); Report.ManufacturerRecordHash = JobInputData.VectoManufacturerReportHash;
// } var fuels = JobInputData.Vehicle.Components.EngineInputData.EngineModes.Select(
x => x.Fuels.Select(f => DeclarationData.FuelData.Lookup(f.FuelType, JobInputData.Vehicle.TankSystem))
// protected virtual List<VectoRunData.AuxData> CreateVTPAuxData(IVehicleDeclarationInputData vehicle) .ToList())
// { .ToList();
// // used to fill VECTO RunData for VTP mission. Report.InitializeReport(powertrainConfig, fuels);
}
// var retVal = new List<VectoRunData.AuxData>();
protected virtual List<VectoRunData.AuxData> CreateVTPAuxData(IVehicleDeclarationInputData vehicle)
// var electricEfficiency = {
// Constants.BusAuxiliaries.ElectricSystem.AlternatorGearEfficiency * // used to fill VECTO RunData for VTP mission.
// DeclarationData.BusAuxiliaries.AlternatorTechnologies.Lookup("default");
var retVal = new List<VectoRunData.AuxData>();
// // TODO: vehicle length from MRF
var electricEfficiency =
// var spPowerDemand = DeclarationData.SteeringPumpBus.LookupMechanicalPowerDemand( Constants.BusAuxiliaries.ElectricSystem.AlternatorGearEfficiency *
// MissionType.VerificationTest, JobInputData.Vehicle.Components.BusAuxiliaries.SteeringPumpTechnology, DeclarationData.BusAuxiliaries.AlternatorTechnologies.Lookup("default");
// JobInputData.ManufacturerReportInputData.VehicleLength)
// + // TODO: vehicle length from MRF
// DeclarationData.SteeringPumpBus.LookupElectricalPowerDemand(
// MissionType.VerificationTest, JobInputData.Vehicle.Components.BusAuxiliaries.SteeringPumpTechnology, var spPowerDemand = DeclarationData.SteeringPumpBus.LookupMechanicalPowerDemand(
// JobInputData.ManufacturerReportInputData.VehicleLength) / electricEfficiency; MissionType.VerificationTest, JobInputData.Vehicle.Components.BusAuxiliaries.SteeringPumpTechnology,
JobInputData.ManufacturerReportInputData.VehicleLength)
// retVal.Add( +
// new VectoRunData.AuxData() { DeclarationData.SteeringPumpBus.LookupElectricalPowerDemand(
// DemandType = AuxiliaryDemandType.Constant, MissionType.VerificationTest, JobInputData.Vehicle.Components.BusAuxiliaries.SteeringPumpTechnology,
// Technology = JobInputData.Vehicle.Components.BusAuxiliaries.SteeringPumpTechnology, JobInputData.ManufacturerReportInputData.VehicleLength) / electricEfficiency;
// ID = Constants.Auxiliaries.IDs.SteeringPump,
// PowerDemand = spPowerDemand retVal.Add(
// }); new VectoRunData.AuxData()
{
// retVal.Add( DemandType = AuxiliaryDemandType.Constant,
// new VectoRunData.AuxData() { Technology = JobInputData.Vehicle.Components.BusAuxiliaries.SteeringPumpTechnology,
// DemandType = AuxiliaryDemandType.Constant, ID = Constants.Auxiliaries.IDs.SteeringPump,
// Technology = new List<string>() { "default"}, PowerDemand = spPowerDemand
// ID = Constants.Auxiliaries.IDs.ElectricSystem, });
// PowerDemand = Constants.BusAuxiliaries.ElectricSystem.PowernetVoltage * 32.4.SI<Ampere>() / electricEfficiency
// }); retVal.Add(
// retVal.Add(new VectoRunData.AuxData() { new VectoRunData.AuxData()
// DemandType = AuxiliaryDemandType.Constant, {
// Technology = new List<string>() { "default"}, DemandType = AuxiliaryDemandType.Constant,
// ID = Constants.Auxiliaries.IDs.HeatingVentilationAirCondition, Technology = new List<string>() { "default" },
// PowerDemand = 350.SI<Watt>() ID = Constants.Auxiliaries.IDs.ElectricSystem,
// }); PowerDemand = Constants.BusAuxiliaries.ElectricSystem.PowernetVoltage * 32.4.SI<Ampere>() / electricEfficiency
});
// var busAux = vehicle.Components.BusAuxiliaries; retVal.Add(new VectoRunData.AuxData()
// var psCompressor = DeclarationData.BusAuxiliaries.GetCompressorMap(busAux.PneumaticSupply.CompressorSize, busAux.PneumaticSupply.Clutch); {
// retVal.Add(new VectoRunData.AuxData() { DemandType = AuxiliaryDemandType.Constant,
// DemandType = AuxiliaryDemandType.Direct, Technology = new List<string>() { "default" },
// Technology = new List<string>() { busAux.PneumaticSupply.CompressorSize + " / " + busAux.PneumaticSupply.Clutch}, ID = Constants.Auxiliaries.IDs.HeatingVentilationAirCondition,
// ID = Constants.Auxiliaries.IDs.PneumaticSystem, PowerDemand = 350.SI<Watt>()
// PowerDemandFunc = cycleEntry => { });
// var cmp = psCompressor.Interpolate(cycleEntry.EngineSpeed * busAux.PneumaticSupply.Ratio);
// return cycleEntry.VTPPSCompressorActive ? cmp.PowerOn : cmp.PowerOff; var busAux = vehicle.Components.BusAuxiliaries;
// } var psCompressor = DeclarationData.BusAuxiliaries.GetCompressorMap(busAux.PneumaticSupply.CompressorSize, busAux.PneumaticSupply.Clutch);
// }); retVal.Add(new VectoRunData.AuxData()
{
// var fanData = GetFanData(); DemandType = AuxiliaryDemandType.Direct,
// var engineFan = new EngineFanAuxiliary(fanData.FanCoefficients, fanData.FanDiameter); Technology = new List<string>() { busAux.PneumaticSupply.CompressorSize + " / " + busAux.PneumaticSupply.Clutch },
// retVal.Add( new VectoRunData.AuxData() { ID = Constants.Auxiliaries.IDs.PneumaticSystem,
// DemandType = AuxiliaryDemandType.Direct, PowerDemandFunc = cycleEntry =>
// Technology = new List<string>() { "default"}, {
// ID = Constants.Auxiliaries.IDs.Fan, var cmp = psCompressor.Interpolate(cycleEntry.EngineSpeed * busAux.PneumaticSupply.Ratio);
// PowerDemandFunc = cycleEntry => engineFan.PowerDemand(cycleEntry.FanSpeed) return cycleEntry.VTPPSCompressorActive ? cmp.PowerOn : cmp.PowerOff;
// }); }
});
// return retVal;
// } var fanData = GetFanData();
var engineFan = new EngineFanAuxiliary(fanData.FanCoefficients, fanData.FanDiameter);
// protected override IEnumerable<VectoRunData.AuxData> GetAuxiliaryData(MissionType missionType) retVal.Add(new VectoRunData.AuxData()
// { {
// // used for initializing XML report, DemandType = AuxiliaryDemandType.Direct,
// return AuxVTP; Technology = new List<string>() { "default" },
// } ID = Constants.Auxiliaries.IDs.Fan,
PowerDemandFunc = cycleEntry => engineFan.PowerDemand(cycleEntry.FanSpeed)
// protected override AuxFanData GetFanData() });
// {
// return new AuxFanData() { return retVal;
// FanCoefficients = DeclarationData.VTPMode.FanParameters.Concat(JobInputData.FanPowerCoefficents.Skip(3).Take(1)).ToArray() , }
// FanDiameter = JobInputData.FanDiameter,
// }; protected override IEnumerable<VectoRunData.AuxData> GetAuxiliaryData(MissionType missionType)
// } {
// used for initializing XML report,
// public override IEnumerable<VectoRunData> NextRun() return AuxVTP;
// { }
// if (InitException != null) {
// throw InitException; protected override AuxFanData GetFanData()
// } {
return new AuxFanData()
{
// // simulate the Measured cycle FanCoefficients = DeclarationData.VTPMode.FanParameters.Concat(JobInputData.FanPowerCoefficents.Skip(3).Take(1)).ToArray(),
// var vtpCycle = JobInputData.Cycles.FirstOrDefault(); FanDiameter = JobInputData.FanDiameter,
// if (vtpCycle == null) { };
// throw new VectoException("no VTP-Cycle provided!"); }
// }
public override IEnumerable<VectoRunData> NextRun()
// var drivingCycle = DrivingCycleDataReader.ReadFromDataTable(vtpCycle.CycleData, vtpCycle.Name, false); {
if (InitException != null)
// // Loading is not relevant as we use P_wheel {
// var vtpRunData = CreateVectoRunData(Segment, Segment.Missions.First(), Tuple.Create<Kilogram, double?>(0.SI<Kilogram>(), null)); throw InitException;
// vtpRunData.Cycle = new DrivingCycleProxy(drivingCycle, vtpCycle.Name); }
// vtpRunData.Aux = AuxVTP;
// vtpRunData.FanDataVTP = GetFanData();
// vtpRunData.ExecutionMode = ExecutionMode.Declaration; // simulate the Measured cycle
// vtpRunData.SimulationType = SimulationType.VerificationTest; var vtpCycle = JobInputData.Cycles.FirstOrDefault();
// vtpRunData.Mission = new Mission() { if (vtpCycle == null)
// MissionType = MissionType.VerificationTest {
// }; throw new VectoException("no VTP-Cycle provided!");
// vtpRunData.VehicleData.VehicleClass = JobInputData.ManufacturerReportInputData.VehicleClass; //Segment.VehicleClass; }
// vtpRunData.VehicleData.VehicleCode = JobInputData.ManufacturerReportInputData.VehicleCode;
// vtpRunData.VehicleData.LegislativeClass = JobInputData.Vehicle.LegislativeClass; var drivingCycle = DrivingCycleDataReader.ReadFromDataTable(vtpCycle.CycleData, vtpCycle.Name, false);
// //var ncvStd = DeclarationData.FuelData.Lookup(JobInputData.Vehicle.Components.EngineInputData.FuelType).LowerHeatingValueVecto; // Loading is not relevant as we use P_wheel
// //var ncvCorrection = ncvStd / JobInputData.NetCalorificValueTestFuel; var vtpRunData = CreateVectoRunData(Segment, Segment.Missions.First(), Tuple.Create<Kilogram, double?>(0.SI<Kilogram>(), null));
// var mileageCorrection = GetMileagecorrectionFactor(JobInputData.Mileage); vtpRunData.Cycle = new DrivingCycleProxy(drivingCycle, vtpCycle.Name);
// vtpRunData.VTPData = new VTPData() { vtpRunData.Aux = AuxVTP;
// CorrectionFactor = mileageCorrection, vtpRunData.FanDataVTP = GetFanData();
// }; vtpRunData.ExecutionMode = ExecutionMode.Declaration;
// vtpRunData.DriverData = Driverdata; vtpRunData.SimulationType = SimulationType.VerificationTest;
// yield return vtpRunData; vtpRunData.Mission = new Mission()
// } {
MissionType = MissionType.VerificationTest
};
// } vtpRunData.VehicleData.VehicleClass = JobInputData.ManufacturerReportInputData.VehicleClass; //Segment.VehicleClass;
//} vtpRunData.VehicleData.VehicleCode = JobInputData.ManufacturerReportInputData.VehicleCode;
\ No newline at end of file vtpRunData.VehicleData.LegislativeClass = JobInputData.Vehicle.LegislativeClass;
//var ncvStd = DeclarationData.FuelData.Lookup(JobInputData.Vehicle.Components.EngineInputData.FuelType).LowerHeatingValueVecto;
//var ncvCorrection = ncvStd / JobInputData.NetCalorificValueTestFuel;
var mileageCorrection = GetMileagecorrectionFactor(JobInputData.Mileage);
vtpRunData.VTPData = new VTPData()
{
CorrectionFactor = mileageCorrection,
};
vtpRunData.DriverData = Driverdata;
yield return vtpRunData;
}
}
}
\ No newline at end of file
///* /*
//* This file is part of VECTO. * This file is part of VECTO.
//* *
//* Copyright © 2012-2019 European Union * Copyright © 2012-2019 European Union
//* *
//* Developed by Graz University of Technology, * Developed by Graz University of Technology,
//* Institute of Internal Combustion Engines and Thermodynamics, * Institute of Internal Combustion Engines and Thermodynamics,
//* Institute of Technical Informatics * Institute of Technical Informatics
//* *
//* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved * 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"); * by the European Commission - subsequent versions of the EUPL (the "Licence");
//* You may not use VECTO except in compliance with the Licence. * You may not use VECTO except in compliance with the Licence.
//* You may obtain a copy of the Licence at: * You may obtain a copy of the Licence at:
//* *
//* https://joinup.ec.europa.eu/community/eupl/og_page/eupl * https://joinup.ec.europa.eu/community/eupl/og_page/eupl
//* *
//* Unless required by applicable law or agreed to in writing, VECTO * Unless required by applicable law or agreed to in writing, VECTO
//* distributed under the Licence is distributed on an "AS IS" basis, * distributed under the Licence is distributed on an "AS IS" basis,
//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//* See the Licence for the specific language governing permissions and * See the Licence for the specific language governing permissions and
//* limitations under the Licence. * limitations under the Licence.
//* *
//* Authors: * Authors:
//* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology * Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology
//* Christian Kreiner, christian.kreiner@tugraz.at, ITI, 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 * Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology
//* Raphael Luz, luz@ivt.tugraz.at, IVT, 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 * Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology
//* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology
//*/ */
//using System; using System;
//using System.Collections.Generic; using System.Collections.Generic;
//using System.Linq; using System.Linq;
//using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Exceptions;
//using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.InputData;
//using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Models;
//using TUGraz.VectoCommon.Utils; using TUGraz.VectoCommon.Utils;
//using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.Configuration;
//using TUGraz.VectoCore.InputData.Reader.ComponentData; using TUGraz.VectoCore.InputData.Reader.ComponentData;
//using TUGraz.VectoCore.InputData.Reader.DataObjectAdapter; using TUGraz.VectoCore.InputData.Reader.DataObjectAdapter;
//using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Declaration;
//using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.Data;
//using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Models.SimulationComponent.Data;
//using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.OutputData;
//using DeclarationDataAdapterHeavyLorry = TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.HeavyLorry.DeclarationDataAdapterHeavyLorry; using DeclarationDataAdapterHeavyLorry = TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.HeavyLorry.DeclarationDataAdapterHeavyLorry;
//namespace TUGraz.VectoCore.InputData.Reader.Impl namespace TUGraz.VectoCore.InputData.Reader.Impl
//{ {
// internal class DeclarationVTPModeVectoRunDataFactoryLorries : AbstractVTPModeVectoRunDataFactory internal class DeclarationVTPModeVectoRunDataFactoryLorries : AbstractVTPModeVectoRunDataFactory
// { {
// private DeclarationDataAdapterHeavyLorry _dao; private ILorryDeclarationDataAdapter _dao;
// public DeclarationVTPModeVectoRunDataFactoryLorries(IVTPDeclarationInputDataProvider ivtpProvider, IVTPReport report) : base( public DeclarationVTPModeVectoRunDataFactoryLorries(IVTPDeclarationInputDataProvider ivtpProvider, IVTPReport report) : base(
// ivtpProvider.JobInputData, report) ivtpProvider.JobInputData, report)
// { } { }
// protected DeclarationVTPModeVectoRunDataFactoryLorries(IVTPDeclarationJobInputData job, IVTPReport report) : base(job, report) protected DeclarationVTPModeVectoRunDataFactoryLorries(IVTPDeclarationJobInputData job, IVTPReport report) : base(job, report)
// { } { }
// protected override IDeclarationDataAdapter Dao => _dao ?? (_dao = new DeclarationDataAdapterHeavyLorry()); protected override IDeclarationDataAdapter Dao => DataAdapter;
private ILorryDeclarationDataAdapter DataAdapter => _dao ?? (_dao = new DeclarationDataAdapterHeavyLorry.Conventional());
// protected override void Initialize() protected override void Initialize()
// { {
// var vehicle = JobInputData.Vehicle; var vehicle = JobInputData.Vehicle;
// try { try
// Segment = DeclarationData.TruckSegments.Lookup( {
// vehicle.VehicleCategory, Segment = DeclarationData.TruckSegments.Lookup(
// vehicle.AxleConfiguration, vehicle.VehicleCategory,
// vehicle.GrossVehicleMassRating, vehicle.AxleConfiguration,
// vehicle.CurbMassChassis, vehicle.GrossVehicleMassRating,
// vehicle.VocationalVehicle); vehicle.CurbMassChassis,
// } catch (VectoException) { vehicle.VocationalVehicle);
// _allowVocational = false; }
// Segment = DeclarationData.TruckSegments.Lookup( catch (VectoException)
// vehicle.VehicleCategory, {
// vehicle.AxleConfiguration, _allowVocational = false;
// vehicle.GrossVehicleMassRating, Segment = DeclarationData.TruckSegments.Lookup(
// vehicle.CurbMassChassis, vehicle.VehicleCategory,
// false); vehicle.AxleConfiguration,
// } vehicle.GrossVehicleMassRating,
// Driverdata = Dao.CreateDriverData(); vehicle.CurbMassChassis,
// Driverdata.AccelerationCurve = AccelerationCurveReader.ReadFromStream(Segment.AccelerationFile); false);
// var tempVehicle = Dao.CreateVehicleData( }
// vehicle, Segment, Segment.Missions.First(), Driverdata = DataAdapter.CreateDriverData();
// Segment.Missions.First().Loadings.First(), _allowVocational); Driverdata.AccelerationCurve = AccelerationCurveReader.ReadFromStream(Segment.AccelerationFile);
var tempVehicle = Dao.CreateVehicleData(
// var vtpMission = Segment.VehicleClass.IsMediumLorry() vehicle, Segment, Segment.Missions.First(),
// ? DeclarationData.VTPMode.SelectedMissionMediumLorry Segment.Missions.First().Loadings.First(), _allowVocational);
// : DeclarationData.VTPMode.SelectedMissionHeavyLorry;
var vtpMission = Segment.VehicleClass.IsMediumLorry()
// AirdragData = Dao.CreateAirdragData( ? DeclarationData.VTPMode.SelectedMissionMediumLorry
// vehicle.Components.AirdragInputData, : DeclarationData.VTPMode.SelectedMissionHeavyLorry;
// Segment.Missions.First(), Segment);
// EngineData = Dao.CreateEngineData( AirdragData = DataAdapter.CreateAirdragData(
// vehicle, vehicle.Components.EngineInputData.EngineModes.First(), vehicle.Components.AirdragInputData,
// new Mission() { MissionType = vtpMission }); Segment.Missions.First(), Segment);
// AxlegearData = JobInputData.Vehicle.Components.GearboxInputData.DifferentialIncluded EngineData = DataAdapter.CreateEngineData(
// ? Dao.CreateDummyAxleGearData(JobInputData.Vehicle.Components.GearboxInputData) vehicle, vehicle.Components.EngineInputData.EngineModes.First(),
// : Dao.CreateAxleGearData(vehicle.Components.AxleGearInputData); new Mission() { MissionType = vtpMission });
// AngledriveData = Dao.CreateAngledriveData(vehicle.Components.AngledriveInputData); AxlegearData = JobInputData.Vehicle.Components.GearboxInputData.DifferentialIncluded
? DataAdapter.CreateDummyAxleGearData(JobInputData.Vehicle.Components.GearboxInputData)
// GearboxData = Dao.CreateGearboxData( : DataAdapter.CreateAxleGearData(vehicle.Components.AxleGearInputData);
// vehicle, new VectoRunData() { EngineData = EngineData, AxleGearData = AxlegearData, VehicleData = tempVehicle }, AngledriveData = DataAdapter.CreateAngledriveData(vehicle.Components.AngledriveInputData);
// null);
// RetarderData = Dao.CreateRetarderData(vehicle.Components.RetarderInputData); GearboxData = DataAdapter.CreateGearboxData(
vehicle, new VectoRunData() { EngineData = EngineData, AxleGearData = AxlegearData, VehicleData = tempVehicle },
// PTOTransmissionData = null);
// Dao.CreatePTOTransmissionData(vehicle.Components.PTOTransmissionInputData); RetarderData = DataAdapter.CreateRetarderData(vehicle.Components.RetarderInputData);
// GearshiftData = Dao.CreateGearshiftData( PTOTransmissionData =
// GearboxData, AxlegearData.AxleGear.Ratio * (AngledriveData?.Angledrive.Ratio ?? 1.0), EngineData.IdleSpeed); DataAdapter.CreatePTOTransmissionData(vehicle.Components.PTOTransmissionInputData);
// AuxVTP = CreateVTPAuxData(vehicle); GearshiftData = DataAdapter.CreateGearshiftData(
// } GearboxData, AxlegearData.AxleGear.Ratio * (AngledriveData?.Angledrive.Ratio ?? 1.0), EngineData.IdleSpeed);
// protected override IEnumerable<VectoRunData.AuxData> GetAuxiliaryData(MissionType missionType) AuxVTP = CreateVTPAuxData(vehicle);
// { }
// return Dao.CreateAuxiliaryData(
// JobInputData.Vehicle.Components.AuxiliaryInputData, protected override IEnumerable<VectoRunData.AuxData> GetAuxiliaryData(MissionType missionType)
// JobInputData.Vehicle.Components.BusAuxiliaries, {
// missionType, return DataAdapter.CreateAuxiliaryData(
// Segment.VehicleClass, JobInputData.Vehicle.Length, JobInputData.Vehicle.Components.AuxiliaryInputData,
// JobInputData.Vehicle.Components.AxleWheels.NumSteeredAxles); JobInputData.Vehicle.Components.BusAuxiliaries,
// } missionType,
Segment.VehicleClass, JobInputData.Vehicle.Length,
// protected virtual List<VectoRunData.AuxData> CreateVTPAuxData(IVehicleDeclarationInputData vehicle) JobInputData.Vehicle.Components.AxleWheels.NumSteeredAxles);
// { }
// var numSteered = vehicle.Components.AxleWheels.NumSteeredAxles;
// var auxRD = Dao.CreateAuxiliaryData( protected virtual List<VectoRunData.AuxData> CreateVTPAuxData(IVehicleDeclarationInputData vehicle)
// vehicle.Components.AuxiliaryInputData, vehicle.Components.BusAuxiliaries, MissionType.RegionalDelivery, Segment.VehicleClass, vehicle.Length, numSteered) {
// .ToList(); var numSteered = vehicle.Components.AxleWheels.NumSteeredAxles;
// foreach (var entry in auxRD) { var auxRD = DataAdapter.CreateAuxiliaryData(
// entry.MissionType = MissionType.RegionalDelivery; vehicle.Components.AuxiliaryInputData, vehicle.Components.BusAuxiliaries, MissionType.RegionalDelivery, Segment.VehicleClass, vehicle.Length, numSteered)
// } .ToList();
foreach (var entry in auxRD)
// var auxLH = Dao.CreateAuxiliaryData( {
// vehicle.Components.AuxiliaryInputData, vehicle.Components.BusAuxiliaries, MissionType.LongHaul, Segment.VehicleClass, vehicle.Length, numSteered) entry.MissionType = MissionType.RegionalDelivery;
// .ToList(); }
// foreach (var entry in auxLH) {
// entry.MissionType = MissionType.LongHaul; var auxLH = DataAdapter.CreateAuxiliaryData(
// } vehicle.Components.AuxiliaryInputData, vehicle.Components.BusAuxiliaries, MissionType.LongHaul, Segment.VehicleClass, vehicle.Length, numSteered)
.ToList();
// var auxUD = Dao.CreateAuxiliaryData( foreach (var entry in auxLH)
// vehicle.Components.AuxiliaryInputData, vehicle.Components.BusAuxiliaries, MissionType.UrbanDelivery, Segment.VehicleClass, vehicle.Length, numSteered) {
// .ToList(); entry.MissionType = MissionType.LongHaul;
// foreach (var entry in auxUD) { }
// entry.MissionType = MissionType.UrbanDelivery;
// } var auxUD = DataAdapter.CreateAuxiliaryData(
vehicle.Components.AuxiliaryInputData, vehicle.Components.BusAuxiliaries, MissionType.UrbanDelivery, Segment.VehicleClass, vehicle.Length, numSteered)
// var aux = new List<VectoRunData.AuxData>(); .ToList();
// aux.AddRange(auxRD); foreach (var entry in auxUD)
// aux.AddRange(auxLH); {
// aux.AddRange(auxUD); entry.MissionType = MissionType.UrbanDelivery;
}
// aux.RemoveAll(x => x.ID == Constants.Auxiliaries.IDs.Fan);
// aux.Add( var aux = new List<VectoRunData.AuxData>();
// new VectoRunData.AuxData { aux.AddRange(auxRD);
// DemandType = AuxiliaryDemandType.Direct, aux.AddRange(auxLH);
// ID = DrivingCycleDataReader.Fields.AdditionalAuxPowerDemand aux.AddRange(auxUD);
// });
// return aux; aux.RemoveAll(x => x.ID == Constants.Auxiliaries.IDs.Fan);
// } aux.Add(
new VectoRunData.AuxData
// public override IEnumerable<VectoRunData> NextRun() {
// { DemandType = AuxiliaryDemandType.Direct,
// if (InitException != null) { ID = DrivingCycleDataReader.Fields.AdditionalAuxPowerDemand
// throw InitException; });
// } return aux;
}
// // simulate the Measured cycle
// var vtpCycle = JobInputData.Cycles.FirstOrDefault(); public override IEnumerable<VectoRunData> NextRun()
// if (vtpCycle == null) { {
// throw new VectoException("no VTP-Cycle provided!"); if (InitException != null)
// } {
throw InitException;
// var drivingCycle = DrivingCycleDataReader.ReadFromDataTable(vtpCycle.CycleData, vtpCycle.Name, false); }
// // Loading is not relevant as we use P_wheel // simulate the Measured cycle
// var vtpRunData = CreateVectoRunData(Segment, Segment.Missions.First(), Tuple.Create<Kilogram, double?>(0.SI<Kilogram>(), null)); var vtpCycle = JobInputData.Cycles.FirstOrDefault();
// vtpRunData.Cycle = new DrivingCycleProxy(drivingCycle, vtpCycle.Name); if (vtpCycle == null)
// vtpRunData.Aux = AuxVTP; {
// vtpRunData.FanDataVTP = GetFanData(); throw new VectoException("no VTP-Cycle provided!");
// vtpRunData.ExecutionMode = ExecutionMode.Declaration; }
// vtpRunData.SimulationType = SimulationType.VerificationTest;
// vtpRunData.Mission = new Mission() { var drivingCycle = DrivingCycleDataReader.ReadFromDataTable(vtpCycle.CycleData, vtpCycle.Name, false);
// MissionType = MissionType.VerificationTest
// }; // Loading is not relevant as we use P_wheel
// vtpRunData.VehicleData.VehicleClass = Segment.VehicleClass; var vtpRunData = CreateVectoRunData(Segment, Segment.Missions.First(), Tuple.Create<Kilogram, double?>(0.SI<Kilogram>(), null));
// vtpRunData.VehicleData.LegislativeClass = JobInputData.Vehicle.LegislativeClass; vtpRunData.Cycle = new DrivingCycleProxy(drivingCycle, vtpCycle.Name);
// vtpRunData.DriverData = Driverdata; vtpRunData.Aux = AuxVTP;
vtpRunData.FanDataVTP = GetFanData();
// //var ncvStd = DeclarationData.FuelData.Lookup(JobInputData.Vehicle.Components.EngineInputData.FuelType).LowerHeatingValueVecto; vtpRunData.ExecutionMode = ExecutionMode.Declaration;
// //var ncvCorrection = ncvStd / JobInputData.NetCalorificValueTestFuel; vtpRunData.SimulationType = SimulationType.VerificationTest;
// var mileageCorrection = GetMileagecorrectionFactor(JobInputData.Mileage); vtpRunData.Mission = new Mission()
// vtpRunData.VTPData = new VTPData() { {
// CorrectionFactor = mileageCorrection, MissionType = MissionType.VerificationTest
// }; };
// yield return vtpRunData; vtpRunData.VehicleData.VehicleClass = Segment.VehicleClass;
// } vtpRunData.VehicleData.LegislativeClass = JobInputData.Vehicle.LegislativeClass;
// } vtpRunData.DriverData = Driverdata;
//}
//var ncvStd = DeclarationData.FuelData.Lookup(JobInputData.Vehicle.Components.EngineInputData.FuelType).LowerHeatingValueVecto;
//var ncvCorrection = ncvStd / JobInputData.NetCalorificValueTestFuel;
var mileageCorrection = GetMileagecorrectionFactor(JobInputData.Mileage);
vtpRunData.VTPData = new VTPData()
{
CorrectionFactor = mileageCorrection,
};
yield return vtpRunData;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment