|
|
Simulink Algebraic Loop Error Help
Hi All,
I am new to Simulink and have come across the same Simulink error several times and I don't know how to fix it. Basically I have created an Embedded Matlab function block in Simulink with the following code inside:
function newPsi =dynamics(curHead,ra1,maxTurnRate,TurnRate,cmdHeading,dt)
if (TurnRate>maxTurnRate)
ra=maxTurnRate;
elseif (TurnRate <(-1*maxTurnRate))
ra=-maxTurnRate;
else
ra=TurnRate;
end
if ((cmdHeading-curHead)<=0)
newPsi=cmdHeading;
else
newPsi=curHead+(((ra+ra1)/2)*dt);
end
All of the inputs are constant except for dt which is the time and curHead is a feeback loop from newPsi that has an IC block attached to it. Pretty simple code but I keep getting the same error: Simulink cannot solve the algebraic loop containing 'NICE4/Embedded MATLAB Function4' at time 0.02 using the TrustRegion-based algorithm due to one of the following reasons: the model is ill-defined i.e., the system equations do not have a solution; or the nonlinear equation solver failed to converge due to numerical issues.
I have no idea how fix the algebraic loop. Any help would be greatly appreciated.
Thanks,
Meagan
|
|
0
|
|
|
|
Reply
|
Meagan
|
10/13/2010 1:19:03 PM |
|
Make sure that you do not have a signal line going out and then coming back
into the EML block you
created. If there is such a line then add a delay (z^-1) block.
mbelge
"Meagan " <meagan.musselman@l-3com.com> wrote in message
news:i94bk7$206$1@fred.mathworks.com...
> Hi All,
>
> I am new to Simulink and have come across the same Simulink error several
> times and I don't know how to fix it. Basically I have created an Embedded
> Matlab function block in Simulink with the following code inside:
>
>
> function newPsi =dynamics(curHead,ra1,maxTurnRate,TurnRate,cmdHeading,dt)
> if (TurnRate>maxTurnRate)
> ra=maxTurnRate;
> elseif (TurnRate <(-1*maxTurnRate))
> ra=-maxTurnRate;
> else
> ra=TurnRate;
> end
>
> if ((cmdHeading-curHead)<=0) newPsi=cmdHeading;
> else newPsi=curHead+(((ra+ra1)/2)*dt);
> end
>
>
> All of the inputs are constant except for dt which is the time and curHead
> is a feeback loop from newPsi that has an IC block attached to it. Pretty
> simple code but I keep getting the same error: Simulink cannot solve the
> algebraic loop containing 'NICE4/Embedded MATLAB Function4' at time 0.02
> using the TrustRegion-based algorithm due to one of the following reasons:
> the model is ill-defined i.e., the system equations do not have a
> solution; or the nonlinear equation solver failed to converge due to
> numerical issues.
>
> I have no idea how fix the algebraic loop. Any help would be greatly
> appreciated.
>
> Thanks,
> Meagan
>
|
|
0
|
|
|
|
Reply
|
news
|
10/13/2010 1:48:46 PM
|
|
|
1 Replies
629 Views
(page loaded in 0.034 seconds)
|
|
|
|
|
|
|
|
|