Numerical simulation of beam current control mechanism in the thermionic electron gun