File size: 13,272 Bytes
aadc56f
 
41371f1
 
 
 
 
 
 
1a19328
aadc56f
 
 
5915085
41371f1
 
 
 
 
 
 
 
 
1a19328
aadc56f
 
41371f1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
aadc56f
 
 
 
41371f1
 
 
 
 
 
aadc56f
 
 
41371f1
 
aadc56f
41371f1
1a19328
aadc56f
 
 
 
 
 
 
 
9b6a9f6
aadc56f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
import streamlit as st
import plotly.graph_objects as go
import skfuzzy as fuzz
from skfuzzy import control as crt
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as ml
import streamlit as st
import math
from mpl_toolkits.mplot3d import Axes3D
import streamlit as st


st.title('Schematic Design !')


tanasobat=crt.Antecedent(np.arange(0,3.05,0.05),'c')
jahat=crt.Antecedent(np.arange(0,25.1,0.1),'a')
jerm_hararati=crt.Antecedent(np.arange(0,4185.1,0.1),'b')
feshordegi=crt.Antecedent(np.arange(0,1,0.01),'d')
ertefa=crt.Antecedent(np.arange(2.3,10.001,0.001),'e')
WWR=crt.Antecedent(np.arange(0,1.001,0.001),'f')
emtiaz_HH=crt.Consequent(np.arange(-4,24.01,0.01),'score')
g1=st.sidebar.radio('climate',['hot and humid','hot and dry','cold','moderate and humid'])


jahat['low']=fuzz.trimf(jahat.universe,[0,5,12])
jahat['medium']=fuzz.trimf(jahat.universe,[5,12,17.5])
jahat['re_hight']=fuzz.trimf(jahat.universe,[12,17.5,25])
jahat['high']=fuzz.trimf(jahat.universe,[17.5,25,25])

jerm_hararati['low']=fuzz.trapmf(jerm_hararati.universe,[0,0,1500,1600])
jerm_hararati['medium']=fuzz.trapmf(jerm_hararati.universe,[1500,2000,3000,3500])
jerm_hararati['high']=fuzz.trapmf(jerm_hararati.universe,[3000,3500,4185,4185])


tanasobat['low']=fuzz.trapmf(tanasobat.universe,[0,1.1,1.3,1.4])
tanasobat['medium']=fuzz.trapmf(tanasobat.universe,[1.2,1.4,1.6,1.7])
tanasobat['high']=fuzz.trapmf(tanasobat.universe,[1.6,1.7,3,3])


feshordegi['low']=fuzz.trapmf(feshordegi.universe,[0,0.2,0.5,0.6])
feshordegi['medium']=fuzz.trapmf(feshordegi.universe,[0.5,0.6,0.8,0.85])
feshordegi['high']=fuzz.trapmf(feshordegi.universe,[0.8,0.85,1,1])

ertefa['low']=fuzz.gbellmf(ertefa.universe,0.3,6,2.4)
ertefa['medium']=fuzz.gbellmf(ertefa.universe,0.2,6,3)
ertefa['high']=fuzz.smf(ertefa.universe,3.2,3.6)

WWR['low']=fuzz.gbellmf(WWR.universe,0.05,4,0.15)
#WWR['medium']=fuzz.gbellmf(WWR.universe,0.05,6,0.25)
WWR['RE_high']=fuzz.gbellmf(WWR.universe,0.05,4,0.30)
WWR['high']=fuzz.smf(WWR.universe,0.35,0.45)

emtiaz_HH['awful']=fuzz.gaussmf(emtiaz_HH.universe,0,1)
emtiaz_HH['bad']=fuzz.gaussmf(emtiaz_HH.universe,4,1)
emtiaz_HH['not_bad']=fuzz.gaussmf(emtiaz_HH.universe,8,1)
emtiaz_HH['good']=fuzz.gaussmf(emtiaz_HH.universe,12,1)
emtiaz_HH['very_good']=fuzz.gaussmf(emtiaz_HH.universe,16,1)
emtiaz_HH['excelent']=fuzz.gaussmf(emtiaz_HH.universe,20,1)


r1=crt.Rule(jahat['low']&jerm_hararati['low']&tanasobat['high']&feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['excelent'])

