1.2.3 2D ConstraintsNow that the local point coordinates on each body are defined, building the model is simply a matter of tying the points together with the correct mechanical constraints. Modeler2D provides a small library of mechanical constraint objects that translate desired physical conditions that are imposed on the model into mathematical equations. Constraint ObjectsFour constraint objects are used to model the slider-crank mechanism, constraining a total of six degrees of freedom (three degrees of freedom for each moving body). Some 2D constraint objects. Note that the last character in the name of any Mech constraint object is an integer that specifies the number of degrees of freedom that it constrains. The first argument to each constraint object, cnum, is the user-specified constraint number. This number is used to reference the constraint later in the modeling process, much like body numbers are used to reference specific bodies. The point and axis arguments of Modeler2D constraint objects are specified with Point, Line, or Axis objects, used in much the same manner as the built-in Mathematica graphics primitives Point and Line. These objects are discussed in detail in Section 2.2. Building the ModelThe Modeler2D constraint objects used to model the physical relationships in the slider-crank mechanism are as follows. A Revolute2 constraint forces the axis of the crankshaft to be coincident with the global origin. This constrains the X and Y displacement of the crankshaft axis. The one degree of freedom left for the crankshaft is its rotation about its axis. The syntax of the constraint can be interpreted as, "Constrain a point at on the ground body to be coincident with point on the crankshaft."A RotationLock1 constraint specifies the angular coordinate of the crankshaft. The crankshaft is now completely constrained. The syntax of this constraint can be interpreted as, "Constrain the angular coordinate of the crankshaft to be equal to crankangle."A Translate2 constraint forces a vertical line on the piston to be coincident with a vertical line on the ground body. This constrains two degrees of freedom, horizontal translation and rotation of the piston. The one degree of freedom left is the vertical translation of the piston relative to the ground.A RelativeDistance1 constraint forces an eccentric point on the crankshaft to lie five units distant from the origin of the piston. This single constraint takes the place of a connecting rod five units long. Since the crankshaft is already completely constrained, this completes the constraint of the piston.The Modeler2D constraint objects are finally assembled into a mechanism model with SetConstraints. The fundamental model-building function. Here is the entire slider-crank model built in one step. SetConstraints returns nothing upon success. All of the constraint equations generated by SetConstraints are stored internally in the Modeler2D private context.
|