Import and export Settings for DEM simulation

Hi,guys;
I want to set the number of particles at the outlet to the number of particles at the inlet in the DEM simulation, so that the number of particles in the bed is the same. How should I set this? If the code is changed, where can the code of import and export particles be found? Thanks.

This is the same question as A BC outlet act as an inlet for the DEM partiicles