Dynamic LUT in HDL coder
Show older comments
I am in the process of implementing a nonlinear model of a Permanent Magnet Synchronous Motor (PMSM). To make this model functional, I require 2D lookup tables. The Simulink simulation was successful and yielded the expected results. For the next phase, I intend to implement the model on an FPGA, and I plan to use HDL-Coder to convert my model into VHDL code.
However, I have encountered an issue in the final step of the HDL-Coder process. I wish to implement the model dynamically, similar to the approach described here: https://de.mathworks.com/help/simulink/slref/prelookup-external-breakpoint-spec.html. Specifically, I aim to load different flux maps into the model as an input. The error message that occurs is as follows:
"Failed For the block 'uz_pmsm_model_nonlinear_new/uz_pmsm_model_nonlinear_new/pmsm/q_current_LUT1' Lookup table specification of breakpoints 2 must be set to 'Dialog' for HDL code generation.
Error using slhdlcoder.HDLCoder/reporterrors
Lookup table specification of breakpoints 2 must be set to 'Dialog' for HDL code generation."
The error message is from a LUT with the input option enabled. If i modify my Modell to match the example i mentioned earlier with the Pre-Lookup, the "interpolation from Pre-Lookup" Block is not HDL supported.
Is there a Simulink workaround to implement this type of dynamic LUT in the HDL-Coder?
Accepted Answer
More Answers (1)
UDAYA PEDDIRAJU
on 27 Oct 2023
0 votes
Hello Philipp,
As per my understanding, it appears that you're trying to implement a dynamic Lookup Table (LUT) in HDL Coder for a nonlinear model of a Permanent Magnet Synchronous Motor (PMSM).
You've successfully simulated the model in Simulink, but you're encountering an issue during the final step of the HDL-Coder process.
Based on my observations, here are some suggestions:
- Lookup Table Breakpoints: The error message suggests that the breakpoint specification of your LUT needs to be set to 'Dialog' for HDL code generation. You might want to check the configuration of the LUT block and ensure that this setting is correctly configured.
- Unsupported Blocks: If certain blocks like "Interpolation from Pre-Lookup" are not supported by HDL, you might need to find alternative methods or blocks that perform a similar function and are supported by HDL.
- Dynamic LUT Implementation: Implementing a dynamic LUT in HDL Coder can be challenging. One possible workaround could be to use a “ROM (Read-Only Memory)” block instead of a LUT. The ROM block in Simulink supports HDL code generation and can be used to store precomputed constant values, like a LUT.
You can refer to the following documentation for more information: https://www.mathworks.com/help/simulink/slref/prelookup.html.
3 Comments
Philipp
on 15 Nov 2023
Fahad
on 28 Mar 2024
Hello Philipp,
I am also trying to implement 2D lut for PsiD , PsiQ maps based on Instantaneous values of ID, IQ. I have to mode it HIL system. The simscape model does not allow the n-d lut.
Were you able to solve the issue ? The link you posted in your intial message does not work.
Philipp
on 9 Apr 2024
Categories
Find more on Code Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!