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

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

created singlebus vehicle adapter

parent e9c83913
No related branches found
No related tags found
No related merge requests found
......@@ -14,8 +14,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
public interface IDeclarationDataAdapter
{
//DriverData CreateDriverData();
VehicleData CreateVehicleData(IVehicleDeclarationInputData vehicle, Segment segment, Mission mission, KeyValuePair<LoadingType, Tuple<Kilogram, double?>> loading, bool allowVocational);
//AirdragData CreateAirdragData(IAirdragDeclarationInputData airdragData, Mission mission, Segment segment);
//AirdragData CreateAirdragData(IAirdragDeclarationInputData airdragData, Mission mission, Segment segment);
//AxleGearData CreateAxleGearData(IAxleGearInputData axlegearData);
//AngledriveData CreateAngledriveData(IAngledriveInputData angledriveData);
//CombustionEngineData CreateEngineData(IVehicleDeclarationInputData vehicle, IEngineModeDeclarationInputData engineMode, Mission mission);
......@@ -27,7 +26,8 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
//PTOData CreatePTOTransmissionData(IPTOTransmissionInputData ptoData);
//IList<VectoRunData.AuxData> CreateAuxiliaryData(IAuxiliariesDeclarationInputData auxData, IBusAuxiliariesDeclarationData busAuxData, MissionType missionType, VehicleClass vehicleClass, Meter vehicleLength, int? numSteeredAxles);
//AxleGearData CreateDummyAxleGearData(IGearboxDeclarationInputData gbxData);
}
VehicleData CreateVehicleData(IVehicleDeclarationInputData vehicle, Segment segment, Mission first, KeyValuePair<LoadingType, Tuple<Kilogram, double?>> keyValuePair, bool allowVocational);
}
public interface ILorryDeclarationDataAdapter : IDeclarationDataAdapter
{
......@@ -60,6 +60,8 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
IList<VectoRunData.AuxData> CreateAuxiliaryData(IAuxiliariesDeclarationInputData auxData,
IBusAuxiliariesDeclarationData busAuxData, MissionType missionType, VehicleClass vehicleClass,
Meter vehicleLength, int? numSteeredAxles);
VehicleData CreateVehicleData(IVehicleDeclarationInputData vehicle, Segment segment, Mission mission, KeyValuePair<LoadingType, Tuple<Kilogram, double?>> loading, bool allowVocational);
}
public interface IPrimaryBusDeclarationDataAdapter : IDeclarationDataAdapter
......@@ -93,6 +95,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
Meter vehicleLength, int? numSteeredAxles);
AirdragData CreateAirdragData(IAirdragDeclarationInputData airdragData, Mission mission, Segment segment);
VehicleData CreateVehicleData(IVehicleDeclarationInputData vehicle, Segment segment, Mission mission, KeyValuePair<LoadingType, Tuple<Kilogram, double?>> loading, bool allowVocational);
}
public interface IGenericCompletedBusDeclarationDataAdapter : IDeclarationDataAdapter
......@@ -125,6 +128,8 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
IAuxiliaryConfig CreateBusAuxiliariesData(
Mission mission, IVehicleDeclarationInputData vehicleData, VectoRunData runData);
VehicleData CreateVehicleData(IVehicleDeclarationInputData vehicle, Segment segment, Mission mission, KeyValuePair<LoadingType, Tuple<Kilogram, double?>> loading, bool allowVocational);
}
public interface ISpecificCompletedBusDeclarationDataAdapter
......@@ -146,7 +151,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
Mission mission);
}
public interface ISingleBusDeclarationDataAdapter : IDeclarationDataAdapter
public interface ISingleBusDeclarationDataAdapter
{
AirdragData CreateAirdragData(IVehicleDeclarationInputData completedVehicle, Mission mission);
CombustionEngineData CreateEngineData(IVehicleDeclarationInputData vehicle,
......@@ -163,5 +168,8 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
ShiftStrategyParameters CreateGearshiftData(GearboxData gbx, double axleRatio, PerSecond engineIdlingSpeed);
IEnumerable<VectoRunData.AuxData> CreateAuxiliaryData(IAuxiliariesDeclarationInputData auxInputData, IBusAuxiliariesDeclarationData busAuxInput, MissionType mission, VehicleClass segment, Meter vehicleLength, int? numSteeredAxles);
IAuxiliaryConfig CreateBusAuxiliariesData(Mission mission, IVehicleDeclarationInputData primaryVehicle, IVehicleDeclarationInputData completedVehicle, VectoRunData simulationRunData);
VehicleData CreateVehicleData(ISingleBusInputDataProvider vehicle, Segment segment, Mission mission,
KeyValuePair<LoadingType, Tuple<Kilogram, double?>> loading, bool allowVocational);
}
}
\ No newline at end of file
......@@ -36,8 +36,8 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponen
}
return null;
}
protected readonly IADASDataAdapter _adasDataAdapter = new ADASDataAdapter();
}
internal static IADASDataAdapter _adasDataAdapter = new ADASDataAdapter();
internal static VehicleData SetCommonVehicleData(IVehicleDeclarationInputData data)
{
var retVal = new VehicleData
......@@ -95,12 +95,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponen
protected abstract VehicleData DoCreateExemptedVehicleData(IVehicleDeclarationInputData data);
#endregion
}
internal class LorryVehicleDataAdapter : VehicleDataAdapter
{
protected override VehicleData DoCreateVehicleData(IVehicleDeclarationInputData data,
protected static VehicleData GetVehicleData(IVehicleDeclarationInputData data,
Segment segment, Mission mission, Kilogram loading, double? passengerCount, bool allowVocational)
{
var retVal = SetCommonVehicleData(data);
......@@ -188,6 +183,16 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponen
retVal.AxleData = axleData;
return retVal;
}
#endregion
}
internal class LorryVehicleDataAdapter : VehicleDataAdapter
{
protected override VehicleData DoCreateVehicleData(IVehicleDeclarationInputData data,
Segment segment, Mission mission, Kilogram loading, double? passengerCount, bool allowVocational)
{
return GetVehicleData(data, segment, mission, loading, passengerCount, allowVocational);
}
protected override VehicleData DoCreateExemptedVehicleData(IVehicleDeclarationInputData data)
{
......@@ -204,7 +209,6 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponen
}
}
internal class PrimaryBusVehicleDataAdapter : LorryVehicleDataAdapter
{
#region Overrides of VehicleDataAdapter
......@@ -284,4 +288,55 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponen
#endregion
}
internal class SingleBusVehicleDataAdapter : VehicleDataAdapter
{
#region Overrides of VehicleDataAdapter
public VehicleData CreateVehicleData(ISingleBusInputDataProvider data, Segment segment, Mission mission, KeyValuePair<LoadingType, Tuple<Kilogram, double?>> loading, bool allowVocational)
{
var completedVehicle = data.CompletedVehicle;
var vehicle = data.JobInputData.Vehicle;
var busFloorArea = DeclarationData.BusAuxiliaries.CalculateBusFloorSurfaceArea(
completedVehicle.Length,
completedVehicle.Width);
var passengerCountRef = busFloorArea * (loading.Key == LoadingType.LowLoading
? mission.BusParameter.PassengerDensityLow
: mission.BusParameter.PassengerDensityRef);
var passengerCountDecl = completedVehicle.NumberPassengerSeatsUpperDeck +
completedVehicle.NumberPassengerSeatsLowerDeck
+ (mission.MissionType == MissionType.Coach
? 0
: completedVehicle.NumberPassengersStandingLowerDeck +
completedVehicle.NumberPassengersStandingUpperDeck);
//var refLoad = passengerCount * mission.MissionType.GetAveragePassengerMass();
if (loading.Key != LoadingType.ReferenceLoad && loading.Key != LoadingType.LowLoading)
{
throw new VectoException("Unhandled loading type: {0}", loading.Key);
}
var passengerCountCalc = loading.Key == LoadingType.ReferenceLoad
? VectoMath.Min(passengerCountRef, (int)passengerCountDecl)
: passengerCountRef * mission.MissionType.GetLowLoadFactorBus();
var payload = passengerCountCalc * mission.MissionType.GetAveragePassengerMass();
var retVal = DoCreateVehicleData(vehicle, segment, mission, payload, passengerCountCalc, allowVocational);
retVal.CurbMass = completedVehicle.CurbMassChassis;
return retVal;
}
protected override VehicleData DoCreateVehicleData(IVehicleDeclarationInputData data, Segment segment, Mission mission, Kilogram loading,
double? passengerCount, bool allowVocational)
{
return VehicleDataAdapter.GetVehicleData(data, segment, mission, loading, passengerCount, allowVocational);
}
protected override VehicleData DoCreateExemptedVehicleData(IVehicleDeclarationInputData data)
{
throw new NotImplementedException();
}
#endregion
}
}
......@@ -30,7 +30,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SingleBus
private ICompletedBusAuxiliaryDataAdapter _busAuxiliaryDataAdapter =
new SpecificCompletedBusAuxiliaryDataAdapter(new PrimaryBusAuxiliaryDataAdapter());
private IVehicleDataAdapter _vehicleDataAdapter = new PrimaryBusVehicleDataAdapter();
private SingleBusVehicleDataAdapter _vehicleDataAdapter = new SingleBusVehicleDataAdapter();
private IAxleGearDataAdapter _axleGearDataAdapter = new AxleGearDataAdapter();
private IDriverDataAdapter _driverDataAdapter = new PrimaryBusDriverDataAdapter();
private IAngledriveDataAdapter _angledriveDataAdapter = new AngledriveDataAdapter();
......@@ -39,11 +39,11 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SingleBus
#region Implementation of IDeclarationDataAdapter
public VehicleData CreateVehicleData(IVehicleDeclarationInputData vehicle, Segment segment, Mission mission,
public VehicleData CreateVehicleData(ISingleBusInputDataProvider vehicle, Segment segment, Mission mission,
KeyValuePair<LoadingType, Tuple<Kilogram, double?>> loading, bool allowVocational)
{
return _vehicleDataAdapter.CreateVehicleData(vehicle, segment, mission, loading.Value.Item1,
loading.Value.Item2, allowVocational);
return _vehicleDataAdapter.CreateVehicleData(vehicle, segment, mission, loading
, allowVocational);
}
......
......@@ -108,7 +108,7 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl.DeclarationMode.SingleBus
_segment = GetSegment(DataProvider);
_driverdata = DataAdapter.CreateDriverData(); //PrimaryBus
_driverdata.AccelerationCurve = AccelerationCurveReader.ReadFromStream(_segment.AccelerationFile);
var tempVehicle = DataAdapter.CreateVehicleData(vehicle, _segment, _segment.Missions.First(),
var tempVehicle = DataAdapter.CreateVehicleData(DataProvider, _segment, _segment.Missions.First(),
_segment.Missions.First().Loadings.First(), _allowVocational);
if (vehicle.AxleConfiguration.AxlegearIncludedInGearbox())
{
......@@ -161,7 +161,7 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl.DeclarationMode.SingleBus
{
InputData = DataProvider,
Loading = loading.Key,
VehicleData = DataAdapter.CreateVehicleData(vehicle, _segment, mission, loading, _allowVocational), //Primary
VehicleData = DataAdapter.CreateVehicleData(singleBus, _segment, mission, loading, _allowVocational), //Primary
AirdragData = DataAdapter.CreateAirdragData(completedVehicle, mission), //Single
EngineData = DataAdapter.CreateEngineData(vehicle, engineMode, mission), //Primary
ElectricMachinesData = new List<Tuple<PowertrainPosition, ElectricMotorData>>(),
......
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