In optimal control problems, it is sometimes the case that a control is restricted to be between a lower and an upper bound.
Bang-bang solutions also arise when the Hamiltonian is linear in the control variable; application of Pontryagin's minimum or maximum principle will then lead to pushing the control to its upper or lower bound depending on the sign of the coefficient of u in the Hamiltonian.