Custom block libraries in Simulink: pre-compilation action
조회 수: 1 (최근 30일)
이전 댓글 표시
I have created a custom Simulink library (I was able to create libraries and sub-libraries and add them to the simulink library browser).
Problem statement: Let's say we drag and drop 4 blocks, A, B, C, and D from the library. Let us assume, for now, that any block could be connected to any other (i.e., their I/O behaviors are compatible with every other block). However, logically, I would like to ensure while building my Simulink model that the blocks are connected in the correct fashion: Input --> A --> B --> C --> D --> Output. If they are not, I want Simulink to immediately warn me -- right when I make a wrong connection (via a pop-up message/dialog box). I think this would qualify as "pre-compilation" behavior.
Is this possible at all? If yes, could anyone point me in the right direction?
Note: I have gotten Simulink to generate errors (for logical/order mismatch of individual MATLAB function blocks) post-compilation. So I am clearly seeking help for the pre-compilation case.
댓글 수: 0
답변 (1개)
Maximilian
2014년 7월 3일
I am not how to make simulink warn you but perhaps you could try writing a short script that will automatically connect the blocks for you in order (assuming their port names remain the same). You would use the add_line command: Add Line You could create a dummy subsystem that you would place in the system with your A,B,C and D blocks and when double clicked it could run the script to automatically connect all the blocks in the proper order. You would do this by making a mask on the subsystem and using the callbacks to run the script.
Hope this helps!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Subsystems에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!