linkage_dynamic_model Derived Type

type, public :: linkage_dynamic_model

Defines the variational-integrator representation of a linkage. Body index zero in a joint descriptor denotes the fixed ground link.


Contents


Constructor

public interface linkage_dynamic_model

  • private function ldm_from_serial(mechanism, q) result(rst)

    Constructs a dynamic model from a serial linkage and a compatible set of joint variables. Every serial link is treated as a moving rigid body; the proximal joint of the first link is attached to ground.

    Arguments

    Type IntentOptional Attributes Name
    type(serial_linkage), intent(in) :: mechanism

    The serial linkage to convert.

    real(kind=real64), intent(in), dimension(:) :: q

    One joint variable for each link.

    Return Value type(linkage_dynamic_model)

    The resulting dynamic model.

  • private function ldm_from_parallel(mechanism, q) result(rst)

    Constructs a dynamic model from a parallel or planar linkage. The mechanism's base link remains fixed and all other links become moving maximal-coordinate rigid bodies.

    Arguments

    Type IntentOptional Attributes Name
    class(kinematic_mechanism), intent(in) :: mechanism

    The parallel linkage to convert.

    real(kind=real64), intent(in), dimension(:) :: q

    The complete, constraint-compatible joint-variable array.

    Return Value type(linkage_dynamic_model)

    The resulting dynamic model.


Type-Bound Procedures

procedure, public :: add_axial_element => ldm_add_axial_element

  • private subroutine ldm_add_axial_element(this, element)

    Adds an extensible axial force element to the dynamic model.

    Arguments

    Type IntentOptional Attributes Name
    class(linkage_dynamic_model), intent(inout) :: this

    The model that receives the element.

    class(axial_force_element), intent(in) :: element

    The axial element to add. Its body indices must identify two distinct valid bodies or ground.

procedure, public :: add_linear_damper => ldm_add_linear_damper

  • private subroutine ldm_add_linear_damper(this, element)

    Adds a validated linear axial damper to the dynamic model.

    Arguments

    Type IntentOptional Attributes Name
    class(linkage_dynamic_model), intent(inout) :: this

    The model that receives the damper.

    type(linear_damper), intent(in) :: element

    The damper to add. Its damping coefficient must be nonnegative.

procedure, public :: add_linear_spring => ldm_add_linear_spring

  • private subroutine ldm_add_linear_spring(this, element)

    Adds a validated linear axial spring to the dynamic model.

    Arguments

    Type IntentOptional Attributes Name
    class(linkage_dynamic_model), intent(inout) :: this

    The model that receives the spring.

    type(linear_spring), intent(in) :: element

    The spring to add. Its stiffness and free length must be nonnegative.

procedure, public :: add_torsional_damper => ldm_add_torsional_damper

  • private subroutine ldm_add_torsional_damper(this, element)

    Adds a validated linear torsional damper to the dynamic model.

    Arguments

    Type IntentOptional Attributes Name
    class(linkage_dynamic_model), intent(inout) :: this

    The model that receives the damper.

    type(torsional_damper), intent(in) :: element

    The damper to add. Its damping coefficient must be nonnegative.

procedure, public :: add_torsional_element => ldm_add_torsional_element

  • private subroutine ldm_add_torsional_element(this, element)

    Adds an extensible torsional element bound to a revolute joint.

    Arguments

    Type IntentOptional Attributes Name
    class(linkage_dynamic_model), intent(inout) :: this

    The model that receives the element.

    class(torsional_force_element), intent(in) :: element

    The torsional element to add. Its one-based joint index must refer to a revolute joint in this model.

procedure, public :: add_torsional_spring => ldm_add_torsional_spring

  • private subroutine ldm_add_torsional_spring(this, element)

    Adds a validated linear torsional spring to the dynamic model.

    Arguments

    Type IntentOptional Attributes Name
    class(linkage_dynamic_model), intent(inout) :: this

    The model that receives the spring.

    type(torsional_spring), intent(in) :: element

    The spring to add. Its stiffness must be nonnegative.

