Documented PWM calculations