r2=crt.Rule(~jahat['low']&jerm_hararati['low']&tanasobat['high']&feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['very_good'])
r3=crt.Rule(jahat['low']&~jerm_hararati['low']&tanasobat['high']&feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['very_good'])
r4=crt.Rule(jahat['low']&jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['very_good'])
r5=crt.Rule(jahat['low']&jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['very_good'])
r6=crt.Rule(jahat['low']&jerm_hararati['low']&tanasobat['high']&feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['very_good'])
r7=crt.Rule(jahat['low']&jerm_hararati['low']&tanasobat['high']&feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['very_good'])


r8=crt.Rule(~jahat['low']&~jerm_hararati['low']&tanasobat['high']&feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['good'])
r9=crt.Rule(~jahat['low']&jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['good'])
r10=crt.Rule(~jahat['low']&jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['good'])
r11=crt.Rule(~jahat['low']&jerm_hararati['low']&tanasobat['high']&feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['good'])
r12=crt.Rule(~jahat['low']&jerm_hararati['low']&tanasobat['high']&feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['good'])


r13=crt.Rule(jahat['low']&~jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['good'])
r14=crt.Rule(jahat['low']&~jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['good'])
r15=crt.Rule(jahat['low']&~jerm_hararati['low']&tanasobat['high']&feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['good'])
r16=crt.Rule(jahat['low']&~jerm_hararati['low']&tanasobat['high']&feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['good'])


r17=crt.Rule(jahat['low']&jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['good'])
r18=crt.Rule(jahat['low']&jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['good'])
r19=crt.Rule(jahat['low']&jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['good'])


r20=crt.Rule(jahat['low']&jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['good'])
r21=crt.Rule(jahat['low']&jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['good'])

r22=crt.Rule(jahat['low']&jerm_hararati['low']&tanasobat['high']&feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['good'])

r23=crt.Rule(~jahat['low']&~jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['not_bad'])
r24=crt.Rule(~jahat['low']&~jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['not_bad'])
r25=crt.Rule(~jahat['low']&~jerm_hararati['low']&tanasobat['high']&feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['not_bad'])
r26=crt.Rule(~jahat['low']&~jerm_hararati['low']&tanasobat['high']&feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['not_bad'])
r27=crt.Rule(~jahat['low']&jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['not_bad'])
r28=crt.Rule(~jahat['low']&jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['not_bad'])
r29=crt.Rule(~jahat['low']&jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['not_bad'])
r30=crt.Rule(~jahat['low']&jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['not_bad'])
r31=crt.Rule(~jahat['low']&jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['not_bad'])
r32=crt.Rule(~jahat['low']&jerm_hararati['low']&tanasobat['high']&feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['not_bad'])

r33=crt.Rule(jahat['low']&~jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['not_bad'])
r34=crt.Rule(jahat['low']&~jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['not_bad'])
r35=crt.Rule(jahat['low']&~jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['not_bad'])
r36=crt.Rule(jahat['low']&~jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['not_bad'])


r37=crt.Rule(jahat['low']&jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['not_bad'])
r38=crt.Rule(jahat['low']&jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['not_bad'])
r39=crt.Rule(jahat['low']&jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['not_bad'])

r40=crt.Rule(~jahat['low']&~jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&ertefa['high']&WWR['RE_high'],emtiaz_HH['bad'])
r41=crt.Rule(~jahat['low']&~jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['bad'])
r42=crt.Rule(~jahat['low']&~jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['bad'])
r43=crt.Rule(~jahat['low']&~jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['bad'])
r44=crt.Rule(~jahat['low']&~jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['bad'])
r45=crt.Rule(~jahat['low']&~jerm_hararati['low']&tanasobat['high']&feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['bad'])
r46=crt.Rule(~jahat['low']&jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['bad'])
r47=crt.Rule(~jahat['low']&jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['bad'])
r48=crt.Rule(~jahat['low']&jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['bad'])

r49=crt.Rule(jahat['low']&~jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['bad'])
r50=crt.Rule(jahat['low']&~jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['bad'])
r51=crt.Rule(jahat['low']&~jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['bad'])
r52=crt.Rule(jahat['low']&~jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['bad'])
r53=crt.Rule(jahat['low']&jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['bad'])

