Flexible Bodies in SimMechanics
This week we see how to create flexible bodies in SimMechanics. For that, we will use techniques seen in previous posts like Building Models with MATLAB Code and Self-Modifying Subsystems.
The Lumped Parameter Approach
Using a lumped parameter approach, we can approximate a flexible body using a series of rigid bodies connected by springs and dampers. The material properties and the cross section of the flexible body determines the spring stiffness and damping coefficients.
The Fundamental Element
To begin, in SimMechanics, we create one element to be duplicated as many times as needed and store it in a library. For a beam bending about one axis, our fundamental element looks like:
Assembling the Beam
Now that we have one element, we can create a subsystem that will assemble as many elements as desired. Here is what the final result looks like:
To implement this block, we follow the self-modifying subsystem workflow suggested by Seth in a previous post. In the Mask Initialization tab of the subsystem, we define a function that deletes the content of the subsystem and redraws it when needed.
To delete the content, we use delete_line and delete_block.
To redraw the subsystem, we use add_block and add_line.
Flexible bodies open a lot of possibilities. One of them is vibration analysis. With a beam composed of 25 elements, I have been able to observe the first three normal modes of the beam:
Now it's your turn
Here are a few tips if you want to dig deeper in this area:
- For a more advanced example of building SimMechanics components programmatically, I recommend looking at SimMechanics Model from MATLAB Code from my colleague Pravesh Sanghvi.
- For more details on how to convert the physical properties of your beam like the Young’s elastic modulus and the cross-section moment of inertia, I recommend going through this article: Modeling Flexible Bodies in SimMechanics and Simulink.
- To configure a SimMechanics block programmatically, I recommend using get_param(blk,'DialogParameters') to obtain the list of dialog parameters for this block.
- Click here to download my flexible beam example.
Try modeling flexible bodies in SimMechanics and let us know what you think by leaving a comment here.
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.