Calculation of cable length