E-box/User manual

From Control Systems Technology Group
Jump to navigation Jump to search

Starting an experiment

Starting Matlab

  1. Open a terminal.
  2. Type sudo matlab

Basic simulink model

The function of ec_test01 is similar to mini01 for the PATO setup with Tu/eDACS. Open ec_test01 and "Save as" under a different file name in your home directory /home/<username>.

Library

The library can be found by typing eclib in the matlab console. The supported modules are:

  • EL1008
  • EL1014
  • EL1018
  • EL2004
  • EL2008
  • EL3102
  • EL4038
  • EL4132
  • EL5101

Building the real-time code

Press "CTRL+B" to build the code.

Executing the real-time code

Without Simulink External Mode

  1. Open a terminal.
  2. Go to the directory where the model is saved.
  3. Type sudo ./model.

With Simulink External Mode

  1. Open the simulink model.
  2. Open a terminal.
  3. Go to the directory where the model is saved.
  4. Type sudo ./model -w (in the terminal).
  5. Click Connect to target.
  6. Click Start real-time code.

Getting the data

After the experiment the file model.mat will be created with the data from the experiment. Type load model.mat in the matlab console to load the data to the workspace. Data will be saved with rt_ prefix.

Errors

This section gives an overview of possible errors

Wrong ethernet port

  1. Click Simulation
  2. Click Configuration parameters
  3. Click Real-Time Workshop
  4. Change the make command to make_rtw OPTS='-DNETIF_ID=<x>'

where <x> is the number of the ethernet controller. The correct ethernet port (0 by default) can be found by clicking on the icon marked by the arrow in figure {fig:desktop}.

image {Desktop screen} {fig:desktop}

Program not executed as root

When you forgot to execute the real-time programm as root you will see the following output: [breaklines=true,frame=single,linerange={1-14}] {no_root.txt}

simple_test

  1. Open a terminal.
  2. Type cd /usr/src/soem/.
  3. Type sudo ./simple_test eth<x>.

where <x> is the number of the ethernet controller.

This should give an output similar to:

SOEM (Simple Open EtherCAT Master)
Simple test
Starting simple test
ec_init on eth1 succeeded.
3 slaves found and configured.
Request operational state for all slaves
Operational state reached for all slaves.
Processdata cycle    1 , O: 00 00 00 00 00 00 00 00 I: 00 80 fb ff 00 80 fb ff
Processdata cycle    2 , O: 00 00 00 00 00 00 00 00 I: 00 00 fa ff 00 00 f9 ff
Processdata cycle    3 , O: 00 00 00 00 00 00 00 00 I: 00 00 fa ff 00 00 f9 ff
Processdata cycle    4 , O: 00 00 00 00 00 00 00 00 I: 00 00 fa ff 00 00 f9 ff
Processdata cycle    5 , O: 00 00 00 00 00 00 00 00 I: 00 00 fa ff 00 00 f9 ff
Processdata cycle    6 , O: 00 00 00 00 00 00 00 00 I: 00 00 fa ff 00 00 f9 ff
Processdata cycle    7 , O: 00 00 00 00 00 00 00 00 I: 00 00 fa ff 00 00 f9 ff
Processdata cycle    8 , O: 00 00 00 00 00 00 00 00 I: 00 00 fa ff 00 00 f9 ff
Processdata cycle    9 , O: 00 00 00 00 00 00 00 00 I: 00 00 fa ff 00 00 f9 ff
Processdata cycle   10 , O: 00 00 00 00 00 00 00 00 I: 00 00 fa ff 00 00 f9 ff
Request safe operational state for all slaves
End simple test, close socket
End program

slaveinfo

  1. Open a terminal.
  2. Type cd /usr/src/soem/.
  3. Type sudo ./slaveinfo eth<x>.

where <x> is the number of the ethernet controller.

This should give an output similar to: [breaklines=true,frame=single,linerange={1-14}] {slaveinfo.txt} [breaklines=true,frame=single,linerange={25-34}] {slaveinfo.txt}