EMA Concepts
The Ema package is an API that incorporates several principles of object-based design, such as:
- data hiding: the user of EMA is not exposed to the internal physical, byte-by-byte structure of a model. Instead, access to the various model components is provided via a set of functions that shield detail and verify the integrity of model access.
- generic operators: a small set of generic operators can be applied to any object managed by EMA. These operators include the ability to create and destroy objects, to set or get their components, and to copy or move them. In addition, all objects have a set of generic attributes that EMA maintains.
The remainder of this section will present definitions of the major concepts of EMA, each accompanied by a diagram that depicts the concept. Note that EMA concepts tend to have familiar names, such as “object,” but that they do have very specific semantics within EMA that may vary from the familiar usage of the terms.
Model
Models in EMA correspond to models in Riverbed analysis software, as shown in the following figure. However, EMA models are not identical to Riverbed models. Within EMA, a model is a collection of data that specifies a model in Riverbed analysis software. In other words, while an application program is using EMA to operate on a model, it is actually building up a set of data that will later be used by EMA to construct the Riverbed model. During the EMA “session”, the rules of what can be done with the model and how it is internally stored and manipulated are all governed strictly by EMA. As soon as the model is “written out” by EMA, however, a corresponding Riverbed model is generated, which then can be manipulated by all of the existing tools that deal with models (such as graphical editors, op_mko, and op_mksim).
Figure 3: EMA Application Model File Operations

Models in EMA are sets of objects, each of which has an object type. As concrete examples, one of the objects that can be created in a network model is a node, and one of the objects that can be created in a node model is a processor. For flexibility, arbitrary quantities of objects of various types can be created within a model; the maximum number is only limited by the amount of virtual memory available to the program that is making calls to EMA.
Figure 4: Objects Within EMA Model

As with objects, there can be multiple models present at the same time in an EMA application. The maximum number of models present at any one time in an EMA application is limited by the amount of available virtual memory.
Figure 5: Models Within EMA Application Memory

Models are distinguished from one another in two ways: by type and by instance. Each model instance has a unique identifier that distinguishes it from all other models: this is known as the model ID. In addition, model instances that are of similar type share a common model type (for instance, all network models are identified as being of network type). One of these two identifiers must be passed to most EMA calls, since EMA has to know which model or model type is being referenced. The C/C++ language type definitions and typical function argument names for these identifiers are listed below (the type definitions are provided for code documentation and clarity; these identifiers are in fact just integers, and may be handled the same way as any regular integer in C/C++).
Table 1: EMA Model Data Types
| C/C++ Type Definition | Typical Argument Name |
|---|---|
EmaT_Model_Type |
model_type |
EmaT_Model_Id |
model_id |
Object
Objects in EMA describe components within the Riverbed model. For each model component that can be created using Riverbed analysis software, there is a corresponding EMA object that describes it (examples of such components are fixed nodes, processor modules, and process model states). The description of a model component does not cover its internal structure or its procedural behavior. Instead, the description covers its parameterization. For example, the description of a processor might include attributes that govern its generation of packets over time, such as the interarrival PDF being utilized.
An EMA object is essentially a set of attributes, each of which contains a value. All attributes of a model component are supported by the corresponding EMA object. The initial set of object attributes, and the default values of each of these attributes, are determined by the type of object. (The Ema package contains an internal database of all object attributes and default values.) However, you can extend the attribute set, using an EMA function call that corresponds to the extended attributes button in the Riverbed program.
Figure 6: Ema Model Data Types

