API functions for MPPT block.
Each function of the API accepts a pointer to an MPPT context instance as first parameter. The context is self-contained. No additional local or global static data is needed for MPPT operation. This makes the implementation reentrant.
Before using the MPPT, it must be reset (MpptReset) and initialized (MpptInit). Further, the mppt_context_t::config part of the context must be correctly set by the application.
The Mppt is called on each tracking step. It processes voltage and current inputs and returns the normalized reference by reference.
Functions | |
| void | MpptReset (mppt_context_t *const context) |
| Reset MPPT module state. More... | |
| void | MpptInit (mppt_context_t *const context) |
| Initialize internal working variables from configuration. More... | |
| void | Mppt (mppt_context_t *const context, float32_t voltage, float32_t current, float32_t *d_ref) |
| Execute one Perturb-and-Observe (P&O) tracking step. More... | |
| void MpptReset | ( | mppt_context_t *const | context | ) |
Reset MPPT module state.
Clears (zeros) all internal runtime variables stored in mppt_context_t::vars:
Call sequence requirement:
Safe to call again to discard accumulated tracking history.
| [in] | context | MPPT context |
| void MpptInit | ( | mppt_context_t *const | context | ) |
Initialize internal working variables from configuration.
Consumes user-provided limits and step settings (e.g., config.d_min, config.d_max, config.delta_d) and prepares the internal state for the first tracking iteration:
| [in] | context | MPPT context |
| void Mppt | ( | mppt_context_t *const | context, |
| float32_t | voltage, | ||
| float32_t | current, | ||
| float32_t * | d_ref | ||
| ) |
Execute one Perturb-and-Observe (P&O) tracking step.
Implements a Perturb and Observe algorithm that outputs a normalized reference value in the range [0.0, 1.0]. The algorithm is topology-agnostic: the output can be used as a duty cycle reference, a normalized voltage reference, or any other control variable depending on the power converter topology (e.g., buck, boost, buck-boost, full-bridge).
Algorithm steps:
The application is responsible for scaling the normalized output to the appropriate physical range for the target converter. For example:
Characteristics/limitations of current variant:
| [in] | context | MPPT context |
| [in] | voltage | Latest input voltage (Volts) |
| [in] | current | Latest input current (Amperes) |
| [out] | d_ref | Pointer to store normalized reference output (0.0 .. 1.0). Interpretation depends on converter topology (duty cycle, normalized voltage, etc.) |