working principle of dc generator with diagram