Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Prescribe Joint Motion in Four-Bar Model

Model Overview

In this tutorial, you prescribe the time-varying crank angle of a four-bar linkage using a Revolute Joint block. Then, during simulation, you sense the actuation torque at the same joint corresponding to the prescribed motion.

Build Model

  1. At the MATLAB® command prompt, enter smdoc_four_bar. A four-bar model opens. You can see how to create this model in the tutorial Model Four Bar.

  2. In the Mechanism Configuration block, set Uniform Gravity to None.

  3. In the dialog box of the Base-Crank Revolute Joint block, specify the following parameters settings.

    ParameterSetting
    Actuation > TorqueAutomatically Computed
    Actuation > MotionProvided by Input
    Sensing > Actuator TorqueSelected

    The joint block displays two physical signal ports. Input port q accepts the joint angular position. Output port t provides the joint actuation torque required to achieve that angular position.

  4. In each of the four Revolute Joint block dialog boxes, set Internal Mechanics > Damping Coefficient to 5e-4 N*m/(deg/s). During simulation, damping forces between the joint frames account for dissipative losses at the joints.

  5. Drag the following blocks into the model.

    BlockLibrary
    Simulink-PS ConverterSimscape > Utilities
    PS-Simulink ConverterSimscape > Utilities
    To WorkspaceSimulink > Sinks
    ScopeSimulink > Sinks
    Signal BuilderSimulink > Sources

  6. Connect the bocks as shown in the figure.

  7. Specify the following block parameters.

    Block ParameterValue
    To WorkspaceVariable nametcrank
    PS-Simulink ConverterInput Handling > Filtering and derivativesFilter input
    Input Handling > Input filtering orderSecond-order filtering

  8. In the Signal Builder window, specify the joint angular trajectory as shown in the figure.

    This signal corresponds to a constant angular speed of 1 rad/s from t = 1s onwards.

Simulate Model

Run the simulation, e.g., by selecting Simulation > Run from the Simulink® menu bar. Mechanics Explorer opens with a dynamic display of the four-bar model.

Open the Scope window. The scope plot shows the joint actuation torque with which you can achieve the motion you prescribed.

Actuate Model Using Sensed Torque

Change actuation mode from motion input to torque input. Then, verify that the angular velocity of the Base-Crank Revolute Joint block equals 1 rad/s, corresponding to the original motion input prescribed.

  1. Delete the Signal Builder and To Workspace blocks.

  2. In the dialog box of the Base-Crank Revolute Joint block, change these parameter settings.

    ParameterOriginal SettingChange to...
    Actuation > TorqueAutomatically computedProvided by Input
    Actuation > MotionProvided by InputAutomatically Computed
    Sensing > VelocityClearedSelected
    Sensing > Actuator TorqueSelectedCleared

  3. From the Simulink Sources library, drag a From Workspace block and connect it as shown in the figure.

  4. In the From Workspace block dialog box, set the Data parameter to tcrank. This parameter provides the sensed actuation torque of the original motion-actuated model.

Guide Model Assembly

For the sensed actuation torque to yield the original prescribed motion, the initial joint states of the two model versions (one with the original prescribed motion as input, the other with the sensed actuation torque as input) must be the same.

When a model has joints with motion inputs, those inputs dictate the initial joint states. This statement is true even if the joints contain state targets. The targets serve as guides during initial model assembly, but the motion inputs override them at simulation time t = 0 s.

In this example, to ensure that the sensed actuation torque produces the original motion input, you set the initial angle of the Base-Crank Revolute Joint block to zero degrees. This value is the initial angle that the original motion input prescribes.

  1. In the dialog box of the Base-Crank Revolute Joint block, select State Targets > Specify Position Target.

  2. Set Value to 0 and select OK.

Simulate Updated Model

Run the simulation. Mechanics Explorer displays the updated model. Click the isometric view button for a 3-D viewpoint of the model.

Open the Scope window. The scope plot shows that the angular velocity of the crank joint is 1 rad/s, which matches the original motion input. For greater precision, try reducing the filtering time constant in the PS-Simulink Converter block, e.g., to 0.001 s.

The angular velocity remains constant at 1 rev/s from t = 1 s onward, as prescribed in the original motion input.

Related Examples

Was this topic helpful?