#! /bin/bash

#########################################################################################
# Author: Shuai Li
# Date: 2013-05-14
# Description: 
#   This script generates calls dgmf2transaction several times with different parameters.
#   The "dgmf2transaction" binary generates systems and scheduling results in xml files.
#   This script is configured with config.bash.
#   All files must be in the same folder!
#########################################################################################

. ./config.bash

file_name=""

for ((number_groups = $MIN_GROUPS ; number_groups <= $MAX_GROUPS ; number_groups += $GROUPS_STEP))
do
  for ((number_frames = $MIN_FRAMES ; number_frames <= $MAX_FRAMES ; number_frames += $FRAMES_STEP))
  do
    for ((number_resources = $MIN_RESOURCES ; number_resources <= $MAX_RESOURCES ; number_resources += $RESOURCES_STEP))
    do
      for ((number_usages = $MIN_USAGES ; number_usages <= $MAX_USAGES ; number_usages += $USAGES_STEP))
      do
        for ((number_precedences = $MIN_PRECEDENCES ; number_precedences <= $MAX_PRECEDENCES ; number_precedences += $PRECEDENCES_STEP))
        do
          for ((mf_period = $MIN_PERIOD ; mf_period <= $MAX_PERIOD ; mf_period += $PERIOD_STEP))
          do
             file_name=$number_groups"_"$number_frames"_"$number_resources"_"$number_usages"_"$number_precedences"_"$mf_period
            ./dgmf2transaction -g $number_groups -f $number_frames -r $number_resources -u $number_usages -d $number_precedences -m $mf_period -c $NUMBER_CORES -p $NUMBER_PROCESSORS -a $NUMBER_ADDRS -y $SYNC_RATIO -o $file_name
            diff "sched_multiframe_"$file_name".xml" "sched_transaction_"$file_name".xml" >> diff.txt
            rm *.xml
          done
        done
      done 
    done
  done
done

