15#if defined(HAS_OS_ACCESS)
16#error "Unexpected OS ACCESS HERE"
37 pid_s*
const pidParams
64 if (!previousConfig || !
m_pid.
isSame(&previousConfig->boostPid)) {
100#if EFI_ENGINE_CONTROL
102 for (
size_t i = 0; i < efi::size(
config->boostClosedLoopBlends); i++) {
110 target += result.Value;
117 if (temperatureAdder.has_value()) {
118 target += temperatureAdder.value();
143#if EFI_ENGINE_CONTROL
145 for (
size_t i = 0; i < efi::size(
config->boostOpenLoopBlends); i++) {
153 openLoop += result.Value;
159 float gearAdder =
engineConfiguration->gearBasedOpenLoopBoostAdder[
static_cast<int>(gear) + 1];
160 openLoop += gearAdder;
193 return m_pid.
getOutput(target, manifoldPressure, FAST_CALLBACK_PERIOD_MS / 1000.0f);
202 if (cltBoostMultiplier.has_value()) {
203 result *= cltBoostMultiplier.value();
206 if (iatBoostMultiplier.has_value()) {
207 result *= iatBoostMultiplier.value();
215 if (iatBoostAdder.has_value()) {
216 if (result.has_value()) {
217 result.value() += iatBoostAdder.value();
219 result = iatBoostAdder;
230 if (temperature.Valid) {
231 const std::optional<float> boostCorrection = correctionCurve.
getValue(temperature.Value);
232 if (boostCorrection.has_value()) {
233 return std::make_optional<float>(boostCorrection.value());
268#if EFI_ELECTRONIC_THROTTLE_BODY
311 for (
int loadIndex = 0; loadIndex < BOOST_LOAD_COUNT; loadIndex++) {
312 for (
int rpmIndex = 0; rpmIndex < BOOST_RPM_COUNT; rpmIndex++) {
313 config->boostTableClosedLoop[loadIndex][rpmIndex] = (
float)
config->boostClosedLoopLoadBins[loadIndex];
353 bool hasAnyEtbWastegate =
false;
366 boostMapOpen.initTable(
config->boostTableOpenLoop,
config->boostRpmBins,
config->boostOpenLoopLoadBins);
367 boostMapClosed.initTable(
config->boostTableClosedLoop,
config->boostRpmBins,
config->boostClosedLoopLoadBins);
368 boostCltCorr.initTable(
config->cltBoostCorr,
config->cltBoostCorrBins);
369 boostIatCorr.initTable(
config->iatBoostCorr,
config->iatBoostCorrBins);
370 boostCltAdder.initTable(
config->cltBoostAdder,
config->cltBoostAdderBins);
371 boostIatAdder.initTable(
config->iatBoostAdder,
config->iatBoostAdderBins);
void setDefaultBoostParameters()
bool isBoostControlSolenoidMode()
const ValueProvider3D * m_closedLoopTargetMap
const ValueProvider2D * m_cltBoostCorrMap
expected< percent_t > getClosedLoop(float target, float manifoldPressure) override
void setOutput(expected< percent_t > outputValue) override
const ValueProvider2D * m_iatBoostCorrMap
float getBoostControlDutyCycleWithTemperatureCorrections(const float rpm, const float driverIntent) const
percent_t getClosedLoopImpl(float target, float manifoldPressure)
std::optional< float > getBoostControlTargetTemperatureAdder() const
void setDefaultConfiguration() override
std::optional< float > getBoostTemperatureCorrection(const SensorType sensorType, const ValueProvider2D &correctionCurve) const
const ValueProvider2D * m_iatBoostAdderMap
const ValueProvider3D * m_openLoopMap
expected< percent_t > getOpenLoop(float target) override
const ValueProvider2D * m_cltBoostAdderMap
expected< float > getSetpoint() override
void onConfigurationChange(engine_configuration_s const *previousConfig) override
expected< float > observePlant() override
void init(IPwm *const pmw, const ValueProvider3D *const openLoopMap, const ValueProvider3D *const closedLoopTargetMap, const ValueProvider2D &cltMultiplierProvider, const ValueProvider2D &iatMultiplierProvider, const ValueProvider2D &cltAdderProvider, const ValueProvider2D &iatAdderProvider, pid_s *const pidParams)
void onFastCallback() override
SingleTimerExecutor scheduler
TunerStudioOutputChannels outputChannels
constexpr auto & module()
RegisteredOutputPin boostPin
bool isSame(const pid_s *parameters) const
void postState(pid_status_s &pidStatus) const
void initPidClass(pid_s *parameters)
float getOutput(float target, float input)
virtual SensorResult get() const =0
static float getOrZero(SensorType type)
virtual std::optional< float > getValue(float x) const =0
virtual float getValue(float xColumn, float yRow) const =0
void setEtbWastegatePosition(percent_t pos)
static EngineAccessor engine
static constexpr persistent_config_s * config
static constexpr engine_configuration_s * engineConfiguration
BlendResult calculateBlend(blend_table_s &cfg, float rpm, float load)
expected< float > readGppwmChannel(gppwm_channel_e channel)
static ProxySensor driverIntent(SensorType::DriverThrottleIntent)
UNUSED(samplingTimeSeconds)
@ OBD_PCM_Processor_Fault
bool isBrainPinValid(brain_pin_e brainPin)
void startSimplePwm(SimplePwm *state, const char *msg, Scheduler *executor, OutputPin *output, float frequency, float dutyCycle, pwm_gen_callback *callback)
expected< float > SensorResult
virtual void setSimplePwmDutyCycle(float dutyCycle)=0
scaled_channel< int16_t, 30, 1 > boostControlTarget
bool isBelowClosedLoopThreshold
scaled_channel< int16_t, 10, 1 > openLoopYAxis
scaled_channel< int16_t, 100, 1 > boostOutput
scaled_channel< int8_t, 2, 1 > boostControllerClosedLoopPart
scaled_channel< int16_t, 2, 1 > luaTargetAdd
scaled_channel< int16_t, 10, 1 > boostClosedLoopBlendYAxis[BOOST_BLEND_COUNT]
scaled_channel< int16_t, 10, 1 > boostClosedLoopBlendParameter[BOOST_BLEND_COUNT]
scaled_channel< uint8_t, 2, 1 > boostClosedLoopBlendBias[BOOST_BLEND_COUNT]
scaled_channel< int16_t, 10, 1 > boostOpenLoopBlendParameter[BOOST_BLEND_COUNT]
scaled_channel< int16_t, 10, 1 > boostClosedLoopBlendOutput[BOOST_BLEND_COUNT]
scaled_channel< uint8_t, 2, 1 > boostOpenLoopBlendBias[BOOST_BLEND_COUNT]
int8_t boostOpenLoopBlendOutput[BOOST_BLEND_COUNT]
scaled_channel< int16_t, 10, 1 > boostOpenLoopBlendYAxis[BOOST_BLEND_COUNT]
void setRpmTableBin(TValue(&array)[TSize])
void setLinearCurve(TValue(&array)[TSize], float from, float to, float precision=0.01f)