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

Skip to content
Snippets Groups Projects
Commit 27fbe69e authored by Harald MARTINI's avatar Harald MARTINI
Browse files

create mockup model data in DeclarationModeMockupTruckVectoRunDataFactory

parent fa87e45e
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,9 @@ using System.Text;
using System.Threading.Tasks;
using TUGraz.VectoCommon.Exceptions;
using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.InputData.Reader.ComponentData;
using TUGraz.VectoCore.InputData.Reader.DataObjectAdapter;
using TUGraz.VectoCore.Models.Declaration;
using TUGraz.VectoCore.Models.Simulation.Data;
......@@ -28,18 +30,40 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl.MockupRunDataFactories
protected override IDeclarationDataAdapter DataAdapter { get; }
protected override IEnumerable<VectoRunData> GetNextRun()
{
throw new NotImplementedException();
var nextRun = base.GetNextRun();
return nextRun;
}
protected override VectoRunData CreateVectoRunData(IVehicleDeclarationInputData vehicle, int modeIdx, Mission mission,
KeyValuePair<LoadingType, Tuple<Kilogram, double?>> loading)
{
if (InputDataProvider.JobInputData.Vehicle.ExemptedVehicle)
{
return new VectoRunData
{
Exempted = true,
Report = Report,
Mission = new Mission() { MissionType = MissionType.ExemptedMission },
VehicleData = CreateMockupVehicleData(vehicle),
InputDataHash = InputDataProvider.XMLHash
};
}
var cycle = DeclarationData.CyclesCache.GetOrAdd(mission.MissionType, _ => DrivingCycleDataReader.ReadFromStream(mission.CycleFile, CycleType.DistanceBased, "", false));
return new VectoRunData() {
VehicleData = new VehicleData() {
InputData = vehicle,
},
Loading = loading.Key,
Cycle = new DrivingCycleProxy(cycle, mission.MissionType.ToString()),
ExecutionMode = ExecutionMode.Declaration,
Report = Report,
Mission = mission,
SimulationType = SimulationType.DistanceCycle,
VehicleData = CreateMockupVehicleData(vehicle),
EngineData = CreateMockupEngineData(vehicle, modeIdx),
};
}
......@@ -52,5 +76,34 @@ namespace TUGraz.VectoCore.InputData.Reader.Impl.MockupRunDataFactories
}
#endregion
private CombustionEngineData CreateMockupEngineData(IVehicleDeclarationInputData vehicleData, int modeIdx)
{
var engine = InputDataProvider.JobInputData.Vehicle.Components.EngineInputData;
var engineModes = engine.EngineModes;
var engineMode = engineModes[modeIdx];
var fuels = new List<CombustionEngineFuelData>();
foreach (var fuel in engineMode.Fuels) {
fuels.Add(new CombustionEngineFuelData() {
FuelData = DeclarationData.FuelData.Lookup(fuel.FuelType, vehicleData.TankSystem)
});
}
return new CombustionEngineData() {
Fuels = fuels,
};
}
private VehicleData CreateMockupVehicleData(IVehicleDeclarationInputData vehicleData)
{
return new VehicleData() {
InputData = vehicleData,
SleeperCab = vehicleData?.SleeperCab
};
}
}
}
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