Schema: kinematic_structure_schema

Source : ISO 10303-105



SCHEMA kinematic_structure_schema;

REFERENCE FROM kinematic_topology_schema;    -- ISO 10303-105

REFERENCE FROM geometry_schema   -- ISO 10303-42
  (axis2_placement_3d,
   cartesian_transformation_operator_3d,
   curve,
   direction,
   geometric_representation_context,
   geometric_representation_item,
   normalise,
   point,
   point_on_curve,
   point_on_surface,
   surface,
   rectangular_trimmed_surface,
   trimmed_curve);

REFERENCE FROM measure_schema   -- ISO 10303-41
  (conversion_based_unit,
   global_unit_assigned_context,
   length_measure,
   plane_angle_measure,
   si_prefix,
   si_unit,
   si_unit_name,
   unit);

REFERENCE FROM product_property_definition_schema   -- ISO 10303-41
  (characterized_definition,
   property_definition);

REFERENCE FROM product_property_representation_schema   -- ISO 10303-41
  (property_definition_representation,
   shape_representation);

REFERENCE FROM representation_schema   -- ISO 10303-43
  (definitional_representation_relationship,
   functionally_defined_transformation,
   item_defined_transformation,
   representation,
   representation_context,
   representation_item,
   representation_relationship,
   representation_relationship_with_transformation,
   using_representations);

REFERENCE FROM support_resource_schema   -- ISO 10303-41
  (bag_to_set,
   label);


TYPE actuated_direction = ENUMERATION OF
   (bidirectional,
    positive_only,
    negative_only,
    not_actuated);
END_TYPE;

TYPE kinematic_link_representation_items = SELECT
   (curve,
    point,
    rigid_placement,
    surface);
END_TYPE;

TYPE rigid_placement = SELECT
   (axis2_placement_3d,
    su_parameters);
END_TYPE;

ENTITY actuated_kinematic_pair
  SUBTYPE OF (kinematic_pair);
  t_x : OPTIONAL actuated_direction;
  t_y : OPTIONAL actuated_direction;
  t_z : OPTIONAL actuated_direction;
  r_x : OPTIONAL actuated_direction;
  r_y : OPTIONAL actuated_direction;
  r_z : OPTIONAL actuated_direction;
END_ENTITY;

ENTITY cylindrical_pair
  SUBTYPE OF (low_order_kinematic_pair);
DERIVE
  SELF\low_order_kinematic_pair.t_x : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.t_y : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.t_z : BOOLEAN := TRUE;
  SELF\low_order_kinematic_pair.r_x : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.r_y : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.r_z : BOOLEAN := TRUE;
END_ENTITY;

ENTITY cylindrical_pair_with_range
  SUBTYPE OF (cylindrical_pair);
  lower_limit_actual_translation : OPTIONAL length_measure;
  upper_limit_actual_translation : OPTIONAL length_measure;
  lower_limit_actual_rotation : OPTIONAL plane_angle_measure;
  upper_limit_actual_rotation : OPTIONAL plane_angle_measure;
WHERE
  WR1: (NOT EXISTS(lower_limit_actual_translation) OR NOT EXISTS(upper_limit_actual_translation)) XOR (lower_limit_actual_translation < upper_limit_actual_translation);
  WR2: (NOT EXISTS(lower_limit_actual_rotation) OR NOT EXISTS(upper_limit_actual_rotation)) XOR (lower_limit_actual_rotation < upper_limit_actual_rotation);
END_ENTITY;

ENTITY fully_constrained_pair
  SUBTYPE OF (low_order_kinematic_pair);
DERIVE
  SELF\low_order_kinematic_pair.t_x : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.t_y : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.t_z : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.r_x : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.r_y : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.r_z : BOOLEAN := FALSE;
END_ENTITY;

ENTITY gear_pair
  SUBTYPE OF (low_order_kinematic_pair_with_motion_coupling);
  radius_first_link : length_measure;
  radius_second_link : length_measure;
  bevel : plane_angle_measure;
  helical_angle : plane_angle_measure;
  gear_ratio : REAL;
WHERE
  WR1: SIZEOF( QUERY(lr <* SELF\kinematic_pair.associated_link_representations_1 | NOT('KINEMATIC_STRUCTURE_SCHEMA.RIGID_LINK_REPRESENTATION' IN TYPEOF(lr)))) = 0;
END_ENTITY;

ENTITY gear_pair_with_range
  SUBTYPE OF (gear_pair);
  lower_limit_actual_rotation_1 : OPTIONAL plane_angle_measure;
  upper_limit_actual_rotation_1 : OPTIONAL plane_angle_measure;
