Commit 2bd8e7707713f2705b8d421467ea3274d13deeb4

Authored by yuhang
1 parent f48b4c76

优化函数,添加注释

cal_gate.c
@@ -7,14 +7,14 @@ @@ -7,14 +7,14 @@
7 7
8 8
9 typedef enum { 9 typedef enum {
10 - gate_full_open_with_free_flow, /*A*/  
11 - gate_full_open_with_submerged_flow, /*B*/  
12 - gate_control_with_free_flow, /*C*/  
13 - gate_control_with_submerged_flow, /*D*/  
14 - gate_full_open_with_free_flow_drop_step, /*E*/  
15 - gate_full_open_with_submerged_flow_drop_step, /*F*/  
16 - gate_control_with_free_flow_drop_step, /*G*/  
17 - gate_control_with_submerged_flow_drop_step /*H*/ 10 + gate_full_open_with_free_flow, /*A 闸门全开自由流*/
  11 + gate_full_open_with_submerged_flow, /*B 闸门全开淹没流*/
  12 + gate_control_with_free_flow, /*C 闸门控制自由流*/
  13 + gate_control_with_submerged_flow, /*D 闸门控制淹没流*/
  14 + gate_full_open_with_free_flow_drop_step, /*E 闸门全开自由流 有跌槛*/
  15 + gate_full_open_with_submerged_flow_drop_step, /*F 闸门全开淹没流 有跌槛*/
  16 + gate_control_with_free_flow_drop_step, /*G 闸门控制自由流 有跌槛*/
  17 + gate_control_with_submerged_flow_drop_step /*H 闸门控制淹没流 有跌槛*/
18 }patterns_of_water; 18 }patterns_of_water;
19 19
20 enum { 20 enum {
@@ -23,10 +23,10 @@ enum { @@ -23,10 +23,10 @@ enum {
23 }; 23 };
24 24
25 enum{ 25 enum{
26 - warped_wingwall=1,  
27 - flat_wingwall,  
28 - eight_c_wingwall,  
29 - parallel_wingwall 26 + warped_wingwall=1, /*弯曲墙面*/
  27 + flat_wingwall, /*平整墙面*/
  28 + eight_c_wingwall, /*八字墙面*/
  29 + parallel_wingwall /*平行墙面*/
30 }; 30 };
31 31
32 struct A{ 32 struct A{
@@ -85,9 +85,10 @@ typedef struct total{ @@ -85,9 +85,10 @@ typedef struct total{
85 85
86 86
87 87
88 -  
89 -  
90 - 88 +/*
  89 + *几种墙面分别对应的系数
  90 + *
  91 +*/
91 coefficient_infor coefficient={.A.m_warped_wingwall=0.325, .A.m_warped_wingwall_ds=0.380, .A.m_flat_wingwall=0.310, .A.m_flat_wingwall_ds=0.365,\ 92 coefficient_infor coefficient={.A.m_warped_wingwall=0.325, .A.m_warped_wingwall_ds=0.380, .A.m_flat_wingwall=0.310, .A.m_flat_wingwall_ds=0.365,\
92 .A.m_eight_c_wingwall=0.330, .A.m_eight_c_wingwall_ds=0.390, .A.m_parallel_wingwall=0.295, .A.m_parallel_wingwall_ds=0.355,\ 93 .A.m_eight_c_wingwall=0.330, .A.m_eight_c_wingwall_ds=0.390, .A.m_parallel_wingwall=0.295, .A.m_parallel_wingwall_ds=0.355,\
93 .B.fai_warped_wingwall=0.850,.B.fai_flat_wingwall=0.825, .B.fai_eight_c_wingwall=0.860,.B.fai_parallel_wingwall=0.795,\ 94 .B.fai_warped_wingwall=0.850,.B.fai_flat_wingwall=0.825, .B.fai_eight_c_wingwall=0.860,.B.fai_parallel_wingwall=0.795,\
@@ -100,10 +101,10 @@ coefficient_infor coefficient={.A.m_warped_wingwall=0.325, .A.m_warped_wingwall @@ -100,10 +101,10 @@ coefficient_infor coefficient={.A.m_warped_wingwall=0.325, .A.m_warped_wingwall
100 101
101 102
102 /* 103 /*
103 - *  
104 - *  
105 - *  
106 - * 104 + *函数名: data_validity_check()
  105 + *参数: *param
  106 + *功能: 检查传入的参数是否是有效参数
  107 + *返回值: 0表示参数是合法的,非0表示不合法
107 * 108 *
108 */ 109 */
109 char data_validity_check(struct param_gate *param) 110 char data_validity_check(struct param_gate *param)
@@ -136,10 +137,13 @@ char data_validity_check(struct param_gate *param) @@ -136,10 +137,13 @@ char data_validity_check(struct param_gate *param)
136 } 137 }
137 138
138 /* 139 /*
139 - *  
140 - *  
141 - *  
142 - * 140 + *函数名: discrimination_of_flow_pattern()
  141 + *参数: openning_height_of_gate 开闸高度
  142 + * water_depth_front_of_gate 闸前水位
  143 + * water_depth_behind_of_gate 闸后水位
  144 + * drop_step 跌槛
  145 + *功能: 根据以上参数,判断出是那个水流模型
  146 + *返回值: 水流模型
143 * 147 *
144 */ 148 */
145 149
@@ -169,12 +173,38 @@ patterns_of_water discrimination_of_flow_pattern(double openning_height_of_gate, @@ -169,12 +173,38 @@ patterns_of_water discrimination_of_flow_pattern(double openning_height_of_gate,
169 } 173 }
170 174
171 175
  176 +struct datas{
  177 + double original_data_front;
  178 + double original_data_after;
  179 + double value;
  180 +};
  181 +
  182 +struct datas table[46]={{0.00,0.05,1.00},{0.05,0.15,0.990},{0.15,0.25,0.980},{0.25,0.35,0.970},{0.35,0.45,0.956},{0.45,0.475,0.947},{0.475,0.525,0.937},{0.525,0.575,0.925},\
  183 + {0.575,0.625,0.907},{0.625,0.675,0.885},{0.675,0.710,0.856},{0.710,0.730,0.843},{0.730,0.750,0.828},{0.750,0.770,0.813},{0.770,0.790,0.800},{0.790,0.805,0.778},\
  184 + {0.805,0.815,0.767},{0.815,0.825,0.755},{0.825,0.835,0.742},{0.835,0.845,0.728},{0.845,0.855,0.713},{0.855,0.865,0.698},{0.865,0.875,0.681},{0.875,0.885,0.662},\
  185 + {0.885,0.895,0.642},{0.895,0.9025,0.621},{0.9025,0.9075,0.608},{0.9075,0.9125,0.595},{0.9125,0.9175,0.580},{0.9175,0.9225,0.565},{0.9225,0.9275,0.549},\
  186 + {0.9275,0.9325,0.532},{0.9325,0.9375,0.514},{0.9375,0.9425,0.484},{0.9425,0.9475,0.473},{0.9475,0.9525,0.450},{0.9525,0.9575,0.427},{0.9575,0.9625,0.403},\
  187 + {0.9625,0.9675,0.375},{0.9675,0.9725,0.344},{0.9725,0.9775,0.318},{0.9775,0.9825,0.267},{0.9825,0.9875,0.225},{0.9875,0.9925,0.175},{0.9925,0.9975,0.115},\
  188 + {0.9975,1.0000,0.000}
  189 +};
  190 +
  191 +double find(double target)
  192 +{
  193 + int i=0;
  194 + for(i=0;i<46;i++)
  195 + {
  196 + if(target>=table[i].original_data_front && target<table[i].original_data_after)
  197 + return table[i].value;
  198 + }
  199 + return 0;
  200 +}
172 201
173 /* 202 /*
174 - *  
175 - *  
176 - *  
177 - * 203 + *函数名: get_coefficient_rou()
  204 + *参数: water_depth_front_of_gate
  205 + * water_depth_behind_of_gate
  206 + *功能: 根据闸前闸后水位,获取ρ
  207 + *返回值: ρ的值
178 * 208 *
179 */ 209 */
180 double get_coefficient_rou(double water_depth_front_of_gate,double water_depth_behind_of_gate) 210 double get_coefficient_rou(double water_depth_front_of_gate,double water_depth_behind_of_gate)
@@ -182,107 +212,19 @@ double get_coefficient_rou(double water_depth_front_of_gate,double water_depth_b @@ -182,107 +212,19 @@ double get_coefficient_rou(double water_depth_front_of_gate,double water_depth_b
182 double s; 212 double s;
183 213
184 s=water_depth_behind_of_gate/water_depth_front_of_gate; 214 s=water_depth_behind_of_gate/water_depth_front_of_gate;
185 -  
186 - if(s>=0.00 && s<0.05)  
187 - return 1.00;  
188 - else if(s>=0.06 && s<0.15)  
189 - return 0.990;  
190 - else if(s>=0.15 && s<0.25)  
191 - return 0.980;  
192 - else if(s>=0.25 && s<0.35)  
193 - return 0.970;  
194 - else if(s>=0.35 && s<0.45)  
195 - return 0.956;  
196 - else if(s>=0.45 && s<0.475)  
197 - return 0.947;  
198 - else if(s>=0.475 && s<0.525)  
199 - return 0.937;  
200 - else if(s>=0.525 && s<0.575)  
201 - return 0.925;  
202 - else if(s>=0.575 && s<0.625)  
203 - return 0.907;  
204 - else if(s>=0.625 && s<0.675)  
205 - return 0.885;  
206 - else if(s>=0.675 && s<0.710)  
207 - return 0.856;  
208 - else if(s>=0.710 && s<0.730)  
209 - return 0.843;  
210 - else if(s>=0.730 && s<0.750)  
211 - return 0.828;  
212 - else if(s>=0.750 && s<0.770)  
213 - return 0.813;  
214 - else if(s>=0.770 && s<0.790)  
215 - return 0.800;  
216 - else if(s>=0.790 && s<0.805)  
217 - return 0.778;  
218 - else if(s>=0.805 && s<0.815)  
219 - return 0.767;  
220 - else if(s>=0.815 && s<0.825)  
221 - return 0.755;  
222 - else if(s>=0.825 && s<0.835)  
223 - return 0.742;  
224 - else if(s>=0.835 && s<0.845)  
225 - return 0.728;  
226 - else if(s>=0.845 && s<0.855)  
227 - return 0.713;  
228 - else if(s>=0.855 && s<0.865)  
229 - return 0.698;  
230 - else if(s>=0.865 && s<0.875)  
231 - return 0.681;  
232 - else if(s>=0.875 && s<0.885)  
233 - return 0.662;  
234 - else if(s>=0.885 && s<0.895)  
235 - return 0.642;  
236 - else if(s>=0.895 && s<0.9025)  
237 - return 0.621;  
238 - else if(s>=0.9025 && s<0.9075)  
239 - return 0.608;  
240 - else if(s>=0.9075 && s<0.9125)  
241 - return 0.595;  
242 - else if(s>=0.9125 && s<0.9175)  
243 - return 0.580;  
244 - else if(s>=0.9175 && s<0.9225)  
245 - return 0.565;  
246 - else if(s>=0.9225 && s<0.9275)  
247 - return 0.549;  
248 - else if(s>=0.9275 && s<0.9325)  
249 - return 0.532;  
250 - else if(s>=0.9325 && s<0.9375)  
251 - return 0.514;  
252 - else if(s>=0.9375 && s<0.9425)  
253 - return 0.484;  
254 - else if(s>=0.9425 && s<0.9475)  
255 - return 0.473;  
256 - else if(s>=0.9475 && s<0.9525)  
257 - return 0.450;  
258 - else if(s>=0.9525 && s<0.9575)  
259 - return 0.427;  
260 - else if(s>=0.9575 && s<0.9625)  
261 - return 0.403;  
262 - else if(s>=0.9625 && s<0.9675)  
263 - return 0.375;  
264 - else if(s>=0.9675 && s<0.9725)  
265 - return 0.344;  
266 - else if(s>=0.9725 && s<0.9775)  
267 - return 0.318;  
268 - else if(s>=0.9775 && s<0.9825)  
269 - return 0.267;  
270 - else if(s>=0.9825 && s<0.9875)  
271 - return 0.225;  
272 - else if(s>=0.9875 && s<0.9925)  
273 - return 0.175;  
274 - else if(s>=0.9925 && s<0.9975)  
275 - return 0.115;  
276 - else if(s>=0.9975 && s<1.000)  
277 - return 0.000; 215 + return find(s);
278 } 216 }
279 217
280 218
281 /* 219 /*
282 - *  
283 - *  
284 - *  
285 - * 220 + *函数名: cal_gate_full_open_with_free_flow()
  221 + *参数: water_depth_front_of_gate 闸前水深
  222 + * water_depth_behind_of_gate 闸后水深
  223 + * gate_width 闸门宽度
  224 + * wingwall 翼墙类型
  225 + * ds 跌槛
  226 + *功能: 根据参数,计算出闸门全开自由流模型下的瞬时流量
  227 + *返回值: 瞬时流量
286 * 228 *
287 */ 229 */
288 230
@@ -319,6 +261,17 @@ double cal_gate_full_open_with_free_flow(double water_depth_front_of_gate,double @@ -319,6 +261,17 @@ double cal_gate_full_open_with_free_flow(double water_depth_front_of_gate,double
319 return instantaneousFlow; 261 return instantaneousFlow;
320 } 262 }
321 263
  264 +/*
  265 + *函数名: cal_gate_full_open_with_submerged_flow()
  266 + *参数: water_depth_front_of_gate 闸前水深
  267 + * water_depth_behind_of_gate 闸后水深
  268 + * gate_width 闸门宽度
  269 + * wingwall 翼墙类型
  270 + * ds 跌槛
  271 + *功能: 根据参数,计算出闸门全开淹没流模型下的瞬时流量
  272 + *返回值: 瞬时流量
  273 + *
  274 +*/
322 double cal_gate_full_open_with_submerged_flow(double water_depth_front_of_gate,double water_depth_behind_of_gate,double gate_width,int wingwall,int ds) 275 double cal_gate_full_open_with_submerged_flow(double water_depth_front_of_gate,double water_depth_behind_of_gate,double gate_width,int wingwall,int ds)
323 { 276 {
324 double instantaneousFlow; 277 double instantaneousFlow;
@@ -356,6 +309,18 @@ double cal_gate_full_open_with_submerged_flow(double water_depth_front_of_gate,d @@ -356,6 +309,18 @@ double cal_gate_full_open_with_submerged_flow(double water_depth_front_of_gate,d
356 return instantaneousFlow; 309 return instantaneousFlow;
357 } 310 }
358 311
  312 +/*
  313 + *函数名: cal_gate_control_with_free_flow()
  314 + *参数: water_depth_front_of_gate 闸前水深
  315 + * water_depth_behind_of_gate 闸后水深
  316 + * height_of_gate 闸门开启高度
  317 + * gate_width 闸门宽度
  318 + * wingwall 翼墙类型
  319 + * ds 跌槛
  320 + *功能: 根据参数,计算出闸门控制自由流模型下的瞬时流量
  321 + *返回值: 瞬时流量
  322 + *
  323 +*/
359 double cal_gate_control_with_free_flow(double water_depth_front_of_gate,double water_depth_behind_of_gate,double height_of_gate,double gate_width,int wingwall,int ds) 324 double cal_gate_control_with_free_flow(double water_depth_front_of_gate,double water_depth_behind_of_gate,double height_of_gate,double gate_width,int wingwall,int ds)
360 { 325 {
361 double instantaneousFlow; 326 double instantaneousFlow;
@@ -389,6 +354,18 @@ double cal_gate_control_with_free_flow(double water_depth_front_of_gate,double w @@ -389,6 +354,18 @@ double cal_gate_control_with_free_flow(double water_depth_front_of_gate,double w
389 return instantaneousFlow; 354 return instantaneousFlow;
390 } 355 }
391 356
  357 +/*
  358 + *函数名: cal_gate_control_with_submerged_flow()
  359 + *参数: water_depth_front_of_gate 闸前水深
  360 + * water_depth_behind_of_gate 闸后水深
  361 + * height_of_gate 闸门开启高度
  362 + * gate_width 闸门宽度
  363 + * wingwall 翼墙类型
  364 + * ds 跌槛
  365 + *功能: 根据参数,计算出闸门控制淹没流模型下的瞬时流量
  366 + *返回值: 瞬时流量
  367 + *
  368 +*/
392 double cal_gate_control_with_submerged_flow(double water_depth_front_of_gate,double water_depth_behind_of_gate,double height_of_gate,double gate_width,int wingwall,int ds) 369 double cal_gate_control_with_submerged_flow(double water_depth_front_of_gate,double water_depth_behind_of_gate,double height_of_gate,double gate_width,int wingwall,int ds)
393 { 370 {
394 double instantaneousFlow; 371 double instantaneousFlow;
@@ -423,59 +400,22 @@ double cal_gate_control_with_submerged_flow(double water_depth_front_of_gate,dou @@ -423,59 +400,22 @@ double cal_gate_control_with_submerged_flow(double water_depth_front_of_gate,dou
423 } 400 }
424 401
425 402
426 -/*  
427 - *  
428 - *  
429 - *  
430 - *  
431 - *  
432 -*/  
433 -#if 0  
434 -double Calculation_of_InstantaneousFlow(double openning_height_of_gate, double water_depth_front_of_gate,double water_depth_behind_of_gate,double gate_width,int wingwall,int drop_step)  
435 -{  
436 - patterns_of_water get_pattern;  
437 - double temp;  
438 403
439 - get_pattern = discrimination_of_flow_pattern(openning_height_of_gate,water_depth_front_of_gate,water_depth_behind_of_gate,drop_step);  
440 - switch(get_pattern){  
441 - case gate_full_open_with_free_flow:  
442 - temp = cal_gate_full_open_with_free_flow(water_depth_front_of_gate,gate_width,wingwall,drop_step);  
443 - break;  
444 - case gate_full_open_with_submerged_flow:  
445 - temp = cal_gate_full_open_with_submerged_flow(water_depth_front_of_gate,water_depth_behind_of_gate,gate_width,wingwall,drop_step);  
446 - break;  
447 - case gate_control_with_free_flow:  
448 - temp = cal_gate_control_with_free_flow(water_depth_front_of_gate,water_depth_behind_of_gate,openning_height_of_gate,gate_width,wingwall,drop_step);  
449 - break;  
450 - case gate_control_with_submerged_flow:  
451 - temp = cal_gate_control_with_submerged_flow(water_depth_front_of_gate,water_depth_behind_of_gate,openning_height_of_gate,gate_width,wingwall,drop_step);  
452 - break;  
453 - case gate_full_open_with_free_flow_drop_step:  
454 - temp = cal_gate_full_open_with_free_flow(water_depth_front_of_gate,gate_width,wingwall,drop_step);  
455 - break;  
456 - case gate_full_open_with_submerged_flow_drop_step:  
457 - temp = cal_gate_full_open_with_submerged_flow(water_depth_front_of_gate,water_depth_behind_of_gate,gate_width,wingwall,drop_step);  
458 - break;  
459 - case gate_control_with_free_flow_drop_step:  
460 - temp = cal_gate_control_with_free_flow(water_depth_front_of_gate,water_depth_behind_of_gate,openning_height_of_gate,gate_width,wingwall,drop_step);  
461 - break;  
462 - case gate_control_with_submerged_flow_drop_step:  
463 - temp = cal_gate_control_with_submerged_flow(water_depth_front_of_gate,water_depth_behind_of_gate,openning_height_of_gate,gate_width,wingwall,drop_step);  
464 - break;  
465 - }  
466 - return temp;  
467 -}  
468 -#endif  
469 404
470 405
471 406
472 407
473 -//double openning_height_of_gate, double water_depth_front_of_gate,double water_depth_behind_of_gate,double gate_width,int wingwall,int drop_step 408 +/*
  409 + *函数名: Calculation_of_InstantaneousFlow()
  410 + *参数: *param 指向struct param_gate的指针
  411 + *
  412 + *功能: 根据参数,计算出瞬时流量
  413 + *返回值: 瞬时流量
  414 + *
  415 +*/
474 int Calculation_of_InstantaneousFlow(double *value,struct param_gate *param) 416 int Calculation_of_InstantaneousFlow(double *value,struct param_gate *param)
475 { 417 {
476 patterns_of_water get_pattern; 418 patterns_of_water get_pattern;
477 -  
478 - double temp;  
479 419
480 if(data_validity_check(param)!=0) 420 if(data_validity_check(param)!=0)
481 return -1; 421 return -1;
@@ -483,35 +423,34 @@ int Calculation_of_InstantaneousFlow(double *value,struct param_gate *param) @@ -483,35 +423,34 @@ int Calculation_of_InstantaneousFlow(double *value,struct param_gate *param)
483 get_pattern = discrimination_of_flow_pattern(param->openning_height_of_gate,param->water_depth_front_of_gate,param->water_depth_behind_of_gate,param->drop_step); 423 get_pattern = discrimination_of_flow_pattern(param->openning_height_of_gate,param->water_depth_front_of_gate,param->water_depth_behind_of_gate,param->drop_step);
484 switch(get_pattern){ 424 switch(get_pattern){
485 case gate_full_open_with_free_flow: 425 case gate_full_open_with_free_flow:
486 - temp = cal_gate_full_open_with_free_flow(param->water_depth_front_of_gate,param->gate_width,param->wingwall,param->drop_step); 426 + *value = cal_gate_full_open_with_free_flow(param->water_depth_front_of_gate,param->gate_width,param->wingwall,param->drop_step);
487 break; 427 break;
488 case gate_full_open_with_submerged_flow: 428 case gate_full_open_with_submerged_flow:
489 - temp = cal_gate_full_open_with_submerged_flow(param->water_depth_front_of_gate,param->water_depth_behind_of_gate,param->gate_width,param->wingwall,param->drop_step); 429 + *value = cal_gate_full_open_with_submerged_flow(param->water_depth_front_of_gate,param->water_depth_behind_of_gate,param->gate_width,param->wingwall,param->drop_step);
490 break; 430 break;
491 case gate_control_with_free_flow: 431 case gate_control_with_free_flow:
492 - temp = cal_gate_control_with_free_flow(param->water_depth_front_of_gate,param->water_depth_behind_of_gate,\ 432 + *value = cal_gate_control_with_free_flow(param->water_depth_front_of_gate,param->water_depth_behind_of_gate,\
493 param->openning_height_of_gate,param->gate_width,param->wingwall,param->drop_step); 433 param->openning_height_of_gate,param->gate_width,param->wingwall,param->drop_step);
494 break; 434 break;
495 case gate_control_with_submerged_flow: 435 case gate_control_with_submerged_flow:
496 - temp = cal_gate_control_with_submerged_flow(param->water_depth_front_of_gate,param->water_depth_behind_of_gate,\ 436 + *value = cal_gate_control_with_submerged_flow(param->water_depth_front_of_gate,param->water_depth_behind_of_gate,\
497 param->openning_height_of_gate,param->gate_width,param->wingwall,param->drop_step); 437 param->openning_height_of_gate,param->gate_width,param->wingwall,param->drop_step);
498 break; 438 break;
499 case gate_full_open_with_free_flow_drop_step: 439 case gate_full_open_with_free_flow_drop_step:
500 - temp = cal_gate_full_open_with_free_flow(param->water_depth_front_of_gate,param->gate_width,param->wingwall,param->drop_step); 440 + *value = cal_gate_full_open_with_free_flow(param->water_depth_front_of_gate,param->gate_width,param->wingwall,param->drop_step);
501 break; 441 break;
502 case gate_full_open_with_submerged_flow_drop_step: 442 case gate_full_open_with_submerged_flow_drop_step:
503 - temp = cal_gate_full_open_with_submerged_flow(param->water_depth_front_of_gate,param->water_depth_behind_of_gate,param->gate_width,param->wingwall,param->drop_step); 443 + *value = cal_gate_full_open_with_submerged_flow(param->water_depth_front_of_gate,param->water_depth_behind_of_gate,param->gate_width,param->wingwall,param->drop_step);
504 break; 444 break;
505 case gate_control_with_free_flow_drop_step: 445 case gate_control_with_free_flow_drop_step:
506 - temp = cal_gate_control_with_free_flow(param->water_depth_front_of_gate,param->water_depth_behind_of_gate,\ 446 + *value = cal_gate_control_with_free_flow(param->water_depth_front_of_gate,param->water_depth_behind_of_gate,\
507 param->openning_height_of_gate,param->gate_width,param->wingwall,param->drop_step); 447 param->openning_height_of_gate,param->gate_width,param->wingwall,param->drop_step);
508 break; 448 break;
509 case gate_control_with_submerged_flow_drop_step: 449 case gate_control_with_submerged_flow_drop_step:
510 - temp = cal_gate_control_with_submerged_flow(param->water_depth_front_of_gate,param->water_depth_behind_of_gate,\ 450 + *value = cal_gate_control_with_submerged_flow(param->water_depth_front_of_gate,param->water_depth_behind_of_gate,\
511 param->openning_height_of_gate,param->gate_width,param->wingwall,param->drop_step); 451 param->openning_height_of_gate,param->gate_width,param->wingwall,param->drop_step);
512 break; 452 break;
513 } 453 }
514 - *value = temp;  
515 return 0; 454 return 0;
516 } 455 }
517 456
cal_gate.h
@@ -12,6 +12,10 @@ struct param_gate{ @@ -12,6 +12,10 @@ struct param_gate{
12 double gate_width; 12 double gate_width;
13 }; 13 };
14 14
15 -int Calculation_of_InstantaneousFlow(double * value,struct param_gate *param); 15 +
  16 +//double Calculation_of_InstantaneousFlow(double openning_height_of_gate, double water_depth_front_of_gate,double water_depth_behind_of_gate,double gate_width,int wingwall,int drop_step);
  17 +int Calculation_of_InstantaneousFlow(double *value,struct param_gate *param);
  18 +
  19 +
16 20
17 #endif 21 #endif
test-hdsmf/test.c
@@ -8,7 +8,9 @@ @@ -8,7 +8,9 @@
8 int main() 8 int main()
9 { 9 {
10 void *param; 10 void *param;
11 - 11 + int results=0;
  12 + double temp;
  13 +
12 param=malloc(40); 14 param=malloc(40);
13 15
14 *((int*)param)=1; 16 *((int*)param)=1;
@@ -21,9 +23,9 @@ int main() @@ -21,9 +23,9 @@ int main()
21 23
22 24
23 printf("For Test\r\n"); 25 printf("For Test\r\n");
24 - 26 + results=Calculation_of_InstantaneousFlow(&temp,param);
25 27
26 - printf("ins:%f\r\n",Calculation_of_InstantaneousFlow(param)); 28 + printf("exec:%d,ins:%f\r\n",results,temp);
27 //printf("ins:%f\r\n",Calculation_of_InstantaneousFlow(5,1.2,0.1,1.2,1,0)); 29 //printf("ins:%f\r\n",Calculation_of_InstantaneousFlow(5,1.2,0.1,1.2,1,0));
28 free(param); 30 free(param);
29 return 0; 31 return 0;