PN Junctions: Simulation and Calculation of Electrostatic Variables