WHERE
  WR1: (NOT EXISTS(lower_limit_actual_rotation_1) OR NOT EXISTS(upper_limit_actual_rotation_1)) XOR (lower_limit_actual_rotation_1 < upper_limit_actual_rotation_1);
END_ENTITY;

ENTITY high_order_kinematic_pair
  ABSTRACT SUPERTYPE OF (ONEOF (linear_flexible_and_planar_curve_pair,
                                point_on_surface_pair,
                                point_on_planar_curve_pair,
                                planar_curve_pair,
                                surface_pair))
  SUBTYPE OF (kinematic_pair);
WHERE
  WR1: SIZEOF( QUERY(lr <* SELF\kinematic_pair.associated_link_representations_2 | NOT('KINEMATIC_STRUCTURE_SCHEMA.RIGID_LINK_REPRESENTATION' IN TYPEOF(lr)))) = 0;
END_ENTITY;

ENTITY homokinetic_pair
  SUBTYPE OF (universal_pair);
WHERE
  WR1: NOT EXISTS(SELF.input_skew_angle);
END_ENTITY;

ENTITY kinematic_link_representation
  ABSTRACT SUPERTYPE OF (ONEOF (linear_flexible_link_representation,
                                rigid_link_representation))
  SUBTYPE OF (representation);
  SELF\representation.context_of_items : geometric_representation_context;
  SELF\representation.items : SET[1:?] OF kinematic_link_representation_items;
  represented_link : kinematic_link;
INVERSE
  associated_shape_representation : SET[0:1] OF kinematic_link_representation_association FOR rep_1;
END_ENTITY;

ENTITY kinematic_link_representation_association
  SUBTYPE OF (representation_relationship);
  SELF\representation_relationship.rep_1 : kinematic_link_representation;
  SELF\representation_relationship.rep_2 : shape_representation;
WHERE
  WR1: (SELF\representation_relationship.rep_2.context_of_items :=: SELF\representation_relationship.rep_1.context_of_items) OR ('REPRESENTATION_SCHEMA.REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION' IN TYPEOF(SELF));
END_ENTITY;

ENTITY kinematic_pair
  ABSTRACT SUPERTYPE OF (ONEOF (high_order_kinematic_pair,
                                low_order_kinematic_pair_with_motion_coupling,
                                low_order_kinematic_pair)
                        ANDOR actuated_kinematic_pair)
  SUBTYPE OF (geometric_representation_item, item_defined_transformation);
  joint : kinematic_joint;
  SELF\item_defined_transformation.transform_item_1 : rigid_placement;
  SELF\item_defined_transformation.transform_item_2 : rigid_placement;
DERIVE
  associated_link_representations_1 : SET[1:?] OF kinematic_link_representation := sort_link_associations(link_representation_associations, TRUE);
  associated_link_representations_2 : SET[1:?] OF kinematic_link_representation := sort_link_associations(link_representation_associations, FALSE);
  SELF\item_defined_transformation.name : label := SELF\representation_item.name;
INVERSE
  link_representation_associations : SET[1:?] OF pair_representation_relationship FOR transformation_operator;
END_ENTITY;

ENTITY linear_flexible_and_pinion_pair
  SUBTYPE OF (low_order_kinematic_pair_with_motion_coupling);
  pinion_radius : length_measure;
WHERE
  WR1: SIZEOF( QUERY(lr <* SELF\kinematic_pair.associated_link_representations_1 | NOT('KINEMATIC_STRUCTURE_SCHEMA.LINEAR_FLEXIBLE_LINK_REPRESENTATION' IN TYPEOF(lr)))) = 0;
END_ENTITY;

ENTITY linear_flexible_and_planar_curve_pair
  SUBTYPE OF (high_order_kinematic_pair);
  pair_curve : curve;
  orientation : BOOLEAN;
WHERE
  WR1: SIZEOF( QUERY(r <* SELF\kinematic_pair.associated_link_representations_1 | NOT(pair_curve IN r.items))) = 0;
  WR2: SIZEOF( QUERY(lr <* SELF\kinematic_pair.associated_link_representations_1 | NOT('KINEMATIC_STRUCTURE_SCHEMA.LINEAR_FLEXIBLE_LINK_REPRESENTATION' IN TYPEOF(lr)))) = 0;
END_ENTITY;

ENTITY linear_flexible_link_representation
  SUBTYPE OF (kinematic_link_representation);
END_ENTITY;

ENTITY low_order_kinematic_pair
  SUPERTYPE OF (ONEOF (revolute_pair,
                       cylindrical_pair,
                       spherical_pair,
                       spherical_pair_with_pin,
                       planar_pair,
                       unconstrained_pair,
                       fully_constrained_pair,
                       prismatic_pair,
                       universal_pair,
                       low_order_kinematic_pair_with_range))
  SUBTYPE OF (kinematic_pair);
  t_x : BOOLEAN;
  t_y : BOOLEAN;
  t_z : BOOLEAN;
  r_x : BOOLEAN;
  r_y : BOOLEAN;
  r_z : BOOLEAN;
