# Plugin - External Calculation Objects

EMSO is an equation-based tool, therefore most type of mathematical relations can be expressed directly as equations, using its modeling language. However, there are some cases in which using equations is barely convenient. Typical examples include:

- The relationship cannot be expressed in a closed algebraic form without introducing many intermediate quantities with no physical sense;
- The relationship requires lots of data parameters;
- Already exists well established software that provides the required calculation;
- It is difficult to converge the problem without decoupling the system.

Exactly for the above cases, EMSO provides a mechanism where the user can *plug* code written in C, C++, or FORTRAN into the models.

## Using a Plugin's

In order to *plug* external calculation code into the models the user needs to declare a *special* parameter, a Plugin:

In the above example (see streams.mso?), the parameter **PP** is the Plugin.

## Plugin Methods

Once the Plugin was declared, the user can **call** its methods.
Methods can have arguments and are called using the **dot** notation, eg:

In the above **call** three arguments are supplied: T, P, and z.
Before running a simulation, EMSO will check if all methods used in models actually were implemented by the Plugin.
EMSO also check if the number of arguments and its units of measurement are correct.