I have been working on learning LTSpice because it appears it could save me a great deal of time.
To that end I have constructed this circuit
Purpose of circuit
This circuit is a high side driver for a N-channel MOSFET. It switches a resistor on and off. It is capable of a 100% duty cycle.
Theory of circuit
This circuit consists of a voltage amplifier formed by Q1 & Q2. This amplifier switches the gate of the MOSFET between V1 and 0 volts above the source. V1 is 12 volts, a commonly available voltage. R2 biases the amplifier to the high state, that is to say the MOSFET is on by default. R1 limits peak gate current, L5 models PCB trace inductance. R9 causes the MOSFET to turn off when the circuit is powered down.
In order to switch the MOSFET, the bases of the voltage amplifier just needs to be clamped to the same potential as the source. Q3 and Q4 form a bistable multivibrator, commonly known as a flip flop. Instead of switches, inductors are used to manipulate the current of Q3 and Q4. The base of Q4 in series with L2 which is the "set" circuit. The base of Q3 is in series with L3 which is the "reset" circuit.
L1 is coupled to L2 (set circuit). L4 is coupled to L3 (reset circuit). All inductors have an inductance of 100 microhenries, this seemed like a reasonable value for a small toroid wound with a simple bifilar winding. Coupling factor is 0.99. I had to set the internal resistance of the inductor to "0.01 ohms" in order to get this circuit to work. Use of inductive coupling allows the high side drive to be isolated, although this does require a separate voltage source (V1).
V2 and V3 are pulsed circuits which work together to produce a 10000 Hz square wave in the other circuit. They just produce very brief pulses to actuate the flip flop. The pulse voltage is 11.5 volts.
V4 and R6 are my sample load. V4 is 24 VAC 60 Hz.
Here is the graph of the voltage of V4 and R6, showing the circuit in operation.
After the body diode in the MOSFET turns off at 0 volts, we get a nice chopped up sine wave of voltage on R6. To me this demonstrates it works.
This is my problem. This is the current in L3 and L4
The current starts at 0 amperes and goes down from there. It's shown as negative just because of the way I have the inductor in the circuit. It's doing the right thing. So here are my questions
Why does the current go downwards towards infinity? This seems like it isn't modeling what I think of as real world behavior. After the voltage across the inductor drops to zero I thought the magnetic field collapsed. Is there something else I need to configure on this?
Why do the voltage pulses from V2 and V3 need to be 11.5 volts? I was thinking that I needed a voltage pulse of slightly less than 1 volt. The idea being that it would just be enough to temporarily counteract the voltage drop across the base-emitter junction of Q4 and Q3. Instead, it seems that I need a pulse of voltage with a value of V1 - Vbe. I don't understand this at all. Is this a problem with the simulation or a misunderstanding on my part?