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

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

refacotring method

parent 885abd37
No related branches found
No related tags found
No related merge requests found
...@@ -125,115 +125,10 @@ namespace TUGraz.VectoCore.OutputData ...@@ -125,115 +125,10 @@ namespace TUGraz.VectoCore.OutputData
public void Finish(VectoRun.Status runStatus, Exception exception = null) public void Finish(VectoRun.Status runStatus, Exception exception = null)
{ {
var dataColumns = new List<ModalResultField> { ModalResultField.time };
RunStatus = runStatus; RunStatus = runStatus;
SimException = exception; SimException = exception;
if (!_writeEngineOnly) { var dataColumns = GetOutputColumns();
dataColumns.AddRange(new[] {
ModalResultField.simulationInterval,
ModalResultField.dist,
ModalResultField.v_act,
ModalResultField.v_targ,
ModalResultField.acc,
ModalResultField.grad
});
}
if (!_writeEngineOnly) {
dataColumns.AddRange(new[] {
ModalResultField.Gear,
});
if (HasTorqueConverter) {
dataColumns.AddRange(new[] { ModalResultField.TC_Locked });
}
}
dataColumns.AddRange(new[] {
ModalResultField.n_eng_avg,
ModalResultField.T_eng_fcmap,
ModalResultField.Tq_full,
ModalResultField.Tq_drag,
ModalResultField.P_eng_fcmap,
ModalResultField.P_eng_full,
ModalResultField.P_eng_full_stat,
ModalResultField.P_eng_drag,
ModalResultField.P_eng_inertia,
ModalResultField.P_eng_out,
});
if (HasTorqueConverter) {
dataColumns.AddRange(new[] {
ModalResultField.P_gbx_shift_loss,
ModalResultField.P_TC_loss,
ModalResultField.P_TC_out,
});
} else {
dataColumns.AddRange(new[] {
ModalResultField.P_clutch_loss,
ModalResultField.P_clutch_out,
});
}
dataColumns.AddRange(new[] {
ModalResultField.P_aux
});
if (!_writeEngineOnly) {
dataColumns.AddRange(new[] {
ModalResultField.P_gbx_in,
ModalResultField.P_gbx_loss,
ModalResultField.P_gbx_inertia,
ModalResultField.P_retarder_in,
ModalResultField.P_ret_loss,
ModalResultField.P_angle_in,
ModalResultField.P_angle_loss,
ModalResultField.P_axle_in,
ModalResultField.P_axle_loss,
ModalResultField.P_brake_in,
ModalResultField.P_brake_loss,
ModalResultField.P_wheel_in,
ModalResultField.P_wheel_inertia,
ModalResultField.P_trac,
ModalResultField.P_slope,
ModalResultField.P_air,
ModalResultField.P_roll,
ModalResultField.P_veh_inertia,
ModalResultField.n_gbx_out_avg,
ModalResultField.T_gbx_out
});
if (HasTorqueConverter) {
dataColumns.AddRange(new[] {
ModalResultField.TorqueConverterSpeedRatio,
ModalResultField.TorqueConverterTorqueRatio,
ModalResultField.TC_TorqueOut,
ModalResultField.TC_angularSpeedOut,
ModalResultField.TC_TorqueIn,
ModalResultField.TC_angularSpeedIn,
});
}
}
if (!_writeEngineOnly && WriteAdvancedAux) {
dataColumns.AddRange(new[] {
ModalResultField.AA_NonSmartAlternatorsEfficiency,
ModalResultField.AA_SmartIdleCurrent_Amps,
ModalResultField.AA_SmartIdleAlternatorsEfficiency,
ModalResultField.AA_SmartTractionCurrent_Amps,
ModalResultField.AA_SmartTractionAlternatorEfficiency,
ModalResultField.AA_SmartOverrunCurrent_Amps,
ModalResultField.AA_SmartOverrunAlternatorEfficiency,
ModalResultField.AA_CompressorFlowRate_LitrePerSec,
ModalResultField.AA_OverrunFlag,
ModalResultField.AA_EngineIdleFlag,
ModalResultField.AA_CompressorFlag,
ModalResultField.AA_TotalCycleFC_Grams,
ModalResultField.AA_TotalCycleFC_Litres,
ModalResultField.AA_AveragePowerDemandCrankHVACMechanicals,
ModalResultField.AA_AveragePowerDemandCrankHVACElectricals,
ModalResultField.AA_AveragePowerDemandCrankElectrics,
ModalResultField.AA_AveragePowerDemandCrankPneumatics,
ModalResultField.AA_TotalCycleFuelConsumptionCompressorOff,
ModalResultField.AA_TotalCycleFuelConsumptionCompressorOn,
});
}
var strCols = dataColumns.Select(x => x.GetName()) var strCols = dataColumns.Select(x => x.GetName())
.Concat(Auxiliaries.Values.Select(c => c.ColumnName)) .Concat(Auxiliaries.Values.Select(c => c.ColumnName))
...@@ -264,6 +159,126 @@ namespace TUGraz.VectoCore.OutputData ...@@ -264,6 +159,126 @@ namespace TUGraz.VectoCore.OutputData
_addReportResult(this); _addReportResult(this);
} }
private IEnumerable<ModalResultField> GetOutputColumns()
{
var dataColumns = new List<ModalResultField> { ModalResultField.time };
if (!_writeEngineOnly) {
dataColumns.AddRange(
new[] {
ModalResultField.simulationInterval,
ModalResultField.dist,
ModalResultField.v_act,
ModalResultField.v_targ,
ModalResultField.acc,
ModalResultField.grad
});
}
if (!_writeEngineOnly) {
dataColumns.AddRange(
new[] {
ModalResultField.Gear,
});
if (HasTorqueConverter) {
dataColumns.AddRange(new[] { ModalResultField.TC_Locked });
}
}
dataColumns.AddRange(
new[] {
ModalResultField.n_eng_avg,
ModalResultField.T_eng_fcmap,
ModalResultField.Tq_full,
ModalResultField.Tq_drag,
ModalResultField.P_eng_fcmap,
ModalResultField.P_eng_full,
ModalResultField.P_eng_full_stat,
ModalResultField.P_eng_drag,
ModalResultField.P_eng_inertia,
ModalResultField.P_eng_out,
});
if (HasTorqueConverter) {
dataColumns.AddRange(
new[] {
ModalResultField.P_gbx_shift_loss,
ModalResultField.P_TC_loss,
ModalResultField.P_TC_out,
});
} else {
dataColumns.AddRange(
new[] {
ModalResultField.P_clutch_loss,
ModalResultField.P_clutch_out,
});
}
dataColumns.AddRange(
new[] {
ModalResultField.P_aux
});
if (!_writeEngineOnly) {
dataColumns.AddRange(
new[] {
ModalResultField.P_gbx_in,
ModalResultField.P_gbx_loss,
ModalResultField.P_gbx_inertia,
ModalResultField.P_retarder_in,
ModalResultField.P_ret_loss,
ModalResultField.P_angle_in,
ModalResultField.P_angle_loss,
ModalResultField.P_axle_in,
ModalResultField.P_axle_loss,
ModalResultField.P_brake_in,
ModalResultField.P_brake_loss,
ModalResultField.P_wheel_in,
ModalResultField.P_wheel_inertia,
ModalResultField.P_trac,
ModalResultField.P_slope,
ModalResultField.P_air,
ModalResultField.P_roll,
ModalResultField.P_veh_inertia,
ModalResultField.n_gbx_out_avg,
ModalResultField.T_gbx_out
});
if (HasTorqueConverter) {
dataColumns.AddRange(
new[] {
ModalResultField.TorqueConverterSpeedRatio,
ModalResultField.TorqueConverterTorqueRatio,
ModalResultField.TC_TorqueOut,
ModalResultField.TC_angularSpeedOut,
ModalResultField.TC_TorqueIn,
ModalResultField.TC_angularSpeedIn,
});
}
}
if (!_writeEngineOnly && WriteAdvancedAux) {
dataColumns.AddRange(
new[] {
ModalResultField.AA_NonSmartAlternatorsEfficiency,
ModalResultField.AA_SmartIdleCurrent_Amps,
ModalResultField.AA_SmartIdleAlternatorsEfficiency,
ModalResultField.AA_SmartTractionCurrent_Amps,
ModalResultField.AA_SmartTractionAlternatorEfficiency,
ModalResultField.AA_SmartOverrunCurrent_Amps,
ModalResultField.AA_SmartOverrunAlternatorEfficiency,
ModalResultField.AA_CompressorFlowRate_LitrePerSec,
ModalResultField.AA_OverrunFlag,
ModalResultField.AA_EngineIdleFlag,
ModalResultField.AA_CompressorFlag,
ModalResultField.AA_TotalCycleFC_Grams,
ModalResultField.AA_TotalCycleFC_Litres,
ModalResultField.AA_AveragePowerDemandCrankHVACMechanicals,
ModalResultField.AA_AveragePowerDemandCrankHVACElectricals,
ModalResultField.AA_AveragePowerDemandCrankElectrics,
ModalResultField.AA_AveragePowerDemandCrankPneumatics,
ModalResultField.AA_TotalCycleFuelConsumptionCompressorOff,
ModalResultField.AA_TotalCycleFuelConsumptionCompressorOn,
});
}
return dataColumns;
}
public IEnumerable<T> GetValues<T>(DataColumn col) public IEnumerable<T> GetValues<T>(DataColumn col)
{ {
return Data.Rows.Cast<DataRow>().Select(x => x.Field<T>(col)); return Data.Rows.Cast<DataRow>().Select(x => x.Field<T>(col));
......
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