|
1 | | -/* |
2 | | - * Program for analysis of cantilever beam developed by Dr.G.S.Suresh and Dr. |
3 | | - * M.N.Shesha Prakash |
4 | | - * l = Span of the beam |
5 | | - * p[] = Intensity of concentrated load |
6 | | - * ac[] = Position of concentrated load measured from free end A |
7 | | - * wu[]= Intensity of uniformly distributed load (udl) |
8 | | - * au[] = Position of starting point of udl measured from free end A |
9 | | - * lu[] = Length of udl |
10 | | - * x = Position of section where SF and BM are computed, measured from free end A |
11 | | - * dx = Length of segment computed as total length divided by number of segments |
12 | | - * Nc = Number of concentrated loads |
13 | | - * Nu = Number of uniformly distributed loads |
14 | | - * N = Number of segments |
15 | | - * Vc[] = Shear force at a section due to concentrated loads |
16 | | - * Vu[] = Shear force at a section due to uniformly distributed loads |
17 | | - * Mc[] = Bending moment at a section due to concentrated loads |
18 | | - * Mu[] = Bending moment at a section due to uniformly distributed loads |
19 | | - * V[] = Net shear force at a section due to concentrated loads and uniformly distributed |
20 | | - * loads |
21 | | - * M[] = Net bending moment at a section due to concentrated loads and uniformly |
22 | | - * distributed loads |
23 | | - * i,j,k are integer variables used as index in for loops |
24 | | - * */ |
25 | | - |
26 | | - |
27 | 1 | #include<stdio.h> |
28 | 2 | #include<math.h> |
| 3 | +#include"Civil.h" |
29 | 4 |
|
30 | 5 | int main() |
31 | 6 | { |
32 | | - /* Declaring the pointer fp as a file */ |
33 | | - FILE *fp; |
34 | | - int i, j, k, Nc, Nu, N; |
35 | | - float x,l,dx,p[10],ac[10], wu[10], au[10], lu[10], Vc[10], Mc[10], Vu[10]; |
36 | | - float Mu[10], V[10], M[10]; |
37 | | - |
38 | | - /* Assigning output file cantbm.out */ |
39 | | - fp = fopen("cantbm.out","a"); |
40 | | - |
41 | | - /* Printed on the screen to guide user to enter values */ |
42 | | - printf("Enter the values of Nc, Nu, l, N\n"); |
43 | | - |
44 | | - /* Input of general information of beam */ |
45 | | - scanf("%d%d%f%d",&Nc,&Nu,&l,&N); |
46 | | - |
47 | | - /* Input is done when concentrated load is present */ |
48 | | - if (Nc>0) |
49 | | - { |
50 | | - printf("For each Concentrated Load Enter Intensity of Load and its position \n"); |
51 | | - for (i=1; i<=Nc; i++) |
52 | | - /* Input of intensity of concentrated load and its position */ |
53 | | - scanf("%f%f",&p[i],&ac[i]); |
54 | | - } |
55 | | - |
56 | | - /* Input is done when uniformaly distributed load is present */ |
57 | | - if (Nu>0) |
58 | | - { |
59 | | - printf("For each UDL Type Intensity of Load, its distance from free "); |
60 | | - printf("end and length \n"); |
61 | | - for (i=1; i<=Nu;i++) |
62 | | - { |
63 | | - /* Input of intensity of uniformly distributed load its, position and its length */ |
64 | | - scanf("%f%f%f",&wu[i],&au[i],&lu[i]); |
65 | | - } |
66 | | - } |
67 | | - /* Printing of the header of table */ |
68 | | - fprintf(fp," x SF BM\n"); |
69 | | - x=0; |
70 | | - dx=l/N; |
71 | | - for (i=0;i<=N; i++) /* Initialization */ |
72 | | - { |
73 | | - Vc[i]=0; |
74 | | - Mc[i]=0; |
75 | | - Vu[i]=0; |
76 | | - Mu[i]=0; |
77 | | - V[i]=0; |
78 | | - M[i]=0; |
79 | | - } |
80 | | - for (i=0; i<=N;i++) /* Loop for computing SF and BM at equal Interval */ |
81 | | - { |
82 | | - for (j=1;j<=Nc;j++) /* Loop for computing SF and BM due to concentrated load */ |
83 | | - { |
84 | | - if (x>ac[j]) |
85 | | - { |
86 | | - Vc[i]=Vc[i]+p[j]; /* Computation of SF */ |
87 | | - Mc[i]=Mc[i]-p[j]*(x-ac[j]); /* Computation of BM */ |
88 | | - } |
89 | | - } |
90 | | - |
91 | | - for (k=1; k<=Nu; k++) /* Loop for computing SF and BM due to uniformly distributed load */ |
92 | | - { |
93 | | - if ((x>au[k]) && (x<=au[k]+lu[k]))/* Section on UDL */ |
94 | | - { |
95 | | - /* Computation of SF */ |
96 | | - Vu[i]=Vu[i]+wu[k]*(x-au[k]); |
97 | | - |
98 | | - /* Computation of BM */ |
99 | | - Mu[i]=Mu[i]-wu[k]*(x-au[k])*(x-au[k])/2.0; |
100 | | - } |
101 | | - else if (x>(au[k]+lu[k])) |
102 | | - { |
103 | | - /* Computation of SF */ |
104 | | - Vu[i]=Vu[i]+wu[k]*lu[k]; |
105 | | - |
106 | | - /* Computation of BM */ |
107 | | - Mu[i]=Mu[i]-wu[k]*lu[k]*(x-au[k]-lu[k]/2.0); |
108 | | - } |
109 | | - } |
110 | | - V[i]=Vc[i]+Vu[i]; /* Computation of net Shear Force of Section */ |
111 | | - M[i]=Mc[i]+Mu[i]; /* Computation of net Bending moment of section */ |
112 | | - fprintf(fp, "%5.0f %10.3f %10.3f\n",x,V[i],M[i]); |
113 | | - /* To check for the section to have any concetrated load */ |
114 | | - for(j=1; j<=Nc; j++) |
115 | | - if (x==ac[j]) |
116 | | - fprintf(fp, "%5.0f %10.3f %10.3f\n", x, V[i]+p[j],M[i]); /* Adds intensity of concentrated load to Sf at the section */ |
117 | | - x=x+dx; |
118 | | - } |
119 | | - |
| 7 | + cantbm(3,0,5,5); |
120 | 8 | return 0; |
121 | | - } |
| 9 | +} |
0 commit comments