> 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/rt-lab/automation-api-and-scripting/rt-lab-api/c-rt-lab-api-reference/functions-reference/opalopenproject.md).

# OpalOpenProject

<table data-header-hidden><thead><tr><th width="199.77777099609375"></th><th></th></tr></thead><tbody><tr><td><strong>Group</strong></td><td>Model and project selection</td></tr><tr><td><strong>Description</strong></td><td>Connects the API to an active project and contained models. Subsequent API calls refer to this project and models.</td></tr><tr><td><strong>Required Control</strong></td><td>None</td></tr><tr><td><strong>Usage</strong></td><td>int <strong>OpalOpenProject</strong>(const char * projectPath, unsigned short returnOnAmbiguity, OP_API_INSTANCE_ID* instId);</td></tr><tr><td><strong>Input</strong></td><td><ul><li><strong>projectPath:</strong> the name of the .llp file that refers to the project. A full relative or absolute path is preferred, but the file name alone will work provided the executable from which this call is made is in a subdirectory of the project.</li><li><strong>instId:</strong> The id of the model instance to which the connection is to be made. Should be set to 0 if projectPath is specified.</li><li><strong>returnOnAmbiguity:</strong> If set to non-zero, a pop-up will come up if the projectPath is ambiguous, otherwise and error is returned without a pop-up.</li></ul></td></tr><tr><td><strong>Output</strong></td><td>None</td></tr><tr><td><strong>Return value</strong></td><td><ul><li><strong>EOK:</strong> Success.</li><li><strong>EIO:</strong> Error sending the request or receiving the reply.</li><li><strong>ESRCH:</strong> Invalid instance id or instance id not found.</li><li><strong>EPERM:</strong> Control requested, but already given to another client.</li><li><strong>ENOEXEC:</strong> Could not connect to model. Not all of the subsystems are still active.</li><li><strong>EINVAL:</strong> Trying to connect to a model whose local and UNC path are both empty.</li><li><strong>ENOENT:</strong> Could not find the original model we are trying to connect to.</li><li><strong>OP_API_EBAD_CONFIG:</strong> Node mapping not valid or IP address of controller machine not specified (environment variable OPAL_META_CTL_IP not set).</li><li><strong>OP_API_EBAD_PHYS_NODE:</strong> Physical node not found.</li><li><strong>OP_API_EMODEL_CHANGED:</strong> The original model has been changed (number of sub-systems, sub-systems names, etc.</li><li><strong>OP_API_ENO_LICENSE:</strong> No license.</li><li><strong>OP_API_ENO_PRODUCT:</strong> No license for RT-LAB and RT-LABx.</li><li><strong>OP_API_MODEL_IO_ TIMEOUT</strong></li><li><strong>OP_API_MODEL_IO_ERROR:</strong> Model is missing some or all processes or subsystems.</li></ul></td></tr><tr><td><strong>Examples</strong></td><td>See example <strong>basic_example1, 2, blob1.c, acquisition1.c</strong></td></tr><tr><td><strong>Related items</strong></td><td>OpalConnectByName (deprecated), OpalDisconnect (deprecated), OpalCloseProject</td></tr></tbody></table>


---

# 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/rt-lab/automation-api-and-scripting/rt-lab-api/c-rt-lab-api-reference/functions-reference/opalopenproject.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.
