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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
| oExcel = CreateObject("Excel.Application")
oExcel.visible = True
oBook = oExcel.Workbooks.Add
For k = 0 To 1
For i = 3 To ik + 3
oBook.Worksheets(k + 1).Range("A" & i).Value = TETAl(i - 3)
oBook.Worksheets(k + 1).Range("A" & i + ik + 3).Value = TETAl(i - 3)
oBook.Worksheets(k + 1).Range("A" & i + 2 * ik + 6).Value = TETAl(i - 3)
oBook.Worksheets(k + 1).Range("A" & i + 3 * ik + 9).Value = TETAl(i - 3)
Next i
oBook.Worksheets(k + 1).Range("B2").Resize(1, jk + 1).Value = PSIl
oBook.Worksheets(k + 1).Range("B" & ik + 5).Resize(1, jk + 1).Value = PSIl
oBook.Worksheets(k + 1).Range("B" & 2 * ik + 8).Resize(1, jk + 1).Value = PSIl
oBook.Worksheets(k + 1).Range("B" & 3 * ik + 11).Resize(1, jk + 1).Value = PSIl
oBook.Worksheets(k + 1).Range("A2").Value = "TETAl/PSIl"
oBook.Worksheets(k + 1).Range("A" & ik + 5).Value = "TETAl/PSIl"
oBook.Worksheets(k + 1).Range("A" & 2 * ik + 8).Value = "TETAl/PSIl"
oBook.Worksheets(k + 1).Range("A" & 3 * ik + 11).Value = "TETAl/PSIl"
Next k
For i = 3 To ik + 3
oBook.Worksheets(3).Range("A" & i).Value = TETAl(i - 3)
oBook.Worksheets(3).Range("A" & i + ik + 3).Value = TETAl(i - 3)
Next i
oBook.Worksheets(3).Range("B2").Resize(1, jk + 1).Value = PSIl
oBook.Worksheets(3).Range("B" & ik + 5).Resize(1, jk + 1).Value = PSIl
oBook.Worksheets(3).Range("A2").Value = "TETAl/PSIl"
oBook.Worksheets(3).Range("A" & ik + 5).Value = "TETAl/PSIl"
oSheet = oBook.Worksheets(1)
oSheet.Name = "r,f,d,alfa"
oSheet.Range("B1").Value = "X0 =" & X0
oSheet.Range("C1").Value = "Y0 =" & Y0
oSheet.Range("D1").Value = "X001 ="
oSheet.Range("E1").Value = X001
oSheet.Range("F1").Value = "Y001 ="
oSheet.Range("G1").Value = Y001
oSheet.Range("H1").Value = "a = b = c ="
oSheet.Range("I1").Value = a
oSheet.Range("A1").Value = "r"
For z = 0 To jk
For ii = 0 To ik
TETAl(ii) = TETAlED(z, ii)
Call rass4et()
For k = 1 To ik / 2
If TETAlED(z, k - 1) = TETAlED(z, k) Then
r(k - 1, z) = s
f(k - 1, z) = s
div(k - 1, z) = s
alfa(k - 1, z) = s
End If
If TETAlED(z, ik - k + 1) = TETAlED(z, ik - k) Then
r(ik - k + 1, z) = s
f(ik - k + 1, z) = s
div(ik - k + 1, z) = s
alfa(ik - k + 1, z) = s
End If
If k = 1 And CStr(r(k - 1, z)) <> s Then
r(k - 1, z) = r(k - 1, z) & "(" & TETAlLB(z) & ")"
End If
If CStr(r(k - 1, z)) = s Then
r(k, z) = r(k, z) & "(" & TETAlLB(z) & ")"
End If
If k = 1 And CStr(r(ik - k + 1, z)) <> s Then
r(ik - k + 1, z) = r(ik - k + 1, z) & "(" & TETAlUB(z) & ")"
End If
If CStr(r(ik - k + 1, z)) = s Then
r(ik - k, z) = r(ik - k, z) & "(" & TETAlUB(z) & ")"
End If
If k = 1 And CStr(f(k - 1, z)) <> s Then
f(k - 1, z) = f(k - 1, z) & "(" & TETAlLB(z) & ")"
End If
If CStr(f(k - 1, z)) = s Then
f(k, z) = f(k, z) & "(" & TETAlLB(z) & ")"
End If
If k = 1 And CStr(f(ik - k + 1, z)) <> s Then
f(ik - k + 1, z) = f(ik - k + 1, z) & "(" & TETAlUB(z) & ")"
End If
If CStr(f(ik - k + 1, z)) = s Then
f(ik - k, z) = f(ik - k, z) & "(" & TETAlUB(z) & ")"
End If
If k = 1 And CStr(div(k - 1, z)) <> s Then
div(k - 1, z) = div(k - 1, z) & "(" & TETAlLB(z) & ")"
End If
If CStr(div(k - 1, z)) = s Then
div(k, z) = div(k, z) & "(" & TETAlLB(z) & ")"
End If
If k = 1 And CStr(div(ik - k + 1, z)) <> s Then
div(ik - k + 1, z) = div(ik - k + 1, z) & "(" & TETAlUB(z) & ")"
End If
If CStr(div(ik - k + 1, z)) = s Then
div(ik - k, z) = div(ik - k, z) & "(" & TETAlUB(z) & ")"
End If
If k = 1 And CStr(alfa(k - 1, z)) <> s Then
alfa(k - 1, z) = alfa(k - 1, z) & "(" & TETAlLB(z) & ")"
End If
If CStr(alfa(k - 1, z)) = s Then
alfa(k, z) = alfa(k, z) & "(" & TETAlLB(z) & ")"
End If
If k = 1 And CStr(alfa(ik - k + 1, z)) <> s Then
alfa(ik - k + 1, z) = alfa(ik - k + 1, z) & "(" & TETAlUB(z) & ")"
End If
If CStr(alfa(ik - k + 1, z)) = s Then
alfa(ik - k, z) = alfa(ik - k, z) & "(" & TETAlUB(z) & ")"
End If
Next k
r_ent(ii, z) = r(ii, z)
f_ent(ii, z) = f(ii, z)
div_ent(ii, z) = div(ii, z)
alfa_ent(ii, z) = alfa(ii, z)
Next ii
Next z
oSheet.Range("B3").Resize(ik + 1, jk + 1).Value = r_ent
oSheet.Range("A" & ik + 4).Value = "f"
oSheet.Range("B" & ik + 6).Resize(ik + 1, jk + 1).Value = f_ent
oSheet.Range("A" & 2 * ik + 7).Value = "d"
oSheet.Range("B" & 2 * ik + 9).Resize(ik + 1, jk + 1).Value = div_ent
oSheet.Range("A" & 3 * ik + 10).Value = "alfa"
oSheet.Range("B" & 3 * ik + 12).Resize(ik + 1, jk + 1).Value = alfa_ent
oSheet = oBook.Worksheets(2)
oSheet.Range("B1").Value = "X0 =" & X0
oSheet.Range("C1").Value = "Y0 =" & Y0
oSheet.Range("D1").Value = "X001 ="
oSheet.Range("E1").Value = X001
oSheet.Range("F1").Value = "Y001 ="
oSheet.Range("G1").Value = Y001
oSheet.Range("H1").Value = "a = b = c ="
oSheet.Range("I1").Value = a
oSheet.Name = "TETA_R,PSI_R,TETA_r,PSI_r"
oSheet.Range("A1").Value = "TETA_R"
For z = 0 To jk
For ii = 0 To ik
TETAl(ii) = TETAlED(z, ii)
Call rass4et()
TETARz_ent(ii, z) = TETARz(ii, z)
PSIRz_ent(ii, z) = PSIRz(ii, z)
TETAfr_ent(ii, z) = TETAfr(ii, z)
PSIfr_ent(ii, z) = PSIfr(ii, z)
Next ii
Next z
For z = 0 To jk
For k = 1 To ik / 2
If TETAlED(z, k - 1) = TETAlED(z, k) Then
TETARz_ent(k - 1, z) = s
PSIRz_ent(k - 1, z) = s
TETAfr_ent(k - 1, z) = s
PSIfr_ent(k - 1, z) = s
End If
If TETAlED(z, ik - k + 1) = TETAlED(z, ik - k) Then
TETARz_ent(ik - k + 1, z) = s
PSIRz_ent(ik - k + 1, z) = s
TETAfr_ent(ik - k + 1, z) = s
PSIfr_ent(ik - k + 1, z) = s
End If
If k = 1 And CStr(TETARz_ent(k - 1, z)) <> s Then
TETARz_ent(k - 1, z) = TETARz_ent(k - 1, z) & "(" & TETAlLB(z) & ")"
End If
If CStr(TETARz_ent(k - 1, z)) = s Then
TETARz_ent(k, z) = TETARz_ent(k, z) & "(" & TETAlLB(z) & ")"
End If
If k = 1 And CStr(TETARz_ent(ik - k + 1, z)) <> s Then
TETARz_ent(ik - k + 1, z) = TETARz_ent(ik - k + 1, z) & "(" & TETAlUB(z) & ")"
End If
If CStr(TETARz_ent(ik - k + 1, z)) = s Then
TETARz_ent(ik - k, z) = TETARz_ent(ik - k, z) & "(" & TETAlUB(z) & ")"
End If
If k = 1 And CStr(PSIRz_ent(k - 1, z)) <> s Then
PSIRz_ent(k - 1, z) = PSIRz_ent(k - 1, z) & "(" & TETAlLB(z) & ")"
End If
If CStr(PSIRz_ent(k - 1, z)) = s Then
PSIRz_ent(k, z) = PSIRz_ent(k, z) & "(" & TETAlLB(z) & ")"
End If
If k = 1 And CStr(PSIRz_ent(ik - k + 1, z)) <> s Then
PSIRz_ent(ik - k + 1, z) = PSIRz_ent(ik - k + 1, z) & "(" & TETAlUB(z) & ")"
End If
If CStr(PSIRz_ent(ik - k + 1, z)) = s Then
PSIRz_ent(ik - k, z) = PSIRz_ent(ik - k, z) & "(" & TETAlUB(z) & ")"
End If
If k = 1 And CStr(TETAfr_ent(k - 1, z)) <> s Then
TETAfr_ent(k - 1, z) = TETAfr_ent(k - 1, z) & "(" & TETAlLB(z) & ")"
End If
If CStr(TETAfr_ent(k - 1, z)) = s Then
TETAfr_ent(k, z) = TETAfr_ent(k, z) & "(" & TETAlLB(z) & ")"
End If
If k = 1 And CStr(TETAfr_ent(ik - k + 1, z)) <> s Then
TETAfr_ent(ik - k + 1, z) = TETAfr_ent(ik - k + 1, z) & "(" & TETAlUB(z) & ")"
End If
If CStr(TETAfr_ent(ik - k + 1, z)) = s Then
TETAfr_ent(ik - k, z) = TETAfr_ent(ik - k, z) & "(" & TETAlUB(z) & ")"
End If
If k = 1 And CStr(PSIfr_ent(k - 1, z)) <> s Then
PSIfr_ent(k - 1, z) = PSIfr_ent(k - 1, z) & "(" & TETAlLB(z) & ")"
End If
If CStr(PSIfr_ent(k - 1, z)) = s Then
PSIfr_ent(k, z) = PSIfr_ent(k, z) & "(" & TETAlLB(z) & ")"
End If
If k = 1 And CStr(PSIfr_ent(ik - k + 1, z)) <> s Then
PSIfr_ent(ik - k + 1, z) = PSIfr_ent(ik - k + 1, z) & "(" & TETAlUB(z) & ")"
End If
If CStr(PSIfr_ent(ik - k + 1, z)) = s Then
PSIfr_ent(ik - k, z) = PSIfr_ent(ik - k, z) & "(" & TETAlUB(z) & ")"
End If
Next k
Next z
oSheet.Range("B3").Resize(ik + 1, jk + 1).Value = TETARz_ent
oSheet.Range("A" & ik + 4).Value = "PSI_R"
oSheet.Range("B" & ik + 6).Resize(ik + 1, jk + 1).Value = PSIRz_ent
oSheet.Range("A" & 2 * ik + 7).Value = "TETA_r"
oSheet.Range("B" & 2 * ik + 9).Resize(ik + 1, jk + 1).Value = TETAfr_ent
oSheet.Range("A" & 3 * ik + 10).Value = "PSI_r"
oSheet.Range("B" & 3 * ik + 12).Resize(ik + 1, jk + 1).Value = PSIfr_ent
oSheet = oBook.Worksheets(3)
oSheet.Range("B1").Value = "X0 =" & X0
oSheet.Range("C1").Value = "Y0 =" & Y0
oSheet.Range("D1").Value = "X001 ="
oSheet.Range("E1").Value = X001
oSheet.Range("F1").Value = "Y001 ="
oSheet.Range("G1").Value = Y001
oSheet.Range("H1").Value = "a = b = c ="
oSheet.Range("I1").Value = a
oSheet.Name = "TETA_i,PSI_i"
oSheet.Range("A1").Value = "TETA_i"
For z = 0 To jk
For ii = 0 To ik
TETAl(ii) = TETAlED(z, ii)
Call rass4et()
For k = 1 To ik / 2
If TETAlED(z, k - 1) = TETAlED(z, k) Then
TETAi(k - 1, z) = s
PSIi(k - 1, z) = s
End If
If TETAlED(z, ik - k + 1) = TETAlED(z, ik - k) Then
TETAi(ik - k + 1, z) = s
PSIi(ik - k + 1, z) = s
End If
If k = 1 And CStr(TETAi(k - 1, z)) <> s Then
TETAi(k - 1, z) = TETAi(k - 1, z) & "(" & TETAlLB(z) & ")"
End If
If CStr(TETAi(k - 1, z)) = s Then
TETAi(k, z) = TETAi(k, z) & "(" & TETAlLB(z) & ")"
End If
If k = 1 And CStr(TETAi(ik - k + 1, z)) <> s Then
TETAi(ik - k + 1, z) = TETAi(ik - k + 1, z) & "(" & TETAlUB(z) & ")"
End If
If CStr(TETAi(ik - k + 1, z)) = s Then
TETAi(ik - k, z) = TETAi(ik - k, z) & "(" & TETAlUB(z) & ")"
End If
If k = 1 And CStr(PSIi(k - 1, z)) <> s Then
PSIi(k - 1, z) = PSIi(k - 1, z) & "(" & TETAlLB(z) & ")"
End If
If CStr(PSIi(k - 1, z)) = s Then
PSIi(k, z) = PSIi(k, z) & "(" & TETAlLB(z) & ")"
End If
If k = 1 And CStr(PSIi(ik - k + 1, z)) <> s Then
PSIi(ik - k + 1, z) = PSIi(ik - k + 1, z) & "(" & TETAlUB(z) & ")"
End If
If CStr(PSIi(ik - k + 1, z)) = s Then
PSIi(ik - k, z) = PSIi(ik - k, z) & "(" & TETAlUB(z) & ")"
End If
Next k
TETAi_ent(ii, z) = TETAi(ii, z)
PSIi_ent(ii, z) = PSIi(ii, z)
Next ii
Next z
oSheet.Range("B3").Resize(ik + 1, jk + 1).Value = TETAi_ent
oSheet.Range("A" & ik + 4).Value = "PSI_i"
oSheet.Range("B" & ik + 6).Resize(ik + 1, jk + 1).Value = PSIi_ent
oBook.SaveAs("C:\pole.xls")
oExcel.Quit()
Try
System.Runtime.InteropServices.Marshal.ReleaseComObject(oExcel)
oExcel = Nothing
Catch ex As Exception
MsgBox(ex.Message)
Finally
GC.Collect()
End Try |