How to run OMNeT++ project from Ubuntu terminal - omnet++

I am using OMNeT++ 5.5.1 installed in Ubuntu 19.04 and it is working fine in IDE environment.
But, I need to run an INET project from Ubuntu terminal. Can anyone suggest me what command to write in terminal if:
I want to run, for example, INET showcase examples ( wireless/sensornetwork/omnetpp.ini)?
how to see the list of configurations in omnetpp.ini?
and how to choose one specific config and run it?
Thank you

To run a simulation from command line do the following:
Go to directory of the example you want to start, e.g.:
cd showcases/wireless/sensornetwork
To see available config names in omnetpp.ini type:
opp_run -a
To run selected config (e.g. LMac) with GUI type the following command:
opp_run -m -u Qtenv -n ../../../src:../..:../../../tutorials:../../../showcases -l ../../../src/INET omnetpp.ini -c LMac
To see all runs for selected config type:
opp_run -s -c LMac omnetpp.ini -q runs
To start one selected run (e.g. 5) from config (e.g. LMac) without GUI type the following command:
opp_run -m -u Cmdenv -n ../../../src:../..:../../../tutorials:../../../showcases -l ../../../src/INET omnetpp.ini -c LMac -r 5
To start all runs in selected config (e.g. LMac) type the following command:
opp_run -m -u Cmdenv -n ../../../src:../..:../../../tutorials:../../../showcases -l ../../../src/INET omnetpp.ini -c LMac
The main options for opp_run:
-u Qtenv selects graphical view of a simulation (for command environment use -u Cmdenv)
-n indicates directories of NED files
-l selects library (here: libINET.so)
For more information about running simulations look to OMNeT++ Manual.

Related

Compile cygwin1.dll from its source code

I want to edit some code in cygwin1.dll for my project. So, I clone git repository from these two url:
https://github.com/mirror/newlib-cygwin.git
git://sourceware.org/git/newlib-cygwin.git
I've gcc, g++, make installed with cygwin and mingw-w64 (and also in WSL). But none of them generate DLL file. I also follow the commands ./configure & make. Command generates only object files. Is it possible to compile cygwin1.dll from its source code?
I had two different problems.
First, I followed the steps in cygwin FAQ: How do I build Cygwin on my own?. I forget to install mingww64_x86_64-gcc-g++ package. So, I installed those with the following commands:
setup-x86_64.exe -q -P gcc-g++ -P make -P perl -P cocom -P gettext-devel -P libiconv-devel -P zlib-devel
setup-x86_64.exe -q -P mingw64-x86_64-gcc-core -P mingw64-i686-gcc-g++ -P mingw64-i686-zlib
setup-x86_64.exe -q -P mingw64-x86_64-gcc-g++ -P mingw64-x86_64-zlib
Second, I logged the output from make command with make |& tee make.log. Thanks, #matzeri for the logging tip. Then I followed an error in make.log file as below:
../../.././winsup/cygwin/cygmagic: line 25: /usr/bin/awk: cannot
execute binary file: Exec format error
*** WARNING WARNING WARNING WARNING WARNING ***
*** ../../.././winsup/cygwin/child_info.h: magic number for
CHILD_INFO_MAGIC changed old 0xc96f5e9U != new
Somehow, the awk (hard linked with gawk) does not work in cygwin. So I installed awk package with setup-x86_64.exe. And now I can easily compile cygwin.dll.

OMNET++: Run simulation in command line

