# Fuzzy Logic Control Module

## Fuzzy Logic Introduction

Fuzzy logic control is equivalent to have computers reason like humans do, just much faster. Normally when we think of computers making decisions, the output would be true or false. However, fuzzy logic is a way of letting the computer say little, big, bigger, not so big, and so forth, and have an output decided upon from these vague inputs.

Fuzzy logic has some strengths over conventional control algorithms like for example Proportional-Integral-Derivative control. Often biological systems are nonlinear, difficult, or impossible to model mathematically. However, fuzzy logic is empirically-based and model free, thus opens doors for control systems that would normally be deemed unfeasible for automation. Furthermore, fuzzy logic is very robust and does not need precise and noise-free inputs to generate usable outputs. Finally, it can easily be modified and fine tuned during operation.

Essentially, fuzzy logic revolves around a rule base made of simple, plain-language if X is A and Y is B then Z is C rules. The rules describes the response to a number of inputs (X and Y), which could be pO2, pH etc., and A and B are linguistic variables representing the input values. Although words like large negative, small, and hot are imprecise, they are descriptive of what must actually happen. So instead of making ridged control algorithm, a small number of rules offers a much more flexible control without any mathematical model of the system. This is what experts do when they assist in controlling ill-described systems; by reasoning from prior experience and act accordingly to it.

There are several very good tutorials and bibliographies on the Internet, if you are interested in learning more about fuzzy logic:

Fuzzy Logic Toturial

A brief course in Fuzzy Logic and Fuzzy Control

An Introduction to Fuzzy Logic Control Systems

The papers below are concerned with the application of fuzzy logic for bioprocess control:

Application of Fuzzy Reasoning to Control Glucose and Ethanol Concentrations in Baker's Yeast Culture. Park, Y.S., Shi, Z.P., Shiba, S., Chantal, C., Iijima, S., and Kobayashi, T. (1993) Appl. Microbiol. Biotechnol. 38, 649-655.

Application of Artificial Neural Network and Fuzzy Control for Fed-Batch Cultivation of Recombinant Saccharomyces cerevisiae. Jin, S., Ye, K., Shimizu, k., and Nikawa, J. (1996) J. Ferment. Bioeng., 81, 412-421.

## How to Setup the Fuzzy Logic Control Module

So what to do to get the fuzzy logic controller running ? First of all you have to decide upon which parameters can be used for control. For the BioStat fermentor there is little to decide however, since the only thing you have control over is addition of substrate. The other parameters are in the hands of the hardware PID control, which does a good job of it. And you can use pO2, dpO2, and substrate setpoint as input for the controller.

Figure A Fuzzy Logic Rule Matrix

Thus, to setup the fuzzy logic control, a rule database made of if X is A and Y is B then Z is C rules is needed (A: pO2, B: dpO2 or substrate setpoint, C: substrate setpoint output). To gather and organise knowledge about the relationship between these inputs and corresponding output linguistic values, a rule matrix is usually used. By filling in control words like: Positive Large (PL), Negative Medium (NM), and Zero(ZE) the controller knows what to do when a rule is applicable.

A rule matrix is organised as follows:

If X is A and Y is B then Z is C

 Y X B A Z(C)

 Substrate Feed Rate Very Low Low Ok High Very High Very Low NS NM NM NL NL pO2 Low NS NS NS NM NM Ok PM PS PS NS NS High PM PM PS NS NM Very High PL PL PM NM NL

Very Low (VL), Low (L), Ok, High (H), Very High (VH) and Negative Large (NL), Negative Medium (NM), Zero (ZE), Positive Small (PS), Positive Medium (PM), Positive Large (PL).

RULE 1:

If pO2 is Very Low and Substrate Feed Rate is Very Low then Substrate Feed Rate is Negative Small.

Or in short: If pO2 is VL and Substrate is VL then Substrate Feed Rate is NS.

RULE 2:

If pO2 is High and Substrate Feed Rate is Very High then Substrate Feed Rate is Negative Medium.

Or in short: If pO2 is H and Substrate is VH then Substrate Feed Rate is NM.

As you can see it is easy to use the matrix to make the RuleSub.FUZ file for the controller program. The above matrix will yield 25 rules. Likewise, a rule matrix can be made for pO2 med dpO2. Note that not all rules have to be filled in the RuleSub.FUZ and RuledpO2.Fuz files.

The output from the controller is eventually a change in the Substrate Feed Rate set point (see Figure A), and the speficic value is determined by the information found in the dSub.MF file. Adjusting the values in this controller files will normally not be necessary.

A graphical representation of how the fuzzy logic module reasons is shown below. Two sample runs are found below. As seen from the graph, the control lowers and raises the substrate feed rate as oxygen and the change in oxygen becomes critical. Fuzzy Module at Work Graph. An output log file from the fuzzy logic control module can be found here: Fuzzy Log: The fuzzy logic control module uses a set of parameter files by which the controller evaluate rules and decides what output it should apply to the fermentation process. Two of these (RuleSub.FUZ and RuledpO2.FUZ) contain the logic derived from the rulematrix above, the rest are setting the ranges for the input to the controller. Files marked with an asterisk (*) are the most likely files to need editing to fit your application. To avoid editing these, have a look at this page to find controller files that fit your expression system.

Sub.MF: Member Function, converts substrate setpoint to fuzzy value.

SoftSub.MF: Member Function, converts predicted substrate concentration to fuzzy value.

pO2.MF: Member Function, converts pO2 setpoint to fuzzy value.

dpO2.MF: Member Function, converts change in pO2 to fuzzy value.

dSub.MF: Member Function, converts fuzzy value to substrate setpoint.*

RuleSub.FUZ: Rules for pO2 and Sub substrate control.*

RuledpO2.FUZ: Rules for pO2 and dpO2 substrate control.*

RuledSoftSub.FUZ: Rules for [Sub] and Sub substrate control.*

The file layout is tabulated and every line starting with an asterisk is ignored. More information about values and file layout is given in the legend of the above files (see manual Appendix).