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
Commit ca098a80 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

use generic values for fan parameters in declaration mode

parent d0aa4a9e
No related branches found
No related tags found
No related merge requests found
......@@ -49,18 +49,18 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl
internal class DeclarationVTPModeVectoRunDataFactory : IVectoRunDataFactory
{
protected IVTPDeclarationJobInputData JobInputData;
private DriverData _driverdata;
private AirdragData _airdragData;
private CombustionEngineData _engineData;
private AxleGearData _axlegearData;
private AngledriveData _angledriveData;
private GearboxData _gearboxData;
private RetarderData _retarderData;
private PTOData _ptoTransmissionData;
protected List<VectoRunData.AuxData> _auxVTP;
protected Segment _segment;
private DeclarationDataAdapter _dao;
protected Exception _initException;
protected DriverData Driverdata;
protected AirdragData AirdragData;
protected CombustionEngineData EngineData;
protected AxleGearData AxlegearData;
protected AngledriveData AngledriveData;
protected GearboxData GearboxData;
protected RetarderData RetarderData;
protected PTOData PTOTransmissionData;
protected List<VectoRunData.AuxData> AuxVTP;
protected Segment Segment;
protected DeclarationDataAdapter Dao;
protected Exception InitException;
public IVTPReport Report;
......@@ -77,7 +77,7 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl
InitializeReport();
}
} catch (Exception e) {
_initException = e;
InitException = e;
}
}
......@@ -85,21 +85,21 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl
{
var powertrainConfig = new VectoRunData() {
VehicleData =
_dao.CreateVehicleData(
JobInputData.Vehicle, _segment.Missions.First(),
_segment.Missions.First().Loadings.First().Value),
AirdragData = _airdragData,
EngineData = _engineData,
GearboxData = _gearboxData,
AxleGearData = _axlegearData,
Retarder = _retarderData,
Dao.CreateVehicleData(
JobInputData.Vehicle, Segment.Missions.First(),
Segment.Missions.First().Loadings.First().Value),
AirdragData = AirdragData,
EngineData = EngineData,
GearboxData = GearboxData,
AxleGearData = AxlegearData,
Retarder = RetarderData,
Aux =
_dao.CreateAuxiliaryData(
Dao.CreateAuxiliaryData(
JobInputData.Vehicle.AuxiliaryInputData(),
_segment.Missions.First().MissionType,
_segment.VehicleClass),
Segment.Missions.First().MissionType,
Segment.VehicleClass),
};
powertrainConfig.VehicleData.VehicleClass = _segment.VehicleClass;
powertrainConfig.VehicleData.VehicleClass = Segment.VehicleClass;
Report.InputDataHash = JobInputData.VectoJobHash;
Report.ManufacturerRecord = JobInputData.ManufacturerReportInputData;
Report.ManufacturerRecordHash = JobInputData.VectoManufacturerReportHash;
......@@ -109,61 +109,61 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl
protected void Initialize()
{
_dao = new DeclarationDataAdapter();
Dao = new DeclarationDataAdapter();
var vehicle = JobInputData.Vehicle;
_segment = DeclarationData.Segments.Lookup(
Segment = DeclarationData.Segments.Lookup(
vehicle.VehicleCategory,
vehicle.AxleConfiguration,
vehicle.GrossVehicleMassRating,
vehicle.CurbMassChassis,
vehicle.VocationalVehicle);
_driverdata = _dao.CreateDriverData();
_driverdata.AccelerationCurve = AccelerationCurveReader.ReadFromStream(_segment.AccelerationFile);
var tempVehicle = _dao.CreateVehicleData(
vehicle, _segment.Missions.First(),
_segment.Missions.First().Loadings.First().Value);
_airdragData = _dao.CreateAirdragData(
Driverdata = Dao.CreateDriverData();
Driverdata.AccelerationCurve = AccelerationCurveReader.ReadFromStream(Segment.AccelerationFile);
var tempVehicle = Dao.CreateVehicleData(
vehicle, Segment.Missions.First(),
Segment.Missions.First().Loadings.First().Value);
AirdragData = Dao.CreateAirdragData(
vehicle.AirdragInputData,
_segment.Missions.First(), _segment);
_engineData = _dao.CreateEngineData(
Segment.Missions.First(), Segment);
EngineData = Dao.CreateEngineData(
vehicle.EngineInputData,
vehicle.EngineIdleSpeed,
vehicle.GearboxInputData, vehicle.TorqueLimits, vehicle.TankSystem);
_axlegearData = _dao.CreateAxleGearData(vehicle.AxleGearInputData);
_angledriveData = _dao.CreateAngledriveData(vehicle.AngledriveInputData);
_gearboxData = _dao.CreateGearboxData(
vehicle.GearboxInputData, _engineData,
_axlegearData.AxleGear.Ratio,
AxlegearData = Dao.CreateAxleGearData(vehicle.AxleGearInputData);
AngledriveData = Dao.CreateAngledriveData(vehicle.AngledriveInputData);
GearboxData = Dao.CreateGearboxData(
vehicle.GearboxInputData, EngineData,
AxlegearData.AxleGear.Ratio,
tempVehicle.DynamicTyreRadius, tempVehicle.VehicleCategory);
_retarderData = _dao.CreateRetarderData(vehicle.RetarderInputData);
RetarderData = Dao.CreateRetarderData(vehicle.RetarderInputData);
_ptoTransmissionData =
_dao.CreatePTOTransmissionData(vehicle.PTOTransmissionInputData);
PTOTransmissionData =
Dao.CreatePTOTransmissionData(vehicle.PTOTransmissionInputData);
_auxVTP = CreateVTPAuxData(_dao, vehicle, _segment);
AuxVTP = CreateVTPAuxData(vehicle);
}
#region Implementation of IVectoRunDataFactory
public virtual IEnumerable<VectoRunData> NextRun()
{
if (_initException != null) {
throw _initException;
if (InitException != null) {
throw InitException;
}
// simulate the LongHaul cycle with RefLoad
var mission = _segment.Missions.FirstOrDefault(m => m.MissionType == DeclarationData.VTPMode.SelectedMission);
var mission = Segment.Missions.FirstOrDefault(m => m.MissionType == DeclarationData.VTPMode.SelectedMission);
if (mission == null) {
throw new VectoException("Mission {0} not found in segmentation matrix", DeclarationData.VTPMode.SelectedMission);
}
var loading = mission.Loadings.FirstOrDefault(l => l.Key == DeclarationData.VTPMode.SelectedLoading);
var runData = CreateVectoRunData(_segment, mission, loading.Value);
var runData = CreateVectoRunData(Segment, mission, loading.Value);
runData.ModFileSuffix = loading.Key.ToString();
var cycle = DrivingCycleDataReader.ReadFromStream(mission.CycleFile, CycleType.DistanceBased, "", false);
runData.Cycle = new DrivingCycleProxy(cycle, mission.MissionType.ToString());
runData.DriverData = _driverdata;
runData.Aux = _dao.CreateAuxiliaryData(
JobInputData.Vehicle.AuxiliaryInputData(), mission.MissionType, _segment.VehicleClass);
runData.DriverData = Driverdata;
runData.Aux = Dao.CreateAuxiliaryData(
JobInputData.Vehicle.AuxiliaryInputData(), mission.MissionType, Segment.VehicleClass);
runData.ExecutionMode = ExecutionMode.Declaration;
runData.SimulationType = SimulationType.DistanceCycle;
runData.Mission = mission;
......@@ -179,29 +179,33 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl
var drivingCycle = DrivingCycleDataReader.ReadFromDataTable(vtpCycle.CycleData, vtpCycle.Name, false);
// Loading is not relevant as we use P_wheel
var vtpRunData = CreateVectoRunData(_segment, _segment.Missions.First(), 0.SI<Kilogram>());
var vtpRunData = CreateVectoRunData(Segment, Segment.Missions.First(), 0.SI<Kilogram>());
vtpRunData.Cycle = new DrivingCycleProxy(drivingCycle, vtpCycle.Name);
vtpRunData.Aux = _auxVTP;
vtpRunData.FanData = new AuxFanData() {
FanCoefficients = JobInputData.FanPowerCoefficents.ToArray(),
FanDiameter = JobInputData.FanDiameter,
};
vtpRunData.Aux = AuxVTP;
vtpRunData.FanData = GetFanData();
vtpRunData.ExecutionMode = ExecutionMode.Declaration;
vtpRunData.SimulationType = SimulationType.VerificationTest;
vtpRunData.Mission = new Mission() {
MissionType = MissionType.VerificationTest
};
var ncvStd = DeclarationData.FuelData.Lookup(JobInputData.Vehicle.EngineInputData.FuelType).LowerHeatingValueVecto;
var ncvCorrection = ncvStd / JobInputData.NetCalorificValueTestFuel;
//var ncvCorrection = ncvStd / JobInputData.NetCalorificValueTestFuel;
var mileageCorrection = GetMileagecorrectionFactor(JobInputData.Mileage);
vtpRunData.VTPData = new VTPData() {
CorrectionFactor = ncvCorrection * mileageCorrection,
FuelNetCalorificValue = JobInputData.NetCalorificValueTestFuel //0.SI<JoulePerKilogramm>()
CorrectionFactor = mileageCorrection,
};
yield return vtpRunData;
}
protected virtual AuxFanData GetFanData()
{
return new AuxFanData() {
FanCoefficients = DeclarationData.VTPMode.FanParameters,
FanDiameter = JobInputData.FanDiameter,
};
}
private double GetMileagecorrectionFactor(Meter mileage)
{
if (mileage > DeclarationData.VTPMode.RunInThreshold) {
......@@ -216,41 +220,40 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl
{
return new VectoRunData {
JobName = JobInputData.Vehicle.VIN,
EngineData = _engineData,
GearboxData = _gearboxData,
AxleGearData = _axlegearData,
AngledriveData = _angledriveData,
VehicleData = _dao.CreateVehicleData(
EngineData = EngineData,
GearboxData = GearboxData,
AxleGearData = AxlegearData,
AngledriveData = AngledriveData,
VehicleData = Dao.CreateVehicleData(
JobInputData.Vehicle, mission,
loading),
AirdragData = _airdragData,
AirdragData = AirdragData,
DriverData = null,
AdvancedAux = null,
Retarder = _retarderData,
PTO = _ptoTransmissionData,
Retarder = RetarderData,
PTO = PTOTransmissionData,
Report = Report,
};
}
protected virtual List<VectoRunData.AuxData> CreateVTPAuxData(
DeclarationDataAdapter dao, IVehicleDeclarationInputData vehicle, Segment segment)
protected virtual List<VectoRunData.AuxData> CreateVTPAuxData(IVehicleDeclarationInputData vehicle)
{
var auxRD = dao.CreateAuxiliaryData(
vehicle.AuxiliaryInputData(), MissionType.RegionalDelivery, segment.VehicleClass)
var auxRD = Dao.CreateAuxiliaryData(
vehicle.AuxiliaryInputData(), MissionType.RegionalDelivery, Segment.VehicleClass)
.ToList();
foreach (var entry in auxRD) {
entry.MissionType = MissionType.RegionalDelivery;
}
var auxLH = dao.CreateAuxiliaryData(
vehicle.AuxiliaryInputData(), MissionType.LongHaul, segment.VehicleClass)
var auxLH = Dao.CreateAuxiliaryData(
vehicle.AuxiliaryInputData(), MissionType.LongHaul, Segment.VehicleClass)
.ToList();
foreach (var entry in auxLH) {
entry.MissionType = MissionType.LongHaul;
}
var auxUD = dao.CreateAuxiliaryData(
vehicle.AuxiliaryInputData(), MissionType.UrbanDelivery, segment.VehicleClass)
var auxUD = Dao.CreateAuxiliaryData(
vehicle.AuxiliaryInputData(), MissionType.UrbanDelivery, Segment.VehicleClass)
.ToList();
foreach (var entry in auxUD) {
entry.MissionType = MissionType.UrbanDelivery;
......
......@@ -46,6 +46,8 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl
internal class EngineeringVTPModeVectoRunDataFactory : DeclarationVTPModeVectoRunDataFactory
{
private EngineeringDataAdapter _engineeringDao = new EngineeringDataAdapter();
public EngineeringVTPModeVectoRunDataFactory(IVTPEngineeringInputDataProvider ivtpProvider) : base(ivtpProvider.JobInputData, null)
{
......@@ -53,24 +55,29 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl
public override IEnumerable<VectoRunData> NextRun()
{
if (_initException != null) {
throw _initException;
if (InitException != null) {
throw InitException;
}
return JobInputData.Cycles.Select(
cycle => {
var drivingCycle = DrivingCycleDataReader.ReadFromDataTable(cycle.CycleData, cycle.Name, false);
// loading is not relevant as we use P_wheel
var runData = CreateVectoRunData(_segment, _segment.Missions.First(), 0.SI<Kilogram>());
var runData = CreateVectoRunData(Segment, Segment.Missions.First(), 0.SI<Kilogram>());
runData.Cycle = new DrivingCycleProxy(drivingCycle, cycle.Name);
runData.Aux = _auxVTP;
runData.FanData = new AuxFanData() {
FanCoefficients = JobInputData.FanPowerCoefficents.ToArray(),
FanDiameter = JobInputData.FanDiameter,
};
runData.Aux = AuxVTP;
runData.FanData = GetFanData();
runData.ExecutionMode = ExecutionMode.Engineering;
runData.SimulationType = SimulationType.VerificationTest;
return runData;
});
}
protected override AuxFanData GetFanData()
{
return new AuxFanData() {
FanCoefficients = JobInputData.FanPowerCoefficents.ToArray(),
FanDiameter = JobInputData.FanDiameter,
};
}
}
}
......@@ -532,6 +532,7 @@ namespace TUGraz.VectoCore.Models.Declaration
public static readonly SpecificFuelConsumption LowerFCThreshold = 180.SI(Unit.SI.Gramm.Per.Kilo.Watt.Hour).Cast<SpecificFuelConsumption>();
public static readonly SpecificFuelConsumption UpperFCThreshold = 600.SI(Unit.SI.Gramm.Per.Kilo.Watt.Hour).Cast<SpecificFuelConsumption>();
public static readonly Second FCAccumulationWindow = 10.SI(Unit.SI.Minute).Cast<Second>();
public static readonly double[] FanParameters = { 7.320, 1200.0 , 810 };
}
public static class Vehicle {
......
......@@ -247,8 +247,6 @@ namespace TUGraz.VectoCore.Models.Simulation.Data
public class VTPData
{
public double CorrectionFactor;
public JoulePerKilogramm FuelNetCalorificValue;
}
public class AuxFanData
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment