I have been struggling to integrate the Fuzzylite to my simulator Castalia, so far there is an error related to the Console.cpp under Fuzzylite src folder. In order to link the Fuzzylite to my simulator Castalia, I have added the EXTOPTS in the makemake file under Castalia,
#!/bin/bash
ROOT=`pwd`
# The following options are used by OMNeT's opp_makemake tool
# For explanation and a complete list of options run: opp_makemake -h
OPTS=" -f -r --deep -o CastaliaBin -u Cmdenv -P $ROOT -M release"
# -X excludes a directory from being considered
EXCLUDEDIRS=" -X Simulations -X out -X bin"
# Use options -I -L -l to include external header files or libraries
EXTOPTS="-I /home/utar/Desktop/HY/fuzzylite-6.0/fuzzylite/ -L /home/utar/Desktop/HY/fuzzylite-6.0/fuzzylite/release/bin/ -lfuzzylite"
# Run OMNeT's opp_makemake tool with the above options
opp_makemake $OPTS $EXCLUDEDIRS $EXTOPTS
Then while the compilation runs smoothly, the simulation simply cannot be run. After tracing the file, I am able to trace the source of problem which results from Castalia bin file that is written in Python. The following is the snippet of code that concerns me :
r_castalia = re.compile("^Castalia\|\s+(.+)$")
r_scenario = re.compile("Scenario:\s(.*)\$repetition=(\d+)$")
r_progress = re.compile("^\*\* Event \#\d+\s+T=(\S+)\s+Elapsed: (\S+)s.+\s(\d+)\% completed")
r_newrun = re.compile("Preparing for running configuration General, run #(\d+)")
r_totalrun = re.compile("Number of runs: (\d+)")
for ini in iniList:
ini_num += 1
baselabel = label = labelList.pop(0)
f = open("omnetpp.tmp","w")
f.write("[General]\n")
f.write("repeat = " + str(options.repeat) + "\n")
for k in sorted(ini.keys()):
f.write(k + " = " + ini[k] + "\n")
f.close();
has_output = 0
print "path to CastaliaBint is : " + pathToCastaliaBin
if sys.version_info > (2,7):
data = subprocess.check_output([pathToCastaliaBin, '-f', 'omnetpp.tmp', '-x', 'General']).split("\n")
#data = subprocess.check_output(["/home/utar/Desktop/Castalia/CastaliaBin", '-f', 'omnetpp.tmp', '-x', 'General']).split("\n")
else:
data = subprocess.Popen([pathToCastaliaBin, '-f', 'omnetpp.tmp', '-x', 'General'], stdout=subprocess.PIPE).communicate()[0].split("\n")
if len(data) > 6: data = data[6]
else:
data = ""
m = r_totalrun.match(data)
print "r_totalrun is : " + str(r_totalrun)
if (m):
runs = "/" + m.group(1)
else:
print "WARNING: unable to determine total simulation runs"
runs = ""
As a result, the output shows me this :
WARNING: unable to determine total simulation runs
The point of focus is here :
if sys.version_info > (2,7):
data = subprocess.check_output([pathToCastaliaBin, '-f', 'omnetpp.tmp', '-x', 'General']).split("\n")
Having spent some time figuring out the problem, it is learnt that the variable data shows the following output by using print function:
data is [‘[option error] option <-f> not recognized’, ‘{at /src/Console.cpp::parse() [line:134]}’, ”, ”]
I come to realize that CastaliaBin somehow execute the Console.cpp which is located under the src file of Fuzzylite !!!
The variable pathToCastaliaBin is actually a path to /home/utar/Desktop/Castalia/CastaliaBin where CastaliaBin is an executable.
For normal condition which the Fuzzylite library is not included in the Castalia Simulator, when I type CastaliaBin in the command line, it will show as follows: Before Fuzzylite is included
After I link the Fuzzylite with Castalia, it shows : After Fuzzylite is included
As you can see, CastaliaBin somehow executes the code in the Fuzzylite !!!
So I wish somebody can lend me a helping hand. I would appreciate it very much. Thanks in advance !!!