Skip to content

Latest commit

 

History

History
76 lines (49 loc) · 5.29 KB

File metadata and controls

76 lines (49 loc) · 5.29 KB

Installation and Configuration of ControlAPI

This file describes how to install and configure Control.exe and ControlAPI. It is assumed that you have installed Visual Studio C++ 2022 with MFC (Microsoft Foundation Classes, or Afx) support.

Table of content

  1. ControlAPI

Back to Overview.

 

ControlAPI

The large version of the ControlAPI interface is a DLL that can be used by Visual Studio 2022 C++ and Qt Creator (MinGW). If you need it for Python, please tell us as it would be very easy to support it.

The best way to get to know this API is to study the demo code in Control_Firefly_AQuRA_Qt.

The ControlAPI is basically Control.exe, just running without showing the GUI, as a DLL. This means it is configured like Control.exe. One difference is how one points the DLL to the folder in which the configuration files are. For ControlAPI, you specify this folder when you call "ConnectToLowLevelSoftware", see the definition of ParamFileDirectory in TestSequence.cpp. For example
const char* ParamFileDirectory = "D:\\Florian\\Firefly\\FireflyControl\\Control_Firefly_AQuRA\\ConfigParams\\ControlParam";
points to the configuration files
ControlParam_ParamList.txt
ControlParam_SystemParamList.txt
ControlParam_UniMessList.dat
ControlParam_UtilityDialog.txt
in the folder
D:\Florian\Firefly\FireflyControl\Control_Firefly_AQuRA\ConfigParams\
Note that ParamFileDirectory includes the folder name and the beginning of the configuration file names.

At the same location, you should also specify a folder in which debug files will be stored, e.g.
const QString DebugFileDirectory = "D:\\Florian\\Firefly\\FireflyControl\\DebugFiles";

You can switch debug on or off in this codeline:
if (!CA.ConnectToLowLevelSoftware(atelnet, ParamFileDirectory, /*IP*/ "192.168.0.103", /*Debug*/ true, DebugFileDirectory)) {

You can use the API in TCPIP mode or in DLL mode. The TCPIP mode is useful for debugging, but otherwise the DLL mode is preferred. You can switch between TCPIP mode and DLL mode in
ControlAPI.h
By defining or not defining
#define USE_CA_DLL
If you use the TCPIP mode, search for "192.168." and adjust the IP adress to the one of the computer on which Control.exe is running. Make sure that Control.exe starts the ControlAPI sever, by enabling that option in the system parameter menus.

In either mode, you need to select the IP address of the FPGA. You do this using a Python hardware configuration script, which is described in section Configuration of Control.exe.

Recompiling Control.dll

To recompile Control.dll, install Visual Studio 2022 with MFC and open Control.sln in Visual Studio 2022.

Usually, select Debug and x64 in the toolbar.

Build version selector

Note: pay attention to always use the same x64/Win32 Debug/Release setting for the DLL compiler and for the compiler that compiles the program that uses the DLL.

  • x64 or Win32 (i.e. 32bit or 64bit AMD/Intel code). For most situations x64 is better. The one situation in which Win32 is better is when editing the Control.exe software, as the compilation of Control.exe is vastly faster in Win32 than x64 mode.
  • Debug or Release: Release is quite a bit faster than Debug, both when compiling and when executing the program. Debug enables one to see Visual Studio debug information (even when using the DLL in Qt with MinGW).
  • DLL or EXE: If not automatically changed to DLL when selecting x64, in the Solution Explorer (in the Visual Studio GUI) you right click on "Control" (not " Solution Control" ) and select DLL under Configuration Properties -> General-> Configuration Type.

To select "DLL", right-click on "Control" in the Solution explorer (not "Solution Control"). Select Properties. Select DLL under "General Properties -> Configuration Type".

Build the solution. Look at the linker output. It tells you in which folder the DLL was created, e.g.
D:\Florian\Firefly\FireflyControl\Control_Firefly_AQuRA\x64\Template

Copy Control.dll to the folder in which Qt creates your executable, e.g.
D:\Florian\Firefly\FireflyControl\Control_Firefly_Qt\

If you want to change the hardware configuration, do it by modifying the Configuration Python scripts and running them to create configuration json files, see Specifying hardware configuration.

If you need a second name for an output, do that in the file ConfigFiles\AlternativeCommandNames.txt, which contains alternative names for user IO outputs and their calibration.
MOTCurrent = SetMOTCoilCurrent * 2 + 0
ChillerSetpoint = SetChillerSetpoint * 1 + 0
LatticePowerSetpoint = SetLatticePowerSetpoint * 1 + 0
(This option was needed for the AQuRA clock project, as the higher level software by LTE accessed the lower level software using command names that just contained the number of an output. Using those names would have led to barely readable code in Control.exe, the code that was used to commission the clock.)