gearshift.core.model.calculateShiftpointsNdvFullPC package¶
Subpackages¶
Module contents¶
It provides GEARSHIFT model dsp to obtain the gearshifts following Sub-Annex 2 of the Annex XXI from the COMMISSION REGULATION (EU) 2017/1151.
Docstrings should provide sufficient understanding for any individual function.
Sub-Modules:
It provides the corrections defined in section 4 of the Sub-Annex 2 from Annex XXI from the COMMISSION REGULATION (EU) 2017/1151. |
-
check_gears
(NoOfGears, gear_nbrs, Ndv, ExcludeCrawlerGear)[source]¶ Check if is necessary exclude the first gear from the input gears
- Parameters:
NoOfGears (Integer) – Annex 2 (2d) ng. The number of forward gears.
gear_nbrs (list) – List with of gears of the vehicle.
Ndv (list) – Annex 2 (2e) i ==> (n/v)_i The ratio obtained by dividing the engine speed n by the vehicle speed v for each gear i form 1 to ng.
ExcludeCrawlerGear (boolean) – Annex 2 (2j) Gear 1 may be excluded at the request of . the manufacturer if
- Returns:
- NoOfGearsFinal (
int
): The number of forward gears after apply the exclusion of first gear if is necessary.
- NoOfGearsFinal (
- Gears (
list
): List with of gears of the vehicle after apply the exclusion of first gear if is necessary.
- Gears (
- NdvRatios (
numpy.array
): The ratio obtained by dividing the engine speed n by the vehicle speed v for each gear i form 1 to ng after apply the exclusion of first gear if is necessary.
- NdvRatios (
-
parse_speed_trace
(speed_trace)[source]¶ Split speed trace in trace times and required vehicles speeds
- Parameters:
speed_trace (array) – Annex 1 (eg 8.3) i ==> v_i The vehicle speed at second i.
- Returns:
- TraceTimesInput (
numpy.array
): Times for each vehicle speed required
- TraceTimesInput (
- RequiredVehicleSpeedsInput (
numpy.array
): The vehicle speed required for the whole cycle.
- RequiredVehicleSpeedsInput (
-
resample_trace
(TraceTimesInput, RequiredVehicleSpeedsInput)[source]¶ Re-sample the trace in 1Hz
- Parameters:
TraceTimesInput (array) – Times for each vehicle speed required
RequiredVehicleSpeedsInput (array) – The vehicle speed required for the whole cycle.
- Returns:
- TraceTimes (
numpy.array
): Times for each vehicle speed required re-sampled in 1Hz
- TraceTimes (
- RequiredVehicleSpeeds (
numpy.array
): The vehicle speed required for the whole cycle re-sampled in 1Hz
- RequiredVehicleSpeeds (
- TraceTimesCount (
int
): The length of trace times re-sampled in 1Hz
- TraceTimesCount (
Note
If the trace was provided with higher sample rate, this may lead to data loss.
-
identify_phases
(TraceTimesCount, RequiredVehicleSpeeds)[source]¶ Identify phases
- Parameters:
TraceTimesCount (integer) – The length of trace times re-sampled in 1Hz
RequiredVehicleSpeeds (array) – The vehicle speed required for the whole cycle re-sampled in 1Hz
- Returns:
- Phases (
numpy.array
): The list of phases that are used during whole cycle
- Phases (
- InDecelerationToStandstill (
boolean numpy.array
): The array that contains the seconds from deceleration to standstill as a True
- InDecelerationToStandstill (
- PhaseValues (
numpy.array
): Contains the points of changes phases
- PhaseValues (
- InStandStill (
boolean numpy.array
): Contains the points that are in standstill phase as a True
- InStandStill (
- PhaseStarts (
numpy.array
): Contains the points that are start point from a phase
- PhaseStarts (
- PhaseEnds (
numpy.array
): Contains the points that are end point from a phase
- PhaseEnds (
- PHASE_ACCELERATION_FROM_STANDSTILL (
int
): Acceleration phase following a standstill phase
- PHASE_ACCELERATION_FROM_STANDSTILL (
- PHASE_ACCELERATION (
int
): Acceleration phase
- PHASE_ACCELERATION (
- InAcceleration (
boolean numpy.array
): Contains the points that are in acceleration phase as a True
- InAcceleration (
- InConstantSpeed (
boolean numpy.array
): Contains the points that are in constant speed phase as a True
- InConstantSpeed (
- InAccelerationAnyDuration (
boolean numpy.array
): Some gear corrections ignore the duration of acceleration phases so save acceleration phases with any duration here.
- InAccelerationAnyDuration (
- PHASE_DECELERATION (
int
): - Time period of more than 2 seconds with required vehicle:
speed >= 1km/h and monotonically decreasing
- PHASE_DECELERATION (
- PHASE_DECELERATION_TO_STANDSTILL (
int
): DECELERATION phase preceding a STANDSTILL phase
- PHASE_DECELERATION_TO_STANDSTILL (
- InDeceleration (
boolean numpy.array
): Contains the points that are in deceleration phase as a True
- InDeceleration (
- PHASE_STANDSTILL (
int
): Time period with required vehicle speed < 1km/h
- PHASE_STANDSTILL (
-
load_full_power_curve
(FullPowerCurve, AdditionalSafetyMargin0, StartEngineSpeed, EndEngineSpeed)[source]¶ Load full power curve
- Parameters:
FullPowerCurve (array) – Annex 2 (2h) and (3.4) n ==> P_wot(n), ASM The full load power curve over the engine speed range.
AdditionalSafetyMargin0 (array) – This is a legacy parameter used until regulation GRPE-72-10-Rev.2. Later regulations define the additional safety margin values as part of the FullPowerCurve.
StartEngineSpeed (array) – This is a legacy parameter used until regulation GRPE-72-10-Rev.2. GRPE-72-10-Rev.2 Annex 2 (3.4) n_start The engine speed at which ASM approching zero starts.
EndEngineSpeed (array) – This is a legacy parameter used until regulation GRPE-72-10-Rev.2. GRPE-72-10-Rev.2 Annex 2 (3.4) n_end The engine speed at which ASM approching zero ends.
- Returns:
- PowerCurveEngineSpeeds (
numpy.array
): Contains the power curve engine speeds
- PowerCurveEngineSpeeds (
- PowerCurvePowers (
numpy.array
): Contains the power curve powers
- PowerCurvePowers (
- PowerCurveASM (
numpy.array
): Contains the power curve additional save margin
- PowerCurveASM (
- DefinedPowerCurveAdditionalSafetyMargins (
bool
): Boolean that define if the additional save margins are present
- DefinedPowerCurveAdditionalSafetyMargins (
Note
This function split the different components of full power curve in a independent array
-
determine_rated_engine_power
(RatedEnginePower, RatedEngineSpeed, PowerCurvePowers, PowerCurveEngineSpeeds)[source]¶ Determine rated engine power and rated engine speed from the full power curve
Note
The following requirement was deleted from the regulation but as there is no new requirement we will stay with the old one : If the maximum power is developed over an engine speed range, n_rated shall be the minimum of this range
- Parameters:
RatedEnginePower (numpy.array) –
Annex 2 (2a) P_rated. This is a legacy parameter used until regulation GRPE-75-23.The maximum rated engine power as declared by the manufacturer. But the newer regulation GRPE/2018/2 Annex 2 (2g) now requires : The data sets and the values P_rated and n_rated shall be taken from the power curve as declared by the manufacturer.
For backward compatibility this parameter may still be used to override the value calculated from FullPowerCurve. Set RatedEnginePower and RatedEngineSpeed to 0 to use the calculated values.
RatedEngineSpeed (numpy.array) –
Annex 2 (2b) n_rated. This is a legacy parameter used until regulation GRPE-75-23. The rated engine speed at which an engine declared by the manufacturer as the engine speed at which the engine develops its maximum power.
But the newer regulation GRPE/2018/2 Annex 2 (2g) now requires: The data sets and the values P_rated and n_rated shall be taken from the power curve as declared by the manufacturer.
For backward compatibility this parameter may still be used to override the value calculated from FullPowerCurve. Set RatedEnginePower and RatedEngineSpeed to 0 to use the calculated values.
PowerCurvePowers (numpy.array) – Contains the power curve powers
PowerCurveEngineSpeeds (numpy.array) – Contains the power curve engine speeds
- Returns:
-
determine_maximum_engine_speed_95
(Max95EngineSpeed, PowerCurvePowers, PowerCurveEngineSpeeds)[source]¶ Determine the maximum engine speed where 95 percent of the rated power is reached from the full power curve
- Parameters:
Max95EngineSpeed (float) – Annex 2 (2g) n_max1 = n_95_high The maximum engine speed where 95 per cent of rated power is reached. If the dummy value 0 will be given for this parameter then n_max1 will be calculated from parameter FullPowerCurve P_wot.
PowerCurvePowers (array) – Contains the power curve powers
PowerCurveEngineSpeeds (array) – Contains the power curve engine speeds
- Returns:
- Max95EngineSpeedFinal (
float
): Annex 2 (2g) n_max1 = n_95_high adjusted. If n_95_high cannot be determined because the engine speed is limited to a lower value n_lim for all gears and the corresponding full load power is higher than 95 per cent of rated power, n_95_high shall be set to n_lim.
- Max95EngineSpeedFinal (
Note
This will only be done if this value was not set as input parameter.
-
minimum_engine_speed_in_motion
(IdlingEngineSpeed, RatedEngineSpeedF, MinDriveEngineSpeed1st, MinDriveEngineSpeed1stTo2nd, MinDriveEngineSpeed2ndDecel, MinDriveEngineSpeed2nd, MinDriveEngineSpeedGreater2nd, TraceTimesCount, NoOfGearsFinal, InDecelerationToStandstill)[source]¶ Define minimum engine speeds when vehicle is in motion (2k)
- Parameters:
IdlingEngineSpeed (float) – Annex 2 (2c) n_idle. The idling speed.
RatedEngineSpeedF (float) – Contains the rated engine speed corrected if is necessary
MinDriveEngineSpeed1st (float) – This is a legacy parameter used until regulation GRPE-75-23. This value may be used to increase the calculated value. Annex 2 (2k) n_min_drive = n_idle for n_gear:1 The minimum engine speed when the vehicle is in motion.
MinDriveEngineSpeed1stTo2nd (float) – This is a legacy parameter used until regulation GRPE-75-23. This value may be used to increase the calculated value. Annex 2 (2ka) n_min_drive = 1.15 x n_idle for n_gear:1->2 The minimum engine speed for transitions from first to second gear.
MinDriveEngineSpeed2ndDecel (float) – This is a legacy parameter used until regulation GRPE-75-23. This value may be used to increase the calculated value. Annex 2 (2kb) n_min_drive = n_idle for n_gear:2 The minimum engine speed for decelerations to standstill in second gear.
MinDriveEngineSpeed2nd (float) – This is a legacy parameter used until regulation GRPE-75-23. This value may be used to increase the calculated value. Annex 2 (2kc) n_min_drive = 0.9 x n_idle for n_gear:2
MinDriveEngineSpeedGreater2nd (float) – This is a legacy parameter used until regulation GRPE-75-23. This value may be used to increase the calculated value. Annex 2 (2k) n_min_drive = n_idle + 0.125 × ( n_rated - n_idle ) for n_gear:3.. This value shall be referred to as n_min_drive_set. The minimum engine speed for all driving conditions in gears greater than 2.
TraceTimesCount (integer) – The length of trace times re-sampled in 1Hz
NoOfGearsFinal (integer) – The number of forward gears after apply the exclusion of first gear if is necessary.
InDecelerationToStandstill (boolean array) – The array that contains the seconds from deceleration to standstill as a True
- Returns:
- MinDrivesI (
numpy.array
): Minimum engine speeds when vehicle is in motion
- MinDrivesI (
- CalculatedMinDriveEngineSpeedGreater2nd (
float
): The minimum drive engine speed grater than second
- CalculatedMinDriveEngineSpeedGreater2nd (
- MinDrive1stTo2nd (
float
): Annex 2 (2ka) n_min_drive = 1.15 x n_idle for n_gear:1->2 The minimum engine speed for transitions from first to second gear. This is the maximum of calculated value and input parameter value.
- MinDrive1stTo2nd (
- MinDrive1st (
float
): Annex 2 (2k) n_min_drive = n_idle for n_gear:1 The minimum engine speed when the vehicle is in motion. This is the maximum of calculated value and input parameter value.
- MinDrive1st (
- MinDrive2ndDecel (
float
): Annex 2 (2kb) n_min_drive = n_idle for n_gear:2 The minimum engine speed for decelerations to standstill in second gear. This is the maximum of calculated value and input parameter value.
- MinDrive2ndDecel (
- MinDrive2nd (
float
): Annex 2 (2kc) n_min_drive = 0.9 x n_idle for n_gear:2 The minimum engine speed for all other driving conditions in second gear. This is the maximum of calculated value and input parameter value.
- MinDrive2nd (
- MinDriveGreater2nd (
float
): Annex 2 (2k) n_min_drive = n_idle + 0.125 × ( n_rated - n_idle ) for n_gear:3.. This value shall be referred to as n_min_drive_set. The minimum engine speed for all driving conditions in gears greater than 2. This is the maximum of calculated value and input parameter value.
- MinDriveGreater2nd (
Note
The calculation of minimum engine speeds for the second gear does not fully confirm to the latest legislation text, but rather reflects the previous revision of it until (2ka) is clarified.
-
get_accelerations
(RequiredVehicleSpeeds, TraceTimes)[source]¶ Calculate accelerations.
- Parameters:
RequiredVehicleSpeeds (array) – The vehicle speed required for the whole cycle re-sampled in 1Hz
TraceTimes (array) – Times for each vehicle speed required re-sampled in 1Hz
- Returns:
- Accelerations (
numpy.array
): The acceleration required for the whole cycle re-sampled in 1Hz
- Accelerations (
-
define_minimum_engine_speed_in_motion
(MinDrivesI, CalculatedMinDriveEngineSpeedGreater2nd, MinDriveEngineSpeedGreater2ndAccel, MinDriveEngineSpeedGreater2ndDecel, MinDriveEngineSpeedGreater2ndAccelStartPhase, MinDriveEngineSpeedGreater2ndDecelStartPhase, RequiredVehicleSpeeds, TimeEndOfStartPhase, TraceTimes, NoOfGearsFinal, Accelerations)[source]¶ Determine the gear, in which the maximum vehicle speed is reached (2i) The maximum vehicle speed is defined as the vehicle speed, at which the available power equals the road load power caused by friction and aerodynamics, and is usually not covered by typical traces. That is why the calculation is based on sufficient fictive road load speeds.
- Parameters:
MinDrivesI (array) – Minimum engine speeds when vehicle is in motion
CalculatedMinDriveEngineSpeedGreater2nd (float) – The minimum drive engine speed grater than second
MinDriveEngineSpeedGreater2ndAccel (float) – Annex 2 (2j) n_min_drive_up Values higher than n_min_drive_set may be used for n_gear > 2. The manufacturer may specify a value for acceleration/constant speed phases (n_min_drive_up).
MinDriveEngineSpeedGreater2ndDecel (float) – Annex 2 (2j) n_min_drive_down Values higher than n_min_drive_set may be used for n_gear > 2. The manufacturer may specify a value for deceleration phases (n_min_drive_down).
MinDriveEngineSpeedGreater2ndAccelStartPhase (float) – Annex 2 (2j) n_min_drive_up_start Heinz Steven Tool n_min_drive_start_up For an initial period of time (t_start_phase), the manufacturer may specify higher values (n_min_drive_start and/or n_min_drive_up_start) for the values n_min_drive and/or n_min_drive_up for n_gear > 2. This requirement was implemented with other parameters by the reference implementation Heinz Steven Tool.
MinDriveEngineSpeedGreater2ndDecelStartPhase (float) – Annex 2 (2j) n_min_drive_start Heinz Steven Tool n_min_drive_start_down For an initial period of time (t_start_phase), the manufacturer may specify higher values (n_min_drive_start and/or n_min_drive_up_start) for the values n_min_drive and/or n_min_drive_up for n_gear > 2. This requirement was implemented with other parameters by the reference implementation Heinz Steven Tool.
RequiredVehicleSpeeds (numpy.array) – The vehicle speed required for the whole cycle re-sampled in 1Hz
TimeEndOfStartPhase (numpy.array) – Annex 2 (2j) t_start_phase For an initial period of time (t_start_phase), the manufacturer may specify higher values (n_min_drive_start and/or n_min_drive_up_start) for the values n_min_drive and/or n_min_drive_up for n_gear > 2. The input parameter here is used in combination with MinDriveEngineSpeedGreater2ndAccelStartPhase and MinDriveEngineSpeedGreater2ndDecelStartPhase.
TraceTimes (numpy.array) – Times for each vehicle speed required re-sampled in 1Hz
NoOfGearsFinal (integer) – The number of forward gears after apply the exclusion of first gear if is necessary.
Accelerations (numpy.array) – The acceleration required for the whole cycle re-sampled in 1Hz
- Returns:
- MinDrives (
numpy.array
): Samples which have acceleration values >= -0.1389 m/s² ( = 0.5 (km/h)/s ) shall belong to the acceleration/constant speed phases.
- MinDrives (
-
determine_gear_in_maximum_vehicle_speed
(PowerCurveEngineSpeeds, f0, f1, f2, NdvRatios, NoOfGearsFinal, PowerCurvePowers)[source]¶ The maximum vehicle speed is defined as the vehicle speed, at which the available power equals the road load power caused by friction and aerodynamics, and is usually not covered by typical traces. That is why the calculation is based on sufficient fictive road load speeds.
- Parameters:
PowerCurveEngineSpeeds (numpy.array) – Contains the power curve engine speeds
f0 (float) – The constant road load coefficient, i.e. independent of velocity, caused by internal frictional resistances.
f1 (float) – The linear road load coefficient, i.e. proportional to velocity, caused by tyres rolling resistances.
f2 (float) – The quadratic road load coefficient, i.e. quadratical to velocity, caused by aerodynamic resistances.
NdvRatios (numpy.array) – The ratio obtained by dividing the engine speed n by the vehicle speed v for each gear i form 1 to ng after apply the exclusion of first gear if is necessary.
NoOfGearsFinal (integer) – The number of forward gears after apply the exclusion of first gear if is necessary.
PowerCurvePowers (numpy.array) – Contains the power curve powers
- Returns:
-
determine_maximum_engine_speed
(EngineSpeedLimitVMax, Max95EngineSpeedFinal, PowerCurveEngineSpeeds, PowerCurvePowers, RatedEnginePowerF, NdvRatios, GearAtMaxVehicleSpeed, RequiredVehicleSpeeds, MaxVehicleSpeed, NoOfGearsFinal)[source]¶ Determine maximum engine speed (2g)
n_max1 = n_95_high
If n_95_high cannot be determined because the engine speed is limited to a lower value n_lim for all gears and the corresponding full load power is higher than 95 per cent of rated power, n_95_high shall be set to n_lim.
- Parameters:
EngineSpeedLimitVMax (float) – Annex 2, (2i) n_lim The maximum engine speed for the purpose of limiting maximum vehicle speed. (value 0 means unlimited vehicle speed)
Max95EngineSpeedFinal (float) – Annex 2 (2g) n_max1 = n_95_high adjusted If n_95_high cannot be determined because the engine speed is limited to a lower value n_lim for all gears and the corresponding full load power is higher than 95 per cent of rated power, n_95_high shall be set to n_lim.
PowerCurveEngineSpeeds (numpy.array) – Contains the power curve engine speeds
PowerCurvePowers (numpy.array) – Contains the power curve powers
RatedEnginePowerF (float) – Contains the rated engine power corrected if is necessary
NdvRatios (numpy.array) – The ratio obtained by dividing the engine speed n by the vehicle speed v for each gear i form 1 to ng after apply the exclusion of first gear if is necessary.
GearAtMaxVehicleSpeed (float) – The gear that have the maximum vehicle speed
RequiredVehicleSpeeds (numpy.array) – The vehicle speed required for the whole cycle re-sampled in 1Hz
MaxVehicleSpeed (float) – The maximum vehicle speed
NoOfGearsFinal (int) – The number of forward gears after apply the exclusion of first gear if is necessary.
- Returns:
- MaxEngineSpeed (
float
): The maximum engine speed
- MaxEngineSpeed (
- GearAtMaxVehicleSpeedFinal (
int
): Annex 2 (2i) ng_vmax The gear in which the maximum vehicle speed is reached.
- GearAtMaxVehicleSpeedFinal (
- MaxVehicleSpeedFinal (
float
): Annex 2 (2g, 2i) v_max,vehicle The maximum vehicle speed reachable using the gear in which the maximum vehicle speed can be reached.
- MaxVehicleSpeedFinal (
- EngineSpeedAtGearAtMaxRequiredSpeed (
float
): The engine speed at gear maximum required speed
- EngineSpeedAtGearAtMaxRequiredSpeed (
- EngineSpeedAtGearAtMaxVehicleSpeed (
float
): The engine speed at gear at maximum vehicle speed
- EngineSpeedAtGearAtMaxVehicleSpeed (
-
calculate_required_powers
(RequiredVehicleSpeeds, Accelerations, f0, f1, f2, VehicleTestMass)[source]¶ Calculate required powers (3.1)
- Parameters:
RequiredVehicleSpeeds (array) – The vehicle speed required for the whole cycle re-sampled in 1Hz
Accelerations (array) – The acceleration required for the whole cycle re-sampled in 1Hz
f0 (float) – The constant road load coefficient, i.e. independent of velocity, caused by internal frictional resistances.
f1 (float) – The linear road load coefficient, i.e. proportional to velocity, caused by tyres rolling resistances.
f2 (float) – The quadratic road load coefficient, i.e. quadratical to velocity, caused by aerodynamic resistances.
VehicleTestMass (float) – The test mass of the vehicle.
- Returns:
- requiredPowersF (
float
): Annex 2 (3.1) P_required,j The power required to overcome driving resistance and to accelerate for each second j of the cycle trace.
- requiredPowersF (
-
determine_possible_gears
(RequiredVehicleSpeeds, NdvRatios, TraceTimesCount, NoOfGearsFinal, PhaseValues, InStandStill, IdlingEngineSpeed, PhaseStarts, PHASE_ACCELERATION_FROM_STANDSTILL, Accelerations, MinDrives, GearAtMaxVehicleSpeedFinal, Max95EngineSpeedFinal, EngineSpeedAtGearAtMaxRequiredSpeed, PowerCurveEngineSpeeds, InDecelerationToStandstill)[source]¶ Determine possible gears based on required engine speeds (3.3)
- Parameters:
RequiredVehicleSpeeds (array) – The vehicle speed required for the whole cycle re-sampled in 1Hz
NdvRatios (array) – The ratio obtained by dividing the engine speed n by the vehicle speed v for each gear i form 1 to ng after apply the exclusion of first gear if is necessary.
TraceTimesCount (integer) – The length of trace times re-sampled in 1Hz
NoOfGearsFinal (integer) – The number of forward gears after apply the exclusion of first gear if is necessary.
PhaseValues (array) – Contains the points of changes phases
InStandStill (boolean array) – Contains the points that are in standstill phase as a True
IdlingEngineSpeed (float) – Annex 2 (2c) n_idle. The idling speed.
PhaseStarts (array) – Contains the points that are start point from a phase
PHASE_ACCELERATION_FROM_STANDSTILL (integer) – Acceleration phase following a standstill phase
Accelerations (array) – The acceleration required for the whole cycle re-sampled in 1Hz
MinDrives (array) – Samples which have acceleration values >= -0.1389 m/s² ( = 0.5 (km/h)/s ) shall belong to the acceleration/constant speed phases.
GearAtMaxVehicleSpeedFinal (integer) – Annex 2 (2i) ng_vmax The gear in which the maximum vehicle speed is reached.
Max95EngineSpeedFinal (float) – Annex 2 (2g) n_max1 = n_95_high adjusted If n_95_high cannot be determined because the engine speed is limited to a lower value n_lim for all gears and the corresponding full load power is higher than 95 per cent of rated power, n_95_high shall be set to n_lim.
EngineSpeedAtGearAtMaxRequiredSpeed (float) – The engine speed at gear maximum required speed
PowerCurveEngineSpeeds (array) – Contains the power curve engine speeds
InDecelerationToStandstill (boolean array) – The array that contains the seconds from deceleration to standstill as a True
- Returns:
- RequiredEngineSpeeds (
numpy.array
): Annex 2 (3.2) n_i,j The engine speeds required for each gear i from 1 to ng and for each second j of the cycle trace. .. note:: Note that this are the uncorrected values n_i,j
i.e. without the increments required by Annex 2 (3.3)
- RequiredEngineSpeeds (
- InitialRequiredEngineSpeeds (
numpy.array
): The initial engine speeds required for each gear i from 1 to ng and for each second j of the cycle trace.
- InitialRequiredEngineSpeeds (
- PossibleGearsByEngineSpeed (
boolean numpy.array
): The possible gear that can be used for each second.
- PossibleGearsByEngineSpeed (
- AccelerationFromStandstillStarts (
numpy.array
): The phase start seconds when the phase is going to acceleration from stand still.
- AccelerationFromStandstillStarts (
- ClutchDisengagedByGear (
numpy.array
): The clutch disengaged by each gear and each second.
- ClutchDisengagedByGear (
- ClutchUndefinedByGear (
boolean numpy.array
): The clutch undefined by each gear and each second.
- ClutchUndefinedByGear (
- ClutchDisengaged (
boolean numpy.array
): The clutch disengaged by each second.
- ClutchDisengaged (
- ClutchUndefined (
boolean numpy.array
): The clutch undefined by each second.
- ClutchUndefined (
- AdvancedClutchDisengage (
list
): The seconds in which the advanced clutch disengaget
- AdvancedClutchDisengage (
-
calculate_available_powers
(DefinedPowerCurveAdditionalSafetyMargins, RequiredEngineSpeeds, IdlingEngineSpeed, PowerCurveEngineSpeeds, SafetyMargin, PowerCurveASM, PowerCurvePowers, NoOfGearsFinal, InitialRequiredEngineSpeeds)[source]¶ Calculate available powers (3.4)
Additional safety margins defined together with the power curve take precedence over the legacy additional safety margins exponentially decaying from start to end engine speed
- Parameters:
DefinedPowerCurveAdditionalSafetyMargins (boolean) – Boolean that define if the additional save margins are present
RequiredEngineSpeeds (array) – Annex 2 (3.2) n_i,j The engine speeds required for each gear i from 1 to ng and for each second j of the cycle trace. Note that this are the uncorrected values n_i,j ie without the increments required by Annex 2 (3.3)
IdlingEngineSpeed (float) – Annex 2 (2c) n_idle. The idling speed.
PowerCurveEngineSpeeds (array) – Contains the power curve engine speeds
PowerCurveASM (array) – Contains the power curve additional save margin
PowerCurvePowers (array) – Contains the power curve powers
NoOfGearsFinal (integer) – The number of forward gears after apply the exclusion of first gear if is necessary.
InitialRequiredEngineSpeeds (array) – The initial engine speeds required for each gear i from 1 to ng and for each second j of the cycle trace.
- Returns:
- SafetyMargin (
float
): Annex 2 (3.4) SM. The safety margin is accounting for the difference between the stationary full load condition power curve and the power available during transition conditions. SM is set to 10 per cent.
- SafetyMargin (
- AvailablePowers (
numpy.array
): Annex 2 (3.4) P_available_i,j The power available for each gear i from 1 to ng and for each second j of the cycle trace. Note that this power values are determined from uncorrected values n_i,j i.e. without the engine speed increments required by Annex 2 (3.3)
- AvailablePowers (
- InitialAvailablePowers (
numpy.array
): Annex 2 (3.4) P_available_i,j (initials) The power available for each gear i from 1 to ng and for each second j of the cycle trace. Note that this power values are determined from uncorrected values n_i,j i.e. without the engine speed increments required by Annex 2 (3.3)
- InitialAvailablePowers (
-
determine_possible_gears_based_available_powers
(AvailablePowers, requiredPowersF, TraceTimesCount, NoOfGearsFinal, PossibleGearsByEngineSpeed)[source]¶ Determine possible gears based on available powers (3.5)
- Parameters:
AvailablePowers (array) – Annex 2 (3.4) P_available_i,j The power available for each gear i from 1 to ng and for each second j of the cycle trace. Note that this power values are determined from uncorrected values n_i,j i.e. without the engine speed increments required by Annex 2 (3.3)
requiredPowersF (array) – Annex 2 (3.1) P_required,j The power required to overcome driving resistance and to accelerate for each second j of the cycle trace.
TraceTimesCount (integer) – The length of trace times re-sampled in 1Hz
NoOfGearsFinal (integer) – The number of forward gears after apply the exclusion of first gear if is necessary.
- Returns:
- PossibleGearsByEngineSpeed (
boolean numpy.array
): The possible gear that can be used for each second.
- PossibleGearsByEngineSpeed (
- PossibleGearsByAvailablePowersWithTotalSafetyMargin (
boolean numpy.array
): The possible gears by available powers with total safety margin (following section 3.5 of Sub-Annex 2)
- PossibleGearsByAvailablePowersWithTotalSafetyMargin (
-
determine_initial_gears
(InStandStill, NoOfGearsFinal, PossibleGearsByEngineSpeed, PossibleGearsByAvailablePowersWithTotalSafetyMargin, AccelerationFromStandstillStarts, PhaseEnds, PhaseValues, PHASE_ACCELERATION_FROM_STANDSTILL, InitialRequiredEngineSpeeds, MinDrive1stTo2nd)[source]¶ Determine initial gears
- Parameters:
InStandStill (boolean array) – Contains the points that are in standstill phase as a True
NoOfGearsFinal (integer) – The number of forward gears after apply the exclusion of first gear if is necessary.
PossibleGearsByEngineSpeed (boolean array) – The possible gear that can be used for each second.
PossibleGearsByAvailablePowersWithTotalSafetyMargin (boolean array) – The possible gears by available powers with total safety margin (following section 3.5 of Sub-Annex 2)
AccelerationFromStandstillStarts (array) – The phase start seconds when the phase is going to acceleration from stand still.
PhaseEnds (array) – Contains the points that are end point from a phase
PhaseValues (array) – Contains the points of changes phases
PHASE_ACCELERATION_FROM_STANDSTILL (integer) – Acceleration phase following a standstill phase
InitialRequiredEngineSpeeds (array) – The initial engine speeds required for each gear i from 1 to ng and for each second j of the cycle trace.
MinDrive1stTo2nd (float) – Annex 2 (2ka) n_min_drive = 1.15 x n_idle for n_gear:1->2 The minimum engine speed for transitions from first to second gear. This is the maximum of calculated value and input parameter value.
- Returns:
- InitialGears (
numpy.array
): The initial gears calculated by each second
- InitialGears (
- PossibleGears (
numpy.array
): The possible gears calculated by each second
- PossibleGears (
-
apply_corrections
(InitialGears, PhaseValues, PhaseStarts, PhaseEnds, PHASE_ACCELERATION_FROM_STANDSTILL, PHASE_ACCELERATION, NoOfGearsFinal, PossibleGears, InAcceleration, InConstantSpeed, InAccelerationAnyDuration, ClutchDisengagedByGear, ClutchUndefinedByGear, PHASE_DECELERATION, PHASE_DECELERATION_TO_STANDSTILL, TraceTimesCount, RequiredVehicleSpeeds, SuppressGear0DuringDownshifts, ClutchDisengaged, InitialRequiredEngineSpeeds, IdlingEngineSpeed, Phases, InStandStill, InDecelerationToStandstill, InDeceleration)[source]¶ Apply corrections defined in section 4 of the sub-Annex 2
- Parameters:
InitialGears (array) – The initial gears calculated by each second
PhaseValues (array) – Contains the points of changes phases
PhaseStarts (array) – Contains the points that are start point from a phase
PhaseEnds (array) – Contains the points that are end point from a phase
PHASE_ACCELERATION_FROM_STANDSTILL (integer) – Acceleration phase following a standstill phase
PHASE_ACCELERATION (integer) – Acceleration phase
NoOfGearsFinal (integer) – The number of forward gears after apply the exclusion of first gear if is necessary.
PossibleGears (array) – The possible gears calculated by each second
InAcceleration (boolean array) – Contains the points that are in acceleration phase as a True
InConstantSpeed (boolean array) – Contains the points that are in constant speed phase as a True
InAccelerationAnyDuration (boolean array) – some gear corrections ignore the duration of acceleration phases so save acceleration phases with any duration here
ClutchDisengagedByGear (boolean array) – The clutch disengaged by each gear and each second.
ClutchUndefinedByGear (boolean array) – The clutch undefined by each gear and each second.
PHASE_DECELERATION (integer) –
- time period of more than 2 seconds with required vehicle
speed >= 1km/h and monotonically decreasing
PHASE_DECELERATION_TO_STANDSTILL (integer) – DECELERATION phase preceding a STANDSTILL phase
TraceTimesCount (integer) – The length of trace times re-sampled in 1Hz
RequiredVehicleSpeeds (array) – The vehicle speed required for the whole cycle re-sampled in 1Hz
SuppressGear0DuringDownshifts (boolean) – Sub-Annex 2 (4f).If a gear is used for only 1 second during a deceleration phase it shall be replaced by gear 0 with clutch disengaged, in order to avoid too high engine speeds. But if this is not an issue, the manufacturer may allow to use the lower gear of the following second directly instead of gear 0 for downshifts of up to 3 steps.
ClutchDisengaged (boolean array) – The clutch disengaged by each second.
InitialRequiredEngineSpeeds (array) – The initial engine speeds required for each gear i from 1 to ng and for each second j of the cycle trace.
IdlingEngineSpeed (float) – Annex 2 (2c) n_idle. The idling speed.
Phases (array) – The list of phases that are used during whole cycle
InStandStill (boolean array) – Contains the points that are in standstill phase as a True
InDecelerationToStandstill (boolean array) – The array that contains the seconds from deceleration to standstill as a True
InDeceleration (boolean array) – Contains the points that are in deceleration phase as a True
- Returns:
- InitialGearsFinal (
numpy.array
): The initial gears after apply corrections calculated by each second.
- InitialGearsFinal (
- CorrectionsCells (
numpy.array
): Array of gear correction strings for debugging. This contains a historic transformation of each gear during all execution and the transformation applied.
- CorrectionsCells (
- ClutchDisengagedByGearFinal (
boolean numpy.array
): The clutch disengaged by each gear and each second after apply corrections.
- ClutchDisengagedByGearFinal (
- ClutchUndefinedByGearFinal (
boolean numpy.array
): The clutch undefined by each gear and each second after apply corrections.
- ClutchUndefinedByGearFinal (
-
calculate_average_gear
(PhaseSum, InitialGearsFinal, RequiredVehicleSpeeds)[source]¶ Calculate average gear
- Parameters:
PhaseSum (boolean array) – The all phases that are different of standstill phase
InitialGearsFinal (array) – The initial gears after apply corrections calculated by each second.
RequiredVehicleSpeeds (array) – The vehicle speed required for the whole cycle re-sampled in 1Hz
- Returns:
- ChecksumVxGear (
float
): Checksum of v * gear for v >= 1 km/h rounded to four places of decimal
- ChecksumVxGear (
-
interleave_clutch
(TraceTimesCount, InitialGearsFinal, ClutchDisengagedByGearFinal, ClutchDisengaged, ClutchUndefinedByGearFinal, ClutchUndefined, AutomaticClutchOperation, InDeceleration, AdvancedClutchDisengage)[source]¶ Interleave the clutch Sub-Annex 2 (1.5)
Note
The prescriptions for the clutch operation shall not be applied if the clutch is operated automatically without the need of an engagement or disengagement of the driver.
- Parameters:
TraceTimesCount (integer) – The length of trace times re-sampled in 1Hz
InitialGearsFinal (array) – The initial gears after apply corrections calculated by each second.
ClutchDisengagedByGearFinal (boolean array) – The clutch disengaged by each gear and each second after apply corrections.
ClutchDisengaged (boolean array) – The clutch disengaged by each second.
ClutchUndefinedByGearFinal (boolean array) – The clutch undefined by each gear and each second after apply corrections.
ClutchUndefined (boolean array) – The clutch undefined by each second.
AutomaticClutchOperation (boolean) – Sub-Annex 2 (1.5) The prescriptions for the clutch operation shall not be applied if the clutch is operated automatically without the need of an engagement or disengagement of the driver.
InDeceleration (boolean array) – Contains the points that are in deceleration phase as a True
AdvancedClutchDisengage (list) – The seconds in which the advanced clutch disengage
- Return InitialGearsFinalAfterClutch:
The initial gears after apply corrections calculated by each second and the interleave clutch.
- Rtype InitialGearsFinalAfterClutch:
array
- Return ClutchDisengagedFinal:
The clutch disengaged by each second after apply the interleave clutch
- Rtype ClutchDisengagedFinal:
boolean array
- Return ClutchUndefinedFinal:
The clutch undefined by each second after apply the interleave clutch
- Rtype ClutchUndefinedFinal:
boolean array
-
remove_duplicate_gears
(InitialGearsFinalAfterClutch, ClutchUndefinedFinal, ClutchDisengagedFinal)[source]¶ Remove duplicate gears
- Parameters:
InitialGearsFinalAfterClutch (array) – The initial gears after apply corrections calculated by each second and the interleave clutch.
ClutchUndefinedFinal (boolean array) – The clutch undefined by each second after apply the interleave clutch
ClutchDisengagedFinal (boolean array) – The clutch disengaged by each second after apply the interleave clutch
- Returns:
- ClutchHST (
float
): Array of clutch state names as used by the Heinz Steven Tool (HST).
- ClutchHST (
- GearSequenceStarts (
numpy.array
): Array that contains the position of the gear sequence start for the different gears.
- GearSequenceStarts (
- GearSequenceStarts (
numpy.array
): The name of gear to used by each gear sequence starts.
- GearSequenceStarts (
Note
A clutch disengagement and a gear change cannot be indicated at the same time and the clutch disengagement will therefore be indicated one second earlier.
-
reduce_vehicle_speed_if_not_enough_power
(DefinedPowerCurveAdditionalSafetyMargins, PowerCurveEngineSpeeds, PowerCurvePowers, SafetyMargin, PowerCurveASM, IdlingEngineSpeed, RequiredEngineSpeeds, RequiredVehicleSpeeds, f0, f1, f2, VehicleTestMass, requiredPowersF, ClutchDisengagedFinal, ClutchUndefinedFinal, InitialGearsFinalAfterClutch, NoOfGearsFinal, AvailablePowers, NdvRatios)[source]¶ Reduce vehicle speed if not enough power is available
- Parameters:
DefinedPowerCurveAdditionalSafetyMargins (boolean) – Boolean that define if the additional save margins are present
PowerCurveEngineSpeeds (array) – Contains the power curve engine speeds
PowerCurvePowers (array) – Contains the power curve powers
SafetyMargin (float) – Annex 2 (3.4) SM The safety margin is accounting for the difference between the stationary full load condition power curve and the power available during transition conditions. SM is set to 10 per cent.
PowerCurveASM (array) – Contains the power curve additional save margin
IdlingEngineSpeed (float) – Annex 2 (2c) n_idle. The idling speed.
RequiredEngineSpeeds (array) – Annex 2 (3.2) n_i,j The engine speeds required for each gear i from 1 to ng and for each second j of the cycle trace. Note that this are the uncorrected values n_i,j ie without the increments required by Annex 2 (3.3)
RequiredVehicleSpeeds (array) – The vehicle speed required for the whole cycle re-sampled in 1Hz
f0 (float) – The constant road load coefficient, i.e. independent of velocity, caused by internal frictional resistances.
f1 (float) – The linear road load coefficient, i.e. proportional to velocity, caused by tyres rolling resistances.
f2 (float) – The quadratic road load coefficient, i.e. quadratical to velocity, caused by aerodynamic resistances.
VehicleTestMass (float) – The test mass of the vehicle.
requiredPowersF (array) – Annex 2 (3.1) P_required,j The power required to overcome driving resistance and to accelerate for each second j of the cycle trace.
ClutchDisengagedFinal (boolean array) – The clutch disengaged by each second after apply the interleave clutch
ClutchUndefinedFinal (boolean array) – The clutch undefined by each second after apply the interleave clutch
InitialGearsFinalAfterClutch (array) – The initial gears after apply corrections calculated by each second and the interleave clutch.
NoOfGearsFinal (integer) – The number of forward gears after apply the exclusion of first gear if is necessary.
AvailablePowers (array) – Annex 2 (3.4) P_available_i,j The power available for each gear i from 1 to ng and for each second j of the cycle trace. Note that this power values are determined from uncorrected values n_i,j i.e. without the engine speed increments required by Annex 2 (3.3)
NdvRatios (array) – The ratio obtained by dividing the engine speed n by the vehicle speed v for each gear i form 1 to ng after apply the exclusion of first gear if is necessary.
- Returns:
- AvailablePowersFinal (
numpy.array
): Annex 2 (3.4) P_available_i,j The power available for each gear i from 1 to ng and for each second j of the cycle trace, after check vehicle speed. Note that this power values are determined from uncorrected values n_i,j i.e. without the engine speed increments required by Annex 2 (3.3)
- AvailablePowersFinal (
-
generate_gears
(TraceTimes, GearSequenceStarts, GearNames, AverageGear, Max95EngineSpeedFinal, RequiredVehicleSpeeds, requiredPowersF, RequiredEngineSpeeds, PossibleGearsByEngineSpeed, AvailablePowersFinal, InitialRequiredEngineSpeeds, InitialAvailablePowers, FullPowerCurve, EngineSpeedAtGearAtMaxRequiredSpeed, EngineSpeedAtGearAtMaxVehicleSpeed, MaxEngineSpeed, MaxVehicleSpeedFinal, GearAtMaxVehicleSpeedFinal, MinDrive1st, MinDrive1stTo2nd, MinDrive2ndDecel, MinDrive2nd, MinDriveGreater2nd, InitialGearsFinalAfterClutch, ClutchDisengagedFinal, ClutchUndefinedFinal, ClutchHST, CorrectionsCells, ChecksumVxGear)[source]¶ Assign outputs in the final dictionary
- Parameters:
TraceTimes (array) – Times for each vehicle speed required re-sampled in 1Hz
GearSequenceStarts (array) – Array that contains the position of the gear sequence start for the different gears.
GearNames (array) – The name of gear to used by each gear sequence starts.
AverageGear (float) – Annex 2 (5) average gear In order to enable the assessment of the correctness of the calculation, the average gear for v >= 1 km/h, rounded to four places of decimal, shall be calculated and recorded.
Max95EngineSpeedFinal (float) – Annex 2 (2g) n_max1 = n_95_high adjusted If n_95_high cannot be determined because the engine speed is limited to a lower value n_lim for all gears and the corresponding full load power is higher than 95 per cent of rated power, n_95_high shall be set to n_lim.
RequiredVehicleSpeeds (array) – The vehicle speed required for the whole cycle re-sampled in 1Hz
requiredPowersF (array) – Annex 2 (3.1) P_required,j The power required to overcome driving resistance and to accelerate for each second j of the cycle trace.
RequiredEngineSpeeds (array) – Annex 2 (3.2) n_i,j The engine speeds required for each gear i from 1 to ng and for each second j of the cycle trace. Note that this are the uncorrected values n_i,j ie without the increments required by Annex 2 (3.3)
PossibleGearsByEngineSpeed (boolean array) – The possible gear that can be used for each second.
AvailablePowersFinal (array) – Annex 2 (3.4) P_available_i,j The power available for each gear i from 1 to ng and for each second j of the cycle trace, after check vehicle speed. Note that this power values are determined from uncorrected values n_i,j i.e. without the engine speed increments required by Annex 2 (3.3)
InitialRequiredEngineSpeeds (array) – The initial engine speeds required for each gear i from 1 to ng and for each second j of the cycle trace.
InitialAvailablePowers (array) – Annex 2 (3.4) P_available_i,j (initials) The power available for each gear i from 1 to ng and for each second j of the cycle trace. Note that this power values are determined from uncorrected values n_i,j i.e. without the engine speed increments required by Annex 2 (3.3)
FullPowerCurve (array) – Annex 2 (2h) and (3.4) n ==> P_wot(n), ASM The full load power curve over the engine speed range.
EngineSpeedAtGearAtMaxRequiredSpeed (float) – The engine speed at gear maximum required speed
EngineSpeedAtGearAtMaxVehicleSpeed (float) – The engine speed at gear at maximum vehicle speed
MaxEngineSpeed (float) – The maximum engine speed
MaxVehicleSpeedFinal (float) – Annex 2 (2g, 2i) v_max,vehicle The maximum vehicle speed reachable using the gear in which the maximum vehicle speed can be reached.
GearAtMaxVehicleSpeedFinal (integer) – Annex 2 (2i) ng_vmax The gear in which the maximum vehicle speed is reached.
MinDrive1st (float) – Annex 2 (2k) n_min_drive = n_idle for n_gear:1 The minimum engine speed when the vehicle is in motion. This is the maximum of calculated value and input parameter value.
MinDrive1stTo2nd (float) – Annex 2 (2ka) n_min_drive = 1.15 x n_idle for n_gear:1->2 The minimum engine speed for transitions from first to second gear. This is the maximum of calculated value and input parameter value.
MinDrive2ndDecel (float) – Annex 2 (2kb) n_min_drive = n_idle for n_gear:2 The minimum engine speed for decelerations to standstill in second gear. This is the maximum of calculated value and input parameter value.
MinDrive2nd (float) – Annex 2 (2kc) n_min_drive = 0.9 x n_idle for n_gear:2 The minimum engine speed for all other driving conditions in second gear. This is the maximum of calculated value and input parameter value.
MinDriveGreater2nd (float) – Annex 2 (2k) n_min_drive = n_idle + 0.125 × ( n_rated - n_idle ) for n_gear:3.. This value shall be referred to as n_min_drive_set. The minimum engine speed for all driving conditions in gears greater than 2. This is the maximum of calculated value and input parameter value.
InitialGearsFinalAfterClutch (array) – The initial gears after apply corrections calculated by each second and the interleave clutch.
ClutchDisengagedFinal (boolean array) – The clutch disengaged by each second after apply the interleave clutch
ClutchUndefinedFinal (boolean array) – The clutch undefined by each second after apply the interleave clutch
ClutchHST (array) – Array of clutch state names as used by the Heinz Steven Tool (HST).
CorrectionsCells (array) – Array of gear correction strings for debugging. This contains a historic transformation of each gear during all execution and the transformation applied.
ChecksumVxGear (float) – Checksum of v * gear for v >= 1 km/h rounded to four places of decimal.
- Returns:
- shift_points (
dict
): Dictionary that contains the all input parameters with the expected output format.
- shift_points (
Note
A clutch disengagement and a gear change cannot be indicated at the same time and the clutch disengagement will therefore be indicated one second earlier.