Reference Guide 6: Derived Classes of coupled class

6.1 Digraph Models

Class digraph is a derived class of the class coupled. A digraph model is composed of a finite set of explicitly given components with explicitly specified coupling. Methods are used to specify the components of a digraphmodel and to specify the external and internal coupling relationships.

An example of a digraph model is an experimental frame model. When coupled to a model, it generates input external events, monitors model’s behavior, and processes its output. An experimental frame module usually consists of a generator, transducer, and acceptor.

6.1.1 Instance Variables

The Coupling and components variables are inherited from the coupled class. During initialization, these variables are built from the digraph class definition. Method get_components() accesses the componentsvariable.

Figure 18 External Transition Function of Digraph Model

6.1.2 wrap_deltfunc Function

The wrap_deltfunc function sends input messages down to its components (children). In Figure 18, input messages of the digraphcan come from outside of the system or from its components inside. These input messages are divided into mailboxes based on unique_ids of its components according to comp_map structure. Then the contents of each mailbox are unified as a message (container) and sent to the associated component. Finally, the wrap_deltfunc function of each component is called by the tellall method. This repeats recursively until the atomic level is reached.

6.1.3 Output (compute_input_output) Function

The output function should generate an external output just before an internal transition takes place. Figure 19 shows how a digraph model handles messages in the compute_input_output function. Since imminents are selected just before this method, the digraph model tells all its imminent components to execute their compute_input_output method. Then each imminent component produces its outputs and classifies them into two parts: input for internal messages and output for outgoing messages. The digraph model gathers all outputs from the imminent components and puts them into the input mailbox or output mailbox. Input messages for the components remain in the model, while output messages go up the hierarchical structure.

6.2 Block Models

Block models is specialization of coupled models which provides for coupling of a fixed or variable set of geometrically located cells, each of which is connected to other cellsin a uniform way.

6.2.1 Instance Variables

The Coupling and components variables keep coupling information and components information respectively just as in digraph models. The sizevariable is an array which has boundary information for the region a block covers.

size[0] : lowest i address
size[1] : lowest j address
size[2] : highest i address
size[3] : highest j address


 
Figure 19 Compute Input Output Function

Whenever a model is added into the block, the block checks its boundary and updates the size variable if necessary. In reverse, whenever a model is deleted from, or moves outside of, the block, the block checks its boundary again and diminishes the appropriate sizevariable if it is in the boundary. The size information can be accessed by these methods–get_size0(), get_size1(), get_size2(), get_size3() respectively.

6.2.2 Coupling method of the Block

As a block model can have huge numbers of cells as its components, cells can be built in easy and uniform ways. The coupling methods in block models propagate down to its components so that every component in the block area has the same coupling information due to its uniformity. The add_coupling method (with two arguments) provides the coupling relationship between two ports of the cells. For example, add_coupling(“out“, “in“) specifies connection from the “out” port of any cell to the “in” port of any other cell in the block:

add_coupling(char * p1, char * p2);

6.3 Digcell Models

Digcell models combine both cell and digraph properties. A digcell model is almost the same as a digraph model except for having its own address and its way of converting output. As shown in Figure 20, digcell models work like cell models from block models point of view, and work like digraph models to their components. For example, the digcell model, with address(1,n), has one atomic model (layer A) and one digraph model (m-bc). The digraph model, m-bc, has 2 atomicmodels (layer B, layer C).


 
Figure 20 Digraphcell structure

6.3 Comparison of digraph, block and Digraphcell models

Table 3 shows the differences among digraph, block, and digcell models. Block models use an address based messaging scheme. Digraph models use a port based scheme with coupling information. Digcellmodels use both the address-based messaging scheme and the port based scheme.

Table 3 Differences among digraph, block, and digraph-cell models

Digraph
Block
Digcell
Messaging Scheme
Port based
Address based
mixed
(port + address)
Children Information
Variable “components”
Variable “components”
Variable “components”
Boundary Information
None
Variable “size”
None
Coupling Information
Variable “coupling”
Variable “coupling”
Variable “coupling”
Coupling Method
One-to-one
One-to-many
One-to-one
One-to-man

In terms of Coupling relationship between influencees and receivers, both digraph and digcell models map one source to one destination, while block models support many-to-many coupling. As shown in Table 4, both digraph and digcell models can keep atomic models, block models, and digraph models as their components in hierarchical fashion; while cell, block and digcell models, each having its own address (location), can become components of a block model.

Table 4 component relationship among digraph, block, and digcell models

components of class
digraph model
block model
digcell model
atomic
Yes
No
Yes
cell
No
Yes
No
digraph
Yes
Yes
Yes
block
Yes
No
Yes
digcell
No
Yes
No