How to simulate a limit switch in SIMULINK?
18 ビュー (過去 30 日間)
古いコメントを表示
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!
0 件のコメント
採用された回答
Peter O
2021 年 8 月 14 日
Try something like this. It's a little quickly done, so I'm sure there's room for optimization or elegance, but this works.
You need to track the velocity or direction command as a state in addition to the position. Pass the current one through if it's not outside of the upper or lower limit, and set the up/down direction if it passes it.
Take a look at the backlash (hysteresis) block too. It may not be useful here, but it's helpful to model things like stiction, which you might need if you're working with a hydraulic cylinder.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Upgrading Hydraulic Models to Use Isothermal Liquid Blocks についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!