Skip to content

Installation

On this page, the installation process of ERS will be explained. We will go through the following steps:

  • Adding ERS as a dependency to your project.
  • Activating an ERS license.

Adding the ERS dependency

First, you need to add ERS as a dependency to your project.

Note

We assume you have a C++ development environment set up with CMake installed.

Add the following CMakeLists.txt in the root directory of your project. You can also view it on GitHub. This CMake configuration will download a setup.cmake file for ERS, which will be used to download ERS and configure linking.

cmake_minimum_required (VERSION 3.20)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

project(ERS_Template VERSION 0.1)

set(ERS_VERSION "0.7.2")
set(ZIP_URL "https://github.com/Incontrolsim/ERS_Binaries/releases/download/${ERS_VERSION}/ERS_CPP.zip")
set(ZIP_FILE "${CMAKE_BINARY_DIR}/ERS_CPP.zip")
set(EXTRACT_DIR "${CMAKE_BINARY_DIR}/ers_cpp")

if(NOT EXISTS "${ZIP_FILE}")
    # Download
    file(DOWNLOAD
        "${ZIP_URL}"
        "${ZIP_FILE}"
        SHOW_PROGRESS
    )

    # Extract
    file(ARCHIVE_EXTRACT
        INPUT "${ZIP_FILE}"
        DESTINATION "${EXTRACT_DIR}"
    )
endif()


# Add command line arguments for specific compilers
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
    add_compile_options(-fPIC)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
    add_compile_options(-fPIC)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
endif()

# Create ERS target
file(GLOB_RECURSE ERS_SDK_SOURCES
    "${EXTRACT_DIR}/SDK/Include/*.cpp"
    "${EXTRACT_DIR}/SDK/Include_Minimal/*.cpp"
)
add_library(ers STATIC ${ERS_SDK_SOURCES})
set_property(TARGET ers PROPERTY CXX_STANDARD 20)
if (MSVC)
    target_compile_options(ers PUBLIC /Zc:preprocessor)
endif()
target_include_directories(ers SYSTEM PUBLIC
    "${EXTRACT_DIR}/SDK/Include/Common"
    "${EXTRACT_DIR}/SDK/Include/Ers"
    "${EXTRACT_DIR}/SDK/Include_Minimal"
)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
    target_link_libraries(ers PUBLIC "${EXTRACT_DIR}/bin/GNU/libers-engine.so")
    target_link_libraries(ers PUBLIC atomic)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
    target_link_libraries(ers PUBLIC "${EXTRACT_DIR}/bin/Clang/libers-engine.so")
    target_link_libraries(ers PUBLIC atomic)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
    target_link_libraries(ers PUBLIC "${EXTRACT_DIR}/lib/MSVC/ers-engine.lib")
endif()

# Helper function to automatically copy ers-engine DLL or so file to build directory
function(ERS_copy_dll_so target)
    add_custom_command(TARGET ${target} POST_BUILD
        COMMAND ${CMAKE_COMMAND} -E copy_directory
        "${EXTRACT_DIR}/bin/${CMAKE_CXX_COMPILER_ID}"
        $<TARGET_FILE_DIR:${target}>
    )
endfunction()

add_subdirectory(CppExample)

Please rename ERS_Template with your own project name. Let's now make sure that ERS is working correctly, and let's activate a license. To do this, add the following code to your main.cpp file:

#include "Ers/Api.h"
#include "Ers/Logging.h"

int main(int argc, char** argv)
{
    Ers::Initialize();

    Ers::Logger::Info("Hello ERS!");

    Ers::Uninitialize();
    return 0;
}

Note

We assume you have set up Visual Studio for C# development and are familiar with setting up a C# console app. If not, please follow Microsoft's installation instructions, and the "Create a simple C# console app in Visual Studio" tutorial up to "Create the app" to set up a C# project in Visual Studio.

Important

Please ensure that when creating the Console app project that you select the non .NET framework version.

Project selection

Once you have a C# console app set up, you can add ERS as a dependency via the command:

dotnet add package Ers

Let's now make sure that ERS is working correctly, and let's activate a license. To do this, add the following code to your Program.cs file:

using Ers;

ERS.Initialize();

Logger.Info("Hello ERS!");

ERS.Uninitialize();

ERS is first initialized using the Initialize function. This function checks for a valid license and loads all ERS functions. The last function (Uninitialize) does the opposite: it frees all resources that were loaded in the initialize function. ERS should always be initialized once before using any ERS functions, and should always be uninitialized before exiting your program.

The function in between logs the message "Hello ERS!" as an info level log in ERS. For more information about logging, see the logging section of the documentation.

You can now build and run your program. If all goes correctly, a console window should appear and you should see a message asking for your license.

Activating your license

