Putting VREF or setpoint or whatever on a sky hook is perfectly acceptable. I frequently run simulations with a voltage source component in that place, adjusting or sweeping it as needed. It's handy, and about as representative as anything you might want to drive it with, as long as you make it clear it's an input of course.
Anyway, this hysteresis / bang-bang circuit is a fair sight better than switching the resistor directly (assuming the switching frequency is reasonable). It'll be more efficient for a given power output, and easier to filter the supply ripple.
But it has some problems, too:
- Suppose the diode fails shorted. Will it stop? No, the output voltage collapses, the comparator calls for "MOAR!", and it'll quite happily latch on, until the transistor melts and smoke ensues...
- What happens as C3 ages (ESR rises)? The ripple rises proportionally, effectively subtracting more and more of the hysteresis set by R5 into R3 || R4. This forces ripple voltage lower, and switching frequency higher. LMV7219 is a rather peppy little chip, so the switching frequency will ultimately be limited by U3 and Q1 at a few MHz. Needless to say, neither one will be very happy about it.
- What happens if the load is a very small resistance, or none at all? If you're sensing VOUT or a shunt resistor (not shown), or something like that, how fast will the surrounding circuit respond? Mind that 1uH will take only 10us to charge up to 120A peak -- and that's assuming it doesn't saturate by then, which would be a large inductor indeed! Any small stray inductance in your circuit won't produce very happy results when that switches off, either. If you're controlling current or power based on an ADC reading that takes not even 10us, but ten times longer still... I think you can see where this is going.
The only reasonable way to do it is this: monitor the inductor current, and control that firstly. For this purpose, that's good enough already -- you only need the current or voltage into a load resistor, and that's that. For regular purposes, you use an op-amp to control the current setpoint, regulating the output voltage.
There's a few simple ways you can achieve current mode control. Sensing the current flow through a live inductor isn't very fun, but Q1 source is "grounded" (supply is considered ground at AC, so sue me
), so it might be a good place to put a shunt resistor. If you put a comparator around that, so that the shunt voltage rises to some point, then fires a trigger to turn off, you're set -- even if the diode fails shorted, the transistor will never be on for more than a few hundred nanoseconds into a short circuit!
The tricky part is the logic around it. That 'trigger' stuff doesn't mean wiring the comparator to the gate driver, no, that would oscillate as bad or worse than the hysteresis circuit with C3 absent! What you need is, some event turns the transistor on, then nothing happens until the current comparator turns it off. A latch or flip-flop. Usually, an R-S flip-flop is used, with the 'start' pulse generated by a separate oscillator block (you could do worse than a 555... actually, really you couldn't... it would absolutely work just fine, but, come on...
). Pulse meaning, a low duty cycle of course, so the flip-flop doesn't get forced on while the comparator is still screaming 'uncle' (alternately, the F/F should be "reset dominant", so the comparator has the final say).
So, in short, you can use a couple transistors wired as a flip-flop, or some logic gates, or even the comparator itself (trying to tweak hysteresis and thresholds and stuff to be useful is generally crude at best, though).
You can also use one of many purpose-made chips, like UC3843, which unfortunately contains a ground-referenced comparator (not supply referenced), so it can't be used directly in your circuit. Now, if your load doesn't need to be ground-referenced, you can turn it upside down (use an N-channel MOSFET and so on), and it'll work great.
BTW... MC34063 is crap, and has some sort of hysteresis PWM smooshing thing. It's current mode...sort of, but just isn't worth considering. It also doesn't teach proper control methods, so there.
Tim