Simulation of space charge effects in resistive plate chambers