C2000 TI F2806x PIL simulation is working extremely slow

11 views (last 30 days)
I am simulating a feedback control strategy for power conveter, the model is simulated in discrete time with a sampling rate of 1e-6. The simulation for 1 sec is taking only 2 secs in standalone mode. However, which I use PIL block and run my controller on TI C2000 board it takes alot of time such as 5 hours, however the results are find. I wonder if there is any method to speed it up? I am running PIL simulations with a baud rate of 115200. If someone can suggest me the solution it will be very helpfull.

Accepted Answer

Antonin
Antonin on 21 Jun 2023
Hello Aqeel,
1MHz (or 1e-6 second of sample time) is pretty fast for the F28069. The fact that you are observing 2 seconds in standalone mode to run 1 second of realtime means that your standalone code is overunning. Our overrunning strategy skips the next hit of the scheduler so in this case you always see sample times being multiplied by integers.
For PIL, you have Simulink and Windows in the loop of every step of calculation. Increasing the baudrate will definitely help but won't be a magic solution as for every step of of the scheduler (1µs) Simulink issues a serial send to the Windows COM port, waits for one step to be processed on the F28069 and waits to receive a message back from the F28069 on the COM port.
Here is how to increase the baudrate:
Go to the Configuration Parameters of the model, under Hardware Implementation > Hardware board settings > Target Hardware Resources > SCI_A > Desried baudrate in bits/sec
You can use the max achievable baudrate which is 5.625e6, this will speed up PIL.
Now if your goal is to observe results while the code is running in realtime on the target, PIL may not be the best option.
In this example:
We are using a 2-model approach where the target model runs fast on the embedded processor and keeps sending data to the host. There is a companion model running on the host that streams the data so you can visual it in realtime
The example shows a DC/DC buck converter running at 200kHz, the host model can visualize every point at that rate using this 2-model approach.
I would also suggest to upgrade your board to F28379D which runs at 200MHz, this would help running your control loop at 1MHz.
This example also shows how ot offload the main processor to run code on the CLA, something that you can also do on the F28069.
I hope this helps, let us know othewrise.
Thanks,
Antonin.
  2 Comments
Aqeel
Aqeel on 25 Jun 2023
Hi Antonin,
Thank you so much for your detailed answer, it was really helpful to solve some issue. However, some constrants are still there as you also mentioned in your answer. Coming towards the other methods of PIL simulation, I am still confused with other methods, the example you suggested me use two hardware, i.e TI microcontroller and a boost converter. So he configured the simulation according to his hardware. I want to learn the method of creating host and target file and configuring the specific pins of the microcontroller. If you can share any thing in this regards it'll be very help full. Looking forward to hearing from you.
Antonin
Antonin on 28 Jun 2023
Hi Aqeel,
In the example I pointed to (https://www.mathworks.com/help/ti-c2000/ug/dc-dc-buck-converter.html), you can ignore the boosterPack inverter. What is interesting in this example is the 2-model approach. One model runs on the target in realtime and sends data via serial. Another model runs on the host PC and receives data from the target model. This technique allows you to monitor signals runnning at 200kHz (5µs). It doesn't matter if you don't have the boost converter, you can still use and learn about the host-target communication technique described in the example.
I hope it helps,
Thanks,
Antonin.

Sign in to comment.

More Answers (0)

Communities

More Answers in the  Power Electronics Control

Categories

Find more on Deployment, Integration, and Supported Hardware 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!