Commit e15ffb12ec1d89b16b7bb80015e667631d3b5d33

Authored by yuhang
0 parents

流量率定

README.txt 0 → 100644
  1 +++ a/README.txt
  1 +函数:double Calculation_of_InstantaneousFlow(struct param_gate *datas)
  2 +
  3 +说明:传入的指向void类型的指针,被转换为指向struct param_gate这个结构体的指针
  4 +struct param_gate{
  5 + int wingwall;
  6 + int drop_step;
  7 + double openning_height_of_gate;
  8 + double water_depth_front_of_gate;
  9 + double water_depth_behind_of_gate;
  10 + double gate_width;
  11 +};
  12 +
  13 +重要:且该指针指向的内存起始地址,存储的参数必须按照wingwall,drop_step,openning_height_of_gate,water_depth_front_of_gate,water_depth_behind_of_gate,gate_width;这个顺序存储!!!
  14 +
  15 +wingwall: 翼墙的类型 (扭面翼墙为1 平翼墙为2 八字翼墙为3 平行翼墙为4)
  16 +drop_step: 跌槛(根据现场施工状况决定, 有此参数为1,无则为0)
  17 +openning_height_of_gate: 闸门开启高度
  18 +water_depth_front_of_gate: 闸前水位
  19 +water_depth_behind_of_gate: 闸后水位
  20 +gate_width: 闸门宽度
