Signal Routing in Simscape
50 ビュー (過去 30 日間)
古いコメントを表示
I'm not very familiar with SimScape, but I need to do some signal routing.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1754319/image.png)
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
2024 年 8 月 20 日 14:00
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.
回答 (3 件)
praguna manvi
2024 年 8 月 20 日 5:41
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 件のコメント
Pramil
2024 年 8 月 20 日 8:21
編集済み: Pramil
2024 年 8 月 20 日 8:22
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1756044/image.png)
Regards Pramil
2 件のコメント
Pramil
2024 年 8 月 21 日 4:37
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
Yifeng Tang
2024 年 8 月 20 日 17:28
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1756504/image.png)
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1756509/image.png)
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1756514/image.png)
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.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!