WHERE
  WR1: SIZEOF( QUERY(lr <* SELF\kinematic_pair.associated_link_representations_1 | NOT('KINEMATIC_STRUCTURE_SCHEMA.RIGID_LINK_REPRESENTATION' IN TYPEOF(lr)))) = 0;
  WR2: SIZEOF( QUERY(lr <* SELF\kinematic_pair.associated_link_representations_2 | NOT('KINEMATIC_STRUCTURE_SCHEMA.RIGID_LINK_REPRESENTATION' IN TYPEOF(lr)))) = 0;
END_ENTITY;

ENTITY low_order_kinematic_pair_with_motion_coupling
  ABSTRACT SUPERTYPE OF (ONEOF (gear_pair,
                                linear_flexible_and_pinion_pair,
                                rack_and_pinion_pair,
                                screw_pair))
  SUBTYPE OF (kinematic_pair);
WHERE
  WR1: SIZEOF( QUERY(lr <* SELF\kinematic_pair.associated_link_representations_2 | NOT('KINEMATIC_STRUCTURE_SCHEMA.RIGID_LINK_REPRESENTATION' IN TYPEOF(lr)))) = 0;
END_ENTITY;

ENTITY low_order_kinematic_pair_with_range
  SUBTYPE OF (low_order_kinematic_pair);
  lower_limit_actual_rotation_x : OPTIONAL plane_angle_measure;
  upper_limit_actual_rotation_x : OPTIONAL plane_angle_measure;
  lower_limit_actual_rotation_y : OPTIONAL plane_angle_measure;
  upper_limit_actual_rotation_y : OPTIONAL plane_angle_measure;
  lower_limit_actual_rotation_z : OPTIONAL plane_angle_measure;
  upper_limit_actual_rotation_z : OPTIONAL plane_angle_measure;
  lower_limit_actual_translation_x : OPTIONAL length_measure;
  upper_limit_actual_translation_x : OPTIONAL length_measure;
  lower_limit_actual_translation_y : OPTIONAL length_measure;
  upper_limit_actual_translation_y : OPTIONAL length_measure;
  lower_limit_actual_translation_z : OPTIONAL length_measure;
  upper_limit_actual_translation_z : OPTIONAL length_measure;
END_ENTITY;

ENTITY mechanism_representation
  SUBTYPE OF (representation);
  SELF\representation.context_of_items : geometric_representation_context;
  SELF\representation.items : SET[1:?] OF pair_representation_relationship;
  represented_topology : kinematic_topology_representation_select;
DERIVE
  represented_joints : SET[1:?] OF kinematic_joint := collect_joints(items);
WHERE
  WR1: (('KINEMATIC_TOPOLOGY_SCHEMA.KINEMATIC_TOPOLOGY_STRUCTURE' IN TYPEOF(represented_topology)) AND (represented_joints :=: represented_topology.items)) OR (('KINEMATIC_TOPOLOGY_SCHEMA.KINEMATIC_TOPOLOGY_DIRECTED_STRUCTURE' IN TYPEOF(represented_topology)) AND (represented_joints :=: get_kinematic_joints_from_oriented_joints(represented_topology.items))) OR (('KINEMATIC_TOPOLOGY_SCHEMA.KINEMATIC_TOPOLOGY_NETWORK_STRUCTURE' IN TYPEOF(represented_topology)) AND (represented_joints :=: get_kinematic_joints_from_kinematic_loops(represented_topology.items)));
END_ENTITY;

ENTITY pair_representation_relationship
  SUBTYPE OF (geometric_representation_item, representation_relationship_with_transformation);
  SELF\representation_relationship.rep_1 : kinematic_link_representation;
  SELF\representation_relationship.rep_2 : kinematic_link_representation;
  SELF\representation_relationship_with_transformation.transformation_operator : kinematic_pair;
WHERE
  WR1: transformation_operator\item_defined_transformation.transform_item_1 IN rep_1.items;
  WR2: transformation_operator\item_defined_transformation.transform_item_2 IN rep_2.items;
  WR3: rep_1\kinematic_link_representation.represented_link = transformation_operator\kinematic_pair.joint.edge_start;
  WR4: rep_2\kinematic_link_representation.represented_link = transformation_operator\kinematic_pair.joint.edge_end;
END_ENTITY;

ENTITY planar_curve_pair
  SUPERTYPE OF (ONEOF (sliding_curve_pair,
                       rolling_curve_pair)
               ANDOR planar_curve_pair_range)
  SUBTYPE OF (high_order_kinematic_pair);
  curve_1 : curve;
  curve_2 : curve;
  orientation : BOOLEAN;
