Tutorial Decision Table

The decision and action tables are the simplest state programs. They are called degenerate state programs because, with just one state in the decision table and with just one event in the action table, they form combinational program,.

The decision table consists of a set of events and procedures. The action table is similar except that a group of procedures (instead of one) are executed by an event. Each is called with an event value N, which in turn, executes the table's Nth procedure. Decision and Action tables form combinational programs since the code that's executed depends only on the current event value or count.

For example, the decision table shown below operates in the following manner:

When called with event zero: procedure 'AA' is executed. When called with event one: procedure 'BB' is executed. When called with event two: procedure 'AA' is executed. and so on

The STATEMASTER's source code for this program is shown in below.

The Decision Table

 


STATEMASTER Decision Table Source Code

 
// Date: Mon Oct 25 20:22:01 1999
// Finite State Machine from StateMaster: 
// decesiontable.c Language = C
//  STATE TABLE SIZE: States = 1  Events = 4
 
//  C Language Automata file.
//  Generated by StateMaster.
//  Fuzzy Systems Engineering.
//  Copyright 1999.
//  This StateMaster copy is 
//  registered for the single computer use by:
//  Daffy Duck : Duck Feathers Co. : 619-555-1212
 
//  OPTION SETTINGS:
//        State Variable: Local
//        Limit Tests: Done
//        Data Type: Integer
//        Start State: 0
//        FSP Object: Function
//  State Macros 
#define PROCEDURE        0
 
// Event  Macros 
#define EVENT_0        0
#define EVENT_1        1
#define EVENT_2        2
#define EVENT_3        3
 
int decesiontable_st  = 0; 
void decesiontable(int event)
{
        int action;
        static int action_tbl [4][1] = {
        { 20 },
        { 21 },
        { 22 },
        { 23 }};
        static int next_state_tbl [4][1] = {
        { 0 },
        { 0 },
        { 0 },
        { 0 }};
        action = action_tbl [event][decesiontable_st];
        decesiontable_st = next_state_tbl [event][decesiontable_st];
        switch (action)
        {
        case 20: //AA__
 // Add your action code here for AA__
           break;
        case 21: //BB__
 // Add your action code here for BB__
           break;
        case 22: //CC__
 // Add your action code here for CC__
           break;
        case 23: //DD__
 // Add your action code here for DD__
           break;
        default:
           break;
        }
}
 

Finite Automaton (FA)