Fully Rectified Sine Wave With PWM

If you want to rectify a sinus you have to use abs(sin...)
in your case -abs since you want to invert it.