Introduction

Ports are used to connect model instances for exchanging data objects. The kind of porthole and the type of data objects accepted or produced by the model component to which the port belongs must be defined.

With primitive model components, ports can be single portholes or multiple portholes. The following table shows the possible combinations of port types as well as the keywords used for ports in the primitive sources. At this stage inoutmulti and inout ports are not supported by MLDesigner.

Ports of FSM primitives can only be single portholes.

Possible port type combinations

Port type

Port number

Icon representation

Type name

Input

Single

single arrow

input

Input

Multiple

double arrow

inmulti

Output

Single

single arrow

output

Output

Multiple

double arrow

outmulti

Data objects that pass from one port to another in MLDesigner are called particles or tokens. There are different types that are supported by MLDesigner (see Possible data type combinations below). A model that operates on anytype particles is said to be polymorphic. Polymorphic models operate on multiple types of data. For example, a Printer primitive can produce a textual representation of any type of particle.

MLDesigner usually makes conversions between numeric particle types automatically. The float to complex conversion does the obvious thing, putting the float value into the real part of the complex number and setting the imaginary part to zero. The complex to float conversion computes the magnitude of the complex number. integer to float conversion is easy enough. float to integer conversion rounds to the nearest integer.

In some situations, automatic type conversions cannot be made. A common difficulty involves several outputs of different types feeding a Merge primitive. MLDesigner must assign a specific type to the Merge primitive’s output, but in this case it will be unable to decide which type to use. An error message is displayed stating ”cannot determine DataType” for the output. The solution is to insert one or more types of conversion primitives, so that all the values arriving at the Merge primitive have the same type. The conversion primitives can be found in the Conversion libraries of the appropriate domain. Some domains are more restrictive about particle type conversions than others. Assignment of types to anytype portholes and resolution of type conflicts is discussed further in Manipulating Particles of Type anytype.

The type of port and type of data objects consumed or emitted by the port determines the appearance of the port. The following table shows different types of ports and illustrates the type of data compatible with each port type. A port definition in the model component is also called a formal port.

Scalar Matrix Multiple Scalar Multiple Matrix
Input Ports
Output Ports

The black triangle inside the formal port is the point where you connect it to ports of model instances within the model. The instance represents the model component if it is embedded into another model. The port representation of an instance, the so-called actual port, serves as a connection point for connecting model instances and is sometimes called a terminal.

Possible data type combinations

Data type

Data structure

Port color

Type name

Any type

Scalar

red

anytype

Floating point

Scalar

blue

float

Floating point

Matrix

blue

float_matrix_env

Complex

Scalar

white

complex

Complex

Matrix

white

complex_matrix_env

Integer

Scalar

orange

int

Integer

Matrix

orange

int_matrix_env

Fixed

Scalar

violet

fixed

Fixed

Matrix

violet

fixed_matrix_env

Message

Scalar

green

message

String

Scalar

black

string

File

Scalar

yellow

file

Data Structure

Scalar

cyan

datastruct:

Continuous

Scalar

light blue

continuous