# Diff of /trunk/models/johnpye/beam.a4c

revision 839 by johnpye, Fri Sep 8 07:46:53 2006 UTC revision 840 by johnpye, Sun Sep 10 06:10:36 2006 UTC
# Line 8  MODEL beam_parameterised( Line 8  MODEL beam_parameterised(
8      I WILL_BE second_moment_of_area;      I WILL_BE second_moment_of_area;
9      L WILL_BE distance;      L WILL_BE distance;
10  );  );
11      v[1..n] IS_A distance;      v[1..n] IS_A deflection;
12      x[1..n] IS_A distance;      x[1..n] IS_A distance;
13
14      P IS_A force;      P,R1,R2 IS_A force;
15      a,b IS_A distance;      a,b IS_A distance;
16      a + b = L;      a + b = L;
17
18    (*
19      isrightp[1..n] IS_A boolean_var;      isrightp[1..n] IS_A boolean_var;
20
21      FOR i IN [1..n] CREATE      FOR i IN [1..n] CREATE
# Line 37  MODEL beam_parameterised( Line 38  MODEL beam_parameterised(
38              CASE FALSE:              CASE FALSE:
39                  USE v_left[i];                  USE v_left[i];
40          END WHEN;          END WHEN;
41      END FOR;      END FOR;
42    *)
43        FOR i IN [1..n] CREATE
44            defl[i]: v[i] = P*b/(6*E*I*L)*((L^2 - b^2)*x[i] - x[i]^3 + (L/b)*( 0.5 * (x[i]-a + abs(x[i]-a)) )^3 );
45        END FOR;
46
47        (* sum of vertical forces *)
48        R1 + P + R2 = 0 {N};
49        (* sum of moments about left end *)
50        P * a + R2 * L = 0 {N*m};
51
52  METHODS  METHODS
53  METHOD specify;  METHOD specify;
54      FIX P, a, x[1..n];      FIX P, a, x[1..n];
55  END specify;  END specify;
56  METHOD values;  METHOD values;
57        RUN bound_self;
58    END values;
59    METHOD bound_self;
60      a.upper_bound := 100 {m};      a.upper_bound := 100 {m};
61      b.upper_bound := 100 {m};      b.upper_bound := 100 {m};
62      L.upper_bound := 100 {m};      L.upper_bound := 100 {m};
63  END values;      P.lower_bound := -2e4 {kN};
64        P.upper_bound := 2e4 {kN};
65        v[1..n].upper_bound := 10 {m};
66        v[1..n].lower_bound := -10 {m};
67        x[1..n].upper_bound := 100 {m};
68        x[1..n].lower_bound := -100 {m};
69        R1.lower_bound := -1e4 {kN};
70        R1.upper_bound := 1e4 {kN};
71        R2.lower_bound := -1e4 {kN};
72        R2.upper_bound := 1e4 {kN};
73    END bound_self;
74
75  END beam_parameterised;  END beam_parameterised;
76
77    (* superposition of n beams with displacements calculated at n locations *)
78    MODEL beam_superposition(
79        n WILL_BE integer_constant;
80        E WILL_BE youngs_modulus;
81        I WILL_BE second_moment_of_area;
82        L WILL_BE distance;
83    );
84
85        B[1..n] IS_A beam_parameterised(n,E,I,L);
86
87        v[1..n] IS_A deflection;
88        x[1..n] IS_A distance;
89        R1,R2 IS_A force;
90
91        FOR i IN [1..n] CREATE
92            B[1..n].x[i], x[i] ARE_THE_SAME;
93            v[i] = SUM[B[j].v[i] | j IN [1..n]];
94        END FOR;
95
96        (* displacements are calculated at the locations of the loads *)
97        FOR i IN [1..n] CREATE
98            B[i].a, x[i] ARE_THE_SAME;
99        END FOR;
100
101        R1 = SUM[B[i].R1 | i IN [1..n]];
102        R2 = SUM[B[i].R2 | i IN [1..n]];
103
104    METHODS
105    METHOD bound_self;
106        FOR i IN [1..n] DO
107            RUN B[i].bound_self;
108            v[i].upper_bound := 10 {m};
109            v[i].lower_bound := -10 {m};
110            x[i].upper_bound := 500 {m};
111            x[i].lower_bound := -500 {m};
112        END FOR;
113        R1.lower_bound := -1e4 {kN};
114        R1.upper_bound := 1e4 {kN};
115        R2.lower_bound := -1e4 {kN};
116        R2.upper_bound := 1e4 {kN};
117    END bound_self;
118
119    END beam_superposition;
120
121  (*  (*
122      Model of a simply-supported beam of length L      Model of a simply-supported beam of length L
# Line 84  METHOD values; Line 152  METHOD values;
152      P := 14.0 {kN};      P := 14.0 {kN};
153      a := 1.75 {m};      a := 1.75 {m};
154      x := 2.0 {m};      x := 2.0 {m};
155  END values;  END values;
156
157    METHOD bound_self;
158        RUN B.bound_self;
159        L.lower_bound := 500 {m};
160        L.upper_bound := 0{m};
161    END bound_self;
162