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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2205 - (hide annotations) (download) (as text)
Fri May 21 06:02:14 2010 UTC (14 years, 11 months ago) by jpye
File MIME type: text/x-ascend
File size: 1463 byte(s)
Add slvreq commands to fourbar problem.
1 johnpye 834 REQUIRE "atoms.a4l";
2    
3 jpye 2205 IMPORT "johnpye/extpy/extpy";
4     IMPORT "johnpye/fourbarplot";
5    
6 johnpye 834 (*
7     Model of a four-bar linkage
8    
9     The pivots are at A, B, C, D. Sides are named after the
10     end points. The 'default' configuration being modelled is
11     of a quadrilater with A and D fixed and B and C free.
12     The angle at A, alpha (to the positive x axis) will also be fixed
13    
14     *)
15    
16     MODEL fourbar;
17     x_A,y_A IS_A delta_distance;
18     x_B,y_B IS_A delta_distance;
19     x_C,y_C IS_A delta_distance;
20     x_D,y_D IS_A delta_distance;
21    
22     AB,BC,CD,DA IS_A distance;
23     alpha, beta, gamma, delta IS_A angle;
24    
25     x_B = x_A + AB*cos(alpha);
26     y_B = y_A + AB*sin(alpha);
27    
28     (x_C-x_B)^2 + (y_C-y_B)^2 = BC^2;
29     beta = arctan((y_C-y_B)/(x_C-x_B));
30    
31     x_D = x_C + CD*cos(gamma);
32     y_D = y_C + CD*sin(gamma);
33    
34     x_A = x_D + DA*cos(delta);
35     y_A = y_D + DA*sin(delta);
36    
37     METHODS
38     METHOD default_self;
39     y_B := 0.5 {m}; x_B := 0.8 {m};
40     y_C := -0.5{m}; x_C := 1.2 {m};
41     x_D := 2 {m}; y_D := 0 {m};
42     END default_self;
43    
44     METHOD specify;
45     FIX x_A, y_A;
46     FIX AB, BC, CD, DA;
47     FIX alpha, delta;
48     END specify;
49     METHOD values;
50     x_A := 0 {m};
51     y_A := 0 {m};
52     delta := 180 {deg};
53     AB := 1 {m};
54     BC := 1 {m};
55     CD := 1 {m};
56     DA := 2 {m};
57    
58     alpha:= 30 {deg};
59     END values;
60 jpye 2205 METHOD fancyplot;
61     EXTERNAL fourbarplot(SELF);
62     END fancyplot;
63 johnpye 834
64     METHOD on_load;
65     RUN reset;
66     RUN values;
67     RUN default_self;
68 jpye 2205 SOLVER QRSlv;
69     OPTION iterationlimit 50;
70 johnpye 834 END on_load;
71     END fourbar;
72 jpye 2205

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