Signal Routing in Simscape

15 次查看(过去 30 天)
Paul
Paul 2024-8-16
评论: Paul 2024-8-26
I'm not very familiar with SimScape, but I need to do some signal routing.
Above, you're looking at two prismatic joints. My goal is to switch between prismatic joints based on another physical signal through time. This naturally lead me to the PC switch block, but it seems like it can only take three signals as an input. If this were Simulink, I would simply concatenate the signals and handle them as a vector, but I'm not sure that works in Simscape. Help would be appreciated!
  2 个评论
Yifeng Tang
Yifeng Tang 2024-8-20
Hi Paul,
Are you trying to switch viewing the signal from two different joints or to have the mechanism physically switch between use two different joints? The former is easy, but I suspect it's not what you intended (just to make sure). If it's the latter, I wonder why you wanted to do that.
Some description of the actual mechanism may help the community understand and answer your question. It's uncommon for an actual system to "switch" between joints/constraints, so I am curious what the purpose is here and what's different between the two prismatic joints.
Paul
Paul 2024-8-20
This is a good question!
I want the mechanism to switch between two different joints based on the relative displacement of the bodies. Think about a normal spring-mass-damper system, except place a stopper in it's path of motion. I've drawn a picture below.
When the mass m_m comes into contact with the stopper mass m_s, the two bodies will move together. As they move together, they move as one body, with a mass of m_s + m_b, a stiffness of k_m + k_s, and a damping of c_m + c_s.
I thought the easiest way to model this connection was to model this in simscape was with two prismatic joints that switch based on whether the above equation is satisfied. The first prismatic joint has a stiffness of k_m and a damping of c_m. This first joint becomes inactive when the masses contact, and the second one becomes active. The second prismatic joint has a stiffness of k_m + k_s and a damping of c_m + c_s, because the springs and dampers will be acting in parallel.
Does that make sense? TLDR; I want the stiffness and damping of my prismatic joint to change between two constant values dynamically throughout my simulation.

请先登录,再进行评论。

采纳的回答

Yifeng Tang
Yifeng Tang 2024-8-20
Hi Paul,
I think we can achieve what you envisioned not with a switch of joints but with a "hard-stop".
I created a 1D Simscape model to demonstrate the idea. A hard stop will transmit force only when the upper or lower limit is reached, i.e. when the two masses are close enough or far away enough. It can be used to model contact between two masses you showed in the picture.
When the parameters allow the two masses to "stick" to each other for a period of time, you may observe that the two masses have the same velocity when hardstop is near its limit (0.5m in this case). See the picture below from 0.1-0.6 seconds.
You can do something very similar in Multibody. Prismatic joint allows you to specify spring, damper, and hardstop. You can use one joint for each set of spring + mass, and another for the hardstop between two masses. So, three prismatic joints should do the same thing.
Why do you need this in Multibody though? Nice graphics? The physics and math will be very similar for this simple mechanism, regardless of the tool you use.

更多回答(2 个)

praguna manvi
praguna manvi 2024-8-20
Hi Paul,
As per my understanding, you are trying to switch between the outputs of a "Prismatic Joint" block using a control signal. This can be achieved by using a "PS-Simulink Converter" on each output signal. You can then concatenate these signals using a "Mux" block, route them through a “Switch” block and separate them using a "Demux" block for further processing.

Pramil
Pramil 2024-8-20
编辑:Pramil 2024-8-20
Hey Paul,
I had a similar query as well, as of R2024a there is a “Simscape Bus” block, but it cannot be used with “PS Switch” block as it takes only a single physical signal as input, not a bus.
There is a workaround though and that is to convert the signals from physical signal to Simulink signal through a "PS-Simulink" block and then use “Bus creator” block along with “Switch” block.
The output of the “Switch” block can be passed to “Bus Selector” block from which you can bifurcate the bundled signal into individual signals and if required use “Simulink-PS” block to convert them back into physical signals.
Regards Pramil
  2 个评论
Paul
Paul 2024-8-20
Hey Pramil, thanks for this response! It's really helpful.
I do have one question though - where are the follower frame outputs heading in your diagram? I want to switch which one is fed into the rest of my system based on my system state. Is there any type of "switch" block for frames?
Pramil
Pramil 2024-8-21
There is no switch block for frames but you can look in this MATLAB answer for alternative: https://www.mathworks.com/matlabcentral/answers/296879-simscape-body-frame-switch

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Assembly 的更多信息

标签

产品


版本

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by