Here is your basic inverter, simulated in the free LTspice sim programme.
This one is open loop, so only works for this case of fixed load.
------------------------------________________________________
In fact, the way to do it is to first have a sinusoidal reference.
This represents what you want your inverter to give as an output voltage. So you increase the PWM duty cycle to the bridge FETs as the sinusoidal reference increases. A big inductor in the bridge will smooth out the current.
You need fast overcurrent limiting so that the current never goes above your maximum allowable. You also need average current limiting which is obviosuly much slower acting.
In order that your output voltage never goes above 339Vpk....make sure your DC supply is exactly 339VDC. Then enjoy PWM'ing away.
Remember every 10ms to swap from one set of bridge diagonal fets to the other set....then you get your bipolar voltage.
So its easy because you are not grid tied......just increase the pwm duty cycle as the 50Hz sinusoidal reference increases its amplitude, and let the current take care of itself...just have fets overcurrent limiting....and your slow average current limiting
So to get increasing pwm duty cycle as your sine reference increases.......use the old trick of a repeating ramp (up and down) into one pin of a comparator...and into the other pin...shove your reference.....then your comparator output will have a duty cycle which increases as your sine reference increases.