/[ascend]/trunk/models/johnpye/fourbar.a4c
ViewVC logotype

Contents of /trunk/models/johnpye/fourbar.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 834 - (show annotations) (download) (as text)
Thu Aug 31 05:39:14 2006 UTC (18 years, 8 months ago) by johnpye
File MIME type: text/x-ascend
File size: 1288 byte(s)
Added little 'fourbar' model for a four bar linkage.
Added 'plotfourbar.a4c' as well, for graphical output
using the present plot system (as a bit of a test).
Fixed support for plotting (bug #282)
1 REQUIRE "atoms.a4l";
2
3 (*
4 Model of a four-bar linkage
5
6 The pivots are at A, B, C, D. Sides are named after the
7 end points. The 'default' configuration being modelled is
8 of a quadrilater with A and D fixed and B and C free.
9 The angle at A, alpha (to the positive x axis) will also be fixed
10
11 *)
12
13 MODEL fourbar;
14 x_A,y_A IS_A delta_distance;
15 x_B,y_B IS_A delta_distance;
16 x_C,y_C IS_A delta_distance;
17 x_D,y_D IS_A delta_distance;
18
19 AB,BC,CD,DA IS_A distance;
20 alpha, beta, gamma, delta IS_A angle;
21
22 x_B = x_A + AB*cos(alpha);
23 y_B = y_A + AB*sin(alpha);
24
25 (x_C-x_B)^2 + (y_C-y_B)^2 = BC^2;
26 beta = arctan((y_C-y_B)/(x_C-x_B));
27
28 x_D = x_C + CD*cos(gamma);
29 y_D = y_C + CD*sin(gamma);
30
31 x_A = x_D + DA*cos(delta);
32 y_A = y_D + DA*sin(delta);
33
34 METHODS
35 METHOD default_self;
36 y_B := 0.5 {m}; x_B := 0.8 {m};
37 y_C := -0.5{m}; x_C := 1.2 {m};
38 x_D := 2 {m}; y_D := 0 {m};
39 END default_self;
40
41 METHOD specify;
42 FIX x_A, y_A;
43 FIX AB, BC, CD, DA;
44 FIX alpha, delta;
45 END specify;
46 METHOD values;
47 x_A := 0 {m};
48 y_A := 0 {m};
49 delta := 180 {deg};
50 AB := 1 {m};
51 BC := 1 {m};
52 CD := 1 {m};
53 DA := 2 {m};
54
55 alpha:= 30 {deg};
56 END values;
57
58 METHOD on_load;
59 RUN reset;
60 RUN values;
61 RUN default_self;
62 END on_load;
63 END fourbar;
64

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22