1. procedure flattening()

2. foreach cm in D when mcm is a coupled model

3. mcm.flattening()

4. foreach cm in D when mcm is a coupled model

5. D = D È mcm.D – cm and {Md} = {Md} È {mcm.Md} – mcm

6. {Id} = ({Id}– Icm) È ({mcm.Id} – mcm.Icm)

7. foreach d in D

8. remove cm in Id

9. foreach transition zd,i in {cm.Zd,i} when (d ≠ cm and i ≠ cm)

10. add transition (zd to zi) to {Zd,i}

11. foreach transition td to ti in {Zd,i} when (d or i are coupled model) //tÎ{x, y}

12. if (Mi is a coupled model) and (Mi ≠ self)

13. xj = mi.Zi,j(Zd,i(td))

14. replace (Zd,i (td) = ti) by a translation (Zd,j (td) = xj) into {Zd,i}

15. if (d is not a coupled model) add j to {Id}

16. if (Md is a coupled model) and (Md ≠ self)

17. yj is a output as Md.Zj,d(yj) = td

18. replace (Zd,i (td) = ti) by a translation (Zj,j (yj) = ti) into {Zd,i}

19. add i to {Ij}

20. end flattening