WHERE
  WR1: SIZEOF( QUERY(r <* SELF\kinematic_pair.associated_link_representations_1 | NOT(curve_1 IN r.items))) = 0;
  WR2: SIZEOF( QUERY(r <* SELF\kinematic_pair.associated_link_representations_2 | NOT(curve_2 IN r.items))) = 0;
  WR3: SIZEOF( QUERY(lr <* SELF\kinematic_pair.associated_link_representations_1 | NOT('KINEMATIC_STRUCTURE_SCHEMA.RIGID_LINK_REPRESENTATION' IN TYPEOF(lr)))) = 0;
END_ENTITY;

ENTITY planar_curve_pair_range
  SUBTYPE OF (planar_curve_pair);
  range_on_curve_1 : trimmed_curve;
  range_on_curve_2 : trimmed_curve;
WHERE
  WR1: SELF\planar_curve_pair.curve_1 :=: range_on_curve_1.basis_curve;
  WR2: SELF\planar_curve_pair.curve_2 :=: range_on_curve_2.basis_curve;
  WR3: SIZEOF( QUERY(r <* SELF\kinematic_pair.associated_link_representations_1 | NOT(range_on_curve_1 IN r.items))) = 0;
  WR4: SIZEOF( QUERY(r <* SELF\kinematic_pair.associated_link_representations_2 | NOT(range_on_curve_2 IN r.items))) = 0;
END_ENTITY;

ENTITY planar_pair
  SUBTYPE OF (low_order_kinematic_pair);
DERIVE
  SELF\low_order_kinematic_pair.t_x : BOOLEAN := TRUE;
  SELF\low_order_kinematic_pair.t_y : BOOLEAN := TRUE;
  SELF\low_order_kinematic_pair.t_z : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.r_x : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.r_y : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.r_z : BOOLEAN := TRUE;
END_ENTITY;

ENTITY planar_pair_with_range
  SUBTYPE OF (planar_pair);
  lower_limit_actual_rotation : OPTIONAL plane_angle_measure;
  upper_limit_actual_rotation : OPTIONAL plane_angle_measure;
  lower_limit_actual_translation_x : OPTIONAL length_measure;
  upper_limit_actual_translation_x : OPTIONAL length_measure;
  lower_limit_actual_translation_y : OPTIONAL length_measure;
  upper_limit_actual_translation_y : OPTIONAL length_measure;
WHERE
  WR1: (NOT EXISTS(lower_limit_actual_rotation) OR NOT EXISTS(upper_limit_actual_rotation)) XOR (lower_limit_actual_rotation < upper_limit_actual_rotation);
  WR2: (NOT EXISTS(lower_limit_actual_translation_x) OR NOT EXISTS(upper_limit_actual_translation_x)) XOR (lower_limit_actual_translation_x < upper_limit_actual_translation_x);
  WR3: (NOT EXISTS(lower_limit_actual_translation_y) OR NOT EXISTS(upper_limit_actual_translation_y)) XOR (lower_limit_actual_translation_y < upper_limit_actual_translation_y);
END_ENTITY;

ENTITY point_on_planar_curve_pair
  SUBTYPE OF (high_order_kinematic_pair);
  pair_curve : curve;
  orientation : BOOLEAN;
WHERE
  WR1: SIZEOF( QUERY(r <* SELF\kinematic_pair.associated_link_representations_1 | NOT(pair_curve IN r.items))) = 0;
  WR2: SIZEOF( QUERY(lr <* SELF\kinematic_pair.associated_link_representations_1 | NOT('KINEMATIC_STRUCTURE_SCHEMA.RIGID_LINK_REPRESENTATION' IN TYPEOF(lr)))) = 0;
END_ENTITY;

ENTITY point_on_planar_curve_pair_with_range
  SUBTYPE OF (point_on_planar_curve_pair);
  range_on_pair_curve : trimmed_curve;
  lower_limit_yaw : OPTIONAL plane_angle_measure;
  upper_limit_yaw : OPTIONAL plane_angle_measure;
  lower_limit_pitch : OPTIONAL plane_angle_measure;
  upper_limit_pitch : OPTIONAL plane_angle_measure;
  lower_limit_roll : OPTIONAL plane_angle_measure;
  upper_limit_roll : OPTIONAL plane_angle_measure;
