# How to simulate battery charge over time?

조회 수: 5 (최근 30일)
Max 2022년 6월 14일
답변: Javier Gazzarri 2023년 1월 20일
Hi! I am trying to make a model in simulink that simulates a battery electric vehicle. Basically, I have this data on household energy used from the grid and PV generation from a solar panel. This data covers an entire year.
0 300 250
60 269 300
120 280 310 ...
This data goes all the way up to 527040 seconds which is almost an entire year. In this model we are assuming the household has battery managment system where when the PV_generation is greater than the Load, then the power charges a battery which in turn charges a car.
My first question is how to implement this in simulink? There is a battery block but I can't figure out how to use it. If I was just coding normally I would just set up an if else statement but I am not sure how to do this in simulink. Is there an example online somewhere that I could base this off of?
My second question is if I wanted to charge the car at night, is there an easy way to convert or abstract time in hours from the model? I understand the when I set the model to simulate in 120 seconds it runs it over 120 seconds; but I need to run it over the course of a year and was wondering if there was an easy way to just say the car charges 10 kwH every night?
I am a beginner at simulink and would appreciate all the advice and help I could get. Thanks!

댓글을 달려면 로그인하십시오.

### 답변 (1개)

Javier Gazzarri 2023년 1월 20일
Hello Max,
The way I would implement your design is with a combination of Simscape Battery or Simscape Electrical (physical system) and Stateflow (state and temporal logic). With the Battery (Table-based) block from Simscape you design a circuit to combine the battery itself, the PV array, and the power converter. With Stateflow you set up the conditions for charge/discharge based on the logic you described above.
You can input the table into Stateflow, and the output will be the command to the converter that will determine the power flow.
Here are a few examples:
Please let me know how it goes.
Best regards,
Javier

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Power and Energy Systems에 대해 자세히 알아보기

R2022a

### Community Treasure Hunt

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

Start Hunting!

Translated by