Modelling of a free piston problem