home Forums # Technical Support Convert fuzzylite with Arduino FIST: MATLAB Fuzzy Inference System to Arduino C

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1089
    Unknown
    Member

    If I take an example qtfuzzylite file (mamdanifolder/SimpleDimmer.fis) and use the online Arduino FIST: MATLAB Fuzzy Inference System to Arduino C Converter (http://www.makeproto.com/projects/fuzzy/matlab_arduino_FIST/index.php) in order to get C code I can copy into the Arduino IDE I get the following errors when I VERIFY the Arduino Sketch:

    ‘fis_’ was not declared in this scope

    sketch_jun05c.ino: In function ‘void fis_evaluate()’:
    sketch_jun05c:244: error: ‘fis_’ was not declared in this scope
    sketch_jun05c:246: error: ‘fis_’ was not declared in this scope
    sketch_jun05c:248: error: ‘fis_’ was not declared in this scope
    sketch_jun05c:258: error: ‘fis_’ was not declared in this scope
    sketch_jun05c:260: error: ‘fis_’ was not declared in this scope
    sketch_jun05c:262: error: ‘fis_’ was not declared in this scope

    How do I correct this? My question is can Arduino FIST: MATLAB Fuzzy Inference System to Arduino C Converter convert a qtfuzzylite .fis file? I realize the converter was built for MATLAB, is there some editing I can do on a qtfuzzylite .fis file to make it convert?

    #1090

    Hi Scott,

    I am not familiar with the converter you are talking about, but please have in mind that fuzzylite provides more features than Matlab’s toolbox, for which there are some keywords that are not supported by Matlab and issues occur when importing with them. Specifically, you will need to remove the following keywords from the fis files that are exported using qtfuzzylite:

    • Enabled=1
    • Default=nan
    • LockValid=0
    • LockRange=0

    Please, make sure these lines are not present in the fis files before using your converter. Let me know if this works for you.

    Cheers, Juan

    #1091
    Unknown
    Member

    Hi Juan,
    I opened the saved qtfuzzylite .fis file with a text editor app (TextWrangler) and deleted all the
    Enabled=1
    Default=nan
    LockValid=0
    LockRange=0

    as suggested.

    Next, I converted the file using Karthik Nadig’s online converter (http://www.makeproto.com/projects/fuzzy/matlab_arduino_FIST/index.php ) and copied its code content as instructed into the Arduino IDE. Result is the same set of errors when VERIFIED as before. Do you know of a easy way to take a qtfuzzylite .fis and change it to C language so the Arduino Uno microprocessor can run it? Try doing what I’m attempting with your SimpleDimmer.fis example and Karthik Nadig’s Converter (http://www.makeproto.com/projects/fuzzy/matlab_arduino_FIST/index.php ). Then try creating an Arduino .ino sketch IDE and VERIFY. Thanks for helping.

    #1092
    Unknown
    Member

    Got the Karthik Nadig’s online converter to work by making the following edits. Here is an example of code edits made to the SimpleDimmer.fis file.

    [System]
    Name=’simple-dimmer’
    Type=’mamdani’
    NumInputs=1
    NumOutputs=1
    NumRules=3
    AndMethod=’prod’
    OrMethod=’add’
    ImpMethod=’min’
    AggMethod=’max’
    DefuzzMethod=’centroid’

    [Input1]
    Name=’Ambient’
    Range=[0.000 1.000]
    NumMFs=3
    MF1=’DARK’:’trimf’,[0.000 0.250 0.500]
    MF2=’MEDIUM’:’trimf’,[0.250 0.500 0.750]
    MF3=’BRIGHT’:’trimf’,[0.500 0.750 1.000]

    [Output1]
    Name=’Power’
    Range=[0.000 1.000]
    NumMFs=3
    MF1=’LOW’:’trimf’,[0.000 0.250 0.500]
    MF2=’MEDIUM’:’trimf’,[0.250 0.500 0.750]
    MF3=’HIGH’:’trimf’,[0.500 0.750 1.000]

    [Rules]
    1.000 , 3.000 (1.000) : 1
    2.000 , 2.000 (1.000) : 1
    3.000 , 1.000 (1.000) : 1

    Comparing this to the qtfuzzylite SimpleDimmer.fis code notice all instances of

    Enabled=1
    Default=nan
    LockValid=0
    LockRange=0

    was removed and these changes made:

    AndMethod=’prod’
    OrMethod=’add’

    This VERIFIED in Arduino’s IDE with no error. Sweet!

    #1093

    Hi Scott,

    thank you for posting your solution! I will create a document later outlining the requirements of a conjunction and disjunction operator for fis files. Strictly speaking, you only need such operators if the rules contain “and” or “or” connectors, which is why those properties are empty in SimpleDimmer. However, I think I recall that Matlab also requires valid conjunction and disjunction operators regardless of the presence of connectors. Anyway, good you made it work!

    #2650
    Unknown
    Member

    Hi Scott,
    The last code you have wrotten in Matlab or Arduino ?
    If isn’t in Arduino, how can i write the rules in fuzzy controler in Arduino ?

    #2651
    Unknown
    Member

    Please help me, it’s very urgent

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.