Manual Working Model 2d
Manual Working Model 2d
Manual Working Model 2d
com
Working Model 2D
Information in this document is subject to change without notice and does not represent a license, contract,
agreement or commitment to the purchaser, licensor, reseller, distributor, or any other party. The software
described in this document is furnished under a license agreement or non-disclosure agreement. The software
may be used or copied only in accordance with the terms of the agreement. It is against the law to copy the
software on any medium except as specifically allowed in the license or non-disclosure agreement. No part
of this manual may be reproduced or transmitted in any form or by any means, electronic or mechanical,
including photocopying and recording, for any purpose without express written permission of Design
Simulation Technologies, Inc.
Copyright Design Simulation Technologies, Inc 2006-2010. All rights reserved.
Portions 2000-2005 MSC.Software Corporation.
Portions 1992-1995 Summit Software Company.
Interactive Physics, Interactive Physics II, Interactive Physics Player, Smart Editor, Working Model,
Working Model Basic and WM Basic are trademarks of MSC.Software Corporation.
Apple, Macintosh, Mac, Apple Guide, and QuickTime are registered trademarks of Apple Computer,
Incorporated.
Microsoft, Windows, and WinHelp are registered trademarks of Microsoft Corporation.
MATLAB is a registered trademark of the MathWorks, Incorporated
AutoCAD is a registered trademark of AutoDesk, Incorporated.
DXF is a trademark of AutoDesk, Incorporated.
All other brand or product names are trademarks or registered trademarks of their respective holders.
For phone/fax numbers, mail/E-mail addresses, technical support, sales, and development, please visit
http://www.workingmodel.com
WM2D*V5*Z*Z*Z*DC-USR
xvii
Introduction
Simulation Engine
Designed for both speed and accuracy, the Working Model simulation
engine calculates the motion of interacting bodies using advanced
numerical analysis techniques. The engine allows the construction of a
complex system and can compute its dynamics under a variety of
constraints and forces. In addition to user-imposed constraints such as
springs, pulleys, or joints, the engine has the capability to simulate
world-level interactions such as collisions, gravity, air-resistance, and
electrostatics. Every aspect of a simulation from the integration time step
and technique to the coefficients of friction and restitution can be
adjusted by the user.
xviii
For example, you can write scripts to create, modify, and join bodies and
constraints. You can run iterative simulations overnight and export the data
files for future review. You can design custom dialog boxes to create a new
simulation environment. You can even run scripts provided by third-party
vendors and add them to Working Models menu.
To run a script, select the scripts menu and then the desired script.
Information various useful scripts is found in Appendix D.
Please refer to the Working Model Basic Users Manual for instructions and
language reference.
Smart Editor
The Smart Editor is the core of the user interface, keeping track of
connections and constraints among objects as they are constructed. To
develop a mechanism, a user draws components on the screen and indicates
where and how the pieces should be joined. The Smart Editor allows a
mechanism to be rotated and dragged while maintaining the fundamental
integrity of the components and of the joints between them. Users can
position objects via the standard click-and-drag paradigm or by specifying
precise coordinates in dialog boxes. In all cases, the Smart Editor makes sure
that no link is broken and no body is stretched.
A robot arm composed of several parts held together by pivot joints can be
positioned accurately using the Smart Editor. By clicking and dragging the
hand, the arm stretches out to the desired configuration.
xix
Object Snap
You can quickly modify the geometry and position of various objects in
Working Model by entering desired properties directly on the screen. Simply
select the desired object, and Working Model will present you with a list of
parameters (such as width, height, and position of a body) that can be edited
on-the-fly; type in the precise values, and the modification will take effect
immediately.
Inter-application
Communication
xx
Exporting Static / Animated
Data
Real-time input devices include sliders, buttons, and text fields. Real-time
output devices include graphs, digital displays, and bar displays.
Text Tool
You can annotate simulations directly on the workspace using any font, size,
or style of text available on your computer.
Moving Graphics
You can paste pictures created with a paint or draw program directly on the
workspace or link them to objects. For example, you can create a circular
object and attach a picture of a baseball to it.
Extensive Graphical
Features
You can show and hide objects, fill objects with patterns and colors, display
the electrostatic charge of objects (+ or -), choose the thickness of an objects
outline, show object names, and display vectors.
You can view simulations using any body or point as the frame of reference.
xxi
You can choose from standard metric (SI) units such as kilograms, meters,
and radians; standard English units such as yards, feet, inches, degrees,
seconds, and pounds; or other units (e.g. light-years).
Complete Formula
Language
Working Model has a formula language system for creating arithmetic and
mathematical expressions (including conditional statements) that is very
similar to the formula language used in Microsoft Excel and Lotus 1-2-3.
Any value can be a formula rather than a number. To simulate a rocket, you
can write an formula for its mass so that it decreases as fuel is spent. Using
trigonometric functions, you can write a formula that simulates the force
generated by an actuator that induces an oscillation.
Menu-less Player
Documents
Player mode provides a window with a limited menu bar and no toolbar,
leaving more room to display the simulation. You can switch between player
mode and the standard edit mode by selecting a menu command. Player
documents are useful for people who are unfamiliar with Working Models
modeling capability.
Custom Tracking
You can track all objects or limit tracking to selected objects. Individual
objects can leave tracks of their outline, center of mass, or vector displays.
You can also connect tracks with lines.
Object Layering
The simulation world consists of two layers: one for user objects such as
meters and one for physical objects such as bodies and constraints. Full
control of which objects collide is provided.
Vector Displays
Pause Control
You can stop or pause simulations automatically. For example, you can set a
simulation to pause when two seconds have elapsed by entering the following
formula: Pause when time > 2. You can also have your simulations loop
and reset.
xxii
Apply Control
You can apply forces and constraints at various times. For example, you can
apply a constant force on an object for one second, or you can apply a force
when an objects velocity is greater than 10.
Unlimited Objects
You can create as many objects (such as bodies, constraints, and meters) as
your computers memory allows.
xxiii
The illustrations in this manual show screens and dialog boxes from both
MacOS and Windows computers. Both versions appear only when the two
are substantially different. Any information pertaining to only one of the
systems will be labeled as such.
The chapters and appendices in this guide are described below.
C H A P T E R
A Guided Tour
Figure 1-1
Untitled Working Model 2D
Window
Toolbar
Coordinates bar
Tape player controls
Status bar
Windows
Status bar
Toolbar
Coordinates bar
Tape player controls
MacOS
The new, untitled simulation document appears in its own window. You will
see the Coordinates bar and the Tape player controls along the bottom of the
window.
The Toolbar contains tools you will use to create simulations. Tools are
provided for creating bodies, springs, ropes, forces, and many other objects.
The Toolbar also contains buttons for running and resetting simulations.
NOTE: The Toolbar configuration differs between the Windows and MacOS
versions of Working Model 2D. Please see 2.1. The Working Model 2D
Toolbars for more information on these differences.
The Coordinates bar provides useful information such as the mouse cursor
position, object configurations and object dimensions. The display mode is
context-sensitive and changes swiftly to attend to your needs while you are
using Working Model 2D. You can also edit object parameters by entering
information directly in the Coordinates bar.
The Tape player controls give you more flexibility for running and viewing
simulations. You can use the Tape player controls to step through
simulations, play simulations backwards, or move to a specific time in a
simulation.
The Status bar gives a concise description of the tool or object located at the
mouse cursor. Note that it is located at the top of the document window in
the MacOS version but at the bottom of the window in the Windows version.
2.
Use the Toolbar to draw objects just as you would with a paint or draw
program.
Double-click an object to display and/or edit its initial specifications (for example,
velocity, friction coefficients, or elasticity).
4.
Choose from the items in the Measure menu to install meters and graphs that
display the information to be analyzed during the simulation.
5.
6.
Select one of the demonstrations by clicking it. Then click the Open button.
4.
MacOS
Windows
To stop the simulation, click the mouse button in the window background or click
Stop in the Toolbar.
On MacOS systems, the Run button turns into the Stop button while
running a simulation.
Once you have finished watching a simulation, you should close it to free
more memory for other simulations.
Figure 1-3
Stopping the simulation
MacOS
Windows
6.
Choose Close from the File menu to close the simulation window.
A dialog will appear asking if you want to save the changes before
closing.
7.
Creating a Circle
The Toolbar provides a variety of tools for setting up simulations. To choose
a tool, click on its icon in the Toolbar.
To create a circle (see Figure 1-4):
Figure 1-4
Creating a circle
Click here to select
the circle tool.
1.
2.
Position the pointer at any starting point in the blank area of the screen.
The pointer changes from an arrow to a crosshair. This means you are
ready to create an object.
3.
Click and hold the mouse button and drag the mouse until the circle is the size you
want. Release the mouse button.
A line appears inside the circle. During an animated sequence, this line
indicates the circles rotational orientation.
Optional Method for
Creating Circles
There is another way to create circles. If you are used to using a CAD
applications, you may want to create a circle as follows:
1.
2.
Position the pointer at any starting point in the blank area of the screen.
3.
Click the mouse button and release it. Drag the mouse.
Drag the mouse until the circle is the size you want.
5.
The four reshape handles (small black squares) appear around the circle
as shown in Figure 1-4).
2.
Hold the mouse button down on one of the reshape handles and drag it.
Figure 1-5
Resizing a circle
3.
Release the mouse button when the circle reaches the desired size.
The Coordinates bar shows the position of the circle (in terms of its
center) as well as the radius and orientation (see Figure 1-6).
2.
Type the desired radius into the radius field (labeled r) of the Coordinates bar.
Figure 1-6
Coordinates bar display for a circle
x-position
y-position
radius
orientation
2.
3.
Hold the mouse button and drag the circle to the lower left corner of the screen, as
shown in Figure 1-7.
Figure 1-7
Dragging the circle
Press and hold down the
mouse button here...
Alternatively, you can use the Coordinates bar to specify a precise initial
position. Simply type the desired numbers into x and y fields of the
Coordinates bar (see Figure 1-6).
The Preferences dialog appears (see Figure 1-8). You can use this
dialog to modify preferences and save them for all new documents.
3.
Check the item titled Allow velocity vector dragging. Click OK.
10
Figure 1-8
Preferences dialog
Click here and make sure the
checkmark appears.
4.
Position the pointer on the center dot in the circle and drag away from it to specify
the projectiles initial velocity (see Figure 1-9).
6.
11
4.
Go back to step 3 under Specifying Initial Velocity and try running the simulation
with different velocities.
numbers (digital),
graphs (plot), or
level indicators (bar graph).
12
2.
Draw a circle in the lower left-hand corner of the workspace if one is not already
there. Select the circle.
Your screen should resemble Figure 1-10. When the circle is selected,
four small dots and the velocity arrow appear. If your screen does not
resemble Figure 1-10, repeat the steps of the previous section. If you
already know how to create objects and give them initial velocities,
create a single circular body and give it an initial velocity similar to that
shown in Figure 1-10.
Figure 1-10
A circular projectile with an initial
velocity
3.
Choose Velocity from the Measure menu and All from the Velocity submenu.
13
Figure 1-11
A velocity meter
4.
As the projectile moves, you can monitor the velocity of its center of mass
by watching the velocity meter.
5.
14
Figure 1-12
Changing a digital display into a
graphical display
2.
Click the arrow button in the top left corner of the meter.
4.
Select Vy as the only property to be plotted by clicking the buttons on the side of
the meter.
You can click the buttons on the side of the meter to enable or disable the
plotting of individual properties.
Your meter should resemble Figure 1-13.
Figure 1-13
A graphical display
Click these buttons to
restrict output to Vy
5.
1.6. Tracking
15
You can install meters to measure any quantity shown in the Measure menu.
For more information about meters, see 7.1. Meters.
Displaying Vectors
To display the velocity of the projectile as an animated vector:
1.
2.
From now on, a check mark will appear next to Velocity in the Vectors
menu, indicating that velocity vectors are being displayed.
4.
When you run the simulation, a vector appears on the circle, showing the
velocity of its center of mass.
5.
1.6. Tracking
Tracking shows the path of an object by recording its location at specific
intervals.
1.
Click Reset in the Toolbar if you have run but not yet reset the simulation.
2.
Choose Tracking from the World menu and then choose Every 8 frames from the
submenu.
When you run the simulation, Working Model 2D will display the
position of the circle at eight-frame intervals.
16
4.
The Save As... dialog appears if you have not yet given the simulation a
name.
2.
The changes you have made in all dialog boxes are saved when you save a
simulation document.
If you have already selected and entered a name for your simulation you can
sequentially save without interrupting your work.
17
Use the Save As... command to save a copy of your simulation under a
different name.
Create a new Working Model 2D document by selecting New from the File menu.
Double-clicking allows you to use a tool successively without reselecting the tool after each use.
On MacOS systems, double-clicking on a tool turns its icon dark grey.
3.
4.
Figure 1-15
A single rectangle
While you draw the additional rectangles, a small X symbol appears as you
move the mouse pointer closer to the midpoints and corners of the existing
rectangle. This symbol indicates that the Object Snap feature is active (see
Figure 1-16).
18
Figure 1-16
Aligning rectangles based on Snap
Points
When you start to create a rectangle while a Snap Point symbol is visible, the
drawing is automatically aligned to that Snap Point. As shown in Figure 116, you can start creating a rectangle by aligning its corner to the existing
rectangle.
After you draw the two vertical links, your screen should resemble Figure 117.
Figure 1-17
The layout of a four-bar linkage
You will now create pin joints. A pin joint acts as a hinge between two
bodies. The Smart Editor prevents joints from breaking during drag
operations.
1.
2.
Sketch two pin joints by clicking once with the mouse for each joint. Try to attach
it to a Snap Point (where a small X symbol appears) whenever possible.
Note that the Object Snap is still active when you attach a constraint, such as
a pin joint. As shown in Figure 1-18, possible Snap Points include the center
of links and their corners.
19
Figure 1-18
Aligning pin joints based on Snap
Points
As you bring the mouse
closer to the links...
After you create the two pin joints, your screen should resemble Figure 1-19.
Figure 1-19
Pinning the mechanism together
Pin joints automatically connect the top two bodies. If only one body lies
beneath a pin joint, then the pin joint joins the body to the background.
3.
4.
All three rectangles will follow the motion of the mouse because the pin
joints connect them. The Smart Editor does not allow joints to separate.
In this situation, the Smart Editor moves the three rectangles together.
5.
Add two new pin joints at the bottom of rectangles B and C, as indicated in Figure 120.
These pin joints will join the rectangles to the background. Use the Snap
Points if so desired.
20
Figure 1-20
Pinning the mechanism to the
background
A
C
B
6.
This action de-selects the Pin Joint tool; otherwise, further mouse clicks
would create more pin joints.
7.
The joints pivot, and the bars now move relative to one another. The
Smart Editor moves the mechanism while making sure that pin joints do
not separate.
Figure 1-21
Dragging the mechanism
A
B
21
Bring the mouse pointer to one of its top reshape handles and hold down the mouse
button. Drag the mouse to modify the size of the link.
If you attached all the pin joints to Snap Points, Working Model 2D will
automatically modify the attachment to keep the attachment in its position
relative to the end of the vertical link. If the point was not attached to a Snap
Point, no adjustments will be made. Figure 1-22 provides a comparison
between the two cases.
Figure 1-22
Result of resizing links and pin joint
positions
The difference comes from one of the Working Model 2D features called
point-based parametrics. In short, the Object Snap feature is linked with an
automatic specification of point positions based on the geometry of the bodies
involved in the joint attachment. You can turn this feature on or off using the
Preferences dialog in the World menu. Please see 8.4. Preferences for
more information.
22
3.
q
C
4.
23
A
C
B
5.
Do not drag the pin joints as they may be removed from their respective
rectangles.
6.
Move the rectangles A and B to a position where the pin joint is almost connected.
Try dragging each of the different bodies. Your screen should resemble
Figure 1-25.
Figure 1-25
Preparing to join
A
C
7.
Note that the Join button is active. The button becomes active whenever you
select:
two points,
one of two points that were split from a pin joint, or
a body with a point that was split from a pin joint.
24
The linkage will reassemble itself, moving its component pieces around
to make them overlap where necessary.
Figure 1-26
The re-joined mechanism
A
C
B
If the points that make up the pin joint are a long distance apart, the
Smart Editor will ask you to move the points closer together before
making the join.
You can use the Smart Editor to set the initial conditions of a simulation. In
this example, you will use the Smart Editor to return the mechanism to its
exact initial position.
1.
25
A
B
The Coordinates bar displays the set of parameters you can edit
immediately.
Figure 1-28
Coordinates bar for a body
x-position
y-position
height
width
rotation
2.
3.
The rectangle will be moved to a position where its rotation is 0.00. The
other bodies in the mechanism will move to satisfy this condition.
26
Figure 1-29
Using numerical editing for
precision alignment
Create a new Working Model 2D document by choosing New from the File menu.
2.
Select the Circle tool and create a small circular body in the middle of the
workspace.
27
Figure 1-30
A small circle and a small rectangle
3.
Select the Rectangle tool and create a rectangle similar to the one shown in
Figure 1-30.
Click the Rectangle tool in the Toolbar, and then draw the rectangle on
the screen. Position the circle and rectangle to resemble Figure 1-30.
4.
6.
The ball bounces a few times and then comes to rest on the rectangle.
7.
28
Creating Controls
You will now create a simulation with an initial velocity control. In this
simulation, the circle will act as a projectile that is fired horizontally from the
left. You will use a slider control to change the initial velocity of the center
of the circle.
Figure 1-32
Circle and rectangle
1.
Drag the circle and rectangle so that your screen resembles Figure 1-32.
2.
3.
Choose New Control from the Define menu. Hold down the mouse button and
choose Initial X Velocity from the submenu.
A new control appears. This control specifies the initial velocity of the
center of the circle in the x (horizontal) direction.
Figure 1-33
Velocity control
4.
Pick an initial x velocity for the center of the circle by using the slider to raise or
lower the value.
29
Try to have the ball hit the table by adjusting the initial velocity. Reset
the simulation to try again.
MacOS
1.
A dialog box appears asking you to choose the menu command that you
want the new button to perform.
2.
The button appears with the name Run. Clicking on this button is the
same as choosing Run from the Run menu.
3.
4.
5.
6.
You now have a document with two menu buttons. Drag the menu
buttons and the velocity control so that your screen looks like Figure 134.
Windows
1.
A dialog box appears asking you to choose the menu command that you
want the new button to perform. A list of all menu commands and actions
is displayed alphabetically.
30
The button appears with the name Run. Clicking on this button is the
same as choosing Run from the World menu.
3.
4.
5.
6.
You now have a document with two menu buttons. Drag the menu
buttons and the velocity control so that your screen looks like Figure 134.
Figure 1-34
Menu buttons
Click near the buttons border or drag a selection rectangle around the button to
select it.
2.
Position the pointer near the selected button until the pointer changes to a
crosshair.
31
Player Documents
Finally, you will change this document into a player simulation. Player
simulations are simplified documents suitable for demonstrations or for use
by people without experience using Working Model 2D.
Player simulations are simplified in a number of ways. For example, there
are no toolbars, objects cannot be dragged or resized, and menus are greatly
simplified.
4.
32
1.10. Summary
In this guided tour, you learned how to use the tools in the toolbar to create
and manipulate objects. Then you learned how to run sample simulations and
create simple ones yourself.
You saw that creating a simple simulation consists of drawing objects, setting
their initial velocities, and then running the simulation with the click of a
button.
You used the Smart Editor to create and edit a complex linkage of bodies.
You also learned how to display meters and vectors for measuring physical
quantities, how to track objects, how to add simple controls to adjust data
input during a simulation, and how to create menu buttons.
C H A P T E R
33
In this chapter, you will learn about the main tools and menus of Working
Model 2D.
Windows Toolbars
On Windows systems, Working Model 2D provides a set of dockable,
floating toolbars (shown in Figure 2-2, Figure 2-3, and Figure 2-4). When
you first launch the program, the toolbars are in their docked positions on the
top and left edges of the application window.
34
Figure 2-1
Simple Toolbar (Windows); a
subset of all tools
Circle
Rectangle
Curved Body
Square
Polygon
Anchor
Point
Pin Joint
Rigid Joint
Slot Joint
Spring
Damper
Spring Damper
Force
Motor
Rope
New
Open Save
Cut
File Operations
Arrow
Clipboard Operations
Text
Rotate
Run
Copy Paste
Zoom Out
Zoom In
Stop
Reset
Help
35
36
Figure 2-3
Body, Join/Split, and Point
Toolbars (Windows)
Circle
Polygon
Rectangle
Square
Curved Body
Anchor
Join
Split
Point
Horizontal Slot
Curved Slot
Square Point
Vertical Slot
Closed Curved Slot
37
Figure 2-4
Joint and Constraint Toolbars
(Windows)
Pin Joint
Rigid Joint
Horizontal
Horizontal
Vertical
Vertical
Open
Closed
Rotational Spring
Rotational Damper
Gear
Torque
Spring
Damper
Spring Damper
Force
Motor
Actuator
Rope
Separator
Pulley
Rod
Each individual toolbar can be hidden by clicking on the close box in the
upper right-hand corner. Once hidden, a toolbar can be restored by selecting
Workspace... in the View menu and clicking the appropriate checkbox (see
Displaying Workspace Tools and Controls on page 196 for more details).
38
MacOS Toolbar
In the MacOS, every Working Model 2D document has a single toolbar on
the left side. To minimize clutter in the workspace, the toolbar (Figure 2-5)
provides access to many tools via pop-up palettes, which are special tool
icons indicated by a small arrow (shown as ) in the lower right-hand corner
of the icon.
To open a pop-up palette, position the pointer on a tool icon with an arrow in
the lower right-hand corner, and press the mouse button. The pop-up palette
appears to one side of the icon. Drag the pointer to highlight the desired tool
and release the mouse button. The selected tool is now displayed in the
toolbar and can be used to re-select the tool without opening the pop-up
palette.
Using Tools
If you click once on a tool, it will be selected for the next operation; after that
operation, the selected tool will revert to the Arrow tool. To use a tool for
several successive operations, double-click on it. (MacOS only: the
difference between single vs. double-clicking is indicated on the Toolbar by
shading: a double-clicked item is dark gray, while a single-clicked item is
light gray.)
To quickly select the Arrow tool, press the space bar. To quickly select the
Rotate tool, press the r key.
39
Run
Reset
Rotate
Arrow
Text
Circle
Rectangle, Square
Anchor
Point
Square Point
Slots
Slot Joints
Join
Split
Spring, Rotational Spring,
Spring Damper
Rod
Rope, Separator
Pulley, Gear
Force, Torque
Motor
Actuator
40
Edit Tools
The Arrow tool is used to select an object or a group of objects, or to drag a
selected group of objects on the screen. Pressing the space bar will
automatically select the Arrow tool.
The Rotate tool is used to rotate an object or a selected group of objects.
Objects can be rotated about their center of mass, about pin joints, or about
measurement points. When using the Rotate tool, you will see a line snap to
the nearest point about which objects can be rotated. Pressing the r key will
automatically select the Rotate tool.
The Text tool is used to enter text directly onto the simulation workspace.
The Zoom In tool increases the magnification of the workspace by a factor
of two (2x). The new view is centered on the area around the pointer.
Holding down the shift key will toggle this tool to the Zoom Out tool.
The Zoom Out tool decreases the magnification of the workspace by a factor
of two (1/2x). Holding down the shift key will toggle this tool to the Zoom
In tool.
41
Run Controls
The Run button starts a simulation. On MacOS systems, the Run button
changes into the Stop button when a simulation is in progress.
The Stop button stops a simulation in progress. On MacOS systems, the Stop
button changes into the Run button when a simulation is not running.
The Reset button is used to bring a simulation back to its initial conditions
(the first frame).
Body Tools
The Circle tool is used to create circular bodies.
The Square tool is used to create square bodies.
The Rectangle tool is used to create rectangular bodies.
42
Join/Split Control
The Join button forms a joint from two elements. For example, you can
select two point elements (created using the Point tool, as shown below), and
click the Join button to form a pin joint, or . You can also join a point element
and a slot element to form a slot joint. For more information, see Chapter 5,
The Smart Editor.
The Join button also re-combines elements that have been separated using the
Split button.
The Split button separates a joint into its component elements. In this sense,
the Split button reverses an action performed by the Join button. For
example, if you select a pin joint and click the Split button, the joint is split
into two point elements. See Chapter 5, The Smart Editor for more
information.
43
The Slot Element tools are used in conjunction with the point elements to
form slot joints. For example, you can attach a slot element to the back
ground, attach a point element to a body, and join the two elements to form a
slot joint. The slot joint allows the body to slide and rotate along the joint
(see Figure 2-6).
Figure 2-6
A slot joint example
44
Joint Tools
Joint tools are the collection of Working Model 2D tools to create various
types of joints. See Chapter 4, Constraints for more information on each
joint.
The Pin Joint tool is used to create a pin joint. A pin joint allows a single
degree of freedom in rotation and no degree of freedom in translation. A pair
of bodies (or a body and the background) bound by a pin joint can rotate but
cannot translate with respect to each other.
The Rigid Joint tool is used to create a rigid joint. A rigid joint locks two
bodies together and allows no degree of freedom.
The Slot Joint tools are used to create various types of slot joints.
The Pinned Slot Joint tools constrains a point element on one body to align
with a slot element on a second body (or the background), and allows the first
body to rotate about the point element. Working Model 2D provides pinned
slot joints with vertical, horizontal, curved, and closed curved slots. You can
change the geometry of the slot after the joint is created.
The Keyed Slot Joint tools constrains a point element on one body to align
with a slot element on a second body (or the background), and prohibits the
first body from rotating. For example, a keyed slot joint can constrain the
motion of a piston moving in one direction inside a combustion chamber.
Working Model 2D provides keyed slot joints with vertical and horizontal
slots. You can change the geometry of the slot after the joint is created.
Constraint Tools
Constraint tools are the collection of Working Model 2D tools to create
various types of constraints. See Chapter 4, Constraints for more
information on each constraint.
The Damper tool creates a link which resists changes in compression or
extension. For example, a damper simulates a shock absorber of an
automobile suspension. Dampers can be attached between one body and the
background or between two bodies (the endpoints of the damper are the
attachment points).
45
The Rotational Damper tool creates a pin joint that resists changes in
rotation. Like dampers, rotational dampers can connect two bodies or a body
and the background (the endpoints of the spring are the attachment points).
For example, a rotational damper simulates the resistance experienced by a
propeller rotating in a viscous medium.
46
47
48
49
Air Resistance... causes the Air Resistance dialog to appear, allowing you to
control the air resistance within the active simulation.
Electrostatics... causes the Electrostatics dialog to appear, allowing you to
control electrostatic forces.
Force Field... causes the Force Field dialog to appear, allowing you to create
your own custom force fields to act upon all of the bodies within the active
simulation.
Run starts your simulation.
Reset returns a simulation to its initial conditions (the first frame).
Start Here starts your simulation from the current conditions. A new set of
initial conditions is created based upon the current position and velocity of all
objects.
NOTE: You cannot undo Start Here, which will erase the simulation history
including the previously specified initial conditions.
Skip Frames presents a submenu which lets you specify various playback
rates for your simulations. Skipping more frames will allow faster playback
of a previously calculated simulation. When you open the Skip Frames
submenu, a checkmark appears to indicate the current skip rate.
The options available in the submenu are: 1 step, 2 step, 4 step, 8 step, 16 step,
and Other. The Other dialog lets you choose your own skip rate. A skip rate
of 1 step will play every frame of your simulation.
Tracking presents a submenu which lets you leave a trace of your simulation
at various time intervals. When you open the Tracking submenu, a
checkmark appears to indicates the current tracking rate.
The options available are: Off, Every frame, Every 2 frames, Every 4 frames,
Every 8 frames, Every 16 frames, Every 32 frames, and Other. The Other dialog
box lets you choose your own custom tracking rate.
AutoErase Track, if active, erases tracks whenever the simulation history is
erased. A checkmark appears before the menu item when it is active.
Erase Track immediately erases the trace of any tracked simulation.
50
Grid Lines
X,Y Axes
51
Status Bar shows or hides the Status bar across the top
(MacOS) or bottom (Windows) of the simulation
window.
Scroll Bars
52
53
Style (MacOS only) allows you to choose the style in which the selected text
will be displayed.
Font (Windows) causes the Font dialog to appear, allowing you to select the
font type for selected object(s). The Fonts, Font styles and Sizes available
include the fonts installed in your system.
[The following menu items, Attach Picture and Detach Picture, appear
alternately depending on what objects are selected. For more information, see
Attaching Picture Objects to Bodies on page 248.]
Attach Picture attaches a picture to a single body. The picture replaces the
standard representation of the body in the workspace.
Detach Picture detaches a picture from the body which it represents. The
standard representation of the body reappears and the picture becomes a
separate object in the workspace.
[The following menu items, Attach to Body and Detach from Body, appear
alternately depending on what objects are selected. For more information, see
Attaching and Detaching a Slot Element on page 163.]
Attach to Body attaches a set of points and/or slots to a body while
maintaining their current position in the workspace.
You may find this command useful in importing DXF files. See Chapter 9,
Importing and Exporting Files and Data for details.
Detach from Body detaches a set of points and/or slots from the body to which
they are currently attached. The detached points and slots are immediately
attached to the background.
Convert Objects presents a submenu with the following options:
Convert to Lines
segments.
Convert to Polygon
polygon.
54
55
Gravity Force, Electrostatic Force, Air Force, Force Field, Kinetic Energy, and
Gravity Potential. Selecting other objects will give you various measurement
options.
When two bodies are selected, the Measure menu changes so that you can
measure forces that inherently act between a pair of objects, including
Contact Force, Friction Force, and Pair Gravity Force.
56
Figure 2-7
Properties window
The Geometry window (Figure 2-9) controls the geometry of selected bodies.
The properties that appear in this window depend on the type of object
selected. A rectangles geometry is specified by width and height. A
polygons vertices can be altered by editing the values in this window.
57
Figure 2-9
Geometry window
For Rectangles
For Polygons
Cascade (Windows only) arranges all the currently open document windows
in a cascaded fashion (the title bar for each window is visible).
Tile (Windows only) arranges all the currently open document windows in a
tiled fashion (each window is visible but reduced in size).
Arrange Icons (Windows only) neatly aligns the iconized Working Model 2D
documents.
[List of open documents] A list of open documents is appended to the bottom
of the Window menu when more than one document is open.
The Tab Key and Utility
Windows
You can use the tab key to navigate from one text field to the next on a utility
window. The tab key can also be used to select a utility window. If you have
an object in the workspace selected, then pressing the tab key will
automatically select the last-selected utility window associated with the
object.
58
Chapter 3Bodies
C H A P T E R
Bodies
Circle
Polygon
Square
Rectangle
Curved Body
59
Circle Tool
Polygon Tool
Square Tool
Rectangle Tool
Curved Body Tool
Each body has a number of parameters that define its behavior when you run
a simulation. These parameters are initially set to default values. For
example, the density of every body is initially set to 1.000 kg/m2. Please see
3.2. Body Properties for more information.
Once a body is created, you can attach constraints at precise locations on the
body. Please refer to Positioning Constraints Precisely on page 101 for
details.
Hold down the mouse button and drag diagonally until the rectangle or square
attains the desired dimensions.
60
Chapter 3Bodies
Note that the Coordinates bar shows the current dimensions and position
of the object (see Figure 3-3). You can edit these values later.
If you chose the Square tool, all four sides of the body always have equal
lengths.
4.
Figure 3-3
Creating a rectangle
2.
3.
Note that the rectangle or the square is drawn diagonally, following your
mouse movement.
4.
When the body reaches the desired size, click the mouse button again.
You do not need to change any options or preferences to use this alternate
drawing method. Working Model 2D intelligently identifies your actions on
the mouse and switches drawing methods.
Editing Position and
Geometry Quickly
You can quickly edit the position, orientation, and dimensions (width and
height) of the rectangle or square you just created as follows:
61
Click the field you would like to edit in the Coordinates bar, and type the number
desired (see Figure 3-4 for available parameters). Press the Enter or Return key.
x-position
y-position
height
width
orientation
Creating Circles
To create a circle:
1.
2.
Hold down the mouse button and drag diagonally to create a circle of any size.
The Coordinates bar shows the current dimensions and position of the
object (see Figure 3-5). You can edit these values later.
4.
62
Chapter 3Bodies
Figure 3-5
Creating a circle
Click here...
2.
3.
When the body reaches the desired size, click the mouse button again.
You do not need to change any options or preferences to use this alternate
drawing method. Working Model 2D intelligently identifies your actions on
the mouse and switches drawing methods.
Editing Configuration and
Radius Quickly
You can quickly edit the position, orientation, and radius of the circle as
follows:
1.
Click the field you would like to edit, and type the number desired (see Figure 3-6
for available parameters). Press the Enter or Return key.
x-position x-position
63
radius orientation
Since the way a curved body is defined by its control points is similar to the
way a polygon is defined by its vertices, these two types of objects are
fundamentally related. In fact, Working Model 2D treats curved bodies as a
subclass of polygons with an additional curved Geometry parameter
selected (see Converting Between Polygons and Curved Bodies on
page 80). Due to this similarity, curved bodies are listed in the Status bar and
in all selection menus as polygons.
To draw a polygon or curved body:
1.
You can use the values shown in the Coordinates bar to identify the
global coordinates of the point. The first vertex serves as the first control
point in the case of a curved body.
4.
Move the pointer and click each time you want to create a new vertex. Note that the
Coordinates bar shows the relative displacement of the mouse pointer from the last
vertex created (Figure 3-7).
64
Chapter 3Bodies
Working Model 2D will automatically construct the polygon or curved
body as you create each vertex.
Figure 3-7
Creating polygons or curved
bodies
5.
Click on the first vertex, or double-click the final point to complete the polygon or
curved body. Alternatively, press the space bar to finish after you click the last
vertex.
If you have the Geometry window open, the polygon or curved body will
display a crosshair titled FOR, its frame of reference. See Frame of
Reference (FOR) on page 67 for details.
If you construct a polygon or curved body with crossed lines, Working
Model 2D will display a dialog warning that the bodys moment, mass,
and center of mass will be approximated and that it will not collide with
other objects.
Reshaping Polygons and
Curved Bodies Graphically
Polygons and curved bodies can be reshaped with the mouse or through the
Geometry window. This section will cover the mouse-driven reshaping,
while Reshaping Polygons and Curved Bodies Numerically on page 82 of
this chapter covers the latter method.
To graphically reshape polygons and curved bodies:
1.
Select the polygon or curved body and choose Reshape from the Edit menu.
65
2.
3.
To drag an object while in Reshape mode, click in the body of the object (away from
a vertex or an edge).
4.
Exit Reshape mode by deselecting Reshape from the Edit menu, or by choosing
any tool in the Toolbar.
Figure 3-8
Reshape mode
To add a vertex:
1.
Choose Reshape in the Edit menu. The menu item toggles the Reshape mode.
2.
Click on the desired side (away from an existing vertex) and drag the new vertex to
the desired position.
To delete a vertex:
1.
Be sure to be in Reshape mode (the Reshape menu item in the Edit menu should
have a checkmark).
2.
Select the reshape handle corresponding to the vertex you want to delete.
Select Cut from the Edit menu, or press the delete key.
66
Chapter 3Bodies
Each object in the Working Model 2D workspace behaves according to its
defined characteristics and properties. The properties of an object can be
changed in one of the two ways:
Properties Window
The Properties window (Figure 3-9) provides you with full access to the
available properties of bodies. Information regarding geometry and
appearance can be accessed through the Geometry window (see 3.4. Body
Geometry) and the Appearance window (see 3.3. Body Appearance).
Figure 3-9
Properties window for a body
Either (1) double-click on a body to view its Properties window, or (2) select the
body and then choose Properties from the Window menu.
You can shift from one body to another by simply clicking on different
bodies, or choosing the object from the list in the selection pop-up Menu
(shown in Figure 3-9).
Coordinates Bar
The Coordinates bar at the bottom of the document window shows object
parameters that are frequently edited. Each object has a set of parameters that
can be modified quickly; the Coordinates bar display for a rectangle, for
example, shows the x- and y-position, orientation, width, and height.
67
The center of mass (COM) of a body can be specified arbitrarily. See 3.4.
Body Geometry for instructions.
Taking Measurements
For bodies, meters can measure the position, velocity, and acceleration of
COM and FOR. Meters are further discussed in 7.1. Meters.
Initial Velocity
You can use the Properties window to specify numerically the initial velocity
of the center of mass (COM) of a body.
68
Chapter 3Bodies
You can also specify the translational initial velocity of the COM of a body
using the mouse as follows:
1.
Choose Preferences in the World menu. In the Preferences dialog, check an item
titled: Allow velocity vector dragging.
2.
3.
Click the body for which you wish to specify the initial velocity.
4.
Drag the blue dot located at the center of mass to specify its initial translational
velocity.
69
1.
70
Chapter 3Bodies
mm, or 3.28 10 ft. If you chose the material to be steel, which has a density
of about 500 lb/ft3, the weight of the object would be shown as 500 times
3
3.28 10
, or 1.639 lb.
All objects are initially given a density of 1.0 g/cm3 (equal to the density of
water).
Larger objects are initially heavier than smaller objects because they are both
given the same density.
You can view the density of any body in the Properties window. The only
way to directly change a bodys density is through choosing a material. You
indirectly change a bodys density whenever you specify a new body.
Mass Moment of Inertia
By default, bodies are assigned moments of inertia by assuming that they are
planar and have a uniform mass distribution.
You can adjust the moment of inertia of bodies so that they behave as if their
mass were distributed around their edge, like a shell. You can also specify
the moment of inertia of circular bodies so they behave as if their mass were
distributed like a sphere. You can specify the moment of inertia numerically
as well.
To set a body's moment of inertia to that of a shell or spherical weight
distribution:
1.
Bring up the Properties window for the body by selecting the body and choosing
Properties from the Window menu.
2.
The numerical value of the object's moment changes to reflect the new
moment of inertia.
Charge
Charge dictates how a body will behave in an electrostatic field. Bodies are
given an initial charge large enough to produce movement between human
scale (1.0 meters) objects. Charges only affect the simulation when the
Electrostatics feature is turned on. Electrostatics can be turned on by
selecting Electrostatics in the World menu.
Working Model 2D assumes that electric charge is lumped at the center of
mass for each body. The charge is not distributed across the body and
therefore is independent of the body geometry.
71
You can quickly set many of a body's properties to reflect a specific type of
material. Some of these settings are approximate. Materials include rubber,
rock, plastic, ice, clay, wood, and steel.
The table below shows the list of values stored in Working Model 2D. Static
and kinetic friction coefficients are denoted s and k, respectively.
Material
Density
Elasticitya
Charge
(C)
(g/cm3) [(lb/ft3)]
Standard
1.0 [62.9]
0.3
0.3
0.5
0.0001
Steel
8.0 [503.4]
0.4
0.3
0.95
0.0001
Ice
0.9 [56.6]
0.02
0.01
0.0
(none)
Wood
0.5 [31.5]
0.2
0.2
0.5
(none)
Plastic
0.5 [31.5]
0.2
0.2
0.7
0.0001
Clay
2.0 [125.9]
0.9
0.8
0.02
(none)
Rubber
0.5 [31.5]
0.9
0.8
0.95
0.0001
Rock
4.0 [251.7]
0.4
0.3
0.2
(none)
a. In Working Model 2D, Elasticity refers to the coefficient of
restitution considered in collisions.
To set a body's properties to those of a specific material:
1.
Bring up the Properties window for the body by double-clicking on the body or by
selecting it and choosing Properties from the Window menu.
2.
72
Chapter 3Bodies
Figure 3-10
Coordinates bar when two
rectangles are selected
The above display indicates that the two rectangles have the same
y-coordinates, height, and orientation.
To set the properties of more than one body at the same time:
1.
You can select multiple objects using shift-select; selecting one object
after another while holding down the shift key.
2.
Enter the new value in the appropriate field of the Coordinates bar.
All of the selected bodies will have their properties modified at the same
time.
Properties Window
73
You can select multiple objects using shift-select; selecting one object
after another while holding down the shift key.
The selection pop-up shows mixed selection. When you open the
selection pop-up, the relevant items are shown with a minus sign (-)
next to the object ID (Figure 2-7).
Figure 3-11
Properties window with more than
one body selected
2.
Enter the new value in the appropriate box of the properties window.
All of the selected bodies will have their values adjusted at the same time.
The selection pop-up menu at the top of each utility window displays the ID
and the name of the currently selected object(s). All objects in Working
Model 2D have default names (such as circle and spring), but these
names can be easily customized using the Appearance window (see 3.3.
Body Appearance for instructions). Meaningful names will assist you
tremendously in selecting objects.
To select other objects in the workspace:
1.
Drag down the pop-up menu and select the name of the object you wish to select.
74
Chapter 3Bodies
The utility window will show the properties of the selected object.
Remember that curved body objects are listed in the selection menu as
polygons by default.
Figure 3-12
Selecting an object using the
selection pop-up menu
If objects do not have meaningful names yet, you can use the status bar to
identify object IDs (such as Body[2]). The status bar will show the name of
objects as you move the mouse over them. Turn on the status bar to assist in
finding object names.
To turn on the status bar:
1.
Select Workspace in the View menu, and then select Status bar in the Workspace
submenu or dialog.
75
Figure 3-13
Appearance window for a body
Name Field
2.
To change the color and fill pattern for an objects interior and outline, click
on the pop-up menus next to Fill and Frame in the body Appearance window.
76
Chapter 3Bodies
Fill
The center of a body can be transparent, a solid color, or a pattern of any two
colors, including black and white.
Click on the two pop-up menus next to Fill in the Appearance window to
change the fill color and pattern.
Frame
You can also change both the width and the color of the outline of an object.
The fill pattern may not be apparent for thin outlines.
These three options determine which parts of a body will be traced on the
screen when tracking is turned on in the World menu.
Track Center of Mass will leave a point at the body's center. You can turn on
Show Center of Mass to render the track more pronounced.
Track Connect will leave connecting lines between the body's center of mass
at subsequent positions.
Track Outline will leave a trace of the body's outline.
Figure 3-14
Example of Track Center of Mass,
Track Connect, and Track Outline
Track of Outline
Show
You can hide a body by clicking once in the field titled Show to remove the
checkmark. Hidden bodies behave exactly like displayed bodies. All bodies
are initially shown.
Show Name
The name of a body is automatically set to its type (circle, rectangle, square,
or polygon). Remember that curved body objects are named polygons by
default. You can change this name by typing directly into the name field of
the Appearance window.
77
Choose Show Name to display the name of the body. Figure 3-15 shows a
rectangle with its name displayed.
Figure 3-15
Body with name displayed
Select the Show Center of Mass box to display a body's center of mass. The
center of mass indicator appears as a black-and-white disk. If you have Track
Outline turned on, the indicator will also leave its track.
Figure 3-16
Center of mass symbol
Show Charge
If Show Charge is selected, then positively charged bodies will have large
positive (+) signs in them, while negatively charged bodies will have large
negative () signs in them.
Initially, each circle has a line fixed in it that passes through its geometric
center and is parallel to the World frames x-axis. The orientation of a circle
is defined to be the angle between this line and the x-axis of the World frame.
Select Circle Orientation to display the line that indicates the current
orientation of the circle.
To close the Appearance window, click its close box.
78
Chapter 3Bodies
To modify the geometry of bodies, you can either use the Coordinates bar or
the Geometry window. The Coordinates bar provides you with quick-andeasy access for the geometry parameters, whereas the Geometry window
gives complete control, including importing or exporting the geometry data
of polygons to and from other applications. The Geometry window can also
be used to modify vertex locations for polygons and control points for curved
bodies.
This section shows how to use the Geometry window. For the use of the
Coordinates bar, Please refer to 3.1. Creating Bodies.
To display the Geometry window:
1.
2.
Alternately, if the Geometry window is already visible, you can simply select
the desired object from the selection pop-up menu at the top of the window
(Figure 3-17). The menu will show the list of ID numbers and the names of
all objects in the document. You can change and assign meaningful names
by typing into the name field in the Appearance window (see 3.3. Body
Appearance). Assigning custom names will help you search through the
list of objects.
79
Area
Bodies in Working Model 2D are defined with an area rather than with a
volume. The only way you can change the area of a body is by resizing the
object with the mouse, or by changing values in the Geometry window.
By default, all bodies are created with the Center of Mass (COM) at the
geometric center of the object. The center of mass can be moved by
modifying the x- and y-offset fields, as shown in Figure 3-17.
These values are given with respect to the frame of reference for the object
(see Frame of Reference (FOR) on page 67 for details). In Auto mode (as
indicated by the radio button on Figure 3-17), the COM is automatically
recomputed whenever the polygon is reshaped so that the COM coincides
with the geometric center.
Using meters, you can take kinematic measurements of a body (such as
position, velocity, and acceleration) in terms of its COM or of FOR. See 7.1.
Meters for details.
Also available in the formula language are explicit references to COM and
FOR. For example, body[n].cofm.p refers to the COM, whereas
body[n].p refers to FOR. See Appendix B, Formula Language
Reference for more details.
Radius
Radius is the choice available in the Geometry window when a circular body
is selected. Circular bodies may be accurately sized by setting their radii.
The Radius can also be edited in the Coordinates bar. Please see Creating
Circles on page 61.
80
Chapter 3Bodies
Height and width are choices available in the Geometry window when a
rectangle is selected.
These parameters can also be edited in the Coordinates bar. Please see
Creating Rectangles and Squares on page 59.
The Geometry window gives you complete control of polygon vertices and
curved body control points. By default, the coordinates are given with respect
to the world (i.e. global coordinates). You can add vertices/control points,
delete vertices/control points, and reshape polygons/curved bodies using the
Geometry window.
Converting Between
Polygons and Curved
Bodies
The Geometry window allows you to convert polygons into curved bodies
and vice versa though the Curved body checkbox. For polygons, this box
is unchecked and the point coordinates refer to the polygons vertices.
Clicking to check the box converts the polygon into a curved body with
control points at the former vertex coordinates of the polygon.
Width:
body[3].width /2
Height:
body[3].height/2
81
Shape Coordinates
Shape coordinates show the position of each vertex with respect to the
objects FOR (see Frame of Reference (FOR) on page 67), as local
coordinates. The shape coordinates of a vertex do not change unless the
object is reshaped at that point itself or the entire object is resized. The world
coordinates of the FOR are shown as the x, y and in the Properties window
(see Initial Position and Orientation on page 67).
The type of coordinate system used for Shape coordinates depends on
whether the object is a polygon or a curved body. Polygon Shape coordinates
are given in Cartesian coordinates; Shape coordinates for curved bodies are
given in polar coordinates.
82
Chapter 3Bodies
Copy / Paste
You can copy and/or paste vertex coordinates to and from other applications,
such as spreadsheets or text editors. See Copying Polygon or Curved Body
Geometry to and from Other Applications on page 85 for specifics.
2.
83
The object will change shape as you enter new coordinates. Notice how
each vertex is highlighted on the object as you scan down the vertex table
with the tab key.
Adding a Vertex
To add a vertex:
1.
2.
4.
A duplicate vertex will be created in the vertex list. The shape of the
object will not change until you edit the duplicate. See Figure 3-20.
84
Chapter 3Bodies
Figure 3-20
New object with two identical
vertices
5.
Deleting a Vertex
Edit the coordinates of the new vertex to create a geometrically distinct point.
To delete a vertex:
1.
2.
85
Figure 3-21
Deleting a vertex
4.
The vertex is deleted from the list, and the polygon or curved body is
reshaped accordingly.
Copying a Polygon or
Curved Body to Another
Application
Select the polygon or curved body and choose Geometry from the Window menu.
86
Chapter 3Bodies
The Geometry window appears and shows the vertices.
2.
Switch to the target application and use Paste from its Edit menu to paste the data
points.
2.
Copy the selected data to the Clipboard using the Copy function of the source
application.
87
The vertices of the polygon are not important as they will be overwritten
with the new data that is pasted.
4.
In the Geometry window, select whether you want the data to be interpreted as
World or Shape coordinates by clicking on the appropriate radio button.
This step is very important. Mismatching the coordinate system will lead
to an incorrect rendering of the object.
5.
88
Chapter 3Bodies
If two bodies are not directly connected with each other, Working Model 2D
assumes that they can collide. For example, if three bodies A, B, and C are
connected by pin joints as shown in Figure 3-23, objects A and B will not
collide by default, but objects A and C will, since the two do not have a direct
connection.
Figure 3-23
Objects connected in chain
B
A
Select the set of bodies that you want to collide (or not to collide).
89
Figure 3-24
Collision submenu: three cases
The checkmark (if any) beside the two menu items indicates whether the
selected objects can collide. Three possible cases are as follows:
If the checkmark is located beside Collide, the selected set of bodies can
collide with one another. That is, any two bodies among the selected set
will collide with each other when they come in contact.
If the checkmark is located beside Do Not Collide, the selected set of
bodies cannot collide with one another (they will penetrate one another).
Note that any two bodies among the selected set will penetrate each other
when they come in contact.
A dash (-) appears on both Collide and Do Not Collide when more than
two bodies are selected and the collision property is not uniform for all
bodiessome bodies collide and others do not. For example, if you
selected the three bodies shown in Figure 3-23, the Object menu will
show two dashes. To identify exactly which objects are colliding, select
two bodies at a time and verify the Object menu for each pair.
90
Chapter 4Constraints
C H A P T E R
Constraints
Linear Constraints
Rotational Constraints
Forces and Torques
1. A
pulley system is an exception, since it has nodes in addition to endpoints. See 4.10. Pulleys for details.
91
Joints
Linear Constraints
Linear constraints have two end points and apply force along the line
connecting their endpoints. Linear constraints include Springs, Dampers,
Ropes, Rods, Separators, Actuators, and Pulleys. You can construct them
by clicking the appropriate tool in the Toolbar and then dragging the
constraint onto the workspace.
Forces produced by these constraints have the equal magnitude and act upon
the bodies in opposite directions at either endpoint.
Rotational Constraints
Rotational constraints apply a twisting force (torque) between two objects.
Rotational constraints include Motors, Gears, Rotational Springs, and
Rotational Dampers. All rotational constraints (except gears) include a pin
joint.
Rotational constraints must be created directly by using the appropriate tool.
You cannot create a rotational constraint by joining primitive elements. Once
created, rotational constraints can be split and edited as separate points.
Joints
Joints connect two bodies and constrain how they move relative to one
another. Working Model 2D provides Pin Joints, Rigid Joints, and Slot
Joints. Slot joints can be straight or curved. See 4.18. Joints and 4.19.
Slot Joints for more information.
You can construct joints in one of two ways:
92
Chapter 4Constraints
Figure 4-1
The endpoints of a rope connected
to a circular body
Properties Window
As with all other objects in the Working Model 2D workspace, you can
double-click on any constraint to display the Properties window, which is
used to adjust or define the constraints parameters.
You can also display the Properties window for any constraint by selecting
the constraint and choosing Properties from the Window menu.
93
Select an object for which you want to find out the connections and associations.
Figure 4-2
Selection pop-up showing a pin
joints association with other
objects
Hold the mouse-button down at the Selection pop-up menu (Figure 4-2).
94
Chapter 4Constraints
In the Selection pop-up, objects shown with asterisks (*) (Windows) or
printed in bold face (MacOS) indicate that these objects are attached to or
associated with the selected object. Figure 4-2 shows that Point[1] and
Point[2] are associated with Constraint[3]. Indeed, Constraint[3],
a pin joint, consists of Point[1] and Point[2].
Figure 4-3 shows another example. In the figure, Point[2] is selected from
the Selection pop-up, and Constraint[3] and Body[8] have asterisks to
indicate attachment. Note that the middle part of the Properties window also
confirms this relationship.
Figure 4-3
Selection pop-up showing a points
association with other objects
The above examples reveal that the objects in the model are associated as
shown in the diagram (Figure 4-4):
(Not shown in
Properties window)
Constraint[3]
Body[8]
Background
Part of
Attached
Part of
Point[1]
Attached
Point[2]
All constraints have a default name when first created, but you can assign
arbitrary names to each of them (or to any Working Model 2D object). The
custom names appear in the Selection pop-up, helping you find the desired
object(s) quickly.
To assign custom names to constraints, please see Assigning Names to
Constraints on page 96.
95
Figure 4-5
Properties window with more than
one spring selected
Selection Pop-up
96
Chapter 4Constraints
The Properties window only shows properties that are the same across all
selected constraints. For example, Figure 4-5 shows that the spring constant
is 50, but the length field is blank, indicating that the springs share the same
spring constant and have different lengths.
If you modify a property of a mixed selection in the Properties window, all
the selected constraints will have the same value. For example, if you typed
2.0 in the length field in the Properties window as shown in Figure 4-5, then
the two springs would both have 2.0 meters as their rest length.
Hiding slot elements to avoid a long slot cutting across your simulation
screen.
Hiding a spring-damper suspension mechanism in an automobile to
make the model look more realistic.
2.
2.
97
Type the desired name in the name field of the Appearance window (Figure 4-6).
Figure 4-6
Appearance window
Name Field
Show Checkbox
Linear constraints contain two endpoints. Each point has coordinate values
(x, y) measured in the local coordinate system of the body to which it is
attached.
Rotational Constraints
Rotational constraints also contain two points, one of which is called the Base
Point. As above, each point has (x, y) values measured in the local coordinate
system of the body to which it is attached.
The Coordinates bar, located near the bottom of the document window, shows
various information regarding objects currently selected. You can also edit
these coordinates on the fly to modify your model easily and quickly.
1. If
the point element is attached to the background, then the local coordinates are identical to the global ones.
98
Chapter 4Constraints
The set of values displayed in the Coordinates bar varies depending on the
type of the constraint. For example, when a spring is selected, the
Coordinates bar shows the two endpoints (Figure 4-7) and its rest length. The
(x, y) pairs are shown in the coordinate system of the body to which each
endpoint is attached.
Individual sections later in this chapter show which parameters can be edited
in the Coordinates bar for each type of constraint. Also, Displaying the
Coordinates Bar on page 201 provides useful tips on using the Coordinates
bar.
Figure 4-7
Coordinates bar for a spring
P2
P1
P1 coordinates
P2 coordinates
Spring Length
99
Local Coordinates
(Always Editable)
Global Coordinates
The top set is given in local coordinates; the values are given with respect to
the body to which the point is attached. You can edit these values at all times.
The bottom set of is given in global coordinates. If local coordinates are
defined using geometry-based formulas, you cannot edit global coordinates
since formulas are evaluated with higher priority than any global coordinate
specification.
In the case of a motor that attaches a circular body to the background, the base
point of the motor has coordinates measured in the World frame, whereas the
Point has coordinates measured with respect to the center of the circle.
You can modify these values directly to locate the constraint precisely. For
example:
by modifying the Base Point coordinates, you can precisely specify the
location of the motors attachment point with respect to the background
(the disk and the motor will move together), or
by modifying the Point coordinates, you can precisely specify the
location of the motors attachment to the disk (the disk alone will move).
Figure 4-9 illustrates this example with a motor.
100
Chapter 4Constraints
Figure 4-9
Base Point and Point of a rotational
constraint
4.0
1.0
6.0
Select the rotational constraint and choose Properties in the Window menu.
The Properties window shows the names of the Base Point and the Point,
such as Point[14] and Point[15].
2.
You will see a pop-up list of all the objects in the current model.
Coordinates Descriptions
with Formula Language
3.
4.
Type the coordinate values to position the points precisely at the desired location.
Working Model 2D has two distinct sets of expressions, designed for global
and local coordinates reference.
point[i].p
Global Coordinates
point[i].offset
Local Coordinates
(returns a body)
101
When you are editing the constraint coordinates numerically, you can use not
only numeric values but also geometry-based formulas which specify
constraint positions with respect to the geometry of bodies.
Using Object Snap
Figure 4-10
Attaching a motor with Object Snap
102
Chapter 4Constraints
The object snap feature can be turned on or off at any time. To toggle the
object snap mode:
1.
FOR, Quadrants
Circle
FOR, Vertices,
Midpoints
Polygon
Rectangle / Square
1
--- h
2
1
--- h
2
1
--- h
2
h = min(Height, Width)
103
When the Grid Snap feature is active, you can attach a constraint endpoint to
the background so that it is automatically aligned to the regular intervals of
the grid. You can also align bodies with the Grid Snap.
To activate Grid Snap:
1.
The Coordinates bar (Figure 4-12) displays constraint parameters that are
frequently edited, such as the endpoint coordinates.
For rotational constraints, the first set of (x, y) values holds the coordinates of
the Base Point (point element attached to the body in the lower layer; see
Figure 4-12). The values are given in terms of the local coordinate system.
For linear constraints, the first set of (x, y) values holds the coordinates of the
first point created (see Figure 4-12).
Figure 4-12
Coordinates bar
(1.0, 0.0)
4.0
6.0
Base Point
Top Point
(-1.0, 0.0)
1.0
2.0
First Point
Second Point
104
Chapter 4Constraints
Figure 4-13
Local and global coordinates for a
point element
Local Coordinates
Global Coordinates
Local Coordinates
You can enter numerical values or formulas in the Coordinates bar. The
modification takes effect immediately even if formulas are entered.
Individual sections later in this chapter discuss which parameters can be
edited using the Coordinates bar for each constraint.
Using Geometry-based
Formulas (Point-based
Parametrics)
Figure 4-14
Examples of geometry formulas
body[1]
body[2].height
(body[1].width / 2, -body[1].height / 2)
attached to body[1]
body[2].width
(body[2].width / 2, body[2].height / 2)
attached to body[2]
body[2]
(body[2].width / 4, 0.0)
body[3].radius
body[3]
(0.0, body[3].radius / 2)
105
Select the constraint endpoint whose position you would like to modify.
2.
Alternatively, you could type the formulas directly into the Coordinates
bar; however, you may find the fields a bit too short to enter long
expressions.
Geometry formulas not only help you position constraints endpoints
precisely, but also make these endpoint attachment immune to resize and
reshape. As shown in Figure 4-15, you can stretch a rectangle, and the spring
endpoint stays attached to the midpoint of one of its sides.
Figure 4-15
How geometry formulas preserve
constraint attachment
body[3]
106
Chapter 4Constraints
uppermost bodies lying directly beneath the constraint. You can control
which bodies are uppermost (in front) by using Bring To Front and Send To
Back in the Object menu.
Overriding Automatic
Attachment
You may want to override the automatic attachment when you wish to attach
a constraint to a body without having the constraints endpoint lie within the
bodys outline.
Figure 4-16
Constraint with overridden
connection
Drag the constraint to a position where its endpoints are connected to the desired
bodies.
2.
Hold down the Command (MacOS) or Control (Windows) key while dragging either
the constraint, or one of its endpoints.
You could also attach multiple points to an arbitrary body, whether or not
they are located within the body. To attach a point to a body:
1.
2.
107
The points are attached to the body without changing their position.
Figure 4-17
Splitting a constraint followed by
deleting an endpoint
1. Split Constraints
The ability to split and join constraints is a part of the Smart Editor feature.
Please see Chapter 5 for more information on the Smart Editor.
Removing Constraints
You can remove any constraint by selecting it and pressing the delete or
backspace key or by choosing Clear (MacOS), Delete (Windows), or Cut in
the Edit menu.
108
Chapter 4Constraints
Enter a formula directly into the Active When field in the constraint Properties
window.
Select a constraint, and then choose New Control from the Define menu.
2.
Select On/Off from the submenu that appears next to New Control.
A new control will be created that allows you to turn the constraint on
and off. For more information on controls, see 7.2. Controls.
109
Polarity Definitions
Constraint Length
Constraint Velocity
Figure 4-19
Constraint velocity and force in the
positive direction
Velocity of
the Circle
In this example...
Constraint Forces
Constraint forces are defined as positive when they tend to increase the length
of a constraint (push outwards).
You may consider that the constraint force always measures compression.
For example, since the spring shown in Figure 4-19 is under tension (which
can be considered as negative compression), Working Model 2D measures
the constraint force as negative.
Constraint Rotation
110
Chapter 4Constraints
The base point of a rotational constraint is the bottom-most point of the
constraint when the constraint is sketched. You can verify the position of the
base point of rotational constraints in the Coordinates bar.
When a constraint is split, the base point will include the constraint icon (e.g.,
a spring and a curled arrow for a rotational spring as shown in Figure 4-20).
Figure 4-20
Constraint torque in the positive
direction
Constraint Torques
4.4. Ropes
As its name suggests, a rope applies forces at its endpoints so that the distance
between them does not exceed the specified length, or the rope length. A rope
applies no force at all when the distance between the endpoints is less than the
rope length.
Creating a Rope
To create a rope:
1.
2.
Position the mouse pointer where you would like to define the first endpoint.
4.4. Ropes
111
3.
4.
Drag the mouse to the desired location of the second endpoint. Release the mouse
button to create the second endpoint.
Second Point
Length
Rope Properties
To view and modify the properties of a rope, select the rope and select
Properties from the Window menu. Figure 4-22 shows the Properties window
for a rope.
Figure 4-22
Properties window for a rope
112
Chapter 4Constraints
Rope constraints have two parameters that can be defined: length and
elasticity.
Length
The two endpoints of a rope can never be further apart than the rope's length.
The length of a rope does not change when the rope goes slack.
Current Length
The current length of the rope is the shortest distance between the two
endpoints of the rope. Therefore, when the rope is taut, the magnitudes of the
length and current length are equal.
When you first create a rope, it has no slack; i.e., it is stretched taut between
the two endpoints. When you move an endpoint, the rope remains taut and
its length is automatically updated.
You can also set the length numerically in the Properties window or
Coordinates bar for the rope.
If you specify the length as a numeric constant, the rope will be modified to
the specified length immediately. If the specified length is longer than the
current length, the rope will become slack. If the specified length is shorter
than the current length, the rope will immediately shorten, and the Smart
Editor (see Chapter 5, The Smart Editor) will automatically modify the
rest of the model to accommodate the specification.
If you used a formula expression to specify the length, the formula will be
immediately evaluated as t = 0, and the rope length will be modified
accordingly. Again, the Smart Editor will automatically modify the rest of
the model to accommodate the specification.
Elasticity
Rope constraints apply tension and absorb energy when they move from a
slack configuration to their full length. The coefficient of elasticity for a rope
determines how much energy will be preserved during this transition.
The coefficient of elasticity determines the difference between the relative
velocities of attached bodies before and after a rope reaches full length. A
coefficient of 1.0 results in a completely elastic rope; i.e., attached bodies
which are moving apart will bounce back with the same kinetic energy due
to the rope tension. On the other hand, a rope with a coefficient of 0 is
completely inelastic; the kinetic energy of attached bodies will be completely
absorbed by the rope as it becomes taut.
4.4. Ropes
Slack rope
113
You can first create a taut rope, then specify the length to be longer than the
current length. The rope will be slack, while the endpoints of the rope will
remain stationary.
In order to modify the distance between the two endpoints without modifying
the length of the rope:
1.
The rope's length is automatically set to be the distance between the two
endpoints.
2.
Move either endpoint of the rope while holding down the Option (MacOS) or Control
(Windows) key.
The rope becomes taut or slack depending on how you move the
endpoint.
Figure 4-23
Resizing a rope while maintaining
its length
You can simulate a rope that breaks in the middle of the simulation. In
Working Model 2D, you only need to turn off the rope. The inactive rope
is displayed as a dotted line and exerts no force.
You need to determine when the rope is supposed to be broken. For example,
you may want to turn off the rope at time > 1.0.
To break a rope:
1.
2.
114
Chapter 4Constraints
3.
In the Active When field, type the desired condition during which the rope is to be
active. The rope will break when the condition is not satisfied.
For example, you can type time < 1.0, indicating that the rope is active
only while time is less than 1.0 (in the current unit system).
You can also specify a condition such as |body[5].a| < 50, which
means that the rope will break when body[5] gains acceleration greater
than 50.
See Turning Constraints On and Off on page 108 for more information.
4.5. Springs
A spring exerts a force that depends on the distance between its two
endpoints. A spring applies no force at all when the endpoint distance is equal
to the rest length of the spring.
Creating a Spring
To create a spring:
1.
2.
Position the mouse pointer where you would like to define the first endpoint.
3.
4.
Drag the mouse to the desired location of the second endpoint. Release the mouse
button to create the second endpoint.
4.5. Springs
115
Figure 4-24
Coordinates bar for a spring
First Point
Second Point
Rest Length
Spring Properties
To view and modify the properties of a spring, select the spring and select
Properties from the Window menu.
You can change the spring constant and rest length of springs. You can also
make springs exert forces proportional to the inverse square of their length.
Spring Constant
The spring constant determines how stiff a spring is. Springs with a large
spring constant stretch less than do springs with a low spring constant, given
the same load. Linear springs exert a force equal to the distance they are
stretched from their rest length times their spring constant.
The spring constant of a spring can be changed using the Properties window.
Simply double click on the spring or select it and choose Properties from the
Window menu.
Rest Length
The rest length is the length of a spring when it is neither stretched nor
compressed.
When you sketch or drag a spring, the rest length is automatically made equal
to the current length; i.e., the spring is neither stretched nor compressed. You
can create springs with rest lengths other than the automatic value (current
length) in two ways.
To set the rest length of a spring numerically:
1.
Double-click on a spring.
3.
Click OK.
You can graphically set the rest length of a spring using the mouse:
116
Chapter 4Constraints
1.
Resize the spring while holding down the Option key (on MacOS) or Control (on
Windows) key.
The spring's rest length will remain the same while you resize the spring.
Spring Type
You can create inverse square springs, along with springs that produce forces
proportional to the square, cube, or reciprocal of their extension. A linear
spring exerts a force equal to its spring constant multiplied by its extension
from rest length. This choice is available in the Spring Type pop-up as -Kx.
Figure 4-25
Choosing a spring type
Spring Type Menu
Select the spring and choose Properties from the Window menu.
Click the pop-up menu next to Force = and drag to select the desired spring type.
4.6. Dampers
117
4.6. Dampers
A damper exerts a force that depends on the difference in velocity between its
two endpoints. A damper applies no force at all when the endpoints have the
same velocity (i.e., equal in magnitude and direction).
For example, you can use a damper to simulate a shock absorber of an
automobile suspension.
Creating a Damper
To create a damper:
1.
2.
Position the mouse pointer where you would like to define the first endpoint.
3.
4.
Drag the mouse to the desired location of the second endpoint. Release the mouse
button to create the second endpoint.
Second Point
Damper Properties
To view and modify the properties of a damper, select the damper and select
Properties from the Window menu.
118
Chapter 4Constraints
Damper Constant
A damper with a high damper constant resists motion more than a damper
with a low damper constant.
Damper Type
You can create dampers that exert forces proportional to the velocity, velocity
squared, or velocity cubed between their two endpoints. A linear damper
exerts a force proportional to the difference in velocity between its endpoints.
This choice is available in the damper type pop-up as -Kv.
Figure 4-27
Choosing a damper type
Select the damper and choose Properties from the Window menu.
Click the pop-up menu next to Force = and drag to select the desired damper
type.
119
For example, you can use a spring damper to simulate a McPherson strut (a
combination of a shock absorber with a coiled spring wrapped around it).
Position the mouse pointer where you would like to define the first endpoint.
3.
4.
Drag the mouse to the desired location of the second endpoint. Release the mouse
button to create the second endpoint.
Second Point
120
Chapter 4Constraints
Figure 4-29
Properties window for a spring
damper
Select the spring damper and choose Properties from the Window menu.
Choose the property of the spring damper you would like to change.
You can change the spring constant, the rest length of the spring, and the
damping constant.
121
Position the mouse pointer at where you want to create the spring, and click once.
The Coordinates bar shows the coordinates for the Base Point (point element
on the bottom layer) and the Top Point (point element on the top layer) as well
as the (rest) rotation (Figure 4-30). Both coordinate values are given in
reference to the body to which each point is attached.
Figure 4-30
Coordinates bar for a rotational
spring
Base Point
Top Point
Rotation
Select the rotational spring and choose Properties from the Window menu.
122
Chapter 4Constraints
Figure 4-31
Properties window with rotational
spring selected
You can create rotational springs that exert torques proportional to the square,
cube, or inverse square of their rotations as they are wound up.
Use the pop-up menu next to Torque in the Properties window to change the
rotational spring type.
A rotational spring with a larger spring constant exerts more torque for a
given rotation than one with a smaller constant.
Enter the value for the rotational spring constant next to K in the Properties
window.
Rotational Damper
Constant
You can create a rotational spring damper which combines a rotational spring
and a linear rotational damper (described in 4.9. Rotational Dampers). A
rotational spring damper exerts a torque equal to the sum of the torques
exerted by the spring component and the damper component. The damper
component exerts a torque equal to the product of the damper constant and
the relative angular velocity between the two bodies attached to the
endpoints. The default value for the damper constant is zero; i.e., there is no
damping component.
Enter the value for the rotational damper constant next to C in the Properties
window.
123
Position the mouse pointer at where you want to create the damper, and click once.
The Coordinates bar shows the coordinates for the Base Point (point element
on the bottom layer) and the Top Point (point element on the top layer) as
shown in Figure 4-32. Both coordinate values are given in reference to the
body to which each point is attached.
124
Chapter 4Constraints
Figure 4-32
Coordinates bar for a rotational
damper
Base Point
Top Point
Select the damper and choose Properties from the Window menu.
Figure 4-33
Properties window with rotational
damper selected
You can create a rotational damper that exerts a torque proportional to the
square or cube of the relative angular velocity between the two bodies
attached.
Use the menu next to Torque in the Properties window to change the
rotational damper type.
Rotational Damper
Constant
A rotational damper with a larger damping constant exerts more torque than
one with a smaller constant. The amount of torque exerted by a rotational
damper is equal to the relative angular velocities of the two bodies attached
to the endpoints, multiplied by the constant.
4.10. Pulleys
125
Enter the value for the rotational damper constant next to K in the Properties
window.
4.10. Pulleys
Pulleys behave as a single rope going through multiple fixed points. The total
length of the rope is fixed, but the partial length between each pair of adjacent
points can vary.
Background attachments
Body attachment
2.
126
Chapter 4Constraints
4.
Each time you click you will create a new segment of the rope along with
the tiny hole that acts as a joint.
5.
Double-click on the last point or press any key to complete the pulley.
The Coordinates bar shows the coordinates for the first and last points created
(Figure 4-35), as well as the total length of the rope in the pulley system. Both
coordinate values are given in reference to the body to which each point is
attached.
Figure 4-35
Coordinates bar for a pulley
system
First Point
Last Point
Length
Select the pulley system and choose Properties from the Window menu.
Figure 4-36
Properties window with pulley
system selected
Length
4.11. Gears
127
Current Length
This is the length of a line connecting each point in the pulley system. If the
pulley is slack, the current length is less than the length of the pulley.
Elasticity
Elasticity defines how objects will behave if the pulley system goes quickly
from a slack to a taut configuration. For more information on elasticity, see
Rope Properties on page 111.
4.11. Gears
The Gear tool provides a constraint between two bodies so that their rotations
are dependent on each other. Gears also have a built-in rod that can be useful
when you are simulating planetary gears (the rod is active by default but can
be turned off if you so prefer). The section Principle of Simulating Gears
on page 131 provides more discussion on how gears are simulated in
Working Model 2D.
Figure 4-37 shows a typical use of gears in Working Model 2D, where two
disks of different radii are in contact. One disk is driven by a motor, where
the other is attached to the background with a pin joint. In this case, the gear
ratio is computed as the ratio of the two radii. (See Gear Properties on
page 133 for more discussions on the gear ratio and other properties.)
Figure 4-37
Gears relate behaviors of two
bodies
Creating a Gear
To create a gear:
1.
2.
128
Chapter 4Constraints
On MacOS systems, the Gear tool is hidden in the Pulley pop-up
palette by default. Click and hold on the Pulley tool to bring the Gear
tool in view and select it.
3.
Drag the mouse to the second body. Release the mouse button to create the
second gear.
The second gear icon is automatically aligned with the center of mass of
the second body, if attached to a body.
The Coordinates bar display for Gears shows the position of the two
endpoints. Since the endpoints are always aligned to the Center of Mass, the
Coordinates bar almost always shows (0,0), initially. Editing these values
will result in shifting the endpoints of the built-in rod for the gear.
External Gears
Internal Gear
You can define one of the bodies connected with the gear constraint to act as
an internal gear a gear that has teeth along the inside of its circumference.
A typical example may involve two overlapping bodies (usually with one
completely inside the other) where the larger body is defined as the internal
gear (as shown in Figure 4-38).
4.11. Gears
Figure 4-38
An internal gear
129
external gear
internal gear
Working Model 2D defines external gears by default, even if two bodies are
clearly overlapping. To create an internal gear:
1.
2.
Open the Properties window and click on the Internal Gear checkbox.
One of the gear icons will turn into an internal gear icon, indicating that
the gear will behave as if it had internal teeth.
3.
Click on the appropriate radio button in the Properties window to indicate which
gear you want to be internal (with teeth on the inside of its circumference).
You can use an internal gear to simulate a chain drive mechanism as well. As
with spur gears, you can specify the gear ratio (see Gear Properties on
page 133 for details). An example of a chain mechanism is shown in
Figure 4-39.
Figure 4-39
Chain drive mechanism using
internal gears
130
Chapter 4Constraints
To create a chain drive mechanism like the one above:
1.
Create two disks that are slightly separated, as shown in Figure 4-39.
2.
3.
For example, attach a motor to the center of one of the disks, and attach
a pin joint to the center of the other. The second disk is now free to rotate
with respect to the pin.
4.
Open the Properties window of the gear constraint, and select the body that
appears on top (i.e. the body that was first selected to be a gear) to be the internal
gear (see Figure 4-40 below).
Figure 4-40
Properties window for gears to
simulate a chain drive
In automatic mode, the gear ratio
is computed as:
radius(body[2])/radius(body[1]).
This is the body first selected
when you created the gear pair.
This step ensures that the automatically computed gear ratio is correct.
You could select the body that appears on the bottom to be the internal
gear; in that case, however, you must invert the gear ratio.
5.
Click Run.
4.11. Gears
131
Principle of Simulating
Gears
A gear constraint allows two rigid bodies to exert forces on each other at a
single point of contact. The point of contact is located along the line passing
through the centers of mass of the two bodies; its location depends on the gear
ratio. For circular gears, the gear ratio is computed as the ratio of the radii of
the bodies.
In the case of two circular gears in contact as shown in Figure 4-37, the point
of contact is the point where the gears make contact. If the two gears were
separated, however, the (virtual) point of contact would lie somewhere
between the two gears.
Figure 4-41 below shows examples of how the points of contact (indicated by
the arrows) are located for several pairs of external and internal gears. For
example, given two gears that have the radial ratio of 3 to 1, Working Model
2D computes the default gear ratio as 3.0. Then, as shown in Figure 4-41, the
point of contact for each pair of gears is located so that the ratio a/b is always
3.0.
132
Chapter 4Constraints
Figure 4-41
Examples of computing point of
contact for gear pairs
External Gears
a
Internal Gears
The driving gear exerts a gear force on the driven gear in the direction
perpendicular to the line connecting the two. Working Model 2D computes
the force necessary to maintain proportional rotation, angular velocity, and
angular acceleration on both disks at the point of contact.
Since all gears are simulated according to this principle, you can create gears
that are more generalized than what one might expect in the physical world.
Specifically:
NOTES ON GEARS:
4.11. Gears
133
If one of the bodies is designated as an internal gear, the gear ratio cannot
be 1.0 unless the centers of mass of the gear bodies coincide. Otherwise,
the point of contact would be located at infinity and the simulation will
become indeterministic (consider the case where a = b = 1.0 in the
lower-right drawing in Figure 4-41). A warning dialog appears when the
gear ratio for an internal gear is explicitly assigned as 1.0. A formula
definition of gear ratio cannot be evaluated until run-time, so you must
make sure that the formula does not return 1.0 for an internal gear ratio
during the simulation.
Gear Properties
To define or change the properties of a gear constraint:
1.
Click on the rod connecting the gears (or box-select it), and choose Properties from
the Window menu.
Alternately, you can double-click on the line (rod) connecting the pair of
gears.
Figure 4-42
Properties window for a gear
Gear Ratio
If both bodies are circles, the default gear ratio is computed automatically as
r1/r2 where r1 and r2 are the radii of the first and second disks, respectively.
If at least one of the gear bodies is not a disk (say, a polygon), the default gear
ratio is set to 1.0.
134
Chapter 4Constraints
Changing the gear ratio affects the location of the point of contact, thereby
changing the behavior of bodies connected with gear constraints. Please refer
to Principle of Simulating Gears on page 131 for more detail.
You can override the default gear ratio and set it to an arbitrary positive
floating point number or use a formula, thus allowing more generalized gears.
For example, in Working Model 2D simulations, two disks of the same radius
can have a gear ratio other than 1.0.
Rod Active
By default, each pair of gears has a rigid rod constraint between the two
centroids. A rod constraint maintains a constant distance between two bodies
attached at each of its endpoints. Therefore, a rod keeps the centroids of the
two gear bodies apart at its length, while allowing each of them to rotate about
its endpoints. This feature can be useful, for example, when you are
simulating a set of planetary gears.
You have a control when or whether the rod should be active. You can define
when the rod should be active using formulas as with any other constraint.
See Turning Constraints On and Off on page 108 for details.
Internal Gear
By default, Working Model 2D assumes that all gears are external gears. This
option lets you make one of the bodies into an internal gear. The Properties
window provides radio buttons to select which body is meant to be the
internal gear.
The gear ratio cannot be 1.0 when an internal gear is used unless the
centroids of the gear bodies coincide.
Gear Force
This window shows the variable name of the gear force. Working Model 2D
treats the pair of gears as a combination of two constraints; a gear force and
a rod. The Gear Force variable name is assigned to the gear force constraint,
while the rod constraint carries the variable name which appears at the top of
the Properties window.
You can refer to these variable names to measure the amount of the gear force
or the rod force. For example, in the case of the Properties window as shown
in Figure 4-42:
Constraint[16].f.y
represents the force exerted from one gear to the other (the x-component is
always zero), while
Constraint[15].f.x
4.12. Rods
135
4.12. Rods
A rod applies forces at its endpoints to maintain a fixed length between the
(the rod length).
Creating a Rod
To create a rod:
1.
2.
Position the mouse pointer at where you would like to define the first endpoint.
4.
Drag the mouse to the desired location of the second endpoint. Release the mouse
button to create the second endpoint.
Second Point
Length
136
Chapter 4Constraints
Rod Properties
Rods exert whatever force is necessary to keep their endpoints a fixed
distance apart.
To change the properties of a rod:
1.
Select the rod and choose Properties from the Window menu.
Figure 4-44
Properties window with a rod
selected
Length
4.13. Separators
A separator applies forces at its endpoints so that they do not become closer
than the specified distance. A separator applies no force at all when the
distance between the endpoints are greater than this specified distance.
4.13. Separators
137
Creating a Separator
To create a separator:
1.
Position the mouse pointer at where you would like to define the first endpoint.
4.
Drag the mouse to the desired location of the second endpoint. Release the mouse
button to create the second endpoint.
Second Point
Length
Separator Properties
Separators behave like ropes except that they act in the opposite direction.
Ropes prevent their endpoints from being greater than a certain distance
apart; separators prevent their endpoints from being less than a certain
distance apart.
138
Chapter 4Constraints
Length
This is the actual length of the separator when the endpoints are at their
closest position. The endpoints of a separator can never be closer than this
length.
If you specify the length as a numeric constant, the separator will be modified
to the specified length immediately. The Smart Editor (see Chapter 5, The
Smart Editor) will automatically modify the rest of the model to
accommodate the specification.
If you use a formula expression to specify the length, the formula will be
immediately evaluated as t = 0, and the separator length will be modified
accordingly. Again, the Smart Editor will automatically modify the rest of
the model to accommodate the specification.
Current Length
This is the current length of the separator, measured as the shortest distance
between its two endpoints. The current length is always greater than or equal
to the length.
Elasticity
Separators apply a repulsive force and absorb energy when they move from a
slack configuration to their minimum length. The coefficient of elasticity for
a separator determines how much energy will be preserved during this
transition.
The coefficient of elasticity determines the difference between the relative
velocities of attached bodies before and after a separator reaches minimum
length. A coefficient of 1.0 results in a completely elastic separator; i.e.,
attached bodies which are moving together will bounce apart with the same
kinetic energy due to the separator repulsion. On the other hand, a separator
with a coefficient of 0 is completely inelastic; the kinetic energy of attached
bodies will be completely absorbed by the separator as it reaches minimum
length.
To change the properties of a separator:
1.
Select the separator and choose Properties from the Window menu.
4.14. Force
139
Figure 4-46
Properties window with a separator
selected
4.14. Force
Unlike most other constraints, a force contains only one point element (the
point of application) and applies the specified force at that point. A force
must be attached to a body to have any effect in simulations.
Creating a Force
Forces are attached to the top body lying under the pointer at the time of the
click. To create a force:
1.
2.
Move the pointer to the location where the force is to act on a body.
140
Chapter 4Constraints
Figure 4-47
Sketching a force
2. Move the mouse here, and click again to mark the magnitude.
3.
In Cartesian mode...
Point of Application
X- and Y-components
In Polar mode...
Point of Application
4.14. Force
141
Force Properties
A force has one endpoint; this point indicates where the force is applied. You
can define a force in Cartesian (x and y force) or polar (rotation and
magnitude) coordinates.
To change the on-screen length of the vector without changing the physical
magnitude of the force, use the Vector Length dialog (found in the Define
menu). The display scales in the dialog box apply to all vector displays in
Working Model 2D, including the Force constraint.
The direction of a force can be specified either in relation to a body, or in
relation to the background. A force is considered to rotate with its body if its
line of action changes with the body.
Figure 4-49
Force whose line of action does not
rotate with body.
Figure 4-50
Force whose line of action rotates
with body
Select the force object and choose Properties from the Window menu.
142
Chapter 4Constraints
Figure 4-51
Properties window with a force
selected
Cartesian/Polar
In Cartesian mode, you can specify the x- and y-component of the force
vector. In Polar mode, you can specify the magnitude (|F|) and angle () of
the force vector.
A force that rotates with a body has its line of action fixed in the bodys
reference frame.
A force that does not rotate with a body has its line of action fixed in the
World frame.
Base Point
The Base Point shows the object ID of the endpoint of the force object.
4.15. Torque
Unlike most other constraints, a torque is applied only to one body.
Creating Torque
A torque object attaches to the top body lying under the pointer at the time of
the click and applies torque. To create a torque:
1.
4.15. Torque
2.
143
The Coordinates bar for Torque shows the attachment point (x, y) and the
torque magnitude (T) (Figure 4-53). The (x, y) values are in the local
coordinate system (of the body to which the torque is attached).
Please be reminded that the torque can be attached anywhere on the body, and
(x, y) values are irrelevant as far as dynamics are concerned.
Figure 4-53
Coordinates bar for a torque
Point where Torque is attached
Torque Magnitude
Torque Properties
A torque object applies a torque on a single body.
To change the properties of a torque:
1.
Select the torque and choose Properties from the Window menu.
144
Chapter 4Constraints
Figure 4-54
Properties window with a torque
selected
Torque
This is the value of the torque applied to the body. Positive torque is defined
as counterclockwise.
4.16. Actuators
An actuator is a multi-purpose constraint which exerts whatever force
necessary to maintain its constraint specifications. You can specify its
property in one of four ways: force, length, velocity, or acceleration. You can
specify the magnitude of the constraint using a constant or a formula (see
Chapter 10, Using Formulas for examples and Appendix A, Formula
Language Reference for more information).
The actuator extends or contracts in order to maintain the given constraint
condition. For example, if an actuator is providing a constant force to a body
sliding on a horizontal keyed slot, the body will experience a linear motion
with a constant acceleration. Then the actuator stretches indefinitely to
follow the moving body and keeps applying the force.
Creating an Actuator
To create an actuator:
1.
2.
Position the mouse pointer where you would like to define the first endpoint.
4.16. Actuators
145
3.
4.
Drag the mouse to the desired location of the second endpoint. Release the mouse
button to create the second endpoint.
Second Point
Actuator Properties
To change the properties of an actuator:
1.
Select the actuator and choose Properties from the Window menu.
146
Chapter 4Constraints
Figure 4-56
Properties window with an actuator
selected
2.
You can enter equations in the value field to create actuators that behave
like drivers. For more information on using equations, see Chapter 10,
Using Formulas.
Force
Length
Velocity
4.17. Motors
Acceleration
147
NOTE: When you use a function to specify the actuator force, length,
velocity, or acceleration, make sure that the function does not result in the
actuator length less than or equal to 0 in the duration of the simulation.
4.17. Motors
A motor is composed of two overlapping points and has a built in pin joint.
If a motor is created over a single body, the body will be attached to the
background beneath it. If a motor is drawn over the background, it will do
nothing. If a rotational constraint is drawn over two bodies, the motor will
bind the two bodies with the built-in pin joint.
Motors cannot be built by joining two elements, but they can be split to edit
their individual point elements.
Creating a Motor
To create a motor:
1.
2.
Position the mouse pointer at where you want to create the motor, and click once.
The Coordinates bar shows the coordinates for the Base Point (point element
on the bottom layer) and the Top Point (point element on the top layer) as
shown in Figure 4-57. Both coordinate values are given in reference to the
body to which each point is attached.
Figure 4-57
Coordinates bar for a motor
Base Point
Top Point
148
Chapter 4Constraints
Motor Properties
A motor has a built-in pin joint, which is composed of two points. Given two
bodies (or one body and the background) attached to these two points, a motor
functions as a multi-purpose constraint that exerts the torque necessary to
maintain the specified rotation, angular velocity, or angular acceleration
between the bodies.
A motor is similar to an actuator, except that a motor produces a torque rather
than a linear force. You can specify the motor constraint in one of the four
terms: torque, rotation, velocity and acceleration.
Torque
Rotation
Velocity
Acceleration
Select the motor and choose Properties from the Window menu.
4.18. Joints
149
Figure 4-58
Properties window with a motor
selected
2.
Select the type of the motor and enter the magnitude of the constraint appropriate
for your simulation.
4.18. Joints
Pin Joints and Rigid Joints
Pin joints allow rotation while forcing points on two different bodies to
overlap. Rigid joints lock two bodies together. Unless the force exerted on
them is being measured, rigid joints do not introduce extra force equations
into a simulation, and thus do not significantly decrease simulation speed.
See Joint Properties on page 152 for more details.
Creating a Joint
There are two ways to create joints. You can either attach a joint directly or
build a joint from primitive elements.
Attach a joint to two overlapping bodies directly by selecting the appropriate
joint tool in the toolbar. Click on the desired location for the joint. The top
two bodies that lie beneath the pointer will be joined. The slot component of
a slot joint will be attached to the second body (or to the background) beneath
the pointer.
For control and accuracy you can build joints out of primitive elements, just
as you would build a real pin joint out of two holes. Point elements are
synonymous with the holes drilled in a real body. The Join command forces
the two points to overlap and combines them to form a pin joint.
150
Chapter 4Constraints
To construct a complete pin joint or rigid joint:
1.
Align the bodies that will be connected by the pin joint or rigid joint.
2.
Figure 4-59
Creating a pin joint
Click here to
create a pin joint
3.
Top Point
You can precisely align the position of the pin joints by typing in coordinates.
See Joint Properties on page 152 for instructions.
You can build a pin joint by joining two points that are attached to separate
bodies. You can build a rigid joint by joining two square points that are
attached to separate bodies.
To build a pin joint or a rigid joint from primitive elements:
1.
Create point elements at the desired location of the joint on each of two bodies.
4.18. Joints
151
Use square points if you wish to create a rigid joint. Use regular points
if you wish to create a pin joint.
2.
Select two objects by holding down the shift key and clicking on each
object in turn.
Figure 4-61
Selecting two point elements to
make a joint
3.
You can also join a single point to an existing joint to create a joint binding
multiple bodies. This is very helpful when creating trusses and structures that
have several bodies joined at a common point.
For example, to join three bodies with a single pin joint:
152
Chapter 4Constraints
1.
Connect two bodies with a pin joint as explained in the previous sections.
2.
3.
Both Join and Split buttons are active at this point. If you click Split,
Working Model 2D will split the pin joint.
4.
Joint Properties
Each pin joint or rigid joint consists of two points attached to separate bodies.
Therefore, the Properties window shows the identities and positions of these
two points.
Measurable or Optimized
Rigid Joints
The Properties window of a rigid joint has two radio buttons that specify
whether the joint is optimized or measurable. An optimized rigid joint will
neither introduce extra forces in the simulation nor affect simulation speed
the two rigidly connected bodies behave as one. The optimization does not
permit measurement of forces and torques on the locked joint (they measure
as 0.0). To obtain correct force and torque readings, you can make the joint
measurable. Since the joined bodies will be treated individually, the
simulation will take slightly longer to compute.
Creating a Force or Torque meter for a rigid joint will automatically make it
measurable (non-optimized).
To define the properties of a pin joint or rigid joint:
1.
Select the joint and choose Properties from the Window menu.
2.
Edit the fields corresponding to the coordinates of the point you want to move.
4.18. Joints
153
Figure 4-63
Properties windows for a pin joint
and a rigid joint
Pin Joint
Rigid Joint
The Properties window shows the coordinates of the two points composing
the pin joint. The coordinates are shown relative to the frame of reference of
the body to which the point is attached. (If a point is attached to the
background, the window shows the global coordinates.) You can modify
these values to position individual points precisely.
If you modify the relative position of one of the points belonging to a pin
joint, the other point will move to match the repositioning. For example, one
of the points of the pin joint as shown in Figure 4-64 is attached to the circle.
In the left figure, the point has offset (0, 0). If you change the coordinates of
the point to (0, -0.3) in the Properties window, the other body (the rectangle)
moves along to match the repositioning.
Figure 4-64
Pin joint positioning and point
offset
Offset (0, 0)
154
Chapter 4Constraints
Typically, the meters for joint meters have the formula expressions in its
Properties window:
constraintforce(n).x
constraintforce(n).y
|constraintforce(n)|
for x-, y-components and the magnitude (the variable n differs depending on
the ID number assigned to the pin joint in your model). The expression
constraintforce(n) refers to the force vector acting on the body on the top
layer.
For example, suppose a pin joint constraint[5] consists of point[3]
and point[4]. Then the force meter for constraint[5] measures the
force acting at point[3]. Again, the components are broken into global xand y-coordinate axes.
155
Point[3]
Point[4]
Rectangle on Bottom Layer
The meter created for constraint[5] will measure the vector
constraintforce(5), which is equivalent to the vector point[3].force.
You can measure the force acting on the bottom point by replacing the force
meter fields with:
point[4].force.x
point[4].force.y
|point[4].force|
for x-, y-components and the magnitude, respectively. Please refer to Point
Fields on page B7 for more information.
using one of the straight Slot Joint tools from the Toolbar, or
joining a straight slot element with a point or a square point element (to
create pinned or keyed slot joints, respectively). For this method, please
refer to Creating Slot Joints from Elements on page 160.
156
Chapter 4Constraints
To construct a straight slot joint using a Slot Joint tool directly:
1.
Align the bodies that will be joined by the slot joint or keyed slot joint.
2.
Figure 4-67
Creating a straight slot joint
3.
The top two bodies will be joined. The slot element will attach to the
second body from the top; if only one body lies under the pointer, the slot
will attach to the background.
The Coordinates bar (Figure 4-68) for a straight slot joint shows the slot base
point and the slot pin coordinates (the point at which the body is attached to
the slot).
Figure 4-68
Coordinates bar for a straight slot
joint
Slot Base Point
using the Curved or Closed Curved Slot Joint tool from the Toolbar, or
joining a curved or closed curved slot element with a point element (to
create a pinned slot joint). For this method, please refer to Creating Slot
Joints from Elements on page 160.
157
To create a (closed) curved slot joint using the (Closed) Curved Slot Joint tool
directly:
1.
2.
The slot pin will be attached to the object. This point also becomes the
first control point of the curved slot.
3.
Click to create as many control points as you like, and double-click to signal the last
control point and finish drawing the slot. Alternatively, press the space bar to
complete the slot after you have clicked to create the last control point. Note that
the Coordinates bar shows displacement from the previous control point (as shown
in Figure 4-70).
3. Double-click at the
last point.
2. Click a sequence of
control points.
Figure 4-70
Coordinates bar showing offset
from previous control point
x- and y-offsets
distance
direction
158
Chapter 4Constraints
When the Curved Slot Joint tool is selected, Working Model 2D linearly
extrapolates the portions of the slot beyond the end control points. When the
Closed Curved Slot Joint tool is selected, Working Model 2D automatically
closes the curve between the end control points.
The Coordinates bar for a curved slot joint shows the slot base point and the
slot pin coordinates (the point at which the body is attached to the slot). Both
values are based on local coordinates.
Figure 4-71
Coordinates bar for a curved slot
joint
Slot Base Point
Curved slots can be reshaped with the mouse or through the Geometry
window. This section will cover the mouse-driven reshaping, while
Reshaping a Curved Slot Numerically on page 167 of this chapter covers
the latter method.
To reshape a curved slot:
1.
The menu item will be enabled only if a polygon, curved body, or curved
slotobjects that can be reshapedexists.
2.
The curved slot shows reshape handles at all of its control points, as
shown in Figure 4-72.
159
Figure 4-72
Curved slot in Reshape mode
3.
Exit Reshape mode by deselecting Reshape from the Edit menu or by selecting any
other tool in the Toolbar.
You must return to edit mode to drag the curved slot with the mouse.
To add a control point:
1.
Be sure to be in Reshape mode (the Reshape menu item in the Edit menu should
have a checkmark).
2.
Click on the slot (away from an existing control point) and drag the new control
point to the desired position.
Be sure to be in Reshape mode, using the Reshape option in the Edit menu.
2.
3.
Select the reshape handle corresponding to the control point you want to delete.
Select Cut from the Edit menu, or press the delete key.
160
Chapter 4Constraints
NOTES:
If you attempt to join a square point and a curved slot, the resultant
combination will be a pinned curved slot joint.
No more than one point (round or square) can be attached to a single slot.
If you want multiple points to be attached to the same slot, you will need
to duplicate the slot (using, for example, Duplicate in the Edit menu) as
many times as the number of points you need to have attached.
For more information on joining elements and splitting constraints, see 5.1.
Joining Elements and Splitting Constraints.
To build a slot joint from primitive elements:
1.
Use the point tool in the toolbar to create the points. Use a square point
if you wish to create a keyed slot joint (straight slots only).
2.
Select two objects by holding down the shift key and clicking on each
object in turn.
161
Figure 4-73
Selecting a point and a straight slot
3.
A slot joint is created. The body moves so that the point and slot overlap.
Figure 4-74
Creating a slot joint by joining a
point and a slot
Cam Mechanism
To illustrate how a curved slot joint can be created from primitive elements,
lets create a component of a cam mechanism as shown in Figure 4-75 below.
162
Chapter 4Constraints
Figure 4-75
Simple cam mechanism
1.
Use the Closed Curved Slot tool. Click the first control point on the disk,
and click several control points, finishing the curve with a double-click
or by pressing the space bar.
We will make do with an arbitrary slot shape for now. Refer to
Reshaping a Curved Slot Numerically on page 167 for precise
adjustment of the slot geometry.
2.
Create a rectangular body (a cam follower) and attach a point element on one end
of the rectangle, which will later serve as the pin on the slot.
Make sure the object is long enough as shown in the figure above.
4.
Select the slot, and hold down the shift key to select the point on the cam follower.
5.
Click Join.
Adjust the cam follower so that it is horizontal at roughly the same y-position of the
driving motor.
163
You can drag the follower and/or use the Properties window of the
follower to type in the y coordinates and rotation to adjust the position
and orientation precisely.
7.
Use a horizontal keyed slot to attach the end of the cam follower to the background.
8.
Click Run.
Move the slot element to the desired position on or near the body.
Working Model 2D will not alter the position of the slot or the body when
attaching them together. You need to position the slot to the desired
position on the body first.
You can change the color or pattern of the body to transparent so that
you can see the slot element when it is covered by the object.
2.
The FOR of the slot element will be the FOR of the body. Coordinates of the
control points will be adjusted accordingly.
Detaching a Slot from a
Body
164
Chapter 4Constraints
2.
The slot will lose connection with the body, although the position of the slot
remains unchanged. The FOR of the slot will be moved to that of the
background (i.e., coordinate origin), and the control point coordinates will be
adjusted accordingly.
Select the slot joint and choose Properties from the Window menu.
Figure 4-76
Properties window with a slot joint
or keyed slot joint selected
The Slot field of the Properties window describes the slot element of the
slot joint. The slot element is described by the point at which it is
attached to the background (or to a body if the slot is on a body) and by
its rotation (for straight slots, the angle it forms with the x axis, for curved
slots the angle is initially 0). For curved slots, this attachment point is
the first control point created.
The Point field gives the coordinates of the point element of the pin joint.
This point is where the slot pin is located on the body.
165
166
Chapter 4Constraints
2.
Alternately, if the Geometry window is already visible, you can simply select
the curved slot whose geometry you want to view from the menu at the top of
the window.
Open/Closed Slot
You can convert between open and closed curved slots by selecting the
appropriate radio button. When curved slots are open, the slopes of the spline
curve at the boundary points are used to linearly extrapolate from there to
infinity.
167
Display Coordinates
Copy/Paste Table
You can copy and paste the coordinates of the control points to and from the
Clipboard, which stores the coordinates in the tab-delimited text format. This
feature is useful when you want to export or import numerical data of control
point coordinates from other applications in order to define the curved slot
precisely (see Copying a Curved Slot to and from Other Applications on
page 170 for instructions).
You can, of course, directly copy and paste curved slots graphically within
Working Model 2D just like any other object without using the Copy/Paste
Table feature.
Working Model 2D also allows you to copy a finite number of interpolated
points in the curved slot to the Clipboard. You can specify the number of
points to be sampled per one interval between two adjacent control points.
The Properties window of a curved slot displays the coordinates for the slot.
This point is defined as the frame of reference (FOR) for the curved slot. The
FOR of a curved slot is the FOR of the body to which it was attached when
the slot was first created. If the curved slot was initially created on the
background, its FOR is the global coordinate origin (0, 0).
The FOR for the slot remains fixed when the slot is reshaped either
graphically or by editing one of the control points in the Geometry window
(so that the coordinates of other control points remain unchanged). As a slot
is moved or dragged, the FOR is moved along. In this way, the control points,
shown as offsets from the FOR, remain unchanged as a slot is moved.
168
Chapter 4Constraints
The Geometry window can be used to add or delete control points; you can
even copy a coordinates table to and from the Clipboard for exchange of
precise geometric data with other applications.
You can use the Geometry window to modify the positions of individual
control points. You can also add and delete control points. Also, please see
Copying a Curved Slot to and from Other Applications on page 170 for
instructions to export or import geometry table to and from other applications.
To reshape a curved slot:
1.
2.
The slot will change shape as you enter new coordinates. Also, notice
how the control point currently being edited is highlighted on the curved
slot.
To add a control point:
1.
2.
Select a control point that will be adjacent to the new control point.
169
Figure 4-78
Adding a control point to a curved
slot
Select this
control point
4.
A duplicate control point will be created in the list. The shape of the slot
will not change until you edit the duplicate control point. See Figure 320.
Figure 4-79
New curved slot with two identical
control points
5.
Edit the coordinates of the new control point to create a geometrically distinct
point.
170
Chapter 4Constraints
To delete a control point:
1.
2.
Select the control point you wish to delete in the Geometry window.
Figure 4-80
Deleting a control point from a
curved slot
Select this
control point
4.
Curved slots are transferred via the Clipboard as coordinates of the control
points (with the option of including interpolated points). Specifically, the
data is simple text consisting of a list of number pairs (x, y) or (r, )
coordinates, delimited by a tab. Each number pair is on a separate line.
171
Almost all spreadsheets or text editors can immediately import such data by
pasting it from the Clipboard. CAD programs may require different methods
such as text/ASCII data input.
Copying a Curved Slot to
Another Application
Select the curved slot and choose Geometry from the Window menu.
If you want the interpolated points to be exported, click the Interpolated checkbox,
and specify how many interpolated points are to be exported between each pair of
adjacent control points.
4.
The table of point coordinates are copied to the Clipboard. For this step,
do not use the Copy in the Edit menu, which only copies a single number
selected.
5.
Switch to the target application, and use Paste from its Edit menu to paste the data
points.
To transfer curved slot data from another application to Working Model 2D:
1.
172
Chapter 4Constraints
Figure 4-81
Sample Excel spreadsheet
showing control point coordinates
2.
Copy the selected data to the Clipboard using the Copy function of that application.
3.
Switch to Working Model 2D and create an initial curved slot. Choose Geometry
from the Window menu.
The control points of this initial slot are not important as they will be
overwritten with the new data that is pasted in the next step.
4.
In the Geometry window, select whether you want the data to be interpreted as
Cartesian or Polar coordinates by clicking on the appropriate radio button.
5.
Similarly, select whether you want the interpolated curve to be open or closed.
6.
The data points are automatically interpreted as control points for the
curved slot.
Notes on Interpolations
173
You can generally work around this problem by turning on the Interpolated
option from Working Model 2D when you use Copy Table. By copying
interpolated points, you are exporting more data points per curve, allowing
another CAD/CAM program to mimic the curve you expected more closely.
174
C H A P T E R
Point
Square Point
Slot
175
A Pinned Slot Joint is composed of a slot and a point. A slot joint aligns a
point on one body with a slot on a second body.
A Keyed Slot Joint is composed of a slot element and a square point element.
A keyed slot joint aligns a point on one body with a slot on a second body,
and prevents rotation between the two bodies.
The Join button combines elements into joints. Select both of the elements,
and then click Join in the toolbar.
Figure 5-2
Working Model 2D joint types
For examples of how to construct pin and slot joints using the Join button, see
4.18. Joints and 4.19. Slot Joints.
The Split button separates a constraint into its elemental parts. Select a joint
and click Split in the Toolbar. Elements that are split remember that they
were once joined, so it is easy to take apart pieces of a mechanism and then
reassemble them. Split and Join can be used with constraints other than pins,
joints, rigid joints, and slot joints.
176
Figure 5-3
Two unconstrained rectangles
Figure 5-4
Joining two unconstrained
rectangles
Figure 5-5 and Figure 5-6 show what happens when you join two rectangles
that are only free to rotate about a pin joint but cannot translate.
Figure 5-5
Two constrained rectangles
Pin Joints
177
Figure 5-6
Joining two constrained rectangles
When joining two square points to form a rigid joint, you may notice that one
or both bodies rotate. The rotation occurs because the Smart Editor aligns the
orientations of the two square points when making the rigid joint.
For example, suppose two perfectly horizontal rectangular objects each
contain a square point, one of which is rotated 30 with respect to the
rectangle it is in. If you join these two square points, the two rectangles will
be connected with a relative angle of 30 between them, because the Smart
Editor aligned the orientations of the two square points. If you subsequently
change the rotation of one of the points, the bodies will rotate with respect to
each other.
178
1.
The rectangles move together (as shown in Figure 5-8) because they are
joined by a pin joint.
Figure 5-8
Dragging two pinned rectangles
179
3.
dragging or rotating
using the Join command
typing values into the Properties window
180
p
A
q
Lock Points only prohibits mouse-dragging of points. You can still enter
numerical coordinates in the Properties window to reposition points.
181
Lock Controls, also found in the View menu, is similar to Lock Points but
affects controls (meters, inputs, and menu buttons) rather than points (and the
endpoints of constraints). This option prevents mouse drags from changing a
controls position.
182
Thigh
Shin
Foot
1.
The gray blocks will move as a rigid unit, rotating the joint between the
thigh (the white block) and the background. Figure 5-12 illustrates
the situation.
Figure 5-12
Dragging the thigh
2.
Grabbing one of the gray blocks will cause the joints to pivot and the leg to change
shape.
183
Figure 5-14
Dragging the shin
A Linkage Example
Figure 5-15 is an example of a mechanism in which moving any piece
automatically moves all the others.
Figure 5-15
A linkage of four rectangles
184
Figure 5-16
Dragging the upper bar up and to
the right
Figure 5-17
Dragging the upper bar up and to
the left
Rotating Bodies
The Rotate tool also uses the Smart Editor to resolve constraints. The simple
linkage shown in Figure 5-18 has two rectangles and two pin joints.
185
Figure 5-18
A linkage of two rectangles and two
pin joints
1.
A dotted line will appear between the pointer and the nearest pivot
point, meaning a point around which one could reasonably rotate an
object. Joints are used as possible pivot points. The center of mass of
each object is also used as a possible pivot point. See Figure 5-19.
Figure 5-19
The dotted line between the pointer
and the nearest pivot point
2.
Rotate the horizontal rectangle. It rotates around the joint connecting it to the
vertical rectangle, as in Figure 5-20.
The Rotate tool will always leave fixed the other body, the one that is
connected to the selected body at the pivot point. If the pivot point is
connected to the background, then the rotation is relative to the
background.
186
Figure 5-20
Rotating the horizontal rectangle
3.
Try to rotate the vertical rectangle. Bring the pointer close to the bottom pin joint.
A dotted line appears between the bottom pin joint and the pointer, as in
Figure 5-21.
Figure 5-21
Preparing to rotate the vertical
rectangle
4.
The entire assembly rotates about the bottom pin joint, as shown in
Figure 5-22.
Figure 5-22
Rotating the vertical rectangle
187
The Smart Editor takes care of all constraints while these rotations are
occurring. It makes sure that the new configuration is consistent with existing
constraints.
Fixing a Base Point
It is possible to fix a base point for a rotation, rather than using the nearest
pivot. If you move near to a pivot point, then hold down the Option (MacOS)
or Control (Windows) key while moving the mouse, the editor will not keep
proposing new pivot points but will instead use the one you selected (the one
nearest the pointer when you pressed Option or Control). See Rotating
Objects on page 216 for instructions.
Select-All-Drag
188
Figure 5-23
Dragging a rectangle without
selecting the joint attached to it
If you now select the pin joint and drag again, the rectangle will be dragged
rather than rotated.
Figure 5-24
Dragging a rectangle after
selecting the joint attached to it
189
Figure 5-25
An impossible Join
If you try to Join them, the warning box in Figure 5-26 appears.
Figure 5-26
The impossible join warning box
Windows
MacOS
Trying to drag an object to a position inconsistent with the constraints will not
cause an error message. The Smart Editor will try to find the best solution,
by moving objects to minimize the distance between the pointer and the place
on the object where the pointer was originally clicked.
If you experiment with the Smart Editor, you will begin to see what is
involved. If you try to drag an object too far, it will follow the mouse, and
then stop after going as far as it can.
The best way to learn how to use the Smart Editor is to play with it. Set up
assemblies in the workspace, move them around, use Split and Join, and use
the Properties window to fix positions. The Working Model 2D Tutorial
comes with examples showing how to construct increasingly complex
mechanisms using the Smart Editor.
190
C H A P T E R
191
The Workspace
192
Figure 6-1
The interface layer and the
physical layer
Since interface objects are on the back layer, it is possible to obscure them by
positioning physical objects over them.
In the physical layer, a constraint will attach to the top body when positioned
on overlapping bodies.
To make an object the topmost object, select the object and then choose Bring
To Front from the Object menu.
193
The view:
what you
see in a
window
194
Figure 6-3
Window controls
Vertical Scroll Arrows
Vertical
Scroll Box
Click one of the four scroll arrows to pan the view in the direction you choose,
or drag a scroll box to jump to a new view position.
The scroll bars automatically adjust to encompass all the objects you have
created within the world. You can continue to use the scroll bars until your
objects are just off the screen. To scroll further, first use the Zoom tool to
zoom out.
Zooming
Using the Zoom Tools
Use one of the Zoom tools to increase or decrease magnification of the objects
in the world.
To use the Zoom tools:
1.
Select the Zoom tool with a positive sign (+) to increase magnification (Zoom In).
Select the tool with a negative sign (-) to decrease magnification (Zoom Out).
195
The objects on the screen become larger when you Zoom In and smaller
when you Zoom Out.
The new window after changing the magnification will be arranged so that
where you clicked the Zoom tool becomes the center of the screen (see
Figure 6-4).
Figure 6-4
Zooming, before...
Figure 6-5
...and after
196
The workspace scale in the View Size dialog indicates the size of the
workspace in relation to objects in real life. A scale of 1 means that objects
in the workspace are the same size as they are in reality (1 meter of the
workspace equals 1 meter in real life). A scale of less than 1 means that
objects in the workspace are smaller than they are in the real world.
To exactly specify the size or scale of the view:
1.
Scale field
2.
Enter a value in the scale field to specify the exact scale of the view.
When you click OK, the view will be zoomed such that its scale is the
value you specified.
3.
Enter a value in the Window width field to specify the exact size of the view.
When you click OK, the view will be zoomed such that its width is the
value you specified.
4.
Click OK.
Toolbar
197
Scroll bars
Coordinates bar
Tape player controls
Rulers
Status bar
2.
Select Workspace... (MacOS only: from the Workspace submenu) in the View
menu.
198
Figure 6-8
Workspace dialog
Windows
MacOS
2.
3.
199
Figure 6-9
Grid, Rulers, Tape player controls,
and Coordinates bar displays
Grid lines
x,y axes
Rulers
Status bar
Coordinates bar
Tape player
controls
Displaying Rulers
Working Model 2D provides both rulers and grids to enable you to accurately
position and scale objects. See Figure 6-9.
To display rulers, choose Rulers from the Workspace submenu or dialog. A
checkmark appears next to this command in the menu when the rulers are
displayed. To hide rulers, choose Rulers again. The checkmark next to
Rulers disappears.
200
Grid lines at
major divisions
Grid snap at
every division
201
Grid Snap is on if you see a checkmark by the submenu item titled Grid
Snap.
The coordinate information shown at the bottom of the document tracks the
mouse position to the nearest minor ruler division if Grid Snap is enabled, or
to the nearest pixel if Grid Snap is disabled.
When bodies or constraints are selected, the Coordinates bar shows the
parameters that are most often edited. You can edit these values directly in
the Coordinates bar, and the modification will take effect immediately (please
see 3.2. Body Properties and 4.3. General Properties of Constraints
for details on the usage of the Coordinates bar).
202
Showing Displacements
The Coordinates bar shows the pixel coordinates of the meters and controls.
The coordinate system is designed so that the top-left corner of the simulation
window is (x, y) = (0, 0). The x-coordinate increases toward the right side of
the window, whereas the y-coordinate increases downward. The Coordinates
bar shows the position of meters and controls in terms of their top left corner
(Figure 6-12).
NOTE: These pixel coordinates are used only for meters and controls.
203
(units in pixels)
(0, 0)
(200, 150)
200
150
204
Figure 6-13
Status bar identifying a square
body (Windows)
Status bar
If the pointer is over a tool in the Toolbar, the Status bar will identify it. See
Figure 6-14 (Note that the pointer is over the Circle tool). On Windows
systems, a brief description of the tool under the pointer also appears in a
small tooltip box.
Figure 6-14
Status bar identifying a tool
(MacOS)
205
Quantity
Initially measured in
Time
seconds
Length
meters
Rotation
degrees
Mass
kilograms
Force
newtons
Energy
joules
Power
watts
Charge
coulombs
206
Unit systems include SI, English, astronomical, atomic and CGS systems.
3.
Choose how numbers will be displayed by clicking Fixed Point, Floating Point, or
Auto.
Fixed Point format displays all numbers with a fixed number of digits to
the right of the decimal point.
Floating point format displays all numbers in an exponential format of
the form 1.23e4.
Auto lets Working Model 2D decide whether to display numbers in fixed
or floating point formats. Numbers are presented in the best format for
quick viewing.
4.
To fix the units for a particular quantity, click on the More Choices box.
This will allow you to choose the units that a specific quantity will be
reported in. See Figure 6-17.
Figure 6-17
Numbers and Units dialog with
More Choices selected
5.
207
Number
Fixed (1 digit)
Float (1 digit)
Auto (1 digit)
0.000123
0.0
1.2e-4
1.2e-4
333.3333
333.3
3.3e2
333.3
Property
Setting
Gravity
Air Resistance
none
Electrostatics
none
Force Field
none
Gravity
The default setting of gravity is vertical gravity.
To change the worlds gravity:
1.
208
Figure 6-20
Gravity dialog
2.
Vertical Gravity
When adjusting vertical gravity, you are changing the value of g, the
proportional constant relating the force on the mass center of an object with
its mass; i.e., F = mg.
Planetary Gravity
Air Resistance
Air resistance is modeled as a force on a moving body opposite to the
direction of its motion. This force is proportional to the objects cross section
in the direction of motion. Air resistance in Working Model 2D does not take
into account the coefficient of drag of various shapes. Rather, it uses the cross
section of the appropriate object in the direction of motion. Thus, a 1 meter
209
diameter circle has the same air drag as a square 1 meter on edge. To account
for an objects cross section, modify the air resistance coefficient (k) as
follows:
For a sphere, multiply k by pi*r/2 (where r is the radius of the sphere).
For a cylinder, multiply k by W (width of the cylinder into the screen).
For a square, multiply k by W (width of the box into the screen).
To activate air resistance:
1.
2.
Select Low speed or High speed as the model for air resistance.
Figure 6-21
Air Resistance dialog
Electrostatics
Each body in Working Model 2D has a charge. By default, each object has a
positive charge of 1.0 x 10-4 Coulombs. This charge is enough to produce
interesting results between objects in the default physics workspace, although
it really is an extreme amount of charge.
You can model electrostatic forces between objects by turning on
Electrostatics. You will also need to set the charge values of various bodies
to values other than 0 to see the effects of charge.
210
2.
3.
4.
Force Fields
You can define forces that act upon each object or each pair of objects by
using the Force Field command. For example, you can model wind forces by
applying a horizontal force to all objects that varies randomly with time. You
can model gravitational systems where the force of gravity behaves in a weird
way, such as gravity that grows in proportion to the inverse of distance.
Custom force fields are built upon Working Model 2D formulas, which are
discussed in Chapter 10, Using Formulas and Appendix B, Formula
Language Reference. Formulas are similar to those found in a computer
spreadsheet. The primary difference is that spreadsheet formulas refer to
other cells in the spreadsheet. Working Model 2D formulas refer to the
physical parameters of the various objects in the simulation.
You can click the Sample Force menu in the Force Field dialog box to see
examples of the various force fields you can build, along with the appropriate
formulas that define them.
211
2.
You will see sample formulas for the following global forces:
Linear Gravity
Planetary gravity
212
Magnetic field
Electrostatics
Wind
Air resistance
Click one of the top three buttons to select the type of custom global force.
4.
5.
Formulas entered in the Force Field dialog are applied as forces and torques
to all objects.
A more detailed description of the process of customizing forces using
formulas is given in Chapter 10, Using Formulas.
Normally, when you click the selection tool on one object, all other selections
are automatically canceled.
If you hold down the Shift key when you click an object, previously selected
objects remain selected, and the new object becomes selected as well. If you
click on a selected object while holding down the shift key, the object
becomes de-selected.
213
1.
2.
Place the pointer at one corner of an imaginary rectangle that will enclose all of the
objects you want to select.
3.
You can select all objects in a simulation (even the ones that are off-screen)
with one command: choose Select All from the Edit menu.
All objects become selected. To deselect all objects, click on the workspace
in a place where there are no objects.
214
Clipboard
The Clipboard is a holding area where you can place a selection for temporary
storage.
Windows
You can view the contents of the Clipboard by running the Clipboard Viewer,
which should be located in the Program Managers Main group. See your
Windows documentation for more information on the Clipboard.
Cut
Copy
Paste
Cut removes the current selection from the simulation and places it on the
Clipboard.
1.
2.
Copy duplicates the current selection to the Clipboard without erasing it from
your document.
1.
2.
2.
Activate the window belonging to the document where you wish to place the
selection.
When pasting objects with parameters that contain formulas, Working Model
2D attempts to update the formulas if any objects have to be renumbered.
Objects need to be renumbered if an object with the same number as the
pasted object already exists in the document.
215
Clear removes the current selection from the document without storing it on
the Clipboard.
1.
2.
Choose Clear from the Edit menu or simply press the Backspace or Delete key.
Usually, the menu item names the action to be undone, such as Undo Cut.
Moving an Object
All objects can be moved.
To move objects:
1.
216
Rotating Objects
The Rotate tool allows you to rotate selected objects while keeping a point of
the object fixed to the background The point chosen to be rotated about
may be any point in the workspace; e.g., a pin joint or a center of mass.
The Rotate tool can be used to select objects for rotation, as well as for the
actual rotation operation. After you select the object(s) you wish to rotate, a
line will snap from the pointer to the closest point on the workspace. This is
the point which will be fixed to the background during the rotation.
To rotate an object:
1.
2.
The object becomes selected. A line jumps from the pointer to the center
of the selected object, indicating that the object will rotate about this
point.
Figure 6-24
Rotating an object
217
You can also rotate a body by changing the rotation angle in the Properties
window for the selected body.
As in the case of moving objects, rotating an object that is connected to other
objects by constraints may cause these other objects to move as well. For
more information on how to use these features, see Chapter 5, The
Smart Editor.
Rotating Multiple Objects
You can rotate more than one object at a time with the Rotate tool.
To rotate two or more objects:
1.
Click the objects with the Rotate tool or with the Arrow tool. Hold down
the shift key to extend the selection.
2.
3.
The selected objects will rotate around the point indicated by the dotted
line.
Fixing a Base Point for a
Rotation
In some circumstances you may wish to rotate the selection around a point
that is not closest to the pointer. You can do this with the Option (MacOS) or
Control (Windows) key.
1.
3.
Move the pointer on top of the point which the object is meant to be rotated about.
When a small circle is visible around the point, hold down the Option (MacOS) or
Control (Windows) key. Move the mouse and observe that a dashed line segment
appears between the point and the mouse pointer.
218
Figure 6-25
Rotating around a point element
5.
While holding down the Option (MacOS) or Control (Windows) key, move the mouse
pointer to one of the objects you wish to rotate.
6.
Click and hold down the mouse button and drag the objects as if you were rotating
them.
The selected objects will rotate with the selected point remains fixed.
The motions of rotating bodies are subject to constraints attached to them.
See Chapter 5, The Smart Editor for more details.
219
1.
Select an object.
2.
Choose Move To Front from the Object menu to move the selected object in front
of all the other objects in that layer.
Figure 6-26 shows a selected rectangle before and after using Move To
Front.
Figure 6-26
Moving a rectangle to front of a
circle
Before
3.
After
Choose Send To Back from the Object menu to move the selected object behind all
other objects in that layer.
220
Figure 6-27
Properties window for a rectangle
Doing so displays the Properties window that describes the object (Figure 627). You can then make changes within the window. Since the Properties
window is a floating window, you can move it anywhere you like on the
screen. The window remains in front even while you are running a
simulation.
You can move a utility window by positioning the pointer on its title bar and
dragging it to another location.
You can make the Properties window wider by clicking in the zoom box on
the top right corner, or by dragging the bottom right corner. This is helpful
when entering longer equations.
Utility windows enable you to quickly change parameters of many different
objects. You can change more than one object of the same type at the same
time. Select the objects you wish to change, and then enter the desired value
in a field of a utility window. All objects will be changed at the same time.
Figure 6-28
Appearance window
Appearance Window
You can change the appearance of an object, such as its color or fill pattern,
by changing the information in the Appearance window (Figure 6-28).
221
To display the Appearance window for one or more objects, select the objects
and then choose Appearance from the Window menu.
All utility windows show data for the current selection. Changing the data in
the windows changes the data for the currently selected object or objects.
Geometry Window
Figure 6-29
Geometry window for a polygon
C H A P T E R
Simulation Interfaces
222
7.1. Meters
Meters allow you to extract numerical and graphical data from your
simulation. Not only can you measure almost any physical property in a
Working Model 2D simulation, you can also customize meters to measure,
display, or evaluate arithmetic and mathematical expressions using the
versatile formula language available in Working Model 2D.
7.1. Meters
223
Figure 7-1
Measure menu when one body is
selected
Shown below are some examples of quantities that can be measured using
meters.
Bodies
Linear Constraints
Rotational Constraints
Joints
224
Creating Meters
To install a meter:
1.
Select one body, point, or constraint object whose properties you wish to measure.
You can also select two bodies to measure properties that apply to a pair
of bodies.
2.
Choose the property you wish to measure from the Measure menu.
7.1. Meters
225
To install a contact force or a friction force meter, you must select two bodies
before you create a meter.
You can move, resize, or delete a meter.
Digital Meter
Graph Meter
Bar Meter
Click on the arrow button on the top left corner (see Figure 7-3).
On MacOS systems, a pulldown menu appears for you to select the type
of the meter. On Windows systems, each click cycles the meter types in
the order of digital, graph, bar graph, and digital again.
226
Figure 7-3
Changing meter display types
MacOS
Windows
You can position the meter anywhere on the screen by selecting the meter and
dragging it. You can also position the meter using the Coordinates bar.
When a meter is selected, the Coordinates bar displays the (x, y) coordinates
of the meter in pixel coordinates on the Working Model 2D document.
The origin (0, 0) of the pixel coordinates are set at the top-left corner of the
document window (Figure 7-4). The x-axis extends to the right, whereas the
y-axis extends downward (note that the y-axis of pixel coordinates runs
opposite from the physical coordinates employed in Working Model 2D
simulations). The position of the meter is given in terms of its top-left corner.
You can directly modify the (x, y) values in the Coordinates bar.
7.1. Meters
Figure 7-4
Pixel coordinates for meters
227
(units in pixels)
(0, 0)
(200, 150)
200
150
You can modify the meter size by selecting the meter and dragging one of the
selection handles (small black squares) shown at the corners.
2.
Click in the labeled buttons on the side of the meter to show or hide the property
on the meter.
When the button is greyed, the property will be hidden (not displayed)
from the meter. Otherwise, the meter will show the property.
Figure 7-5
Picking properties to be graphed
Click on these
buttons to
show or hide
properties to
be displayed.
228
2.
3.
Enter Min and Max values for the quantity you wish to scale.
7.1. Meters
229
The x-axis measures time by default. As more data is added to a graph, the
scale of the graph is reduced to allow the full run of your simulation to be
displayed.
Quantities on the y-axis are also in an auto-scale mode by default. You can
override the auto-scaling by removing the check from the check box.
When you turn off auto-scaling, the scale is defined by the values in the
minimum (min) and maximum (max) boxes for each quantity. If you have
already run your simulation, these values contain the minimum and
maximum values that were computed by the auto-scaling feature, and are a
good starting point for adjusting your own scale.
NOTE: If the meter measures multiple values (y1, y2...) the y-axis scale
and the position of x-axis and the grid linesrelates solely to the first output
(y1). The other outputs are scaled according to the minimum and maximum
values shown in the Properties window, but their y-coordinates or x-axis
intersect cannot be viewed.
2.
3.
Select the desired color for each parameter by clicking in the color pop-up menu.
230
When Retain Meter Values is enabled, histories are erased only when Erase
Meter Values is selected from the World menu. The Erase Meter Values
command tells Working Model 2D to discard the meter data from all the past
simulations except the very last one. For example, if you have a graph meter
open and have recorded data from multiple simulation runs, selecting Erase
Meter Values will delete the plots from all the past simulations except the
very last run.
The Erase Meter Values menu item is active only when you enable Retain
Meter Values.
The meter information for all the stored simulations can also be exported to a
file (also see 9.6. Exporting Meter Data to a File). To store the results of
multiple simulations to a file:
1.
2.
3.
Create meters to measure the desired data, and run your simulations as many times
as necessary, while changing parameters (mass, velocity, etc.) for each simulation.
After you are done experimenting, choose Export from the File menu.
The Export dialog appears (see Figure 9-1 on page 291 for general
information on the Export dialog).
5.
6.
7.
Click OK.
7.1. Meters
Data Format for Meter Data
From Multiple Simulations
231
The exported meter data file is formatted in a multiple column format, with
each row representing a set of data from one animation frame. The file
contains as many columns as needed to store all the meter data existing at the
time when you executed the Export command. Data from multiple
simulations are written side by side.
For example, if you have three meters measuring time and (x, y, ) position
of projectiles, measurement data from two simulation runs will produce 3
(meters) *4 (data columns each for t, x, y, and ) *2 (simulations) = 24
columns. If you recorded 4 simulations, then the file would have 48 columns.
The file will have as many rows as necessary to store the data from the
simulation with most animation frames. If some of the simulations lasted for
fewer frames than others, the remaining rows (at the bottom) of the data
columns are filled with minus (-) signs to match the length of the longest
columns.
If new meters are created while you are experimenting, the data from earlier
experiments will have blank columns to represent the fact that the meters did
not exist at the time. All such columns are filled with minus signs. This way,
the file would contain sets of columns, where each set represents one
simulation run, and all the sets have the same number of data columns.
232
7.2. Controls
Controls allow you to adjust simulation parameters, before and while a
simulation is running.
Figure 7-8
Text box, button, and slider
If you highlight a spring, and then create a control for its spring constant, you
automatically replace the number in the springs spring constant field with
a formula that gives the current value of the slider. You can see this change
by displaying the Properties window for the spring, as in Figure 7-10.
7.2. Controls
233
Figure 7-10
Properties window for a spring with
a control on its constant
If you do not edit this formula, the original numeric value will be returned if
you delete the control.
You can create a slider to set the initial velocity of a body before running a
simulation. Use the slider to adjust the velocity, then run the simulation again
using the adjusted value.
For more on formulas, see Chapter 10, Using Formulas.
Creating Controls
To create a control for a body or constraint:
234
Figure 7-11
New Control menu (rectangle
selected)
1.
The properties that you can control are listed on the Control menu. You
can add a control for each of the properties listed.
2.
Select the New Control menu item from the Define menu.
A slider with text box control appears. You can control the magnitude of
the property you chose by dragging the slider.
You can position the control anywhere on the screen by selecting the control
and dragging it. You can also position the control using the Coordinates bar.
When a control is selected, the Coordinates bar displays the (x, y) coordinates
of the control in pixel coordinates on the Working Model 2D document.
The origin (0, 0) of the pixel coordinates are set at the top-left corner of the
document window (see Figure 7-4). The x-axis extends to the right, whereas
the y-axis extends downward (note that the y-axis of pixel coordinates runs
7.2. Controls
235
(units in pixels)
(0, 0)
(200, 150)
150
200
Coordinates bar shows
(x, y) pixel coordinates.
You can modify the control size by selecting the control and dragging one of
the selection handles (small black squares) shown at the corners.
Double-click on the control, or select the control and then choose Properties from
the Window menu.
If you want to change the title and the color of a control, use the Appearance
window.
236
Figure 7-13
Properties window for controls
3.
Each control type is associated with a different set of properties that you can
specify.
Sliders
You can specify minimum and maximum values for the slider bars. Number
of snaps indicate how many discrete values are available in the range of the
slider.
By default, a text window is attached to a slider control. You can use the text
window to enter a precise value within the range, even if the value may not
coincide with the discrete steps of the slider.
This text window can be turned on and off by clicking on the Show Text
checkbox.
Text Box
A text box allows you to enter precise numerical input for the property value.
Button
Using a button, you can quickly select one of the two values specified in min
and max boxes. A button can act as a toggle switch or as a press-and-hold
(button is pressed as long as you hold your mouse button down) button.
7.2. Controls
Table
237
A table control reads its value from a table file. A table file is an ASCII text
file which contains multiple columns of numbers, delimited by a tab. By
default, Working Model 2D assumes that the first column of data holds time
and the second holds the corresponding control values.
Using this feature, you can combine experiment data with your simulations.
For example, suppose you want to simulate the suspension system of an
automobile. You could take the contour data of a bumpy road and use that
data as an input to the actuator length in Working Model 2D.
Working Model 2D can read a text file (ASCII file) which contains multiple
columns of numbers. Working Model 2D ignores all lines starting with an
arbitrary non-numeric character as comments. If you are using a word
processing program to edit a text file, make sure that the file is saved as text
of an ASCII file.
In order to read a table file:
1.
Double-click on the control, or select the control and then choose Properties from
the Window menu.
2.
3.
A pop-up window prompts you to locate the text file you would like to use.
4.
At this point, the table is read into Working Model 2D. Even if you delete
the table file, Working Model 2D will still remember the data. By the
same token, if you modify the table file, Working Model 2D would not
know of the change until you repeat Step 3 above which re-reads the
table data.
5.
Specify which columns you would like to use as time and data reference.
Setting 0 as the time column indicates that Working Model 2D will read
data row by row for every animation frame (see Animation Step on
page A16 for details).
You must specify a positive number for the data columnyou cannot
specify 0 as the data column.
238
Figure 7-14
Table data and simulation time
steps
data
value
time
t1
t2
: values given in data column of file
t1 : simulation
t2 : time given in time column of file
The numbers on the time column in the table file must be sorted in increasing
order; otherwise the simulation behavior may not be accurate.
If the input file has a time column, you should not make the Animation
step (in the Accuracy dialog) greater than the time step given in the input
file in order to ensure smooth animation.
When you save your Working Model 2D simulation (with or without
recording), the saved document includes the table data. Therefore, when
you re-open the simulation document at a later time, Working Model 2D
does not need to have access to the table file.
If you choose Start Here (in the World menu), Working Model 2D will use
the same table data, assuming that the first row of the table data
corresponds to the current frame of simulation, since Start Here resets
both the frame number and time clock to zero.
239
MacOS
1.
A dialog box appears asking you to choose the menu command that you
want the new button to perform.
Figure 7-15
New Menu Button dialog
2.
The new button appears with the name of the menu item you chose.
Clicking this new button is the same as choosing the named command
from the menu.
3.
Click OK.
Windows
1.
A dialog box appears asking you to choose the menu command that you
want the new button to perform. A list of all menu commands and actions
is displayed alphabetically.
240
Figure 7-16
New Menu Button dialog
2.
You can scroll down the list, or enter the first letter of the command. For
finer selection you can also use the arrow keys to move the list up or
down one item at a time.
3.
Click OK.
MacOS
1.
Create the simulation documents you want to link, and for convenience, store them
in the same folder.
2.
3.
A dialog box appears asking you to choose the command you want this
button to execute.
7.4. Vectors
4.
241
Choose Open from the File menu, and then select the name of the document you
want the button to open when pressed.
Windows
1.
Create the simulation documents you want to link, and for convenience, store them
in the same directory.
If Working Model 2D cannot find a file in the local directory it will bring
up a file selection dialog to allow the user to locate the file. This will
happen every time the Open menu button is pressed, so it is best to store
all related files in the same directory.
2.
3.
A dialog box appears asking you to choose the command you want this
button to execute.
4.
Choose the file that should be opened when the Open button is pressed.
When you click the Open button inside the current simulation, the
simulation closes. The simulation you selected when creating the Open
button will open.
7.4. Vectors
You can graphically represent kinematic (velocity and acceleration) and
kinetic (force) properties by displaying vectors.1
Vectors can be placed on points and bodies. Select the endpoint of a
constraint to display force vectors for forces produced by the constraint.
1. Vector
242
Figure 7-17
A pendulum with acceleration and
velocity vectors
velocity
acceleration
total force
gravitational force
electrostatic force
air force
force field
contact force
friction force
Displaying Vectors
To display one or more vectors:
1.
Select one or more bodies whose vectors you want to display graphically.
7.4. Vectors
243
The Vectors submenu in the Define menu lists the possible vectors that
can be displayed for the selected object(s). If more than one object is
selected, and the currently displayed vectors for the bodies do not match,
a - will appear next to the vector type, signifying that a mixed selection
exists.
2.
Choose the type of vector to display from the Vectors submenu of the Define menu.
The vectors will be displayed the next time you run the simulation.
or 1.0 meters (because SI unit has meters as a default distance unit) on the
Working Model 2D document. Lengths for other properties (velocity and
acceleration) are computed in the same fashion.
To adjust the vector display scale factor:
1.
244
Use the sliders or enter a scale factor to adjust vector lengths for velocity, force,
and acceleration vectors.
3.
3.
Choose whether to draw force vectors nose out or nose in, and whether to draw
force vectors at the point of application.
Force vectors are drawn nose out, and at the point of application, by
default.
7.5. Text
245
Select the pin joint and choose Properties from the Window menu.
2.
In the Properties window, choose one of the points that constitute the pin from the
pop-up menu at the top of the window.
Only one of the points that make up the joint will be selected on the
workspace.
3.
When the simulation is run, the displayed vector will be the force on only one
of the points.
If you wish to measure the reaction forces quantitatively using meters, please
refer to Measuring Reaction Forces at Joints on page 154 for details.
7.5. Text
To label your simulations, you can create text captions within a document.
Text captions are considered text objects in the Working Model 2D. You can
edit a text object by selecting all or part of its text on the screen and typing
replacement text. Object names can also appear on the screen. This section
explains how to create and edit both kinds of text.
2.
246
2.
Select the letter or words you want to edit by dragging through the text.
Figure 7-20
Selected text
The selected text appears highlighted.
3.
4.
2.
3.
Choose Cut or Clear from the Edit menu, or press the Delete key on your keyboard.
Cut text is placed on the Clipboard and can be pasted into the current
document or into another document.
Pressing the Delete key is the same as choosing Clear from the Edit menu;
thus, the cut text cannot be pasted.
To undo deletion, choose Undo from the Edit menu before doing anything
else.
7.5. Text
247
2.
3.
Type the text or choose Paste from the Edit menu to paste cut or copied text.
When you insert text, it wraps around to fit within the current margins. You
can change the size of the text object by dragging one of its handles.
MacOS
1.
Select the text object or object whose name you wish to adjust.
2.
3.
The changes you make apply to all text in the selected object.
Windows
1.
Select the text object or object whose name you wish to adjust.
2.
3.
Select the desired font, size, or style from the dialog box.
The fonts shown in the dialog box are the Windows fonts, styles and sizes
installed on your computer.
248
Naming Objects
To edit or change the name of a body, constraint, meter, or control:
1.
2.
3.
Select the current name and type a new one in its place.
7.6. Pictures
Picture objects are created in Working Model 2D whenever graphics data is
pasted into the workspace. The MacOS version accepts PICT data; the
Windows version accepts metafile data.
You can drag, cut, copy, and paste picture objects. You can also attach
picture objects to bodies.
7.6. Pictures
1.
249
Select both the body and picture by holding down the Shift key and clicking on each
one.
Both the picture and the object appear selected. The Attach Picture item
in the Object menu becomes highlighted.
2.
C H A P T E R
Running Simulations
Run a simulation
Replay a simulation
Control the speed and accuracy of a simulation
Save a recorded simulation
Create Player documents
Specify a reference frame
Track objects
250
MacOS
Windows
1.
Click Run in the Toolbar or choose Run from the World menu. See Figure 8-1.
On MacOS systems, the Run button turns into the Stop button while
running a simulation.
2.
Click Stop to stop the simulation or choose Stop from the World menu.
Once you have run a simulation, the calculations are stored in the tape player.
If you run the simulation again without making any changes, it will play much
more quickly.
251
The Workspace menu appears. You can select options by choosing them
from the menu.
2.
A check next to the entry will indicate the tape player option is selected.
3.
Click OK.
The tape player controls and indicators appear along the bottom of the
screen, as shown in Figure 8-2.
Figure 8-2
Tape Player controls
Frame Counter
Run Forward
252
Step Backward
Step Foward
Click on the forward or backward step in the tape player control to move
forward or backward one frame at a time.
You can also press + to step forward and - to step backward.
To select the number of frames to skip with the step controls:
1.
2.
Skipping Frames
To skip frames for faster animation:
1.
Drag down the World menu to Skip Frames, without releasing the mouse button.
Choose the number of frames you wish to skip from the Skip Frames submenu.
Another way to control the speed of animation is to adjust the Time Step.
This feature is discussed in Useful Simulation Tips on page 280 of this
chapter.
When you run a simulation for the first time, choosing the Skip Frames
command does not have any effect. Skip Frames only affects simulations that
have been run once, and are thus stored in the tape player.
253
Click the play backward control on the tape player. See Figure 8-4.
The simulation begins running in reverse. You can stop the simulation
at any time. The simulation will stop by itself when it reaches the first
frame.
Figure 8-4
Playing in reverse
Step Backward
2.
Click either the play forward or the play backward control to resume animation.
As the animation runs backward, the frame indicator moves to the left while
displaying the number of the current frame of animation.
You can also click any portion of the gray region on the tape player controls
to immediately move the frame indicator to that location.
254
Speeding up Playback
When you run a simulation for the first time, Working Model 2D not only
draws the animation on the screen, but also calculates the motion whose
results are to be displayed in the animation. For most simulations, this
calculation does not noticeably slow down the animation since Working
Model 2D quickly calculates the motion.
For complicated simulations, particularly simulations with many objects
touching each other at the same time, the animation may be slow the first time
you run the simulation.
You can speed up the animation by playing the simulation again or by using
the Skip feature. The Skip feature increases animation speed by removing
animation frames. For example, if only every second frame of the recording
is shown, the playback speed doubles.
Replaying the Simulation
Record the animation and calculate the motion by running the simulation once.
2.
3.
The animation replays faster this time because Working Model 2D did
not have to calculate the motion while replaying the simulation.
Pausing
The Pause feature enables you to automatically stop a simulation when some
condition is met. For example, you can pause when time > 1.00 seconds.
8.4. Preferences
255
2.
Select the event type you wish to occur when the condition is met.
You can pause, stop, loop or reset when the formula evaluates to a value
greater than 0.0 (evaluates to true).
For specific information on how to use formulas, see Chapter 10, Using
Formulas and Appendix B, Formula Language Reference.
8.4. Preferences
The Preferences dialog gives you control of several important run-time
features.To change any of the preferences:
1.
256
Figure 8-7
Preferences dialog
2.
Click OK.
8.4. Preferences
257
258
Saving Preferences
If you click Save Current Settings in the Preferences dialog, a preferences file
is created. On MacOS systems, the file Working Model 2D Prefs will be in the
Preferences folder in the System folder. On Windows systems, the file named
wmprefs4.wm is created in the Windows directory.
259
This preference file is opened and read each time you open a new Working
Model 2D document and is used to customize the startup environment of your
Working Model 2D session.
Saved preferences include the following:
If the tape player memory is full, you can continue running your simulation
in several ways:
260
To illustrate what happens when the initial frames of a recording are erased,
suppose the tape player memory allows room for 100 frames. If you continue
the simulation when the tape player memory is full, then stop the simulation
at frame 160, you can play the simulation backward to frame 60, but not back
to the beginning. Frames 1 to 60 were overwritten by frames 100 to 160.
Clicking Reset in the Toolbar reverts to frame zero.
You can also continue to observe the simulation without losing the initial
frames.
1.
The command erases the existing simulation history, and makes the last
frame to be the first frame, preserving all configurations such as object
positions and velocities.
4.
This way, you will not accidentally overwrite the history previously
saved.
261
You still have the data from the initial frames in the file you saved earlier.
Notes for MacOS Users
To accommodate a simulation with long history data, you can close the
application, increase the application size (see Running Simulations
Unattended on page 282), and launch the application again. This way, the
application has more memory allocated. You may be able to open the
previous file with the saved history and continue the simulation.
To maximize the memory allocated to Working Model 2D, make sure that no
other applications are running on your machine. After quitting other
applications, you may be able to continue simulation in Working Model 2D.
2.
The current frame becomes frame zero and the new initial conditions. The
original initial conditions are lost. The simulation is recalculated from this
new starting point.
Save your simulation with a new name before setting new initial conditions
if you wish to re-use the old initial conditions at some later time.
262
Find the tool file or the file containing the desired script.
3.
Click OK.
Please refer to Working Model Basic Users Manual for instructions on how
to add scripts and tools to the Script menu.
Edit Mode
Edit mode is Working Model 2Ds default mode. The full range of menus and
toolbars is available for editing and running simulations in Edit mode.
263
Figure 8-10
Edit mode
Player Mode
In Player mode, the toolbars are hidden, giving more space for the document
on the screen. The menu set is also reduced. All the commands you need to
use while running a simulation appear on these menus.
264
Figure 8-11
Player mode
Notice that you now have a limited set of menus and commands
available: File, Edit, and Run.
2.
3.
4.
Close the simulation when you finish watching it so that the computer has
more memory available for other simulations.
5.
Choose Edit mode from the Edit menu to return to Edit mode.
Simulations saved in Player mode are perfect for users who will not be editing
the simulation.
265
266
Figure 8-12
Reference frames: a collision
Figure 8-13
The same collision from the
reference frame of the dark circle
If you do not select an object, you will create a new reference frame for
the background.
2.
267
Figure 8-14
New Reference Frame dialog
3.
You can also choose to display a reference frame eye, x- and y-axes, or
both. The eye and axes appear at the center of the origin of the reference
frame.
4.
Click OK.
The new reference frame becomes the current reference frame and is
appended to the bottom of the View menu.
To choose between various reference frames, pick the desired reference frame
from the bottom of the View menu.
You can create reference frames by using the Working Model 2D formula
language. For example, you can create a reference frame that doesn't rotate
with the body. For more information on using formulas, consult Chapter 10,
Using Formulas and Appendix B, Formula Language Reference.
3.
Click OK.
268
Choose Show System Center of Mass from the View menu to create a system center
of mass point.
2.
3.
4.
5.
Click OK.
When you run the simulation, you will view the simulation from the
reference frame of the system center of mass.
8.9. Tracking
Tracking leaves an image trace of moving objectsonly applying to bodies
and constraintsat adjustable time intervals. You can track individual
objects or all objects. Objects can leave visible tracks of their outline, center
of mass, or vectors so that you can follow the physical action throughout a
simulation.
To activate tracking:
1.
2.
3.
Select how often you wish to track from the Track submenu.
Select the object whose individual tracking behavior you want to define.
2.
8.9. Tracking
269
Figure 8-15
Tracking options in the
Appearance window
3.
You can choose to track the outline and/or the center of mass point. You
can also connect the center of mass point tracks with a line by selecting
Track connect.
Create a circle.
2.
270
Give the circle an initial downward velocity by selecting it and dragging its velocity
vector from the center of the object.
5.
The model should look similar to the one shown in Figure 8-16.
Figure 8-16
A simple collision model
6.
You can set the elasticity by opening the Properties window for the table.
Select the table, and choose Properties under the Window menu.
7.
Select the circle object representing the ball, and choose Elasticity
(located in the New Control submenu, in Define).
8.
Turn on tracking every 4 frames and run a simulation with the elasticity of the ball
set to 1.0.
You can turn on the tracking by choosing Tracking under the World menu.
9.
Now turn off AutoErase Track and run multiple simulations, decreasing the
elasticity of the collision every time.
You can turn off the AutoErase feature by selecting AutoErase Track
under the World menu. The simulation should look similar to the one
shown in Figure 8-17.
8.9. Tracking
271
Figure 8-17
Running multiple simulations with
AutoErase Track disabled
Certain actions require redrawing of the interface layer and will erase tracks
even if AutoErase Track is disabled. Such actions include, but are not limited
to:
272
2.
Enable AutoErase, and run the model for the range of parameters with which you
are trying to experiment.
Disable AutoErase, then run multiple experiments making variations with the
parameters of the objects in the model.
The Save As dialog appears as shown in Figure 8-18 if this is the first
time you are saving the simulation. If you have already saved your
simulation you can sequentially save without interrupting your work.
273
Figure 8-18
Save As dialog
MacOS
Windows
2.
3.
Your simulation model, initial condition, and time history are saved to disk.
When you open this simulation, the tape player memory will be filled with the
recorded time history, and the simulation will run quickly the first time
through.
274
MacOS Printing
Selecting Page Size and
Orientation
Before choosing Print, you can specify options for printing such as the size of
the paper and the orientation of objects on the printed pages. To specify print
options:
1.
2.
The Page Setup dialog for your printer appears. If you are using a
LaserWriter printer, youll see the dialog shown in Figure 8-19.
Figure 8-19
Page Setup dialog for LaserWriter
printers
The information you see in the Page Setup dialog varies depending on the
system and printer you are using. The Page Setup command and settings
shown here describe page setup for printing to an Apple LaserWriter. If you
are using a different type of printer, the settings and choices you see in the
dialog may be different. Refer to your MacOS manual for the specific
settings to select.
Printing
After you have positioned your simulation within the window at the desired
Zoom and location, you are ready to print.
To print the simulation:
1.
Open a simulation.
2.
The Print dialog for your printer appears. If you are using a LaserWriter
printer, youll see the dialog shown in Figure 8-20.
If you are using a different type of printer, the settings and choices you
see in the dialog will be different. Refer to your MacOS manual.
275
Figure 8-20
MacOS Print dialog
3.
Click OK.
Windows Printing
After you have positioned your simulation within the window at the desired
Zoom and location, you are ready to print.
To print the simulation:
1.
2.
The Print dialog for your printer appears. It will indicate the default
printer settings and allow you to select a different printer, which pages
to print, the number of copies to print, whether to direct the output to a
file instead of the printer, and whether to collate copies.
Figure 8-21
WindowsPrint dialog
3.
276
Figure 8-22
Windows Print Properties dialog
4.
Click OK.
2.
3.
4.
277
Time Step
In Working Model 2D, every frame of a simulation represents a certain point
in time. If a new frame is computed every one hundredth of a second, the first
frame represents the simulation at time t = 0s, the second frame at t = 0.01s,
the third frame at t = 0.02s, and so forth.
This time interval between frames is called the time step or delta t (t).
To varying degrees, the accuracy of every simulation is influenced by t.
Generally, the smaller the t, the slower the simulation will run and the more
accurate the simulation becomes. Conversely, the larger the t, the faster the
simulation will run and the less accurate the simulation becomes.
Different simulations demand different time steps. A simulation of a thrown
baseball creates good results when the time step is about 0.01 seconds. This
time step would not be appropriate for a simulation of the solar system,
however. At a rate of 0.01 seconds per frame, it would take a very long time
to see any motion of the earth around the sun.
Working Model 2D automatically selects a time step for each simulation
based on the size and mass of the objects. If necessary, you can override this
automatic time step and enter your own value.
To change the value of t:
1.
278
Figure 8-23
Simulation Accuracy dialog
2.
Click OK.
Simulation Accuracy
Working Model 2D provides you with complete control of the numerical
algorithms used in creating simulations. For convenience, these choices have
been condensed into two general accuracy modes:
Fast
Accurate
279
In such cases, Working Model 2D assumes that these two objects are
colliding and tries to generate enough force to separate the two (see A.6.
Simulation Accuracy Dialog and Simulation Parameters), potentially
yielding unexpected results.
Two objects overlapping at the beginning of a simulation should be given Do
Not Collide designation (under the Objects menu). If you are designing a
model where two objects are close together and are meant to interact, you
should ensure that they are not colliding at the beginning of the simulation.
You can find out whether a particular object is colliding with another at the
beginning of a simulation by measuring the contact force. For example:
choose the object, and define a vector to show a contact forces incident to it
(see Displaying Vectors on page 242). The objects are overlapping if the
force vector appears from the object at the first frame of the simulation.
280
Inconsistent Constraint
Redundant Constraint
Use the Fast simulation method, and set the time step to the largest value
that allows stable simulation and acceptable accuracy.
Reduce the number of objects that are in contact. Make sure to use the
Do Not Collide command (in the Object menu) with all groups of objects
that do not need to collide. This modification allows Working Model 2D
to bypass many collision tests. To visually check for contacts, display
collision force vectors by selecting all objects and choosing Define >
Vector > Contact Force.
Set the frictional coefficients of contacting objects to 0.0 if friction is not
needed in your simulation.
Use rigid joints to build complex objects. Using two pin joints to lock
objects together introduces extra simulation overhead and redundant
constraints.
Use rods instead of ropes wherever possible.
281
1. Integration
282
3.
To Expand Application
Memory
When you suspect that the memory may be insufficient to store the entire
duration of the simulation, you have two options before you start running it.
283
Remove the checkmark from the check box: Loop when tape player is full.
Put a checkmark in the check box: Loop when tape player is full.
Essentially, the simulation will run forever or until you stop it. If you want
to set an automatic pause in the simulation, see Controlling the Duration of
a Simulation on page 282.
Using Scripting to Control
Unattended Operations
Minimizing Collisions
You can control whether any two objects are meant to collide. By default,
Working Model 2D makes all objects collide, except those that are directly
connected to each other with a joint or gears. You have complete control for
designating that multiple objects do not collide with one another. See 3.6.
Controlling Collisions among Bodies for instructions.
284
285
Make sure the filename abides by Windows naming conventions and has a .wm
extension.
You can transfer the files using a floppy disk or over networks.
3.
2.
If you wish to modify the original file so that double-clicking the file would
launch the application, you can either:
286
2.
3.
select Get Info from the File menu and enter the following information (see Figure 824 for a sample):
Type: FzzX
Creator:
Figure 8-24
Converting file type using ResEdit
wmK
File Type
Information
The file is now ready to be opened by Working Model 2D. The file now bears
the Working Model 2D document icon.
Translation Issues
Although files are fully compatible on both platforms, there are some
differences in the system environments that might affect the translation of
files.
287
In general, the colors available on the two platforms will not have a one-toone mapping, so Working Model 2D will do its best to find the closest color
available on the current platform. This might result in different colors being
used for a given simulation. The user can obviously modify the colors at any
time.
Sometimes transparency information is lost on pictures translated from PICT
(MacOS) to metafiles (Windows).
Fonts
C H A P T E R
Fonts also do not always have a one-to-one mapping. The default font is used
for all fonts in a document that do not map to a font currently installed on the
system.
288
DXF
Meter Data
The data from any meter can be exported as a tab delimited text file. You can
edit this data with a word processor, spreadsheet, or graphics application.
Meter data can also be captured by selecting a meter and then choosing Copy
Data from the Edit menu. Data from the meter will be copied to the
Clipboard. You can then paste the data into any application that supports tab
delineated text.
Windows only
Video for Windows
MacOS only
QuickTime Movie
PICT
You can save a picture of the Working Model 2D workspace as a single PICT
file. PICT files can be edited in any paint or draw program, or pasted directly
into documents.
PICT Animation
DXF Animation
Sequential DXF geometry files can be saved for each frame of a simulation.
Object Positions
You can export motion data from Working Model 2D simulations in the form
of tab delineated object positions. This format is useful for transferring data
to animation programs that support object motion paths in keyframes.
289
MacroMind Three-D
Animation
Wavefront Technologies
Advanced Visualizer
Import
Working Model 2D can import data in the following formats:
DXF
MacOS only
Lincages
If you wish to export numerical data from a simulation, export Meter Data.
Numerical data includes anything that you can measure in a Working Model
2D simulation, such as the force on a joint or the angular acceleration of an
object.
290
Object Geometry
Object geometry is the exact shape and size of the objects in your simulation.
The best format for transferring this information to another application is the
DXF format. Most CAD (Computer Aided Design) programs support the
DXF format.
Animation
MacOS only
Object Motion Paths or
Keyframes
If you are using an animation package that gives you access to numerical
keyframe data, you can create realistic animations by using Working Model
2D motion data in your animations. The Object Position export type will
create a tab delineated file of each object's position on a frame-by-frame
basis. Object Position data can be exported in either row or column format.
2.
291
Figure 9-1
Export dialog
MacOS
Windows
3.
Choose the type of data you wish to export by clicking on the menu next to Type.
You will see a list of all the export data types that Working Model 2D
supports. Options that are not currently available will be dimmed.
4.
Click the Export Options button to specify particular options for the export data
type you will be using.
Each export type has options that are specific to its data type.
5.
292
A progress dialog appears on the screen, and the exported data is saved
as a file.
Settings from the Working Model 2D workspace apply when exporting.
When exporting meter data, the numerical format is taken from the current
setting in the Numbers and Units dialog. When exporting QuickTime movies
and PICT files on MacOS systems, the color settings or number of colors are
taken from the current monitor settings.
293
1.
From your CAD program, save the drawing as a DXF file. Please refer to Important
Notes on Importing DXF Files on page 295 for preparation of your drawing.
2.
Import the file into Working Model 2D. Please read on for instructions.
3.
If necessary, convert selected lines to form polygons, curved slots, and other
Working Model 2D objects. See Converting Lines into Physical Objects on
page 296.
4.
Attach individual points to appropriate bodies (see Attaching Points and Slots to
Bodies on page 297). Construct joints and other constraints as necessary.
5.
6.
Note that a DXF file contains a drawing, whereas objects treated in Working
Model 2D are components of a physical model. Therefore, Working Model
2D enforces a set of conversion rules when importing a DXF file. Working
Model 2D creates a body, a point object, or a line segment for each
corresponding entity recognized in the DXF file, and places them in the
current workspace using the current unit system.
After these automatic conversions, you might need to edit the imported model
before you run the simulation in Working Model 2D. For example, your
original CAD drawing does not contain physical representations of pin joints,
slot joints, or springs; in the drawing, they only bear shapes but not meanings.
In essence, you must attach physical meanings to what used to be a drawing.
Please read Converting Lines into Physical Objects on page 296.
Working Model 2D recognizes the BLOCKS and ENTITIES sections of a DXF
file. The conversion rules are listed as follows.
Only one copy of a BLOCK is imported into Working Model 2D. Each
copy is placed according to its local coordinates; usually the placement
is near the origin and may appear offset from the original drawing.
Avoiding duplication of BLOCKs leads to not only a shorter import time
but also a simpler simulation model. If necessary, you can select the
objects contained in a BLOCK, convert them to physical objects (see
Converting Lines into Physical Objects on page 296) and place them
in Working Model 2D (duplicate them as needed).
The CIRCLE entities are imported as circular bodies.
294
295
Make sure your unit system is consistent with the target DXF file.
2.
3.
4.
5.
The imported objects are placed directly on the workspace. The import
process may take some time, depending on the size of the DXF file. You
can observe the import process in a progress dialog.
296
We recommend that the lines form a closed polygonal shape. If the lines
have gaps between them, Working Model 2D will add line segments
where necessary to form a closed shape. You can drag or resize
individual lines to improve the arrangement of the lines.
You have to use the mouse to select lines since, for speed performance
reasons, no lines appear in the object list of the Properties window like
the Working Model 2D objects such as bodies and constraints.
2.
Select Convert to Polygon from the Convert Objects item in the Object menu.
297
If the polygon is not of the desired shape, you can either reshape the polygon (see
Reshaping Polygons and Curved Bodies Graphically on page 64), or you can turn
the polygon back into lines, re-arrange the lines and start again with step 1.
To turn the polygon into lines, select the polygon then select Convert to
Lines (from the Convert Objects submenu in the Object menu).
The algorithm that converts lines into polygons tries to turn the lines that have
been selected into a closed polygon. Below is a simplified description of the
algorithm employed in Working Model 2D:
1.
2.
3.
Look for the closest endpoint that has not already been converted.
4.
If the closest endpoint is farther than a certain tolerance, add a new line.
5.
Lines-to-Curved-Slot
Conversion
To convert a line into a curved slot, follow the same procedure as above. The
endpoints of the line segments are converted into control points for the curved
slot. This feature is useful, for example, when you want to import a cam
design.
Polygon-to-Curved-Slot
Conversion
Polygons can be converted into a closed curved slot through two simple steps:
1.
2.
Immediately following the above step, choose Convert to Curved Slot from Object
menu.
Initially, all points in DXF files are imported as attached to the background.
You can select a set of points along with a body, and assign the points to be
attached to the body.
298
Figure 9-3
Attaching points to a body
B
1. Just imported
In order to attach the two points to the vertical polygon, for example:
1.
Select the two points A and Byou may need to use the box-select since some
options are covered by polygonsand a body.
Use either shift-select (selecting an object while pressing down the Shift
key) or box-select (dragging a mouse-cursor to draw a rectangle while
pressing the button down) to select the two points and the body.
2.
Select the point A and read the global coordinates of the point in the Properties
window.
The Properties window for a point object looks like Figure 9-4.
299
Figure 9-4
Properties window for a point
element
4.
Set the global coordinates of the duplicated point to be the same as that of point A.
6.
7.
Make sure that the slot is located properly relative to the target object.
300
Figure 9-5
Aligning a curved slot to a body
2.
3.
Select Attach to Body under the Object menu (alternatively, you can press Ctrl-M
(Windows) or Command-M (MacOS)).
301
2.
The Export dialog box appears (see Figure 9-1 for general information
on the Export dialog).
3.
DXF animation will export a file for every requested frame of the
simulation.
4.
You can choose to export all objects, or just those that are selected.
5.
A file is generated with the suffix .DXF. Open this file in any CAD
program that supports the DXF format.
Use the Export command to export meter data into a new text file.
Select one or more meters, and then choose Copy Data from the Edit
menu. Doing so copies the data onto the Clipboard. You can then paste
the data into another application.
The Export dialog box appears (see Figure 9-1 for general information
on the Export dialog).
302
4.
5.
Meter data is exported as a tab delineated text file. You can open the exported
file with any word processor or spreadsheet program. Meter data is stored in
columns, with each row representing a new simulation frame.
The numerical format of meter data is taken from the current settings in the
Numbers and Units dialog box. A document with a single position meter
would produce the following file:
Data From Untitled-1
at:8:32:20 PM 2/4/93
Position of Rectangle #2
t
x
y
0.000
1.250
-3.000
0.020
1.365
-2.884
0.040
1.480
-2.772
0.060
1.595
-2.664
0.080
1.710
-2.559
0.100
1.825
-2.459
0.120
1.940
-2.362
0.140
2.055
-2.270
0.160
2.170
-2.181
0.180
2.285
-2.097
0.200
2.400
-2.016
rot
0.000
0.000
0.000
0.000
0.000
0.000
0.000
0.000
0.000
0.000
0.000
303
Figure 9-6
Meter Data export options
MacOS
Windows
Include Header
This option includes the file name, date, meter name, and column names
before all numerical data. This option will help in referring to specific
columns of data. When this option is turned off, only numerical data is
exported.
Include x-axis
This option includes the x-axis data of each meter as a column. Meters
generally have time as the x-axis default. You can specify another variable
(such as the frame number) and make it the independent variable.
2.
3.
Run the simulation for the time duration that you want to collect data.
304
5.
Your data is now in the Clipboard. You can paste this data into other
applications.
NOTE: While the output data is recorded after each frame is computed,
using that data as an input will specify the controlled values at the beginning
of each frame before it is computed.
2.
The Export dialog box appears (see Figure 9-1 for general information
on the Export dialog).
3.
4.
5.
Click Save.
305
Figure 9-7
QuickTime Movie export options
Playback Rate
Pick a playback rate for the QuickTime movie that your computer can support.
In the Accuracy dialog box, set the frame rate to match this value.
306
You will generally use large simulation time steps when you create realtime simulations. The internal time step must be decreased so that
internal results are calculated more often.
For more information on time steps, see Appendix A.
2.
The Export dialog appears (see Figure 9-1 for general information on
the Export dialog).
Figure 9-8
Video for Windows export options
3.
4.
5.
Click Export.
307
2.
Your document will have nothing but the caption (title bar) and your
model.
3.
Export Options
Video for Windows export provides the following parameters. The default
settings are appropriate for most purposes.
Default Suffix
By default, a Video for Windows animation file has a .avi suffix. Windows
associates the .avi extension with the Media Player.
Bitmap Depth
Specifies the number of colors available in the bitmap. The default value is
8, meaning 28 = 256 colors can be used. The other option is 16, meaning
65,636 colors can be stored.
Frame Multiplier
Specifies how many times each exported frame is repeated during the
playback. The default value is 1.
For example, if you set the Frame Multiplier to 4, the Video for Windows file
will have 4 successive copies of each Working Model 2D frame, resulting in
a playback 4 times slower (slow motion) than the default.
308
Playback Rate
Specifies how many frames per second will be displayed during the playback.
The maximum value that can be entered is 100. The default value is 15,
meaning 15 frames per second will be displayed.
The Video for Windows mechanism automatically adjusts each frame to meet
the demand set by Playback Rate. Exceedingly high values will result in
degraded animation and therefore are not recommended.
Example of Playback
Setting
and exported 80 frames. Then the exported AVI file will have:
80 (frames) 5 (export every 5 frames) = 16
frames
It will take:
16 (frames) x 4 (multiplier) 10 (frames/s) = 6.4
sec.
to play back the entire AVI file.
2.
3.
4.
309
0.000
1.250
3.000
0.020
1.365
2.884
0.040
1.480
2.772
0.060
1.595
2.664
0.080
1.710
2.559
0.100
1.825
2.459
You can also export data by rows:
Data From Untitled-1
at:9:02:22 PM 3/4/93
Mass[4]
x
y
0.000 1.250
0.000 1.365
0.000 1.480
0.000 1.595
0.000 1.710
0.000 1.825
3.000
2.884
2.772
2.664
2.559
2.459
310
Mass[2].x
Mass[2].y
Mass[2].
Mass[3].x
Mass[3].y
Mass[3].
0.000
0.020
0.040
0.060
0.080
0.100
1.250
1.365
1.480
1.595
1.710
1.825
3.000
2.884
2.772
2.664
2.559
2.459
0.000
0.000
0.000
0.000
0.000
0.000
2.
The Export dialog box appears (see Figure 9-1 for general information
on the Export dialog).
3.
4.
5.
Click OK.
Figure 9-10
Object Positions export options
Include Header
This option includes the file name, date, object name, and column or row
names before all numerical data. This option will help in referring to specific
columns of data. When this option is turned off, only numerical data is
exported.
311
This option creates rows of positional data rather than columns. Some
animation programs, such as Electric Image, support pasted in rows of
keyframe data.
312
Create a Working Model 2D simulation that describes the planar motion you wish
to achieve.
3.
Export complex shapes from the Working Model 2D simulation as DXF geometry
files.
4.
Create objects in your 3-D animation package that correspond to the objects in the
Working Model 2D simulation.
Edit the exported object positions with a word processor or spreadsheet, and then
paste rows or columns of keyframe data into the corresponding object in your 3-D
animation application.
2.
313
The Export dialog box appears (see Figure 9-1 for general information
on the Export dialog).
3.
4.
You can set the starting frame number of a PICT animation sequence in
the Export Options.
5.
Click OK.
Figure 9-11
PICT export options
Default Suffix
Sequential PICT files will be stored with names such as Car.PICT 0001,
Car.PICT 0002, Car.PICT 0003. Leave the suffix as PICT if you are
exporting sequential PICT files, and your animation package requires naming
of this type.
Export Increment
You can skip simulation frames when exporting sequential PICT files by
choosing an export increment greater than 1.
Change this value to start files with a suffix other than .PICT 0001.
All sequential PICT files will be place in the same folder.
314
2.
The Export dialog box appears (see Figure 9-1 for general information
on the Export dialog).
3.
4.
You can choose to export all objects, or just those that are selected.
5.
Click OK.
A script file and several 3DGF files (one per object) are created and
placed in the same folder.
315
Figure 9-12
MacroMind Three-D export options
Extrude
Use this option if you wish to edit the 3DGF object geometry files by hand.
316
2.
The Export dialog box appears (see Figure 9-1 for general information
on the Export dialog).
3.
4.
You can choose to export all objects, or just those that are selected.
5.
Click OK.
A .set, and several .mov and .obj files (one per object) are created and placed
in the same folder.
Figure 9-13
Wavefront export options
317
2.
3.
4.
5.
Click Import.
318
Working Model 2D can exchange data in real time with external applications
using Apple Events on MacOS systems or Dynamic Data Exchange (DDE)
on Windows systems. In short, Working Model 2D serves as a client to tap
into the capabilities available in other application (such as Excel), which acts
as a server. Working Model 2D sends and receives data to and from another
application once every animation time step.
Such links allow you to create a complex control system in another
application and drive a Working Model 2D simulation with it. You can also
implement complex functions in other applications which may not be
supported directly in Working Model 2D. For example, you can implement
a look-up table in Microsoft Excel for the horsepower curve of a motor.
An exercise in the accompanied Working Model 2D Tutorial uses this
external link feature. We encourage you to try this exercise to familiarize
yourself with the usage of the external interface.
Working Model 2D can also function as a DDE or Apple events server.
Please see 9.15. Controlling Working Model 2D from Another Application
for more information.
319
MacOS
Working Model 2D can communicate with applications that support the
Table Suite of Apple events. These applications include Microsoft Excel 4.0
and Claris FileMaker. Check with your particular applications user guide
to see if the Table Suite is supported.
Windows
Working Model 2D can communicate with applications that support DDE
(Excel Table or Text formats). These applications include Microsoft Excel,
Quattro Pro, MATLAB (version 4.2 or later), and Microsoft Word for
Windows. Check with your particular applications user guide to see if DDE
is supported.
Interface Objects
Remote Commands
320
1.
2.
Create meters and/or controls for the properties you wish to exchange with the
external application.
3.
MacOS
Windows
5.
(Windows only) Click the Application button, select the application name from the
dialog box and click OK.
6.
321
On MacOS systems, the Apple Event link dialog appears (Figure 9-16).
On Windows, a regular file selection dialog appears.
Figure 9-16
Apple events link dialog (MacOS
only)
7.
8.
(MacOS only) Make sure that the application is already running and has the
document open; then click Make Link.
9.
The name of the linked file will appear in the Properties window. The
blank interface object icon will change to the icon of the linked
application.
Connecting the Inputs/
Outputs with the
Application
At this point, you have specified the external application and the document
with which Working Model 2D will interact. You must also specify which
individual Controls (inputs) and Meters (outputs) in the Working Model 2D
document correspond to appropriate elements in the external application. For
example, you must establish a logical link between Controls/Meters and
particular cells (in Excel) or variables (in MATLAB).
1.
In the Properties window for the interface object, select an input or output from the
list.
1.
2. The
322
Figure 9-17
Selecting output objects from the
list
Click on the pulldown box...
2.
For each selected Meter or Control object, click the Connect radio button, and type
in the variable name appropriate for the external application.
For example, if you are using Excel, you can specify the cell by typing:
R1C3
to indicate the cell located at row 1, column 3.1 In MATLAB, you can simply
type the name of the variable exactly as it appears MATLAB, like:
x_initial
For Meters, observe that all the meter fields (like y1, y2, and y3) appear
separately. You can specify variable names or cell names for all these output
channels individually.
3.
Click the Connect radio button for the particular input or output.
1. The RiCj cell specification format may not apply to non-U.S. versions
323
4.
Repeat the steps 1, 2, and 3 for all the inputs and outputs that you want to exchange
data with the external application.
5.
If desired, specify the Initialize and Execute commands appropriate for the external
application.
Executing Remote
Commands
You can execute commands that are specific to the external application linked
to Working Model 2D. For example, you can execute MATLAB commands
or Excel macros by typing them in Initialize and Execute text boxes before you
start a simulation. The following are example commands.
In MATLAB, you can type the function calls into Initialize and Execute
command boxes:
(Initialize)
u = 0;
324
u = f(x, y);
In Excel, you can type Excel macro language into the command boxes. On
Windows, the commands must be enclosed by a pair of box brackets ([]) as
shown below (the brackets are not necessary for MacOS):
(Initialize)
[FORMULA(=R[-1]C+R2C3)]
(Execute)
[RUN(MACRO1)]
where MACRO1 is the name of a macro command you recorded, for example.
Please consult Excels Function Reference manual for details.
Commands typed in the Initialize box will be executed when the simulation
starts, before Working Model 2D performs any computation. For example,
the commands can initialize data before you start a simulation.
Commands typed in the Execute box will be executed at every frame of the
Working Model 2D simulation.
A Sketch for Designing a
Control System
Create an Excel spreadsheet and write a function that describes the feedback
control.
2.
Make sure a motor in your model has a meter for the rotational speed and a control
for the torque.
The meter and control serve as the input and the output for the control
system, respectively.
3.
Select the motors control from the lists of inputs shown in the Properties window
of the interface.
5.
Type the appropriate Excel cell in the Variable fields of the input.
Make sure the cell contains the desired control function in Excel.
325
Select the motors meter from the lists of outputs shown in the Properties window.
Type the appropriate cell in the variable field.
Make sure that the cell is used as the input in the Excel function.
7.
At every frame, velocity data will be sent to the spreadsheet, whose macro
will calculate the desired torque. The torque is returned to the Working
Model 2D simulation as a motor input through the control.
326
C H A P T E R
1 0
Using Formulas
Input controls
Meters
Bodies
Global forces
Frames of reference
Working Model 2D allows you to enter formulas in most places where you
would typically enter a number. Formulas enable you to build custom forces
and constraints and to dynamically control the behavior of objects. Formulas
also serve as the underlying mechanism that links input controls to the
simulation. Formulas control the data displayed by meters and output
devices.
For a complete listing of the Working Model 2D formula language, consult
Appendix B, Formula Language Reference.
327
Formulas
When the unit system is changed, all the factors in the formula are multiplied
by the proper conversion constants. Suppose the current unit system is feet/
pounds/seconds, and you entered a length of an actuator as follows:
Length:
time + 5
[in feet]
12*(time + 5)
[in inches]
Note that the physical quantity is preserved before and after the unit system
is changed; without the conversion factor 12, the length would have been
6.0 inches at t = 1.0, although you would have expected it to be 6.0 feet (72.0
inches).
Furthermore, if the time units were changed from seconds to minutes, the
equation would become:
Length:
12*(time*60 + 5)
[in inches]
because the variable time now returns the value in minutes (according to Rule
1 above).
Effects on Meters
The values displayed by Meter objects are always associated with the current
unit system; if a meter shows 2 feet in the English (pounds) unit system, it will
show 24 inches after you change the length unit to inches.
328
Notes on Precision
The conversion constants are internally stored with full precision but are
displayed with the significant digits given in the Numbers and Units dialog
(default is 3 digits). Editing an equation containing conversion constants will
cause those constants to be part of the equation string with the precision
shown (instead of being internally stored with full precision).
Lets look at our example equation. Even after the units have been changed
to inches and minutes, internally the equation is still stored as:
Length:(time sec. + 5) ft
yet displayed as:
Length:12*(time*60
+ 5)
in
Length:12*(time
min * 60 + 5)
329
in
Note that if some of the constants had multiple significant digits, modifying
the equation could lead to slightly different answers in the simulation. See
also Precision of Meter Data in Non-SI Units on page A25.
Maximum Equation Length
Select a spring.
2.
Choose Spring Constant from the New Control submenu in the Define menu.
A slider and text box will appear on the screen. This control is directly
tied to the spring, and can be used to change the spring's constant.
To see the link between the control and the spring constant:
1.
2.
330
Figure 10-1
Properties window with a spring
selected
In the area that defines the spring's constant, you will see the following:
input[5]
When Working Model 2D is running a simulation, it will look for a value to
use as the spring's constant. Instead of using a number, it will use whatever
value is being generated by input #5.
Input[5] is the formula name for the value generated by the slider. The
formula Input[5] was automatically placed in the spring constant field
when the slider control was created. If you delete the slider control, the
formula will be removed and replaced by the original value of the spring
constant.
You can link input controls to any property you wish by selecting an object
and creating a new control from the object menu, or by entering the name of
the control (in this case input[5]) in any field that accepts formulas.
Each control has a minimum and maximum value that you can change from
the control's Properties window.
331
Arithmetic Expressions
Typically, an object keeps its mass constant during a simulation.
You can inspect an objects mass by selecting the object and then choosing
Properties from the Window menu. The Properties window appears to show
the object properties, including its mass.
You can click the resize box in the upper-right corner of the Properties
window to make it larger. The entry fields expand at the same time, allowing
you to enter longer expressions more easily.
A typical rocket might start with a mass of 10,000 kg, (excluding fuel) and
carry 10,000 kg of fuel. If the fuel is burned in 100 seconds, and at a constant
rate, then the mass M of the rocket can be described as follows:
20000
M =
If you were running your simulation for less than 100 seconds, you could
simply enter the following into the mass field of the properties window (see
Figure 10-2) that defines the rockets mass:
20000 - 100 * time
Figure 10-2
Formula entered in properties
window
When you run the rocket simulation, the rocket will progressively become
lighter according to the formula you have entered.
332
Conditional Formulas
If you were running your simulation for more than 100 seconds, you could
accurately combine these two equations into a conditional statement as
follows:
if (time < 100)
else
You could enter a formula like this using the if function. The if function
takes three parameters, each separated by a comma, in the following format:
if (condition,return if true,return if false)
The rocket equations are combined with an if() function as follows:
if(time<100, 20000-100*time, 10000)
5000, 0)
This means that if time is less than 100 seconds, the force will exert 5000 N.
Otherwise, the force will exert 0 N.
Working Model 2D also provides an easy way to turn constraints on and off,
using the Active when field of the force Properties window. To turn the
force off after 100 seconds, simply enter 5000 as the value of the force, and
enter
time < 100
in the Active when field of the Properties window for the force (see
Figure 10-3).
333
Figure 10-3
Active When field of a constraint
body[3].vertex[2].x
y:
body[3].vertex[2].y
This way, the endpoint will always remain on the second vertex, even when
the size and the shape of the polygon is modified.
Please refer to Using Geometry-based Formulas (Point-based Parametrics)
on page 104 for instructions. Also, Body Fields on page B6 provides
references for syntax.
334
There are times when you want to access the properties of each individual
body when applying a custom global force. A good example of this is gravity
at the Earth's surface. A general description of the force generated by the
Earth's gravitational field near the Earth's surface is given by:
F = mg
335
This equation results from the more general equation describing the universal
gravity:
Gm 1 m 2
F = -----------------2
r
G = 6.67 10
24
m 1 = 5.98 10
6
r = 6.38 10
Fy:
- 9.81 * self.mass
T:
336
6.67e-11*self.mass*other.mass /
sqr(self.p - other.p)
Fy:
T:
G = 6.67 10
337
Figure 10-5
Formulas used in a position meter
A meter that measures the position of a body contains the following three
formulas:
body[1].p.x
body[1].p.y
body[1].p.r
These formulas refer to the configuration of the object in terms of its position
(x, y) and rotation (r).
You can create custom meters by replacing the default formulas with your
own formulas. The title and appearance of a meter can also be altered using
the Appearance window.
Further, any meter field can be used in another formula description. See
Using Meters as Variables in Formulas on page 342 for examples.
338
2.
Click on a body.
4.
2.
Click on a body.
339
4.
To make the center of mass of an object move to the right with constant
acceleration, you could type
time
in the Vx field. The center of mass will start at Vx = 0 and accelerate to the
right during the simulation.
To make the center of mass move with a constant velocity, type
(5.0)
in a velocity field. Putting the number in parentheses will force the velocity
to be a formula.
NOTE: If the anchored body has a formula in any of its velocity fields,
Working Model 2D treats the anchor as a velocity constraint, and the position
fieldseven if they contain formulaswill be applied only at the first frame.
340
Figure 10-6
A block tumbling down a wedge
After selecting the square as the frame of referencethat is, view the
simulation from the mass center of the square and the squares orientation
the animation would appear as in Figure 10-7. Note that the anchored wedge
appears to rotate during the simulation.
Figure 10-7
Simulation from the block's
reference frame
Figure 10-8 again shows the same simulation. But this time, the simulation
is viewed positionally from the point in the upper-right-hand corner of the
square, yet with the orientation of the background.
341
Figure 10-8
Simulation from the block's
reference frame without rotation
Select the point, and choose Properties from the Window menu.
Enter the following formula in the (angle) field of the point (n is the ID number
corresponding to the tumbling block):
-body[n].p.r
The formula specifies the orientation of the frame of reference to oppose
that of the body. Now the point will rotate to compensate the rotation of
the body.
4.
Select the point and choose New Reference Frame from the View menu.
Now the frame of reference is attached to the point. You are ready to run
the simulation.
342
Under the Measure menu, choose Time and create a time meter.
In fact, any meter can be used as a variable. For now, we will just use a
Time meter and modify it.
2.
Overwrite the field y1 with the formulas shown in Figure 10-9 below. If necessary,
resize the Properties window so you can view the entire text in the formula box.
This step is where you define the variable. In fact, you can use any or all
of the output fields (y1 through y4) to define variables.
343
Figure 10-9
Using a meter field as a variable
A-1
A P P E N D I X
Technical Information
1. The
A-2
3.
4.
Change the Preferred Size to a larger value in the Memory Requirements box.
5.
The change will not take effect until you close the window.
The next time you launch Working Model 2D, it will attempt to claim as
much memory as possible, up to the size set in Preferred Size. If the
available memory is below Minimum, the MacOS will not allow you to
launch Working Model 2D.
The above method will not work if the memory available to the whole MacOS
computer is low. In this case, you can take advantage of virtual memory if
desired. To turn on virtual memory, open the Memory Control Panel. Turn
on Virtual Memory in the dialog and set the appropriate size as desired. You
will have to restart your MacOS computer to activate virtual memory.
Windows
A-3
When you examine the memory status using the About This Macintosh
dialog from the Finder (see Figure A-1), you will only see the block allocated
to Working Model 2D. However, the memory used up by the scripting engine
is accounted as part of the System Software.
The scripting engines attempt to claim this additional memory when Working
Model 2D is launched. If the memory is not available, Working Model 2D
will present a warning dialog indicating that any scripting feature including
running pre-written scriptswill be disabled. You can continue to launch
and use Working Model 2D, but all scripting and script editing functions will
be disabled.
To re-activate the scripting engines:
1.
2.
A-4
Windows
The two main factors that affect performance of Working Model 2D, besides
the performance of the computer itself, are available memory (RAM) and the
size of the document window.
Lack of sufficient RAM causes frequent disk access and thus negatively
affects performance. If the amount of physical RAM is insufficient to store
Working Model 2D and other applications (including Windows), the
operating system will be constantly forced to swap part of Working Model 2D
to disk. To avoid this behavior, quit other applications so that memory is
available to Working Model 2D.
If you are using full-page or larger monitors, you may find that the animation
speed drops below acceptable performance. You can increase animation
speed by reducing the size of the document window.
Section Making Your Simulation Run Faster on page 280 also provides
useful tips on how to optimize the simulation speed.
Interested in Fast
Playback?
You can also save the animated simulation results in a run-time animation
format. The MacOS version of Working Model 2D supports QuickTime
export, whereas the Windows version is capable of exporting Video for
Windows files. These data formats are optimized for rendering smooth
A-5
animation, and their playback rate can be considerably higher than that of
Working Model 2D. Furthermore, the recipients of these files need not have
a copy of Working Model 2D to view the animated results.
For more details, please see Chapter 9, Importing and Exporting Files
and Data.
Overview
An analytical solution for the x and y position of the mass center a ball seen
in most elementary physics texts is:
x = x0 + vx t
0
1 2
y = y 0 + v y + --- gt
0
2
1. Also
A-6
Numerical Integration
F = ma
(Force = mass * acceleration)
T = I
a =
dv
dt
v =
dx
dt
d
dt
1. As
v =
a =
A-7
dv
results in
dt
= a dt + v 0 . The
2.
v t = t = a t + v t = 0 (approximating v =
3.
a dt + v 0 )
xt = t = xt = 0 + vt = 0 t
This process is called numerical integration. There are many methods for
numerically integrating acceleration to calculate new velocity and position
terms at a later time. The method shown above is known as the Euler method,
one of the simplest numerical integrators available. Working Model 2D
features another, more accurate numerical integrator called Kutta-Merson
method. See Integrators on page A15 for more discussion on numerical
integration.
A-8
A-9
A-10
be 10
11
A-11
waste computing time trying to meet this exceedingly small error criterion.
To avoid this problem, Working Model 2D uses a second error bound called
Absolute Acceptable Error.
You can specify the magnitude of a as the Integrator Error in the Accuracy
dialog (see A.6. Simulation Accuracy Dialog and Simulation
Parameters).
Acceptable Error
The acceptable error is the maximum of Absolute Acceptable Error and
Relative Acceptable Error. In Figure A-2, the acceptable error is denoted as
a thick line. When the error estimate exceeds this line, Working Model 2D
proceeds to cut the time step in half (see Variable Time Step on page A9).
Acceptable Error
Figure A-2
Acceptable Error
A-12
As a case study, consider simulating a space probe that is launched from the
Earth. For simplicity, we will assume that the probe cannot propel itself, and
its dimension is about 20 feet across.
If you are interested in the position of the space probe after one year from
launch, and if you can afford an error of 1 mile, you should set the Absolute
Acceptable Error to 1 mile. Since the numerical magnitude of the solution
you are interested in is fairly large compared to the size of the body, a tight
absolute error would require an excessively long computation time. On the
6
other hand, you should keep the Relative Acceptable Error low (e.g. 10 ,
which translates to setting Significant Digits to 6), because 1 mile of an error
is a small fraction of the overall displacement of the probe, which probably
extends to millions of miles.
Simulating the Probes
Internal Mechanism
However, suppose you are interested in the orientation of the probe while it
travels in space. Further assume that the error must stay within 1.
Working Model 2D evaluates an angular error by converting it to the arc
length drawn by the body with the given angle. In our case, a 20-foot body
swings 1 to draw the arc length of:
20
A-13
(The body dimension of 20 feet is divided by two to obtain the rotation radius,
assuming the body rotates about its center of mass.)
Then the Absolute Acceptable Error of 1 mile is too large; you need to tighten
it to about 2 inches ( 0.175 feet). Meanwhile, you can leave the Relative
6
Shown below are general rules of thumb in fine-tuning the acceptable errors:
You should almost always keep the Relative Acceptable Error low by
choosing a large value (at least 4) for Significant Digits in the Accuracy
dialog.
You may need to control the Absolute Acceptable Error (defined as
Integrator Error in the Accuracy dialog) depending on the magnitude of
the solution you are interested in.
A-14
Figure A-3
Simulation Accuracy dialog with
More Choices selected
Fast / Accurate
Custom
Accurate
Integrator
Euler
Kutta-Merson
Locked
Variable
Warn inaccurate
integration
Yes
No
Yes
Yes
Warn redundant
constraints
No
No
Warn inconsistent
constraints
No
Yes
A-15
Integrators
Working Model 2D assigns an integrator when you choose either Fast or
Accurate mode. This section is presented for those who wish to experiment
with the benefits of various integration methods.
The integrator is the mathematical process that continuously integrates
bodies accelerations to update their positions and velocities. The following
integrators are available in Working Model 2D:
Euler Integration
Kutta-Merson Integration
In order to illustrate the relative complexity of the two methods, lets examine
the following first order differential equation:
y = f(y, t)
and see how each integrator solves it numerically. We are interested in
solving yn+1, or the value of y at the next step tn+1, given the information
yn and tn. We will denote the time step as h (so t n + 1 t n = h ).
Euler
Euler integration is the fastest and simplest but least accurate integrator
available for a given time step. Euler integration is the default in the Fast
simulation mode and should suffice in giving you a rough idea of the motion.
The Euler method solves the above differential equation in a single step:
y n + 1 = y n + hf ( y n, t n )
Working Model 2D does not provide the variable time step option for the
Euler method.
Kutta-Merson
Kutta 5.
A-16
1
1
1
( y n ) 2 = y n + --- hf ( y n, t n ) + --- hf ( y n ) 1, t n + --- h
6
3
6
3
1
1
( y n ) 3 = y n + --- hf ( y n, t n ) + --- hf ( y n ) 2, t n + --- h
8
8
3
3
1
1
1
( y n ) 4 = y n + --- hf ( y n, t n ) --- hf ( y n ) 2, t n + --- h + 2hf ( y n ) 3, t n + --- h
2
6
3
2
1
1
2
1
( y n ) 5 = y n + --- hf ( y n, t n ) + --- hf ( y n ) 3, t n + --- h + --- hf ( ( y n ) 4, t n + h )
6
2 6
3
yn + 1 = ( yn )5
to the Acceptable Error (Please see A.5. How Working Model 2D Bounds
Errors).
Animation Step
The Animation Step box determines the time between frames of animation.
Data from the simulation is presented on the screen as a new frame at this
interval. This box does not represent the integration time step.
By default, Working Model 2D automatically tries to choose a good
animation step based on the type of simulation that has been created. Using
the size of the objects, their spacing, and their velocities, Working Model 2D
determines an ideal animation step size. Thus, if you are modeling the solar
system, its large size, spacing, and velocities will force an automatic
animation step size in the range of hours or days.
You can override the automatic animation step decision and set your own
time step size between animation frames. See Integration Time Step on
page A17 for discussion on how to set the integration time step.
A-17
Integrator Error
The integrator error corresponds to the Absolute Acceptable Error, or the
parameter a discussed in A.5. How Working Model 2D Bounds Errors.
Fundamentally, the value is used as the lower bound for numerical errors;
Working Model 2D cannot attain higher accuracy than what is specified in the
Integrator Error. Integration results can violate this bound as long as they are
within the Relative Acceptable Error.
In Fixed mode, the integration time step is locked. The default value for
integration step is equal to the animation step. You can make the integration
time step smaller than the animation step by typing the desired step size in the
text box. By doing so, you are packing multiple integration steps into one
animation frame.
Variable
interpenetrating bodies
constraint violations
A-18
Overlap Error
Overlap error is used as the upper bound for overlap amount between bodies
while Working Model 2D simulates their collision. In order to prevent two
bodies from interpenetrating, Working Model 2D applies a repulsive contact
force to each object when the bodies overlap by more than this value. This
scheme ensures that the overlap will never exceed the value specified in
Overlap Error. See A.7. Simulating Collisions for more discussion.
Assembly Error
Assembly error is used to bound the numerical error in the Join operation
performed by the Smart Editor. For example, when you join a pair of point
elements to form a pin joint, Working Model 2D iteratively computes the
configuration until the result converges within the Assembly Error value.
NOTE: Joints are more closely monitored for error correction during the
simulation run. Maintaining the pin joint constraint is a fairly simple process,
and in variable step mode, Working Model 2D corrects errors as soon as they
are eminent. In fixed time step, you may observe that the joints wobble
slightly. Working Model 2D is trying to correct the position of a pin joint
because the simulation result after one frame may place the pin joint slightly
offset due to a numerical error.
Significant Digits
The value given in the Significant Digits box corresponds to the number of
digits that are accurate during numerical integrations. The number given in
the Significant Digits field sets the relative error, 10
Working Model 2D Bounds Errors for details).
A-19
Warnings
When a warning occurs, the simulation pauses and presents a dialog. The
simulation can then be stopped or continued.
Inaccurate Integration
Warns when two or more bodies overlap by more than the overlap tolerance
(see Simulation Error Tolerances on page A17) at the initial condition,
and the bodies are not connected by joints or designated as Do Not Collide.
When two overlapping bodies collide, they may cause physical instability in
the simulation. See Preventing Unstable Simulations on page A22 for
more information.
Redundant Constraints
Warns when there are more constraints than necessary to constrain a specific
object's motion. For example, a body with several pin joints between it and
the background has redundant constraints.
Inconsistent Constraints
A-20
Collision Impulse
A-21
In physical experiments, a collision force profile typically resembles a spikeshaped bell curve whose support (where the function is non-zero; i.e., the
physical duration of the collision) is often much smaller than a typical time
step used in numerical simulations (see Figure A-4).
Figure A-4
Time step size, numerical peak
value, and physical peak value
A-22
2.
A-23
Simulation instabilities can occur when bodies that initially overlap are
allowed to collide. Any two bodies that are not connected with a joint can
collide. If you overlap two bodies without using the Do Not Collide command,
large forces will be generated to move the bodies apart.
Instabilities usually indicate the need for a smaller time step. If an object is
moving large distances in a small time and interacting with another object
through a joint or contact, incorrect results and instabilities may result.
A good rule of thumb is that the time step must be small enough to capture
small motions that occur in the system. If you are modeling a guitar string,
you will need a very small time step. If the guitar string oscillates 440 times
per second, you would need at least four time steps to accurately model each
back and forth motion of the string. Thus you would need 1760 time steps
per second, or a time step of 1/1760 second.
Other systems requiring a small time step include very heavy bodies
interacting with very light ones, chains that are being stretched, and light
wheels on heavy cars.
Instabilities can usually be corrected with the Accurate simulation method
(use the Simulation Accuracy dialog). The Accurate simulation method
automatically adjusts the time step for you. As an alternative, use the Fast
simulation method, but decrease the time step. Through a bit of playing
around, you will get a feel for how the time step affects the simulation.
When using the Fast method (fixed time step), reducing the time step
increases the accuracy. When using the Accurate method (variable time
step), reducing the value in the Integrator Error increases the accuracy. The
error value determines how much numerical error is allowed during each time
step. The smaller the error value, the more accurate the simulation.
A-24
A-25
1 2
--- mv as the formula. The SI unit system is designed so that 1 J
2
(Joule) = 1 kg-m2/s2. However, in the English unit system, where Btu (British
Thermal Unit) is used to measure energy, 1 Btu is not equal to 1 lb-ft2/s2.
1
2
where the constants 9.49e-4, 0.454, and 0.305 convert Joule to Btu, pounds to
kilogram, and feet to meters, respectively.
Since these constants are generated with the number of digits specified in the
Numbers and Units dialog, meters may present slight discrepancies between
the SI and non-SI unit systems. You can increase the number of sub-decimal
digits in the Numbers and Units dialog to increase the precision of these
conversion factors generated by Working Model 2D.
A-26
On Numerical Methods
Leslie Fox: Numerical Solution of Ordinary and Partial Differential
Equations, Addison-Wesley, 1962.
Robert W. Hornbeck: Numerical Methods, Prentice-Hall, 1961.
Gene H. Golub and James M. Ortega: Scientific Computing and Differential
Equations: An Introduction to Numerical Methods, Academic Press,
Inc, 1992.
C. William Gear: Numerical Initial Value Problems in Ordinary Differential
Equations, Prentice-Hall, 1971.
Germund Dahlquist and ke Bjrck: Numerical Methods, Prentice-Hall,
1974.
On Mechanics
Thomas R. Kane and David A. Levinson: Dynamics: Theory and
Applications, McGraw-Hill Publishing Company, 1985.
Ferdinand P. Beer and E. Russell Johnston, Jr.: Vector Mechanics for
Engineers, McGraw-Hill Book Company, 1977.
Nicholas P. Chronis: Mechanisms & Mechanical Devices Sourcebook,
McGraw-Hill, Inc., 1991.
Edward J. Haug: Computer-Aided Kinematics and Dynamics of Mechanical
Systems, Allyn and Bacon, 1989.
A. Bedford and W. Fowler: Engineering DynamicsMechanics, AddisonWesley Publishing Company, 1995.
A-27
B-1
A P P E N D I X
B-2
Exponents
Exponents are displayed in the following way:
In Printed Text
In Working Model 2D
123x103
123e3
1.001x10-22
1.001e-22
Angle Measures
All angles are expressed in radians. An angle of 360 has a radian measure
of 2.
NOTE: Angles in formulas are expressed in radians although the default
display mode for Working Model 2D is degrees.
B.3. Identifiers
Identifiers are used in formulas to identify an object. There are five types of
identifiers. When creating formulas, you can use one or more of these types:
body[3]
point[2]
constraint[44]
output[12]
input[5]
The number within the brackets is the object ID. Each object in Working
Model 2D has a unique ID. To find the ID of an object, double-click the
object to display the Properties window for that object. The ID appears with
the proper formula syntax in the top of the Properties window. In addition,
the identifier of an object is displayed in the Status bar when the pointer is
over the object (see Chapter 6, The Workspace).
B.4. Fields
B-3
Body[] is the identifier for bodies, such as circles, polygons, and rectangles.
Point[]
Point[] is the identifier for point objects. Point objects are either isolated
points, or the points which compose the endpoints of a constraint.
Point[11] is the ID for point #11. (See Body Fields on page B6 for
polygon vertices.)
Constraint[]
Output[]
Input[]
Input[] is the identifier for all input controls, including sliders, text boxes,
and buttons.
If you use an identifier with an ID for an object that does not exist, the result
will be a Null object. Null objects return 0.0 for all of their properties.
B.4. Fields
Each identifier in the Working Model 2D formula language can have fields.
You use fields to access the values of basic properties such as position and
velocity.
Fields are specified by a Type, followed by a period (.) and a field name.
To access the moment of a body with an ID of 3, you would enter the formula:
body[3].moment
B-4
body[2].p.r
This equation has two hierarchical fields. First, body[2].p produces the
position field of body #2, which is a vector. Next, the .r produces a
rotation value (i.e., the orientation of the body) from the position field.
body[2]
body type
body[2].p
vector type
body[2].p.r
number type
The following is a list of all fields with the type of value that each field
produces. See the following sections for field descriptions.
Type
Field
Type
Returned
Vector
.x
.y
.r
number
number
number
Body
.p
.v
.a
.mass
.moment
.charge
.staticfric
.kineticfric
.elasticity
.cofm
.width
.height
.radius
.vertex[n].x
.vertex[n].y
Vector
Vector
Vector
number
number
number
number
number
number
Point
number
number
number
number
number
Point
.p
.v
.a
Vector
Vector
Vector
B.4. Fields
.offset
.body
.force
Vector
Body
Vector
Constraint
.length
.dp
.dv
.da
.p1
.p2
.force
number
Vector
Vector
Vector
Point
Point
Vector
Output
.x
.y1
.y2
.y3
.y4
number
number
number
number
number
Input
B-5
number
Vector Fields
x, y, r
Notice that position, velocity, and acceleration are always returned as type
vector in the above table. For example,
point[4].a
acceleration of point #4
body[3].v
are both of type vector. You cannot enter these formulas in a text field,
because they are not numbers.
To access individual components of these vectors, you must designate
whether you want the x, y or rotational components.
To get a number, enter the following equation instead:
body[3].v.x
B-6
Body Fields
p, v, a
cofm
These are the current values of position, velocity and acceleration. Each of
these fields returns a value of type vector. Thus, to use any of these field you
need to add one of the vector fields (x, y, r).
body[1].p.x
body[3].v.y
body[37].a.r
charge of body #3
body[14].mass
This field returns the kinematic properties of the center of mass of a body.
The expression:
body[3].cofm
is the same type as points, so it has all the fields available to a point (see
Point Fields on page B7). For example, the expression:
body[3].cofm.p.x
B.4. Fields
B-7
The next four fields (width, height, radius, vertex[n]) are called
geometry-based formula and return the geometric information of bodies.
You can use these fields to position endpoints of constraints precisely (see
Using Geometry-based Formulas (Point-based Parametrics) on page 104).
width
Returns the width of a rectangle or a square. The width field is not valid for
other body types. For squares, width is always identical to height.
height
Returns the height of a rectangle or a square. The height field is not valid
for other body types. For squares, height is always identical to width.
radius
Returns the radius of a circle. The radius field is not valid for other body
types.
vertex[n].x, vertex[n].y
Point Fields
p, v, a
These are the current values of position, velocity and acceleration. Each of
these fields returns a value of type vector. Thus, to use any of these fields you
need to add one of the vector fields (x, y, r).
point[1].p.x
x position of point #1
The offset field returns the vector containing the current configuration (.x,
.y, and .r) of the point element in terms of the FOR (frame of reference) of
the body to which the point is attached (local coordinates).
B-8
The body field returns the body to which the point element is attached. See
Body Fields on page B6 for associated fields.
force
The force field returns a vector representing the force acting on the point
to be more precise, the force acting on the body at the point. The components
are given in terms of the global coordinates, regardless of what the point
element is attached to.
Constraint Fields
length
This is the current distance between the two points of the constraint. To find
the current length of a spring, you would enter:
constraint[3].length
dp, dv, da
length of constraint #3
These are the current values for the difference in position, velocity, and
acceleration between the two points of the constraint. Each of these fields
returns a value of type vector.
These values measure in the constraint's reference frame. The x value is
measured along the line connecting the two points of a point to point
constraint.
To find out how fast the length of a spring is changing (the difference in
velocity between the two endpoints of the spring), you enter the following
formula:
constraint[3].dv.x
p1, p2
B.5. Operators
force
B-9
The force field returns the vector representing the constraint force. The
field is equivalent to constraintforce(n) (see Simulation Functions on
page B21).
Output Fields
x
This is the value displayed on the x-axis or the abscissa of an output graph.
output[6].x
output[6].y2
output[6].y3
output[6].y4
B.5. Operators
Operators include all of the common algebraic symbols (+, -, >, =). The
following operators require one or two numbers. The letters a and b are
used as place holders for any number or formula that evaluates to a number.
Numeric Operators
The following is a listing of numeric operators that are available for use in
formula entry:
B-10
Operator
- (negate)
+ (plus)
- (minus)
* (multiply)
/ (divide)
% (mod)
Input(s)
a
a + b
a - b
a * b
a / b
a % b
Output
-a
a + b
a - b
a x b
a / b
a mod b
^ (power)
>
<
>=
<=
= (equal)
<>(not equal)
a
a
a
a
a
a
a
ab
1 or
1 or
1 or
1 or
1 or
1 or
^ b
> b
< b
>=b
<=b
= b
<>b
0
0
0
0
0
0
These operators require numbers as their inputs. This means that you cannot
add most formula elements that are not a number.
Incorrect:
body[3] + point[3]
body[3].p - 34.5
cannot subtract a
number from a vector
point[7].v + body[3]
cannot compare a
vector to a number
Correct:
body[3].p.x + point[3].p.x
body[3].p.x - 34.5
point[7].v.y - body[3].v.y
body[3].p.y > 44.0
B.5. Operators
B-11
body[3].p.y = 44.0
body[3].p.y != 44.0
- (negate)
+ (plus)
- (minus)
* (multiply)
/ (divide)
% (mod)
Takes two numbers and returns the remainder of the first value divided by the
second.
^ (power)
Takes two numbers and returns the first value raised to the power of the
second value.
Takes two numbers and returns the value 1 if the first value is greater than the
second value. Otherwise, returns the value 0.
Takes two numbers and returns the value 1 if the first value is less than the
second value. Otherwise, returns the value 0.
Takes two numbers and returns the value 1 if the first value is greater than or
equal to the second value. Otherwise, returns the value 0.
Takes two numbers and returns the value 1 if the first value is less than or
equal to the second value. Otherwise, returns the value 0.
= (equal)
Takes two numbers and returns the value 1 if the two values are equal.
Otherwise, returns the value 0. This operator does not assign any value to the
left side of the equation. The formula:
body[3].p.y = 3
B-12
Takes two numbers and returns the value 1 if the two values are not equal.
Otherwise, returns the value 0.
Operator Precedence
Use parentheses to set the order of equation evaluation. All equations are
normally evaluated from left to right. Precedence is given to operators in the
following order. (operators listed in the same row have equal precedence):
()
[]
(binary operators)
<
<=
>
highest precedence
%
>=
=
Arithmetic Operators
lowest precedence
Operators with the highest precedence are applied first. For example, the
following formula:
3 + 2 * 4
B.5. Operators
B-13
Although the inequality operators have the same precedences, the return
value of the formula:
if (0 < t <=1, 50, 100)
since the chain of the binary operators is evaluated from left to right. As a
result, the above formula always returns 50 regardless of the value t (since (0
< t) returns 1 or 0, the entire first argument is always 1, or true). If you want
the effect of return 50 when t is between 0 and 1, or else return 100, you
should type:
if(and(0 < t, t <= 1), 50, 100).
Vector Operators
The following operators will work on vectors.
Operator
- (negate)
+ (plus)
- (minus)
* (multiply)
||(magnitude)
Input(s)
vector
vector,vector
vector,vector
number,vector
vector
Output
vector
vector
vector
vector
number
These operators require that their input types match those listed in the
previous chart. Vector operators are useful for simplifying formulas. To
display a meter showing the distance between two bodies, you would enter
the following formula:
|body[3].p - body[2].p|
This formula contains two vector operators. First, the - operator was used
to subtract the two positions of the bodies:
B-14
body[3].p - body[2].p
result is a vector
The chart above indicates that the minus (-) operator can be used on two
vectors, and that the result is a vector. The result can then be used with the
magnitude(||) operator to produce a number. The following table shows some
of possibly common mistakes and corrections.
- (negate)
Incorrect
Correct
body[2].|a|
|body[2].a|
|body[2]|.a
|body[2].a|
|body[2].a.x|
abs(body[2].a.x)
body[2].a.x + body[2].v
Takes a vector quantity and returns the negative of the quantity. The .x, .y,
and .r fields of the vector are all negated.
body[3].p.x
value is 10.0
-body[3].p.x
value is -10.0
(-body[3].p).x
value is -10.0
Takes two vectors and returns a vector which is the sum. The vector which
is returned will have each of its fields (.x, .y, .r) equal to the sum of the
corespondent fields of the two vectors being added.
- (minus)
Takes two vectors and returns a vector which is the difference. The vector
which is returned will have each of its fields (.x, .y, .r) equal to the difference
of the corespondent fields of the two vectors being added.
* (multiply)
Takes a vector and a number and returns the scalar product. The vector which
is returned will have each of its fields
(.x, .y, .r) equal to the product of the number and the corresponding field of
the multiplied vector.
B.6. Functions
|| (magnitude)
B-15
Takes a vector and returns a number which is the magnitude of the .x and .y
fields. Magnitude is equal to the length of a line drawn from (0,0) to the (.x,
.y) fields of the vector. The number returned from the magnitude function is
equal to:
|v| = sqrt(v.x*v.x + v.y*v.y)
B.6. Functions
Functions take from zero to three arguments, and return a number or vector
value. All functions accept their arguments in the form
function(arg1, arg2.....)
There are two kinds of functions available. Math functions perform standard
mathematical operations. Simulation functions return information from
Working Model 2D simulations.
B-16
List of Functions
Name
abs
and
angle
acos
asin
atan
atan2
ceil
cos
exp
floor
if
ln
log
mag
max
min
mod
not
or
pi
pow
rand
sign
sin
sqr
sqrt
tan
vector
abs(x)
Inputs
number
number,number
vector
number
number
number
number,number
number
number
number
number
number,number,number
number
number
vector
number,number
number,number
number,number
number
number,number
number,number
number
number
number
vector
number
number
number,number
Output
number
1 or 0
number
number
number
number
number
number
number
number
number
number
number
number
number
number
number
number
1 or 0
1 or 0
number
number
1 or -1
number
number
number
number
number
vector
Takes a number and returns the absolute value of the number. Example:
abs(body[3].p.x)
B.6. Functions
and(x,y)
B-17
Logical AND operation. Takes two numbers and returns the value 1 if both
numbers are not 0. Otherwise, returns the value 0. Example:
and(time>1 , body[2].v.y>10)
returns the value 1 if time is greater than 1 and body #2's y velocity is greater
than 10.
angle(v)
Takes a vector and returns the angle the vector makes with the coordinate
plane. For example, if a body has a velocity of 0 in the x direction, and 10 in
the y direction, the body has a velocity that is in the direction of 90 or /2
on the coordinate plane. The formula
angle(body[3].v)
Takes a number and returns the inverse cosine of the number. Values are
returned in the range [0,].
asin(x)
Takes a number and returns the inverse sine of the number. Values are
returned in the range [-/2, /2].
atan(x)
Takes a number and returns the inverse tangent of the number. Values are
returned in the range [-/2, /2].
atan2(y,x)
Takes two numbers and returns the inverse tangent of y/x. This function is
useful because unlike the atan function, it can generate an angle in the correct
quadrant. Values are returned in the range [-, ].
ceil(x)
Takes a number and returns the smallest integer no smaller than the number.
cos(x)
exp(x)
Takes a number and returns the exponential of the number. (e raised to the
value of the number).
floor(x)
Takes a number and returns the largest integer no larger than the number.
B-18
if(x,y,z)
returns the value 20 if time is greater than 1, otherwise returns the value 0.
Typically, the first argument of an if function is a relation (such as x > y)
or a logical operation (such as and(a, b)). You can write nested ifstatements by recursively using other if() functions as its own arguments.
For example, shown below is a somewhat naive C-code segment which
returns the maximum of three numbers a, b, and c:
{
if (a > b) {
if (a > c)
return a
else
return c
}
else {
if (b > c)
return b
else
return c
}
;
;
;
;
In the formula language of Working Model 2D, the above segment can be
translated into a single line as follows:
if(a>b,if(a>c,a,c),if(b>c,b,c))
ln(x)
log(x)
mag(v)
Takes a vector and returns the magnitude of the vector. Result is the same as
|v|.
max(x,y)
Takes two numbers and returns the larger of the two numbers. Example:
B.6. Functions
B-19
max(body[1].a.x , body[2].a.x)
min(x,y)
Takes two numbers and returns the smaller of the two. Example:
min(body[1].v.x , body[2].v.x)
mod(x,y)
Takes two numbers and returns the remainder when the first value is divided
by the second.
not(x)
Logical NOT operation. Takes a number and returns the value 0 if the
number is not 0. Otherwise, returns the value 1.
or(x,y)
Logical OR operation. Takes two numbers and returns the value 1 if at least
one of the numbers is not 0. Returns 0 if and only if both numbers are 0.
Example:
or(time>1 , body[2].v.r>10)
returns the value 1 if time is greater than 1 or body #2's angular velocity is
greater than 10.
pow(x,y)
Takes two numbers and returns the value of x raised to the power of y; i.e.,
returns xy.
pi()
rand()
B-20
sign(x)
Takes a number and returns the value 1 if the number is greater than or equal
to zero. Otherwise, returns the value -1.
sin(x)
sqr(x)
sqrt(x)
tan(x)
vector(x,y)
Takes two numbers and returns a vector composed of the two numbers. The
first number (x) becomes the .x field of the vector. The second number
becomes the .y field of the vector.
B.6. Functions
B-21
Simulation Functions
Simulation functions are used to extract data from the simulation. These
functions are used in the various meters and vectors of Working Model 2D.
Name
Inputs
Output
constraintforce
number
vector
number,number
vector
number,number,number
vector
frame
number
frictionforce
number,number
vector
groupcofm
number
vector
kinetic
constraintforce(x)
number
length
number,number
number
normalforce
number,number
vector
section
number,vector
number
Takes the ID number of a constraint (x), and returns a vector describing the
current force being applied by the constraint. To find the compression in a
spring, use the formula:
constraintforce(3).x
Takes the ID number of a constraint (x), and the ID number of a body (y).
Returns the amount of force being applied by the constraint on the body as a
vector. This function is used by meters which measure gravity, air resistance,
electrostatic and custom force fields. The ID numbers for these four
constraints are constant, and are described in the next section. The gravity
constraint always uses constraint ID #10002. To measure the force imposed
on a body by the linear gravity constraint, use the formula
B-22
constraintforce(10002, 3).y
In this case, the .y suffix is used to get the value of force in the y (up and
down) direction.
constraintforce(x,y,z)
Takes the ID number of a constraint (x), and the ID numbers of two bodies (y
and z). Returns the amount of force being applied by the constraint between
the two bodies.
This function only returns values for forces which are applied to each pair of
bodies (planetary gravity, electrostatics, and custom force fields). The ID
numbers for these constraints are constant, and are described in the next
section. The gravity constraint always uses constraint ID #10002. To
measure the force of gravity between two specific bodies in a planetary
system, use the formula
constraintforce(10002,3,5).x
As with point to point constraints, the .x value of the vector measures the
force applied along the line that connects the center of mass of the two bodies.
frame()
Returns the current frame number. The initial conditions are defined as being
frame zero.
frictionforce(x,y)
Takes the ID numbers of two bodies (x and y) and returns the friction force
of the first object acting upon the second. The value is returned as a vector.
groupcofm(x)
Takes the ID number of a group (x) and returns the center of mass of all
bodies in the group. Currently, the only defined group is group #0, which is
the group that contains all bodies.
kinetic()
Returns the total kinetic energy of all bodies in the simulation as a number.
length(x,y)
Takes the ID numbers of two bodies (x and y) and returns the length of the
line connecting their centers of mass.
normalforce(x,y)
Takes the ID numbers of two bodies (x and y) and returns the contact force of
the first object acting upon the second. The value is returned as a vector.
B-23
Working Model 2D considers the contact force as the sum of the normal force
and the collision force. Please see A.7. Simulating Collisions for more
information.
section(x,v)
Takes the ID number of a body (x) and a vector quantity (y). Returns the cross
sectional width of the body in the direction of the vector. For example,
section(body[1], vector(1,0)) will return the vertical cross section
width of body[1]. This function is used by the air resistance force field to
approximate the drag on bodies.
Type
number
mass
mass
mass
time or t
Returns the current time in the simulation. Time always begins at 0.0 in
frame #0.
self
Returns a body type when placed inside a force field equation. When force
field equations are evaluated for each body in the simulation, self assumes
the value of the current body on which the force field is being applied. For
example, the equation for a linear gravitational field is
Fy:
- self.mass * 9.81
A force is applied to each body in the simulation. The value of self assumes
the value of the specific body onto which force is being applied. Thus, in this
case each body has a force applied equal to -9.81 times its own mass.
When force fields are evaluated for each pair of bodies (pair-wise fields), the
value of self assumes the body of the first body in each pair.
B-24
other
1 2
or more commonly: -----------------.
2
Returns a body type for the background. This is essentially a body at location
0,0 that never moves.
Constants
Four ID numbers are reserved for the global force fields of gravity,
electrostatics, air resistance, and the custom force field. You will see these
ID numbers in the formulas used in meters to measure forces produced by
these constraints. These ID numbers are as follows:
Force Field
gravity
electrostatics
air resistance
custom force field
Reserved ID
10002
10004
10006
10008
If you create a meter to measure the force of gravity on a body, you will see
a formula such as
constraintforce(10002, 3).y
This formula gives the y component of the force applied by constraint #10002
on body #3. The value 10002 is automatically inserted in the formula for this
meter as the constraint ID for the gravity force.
C-1
A P P E N D I X
This appendix contains a variety of useful tips that will help you be more
effective when using Working Model 2D.
MacOS
Using the Shift key
To select more than one item, hold down the Shift key while clicking the
items you want.
Clicking on an already selected object while holding down the Shift key
deselects the object.
C-2
Windows
Using the Shift key
To select more than one item, hold down the Shift key while clicking the
items you want.
Clicking on an already selected object while holding down the Shift key
deselects the object.
C-3
Action
Command +
Join
Command
Split
Shift-Command-R
F1 or Command-Z
Undo
F2 or Command-X
Cut
F3 or Command-C
Copy
F4 or Command-V
Paste
Space bar
r, R
a, A
C-4
Windows
Key
Action
Control F1
Join
Control F2
Split
Shift-Control-R
Space bar
r, R
a, A
Alt-Enter, Ctrl-I
Alt-Backspace
Undo
Delete
Clear
Shift-Delete
Cut
Control-Insert
Copy
Shift-Insert
Paste
F1
Help
F2
New document
Alt-F4
Quit
F5
Run/Stop
F12
Save As
Shift-F12
Save
Control-F12
Open
Control-Shift-F12
C-5
C-6
Settling Objects
The Working Model 2D simulation engine can be used to align objects. Take
for example a block that needs to rest exactly on an inclined plane. Select
both the block and the plane, and set their frictional coefficients to a high
value like 1.0. Place the block so it is approximately in position over the
plane, and then run the simulation. The block will come to rest in a stable
position. Stop the simulation at this time, and choose Start Here from the
World menu. This will make the stable, settled position the initial conditions.
The block will be perfectly aligned on the plane.
C.4. Troubleshooting
C-7
You can take advantage of the object snap feature as well as parametrics.
Please refer to Positioning Constraints Precisely on page 101 for details.
C.4. Troubleshooting
This section contains a list of questions and answers compiled from our
technical support database.
C-8
When you split a pin joint, the result will be two points that lie directly
on top of each other. Each point will be connected to a different body.
When you import a CAD drawing, the original may have had multiple
overlapping points. Since Working Model 2D preserves each point
individually when importing files, such points may not appear
highlighted when you selected them.
D-1
A P P E N D I X
Scripts
Introduction
Flexbeam replaces a selected rectangular body with a set of smaller rectangular elements attached with rotational springs. Flexbeam chooses values for the spring constants, which depend on the material and geometry of the selected rectangular beam,
and creates an assembly that approximates a flexible beam. Figure D-1 and
Figure D-2 show a sample document before and after running Flexbeam respectively.
Notice that Flexbeam works on beams with an arbitrary orientation and maintains
constraint relationships. An undo script, called Unflex, restores beams to their original rigid form.
Figure D-1
Before Running Flexbeam
D-2
Appendix DScripts
Figure D-2
After Running Flexbeam
Unit Systems
Flexbeam works with the SI and English unit systems only. Flexbeam automatically
selects the mass and distance units to be consistent with the current force unit. If the
user selects the force unit to be Newtons, the script selects meters for the distance
unit and kilograms for the mass unit. If the user selects the force unit to be pounds,
the script selects inches for the distance unit and pounds mass for the mass unit. If
the user selects another unit for force, dynes for example, the user is notified that this
system of units is unavailable and the program terminates.
Running Flexbeam
To use Flexbeam:
1.
2.
3.
Enter the values for the structural stiffness of the beam (EI) and the
number of elements (n) with which to model the beam.
The structural stiffness can be chosen through either the highly stiff, minimally stiff,
or custom option. The highly stiff and minimally stiff options provide a specified
deflection for a load based on the weight of the beam. The highly stiff option specifies roughly a 3% deflection, while the minimally stiff option specifies roughly a
10% deflection.
D-3
Figure D-3
Dialog Provided by Flexbeam
The first input quantity, the structural stiffness, is the product of E, Youngs modulus
of elasticity, and I, the area moment of inertia. I is a geometric property of the cross
section of the beam and it is given by the equation:
I =
dA
where dA is a differential element of area and y is the distance of dA from the centroid
axis (see Figure D-4 for an example). Working Model is unable to calculate I
because it simulates in the xy plane, while the beam cross section lies on the yz plane.
Figure D-4
Centroid Axis
The second input quantity is n, the number of rectangular elements with which to
approximate the flexible body. A larger value of n, produces a more accurate approximation to the flexible beam. However, as the warning message in Figure D-3 indicates, the user should be careful to avoid using more elements than necessary.
D-4
Appendix DScripts
For all springs, other than those which model cantilever supports, the value of k is
given by:
EI
k = -----L
where L is the length of the smaller rectangular element.
Beam Constraints
The constraints one can impose on a beam are termed fixed, pinned, roller and free.
The fixed constraint confines a point on the beam to no translational movement in
any direction, and it restricts the beam from rotating about that point. The pinned
constraint imposes the same translational confinement but allows the body to rotate.
The roller constraint confines a point to translational movement in only one direction.
The roller can have either a fixed or a pinned attachment which would determine
whether or not rotation of the beam about that point could occur. The free constraint,
which really is no constraint at all, allows a point to move in any direction and there
are no restrictions to the rotation of the body about that point. In the rest of this section, the construction of two of the more standard beam types is discussed.
Figure D-5
A Pinned-Roller Beam
Figure D-6
Before Running Flexbeam
D-5
Figure D-7
After Running Flexbeam
Figure D-8
A Cantilever Beam
D-6
Appendix DScripts
Figure D-9
A Cantilever Beam (before
Flexbeam)
Notice that, in Figure D-10, Flexbeam automatically replaces the square pin at the
base of the beam with a rotational spring.
Figure D-10
A Cantilever Beam (after
Flexbeam)
D-7
Filename
Description
Sample Scripts
flexbeam.wbs
unflex.wbs
flexbeam.hlp
bridge.wm
fixfree.wm
fixroll.wm
pinroll.wm
Documents
References
The spring constants provided by Flexbeam are determined by the formulas in
Determination of Spring Constants for Modeling Flexible Beams, by Paul Mitiguy
and Arun Banerjee.
The effectiveness of this formulation is discussed in MSC.Softwares technical
document, Modeling Uniform Flexible Bodies in Working Model, by Keith
Reckdahl.
D-8
Appendix DScripts
Introduction
In general, the shear force and bending moment vary along the length of the beam and
can be strongly affected by the beams motion. Using a graphics window as shown in
Figure D-11, this script displays shear force and bending moment versus the position
along the length of the beam and updates these diagrams at each frame. This script
also records and displays maximum and minimum values of both the shear force and
bending moment over the history of the simulation. In addition, this script provides for
the export of shear force and bending moment data to a text file for any time frame.
Figure D-11
Shear & Bending Moment
Example
Operation Instructions
Before running the script, select the rectangular beam within your WM document to
be analyzed. Invoke Shear & Bending Moment from the script menu.
D-9
The script creates a window, like that shown below, which displays both shear force
and bending moment diagrams. It shows the shear force diagram in red and the
bending moment in blue and is updated each time frame. The numbers to the left of
the diagrams are the maximum and minimum values of the shear force; the numbers
to the right are the maximum and minimum values of the bending moment.
Figure D-12
Shear Force and Bending
Moment Diagram
There are six buttons which control various aspects of the simulation. The Run/Stop
button starts and stops the simulation. While the simulation is running, this button has
the word Stop on it, and only this button is enabled. The > and < buttons allow for
forward or backward stepping through the simulation. The Max/Min button reports
the maximum and minimum value of the shear force and bending moment over the
entire history of the simulation. When the Max/Min button is selected, the diagrams
are replaced by the dialogue box shown below. Selection of any of the other control
buttons will bring back the shear-moment diagrams
Figure D-13
Maximum / Minimum Table
The Export button provides for the export of the shear force and bending moment data
of the current time frame to a data file. With the > and < buttons, you can step forward
and backward to any frame of interest. This may be used, for example, to record the
profile associated with the maximum bending moment. The script automatically
names the file according to the format Shear###.dta. The triple pound sign ###
symbolizes the numeric characters between 001 and 999 and reflects the order in
which this file was written. For example, the first profile exported is written to the file
Shear001.dta. The files are written in the directory in which Working Model resides,
e.g., C:\Program Files\Working Model.
D-10
Appendix DScripts
Figure D-14
Coordinate System and Sign
Convention
Coordinate System
Sign Convention
(Forces and moments shown
are acting in positive direction)
D-11
Sign Convention
The bottom half of Figure D-14 shows an exploded view of the beam element B. The
shear force and bending moment are the internal loads which hold the beam together
and ensure the rigid connection between the element B and the remainder of the beam,
or the two elements A and C.
Figure D-14 also shows the sign convention for positive shear force and bending
moment. As explained in the figure:
The shear force is positive when element A exerts a force in the positive ydirection on the element B and when element C exerts a force in the negative ydirection on the element B.
The bending moment is positive when element A exerts a moment in the positive
z-direction (coming out of the page) on element B and when element C exerts a
moment in the negative z-direction on element B.
Figure D-15
Definition of the Area Moment of
Inertia
I area =
dy dz
D-12
Appendix DScripts
Figure D-16
Falling Smoke Stack
In Figure D-17, we show both the static and dynamic analyses of this event. In the
static beam analysis, the beam is rigidly attached to the background. In the dynamic
analysis, the connection is made with a circular pin, which allows the beam to rotate.
Figure D-17 shows that the difference between the two analyses is substantial.
Figure D-17 also highlights that in the dynamic analysis, the peak bending moment
occurs in the middle of the beam which is consistent with the notion that a falling
smoke stack breaks into two pieces before hitting the ground.
D-13
Figure D-17
Analysis of Static and Dynamic
Beams
Static Beam
Dynamic Beam
D-14
Appendix DScripts
D-15
Example: To determine the name of the body associated with the first point of a constraint named Shock Spring:
MsgBox WM.ActiveDocument.Constraint("Shock Spring").Point(1).Body.Name
This chart shows selected relations between WM Basic objects. For complete information, refer to the manual WMBasic.pdf (on CD).
WMApplication
(Constant WM)
.Documents
Collection of
WMDocument objects
.ActiveDocument
.Item(n)
.Objects/.Selection
WMDocument
Collection of
WMBody objects
Collection of
WMObject objects
.Item(n)
.Bodies
WMBody
.Body(id | name)
Collection of
WMConstraint objects
.Body
.Item(n)
.Item(n)
.Constraints
.Constraint(id | name)
WMConstraint
.Constraint
Collection of
WMPoint objects
.Point(n)
.Item(n)
.Points
.Point(id | name)
Collection of
WMInput objects
WMPoint
.Item(n)
.Inputs
.Input(id | name)
Collection of
WMInput objects
WMInput
.Item(n)
WMCell
.Outputs
.Output(id | name)
WMOutput
.Column(n)
WMOutputColumn
WMObject
WMDocument
.Bodies.Count {Integer}
.Bodies.Item(n) {WMBody}
.Body(name|id) {WMBody}
.Collide
.Constraint(name|id) {WMConstraint}
.Constraints.Item(n) {WMConstraint}
.Delete [object]
.Input(name|id) {WMInput}
.Inputs.Item(n) {WMInput}
.Output(name|id) {WMOutput}
.Outputs.Item(n) {WMOutput}
.Object(name|id) {WMObject}
.Objects.Item(n) {WMObject}
.Point(name|id) {WMPoint}
.Points.Item(n) {WMPoint}
.Reset
.Run frames
.RunScript filename
.Save
.SaveAs filename[, IsHistorySaved]
.Selection.Item(n) {WMObject}
.ScaleFactor {Double}
.ScrollTo x, y
.Select object[, state]
.SelectAll [state]
.SimulationMode {String}
.UnitSystem {String}
.Update
WMBody
.AddVertex n, x, y
.DeleteVertex n
.GetVertex n, x, y
.Height {WMCell}
.Mass {WMCell}
.PX, .PY, .PR {WMCell}
.Radius {WMCell}
.VX, .VY, .VR {WMCell}
.VertexCount {Integer}
.Width {WMCell}
WMConstraint
.Kind {String}
.ActiveWhen {WMCell}
.AddVertex n, x, y
.AppendPoint x, y
.CurrentLength {Double}
.DamperK {WMCell}
.DeleteVertex n
.Elasticity {WMCell}
.K {WMCell}
.Kind {WMCell}
.Length {WMCell}
WMPoint
.Body {WMBody}
.Constraint {WMConstraint}
.PX, .PY, .PR {WMCell}
WMInput
.Format {String}
.Min, .Max {Double}
.Value {Double}
WMOutput
.Format {String}
.Column(n) {WMOutputColumn}
WMOutputColumn
.Label {String}
.Cell {WMCell}
WMObject
.X {Integer}
.Y {Integer}
.Width {Integer}
.Height {Integer}
.ID {Integer}
.Kind {String}
.Name {String}
WMCell
.Formula {String}
.Value {Double}
Interactive Physics
Students and educators in high
schools and colleges around the
world use Interactive Physics to
investigate and experiment with
concepts in physics.
Working Model 2D
University students, educators,
and professional engineers use
Working Model 2D to understand
how mechanical systems work
and perform without building
physical models.
Dynamic Designer
Professional Engineers use
Dynamic Designer Motion to
build virtual prototypes of their
mechanical designs in order to
validate performance and function
from within their CAD system.