home › Forums › # Technical Support › Integration of Fuzzylite to Castalia Simulator
Tagged: Castalia
- This topic has 3 replies, 2 voices, and was last updated 5 years ago by
Juan Rada-Vilela (admin).
-
AuthorPosts
-
April 30, 2018 at 15:39 #6153
Unknown
MemberDear all,
I have been using Castalia Simulator to simulate the LEACH protocol and would like to develop a Fuzzy-Logic System to elect the cluster head. However, i am struggling to link the Castalia to FuzzyLite.
I did search the forum with the link as follows : https://groups.google.com/forum/#CAJo2o+mWy0Rnp1MUgCFSxYJD3rDyAwDwkoU-LuU_s4=LOo_zAw@mail.gmail.com__ftn1
However, it shows error that src/node/communication/routing/leachRouting/LeachRouting.h:40:24: fatal error: fl/Headers.h: No such file or directory , even though i followed the steps provided.
The following is the content of makemake file in 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=”-L /home/utar/Desktop/HY/fuzzylite-6.0/fuzzylite/release/bin/”# Run OMNeT’s opp_makemake tool with the above options
opp_makemake $OPTS $EXCLUDEDIRS $EXTOPTSCorrect me if there is any mistake.
I would really appreciate if anyone could help me as soon as possible. Thanks in advance !
May 3, 2018 at 23:19 #6154Juan Rada-Vilela (admin)
KeymasterHi,
thank you for your post.
I think you should try following the steps available at:
https://github.com/fuzzylite/fuzzylite#compile-link-and-executeThis will probably solve your problem. Otherwise, check the example application available in the project: https://github.com/fuzzylite/fuzzylite/tree/release/examples/application
Cheers.
May 4, 2018 at 14:10 #6155Unknown
MemberHi Vilela,
First of all, thanks very much for your reply.
I did follow the steps provided in README file. I am now able to compile the Castalia Simulator without error.
However, i am unable to run the simulation with the errors that read : WARNING: unable to determine total simulation runs. I trace the Castalia file, but i am not the expert in that field, so i cannot clearly figure out the problem. The following is the snippet of the Castalia Python file to run the simulation :
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
if sys.version_info > (2,7):
data = subprocess.check_output([pathToCastaliaBin, ‘-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)
if (m):
runs = “/” + m.group(1)
else:
print “WARNING: unable to determine total simulation runs”
runs = “”As you can see , r_totalrun is designed to match the data which is generated by the function subprocess.check_output or subprocess.Popen, it is obvious that problem occurs from here. If I do not include the FuzzyLite external library, I would not have such problem, this makes me wonder if it is my problem or the FuzzyLite’s.
So could you please give me somes idea how would i resort to in such circumstance ?
By the way, I tried the example/application, i am able to generate four files, which are example-static-11, example-static-98, example-dynamic-11 and example-dynamic-98, but i do not know how i can generate the output from here. Also, the documentation does not clearly state how to generate output using centroid defuzzificater, hopefully you can tell me how. Thanks in advance.
Best regards
June 6, 2018 at 18:24 #6185Juan Rada-Vilela (admin)
KeymasterWhat is the output of your process?
Instead of printing
print “WARNING: unable to determine total simulation runs”
, can you please print the real output? -
AuthorPosts
- You must be logged in to reply to this topic.