#+TITLE: Simscape Model #+SETUPFILE: ./setup/org-setup-file.org * Introduction :ignore: A [[https://.mathworks.com/products/simscape.html][simscape]] model permits to model multi-physics systems. [[https://mathworks.com/products/simmechanics.html][Simscape Multibody]] permits to model multibody systems using blocks representing bodies, joints, constraints, force elements, and sensors. * Solid bodies Each solid body is represented by a [[https://mathworks.com/help/physmod/sm/ref/solid.html][solid block]]. The geometry of the solid body can be imported using a =step= file. The properties of the solid body such as its mass, center of mass and moment of inertia can be derived from its density and its geometry as defined by the =step= file. They also can be set by hand. * Frames Frames are very important in simscape multibody, they defined where the forces are applied, where the joints are located and where the measurements are made. They can be defined from the solid body geometry, or using the [[https://mathworks.com/help/physmod/sm/ref/rigidtransform.html][rigid transform block]]. * Joints Solid Bodies are connected with joints (between frames of the two solid bodies). There are various types of joints that are all described [[https://mathworks.com/help/physmod/sm/ug/joints.html][here]]. #+name: tab:joint_dof #+caption: Degrees of freedom associated with each joint | Joint Block | Translational DOFs | Rotational DOFs | |-------------------+--------------------+-----------------| | 6-DOF | 3 | 3 | | Bearing | 1 | 3 | | Bushing | 3 | 3 | | Cartesian | 3 | 0 | | Constant Velocity | 0 | 2 | | Cylindrical | 1 | 1 | | Gimbal | 0 | 3 | | Leadscrew | 1 (coupled) | 1 (coupled) | | Pin Slot | 1 | 1 | | Planar | 2 | 1 | | Prismatic | 1 | 0 | | Rectangular | 2 | 0 | | Revolute | 0 | 1 | | Spherical | 1 | 3 | | Telescoping | 1 | 3 | | Universal | 0 | 2 | | Weld | 0 | 0 | Joint blocks are assortments of joint primitives: - *Prismatic*: allows translation along a single standard axis: =Px=, =Py=, =Pz= - *Revolute*: allows rotation about a single standard axis: =Rx=, =Ry=, =Rz= - *Spherical*: allow rotation about any 3D axis: =S= - *Lead Screw*: allows coupled rotation and translation on a standard axis: =LSz= - *Constant Velocity*: Allows rotation at constant velocity between intersection through arbitrarily aligned shafts: =CV= #+name: tab:joint_primitive #+caption: Joint primitives for each joint type | Joint Block | Px | Py | Pz | Rx | Ry | Rz | S | CV | LSz | |-------------------+----+----+----+----+----+----+---+----+-----| | 6-DOF | x | x | x | | | | x | | | | Bearing | | | x | x | x | x | | | | | Bushing | x | x | x | x | x | x | | | | | Cartesian | x | x | x | | | | | | | | Constant Velocity | | | | | | | | x | | | Cylindrical | | | x | | | x | | | | | Gimbal | | | | x | x | x | | | | | Leadscrew | | | | | | | | | x | | Pin Slot | x | | | | | x | | | | | Planar | x | x | | | | x | | | | | Prismatic | | | x | | | | | | | | Rectangular | x | x | | | | | | | | | Revolute | | | | | | x | | | | | Spherical | | | | | | | x | | | | Telescoping | | | x | | | | x | | | | Universal | | | | x | x | | | | | | Weld | | | | | | | | | | For each of the joint primitive, we can specify the dynamical properties: - The *spring stiffness*: either linear or rotational one - The *damping coefficient* For the actuation, we can either specify the motion or the force: - the force applied in the corresponding DOF is provided by the input - the motion is provided by the input A sensor can be added to measure either the position, velocity or acceleration of the joint DOF. Composite Force/Torque sensing: - Constraint force - Total force: gives the sum across all joint primitives over all sources: actuation inputs, internal springs and dampers. * Measurements A transform sensor block measures the spatial relationship between two frames: the base =B= and the follower =F=. It can give the rotational and translational position, velocity and acceleration. The measurement frame should be specified: it corresponds to the frame in which to resolve the selected spatial measurements. The default is =world=. If we want to simulate an *inertial sensor*, we just have to choose =B= to be the =world= frame. *Force sensors* are included in the joints blocks. * Excitation We can apply *external forces* to the model by using an [[https://mathworks.com/help/physmod/sm/ref/externalforceandtorque.html][external force and torque block]]. Internal force, acting reciprocally between base and following origins is implemented using the [[https://mathworks.com/help/physmod/sm/ref/internalforce.html][internal force block]] even though it is usually included in one joint block.