> 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/create-oem-controller-code.md).

# Create OEM Controller Code

## Overview

As power systems incorporate increasing levels of inverter-based resources (IBRs), accurately modeling converter-driven behavior has become essential for ensuring grid reliability and stability. In this context, HYPERSIM's controller code integration capability enables end users and equipment manufacturers to simulate real controller behavior with a high degree of fidelity.

For utilities, Transmission System Operators (TSOs), and Regional Transmission Organizations (RTOs), integrating OEM controller code is critical for obtaining accurate simulation results. Generic models often fail to represent the behavior of actual equipment and can be difficult or impossible to tune, particularly when control and power circuitry are closely coupled. Direct integration of OEM code ensures that simulations accurately reflect the control and protection systems deployed in the field.

For equipment manufacturers, HYPERSIM provides a secure environment for model development and validation. A black-box implementation protects intellectual property while allowing users to simulate real controller behavior. Manufacturers can also leverage the same code base for both physical devices and simulation models, ensuring consistency between testing and field operation and facilitating compliance with industry standards such as IEEE 2800.

Real-time electromagnetic transient (EMT) simulation, combined with Software-in-the-Loop (SIL) and Hardware-in-the-Loop (HIL) methodologies, enables the validation of controller code and system interactions under realistic operating conditions. This significantly reduces testing, commissioning, and deployment risks.

As interconnection studies become increasingly complex, the ability to perform accurate EMT simulations using OEM controller code has become a key requirement. HYPERSIM addresses this need by providing a standardized, secure, and high-performance framework for controller code integration, enabling effective collaboration between utilities, system operators, and equipment manufacturers.

The integration of **OEM controller code** into HYPERSIM enables high-fidelity simulation of inverter-based resources (IBRs) while protecting intellectual property and ensuring model accuracy. It provides a seamless link between the proprietary control algorithms developed by equipment manufacturers and the real-time simulation environment used by system operators, consultants, and engineers to assess grid stability, performance, and compliance.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-44656b242d3d4d41aab578f247fe071e76323043%2Foem-principle.jpg?alt=media" alt=""><figcaption></figcaption></figure>

* **For utilities, TSOs, and RTOs**, support for black-box controller models enables simulations that accurately reflect the behavior of field-deployed equipment. This improves the reliability of interconnection studies, fault response analysis, and compliance assessments against standards such as IEEE 2800-2022.
* **For OEMs**, the integration framework enables the reuse of production-grade controller code within simulation environments, supporting a streamlined development, testing, and validation process. At the same time, proprietary algorithms remain protected while allowing comprehensive evaluation of system performance under a wide range of operating conditions.

The feature also supports **Software-in-the-Loop (SIL) and Hardware-in-the-Loop (HIL)** workflows, making it well suited for controller development, system validation, plant commissioning, and grid-code compliance testing.

### Challenges in OEM controller code integration

Despite its many advantages, integrating OEM controller code into simulation environments presents a number of technical and organizational challenges. These challenges must be addressed to ensure reliable deployment, optimal performance, and accurate validation of controller behavior.

<details>

<summary>Real-time performance constraints</summary>

Simulation performance is critical when running in real time. OEM controllers often involve tight timing constraints related to:

* Control loop sample time
* High pulse-width modulation frequency (Fₚₛwₘ)
* Processing communication delays

Meeting these requirements in an EMT solver while maintaining determinism and stability is non-trivial, especially as the plant complexity grows

</details>

<details>

<summary>No access to source code</summary>

In many cases, OEMs only provide binary code (DLL, SO) with no access to the source. This limits debugging and integration flexibility and requires well-defined and secure APIs to encapsulate controller behavior.

</details>

<details>

<summary>Inconsistent code formats</summary>

OEM binaries are often delivered in diverse, non-standardized formats, some tailored to Simulink/Embedded Coder, others to custom environments or proprietary tools. The lack of a universal standard complicates integration, versioning, and compatibility across simulation platforms.

</details>

<details>

<summary>Multi-rate execution and resampling</summary>

OEM controllers may operate with multiple internal time steps, especially when different control loops or protection functions are involved. This necessitates precise signal resampling, interpolation, and synchronization to avoid artifacts during simulation.

</details>

<details>

<summary>Complexity of switch modeling</summary>

Simulating power electronic devices accurately may require:

* Average-value models
* Switching-function models
* Or detailed switch-level models

