|On this page…|
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.
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.
In the Mechanism Configuration block, set Uniform Gravity to None.
In the dialog box of the Base-Crank Revolute Joint block, specify the following parameters settings.
|Actuation > Torque||Automatically Computed|
|Actuation > Motion||Provided by Input|
|Sensing > Actuator Torque||Selected|
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.
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.
Drag the following blocks into the model.
|Simulink-PS Converter||Simscape > Utilities|
|PS-Simulink Converter||Simscape > Utilities|
|To Workspace||Simulink > Sinks|
|Scope||Simulink > Sinks|
|Signal Builder||Simulink > Sources|
Connect the bocks as shown in the figure.
Specify the following block parameters.
|To Workspace||Variable name||tcrank|
|PS-Simulink Converter||Input Handling > Filtering and derivatives||Filter input|
|Input Handling > Input filtering order||Second-order filtering|
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.
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.
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.
Delete the Signal Builder and To Workspace blocks.
In the dialog box of the Base-Crank Revolute Joint block, change these parameter settings.
|Parameter||Original Setting||Change to...|
|Actuation > Torque||Automatically computed||Provided by Input|
|Actuation > Motion||Provided by Input||Automatically Computed|
|Sensing > Velocity||Cleared||Selected|
|Sensing > Actuator Torque||Selected||Cleared|
From the Simulink Sources library, drag a From Workspace block and connect it as shown in the figure.
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.
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.
In the dialog box of the Base-Crank Revolute Joint block, select State Targets > Specify Position Target.
Set Value to 0 and select OK.
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.