WHERE
  WR1: (NOT EXISTS(lower_limit_pitch) OR NOT EXISTS(upper_limit_pitch)) XOR (lower_limit_pitch < upper_limit_pitch);
  WR2: (NOT EXISTS(lower_limit_yaw) OR NOT EXISTS(upper_limit_yaw)) XOR (lower_limit_yaw < upper_limit_yaw);
  WR3: (NOT EXISTS(lower_limit_roll) OR NOT EXISTS(upper_limit_roll)) XOR (lower_limit_roll < upper_limit_roll);
  WR4: SIZEOF( QUERY(r <* SELF\kinematic_pair.associated_link_representations_1 | NOT(range_on_pair_curve IN r.items))) = 0;
END_ENTITY;

ENTITY point_on_surface_pair
  SUBTYPE OF (high_order_kinematic_pair);
  pair_surface : surface;
WHERE
  WR1: SIZEOF( QUERY(r <* SELF\kinematic_pair.associated_link_representations_1 | NOT(pair_surface IN r.items))) = 0;
  WR2: SIZEOF( QUERY(lr <* SELF\kinematic_pair.associated_link_representations_1 | NOT('KINEMATIC_STRUCTURE_SCHEMA.RIGID_LINK_REPRESENTATION' IN TYPEOF(lr)))) = 0;
END_ENTITY;

ENTITY point_on_surface_pair_with_range
  SUBTYPE OF (point_on_surface_pair);
  range_on_pair_surface : rectangular_trimmed_surface;
  lower_limit_yaw : OPTIONAL plane_angle_measure;
  upper_limit_yaw : OPTIONAL plane_angle_measure;
  lower_limit_pitch : OPTIONAL plane_angle_measure;
  upper_limit_pitch : OPTIONAL plane_angle_measure;
  lower_limit_roll : OPTIONAL plane_angle_measure;
  upper_limit_roll : OPTIONAL plane_angle_measure;
WHERE
  WR1: (NOT EXISTS(lower_limit_pitch) OR NOT EXISTS(upper_limit_pitch)) XOR (lower_limit_pitch < upper_limit_pitch);
  WR2: (NOT EXISTS(lower_limit_yaw) OR NOT EXISTS(upper_limit_yaw)) XOR (lower_limit_yaw < upper_limit_yaw);
  WR3: (NOT EXISTS(lower_limit_roll) OR NOT EXISTS(upper_limit_roll)) XOR (lower_limit_roll < upper_limit_roll);
  WR4: SIZEOF( QUERY(r <* SELF\kinematic_pair.associated_link_representations_1 | NOT(range_on_pair_surface IN r.items))) = 0;
END_ENTITY;

ENTITY prismatic_pair
  SUBTYPE OF (low_order_kinematic_pair);
DERIVE
  SELF\low_order_kinematic_pair.t_x : BOOLEAN := TRUE;
  SELF\low_order_kinematic_pair.t_y : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.t_z : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.r_x : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.r_y : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.r_z : BOOLEAN := FALSE;
END_ENTITY;

ENTITY prismatic_pair_with_range
  SUBTYPE OF (prismatic_pair);
  lower_limit_actual_translation : OPTIONAL length_measure;
  upper_limit_actual_translation : OPTIONAL length_measure;
WHERE
  WR1: (NOT EXISTS(lower_limit_actual_translation) OR NOT EXISTS(upper_limit_actual_translation)) XOR (lower_limit_actual_translation < upper_limit_actual_translation);
END_ENTITY;

ENTITY rack_and_pinion_pair
  SUBTYPE OF (low_order_kinematic_pair_with_motion_coupling);
  pinion_radius : length_measure;
WHERE
  WR1: SIZEOF( QUERY(lr <* SELF\kinematic_pair.associated_link_representations_1 | NOT('KINEMATIC_STRUCTURE_SCHEMA.RIGID_LINK_REPRESENTATION' IN TYPEOF(lr)))) = 0;
END_ENTITY;

ENTITY rack_and_pinion_pair_with_range
  SUBTYPE OF (rack_and_pinion_pair);
  lower_limit_rack_displacement : OPTIONAL length_measure;
  upper_limit_rack_displacement : OPTIONAL length_measure;
WHERE
  WR1: (NOT EXISTS(lower_limit_rack_displacement) OR NOT EXISTS(upper_limit_rack_displacement)) XOR (lower_limit_rack_displacement < upper_limit_rack_displacement);
END_ENTITY;

ENTITY revolute_pair
  SUBTYPE OF (low_order_kinematic_pair);
DERIVE
  SELF\low_order_kinematic_pair.t_x : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.t_y : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.t_z : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.r_x : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.r_y : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.r_z : BOOLEAN := TRUE;
END_ENTITY;

ENTITY revolute_pair_with_range
  SUBTYPE OF (revolute_pair);
  lower_limit_actual_rotation : OPTIONAL plane_angle_measure;
  upper_limit_actual_rotation : OPTIONAL plane_angle_measure;
