Clear Filters
Clear Filters

Is there a easy possibility to create a mechanical switch in simscape? (parameter-based)

6 views (last 30 days)
Hello together,
I would like to include a mechanical switch in my simscape model to change the connected blocks easily.
More detailed: 1) one output
2) 2 possible inputs
3) select one ->100%; the other 0%
4) selection of the output through parameter or simulink block
5) would be enough, if it can be set before the simulation begins
Thanks for your answers.
Greetings Felix

Answers (1)

Pramil
Pramil on 27 Feb 2024
Hey Felix, well there is no such one block available in Simscape Mechanical that can achieve that but instead you can create a subsystem for the same using a “PS switch” block and sensors.
You can do the following:
  1. Create a subsystem which takes three mechanical signals and outputs a single mechanical signal (this will be similar to what the “switch” block does in Simulink).
  2. If the mechanical signal is position or velocity, you can use the Ideal Translational Motion Sensor block to convert it to a Physical Signal and pass the output to a “PS Switch” block.
  3. Configure the “PS Switch” block as you would configure a “switch” block in Simulink.
  4. Now pass the output of the “PS Switch” block to an “Ideal Translational Velocity Source” block to again convert the signal to a Mechanical Signal.
  5. Connect the output of the above to the outport of the subsystem.
Tip: You can create a mask for the configuration of the “PS Switch” block so that you do not have to open the subsystem for the configuration. You can know more about how to create mask from the following link:
I have attached an example Simscape model which works in both MATLAB R2021a and R2023b, where the velocity is selected depending upon the position of a mass attached to a damping spring.
You can check out more about “PS Switch” block from the following page:
hope it helps

Categories

Find more on Foundation and Custom Domains in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!