Fuzzy Logic Controller in Simulink
Integrate a fuzzy logic controller into a Simulink® model.
This video shows how to integrate a fuzzy logic controller into a Simulink model. In this particular model, you want to control water level in the tank modeled is the subsystem. The tank has one pipe for water inflow and another one for water outflow. It can adjust valve controlling the inflow. But the outflow rate depends on the diameter of the outflow pipe, which is constant, and the pressure hardens a tank, which worries is the water level.
Clearly, the system has some very non-linear characteristics. To add the fuzzy logic controller to this module, we open the Simulink library browser. And in the fuzzy logic tool box library, select Fuzzy Logic Controller in this rule viewer block. We add this block into our model and connect it to the rest of the model.
As you can see, the final logic controller has two inputs. The first one is water level error, which is the difference between the set point and measured water level. And the second input is change of rate of the water level. The output of the controller is a calculated valve position for controlling the tank inflow rate.
We open the block dialog and specify the name of the fuzzy inference system. In our case, this is a variable called tank. Let me show you where it is coming from. For this, we go to MATLAB. And here, you see this variable tank in MATLAB workspace. This variable contains the FIS systems that we have designed previously and we want to implement in Simulink.
You can open fuzzy inference system editor and see that our FIS system tank has two inputs and one output, as expected. It can also see the rules that the FIS system implements. In this case, there are five of them. These rules connect two input variables with an output variable.
Now, let's go back to our Simulink model. This subsystem here creates a repeating sequence of steps that point changes to test our controller performance. Let's start the simulation. On the right, we see the animation showing us that we are tracking the set point well. The set point value is shown by this red line.
You can also see that we are tracking well in this plot on the left. Again, the red line is the set point value. And the blue line is actual water level. The bottom part of the plot shows the valve position controller commands. Another windows that opens up when we run the simulation is a rule viewer. It provides a graphical view of the state of fuzzy logic controller.
Each row of plots corresponds to one rule, so five rows for five rules. The first two columns of plots correspond to controller inputs. And the last column corresponds to controller output. The final output of the system, valve position, is depicted by the thick red line and is determined by the centroid rule.
We can now look at how is the level of the water in the tank changes with differing inputs to the fuzzy logic controller. If you pause or stop the simulation, we can interactively change the input values to see how the output is calculated according to the rules that we have.
We can also look at the features we can access from the rule viewer. From the View tab, we can bring up the surface formed by the rules of our controller. We can also access the three fuzzy logic tool box editors, FIS properties editor, membership function editor, and the rules editor. This concludes the demo.
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.