Important

Activation will not start until you actually run a model, or you explicitly force it. If you want to trigger it without running a model, see the Forcing activation programmatically section for more details.

You don't have a valid license, or it might be expired
if you had a local ERS license it will be deactivated
Welcome to the ERS Activation.
To activate ERS please select one of the following licensing options:
0) Online(License Keys)
1) Free
2) Air gapped
Please write down the digit and press enter:
>

You can now select which type of license you want to activate.

In case we gave you access and you received a username and password instead of a license key, see the "license management" section below.

License management

If you have been given access to our user portal, you will find all your licenses there.

Please login using the UserName and Password you have been given, please do not forget to reset the password, as we are able to see the initial password.

Overview

Now click on the menu item highlighted below.

Overview

Now use any of the license keys you see below

Enter 0 and press Enter to select the online license option:

You don't have a valid license, or it might be expired
if you had a local ERS license it will be deactivated
Welcome to the ERS Activation.
To activate ERS please select one of the following licensing options:
0) Online(License Keys)
1) Free
2) Air gapped
Please write down the digit and press enter:
> 0
Please enter the license Key

You can now enter your online license. Enter it and press Enter:

Please write down the digit and press enter:
> 0
Please enter the license Key
ABCD-1234-DEFG-5678

Enter 1 and press Enter to select the Free license option:

You don't have a valid license, or it might be expired
if you had a local ERS license it will be deactivated
Welcome to the ERS Activation.
To activate ERS please select one of the following licensing options:
0) Online(License Keys)
1) Free
2) Air gapped
Please write down the digit and press enter:
> 1
Please enter your email address

You can now enter your email address and press Enter:

In case we gave you access and you received a username and password instead of a license key, see the "license management" section below.

License management

If you have been given access to our user portal, you will find all your licenses there.

Please login using the UserName and Password you have been given, please do not forget to reset the password, as we are able to see the initial password.

Overview

Now click on the menu item highlighted below.

Overview

Now use any of the license keys you see below

Enter 2 and press Enter to select the Air-gap license option:

You don't have a valid license, or it might be expired
if you had a local ERS license it will be deactivated
Welcome to the ERS Activation.
To activate ERS please select one of the following licensing options:
0) Online(License Keys)
1) Free
2) Air gapped
Please write down the digit and press enter:
> 2
Please enter the air gapped license key
ABCD-1234-DEFG-5678

You can now enter your air gapped license key and press Enter:

Head to the air-gap portal.

Ensure that Activation Mode is selected Overview

Then click on "Initialize air-gap activation" and enter the air-gap license key again. Then click "Send" this generates an initialization code, please copy or manually enter that initialization code inside ERS and press Enter.

Your ERS terminal should look like this

Please head to the portal at https://airgap.licensing.incontrolsim.com/  and enter the license key
Please enter the initialization code
qO4938Hd1GVKzTK59WfPVoh9Zl9rCAPyg9CTNZA/F8A=

If the above goes well ERS will give you an activation code and your hardware id like shown below

Now enter the activation code in the portal:
wD2X7e3CQQnCbIyV1rNeXoCqnAkqG+jG5cGT8FgiiVD3fQM9XFCc4kLQww5mDx+ZzmMqmEcuXcQmlkPGwcSGyQ==
with the hardware id:
6545c7252e9acb18bbb4bcb8a43276fb011cefcc81a37470461a17cbd96f7f3e
After activating in the portal the server thinks the license is activated, if you have issues on the local machine, please reach out to us.
Please enter the confirmation code

On the air-gap portal please close the initialize air-gap activation pop up. Then open "Enter air-gap activation code".

And enter

  • The air-gap license key
  • The Hardware ID
  • The Activation code

Afterwards click on "Submit".

If everything is correct then you should see the following screen alt text

Important

From this point our licensing backend considers the license activated, but it is not activated on your machine yet. It is very important to not close this screen yet, otherwise the license needs to be reset in our backend.

Now enter the confirmation code into ERS and press Enter. Now enter the policy id shown in the portal into ERS and press Enter.

If all goes well, you should see ERS now runs the (empty) model. The console output should end with:

[I] Thread [42984] Starting Enterprise Resource Simulator Core
[I] Thread [42984] Version 0.4.0 | Build Date: 2025-05-16 17:46:38
[I] Thread [42984] Reading initial settings file
[W] Thread [42984] No Settings found, creating new file!
[I] Thread [42984] [Info] is new LogLevel!
[I] Thread [42984] Hello ERS!
[I] Thread [42984] Waiting for JobSystem to finish remaining tasks, then shut down
[I] Thread [42984] Exiting JobSystem
[I] Thread [42984] Closing Enterprise Resource Simulator Core

Next steps

Was this page helpful?