E-box/User manual: Difference between revisions
No edit summary |
|||
Line 59: | Line 59: | ||
# Change the make command to <tt>make_rtw OPTS='-DNETIF_ID=<x>'</tt> | # Change the make command to <tt>make_rtw OPTS='-DNETIF_ID=<x>'</tt> | ||
where <tt><x></tt> is the number of the ethernet controller. The correct ethernet port | where <tt><x></tt> is the number of the ethernet controller. The correct ethernet port is 0 by default. | ||
== Program not executed as root == | == Program not executed as root == | ||
Revision as of 08:43, 9 June 2011
Starting an experiment
Starting Matlab
- Open a terminal.
- 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 or type rtwbuild('model') in the Matlab console.
Executing the real-time code
Without Simulink External Mode
- Open a terminal.
- Go to the directory where the model is saved.
- Type sudo ./model.
With Simulink External Mode
- Open the simulink model.
- Open a terminal.
- Go to the directory where the model is saved.
- Type sudo ./model -w (in the terminal).
- Click Connect to target.
- 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
- Click Simulation
- Click Configuration parameters
- Click Real-Time Workshop
- Change the make command to make_rtw OPTS='-DNETIF_ID=<x>'
where <x> is the number of the ethernet controller. The correct ethernet port is 0 by default.
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
- Open a terminal.
- Type cd /usr/src/soem/.
- 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
- Open a terminal.
- Type cd /usr/src/soem/.
- 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}