cal_gate.c 0 → 100644
  1 +++ a/cal_gate.c
  1 +#include <stdio.h>
  2 +#include <stdlib.h>
  3 +#include <math.h>
  4 +
  5 +#include "cal_gate.h"
  6 +
  7 +
  8 +
  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*/
  18 +}patterns_of_water;
  19 +
  20 +enum {
  21 + NOTHINGNESS,
  22 + EXIST
  23 +};
  24 +
  25 +enum{
  26 + warped_wingwall=1,
  27 + flat_wingwall,
  28 + eight_c_wingwall,
  29 + parallel_wingwall
  30 +};
  31 +
  32 +struct A{
  33 + double m_warped_wingwall;
  34 + double m_warped_wingwall_ds;
  35 + double m_flat_wingwall;
  36 + double m_flat_wingwall_ds;
  37 + double m_eight_c_wingwall;
  38 + double m_eight_c_wingwall_ds;
  39 + double m_parallel_wingwall;
  40 + double m_parallel_wingwall_ds;
  41 +};
  42 +
  43 +
  44 +struct B{
  45 + double fai_warped_wingwall;
  46 + //float m_warped_wingwall_ds;
  47 + double fai_flat_wingwall;
  48 + //float m_flat_wingwall_ds;
  49 + double fai_eight_c_wingwall;
  50 + //float m_eight_c_wingwall_ds;
  51 + double fai_parallel_wingwall;
  52 + //float m_parallel_wingwall_ds;
  53 +};
  54 +
  55 +
  56 +struct C{
  57 + double miu_warped_wingwall;
  58 + double miu_warped_wingwall_ds;
  59 + double miu_flat_wingwall;
  60 + double miu_flat_wingwall_ds;
  61 + double miu_eight_c_wingwall;
  62 + double miu_eight_c_wingwall_ds;
  63 + double miu_parallel_wingwall;
  64 + double miu_parallel_wingwall_ds;
  65 +};
  66 +
  67 +struct D{
  68 + double miu_warped_wingwall;
  69 + double miu_warped_wingwall_ds;
  70 + double miu_flat_wingwall;
  71 + double miu_flat_wingwall_ds;
  72 + double miu_eight_c_wingwall;
  73 + double miu_eight_c_wingwall_ds;
  74 + double miu_parallel_wingwall;
  75 + double miu_parallel_wingwall_ds;
  76 +};
  77 +
  78 +
  79 +typedef struct total{
  80 + struct A A;
  81 + struct B B;
  82 + struct C C;
  83 + struct D D;
  84 +}coefficient_infor;
  85 +
  86 +
  87 +
  88 +
  89 +
  90 +
  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 + .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 + .C.miu_warped_wingwall=0.60, .C.miu_warped_wingwall_ds=0.625,.C.miu_flat_wingwall=0.58, .C.miu_flat_wingwall_ds=0.60,\
  95 + .C.miu_eight_c_wingwall=0.62,.C.miu_eight_c_wingwall_ds=0.64,.C.miu_parallel_wingwall=0.61,.C.miu_parallel_wingwall_ds=0.65,
  96 + .D.miu_warped_wingwall=0.60, .D.miu_warped_wingwall_ds=0.625,.D.miu_flat_wingwall=0.60, .D.miu_flat_wingwall_ds=0.60,\
  97 + .D.miu_eight_c_wingwall=0.64,.D.miu_eight_c_wingwall_ds=0.64,.D.miu_parallel_wingwall=0.63,.D.miu_parallel_wingwall_ds=0.65\
  98 + };
  99 +
  100 +
  101 +
  102 +/*
  103 + *
  104 + *
  105 + *
  106 + *
  107 + *
  108 +*/
  109 +char data_validity_check(struct param_gate *param)
  110 +{
  111 + if(param->wingwall <1 || param->wingwall>4){
  112 + printf("Invalid parameter of wingwall\r\n");
  113 + return 1;
  114 + }
  115 + if(param->drop_step <0 || param->drop_step >1){
  116 + printf("Invalid parameter of drop_step\r\n");
  117 + return 2;
  118 + }
  119 + if(param->openning_height_of_gate <0.0000001){
  120 + printf("Invalid parameter of openning_height_of_gate\r\n");
  121 + return 3;
  122 + }
  123 + if(param->water_depth_front_of_gate <0.0000001){
  124 + printf("Invalid parameter of water_depth_front_of_gate\r\n");
  125 + return 4;
  126 + }
  127 + if(param->water_depth_behind_of_gate <0.0000001){
  128 + printf("Invalid parameter of water_depth_behind_of_gate\r\n");
  129 + return 5;
  130 + }
  131 + if(param->gate_width <0.0000001){
  132 + printf("Invalid parameter of gate_width\r\n");
  133 + return 6;
  134 + }
  135 + return 0;
  136 +}
  137 +
  138 +/*
  139 + *
  140 + *
  141 + *
  142 + *
  143 + *
  144 +*/
  145 +
  146 +patterns_of_water discrimination_of_flow_pattern(double openning_height_of_gate,double water_depth_front_of_gate,double water_depth_behind_of_gate,int drop_step)
  147 +{
  148 + if((openning_height_of_gate/water_depth_front_of_gate > 0.65) && (water_depth_behind_of_gate/water_depth_front_of_gate < 0.7)){
  149 + if(drop_step == EXIST)
  150 + return gate_full_open_with_free_flow_drop_step;
  151 + else
  152 + return gate_full_open_with_free_flow;
  153 + }else if((openning_height_of_gate/water_depth_front_of_gate > 0.65) && (water_depth_behind_of_gate/water_depth_front_of_gate > 0.7)){
  154 + if(drop_step == EXIST)
  155 + return gate_full_open_with_submerged_flow_drop_step;
  156 + else
  157 + return gate_full_open_with_submerged_flow;
  158 + }else if((openning_height_of_gate/water_depth_front_of_gate <= 0.65) && (water_depth_behind_of_gate < openning_height_of_gate)){
  159 + if(drop_step == EXIST)
  160 + return gate_control_with_free_flow_drop_step;
  161 + else
  162 + return gate_control_with_free_flow;
  163 + }else if((water_depth_behind_of_gate > openning_height_of_gate)&& (water_depth_front_of_gate>openning_height_of_gate)){
  164 + if(drop_step == EXIST)
  165 + return gate_control_with_submerged_flow_drop_step;
  166 + else
  167 + return gate_control_with_submerged_flow;
  168 + }
  169 +}
  170 +
  171 +
  172 +
  173 +/*
  174 + *
  175 + *
  176 + *
  177 + *
  178 + *
  179 +*/
  180 +double get_coefficient_rou(double water_depth_front_of_gate,double water_depth_behind_of_gate)
  181 +{
  182 + double s;
  183 +
  184 + 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;
  278 +}
  279 +
  280 +
  281 +/*
  282 + *
  283 + *
  284 + *
  285 + *
  286 + *
  287 +*/
  288 +
  289 +double cal_gate_full_open_with_free_flow(double water_depth_front_of_gate,double gate_width,int wingwall,int ds)
  290 +{
  291 + double instantaneousFlow;
  292 +
  293 + switch(wingwall){
  294 + case warped_wingwall:
  295 + if(ds == EXIST)
  296 + instantaneousFlow=coefficient.A.m_warped_wingwall_ds*gate_width*water_depth_front_of_gate*sqrt(2*g*water_depth_front_of_gate);
  297 + else
  298 + instantaneousFlow=coefficient.A.m_warped_wingwall*gate_width*water_depth_front_of_gate*sqrt(2*g*water_depth_front_of_gate);
  299 + break;
  300 + case flat_wingwall:
  301 + if(ds == EXIST)
  302 + instantaneousFlow=coefficient.A.m_flat_wingwall_ds*gate_width*water_depth_front_of_gate*sqrt(2*g*water_depth_front_of_gate);
  303 + else
  304 + instantaneousFlow=coefficient.A.m_flat_wingwall*gate_width*water_depth_front_of_gate*sqrt(2*g*water_depth_front_of_gate);
  305 + break;
  306 + case eight_c_wingwall:
  307 + if(ds == EXIST)
  308 + instantaneousFlow=coefficient.A.m_eight_c_wingwall_ds*gate_width*water_depth_front_of_gate*sqrt(2*g*water_depth_front_of_gate);
  309 + else
  310 + instantaneousFlow=coefficient.A.m_eight_c_wingwall*gate_width*water_depth_front_of_gate*sqrt(2*g*water_depth_front_of_gate);
  311 + break;
  312 + case parallel_wingwall:
  313 + if(ds == EXIST)
  314 + instantaneousFlow=coefficient.A.m_parallel_wingwall_ds*gate_width*water_depth_front_of_gate*sqrt(2*g*water_depth_front_of_gate);
  315 + else
  316 + instantaneousFlow=coefficient.A.m_parallel_wingwall*gate_width*water_depth_front_of_gate*sqrt(2*g*water_depth_front_of_gate);
  317 + break;
  318 + }
  319 + return instantaneousFlow;
  320 +}
  321 +
  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)
  323 +{
  324 + double instantaneousFlow;
  325 +
  326 + switch(wingwall){
  327 + case warped_wingwall:
  328 + if(ds == EXIST)
  329 + instantaneousFlow=coefficient.B.fai_warped_wingwall*gate_width*get_coefficient_rou(water_depth_front_of_gate,water_depth_behind_of_gate)\
  330 + *water_depth_behind_of_gate*sqrt(2*g*water_depth_front_of_gate);
  331 + else
  332 + instantaneousFlow=coefficient.B.fai_warped_wingwall*gate_width*water_depth_behind_of_gate*sqrt(2*g*(water_depth_front_of_gate-water_depth_behind_of_gate));
  333 + break;
  334 + case flat_wingwall:
  335 + if(ds == EXIST)
  336 + instantaneousFlow=coefficient.B.fai_flat_wingwall*gate_width*get_coefficient_rou(water_depth_front_of_gate,water_depth_behind_of_gate)*water_depth_behind_of_gate\
  337 + *sqrt(2*g*water_depth_front_of_gate);
  338 + else
  339 + instantaneousFlow=coefficient.B.fai_flat_wingwall*gate_width*water_depth_behind_of_gate*sqrt(2*g*(water_depth_front_of_gate-water_depth_behind_of_gate));
  340 + break;
  341 + case eight_c_wingwall:
  342 + if(ds == EXIST)
  343 + instantaneousFlow=coefficient.B.fai_eight_c_wingwall*gate_width*get_coefficient_rou(water_depth_front_of_gate,water_depth_behind_of_gate)*water_depth_behind_of_gate\
  344 + *sqrt(2*g*water_depth_front_of_gate);
  345 + else
  346 + instantaneousFlow=coefficient.B.fai_eight_c_wingwall*gate_width*water_depth_behind_of_gate*sqrt(2*g*(water_depth_front_of_gate-water_depth_behind_of_gate));
  347 + break;
  348 + case parallel_wingwall:
  349 + if(ds == EXIST)
  350 + instantaneousFlow=coefficient.B.fai_parallel_wingwall*gate_width*get_coefficient_rou(water_depth_front_of_gate,water_depth_behind_of_gate)*water_depth_behind_of_gate\
  351 + *sqrt(2*g*water_depth_front_of_gate);
  352 + else
  353 + instantaneousFlow=coefficient.B.fai_parallel_wingwall*gate_width*water_depth_behind_of_gate*sqrt(2*g*(water_depth_front_of_gate-water_depth_behind_of_gate));
  354 + break;
  355 + }
  356 + return instantaneousFlow;
  357 +}
  358 +
  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)
  360 +{
  361 + double instantaneousFlow;
  362 +
  363 + switch(wingwall){
  364 + case warped_wingwall:
  365 + if(ds == EXIST)
  366 + instantaneousFlow=coefficient.C.miu_warped_wingwall_ds*gate_width*height_of_gate*sqrt(2*g*(water_depth_front_of_gate-0.5*height_of_gate));
  367 + else
  368 + instantaneousFlow=coefficient.C.miu_warped_wingwall*gate_width*height_of_gate*sqrt(2*g*(water_depth_front_of_gate-0.65*height_of_gate));
  369 + break;
  370 + case flat_wingwall:
  371 + if(ds == EXIST)
  372 + instantaneousFlow=coefficient.C.miu_flat_wingwall_ds*gate_width*height_of_gate*sqrt(2*g*(water_depth_front_of_gate-0.5*height_of_gate));
  373 + else
  374 + instantaneousFlow=coefficient.C.miu_flat_wingwall*gate_width*height_of_gate*sqrt(2*g*(water_depth_front_of_gate-0.65*height_of_gate));
  375 + break;
  376 + case eight_c_wingwall:
  377 + if(ds == EXIST)
  378 + instantaneousFlow=coefficient.C.miu_eight_c_wingwall_ds*gate_width*height_of_gate*sqrt(2*g*(water_depth_front_of_gate-0.5*height_of_gate));
  379 + else
  380 + instantaneousFlow=coefficient.C.miu_eight_c_wingwall*gate_width*height_of_gate*sqrt(2*g*(water_depth_front_of_gate-0.65*height_of_gate));
  381 + break;
  382 + case parallel_wingwall:
  383 + if(ds == EXIST)
  384 + instantaneousFlow=coefficient.C.miu_parallel_wingwall_ds*gate_width*height_of_gate*sqrt(2*g*(water_depth_front_of_gate-0.5*height_of_gate));
  385 + else
  386 + instantaneousFlow=coefficient.C.miu_parallel_wingwall*gate_width*height_of_gate*sqrt(2*g*(water_depth_front_of_gate-0.65*height_of_gate));
  387 + break;
  388 + }
  389 + return instantaneousFlow;
  390 +}
  391 +
  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)
  393 +{
  394 + double instantaneousFlow;
  395 +
  396 + switch(wingwall){
  397 + case warped_wingwall:
  398 + if(ds == EXIST)
  399 + instantaneousFlow=coefficient.D.miu_warped_wingwall_ds*gate_width*height_of_gate*sqrt(2*g*(water_depth_front_of_gate-water_depth_behind_of_gate));
  400 + else
  401 + instantaneousFlow=coefficient.D.miu_warped_wingwall*gate_width*height_of_gate*sqrt(2*g*(water_depth_front_of_gate-water_depth_behind_of_gate));
  402 + break;
  403 + case flat_wingwall:
  404 + if(ds == EXIST)
  405 + instantaneousFlow=coefficient.D.miu_flat_wingwall_ds*gate_width*height_of_gate*sqrt(2*g*(water_depth_front_of_gate-water_depth_behind_of_gate));
  406 + else
  407 + instantaneousFlow=coefficient.D.miu_flat_wingwall*gate_width*height_of_gate*sqrt(2*g*(water_depth_front_of_gate-water_depth_behind_of_gate));
  408 + break;
  409 + case eight_c_wingwall:
  410 + if(ds == EXIST)
  411 + instantaneousFlow=coefficient.D.miu_eight_c_wingwall_ds*gate_width*height_of_gate*sqrt(2*g*(water_depth_front_of_gate-water_depth_behind_of_gate));
  412 + else
  413 + instantaneousFlow=coefficient.D.miu_eight_c_wingwall*gate_width*height_of_gate*sqrt(2*g*(water_depth_front_of_gate-water_depth_behind_of_gate));
  414 + break;
  415 + case parallel_wingwall:
  416 + if(ds == EXIST)
  417 + instantaneousFlow=coefficient.D.miu_parallel_wingwall_ds*gate_width*height_of_gate*sqrt(2*g*(water_depth_front_of_gate-water_depth_behind_of_gate));
  418 + else
  419 + instantaneousFlow=coefficient.D.miu_parallel_wingwall*gate_width*height_of_gate*sqrt(2*g*(water_depth_front_of_gate-water_depth_behind_of_gate));
  420 + break;
  421 + }
  422 + return instantaneousFlow;
  423 +}
  424 +
  425 +
  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 +
  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 +
  470 +
  471 +
  472 +
  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
  474 +double Calculation_of_InstantaneousFlow(struct param_gate *param)
  475 +{
  476 + patterns_of_water get_pattern;
  477 +
  478 + double temp;
  479 +
  480 + if(data_validity_check(param)!=0)
  481 + return 0;
  482 +
  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);
  484 + switch(get_pattern){
  485 + 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);
  487 + break;
  488 + 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);
  490 + break;
  491 + 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,\
  493 + param->openning_height_of_gate,param->gate_width,param->wingwall,param->drop_step);
  494 + break;
  495 + 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,\
  497 + param->openning_height_of_gate,param->gate_width,param->wingwall,param->drop_step);
  498 + break;
  499 + 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);
  501 + break;
  502 + 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);
  504 + break;
  505 + 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,\
  507 + param->openning_height_of_gate,param->gate_width,param->wingwall,param->drop_step);
  508 + break;
  509 + 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,\
  511 + param->openning_height_of_gate,param->gate_width,param->wingwall,param->drop_step);
  512 + break;
  513 + }
  514 + return temp;
  515 +}
  516 +
  517 +
  518 +
  519 +
  520 +
  521 +
  522 +
  523 +
  524 +
  525 +
  526 +
  527 +
  528 +
  529 +
  530 +
  531 +
  532 +
  533 +
