When creating a model in TANGRAM-II, it is imperative to define the events that characterize the system that is being modeled, and the actions that take place whenever these events occurs. With MTK's integration with TANGRAM-II, it is now possible to, inside these events, work with MTK's plugin methods, as if they where just another action taking place inside the event. Therefore, when simulating a system, users can now, for example, collect and save traces obtained during the simulation, or use custom models (implemented as MTK plugins) to analyze the system during its simulation in TANGRAM-II.
TANGRAM-II views MTK as a black box, from which it can interact only through its plugin's attributes and methods. To achieve this, a new Tangram-II type, called MTKObject, was created. Each MTK object, that will be used in a Tangram-II model, will be viewed by TANGRAM-II as a variable of this type, and must be declared in Declaration section, just like any other variable in TANGRAM-II. Once created, the manipulation of these objects can be done through six primitives, listed below, in any point of the action code of a message or event. Through these primitives, users can access the object's attributes and execute their methods.
Each of these primitives is translated into the user_code.c file as a set of commands, which perform the communication between the Tangram-II simulator and the libmtk library, in order to execute the requested MTK actions during the simulation. Next, we describe, individually, each of the six primitives.