Before getting involved in advanced ways of modelling we need to make sure the basics are in place. The better we set out the class in the first place, the easier our lives will be later on in the modelling.
I have written blog posts in this area in the past but it is a recurring issue and requires addressing. In this blog post I propose some simple solutions to the problems.
The two things I would like to write about in this blog post are:
- Using the grid in the diagram layer
- Using descriptions in class definitions
1. Using the grid in the diagram layer
The diagram layer grid is extremely useful when building models to help us size and position components in a way that reduces unnecessary visual complications that can end up overloading us with visual information and making the diagram layer more difficult to understand.
In figure 1, the models have been maintained at the same size as when they were first dragged and dropped into the diagram layer. The electro-mechanical system is nicely aligned along a horizontal grid line.
Like wise with the control blocks, their size has not been altered and they are aligned as best possible within the grid boxes.


Figure 2 shows a “messy” alternative to Figure 1 and presents several areas for improvement.
Issue 1:
Some of the objects have been unnecessarily resized and the connections no longer align nicely from one object to the next.
Solution:
Do not resize the components if this is not required, alternatively resize by multiples of 2 steps to maintain the ability to align the connection lines when you re-position the objects.
Issue 2:
Not all objects are within the white gridded area which is what Dymola will zoom in on by default. If we have positioned objects outside of this area like the cosntant force model on the right, we may miss this when looking for errors if the error relates to that component.
Solution:
Increase the white gridded area by zooming out, then clicking on its border and stretching it so that all objects are within it,
or
Reposition the objects so that they all sit within the existing white gridded area,
or
Create submodels using the “split model” functionality .
Conclusion: You are aiming for Figure 1, not Figure 2!
2. Using descriptions in class definitions
Descriptions, whether for parameter and variable declarations or Modelica classes, are very important to include. They help us remember what the parameter, variable or Modelica class represents.
One common pitfall to look out for is when you are duplicating a class or a parameter or variable declaration. You need to remember to update the description; otherwise, you will end up with multiple classes or parameter and variable declarations that have exactly the same description.
This becomes particularly confusing when using the “All matching choices” option when redeclaring an object where the list will include multiple items to choose from with exactly the same description.

Figure 3 shows an example of this where the user has duplicated the “Large Off Road …..” car model several times but forgotten to update the existing description of it. Although the models are separate models, it is not easy to determine what the difference is between them.
Conclusions
Try to be organised and probably pedantic right from the start. Small efforts here and there whilst things are fresh in your mind are easy to apply. This will reduce the need for more extensive fixes and improvements later on in the development. It will also make it far easier for others to understand and use your models.
Written by: Alessandro Picarelli – Engineering Director
Please get in touch if you have any questions or have got a topic in mind that you would like us to write about. You can submit your questions / topics via: Tech Blog Questions / Topic Suggestion.