C# scripting
These features require an Automation Toolbox license.
Otii has a build in TCP Server that can be used to control the application from another application, e.g. from a script running in your C.I. environment.
You can write your own TCP client using the Otii TCP Server API, or use one of the clients available at the Qoitech Github.
In this guide we will show you how to control Otii from a C# application using the Otii TCP Client for C#.
Installing the C# client
The Otii TCP Client for C# is avaliable as a NuGet package from nuget.org.
In Visual Studio, create a C#/.NET Framework project, right click on References in the Solution Explorer, and select Manage NuGet Packages....
In the NuGet Package Manager install OtiiTcpClient from the package source nuget.org. (If nuget.org not is listed as a package source, see here how to fix it.
Start the TCP Server
You need to start the Otii TCP server before connecting to it.
You can find out more about how to get started with the TCP server here:
Getting started
Make sure you have Otii running with the TCP server started, and an Arc connected to the computer without any devices connected to its main output.
We start with adding code to turn on and off the power of the Arc.
Run the program, and the Arc connected to your computer should turn on the power, and after a second turn it off again.
Handling projects
Before starting a measurement tou need to either create a project, connect to an already opened project, or open a previously saved project.
Here we connect to an open project if it exists, otherwise we create a new one.
Configuring the project
Before measuring, we set the main output voltage, overcurrent protection., and we confiure and enable the UART.
Then we add the channels we want to records. In this case we enable Main Current (mc), Main Voltage (mv), UART logs (rx) and the digital input GPI1 (i1).
If you hover above the EnableChannel method in Visual Studio you can see what channels are available.
Do a timed recording
Replace the code in the section "Turn on and off the power" with the section Record shown below. You also need to add an constant in the main class defining the recording time.
You can find the Basic Measurment example at the Qoitech GitHub.
Last updated