Building submodels in separate libraries is an advanced topic. It can be useful to reduce the time taken to build large models when only local changes are being made, but it is only impossible in specific circumstances, and in these cases, model behaviour can be unpredictable.
When a model is built, it is first translated into C++ source code, and then the source code is compiled (using the GCC or Microsoft Visual C compilers) into a dynamic link library (*.dll) or shared object (*.so) file. A single library is prepared for the whole model, so if any change (however small) is made to any part of the model, the whole library must be re-compiled. This can take a long time. In order to avoid this, it is possible to specify that one or more submodels should be compiled into separate libraries. If nothing in the submodel is changed, it is not necessary to re-compile the library. Breaking a large model into several smaller libraries in this way can substantially reduce build times when a localised change is made, affecting only one of the libraries.
In general any submodel can be flagged to build separately, but there are a number of cases in which it is not possible. These are if it:
In addition to the above prohibitions, there is a more complex class of restriction. If one separately-built submodel relies on another separately-built submodel for the calculation of some of its elements, whilst the other also relies on the first for the calculation of the same elements, there can be conflicts. In preparing the C++ code, these cases are handled appropriately wherever possible, but the results cannot be guaranteed. If you suspect a model is behaving strangely in these circumstances, it would be best to build the model as a single library.
In: Contents >> Working with submodels >> Submodel properties