I think the velocity input will always run it as a generator. To be able to switch this, you may have to change the input to mechanical torque. According to the documentation:
" Select Torque Tm to specify a torque input, in N.m., and change labeling of the block input to Tm. The machine speed is determined by the machine Inertia J and by the difference between the applied mechanical torque Tm and the internal electromagnetic torque Te. The sign convention for the mechanical torque is when the speed is positive, a positive torque signal indicates motor mode and a negative signal indicates generator mode. "