Modeltool Software Development

The possibilities and conveniences which offer modern technology have a wide range of uses. The chemical industry has recently experienced a “boom” in the expansion and application of new opportunities to improve the operation and implementation of modern technologies in practice. A significant role in the whole process of advancement is formed by the steady foundations of the fundamental units of the industry – systems, which are based on mathematical models and physicochemical principles.

In the following way, you will read what kind of work I did during the last semester. We will gradually explain the individual steps of the semestral project and describe its strengths. Today's topic - Modeltool Software Development.

The first problem we dealt with was logical errors in the code. They did not occur in all models, but these detected had to be corrected. Most of the errors consist of incorrect indexing, wrongly defined variables, or false adjustment of partial equations. After fixing the faulty parts, further control of the total and partial mass and enthalpy balances of the systems were implemented.

The moment the program was fully functional, we looked at it from a distance. All we found was the structure of the code itself was unclear, the functions and calculations were over-complicated, and at the same time, they were absent the standards of the latest versions of MATLAB. Therefore, the superfluous lines of the code were reduced to a minimum, bifurcating of cyclic functions was optimized, and the calculations of the linear models were redefined, while the code itself retained its clarity and logical integrity.

Fig. 1: Editing and adjusting the code


One of the main changes has taken place in error handling. While in the early program this was implemented directly in the script, a new version detects errors in the model itself. The reason for this transfer was simple – in the original version, if the error had to be caught, it was first crucial to


  1. load the model (which also contains an initialization)
  2. send data to MATLAB script (initialization again)
  3. the appropriate function was loaded all iterations ran (e. g. in cyclic functions)

and somewhere at the end of the program, the error was declared. Errors handled directly in the model are limited to entering individual data or running the model. In this way, computer memory is saved up, redundant iterations of cyclic functions are eliminated, and the user's time while working with the model is significantly minimalized.

The last modification, which we could call the icing on the cake, was to add descriptions to the models. After opening the model, a user has the benefit of initial information about the operation and functionality, including precise descriptions of all blocks and signals. The model mask was altered for user-friendly control, additional information with a specific description of the model is provided by Help option.

Fig. 2: Model overview with description of blocks, streams, basic information about the model


Once the job on the original models was done, we focused our attention on creating new models. Some models were independent of the previous ones, other extended the original models.

The new programmed model in Modeltool software is a bioreactor model. The bioreactor is a model of a flow-through chemical reactor with continuous stirring, in which a chemical process - fermentation - takes place. In addition, a pair of packed columns were added - a destillation and an absorption column. The material and size of the packing used in the columns can be selected by the user. In addition to the original models of heat exchangers, two new models were scripted, using a counter-current cooling flow.

Fig. 3: Modeltool software models (original models marked light blue, new models green)


Previously, when a user wanted to access the models, you had to open them manually. We have resolved this deficiency by programming a graphical user interface (or simply GUI).

The great advantage of the GUI is its ability to provide fast and intuitive access to the used models. All models are logically arranged in a list, where the user can scroll to them anytime. After clicking on the exact model, the essential information is displayed along with a schematic representation of the model. After pressing the open button, the model window appears and is fully available to the user. A choice of several software languages is available for better working comfort.

Fig. 4: Modeltool GUI provides basic information and a schematic picture of the selected model


While creating functional software, the programmer must pay attention to both the functional side of the model and its graphical design. Modeltool is no exception. After modifying and correcting the program logic in the faulty scripts, it was possible to declare that Modeltool was fully-functional and ready to serve. By simplifying the error-handling code, working with it has become significantly more efficient (and faster), and additional descriptions and documentation have increased the user's self-sufficiency compared to the previous version. New models were added - bioreactor, packed columns (distillation, absorption), as well as counter-current cooling of heat exchangers. Last but not least, the graphical user interface provides ease of use and a comfortable choice of models to be used.