Conditions for the effective use of simulation and its application to middle-school physics inquiry activities