Contenido principal

computeDynamics

Class: simscape.multibody.CompiledMultibody
Namespace: simscape.multibody

Compute dynamics results of compiled multibody model

Since R2024a

Description

dynamicsResult = computeDynamics(cmb,state) computes the dynamics results of the compiled multibody model, cmb, with the state, state.

dynamicsResult = computeDynamics(cmb,state,jointActuation) computes the dynamics results of the compiled multibody model with the joint actuations, jointActuation.

example

dynamicsResult = computeDynamics(cmb,state,jointAcceleration) computes the dynamics results of the compiled multibody model with the joint accelerations, jointAcceleration.

dynamicsResult = computeDynamics(cmb,state,externalForceTorque) computes the dynamics results of the compiled multibody model with the external forces and torques, externalForceTorque.

dynamicsResult = computeDynamics(cmb,state,jointActuation,jointAcceleration,externalForceTorque) computes the dynamics results of the compiled multibody model with the specified joint actuations, joint accelerations, and applied external forces and torques. These input arguments are optional, and the computeDynamics method can accept one or more types of arguments in any order.

Input Arguments

expand all

Compiled multibody system, specified as a simscape.multibody.CompiledMultibody object.

State of the compiled multibody system, specified as a simscape.multibody.State object. The state object includes the position and velocity of every joint primitive in the compiled multibody system.

Joint primitive actuations, specified as a simscape.multibody.JointActuationDictionary object. The JointActuationDictionary object stores the forces and torque to apply to the joint primitives in the compiled multibody system.

Joint primitive accelerations, specified as a simscape.multibody.JointAccelerationDictionary object. The JointActuationDictionary object stores the accelerations to apply to the joint primitives in the compiled multibody system.

External forces and torques, specified as a simscape.multibody.ExternalForceTorqueDictionary object. The ExternalForceTorqueDictionary object stores the forces and torques to apply to the frame connectors in the compiled multibody system.

Output Arguments

expand all

Dynamics results of the multibody model, returned as a simscape.multibody.DynamicsResult object. You can use the DynamicsResult object to query the dynamics results, such as the accelerations of desired joint primitives.

Attributes

Accesspublic

To learn about attributes of methods, see Method Attributes.

Examples

expand 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") = 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 = 
   2.7101e+06 (deg/s^2)
accel_top_left = jointPrimitiveAcceleration(cfb,"Top_Left_Joint/Rz",dynamicsResult)
accel_top_left = 
   4.9949e+06 (deg/s^2)
accel_bottom_left = jointPrimitiveAcceleration(cfb,"Bottom_Left_Joint/Rz",dynamicsResult)
accel_bottom_left = 
   3.9137e+06 (deg/s^2)

Version History

Introduced in R2024a