Build a Model and Visualize Results
This example shows how to create and run a simple model that generates plotted output. Simscape Driveline blocks belong to either the mechanical rotational domain or the mechanical translational domain. Use Simscape Driveline blocks to create the model, parameterize the blocks to change the model functionality, and then visualize the results. You then use a sensor block to visualize physical data.
This example uses blocks in the rotational mechanical domain, but you can apply these principles from this example to create a translational system model. You can start with simple or ideal inputs and physics to validate that a block behaves as expected before adding it to a more complex model. The blocks perform computations using system input values to represent the physics of that block. To learn more about the block equations and parameters, see the reference for the block.
Build a Mechanical Rotational Model
You can open a Simulink canvas that include blocks and links that are helpful for modeling in the mechanical rotational domain. In the MATLAB window, click the Simulink button to open the Simulink Start Page. Under the New tab, navigate to Simscape and click Create Model for Mechanical Rotational. The mechanical translational and mechanical rotational domains each have their own reference blocks. In this model, the Mechanical Rotational Reference block defines a point of zero motion and orientation. Simscape defines the connected blocks relative to this reference frame.
The canvas includes a Mechanical Rotational Reference block connected to the Solver Configuration block. Double-click the canvas and add these Simscape and Simscape Driveline blocks to the model:
Follow these steps to build the model:
Connect port C of the Ideal Angular Velocity Source block to the Mechanical Rotational Reference block.
Connect port R of the Ideal Angular Velocity Source block to port B of the Simple Gear block.
Connect the PS Step block to port S of the Ideal Angular Velocity Source. Then double-click the PS Step block, and set Final value to
10
.Connect port F of the Simple Gear block to the Rotational Free End block.
Delete the Simulink-PS Converter block. You can leave the PS-Simulink block and the Scope block disconnected from the model until later.
You can rotate blocks on the canvas by right-hand clicking the
block and selecting Format > Rotate Clockwise, or by pressing CTRL+R. To learn more about
interacting with the model canvas, see Configure Model Layout. Save the model as
myModel
.
The model is ideal with no friction, mass, or dynamic forces so the Ideal Angular Velocity Source block requires no torque to bring the system to steady state.
The Simple Gear block has a default follower to
base ratio of 2:1. To change the reduction ratio, double-click the block and set
Follower (F) to base (B) teeth ratio (NF/NB) to
3
.
Use a Sensor Block to Output Data to a Scope Block
You can use sensor blocks to track one or more model variables, and you can visualize the sensor data using a Scope block. Sensor blocks are ideal and do not physically impact your model. These translational and rotational sensor blocks are in the Simscape Foundation Library :
Translational Power Sensor
Rotational Power Sensor
Ideal Translational Motion Sensor
Ideal Rotational Motion Sensor
Ideal Force Sensor
Ideal Torque Sensor
To see the output shaft speed of the Simple
Gear block, attach an Ideal Rotational
Motion Sensor block and a Scope block to
the model as shown in the figure. The sensor block outputs a physical
signal, so you must use a PS-Simulink Converter block between
the Scope block and port W of the
Ideal Rotational Motion Sensor block.
Double-click the Ideal Rotational Motion
Sensor block, and set Measurement
reference to Absolute
. Branch the
signal between the Simple Gear block and the
Rotational Free End block and connect it
to port R of the sensor.
Run the model from the Scope block to generate the results.
The shaft reaches a constant rotational velocity of approximately 3.3
after the step input. The output speed is one third the magnitude of the
input of 10 from the PS Step block. Recall
that the result requires no torque to start because the system has no mass
or friction. Note that port F rotates in the opposite
direction of port B when you set Output shaft
rotates to In opposite direction to input
shaft
.
To open the completed model, enter:
openExample('sdl/SimpleRotationalMechanicalSystemExample')
See Also
How Simscape Models Represent Physical Systems | Set Model Configuration Parameters for a Model | Configure Model Layout | Simple Gear