For the first time, the charge state distribution inside the MEsskammer für FlugzeitInStrumente und Time-Of-Flight (MEFISTO) electron cyclotron resonance (ECR) plasma and in the extracted ion beam was successfully simulated. A self-consistent ECR plasma ionization model (Hohl M 2002 MEFISTO II: Design, setup, characterization and operation of an improved calibration facility for solar plasma instrumentation PhD Thesis University of Bern) was further developed, recomputing the ion confinement time for every ion species and in every time step based on the actual plasma potential rather than using a prescribed constant ion confinement time. The simulation starts with a user defined set of initial conditions and develops the problem in time space by an adaptive step length fourth order Runge-Kutta (RK4) solver, considering particle densities based on ionization rates, recombination rates, ion confinement times and plasma potential. At the simulation end, a steady-state ion charge state distribution is reached, which is in excellent agreement with the measured ion beam charge state distribution of the MEFISTO ion source for Ar 1+ to Ar 5+ and in good agreement for Ar 6+ .