home Forums # Technical Support Integration of Fuzzylite to Castalia Simulator Reply To: Integration of Fuzzylite to Castalia Simulator


Hi 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(“repeat = ” + str(options.repeat) + “\n”)
for k in sorted(ini.keys()):
f.write(k + ” = ” + ini[k] + “\n”)
has_output = 0
if sys.version_info > (2,7):
data = subprocess.check_output([pathToCastaliaBin, ‘-f’, ‘omnetpp.tmp’, ‘-x’, ‘General’]).split(“\n”)
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)
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