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

Skip to content
Snippets Groups Projects
Commit f20723c6 authored by Markus QUARITSCH's avatar Markus QUARITSCH
Browse files

fix: write correct values for P_busAux_xx in mod file in case of engine stop/start

parent 100ffece
No related branches found
No related tags found
No related merge requests found
...@@ -113,7 +113,7 @@ Namespace IntegrationTests ...@@ -113,7 +113,7 @@ Namespace IntegrationTests
For i As Integer = 0 To 9 For i As Integer = 0 To 9
aux.ResetCalculations() aux.ResetCalculations()
Assert.AreEqual(6087.0317, aux.AuxiliaryPowerAtCrankWatts().Value(), 0.001) Assert.AreEqual(6087.0317, aux.AuxiliaryPowerAtCrankWatts().Value(), 0.001)
aux.CycleStep(1.SI(Of Second)) aux.CycleStep(1.SI(Of Second), 1.0)
'Console.WriteLine("{0}", aux.AA_TotalCycleFC_Grams) 'Console.WriteLine("{0}", aux.AA_TotalCycleFC_Grams)
Next Next
...@@ -128,7 +128,7 @@ Namespace IntegrationTests ...@@ -128,7 +128,7 @@ Namespace IntegrationTests
For i As Integer = 0 To 9 For i As Integer = 0 To 9
aux.ResetCalculations() aux.ResetCalculations()
Assert.AreEqual(8954.1435, aux.AuxiliaryPowerAtCrankWatts().Value(), 0.001) Assert.AreEqual(8954.1435, aux.AuxiliaryPowerAtCrankWatts().Value(), 0.001)
aux.CycleStep(1.SI(Of Second)) aux.CycleStep(1.SI(Of Second), 1.0)
'Console.WriteLine("{0}", aux.AA_TotalCycleFC_Grams) 'Console.WriteLine("{0}", aux.AA_TotalCycleFC_Grams)
Next Next
...@@ -143,7 +143,7 @@ Namespace IntegrationTests ...@@ -143,7 +143,7 @@ Namespace IntegrationTests
For i As Integer = 0 To 9 For i As Integer = 0 To 9
aux.ResetCalculations() aux.ResetCalculations()
Assert.AreEqual(6087.0317, aux.AuxiliaryPowerAtCrankWatts().Value(), 0.001) Assert.AreEqual(6087.0317, aux.AuxiliaryPowerAtCrankWatts().Value(), 0.001)
aux.CycleStep(1.SI(Of Second)) aux.CycleStep(1.SI(Of Second), 1.0)
'Console.WriteLine("{0}", aux.AA_TotalCycleFC_Grams) 'Console.WriteLine("{0}", aux.AA_TotalCycleFC_Grams)
Next Next
......
...@@ -274,7 +274,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries ...@@ -274,7 +274,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries
} }
public void CycleStep(Second seconds) public void CycleStep(Second seconds, double essFactor)
{ {
try { try {
//M9.CycleStep(seconds); //M9.CycleStep(seconds);
...@@ -282,11 +282,11 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries ...@@ -282,11 +282,11 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries
//M11.CycleStep(seconds); //M11.CycleStep(seconds);
if (auxConfig.ElectricalUserInputsConfig.SmartElectrical) { if (auxConfig.ElectricalUserInputsConfig.SmartElectrical) {
var generatedElPower = var generatedElPower =
(auxConfig.ElectricalUserInputsConfig.SmartElectrical && auxConfig.PneumaticUserInputsConfig.SmartAirCompression (auxConfig.PneumaticUserInputsConfig.SmartAirCompression
? M7.SmartElectricalAndPneumaticAuxAltPowerGenAtCrank ? M7.SmartElectricalAndPneumaticAuxAltPowerGenAtCrank
: M7.SmartElectricalOnlyAuxAltPowerGenAtCrank) * M0.AlternatorsEfficiency * : M7.SmartElectricalOnlyAuxAltPowerGenAtCrank) * M0.AlternatorsEfficiency *
auxConfig.ElectricalUserInputsConfig.AlternatorGearEfficiency; auxConfig.ElectricalUserInputsConfig.AlternatorGearEfficiency;
ElectricStorage.Request(generatedElPower - ElectricPowerConsumerSum, seconds); ElectricStorage.Request((generatedElPower - ElectricPowerConsumerSum) * essFactor, seconds);
} }
Signals.CurrentCycleTimeInSeconds += seconds.Value(); Signals.CurrentCycleTimeInSeconds += seconds.Value();
} catch (Exception ex) { } catch (Exception ex) {
......
...@@ -40,7 +40,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl ...@@ -40,7 +40,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl
var sw5 = _smartElectrics ? sw1 : sw2; var sw5 = _smartElectrics ? sw1 : sw2;
var sw6 = !_signals.EngineStopped; var sw6 = !_signals.EngineStopped;
var sum5 = _m1.AveragePowerDemandAtCrankFromHVACMechanicals + sw5; var sum5 = _m1.AveragePowerDemandAtCrankFromHVACMechanicals + sw5;
var sum6 = sw6 ? sum5 : 0.SI<Watt>(); var sum6 = sum5; // sw6 ? sum5 : 0.SI<Watt>();
var sw3 = _smartPneumatics ? _m7.SmartElectricalAndPneumaticAuxAltPowerGenAtCrank : var sw3 = _smartPneumatics ? _m7.SmartElectricalAndPneumaticAuxAltPowerGenAtCrank :
_m7.SmartElectricalOnlyAuxAltPowerGenAtCrank; _m7.SmartElectricalOnlyAuxAltPowerGenAtCrank;
......
...@@ -131,9 +131,10 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.Interfaces ...@@ -131,9 +131,10 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.Interfaces
/// Cycle Step - Used to calculate fuelling /// Cycle Step - Used to calculate fuelling
/// </summary> /// </summary>
/// <param name="seconds"></param> /// <param name="seconds"></param>
/// <param name="essFactor"></param>
/// <returns></returns> /// <returns></returns>
/// <remarks></remarks> /// <remarks></remarks>
void CycleStep(Second seconds); void CycleStep(Second seconds, double essFactor);
///// <summary> ///// <summary>
///// Initialises AAUX Environment ( Begin Processs ) ///// Initialises AAUX Environment ( Begin Processs )
......
...@@ -38,7 +38,6 @@ using TUGraz.VectoCore.Models.BusAuxiliaries.Interfaces; ...@@ -38,7 +38,6 @@ using TUGraz.VectoCore.Models.BusAuxiliaries.Interfaces;
using TUGraz.VectoCore.Models.Simulation; using TUGraz.VectoCore.Models.Simulation;
using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.Data;
using TUGraz.VectoCore.Models.Simulation.DataBus; using TUGraz.VectoCore.Models.Simulation.DataBus;
using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine;
using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.OutputData;
namespace TUGraz.VectoCore.Models.SimulationComponent.Impl namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
...@@ -107,6 +106,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -107,6 +106,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
{ {
CurrentState.AngularSpeed = angularSpeed; CurrentState.AngularSpeed = angularSpeed;
CurrentState.dt = dt; CurrentState.dt = dt;
var signals = Auxiliaries.Signals;
// trick bus auxiliaries that ice is on - all auxiliaries are considered. ESS is corrected in post-processing
signals.EngineStopped = false;
signals.VehicleStopped = false;
CurrentState.PowerDemand = GetBusAuxPowerDemand(absTime, dt, torquePowerTrain, torqueEngine, angularSpeed, dryRun); CurrentState.PowerDemand = GetBusAuxPowerDemand(absTime, dt, torquePowerTrain, torqueEngine, angularSpeed, dryRun);
var avgAngularSpeed = (CurrentState.AngularSpeed + PreviousState.AngularSpeed) / 2.0; var avgAngularSpeed = (CurrentState.AngularSpeed + PreviousState.AngularSpeed) / 2.0;
...@@ -115,6 +120,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -115,6 +120,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
public Watt PowerDemandEngineOn(Second time, Second simulationInterval, PerSecond engineSpeed) public Watt PowerDemandEngineOn(Second time, Second simulationInterval, PerSecond engineSpeed)
{ {
var signals = Auxiliaries.Signals;
signals.EngineStopped = false;
signals.VehicleStopped = false;
return GetBusAuxPowerDemand(time, simulationInterval, 0.SI<NewtonMeter>(), 0.SI<NewtonMeter>(), engineSpeed, true); return GetBusAuxPowerDemand(time, simulationInterval, 0.SI<NewtonMeter>(), 0.SI<NewtonMeter>(), engineSpeed, true);
} }
...@@ -124,6 +132,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -124,6 +132,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
AdditionalAux = null; AdditionalAux = null;
CurrentState.AngularSpeed = DataBus.EngineIdleSpeed; CurrentState.AngularSpeed = DataBus.EngineIdleSpeed;
CurrentState.dt = dt; CurrentState.dt = dt;
var signals = Auxiliaries.Signals;
// set internal state of power demand as if ICE is on - multiplied by (1-ESS_UF)
signals.EngineStopped = false;
signals.VehicleStopped = false;
var busAuxPowerDemand = GetBusAuxPowerDemand( var busAuxPowerDemand = GetBusAuxPowerDemand(
absTime, dt, 0.SI<NewtonMeter>(), 0.SI<NewtonMeter>(), DataBus.EngineIdleSpeed); absTime, dt, 0.SI<NewtonMeter>(), 0.SI<NewtonMeter>(), DataBus.EngineIdleSpeed);
AdditionalAux = conventionalAux; AdditionalAux = conventionalAux;
...@@ -131,27 +146,34 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -131,27 +146,34 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
CurrentState.PowerDemand = ((AdditionalAux?.PowerDemandEngineOn(absTime, dt, DataBus.EngineIdleSpeed) ?? 0.SI<Watt>()) + CurrentState.PowerDemand = ((AdditionalAux?.PowerDemandEngineOn(absTime, dt, DataBus.EngineIdleSpeed) ?? 0.SI<Watt>()) +
busAuxPowerDemand) * (1 - EngineStopStartUtilityFactor); busAuxPowerDemand) * (1 - EngineStopStartUtilityFactor);
return EngineStopStartUtilityFactor * busAuxPowerDemand + AdditionalAux?.PowerDemandEngineOff(absTime, dt); //
signals.EngineStopped = !DataBus.IgnitionOn;
signals.VehicleStopped = DataBus.VehicleStopped;
busAuxPowerDemand = GetBusAuxPowerDemand(
absTime, dt, 0.SI<NewtonMeter>(), 0.SI<NewtonMeter>(), DataBus.EngineIdleSpeed);
AdditionalAux = conventionalAux;
return EngineStopStartUtilityFactor * (busAuxPowerDemand + AdditionalAux?.PowerDemandEngineOff(absTime, dt));
} }
protected internal virtual void DoWriteModalResults(IModalDataContainer container) protected internal virtual void DoWriteModalResults(IModalDataContainer container)
{ {
// cycleStep has to be called here and not in DoCommit, write is called before Commit!
Auxiliaries.CycleStep(CurrentState.dt);
var essUtilityFactor = 1.0; var essUtilityFactor = 1.0;
if (!DataBus.IgnitionOn) { if (!DataBus.IgnitionOn) {
essUtilityFactor = 1 - EngineStopStartUtilityFactor; essUtilityFactor = 1 - EngineStopStartUtilityFactor;
} }
// cycleStep has to be called here and not in DoCommit, write is called before Commit!
Auxiliaries.CycleStep(CurrentState.dt, essUtilityFactor);
//CurrentState.TotalFuelConsumption = Auxiliaries.TotalFuel; //CurrentState.TotalFuelConsumption = Auxiliaries.TotalFuel;
container[ModalResultField.P_aux] = CurrentState.PowerDemand; container[ModalResultField.P_aux] = CurrentState.PowerDemand;
container[ModalResultField.P_busAux_ES_HVAC] = Auxiliaries.HVACElectricalPowerConsumer; container[ModalResultField.P_busAux_ES_HVAC] = essUtilityFactor * Auxiliaries.HVACElectricalPowerConsumer;
container[ModalResultField.P_busAux_ES_other] = Auxiliaries.ElectricPowerConsumer; container[ModalResultField.P_busAux_ES_other] = essUtilityFactor * Auxiliaries.ElectricPowerConsumer;
container[ModalResultField.P_busAux_ES_consumer_sum] = Auxiliaries.ElectricPowerConsumerSum; container[ModalResultField.P_busAux_ES_consumer_sum] = essUtilityFactor * Auxiliaries.ElectricPowerConsumerSum;
container[ModalResultField.P_busAux_ES_sum_mech] = essUtilityFactor * Auxiliaries.ElectricPowerDemandMech; container[ModalResultField.P_busAux_ES_sum_mech] = essUtilityFactor * Auxiliaries.ElectricPowerDemandMech;
container[ModalResultField.P_busAux_ES_generated] = essUtilityFactor * Auxiliaries.ElectricPowerGenerated; container[ModalResultField.P_busAux_ES_generated] = essUtilityFactor * Auxiliaries.ElectricPowerGenerated;
...@@ -167,7 +189,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -167,7 +189,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
container[ModalResultField.P_busAux_PS_generated_alwaysOn] = essUtilityFactor * Auxiliaries.PSPowerCompressorAlwaysOn; container[ModalResultField.P_busAux_PS_generated_alwaysOn] = essUtilityFactor * Auxiliaries.PSPowerCompressorAlwaysOn;
container[ModalResultField.P_busAux_PS_generated_dragOnly] = essUtilityFactor * Auxiliaries.PSPowerCompressorDragOnly; container[ModalResultField.P_busAux_PS_generated_dragOnly] = essUtilityFactor * Auxiliaries.PSPowerCompressorDragOnly;
container[ModalResultField.P_busAux_HVACmech_consumer] = Auxiliaries.HVACMechanicalPowerConsumer; container[ModalResultField.P_busAux_HVACmech_consumer] = essUtilityFactor * Auxiliaries.HVACMechanicalPowerConsumer;
container[ModalResultField.P_busAux_HVACmech_gen] = essUtilityFactor * Auxiliaries.HVACMechanicalPowerGenerated; container[ModalResultField.P_busAux_HVACmech_gen] = essUtilityFactor * Auxiliaries.HVACMechanicalPowerGenerated;
} }
...@@ -211,24 +233,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -211,24 +233,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
signals.Idle = DataBus.VehicleStopped; signals.Idle = DataBus.VehicleStopped;
signals.InNeutral = DataBus.Gear == 0; signals.InNeutral = DataBus.Gear == 0;
signals.EngineStopped = !DataBus.IgnitionOn;
signals.VehicleStopped = DataBus.VehicleStopped;
return Auxiliaries.AuxiliaryPowerAtCrankWatts + signals.PreExistingAuxPower; return Auxiliaries.AuxiliaryPowerAtCrankWatts + signals.PreExistingAuxPower;
} }
protected class FuelConsumptionAdapter : IFuelConsumptionMap
{
protected internal FuelConsumptionMap FcMap;
public bool AllowExtrapolation { get; set; }
public KilogramPerSecond GetFuelConsumptionValue(NewtonMeter torque, PerSecond angularVelocity)
{
return FcMap.GetFuelConsumption(torque, angularVelocity, AllowExtrapolation).Value;
}
}
public class BusAuxState public class BusAuxState
{ {
public Second dt; public Second dt;
......
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