Teacher can teach max 2 periods per day in one class
Add this advanced cardrelationship:
Select Max periods per day and set the number.
It is important to correctly select the apply to comobobox. In this case we have used "apply to selected teachers' classes". This means that this rule is applied to each class where each selected teacher is teaching separatelly.
If you for example select only apply to teachers it would mean that each teacher can have max 2 periods per day.