WHERE
  WR1: (NOT EXISTS(lower_limit_actual_rotation) OR NOT EXISTS(upper_limit_actual_rotation)) XOR (lower_limit_actual_rotation < upper_limit_actual_rotation);
END_ENTITY;

ENTITY rigid_link_representation
  SUBTYPE OF (kinematic_link_representation);
END_ENTITY;

ENTITY rolling_curve_pair
  SUBTYPE OF (planar_curve_pair);
END_ENTITY;

ENTITY rolling_surface_pair
  SUBTYPE OF (surface_pair);
END_ENTITY;

ENTITY screw_pair
  SUBTYPE OF (low_order_kinematic_pair_with_motion_coupling);
  pitch : length_measure;
WHERE
  WR1: SIZEOF( QUERY(lr <* SELF\kinematic_pair.associated_link_representations_1 | NOT('KINEMATIC_STRUCTURE_SCHEMA.RIGID_LINK_REPRESENTATION' IN TYPEOF(lr)))) = 0;
END_ENTITY;

ENTITY screw_pair_with_range
  SUBTYPE OF (screw_pair);
  lower_limit_actual_rotation : OPTIONAL plane_angle_measure;
  upper_limit_actual_rotation : OPTIONAL plane_angle_measure;
WHERE
  WR1: (NOT EXISTS(lower_limit_actual_rotation) OR NOT EXISTS(upper_limit_actual_rotation)) XOR (lower_limit_actual_rotation < upper_limit_actual_rotation);
END_ENTITY;

ENTITY sliding_curve_pair
  SUBTYPE OF (planar_curve_pair);
END_ENTITY;

ENTITY sliding_surface_pair
  SUBTYPE OF (surface_pair);
END_ENTITY;

ENTITY spherical_pair
  SUBTYPE OF (low_order_kinematic_pair);
DERIVE
  SELF\low_order_kinematic_pair.t_x : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.t_y : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.t_z : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.r_x : BOOLEAN := TRUE;
  SELF\low_order_kinematic_pair.r_y : BOOLEAN := TRUE;
  SELF\low_order_kinematic_pair.r_z : BOOLEAN := TRUE;
END_ENTITY;

ENTITY spherical_pair_with_pin
  SUBTYPE OF (low_order_kinematic_pair);
DERIVE
  SELF\low_order_kinematic_pair.t_x : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.t_y : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.t_z : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.r_x : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.r_y : BOOLEAN := TRUE;
  SELF\low_order_kinematic_pair.r_z : BOOLEAN := TRUE;
END_ENTITY;

ENTITY spherical_pair_with_pin_and_range
  SUBTYPE OF (spherical_pair_with_pin);
  lower_limit_yaw : OPTIONAL plane_angle_measure;
  upper_limit_yaw : OPTIONAL plane_angle_measure;
  lower_limit_roll : OPTIONAL plane_angle_measure;
  upper_limit_roll : OPTIONAL plane_angle_measure;
WHERE
  WR1: (NOT EXISTS(lower_limit_yaw) OR NOT EXISTS(upper_limit_yaw)) XOR (lower_limit_yaw < upper_limit_yaw);
  WR2: (NOT EXISTS(lower_limit_roll) OR NOT EXISTS(upper_limit_roll)) XOR (lower_limit_roll < upper_limit_roll);
END_ENTITY;

ENTITY spherical_pair_with_range
  SUBTYPE OF (spherical_pair);
  lower_limit_yaw : OPTIONAL plane_angle_measure;
  upper_limit_yaw : OPTIONAL plane_angle_measure;
  lower_limit_pitch : OPTIONAL plane_angle_measure;
  upper_limit_pitch : OPTIONAL plane_angle_measure;
  lower_limit_roll : OPTIONAL plane_angle_measure;
  upper_limit_roll : OPTIONAL plane_angle_measure;
WHERE
  WR1: (NOT EXISTS(lower_limit_yaw) OR NOT EXISTS(upper_limit_yaw)) XOR (lower_limit_yaw < upper_limit_yaw);
  WR2: (NOT EXISTS(lower_limit_pitch) OR NOT EXISTS(upper_limit_pitch)) XOR (lower_limit_pitch < upper_limit_pitch);
  WR3: (NOT EXISTS(lower_limit_roll) OR NOT EXISTS(upper_limit_roll)) XOR (lower_limit_roll < upper_limit_roll);
END_ENTITY;

ENTITY su_parameters
  SUBTYPE OF (geometric_representation_item);
  a : length_measure;
  alpha : plane_angle_measure;
  b : length_measure;
  beta : plane_angle_measure;
  c : length_measure;
  gamma : plane_angle_measure;
WHERE
  WR1: SELF\geometric_representation_item.dim=3;
END_ENTITY;

