Code Generated Component Over-running Specified Run Time

I’m working on processing LiDAR data using a deep learning algorithm in simulink. Before I sink too much time into its development I want to be sure the component works in RTMaps. I have generated the simulink model into an RTMaps component; however, when I run it in RTMaps and connect the output to a data viewer it seems to execute every 15 seconds when I specified the executionPeriod as 0.2 seconds. Are there any optimization solutions to a generated component over running the specified run time?

Hello,

Sorry for the late reply.
Is the executionMode set to “Periodic” or “Periodic Sampling While Post-processing”?
The first one does process the input every 0.2 seconds, even when no new data is available. The second one skips already processed data, so if your input period is higher, the actual execution period will match it.

Other than that, the generated component simply runs the Matlab generated step function, it is possible that it takes too long because it is too complex. You can test generating a standard C/C++ application using a Matlab TLC and compare the execution time.
It can be noted that the generated component only uses one thread. If your model has blocks that could be run in parallel, I would advise to divide them in separate models and generate a component for each “independent” block, and design the RTMaps diagram to match your original Simulink model. In RTMaps every component runs in a separate thread (except configured otherwise), so this can improve your execution time.

Please let me know if you have further questions,
Best regards,

This might be a somewhat related question (or might not be), but one of our components has a 10ms discrete solver in Matlab. It used to convert to 10ms equivalent RTMaps components, however recently (after a few changes) it’s been converting to run at 200 ms instead.
We’re not sure what the cause might be, as the FixedDiscreteSolver from Simulink is set to run at 0.01 sec (10ms). And all the blocks that have sample time properties are set to ‘Inherited’. How should we diagnose the issue?

Let me know if this deserves it’s own post and I’ll make one.

Thanks!

1 Like

Not positive, but it sounds like you moved to a referenced model. I’ve found that the config params default to 200ms when you make the switch for some reason. You should be able to open the given referenced model on its own and change the solver value the same like normal. Let me know if you’re experiencing something different

Hello @dparikh
There was a regression on the model step size in the code generation with RTMaps TLC version 2.7.0. Thanks for pointing it out.
Please update to version 2.7.1 (RTMaps Mathworks package 3.21.1), and try again. It should now use your set value instead of 200 ms.

Thanks!