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.
So, we have a subsystem with the algorithm described above. Now let's move on to the mask creation.
After that we will get to the window of creating interfaces.
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.
- Input field allows us to assign to a constant inside the block any value we enter using the keyboard.
- 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.
- 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.
- 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.
After that we will add three entry fields
Now let's customise each of the fields according to the constant names specified inside the subsystem.
As a result, we get a block with the following parameters for input:
Now let's run the model.
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.