h-bridge wastegate not alive on bench #4965

more live data
This commit is contained in:
rusefillc 2023-01-16 20:50:45 -05:00
parent d9f284453b
commit 3e81c82ff5
3 changed files with 14 additions and 23 deletions

View File

@ -284,9 +284,6 @@ uint16_t rpmAcceleration;dRPM;"RPM/s",1, 0, 0, 5, 2
bit dfcoActive
bit tpsAccelActive
uint8_t autoscale boostControllerOutput;@@GAUGE_NAME_BOOST_OUTPUT@@;"%", 0.5, 0, 0, 100, 1
uint8_t autoscale boostControllerOpenLoopPart;@@GAUGE_NAME_BOOST_OPEN_LOOP@@;"%", 0.5, 0, 0, 100, 1
uint16_t autoscale fallbackMap;;"kPa", 0.1, 0, 0, 1000, 1
uint16_t autoscale instantMAPValue;Instant MAP;"kPa",{1/@@PACK_MULT_PRESSURE@@}, 0, 0, 655, 2

View File

@ -58,8 +58,8 @@ expected<float> BoostController::getSetpoint() {
float rpm = Sensor::getOrZero(SensorType::Rpm);
auto tps = Sensor::get(SensorType::DriverThrottleIntent);
isTpsInvalid = !tps.Valid;
auto driverIntent = Sensor::get(SensorType::DriverThrottleIntent);
isTpsInvalid = !driverIntent.Valid;
if (isTpsInvalid) {
return unexpected;
@ -67,7 +67,7 @@ expected<float> BoostController::getSetpoint() {
efiAssert(OBD_PCM_Processor_Fault, m_closedLoopTargetMap != nullptr, "boost closed loop target", unexpected);
return m_closedLoopTargetMap->getValue(rpm, tps.Value) * luaTargetMult + luaTargetAdd;
return m_closedLoopTargetMap->getValue(rpm, driverIntent.Value) * luaTargetMult + luaTargetAdd;
}
expected<percent_t> BoostController::getOpenLoop(float target) {
@ -87,11 +87,6 @@ expected<percent_t> BoostController::getOpenLoop(float target) {
openLoopPart = luaOpenLoopAdd + m_openLoopMap->getValue(rpm, tps.Value);
#if EFI_TUNER_STUDIO
// todo: why do we still copy this data point?
engine->outputChannels.boostControllerOpenLoopPart = openLoopPart;
#endif
return openLoopPart;
}
@ -136,18 +131,14 @@ expected<percent_t> BoostController::getClosedLoop(float target, float manifoldP
}
void BoostController::setOutput(expected<float> output) {
percent_t percent = output.value_or(engineConfiguration->boostControlSafeDutyCycle);
boostOutput = output.value_or(engineConfiguration->boostControlSafeDutyCycle);
if (!engineConfiguration->isBoostControlEnabled) {
// If not enabled, force 0% output
percent = 0;
boostOutput = 0;
}
#if EFI_TUNER_STUDIO
engine->outputChannels.boostControllerOutput = percent;
#endif /* EFI_TUNER_STUDIO */
float duty = PERCENT_TO_DUTY(percent);
float duty = PERCENT_TO_DUTY(boostOutput);
if (m_pwm) {
m_pwm->setSimplePwmDutyCycle(duty);
@ -155,16 +146,16 @@ void BoostController::setOutput(expected<float> output) {
// inject wastegate position into DC controllers, pretty weird workflow to be honest
// todo: should it be DC controller pulling?
setEtbWastegatePosition(percent);
setEtbWastegatePosition(boostOutput);
}
void BoostController::update() {
m_pid.iTermMin = -50;
m_pid.iTermMax = 50;
bool rpmTooLow = Sensor::getOrZero(SensorType::Rpm) < engineConfiguration->boostControlMinRpm;
bool tpsTooLow = Sensor::getOrZero(SensorType::Tps1) < engineConfiguration->boostControlMinTps;
bool mapTooLow = Sensor::getOrZero(SensorType::Map) < engineConfiguration->boostControlMinMap;
rpmTooLow = Sensor::getOrZero(SensorType::Rpm) < engineConfiguration->boostControlMinRpm;
tpsTooLow = Sensor::getOrZero(SensorType::Tps1) < engineConfiguration->boostControlMinTps;
mapTooLow = Sensor::getOrZero(SensorType::Map) < engineConfiguration->boostControlMinMap;
if (rpmTooLow || tpsTooLow || mapTooLow) {
// Passing unexpected will use the safe duty cycle configured by the user

View File

@ -6,9 +6,12 @@ bit isBelowClosedLoopThreshold;
bit isNotClosedLoop;
bit isZeroRpm
bit hasInitBoost
bit rpmTooLow
bit tpsTooLow
bit mapTooLow
int16_t autoscale luaTargetAdd;"Boost: Lua Target Add";"v", 0.5,0, -100,100, 1, @@GAUGE_CATEGORY_BOOST_CONTROL@@
int16_t autoscale boostOutput;"Boost: Output";"v", 0.5,0, -100,100, 1, @@GAUGE_CATEGORY_BOOST_CONTROL@@
int16_t autoscale boostOutput;"Boost: Output";"percent", 0.01,0, -100,100, 2, @@GAUGE_CATEGORY_BOOST_CONTROL@@
float luaTargetMult
float openLoopPart;