I am facing a huge problem with real-time analysis of a PCS simulation. I want to simulate a power converter system, which can be used as a power converter. I have to do an accelerated simulation with a Battery. discharged into a resistor for example, I can simulate multiple times for a while in seconds and see the behavior of loading and unloading it, but the same did not happen when switched converters. To simulate 1h (3600s) for example, it would take a long time, so I can not see the discharge dynamics (SoC variation) of the battery, because if the simulation time is 1s what the battery sees is a current request that lasted 1 second only. How do I make this simulation "more real"?

Update (Showing my model)

Simulation Model

So my model consists in a bidirectional boost converter with a battery as a LVS. Into the subsystem "Controlador" within the "Controlador" block there are only 2 PI controllers and one PWM.

Then again describing my problem: If I just simulate the Battery pack with a controlled current source, I can simulate 21600 s (the equivalent of 6 hours) in just a few seconds in real life.

Take a look ate this simulation

12.8 V, 40 Ah, Lithium-Ion (LiFePO4) Battery Aging Model (1000 h Simulation)
This is a 1000h simulation that takes no more than a few seconds. So, what I'm trying to do is discharge this battery, and for that I need at least 3600s simulation, but in my model takes 3600s (more or a little bit less) in real life.

Ps.: The switching frequency is \$25kHz\$

  • \$\begingroup\$ Well, one answer is to get a better computer, but I imagine that isn't the answer you're looking for. \$\endgroup\$
    – Hearth
    May 12, 2018 at 1:25
  • \$\begingroup\$ It is not. The computer is not the problem, I use a Dell Server with Intel Xeon, 64Gb of RAM and nVidia Graphics Card. I need some tips or adjustments to do in Configuration parameters \$\endgroup\$
    – SrnLord
    May 12, 2018 at 1:38
  • \$\begingroup\$ What is the switching frequency of the converter? \$\endgroup\$
    – Hazem
    May 12, 2018 at 9:11
  • \$\begingroup\$ 25kHz is the switching frequency \$\endgroup\$
    – SrnLord
    May 12, 2018 at 12:22

2 Answers 2


What are you interested in?

Controller loop dynamics? You don't need to see more then a few hundreds of ms for that, just step the operating point conditions and do a series of short runs.

Battery charge/discharge curves, rip the DC-DC out and use something linear as a source or sink, much less painful.

Generally trying to sim two things that happen on vastly different timescales is always going to be painful compared to doing two separate simulations (One of them possibly repeated to sample meaningful numbers of operating points from the other one .

You could maybe try making the thing a multi rate system with the DC-DC running at a much higher sample rate then the battery model? Tends to be a bit of a pain, but it might help if for some reason you really need to model the whole thing.

  • \$\begingroup\$ +1 Absolutely right. 25 kHz is unnecessary in his case to study long term dynamics like battery aging. He can either go with lower switching frequency or as you have mentioned current source. \$\endgroup\$
    – Hazem
    May 14, 2018 at 4:29

As long as you didn't post your model, it is not possible to know what exactly your problem. However, here are some suggestions to make your simulation faster:

  1. Remove all unnecessary Scopes/To workspace blocks or any kind of blocks that save data. You can comment them (Ctrl+Shift+x) if you want to use them in future. But recording too much information slow down your simulation significantly. So you just record the data that is important.
  2. From Powergui block. Be sure that you are not over sampling your simulation. In other words, don't put sampling time unreasonably low (for example some people tend to put 1e-8 or even 1e-9 to capture fast dynamics in the simulation which is completely wrong). In your case, for example, switching frequency is \$25 kHz\$, which is equivalent to switching time of \$40 \mu s\$. So sampling time in range of \$ [4-10] \mu s\$ is fairly acceptable.
  3. Change the solver (Ctrl+E). Sometimes changing the solver speed up the simulation significantly. I am not sure which solver is the best for your case, but it worth to try.


It is all about sampling frequency. If you change the simulation type to discrete and simulation time to 1e-5 s in this simulation, it will also take long time. As @DanMills has mentioned in his answer, you have to know what you want from your simulation. If you want to study "converter/controller dynamics" then you don't need to run simulation for long time, few seconds are enough. If battery aging is important, then why to have very high switching frequency which lead to very low sampling time? You can simply reduce the switching frequency to (5 kHz) or less for example, i.e. sampling time 5e-5 s, which allows you to speed up your simulation more than 5 times without loosing the main goal of studying the battery dynamic. But obviously don't forget to change the converter parameters as the switching frequency is changed.

  • \$\begingroup\$ Hi @hazem , thanks for your answer. I updated the post with more information, can you take a look ? \$\endgroup\$
    – SrnLord
    May 13, 2018 at 23:11
  • \$\begingroup\$ @SrnLord updated. \$\endgroup\$
    – Hazem
    May 14, 2018 at 4:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.