Code sources contain:

  1. 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).
  2. gen_flc.h - the declarations needed by the gen_flc module
  3. flc.ned - the ned description and the ned parameters of the flc module
  4. 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:
  5. then it is computed their difference: int diff = leni - lenr;
  6. 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
  7. 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).
  8. 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.
  9. It is updated theSe the array inp (inputs) which will be used for calling the function flc:
    int inp[2]={diff,qos};
  10. The function flc is called as follows:
    int result = fuzzy_inference(inp,2, delta);
  11. If necessary, the result will be scaled.
  12. The result will be used for updating the desired parameter from another omnetpp module.