jFuzzyLogic/fcl/scarledOLD.fcl

37 lines
816 B
Plaintext
Raw Normal View History

2014-12-19 14:30:46 +01:00
/*
Example: derived from the example of Pablo Ciongolani
http://www.mathworks.com/access/helpdesk/help/pdf_doc/fuzzy/fuzzy.pdf
Pablo Cingolani
pcingola@users.sourceforge.net
*/
FUNCTION_BLOCK scarled // Block definition (there may be more than one block per file)
VAR_INPUT // Define input variables
age : REAL;
END_VAR
FUZZIFY age
TERM very_young := (0,1) (20, 1) (30, 0) ;
TERM young := (20, 0) (30,1) (40,0);
TERM middle := (30, 0) (40,1) (50,0);
TERM old := (40, 0) (50,1) (60,0);
TERM very_old := (50, 0) (60, 1) (100,1);
END_FUZZIFY
END_FUNCTION_BLOCK
FUNCTION_BLOCK second_level
VAR_INPUT // Define input variables
attitudes : REAL;
END_VAR
FUZZIFY attitudes
TERM negative := (1,1) (2,1) (4,0);
TERM positive := (1,0) (2,0) (4,1);
END_FUZZIFY
END_FUNCTION_BLOCK