Are you ready to talk?

Modifying parameters efficiently

Table of contents
This Modelica Basics post explores efficient ways to modify parameters in a model. While aimed at Dymola novices, it tackles a common pitfall that can easily lead to hours of wasted time, (like I have ☹).
 

Tuning a Vehicle to Navigate a Bend

Let’s consider the example of simulating a vehicle travelling around a bend in the track. The goal is to tune the velocity profile so the vehicle stays on the road throughout the simulation, by reducing speed in the corners.

The Model

The vehicle model used for this example is shown in Figure 1.

 

Vehicle model driving on an Open CRG

Figure 1. Vehicle model driving on a OpenCRG road that contains a corner 

The vehicle model is a simplified go-kart model used for testing purposes. It is intentionally lightweight, allowing for fast compilation and simulation, with relatively few signals, resulting in smaller output files. The road model uses OpenCRG, and the selected track includes a representative corner.

The road model is configured so that the vProfile table provides the target velocity for the vehicle, as shown in Figure 2.

Picture2- Parameter dialog for the road component

Figure 2. The parameter dialog for the road component has vOverride selected and the table vProfile set.

Simulation

This model is simulated and by tracing the vehicle it is obvious that the vehicle does not follow the road (Figure 3.)

Picture3 Vehicle model simulation

Figure 3. Vehicle model simulation shows the vehicle driving off the road after the bend

To define the vProfile table, we first need to identify where the corner occurs along the track. This requires analysing additional data, which is plotted in Figure 4.
 
Picture4 - Subplots of the road curvature
Figure 4. Subplots of the road curvature, the vehicles longitudinal velocity, and the error between the centreline and the vehicles position plotted against the sDriver location, (this is the distance along the centreline corresponding to the vehicles current location).
 

Modifying Prameters 

The instinctive approach would be to return to the Graphics layer in Dymola, modify the vProfile, and re-run the simulation. However, this triggers a full model re-translation, which can be time-consuming.

A more efficient approach is to locate and modify the relevant parameters directly in the Variable Browser, as shown in Figure 5, or via the Diagram layer, as shown in Figure 6.

Picture5 - Variable browser

Figure 5. The variable browser with the filter being used to search for vProfile

Picture6 Diagram

Figure 6. The Diagram can be navigated like the Graphics layer to modify parameters

Once the parameters have been modified, the vehicle can be re-simulated without triggering a full model re-translation, saving a significant amount of time.

In some cases, the parameters you want to adjust may not be available because Dymola has already evaluated them. For more details, along with a possible workaround, see Modifying evaluated parameters in multiple simulations – Claytex.

Note: Modified parameters are not automatically saved back to the Dymola model.

Storing the Modified Parameters

Once you have identified satisfactory parameter settings you should save them. This can be done by right-clicking the result in the Variable Browser and selecting “Save Start Values in Model”, as shown in Figure 7.

Picture7 the save start values

Figure 7. The Save Start Values dialog with the Current Variable Browser content is used to store the modified vProfile table in the original model.

The Save Start Values feature can be used to store either the current Variable Browser settings or the initial state values directly within a model. These values can be saved to the existing model, or used to create a new model if required.
 

Conclusion

Using this approach, it becomes quick and straightforward to identify suitable parameter settings that allow the vehicle to complete the track without leaving the road.

Overall, this method significantly reduces iteration time and can save a substantial amount of effort when refining simulations.

Need to talk to an expert?

Our engineering teams are on hand to provide tailored guidance and support with a deep knowledge of the full Dassault Systèmes portfolio.

Want to receive more content like this?

Sign up to receive a weekly roundup of Expert insights as they are published...

  • Related news & articles straight to your inbox
  • Hints, tips & how-tos
  • Thought leadership articles