Package Overview
The Topo (Topology) package is a collection of kernel procedures concerned with determining the topological structure of node and network models. These KPs are particularly useful when process models are written in a general way so that they can auto-configure to their surroundings.
Two Topo KPs are used to determine the quantities and IDs of particular objects. These procedures can be used to size data structures and normalize statistics, as well as loop through all the objects of a type. The KP op_topo_object_count() returns the number of static objects in the simulation, specified by type. Some example types of these objects are nodes, links, modules, compound attributes, and generic objects. The KP op_topo_object(), when given the object type and index, returns the object’s ID.
Three Topo KPs are used to explore the topology of the network by following the hierarchy. Child objects are lower-level objects and are contained in the parent object. For example, modules are children of nodes and nodes are children of subnets. Subqueues and channels are children of compound attributes and compound attributes are children of queues, transmitters, and receivers. (Compound attributes, when defined as extended attributes, can also be the children of built-in objects; when defined as model attributes, they can be children of processes, queues, and user-defined generic objects.) The KP op_topo_parent() returns the object ID of the parent object. op_topo_child_count() returns the number of children of a particular type. The count can then be used to loop through the child objects, obtaining each object ID with the KP op_topo_child().
The input and output associations of an object are the objects directly connected to its input and output ports, respectively. For instance, in the case of a processor connected to a point-to-point receiver, the processor’s input association is the receiver, the receiver’s input association is a point-to-point link, and the link’s input association is a point-to-point transmitter located in another node. The KP op_topo_assoc_count() returns the number of associations, specified as either “in” or “out”, of an object. The KP op_topo_assoc() returns the object ID for a specified association.
An object is a connector if it joins two objects. For example, a packet stream can connect two modules or a link can connect two nodes. The KPs op_topo_connect_count() and op_topo_connect() return the count and object IDs of the connectors between two objects.