procedure, public :: constraint_residual => ldm_constraint_residual

  • private function ldm_constraint_residual(this, state) result(rst)

    Evaluates every joint and planar constraint for a supplied state.

    Arguments

    Type IntentOptional Attributes Name
    class(linkage_dynamic_model), intent(in) :: this

    The dynamic linkage model whose constraints are evaluated.

    type(variational_state), intent(in) :: state

    The body state at which the constraints are evaluated.

    Return Value real(kind=real64), allocatable, dimension(:)

    The constraint residual vector in the model's constraint ordering.

procedure, public :: get_axial_element_count => ldm_get_axial_count

  • private pure function ldm_get_axial_count(this) result(rst)

    Gets the number of axial force elements in the model.

    Arguments

    Type IntentOptional Attributes Name
    class(linkage_dynamic_model), intent(in) :: this

    The dynamic linkage model.

    Return Value integer(kind=int32)

    The number of stored axial elements.

procedure, public :: get_axial_element_results => ldm_get_axial_results

  • private function ldm_get_axial_results(this, state) result(rst)

    Gets instantaneous lengths, rates, and signed forces for axial elements.

    Arguments

    Type IntentOptional Attributes Name
    class(linkage_dynamic_model), intent(in) :: this

    The dynamic linkage model containing the elements.

    type(variational_state), intent(in) :: state

    The state at which each element is evaluated.

    Return Value type(axial_element_result), allocatable, dimension(:)

    One result for each axial element, in insertion order.

procedure, public :: get_body_count => ldm_get_body_count

  • private pure function ldm_get_body_count(this) result(rst)

    Gets the number of moving rigid bodies in the dynamic model.

    Arguments

    Type IntentOptional Attributes Name
    class(linkage_dynamic_model), intent(in) :: this

    The dynamic linkage model.

    Return Value integer(kind=int32)

    The number of moving bodies; ground is not included.

procedure, public :: get_constraint_count => ldm_get_constraint_count

  • private pure function ldm_get_constraint_count(this) result(rst)

    Gets the number of scalar constraints in the dynamic model.

    Arguments

    Type IntentOptional Attributes Name
    class(linkage_dynamic_model), intent(in) :: this

    The dynamic linkage model.

    Return Value integer(kind=int32)

    The total number of joint and planar-body constraints.

procedure, public :: get_initial_state => ldm_get_initial_state

  • private function ldm_get_initial_state(this) result(rst)

    Gets a copy of the constraint-compatible state used to construct the dynamic model.

    Arguments

    Type IntentOptional Attributes Name
    class(linkage_dynamic_model), intent(in) :: this

    The dynamic linkage model.

    Return Value type(variational_state)

    A copy of the model's constraint-compatible initial state.

procedure, public :: get_joint => ldm_get_joint

  • private function ldm_get_joint(this, index) result(rst)

    Gets a copy of a joint descriptor in the model's joint ordering.

    Arguments

    Type IntentOptional Attributes Name
    class(linkage_dynamic_model), intent(in) :: this
    integer(kind=int32), intent(in) :: index

    The one-based joint index, not a moving-body index.

    Return Value type(dynamic_joint)

procedure, public :: get_joint_count => ldm_get_joint_count

  • private pure function ldm_get_joint_count(this) result(rst)

    Gets the number of joints represented by the dynamic model.

    Arguments

    Type IntentOptional Attributes Name
    class(linkage_dynamic_model), intent(in) :: this

    The dynamic linkage model.

    Return Value integer(kind=int32)

    The joint count.

procedure, public :: get_joint_reactions => ldm_get_joint_reactions

  • private function ldm_get_joint_reactions(this, state, multipliers) result(rst)

    Converts one time step's constraint multipliers into the force and moment exerted by every joint on its child link. Multipliers associated with the planar-body constraints or a prescribed-motion constraint are excluded.

    Arguments

    Type IntentOptional Attributes Name
    class(linkage_dynamic_model), intent(in) :: this

    The dynamic linkage model.

    type(variational_state), intent(in) :: state

    The state corresponding to the supplied multipliers.

    real(kind=real64), intent(in), dimension(:) :: multipliers

    The constraint multiplier vector returned by the integrator.

    Return Value type(joint_reaction), allocatable, dimension(:)

    One world-frame reaction wrench for each joint, in mechanism order.

