# Simulate 1 hour SOC of the Generic Model Simscape Electrical Battery in 1 second

15 views (last 30 days)
Haad Yousaf on 23 Jul 2023
Commented: Haad Yousaf on 26 Jul 2023
I modeled a renewables microgrid with the generic simulink battery as a source, the system is modeled with a 1e-4 sample time and hourly load profile on a 1 second time interval.
What do I have to do to make the battery block SOC behave as if 1 second of the simulation time is 1 hour? So that it follows and matches the load profile where 1 second of simulation time is the hourly load.

Javier Gazzarri on 25 Jul 2023
In this case I would convert all units in all block parameters to hours instead of seconds. Depending on the case, it will be a multiplication or division by 3600. When you simulate the model, Simulink is going to interpret a unit time step as one hour as long as you are consistent in the choice of parameter units. The only non-SI unit I am seeing is the cell capacity, which is already in Ah, so you have to divide the capacity by 3600 as I had indicated above.
With these two modifications I believe you will be good to go.
Please let me know how it goes.
Javier
##### 3 CommentsShow 1 older commentHide 1 older comment
Javier Gazzarri on 26 Jul 2023
Correct - every parameter that has "time" on it should be scaled so that time is in hours. For example, a relaxation time which we typically set in seconds, should be set in hours.
You don't need to scale inputs or outputs. However please bear in mind that the integral of a power will be given in Wh as opposed to Joules, for example if you want to keep track of energy usage, because the unit of time is hours.
Javier
Haad Yousaf on 26 Jul 2023
Yes that makes sense.
Thank you for all your help!

### More Answers (2)

Javier Gazzarri on 23 Jul 2023
I am not sure I understand the 1sec = 1hour statement.
The battery capacity in the block is entered in Ah, so you need to discharge it for 1h at 1C rate to fully discharge it, irrespective of the model sampling rate. Simulink works in seconds by defult, so you can also replace the load input signal by scaling the time vector x 3600, but I am not 100% certain that this is what you are asking.
As a side note, please consider increasing the solver step size to make the simulation run faster if your system does not require the 1e-4sec for anything else. Typically for a battery simulation 0.1sec is OK.
Best regards,
Javier
Haad Yousaf on 24 Jul 2023
Hello Javier,
Thank you for your response.
I am modeling a Microgrid with renewable energy sources, one of which is a 200kWh battery. My hourly load profile is a signal builder which emulates a 1 hour load change at every 1 second simulation time as follows;
0s to 1s simulation time = 0:00 to 1:00am hourly load profile
1s to 2s simulation time = 1:00 to 2:00am hourly load profile etc
I am required to use 1e-4s sample time due to the presence of DC to DC converters and DC to AC inverter.
As you can see in the scope results below, where I have marked 24 hours of load profile (P_load) simulated (1 second simulation time being the change in hourly load), the Battery SOC decreases according to the simulation time which is 1 second, making a 24 hour load profile period discharging the battery by less than 0.5%.
That is why I wanted the battery to behave as if 1 second of simulation time is 1 hour, so that its SOC drops and matches the emulated load profile.

Javier Gazzarri on 24 Jul 2023
I see two options:
1- You can scale everything that is linear so that 1sec simulation = 1h real time. For the battery SOC, for example, you divide the capacity by 3600. The problem with this approach is that I am not certain that you'll be able to obtain good results for things like temperature increase.
2- Use your load profile as input by configuring Simulink as in the attached example. Please see what I did in Configuration Parameters -> Data Import/Export -> Input.
Javier
Haad Yousaf on 25 Jul 2023
As I am designing a basic energy management system, the only results I am concerned with are the battery SOC, current and voltage. The signal builder/editor provides the load profile.
I have attached my model and would greatly appreciate if you took a glance at it as it may help you understand the dynamics of my system.
In my attached model, it would be easier if I applied your first option and scaled the battery Ah capacity by dividing it by 3600. My question is if it would provide good results for the SOC i.e 1sec simulation = 1h real time SOC behaviour? And what other things would need to be scaled by dividing by 3600?
Again, I am very thankful for your time and help