r53=crt.Rule(jahat['low']&~jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['awful'])
r54=crt.Rule(~jahat['low']&jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['awful'])
r55=crt.Rule(~jahat['low']&~jerm_hararati['low']&tanasobat['high']&~feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['awful'])
r56=crt.Rule(~jahat['low']&~jerm_hararati['low']&~tanasobat['high']&feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['awful'])
r57=crt.Rule(~jahat['low']&~jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&ertefa['high']&~WWR['RE_high'],emtiaz_HH['awful'])
r58=crt.Rule(~jahat['low']&~jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&~ertefa['high']&WWR['RE_high'],emtiaz_HH['awful'])
r59=crt.Rule(~jahat['low']&~jerm_hararati['low']&~tanasobat['high']&~feshordegi['low']&~ertefa['high']&~WWR['RE_high'],emtiaz_HH['awful'])

cs=crt.ControlSystem([r1,
r2,
r3,
r4,
r5,
r6,
r7,
r8,
r9,
r10,
r11,
r12,
r13,
r14,
r15,
r16,
r17,
r18,
r19,
r20,
r21,
r22,
r23,
r24,
r25,
r26,
r27,
r28,
r29,
r30,
r31,
r32,
r33,
r34,
r35,
r36,
r37,
r38,
r39,
r40,
r41,
r42,
r43,
r44,
r45,
r46,
r47,
r48,
r49,
r50,
r51,
r52,
r53,r54,r55,r56,r57,r58,r59])
cs1=crt.ControlSystemSimulation(cs)

width=st.sidebar.slider("width",min_value=1,max_value=10,step=1,value=5)
length=st.sidebar.slider("length",min_value=1,max_value=10,step=1,value=8)
c1=cs1.input['c']=length/width


a1=cs1.input['a']=st.sidebar.slider("jahat",min_value=0.00,max_value=40.00,step=0.1,value=0.0)
b1=cs1.input['b']=st.sidebar.slider("jerm_hararati",min_value=0.00,max_value=4180.00,step=0.1,value=0.0)

d1=cs1.input['d']=st.sidebar.slider("feshordegi",min_value=0.00,max_value=1.0,step=0.01,value=0.1)
e1=cs1.input['e']=st.sidebar.slider("ertefa",min_value=2.3,max_value=5.00,step=0.01,value=3.31)
height=e1
f1=cs1.input['f']=st.sidebar.slider("wwr",min_value=0,max_value=100,step=5,value=50)
wwr= ((f1 - 1) / 99) * 50 + 50
cs1.compute()
g11=cs1.output['score']
g11=round(g11)

# Create axis


st.metric(label="your fuzzy score", value=g11)
#st.set_option('deprecation.showPyplotGlobalUse', False)
#st.pyplot()



#Create sliders to adjust the dimensions



# Use Plotly to create a 3D cube with the adjusted dimensions
fig = go.Figure(data=[
    # Main body of the cube
    go.Mesh3d(x=[0, width, width, 0, 0, width, width, 0],
              y=[0, 0, length, length, 0, 0, length, length],
              z=[0, 0, 0, 0, height, height, height, height],
              alphahull=0,
              color='#F5DEB3',
              opacity=1,
              lighting=dict(ambient=0.5, diffuse=0.9, roughness=0.1, specular=0.2, fresnel=0.2),
              flatshading=True,
              hoverinfo='none'),
    # Window surface
    go.Mesh3d(x=[width+0.05,width+0.05,width+0.05,width+0.05],
              y=[length*(wwr/100), length*(wwr/100), length*(1-wwr/100), length*(1-wwr/100) ],
              z=[height*(wwr/100), height*(1-wwr/100), height*(1-wwr/100), height*(wwr/100)],
              i=[2, 3, 0, 1, 0, 3],
              j=[1, 2, 3, 3, 2, 0],
              k=[0, 1, 2, 0, 2, 3],
              color='skyblue',
              opacity=1,
              lighting=dict(ambient=0.5, diffuse=0.9, roughness=0.1, specular=0.2, fresnel=0.2),
              flatshading=True,
              hoverinfo='none')]
)
fig.update_layout(scene=dict(zaxis=dict(visible=False,range=[0,5],autorange=False),xaxis=dict(visible=False,range=[0,10],autorange=False),yaxis=dict(visible=False,range=[0,10],autorange=False)),width=100,height=800)

# Use Streamlit to display the 3D c ube
st.plotly_chart(fig,use_container_width=True)