Working with Expandable Connectors

Written by: Hannah Hammond-Scott  – Senior Engineer

Large models, like the VeSyMA vehicle models, need a signal bus to pass information between the subsystems. Such models are often built from templates containing replaceable subsystems, so we cannot know definitively what signals we will need to pass on the signal bus because the subsystems can change. Normal connectors do not have the flexibility needed for a signal bus, as they require all the signals to be predefined before we use them. The Modelica language provides expandable connectors as a solution for creating a signal bus.

So What Makes Expandable Connectors Different?

If we look at part of the signal bus in a VeSyMA vehicle it illustrates how using expandable connectors is different to using normal connectors for a signal bus. In the vehicle body there is a sensors subsystem where vehicle metrics are measured and added to the signal bus to be shared with other subsystems. A typical metric measured here is the vehicle’s longitudinal velocity. Figure 1 compares how this is implemented in the VeSyMA vehicle using expandable connectors versus using normal connectors.

Figure 1: Comparison of a signal bus using expandable connectors and normal connectors

(Click on the image to see a larger version)

Firstly, let’s look at the connectors themselves. The expandable connector ChassisBus is empty, while the normal connector, ChassisBusConnector contains a declaration of the signal we want to pass around, longitudinalVelocity.

Now let’s see how we add our signal to the bus. With the expandable connector, all we need to do is draw a connection between the velocity sensor output and the chasssisBus in the Diagram layer. At this point we specify the name of the signal on the bus, in this case longitudinalVelocity, using the dialog box shown in Figure 2. The signal name is shown in the connect statement automatically created in the model code.

Figure 2: Create Connection dialog used when adding a signal to the signal bus

Using a normal connector, we need to add an equation to the model’s code in order to add the velocity sensor output to the signal bus. The signal name is already defined in the ChassisBusConnector, so we need to make sure this is the name we use in the equation.

When taking a signal off the bus, similar methods are used to those above. For the expandable connector, the Create Connection dialog automatically provides a list of signals from which to choose the output from the bus. Whereas for the normal connector, you would need to check the variables defined in the connector before writing the equation assigning the output from the bus, which is less user friendly.

Where Does That Signal Come From?

A further benefit of using expandable connectors to create a signal bus is the ability to trace the signal easily. Dymola provides two methods to investigate where the source of a signal is and where it is used.

The first is Find Connection. Right click on a connection in the Diagram Layer and select the Find Connection option from the menu. This opens a list showing where the signal is added to the signal bus and all the places where the signal is output for use.

Figure 3: Find Connection lists the source and use of a signal

The second is to trace signals when simulating a model. To enable this option go to the Simulation menu, select Setup and check Log bus signal sets in the Translation tab. This adds a list to the Simulation Log of where every signal originates and where it is used in the model.

Figure 4:  Log of all the bus signals in the model during simulation

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.


Got a question? Just fill in this form and send it to us and we'll get back to you shortly.


© Copyright 2010-2017 Claytex Services Ltd All Rights Reserved. | Designed by CMA Marketing

Log in with your credentials

Forgot your details?