Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

About fuzzy logic using the Maxwell's pendulum

License

NotificationsYou must be signed in to change notification settings

Kristal1ik/FuzzyContApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pendulum

AndroidJavaArduinoPython

Learn fuzzy logic with the example of the Maxwell's pendulum!

About

The need forfuzzy logic arises in many areas, includingartificial intelligence,control anddecision-making. Fuzziness is an integral part of the real world, so fuzzy logic is actively used to developintelligent systems capable of processing and analyzing fuzzy information. The main problem of this topic is itsinaccessibility. The fact is that the theory of fuzzy sets is studied at the senior courses of universities, and the materials presented in the public domain include terms, formulas and designations that are incomprehensible toschoolchildren. This project is aimed atpopularizing fuzzy logic by writing an application forAndroid OS, as well as developing a real prototype of theMaxwell pendulum (the task is to keep the pendulum within the specified boundaries) to demonstrate the operation of a controller running on fuzzy rules.Next, the functionality that allows the user to study the proposed topic will be described.

Pendulum

Documentation

"Fuzzy logic is the art of finding beauty in uncertainty" — Lotfi A. Zadeh

Rule base

To solve this problem, the theory of fuzzy sets is used, since it avoids a large number of calculations in fuzzy modeling problems.Therule base consists of several fuzzy rules in which each gasified value of the pendulumposition andvelocity corresponds to a fuzzy number. The rule base may look like this:

$$RULE_1: ;IF; «X_1» ;AND; «V_1» ;THEN; «Conclusion_1» ;(F1)$$

$$RULE_2: ;IF; «X_2» ;AND; «V_2» ;THEN; «Conclusion_2» ;(F2)$$

Graphical representation of the rule base

The figure shows the notation:
  • x is the position of the pendulum;

  • v is the speed of the pendulum;

  • w – conclusion.

In the author 's code , the rule looks like this:

x1=Trapezoid([0.09,0.14,0.156,0.175,1]).trapezoid();v1=Trapezoid([0.280,0.351,0.466,0.616,1]).trapezoid();w1=Trapezoid([6.00,9.550,13.550,16.350,1]).trapezoid().

In the example above, there is aTrapezoid class that has atrapezoid() method that fuzzifies a number.

Accessory function(μ)

Fuzzification is the process of translating input data into fuzzy data by finding thedegree of belonging of a measurement to a fuzzy set. As input data, we get theposition of the model (x) and thevelocity (v). The trapezoidal membership function is given by four numbers and calculated according to the expression:

$$\mu=\begin{equation*}\begin{cases}1-\frac{b-x}{b-a}, a\le x\le b\\1, b\le x\le c\\1-\frac{x-c}{d-c}, c\le x\le d\\0, else.\end{cases}\end{equation*}$$

Optimization

Oprimization algorithmDescription
basin hoppingA global optimization method used to solve optimization problems that have a complex energy surface.
genetic algorithmAn optimization method that uses ideas from evolutionary biology and genetics to solve problems.
particle swarm algorithmAn optimization method that simulates the behavior of a flock of particles in space to find optimal solutions in multidimensional problems.

Behavior of the mathematical model

This function gets theposition,speed andacceleration from a given time, returnsnew values by certain transformations.

deff(x,v,w):a= (m*r*r* (g-w))/ (0.5* (m*R*R+maxis*r*r)+ (m+maxis)*r*r)if (x==Randv<0)or (x==landv>0):v=-v* (1-k)xnew=x+v*dt+0.5*dt**2*avnew=v+a*dtifxnew>l:xnew=lifxnew<R:xnew=Rreturnxnew,vnew

The full version of the documentation you can findhere.

Functionality

  • acc2 Сontrol of the pendulum using the built-in accelerometer with the ability to change the parameters of the model.
  • optim Drawing up your rule base using the presented global optimization algorithms in the application (all has a description).
  • pend Control of the physical model of the Maxwell pendulum.
  • pend_rules The imposition of rules on the mathematical model of the Maxwell pendulum.
  • More information about the functionality and work of the physical model you can findhere.

Screenshots

pendpendpendpend

Stack

Developer

License

Project FuzzyContApp is distributed under the MIT license.


[8]ページ先頭

©2009-2025 Movatter.jp