How to simulate a limit switch in SIMULINK?
Show older comments
Hi! I'm strugling to find a solution of my problem: i want to simulate a hydraulic model with a double acting hydraulic cylinder that changes the acting direction at a moment when the displacement of the rod reaches some value (for example 0.5 m) in a loop (see picture). I want it to check current displacement and return 1 if displacement is below 0.5 m and after it reaches 0.5 m i want to get -1. I tried to use "detect change" but unsuccessfully.
In general the problem i faced is inability to change the signal permanently. When i get -1 the rod goes back 1 step and than displacement is again < 0.5 m and the rod goes forward. And it happens in a loop.
I don't use "repeating sequence interpolated" because i will simulate the model with different speed of the rod but i want the direction of the action to be changed every time at the same moment.
You can find sample model in attachment. Thanks a lot!

Accepted Answer
More Answers (0)
Categories
Find more on Simscape Fluids 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!
