Matrix operations and initial conditions

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Submitted by danilo.llano on Tue, 05/15/2012 - 19:10 

Hello everybody, I have a problem and I will be very grateful if somebody can help me...

I'm using VISSIM to implement on a DSP a recursive algorithm for estimation (matricial operations principally) . My problem is that I need to set up initial conditions to start the algorithm and then use the last results for the next estimation but I don't know how to do it with VISSIM (the algorithm wil be implemented on a DSP by Texas Instruments, F2808). I was thinking in using the block merge, but I don't figure out which signal can I use for the boolean condition. This signal has to set up the initial conditions every time the algorithm starts. Any idea???

Thanks a lot for the help

Best regards, Danilo

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by pete on Tue, 05/15/2012 - 23:45.

    Hi Danilo, Normally if you are using recursion you will want to use the clocked delay (1/Z) block. It takes a matrix input and accepts a matrix as initial condition. You can use bracket notation for direct initialization (i.e. [1 2;3 4]) or use a variable that is defined as a matrix. No need for merge though if you did use a merge, use the built-in variable $firstPass as the selector.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by danilo.llano on Wed, 05/16/2012 - 03:44.

    Hello, thanks for the answer. I'm quite new in VISSIM so I don't know all possibilities and capabilities. To implement the built-in variable $firstPass I have to use a expression block or which block. Thanks for the answer.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by pete on Wed, 05/16/2012 - 03:52.

    Use a variable block. In the drop down you will find $firstPass, $lastPass, $timeStep etc.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by danilo.llano on Wed, 05/16/2012 - 06:09.

    Thanks a lot, now I got a new problem... When I play the simulation a message indicates that there is an algebraic loop.

    But it is on one sum and one multiplication which are part of my algorithm. Do you have any idea how to solve it? Sorry for bothering you

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by pete on Wed, 05/16/2012 - 08:55.

    You can't have a feedback loop unless it is broken by an integrator or unit delay (1/Z). The reason is that you need a fixed place to start calculating on each time step, and a place to hold the result for the next iteration.  Read more detail here

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by danilo.llano on Wed, 05/16/2012 - 19:13.

    Thanks again, I have seen before the document you suggested to me. But It is not really a feedback loop where I get the algebraic loop. It's in a matrix multiplication and in a matrix sum. But I don't get that problem in all the operations done, only in two ones. The other algebraic loop appears when I use the block vector to scalar, because I need to assign each entrance in a vector to individual variables.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by pete on Wed, 05/16/2012 - 19:29.

    Please attach diagram so we can make informed comment.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2020

    Submitted by danilo.llano on Wed, 05/16/2012 - 19:40.

    Thanks for the help

    Unable to find an attachment - read this blog

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2020

    Submitted by pete on Wed, 05/16/2012 - 20:08.

    The problem was that you had no delay inducing block between your calculation of Xk and Xk-1. I have added a 1/Z in the attached and now there is no complaint. Diagram is attached below (you must be signed in to see it and download it).

    Unable to find an attachment - read this blog