---
title: Set Up the OSI Agent
slug: manufacturing-connect-edge/set-up-the-osi-agent
docTags: 
createdAt: 2023-11-24T14:23:28.537Z
---

Review the following information for setting up and configuring the OSI Agent driver.&#x20;

# Before You Begin

- Install an OSI Server and OSI Agent on a Windows system.&#x20;
- Follow up with your account executive to download the OSI Agent and required files.&#x20;
- Make sure the OSI Client dll is on the same system running the OSI Agent.&#x20;
- Open port 443 and 4777 between Windows and Manufacturing Connect Edge. Otherwise, the OSI Agent won't work.&#x20;
- Configure Windows authentication so that the OSI Pi Server can work.
- [Create API Credentials](docId\:wVmH8bpJcJJC4SMSOWQ78) in Manufacturing Connect Edge. &#x20;

# Step 1: Install OSI Agent

Install the ZIP file with the OSI Agent and all required files on a Windows system.&#x20;

# Step 2: Run and Configure the DH Historian Agent

**To run and configure the DH Historian Agent:**

1. Run the DH Historian Agent EXE file.&#x20;
   A Windows service starts and connects to the OSI Agent so that it can collect data from the OSI Agent.&#x20;
2. Review the introductory screen and click **Next**.&#x20;
   The appearance configuration settings displays.&#x20;
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/ujVfuvFHBrsHHpinLNQrx_agent01.png" size="80" width="1303" height="791" caption="Agent introductory screen" position="center" showCaption="true"}
3. Configure the appearance settings.&#x20;
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/ym1mUnWdXdgPR2houpb-E_agent02.png" size="80" width="1303" height="709" caption="Agent appearance settingss" position="center" showCaption="true"}
4. Click **Save**, and then **Next**.&#x20;
   The *Server Settings* section displays.&#x20;
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/aKDTwd95KhdlSbIrA_tBq_agent03.png" size="80" width="1303" height="703" caption="Sever settings" position="center" showCaption="true"}
5. In the *PI Server* section, click the **Load PI Servers** button. You will be able to view all PI servers properly set up with DCOM rules on the correct network.&#x20;
6. Open the drop-down list for **Server&#x20;**&#x74;o view accessible servers and select the appropriate server.&#x20;
7. Select an authentication method.&#x20;
   - **PI User**: This is local user. To define the DCOM rules for this user, open the PI System Management Tool and navigate to **Security&#x20;**> **PI Users and Groups**. Enter the correct username and password.&#x20;
   - **Windows**: The PI Server needs to be properly configured to use Windows authentication.&#x20;
8. Once the PI Server is configured, clic&#x6B;**&#x20;Test Connection**. Verify the status is *Success&#x20;*&#x6F;r *Fail*.&#x20;
9. In the *Operation Mode* section, select how data will be collected. Both modes allow the first value on startup to get published to NATS. &#x20;
   - **Events-Based**: The recommended selection. Whenever the value changes on the PI server, you will receive a NATS message.&#x20;
   - **Polling**: Define the polling interval in seconds. The timestamp for the message is when the data was published to the DH Historian Agent, not when Manufacturing Connect Edge collects the data.&#x20;
10. In the *Logs&#x20;*&#x73;ection, select how to view logs. The logs will records failures with details.&#x20;
    - **Events Log**: To view logs, start the OSI Agent.&#x20;
    - **Log file folder**: Define a local folder to store log files.&#x20;
11. Click **Save**, and then **Next**.&#x20;
    Th&#x65;*&#x20;Site Settings* section displays.&#x20;
    ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/Wj_B-GgU14yFUacOCdNMv_agent04.png" size="80" width="1303" height="695" caption="Site settings" position="center" showCaption="true"}
12. Configure the site settings.&#x20;
    - **Host**: Enter the IP address for the Manufacturing Connect Edge instance.&#x20;
    - **Port**: Enter 4777.&#x20;
    - **User**: Enter the username to connect to the server in DeviceHub.&#x20;
    - **Password**: Enter the password to connect to the server in DeviceHub.&#x20;
    - **API Token**: Follow the steps to [Create API Credentials](docId\:wVmH8bpJcJJC4SMSOWQ78), copy the token, and paste it here. The token is used to create the device and tags.&#x20;
    - **Device Name**: Enter the name for the device that will be created in Manufacturing Connect Edge DeviceHub.&#x20;
    - **Device Id**: This field is optional. The ID is automatically generated.&#x20;
13. Click **Test Connection** to ensure the settings are configured correctly.&#x20;
14. Click **Create Device**.&#x20;
    If a device is successfully created, a *Created a new Device* message will display. The OSI Agent driver device will be created in the Manufacturing Connect Edge DeviceHub pane.&#x20;
