Main Content

simscape.multibody.DynamicsResult Class

Namespace: simscape.multibody

Dynamics Results of Multibody Models

Since R2024a

Description

Use an object of the simscape.multibody.DynamicsResult class to store the dynamics results of a multibody model.

After you create a DynamicsResult object, subsequent changes to the assembly, the state of joints, or the actuation forces or torque do not affect the DynamicsResult object. To capture these changes, create a new DynamicsResult object.

Use the DynamicsResult object to query the dynamics results, such as the accelerations of the joint primitives. You can use a DynamicsResult object with only the simscape.multibody.CompiledMultibody object that you used to create the DynamicsResult object. Passing a DynamicsResult object to a method of a different CompiledMultibody object generates an error.

Class Attributes

Sealed
true
ConstructOnLoad
true
RestrictsSubclassing
true

For information on class attributes, see Class Attributes.

Creation

To create a simscape.multibody.DynamicsResult object for a compiled multibody system, use the computeDynamics method.

Examples

collapse all

The example shows how to compute the dynamics of a four-bar mechanism with a given joint state and actuation.

Open the model from the Creating a Four Bar Multibody Mechanism in MATLAB example. Create a simscape.multibody.Multibody object, fb, of the four-bar model for the specified links.

openExample("sm/CreateAFourBarMechanismInMATLABExample");
fb = fourBar(simscape.Value(12,"cm"),simscape.Value(10,"cm"),...
                      simscape.Value(5,"cm"),simscape.Value(8,"cm"));

Compile the four-bar model and specify the joint targets.

cfb = compile(fb);
jointState = simscape.op.OperatingPoint;
jointState("Bottom_Left_Joint/Rz/q") = simscape.op.Target(60,"deg","High");
jointState("Bottom_Right_Joint/Rz/q") = simscape.op.Target(90,"deg","Low");
jointState("Bottom_Left_Joint/Rz/w") = simscape.op.Target(2.5,"rev/s","High");

Compute the current state of the model.

fbState = computeState(cfb,jointState);

Construct an actuation torque of 10 N*m for the revolute joint primitive and apply the torque to the bottom-right joint.

dict = simscape.multibody.JointActuationDictionary;
torque = simscape.multibody.RevolutePrimitiveActuationTorque(...
                     simscape.Value(10,"N*m"));
dict("Bottom_Right_Joint/Rz/t") = torque;

Solve the dynamics of the four-bar model with the given state and actuation. Then, query the accelerations of the other joints in the model.

dynamicsResult = computeDynamics(cfb,fbState,dict);
accel_top_right = jointPrimitiveAcceleration(cfb,"Top_Right_Joint/Rz",dynamicsResult)
accel_top_right = 

   4.7301e+04 (deg/s^2)
accel_top_left = jointPrimitiveAcceleration(cfb,"Top_Left_Joint/Rz",dynamicsResult)
accel_top_left = 

   8.7177e+04 (deg/s^2)
accel_bottom_left = jointPrimitiveAcceleration(cfb,"Bottom_Left_Joint/Rz",dynamicsResult)
accel_bottom_left = 

   6.8306e+04 (deg/s^2)

Version History

Introduced in R2024a