How to include a big constant matrix when using PLC Coder for TwinCAT 3?

2 visualizaciones (últimos 30 días)
Hi everyone,
I created a Matlab function block in Simulink which I want to export as XML Open file to use it in TwinCAT 3.
The function block needs a quite big precalculated matrix (100000x10 double) as a sort of lookup-table so it somehow needs to be included as a parameter/input variable.
Unfortunately the matrix seems to be too big to do so. When generating the code via the PLC Coder, I get errors like 'Not enough Java memory to construct Java arguments.'
I already tried
-to include it as parameter
-to include it as data store memory
-to include it as a constant input block in a subsystem
-to import the variable in the code from a .mat file via the load function
But nothing of this works. Does anybody have a good idea how to do it?
I need to access the full matrix so I guess the 'from file block' does not work here as it only reads one line per time step.
Alternatively, is there an easy way to load the full matrix into the TwinCat system and use it as an input for the generated PLC Code?
Thank you very much!

Respuestas (1)

Sri Kapali
Sri Kapali el 19 de Feb. de 2021
Hello,
My understanding is that the issue is the MATLAB function block for which code will be generated requires a large matrix as an input to the function block and when you attach this large matrix you are getting errors during code generation. Could you answer these questions:
1.What version of MATLAB are you using and what version of Simulink PLC Coder?
2.Can you provide us with an example model and example pre-calculated matrix?

Categorías

Más información sobre Simulink PLC Coder en Help Center y File Exchange.

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by