ENTITY surface_pair
  ABSTRACT SUPERTYPE OF (ONEOF (sliding_surface_pair,
                                rolling_surface_pair)
                        ANDOR surface_pair_with_range)
  SUBTYPE OF (high_order_kinematic_pair);
  surface_1 : surface;
  surface_2 : surface;
  orientation : BOOLEAN;
WHERE
  WR1: SIZEOF( QUERY(r <* SELF\kinematic_pair.associated_link_representations_1 | NOT(surface_1 IN r.items))) = 0;
  WR2: SIZEOF( QUERY(r <* SELF\kinematic_pair.associated_link_representations_2 | NOT(surface_2 IN r.items))) = 0;
  WR3: SIZEOF( QUERY(lr <* SELF\kinematic_pair.associated_link_representations_1 | NOT('KINEMATIC_STRUCTURE_SCHEMA.RIGID_LINK_REPRESENTATION' IN TYPEOF(lr)))) = 0;
END_ENTITY;

ENTITY surface_pair_with_range
  SUBTYPE OF (surface_pair);
  range_on_surface_1 : rectangular_trimmed_surface;
  range_on_surface_2 : rectangular_trimmed_surface;
  lower_limit_actual_rotation : OPTIONAL plane_angle_measure;
  upper_limit_actual_rotation : OPTIONAL plane_angle_measure;
WHERE
  WR1: SELF\surface_pair.surface_1 :=: range_on_surface_1.basis_surface;
  WR2: SELF\surface_pair.surface_2 :=: range_on_surface_2.basis_surface;
  WR3: (NOT EXISTS(lower_limit_actual_rotation) OR NOT EXISTS(upper_limit_actual_rotation)) XOR (lower_limit_actual_rotation < upper_limit_actual_rotation);
  WR4: SIZEOF( QUERY(r <* SELF\kinematic_pair.associated_link_representations_1 | NOT(range_on_surface_1 IN r.items))) = 0;
  WR5: SIZEOF( QUERY(r <* SELF\kinematic_pair.associated_link_representations_2 | NOT(range_on_surface_2 IN r.items))) = 0;
END_ENTITY;

ENTITY unconstrained_pair
  SUBTYPE OF (low_order_kinematic_pair);
DERIVE
  SELF\low_order_kinematic_pair.t_x : BOOLEAN := TRUE;
  SELF\low_order_kinematic_pair.t_y : BOOLEAN := TRUE;
  SELF\low_order_kinematic_pair.t_z : BOOLEAN := TRUE;
  SELF\low_order_kinematic_pair.r_x : BOOLEAN := TRUE;
  SELF\low_order_kinematic_pair.r_y : BOOLEAN := TRUE;
  SELF\low_order_kinematic_pair.r_z : BOOLEAN := TRUE;
END_ENTITY;

ENTITY universal_pair
  SUBTYPE OF (low_order_kinematic_pair);
  input_skew_angle : OPTIONAL plane_angle_measure;
DERIVE
  SELF\low_order_kinematic_pair.t_x : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.t_y : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.t_z : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.r_x : BOOLEAN := TRUE;
  SELF\low_order_kinematic_pair.r_y : BOOLEAN := FALSE;
  SELF\low_order_kinematic_pair.r_z : BOOLEAN := TRUE;
  skew_angle : plane_angle_measure := NVL (input_skew_angle, 0.0);
WHERE
  WR1: COS (plane_angle_for_pair_in_radian (SELF, skew_angle)) > 0.0;
END_ENTITY;

ENTITY universal_pair_with_range
  SUBTYPE OF (universal_pair);
  lower_limit_first_rotation : OPTIONAL plane_angle_measure;
  upper_limit_first_rotation : OPTIONAL plane_angle_measure;
  lower_limit_second_rotation : OPTIONAL plane_angle_measure;
  upper_limit_second_rotation : OPTIONAL plane_angle_measure;
WHERE
  WR1: (NOT EXISTS(lower_limit_first_rotation) OR NOT EXISTS(upper_limit_first_rotation)) XOR (lower_limit_first_rotation < upper_limit_first_rotation);
  WR2: (NOT EXISTS(lower_limit_second_rotation) OR NOT EXISTS(upper_limit_second_rotation)) XOR (lower_limit_second_rotation < upper_limit_second_rotation);
END_ENTITY;

SUBTYPE_CONSTRAINT kss_representation_subtypes FOR representation;
  ONEOF (kinematic_link_representation,
         kinematic_topology_structure,
         kinematic_topology_directed_structure,
         kinematic_topology_network_structure,
         mechanism_representation,
         shape_representation);
END_SUBTYPE_CONSTRAINT;

FUNCTION collect_joints
 (items : SET[1:?] OF pair_representation_relationship) : SET[0:?] OF kinematic_joint;
