calculate ibu logic