Before reading this section you must be familiar with the Graphical User Interface (GUI) and know how to create libraries, models and model components.

There are different ways to create models or model components using MLDesigner.

The Ptolemy language is a preprocessor language that allows the designer to use C++ code to define the functionality of primitives. Files written in the Ptolemy language have the extension .pl and contain primitive source code.

The Ptolemy vocabulary differs from that of MLDesigner. Here is an overview of the definitions and differences in terminology.

MLDesigner type Description Ptolemy type
Primitive The lowest level model in MLDesigner, with functionality defined in the Ptolemy language. Contains C++ code fragments. Star
Module A model made up of connected primitives and/or embedded modules, with input and/or output ports. Galaxy
System A combination of primitives and modules with connected ports within a model. A complete system that can be executed/simulated. Universe
Parameter Interface element for definition of initial values. In primitives parameters can be used to remember values. State
Domain The model of computation, which defines the behavior of a network of models. In code generation, a domain also corresponds to single target language. Domain

Here you'll see a comparison of advantages for each class of models.

Modules FSM models Primitives
no knowledge of C/C++ required well suited to controller design and protocol specification required for fundamental operations
automatic consistency / error checking suited to certain levels of design abstraction often more efficient
understandable easier to create than primitives preexisting C++ simulation modules can be used
easy to modify and extend
built-in debugging tools can be used

Comprehensive libraries of primitive models for the more mature domains are supplied with MLDesigner. These primitives were designed to be as generic as possible and many complex functions can be realized using primitives contained in these libraries. There will, however, always be a need to develop new primitives. You can link the new primitives dynamically or (if the primitives use shared variables) add them to the list of compiled-in primitives by selecting the Load Mode as permanent.

The following steps are necessary when defining a primitive:

  1. create the primitive,
  2. define the external interface of the primitive using the standard Model editor,
  3. define the primitive functionality using the Ptolemy language ptlang, and
  4. compile and load the primitive (dynamic or permanent).