|
VBAに挑戦して10日目くらいの者です。
下記のようなものを作って計算をさせようとしております。
「結果」で示すように「越流幅」がB≦1.7ではうまく計算しますが
B≦1.8になると最終行の手前で止まってしまします。
Bを変えただけでなぜ計算しないのか、どこが原因なのか、まったく解りません。
アドバイスをいただけないでしょうかお願い致します。
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
Sub 水位の計算()
Dim H0, H1, H2 As Double
Dim X0 As Double
Dim X1 As Double
Dim X2 As Double
Dim X3 As Double
Dim X4 As Double
Dim X5 As Double
Dim X6 As Double
Dim XX As Double
Dim XX1 As Double
Dim XX2 As Double
Dim XX3 As Double
Dim XX4 As Double
Dim XX5 As Double
Dim Y1 As Double
Dim Y2 As Double
Dim I, J, K, N, P
K = Cells(2, 10)
N = Cells(2, 10) + 11
X0 = 0.001
XX = 1 / 3.6 * Cells(4, 9) * Cells(9, 6) * Cells(4, 6) / 100 * 1.2
Cells(9, 7) = XX
X1 = Cells(6, 9) * Cells(6, 6) * X0 ^ (3 / 2) '放流量
X2 = (X1 + 0) / 2
X3 = (Cells(9, 7) / 2 - X2) * 34 * 60
X4 = X3 / (Cells(5, 6) * 100 * 100)
X5 = Abs(X4 - X0)
Do Until X5 < 0.00001
H0 = X4
X1 = Cells(6, 9) * Cells(6, 6) * H0 ^ (3 / 2) '放流量
X2 = (X1 + 0) / 2
X3 = (Cells(9, 7) / 2 - X2) * 34 * 60
X4 = X3 / (Cells(5, 6) * 100 * 100)
X5 = Abs(X4 - H0)
Loop
Cells(9, 8) = X1
Cells(9, 9) = XX / 2
Cells(9, 10) = X2
Cells(9, 11) = X3
Cells(9, 12) = X4
'-----------------------------------------
For I = 10 To N
J = I - 9
P = Cells(2, 6)
H1 = X4
XX1 = 1 / 3.6 * Cells(4, 9) * Cells(I, 6) * Cells(4, 6) / 100 * 1.2
Y1 = 1 / 3.6 * Cells(4, 9) * Cells(I - 1, 6) * Cells(4, 6) / 100 * 1.2
Y2 = 1 / 3.6 * Cells(4, 9) * Cells(I, 6) * Cells(4, 6) / 100 * 1.2
XX2 = Cells(6, 9) * Cells(6, 6) * H1 ^ (3 / 2)
XX3 = (XX2 + Cells(I - 1, 8)) / 2
XX4 = Cells(I - 1, 11) + ((Y1 + Y2) / 2 - XX3) * Cells(2, 6) * 60
XX5 = XX4 / (Cells(5, 6) * 100 * 100)
XX6 = Abs(XX5 - H1)
H2 = XX5
Do Until XX6 < Cells(5, 9)
XX1 = 1 / 3.6 * Cells(4, 9) * Cells(I, 6) * Cells(4, 6) / 100 * 1.2
Y1 = 1 / 3.6 * Cells(4, 9) * Cells(I - 1, 6) * Cells(4, 6) / 100 * 1.2
Y2 = 1 / 3.6 * Cells(4, 9) * Cells(I, 6) * Cells(4, 6) / 100 * 1.2
XX2 = Cells(6, 9) * Cells(6, 6) * H2 ^ (3 / 2)
XX3 = (XX2 + Cells(I - 1, 8)) / 2
XX4 = Cells(I - 1, 11) + ((Y1 + Y2) / 2 - XX3) * Cells(2, 6) * 60
XX5 = XX4 / (Cells(5, 6) * 100 * 100)
XX6 = Abs(XX5 - H2)
H2 = XX5
Loop
Cells(I, 7) = XX1
Cells(I, 8) = XX2 '放流量
Cells(I, 9) = (Y1 + Y2) / 2
Cells(I, 10) = XX3 'O(t+dt/2)
Cells(I, 11) = XX4 ' V
Cells(I, 12) = XX5
Next
End Sub
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−「結果」
計算ピッチ(分)= 34.000 計算時間(分) 1462 43
地域係数 (B)= 0.400 地域係数 (A) 664
流域面積 (ha) = 8.370 流出係数(F) 0.81
満水面積 (ha) = 0.440 許容誤差 0.00001
越流幅 (L) = 1.800 流量係数 2.100
降雨強度 流入量 放流量 O(t+dt) O(t+dt/2) V(t+dt) 水位
1 8.733 0.197 0.029 0.099 0.015 171.6 0.039
2 8.838 0.200 0.115 0.199 0.072 429.4 0.098
3 8.946 0.202 0.167 0.201 0.141 551.0 0.125
4 9.059 0.205 0.191 0.203 0.179 600.6 0.137
5 9.175 0.207 0.201 0.206 0.196 621.7 0.141
6 9.297 0.210 0.206 0.209 0.203 632.6 0.144
7 9.423 0.213 0.210 0.212 0.208 640.0 0.145
8 9.555 0.216 0.213 0.214 0.211 646.5 0.147
9 9.693 0.219 0.216 0.217 0.214 652.8 0.148
10 9.836 0.222 0.219 0.221 0.218 659.1 0.150
11 9.986 0.226 0.222 0.224 0.221 665.6 0.151
12 10.144 0.229 0.226 0.227 0.224 672.4 0.153
13 10.309 0.233 0.229 0.231 0.228 679.5 0.154
14 10.482 0.237 0.233 0.235 0.231 686.9 0.156
15 10.664 0.241 0.237 0.239 0.235 694.6 0.158
16 10.856 0.245 0.241 0.243 0.239 702.7 0.160
17 11.059 0.250 0.246 0.248 0.243 711.2 0.162
18 11.274 0.255 0.250 0.252 0.248 720.2 0.164
19 11.502 0.260 0.255 0.257 0.253 729.6 0.166
20 11.744 0.265 0.260 0.263 0.258 739.5 0.168
21 12.002 0.271 0.266 0.268 0.263 749.9 0.170
22 12.278 0.277 0.272 0.274 0.269 761.0 0.173
23 12.574 0.284 0.278 0.281 0.275 772.7 0.176
24 12.892 0.291 0.285 0.288 0.282 785.2 0.178
25 13.236 0.299 0.292 0.295 0.289 798.6 0.182
26 13.609 0.308 0.300 0.303 0.296 813.0 0.185
27 14.015 0.317 0.309 0.312 0.305 828.5 0.188
28 14.460 0.327 0.318 0.322 0.314 845.3 0.192
29 14.950 0.338 0.329 0.332 0.323 863.4 0.196
30 15.494 0.350 0.340 0.344 0.334 883.2 0.201
31 16.102 0.364 0.353 0.357 0.346 905.1 0.206
32 16.787 0.379 0.367 0.372 0.360 929.3 0.211
33 17.569 0.397 0.383 0.388 0.375 956.3 0.217
34 18.471 0.417 0.401 0.407 0.392 986.9 0.224
35 19.528 0.441 0.423 0.429 0.412 1021.8 0.232
36 20.790 0.470 0.448 0.456 0.436 1062.3 0.241
37 22.334 0.505 0.479 0.487 0.464 1110.2 0.252
38 24.284 0.549 0.517 0.527 0.498 1168.5 0.266
39 26.856 0.607 0.567 0.578 0.542 1241.6 0.282
40 30.474 0.689 0.634 0.648 0.600 1338.3 0.304
41 36.130 0.817 0.735 0.753 0.685 1477.0 0.336
42 47.029 1.063 0.916 0.940 0.825 1709.9 0.389
43 106.565 ? ? ? ? ? ?(求める水位)
44
45
46
47
|
|