15. Click **Save**, and then **Next**.&#x20;
    The *Tags&#x20;*&#x73;ection displays.&#x20;
    ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/xmcuI7_qQZjRTpiqThyyf_agent052.png" size="80" width="1302" height="623" caption="Tags settings" position="center" showCaption="true"}
16. Search for tags you want to add.&#x20;
    - You can search by using regular expression.&#x20;
    - The \* character displays all tags on the server.&#x20;
    - The *Server Tags* column displays tags on the OSI Agent.&#x20;
    - The *Agent Tags* column displays tags that will be sent to Manufacturing Connect Edge and mapped to the OSI Agent driver device in DeviceHub.&#x20;
17. After selecting tags to be sent to Manufacturing Connect Edge, click **Update Tags**.
    The tags will be added to the OSI driver in Manufacturing Connect Edge. You can view them in **DeviceHub&#x20;**> **Tags**.&#x20;
18. If needed, click **Save**.&#x20;
    This saves the settings in the DeviceHubAgentMain.UI.exeConfig file, which is a password encrypted text file. The next time you start the Historian Agent, the saved settings from the configuration file will load.&#x20;
19. In the folder that installed the DH Historian Agent, navigate to the **PI Agent** sub-folder.&#x20;
20. Double-click the DeviceHubAgentSvc.exe file.&#x20;
    This will enable the connection to the server.&#x20;
21. Follow the command to install the service.&#x20;
    Once installed and the task management is properly set up to run the service when logged off, data will still be sent to the driver when users are logged out.&#x20;
22. Log in to Manufacturing Connect Edge and navigate to **DeviceHub&#x20;**> **Devices**. You should see a *Connected&#x20;*&#x73;tatus for the OSI Agent device.&#x20;

# OSI Agent Driver Settings in Manufacturing Connect Edge

If you review or edit the settings of the OSI Agent device, refer to the following parameters.&#x20;

| Parameter        | Value                                                                                                                                                                                            |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Type**         | OSI                                                                                                                                                                                              |
| **Driver**       | OSI Agent                                                                                                                                                                                        |
| **Network Port** | The port configured in the DH Historian Agent. The default value is 4777.                                                                                                                        |
| **Interface**    | You have the option of selecting the interface for accepting client connections. The default value is 0.0.0.0, which means using all network interfaces for accepting connections from clients.  |
| **User**         | The username configured in the DH Historian Agent.                                                                                                                                               |
| **Password**     | The password configured in the DH Historian Agent.                                                                                                                                               |

# Tag Parameters in Manufacturing Connect Edge

If you [Add a Tag](docId\:h5heqIcXrCY3NCH9KBg9I) in Manufacturing Connect Edge, select the **R** register name, and then refer to the following supported data types and tag parameters. &#x20;

- `uint32`
- `uint64`
- `float64`
- `string`
- `byte[]`
- `float32[]`
- `bool`
- `byte`
- `float64[]`
- `string[]`
- `uint16`
- `int64`
- `uint16[]`
- `sbyte`
- `int16`
- `int16[]`
- `int32[]`
- `int64[]`
- `uint64[]`
- `float32`
- `bool[]`
- `uint32[]`
- `int32`
- `sbyte[]`

## Tag Parameters

- **Name**: Select **R**. &#x20;
- **Value Type**: Select a value type.&#x20;
- **Tag Name**: Enter a name for the tag.
- **Description** (Optional): Enter a description for the tag. &#x20;
- **Tag Formula**: Enter a formula for the tag to process the generated data. Two variables are permitted: `value` (current tag value) and `timestamp` (current tag UNIX time in milliseconds). The following math functions are available:
  - sin
  - cos
  - sqrt
  - tan
  - power: power(`x`) performs the operation `10^x`.
  - log: log(`x`) is the natural logarithm (the logarithm is in base `e`).&#x20;
  - exp: exp(`x`) performs the operation `e^x`.
- **Only Publish on Change of Value**: Select the checkbox to customize NATS messages to be published only when the *value&#x20;*&#x70;arameter changes from a previous value to a new one. *Change of Value* only applies to boolean, numeric (such as int or float), and simple string data types. It does not apply to complex types, such as JSON or array. Poll-once topics will not be affected by *Change of Value* settings. These topics will still only see a single message.&#x20;
- **Meta Data**: Metadata summarizes basic information about data. This feature allows you to define key-value pair data for the device output payload later on. It can then be used to find, use, and reuse particular instances of data.&#x20;

:::hint{type="info"}
**Note**: If you use special characters in meta data key names, the special characters are replaced with underscore characters in the payload. This can cause two key names to be combined into one. For example, configuring the key names a\*\*b and a&\&b will cause only one key name to be created (a\_\_b).&#x20;
:::



