A computer code has been developed to simulate and study the evolution of ion charge states inside the trap region of an electron beam ion trap. In addition to atomic physics phenomena previously included in similar codes such as electron impact ionization, radiative recombination, and charge exchange, several aspects of the relevant physics such as dielectronic recombination, ionization heating, and ion cloud expansion have been included for the first time in the model. The code was developed using object oriented concepts with database support, making it readable, accurate, and well organized. The simulation results show a good agreement with various experiments, and give useful information for selection of operating conditions and experiment design.