In the field of automatic control, great progress has been made in the research of fuzzy control theory and its application. The NLX230 single-chip fuzzy controller launched by American neurlogix company is a programmable super large-scale integrated fuzzy logic microprocessor FMC (fuzzy micro controller), which performs fuzzy logic operation on the input conditions according to the fuzzy logic principle to obtain the optimal action, By executing parallel operation control output, its processing speed is up to 30m rules / s. It has interface circuit with computer, interface circuit with external EEPROM and crystal oscillator. It can be widely used in process embedded control, pattern matching, artificial intelligence, robot and expert system.
2. Design features and working principle of NLX230
The application principle of fuzzy logic in the control field is to use fuzzy logic devices to construct arbitrary complex linear and nonlinear functions through “items” and “rules”, and then through fuzzy reasoning according to the input state, find the best output action value and apply it to the control process, so as to make fuzzy logic obtain the ability similar to human expert likelihood reasoning.
NLX230 calculates the optimized output operation with fuzzy logic rules based on conditions. The input values are sorted according to the appropriate degree in the user-defined membership function. In order to implement effective digitization, a linear symmetric membership function or the simplest maximum / minimum fuzzy reference method is adopted. The rules determine the required state set during input. Each rule contains at most 16 items, and each item is paired with a “clear” input / fuzzy membership function. 1 current value is the modification of the total output value of the user under a rule. For all inputs and outputs, input sorting and rule processing are parallel. The monolithic 24 bit wide rule memory can store up to 64 rules, which can be shared by all inputs. As required, each output can be programmed to use up to 64 rules. The number of rules used in any output is the remaining number of rules used by other rules. The efficient digital implementation of fuzzy logic principle enables NLX230 to obtain high processing speed (30M rules / s) at low price.
2.1 similarity judgment principle of distance measurement
NLX230 monolithic fuzzy integrated controller uses fuzzy logic elements to combine the input with the membership function to determine the distance between the input and the center value of the selected membership function, and makes similar decisions through distance measurement. Because the shape of the optimal membership function is related to the sensor characteristics, control response and other dynamic characteristics of the system, it is often difficult to determine the shape of the optimal membership function (of course, it can be determined according to experience in some cases). A new method is adopted in the design of NLX230 single-chip fuzzy controller, which does not depend on the shape of the membership function and the intersection of the exact value input and the membership function, and measures and calculates the distance between the input and the center point of the selected membership function. Its principle is shown in Figure 1. The distance between the output and the middle position is measured without considering the interval of the membership function and the monotonicity of the input. The distance subtracts the input from the center position and ignores the symbol. The farther the exact value input XA is from the center point, the lower its membership value is; on the contrary, the higher its membership value is. When the exact value input XA is just at the center point, the membership value is the largest.
There are two different types of membership functions. For the first membership function, the closer the exact value input is to the center point, the greater the membership value. If the exact value input falls outside the width range of the membership function, the membership value is the smallest. For the second membership function, when the exact value input falls within the width range of the membership function, the membership value is the smallest. Distance measurement has two advantages: one is that the designer does not have to determine the shape of complex membership function while retaining important information; The second is that this method provides a simple way of similar judgment.
2.2 conversion from definite value input to fuzzy logic quantity
The conversion from definite value input to fuzzy logic quantity is realized by similar decision fuzzy logic unit measuring distance. The circuit structure of obtaining membership value in similar decision fuzzy logic unit is shown in Fig. 2. The center point value and exact value of the selected membership function in the fuzzy logic unit are input and sent to the subtractor to calculate the travel value AC. the difference is compared with the width value of the membership function. Only when the difference is within the width range, the membership value calculator outputs the result (the result is equal to subtracting the difference AC from the allowable maximum membership value, as shown in Figure 1). Otherwise, The membership calculator output will be set to zero or minimum. The membership value is actually a fuzzy logic quantity μ（ Or D).
3. Internal structure and pin function of NLX230
The internal structure of NLX230 fuzzy controller is shown in Figure 3. It is composed of fuzzy input selector, 16 fuzzy units, minimum and maximum comparators, rule register, output register and timing control to complete fuzzy reasoning operation and make control decision.
3.1 fuzzy input selector and fuzzy unit
The 8-out-of-1 multiplexer controls the input of each of the 16 fuzzy units in n lx230. The fuzzy unit obtains the membership degree of the input to the membership function defined by the user. Each fuzzy unit selects one of the eight external inputs as the input data (one fuzzy unit can only access one input data). The fuzzy unit is configured to form the form of output feedback to input, which can not deal with external input. One input is associated with one membership function to form one item. NLX230 can support up to 16 items. The structure of each fuzzy unit is shown in Figure 2. It contains a 16 bit item register, including 8-bit center value, 5-bit width value and 3-bit input selection configuration (to complete the selection of any one of the 8 external inputs). Each fuzzy unit calculates the distance between the input value and the user-defined center point, and completes the conversion from the input exact value to the fuzzy logic value. In this way, each fuzzy unit is associated with an 8-bit central position. After calculating the distance, the result is compared with the user-defined width. The 5-bit width value represents the farthest distance from the input to the central position. If the input distance is less than or equal to this width, the input is considered to be a part of the membership function, and the membership function degree is obtained by supplementing the distance. The complement is 30 minus the distance (30 is the maximum width). The closer the input is to the center, the higher the membership value. The membership value falling within the width is transmitted to the minimum comparator for rule processing.
When the input is equal to the center value, the fuzzy unit outputs the maximum value 31; When the input falls outside the width range, the fuzzy output value is 0, indicating that it doesn’t matter at all.
3.2 minimum comparator and maximum comparator
The NLX230 minimum comparator is implemented by a high flux neural network to adapt to high-speed data volume. 64 rules are stored in 64 rule registers. Each rule register word has 24 bits, and the first 16 bits are used to enable the output of each fuzzy unit to the minimum comparator. Each rule bit is fixed and corresponds to one fuzzy unit. When a rule bit is set to 1, the rule contains the item, and the corresponding fuzzy unit output can be compared with other rule bits set to 1 to find the minimum item.
Once the minimum item of a rule is found, it is stored in the temporary register of the NLX230 maximum comparator. The processed minimum item corresponding to each rule is compared with the value temporarily stored in the maximum register to reduce the size and save the size; When all rules are processed, the result in the maximum value register is the maximum value of all minimum items. The rule corresponding to this value is the winning rule, representing the sum of the results of a “fuzzy” logic. The current value (action value) of the winning rule is sent to the conversion unit (output register) of fuzzy value and exact value, and the fuzzy control is carried out after conversion.
The current value is defined in the 8 reserved bits of each rule register word, which represents the correction amount required to output the action value. The action correction value is an 8-bit binary complement value of – 128 ~ 127. The 8-bit action correction value from the rule register word is added to the user-defined initial value. For example, if the initial value is 100 and the action correction value is – 5, the output is 95.
3.3 rule register and output register
The rule register is used to store control rules. NLX230 can store up to 64 rules. The output register is in the bus enable mode. As long as all rules are processed, the sum of the 8-bit complement correction value of the rule register and the initial value is processed, the saturation arithmetic operation makes the output bit take the modulus 128 (the current value makes the output higher or lower than the limits – 128 and 127), the output is changed from the fuzzy value to the true value, and the fuzzy controller outputs the result data while inputting the next set of data.
3.4 pin function of NLX230
NLX230 adopts 40 pin dual in-line package, as shown in Figure 4. RST is the system reset pin, and the low level is effective. DI0 － di7 are 8-bit data input ports. VSS is the ground. SK is a serial clock pin, which is used to input configuration data into FMC (when m / S = 0, this pin outputs). CS is chip selection and enables serial data input / output in combination with M / s and R / w (output when m / S = 1 and input when m / S = 0). Di is the serial data input pin. Do is the serial data output pin. M / S is master / slave mode selection (active mode when m / S = 1); Servo mode when m / S = 0). R / W is the read / write input pin, which is only used in servo mode (r = 1 is read); W = 0 (write). NC is an empty pin and must be grounded. Xi is the input pin of the crystal oscillator. XO is the output pin of crystal oscillator. CLK is the buffered system clock output pin. STB is a gating pin, which is used in conjunction with ma0-ma2 to gate input / output data. Ma2 is the input / output multiplex address 2 output pin. MA1 is the input / output multiplex address bit 1 output pin. Ma0 is the input / output multiplex address bit 0 output pin. Do7 － do0 is the data output pin. VDD is the + 5V power pin.
4. Working mode of NLX230 fuzzy controller
The working modes of NLX230 fuzzy controller include fuzzy unit mode, input mode, output mode and input-output extension application.
4.1 fuzzy unit mode
In the fuzzy unit mode, there are two ways. The typical application is that the output of the fuzzy unit represents the degree that each input is close to the center; Another way is to configure NLX230 without fuzzy unit. By using the working mode without fuzzy unit, the rule items can be weighted by the distance between the input and the central position.
4.2 input mode
The input of NLX230 can be either the signal from 8 time-sharing multiple input pins or the output internal feedback signal. The two input modes are selected through the input configuration register.
4.3 output mode
Each output of NLX230 can be configured as immediate output and cumulative output. In the immediate output mode, the action value specified by the winning rule (which has the largest and smallest item) plus the initial value. For the duty cycle of NLX230, the original initial values are used to calculate the output. The output value of the new action mode is determined by the cumulative value of 1. In this mode, the new input value is retained as the initial value for the calculation of the next output value. The original user-defined initial value is used only when calculating the first output value after reset.
Multiple NLX230 are used in cascade, which can expand the number of input, output, fuzzy units and rules.
An external clock source input from Xi pin can directly drive NLX230. NLX230 also includes an active oscillator circuit for clock generation. CLK provides the required clock output.
5. Operation mode of NLX230
The operation mode of NLX230 is completed by initialization. The reset pin M / s can set two operation modes with different structures: active mode (NLX230 automatically reads data from the external EEPROM) and driven mode (NLX230 waits for the external logic circuit to read and write data).
5.1 active mode
The active mode is to make NLX230 start an automatic unloading cycle when the reset pin changes from “1” to “0” and M / S is “1”. NLX230 addresses 2048 Bit Serial EEPROM through the generation of clock SK, chip selection enable and address (do). NLX230 outputs serial clock (SK) and maintains chip selection (CS), then “read flag” appears, 7-bit address appears at do output pin, NLX230 immediately starts to input 16 bit data at di pin, and the process continues until NLX230 has input 128 data words (16 bits) × 28 = 2048), and then the chip selection fails. The next operation of this configuration cycle is to process the data appearing on the input pin (di0-di7) by NLX230.
5.2 driven (servo) mode
When m / S is “0”, NLX230 is in driven (servo) mode, and SK, CS, R / W and other signals are provided by external control logic. Before the rising edge of SK, keep R / W low and CS high to trigger the unloading process. Then, data is input by Di pin on the rising edge of sk. After all data bits (2048) are written in sequence, CS becomes low level; Before the rising edge of SK, keep the R / W and CS signals high to trigger the loading process. Then, the do pin outputs data on the rising edge of sk. After all data bits (2048) are read out sequentially, CS changes to low level. After a serial unload or load cycle, a reset signal (held low) is required to clear the internal data channel.
6. Application interface
6.1 NLX230 interface function
The NLX230 has 8 time division multiplexed input pins and 8 multiplexed output pins. The feedback path, external crystal oscillator or PC circuit can be obtained by internally connecting the output to the input; 1 clock output for input and output counts; One frame signal for synchronizing the external data input signal; The Serial EEPROM interface consists of data input (DI), chip selection (CS), clock (SK) and read-write (R / W) pins. When NLX230 interfaces with microcomputer, only Di, CS, do, SK and R / W pins are required.
6.2 data interface circuit
NLX230 interface with microprocessor (or single chip microcomputer) only needs 5 pin signals: Di, CS, do, SK and R / W. Figure 5 shows a typical control system data interface. 74373 is used as input / output data latch, and its number is the same as that of input / output. The typical input / output values for the NLX230 control system are 8 bits. The decoding of MUX address pin MA (2:0), strobe pin STB and dynamic input or output channel is provided by NLX230. NLX230 provides all necessary signals, and the time relationship can be displayed by a typical frame timing diagram. The input value is input from di (7:0) and the output is also carried out in do (7:0).
7. Application examples
An application example is the automatic driving control system of toy electric vehicle. According to the input, NLX230 provides decision output, and the speed and direction under different road environments are controlled by control rules. The development system ads230 of NLX230 consists of software and hardware. Its main function is to write the control rules of the application system into the control rule file, convert them into the contents of relevant registers, and write them into the rule register of NLX230.
7.1 label definition
DF: front; Dr: right; DL: left; Ve: speed; Ro: pavement; Di: direction; FT: throttle; Br: brake; Le: left; EI: right; ST: straight; DF － CL: close to the front; DF － FA: keep away from the front; Dr － FA: keep away from the right; DL － FA: keep away from the left; Ve － SL: low speed; Ve － me: medium speed; Ve － FA: high speed; RA － we: slippery road surface; RO － me: moderate pavement; Th － SL: resistance; Th － me: middle gear; Th － FA: high gear; Br － of: no braking; Al-a: prompt to avoid; Al － V: prompt speed; Si － R: right signal; Si － L: left signal; Br － LT: close the throttle; Sp － I: the speed becomes higher; AC: accumulation; Im: immediately; Yes: Yes; No: No; Is: Yes; In: including; Ex: not included; Then: then; And: and; LB: feedback.
The definition of input / output is shown in Table 1. The definition of items is shown in Table 2. 7.2 rule definition
7.2 rule definition
In terms of fuzzy control, compared with single chip microcomputer, NLX230 fuzzy controller has the characteristics of fast reasoning speed, powerful function, flexible application and good control effect. Therefore, it can be widely used in process embedded control, pattern matching, artificial intelligence, robot and expert system.
Responsible editor: GT