procedure, public :: get_torsional_element_count => ldm_get_torsional_count

  • private pure function ldm_get_torsional_count(this) result(rst)

    Gets the number of torsional force elements in the model.

    Arguments

    Type IntentOptional Attributes Name
    class(linkage_dynamic_model), intent(in) :: this

    The dynamic linkage model.

    Return Value integer(kind=int32)

    The number of stored torsional elements.

procedure, public :: get_torsional_element_results => ldm_get_torsional_results

  • private function ldm_get_torsional_results(this, state) result(rst)

    Gets instantaneous angles, twist rates, and torques for torsional elements.

    Arguments

    Type IntentOptional Attributes Name
    class(linkage_dynamic_model), intent(in) :: this

    The dynamic linkage model containing the elements.

    type(variational_state), intent(in) :: state

    The state at which each element is evaluated.

    Return Value type(torsional_element_result), allocatable, dimension(:)

    One result for each torsional element, in insertion order.

procedure, public :: solve => ldm_solve

  • private function ldm_solve(this, integrator, dt, ntime, initial_state, gravity, body_force, body_torque, prescribed_body, prescribed_motion, multipliers, args, info, prescribed_joint) result(rst)

    Integrates the linkage dynamics under an optional uniform world-frame gravitational acceleration and optional constant body loads.

    Arguments

    Type IntentOptional Attributes Name
    class(linkage_dynamic_model), intent(in), target :: this

    The dynamic linkage model to integrate.

    type(variational_integrator), intent(in) :: integrator

    The variational integrator used to advance the model.

    real(kind=real64), intent(in) :: dt

    The time step in seconds.

    integer(kind=int32), intent(in) :: ntime

    The number of returned simulation points, including the initial point.

    type(variational_state), intent(in), optional :: initial_state

    An optional starting state; the model's initial state is used when this argument is absent.

    real(kind=real64), intent(in), optional, dimension(3) :: gravity

    Optional constant gravitational acceleration in world coordinates.

    real(kind=real64), intent(in), optional, dimension(:,:) :: body_force

    Constant 3-by-nbody world-frame force array.

    real(kind=real64), intent(in), optional, dimension(:,:) :: body_torque

    Constant 3-by-nbody body-frame torque array.

    integer(kind=int32), intent(in), optional :: prescribed_body

    The one-based moving body whose absolute world-z planar angle is prescribed (legacy input). Only planar models support this selector. Mutually exclusive with prescribed_joint.

    procedure(linkage_prescribed_motion), intent(in), optional, pointer :: prescribed_motion

    The scalar motion callback. Supply exactly one of prescribed_body or prescribed_joint with this associated procedure pointer.

    real(kind=real64), intent(out), optional, allocatable, dimension(:,:) :: multipliers

    Constraint multipliers for each returned simulation point, with the final column computed by a noncommitting look-ahead step. When motion is prescribed, the last row is the required actuator torque (angular input) or axial force (prismatic input), positive in the direction of increasing prescribed coordinate. Joint reactions exclude it.

    class(*), intent(inout), optional, target :: args

    A mechanism for the caller to pass information to/from the user-defined routines (e.g. presribed_motion).

    type(variational_integrator_info), intent(out), optional :: info

    Optional convergence diagnostics aggregated over the trajectory.

    integer(kind=int32), intent(in), optional :: prescribed_joint

    The one-based revolute or prismatic joint in model joint order (serial: proximal joint of link i; parallel: mechanism joint order). Supported for planar and spatial models. Revolute input is the child joint frame's rotation relative to the parent about its positive z-axis, in radians. Prismatic input is the child attachment origin's signed separation from the parent along the parent's positive joint z-axis, in model length units. Zero is defined by coincident joint frames, not by the initial configuration. The initial coordinate must match the callback at initial time; initial velocities should match its time derivative. Angular residuals are wrapped modulo 2*pi; use time steps resolving less than pi radians of joint rotation. Constraints are built internally.

    Return Value type(variational_state), allocatable, dimension(:)

    The state at the initial time followed by the state after each completed integration step.