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

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

handle case of simulation runs with no wheel power available - ignore calculation of k_vehline

parent 0e1d1aef
No related branches found
No related tags found
No related merge requests found
......@@ -193,18 +193,22 @@ namespace TUGraz.VectoCore.OutputData
return _vehLine[fuel.FuelType];
}
double k, d, r;
VectoMath.LeastSquaresFitting(
GetValues(
row => row.Field<bool>(ModalResultField.ICEOn.GetName())
? new Point(
row.Field<SI>(ModalResultField.P_wheel_in.GetName()).Value(),
row.Field<SI>(GetColumnName(fuel, ModalResultField.FCFinal)).Value())
: null)
.Where(x => x != null && x.X > 0 && x.Y > 0), out k, out d, out r);
_vehLine[fuel.FuelType] = k.SI<KilogramPerWattSecond>();
return _vehLine[fuel.FuelType];
if (Data.AsEnumerable().Any(r => r.Field<SI>(ModalResultField.P_wheel_in.GetName()) != null)) {
double k, d, r;
VectoMath.LeastSquaresFitting(
GetValues(
row => row.Field<bool>(ModalResultField.ICEOn.GetName())
? new Point(
row.Field<SI>(ModalResultField.P_wheel_in.GetName()).Value(),
row.Field<SI>(GetColumnName(fuel, ModalResultField.FCFinal)).Value())
: null)
.Where(x => x != null && x.X > 0 && x.Y > 0), out k, out d, out r);
_vehLine[fuel.FuelType] = k.SI<KilogramPerWattSecond>();
return _vehLine[fuel.FuelType];
}
return null;
}
public void CalculateAggregateValues()
......
......@@ -444,7 +444,10 @@ namespace TUGraz.VectoCore.OutputData
row[FcCol(Fields.K_ENGLINE, suffix)] = correction.ConvertToGramPerKiloWattHour();
row[FcCol(Fields.K_VEHLINE, suffix)] = modData.VehicleLineSlope(fuel).ConvertToGramPerKiloWattHour();
var vehLine = modData.VehicleLineSlope(fuel);
if (vehLine != null) {
row[FcCol(Fields.K_VEHLINE, suffix)] = vehLine.ConvertToGramPerKiloWattHour();
}
var fcEssCorr = fcModSum + correction * workESS;
row[FcCol(Fields.FCESS_H_CORR, suffix)] = duration != null ? (fcEssCorr / duration).ConvertToGrammPerHour() : 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