C# scripting
Last updated
Last updated
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 , or use one of the clients available at the Qoitech .
In this guide we will show you how to control Otii from a C# application using the .
The Otii TCP Client for C# is avaliable as a NuGet package from .
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, .
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:
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.
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.
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.
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 at the Qoitech GitHub.