The INET Framework contains a detailed and faithful TCP model. This tutorial explains how you can trace what is going in TCP simulation, how you can use TCP in your models, and finally, we say a few words on how TCP can be extended.
It is expected that you have a basic understanding of OMNeT++'s architecture (simple and compound modules, NED files, messages, omnetpp.ini, etc.) and of TCP of course. If you need to brush up your knowledge on the first topic, go through the TicToc tutorial, and read the relevant parts of the Manual.
Part 2: Drawing sequence number charts