5.1.3 Slider-Ramp Example MechanismAnother usage of the StageSwitch constraint is to switch from one stage of operation to another when such switching is the normal progression of operation of the mechanism. To demonstrate this usage a 2D model of a slider on a ramp is developed. The model has only one moving body, the slider. This mechanism has two distinct modes of operation. First, the slider travels across a horizontal surface until it encounters an inclined ramp. As the slider progresses further, its front edge leaves the horizontal plane and begins to slide up the inclined ramp. StageSwitch is used to switch between these modes by defining the test expressions in the StageSwitch constraint to test explicitly whether or not the corner of the slider has traveled beyond the bottom of the ramp. Here is a graphic of the 2D slider-ramp model.
Bodies Two bodies are needed in the slider-ramp mechanism model. The ground (body 1) requires three points. P1 is the beginning of the horizontal ramp at {0, 0}. P2 is the end of the horizontal ramp and the beginning of the inclined ramp at {4, 0}. P3 is the end of the inclined ramp at {6, 2}.The slider (body 2) requires two points. P1 is the left bottom corner of the slider at local coordinates {0, 0}. P2 is the right bottom corner of the slider at local coordinates {2, 0}.Here are both the bodies in the slider-ramp model.
Names are defined for each of the body numbers in the model. ConstraintsTwo regular constraints and one StageSwitch constraint are used to model the slider-ramp mechanism. A RelativeX1 constraint specifies the X coordinate of the left bottom corner of the slider as a function of time T.A PointOnLine1 constraint enforces that the left bottom corner of the slider remains in contact with the horizontal surface of the ramp.A StageSwitch constraint with two stages eliminates the one remaining degree of freedom: A PointOnLine1 constraint is used to place the right bottom corner of the slider on the horizontal surface if it is still to the left of the ramp. A PointOnLine1 constraint is used to place the right bottom corner of the slider on the inclined ramp if it has passed to the right of the ramp.Which stage of operation is active is determined by the value of a test expression that is a function of Modeler2D dependent variables. The test expression measures whether or not the right bottom corner of the slider has progressed far enough to the right to be on the inclined ramp. Here is the slider-ramp mechanism built in one step. RuntimeThe slider-ramp mechanism model can be run at any time, T, up to T = 4 with valid results. After T = 4, the left bottom corner of the slider passes the inclined ramp, but it does not travel up the ramp because the constraints have not been written to accommodate this. This runs the model at T = 1.
Out[19]= | |
The slider-ramp mechanism is still on the horizontal segment of the ramp.
Now the model is run at T = 2.5, which puts the slider part way up the ramp.
Out[20]= | |
Here is the result.
|