Hi there guys, I'm trying to design a bidirectional buck boost converter as part of a larger three way solar charge controller project. The buck boost part will be connected to an energy storage device, which will probably be a 2F 5V ultracapacitor. The aim is to step down 9v source to charge the ultracap, and then when power is needed the converter will work in reverse and boost the ultracap voltage to provide the load. I plan to use average current mode control for the converter. The only problem is that i'm really bad at control theory. I've just about got the converter working in buck mode, but having problems getting it working in boost mode as i can't understand how to get the control setup for this and the capacitors complicate matters. At the moment i'm still at the simulation stage using PSim software. For the control design I have an outer voltage loop and a inner current loop. I've used two PI block with identical gains and time constants of 1 and 0.001sec. The control voltage is then fed into a comparator with a 20kHz 1V peak to peak sawtooth oscillator to get the PWM for the MOSFETS. I've included the circuit diagram. Can anyone help please?