adding duty cycle calculation