The structure of a n-on-p Hg1-xCdxTe infrared detector is modeled by the Sentaurus TCAD software. The influence of junction depth on the current of a photovoltaic diode is simulated and analyzed. The results show that the influence of junction depth on the current of the diode is affected by the thickness of absorption layer and the carrier concentration in p region. The change of the diodes for different wavelengths with junction depth is fitted and the junction depth for maximal current at different wavelengths is obtained.