In my omnetpp.ini file, I have these lines describing cmdenv:
[General]
cmdenv-express-mode = false
cmdenv-output-file = log.txt
cmdenv-autoflush = true
cmdenv-status-frequency = 10000000s
So my outputs are redirected to a log file. To run my simulation I access to run -> run configurations -> user interface command line
Now, I need to run the omnetpp.ini file using a server so I need to run the .ini file in command line and not using the previous steps mentioned. I followed these two solutions that I found in the mailing list but they do not work:
1) ./run -u Cmdenv -f omnetpp.ini
2) opp_run -u Cmdenv -f omnetpp.ini
This is what display:
HP-ProBook-650-G2:~/WorkspaceThese/Veins-4a2/examples/veins$ opp_run -u Cmdenv -f omnetpp.ini
OMNeT++ Discrete Event Simulation (C) 1992-2014 Andras Varga, OpenSim Ltd.
Version: 4.6, build: 141202-f785492, edition: Academic Public License -- NOT FOR COMMERCIAL USE
See the license for distribution terms and warranty disclaimer
Setting up Cmdenv...
Cmdenv: redirecting output to file `/home/yosra/WorkspaceThese/Veins- 4a2/examples/veins/log.txt'...
End.
Can someone help me to fix this issue please?
If you are able to run your simulation in Cmdenv mode from Eclipse, you may see what Eclipse uses to run the simulation. To do it add the Console ( Window | Show View | Other | Console) and start your simulation in Cmdenv mode. In the console you will see something like this:
Starting...
$ cd /opt/omnetpp/omnetpp-4.6/samples/tictoc/simulations
$ ../src/tictoc -r 0 -u Cmdenv -c General -n ../src;. omnetpp.ini
OMNeT++ Discrete Event Simulation (C) 1992-2014 Andras Varga, OpenSim Ltd.
...
Here are the commands you are looking for.

give bootup messages and times, embedded linux

i had problem to show bootup steps and each step's time in an embedded linux project on cubieboard2. so i solved the problem using grabserial. to do so follow below instructions:
1- download grabserial from: https://github.com/tbird20d/grabserial
2- extract downloaded files and go to extracted directory
3- make grabserial file executable using below script in the terminal:
Sudo chmod +x grabserial
4- install required packages using below script:
sudo apt-get install python-setuptools
5- do below copy:
sudo cp grabserial /usr/local/bin
6- exit from the extracted folder using cd /..
7- connect your device to your PC using com0 port.
8- type below script in the terminal to save output of com0 port into bootTime.txt file.
sudo grabserial -d /dev/ttyS0 -m RomBoot -t -e 30 &>>bootTime.txt
9- if you want to show bootTime.txt content in the terminal, open a new terminal and type below script:
tailf bootTime.txt

Run time error in Castalia

Hey friends i had installed Omnet++ 4.2.2 and Castalia 3.2.I had tried to run the example simulations,but it saying an run time error.i had attached it as a image.Please help me.Please tell me the solutions.Help indeed please.
You probably didn't build the Castalia. In order to build it under Windows do the following:
Open in any text editor the file makemake from main Castalia-3.2 directory, and change the line: OPTS=" -f -r --deep -o CastaliaBin -u Cmdenv -P $ROOT -M release" into:
OPTS=" -f -r --deep -P $ROOT -M release"
Open console mingwenv.cmd.
Change directory to the Castalia directory. Example: assuming that Castalia-3.2 is in d:\Castalia-3.2 you should type: cd /d/Castalia-3.2
Then type in mingwcmd console:
./makemake
make
In order to check it try to start a simulation by typing in console:
cd Simulations/BANtest/
../../Castalia-3.2.exe
The simulation should start in graphical mode.

Cygwin run multiple commands at once

MATLAB runs on a host machine. By using the 'system' call and CYGWIN I have to run some applications on a remote system based on linux.
The problem is, after calling the SSH command the other commands are ignored
so
system('C:\cygwin64\bin\bash -l -c "ssh -t -t 10.0.0.127; cd /home/superuser/MAGIC_PATH")
does not work
So I tried to change the directory sequentially after the SSH-Connections, but now the MATLAB-script is blocked. And I have to type the command manually. Which is not the desired solution
In MATLAB:
cygwin_path='C:\cygwin64\bin\bash';
binary_path='/home/superuser/MAGIC_PATH';
SSH_string=sprintf('%s -l -c "ssh -t -t %s &"',cygwin_path,remote_IP)
ChangeDIR_string=sprintf('%s -l -c "cd /home/superuser/"',cygwin_path)
So how can I change my code respectively the system call, so that it automatically runs multiple commands and starts some applications (as background jobs)

Resources