# Getting more from simulation – Part 3 Component orientated modelling versus block diagram modelling

Download a copy of the article as a pdf: Component oriented modelling versus block diagrams

Written by Mike Dempsey, Claytex

In this 3rd article in the series “Getting more from simulation” we will compare the component orientated, physical modelling approach used in Dymola with the traditional block diagram modelling approach used in tools like Simulink. Dymola supports a component orientated approach to modelling where each object in the model diagram represents a physical part in the system.  Simulink, on the other hand, supports a block diagram approach to modelling that requires the user to manually rearrange the equations defining the system in to a block diagram.  The block diagram is then a graphical representation of the equations solved to perform a specific calculation.

The example below illustrates a simple system model built in Dymola.  The system consists of an electric motor connected to a 1D rotational inertia and a load inertia via a gearbox. The voltage supplied to the motor is determined using a PID controller that aims to match the rotational speed of the load inertia to the set-point defined in the step function. To create the same diagram using a block diagram approach would require the modeller to first determine all the equations required to model each part of the system and to then manually rearrange these in to the correct calculation order. Using Dymola, the process of rearranging the equations is taken care of automatically using symbolic manipulation. Working through this process would yield the following block diagram. The two models shown above are identical and produce the same results. The real advantage of the component orientated modelling approach can be realised if we consider what would happen at the next stage of the project. Typically, as a project progresses the models need to include more detail to support the next phase of development. In this example, a simple enhancement that would need to be made to the model is to account for compliance in the gearbox as this would introduce oscillations during transients between the speed set-points.

To make this change using Dymola and the component orientated modelling approach we would simply drag and drop a spring-damper block from the library in to the model and connect it between the gearbox and load inertia as shown below. This change can be accomplished very quickly and the new model can be available in matter of seconds. To update the block diagram version of the model you would first have to discard half of the model from the first stage because this solution to the model equations doesn’t include the compliance in the gearbox. The model developer has to determine the new equations for the compliant system and create the block diagram highlighted in red. This will take even an expert mathematical  modeller time to complete and open the door to potential manual error, whereas the alteration using Dymola could be achieved quickly without detailed knowledge of the mathematics required. The traditional approach described here has been born from the requirement for engineers to do more simulation so that businesses can reduce costs. Engineers rightly choose a tool they are familiar with and have access to, in Simulink. The concern is that this tool was designed for the very specific purpose of designing control systems. It does it very well and is why Dymola has a seamless interface with the software and can appear as a Simulink block in any model.

Dymola is however a better tool for simulation. The reason is that, as Simulink was designed from the ground up for control system engineers, Dymola was designed from the ground up for simulation engineers. Simulation happens across every functional department within a development team (mechanical, hydraulic, pneumatic, electrical, systems etc) and so Dymola is capable to serve every functional department within a development team too. In the next article in this series we will explore how the component orientated modelling approach enables the extensive reuse of models to perform different types of analysis.

The next article in the series is available here.