The controller code must remain stable and responsive across these different levels of abstraction, which can affect its performance or output behavior.

</details>

<details>

<summary>System and plant model complexity</summary>

When simulating full IBR plants:

* Multiple controllers may be instantiated
* Large numbers of DLLs/SOs are loaded
* The simulation must solve a large EMT network with fine time steps

This increases the computational burden, especially for real-time execution, and demands careful resource allocation (e.g., multi-core CPUs, FPGAs) and model partitioning strategies.

</details>

To address the challenges of OEM controller code integration, HYPERSIM provides a **unified framework** that supports multiple integration approaches, from low-level **UCMs** to industry-standard interfaces such as **IEEE/CIGRÉ B4.82** and **FMI**.

All approaches share the same underlying architecture, ensuring consistent workflows, strong IP protection, and high simulation performance. The framework also simplifies controller integration and enhances scalability across both offline and real-time simulation environments.

### Accelerate OEM controller integration with HYPERSIM

The integration of proprietary controller code into EMT simulations is becoming essential for renewable energy plants, FACTS devices, and other converter-based resources. HYPERSIM addresses this need with a flexible, high-performance framework that simplifies OEM code integration and accelerates model validation.

<details>

<summary>Seamless integration without hardware communication delays</summary>

A key advantage of HYPERSIM is its ability to execute OEM controller code directly within the simulation engine, without relying on external hardware loops. By running the controller code on the same processor as the EMT solver, HYPERSIM minimizes latency, eliminates synchronization constraints, and simplifies the development of high-fidelity simulation models.

</details>

<details>

<summary>High simulation performance powered by modern x86 architectures</summary>

HYPERSIM is built on a native x86 architecture that leverages high-frequency, multi-core CPUs to deliver high-performance real-time simulation. This computing platform supports simulation time steps below 10 μs, enabling accurate modeling of fast-switching power electronic systems and detailed control dynamics. The resulting low-latency execution environment helps maintain simulation fidelity, particularly for complex and time-sensitive controller algorithms.

In addition, HYPERSIM supports standard software development workflows and compilers, allowing OEM controller code to be integrated with minimal modification. Developers can reuse existing code bases without porting them to ARM architectures or adapting them to specialized embedded toolchains, significantly reducing integration effort and validation time.

</details>

<details>

<summary>Developer-friendly compilation and deployment workflow</summary>

OEMs can compile their controller code using standard C/C++ compilers (e.g., GCC or Intel), without requiring proprietary IDEs or FPGA toolchains. Developers can build libraries directly on their laptop, using familiar environments such as Windows Subsystem for Linux (WSL) or Linux virtual machines, or on their real-time simulator. This flexibility speeds up onboarding, reduces integration overhead, and allows parallel development with minimal dependency on IT.

</details>

<details>

<summary>Scalable software architecture for multi-controller simulation</summary>

HYPERSIM's modern simulation engine can accommodate many concurrent DLLs or OEM controllers, supporting systems with 16 to 32 CPU cores or more. This scalability makes it possible to model an entire grid where each inverter or controller runs its logic block without the architectural limitations found in fixed-core environments. The platform can also support controllers with multiple internal sampling rates, as well as hybrid configurations mixing UCM, CIGRE, and FMU libraries and models generated from tools like Simulink or written in C/Fortran.

</details>

<details>

<summary>No Additional Hardware or Cabling Required</summary>

Because controller integration is performed entirely in software, no external hardware is needed to run OEM code in the simulation. There is no need for specialized interface cards, communication cables, or dedicated processing modules. Everything runs on the base simulator or on a regular workstation for offline simulations. This greatly reduces cost, simplifies the testing environment, and streamlines setup in laboratories or cloud-based testing infrastructures.

</details>

<details>

<summary>Offline Simulation on Workstations</summary>

HYPERSIM supports non-real time (accelerated) simulation on standard Windows workstations, allowing users to test, tune, and validate their controller integration without requiring access to a real-time platform. This is ideal for early development, debugging, and integration workflows involving multiple stakeholders.

</details>

<details>

<summary>Automated Task Distribution</summary>

HYPERSIM platform incorporates a task mapping tool that can automatically distribute simulation and controller tasks across CPU cores. This simplifies multi-controller deployment and optimizes CPU resource usage without manual configuration.

</details>


---

# 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/create-oem-controller-code.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.
