Video length is 9:21

Import a CAD Model of an AUV for Dynamic Simulation | AUV Deep Dive, Part 2

From the series: AUV Deep Dive

With Simscape Multibody™, you can import your CAD model of your mechanism and turn it into a platform of dynamic simulation. After import, you can:

  1. Add external force and actuation to specific locations on the mechanism
  2. Define kinematics and motion constraints
  3. Visualize the mechanism's motion in 3D

Published: 30 Apr 2021

Now Carlos we got this CAD model of the underwater vehicle. How can we bring that into the MATLAB and create a dynamics model with it?

OK. Yeah. So we have a solid works mechanism of the entire vehicle. By the way, this has not just the outside part, but there's all the individual propellers, and you can see the thrusters there. And if I were to hide some of these pieces for example, you would see all the sensors are there. The cameras, the sonar, the Doppler velocity radar elements. All those things are part of this implementation.

So because this is already implemented in CAD, what we want to do is we want to bring in the entire-- we have two options. We could bring in individual parts and connect them together ourselves. So that is, for example, here. Let me open this very simple model where I'm showing you using this file solid block from Simscape Multibody.

I can associate a file solid to any particular part of the CAD package. So the main hull which is that middle piece, for example. Now that's the CAD part. That will come in directly from the CAD. It will bring in the material properties, the density, inertia. All the things that we need for our mathematics. And as it's a block here, I can just connect it to something. In this case, I'm just connecting it to the World, so it's not very interesting. It's not doing anything because it's not moving. There is no degree of freedom. But you can bring all the individual parts that you have and start connecting them manually yourself, one by one, and create the entire vehicle. That's one alternative.

But, like I was saying, if you actually have the full assembly implemented in CAD. And by full assembly I mean not just the parts. We have all the parts, but we also have the appropriate mates for the different-- in this case, the mates in CAD mean how things are allowed to move relative to other things or how some parts are allowed to move relative to other parts.

So we have the main propellers, for example. They are allowed to rotate. So the propeller part, the blades of the propeller part, are allowed to rotate around a particular base of the motor for example. So all of that is already set up here in the CAD.

Now, if I have all of that implemented, I can use a direct translator. So we have a direct translator that can connect multiple CAD packages directly to Simscape Multibody. What it would actually do is it would read the CAD file. It will connect my MATLAB session to this CAD file. And it will grab all the individual parts. And it's going to also capture how each one of these parts is connected to all the associated parts around it.

So as you saw, I mean this vehicle. Even though it's a simple geometry, no? It has many, many pieces. Like you saw all the bits and pieces of the motor, and the sensors, and all the parts. So all those parts have been added to an XML file, called AUV.xml.

So let me hit OK here. Let me go back to MATLAB now. So I'm leaving SolidWorks, and I'm going to go back to MATLAB now. And I have all the step files for each one of the parts and pieces. And there's this file called AUV.xml that I just generated.

That AUV.xml is a text file. So if I were to open it, all you would see is information in some particular format. So you see all the rotations and transformations and all the masses and inertia tensors. All that information that we have captured from CAD has been saved into that XML file.

But we provide you with a function, called smimport. That stands for Simscape Multibody import. Where you put the name of the file, in this case AUV.xml. And that function will automatically read that XML file, read all the information, go to the library, in Simscape Multibody, pick up the body block, pick up the transform blocks, pick up the joint blocks that it needs, and put them all together automatically, building it in Simulink.

So once this is finished, so even though we have, like I said, like maybe 60 or 70 pieces of our mechanism. What you're seeing here is an actual live model of Simulink, where we have that platform already constructed. Now notice, we have our main body here, and we have the two main propellers and the four thrusters. The two horizontal thrusters, and the two vertical thrusters.

So you can see all the parts have been brought in, and each one of the propellers and thrusters is connected to their rigid body, to the vehicle body, through rotational joints. So if I were to dig in a little bit, you will see everything is aligned and transformed in a way where things are pointing in the right direction.

But this is a live model. If I press run, what this is going to do is it's going to first construct the equations together. Construct all the bits and pieces. And this is now the visualization in Simscape Multibody. We have brought in all the different bits and pieces. Again where I want to hide that. So you can see all the sensors have been brought in, and everything is there in the appropriate location.

Of course, I just brought it in automatically from the CAD, so there's no notion of physics. So the propellers are not spinning or anything. You have to put a motor or put a torque on the propellers to move them. And right now, if you notice when I run the simulation, nothing is happening. When I press play, when I press run, nothing is happening, because the vehicle is rigidly connected to the World reference frame. And that's how it comes from the CAD.

If I want my vehicle to be able to move around, all I have to do is I will have to go to my joints library here in Simscape Multibody and bring in a six degrees of freedom. So my vehicle, really, should be free to move in any direction. Of course right now, if I were to run a simulation, what you're going to see is the only force that I have acting on my vehicle right now is gravity. So that's why what you're seeing is the vehicle just falling down because of gravity.

But if we go back to the live script, there's a section, I have a section here when after I bring frames from the CAD. I have my mechanism here in this example is exactly the same thing that you just saw, only I cleaned it up. I put little icons just so it's clearer when you look at it. But what we are looking at right now is the vehicle body with the six actuator devices and connected to the World through a six degrees of freedom joint.

And we still have gravity, but we not only have gravity, we also have a buoyancy force that is keeping this afloat. Or at a particular depth there. So what this example is showing now just to excite some of the six degrees of freedom, what I'm doing here is I'm applying a roll moment and a pitch moment. And the dynamics that you are observing right now is because we have that restoring moment from the buoyancy.

So the center of mass and the center of buoyancy are separated by a certain distance. So that moment arm is a restoring moment. As I apply a roll moment, what you see is the thing is returning to equilibrium because that restoring moment brings it back. Same with the pitch. I am applying a pitch moment. And

you can see how the restoring moment, which is due to this pretty small moment arm here that you see between the center of buoyancy and the center of mass of the vehicle.

So that's why it is super important that those two frames are pretty much aligned vertically. One on top of the other. So that way that moment is always restoring that to an equilibrium position.

And now we can add on further actuation forces onto this vehicle.

Of course. Buoyancy is a hydrostatic force. Now what we need to do is now we need to start adding all the hydrodynamic drag effects, and the added mass effects, which are going to be forces and moments in three dimensions. Forces and moments on the center of mass of the vehicle.