This model of steam engine was the most common in past. The energy of the steam pressure is converted into the rotation of the flywheel by the piston. The moving of the flywheel alters the position of the valve, which redirects a portion of steam in one of cylinder parts and opens the other part to emit exhaust steam.
In theory, such type of engines was mounted on locomotives. Now such devices can be found, perhaps, in museums or as a steam-punk attributes.