Section 2

Back Home Up Next

 

Home
Software
Prices
Download
Yahoo Charts


NEW:
ADVANCED
TRADESTATION TECHNIQUE

US Markets Daily
snapshots

Technical
Description


Forthcoming Releases:

Fuzzy Logic:
sFLC3
DLL & API


Neural Net:
Release of NXL3
DLL & API


 

Section 2

Defining the FLC major components

As described briefly above, the main FLC components (FS, VS, and RS) need to be fully defined to be operational.  The dialog based implementation not only creates them but also defines them as per the Seattle Robotics tutorial.  Sceptics will be able to verify that calculations return the same results.

In our quest to have a simple highly replicable model, we have also coded 3 additional steps in our client application, which will be a very significant time saver later while offering increased versatility, which we describe now:


Defining a FLC Model

As mentioned before, the library allows for any sort of MISO model, yet we find it simpler to keep a 2-input 1-output model, each having the same number of fuzzy states.  We thought it could be confusing to build a model whereby for instance Variable1 is High (from a 3-state fuzzy set), and Variable2 is “High” or “Very High” (from a 5-state fuzzy set).  In the current version, we recommend using a “square” model, i.e. 3x3 or 5x5.

The FLC Model is not recorded in the object itself in the current version.  A variable is however used in the client application (“m_nFLCshape”).

Defining a Fuzzy Set Model

The library includes a number of predefined fuzzy sets[1] for the 3x3 and the 5x5 FLC models (check latest file header FLC_DLL.h)

For instance a 3-state (or 5-state) fuzzy set can be defined instantly as “Regular” and will have 3 (or 5) “ready-made” fuzzy states (i.e. membership functions) defined:

             

 

Future versions may offer more default models.  Next picture represents a “Regular” 3-state Fuzzy Set.

We can see above a relatively equally spaced Fuzzy Set with a balanced overlap between states:

  • a “Low” state (blue membership function),
  • an “Avg” state (orange membership function)
  • and a “High” state (green membership function)

Another example is the following fuzzy set where the “Avg” state is a little more constrained (more decisive model):

 

 

The available predefined models for both 3-state and 5-state fuzzy sets are listed in a spreadsheet to download from the web site.

 In the client application, we assume the same default fuzzy model for both variables.  It is obviously not a prerequisite.  We shall come back to this point in the next section “Defining a Fuzzy Set”.

Defining a Rule Set Model

Along the same vein, the library allows building a default rule set instantly from a list of 5 predefined rule bases, according to decisiveness and balance. “V1 controls V2” (and its opposite counterpart) are typical of error and error-dot fuzzy control systems.  It is for instance the one used in the Seattle Robotics tutorial.

A Rule Set spreadsheet available on the site gives detailed settings for all predefined rule sets.  Let’s just take a quick look at this first one:

We have Variable 1 (horizontal) with 3 possible states here coded 1 to 3, and Variable 2 (vertical) also with 3 states. The top left cell in that matrix reads as follows:
IF V1 = 1 AND V2=1 THEN OUTPUT=1

Wrapping up the introduction

We’ve seen a new object called FLC which represents the Fuzzy Logic Controller.  When instantiating, it is empty, and needs its 3 major components FS, VS, and RS to be set up to be fully operational.

We’ve also seen that default settings can speed the creation of a FLC with using a predefined fuzzy set and a predefined rule set. Obviously, they can be edited.  We’re going to study that now.


 

[1] Settings for the 6 predefined 3-state fuzzy sets as per FLC_DLL header (version 3.0) :

const int NumFS3 = 6;

const double FS3[NumFS3][3][4] =

       {

              0.,-0.5,0.,-1.,      1.,-0.5,0.5,0.,      2.,0.,0.5,1.,

              0.,-0.25,0.,1.,      1.,-0.25,0.25,0.,    2.,0.,0.5,1.,

              0.,-0.25,0.25,-1,    1.,-0.25,0.25,0.,    2.,-0.25,0.25,1.,

              0.,-0.75,0.,-1.,     1.,-0.75,0.75,0.,    2.,0,0.75,1.,

              0.,-0.75,0.,-1.,     1.,-0.5,0.5,0.,      2.,0,0.75,1.,

              0.,-1.,-0.25,-1.,    1.,-0.5,0.5,0.,      2.,0.25,1.,1.

       };

const string strStates3[3][3] =

                     {"Low", "Med", "High",

                     "Neg.", "Null", "Pos.",

                     "Small", "Avg.", "High"};

 

const string FS3n[NumFS3] =
{"Regular","Decisive","Very decisive","Averaging","Dampened","Separated"   };

 

Home Up Best viewed with MS Internet Explorer 5 and above

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