cal_gate.h 0 → 100644
  1 +++ a/cal_gate.h
  1 +#ifndef __CAL_GATE_H
  2 +#define __CAL_GATE_H
  3 +
  4 +#define g 9.81
  5 +
  6 +struct param_gate{
  7 + int wingwall;
  8 + int drop_step;
  9 + double openning_height_of_gate;
  10 + double water_depth_front_of_gate;
  11 + double water_depth_behind_of_gate;
  12 + double gate_width;
  13 +};
  14 +
  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 +double Calculation_of_InstantaneousFlow(struct param_gate *param);
  18 +
  19 +
  20 +
  21 +#endif
test 0 → 100644
No preview for this file type
test.c 0 → 100644
  1 +++ a/test.c
  1 +#include <stdio.h>
  2 +#include <stdlib.h>
  3 +#include <math.h>
  4 +#include "cal_gate.h"
  5 +
  6 +
  7 +
  8 +int main()
  9 +{
  10 + void *param;
  11 +
  12 + param=malloc(40);
  13 +
  14 + *((int*)param)=1;
  15 + *((int*)param+1)=0;
  16 + *((double*)param+1)=5.0;
  17 + *((double*)param+2)=1.2;
  18 + *((double*)param+3)=0.1;
  19 + *((double*)param+4)=1.2;
  20 +
  21 +
  22 +
  23 + printf("For Test\r\n");
  24 +
  25 +
  26 + printf("ins:%f\r\n",Calculation_of_InstantaneousFlow(param));
  27 + //printf("ins:%f\r\n",Calculation_of_InstantaneousFlow(5,1.2,0.1,1.2,1,0));
  28 + free(param);
  29 + return 0;
  30 +}
  31 +
  32 +