Engee documentation

Model hierarchy

Several blocks can be combined into a subsystem. This is necessary when the number of blocks in the model is so large that it becomes inconvenient to work with them.

Creating a subsystem

There are several ways to combine blocks into a subsystem:

  • Add a block Subsystem from the block library, double click on it with the left mouse button (this is how you enter the subsystem) and add the required blocks in the standard way.

    model hierarchy 1

  • Highlight the blocks you want to add to the subsystem with the Shift key pressed, click on the appearing dots in the corner of the rectangle and click on the subsystem icon 1 1 Subsystem icon.

    model hierarchy 2

Within one subsystem you can create an unlimited number of other subsystems at different levels of nesting. As a result, the model has a hierarchy. To navigate through different levels of the model use Navigation panel.

model hierarchy 3 1

Using the Model block

To work with model hierarchies, in addition to subsystems, you can use the block Model.

Unlike a subsystem, the content of the Model block represents a separate model and can be reused in other models (several models can refer to the Model block).

Consequently, you can incorporate one model into another using a Model block. Each Model block is a reference to a particular model (submodel). Let’s consider an example:

To create a submodel, we use the blocks In1, Gain, Integrator and Out1. The parameters of the blocks remain by default.

example model hierarchy 1

In the future we plan to feed both input ports with the same signal, so we use the Duplicate function for Inport blocks:

example model hierarchy shadowinport

Model view after input port conversion

The final submodel looks as follows:

example model hierarchy 2

Let’s save the submodel and give it a name, in our case - newmodel_12. In the future we will refer to this name in the parent model Model.

Next, let’s create a model from which we will refer to the submodel. We use the blocks Sine Wave Function, Model and Terminator.

example model hierarchy 3

For the Sine Wave block set the Sample time value to 0.1. The block will change. Then right-click on the Model block and select Parameters. This will open a settings window, inside which we will refer to the previously created newmodel_12 submodel:

example model x

The Model block will be modified to include input and output ports, to which we will connect the signal lines. For signals from the output ports we will set a record:

example model hierarchy 4

Let’s run the simulation of the model and see the graph. We leave the solver by default (Euler). The graph of sinusoidal signal simulation will be displayed in graph window graphs icon 1:

example model hierarchy 5

  • The solver step size in all reference models must match the solver step size of the parent model (with Model block). Otherwise you will get a solver error.

  • You can select different solvers as long as the step size is the same:

    • A model-link with a variable step size cannot be used in a parent model with a constant step size.

    • A model-link with constant step size can be used in a parent model with variable step size.

  • Reference models do not support Physical Modelling library blocks and multivariate signals.

  • Reference models support multi-level nesting subsystems and other Model blocks.