Simulink develop TestCase

01--Background

Hey, my friends

I am writing the blog in English so that I can improve my working language skills, so it might have lots of mistake like grammar and spell or something else. Please feel free to ignore the issues. For it's my first time writing like this , I am not sure if I can express myself clearly.

02--Test case condition

The condition you can see below the table:

The total capacity of the small battery is 10 Ah. 1C(Coulomb) on discharging.

Simulink develop TestCase_第1张图片

There has to be a 30 seconds pause after each charge and discharge.

Take the first raw as an example to explan:

The initial value of the small battery's SOC is 90%, the temperature is -30℃, and  at the moment, the battery need to discharge with a constant value 10A, when the discharge capacity reaches 5Ah, then the MOS or relay state must change from discharge to charge. And the charge current is 20A until the SOC reaches 90%. All the above procedure is treat as the number 1 cycle, the total cycles is 2 cycles.

And in the other rows, temperature is different,works on the same way. Base on the situation so that the module is able to be developed.

03--SW develop

1--Single temperature value

In order to develop the module,first of all, because of the temperatures are not continuous value, and other parameters change too. We can consider to use stateflow module to make a quick development.

As we had mentioned before,take the first raw as example:

(The charge is represented by a negative number)

Simulink develop TestCase_第2张图片

Calibration parameters:

This one stateflow means in the temperature of -30℃,

Reset:use for the cycle number counts,when the total cycles reaches 2,the cycle counts will reset to the value 0.

State: 0 means in the discharge state, 1 means in the charge state.

Charge_I: charge current in the charge state.

Dis_Ah: discharge capacity in 1 cycle

DisChargeAh: constant value 10

RestTime: because of the phrase “There has to be a 30 seconds pause after each charge and discharge.”,so it's constant value 30

SOC_THD: current percentage of SOC

Cycle: the repeat number of cycles

T: temperature

2--Multiple temperature values

The stateflow can in the same way to copy with different temperatures:

Simulink develop TestCase_第3张图片

And here are the interface of the stateflow:

Simulink develop TestCase_第4张图片

3--Current select function

The function generates the value of current

Outside view:

Simulink develop TestCase_第5张图片

Inside:

Simulink develop TestCase_第6张图片

The value of current is impact by the State if it's on charge state or discharge state.

4--SOC calculate function

Outside view:

Simulink develop TestCase_第7张图片

Inside:

Simulink develop TestCase_第8张图片

We use the simplest way to calculate the percentage of SOC.

                      SOC = init_SOC - current*time/capacity

init_SOC: the initial value of SOC

DT: the module sample time

5--Total discharge capacity function

We can calclate the whole discharge capacity

Outside view:

Simulink develop TestCase_第9张图片

Inside:

Simulink develop TestCase_第10张图片

We use a Switch module to ignore the charge current, when in the charge state, the total discharge capacity will not be accumulated.

5.1discharge capacity in every cycle:

Outside view:

Simulink develop TestCase_第11张图片

Inside:

Simulink develop TestCase_第12张图片

In one cycle the discharge capacity will accumulate by one to one sample time,but in the next cycle, the capacity will reset to value 0.

6--TotalCycle Counter function

Outside view:

Inside:

Simulink develop TestCase_第13张图片

6.1--Cycle Counter function

Outside view:

Simulink develop TestCase_第14张图片

Inside:

Simulink develop TestCase_第15张图片

7--Overview

Simulink develop TestCase_第16张图片

Simulink develop TestCase_第17张图片

According to the table, we can calculate the total discharge capacity in all the cycles and temperatures.

discharge_ah_stop_simu = (2+5+8+10+5+4+3+2+5+8+6+7+9+4)*5 = 390

We set the value to 390.1, when the capacity reached, the simulation will stop.

Simulink develop TestCase_第18张图片

8--Oscilloscope result

Simulink develop TestCase_第19张图片

The temperature and current is synchronously changing

The total discharge capacity is 390

Total cycles are 78

Simulink develop TestCase_第20张图片

Cycle Counter function

Simulink develop TestCase_第21张图片

Current select function

The details you can see the attachment of the simulink module.

你可能感兴趣的:(Simulink,Matlab)