arruda / scikit_fuzzy_fcl

A plugin for scikit-fuzzy that provides a parser for Fuzzy Control Language (as described in IEC 61131-7)
MIT License
2 stars 1 forks source link

Fix variable range definition in FCL grammar #3

Closed arruda closed 7 years ago

arruda commented 7 years ago

According to FFLL page that contains some tips on the IEC input/output variable:

var1_init_decl ::= var1_list ':' (simple_spec_init | subrange_spec_init | enumerated_spec_init)

Also according to IEC 1331-7, on the input/output variable, input_declarations ::= see IEC 1131-3 Annex B, one should take a look into 1131-3.

After taking a look in 1131-3, this is the closes thing that I've found to how one should define the sub range for a spec (Table 12 - Data type declaration features):

Subrange data types, e.g.: TYPE ANALOG_DATA : INT (-4095..4095) ; END_TYPE

So instead of writing it like this:

        FUNCTION_BLOCK f_block
            VAR_INPUT
                input_id : REAL; RANGE := ( 12 .. 34 );
            END_VAR
        END_FUNCTION_BLOCK

It probably should be written like this:

        FUNCTION_BLOCK f_block
            VAR_INPUT
                input_id : REAL ( 12 .. 34 );
            END_VAR
        END_FUNCTION_BLOCK

Where, following the example in IEC 1331-3: