Add files via upload

업데이트 내용은 다음과 같습니다.

1. 기존에 작업하던 1공구 SP-11의 전체단계(4단계)에 대하여 반복문을 통하여 돌아갈 수 있도록 수정하였습니다. 
  (1_SP-11_Test.csv/ main_Rev.4.py / main.Rev.4_svg)
  
2. 앞서 완성한 main_Rev.4.py 코드의 적용성 검토를 위하여 
   3공구 SP-68 지점 데이터(4단계) 적용한 결과 첨부해드립니다.
   (3_SP-68_Test.csv / 3_SP-68_Rev.4.svg)
   
+) 지점 데이터에 변화에 대한 입력값 수정 필요 부분은 다음과 같습니다.
  line 50 : 불러올 .csv 파일명 
  line 61-62 : start/end index
  line 64 : 성토 단계 
  line 170 ~ : 그래프 추가 
  line 183 : .svg 파일명
master
inugeoSeHee 2022-08-12 11:14:50 +09:00 committed by GitHub
parent 8b279be17d
commit 2d8a39b694
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 4570 additions and 0 deletions

125
1_SP-11_Test.csv Normal file
View File

@ -0,0 +1,125 @@
Time,Settle,Surcharge
0,0,1.5
5,17.4,1.5
7,23.9,1.5
11,32.2,1.5
14,41.7,1.5
21,64.1,1.5
28,72.5,1.5
35,78.8,1.5
42,93.3,1.5
48,102.5,1.5
53,108,3.002
54,109.2,3.002
55,110.4,3.002
56,111.6,3.002
59,117.3,3.002
60,119.2,3.002
61,121.1,3.002
62,122.7,3.002
67,130.2,3.002
68,131.9,3.002
69,133.6,3.002
70,135.4,3.002
74,141.4,3.002
75,142.9,3.002
76,144.4,3.002
77,146.2,3.002
80,149.2,3.002
81,150.2,3.002
82,151.2,3.002
83,152.2,3.002
91,162.8,3.002
98,170,3.002
105,177,3.002
112,182.4,3.002
115,185,3.002
117,186.5,3.002
118,187.3,3.002
122,202.9,4.095
124,210.5,4.095
125,214.5,4.095
126,218.6,4.095
129,222.4,4.095
130,223.7,4.095
131,225,4.095
132,226.3,4.095
133,227.5,4.095
136,231.7,4.095
137,233.1,4.095
138,234.5,4.095
139,235.9,4.095
140,237.3,4.095
143,240.7,4.095
147,245.5,4.095
151,249.7,4.095
154,252.8,4.095
158,257.8,4.095
161,261.1,4.095
164,264.1,4.095
168,268,4.095
172,272.2,4.095
175,275.5,4.095
181,283.5,4.095
192,293.5,4.095
195,296.2,4.095
199,301.3,4.095
202,304.6,4.095
209,311.1,4.095
216,316,4.095
223,322.3,4.095
230,326.5,4.095
237,331.6,4.095
244,336.5,4.095
251,341.2,4.095
258,346.1,4.095
266,350.9,4.095
273,354,4.095
280,356,4.095
286,358,4.095
294,360.9,4.095
300,363,5.256
301,363.4,5.256
304,365.8,5.256
305,366.5,5.256
306,367.2,5.256
307,367.9,5.256
308,368.5,5.256
311,369.5,5.256
312,369.8,5.256
313,370.1,5.256
314,370.4,5.256
327,377.4,5.256
329,378.5,5.256
336,381.8,5.256
343,385.5,5.256
350,388.4,5.256
357,391.1,5.256
364,394.1,5.256
371,397.1,5.256
377,399.5,5.256
385,401.4,5.256
388,402.3,5.256
389,402.6,5.256
390,402.9,5.256
391,403.2,5.256
392,403.5,5.256
395,404.4,5.256
397,405,5.256
398,405.3,5.256
402,406.5,5.256
404,407.1,5.256
405,407.4,5.256
406,407.6,5.256
409,408.2,5.256
411,408.6,5.256
419,410.2,5.256
420,410.5,5.256
425,411.5,5.256
426,411.7,5.256
434,413.3,5.256
440,414.5,5.256
447,415.9,5.256
455,417.5,5.256
461,418.7,5.256
468,420,5.256
1 Time Settle Surcharge
2 0 0 1.5
3 5 17.4 1.5
4 7 23.9 1.5
5 11 32.2 1.5
6 14 41.7 1.5
7 21 64.1 1.5
8 28 72.5 1.5
9 35 78.8 1.5
10 42 93.3 1.5
11 48 102.5 1.5
12 53 108 3.002
13 54 109.2 3.002
14 55 110.4 3.002
15 56 111.6 3.002
16 59 117.3 3.002
17 60 119.2 3.002
18 61 121.1 3.002
19 62 122.7 3.002
20 67 130.2 3.002
21 68 131.9 3.002
22 69 133.6 3.002
23 70 135.4 3.002
24 74 141.4 3.002
25 75 142.9 3.002
26 76 144.4 3.002
27 77 146.2 3.002
28 80 149.2 3.002
29 81 150.2 3.002
30 82 151.2 3.002
31 83 152.2 3.002
32 91 162.8 3.002
33 98 170 3.002
34 105 177 3.002
35 112 182.4 3.002
36 115 185 3.002
37 117 186.5 3.002
38 118 187.3 3.002
39 122 202.9 4.095
40 124 210.5 4.095
41 125 214.5 4.095
42 126 218.6 4.095
43 129 222.4 4.095
44 130 223.7 4.095
45 131 225 4.095
46 132 226.3 4.095
47 133 227.5 4.095
48 136 231.7 4.095
49 137 233.1 4.095
50 138 234.5 4.095
51 139 235.9 4.095
52 140 237.3 4.095
53 143 240.7 4.095
54 147 245.5 4.095
55 151 249.7 4.095
56 154 252.8 4.095
57 158 257.8 4.095
58 161 261.1 4.095
59 164 264.1 4.095
60 168 268 4.095
61 172 272.2 4.095
62 175 275.5 4.095
63 181 283.5 4.095
64 192 293.5 4.095
65 195 296.2 4.095
66 199 301.3 4.095
67 202 304.6 4.095
68 209 311.1 4.095
69 216 316 4.095
70 223 322.3 4.095
71 230 326.5 4.095
72 237 331.6 4.095
73 244 336.5 4.095
74 251 341.2 4.095
75 258 346.1 4.095
76 266 350.9 4.095
77 273 354 4.095
78 280 356 4.095
79 286 358 4.095
80 294 360.9 4.095
81 300 363 5.256
82 301 363.4 5.256
83 304 365.8 5.256
84 305 366.5 5.256
85 306 367.2 5.256
86 307 367.9 5.256
87 308 368.5 5.256
88 311 369.5 5.256
89 312 369.8 5.256
90 313 370.1 5.256
91 314 370.4 5.256
92 327 377.4 5.256
93 329 378.5 5.256
94 336 381.8 5.256
95 343 385.5 5.256
96 350 388.4 5.256
97 357 391.1 5.256
98 364 394.1 5.256
99 371 397.1 5.256
100 377 399.5 5.256
101 385 401.4 5.256
102 388 402.3 5.256
103 389 402.6 5.256
104 390 402.9 5.256
105 391 403.2 5.256
106 392 403.5 5.256
107 395 404.4 5.256
108 397 405 5.256
109 398 405.3 5.256
110 402 406.5 5.256
111 404 407.1 5.256
112 405 407.4 5.256
113 406 407.6 5.256
114 409 408.2 5.256
115 411 408.6 5.256
116 419 410.2 5.256
117 420 410.5 5.256
118 425 411.5 5.256
119 426 411.7 5.256
120 434 413.3 5.256
121 440 414.5 5.256
122 447 415.9 5.256
123 455 417.5 5.256
124 461 418.7 5.256
125 468 420 5.256

2091
3_SP-68_Rev.4_Test.svg Normal file

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 68 KiB

128
3_SP-68_Test.csv Normal file
View File

@ -0,0 +1,128 @@
Time,Settle,Surcharge
0,0,1.887
3,41,1.887
6,61.5,1.887
10,73.1,1.887
13,81.6,1.887
17,86.9,1.887
20,91.9,1.887
23,96.7,1.887
26,101.6,1.887
30,107.7,2.94
33,113,2.94
37,119.4,2.94
40,122.8,2.94
44,128.4,2.94
47,131.9,2.94
52,139.5,2.94
54,140.5,2.94
59,148,2.94
62,151,2.94
65,153.8,2.94
68,156.6,2.94
72,160,2.94
75,162.5,2.94
79,166,2.94
83,169.1,2.94
86,172,2.94
89,174.7,2.94
94,180.3,2.94
96,182.1,2.94
100,185.5,2.94
103,188.4,2.94
110,195.8,2.94
114,198.7,2.94
118,201.1,2.94
122,205,2.94
125,206.9,2.94
128,209.3,2.94
131,211.8,2.94
135,214.2,2.94
138,216.2,2.94
143,217.4,2.94
146,218.3,2.94
150,219.1,2.94
153,219.9,2.94
156,220.9,2.94
159,222,2.94
164,227.7,2.94
167,230.7,2.94
171,234.8,3.48
173,236.5,3.48
177,239.7,3.48
180,241.8,3.48
184,243.9,3.48
187,246.3,3.48
191,249.6,3.48
194,252.1,3.48
198,255.5,3.48
201,258.9,3.48
205,261.2,3.48
208,263.4,3.48
212,265.8,3.48
215,267.1,3.48
219,268.9,3.48
222,270.2,3.48
227,273.4,3.48
229,275,3.48
234,277.3,3.48
237,278.1,3.48
241,280,3.48
244,281.2,3.48
248,283.2,3.48
251,284.6,3.48
254,286.1,3.48
257,287.5,3.48
262,289.5,3.48
265,290.7,3.48
268,292,3.48
271,293.2,3.48
275,294.7,3.48
278,295.3,3.48
282,296.3,3.48
285,296.7,3.48
289,297.6,3.48
292,298.5,3.48
296,299.8,3.48
299,300.6,3.48
303,302.2,3.48
306,303.5,3.48
310,312.8,5.608
313,318.1,5.608
317,322.8,6.794
320,328.9,6.794
324,335.3,6.794
328,340.5,6.794
331,342.9,6.794
334,345.5,6.794
339,348,6.794
342,350.6,6.794
345,353.1,6.794
348,355.6,6.794
352,358.9,6.794
355,361,6.794
362,365.6,6.794
367,369,6.794
370,370.5,6.794
373,372.2,6.794
376,373.8,6.794
381,376.4,6.794
384,378.5,6.794
387,380.4,6.794
390,382.4,6.794
394,385.8,6.794
397,388,6.794
402,389.9,6.794
405,390.9,6.794
409,392.6,6.794
412,394,6.794
415,396.7,6.794
418,397.5,6.794
422,398.7,6.794
425,399.1,6.794
429,399.8,6.794
432,400.9,6.794
436,403.6,6.794
439,405.6,6.794
443,408.2,6.794
446,409.4,6.794
1 Time Settle Surcharge
2 0 0 1.887
3 3 41 1.887
4 6 61.5 1.887
5 10 73.1 1.887
6 13 81.6 1.887
7 17 86.9 1.887
8 20 91.9 1.887
9 23 96.7 1.887
10 26 101.6 1.887
11 30 107.7 2.94
12 33 113 2.94
13 37 119.4 2.94
14 40 122.8 2.94
15 44 128.4 2.94
16 47 131.9 2.94
17 52 139.5 2.94
18 54 140.5 2.94
19 59 148 2.94
20 62 151 2.94
21 65 153.8 2.94
22 68 156.6 2.94
23 72 160 2.94
24 75 162.5 2.94
25 79 166 2.94
26 83 169.1 2.94
27 86 172 2.94
28 89 174.7 2.94
29 94 180.3 2.94
30 96 182.1 2.94
31 100 185.5 2.94
32 103 188.4 2.94
33 110 195.8 2.94
34 114 198.7 2.94
35 118 201.1 2.94
36 122 205 2.94
37 125 206.9 2.94
38 128 209.3 2.94
39 131 211.8 2.94
40 135 214.2 2.94
41 138 216.2 2.94
42 143 217.4 2.94
43 146 218.3 2.94
44 150 219.1 2.94
45 153 219.9 2.94
46 156 220.9 2.94
47 159 222 2.94
48 164 227.7 2.94
49 167 230.7 2.94
50 171 234.8 3.48
51 173 236.5 3.48
52 177 239.7 3.48
53 180 241.8 3.48
54 184 243.9 3.48
55 187 246.3 3.48
56 191 249.6 3.48
57 194 252.1 3.48
58 198 255.5 3.48
59 201 258.9 3.48
60 205 261.2 3.48
61 208 263.4 3.48
62 212 265.8 3.48
63 215 267.1 3.48
64 219 268.9 3.48
65 222 270.2 3.48
66 227 273.4 3.48
67 229 275 3.48
68 234 277.3 3.48
69 237 278.1 3.48
70 241 280 3.48
71 244 281.2 3.48
72 248 283.2 3.48
73 251 284.6 3.48
74 254 286.1 3.48
75 257 287.5 3.48
76 262 289.5 3.48
77 265 290.7 3.48
78 268 292 3.48
79 271 293.2 3.48
80 275 294.7 3.48
81 278 295.3 3.48
82 282 296.3 3.48
83 285 296.7 3.48
84 289 297.6 3.48
85 292 298.5 3.48
86 296 299.8 3.48
87 299 300.6 3.48
88 303 302.2 3.48
89 306 303.5 3.48
90 310 312.8 5.608
91 313 318.1 5.608
92 317 322.8 6.794
93 320 328.9 6.794
94 324 335.3 6.794
95 328 340.5 6.794
96 331 342.9 6.794
97 334 345.5 6.794
98 339 348 6.794
99 342 350.6 6.794
100 345 353.1 6.794
101 348 355.6 6.794
102 352 358.9 6.794
103 355 361 6.794
104 362 365.6 6.794
105 367 369 6.794
106 370 370.5 6.794
107 373 372.2 6.794
108 376 373.8 6.794
109 381 376.4 6.794
110 384 378.5 6.794
111 387 380.4 6.794
112 390 382.4 6.794
113 394 385.8 6.794
114 397 388 6.794
115 402 389.9 6.794
116 405 390.9 6.794
117 409 392.6 6.794
118 412 394 6.794
119 415 396.7 6.794
120 418 397.5 6.794
121 422 398.7 6.794
122 425 399.1 6.794
123 429 399.8 6.794
124 432 400.9 6.794
125 436 403.6 6.794
126 439 405.6 6.794
127 443 408.2 6.794
128 446 409.4 6.794

184
main_Rev.4.py Normal file
View File

@ -0,0 +1,184 @@
# =================
# Import 섹션
# =================
import numpy as np
from scipy.optimize import least_squares
import matplotlib.pyplot as plt
from matplotlib import rcParams
import pandas as pd
# =================
# Function 섹션
# =================
# 주어진 계수를 이용하여 쌍곡선 시간-침하 곡선 반환
def generate_data_hyper(px, pt):
return pt / (px[0] * pt + px[1])
# 회귀식과 측정치와의 잔차 반환 (비선형 쌍곡선)
def fun_hyper_nonlinear(px, pt, py):
return pt / (px[0] * pt + px[1]) - py
# =================
# Step별 활용 Function
# =================
# i단계 보정 침하량 산정
def fun_step_measured_correction(m, p):
return m - p
# i단계 t-ti 산정
def fun_step_time_correction(t, ti):
return t - ti
# i단계 침하곡선 작성
def settlement_prediction_curve(m1, p1):
return m1 + p1
# i단계 보정 예측 침하량 산정
def fun_step_prediction_correction(m2, p2):
return p2 + (m2[0] - p2[0])
# =================
# 입력값 설정
# =================
# CSV 파일 읽기
data = pd.read_csv("3_SP-68_Test.csv")
# 시간, 침하량, 성토고 배열 생성
time = data['Time'].to_numpy()
settle = data['Settle'].to_numpy()
surcharge = data['Surcharge'].to_numpy()
# =================
# 성토 단계 구분
# =================
step_start_index = [0, 9, 49, 90] # 단계별 성토 시작 지점 입력(4단계 이므로 4개)
step_end_index = [8, 48, 89, 129] # 단계별 성토 종료 지점 입력(4단계 이므로 4개)
x0 = np.ones(2)
num_step = 4
for i in range(0, num_step): # 성토 단계에 따라 수정(4단계 이므로 0~4)
# i단계 실측 기간 및 침하량
globals()['tm_{}'.format(i)] = time[step_start_index[i]:step_end_index[i]]
globals()['ym_{}'.format(i)] = settle[step_start_index[i]:step_end_index[i]]
if i == 0 : # 1단계
res_lsq_hyper_nonlinear_0 = least_squares(fun_hyper_nonlinear, x0, args=(tm_0, ym_0))
print(res_lsq_hyper_nonlinear_0.x)
globals()['settle_predicted_{}'.format(i)] = generate_data_hyper(res_lsq_hyper_nonlinear_0.x, time)
elif 0 < i < (num_step - 1):
# i단계~최종 실측 기간 및 침하량
globals()['tmm_{}'.format(i)] = time[step_start_index[i]:step_end_index[-1]]
globals()['ymm_{}'.format(i)] = settle[step_start_index[i]:step_end_index[-1]]
# i-1단계 예측 침하량(i단계 기간에 해당하는)
globals()['yp_{}'.format(i)] = globals()['settle_predicted_{}'.format(i - 1)][(step_start_index[i]-step_start_index[i-1]):(step_end_index[i]-step_start_index[i-1])]
# i-1 단계 예측 침하량 (i단계~최종)
globals()['ypp_{}'.format(i)] = globals()['settle_predicted_{}'.format(i - 1)][(step_start_index[i]-step_start_index[i-1]):(step_end_index[-1]-step_start_index[i-1])]
# i단계 실측 보정 침하량 산정
globals()['step_{}_measured_correction'.format(i)] = fun_step_measured_correction(globals()['ym_{}'.format(i)],globals()['yp_{}'.format(i)])
# i단계 t-ti 산정
globals()['step_{}_time_correction'.format(i)] = fun_step_time_correction(globals()['tmm_{}'.format(i)],
globals()['tm_{}'.format(i)][0])
# i 단계 보정 침하량에 대한 예측 침하량 산정
globals()['res_lsq_hyper_nonlinear_{}'.format(i)] = least_squares(fun_hyper_nonlinear, x0,
args=(globals()['step_{}_time_correction'.format(i)][0:(step_end_index[i]-step_start_index[i])],
globals()['step_{}_measured_correction'.format(i)]))
print(globals()['res_lsq_hyper_nonlinear_{}'.format(i)].x)
globals()['settle_hyper_nonlinear_{}'.format(i)] = generate_data_hyper(globals()['res_lsq_hyper_nonlinear_{}'.format(i)].x,
globals()['step_{}_time_correction'.format(i)])
# i단계 침하곡선 작성
globals()['step_{}_prediction_curve'.format(i)] = settlement_prediction_curve(globals()['settle_hyper_nonlinear_{}'.format(i)],
globals()['ypp_{}'.format(i)])
# i단계 보정 예측 침하량 산정
globals()['settle_predicted_{}'.format(i)] = fun_step_prediction_correction(globals()['ymm_{}'.format(i)],
globals()['step_{}_prediction_curve'.format(i)])
else: # 최종 성토 단계
# i-1 단계 예측 침하량 (최종 단계에 해당하는)
globals()['yp_{}'.format(i)] = globals()['settle_predicted_{}'.format(i - 1)][(step_start_index[i]-step_start_index[i-1]):step_end_index[i]]
# 최종 단계 실측 보정 침하량 산정
globals()['step_{}_measured_correction'.format(i)] = fun_step_measured_correction(globals()['ym_{}'.format(i)],
globals()['yp_{}'.format(i)])
# 최종 단계 t-ti 산정
globals()['step_{}_time_correction'.format(i)] = fun_step_time_correction(globals()['tm_{}'.format(i)],
globals()['tm_{}'.format(i)][0])
# 최종 단계 보정 침하량에 대한 예측 침하량 산정
globals()['res_lsq_hyper_nonlinear_{}'.format(i)] = least_squares(fun_hyper_nonlinear, x0,
args=(globals()['step_{}_time_correction'.format(i)],
globals()['step_{}_measured_correction'.format(i)]))
print(globals()['res_lsq_hyper_nonlinear_{}'.format(i)].x)
globals()['settle_hyper_nonlinear_{}'.format(i)] = generate_data_hyper(globals()['res_lsq_hyper_nonlinear_{}'.format(i)].x,
globals()['step_{}_time_correction'.format(i)])
# 최종 단계 침하곡선 작성
globals()['step_{}_prediction_curve'.format(i)] = settlement_prediction_curve(globals()['settle_hyper_nonlinear_{}'.format(i)],
globals()['yp_{}'.format(i)])
# 최종단계 보정 예측 침하량 산정
globals()['settle_predicted_{}'.format(i)] = fun_step_prediction_correction(globals()['ym_{}'.format(i)],
globals()['step_{}_prediction_curve'.format(i)])
'''
나중에: 그래프 작성
'''
# 그래프 크기, 서브 그래프 개수 및 비율 설정
f, axes = plt.subplots(2,1, figsize=(10, 10),
gridspec_kw={'height_ratios':[1,2]})
# 성토고 그래프 표시
axes[0].plot(time, surcharge, color='black', label='surcharge height')
axes[0].set_ylabel("Surcharge height (m)", fontsize = 17)
axes[0].set_xlim(left = 0)
axes[0].grid(color="gray", alpha=.5, linestyle='--')
axes[0].tick_params(direction='in')
# 계측 침하량 표시
axes[1].scatter(time, -settle, s = 50, facecolors='white', edgecolors='black', label = 'measured data')
# 예측 침하량 표시
axes[1].plot(time, -settle_predicted_0, linestyle='--', color='red', label='Predicted Curve_Step 1')
axes[1].plot(tmm_1, -settle_predicted_1, linestyle='--', color='blue', label='Predicted Curve_Step 2')
axes[1].plot(tmm_2, -settle_predicted_2, linestyle='--', color='green', label='Predicted Curve_Step 3')
axes[1].plot(tm_3, -settle_predicted_3, linestyle='--', color='orange', label='Predicted Curve_Step 4')
# 예측 침하량 그래프 설정
axes[1].set_xlabel("Time (day)", fontsize = 17)
axes[1].set_ylabel("Settlement (mm)", fontsize = 17)
axes[1].set_ylim(top = 0)
axes[1].set_ylim(bottom = -1.5 * settle.max())
axes[1].set_xlim(left = 0)
# 범례 표시
axes[1].legend(loc=1, ncol=2, frameon=True, fontsize=12)
# 그래프 저장 및 출력
plt.savefig('3_SP-68_Rev.4_Test.svg', dpi=300)
plt.show()

2042
main_Rev.4.svg Normal file

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 66 KiB