Engee documentation
Notebook

Block Masks

In this example we will see how to apply graphical interfaces for subsystems. This tool is used for convenient parameterisation of blocks and for developing custom libraries.

In our demonstration we will use the previously described model from this example (https://engee.com/helpcenter/stable/ru/interactive-scripts/edu/Root_Quadratic_Equation.html). This example presents a model for finding the roots of a quadratic equation.

𝑎𝑥^2+𝑏𝑥+𝑐=0, 𝑎≠0

The model itself is shown in the figure below.

image.png

So, we have a subsystem with the algorithm described above. Now let's move on to the mask creation.

image_2.png

After that we will get to the window of creating interfaces.

image_3.png

In this window:

  • on the left are the structural elements,
  • in the centre is the final interface of the block,
  • on the right you can see the settings of each of the elements.

Now let's take a closer look at the elements we can interact with.

image_4.png

  1. Input field allows us to assign to a constant inside the block any value we enter using the keyboard.
  2. The Checkbox allows the constant inside the block to be given a value of 0 or 1, depending on whether the parameter is enabled or disabled.
  3. The Drop-down list contains a set of parameters and, depending on the selected parameter, assigns the constant the sequence number of the selected parameter.
  4. The Hidden section allows the block interface to be divided into several subgroups; each of them can be collapsed and have its own name.

In our example, we'll look at Input Field and set parameters a, b, and c through it. Let's start by renaming the section.

image.png

After that we will add three entry fields

image_2.png

Now let's customise each of the fields according to the constant names specified inside the subsystem.

image_3.png

As a result, we get a block with the following parameters for input:

image_4.png

Now let's run the model.

image_5.png

We can see that the roots of the equation have been found, hence the model works correctly.

Conclusion

In this example, we have shown you the tools for creating interfaces for custom blocks and how to work with them.