Skip to content

Commit bad08fa

Browse files
committed
boxed stuff
1 parent 1edc8fc commit bad08fa

14 files changed

+10533
-0
lines changed
601 KB
Binary file not shown.

.box/fuzzylogic_model.mdj

+9,179
Large diffs are not rendered by default.
+296
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,296 @@
1+
core - da wo 1 ist
2+
boundaries - überall wo nicht 1 und nicht 0
3+
support - überall wo nicht 0
4+
5+
schreibweise für fuzzy sets:
6+
A = µ1 / u1 + µ2 / u2 + µ3 / u3
7+
oben stehen die membership values, unten die werte; + ist funktions-theoretische vereinigung
8+
9+
vereinigung von zwei konvexen megen -> konvexe menge
10+
"normal fuzzy set" := fuzzy set mit mindestens einem element mit µ = 1
11+
bei fuzzy sets mit exakt einem element mit µ = 1 heißt dieses element "prototype"
12+
13+
eine funktion die von einer menge A auf eine menge B abbildet:
14+
f(A) = f(µ1/ u1 + µ2 / u2 + µ3 + u3) = µ1 / f(u1) + µ2 / f(u2) + µ3 / f(u3)
15+
(erweiterungsprinzip nach zadeh & yager)
16+
17+
wenn man zwei universen auf eines abbilden will funktioniert das kartesisch:
18+
U1 x U2 -> V
19+
hier ist A ein fuzzy set das über den universen U1 und U2 definiert ist:
20+
f(A) = {min(µ1(i), µ1(j) / f(i,j) \ i element of U1, j element of U2}
21+
where (µ1(i) and (µ2(j) are the separable membership projections of µ(ij) from the
22+
Cartesian space Ui x U2 when ji(i j) can not be determined.
23+
- dazu gilt analog zur wahrscheinlichkeitstheorie die bedingung der
24+
"non-interaktion" ("unabhängigkeit" in der wahrscheinlichkeitstheorie)
25+
in FL wird min() statt prod() verwendet
26+
27+
beispiel:
28+
U1 = U2 = {1,2,..9,10}
29+
A(auf U1) = 0.6/1 + 1/2 + 0.8/3
30+
B(auf U2) = 0.8/5 + 1/6 + 0.7/7
31+
V = {5,6,..,18,12}
32+
A x B = (0.6/1 + 1/2 + 0.8/3)x (0.8/5 + 1/6 + 0.7/7)
33+
= min(0.6,0.8)/5 + min(0.6,1)/6 + ... + min(0.8,1)/18 + min(0.8, 0.7)/21
34+
= 0.6/5 + 0.6/6 + 0.6/7 + 0.8/10 + 1/12 + 0.7/14 + 0.8/15 + 0.8/18 + 0.7/21
35+
36+
falls es zwei oder mehr wege gibt eine zahl zu produzieren wird zuerst
37+
min() und dann max() angewandt:
38+
a = 0.2/1 + 1/2 + 0.7/4
39+
b = 0.5/1 + 1/2
40+
41+
a*b = min(0.2,0.5)/1 + max(min(0.2,1)), min(0.5, 1))/2 + max(min(0.7,0.5, min(1,1))/4, min(0.7,1)/8
42+
= 0.2/1 + 0.5/2 + 1/4 + 0.7/8
43+
44+
v = binary OR, u (rundes v) = set UNION
45+
/\ = binary AND, rundes /\ = set INTERSECTION
46+
47+
union (OR): max..
48+
intersection (AND): min..
49+
complement: 1- ..
50+
containment: R contains S <=> µR(x,y) <= µS(x,y)
51+
identity: {} -> 0 and X -> E
52+
53+
composition (abbildung X -> Y -> Z ~ X -> Z) ~ "defuzzifizierung":
54+
max-min:
55+
T = R o S
56+
*das OR und AND stimmen so - obwohl es max-min heißt*
57+
µT(x,z) = OR(µR(x,y) AND µS(y,z) for y element of Y)
58+
59+
max-prod (manchmal auch max-dot):
60+
T = R o S
61+
µT(x,z) = OR(µR(x,y) * µS(y,z) for y element of Y)
62+
63+
beispiel:
64+
(R= x zeilen, y spalten)
65+
R = [
66+
[1,0,1,0],
67+
[0,0,0,1],
68+
[0,0,0,0],
69+
]
70+
(S = y zeilen, z spalten)
71+
S = [
72+
[0,1],
73+
[0,0],
74+
[0,1],
75+
[0,0],
76+
]
77+
78+
T = [
79+
[0,1],
80+
[0,0],
81+
[0,0],
82+
]
83+
84+
dazu muss lediglich multiplikation als min (AND) und
85+
addition als max (OR) implementiert werden -
86+
alles andere ist pure matrizenmultiplikation!
87+
88+
[0,1] heißt auch "einheitsinterval" oder "unit interval"
89+
90+
implication:
91+
P -> Q => x is A then x is B
92+
T(P -> Q) = T(-P) or Q) = max(T(~P), T(Q))
93+
P -> Q is: IF x is A THEN y is B
94+
95+
IF x is A THEN y is B ELSE y is C:
96+
R = (A x B) OR (~A x C)
97+
98+
99+
100+
u(t) = Kp . e(t)
101+
for a proportional or P controller;
102+
u(t) = Kp . e(t) + KI . integral(e(t))dt
103+
for a proportional plus integral or PI controller;
104+
u(t) = Kp. e(t) + KD. e'(t)
105+
for a proportional plus derivative or PD controller;
106+
u(t) = Kp . e(t) + KI . integral(e(t))dt + KD. e'(t)
107+
or a proportional plus derivative plus integral or PID controller,
108+
109+
where e(t), e'(t), and integral(e(t))dt are the output error, error derivative, and error integral, respectively;
110+
111+
The problem of control system design is defined as obtaining the generally
112+
nonlinear function h(.) in the case of nonlinear systems, coefficients Kp, KI, and KD in
113+
the case of an output-feedback, and coefficients ki, k2,..., and kn, in the case of state-
114+
feedback policies for linear system models.
115+
116+
i) Large scale systems are decentralized and decomposed into a collection
117+
of decoupled sub-systems.
118+
ii) The temporal variations of plant dynamics are assumed to be "slowly
119+
varying."
120+
iii) The nonlinear plant dynamics are locally linearized about a set of
121+
operating points.
122+
iv) A set of state variables, control variables, or output features are made
123+
available.
124+
v) A simple P, PD, PID (output feedback), or state-feedback controller is
125+
designed for each de coupled system. The controllers are of regulatory
126+
type and are fast enough to perform satisfactorily under tracking control
127+
situations. Optimal controllers can also be tried using LQR or LQG
128+
techniques.
129+
vi) The first five steps mentioned above introduce uncertainties. There are
130+
also uncertainties due to external environment. The controller design
131+
should be made as close as possible to the optimal one based on the
132+
control engineer's all best available knowledge, in the form of I/O
133+
numerical observations data, analytic, linguistic, intuitive, and etc.,
134+
information regarding the plant dynamics and external world.
135+
vii) A supervisory control system, either automatic or a human expert
136+
operator, forms an additional feedback control loop to tune and adjust
137+
the controller's parameters in order to compensate the effects of
138+
uncertainties and variations due to unmodeled dynamics.
139+
140+
141+
Six basic assumptions are commonly made whenever a fuzzy logic-based control policy
142+
is selected. These assumptions are outlined below:
143+
i) The plant is observable and controllable: State, input, and output
144+
variables are available for observation and measurement or
145+
computation.
146+
ii) There exists a body of knowledge in the form of expert production
147+
linguistic rules, engineering common sense, intuition, or an analytic
148+
model that can be fuzzifled and the rules be extracted.
149+
iii) A solution exists.
150+
vi) The control engineer is looking for a good enough solution and not
151+
necessarily the optimum one.
152+
v) We desire to design a controller to the best of our available knowledge
153+
and within an acceptable precision range.
154+
vi) The problems of stability and optimality are open problems.
155+
156+
A fuzzy production rule system consists of four structures:
157+
i) A set of rules which represents the policies and heuristic strategies of
158+
the expert decision-maker.
159+
ii) A set of input data assessed immediately prior to the actual decision.
160+
iii) A method for evaluating any proposed action in terms of its conformity
161+
to the expressed rules, given the available data,
162+
iv) A method for generating promising actions and for determining when to
163+
stop searching for better ones.
164+
165+
A fuzzy production rule system consists of four structures:
166+
i) A set of rules which represents the policies and heuristic strategies of
167+
the expert decision-maker.
168+
ii) A set of input data assessed immediately prior to the actual decision.
169+
iii) A method for evaluating any proposed action in terms of its conformity
170+
to the expressed rules, given the available data,
171+
iv) A method for generating promising actions and for determining when to
172+
stop searching for better ones.
173+
174+
In general, a value of a linguistic variable is a composite term which is a concatenation of
175+
atomic terms. These atomic terms may be divided into four categories:
176+
i) primary terms which are labels of specified fuzzy subsets of the
177+
universe of discourse (e.g., hot, cold, hard, lower, etc., in the preceding
178+
example).
179+
ii) The negation NOT and connectives "AND" and "OR."
180+
iii) Hedges, such as "very," "much," "slightly," "more or less," etc.
181+
iv) Markers, such as parentheses.
182+
183+
IF A THEN B entspricht:
184+
# Zadeh's implication oder classic implication
185+
# falls µB(y) < µA(x) wird (44) zu (45) reduziert
186+
(44) µ(x,y) = max(min(µA(x), µB(y)), 1- µA(x))
187+
(45) µ(x,y) = max((µB(y), (1 - µA(x)))
188+
189+
# correlation-minimum oder Mamdani's implication
190+
# wird auch für das fuzzy-kreuzprodukt verwendet
191+
# falls µA(x) >=0.5 und µB(y) >=0.5
192+
# wird Zadeh's implication zu Mamdani's implication reduziert
193+
(46) µ(x,y) = min(µA(x), µB(y))
194+
195+
# Luckawics implication
196+
(47) µ(x,y) = min(1, (1 - µA(x) + µB(y)))
197+
198+
# bounded sum implication
199+
(48) µ(x,y) = min(1, (µA(x) + µB(y)))
200+
201+
(49) µ(x,y) = min(1, [µB(y) / µA(x)])
202+
203+
# eine form des correlation-product (hebbian networks: conditioning)
204+
# vom Author bevorzugt
205+
(50) µ(x,y) = max(µA(x) * µB(y), (1 - µA(x)))
206+
207+
# eine form des correlation-product (hebbian networks: reinforcement)
208+
(51) µ(x,y) = µA(x) * µB(y)
209+
210+
(52) µ(x,y) = (µB(y))**µA(x)
211+
212+
# Gödel's implication oder "alpha" implication
213+
(53) µ(x,y) = {µB(y) for µB(y) < µA(x); 1 otherwise}
214+
215+
Methods for composition of fuzzy relations:
216+
I. Max-Min composition
217+
yk = x • Rk
218+
µ(y) = max(min(µ(x), µR(x, y) for x in X)
219+
220+
II. Max-Prod composition
221+
yk = x * Rk
222+
µ(y) = max(µ(x) • µ(x, y) for x in X)
223+
224+
III. Min-Max composition
225+
yk = x † Rk
226+
µ(y) = min(max(µ(x), µ(x,y) for x in X))
227+
228+
IV. Max-Max composition
229+
yk = x o Rk
230+
µ(y) = max(max(µ(x), µ(x,y)) for x in X)
231+
232+
V. Min-Min composition
233+
µk = x ¤ Rk
234+
µ(y) = min(min(µ(x), µ(x, y) for x in X))
235+
236+
VI. (p, q) composition
237+
µk = x ºpq Rk
238+
µ(y) = max_p(min_q(µ(x), µ(x,y)))
239+
where max_p a(x) = inf.(x) for x in X
240+
{1, [[a(x1)]**p + [a[(x2)**p + ... + a(xn)**p)*1/p}
241+
and
242+
min_q [a(x), b(x)] = 1 - min((1,(1 - a(x))**q + (1 - b(x))**q)*1/q)
243+
244+
VII. Sum-Prod composition
245+
yk = x x Rk
246+
µ(y) = f(sum(µ(x) * µ(x,y)))
247+
where f(*) is a logistic function that limits the
248+
value of the function within the unit interval
249+
mainly used in ANN for mapping between parallel layers
250+
in a multi-layer network.
251+
252+
VIII. Max-Ave composition
253+
yk = x * av.Rk
254+
µ(y) = 1/2*max(µ(x) + µ(x,y) for x in X)
255+
256+
257+
# Fuzzy Control (page 175)
258+
# A Fuzzy Two-Axis Mirror Controller for Laser Beam Alignment
259+
260+
#VAR Error
261+
#TYPE signed byte /* C type of'signed char' */
262+
#MIN -128 /* universe of discourse min */
263+
#MAX 127 /* universe of discourse max */
264+
#/* Membership functions for Error (ZE, PS, NS, PM, NM). */
265+
#MEMBER ZE
266+
#POINTS -20 0 0 1 20 0
267+
#END
268+
#VAR dError
269+
#TYPE signed byte
270+
#MIN-100
271+
#*/
272+
#MAX 100
273+
#*/ /* C type of 'signed char' */
274+
#/* universe of discourse min
275+
#/* universe of discourse max
276+
#
277+
#MEMBER ZE
278+
#POINTS -30 0 0 1 30 0
279+
#END
280+
281+
#FUZZY Alignment_rules
282+
#RULE Rulel
283+
#IF Error IS PM AND dError IS ZE THEN
284+
#Speed IS NM
285+
#END
286+
# ...
287+
#/* The following three CONNECT Objects specify that Error
288+
#* and dError are inputs to the Alignment_rules knowledge base
289+
#* and Speed output from Alignment_rules.
290+
#CONNECT
291+
#FROM Error
292+
#TO Alignment_rules
293+
#END
294+
# ...
295+
296+
transformed-viscosity = (integer) (10*logiQ (viscosity) + .5).

0 commit comments

Comments
 (0)