Modeling Logic Systems with Structured Array-Based Logic

First this paper introduces an efficient tool called array-based logic for modeling complex logic systems. The main concepts of array-based logic are explained. Second, the logic functions of this tool are presented with the help of six definitions. Finally, an application example on manufacturing system is worked out.


Introduction
Structured Array-Based Logic is a toolbox of logic functions for modeling logic systems.In the fields like manufacturing, mechatronic, control systems, and for embedded processors, there is a need for a logic programming tool that gives complete solutions, compact code, as well as fast computation (for real-time applications).Structured array-based logic is such as logic programming tool written in MATLAB language, that guarantees the requirements mentioned above, namely complete solutions, compact, and fast.

Propositional logic
Modeling a logic system can be done exactly like modeling a physical system [1].First, the fundamental logic variables (also called primitive logic elements) are identified and each logic variable is assigned an axis; thus the logic variables span the whole universe of discourse (total space), see figure-1a.Then the logic variables are connected into premises, thus creating a subspace of the total space, see figure-1b.Finally, the premises are combined to form the logic system, connecting subspaces spanned by the premises.There are some differences between the space span by the physical systems and logical systems; logical spaces are always linear and discrete.
By connection, space which do not satisfy the constraints are removed, leaving a smaller space which represents the feasible solution (figure-1); this is after Lagrange, who in analytical mechanics developed the free variational method.Thus Lagrange developed the mathematical foundation for the basic procedures for logic modeling discussed in this paper, and it was Pierce who applied these procedures (constraint satisfaction) to

Array-based logic
By the mathematical approach for modeling logic systems, a Cartesian axis is assigned to each logic variable in the system, generating subspaces spanning all possible states of all the variables, thus providing a complete representation.Though complete, this representation is huge; this means, for M multi-valued logic variables with a domain of N values, the resulting space will contain M N subspaces.This exponential growth of the subspaces with increasing number of variables makes the modeling and simulation slower.Array-Based Logic developed by O. I. Franksen and G. L. Møller avoids this exponential problem by compressing M N subspaces into M x N liner representation [2][3].Array-based logic also provides operations, which operates on the compressed representation in linear time.
Array-based logic was written in APL language; we ported array-based logic to MATLAB environment with some additional functions, and named structured array-based logic [4].

The toolbox functions
Propositional logic functions are for basic mathematical treatment of the logic system after Lagrange and Pierce.By using the propositional logic functions, though the configuration spaces will be large (exponential growth with increasing number of variables), it will be complete; that is, the configuration space includes all possible combinations of the logic variables.Array-based logic functions are enhanced logic functions for modeling and simulation of logic systems using a compression technology that provides compact representation of configuration space and faster simulation, without loosing completeness.

Propositional logic functions
All the logic variables (primitive elements) that are used in a system are to be declared first; it is the function element that is used for declaration.Relevant to the function element is the function assign; this function changes the values of a logic variable.E.g.To define a multi-valued logic variable 'Color' with a domain of three values 'red', 'green', and 'blue', we use, Color = element('n',{'red','green','blue'},{'green'}, 'Color'); The first argument 'n' indicates that the variable is multi-valued (or boolean).The second group of input argument are values (of domain), the third group is the default values selected at the time of declaration (in this example, default value is 'green'), and the final input argument is the label or name of the variable.After declaring a logic variable, we could change the values of the variable with the function assign; ColorRED = assign({'red'}, Color); Definition 1: Basic operations A logic system can be built by applying the following four basic operations on variables: disjunction (V), direct-implication (=>), nand, and converse-implication.These four operations are known as the Klein four group.Other logic operations can be derived from these four basic operations.The functions for these four operations are, disjunct, dimp, nand, and cimp respectively.[4,2], or [3,3]) and intervals (e.g.Cost is between <50 and 100>).

Definition 4: Intervals as logic variables
Array-based logic facilitates intervals to be treated as logic variables too.An interval variable may contain many intervals, each of which may be true or false.
An interval variable is created using the function element.E.g.: InputPrice = element('i', {LowerInterval, UpperInterval}, 'Input Price'), where the first argument 'i' indicates that the variable to be created is an interval variable, and the final argument is a label of the variable.

Definition 5: Deducing conclusions Deduction (or inference) is to draw conclusion from a connected system. Deduction is performed by the function deduct, which makes the OR -projection of all the axes complementary to the variables concerned, on the axes of the variables.
The final definition is about the state of a system.

