~jdpipe/ascend/trunk-old

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# This file is part of the ASCEND Modeling Library and is released
# under the GNU Public License as described at the end of this file.
#
# This file demonstrates the use of force1d.a4c and the use of
# PLOT in ASCEND

# Mass/spring/anchor/finger/hook stationary on horizontal surface.
#

DELETE TYPES;
READ FILE "force1d.a4c";

#
# build a test model anchor/spring/mass/finger
#
COMPILE hand OF finger_test;
BROWSE {hand};
RUN {hand.reset};

# Send the distances we want to see to the probe
PROBE current {hand.h1.X} {};
PROBE current {hand.h2.X} {};
PROBE current {hand.h3.X} {};
PROBE current {hand.s1.dx} {};

# Send the input variables to the probe
PROBE current {hand.m1.width} {};
PROBE current {hand.pinky.pull} {};
PROBE current {hand.s1.L0} {};

ASSIGN {hand.m1.width} 0.04 {meter};
SOLVE {hand} WITH QRSlv;

# now specify the spring stretch and calc pull.
DELETE SYSTEM;
ASSIGN {hand.s1.dx} 0.05 {meter};
ASSIGN {hand.s1.dx.fixed} TRUE {};
ASSIGN {hand.pinky.pull.fixed} FALSE {};
SOLVE {hand} WITH QRSlv;

#
# build a test model anchor/spring/spring/finger
#
COMPILE slinky OF spring_test;
BROWSE {slinky};
RUN {slinky.reset};

# Send the distances we want to see to the probe
PROBE new {slinky.h1.X} {};
PROBE current {slinky.h2.X} {};
PROBE current {slinky.h3.X} {};
PROBE current {slinky.s1.dx} {};

# Send the input variables to the probe
PROBE current {slinky.s2.L0} {};
PROBE current {slinky.pinky.pull} {};
PROBE current {slinky.s1.L0} {};

ASSIGN {slinky.s2.L0} 0.4 {meter};
SOLVE {slinky} WITH QRSlv;

# now specify the spring stretch and calc pull.
DELETE SYSTEM;
ASSIGN {slinky.s1.dx} 0.05 {meter};
ASSIGN {slinky.s1.dx.fixed} TRUE {};
ASSIGN {slinky.pinky.pull.fixed} FALSE {};
SOLVE {slinky} WITH QRSlv;

#
# This block does the work illustrated in howto-plot.
#

# do plot model
COMPILE pst OF plot_spring_test;
BROWSE {pst};
RUN {pst.st.reset};
SOLVE {pst.st} WITH QRSlv;
PLOT {pst.Plot_X} ;
SHOW LAST;

##########  force1d.a4s ends here  ##########
#
#  force1d.a4s
#  by Benjamin Allan
#  May 16, 1998
#  Part of the ASCEND Library
#  $Date: 1998/06/17 20:08:32 $
#  $Revision: 1.2 $
#  $Author: mthomas $
#  $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/force1d.a4s,v $
#
#  This file is part of the ASCEND Modeling Library.
#
#  Copyright (C) 1998 Carnegie Mellon University
#
#  The ASCEND Modeling Library is free software. You can redistribute
#  it and/or modify it under the terms of the GNU General Public
#  License as published by the Free Software Foundation---either
#  version 2 of the License, or (at your option) any later version.
#
#  The ASCEND Modeling Library is distributed in hope that it
#  will be useful, but WITHOUT ANY WARRANTY--without even the implied
#  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#  See the GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with the program.  If not, write to the Free Software
#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA.  Check
#  the file named COPYING.