Manual Switch management for Simscape simulation
9 次查看(过去 30 天)
显示 更早的评论
I'm using Manual Switches in a Simscape simulation with Simulink Desktop Real-Time to change a valve states (close <-> open). In doing this I'm encountering to different inconvenient:
- I'm feeding a derivative state block, the valve, with a non-continuous signal generated by the manual switch
- Every time I stop the simulation, I need to reset the state of the manual switches since they remain in the last position
First issue: since the manual switch will be replaced by signal coming from PLC that is non continuous as well, I need something to put in the middle between the valve and the non-continuous signal to manage this discontinuity (if it exists).
Second issue: I thought to use the "setparam" function but there are a lot of manual switches, so I want to ask if there is a faster way.
0 个评论
回答(1 个)
Jan Houska
2023-7-29
Hi,
for the first issue, if the discontinuity is the problem, a simple first-order delay should do the trick. However, feeding discontinuities into the input of derivatives may also mean that you have oversimplified your model and there's some dynamic behavior that you may have neglected. This is difficult to say without actually seeing the model.
For the second issue, an alternative way would be just to close the model without saving it, then re-open it. This probably won't be faster than set_param but can be simpler. However, I'd probably still prefer finding the manual switches by find_system and then using set_param to set their values.
Good Luck, Jan
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Target Computer Setup 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!