Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 70958872 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

only calculate fuel factor (completed bus) if there are fuels in the primary...

only calculate fuel factor (completed bus) if there are fuels in the primary bus - i.e. don't calculate for PEV
parent 5b661e44
No related branches found
No related tags found
No related merge requests found
......@@ -196,21 +196,26 @@ namespace TUGraz.VectoCore.OutputData.XML
DeclarationData.FuelData.Lookup(x, specific.VectoRunData.VehicleData.InputData.TankSystem)).ToList(); //specific.FuelData;
var co2Sum = 0.SI<Kilogram>();
var fuel = specific.FuelData.First();
var fuelFactor = CalculateFactor(combinedResults, r => r.FuelConsumptionFinal(fuel.FuelType).TotalFuelConsumptionCorrected);
if (primary.EnergyConsumption != null && primary.EnergyConsumption.Any()) {
var fuel = specific.FuelData.First();
var fuelFactor = CalculateFactor(combinedResults,
r => r.FuelConsumptionFinal(fuel.FuelType).TotalFuelConsumptionCorrected);
foreach (var entry in primary.EnergyConsumption)//generic.FuelData.Select(f => f.FuelType))
{
var energyDemand = fuelFactor * (entry.Value * specific.Distance);
var fuelConsumption = new CompletedBusFuelConsumption()
{
Fuel = DeclarationData.FuelData.Lookup(entry.Key, specific.VectoRunData.VehicleData.InputData.TankSystem), // specific.FuelData.Single(f => f.FuelType == fuel),
EnergyDemand = energyDemand,
};
co2Sum += fuelConsumption.TotalFuelConsumptionCorrected * fuelConsumption.Fuel.CO2PerFuelWeight;
result.CorrectedFinalFuelConsumption.Add(entry.Key, fuelConsumption);
}
result.CO2Total = co2Sum;
foreach (var entry in primary.EnergyConsumption) //generic.FuelData.Select(f => f.FuelType))
{
var energyDemand = fuelFactor * (entry.Value * specific.Distance);
var fuelConsumption = new CompletedBusFuelConsumption() {
Fuel = DeclarationData.FuelData.Lookup(entry.Key,
specific.VectoRunData.VehicleData.InputData
.TankSystem), // specific.FuelData.Single(f => f.FuelType == fuel),
EnergyDemand = energyDemand,
};
co2Sum += fuelConsumption.TotalFuelConsumptionCorrected * fuelConsumption.Fuel.CO2PerFuelWeight;
result.CorrectedFinalFuelConsumption.Add(entry.Key, fuelConsumption);
}
}
result.CO2Total = co2Sum;
result.ElectricEnergyConsumption = null;
......
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