> 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/general.md).

# General

## Function: closeHyperWorks

| **Section**    | **Description**  |
| -------------- | ---------------- |
| **Action**     | Close HyperWorks |
| **Parameters** | None             |
| **Returns**    | None             |
| **Raises**     | None             |

### **Example Usage**

{% code overflow="wrap" lineNumbers="true" %}

```python
HyWorksApi.closeHyperWorks()
```

{% endcode %}

## Function: closeLibrary

| **Section**    | **Description**                                                      |
| -------------- | -------------------------------------------------------------------- |
| **Action**     | close a CLF library located at the specified 'libraryPath'.          |
| **Parameters** | **libraryPath** (*str*) – The path to the CLF library to be closed.  |
| **Returns**    | True if the library was successfully closed; False otherwise. (bool) |
| **Raises**     | None                                                                 |

## Function: connectToHyWorks

| **Section**    | **Description**                                                                                                                                                                                                                                            |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Action**     | Connect HyJavaApi to HYPERSIM                                                                                                                                                                                                                              |
| **Parameters** | <p><strong>host</strong> (<em>str</em>) – computer name<br><strong>register</strong> (<em>str</em>) – user name<br><strong>timeout</strong> (<em>int</em>) – timeout for function<br><strong>id</strong> (<em>int</em>) – Hyworks index to register to</p> |
| **Returns**    | Error value (int)                                                                                                                                                                                                                                          |
| **Raises**     | **AssertionError** – Raises exception on error                                                                                                                                                                                                             |

## Function: disableHyWorksApiExceptions

| **Section**    | **Description**                                                      |
| -------------- | -------------------------------------------------------------------- |
| **Action**     | Disable HyWorksApi from returning HYPERSIM exceptions through Python |
| **Parameters** | None                                                                 |
| **Returns**    | None                                                                 |
| **Raises**     | None                                                                 |

## Function: enableHyWorksApiExceptions

| **Section**    | **Description**                                                |
| -------------- | -------------------------------------------------------------- |
| **Action**     | Enable HyWorksApi to return HYPERSIM exceptions through Python |
| **Parameters** | None                                                           |
| **Returns**    | None                                                           |
| **Raises**     | None                                                           |

## Function: getApiSession

| **Section**    | **Description**                                                                                                                                        |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Action**     | <p>Retrieve the currently active API session with HyWorks<br>Note : To be used only when multiple HYPERSIM instances are required at the same time</p> |
| **Parameters** | None                                                                                                                                                   |
| **Returns**    | None                                                                                                                                                   |
| **Raises**     | None                                                                                                                                                   |

## Function: getCurrentDesign

| **Section**    | **Description**                                    |
| -------------- | -------------------------------------------------- |
| **Action**     | Get the currently focused HYPERSIM design.         |
| **Parameters** | None                                               |
| **Returns**    | Path to the currently active HYPERSIM design (str) |
| **Raises**     | None                                               |

## Function: getProperties

| **Section**    | **Description**                         |
| -------------- | --------------------------------------- |
| **Action**     | Get current HYPERSIM general properties |
| **Parameters** | None                                    |
| **Returns**    | HYPERSIM general properties (str)       |
| **Raises**     | None                                    |

## Function: getProperty

| **Section**    | **Description**                                                                                                                                                                                                                                                                               |
| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Action**     | <p>Get HYPERSIM property<br>Refer to the following page of the documentation to find the properties names:<br>- <a href="https://opal-rt.atlassian.net/wiki/spaces/PDOCHS/pages/149979423/Preferences"><https://opal-rt.atlassian.net/wiki/spaces/PDOCHS/pages/149979423/Preferences></a></p> |
| **Parameters** | **key** (*str*) – property key                                                                                                                                                                                                                                                                |
| **Returns**    | HYPERSIM property (str)                                                                                                                                                                                                                                                                       |
| **Raises**     | **AssertionError** – Raises exception on error                                                                                                                                                                                                                                                |

### **Example Usage**

{% code overflow="wrap" lineNumbers="true" %}

```python
HyWorksApi.getProperty("hyworks.hysim.extraTimeout")
```

{% endcode %}

## Function: getVersion

