Manual Switch management for Simscape simulation
10 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Jan Houska
on 29 Jul 2023
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 Comments
See Also
Categories
Find more on Target Computer Setup 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!