problem with trained model/unit delay

4 次查看(过去 30 天)
M.M
M.M 2022-6-3
回答: Yash 2024-1-10
Hello,
I trained three models using the regression learner MATLAB app and then exported the trained functions to Simulink. When I run the Simulink model below, I get the following error:
error:
"Cannot solve algebraic loop because it consists of blocks that cannot be assigned algebraic variables, such as blocks with discrete-valued outputs, blocks with non-double or complex outputs, Stateflow blocks, or nonvirtual subsystems. Consider breaking the algebraic loop. For example, add a delay or a memory block to the loop"
When I add unit delays as shown below, there is no error, but the trained models can not predict the desired response (while my model is validated by 90%). The unit delay appears to be the cause, as it alters the system from continues to a discrete and feeds the incorrect output as an input.
The red figure in the following picture represents the Simulink-trained model, while the blue one represents the desired output. As you can see, the red figure follows the blue one for around 0.5 seconds, but then it is weird!
I'd like to ask you about the issue I'm having with unit delay:
-Is there another technique to solve an algebraic loop?
Thank you in advance for your help
  3 个评论
M.M
M.M 2022-6-6
Thank you for responding.
I tried the Memory block, but got the same result as before.
Alex Alex
Alex Alex 2022-6-6
Try....treat as atomic unit in Block Parameters for MATLAB Function....no idea for more

请先登录,再进行评论。

回答(1 个)

Yash
Yash 2024-1-10
Hi,
Algebraic loops in Simulink occur when an output of a block or a set of blocks is required to compute its own input without any delay, which can lead to computational issues since Simulink needs to determine the values simultaneously. Breaking an algebraic loop often involves introducing some form of delay or memory to provide a dependent relationship between inputs and outputs. You mentioned that you tried using a Unit Delay block, but it alters the system from continues to a discrete and feeds the incorrect output as an input.
To solve this, you can use Transport Delay block, which can introduce a continuous delay to the signal without discretizing it. The Transport Delay block does not interpolate discrete signals. Instead, the block returns the discrete value at the required time. This block differs from the Unit Delay block, which delays and holds the output on sample hits only.
To know about the Transport Delay block, refer to its documentation here: https://in.mathworks.com/help/simulink/slref/transportdelay.html
Hope this helps

Community Treasure Hunt

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

Start Hunting!

Translated by