Similar to models, objects are distinguished by type and by instance. Each object instance in a model has a unique identifier which distinguishes it from all other objects within the model: this is known as the object ID (note that object IDs are not unique across models, so model #0 and model #1 can both have an object #45). Therefore, the specification of a unique object instance in an EMA application must also include the ID of the model in which the object is contained. Object instances which are of similar type share a common object type (for instance, all processor objects are identified as being of processor type). The C/C++ language type definitions and typical function call argument names for these identifiers are listed below (the type definitions are provided for code documentation and clarity; these identifiers are in fact just integers, and may be handled the same way as any normal integer in C/C++).
Table 2: EMA Object Data Types
| C/C++ Type Definition | Typical Argument Name |
|---|---|
EmaT_Object_Type |
object_type |
EmaT_Object_Id |
object_id |
Attribute
The EMA concepts introduced so far (model and object) are essentially grouping elements. They don’t directly contain data that describes model components; what they do contain directly are attributes (the previous section explained that objects contain sets of attributes, but models also contain sets of attributes, in cases where model-wide parameters must be described). Attributes actually hold the data that parameterizes model components.
The data stored in each attribute is known as the attribute's contents. The contents of an attribute can be assigned to the attribute or read from the attribute using the appropriate EMA operators, to be described in later sections. The diagram below shows an object with several attributes; each attribute has an integer as its contents.
Figure 7: Object Attribute Structure

Because modeling and analysis entities are typically parameterized using a variety of data types, attributes must also be of different types (e.g., integer, string).
The core types of attributes are
- integer
- double
- string
- textlist
- object ID
- double vector
- poly
The integer, double (i.e., double-precision floating point) and string attribute types are similar to the C data types on which these are based. The four special attribute types are textlist, object ID, double vector, and poly. These data types provided enhanced, direct support for describing model components.
A textlist is a collection of strings that form an ordered list. Textlists are implemented by a C data structure, and are indirectly manipulated by a set of functions within the Program Library (Prg) package. Textlist attributes accept textlists as values; an example of a textlist attribute is the list of enter executives associated with a process model state.
The Prg package (in which function names have the form prg_) is distinct from the Simulation Kernel’s Programming package (in which function names have the form op_prg_). Prg package functions can be called by EMA programs, external tool programs, and process model code. The Simulation Kernel Programming package functions can be called only by process model code.
The object ID type, as introduced earlier, is really an integer. However, it has special semantics associated with it, in that its contents references another object in the model. The referenced object must exist for this attribute to have valid contents. An object ID attribute can only reference an object in the same model as the object that contains the attribute; it cannot reference objects in other models. The presence of object ID attributes allows models to become directed graphs of inter-referencing objects, as shown in the following figure.
Figure 8: Interobject References

A double vector is an attribute that contains a sequence of real numbers that represent a single parameter of an object or model. The vector stores a sequence of double-precision floating-point values in an efficient format, with consecutive elements packed into consecutive locations of memory (this is similar to an array in the C language). Each element of a double vector has an index, which is used to access it (elements are indexed starting with 0). Each double vector attribute has a default size that is built into EMA’s internal database of objects and models. The default size can be changed through a special EMA operator, to extend or shrink the vector.
A poly type is an attribute that can take on a variety of values. The value of a poly attribute is one of the allowed attribute types described in this section, except for poly itself.
In addition to the attribute core types, there is a set of attribute type modifiers, which are layered on top of the core type. These modifiers primarily affect the ways in which the attribute is accessed through EMA.
The attribute type modifiers are
- array
- toggle
- set-required
The array modifier expands an attribute to actually represent a series of attributes, each identified by a unique array index. The concept is somewhat like an array in C, in which a series of elements are referenced by index. However, attribute arrays are actually implemented with dynamically allocated memory, so they have the advantage that they can grow to arbitrary size.
The toggle modifier defines an attribute as having two states: enabled and disabled. Regardless of the state of the attribute, however, the attribute still has a defined contents. Toggles are useful for objects that have optional behaviors that require parameters if enabled. For example, processor modules by default are not regularly interrupted, so the interrupt rate parameter is irrelevant. When regular interrupts are enabled, however, the interrupt rate parameter is meaningful. This sort of object behavior could have been described by two attributes, one of which contains the interrupt rate, and another which serves as a Boolean indicating whether regular interrupts are enabled. However, it is more convenient to combine the two pieces of data into a single attribute using the toggle modifier.
The set-required modifier indicates that an attribute has no default value, and that it must have an assigned contents (i.e., it must be “set”) before a model can be written out to disk. This modifier is mostly used for attributes which have object ID as their core type, since if such an attribute is not set, there is no “intelligent” or obvious default value.
Each attribute that is supported is presented in EMA Built-In Attributes. The core type and type modifiers for each attribute are also listed in that section.