Simulink MPC RTMaps Code Gen Issues

Hello,

We had some issues trying to code-gen the Simulink MPC block. The generated C++ files reference a few structs that aren’t defined anywhere in the code, and looking through the code and the model we’re not sure where the structs are coming from. The image below shows the issues and the model. The model was created by taking an MPC block (without any modifications) and adding inports/outports.

The MPC block can be code generated into C/C++, so we’re not sure why it runs into this issue when trying to code gen for RTMaps.
Any help would be greatly appreciated!

Hello @dparikh,

Thanks for reporting this.
I was able to reproduce this issue. It seems the structures are declared in the model description, but with a ‘Skip’ attribute that wasn’t taken into account on our code template. There was a similar issue with parameters that weren’t tunable.
It is now fixed with version 3.20.5 of the RTMaps Mathworks package, available on our update site (https://support.intempora.com/hc/en-us/articles/115001658369-RTMaps-Updater).
Please let us know if your component generated with this update works as expected.

Thanks!

1 Like

Sorry for the late response, we were testing this out with a few other customized MPC models on our team. They all convert perfectly now.

Thanks a lot for the quick response and help!

We faced another issue with an MPC controller just earlier, where it seem to not build due to some issues again,

Any help would be appreciated as this is quite a time-sensitive item for our team.
Thanks!

I have an idea for a fix, but I can’t reproduce this issue to confirm it works.
Can you test version 3.21.0.1 from our testing update site?
(https://dl.intempora.com/rtmaps_update_site_testing/archives/rtmaps_pck_rtmaps_mathworks_3.21.0.1_ubuntu2204_x86_64.zip)
You can add the testing update site to your Studio for more convenience:

If this version doesn’t solve it, what configuration on the MPC controller can be used to reproduce this issue?
Did this issue occurred only after updating the RTMaps TLC target to 3.21.0? Or is it reproducible with the previous version (3.20.5 or 3.20.4)?

Best regards,

Hey @max

I gave the new test upgrade a try, but it seems to fail as well, now due to some data conversion issues

This appears to be an issue on 3.21.0 on Ubuntu specifically, as the Windows counterpart builds fine. The previous version had issues with the MPC in general and so couldn’t be used.

I’m not sure how to share the MPC configurations with you as there are a few changes we’ve made on our side, but if there’s a way for me to provide you the necessary files I’d be happy to do that.

Thanks!

On another note, how can we revert back to 3.21.0 since it some of our other models are also not building on 3.21.0.1 when they were working on 3.21.0

Thanks!

You can switch to older version the same way you update to new versions. Just make sure the option for “show older versions” is enabled in the updater and then select 3.21.0 from the standard update site

1 Like

Thanks for your test!

From the compile error, it now seems to be caused by a file purely generated by Simulink (ACCMPC.cpp). The RTMaps TLC Target should only affect the generation of the files with the “maps_” prefix.

Can you try using a TLC from base Simulink (grt.tlc for example), and see if it compiles correctly? If you get the same error, the Matlab community should be able to help on Matlab Answers.
But if it compiles correctly then, I would need a Simulink model file (.mdl) to reproduce this. If you prefer to share it privately, feel free to send a private message on the forum or by email to maxime.beluguet@intempora.com.

Best regards,

Hey @max

I tried compiling it with both the grt.tlc and the ert.tlc (embedded coder) and both worked fine. I did this on the deployment computer (dSPACE’s Autera) directly, which runs Ubuntu 22.04.
Both methods run successfully and built binary outputs, although with the ERT our goal was to write an RTMaps wrapper around the generated code, which seemed to due to a missing symbol (there some chance this was because of a mistake in writing the wrapper). I can send those details if you’d like me to.

As for the MPC, version 3.21.0 of the RTMaps TLC still has the same error, and v 3.21.0.1 has those include problems still. I’ve emailed you the files and details on how to open them.

Thanks a lot for helping out with this!

Hey @dparikh

Interesting, so the error does come from our TLC.
If your issue with your RTMaps wrapper is blocking you, please let us know more details.

I haven’t received your email (maybe your email domain is filtered by our IT). Can you send it through a private message on the forum?

Best regards,