A one-dimensional semiconductor device simulation program with current boundary conditions is developed to study the steady-state and the transient characteristics of heterostructure four-layer p-n-p-n optical switches. Avalanche effect, radiative recombination, and band-gap discontinuities are included in the model. To demonstrate the use of the simulator, the modeling results are studied for both InP/In0.53Ga0.47As and Al0.3Ga0.7As/GaAs devices, and compared with experimental results in the latter case. The effects of optical generation and carrier lifetime on electrical characteristics of p-n-p-n switches are investigated. Simulation and experiment agree on holding current and voltage and on high-current on-state characteristics, while the limitation and simplification of the numerical model leads to discrepancy in the low-current off state. The simulator is shown to be useful in evaluating the effects of device geometry, material parameters, avalanche mechanism, heterostructure spacing, and light generation on key switching parameters of four-layer p-n-p-n switches.