- Add PS-simulink converter right before the mux and simulink-PS converter after the variable selector (as I did in the figure above).
- Replace your PS sources with simulink sources and only use a simulink-PS converter after the variable selector.
How do i switch between sources in a Simulink (Simscape) model acroding to a Workspace variable?
조회 수: 2 (최근 30일)
이전 댓글 표시
I have a simscape simulink model, as shown in the picture:
I would like a specific run of the simulation to switch between the 4 possible signal sources acording to a Workspace variable WS. In other words, if WS=1 when the simulation runs, i would want the step signal to be the source. If WS=2 i would like the slope to be the sourse etc.
I saw some similar question and answers, but still havn't figured it out. Any help?
Thanks!
댓글 수: 0
채택된 답변
Romain
2024년 7월 11일
편집: Romain
2024년 7월 11일
Hi Aharon,
Here is how I would do it with Simulink signals, using a 4 input mux and a variable selector:
Specify selector mode as 'variable' to have the 'Idx' input of the variable selector, then connect your 'WS' constant block to the 'Idx' input. Variable selector and mux may not work with physical signal, so you can either:
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Variable Initialization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!