Code sources contain:
- gen_flc_.cc - the file which contains the code of the generator (source) of the FLC.
The generator activates the code of the FLC at intervals equals with "flc_time". The
flc_time is a parameter which is read by the gen_flc from the parent module (you can modify
the code in order to read this parameter from the omnetpp.imi file).
- gen_flc.h - the declarations needed by the gen_flc module
- flc.ned - the ned description and the ned parameters of the flc module
- flc.cc - the code of the flc. The changes must be operated ONLY in the function
void FLC::handleMessage(cMessage *msg) , in the sense that you have to re-write the code of
this function such that the code will fit the current application of the FLC.
In the code, two parameters are read from other modules:
- then it is computed their difference: int diff = leni - lenr;
- The value of diff is scaled (from the intervalul [-31, 31], corresponding to the values
of diff given by the application, to the interval [0, 63], which corresponds to the internal
representation of the linguistic variables inside the flc
- The parameter named "qos" is read from another module (the values of the qos parameter
are already in the interval [0,63], so it is not necessary to scale it).
- The parameter "delta" is read. This parameters determines how much to fuzzify the crisp input
variables. If we don't want to fuzzify, we will make delta = 0.
- It is updated theSe the array inp (inputs) which will be used for calling the function
flc:
int inp[2]={diff,qos};
- The function flc is called as follows:
int result = fuzzy_inference(inp,2, delta);
- If necessary, the result will be scaled.
- The result will be used for updating the desired parameter from another omnetpp module.