*«A good model is a judicious trade-off between realism and simplicity.” *[Anu Maria, Introduction to modeling and simulation]

This statement perfectly highlights the challenge of choosing the right level of modeling / assumptions when starting a new simulation study. It is particularly true when you want to reach real-time capability for doing **virtual sensing**, **IIOT on edge**, **model-based system testing** or simply want to have your model **running faster**.

In this blog post, we provide you with some tips on how to make your Simcenter Amesim models run faster.

This can be done through the following best practices:

- Avoid generating implicit variables
- Avoid useless states variables
- Define the best simulation run parameters
- Avoid useless discontinuities
- Save only useful variables
- Condition correctly your maps

## Avoid generating implicit variables

Implicit variables are generated by the solver whenever there is an **algebraic loop** in the system. An algebraic loop occurs when there is no order in which the submodels can be called such that all the inputs of each submodel are known when the submodel is called.

Example: ? = (?, ?)

The solution to remove an implicit loop can be to include a time constant within the loop (inertia, first order lag, inductor …) or to remove the calculation of the variable generating the algebraic loop.

## Avoid useless states variables

The computation time is directly impacted by the number of states N. For a standard problem to solve within Simcenter Amesim, Adams’ method is used where CPU = k*N. When backward differential formulae method is used, CPU=k1*N + k2*N².

The solution to reduce the number of states variables is to **group hydraulic volumes, mechanical masses or electric resistances**.

## Define the best run parameters

Usually, the higher the tolerance of the integrator is, the higher the simulation time is.

The solution is to **minimize the tolerance parameter** without compromising the simulation results accuracy.

## Avoid useless discontinuities

A discontinuity appears when a variable is suddenly jumping from one value to another (switch from laminar to turbulent flow, friction stick-slip, hysteresis…). This causes a restart of the solver to manage the interpolation between the two values.

The solution for avoiding useless discontinuities can be to **disable the discontinuity handling** of tabulated submodels (when possible) or to **add damping**.

## Save only useful variables

Simulation results are written in a data file all along the simulation and by default all submodels variables are saved (the frequency of the results saving is set by the user in Run Parameters’ Print interval).

The solution for reducing the number of saved data is either to **save only the required variables** or to **increase the print interval** (for the complete simulation or dynamically during the simulation).

## Condition correctly your maps

Maps imported from experimental data can typically be quite noisy or contain discontinuities.

The solution to properly condition your maps is either to **disable the discontinuity handling**, use an **appropriate data sample** or **filter the noisy signals**.

## Print out our step-by-step process

Most of the information above are explained in the infographic below, for the particular case of reaching real-time capacity:

Finally, a dedicated hands-on workshop can be organized on-site to walk you through the process.

## Need more information?

Contact your local Siemens PLM team or ask a question on our System Simulation Forum.