Why do we consider a p-n junction diode as a voltage source sometimes and how do we justify it's working?