> 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/automation-api-and-scripting/hypersim-api-references/settings.md).

# Settings

## Function: analyze

| **Section**    | **Description**                                |
| -------------- | ---------------------------------------------- |
| **Action**     | Analyse                                        |
| **Parameters** | None                                           |
| **Returns**    | Error value (int)                              |
| **Raises**     | **AssertionError** – Raises exception on error |

## Function: buildTopology

| **Section**    | **Description**   |
| -------------- | ----------------- |
| **Action**     | Build topology    |
| **Parameters** | None              |
| **Returns**    | Error value (int) |
| **Raises**     | None              |

## Function: clearCodeDir

| **Section**    | **Description**      |
| -------------- | -------------------- |
| **Action**     | Clear code directory |
| **Parameters** | None                 |
| **Returns**    | Error value (int)    |
| **Raises**     | None                 |

## Function: genCode

| **Section**    | **Description**                                |
| -------------- | ---------------------------------------------- |
| **Action**     | Generate code                                  |
| **Parameters** | None                                           |
| **Returns**    | Error value (int)                              |
| **Raises**     | **AssertionError** – Raises exception on error |

## Function: getLoadFlowReport

| **Section**    | **Description**                                                                                             |
| -------------- | ----------------------------------------------------------------------------------------------------------- |
| **Action**     | <p>Get the load-flow report<br>(BETA: this feature is subject to improvements in the upcoming versions)</p> |
| **Parameters** | None                                                                                                        |
| **Returns**    | HYPERSIM load-flow report (LoadflowReport)                                                                  |
| **Raises**     | None                                                                                                        |

## Function: getModelTasks

| **Section**    | **Description**                                                                                                          |
| -------------- | ------------------------------------------------------------------------------------------------------------------------ |
| **Action**     | Get the task mapping configuration for the currently selected target.                                                    |
| **Parameters** | **file\_name** (*str*) – Name of the xml configuration to read. If none specified, the current configuration is returned |
| **Returns**    | HYPERSIM task-mapping report (TaskMapping)                                                                               |
| **Raises**     | None                                                                                                                     |

## Function: getPreference

| **Section**    | **Description**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Action**     | <p>Retrieve a model preference<br>Refer to the following pages of the documentation to find the preference names:<br>- <a href="https://opal-rt.atlassian.net/wiki/spaces/PDOCHS/pages/149881158/Simulation+Settings"><https://opal-rt.atlassian.net/wiki/spaces/PDOCHS/pages/149881158/Simulation+Settings></a><br>- <a href="https://opal-rt.atlassian.net/wiki/spaces/PDOCHS/pages/150144430/Task+Manager+Summary+and+Preferences"><https://opal-rt.atlassian.net/wiki/spaces/PDOCHS/pages/150144430/Task+Manager+Summary+and+Preferences></a></p> |
| **Parameters** | **prefName** (*str*) – preference name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| **Returns**    | Error value (int)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| **Raises**     | **AssertionError** – Raises exception on error                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |

## Function: loadModelTasks

| **Section**    | **Description**                                                                                                                                                |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Action**     | Load an apply a previously saved task mapping configuration.                                                                                                   |
| **Parameters** | **file\_name** (*str*) – XML file name where the configuration will be loaded from. If not specified, the default file 'preallocatedTasks.xml' will be loaded. |
| **Returns**    | HYPERSIM task-mapping report (TaskMapping)                                                                                                                     |
| **Raises**     | None                                                                                                                                                           |

## Function: mapTask

| **Section**    | **Description**                                |
| -------------- | ---------------------------------------------- |
| **Action**     | Map tasks                                      |
| **Parameters** | None                                           |
| **Returns**    | Error value (int)                              |
| **Raises**     | **AssertionError** – Raises exception on error |

## Function: setModelTasks

| **Section**    | **Description**                                                                                                                                                                                                                                                |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Action**     | Apply the task mapping configuration.                                                                                                                                                                                                                          |
| **Parameters** | <p><strong>mapping</strong> (<em>TaskMapping</em>) – Configuration to apply<br><strong>file\_name</strong> (<em>str</em>) – XML file name where the configuration will be saved. If not specified, only the current active configuration will be affected.</p> |
| **Returns**    | True if successful (bool)                                                                                                                                                                                                                                      |
| **Raises**     | None                                                                                                                                                                                                                                                           |

## Function: setPreference

| **Section**    | **Description**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Action**     | <p>Set a model preference to a specific value<br>Refer to the following pages of the documentation to find the preference names:<br>- <a href="https://opal-rt.atlassian.net/wiki/spaces/PDOCHS/pages/149881158/Simulation+Settings"><https://opal-rt.atlassian.net/wiki/spaces/PDOCHS/pages/149881158/Simulation+Settings></a><br>- <a href="https://opal-rt.atlassian.net/wiki/spaces/PDOCHS/pages/150144430/Task+Manager+Summary+and+Preferences"><https://opal-rt.atlassian.net/wiki/spaces/PDOCHS/pages/150144430/Task+Manager+Summary+and+Preferences></a></p> |
| **Parameters** | <p><strong>prefName</strong> (<em>str</em>) – preference name<br><strong>value</strong> (<em>str</em>) – preference value</p>                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| **Returns**    | Error value (int)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| **Raises**     | **AssertionError** – Raises exception on error                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |

## Function: setTarget

| **Section**    | **Description**                                                                                                                                                                                                      |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Action**     | Set simulation target                                                                                                                                                                                                |
| **Parameters** | <p><strong>hostname</strong> (<em>str</em>) – target IP<br><strong>mode</strong> (<em>str</em>) – simulation mode. Options:<br>- Offline (RTA): nrt\_optimized<br>- Offline (PMI) : nrt\_mpi<br>- Real-time : rt</p> |
| **Returns**    | Error value (int)                                                                                                                                                                                                    |
| **Raises**     | **AssertionError** – Raises exception on error                                                                                                                                                                       |

## Function: startLoadFlow

| **Section**    | **Description**                                |
| -------------- | ---------------------------------------------- |
| **Action**     | Load flow                                      |
| **Parameters** | None                                           |
| **Returns**    | Error value (int)                              |
| **Raises**     | **AssertionError** – Raises exception on error |


---

# 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/automation-api-and-scripting/hypersim-api-references/settings.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.
