Advertisement
lodha1503

Untitled

Jul 8th, 2023
876
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from 'react'
  2.  
  3. const OneWaySlab = (props) =>
  4. {
  5.     var flag=0;
  6.     const choose_positive_min=(value1,value2)=>
  7.     {
  8.       if (value1 >= 0 && value2 >= 0)
  9.       {
  10.         return Math.min(value1, value2);
  11.       }
  12.    
  13.       else if (value1 >= 0)
  14.       {
  15.         return value1;
  16.       }
  17.  
  18.       else if (value2 >= 0)
  19.       {
  20.         return value2;
  21.       }
  22.  
  23.       return -1;
  24.     };
  25.  
  26.     const find_lowest_nearest_multiple_of_10=(num)=>
  27.     {
  28.      
  29.       var nearest_multiple;
  30.       nearest_multiple = Math.floor(num/10);
  31.       nearest_multiple=nearest_multiple*10;
  32.      
  33.       return nearest_multiple;
  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.  
  54.     const Long_Span=props.length;
  55.     const Short_Span=props.breadth;
  56.     const Live_Load=3.5;
  57.     const Dead_Load=0.25;
  58.    
  59.     const Floor_Finish=1;
  60.  
  61.    
  62.  
  63.     const D=Short_Span/28;
  64.     const Effective_depth=Math.round(D*1000);
  65.  
  66.     const Total_depth = Effective_depth + 20;
  67.     var Maximum_spacing = Math.min(3*Total_depth,300);
  68.  
  69.     const width = 300; // Given
  70.  
  71.     const shorter_effectivespan1 = (Short_Span*1000) + width;
  72.     const longer_effectivespan1 = (Long_Span*1000) + width;
  73.     const shorter_effectivespan2 = Effective_depth + (Short_Span*1000);
  74.     const longer_effectivespan2 = Effective_depth + (Long_Span*1000);
  75.  
  76.     const shorter_effectivespan = Math.min(shorter_effectivespan1, shorter_effectivespan2);
  77.     const longer_effectivespan = Math.min(longer_effectivespan1,longer_effectivespan2);
  78.    
  79.     const Self_weight = 25*(1)*(Total_depth/1000)  ;
  80.  
  81.     const Total_Load = Live_Load + Dead_Load + Self_weight + Floor_Finish;
  82.  
  83.     const Factored_Load = 1.5*Total_Load ;
  84.     const Factored_Moment = (Factored_Load*Math.pow((shorter_effectivespan/1000),2))/8;
  85.     const Factored_shearforce = (Factored_Load*(shorter_effectivespan/1000))/2;
  86.  
  87.     const Concrete_grade = 20;
  88.     const Steel_Strength = 415;
  89.  
  90.     const d = Math.sqrt((Factored_Moment*1000000)/(0.1379*1000*Concrete_grade));
  91.  
  92.  
  93.     //Variables
  94.  
  95.     var a,b,c,discriminant,root1,root2,Area_required,dia,area_of_bar,no_of_bar,number,spacing,Spacing,Area_Provided,Min_area_req,fs,pt,kt,x,tau,Assume_tensionsteel,y_value,s,spacing_prov,development_length,Length_of_embedment,embedded_length;
  96.  
  97.     const Tbd=1.2,wall_width=300;
  98.  
  99.     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];
  100.     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]
  101.  
  102.  
  103.     if (Effective_depth>d)
  104.     {
  105.         a = (Math.pow((Steel_Strength),2)*0.87)/(Concrete_grade*1000)
  106.         b = -(Steel_Strength*0.87*Effective_depth)
  107.         c = Factored_Moment*1000000;
  108.  
  109.         discriminant = (Math.pow(b,2)) - (4*a*c);
  110.  
  111.         if (discriminant<0)
  112.         {
  113.           root1=-b/(2*a);
  114.           root2=-b/(2*a);
  115.         }
  116.  
  117.         else
  118.         {
  119.           root1 = (-b + Math.sqrt(discriminant)) / (2*a);
  120.           root2 = (-b - Math.sqrt(discriminant)) / (2*a);
  121.         }
  122.  
  123.         Area_required=choose_positive_min(root1,root2);
  124.  
  125.         if (Area_required>0)
  126.         {
  127.           dia = 10;                                                        
  128.           area_of_bar = (3.14*(Math.pow(dia,2)))/4;
  129.           no_of_bar = Area_required/area_of_bar + 1;
  130.           number = Math.round(no_of_bar);
  131.           spacing = 1000/number;
  132.           Spacing = find_lowest_nearest_multiple_of_10(spacing);
  133.          
  134.           if (Maximum_spacing>=Spacing)
  135.           {
  136.             Area_Provided = (1000/Spacing)*area_of_bar;
  137.             Min_area_req = 0.0012*Total_depth*1000;
  138.            
  139.             if(Area_Provided>=Min_area_req && Area_Provided>=Area_required)
  140.             {
  141.              
  142.               fs = (0.58*Steel_Strength*Area_required)/Area_Provided;
  143.               pt = (Area_Provided/(1000*Total_depth))*100;
  144.               kt=1 / (0.225 + 0.00322 * fs - 0.625 * Math.log10(1/pt));
  145.               x = 20*kt;
  146.  
  147.              
  148.  
  149.               if (x>=Short_Span/D)
  150.               {
  151.                 tau = (Factored_shearforce*1000)/(1000*Total_depth);
  152.                 Assume_tensionsteel = pt/2;
  153.                 y_value=Interpolation(Assume_tensionsteel,pt_percentage,y);
  154.                
  155.                
  156.                 if (y_value>=tau)
  157.                 {
  158.                   s = Math.min(5*Effective_depth,450);
  159.                  
  160.                   if (s>=Spacing)
  161.                   {
  162.                     spacing_prov = (Math.floor(Spacing/ 10)) * 10;
  163.                    
  164.                     development_length = (0.87*Steel_Strength*dia)/(4*1.6*Tbd);
  165.                     console.log(development_length);
  166.  
  167.                     embedded_length = development_length/3;
  168.                     Length_of_embedment = wall_width - 30 ;
  169.                     if ((Length_of_embedment>embedded_length))
  170.                     {
  171.                       flag=1;
  172.                     }
  173.                     else
  174.                     {
  175.                       alert(Length_of_embedment<embedded_length);
  176.                     }
  177.                    
  178.                    
  179.                   }
  180.  
  181.                   else
  182.                   {
  183.                     alert("s<Spacing");
  184.                   }
  185.                 }
  186.  
  187.                 else
  188.                 {
  189.                   alert("y_value<tau")
  190.                 }
  191.  
  192.               }
  193.               else
  194.               {
  195.                 alert("x < Short_Span/D")
  196.               }
  197.  
  198.  
  199.             }
  200.             else
  201.             {
  202.               if(Area_Provided<Min_area_req && Area_Provided<Area_required)
  203.               {
  204.                 alert("Area_Provided<Min_area_req && Area_Provided<Area_required");
  205.               }
  206.               else if(Area_Provided<Min_area_req)
  207.               {
  208.                 alert("Area_Provided<Min_area_req");
  209.               }
  210.  
  211.               else if(Area_Provided<Area_required)
  212.               {
  213.                 alert("Area_Provided<Area_required");
  214.               }
  215.  
  216.             }
  217.              
  218.              
  219.           }
  220.  
  221.           else
  222.           {
  223.             alert("Maximum Spacing is less than Spacing");
  224.           }
  225.  
  226.  
  227.  
  228.          
  229.         }
  230.  
  231.         else
  232.         {
  233.           alert("Required Area is negative");
  234.         }
  235.  
  236.        
  237.     }
  238.  
  239.     else
  240.     {
  241.       alert("EFFECTIVE_DEPTH EXCEEDS D");
  242.     }
  243.  
  244.  
  245.        
  246.  
  247.          
  248.        
  249.              
  250.  
  251.   return (
  252.     <>
  253.     One Way Slab
  254.     {flag==1?<p>Area of Reinforcement Required is : {Area_required} <br />
  255.                 Area of Reinforcement Provided is : {Area_Provided} <br />
  256.                 Number of Bars Provided : {number}
  257.     </p>:""}
  258.     </>
  259.    
  260.   )
  261. }
  262.  
  263. export default OneWaySlab
  264.  
  265.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement