sFLC3 Sample Dialog Application

Home Up Next


Yahoo Charts


US Markets Daily


Forthcoming Releases:

Fuzzy Logic:

Neural Net:
Release of NXL3


sFLC3 Sample Dialog Application

Let's just have a quick look at a few screenshots of the sFLC client.  It is in our view to best and quickest way to approach sFLC3.

Click to download:  Executable (setup file), VC++ Source code, Documentation (Quick Guide)

It here may seem a little verbose, but we first wished to keep this sample program also as a learning tool closely associated to the Seattle Robotics tutorial, and then build on those basic principles to make it a very versatile tool.  You will notice that the default 3x3 FLC is exactly the same as the one described in the Seattle Robotics tutorial. 

(snapshot may change in future releases)

This first screenshot shows the sFLC client software.  A new FLC is created when the dialog is initialised. This sample program will only create one, but any number of FLCs can be created.

Our motivation being simplicity, the first thing we shall do is to select a Fuzzy Model (3x3 or 5x5 in our example). Again the DLL allows for very versatile fuzzy controllers, but building a comprehensive rule set can become very tedious with more than 2 or 3 inputs and more than 1 input.  We therefore shall always try and keep problems simple, or split fuzzy problems into separate FLCs.  Our example will therefore use 3 variables: 2 inputs + 1 output.

(snapshot may change in future releases)


We here select a 3x3 model (top left). This means that we choose to have 3 fuzzy states in each variable (like for instance Low, Med, High). We then select the shape of the default fuzzy sets we want to use in our FLC. Clicking on the Shape button displays the Fuzzy Set layout i.e. how fuzzy states are distributed in space.

Here above are 3 types of default fuzzy sets (please do take a look at our Fuzzy Sets Model spreadsheets FS3.xls/FS3.MHT and FS5.xls/FS5.MHT for more details). To read the above pictures, the horizontal axis is the value of either an input or the output from -1 (left) to +1 (right), i.e. very low to very high. The vertical axis is a measure from 0 (nil) to 1 (full) how the input or output fits in such or such category. The green line represents the Low state, the red line the Medium state, and the blue line the High state.  For instance, all models being balanced, a value of 0 would be 100% Medium while 0% Low and 0% High.  We'll come back to this later on.

The first one here is regular or balanced with an average overlap.  The other 2 show variations, the middle one being more "decisive" with the "Average" state being played down, and the last one also decisive, but with a stronger "Average" state.  All models can be edited to suit any problem solving exercise on hand.


We then select a default Rule Set (from a list of 5 predefined rule set models).  In the example below, we have the 2 input states listed horizontally for V1 (1=Low, 2=Med, 3, High) and vertically for V2 (4=High, 5=Med, 6=High).

A typical rule in that rule set will be for instance: "IF V1=Low AND V2=Low THEN Output=Low" (top left cell in the above matrix).

We'll describe this in more details later on. Trust me... it is really straightforward to use.

Let's move on to the next screen shot.

We now click on the FS button to generate default Fuzzy Sets according to the fuzzy model ("Regular" in this case). We can call the FS editor, or even delete all Fuzzy Sets to eventually start all over again.

Next step is to create a set of variables (3 = 2 Inputs + 1 Output), and attach the newly created Fuzzy Sets to each of them. Again, variable attributes can be edited here.

Let's click on the last RS button to generate the Rule Set.  That's it. The sFLC is now operational. We can of course edit our Rule Set, but using a predefined rule set is often sufficient, and is very straightforward, which is what we need when the ultimate goal is to build complex fuzzy systems like a Fuzzy State Machine.

For the time being, let's just say we got a FLC with only 4 Clicks, and developers will see it takes probably the same number of C++ calls!

We can now test our sFLC with sample data.

The details of the sFLC calculations are described in the Walk-Through document.  Again, please take the necessary time to first read the excellent tutorial from Seattle Robotics if the FL concepts still seem a little difficult to grasp.

In a few words, what do we see on the above picture? First the predicates are estimated.  For instance, if Var1 = 0.25, it means that the the first premise ("Is Var1 Low?") or V0 (p1) = 0% Low. In other words, at that level, Var1 is not Low.  All 6 predicates (2 variables times 3 possible states) are calculated.

Secondly, we try inferencing all available rules.  Let's take the 1st rule : "If Var1 is Low and Var2 is Low". Since Var1 is 0% Low, the first rule returns 0 ("AND(0.000,0.500)=0.000").  All 9 rules are scanned here using the standard MINMAX mechanism.  Some systems will discard rules, or keep the most suitable etc.  In our case, we will try and find a balance whereby all rules contribute to the output in their own capacity.  Again, full access to the API allows full customization of your FL controller.

Now that rules have been "fired" comes the 3rd step: calculating the Output Strength for each fuzzy state.  In this example, with the 2 input values, the FLC returns, the output is 50% Medium and 87% High.  Again, we could keep the most relevant output only, but we here decide to calculate a fuzzy centroid, i.e. a defuzzified composite output = 0.634

The API allows a straightforward calculation using a single call, or go through all 4 calls and possibly customise each step.  Generally, the variations will be on either applying a min/max on rule inferencing or other sort of rule selection, and/or change the way the overall defuzzified output must be calculated.

For any question, please send a mail to Support

Home Up Best viewed with MS Internet Explorer 5 and above

Page last modified: May 08, 2008
Copyright ForeTrade Technologies 21st century and thereafter