Necessary and sufficient conditions of existence of periodical motions in the model of a hinge mechanism in a flow