| **Section**    | **Description**                                                                                 |
| -------------- | ----------------------------------------------------------------------------------------------- |
| **Action**     | Get the current HYPERSIM version name                                                           |
| **Parameters** | **long** (*bool*) – Add 'hypersim\_' prefix, which is necessary for certain compatibility usage |
| **Returns**    | HYPERSIM version (str)                                                                          |
| **Raises**     | None                                                                                            |

## Function: newApiSession

| **Section**    | **Description**                                       |
| -------------- | ----------------------------------------------------- |
| **Action**     | Create a new API disconnected API session for HyWorks |
| **Parameters** | None                                                  |
| **Returns**    | None                                                  |
| **Raises**     | None                                                  |

## Function: openLibrary

| **Section**    | **Description**                                                                                                                                                                                                                                         |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Action**     | opens a CLF library located at the specified 'libraryPath'.                                                                                                                                                                                             |
| **Parameters** | <p><strong>libraryPath</strong> (<em>str</em>) – The path to the CLF library to be opened.<br><strong>visible</strong> (<em>bool</em>) – (Optional) A boolean indicating whether the library should be opened in a visible state (default is True).</p> |
| **Returns**    | True if the library was successfully opened; False otherwise. (bool)                                                                                                                                                                                    |
| **Raises**     | None                                                                                                                                                                                                                                                    |

## Function: setApiSession

| **Section**    | **Description**                                                    |
| -------------- | ------------------------------------------------------------------ |
| **Action**     | Activates a previously save API session retrieved by getApiSession |
| **Parameters** | **session** (*HyWorksGRPCSession*) – gRPC Session                  |
| **Returns**    | The currently active session (HyWorksGRPCSession)                  |
| **Raises**     | None                                                               |

## Function: setProperty

| **Section**    | **Description**                                                                                                                                                                                                                                                                                       |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Action**     | <p>Set HYPERSIM general property<br>Refer to the following page of the documentation to find the properties names:<br>- <a href="https://opal-rt.atlassian.net/wiki/spaces/PDOCHS/pages/149979423/Preferences"><https://opal-rt.atlassian.net/wiki/spaces/PDOCHS/pages/149979423/Preferences></a></p> |
| **Parameters** | <p><strong>key</strong> (<em>str</em>) – property key<br><strong>value</strong> (<em>str</em>) – property value<br><strong>save</strong> (<em>bool</em>) – save preferences for the next session</p>                                                                                                  |
| **Returns**    | Error value (bool)                                                                                                                                                                                                                                                                                    |
| **Raises**     | **AssertionError** – Raises exception on error                                                                                                                                                                                                                                                        |

### **Example Usage**

{% code overflow="wrap" lineNumbers="true" %}

```python
HyWorksApi.setProperty("hyworks.hysim.extraTimeout", "1200000")
HyWorksApi.setProperty("hyworks.hysim.extraTimeout", "1800000", True)
```

{% endcode %}

## Function: startAndConnectHypersim

| **Section**    | **Description**                                                                                                                                                                                                                                                                                                                                                                                |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Action**     | Starts HYPERSIM and connect HyWorksApi to it in a single call.                                                                                                                                                                                                                                                                                                                                 |
| **Parameters** | <p><strong>host</strong> (<em>str</em>) – computer name<br><strong>register</strong> (<em>str</em>) – user name<br><strong>stdout</strong> – standard output<br><strong>stderr</strong> – standard error<br><strong>timeout</strong> (<em>int</em>) – timeout for connecting to an existing one<br><strong>starting\_timeout</strong> (<em>int</em>) – timeout for starting a new instance</p> |
| **Returns**    | Error value (int)                                                                                                                                                                                                                                                                                                                                                                              |
| **Raises**     | **AssertionError** – Raises exception on error                                                                                                                                                                                                                                                                                                                                                 |

## Function: startHyperWorks

| **Section**    | **Description**                                                                              |
| -------------- | -------------------------------------------------------------------------------------------- |
| **Action**     | Start HYPERSIM                                                                               |
| **Parameters** | <p><strong>stdout</strong> – standard output<br><strong>stderr</strong> – standard error</p> |
| **Returns**    | None                                                                                         |
| **Raises**     | None                                                                                         |

### **Example Usage**

{% code overflow="wrap" lineNumbers="true" %}

```python
HyWorksApi.startHyperWorks()
```

{% endcode %}


---

# 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/general.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.
