Modular encoding of synchronous and asynchronous interactions using open Petri nets