relay setting calculation