LOCAL
  result : SET OF kinematic_joint := [];
END_LOCAL;
  REPEAT i := 1 TO HIINDEX(items);
    result := result + items[i].transformation_operator.joint;
  END_REPEAT;
  RETURN(result);
END_FUNCTION;

FUNCTION plane_angle_for_pair_in_radian
 (pair : kinematic_pair; angle : plane_angle_measure) : plane_angle_measure;
LOCAL
    converted_angle : plane_angle_measure := angle;
    link_rep        : kinematic_link_representation
                    := representation_of_link (pair.joint.edge_start);
    link_cntxt      : representation_context;
    pa_units        : SET OF unit := [];
    pau             : unit;
  END_LOCAL;

  link_cntxt := link_rep\representation.context_of_items;

  IF NOT ('MEASURE_SCHEMA.GLOBAL_UNIT_ASSIGNED_CONTEXT'
          IN TYPEOF (link_cntxt)) THEN
    RETURN (?);
  END_IF;

  pa_units := QUERY (unit <* link_cntxt\global_unit_assigned_context.units |
                     'MEASURE_SCHEMA.PLANE_ANGLE_UNIT' IN TYPEOF (unit));

  IF SIZEOF (pa_units) <> 1 THEN
    RETURN (?);
  END_IF;

  pau := pa_units[1];

  IF (NOT ('MEASURE_SCHEMA.SI_UNIT' IN TYPEOF (pau)) AND
      NOT ('MEASURE_SCHEMA.CONVERSION_BASED_UNIT' IN TYPEOF (pau))) THEN
    RETURN (?);
  END_IF;

  REPEAT WHILE ('MEASURE_SCHEMA.CONVERSION_BASED_UNIT' IN TYPEOF (pau));
    converted_angle := converted_angle *
                       pau\conversion_based_unit.conversion_factor.
                       value_component;
    pau := pau\conversion_based_unit.conversion_factor.unit_component;

    IF ((NOT ('MEASURE_SCHEMA.SI_UNIT' IN TYPEOF (pau)) AND
         NOT ('MEASURE_SCHEMA.CONVERSION_BASED_UNIT' IN TYPEOF (pau))) OR
        (NOT ('MEASURE_SCHEMA.PLANE_ANGLE_UNIT' IN TYPEOF (pau)))) THEN
      RETURN (?);
    END_IF;
  END_REPEAT;

  IF (pau\si_unit.name <> si_unit_name.radian) THEN
    RETURN (?);
  END_IF;

  CASE pau\si_unit.prefix OF
    si_prefix.exa     : RETURN (1.E18 * converted_angle);
    si_prefix.peta    : RETURN (1.E15 * converted_angle);
    si_prefix.tera    : RETURN (1.E12 * converted_angle);
    si_prefix.giga    : RETURN (1.E9 * converted_angle);
    si_prefix.mega    : RETURN (1.E6 * converted_angle);
    si_prefix.kilo    : RETURN (1.E3 * converted_angle);
    si_prefix.hecto   : RETURN (1.E2 * converted_angle);
    si_prefix.deca    : RETURN (1.E1 * converted_angle);
    si_prefix.deci    : RETURN (1.E-1 * converted_angle);
    si_prefix.centi   : RETURN (1.E-2 * converted_angle);
    si_prefix.milli   : RETURN (1.E-3 * converted_angle);
    si_prefix.micro   : RETURN (1.E-6 * converted_angle);
    si_prefix.nano    : RETURN (1.E-9 * converted_angle);
    si_prefix.pico    : RETURN (1.E-12 * converted_angle);
    si_prefix.femto   : RETURN (1.E-15 * converted_angle);
    si_prefix.atto    : RETURN (1.E-18 * converted_angle);
  OTHERWISE           : RETURN (converted_angle);
  END_CASE;
END_FUNCTION;

FUNCTION representation_of_link
 (link : kinematic_link) : kinematic_link_representation;
RETURN (?);
END_FUNCTION;

FUNCTION sort_link_associations
 (aprr : SET[1:?] OF pair_representation_relationship; one_not_two : BOOLEAN) : SET[0:?] OF kinematic_link_representation;
LOCAL
  result : SET OF kinematic_link_representation := [];
END_LOCAL;
  IF one_not_two THEN
    REPEAT i := 1 TO HIINDEX(aprr);
      result := result + aprr[i].rep_1;
    END_REPEAT;
  ELSE  
    REPEAT i := 1 TO HIINDEX(aprr);
      result := result + aprr[i].rep_2;
    END_REPEAT;
  END_IF;
  RETURN(result);
END_FUNCTION;

END_SCHEMA;  -- kinematic_structure_schema