The IdealInverter is based on a power balance between input and output. The output voltage is fed (with a delay = dead time) to the output voltage source. The input current is driven by an integral controller observing the power balance.