More untested transmission features (#4093)
* use ISS for gearbox ratio, add gauge for TC ratio * measure shift time * add shift time gauge, todo notes for pc * do conversion in the right direction * switch to Timer and seconds * try fixing build * try fixing build again * try defines, remove include * use shift pcs * add 3-2 pct curve * control 3-2 solenoid * move 3-2 to persistent config * fix param
This commit is contained in:
parent
53ccdbd59d
commit
49f8daae14
|
@ -176,6 +176,8 @@
|
|||
|
||||
#define EFI_VEHICLE_SPEED FALSE
|
||||
|
||||
#define EFI_TCU FALSE
|
||||
|
||||
#define EFI_ENGINE_EMULATOR TRUE
|
||||
|
||||
#define EFI_EMULATE_POSITION_SENSORS TRUE
|
||||
|
|
|
@ -161,6 +161,10 @@
|
|||
#define EFI_VEHICLE_SPEED FALSE
|
||||
#endif
|
||||
|
||||
#ifndef EFI_TCU
|
||||
#define EFI_TCU FALSE
|
||||
#endif
|
||||
|
||||
#ifndef EFI_ENGINE_EMULATOR
|
||||
#define EFI_ENGINE_EMULATOR FALSE
|
||||
#endif
|
||||
|
|
|
@ -170,6 +170,10 @@
|
|||
#define EFI_VEHICLE_SPEED TRUE
|
||||
#endif
|
||||
|
||||
#ifndef EFI_TCU
|
||||
#define EFI_TCU TRUE
|
||||
#endif
|
||||
|
||||
#ifndef EFI_ENGINE_EMULATOR
|
||||
#define EFI_ENGINE_EMULATOR TRUE
|
||||
#endif
|
||||
|
|
|
@ -243,6 +243,10 @@
|
|||
#define EFI_VEHICLE_SPEED TRUE
|
||||
#endif
|
||||
|
||||
#ifndef EFI_TCU
|
||||
#define EFI_TCU TRUE
|
||||
#endif
|
||||
|
||||
#ifndef EFI_ENGINE_EMULATOR
|
||||
#define EFI_ENGINE_EMULATOR TRUE
|
||||
#endif
|
||||
|
|
|
@ -280,7 +280,6 @@ uint16_t rpmAcceleration;dRPM;"RPM/s",1, 0, 0, 5, 0
|
|||
uint8_t tpsAccelFrom;;"%", 1, 0, 0, 100, 0
|
||||
uint8_t tpsAccelTo;;"%", 1, 0, 0, 100, 0
|
||||
|
||||
! we have some unused bytes to allow compatible TS changes
|
||||
float autoscale calibrationValue2;;"", 1, 0, 0, 0, 0
|
||||
bit isMainRelayOn;
|
||||
bit isUsbConnected;Original reason for this is to check if USB is connected from Lua
|
||||
|
@ -288,7 +287,13 @@ uint16_t rpmAcceleration;dRPM;"RPM/s",1, 0, 0, 5, 0
|
|||
int luaInvocationCounter;;"count",1, 0, 0, 0, 0
|
||||
int luaLastCycleDuration;;"nt",1, 0, 0, 0, 0
|
||||
uint8_t testBenchIter;;"count",1, 0, 0, 0, 0
|
||||
uint8_t[15 iterate] unusedInTheMiddle;;"",1, 0, 0, 0, 0
|
||||
uint8_t unusedWat
|
||||
|
||||
uint16_t autoscale tcRatio;@@GAUGE_NAME_TC_RATIO@@;"value",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 0
|
||||
float lastShiftTime;"S"
|
||||
|
||||
! we have some unused bytes to allow compatible TS changes
|
||||
uint8_t[8 iterate] unusedInTheMiddle;;"",1, 0, 0, 0, 0
|
||||
|
||||
int16_t autoscale auxLinear1;@@GAUGE_NAME_AUX_LINEAR_1@@;"", 0.01, 0, 0, 0, 0
|
||||
int16_t autoscale auxLinear2;@@GAUGE_NAME_AUX_LINEAR_2@@;"", 0.01, 0, 0, 0, 0
|
||||
|
|
|
@ -205,7 +205,10 @@ public:
|
|||
|
||||
cyclic_buffer<int> triggerErrorDetection;
|
||||
|
||||
#if EFI_TCU
|
||||
GearControllerBase *gearController;
|
||||
#endif
|
||||
|
||||
#if EFI_LAUNCH_CONTROL
|
||||
LaunchControlBase launchController;
|
||||
SoftSparkLimiter softSparkLimiter;
|
||||
|
|
|
@ -85,7 +85,12 @@ float GearDetector::computeGearboxRatio() const {
|
|||
return 0;
|
||||
}
|
||||
|
||||
auto engineRpm = Sensor::getOrZero(SensorType::Rpm);
|
||||
float engineRpm;
|
||||
if (Sensor::hasSensor(SensorType::InputShaftSpeed)) {
|
||||
engineRpm = Sensor::getOrZero(SensorType::InputShaftSpeed);
|
||||
} else {
|
||||
engineRpm = Sensor::getOrZero(SensorType::Rpm);
|
||||
}
|
||||
|
||||
// Convert to wheel RPM
|
||||
// km rev 1 hr
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "buttonshift.h"
|
||||
|
||||
#if EFI_TCU
|
||||
ButtonShiftController buttonShiftController;
|
||||
|
||||
ButtonShiftController::ButtonShiftController() :
|
||||
|
@ -83,3 +84,4 @@ void ButtonShiftController::update() {
|
|||
ButtonShiftController* getButtonShiftController() {
|
||||
return &buttonShiftController;
|
||||
}
|
||||
#endif // EFI_TCU
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "globalaccess.h"
|
||||
#include "debounce.h"
|
||||
|
||||
#if EFI_TCU
|
||||
class ButtonShiftController: public GearControllerBase {
|
||||
public:
|
||||
ButtonShiftController();
|
||||
|
@ -26,3 +27,4 @@ private:
|
|||
};
|
||||
|
||||
ButtonShiftController* getButtonShiftController();
|
||||
#endif // EFI_TCU
|
||||
|
|
|
@ -224,6 +224,7 @@ static void doPeriodicSlowCallback() {
|
|||
engine->periodicSlowCallback();
|
||||
#endif /* if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT */
|
||||
|
||||
#if EFI_TCU
|
||||
if (engineConfiguration->tcuEnabled && engineConfiguration->gearControllerMode != GearControllerMode::None) {
|
||||
if (engine->gearController == NULL) {
|
||||
initGearController();
|
||||
|
@ -232,6 +233,8 @@ static void doPeriodicSlowCallback() {
|
|||
}
|
||||
engine->gearController->update();
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void initPeriodicEvents() {
|
||||
|
@ -514,7 +517,9 @@ void commonInitEngineController() {
|
|||
startIdleThread();
|
||||
#endif /* EFI_IDLE_CONTROL */
|
||||
|
||||
#if EFI_TCU
|
||||
initGearController();
|
||||
#endif
|
||||
|
||||
initButtonDebounce();
|
||||
initStartStopButton();
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "gear_controller.h"
|
||||
|
||||
#if EFI_TCU
|
||||
void GearControllerBase::init() {
|
||||
initTransmissionController();
|
||||
}
|
||||
|
@ -60,3 +61,4 @@ void initGearController() {
|
|||
}
|
||||
engine->gearController->init();
|
||||
}
|
||||
#endif // EFI_TCU
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "simple_tcu.h"
|
||||
#include "tc_4l6x.h"
|
||||
|
||||
#if EFI_TCU
|
||||
class GearControllerBase {
|
||||
public:
|
||||
virtual void update();
|
||||
|
@ -26,3 +27,4 @@ private:
|
|||
};
|
||||
|
||||
void initGearController();
|
||||
#endif // EFI_TCU
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "simple_tcu.h"
|
||||
|
||||
#if EFI_TCU
|
||||
SimpleTransmissionController simpleTransmissionController;
|
||||
|
||||
void SimpleTransmissionController::init() {
|
||||
|
@ -17,7 +18,6 @@ void SimpleTransmissionController::update(gear_e gear) {
|
|||
#endif
|
||||
}
|
||||
setCurrentGear(gear);
|
||||
postState();
|
||||
|
||||
#if EFI_TUNER_STUDIO
|
||||
if (engineConfiguration->debugMode == DBG_TCU) {
|
||||
|
@ -28,8 +28,11 @@ void SimpleTransmissionController::update(gear_e gear) {
|
|||
engine->outputChannels.debugIntField5 = config->tcuSolenoidTable[static_cast<int>(gear) + 1][4];
|
||||
}
|
||||
#endif
|
||||
|
||||
TransmissionControllerBase::update(gear);
|
||||
}
|
||||
|
||||
SimpleTransmissionController* getSimpleTransmissionController() {
|
||||
return &simpleTransmissionController;
|
||||
}
|
||||
#endif // EFI_TCU
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "tcu.h"
|
||||
|
||||
#if EFI_TCU
|
||||
class SimpleTransmissionController: public TransmissionControllerBase {
|
||||
public:
|
||||
void update(gear_e);
|
||||
|
@ -14,3 +15,4 @@ public:
|
|||
};
|
||||
|
||||
SimpleTransmissionController* getSimpleTransmissionController();
|
||||
#endif // EFI_TCU
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "tc_4l6x.h"
|
||||
|
||||
#if EFI_TCU
|
||||
Gm4l6xTransmissionController gm4l6xTransmissionController;
|
||||
static SimplePwm tccPwm("TCC Control");
|
||||
static SimplePwm pcPwm("Pressure Control");
|
||||
|
@ -39,7 +40,7 @@ void Gm4l6xTransmissionController::update(gear_e gear) {
|
|||
setCurrentGear(gear);
|
||||
setTccState();
|
||||
setPcState(gear);
|
||||
postState();
|
||||
set32State(gear);
|
||||
|
||||
#if EFI_TUNER_STUDIO
|
||||
if (engineConfiguration->debugMode == DBG_TCU) {
|
||||
|
@ -50,6 +51,14 @@ void Gm4l6xTransmissionController::update(gear_e gear) {
|
|||
engine->outputChannels.debugIntField5 = config->tcuSolenoidTable[static_cast<int>(gear) + 1][4];
|
||||
}
|
||||
#endif
|
||||
|
||||
TransmissionControllerBase::update(gear);
|
||||
|
||||
float time = isShiftCompleted();
|
||||
if (time != 0) {
|
||||
engine->outputChannels.lastShiftTime = time;
|
||||
isShifting = false;
|
||||
}
|
||||
}
|
||||
|
||||
gear_e Gm4l6xTransmissionController::setCurrentGear(gear_e gear) {
|
||||
|
@ -63,6 +72,7 @@ gear_e Gm4l6xTransmissionController::setCurrentGear(gear_e gear) {
|
|||
enginePins.tcuSolenoids[i].setValue(config->tcuSolenoidTable[static_cast<int>(gear) + 1][i]);
|
||||
#endif
|
||||
}
|
||||
measureShiftTime(gear);
|
||||
return getCurrentGear();
|
||||
}
|
||||
|
||||
|
@ -86,9 +96,11 @@ void Gm4l6xTransmissionController::setTccState() {
|
|||
}
|
||||
|
||||
void Gm4l6xTransmissionController::setPcState(gear_e gear) {
|
||||
if (gear != getCurrentGear()) {
|
||||
}
|
||||
uint8_t (*pcts)[sizeof(config->tcu_pcAirmassBins)/sizeof(config->tcu_pcAirmassBins[0])];
|
||||
if (gear != getCurrentGear()) {
|
||||
shiftingFrom = getCurrentGear();
|
||||
isShifting = true;
|
||||
}
|
||||
switch (getCurrentGear()) {
|
||||
case REVERSE:
|
||||
pcts = &config->tcu_pcValsR;
|
||||
|
@ -97,22 +109,53 @@ void Gm4l6xTransmissionController::setPcState(gear_e gear) {
|
|||
pcts = &config->tcu_pcValsN;
|
||||
break;
|
||||
case GEAR_1:
|
||||
pcts = &config->tcu_pcValsR;
|
||||
if (isShifting && shiftingFrom == GEAR_2) {
|
||||
pcts = &config->tcu_pcVals21;
|
||||
} else {
|
||||
pcts = &config->tcu_pcVals1;
|
||||
}
|
||||
break;
|
||||
case GEAR_2:
|
||||
pcts = &config->tcu_pcValsR;
|
||||
if (isShifting && shiftingFrom == GEAR_1) {
|
||||
pcts = &config->tcu_pcVals12;
|
||||
} else if (isShifting && shiftingFrom == GEAR_3) {
|
||||
pcts = &config->tcu_pcVals32;
|
||||
} else {
|
||||
pcts = &config->tcu_pcVals2;
|
||||
}
|
||||
break;
|
||||
case GEAR_3:
|
||||
pcts = &config->tcu_pcValsR;
|
||||
if (isShifting && shiftingFrom == GEAR_2) {
|
||||
pcts = &config->tcu_pcVals23;
|
||||
} else if (isShifting && shiftingFrom == GEAR_4) {
|
||||
pcts = &config->tcu_pcVals43;
|
||||
} else {
|
||||
pcts = &config->tcu_pcVals3;
|
||||
}
|
||||
break;
|
||||
case GEAR_4:
|
||||
pcts = &config->tcu_pcValsR;
|
||||
pcts = &config->tcu_pcVals4;
|
||||
break;
|
||||
}
|
||||
int pct = interpolate2d(engine->engineState.sd.airMassInOneCylinder, config->tcu_pcAirmassBins, *pcts);
|
||||
pcPwm.setSimplePwmDutyCycle(pct*0.01);
|
||||
}
|
||||
|
||||
void Gm4l6xTransmissionController::set32State(gear_e gear) {
|
||||
if (isShifting && shiftingFrom == GEAR_3 && gear == GEAR_2) {
|
||||
auto vss = Sensor::get(SensorType::VehicleSpeed);
|
||||
if (!vss.Valid) {
|
||||
return;
|
||||
}
|
||||
uint8_t (*pcts)[sizeof(config->tcu_32SpeedBins)/sizeof(config->tcu_32SpeedBins[0])];
|
||||
int pct = interpolate2d(vss.Value, config->tcu_32SpeedBins, config->tcu_32Vals);
|
||||
shift32Pwm.setSimplePwmDutyCycle(pct*0.01);
|
||||
} else {
|
||||
shift32Pwm.setSimplePwmDutyCycle(0);
|
||||
}
|
||||
}
|
||||
|
||||
Gm4l6xTransmissionController* getGm4l6xTransmissionController() {
|
||||
return &gm4l6xTransmissionController;
|
||||
}
|
||||
#endif // EFI_TCU
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "tcu.h"
|
||||
|
||||
#if EFI_TCU
|
||||
class Gm4l6xTransmissionController: public TransmissionControllerBase {
|
||||
public:
|
||||
void update(gear_e);
|
||||
|
@ -13,6 +14,10 @@ private:
|
|||
gear_e setCurrentGear(gear_e gear);
|
||||
void setTccState();
|
||||
void setPcState(gear_e gear);
|
||||
void set32State(gear_e gear);
|
||||
bool isShifting = false;
|
||||
gear_e shiftingFrom;
|
||||
};
|
||||
|
||||
Gm4l6xTransmissionController* getGm4l6xTransmissionController();
|
||||
#endif // EFI_TCU
|
||||
|
|
|
@ -9,13 +9,14 @@
|
|||
#include "pch.h"
|
||||
|
||||
#include "tcu.h"
|
||||
#include "engine.h"
|
||||
|
||||
#if EFI_TCU
|
||||
void TransmissionControllerBase::init() {
|
||||
}
|
||||
|
||||
void TransmissionControllerBase::update(gear_e gear) {
|
||||
setCurrentGear(gear);
|
||||
postState();
|
||||
postState();
|
||||
}
|
||||
|
||||
gear_e TransmissionControllerBase::setCurrentGear(gear_e gear) {
|
||||
|
@ -32,3 +33,19 @@ void TransmissionControllerBase::postState() {
|
|||
engine->outputChannels.tcuCurrentGear = getCurrentGear();
|
||||
#endif
|
||||
}
|
||||
|
||||
void TransmissionControllerBase::measureShiftTime(gear_e gear) {
|
||||
m_shiftTime = true;
|
||||
m_shiftTimer.reset();
|
||||
m_shiftTimeGear = gear;
|
||||
}
|
||||
|
||||
float TransmissionControllerBase::isShiftCompleted() {
|
||||
if (m_shiftTime && m_shiftTimeGear == engine->module<GearDetector>()->getCurrentGear()) {
|
||||
m_shiftTime = false;
|
||||
return m_shiftTimer.getElapsedSeconds();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif // EFI_TCU
|
||||
|
|
|
@ -12,8 +12,14 @@
|
|||
#include "persistent_configuration.h"
|
||||
#include "engine_configuration_generated_structures.h"
|
||||
#include "globalaccess.h"
|
||||
#include "timer.h"
|
||||
|
||||
#if EFI_TCU
|
||||
class TransmissionControllerBase {
|
||||
private:
|
||||
Timer m_shiftTimer;
|
||||
bool m_shiftTime;
|
||||
gear_e m_shiftTimeGear;
|
||||
public:
|
||||
virtual void update(gear_e);
|
||||
virtual void init();
|
||||
|
@ -25,4 +31,7 @@ protected:
|
|||
gear_e currentGear = NEUTRAL;
|
||||
virtual gear_e setCurrentGear(gear_e);
|
||||
void postState();
|
||||
void measureShiftTime(gear_e);
|
||||
float isShiftCompleted();
|
||||
};
|
||||
#endif // EFI_TCU
|
||||
|
|
|
@ -1728,6 +1728,9 @@ uint8_t[8] tcu_tccTpsBins;;"TPS", 1, 0, 0, 255, 0
|
|||
uint8_t[8] tcu_tccLockSpeed;;"MPH", 1, 0, 0, 255, 0
|
||||
uint8_t[8] tcu_tccUnlockSpeed;;"MPH", 1, 0, 0, 255, 0
|
||||
|
||||
uint8_t[8] tcu_32SpeedBins;;"KPH", 1, 0, 0, 255, 0
|
||||
uint8_t[8] tcu_32Vals;;"%", 1, 0, 0, 255, 0
|
||||
|
||||
end_struct
|
||||
|
||||
! Pedal Position Sensor
|
||||
|
@ -1752,6 +1755,7 @@ end_struct
|
|||
#define GAUGE_NAME_DESIRED_GEAR "Desired Gear"
|
||||
#define GAUGE_NAME_CURRENT_GEAR "Current Gear"
|
||||
#define GAUGE_NAME_ISS "Input Shaft Speed"
|
||||
#define GAUGE_NAME_TC_RATIO "Torque Converter Ratio"
|
||||
|
||||
#define GAUGE_NAME_TIMING_ADVANCE "timing"
|
||||
#define GAUGE_NAME_VVS "Vehicle Speed"
|
||||
|
|
|
@ -684,6 +684,13 @@ curve = pcPerShiftCurve, "Transmission Line Pressure Control - Shift"
|
|||
lineLabel = "3->2%"
|
||||
lineLabel = "4->3%"
|
||||
|
||||
curve = 32Curve, "3-2 Shift Solenoid Percent by Speed"
|
||||
columnLabel = "Speed", "%"
|
||||
xAxis = 0, 200, 20
|
||||
yAxis = 0, 100, 10
|
||||
xBins = tcu_32SpeedBins, vehicleSpeedKph
|
||||
yBins = tcu_32Vals
|
||||
|
||||
[TableEditor]
|
||||
; table_id, map3d_id, "title", page
|
||||
|
||||
|
@ -1214,7 +1221,9 @@ gaugeCategory = Transmission
|
|||
currentGearGauge = tcuCurrentGear, @@GAUGE_NAME_CURRENT_GEAR@@, "gear", -1, 10, -1, -1, 10, 10, 0, 0
|
||||
detectedGearGauge = detectedGear, @@GAUGE_NAME_DETECTED_GEAR@@, "gear", 0, @@GEARS_COUNT@@, 0, 0, @@GEARS_COUNT@@, @@GEARS_COUNT@@, 0, 0
|
||||
speedToRpmRatioGauge = speedToRpmRatio, @@GAUGE_NAME_GEAR_RATIO@@, "", 0, 100, 0, 0, 100, 100, 4, 4
|
||||
ISSGauge = ISSValue, @@GAUGE_NAME_ISS@@, "RPM", 0, {rpmHardLimit + 2000}, 200, {cranking_rpm}, {rpmHardLimit - 500}, {rpmHardLimit}, 0, 0
|
||||
ISSGauge = ISSValue, @@GAUGE_NAME_ISS@@, "RPM", 0, {rpmHardLimit + 2000}, 200, {cranking_rpm}, {rpmHardLimit - 500}, {rpmHardLimit}, 0, 0
|
||||
tcRatioGauge = tcRatio, @@GAUGE_NAME_TC_RATIO@@, "", 0, 100, 0, 0, 100, 100, 4, 4
|
||||
shiftTimeGauge = lastShiftTime, "Last Shift Time", "S", 0, 2, 0, 0, 2, 2, 4, 4
|
||||
|
||||
gaugeCategory = Knock
|
||||
knock1Gauge = knock1, "Knock Cyl 1", "dBv", -60, 10, -60, -60, 10, 10, 0, 0
|
||||
|
@ -1549,6 +1558,7 @@ menuDialog = main
|
|||
subMenu = tccCurves, "TCC Lock/Unlock Speed"
|
||||
subMenu = pcPerGearDialog, "Line Pressure Per Gear"
|
||||
subMenu = pcPerShiftDialog, "Line Pressure Per Shift"
|
||||
subMenu = 32Dialog, "3-2 Shift Solenoid Percent by Speed"
|
||||
|
||||
menu = "&Sensors"
|
||||
# Base analog input settings
|
||||
|
@ -3512,6 +3522,9 @@ dialog = tcuControls, "Transmission Settings"
|
|||
dialog = pcPerShiftDialog, "Line Pressure Per Shift"
|
||||
panel = pcPerShiftCurve
|
||||
|
||||
dialog = 32Dialog, "3-2 Shift Solenoid Percent by Speed"
|
||||
panel = 32Curve
|
||||
|
||||
;Boost Open Loop
|
||||
|
||||
dialog = boostDialog, ""
|
||||
|
|
Loading…
Reference in New Issue