SimMechanics | ![]() ![]() |
Modeling Sensors
The SimMechanics Sensors & Actuators library provides a set of Sensor blocks that enable you to measure
Note You can feed Sensor output back into Actuator blocks to model springs, dampers, and other mechanical devices that depend on force feedback. See the Actuating a Body, Actuating a Joint, and Modeling Sensor-Actuator Feedback sections. |
Sensing Body Motions
To sense the position, velocity, or acceleration of a body represented by a Body block:
Sensing Joint Motions and Forces
The SimMechanics Joint Sensor block enables you to measure the motions of joints. It can also measure the relative forces and torques between the bodies connected to the joint. These include the computed force or torque (the force or torque needed to reproduce the joint's motion) and the reaction force and torque on a joint primitive. (You cannot measure the computed force or torque on a spherical or weld primitive.) You must connect a separate Joint Sensor block to a Joint block for each joint primitive that you want to sense.
To sense the motions, forces, and torques of a joint primitive contained by a Joint block:
Sensing Constraint Reaction Forces
The SimMechanics Constraint & Driver Sensor block enables you to measure the reaction forces and torques induced on the constraints modeled by SimMechanics Constraint and Driver blocks.
To sense the reaction force and/or torque induced by a Constraint or Driver block:
Modeling Sensor-Actuator Feedback
You can use sensor-actuator feedback loops to model springs, dampers, and more complex internal forces (forces the machine applies to itself as a result of its motion). For example, Hooke's law states that the force exerted by an extended spring is proportional to its displacement from its unextended position: F = -kx.
The following SimMechanics model models a spring that obeys Hooke's law.
The model uses the Gain block labeled Spring Constant to multiply the displacement of the prismatic joint labeled Spring along the World's y-axis by the spring constant -0.8
. The output of the Gain block is the force exerted by the spring. The model feeds the force back into the prismatic joint via the Actuator labeled Force. The model encapsulates the spring block diagram in a subsystem to clarify the model and to allow a spring to be inserted elsewhere.
![]() | Modeling Actuators | Checking Model Validity | ![]() |