How to calculate Volt drop by the code