Just like the simulation shown: I added a resistor to the transformer circuit.

You can download the simulation and open it with EJS to find out the detail equations being used in the simulation.