Skip to content

Latest commit

 

History

History
174 lines (136 loc) · 8.11 KB

File metadata and controls

174 lines (136 loc) · 8.11 KB

Here is a full description of the IEEE 1855 (FML) standard, followed by a comprehensive example that demonstrates its most important and common features.


ℹ️ Description of the IEEE 1855 (FML) Standard

IEEE 1855, or the Fuzzy Markup Language (FML) standard, is an XML-based specification for describing fuzzy logic systems in a human-readable and hardware-independent way.

1. Purpose and Significance

The primary goal of FML is interoperability. Before the standard, different fuzzy logic software (like MATLAB's Fuzzy Logic Toolbox, jFuzzyLogic, etc.) and hardware implementations used their own proprietary formats. This made it extremely difficult to share, reuse, or validate a fuzzy system created in one tool with another.

IEEE 1855 solves this by providing a single, standardized "lingua franca" that any compliant tool can read and write.

  • Human-Readable: Because it's XML, you can open an FML file in any text editor and understand the system's logic.
  • Hardware-Independent: A single FML file can be used to program a fuzzy controller in a desktop application, a microcontroller (like an Arduino), or a large industrial PLC, as long as the target platform has an FML-compliant parser.
  • Complete: The standard is designed to describe all components of a fuzzy inference system (FIS), including variables, membership functions, rules, and inference settings.

2. Core Components of an FML Document

An FML file is structured around three main components, nested within a root <FuzzySystem> tag:

  1. <KnowledgeBase>: This block defines all the variables in the system.

    • <FuzzyVariable>: Defines an input or output variable for a Mamdani-type system (the most common type, which uses fuzzy sets for its output).
    • <TakagiSugenoVariable>: Defines an input or output variable for a Takagi-Sugeno (TSK)-type system (which uses a mathematical function, usually linear, for its output).
    • <FuzzyTerm>: Defines the linguistic terms (like "cold," "warm," "hot") for each variable. This is where the membership functions (<triangularShape>, <trapezoidalShape>, <gaussianShape>, etc.) are specified.
  2. <RuleBase>: This block defines the logic of the system.

    • A single FML file can contain multiple RuleBase blocks, allowing you to define different system behaviors (e.g., one for Mamdani, one for TSK).
    • You specify the core inference operators here, such as andMethod (e.g., min, prod), orMethod (e.g., max, bsum), and activationMethod (e.g., min).
    • <Rule>: Contains a single IF-THEN rule.
    • <Antecedent>: The "IF" part of the rule, containing one or more clauses.
    • <Consequent>: The "THEN" part of the rule, containing one or more clauses.
    • <Clause>: A single statement about a variable (e.g., "temperature IS cold"). This is also where you can add modifiers like modifier="very" or negation like NOT="true".
  3. <InferenceEngine>: (Often optional, as defaults are used) This block specifies the high-level details of the inference process, such as the defuzzification and accumulation methods.


Example: "Smart Tipper" Fuzzy System

It's not feasible to show every possible feature in one file, as many are mutually exclusive (e.g., different defuzzifiers).

However, this example is far more complete than the last one and demonstrates the standard's most powerful features, including:

  • Both Mamdani and Takagi-Sugeno (TSK) system types.
  • Multiple membership function shapes (triangular, gaussian, singleton).
  • Different AND/OR operators.
  • Rule weights.
  • Linguistic modifiers ("very") and negation ("NOT").

This system calculates a restaurant tip based on two inputs: service and food_quality.

<?xml version="1.0" encoding="UTF-8"?>
<FuzzySystem name="SmartTipper">

    <KnowledgeBase>

        <FuzzyVariable name="service" type="input" domainleft="0" domainright="10">
            <FuzzyTerm name="poor" complement="false">
                <gaussianShape param1="0" param2="1.5"/>
            </FuzzyTerm>
            <FuzzyTerm name="good" complement="false">
                <triangularShape param1="3" param2="5" param3="7"/>
            </FuzzyTerm>
            <FuzzyTerm name="excellent" complement="false">
                <trapezoidalShape param1="6" param2="8" param3="10" param4="10"/>
            </FuzzyTerm>
        </FuzzyVariable>

        <FuzzyVariable name="food" type="input" domainleft="0" domainright="10">
            <FuzzyTerm name="bad" complement="false">
                <singletonShape param1="2.5"/>
            </FuzzyTerm>
            <FuzzyTerm name="tasty" complement="false">
                <gaussianShape param1="10" param2="2"/>
            </FuzzyTerm>
        </FuzzyVariable>

        <FuzzyVariable name="tip_mamdani" type="output" domainleft="0" domainright="30"
                       accumulation="max" defuzzifier="COG" defaultValue="0">
            <FuzzyTerm name="low" complement="false">
                <triangularShape param1="0" param2="5" param3="10"/>
            </FuzzyTerm>
            <FuzzyTerm name="average" complement="false">
                <triangularShape param1="10" param2="15" param3="20"/>
            </FuzzyTerm>
            <FuzzyTerm name="high" complement="false">
                <trapezoidalShape param1="20" param2="25" param3="30" param4="30"/>
            </FuzzyTerm>
        </FuzzyVariable>

        <TakagiSugenoVariable name="tip_tsk" type="output" domainleft="0" domainright="30">
            <SugenoTerm name="low_linear"
                        param0="0" param1="0.5" param2="0.5" />
            <SugenoTerm name="high_linear"
                        param0="5" param1="1.0" param2="1.0" />
            <SugenoTerm name="fixed_high"
                        param0="25" param1="0" param2="0" />
        </TakagiSugenoVariable>

    </KnowledgeBase>

    <RuleBase name="MamdaniRules" type="mamdani" andMethod="prod" orMethod="max" activationMethod="min">

        <Rule name="Rule_Poor" connector="or" weight="1.0">
            <Antecedent>
                <Clause var="service" term="poor"/>
                <Clause var="food" term="bad"/>
            </Antecedent>
            <Consequent>
                <Clause var="tip_mamdani" term="low"/>
            </Consequent>
        </Rule>

        <Rule name="Rule_Good" connector="and" weight="1.0">
            <Antecedent>
                <Clause var="service" term="good"/>
            </Antecedent>
            <Consequent>
                <Clause var="tip_mamdani" term="average"/>
            </Consequent>
        </Rule>

        <Rule name="Rule_Excellent" connector="and" weight="0.8">
            <Antecedent>
                <Clause var="service" term="excellent"/>
                <Clause var="food" term="tasty"/>
            </Antecedent>
            <Consequent>
                <Clause var="tip_mamdani" term="high"/>
            </Consequent>
        </Rule>

        <Rule name="Rule_Advanced" connector="and" weight="1.0">
            <Antecedent>
                <Clause var="service" term="poor" NOT="true"/>
                <Clause var="food" term="tasty" modifier="very"/>
            </Antecedent>
            <Consequent>
                <Clause var="tip_mamdani" term="high"/>
            </Consequent>
        </Rule>

    </RuleBase>

    <RuleBase name="TSK_Rules" type="takagi-sugeno" andMethod="min" orMethod="max" activationMethod="min">

        <Rule name="TSK_Rule_1" connector="and" weight="1.0">
            <Antecedent>
                <Clause var="service" term="poor"/>
            </Antecedent>
            <Consequent>
                <Clause var="tip_tsk" term="low_linear"/>
            </Consequent>
        </Rule>

        <Rule name="TSK_Rule_2" connector="or" weight="1.0">
            <Antecedent>
                <Clause var="service" term="excellent"/>
                <Clause var="food" term="tasty"/>
            </Antecedent>
            <Consequent>
                <Clause var="tip_tsk" term="high_linear"/>
            </Consequent>
        </Rule>

    </RuleBase>

</FuzzySystem>