Code Generation and Process-in-the-Loop Deployment for PV and Battery Control on LAUNCHXL-F28379D Using SolarPVDCW​ithBattery​Example

23 views (last 30 days)
Hello everyone,
I am currently working with the following MathWorks example:
openExample('simscapeelectrical/SolarPVDCWithBatteryExample')
My goal is to implement the PV control, MPPT algorithm, battery management, and converter mode control on a Texas Instruments LAUNCHXL-F28379D using PIL or full code generation with Embedded Coder.
However, I am facing a major issue:
the model is not compatible with C code generation, because it uses Simscape Electrical / Specialized Technology blocks. This prevents me from simulating and deploying the controller directly to the C2000 hardware.
I would like to ask for guidance on the following:
  1. Is there any official MathWorks example that uses a C2000 LaunchPad (especially LAUNCHXL-F28379D) together with a PV/battery model, where the plant is simulated in Simscape but the controller is deployed to the hardware?
  2. If not, is there an equivalent example without Simscape, but that still includes the same functional components such as:
  • PV array model
  • DC/DC converter with MPPT (preferably Perturb & Observe)
  • DC bus
  • Bidirectional converter with battery
  • MPPT controller
  • Irradiance profile or irradiance simulator
  1. Additionally, is there a recommended workflow or example for splitting plant and controller, where:
  • the plant runs in Simscape on the host computer, and
  • the controller (PV control, battery management, mode control) is implemented on the LAUNCHXL-F28379D using a code-generation-compatible model?
In summary, I am using the Solar PV DC with Battery example, and I want to port only the controller portion (MPPT, battery converter control, and mode control) to the LAUNCHXL-F28379D for PIL or hardware deployment, while keeping the full Simscape model for host-based simulation.
Any documentation, references, or examples on how to properly achieve this integration would be greatly appreciated.
Thank you!

Answers (1)

Ayush
Ayush on 16 Dec 2025 at 5:43
Hello Miguel,
I understand you are looking for relevant resources to help you with deploying the controller (MPPT, battery management, etc.) to the LAUNCHXL-F28379D while simulating the plant in Simulink.
You can refer these relevant document:
  1. https://www.mathworks.com/help/ti-c2000/ug/photovoltaic-solar-example.html : This example shows how to separate the controller and plant, generate code for TI C2000 hardware, and run plant simulations in Simulink.
  2. https://www.mathworks.com/matlabcentral/fileexchange/164226-model-based-design-for-solar-power-control-with-ti-hardware/ : This community example provides a practical implementation of PV control (including MPPT) with code generation and deployment to C2000 LaunchPad boards.
Both resources demonstrate the recommended workflow for your use case. You can use these as templates for your own project.
Hope this helps!
  1 Comment
Miguel Andres
Miguel Andres ongeveer 3 uur ago
Hello,
Thank you very much for the detailed reply and for sharing these resources.
Both references are very helpful and clearly align with the workflow I am aiming for (controller deployment on the LAUNCHXL-F28379D with the plant simulated in Simulink).
I will review the official C2000 photovoltaic example as well as the community Model-Based Design example and use them as a basis for adapting my PV, MPPT, and battery management control.
Thanks again for your support and guidance.
Best regards,
Miguel

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!