rusEFI
The most advanced open source ECU
|
#include <efi_pid.h>
Public Member Functions | |
Pid () | |
Pid (pid_s *parameters) | |
void | initPidClass (pid_s *parameters) |
bool | isSame (const pid_s *parameters) const |
float | getOutput (float target, float input) |
virtual float | getOutput (float target, float input, float dTime) |
float | getUnclampedOutput (float target, float input, float dTime) |
void | updateFactors (float pFactor, float iFactor, float dFactor) |
virtual void | reset () |
float | getP () const |
float | getI () const |
float | getD () const |
float | getOffset () const |
float | getMinValue () const |
float | getIntegration (void) const |
float | getPrevError (void) const |
void | setErrorAmplification (float coef) |
void | postState (pid_status_s &pidStatus) const |
void | showPidStatus (const char *msg) const |
void | sleep () |
Data Fields | |
int | resetCounter |
float | iTermMin = -1000000.0 |
float | iTermMax = 1000000.0 |
![]() | |
float | iTerm = (float)0 |
float | dTerm = (float)0 |
float | target = (float)0 |
float | input = (float)0 |
float | output = (float)0 |
float | errorAmplificationCoef = (float)0 |
float | previousError = (float)0 |
Protected Member Functions | |
virtual void | updateITerm (float value) |
Protected Attributes | |
pid_s * | parameters = nullptr |
default basic implementation also known as PidParallelController
Pid::Pid | ( | ) |
|
explicit |
float Pid::getD | ( | ) | const |
Definition at line 126 of file efi_pid.cpp.
float Pid::getI | ( | ) | const |
Definition at line 114 of file efi_pid.cpp.
float Pid::getIntegration | ( | void | ) | const |
Definition at line 122 of file efi_pid.cpp.
float Pid::getMinValue | ( | void | ) | const |
Definition at line 134 of file efi_pid.cpp.
Referenced by getOutput(), and PidIndustrial::limitOutput().
float Pid::getOffset | ( | void | ) | const |
Definition at line 130 of file efi_pid.cpp.
Referenced by PidIndustrial::getOutput(), getUnclampedOutput(), and showPidStatus().
This version of the method takes dTime from pid_s
Controller | input / process output |
Controller | input / process output |
Definition at line 56 of file efi_pid.cpp.
Referenced by LuaPid::get(), VvtController::getClosedLoop(), AlternatorController::getClosedLoop(), EtbController::getClosedLoop(), BoostController::getClosedLoopImpl(), IdleController::getIdleTimingAdjustment(), and getOutput().
dTime | seconds probably? :) |
Reimplemented in PidCic, PidIndustrial, PidCic, and PidIndustrial.
Definition at line 84 of file efi_pid.cpp.
float Pid::getP | ( | ) | const |
Definition at line 110 of file efi_pid.cpp.
float Pid::getPrevError | ( | void | ) | const |
Definition at line 118 of file efi_pid.cpp.
Definition at line 62 of file efi_pid.cpp.
Referenced by getOutput(), and PidCic::getOutput().
void Pid::initPidClass | ( | pid_s * | parameters | ) |
Definition at line 24 of file efi_pid.cpp.
Referenced by AlternatorController::AlternatorController(), IdleController::init(), VvtController::init(), EtbController::init(), BoostController::init(), Pid(), and Pid().
Definition at line 39 of file efi_pid.cpp.
Referenced by BoostController::onConfigurationChange(), VvtController::onConfigurationChange(), IdleController::onConfigurationChange(), AlternatorController::onConfigurationChange(), and EtbController::onConfigurationChange().
void Pid::postState | ( | pid_status_s & | pidStatus | ) | const |
Definition at line 144 of file efi_pid.cpp.
Referenced by EtbController::checkStatus(), VvtController::getClosedLoop(), BoostController::getClosedLoop(), IdleController::getIdlePosition(), and AlternatorController::onFastCallback().
|
virtual |
Reimplemented in PidCic.
Definition at line 103 of file efi_pid.cpp.
Referenced by EtbController::getClosedLoop(), BoostController::getClosedLoopImpl(), IdleController::getIdleTimingAdjustment(), initPidClass(), VvtController::onConfigurationChange(), AlternatorController::onConfigurationChange(), IdleController::onEngineStop(), LuaPid::reset(), LuaIndustrialPid::reset(), PidCic::reset(), AlternatorController::setOutput(), VvtController::setOutput(), and updateFactors().
void Pid::setErrorAmplification | ( | float | coef | ) |
Definition at line 138 of file efi_pid.cpp.
Referenced by VvtController::getClosedLoop(), and IdleController::getIdleTimingAdjustment().
void Pid::showPidStatus | ( | const char * | msg | ) | const |
Definition at line 160 of file efi_pid.cpp.
Referenced by EtbController::showStatus().
void Pid::sleep | ( | ) |
Definition at line 153 of file efi_pid.cpp.
Definition at line 96 of file efi_pid.cpp.
Referenced by applyPidSettings().
|
protectedvirtual |
If we have exceeded the ability of the controlled device to hit target, the I factor will keep accumulating and approach infinity. Here we limit the I-term #353
Reimplemented in PidCic.
Definition at line 178 of file efi_pid.cpp.
Referenced by PidIndustrial::getOutput(), and getUnclampedOutput().
float Pid::iTermMax = 1000000.0 |
Definition at line 69 of file efi_pid.h.
Referenced by AlternatorController::getClosedLoop(), IdleController::getIdlePosition(), EtbController::init(), BoostController::onFastCallback(), and updateITerm().
float Pid::iTermMin = -1000000.0 |
Definition at line 68 of file efi_pid.h.
Referenced by AlternatorController::getClosedLoop(), IdleController::getIdlePosition(), EtbController::init(), BoostController::onFastCallback(), and updateITerm().
|
protected |
Definition at line 71 of file efi_pid.h.
Referenced by getD(), getI(), getMinValue(), getOffset(), getOutput(), getOutput(), PidIndustrial::getOutput(), getP(), getUnclampedOutput(), initPidClass(), isSame(), PidIndustrial::limitOutput(), postState(), showPidStatus(), sleep(), updateFactors(), and updateITerm().
int Pid::resetCounter |
Definition at line 66 of file efi_pid.h.
Referenced by initPidClass(), and reset().