How to Set Initial Position for a Mass Block in Simscape?
16 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
José
el 26 de Mzo. de 2025
Respondida: Yifeng Tang
el 10 de Abr. de 2025
I am working on a mechanical translational system in Simscape, and I need to set an initial position for the Mass block. However, the Mass block only allows setting an initial velocity and force, not position.
I tried using an Ideal Motion Sensor to specify the initial position, but it does not contribute to the problem's resolution, so it does not work for setting the initial condition.
In my version of MATLAB:
- The "Ideal Translational Motion Actuator" does not appear in the Simscape library.
- The "State Targets" option is not available in the Solver Configuration block.
What is the correct way to set an initial position for the Mass block in Simscape when these options are unavailable?
Would using a high-stiffness spring temporarily be a valid workaround, or is there another recommended approach?
2 comentarios
Yifeng Tang
el 31 de Mzo. de 2025
I would be interested in learning more about your statement that you "need to set an initial position for the Mass block". Would you be able to provide more details and why you say that? Maybe we can find another way to approach the problem where the initial position of the mass isn't necessary. I suspect it's actually the position of some other component that you really needed.
Respuesta aceptada
Yifeng Tang
el 10 de Abr. de 2025
In the mechanical translational domain, the domain variables are the velocity and the force. In general, the displacement/position is calculated as
. And you are right, the initial position is required to get the position at any given time.

That said, the governing equation of certain components doesn't care about the position. For example, the mass, whose governing equation is
. Position is not explicitly involved here. And that's why there isn't an initial condition for position in this block.

In some other components, like a spring, position and its initial value do matter, since
, and you will have the option to specify the initial position, or more precisely the initial deformation of the spring.

As such, when you have a mass-spring-damper system, you will need an initial deformation of the spring and an initial velocity of the mass (which is the same as the initial velocity at one end of the spring and/or damper) to define the full set of the initial conditions. The "position" of the mass block, I would argue, isn't a realy thing until you measure it with respect to a point that you call "zero". In this case, it's natural to define the position as the distance between the current position and the neutral position of the spring, so we are really talking about the deformation of the spring.
I know this sounds a bit "philosophical", but what this means for Simscape modeling is simple: set the initial position in the spring deformation. If you do want to measure the position of the mass where zero is defined at the neutral position of the spring, attach a translational motion sensor to the mass and set the initial position to be the same as the initial deformation of the spring.
Hope this makes sense.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Foundation and Custom Domains en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!