Advertisement
lodha1503

Untitled

Jul 8th, 2023
493
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from 'react'
  2.  
  3. const TwoWaySlab = (props) => {
  4.     var flag=0;
  5.     const choose_positive_min=(value1,value2)=>
  6.     {
  7.       if (value1 >= 0 && value2 >= 0)
  8.       {
  9.         return Math.min(value1, value2);
  10.       }
  11.    
  12.       else if (value1 >= 0)
  13.       {
  14.         return value1;
  15.       }
  16.  
  17.       else if (value2 >= 0)
  18.       {
  19.         return value2;
  20.       }
  21.  
  22.       return -1;
  23.     };
  24.  
  25.     const find_lowest_nearest_multiple_of_10=(num)=>
  26.     {
  27.      
  28.       var nearest_multiple;
  29.       nearest_multiple = floor(num/10);
  30.       nearest_multiple=nearest_multiple*10;
  31.      
  32.       return nearest_multiple;
  33.     };
  34.  
  35.  
  36.     const Interpolation=(Assume_tensionsteel,pt_percentage,y)=>
  37.     {
  38.       var len=y.length;
  39.       var ans=y[len-1];
  40.       for (let i = 1; i < len; i++)
  41.       {
  42.         if ((Assume_tensionsteel>=pt_percentage[i-1]) && (Assume_tensionsteel<pt_percentage[i]))
  43.         {
  44.           ans= (((y[i]-y[i-1])/(pt_percentage[i]-pt_percentage[i-1]))*(Assume_tensionsteel-pt_percentage[i-1]))+y[i-1];
  45.  
  46.           break;
  47.         }
  48.       }
  49.  
  50.       return ans;
  51.     }
  52.  
  53.     const Long_Span=props.breadth;
  54.     const Short_Span=props.length;
  55.     const Live_Load=3.5;
  56.     const Dead_Load=0.25;
  57.     const Concrete_grade = 20,Steel_Strength=415;
  58.  
  59.     const Depth=Short_Span/32;
  60.     const Effective_depth = Math.round(Depth*1000);
  61.     const Total_depth = Effective_depth + 20+4;
  62.  
  63.  
  64.     const Self_weight = 25*(1)*(Total_depth/1000)  ;
  65.     const Floor_Finish=1;
  66.  
  67.     const Total_Load = Live_Load + Dead_Load + Self_weight + Floor_Finish;
  68.     const Factored_Load = 1.5*Total_Load;
  69.  
  70.     const ratio = Math.float(Long_Span) / Math.float(Short_Span);
  71.     const final_ratio = Math.round(ratio, 2);
  72.  
  73.  
  74.  
  75.     var short_negative_momentcoefficient;
  76.     var short_positive_momentcoefficient;
  77.     var long_negative_momentcoefficient;
  78.     var long_positive_momentcoefficient;
  79.  
  80.  
  81.     var Negative_shortspan_Moment = short_negative_momentcoefficient*Factored_Load*(Math.pow(Short_Span,2)) ;  
  82.  
  83.     var Positive_shortspan_Moment = short_positive_momentcoefficient*Factored_Load*(Math.pow(Short_Span,2));
  84.  
  85.     var Negative_longspan_Moment = long_negative_momentcoefficient*Factored_Load*(Math.pow(Short_Span,2));
  86.  
  87.     var Positive_longspan_Moment = long_positive_momentcoefficient*Factored_Load*(Math.pow(Short_Span,2));
  88.  
  89.     var Effective_depth_req = (Math.sqrt((Negative_shortspan_Moment*1000000)/(0.138*Concrete_grade*1000)));
  90.  
  91.  
  92.     const pt_percentage=[0.15,0.25,0.5,0.75,1,1.25,1.5,1.75,2,2.25,2.5,2.75,3];
  93.     const y=[0.28,0.36,0.48,0.56,0.62,0.67,0.72,0.75,0.79,0.81,0.82,0.82,0.82];
  94.  
  95.     const x2 = [300, 275, 250, 225, 200, 175, 150];
  96.     const y2 = [1, 1.05, 1.1, 1.15, 1.2, 1.2, 1,3];
  97.  
  98.  
  99.  
  100.  
  101.     var Ast_min,Maximum_spacing,a,b,c,root1,root2,discriminant,dia,area_of_bar,no_of_bar,number,spacing,Spacing,Area_requiredx1,Area_providedx,Area_requiredx2,Ast_requiredy1,Area_providedy,Ast_requiredy2,l,v,Tau,pt_in_shorterdirection,y_line ;
  102.  
  103.     if(Effective_depth_req>Effective_depth)
  104.     {
  105.         Ast_min = (0.0012)*(1000*Total_depth);
  106.         Maximum_spacing = Math.min(3*Effective_depth,300);
  107.  
  108.         a = (Math.pow((Steel_Strength),2)*0.87)/(Concrete_grade*1000)
  109.         b = -(Steel_Strength*0.87*Effective_depth)
  110.         c = Negative_shortspan_Moment*1000000;
  111.  
  112.         discriminant = (Math.pow(b,2)) - (4*a*c);
  113.  
  114.         if (discriminant<0)
  115.         {
  116.           root1=-b/(2*a);
  117.           root2=-b/(2*a);
  118.         }
  119.  
  120.         else
  121.         {
  122.           root1 = (-b + Math.sqrt(discriminant)) / (2*a);
  123.           root2 = (-b - Math.sqrt(discriminant)) / (2*a);
  124.         }
  125.  
  126.         Area_requiredx1=choose_positive_min(root1,root2);
  127.  
  128.         if(Area_requiredx1>=0)
  129.         {
  130.            
  131.             dia = 8;                                                        
  132.             area_of_bar = (3.14*(Math.pow(dia,2)))/4;
  133.             no_of_bar = Area_requiredx1/area_of_bar + 1;
  134.             number = Math.round(no_of_bar);
  135.             spacing = 1000/number;
  136.             Spacing = find_lowest_nearest_multiple_of_10(spacing);
  137.  
  138.             if (Maximum_spacing>=Spacing)
  139.             {
  140.                 Area_providedx = (no_of_bar - 1)*(floor( spacing/ 100) * 100);
  141.  
  142.                 a = (Math.pow((Steel_Strength),2)*0.87)/(Concrete_grade*1000);
  143.                 b = -(Steel_Strength*0.87*Effective_depth);
  144.                 c = Positive_shortspan_Moment*1000000;
  145.  
  146.                 discriminant = (Math.pow(b,2)) - (4*a*c);
  147.  
  148.                 if (discriminant<0)
  149.                 {
  150.                     root1=-b/(2*a);
  151.                     root2=-b/(2*a);
  152.                 }
  153.  
  154.                 else
  155.                 {
  156.                     root1 = (-b + Math.sqrt(discriminant)) / (2*a);
  157.                     root2 = (-b - Math.sqrt(discriminant)) / (2*a);
  158.                 }
  159.  
  160.                 Area_requiredx2=choose_positive_min(root1,root2);
  161.  
  162.                 if (Area_requiredx2>=0)
  163.                 {
  164.                     dia=8;
  165.                     area_of_bar = (3.14*(Math.pow(dia,2)))/4;
  166.                     no_of_bar = Area_requiredx2/area_of_bar + 1;
  167.                     number = Math.round(no_of_bar);
  168.                     spacing = 1000/number;
  169.                     Spacing = find_lowest_nearest_multiple_of_10(spacing);
  170.  
  171.                     if(Maximum_spacing>=Spacing)
  172.                     {
  173.                         a = (Math.pow((Steel_Strength),2)*0.87)/(Concrete_grade*1000);
  174.                         b = -(Steel_Strength*0.87*Effective_depth);
  175.                         c = Negative_longspan_Moment*1000000;
  176.  
  177.                         discriminant = (Math.pow(b,2)) - (4*a*c);
  178.  
  179.                         if (discriminant<0)
  180.                         {
  181.                             root1=-b/(2*a);
  182.                             root2=-b/(2*a);
  183.                         }
  184.  
  185.                         else
  186.                         {
  187.                             root1 = (-b + Math.sqrt(discriminant)) / (2*a);
  188.                             root2 = (-b - Math.sqrt(discriminant)) / (2*a);
  189.                         }
  190.  
  191.                         Ast_requiredy1=choose_positive_min(root1,root2);
  192.                         if(Ast_requiredy1>=0)
  193.                         {
  194.                             if(Ast_requiredy1>=Ast_min)
  195.                             {
  196.                                 dia=8;
  197.                                 area_of_bar = (3.14*(Math.pow(dia,2)))/4;
  198.                                 no_of_bar = Ast_requiredy1/area_of_bar + 1;
  199.                                 number = Math.round(no_of_bar);
  200.                                 spacing = 1000/number;
  201.                                 Spacing = find_lowest_nearest_multiple_of_10(spacing);
  202.  
  203.                                 if (Maximum_spacing>=Spacing)
  204.                                 {
  205.                                     Area_providedy = (no_of_bar - 1)* Math.floor( spacing/ 100) * 100;
  206.  
  207.                                     a = (Math.pow((Steel_Strength),2)*0.87)/(Concrete_grade*1000);
  208.                                     b = -(Steel_Strength*0.87*Effective_depth);
  209.                                     c =  Positive_longspan_Moment*1000000;
  210.  
  211.                                     discriminant = (Math.pow(b,2)) - (4*a*c);
  212.  
  213.                                     if (discriminant<0)
  214.                                     {
  215.                                         root1=-b/(2*a);
  216.                                         root2=-b/(2*a);
  217.                                     }
  218.  
  219.                                     else
  220.                                     {
  221.                                         root1 = (-b + Math.sqrt(discriminant)) / (2*a);
  222.                                         root2 = (-b - Math.sqrt(discriminant)) / (2*a);
  223.                                     }
  224.                                    
  225.  
  226.                                     Ast_requiredy2 = choose_positive_min(root1, root2);
  227.  
  228.                                     if (Ast_requiredy2>=0)
  229.                                     {
  230.                                         if (Ast_requiredy2<=Ast_min)
  231.                                         {
  232.                                             dia=8;
  233.                                             area_of_bar = (3.14*(Math.pow(dia,2)))/4;
  234.                                             no_of_bar = Ast_requiredy2/area_of_bar + 1;
  235.                                             number = Math.round(no_of_bar);
  236.                                             spacing = 1000/number;
  237.                                             Spacing = find_lowest_nearest_multiple_of_10(spacing);
  238.  
  239.                                             if (Maximum_spacing>=Spacing)
  240.                                             {
  241.                                                 l = Short_Span+ 0.15;
  242.                                                 v = (Total_Load*l)/2;
  243.                                                 Tau = (v * 1000) / (1000 * Effective_depth);
  244.  
  245.                                                 pt_in_shorterdirection = (100*Area_requiredx1)/(1000*Effective_depth);
  246.  
  247.                                                
  248.  
  249.                                                 y_line = Interpolation(pt_in_shorterdirection, pt_percentage, y);
  250.  
  251.  
  252.  
  253.  
  254.                                             }
  255.  
  256.                                             else
  257.                                             {
  258.                                                 alert("Maximum Spacing is less than Spacing for Ast_y2");
  259.                                             }
  260.                                         }
  261.                                         else
  262.                                         {
  263.                                             alert("Ast_requiredy2>Ast_min")
  264.                                         }
  265.                                     }
  266.  
  267.                                     else
  268.                                     {
  269.                                         alert("Ast_requiredy2 is negative");
  270.                                     }
  271.  
  272.  
  273.  
  274.  
  275.  
  276.                                 }
  277.                                 else
  278.                                 {
  279.                                     alert("Maximum Spacing is less than Spacing for Ast_y1");
  280.                                 }
  281.                             }
  282.                             else
  283.                             {
  284.                                 alert("Ast_requiredy1 < Ast_min")
  285.                             }
  286.                         }
  287.                         else
  288.                         {
  289.                             alert("Required Area y2 is negative");
  290.                         }
  291.  
  292.                        
  293.                     }
  294.                     else
  295.                     {
  296.                         alert("Maximum Spacing < Spacing for Area_reqx2");
  297.                     }
  298.                 }
  299.                 else
  300.                 {
  301.                     alert("Required Areax2 is negative");
  302.  
  303.                 }
  304.  
  305.             }
  306.             else
  307.             {
  308.                 alert("Maximum Spacing < Spacing for Area_reqx1")
  309.             }
  310.  
  311.  
  312.         }
  313.         else
  314.         {
  315.           alert("Required Areax1 is negative");
  316.         }
  317.     }
  318.  
  319.     else
  320.     {
  321.         alert("The effective depth selected is not sufficient to resist the design ultimate moment")
  322.     }
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.   return (
  336.     <div>
  337.      
  338.     </div>
  339.   )
  340. }
  341.  
  342. export default TwoWaySlab
  343.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement