> For the complete documentation index, see [llms.txt](https://www.opal-rt.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opal-rt.com/docs/hypersim/model-and-simulation/import-models-from-external-software-or-code/import-from-simulink-hyperlink/export-from-simulink/use-tunable-parameters.md).

# Use Tunable Parameters

This page describes how to use tunable parameters when importing Simulink models into HYPERSIM. Tunable parameters allow selected model variables to be modified directly in HYPERSIM without regenerating code in Simulink, which is especially useful during model tuning and testing.

## Configure tunable parameters in Simulink

To make parameters tunable in HYPERSIM, they must be defined as variables in the corresponding Simulink blocks before exporting the model.

{% stepper %}
{% step %}

### Define variables in Simulink blocks

Set the block parameters you want to tune (for example **q**) as workspace variables instead of fixed numeric values.
{% endstep %}

{% step %}

### Select tunable parameters

1. Open the Simulink model, then open the **Configuration Parameters** dialog:

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-14a5133ed8b438ab245150a7ccef0ad8531299bf%2Fsimulink-import-configuration-parameters.png?alt=media" alt=""><figcaption></figcaption></figure>

2. Navigate to **Code Generation > Optimization**. Next to **Default parameter behavior**, click **Configure**.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-e12045b2938708811b47b26ff2dcf62125abedc3%2Fsimulink-import-configure-tunable.png?alt=media" alt=""><figcaption></figcaption></figure>

3. In the **Source list**, select **Referenced workspace variables**. All variables used in the model are displayed.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-98cf0075640887af8aed6df66d1724b6e81869bb%2Fsimulink-import-referenced-workspace-variable.png?alt=media" alt=""><figcaption></figcaption></figure>

3. Select the variables to be made tunable. Then, click **Add to table** to include them in the tunable parameter list.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-d7e5e1b9885f1748d3638db2908567e9651b8361%2Fsimulink-import-add-to-table.png?alt=media" alt=""><figcaption></figcaption></figure>

3. Click **Apply**, then **OK**.

The selected variables will be treated as tunable parameters during code generation.
{% endstep %}
{% endstepper %}

## Modify tunable parameters in HYPERSIM

After importing the Simulink model into HYPERSIM:

* Tunable parameters are accessible through the block form of the imported model.
* Parameters can be modified directly without re‑exporting the Simulink code.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-8abf82e503724be79a1e45d2d036b85194093c99%2Fsimulink-import-tunable-parameters-hypersim.png?alt=media" alt=""><figcaption></figcaption></figure>

These changes take effect immediately in HYPERSIM and can be adjusted during iterative testing.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.opal-rt.com/docs/hypersim/model-and-simulation/import-models-from-external-software-or-code/import-from-simulink-hyperlink/export-from-simulink/use-tunable-parameters.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
