フィルターのクリア

Batterymodel, 20sec wait time after charging/discharging

1 回表示 (過去 30 日間)
Timo Röder
Timo Röder 2021 年 12 月 2 日
Hello,
I made a Simulink model that compares a BMS's (Battery Management System) C-Code against the Outputs of the Battery Block. I based the model on the "power_battery_aging model", available through that command. It has a cycle generator, that changes from charging to discharging at 100% SOC (State-of-Charge) and vice-versa at 0% SOC. Now I wanted to add a wait time of 20 seconds (in simulation time) between charging and discharging, with 0 current flowing. I have tried many different things like
t=Simtime;
if (Simtime < t+20)
...
end
but nothing worked.
Here is the default code:
function [ibatt, Status] = fcn(SOC, SOCmin, SOCmax, Idis, Icharge, PreviousStatus, Simtime)
%#codegen
%Status: 1 = Entladen; 0 = Laden
Status=PreviousStatus;
% 1 sec Idis & Icharge = 0
if (Simtime < 1)
Idis= 0;
Icharge = 0;
end
if(PreviousStatus==1 && SOC<=SOCmin) %if discharge and SOC <=SOCmin -> charge
Status=0;
end
if(PreviousStatus==0 && SOC>=SOCmax) %if charge and SOC >=SOCmax -> discharge
Status=1;
end
if (PreviousStatus==1)
ibatt=Idis;
else
ibatt=-Icharge;
end
Thanks very much for any help.

回答 (0 件)

カテゴリ

Help Center および File ExchangeSources についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by