The Xfuzzy 3 development environment
The SysGen model generation tool - Xfsg
The xfsg hardware synthesis tool (Xfuzzy to System Generator) allows the automatic conversion of the XFL3 specification of a hierarchical fuzzy system, consisting of the combination of different inference modules and crisp blocks, into a Simulink model that can be simulated in the MATLAB environment and implemented on Xilinx FPGAs. However, not all XFL3 specifications are likely to be implemented through xfsg. In particular, fuzzy systems that can be implemented by this tool must employ functions or families of triangular membership functions with overlapping degree 2 and use simplified defuzzification methods.
The graphical user interface of xfsg can be invoked from the main window of the Xfuzzy environment, using the "To Sysgen" option in the Synthesis menu, or through the corresponding icon of the icon bar. The main window of xfsg is divided into five parts: a zone with information on the location and the name of the used files, a tree structure that shows the rule bases and crisp blocks that make up the system, an area that initially shows the interconnection of the different system components, a zone of global options, and a series of buttons located in the lower part of the window.
The zone of information about files and directories is divided into three fields. The Input XFL file field contains the absolute path of the XFL3 specification file selected when the tool is launched. This field is informative, it can not be modified by the user. The Name for Output files field allows you to configure the prefix of the xfsg output files. By default, the name of the input fuzzy system appears. Finally, the Output directory field indicates the absolute path of the directory where the output files generated by the tool will be located. In this case, the directory that contains the system specification appears by default.
The upper area of the window also includes a button (identified by the text XFSG) that, when pressed, displays a dialog box listing the different operators, defuzzification methods, types of membership functions and crisp blocks that may appear in fuzzy systems synthesized by the tool. These functions are defined in what is called the "xfsg package" in Xfuzzy terminology. To the right of the button is a text that advises the user to use only the functions included in this package to ensure that no problem will occur when implementing the system.
In the left central zone of the window the tree structure of the fuzzy system is shown, with the elements that compose it grouped under the categories RuleBases and CrispBlocks. Initially, or whenever the top level of the system specification is selected, a window with the components that make up the system and its interconnection appears in the right area. When a specific rule base is selected within the RuleBases category, the interface shown in the following figure appears in this zone, allowing to define the different parameters that dimension the inference module. Specifically, can be defined the number of bits used to encode inputs, output, antecedent membership degrees, and slopes of the membership functions. Also in this zone are displayed certain values calculated from the system specification. Specifically, the number of membership functions and the values of the breakpoints and slopes for each input, as well as the matrix representation of the corresponding rule base.
When a crisp block is selected in the tree structure, the right middle part of the interface shows a single field to be filled relative to the number of bits defined for the output of the block.
When all the parameters related to the rule base or the crisp block have been configured, it is necessary to press the Apply button to save the changes (otherwise the information entered in the form will be lost). After that, the red icon that appeared initially next to the knowledge base is replaced by the green icon shown in the figure. When the parameters of all the rule bases and crisp blocks that make up the system have been defined, a green icon appears next to the top level of the system specification and the Save Configuration and Generate Files buttons in the lower area of the graphical user interface are enabled.
The Save Configuration button allows to save the system configuration through an XML file that stores information relative to the implementation options of the different components of the system (see Configuration file section). The configurations saved by this option can be loaded at a later time using the Load Configuration button.
Before clicking the Generate Files button, the user can configure the options that appear in the Global Options zone of the graphical user interface. The functionality of each of the options is as follows:
Once the parameters of the different system components and the global options have been defined, the Generate Files button can be pressed to generate the following files in the indicated output directory:
The configuration of the synthesis process with xfsg can be saved in an XML file to be retrieved at a later time. It must be taken into account that the syntax of the configuration file can change in successive Xfuzzy versions and that only configuration files generated by the current version can be loaded, So the old XML files must be adapted to the right format by adding the new tags.
The appearance of the configuration file reflects the tree structure that represents the system. The root of this file is the label called system, which has three attributes: name, rulebases and crisps. The first one indicates the name of the system, while the other two indicate the number of rule bases and crisps blocks, respectively. (If the system does not contain any crisp blocks, this attribute does not appear).
The file includes three main elements: rulebases, crisps and options. The rulebases tag contains information about the rules bases, each of them identified by a rulebase tag. This element has as attributes: name, which indicates the name of the rule base; inputs, which indicates the number of inputs; and outputs, which indicates the number of outputs. The child elements of this tag define each of the parameters of the rule base: bits_input (number of bits for inputs), bits_output (number of bits for outputs), bits_membership_degree (number of bits for membership degree) and bits_MF_slopes (number of bits for slopes).
The crisps element appears empty when the system does not include any block of this type. Otherwise, each block is defined by a crisp tag that includes the attributes: name, which indicates the name of the crisp block; inputs, which indicates the number of inputs; and outputs, which indicates the number of outputs. The only parameter that can be defined for this type of elements is the number of bits used to encode the output (bitsize_output).
Finally, the option tag is used to identify the different options that appear in the Global Options and Files and directory information sections of the xfvhdl graphical user interface. The child elements of this tag are: include_rule_confidence_factor_mfile, gen_txtfile, gen_simmodel, use_simp_components, outputFile and outputDirectory. The first four admit a Boolean value (true or false) that indicates the activation or not of the corresponding option.
The saved configurations can be subsequently loaded using the Load Configuration button, without the need to enter all the values again.
If an error or warning occurs during the generation of the xfsg output files, the user will be notified in the Xfuzzy message area. The list of possible errors together with the description of the causes that motivate them is illustrated in the following table.
-------------------------------------------------------------------------------------- S. Sánchez-Solano, E. del Toro, M. Brox, P. Brox, I. Baturone Model-Based Design Methodology for Rapid Development of Fuzzy Controllers on FPGAs IEEE Transactions on Industrial Informatics, 2012 DOI: 10.1109/TII.2012.2211608
For comments, patches, bug reports, etc contact us at: