필터 지우기
필터 지우기

Iterative Simulink Model with Matlab Subsystems Feedback

조회 수: 3 (최근 30일)
gubertoli
gubertoli 2014년 6월 26일
답변: gubertoli 2014년 6월 27일
I created a model to calculate the power generated by solar cells given an area and I created a feedback between two Matlab Subsystem Blocks, like this:
Block 1 with the Inputs:
PowerRequired - A requirement to met
A and B - rectangle sides size
PowerAvail - Feedback from Other Block
Block 1 has the code:
function Area = Block1(PowerRequired,A,B,PowerAvail)
Area=A*B;
while (PowerRequired<PowerAvail)
Area=Area+0.01;
end
Block 2 Inputs:
Area - From Block1 (m²)
Irradiance - Solar available power (W/m²)
and Block 2 code:
function PowerCalculated = Block2(Area,Irradiance)
PowerCalculated=Area*eff*Irradiance;
The problem is when I start simulation, the while condition keep the Simulink in an eternal loop, without considering the feedback value in a continuous change. The ideal behavior would be the Block1 incrementing the Area until PowerCalculated>PowerRequired, but it seems to not change.
I don't know if I'm using the correct blocks for this purpose (which one will fit better?), but the problem is that the original simulink model has an extensive Matlab Code in both Subsystem Blocks, so I really want to implement this in the original blocks, I mean, if there is anyway to implement this feedback update by Matlab code will be the best dream.
Please, feel free to ask if I didn't sound clear, as I said, this is a simplified case to ilustrate what I'm facing in a model development.
Thanks.

채택된 답변

gubertoli
gubertoli 2014년 6월 27일
I transformed both blocks as "Atomic" and inserted a delay in the feedback signal and resolved the algebraic loop.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Schedule Model Components에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by