How to access Simscape variables and intermediates via commandline while simulating
조회 수: 1 (최근 30일)
이전 댓글 표시
I want to simulate a big network with more than 100 simscape components. I'm building it with a routine, where the network is specified in a text script. For the network I need to specify some events, for example: When the battery SOC is lower than 10%, open the switch no. 12. And many more. I really don't care with what instance I am controlling these. Stateflow would be cool, but then I need to connect every single variable output with the stateflow chart, and thats going to be messy and not easy to program. Even if I would use FROM-TO function. I also thought to use one simscape component which is only there to run the events. But that's the same thing, lots of simulink lines.
So my question is: Can I use a MATLAB script where am able to access calculated variables and intermediates while simulating? I would use the set_param command to then send a 0 to the switch. Here is an example what network I'm talking about. Each Simscape component is embedded in a subsystem.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/719714/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/719714/image.png)
This is the inside of one of the subsystems:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/719719/image.png)
Thank you for answering!
댓글 수: 0
채택된 답변
Sabin
2023년 3월 18일
From R2023a it is possible to use the Probe block to access the same variables that you can see in the simulation data log.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Logging에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!