Definition 6: state of system
The state of a system is the information required of the system to uniquely determine an output for an input to the system.The output is a vector of output variables which is computed from the input vector of variables and the system (see figure-2), using the function state.
Allowing quantitative variables to be treated as logic variables facilitates numerous advantages in modeling complex logic systems.Use of propositional and array-basic logic functions will become clear in the next section where we model a simple logic system from manufacturing engineering.See [4] for more elaborate explanation of the logic functions.Table-I shows the main functions.

Application Example
In this section, we shall model a manufacturing system as an application example.This example is taken from [5].The example is simple, but the methodology given below can be used to model larger logic systems.In the modeling approach (see figure-2), first the primitive logic variables are identified.Then these variables are grouped into premises using the logic operators like disjunct, dimp, etc.Finally, the premises are joined to make the compete system.

The manufacturing system example
The manufacturing system is shown in figure -3.It consists of a boring spindle operated by a direct current servomotor.The linear motion of the boring spindle is carried out by means of a hydraulic linear actuator.The hydraulic actuator is powered by a constant pressure hydraulic pump and the volumetric flow is the hydraulic circuit is controlled by a servo valve S t [6].The operation of the system is governed by three sensors (micro-switches) B, M, and E, where, 1. Sensor B indicates that the boring spindle is at the rear position, 2. Sensor M indicates that the boring spindle has reached the feeding position, and 3. Sensor E indicates that the boring spindle has reached the final destination, and ready for backward motion.
The spindle is at the rear position initially, and the operator switches on the system by a very short signal K.The manufacturing system then will go through three modes of operation: 1. Starting from the initial state, hydraulic circuit will open rapid phase valve I, and the spindle will go forward by the opening the valve F. 2. At position M, the rapid phase valve I will be switched off to start a controlled feed forward motion; This motion is regulated manually by the servo valve S t .At position M, the spindle motor will also be switched on by a signal S. 3. At position E, the backward motion R will begin.Simultaneously, the rapid phase valve I will be switched on.

Modeling The Logic System
The manufacturing system consists of a physical system and a logical system; we shall model the logical system only.

Identifying primitive logic variables
The behavior of the logic system can be described by the logic variables shown in Table-II:

Establishing the premises
The logic variables are grouped into premises as shown in Table-III [6]:

Logic Programming
In this subsection, we shall show how the logic system described above can be programmed using structured array-basic logic.

Declaring the logic variables
First of all, the logic variables must be declared.MATLAB codes for creating the variables are shown below.MATLAB codes start with a MATLAB prompt '>'.In MATLAB, the text that follows the '%' mark are comments, that is, not executable.

Grouping the logic variables into premises
Premise P1 is: F = (K OR F) AND (NOT E).This is programmed as follows:  The combined system If we combine the four premises together using AND operator, there will be 2 8 values (or tuples) in the truth table, as there are 8 boolean variables.Also, fusing the duplicate variables will be time consuming.Instead of AND'ing the variables together, we use the logic function join.
The system as the combination of the four premises, > SYSTEM = join(P1, P2, P3, P4); When we join the four premises, the function join removes duplicate variables when combining two premises together, and leaves the combined system in the compressed form by taking only the valid tuples.The combined system (SYSTEM) is very compact and complete.This is the core of the inference engine.Because it is compact, the inferences (deductions) made from it are fast.

Simulations on the combined system
Let us input some sample values to the inference engine.This means, during the initial phase, when K is pressed, both F and I will be switched on for forward rapid movement, while spindle motor (S) and backward movement (R) will remain switched off.

Closing remark
The core technology of the approach discussed in this paper, the array-based logic, is already used in many industrial applications, e.g. in TV sets [1].This paper presented an efficient logic programming toolbox called structured array-based logic, developed in MATLAB language with the aim of computing with words, in-addition to fast, complete solutions, and compact.Computing with words facility greatly enhances the modeler to concentrate on the logic modeling aspects rather than on the internal representations.

: System perspective of modeling a logic system SYSTEM join() join()
Definition 2: ColligationIf the same variable occurs more than once in a premise or in a combination of premises, then duplicate axes will be found in the configuration space.The process of removing superfluous axes without losing any information is called Colligation.The function that performs colligation is fuse.

Table - II: The logic variables of the system
R = (NOT F ) AND (NOT B)