Manual Switch management for Simscape simulation

조회 수: 7 (최근 30일)
VaL V6
VaL V6 2023년 7월 6일
답변: Jan Houska 2023년 7월 29일
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:
  1. I'm feeding a derivative state block, the valve, with a non-continuous signal generated by the manual switch
  2. 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.

답변 (1개)

Jan Houska
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

카테고리

Help CenterFile Exchange에서 Target Computer Setup에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by