Acqgen DataAcquisition

From Control Systems Technology Group
Revision as of 09:09, 12 July 2017 by Ahofkamp (talk | contribs) (fixing markup)
Jump to navigation Jump to search

Acqgen is a piece of software for generating real-time measurement or control software for plain Matlab for EtherCaT devices, such as the E-Box.

Required equipment

To use Acqgen, you need

  1. A Linux computer (tested with Ubuntu 16.04 LTS), with an Ethernet port compatible with the Soem EtherCat master software (that is, a normal TU/e laptop). Since these laptops usually have Windows that you want to keep, you can use an USB stick to boot and run a Linux operating system from it, rather than install Linux at the hard disk.
  2. One or more EtherCaT compatible measurement devices, like an E-Box. The software supports several devices, the full list is in the manual, which is included in the software distribution.
  3. An experiment to measure or control.
  4. Cables, power, etc to hook the EtherCaT measurement device(s) to the experiment, and to connect the EtherCaT devices to the computer.
  5. A Matlab (tested with R2015a, newer should also work) installed at the Linux system. The software generates a C module that must be compiled, which means the Linux system must have a working C compiler compatible with Matlab Mex (that is, the normal gcc program).
  6. Python3 (Likely already installed at the Linux system, try running python3 --version, which should output some lines of text with the version number of the Python interpreter. If you get an error that python3 does not exist, it must be installed in the Linux system first.)
  7. The Soem software installed at the Linux computer (for details, see below). Installing this software needs the same C compiler as above.
  8. The Acqgen software distribution at the Linux computer (for details see below).

Installing the Soem software

  1. Soem is available from Github, at https://github.com/OpenEtherCATsociety/SOEM Clone or download a copy (acqgen was tested with revision fb975cbc70bde723a178936ddb8c3b1c8c192c39, committed at March 31, 2017).
  2. Unpack the archive.
  3. Install the software.

Installing it can be done anywhere, for simplicity, it is assumed that it should be installed in directory installed_soem, right next to the unpacked archive directory named SOEM. The software uses CMake, which works best if it has a directory by itself for building. That means you need the following directory structure.

 ...  / SOEM            # the unpacked archive, a file .../SOEM/CMakeLists.txt should exist
      / installed_soem  # empty directory, will contain the installed result
      / build_dir       # empty directory, used for building and installing SOEM, should be deleted afterwards

Building and installing is then

 mkdir installed_soem   # Create 'installed_soem' (use rm -rf installed_soem if the directory already exists,
                        #    this removes the directory and everything inside it)
 mkdir build_dir        # Make some room for CMake too
                        #
 gcc --version          # Verify that the C compiler is installed. If it is, this command should output a version number,
                        #    else you get an error that the command cannot be found. In the latter case, install gcc in the Linux system first.
                        #
                        #
 cd build_dir           # Enter Cmake build directory
                        #
                        # Tell CMake where to install the result, which C compiler to use, which additional compiler flags to use,
                        #    and where to find the source.
 cmake -DCMAKE_INSTALL_PREFIX=../installed_soem -DCMAKE_C_COMPILER:FILEPATH=gcc -DCMAKE_C_FLAGS:STRING=-fPIC ../SOEM
                        #
 # CMake should find everything it needs, else additional software needs to be install at the Linux system first.
                        #
 make                   # Compile the SOEM source code, and put the results into build_dir (the current directory)
 make install           # Install the compiled results ready for use in ../installed_soem.

Afterwards, the installed_soem directory should have a bin, include, and lib directories, each containing some files.

Installing the Acqgen software

Installing Acqgen is pretty much the same procedure, except it doesn't have a nifty CMake script, it uses a simple Python script 1. Download the software archive (see Releases below for a link. 2. Unpack the archive. 3. Install it somewhere 2. If your archive is named acqgen-release-v1-RC2.tar.gz, run a command like

 tar xzf acqgen-release-v1-RC2.tar.gz

(extract while decompressing, the file acqgen-release-v1-RC2.tar.gz)

Extracting gives you a directory named like the archive but without extensions, that is, something like acqgen-release-v1-RC2.