Simscape Multibody Spring-Mass System | MATLAB Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we're going to be taking a look at how to use matlab's sim scape application for simulating a spring mass damper system sim scape is a very user-friendly and intuitive graphical software within matlab used for simulating mechanical and electrical systems we have here a model of a two mass spring mass damper system in sim scape that is given a step input and then we're able to graph the step response of this system so let's go ahead and see how we are going to do this so if you go here into your mad command window you can type SS C new to open up sim scape it actually opens up within simulating Simulink because it's just a derivative application of it and we're starting here with about five different blocks we have our solver block a signal to physical system converter a physical system to signal a scope and then this sim escape library button the first thing you're going to want to do is open the sim scape library and I'm going to drag that over here to the side of the screen and open up the foundation library and this gives us a whole array of different components that we can select I'm gonna be talking solely about mechanical elements in this video so we have five different types of mechanical elements so first go over here to translational elements and this is our typical springs dampers masses grounds etc and so if we want to make a spring mass damper obviously we have to have a translational reference or a ground so I'm going to drag one of these over here into the window and I'm going to give it a clockwise rotation and we're going to position that right about there so now I want to import a damper if we're going to make a two-body spring mass system and we want to import a spring and then we'll do a mass for this okay so I'm just gonna copy the spring damper and mass over so I don't have to re-import them and go ahead and arrange this nicely it is pretty critical how you arrange the components as this will make a big difference when you go to kind of connect everything together it's a bit like wiring a circuit up in multi sim or a similar software so generally if you have multiple masses you want your springs and dampers kind of in parallel and then you want to have your masses sitting below and so when we go to wire this up you can just kind of go ahead and connect all your components and from this spring I'm going to go over here to the mass and from the damper I'm just going to connect straight to there as well and do this and then we'll go from this spring to this mass and like that so we have our spring mass damper system here the next thing I'm going to do is I'm going to assign values to all of these components so you can double click on a mass and I'm gonna give this a mass of I don't know five kilograms these values are just kind of arbitrary I'll go another five there and we'll give the springs a spring constant of maybe fifty and we'll do fifty years well here same thing for the dampers would do I don't know maybe three okay so we have values assigned to all of our components but there's nothing acting on the system and you know if we went ahead and run this we might get an error or nothing might happen but this isn't complete right now there's still more to be done so you have to take this solver block and you can connect it anywhere on the system but I typically like to connect it near my ground and then we have this simulate to physical system converter so we want to have a step input act upon our system but we can't just connect a step input to this mass and call it a day what we have to do is we have to go up here to mechanical and go to a mechanical source and select an ideal for source and drag down on over and I'm going to give it a clockwise rotation and you're going to connect the s here to the simulant to physical system block connect this C to the ground of your system your translational reference and connect our over here to this mass which is what we want this to act on so this is gonna take whatever our signal is and it's gonna create an ideal force out of it and it's gonna act it upon this mass so now let's go over here into the actual Simulink library and we'll select a step input from the sources menu so we can drag that on over yeah and connect that to the this block right here double-click your step input and set the step time to zero that way it acts as soon as the simulation starts so we can run it right now but we're not going to get anything outputted to our scope and so what I'm going to do is I'm going to move these blocks over here and we need to go to our sim scape mechanical library here and go to mechanical sensors and we're going to select the relational motion sensor this will allow us to look at the positions or velocities of our masses so we have four little outputs here we have our C V and P so we want to connect our to the mass this is basically what we want to look at where we want the position so I'm just gonna hook that right there connect see over here to our system ground and V and P stand for velocity and position in this scenario I think I'm more interested in the position of the 2nd mass so I'm just gonna connect that to my physical system simulant converter which is then going to take it out to a scope so to summarize our wiring here we have our translational reference to dampers two springs and two masses and then we have a step input that goes from a simulant to a physical system converter it's then passed through a four source which acts on the second s and then we have our translational motion sensor here which is sampling the position of the 2nd mass and it's sending that out to the scope and that's basically all we have so I'm going to go ahead and run this and then we can open up our scope and see the results scope windows a little small so I'm going to make it just a little bit bigger that make it bigger on this side as well okay so we can see there's a lot of oscillation in this system maybe the damping is not quite as high as we like or something like that but we can fix that what I'm gonna do is I'm gonna go here to our dampers and maybe we'll set those to about 5 and we can go ahead and rerun this you can also change the default simulation time as you see here the simulation was run for 10 seconds so we can go up here to this block and I'm going to type in 20 if we want to run it for about 20 seconds and I'll press run again and you can see that the system is almost damped out in 20 seconds and here's our position response so anyways I hope this was a helpful video and how to use sim scape to simulate spring mass damper systems and if you have any questions please leave them in the comments and we'll catch you next time
Info
Channel: Ironpine
Views: 13,675
Rating: 4.98 out of 5
Keywords: MATLAB, Simulink, Simscape, Vibrations, Dynamic Systems, Spring, Damper, Multibody Spring Mass Damper
Id: B1TD_huqeBY
Channel Id: undefined
Length: 8min 31sec (511 seconds)
Published: Sun Dec 15 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.