Programmable controller with fuzzy control function, fuzzy control process and fuzzy control monitoring process

Abstract: A programmable controller or PC (41) to which fuzzy control logic principles have been applied is disclosed. The controller improves operational speed by performing several of the fuzzy logic functions in the A/D and D/A converters (50, 60) traditionally used in PC units, thereby allowing portions of a fuzzy logic control operation to proceed in parallel and independently. The invention dispenses with the use of look-up tables and the like for fuzzy membership functions, fuzzy output functions, etc., by defining the functions typically in terms of three points in an orthogonal coordinate system, saving memory space. The invention also includes a fuzzy control process having the described aspects and a method of monitoring a PC or PCs having a fuzzy control function.

Description: The present invention relates to a programmable controller having a fuzzy control function, which performs fuzzy control on an analog data input, the fuzzy control process thereof and a fuzzy control monitoring process. Recently, in the control field, control systems to which fuzzy logic principles are applied have been the subject of intense research and development. The publication "Electronics and Communications in Japan", Vol. 67, No. 12, December 1984, pages 106 to 111, in particular Figs. 2 and 5, discloses a data converter for an analog/fuzzy-logic interface. In this publication, experimental results on an analog/membership grade converter or AMC are shown. The interface used there is a data converter which processes input analog voltage signals and outputs digital signals suitable for fuzzy logic processing, wherein the digital signals which are output represent fuzzy grade members. For that purpose, an experimental circuit is provided for inputting one piece of analog data, converting it to one piece of digital data, and operating on the digital data with one membership function. In that conventional device, only one grade number for the one input is calculated. The membership function in the conventional device is calculated on the basis of function curves, for example of the type as shown in Fig. 1 of that publication. Fig. 11 is a diagram (a descriptive representation of a fuzzy-control machine tool) showing the configuration of a prior art fuzzy controller. See "Fuzzy Expert System Configuring Tool Having Real-Time Control Functions", pp. 60-63, Mitsubishi Electric Technical Information Vol. 63, No. 3. In Fig. 11, numeral 10 indicates a fuzzy controller, 20 a system to be controlled by the fuzzy controller, and 30 a setting/monitoring device electrically connected to the controller 10 for setting therein the fuzzy membership functions (hereinafter referred to as "membership functions") and fuzzy control application software, and for monitoring the control operation. The fuzzy controller 10 comprises a general-purpose, high-speed CPU, such as a digital signal processor (DPS), and is composed of an inferrer 11 for making inferences, an A/D converter 12 for converting input analog data into digital data, a D/A converter 13 for converting digital data into analog data and outputting the result, a memory 14 for storing a plurality of membership functions and fuzzy output functions as parameter values and for storing application programs as application software for fuzzy inferences, the setting/monitoring device 30, and a line controller 15 for connecting the fuzzy controller 10. Fig. 12 shows an example of a fuzzy control application program stored in the memory 14 and executed in the inferrer 11. Figs. 13a to c show examples of A/D-converted inputs and the conversion thereof into fuzzy grade numbers using a plurality of membership functions, as part of an inferring process in accordance with the fuzzy control application program example shown in Fig. 12, and a defuzzed inference output, discussed hereafter. Fig. 14 is a flowchart of the fuzzy control process in accordance with the fuzzy control application program shown in Fig. 12. Operation will now be described using Fig. 14 on the assumption that the fuzzy application program shown in Fig. 12 has been written to the memory 14 in Fig. 11. The inferrer 11 reads the said application program from the memory 14 one line at a time and executes it on a line-by-line basis. The contents of rule R1 on line one are as follows: if A11 and A12 then A1 The "and" in rule R1 is a minimizing operation for selecting the smaller one of first fuzzy grade numbers A11 and A12. The operation result of the above conditional statement, A1, is also a fuzzy grade number. Hereinafter A11, A12, etc., are referred to as first fuzzy grade numbers and A1, etc., as second fuzzy grade numbers. The inferrer 11 will interpret the above rule R1 and first find the first fuzzy grade number A11. To find the first fuzzy grade number A11, a fuzzy inference process is started at step 500 in the flowchart shown in Fig. 14. The inferrer 11 reads and interprets, at step 501, the first rule Ri (i = 1). At step 502, the inferrer inputs from the controlled object a value x1, via the A/D converter 12, converts the same into a first fuzzy grade number by means of membership function all corresponding to A11 shown in Fig. 13a, and finds A11 ≡ a11(x1) = 0.6. Then, to obtain the first fuzzy grade number A12, the inferrer 11 inputs a value x2 via the A/D converter 12, converts the same into a fuzzy grade number by means of membership function a12 corresponding to A12 shown in Fig. 13b, and finds A12 ≡ a12(x2) = 0.90. At step 503, the inferrer 11 then performs the following fuzzy operation on the obtained fuzzy grade numbers A11 and A12 and finds the second fuzzy grade number A1, i.e. , obtains the second fuzzy grade number A1 = 0.60 from the following expression: A11 and A12 ≡ A1 = 0.60 and 0.90 ≡ 0.60 Then, at step 504, the inferrer 11 performs the following implication operation: A1 ○ B1 for the above obtained value A1 (= 0.60) using a fuzzy membership output function B1 (hereinafter referred to as a "fuzzy output function") which is different from the previously mentioned membership functions. The "○" in the above implication operation A1 ○ B1 contracts the fuzzy output function B1 at the same- ratio as the value of the second fuzzy grade number A1. Since A1 = 0.60 in this case, the fuzzy set which is the result of the implication operation is a reduction of the whole fuzzy output function B1 at a ratio of 1 to 0.6. This operation result is shown by a hatched area in Fig. 13C. The inferrer 11 then judges, at step 505, whether processing of all rules R1 to Rn is complete. If so, the processing will progress to step 507. Since the processing is not yet complete in this example, the inferrer 11 reads the next rule, i.e., the rule R2 on line two, from the memory 14 and interprets its contents at step 506, and returns to step 502. The contents of line two read: if A21 and A22 then A2 The inferrer 11 now works membership functions a21 and a22 in accordance with the previously found x1 and x2 and obtains first fuzzy grade numbers 0.75 (from a21(x1)) and 0.50 (from a22(x2)), from which second fuzzy grade number A2 is obtained by the following expression: A21 and A22 ≡ A2 = 0.75 and 0.50 ≡ 0.50 The inferrer 11 then works the above obtained value A2 on fuzzy output function B2 and performs the following operation: A2 ○ B2 Since A2 = 0.50, the operation result is a reduction of the whole fuzzy output function B2 at a ratio of 0.50. This operation result is also illustrated in Fig. 13c (the triangle defined by dashed lines). Hereinafter, by repeating step 506 and steps 502 through 505 as mentioned above, the inferrer 11 reads the remaining rules R3 (on line three) to Rn (on line n) in order, performs processing similar to that of rules R1 and R2, and as a result, obtains "n" pieces of inference output comprising A1 ○ B1 to An ○ Bn. Then, at step 507, the inferrer 11 carries out a fuzzy composition process which composes all of the above implication operation result, i.e. , calculates the center of gravity of the overlapped inference outputs, i.e. , the figures in Fig. 13c enclosed by a bottom coordinate axis (y axis) and both vertical axes (grade coordinate axes). In the present example this is done for values of the above indicated A1 ○ B1 and A2 ○ B2, resulting in a y axis value (in %) as a defuzzy value. At step 508, the above defuzzy value is converted into an analog value by the D/A converter 13 and provided as output y. By repeating the above steps at predetermined intervals, fuzzy control is carried out on the system 20 to be controlled. In the above mentioned process, the membership functions all to a21, the fuzzy output functions B1 to Bn, and the rules R1 to Rn are all stored in the memory 14 by the setting/monitoring device 30 via the line controller 15. The values of the figures (the results of the implication operations A1 ○ B1 to An ○ Bn) are also monitored, by specifying a whole or part thereof, by the setting/monitoring device 30 via the line controller 15. As is apparent from the flowchart shown in Fig. 14, since the prior art fuzzy controller 10 employs only one inferrer 11 to execute a succession of processes, in series, which are composed of the fuzzy grade number operations (step 502), the minimum value operation (step 503) and the implication operations (step 504), a comparatively long time is needed to perform the processes from input to output. In the first fuzzy grade number conversion by means of the membership function aij, therefore, a table reference system ( i.e., a look-up table) is used to reduce the processing time, i.e., tabulated membership functions are stored in the memory 14 beforehand. As an example, if 10 types of 10 membership functions alj are input, each of 256-division accuracy, a memory capacity of: 1 byte × 256 × 10 × 10 = 25.6KB is required and a large area is necessary for the table memory. Similarly, the fuzzy output functions B1 are also tabulated and stored in the memory 14 beforehand, and also require a large area for the table memory. The fuzzy controller 10 of the prior art configured as described above has problems in that the fuzzy inference operation takes a relatively long time because it is executed in series by one inferrer 11, and in that since a table reference system must be used to reduce the processing time of the fuzzy grade number conversion by way of the membership functions, a comparatively large memory area is required. Moreover, since the fuzzy controller is designed as a dedicated controller, the wiring and connections become complicated in the monitoring of the fuzzy control results when employing a general-purpose controller, such as a programmable controller, resulting in extra cost and loss of time. It is accordingly an object of the present invention to resolve the aforementioned problems in the prior art by providing a programmable controller having a fuzzy control function and using a fuzzy control process and performing a fuzzy control monitoring process, which can process the required fuzzy control functions in a comparatively short time, requires a relatively small memory area for fuzzy control, eliminates extra cost and loss time, and can easily monitor the fuzzy control results. The object is solved by a programmable controller and a fuzzy control process as defined in claims 1 and 6. Further developments thereof are set forth in claims 2 to 5 and 7. Examples of the invention will now be described with reference to the accompanying drawings in which: Fig. 1 is a block diagram of a programmable controller having a fuzzy control function according to an embodiment of the invention. Figs. 2a and 2b are block diagrams illustrating the details of an A/D converter module shown in Fig. 1. Figs. 3a and 3b are block diagrams illustrating the details of a D/A converter module shown in Fig. 1. Fig. 4 is a flowchart illustrating operations of the fuzzy control programmable controller shown in Fig. 1. Figs 5a and b are illustrative diagrams of a first fuzzy grade number operation which takes place in the A/D converter module shown in Fig. 2. Fig. 5c is an illustrative diagram of an implication operation carried out in the D/A converter module shown in Fig. 3. Fig. 6 is a ladder diagram illustrating an example of an application program for executing fuzzy operation processing instructions. Fig. 7 to 9 are illustrative diagrams of the calculation method of defuzzy conversion. Fig. 10 is a diagram illustrating a monitoring process which takes place over a network. Fig. 11 is a block diagram illustrating a fuzzy controller of the prior art. Fig. 12 is a diagram illustrating a set of fuzzy rules. Figs. 13a, 13b and 13c are illustrative diagrams of typical fuzzy grade number operations and an implication operation in the prior art fuzzy controller. Fig. 14 is a flowchart illustrating the fuzzy control scheme of the prior art. In the above figures, reference characters in the different views identify identical or corresponding parts. Referring now to the drawings, wherein like reference characters designate like or corresponding parts throughout the several views, embodiments of the invention will be described according to Figs. 1 through 10. Fig. 1 is a block diagram illustrating the configuration of a programmable controller having a fuzzy control function (hereinafter referred to as the "PC"). In Fig. 1, the numeral 40 indicates a controller unit containing a CPU 41 (hereinafter referred to as the "PC-CPU") as its major component. Numeral 42 refers to an application memory used as a storage for application programs comprising any combination of user-prepared sequence instructions and fuzzy inference instructions. An internal memory 43 of the PC-CPU 41 comprises a sequence instruction execution processor 43a identical to that of the prior art and an added fuzzy inference instruction execution processor 43b. The PC-CPU serves as a fuzzy operation processing instruction executing means, and functions to execute the fuzzy inference instructions. A line controller 45 connects a peripheral device 90 (described later) and the PC-CPU 41. An A/D converter module 50, connected to the PC-CPU by an I/O bus 44, converts input analog values into digital values, then converts the results into first fuzzy grade numbers. The A/D converter module 50 has the same hardware configuration as the prior art A/D converter module, and stores fuzzy membership functions (hereinafter referred to simply as "membership functions"). Unit 50 performs the grade number converting function using the membership functions, and is marked with an "*" in the drawings for differentiation from the prior art A/D converter module 50A. Input terminals 51 of the A/D converter module 50 receive analog input signals x1 to xm. A D/A converter module 60 operates as a D/A converter and also defuzzes a fuzzy inference result received from the controller unit 40, i.e. , derives a defuzzy value and converts it from digital form into an analog value, and outputs the analog value. The D/A converter module 60 has the same hardware configuration as the prior art D/A converter module, but stores fuzzy output functions and has a defuzzy conversion function. It is marked with an "*" in the drawings for differentiation from the prior art D/A converter module 60A. Output terminals 61 provide analog signal y as a fuzzy control output. Digital input module 70 and digital output module 80 resemble those of an ordinary programmable controller, and have digital signal input terminals 71 and digital signal output terminals 81, respectively. Numeral 90 indicates a peripheral device of the PC-CPU 41 used for writing user application programs to the application memory 42, for modification thereof, and for monitoring, etc ., of the instruction execution status of the PC-CPU 41 via the line controller 45. The peripheral 90 carries out, via the PC-CPU 41, the writing and modification of fuzzy inference instructions, in addition to the usual sequence instructions of the prior art, the setting of membership functions to the A/D converter module 50, the setting of fuzzy output functions to the D/A converter module 60, and monitoring. Fig. 2a is a block diagram illustrating the details of the A/D converter module 50. In Fig. 2a, numerals 51 indicate the analog signal input terminals, and 52 a built-in microprocessor (hereinafter referred to as the "µ-P") having an analog port 52a for A/D conversion. Numerals 53 indicate analog switches, and 54 is a sample holder, to which an input analog signal is output when any of the analog switches 53 is selectively switched on by the output signal 58a of a decoder 58 which will be described later. The sample holder 54 holds the input analog signal for a predetermined period of time in accordance with output signal 58b of the decoder 58 and then outputs the same to the analog port 52a of the µ-P 52. The µ-P 52 is a general-purpose processor containing an A/D conversion function, and has a built-in ROM/RAM 55. The built-in ROM/RAM 55 includes a prior art A/D conversion microprogram 55a with a non-linear compensation function and a fuzzy conversion microprogram 55b. The µ-P serves the functions of: (1) an A/D converter, converting analog signals input from the input terminals 51 into digital signals and (2) a fuzzy grade conversion means for converting the digital values into first fuzzy grade numbers using the membership functions. An interface 56 (hereinafter referred to as the "I/F") serves as an output area of the A/D converter module 50 and includes a two-port RAM 57 as a two-port storage. The two-port RAM 57 allows data to be transferred to and from the µ-P 52 and to and from the PC-CPU 41 over the I/O bus 44. In addition to its function as a storage means for the usual A/D converter module, the two-port RAM 57 includes a fuzzy function.storing area 57a (see Fig. 2b) for storing coordinate points that define the membership functions (in this embodiment, each membership function is defined by three points on orthogonal coordinate axes), and a fuzzy grade number storing area 57b. Analog input signals are converted into digital signals, and then conversion into first fuzzy grade numbers takes place by means of the membership functions, and the results are stored here. Namely, the two-port RAM 57 serves as a fuzzy grade number storing means for storing first fuzzy grade numbers accessible by/from the PC-CPU 41 of the controller unit 40, and as a storage means for membership functions, as defined by a format composed of a plurality of points (three points in the foregoing example). A decoder 58 (hereinafter referred to as the "DEC") closes any of the open analog switches 53 by decoding a command from the µ-P 52, and directs a command to the sample holder 54 so as to temporarily hold the analog value input via the closed analog switch 53. Fig. 3a is a block diagram illustrating the details of the D/A converter module 60. In Fig. 3a, numeral 61 indicate analog output terminals, and 62, a built-in microprocessor (hereinafter referred to as the "µ-P") having an analog port 62a, for D/A conversion. Output amplifiers are shown at 63m and at 64 are sample holders. The analog value output from the µ-P 62 is temporarily held by the sample holders 64, converted to low impedance and output by the output amplifiers 63. The µ-P 62 has a built-in ROM/RAM 65 which includes a prior art D/A conversion microprogram 65a and a defuzzy conversion microprogram 65b. An interface 66 (hereinafter referred to as the "I/F") between the I/O bus 44 of the PC-CPU 41 and the D/A converter module 60 has a two-port RAM 67 to allow data to be transferred to/from µ-P 62. In addition to functioning as a storage means as in the case of an ordinary D/A converter module, the two-port RAM 67 has, as shown in Fig. 3a, a fuzzy output function storing area 67a for storing coordinate points that define fuzzy output functions (in this embodiment, one fuzzy output function is defined by three points on orthogonal coordinate axes), and a fuzzy output storing area 67b for storing second fuzzy grade numbers transferred from the PC-CPU 41. A decoder 68 (hereinafter referred to as the "DEC") closes any of the open sample holders 64 by decoding a command from the µ-P 52. Fig. 4 is a flowchart illustrating the operation of the PC shown in Fig. 1. Flow A indicates the operation of the A/D converter module 50, flow B that of the controller unit 40, and flow C that of the D/A converter module 60. The details of the processing will be hereafter described. Fig. 5a and b are illustrative diagrams of the operations performed on the first fuzzy grade numbers obtained in correspondence with input data x1, x2 converted into digital values, using the membership functions defined in the three point format, in the A/D converter module 50 shown in Fig. 2. Fig. 5c is an illustrative diagram of the performance of the implication operation on the second fuzzy grade numbers input from the controller unit 40, using the fuzzy output functions defined in the three point format, in the D/A converter module 60. Fig. 6, as described in more detail hereinafter, shows a portion of an application program example, in ladder form, relating to a fuzzy inference function executed by the PC-CPU 41 shown in Fig. 1. The operation of the foregoing system will now be described, with reference to Figs. 1-6. Prior to performing control, a plurality of coordinate points (coordinate data) defining the predetermined membership functions are stored in the two-port RAM 57 (Fig. 2a) inside the A/D converter module 50, via the line controller 45 (Fig. 1) and I/O bus 44 of the controller unit 40, using the peripheral device 90 in Fig. 1. In a similar way, coordinate data defining the predetermined fuzzy output functions are stored in the two-port RAM 67 (Fig. 3a) inside the D/A converter module 60. For both the membership and output functions, each function is defined by three coordinate points in this embodiment. In Fig. 5a, all and a21 are prepared as membership functions for x1 input from the analog input terminal 51 of the A/D converter module 50 (Fig. 1), and are given as a combination of points having coordinate values of the form (P1, P2), in an orthogonal coordinate system. The vertical axis is defined as the grade number, ranging between 0 and 1 {0, 1} and the horizontal axis is defined as the input percentage, ranging from 0 to 100% {0, 100}. In this embodiment, the function all is defined by three definition points SPA111, SPA112 and SPA113, and the function a21 is defined by definition points SPA211, SPA212 and SPA213, all of which are stored in the two-port RAM 57. Similarly, in Fig. 5b, a12 and a22 are prepared as membership functions for analog input x2, the function a12 being defined by points SPA121, SPA122 and SPA123, and the function a22 by points SPA221, SPA222 and SPA223 in this embodiment, the functions being stored in the two-port RAM 57. In Fig. 5c, fuzzy output functions B1 and B2 are used to produce the analog output y which will be output from the analog output terminal 61 of the D/A converter module 60 (Fig. 1). Functions B1 and B2 are given as a combination of orthogonal coordinates, wherein the vertical axis is defined as an output fuzzy value, ranging from 0 to 1 {0, 1} and the horizontal axis is defined as the output percentage, ranging from 0 to 100% {0, 100}. In this embodiment, the function B1 is defined by the three definition points SPB11, SPB12 and SPB13, and the function B2 by the points SPB21, SPB22 and SPB23, with the functions being stored in two-port RAM 67 (Fig. 3). Operations will now be described according to the flowchart shown in Fig. 4. In flow A, the A/D converter module 50 is started up at step 200, and initialized (j = 1) at step 201. The µ-P 52 then inputs the first analog signal xj (j = 1) and converts it into a digital value at step 202. At step 203, the µ-P 52 then reads membership functions aij (i = 1 to n) ( i.e. , all and a21 in this example) corresponding to the A/D-converted input signal xj (j = 1) from the two-port RAM 57, finds the first fuzzy grade numbers Aij ( i.e. , A11(x1) and A21(x1) in this example) corresponding to each membership function aij ( i.e. , converts the input xj into a grade number Aij) using the membership functions aij, and at step 204, writes the first fuzzy grade numbers Alj through Anj to a predetermined area of the two-port RAM 57. Then, at step 205, the µ-P 52 judges whether the above operation is complete or not for all input signals xj (j = 1 to m; m = 2 in this example), and if it is not complete, sets j = j + 1 to retrieve the next input signal (here, x2) at step 206 and repeats steps 202 through 204. When this process is complete, flow A terminates at step 207. In actuality, the µ-P 52 executes flow A cyclically at predetermined intervals of time, and at step 204, updates the first fuzzy grade numbers Aij stored in the two-port RAM 57. Details of the operation at major steps in flow A will be described below in accordance with Figs. 2a, b and Figs. 5a, b. At step 202, with regard to the A/D conversion and fuzzy grade number conversion of the analog input signals by means of the membership functions in the A/D converter 50, the µ-P 52 directs a command to the DEC 58, which closes one analog switch 53 by way of an output thereof, whereby the analog signal x1 is input from the input terminal 51 into the sample holder 54. The µ-P 52 causes the sample holder 54 to hold its value, by means of another output from the DEC 58. The µ-P receives the held output value at the A/D input port 52a included therein, converts the same into a digital value, makes the required scale and linearity conversions, and obtains a corresponding digital value. This operation is performed by the A/D conversion microprogram 55a using an established routine stored in the built-in ROM/RAM 55 of the µ-P 52. The process so far is the same or essentially similar to prior art A/D conversion techniques. Then, at step 203, flow A progresses to the execution of the microprogram 55b, i.e. , the fuzzy grade conversion routine, whereby the digital value obtained above (digital value at full scale = 100%) is converted into grade numbers by the membership functions a11 and a21. In the present example, as shown in Fig. 5a, in regard to the membership function a11, it is necessary only to find the intersection a11(x1) between value x1 and the straight line connecting points SPA112 and SPA113, which can be calculated from the following formula (1) and which will yield a first fuzzy grade number A11 for the input x1: A11 ≡ a11(x1) = P2(SPA113)-P2(SPA112) P1(SPA113)-P1(SPA112) ·(x1-P1(SPA113))+P2(SPA113) Similarly, for the membership function a21, the intersection of value x1 with the straight line connecting the two points SPA211 and SPA212 is found, which provides the following first fuzzy grade number A21: A21 ≡ a21(x1) = P2(SPA212)-P2(SPA211) P1(SPA212)-P1(SPA211) ·(x1-P1(SPA211))+P2(SPA211) In the above calculations, P1 and P2 are the coordinate values for the respective points, obtainable from the two-port RAM 57, as schematically seen in Fig. 26. Since the membership functions a11 and a21 are represented by polygonal lines, it is apparent that whether the input x1 intersects either or neither of the polygonal lines is determined nonambiguously. Then, at step 205, A11 (≡ a11(x1)) and A21 (≡ a21(x1)) obtained as indicated above are written, as first fuzzy grade numbers of the input x1 according to the membership functions all and a21, in a predetermined area 57b of the two-port RAM 57 as also shown in Fig. 2b. Similarly, thereafter, steps 202 through 206 are repeated and the µ-P 52 causes the DEC 58 to open the analog switch corresponding to the analog input x2, and causes the sample holder 54 to hold the x2 value, and then receives that value at the A/D input port 52a. The x2 value is converted into a digital value, and first fuzzy grade numbers A12 and A22 are found in correspondence with the membership functions a12 and a22 corresponding to the input x2. Fuzzy grade numbers A12 and A22 are obtained for the input x2 in a manner similar to that with respect to x1: A12 ≡ a12(x2) = P2(SPA123)-P2(SPA122) P1(SPA123)-P1(SPA122) ·(x2-P1(SPA122))+P2(SPA122) A22 ≡ a22(x2) = P2(SPA221)-P2(SPA222) P1(SPA221)-P1(SPA222) ·(x2-P1(SPA222))+P2(SPA222) In a similar way, the other analog inputs (if any) of the A/D converter module are converted into fuzzy grade numbers in correspondence with the corresponding membership functions and the conversion results are written to the predetermined area 57b of the two-port RAM 57. The membership function definition area 57a corresponding to each analog input informs the µ-P 52 of the end of each definition area with a predetermined mark at the termination of each definition. The above conversion operation is performed cyclically by the A/D converter module 50. Where there are a plurality of A/D converter modules 50, the above conversion operation is carried out asynchronously and in parallel. The operation in flow B of Fig. 4 will now be explained. The controller unit 40 is started up at step 300. When any of a plurality of pre-prepared fuzzy rule (hereinafter referred to simply as "rule") sets is selected at step 301, the PC-CPU 41 reads, at step 302, the first fuzzy grade numbers Aij (i = 1 to n, j = 1 to m) from storage in the two-port RAM 57 of the A/D converter module 50 and writes them in internal memory in the PC-CPU 41. At step 303, the PC-CPU 41 then executes the fuzzy operation processing instructions, i.e. , performs a fuzzy inference operation which will later be described in detail, using the first fuzzy grade numbers Aij. Namely, instructions 102 to 105 in the sequence ladder diagram segment shown in Fig. 6 are executed in order and the second fuzzy grade numbers Ai (i = 1 to n) are output. At step 304, the PC-CPU 41 then transfers the second fuzzy grade numbers Ai to a predetermined area 67b of the two-port RAM 67 in the I/F 66 of the D/A converter module 60 via the I/O bus 44, and terminates flow B at step 305. Flow B, however, is part of the application program, which is run cyclically by the PC-CPU 41, and is therefore executed cyclically. The principal steps of flow B will now be described in detail. Fig. 6 is a segment of a sequence program illustrated in ladder diagram form which causes the PC-CPU 41 to execute the rules shown in Fig. 12. It is part of the application program(s) stored in the memory 42. Instructions 101 to 106 execute the rules R1 to Rn shown in Fig. 12. Relay M10 110 is a logical contact which acts as a conditional contact controlling the execution/non-execution of the rule sets, and is switched on/off in the application program area (not illustrated). Instructions 107 to 109 correspond to a part of another set of rules (not illustrated in full), like the rules shown in Fig. 12. Relay M11 111 controls the execution/non-execution of this group of rules. The execution of the rule implementing instructions 101 to 106 will now be described, in comparison with the prior art. Instruction 101 is the data transfer instruction of the PC-CPU 41 executed at the step 302 in Fig. 4, and operates to transfer data (groups of words in batches) from any specified data area of the two-port RAM 57 in the I/F 56 within the A/D converter module 50 to any specified data area (a data register in this example) within the PC-CPU 41. Namely, the instruction 101 transfers data from the addresses (known to the user) of the two-port RAM 57 which store the first fuzzy grade numbers A11, A21, ... An1, A12, A22, ... An2, to data registers in the PC-CPU specified by the user application. At the instruction 101 in Fig. 6, FROM indicates a batch transfer instruction (an existing sequence application instruction) from any module (device) to the PC-CPU 41. H10 indicates an address where a transfer destination module is being inserted (H is a symbol representing a hexadecimal constant). Kmi indicates an address on the two-port RAM; in this example, an address on the two-port RAM 57 in the A/D converter module (K is a symbol representing a decimal constant). D11 indicates a transfer destination head address. K2n indicates the number of words to be transferred (K is a decimal constant). When the PC-CPU 41 executes the above instruction, the A11 value is stored into D11, A21 into D12, An1 into D10+n, ... A12 into D11+n, A22 into D12+n, and An2 into D10+2n. Instruction 102 is a fuzzy AND instruction executed at step 303 and is differentiated from the usual AND instruction by the presence of the symbol ∼, i.e. , the fuzzy AND instruction is indicated by "∼AND". The processing routine for this instruction is stored in the fuzzy inference instruction execution processor 43b of the internal memory 43 in the PC-CPU 41. The instruction performs the following fuzzy operation between the word resources at the three successive addresses: Namely, the instruction 102 compares and takes the minimum of the contents of D11 and D11+n; i.e. , in this example, a minimum value operation is performed on values A11 and A12, and the smaller value is stored at D11+2n as the second fuzzy grade number A1. Thereafter, similarly, AND instructions 103 through 105 are executed at step 303: Instruction 103 performs a minimum value operation on the contents of D12 and D12+n, i.e. , the values A21 and A22, and the smaller value is stored in D12+2n as A2. Instruction 104 performs a minimum value operation on the contents of D10+i and D10+2i, i.e., the values Ai1 and Ai2, and the smaller value is stored in D10+3i as Ai. Instruction 105 performs a minimum value operation on the contents of D10+n and D10+2n, i.e. , the values An1 and An2, and the smaller value is stored at D10+3n as An. Instruction 106 is a data transfer instruction of the PC-CPU 41, executed at step 304 of Fig. 4. It differs from the FROM instruction at instruction 101 in that the transfer direction is opposite, i.e. , a batch transfer from any designated data area (a data register in this example) of the PC-CPU 41 to a designated area in any module (here, the two port RAM 67). Specifically, in instruction 106, TO indicates a batch transfer instruction to transfer data from the PC-CPU 41 to any designated module (device). This is an existing sequence application instruction; its processing routine is stored in the microprogram 43a. H20 indicates an address where a transfer destination module is being inserted; a D/A converter module address in this example (H indicates a hexadecimal representation). Km2 indicates an address on a two-port RAM in the destination module; in this example, an address value m2 on the two-port RAM in the D/A converter module 60 (K is a symbol representing a decimal constant). D11+2n indicates the transfer source head address. Note that the head address is that which was the target address of instruction 102. Kn indicates the number of words to be transferred. Namely, instruction 106 causes "n" pieces of word data, here A1 to An in memory areas D11+2n to D10+3n storing the fuzzy operation results, to be stored into RAM area 67b (Fig. 3b) at and after address m2 in the two-port RAM 67 of the D/A converter module 60. This completes step 304 in Fig. 4. Referring again now to Fig. 4, the operation of flow C will now be described. The D/A converter module 60 is started at step 400 and initialized (n = 1) at step 401. In a loop comprising steps 402 to 405, the µ-P 62 reads the second fuzzy grade numbers Ai (i = 1 to n), which have been stored in memory area 67b after being transferred there by PC-CPU 41 of the controller unit 40 at step 304 of flow B. The pre-stored fuzzy output functions Bi (i = 1 to n) are also obtained from the two-port RAM 67 in order. The µ-P 62 then performs implication operations Ai ○ Bi (i = 1 to n), and creates fuzzy result functions Ci (i = 1 to n) in a definition format defined by three points (like the fuzzy output functions Bi). These fuzzy sets are the fuzzy results of the operation. Then, at step 406, the areas Si of the figures (see Fig. 5c) defined by the fuzzy result functions Ci are found, along with the horizontal axis y axis) components li of their center of gravity. An area center of the composite fuzzy set obtained by overlapping the figures is determined, and the y axis value of the same (in %) is used as the defuzzy value obtained by defuzzing the composite fuzzy set, explained in greater detail hereafter. At step 407, the above defuzzy value is converted into an analog value and output as output y, and the flow C is terminated at step 408. Like the operation of the A/D converter module 50 shown in flow A and that of the controller unit 40 in flow B, flow C is executed cyclically and independently, and data transfer between the flows is performed by the PC-CPU 41 in the controller unit 40 by accessing the two-port RAM 57 of the A/D converter module 50 and the two-port RAM 67 of the D/A converter module 60. The main steps of the flow C will now be detailed. In Fig. 3, the D/A converter module 60 performs the defuzzy conversion via the following operation. Each fuzzy output function Bi has been specified by three definition points, which have been written to a predetermined area of the two-port RAM 67 in a given order. At step 403 of Fig. 4, the µ-P 62 performs the implication operation Ai ○ Bi on each of the second fuzzy grade numbers Ai (i = 1 to n). That is, it first reduces the value of each fuzzy output function Bi (i = 1 to n) in its vertical axis direction by a ratio set by the second fuzzy grade number Ai. That is, if the second fuzzy grade number Ai is 0.6, for example, the output function Bi will be reduced in the vertical direction to 60% of its original value. Next, µ-P 62 determines the area Si and the area center coordinate li (horizontal axis only) of the triangle defined by the resultant three points or the trapezoid defined by the three points and the vertical axis. Then, at step 406, by weighting all of the area center coordinates li (i = 1 to n) according to the size of the area Si of each figure, the µ-P 62 overlaps and composes them, and finds the horizontal axis coordinate value of the area center of the resultant composite fuzzy set, i.e. , the defuzzy value y. Fig. 7 is an illustrative diagram showing the calculation method where the fuzzy output functions comprise triangles. If the triangle is composed of three points (ℓ1, 0), (ℓ2, h), (ℓ3, 0), the area S and the position x of the area center are obtained as follows: x = 1/3 (ℓ1 + ℓ2 + ℓ3) S = 1/2 (ℓ3 - ℓ1)h Where h is the height of the triangle, here determined by the second fuzzy grade number Ai. Fig. 8 is an illustrative diagram of the calculation method where the fuzzy output function comprises a trapezoid. If the trapezoid is composed of three points (0, h), (ℓ2, h), (ℓ 3, 0) and the origin (0, 0), it is divided into a rectangle including the point (ℓ2, h) and the origin (0, 0) and a triangle including the points (ℓ2, h), (ℓ3, 0), and the area S1 and the area center x1 of the rectangle are found by the following expressions: S1 = ℓ2h x1 = ℓ2/2 and the area S2 and the area center x1 of the triangle are found by the following expressions: S2 = 1/2 (ℓ3 - ℓ1)h x2 = 1/3 (2ℓ2 + ℓ3) and the area S of the said trapezoid is obtained by adding the said areas S1 and S2, and the area center x is obtained by weighting the values x1 and x2 by the sizes of the respective areas S1 and S2, respectively, whereby the area center position x and the area S are obtained by the following expressions: x = (ℓ3 2 ℓ2ℓ3 + ℓ2 2 ) 3(ℓ2 + ℓ3) S = 1/2h(ℓ2 + ℓ3) Since the fuzzy output function Bi comprises a trapezoid in the example shown in Fig. 5c, the expressions (7) and (8) are used, and h = A1 ℓ2 = P1 (SPB12) ℓ3 = P1 (SPB13) are used in expressions (7) and (8) to find the area and its center position. Since the fuzzy output function B2 comprises a triangle as shown in Fig. 4c, expressions (5) and (6) are used, and h = A2 ℓ1 = P1 (SPB21) ℓ2 = P1 (SPB22) ℓ3 = P1 (SPB23) are used in expressions (5) and (6) to find the area and the center position. Then, a composite value of the moments, wherein the center positions found above are coordinate values and the area values are their relative magnitudes, is found according to Fig. 9, i.e. , if the original areas and center positions are (Si, l1), (S2, l2), respectively, the composite center x and the composite area S are obtained by the following expressions: x = S1l1 +S2l2 S1 + S2 S = S1 + S2 In the present example shown in Figs. 5, each center position and area of A1 ○ B1 and A2 ○ B2, as previously calculated, are used in the above expressions to obtain the composite center position and area. In a similar way, Ai ○ Bi (i = 3 to n) is used to find the composite center position of plural areas greater than 2, if there are more Ai and Bi than Al, A2, B1, B2. Since the composite center position is a % output with respect to the horizontal axis, it is converted into an analog value in an ordinary way and output as the output y. Namely, the µ-P 62 outputs the D/A output value, i.e. , the composite center position (the defuzzed value of the composite fuzzy set), to the D/A port 62a, holds the output at that one of the sample holders 64 made active by the output of the DEC 68, converts the same to low impedance by means of the corresponding amplifier 63, and outputs it to the corresponding analog signal output terminal 61 as an analog signal. As described above, since the input conversion operation (using the fuzzy input membership functions), the fuzzy inference operation (using the main PC-CPU), and the calculation and processing of the area centers of the fuzzy result functions all proceed independently of and in parallel to each other, throughput is increased, speed is not compromised, and the addition of fuzzy inference processing to a sequence control operation allows the same CPU to cyclically carry out fuzzy control as a general PC control function. Moreover, by utilizing spare time made available by the concurrent processing of the fuzzy and defuzzy conversion operations as described above, fuzzy and defuzzy conversions can be performed by way of a numerical operation based on a coordinate based format using three coordinate values or so, instead of a look-up table system. Further, the integration of fuzzy control and sequence control in one PC allows more complex overall control. The peripheral device 90 in fig. 1 is capable of creating an application program including fuzzy operation processing instructions in addition to the usual sequence instructions of the prior art, and writes (or modifies) the same to the application memory 42 via the line controller 45 and the PC-CPU 41 in the controller unit 40, and also creates (or modifies) the membership functions and the fuzzy output functions in the three-point definition format and writes the same to the two-port RAMs 57, 67 of the A/D converter module 50 and the D/A converter module 60, respectively. Further, the peripheral device 90, reversely, is capable of reading the data stored in the application memory 42 and the two-port RAMs 56, 67, and the execution results of the PC-CPU 41 and the µ-Ps 52, 62; e.g. , the sets of three points defining the membership functions, the fuzzy output functions and the fuzzy result functions, the first and second fuzzy grade numbers, and the defuzzy value of the composite fuzzy set, and indicating the same on the display. At such time, the functions are reproduced as graphic figures. Namely, the peripheral device 90 functions as a fuzzy monitoring device. This function is easily achieved by adding a fuzzy control monitoring program to the peripheral device 90 and executing the same on the CPU (not illustrated) of the peripheral device 90. Fig. 10 is a block diagram illustrating a circuit wherein one peripheral 90 provided as a fuzzy control monitoring device is equipped with a network connection unit 91 and connected with a plurality of CPUs 40A via a network 92. Referring to Fig. 10, one peripheral device 90 reproduces the fuzzy control status of any of the plurality of PCs on the display. In the present invention, the fuzzy inference operation, which is executed between fuzzy grade numbers set in various registers using an added fuzzy inference instruction as a sequence instruction executed by the PC-CPU 41, is not limited to the minimum value operation (fuzzy AND) exemplified above. In addition to this, a maximum value operation (fuzzy OR) may be performed, as well as binary operations such as an m × n matrix operation, a maximum value/minimum value operation combination, etc. , all of which may be represented and given an execution format in a sequence program. The implication operation "A ○ B" is performed by the D/A converter 60 in the above embodiment. That is, the three coordinate value sets defining the fuzzy output functions B are stored in the memory (the two-port RAM 67) of the D/A converter 60 and the said implication operation "A ○ B" is executed by the D/A converter's µ-P 62. The implication operation, however, could be performed by the CPU 40 as are others of the fuzzy operations, in which case the fuzzy output functions B would be stored in the memory 42. Moreover, a compound A/D module, wherein the A/D and D/A converters are operated by one microprocessor, may be used instead of the A/D converter module 50 and the D/A converter module 60 configured independently in the above described embodiment, to produce the same effect as independent converters. Further, the functions needed to implement the fuzzy operation may be extracted and carried out by an additional second CPU or by separately provided dedicated unit, instead of using the existing PC-CPU 41 as in the present embodiment. The definition format of the membership functions as described above may be retained while all control functions are concentrated in the single PC-CPU. In this case, the high speed achieved by the pipeline (parallel) system is sacrificed but there is still the advantage that a large memory, as needed for a table-type look-up system, is not required in fuzzy or defuzzy conversion. Naturally, more than three points may be employed for the definition of the membership functions, fuzzy output functions, etc. Switching from one fuzzy inference rule or rule set to another may be achieved easily by controlling logical contacts M10 110 and M11 111, etc., as shown in Fig. 6. The logical contacts can be configured as physical contracts (relay coils, etc.) if desired.

