Introduction
The modeling environment MOSAICmodeling is a project that tries to improve the creation and the use of custom made models. While many software tools exist that provide standard models for chemical engineering (like AspenPlus among many others) it is often necessary to create new models that fulfill special needs. Such custom models can be written in many languages (e.g. Fortran, C) and there are many environments that allow use custom models in one or two languages (e.g. Matlab, gProms). However, most of these languages are textual programming languages, which leads to three handicaps: First, it takes a long time to write and debug the model; second, the model can only be used in environments that understand the programming language of the model, for other environments the model must be programmed anew which again comes along with much effort; and third, there is a visual and conceptional gab between programming languages and the mathematical two-dimensional formulation. To react on this situation, MOSAICmodeling is created as symbolic mathematical environment and code generator for large systems of equations. The idea is to create a model once and use it in different cases and many environments or languages.
Apart from its modeling concept, MOSAICmodeling is a Web 2.0 application, so that the maintenance on the computer of the user is small and the storage is done on a server over the internet.
Important principles To describe the work with the MOSAICmodeling environment the following basic principles need to be mentioned:
- Mathematic expressions are written symbolically so that they can be seen in the environment just as they would appear in a publication or written on paper.
- Equations and functions are created separately and then assembled to equation systems.
- In the same way equation systems can be added to other equation systems.
- Every equation, function and equation system must have a notation that contains an explanation for each symbol used in the mathematical expressions.
- The calculation of an equation system is separated from its creation. This makes the equation systems more reusable. In particular
- an equation system does not contain any specific values for its variables and parameters;
- an equation system does not contain any information about which the design variables and which the iteration variables are;
- an equation system does not contain information about the maximum values of indices.
- such pieces of information are kept in an object called evaluation
General modeling procedure To build up a new model from scratch you have to adhere to the following procedure.
- Create a notation object containing information for all symbols that you will use.
- Create the equations and assemble them to an equation system. (If necessary, you can sub-divide your model into several equation systems, which can be added to a superior equation system in a second step.)
- If you need functional calculations you can create function objects. Instances of function objects can be added into the equation system.
- Once you have created your equation system, create an evaluation object that contains all information necessary to specify a problem to be solved based on the equation system. This step includes
- Specification of maximum index values (e. g. number of components)
- Classification of the variables into design and iteration variables
- Giving values to the design variables and parameters, as well as, providing guess values for the iteration variables
- With all necessary information gathered, create a problem solving program code in one of the languages provided by MOSAICmodeling. Depending on what code generator you used you can either
- compile and execute the code on the solver which allows you to see the results directly in the MOSAICmodeling user interface
- copy the code and use it in your own modeling environment
Re-use Usually you do not want to build up everything from scratch. Therefore all objects created in MOSAICmodeling can be used in several models. This allows you for example to build up your notation suitable for the current project and use it in all related models. In the same way you can reuse equations and entire equation systems. There are several ways to add existing equations or equation systems to a new equation system. To be used together two equation systems do not need to use the same notation. When existing equations and equation systems are integrated in a new equation system the meanings of the variables of all connected model parts must be clear throughout the equation system to be evaluated. In MOSAICmodeling this issue is addressed by giving synonyms to variables whenever variables of the same meaning have different names. This will be explained in greater length later in the manual.
Modeling Concepts
Proximity to literature In chemical engineering a large part of the models is based on conservation laws of mass, impulse and energy, transport equations, summation relations, and further phenomenon-specific relations. The resulting MESH model results in an equation system which is, depending on the special case, a root finding problem, an ordinary dierential or differential algebraic equation system. Such equation systems are also a very important means of description in other engineering disciplines. The presentations of such models in literature consist of a list of the relevant equations given in mathematical expressions using symbols that are specied in a given notation. The notation adds information to the model that is necessary for the correct use of the equations. The information given for each symbol is an important part of documentation for the creator of the model equations as well as for fellow researchers, students, and programmers. In literature, one variable can be named by several symbols including subscripted and superscripted elements; as opposed to an outright sequence of characters in conventional programming using languages like Fortran or Matlab. To reflect mathematical expressions in MOSAICmodeling, the variables are distinguished by their Variable Naming which consists of symbols on the base line and may have several superscripts, one fixed subscript and several indices taking values from 1 to a given maximum value. Furthermore, the Notation is a centrally important model element in MOSAICmodeling that reflects this classification of naming compartments.
Modularity Writing equations into a document or into a solving software takes time and is an error-prone process. In such a process many equations are rewritten many times: if a new model is created, the engineer often has to implement equations he has already written and corrected in other models. Furthermore, many equations are reimplemented the same way independently by different engineers. If sections of the model are re-written, time and personal resources are consumed, that could be used in much better ways. It makes sense to be able to re-use equations and equation systems that have been well tested. Thus, the user can create the equations that are essential in his model and that are really new and different from existing models, and he can use ready made equations for standard model parts. The reusability of small model parts down to equations is reflected in MOSAICmodeling. This is done by establishing the Equation as an independent model element. The model element Equation System is a combination of several Equation elements. Several Equation System elements can be put together to create a new Equation System.
When one equation system is added to another equation system with the same notation the coupling of the equations is directly visible by the names of the variables involved. In literature as well as in computer programs, however, the notations differ from model to model, so that variables with the same physical meaning may have different names. In general, different models will also use a different set of units. On the other hand, it might be desirable to see all model parts in one and the same notation even if some of them were created using a different notation. In this case, the variable would have at least two names: one in the original notation and one corresponding to the notation in the superordinate model. Further names may need to be added in the same way if the superordinate model is added to other models. To reflect this, MOSAICmodeling distinguishes between Variable and Variable Naming. One Variable has one or several Variable Namings. As the size of the equation systems grows, it becomes more and more difficult to provide distinct names in one notation. For example the symbol as vapor molar fraction for component i may be used in many Equation Systems that represent process units. Furthermore, this variable might occur in sub-models, etc. To avoid confusion and difficult naming conventions of variables, MOSAICmodeling allows the assignment of Equations and Equation Systems to different name spaces. Thus, equivalent Variable Namings assigned to different name spaces are considered as belonging to different variables.
Workflow
The following flow charts explain the basic navigation and workflow inside MOSAICmodeling.
- Green paths and blocks highlight standard MOSAICmodeling features, which will always be used by any user.
- Blue paths and blocks are optional features, which may be used.
- Purple paths and blocks are advanced optional features for expert users.
- Red paths and blocks are interactions with software, which is not part of MOSAICmodeling.
The latter of course depend on your local machine and the software available to you.
MOSAICmodeling consists of three main parts, which build upon one another: Modeling, Simulation, and Optimization. In addition, a number of advanced features exist, which will be added to the workflow subsequently. There is a stringent workflow from modeling to optimization:
The Simulation requires an existing Equation System generated in the Modeling step and the Optimization requires an existing Simulation. Each of these steps are described in the following:
- Procede to Modeling Workflow
- Procede to Simulation Workflow
- Procede to Optimization Workflow