Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

Does PLECS have a matrix operation module? If so, can these modules be deployed to RT box2?

0 votes
35,633 views
I want to implement the recursive least square algorithm on PLECS, which requires matrix operation, but I can't find the block of matrix generation and operation. I hope to get a reply
asked Jul 27, 2022 by WANGJINYU_loner (19 points)

1 Answer

0 votes
If the matrix coefficients are constants, you can use the Gain block for multiplying an incoming vector signal with a matrix (the ‘Mulitplication’ parameter needs to be set to ‘Matrix (K*u)’).

PLECS does not support matrices as signal values, it only supports vectors, so therefore there is no C=A*B operation where A,B, and C are matrices.

If the coefficients are variable over time or you need to determine the product of two matrices, then you need to unwrap the matrix multiplication using Sum and Product blocks.

Another alternative is to implement matrix multiplication in a C-Script or DLL Block. The DLL Block is not supported when generating code for the RT Box, so therefore the C-Script block would be the best choice. You will also likely need to go this route if you require computations beyond basic operations like addition/multiplication.

A good reference for matrix operations in a C-Script is the "Multistep Model Predictive Control for NPC Inverter Driving an Induction Machine" demo model in the RT Box demo model library.
answered Jul 27, 2022 by Bryan Lieblick (1,853 points)
edited Jul 27, 2022 by Bryan Lieblick
...