clear

home=$(pwd)
cd ../../..
omnet=$(pwd)
M3WSN=$omnet'/M3WSN/M3WSN'
M3WSNSrc=$omnet'/M3WSN/src'
castalia=$omnet'/Castalia-3.2_M3WSN/castalia'
castaliaSrc=$omnet'/Castalia-3.2_M3WSN/src'
cd $home

rm M3WSN-Debug.txt
rm M3WSN-Output.txt
rm M3WSN-Result.txt
rm output.txt
mkdir run1

ini=$(pwd)'/video.ini'
cmd=$M3WSN' -r 0 -u Cmdenv -c General -n '$M3WSNSrc':'$castaliaSrc' -l '$castalia' '$ini

$cmd > result.txt

mkdir run1/simulation0
mkdir run1/simulation0/videos
mv M3WSN-Debug.txt run1/simulation0/simulation_dubug_0.txt
mv M3WSN-Output.txt run1/simulation0/simulation_output_0.txt
mv M3WSN-Result.txt run1/simulation0/simulation_result_0.txt
mv result.txt run1/simulation0/simulation_result_cmd_0.txt
mv *sd* run1/simulation0/videos
mv rd* run1/simulation0/videos

for sim in `seq 1 1` ; do
	ini=$(pwd)'/video.ini'
	cmd=$M3WSN' -r 0 -u Cmdenv -c 'run$sim' -n '$M3WSNSrc':'$castaliaSrc' -l '$castalia' '$ini

	$cmd > result.txt

	mkdir run1/simulation$sim
	mkdir run1/simulation$sim/videos
	mv M3WSN-Debug.txt run1/simulation$sim/simulation_dubug_$sim.txt
	mv M3WSN-Output.txt run1/simulation$sim/simulation_output_$sim.txt
	mv M3WSN-Result.txt run1/simulation$sim/simulation_result_$sim.txt
	mv result.txt run1/simulation$sim/simulation_result_cmd_$sim.txt
	mv *sd* run1/simulation$sim/videos
	mv rd* run1/simulation$sim/videos
done

