generate inbound and outbound array before calculation