RELAY SETTINGS CALCULATIONS