필터 지우기
필터 지우기

Parameters (tables) must have the same size.

조회 수: 1 (최근 30일)
Jesús
Jesús 2023년 11월 15일
편집: Jesús 2023년 11월 15일
I got a Lithium Battery Cell from a MatLab command and I got the following error while compiling:
Parameters 'Temp_Table' and 'C_Table' must have the same size.
These tables are:
C_Table = {[18 19 20],'A*hr'}
Temp_Table = {[273.15 293.15 313.15],'K'}
The full code is:
component Em_table
% Em_table
% This block implements the cell's main branch voltage source, and determines
% values for capacity (C) and state of charge (SOC). The defining equations
% depend on cell temperature, T.
% Copyright 2012-2013 The MathWorks, Inc.
nodes
p = foundation.electrical.electrical; % +:left
n = foundation.electrical.electrical; % -:right
end
inputs
T = {293.15,'K'} % T:right
end
outputs
C = {20,'A*hr'} %C:left
SOC = {1,'1'} %SOC:left
end
parameters (Size=variable)
C_Table = {[18 19 20],'A*hr'} % Capacity values at specified temperature breakpoints
Em_Table = {3.8*ones(5,3),'V'} % Matrix of voltage values, Em(SOC,T)
SOC_Table = {[0;0.1;0.5;0.9;1],'1'} % State of charge (SOC) breakpoints
Temp_Table = {273.15 293.15 313.15,'K'} % Temperature (T) breakpoints
end
parameters
Qinit = {0,'A*hr'} % Initial charge deficit
end
variables(Access=private)
i = { 0, 'A' }; % Current
v = { 0, 'V' }; % Voltage
Qe = {0,'A*hr'}; % Charge deficit
end
function setup
% Check parameter values
if any(value(C_Table,'A*hr')<=0)
pm_error('simscape:GreaterThanZero','Capacity values at specified temperature breakpoints');
end
if any(any(value(Em_Table,'V')<=0))
pm_error('simscape:GreaterThanZero','Matrix of voltage values, Em(SOC,T)');
end
if any(value(SOC_Table,'1')<0)
pm_error('simscape:GreaterThanOrEqualToZero','State of charge (SOC) breakpoints');
end
if any(value(Temp_Table,'K')<0)
pm_error('simscape:GreaterThanOrEqualToZero','Temperature (T) breakpoints');
end
if value(Qinit,'A*hr')<0
pm_error('simscape:GreaterThanOrEqualToZero','Initial charge deficit');
end
% Set initial charge deficit
Qe = Qinit;
end
branches
i : p.i -> n.i;
end
equations
v == p.v - n.v;
% Charge deficit calculation, preventing SOC>1
if Qe<0 && i>0
Qe.der == 0;
else
Qe.der == -i;
end
% Perform the capacity table lookup
C == tablelookup(Temp_Table,C_Table,T,...
interpolation=linear,extrapolation=nearest)
% SOC Equation
SOC == 1 - Qe/C;
% Electrical equation by table lookup
v == tablelookup(SOC_Table,Temp_Table,Em_Table,SOC,T,...
interpolation=linear,extrapolation=nearest)
end
end

답변 (0개)

제품


릴리스

R2015a

Community Treasure Hunt

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

Start Hunting!