Is it necessary to discretize control blocks before Run from Coder or Generating Code for CCS on C2000 Launchpad?

Hi gutovsk,

Hope you are doing well. Please see my comments below:

Now, I would like to run the control law in the … digital control method (?).

Code generation automatically handles the discretization of your continuous-time controller, so you do not need to maintain separate models for offline simulation and code generation. With the PLECS Target Support Packages (TSP), you can use a single model to both configure the MCU peripherals and run offline simulations.

The TSP includes peripheral models that accurately and efficiently represent peripheral behavior. This allows you to validate expected performance through offline simulation before generating code from the same model to program your MCU.

Other than that, I found this fixed post explaining […] example from the file in the mentioned post?

As described in the post, SIL can take two forms depending on the project requirements. For projects that plan to use code generation, the same model can be used for both offline simulation and MCU code generation, as mentioned above.

For projects that rely on hand-coded implementations, the post describes a method for integrating the manually developed algorithm into a PLECS simulation. If you are using code generation, you do not need to follow the steps described in the “SIL via C-Script” section.

I hope this helps clarify any confusion from the article.

In the end, what is not clear […] to the MCU/Launchpad framework?

With PLECS Code generation you can easily maintain your controller design in the continuous domain and let the tools handle the discretization for your. Additionally, with you can:

  • inspect the code that has been generated
  • run your offline simulation using the generated code
  • see this youtube playlist to get started with code generation

Finally, I would recommend going through our tutorials to quickly get up and running with code generation.

1 Like