add ap calculation