Can you call Simulink models recursively?

조회 수: 9 (최근 30일)
Jan
Jan 2024년 11월 26일
댓글: Jan 2024년 11월 27일
Hi all,
I have a feeling that what I try to do can be done more elegantly. Please let me know if you think of a solution.
A digital-to-time converter (DTC) works as a string of unit-delay cells and a multiplexer that picks one of the intermediate points in the string to select a specific delay. An example is shown here, where the input square wave is delayed by multiples of 1 second (0, 1, 2, or 3 seconds). The index 2 selects the first delay output, thus 1 second delay, as it shows in the scope picture.
This is fine if one needs only a limited number of delay settings, but what if 100 are required? This brute force method of drawing the model can then take all day, and it is quite error-prone. Is there a way to make this easier (like nesting models, recursevly instantiating models, defining the delays as an array and connecting the inputs and outputs by name, etc.)?

채택된 답변

Michael
Michael 2024년 11월 26일
Hi Jan,
I am not sure if I understand you correctly. But maybe this could be a solution for your task?
  댓글 수: 1
Jan
Jan 2024년 11월 26일
Thanks Michael,
I wasn't aware that the d-input of the variable delay could be changed during the simulation.
In the actual system, the index changes from cycle to cycle of the input signal. So I sample it here on the falling edge of the input signal, which delays both rising and falling edges as expected. This is indeed a good solution. I am only interested in the rising edge, so the pulse-width modulation is of no concern.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Paul
Paul 2024년 11월 26일
Hi Jan,
I think the Tapped Delay block is exactly what you need.
  댓글 수: 1
Jan
Jan 2024년 11월 27일
Thanks Paul,
This is also a good solution. It took me a while to find out how to select the correct output signal from the bus, but this solution is indeed equivalent to the one I copied above, in response to @Michael's suggestion.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by