Claims: A programmable controller having a fuzzy control function comprising an A/D converter (50) for converting input analog data into digital data, a CPU (41) for executing sequence instructions using said digital data and producing digital result data, and a D/A converter (60) for converting the digital result data into analog data and outputting the result, wherein the A/D converter (50) further comprises a fuzzy membership function storing means (57a) for storing fuzzy membership functions (aij) and a fuzzy grade number determining means (55b) for calculating first fuzzy grade numbers (Aij) from the digital data using the fuzzy membership functions, wherein the CPU (41) comprises fuzzy operation processing instruction executing means (43b) for receiving the first fuzzy grade numbers (Aij) and executing fuzzy operation instructions as sequence instructions, thereby calculating second fuzzy grade numbers (Ai), wherein the D/A converter (60) further comprises a fuzzy output function storing means (67) for storing fuzzy output functions (Bi), fuzzy result function generating means (62) for calculating fuzzy sets from the fuzzy output functions (Bi) and the second fuzzy grade numbers (Ai) and for outputting the result as fuzzy result functions (Ci), wherein the D/A converter (60) includes defuzzing means (65b) for taking a composite of a plurality of the fuzzy result functions (Ci) and for defuzzing the resulting composite fuzzv set. and wherein the fuzzy membership functions (aij), the fuzzy output functions (Bi) and the fuzzy result functions (Ci) are defined in a format composed of a plurality of points. A programmable controller as claimed in Claim 1, wherein the CPU (41) includes means for setting fuzzy rules in an application program and fuzzy rule selecting means for selecting among fuzzy rules to be executed by means of operation of one or more logical contacts (M10, M11) in the application program. A programmable controller as claimed in Claim 1 or 2, further comprising a first CPU section (43b) for executing fuzzy operation instructions and a second CPU section (43a) for executing sequence instructions other than fuzzy operation instructions. A programmable controller as claimed in any one of Claims 1 to 3, wherein the defuzzing means (65b) of the D/A converter (60) obtains the composite fuzzy set by forming a composite of moments of the fuzzy result function as a weighting factor (S) and a center (x) of each area as a coordinate value, prior to the defuzzing of the composite fuzzy set. A programmable controller as claimed in any one of the Claims 1 to 4, further comprising peripheral device (90) adapted for setting the membership functions (aij) in the A/D converter (50) and the fuzzy output functions (Bi) in D/A converter (60) and adapted to monitor the fuzzy control process by reading out the membership functions (aij) and the first fuzzy grade members (Aij) from the A/D converter (50), the second fuzzy grade numbers (Ai) from the CPU (42) and the fuzzy output functions (Bi), the fuzzy result functions (Ci) and the defuzzy value (y) of the composite fuzzy set from the D/A converter (60). A fuzzy control process carried out by a programmable controller comprising the steps of: a) converting input analog data into digital data and converting the digital data into first fuzzy grade numbers (Aij) by use of membership functions (aij) defined in a format of a plurality of points, said converting carried out in an A/D converter (50); b) transferring the first fuzzy grade numbers (Aij) to a CPU unit (42) and executing fuzzy operation instructions on said first fuzzy grade numbers, thereby obtaining second fuzzy grade numbers (Ai); c) transferring said second fuzzy grade numbers (Ai) to a D/A converter (60), said D/A converter having storing means (67) for storing fuzzy output functions (Bi) in the format of a plurality of points; d) operating on the fuzzy output functions (Bi) using said second fuzzy grade numbers (Ai) to obtain fuzzy result functions (Ci) in said D/A converter (60); e) forming a composite of a plurality of fuzzy result functions (Ci) and defuzzing the resulting composite fuzzy set in said D/A converter; and f) converting the digital defuzzing value of the composite set into analog data and outputting same. 7. The fuzzy control process of Claim 6, further comprising fuzzy monitoring by means of a peripheral device (90) through the alternative steps of: setting the membership functions (aij) in the A/D converter (50) and the fuzzy output functions (Bi) in the D/A converter (60); reading out the membership functions (aij) and the first fuzzy grade members (Aij) from the A/D converter (50); reading out the second fuzzy grade numbers (Ai) from the CPU (42); reading out the fuzzy output functions (Bi), the fuzzy result functions (Ci) and the defuzzy value (y) of the composite fuzzy set.

Inventors: NAKANO NOBUMASA, NAKANO, NOBUMASA, NAKANO, NOBUMASA, C/O MITSUBISHI DENKI K. K.
Applicants: MITSUBISHI ELECTRIC CORP, MITSUBISHI DENKI KABUSHIKI KAISHA
Application year: 1990
Main classification: G05B19
IPC codes: G05B19, G06N7, G05B13, G06F9, G06F1