Solar charger: perturb and observe
A solar array gives its most power at one voltage, and that voltage moves with the sunlight. A tracker (MPPT) finds it by trying: step the duty, see whether the power rose, and keep going the same way if it did. Here you open a boost charger with a perturb-and-observe tracker, watch it climb to the peak, and then cut the sunlight in half. About 15 minutes.
File › Open Example is a menu path and F5 a key.
The numbers on this page are checked by the tests of crates/engine/tests/tutorial_wpt_charger_mppt.rs, which run the same example. All parameters are illustrative.
1. Open the charger
Step 1 of 4 · about 1 minChoose File › Open Example › Renewable energy › Solar charger with MPPT.
Two 60-cell modules in series (each 38 V open circuit, 9.5 A short circuit, maximum power at 31 V and 9 A) feed a boost converter that charges a 104 V battery. The battery holds the output, so the duty sets the array voltage: Vpv = Vbat·(1 − D). At standard test conditions the array's most power is 62 V · 9 A = 558 W, which needs a duty near 0.40.
2. Read the tracker
Step 2 of 4 · about 1 minEvery 5 ms the blocks ZV and ZI sample the array voltage and current and Pw multiplies them. DV and DP keep the previous samples, and the sign of ΔP·ΔV says which side of the peak the array is on: positive on the rising side, where the voltage must go up. A comparator turns that into 1 or 0 and a sampled integrator moves the duty by 0.01 in the right direction. The 5 ms period leaves the array's input filter time to settle between steps.
3. Run it
Step 3 of 4 · about 1 minPress F5 (0.15 s). The duty starts at 0.29 and the sampled power ps first reaches 98 % of its final value at 55 ms. In the last 30 ms the array gives 557 W at 62.0 V, with a duty of 0.41, close to the 558 W and 0.40 expected from the ratings. The duty does not stop: it steps between three neighbouring values around the peak, which is the cost of tracking by trying.
4. Cut the sunlight
Step 4 of 4 · about 1 minSelect PV1 and set irr to 500 W/m², then run. The array now peaks lower, and the tracker settles at 279 W with a duty of 0.41; the array voltage is 61.8 V, close to the 62.0 V at full sun: the voltage of a cell depends on the light only by its logarithm, while the current is proportional to it.
For a step, as a cloud would make, add a Step block (circuit.addComponent, kind step, t0 = 0.06, before = 1000, after = 500), join its output to the g pin of PV1 and run. The tracker follows the new peak within the run: in the last 30 ms the array gives 279 W, against 279 W for the run that started at 500 W/m².
The manual lists every command used here.