Signal Routing in Simscape
22 views (last 30 days)
Show older comments
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 Comments
Yifeng Tang
on 20 Aug 2024
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.
Accepted Answer
Yifeng Tang
on 20 Aug 2024
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.
More Answers (2)
praguna manvi
on 20 Aug 2024
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.
0 Comments
Pramil
on 20 Aug 2024
Edited: Pramil
on 20 Aug 2024
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 Comments
Pramil
on 21 Aug 2024
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
See Also
Categories
Find more on Assembly in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!