I am currently working on a Simulink code for a school related project - the model itself is fairly extensive at this point and contains multiple feedback loops - it essentially consists of three coupled models, a single track vehicle model as well as tire model for the combined front and rear tires. When I ran the model after some extensive debugging, I received the following error message along with several additional error messages which point to algebraic loop errors in the vehicle model block:
Cannot solve algebraic loop involving 'Model Name' 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.
I have not found any direct feedback loops which could cause this error, but thought it might stem from the fact at the first timestep, the feedback loop has not been completed, and thus calculations in the vehicle model which rely on outputs from the tire model, for instance, cannot be computed yet.
Next, I added a unit delay block - when I place a unit delay block in one of the feedbacks the model runs, but the results are incorrect and not what I would expect. The system seems increasingly unstable as unit delays are added to the feedback loops. Furthermore, the results naturally depend on the location of the unit delay in the model. I figured the reason the results deviate from what I would expect is that you are essentially holding the input signal to a certain subsystem by onestep every timestep. Meaning that calculations in this model always essentially lag one iteration behind and could lead to unexpected results.
Is this the correct reasoning? Is there something else I might try instead of a unit delay? Any advice on how to proceed would be greatly appreciated.