How to resolve "Out of memory" error?? please look into the following code
2 ビュー (過去 30 日間)
古いコメントを表示
clear all
clc
tspan = [0 2];
y01 = 0.1*ones(36,1);
y0 =[10 2.5 0 1 0.00025 0 0 0 0 (11.4*380/10000) -(5.5*380/10000) 380.8/380 0 (11.4*380/10000) (0.4*380/10000)...
10 2.5 (1.9e-3) 1 1 0 0 0 0 (11.4*380/10000) -(5.5*380/10000) 380.8/380 0 (11.4*380/10000) (0.4*380/10000)...
3.8*380/1000 0.4*380/10000 7.6*380/10000 1.6*380/10000 22.8*380/10000 0.8*380/10000];
options = odeset('RelTol',1e-4,'AbsTol',1e-6);
[t, y] = ode23tb(@sysMG2, tspan, y01, options);
save MGinitialcond.mat
function dydt = sysMG2(t, y)
i_dc1=y(1); v_dc1=y(2);delta1=y(3); P1=y(4); Q1=y(5); phi_d1=y(6); phi_q1=y(7); gamma_d1=y(8); gamma_q1=y(9);i_ld1=y(10);...
i_lq1=y(11); vo_d1=y(12); vo_q1=y(13); io_d1=y(14); io_q1=y(15);
i_dc2=y(16); v_dc2=y(17);delta2=y(18); P2=y(19); Q2=y(20); phi_d2=y(21); phi_q2=y(22); gamma_d2=y(23); gamma_q2=y(24);i_ld2=y(25); i_lq2=y(26); vo_d2=y(27); vo_q2=y(28); io_d2=y(29); io_q2=y(30);
i_lineD1=y(31);i_lineQ1=y(32);i_lineD2=y(33);i_lineQ2=y(34);
i_loadD1=y(35);i_loadQ1=y(36);
di_dc1dt=8790923519632281/8796093022208 - (9001905684103455*v_dc1)/9007199254740992 - (7201524547282765*i_dc1)/144115188075855872;
dv_dc1dt=(900970629561481*i_dc1)/4503599627370496 - (562949953421312*P1)/(2813966534836365*v_dc1);
ddelta1dt=200*pi;
dP1dt=(3141*io_d1*vo_d1)/100 - (3141*P1)/100 + (3141*io_q1*vo_q1)/100;
dQ1dt=(3141*io_q1*vo_d1)/100 - (3141*io_d1*vo_q1)/100 - (3141*Q1)/100;
dphi_d1dt=380 - vo_d1 - (13*Q1)/10000;
dphi_q1dt=-vo_q1;
dgamma_d1dt=(3*io_d1)/4 - i_ld1 - (4796153459164483*Q1)/73786976294838206464 + 390*phi_d1 - vo_d1/20 - (pi*vo_q1)/200 + 19;
dgamma_q1dt=(3*io_q1)/4 - i_lq1 + 390*phi_q1 - vo_q1/20 + (pi*vo_d1)/200;
di_ld1dt=(13300*v_dc1)/81 - vo_d1*((35*v_dc1)/81 + 20000/27) - (91*Q1*v_dc1)/162000 + (3200000*gamma_d1*v_dc1)/243 + (175*io_d1*v_dc1)/27 + (91000*phi_d1*v_dc1)/27 - i_lq1*((pi*v_dc1)/9 - 31367/100) - i_ld1*((700*v_dc1)/81 + 2000/27) - (7*pi*v_dc1*vo_q1)/162;
di_lq1dt=(3200000*gamma_q1*v_dc1)/243 - vo_q1*((35*v_dc1)/81 + 20000/27) + (175*io_q1*v_dc1)/27 + (91000*phi_q1*v_dc1)/27 + i_ld1*((pi*v_dc1)/9 - 31367/100) - i_lq1*((700*v_dc1)/81 + 2000/27) + (7*pi*v_dc1*vo_d1)/162;
dvo_d1dt=20000*i_ld1 - 20000*io_d1 + (31367*vo_q1)/100;
dvo_q1dt=20000*i_lq1 - 20000*io_q1 - (31367*vo_d1)/100;
dio_d1dt=(31367*io_q1)/100 + (20000*vo_d1)/7 - io_d1*((20000000*cos(delta1)^2)/7 + (20000000*sin(delta1)^2)/7 + 600/7) + (20000000*i_lineD1*cos(delta1))/7 + (20000000*i_lineQ1*sin(delta1))/7;
dio_q1dt=(20000*vo_q1)/7 - (31367*io_d1)/100 - io_q1*((20000000*cos(delta1)^2)/7 + (20000000*sin(delta1)^2)/7 + 600/7) + (20000000*i_lineQ1*cos(delta1))/7 - (20000000*i_lineD1*sin(delta1))/7;
di_dc2dt=8790923519632281/8796093022208 - (9001905684103455*v_dc2)/9007199254740992 - (7201524547282765*i_dc2)/144115188075855872;
dv_dc2dt=(900970629561481*i_dc2)/4503599627370496 - (562949953421312*P2)/(2813966534836365*v_dc2);
dde2ta1dt=(6935975771714791*P1)/73786976294838206464 - (6935975771714791*P2)/73786976294838206464 + 200*pi;
dP2dt=(3141*io_d2*vo_d2)/100 - (3141*P2)/100 + (3141*io_q2*vo_q2)/100;
dQ2dt=(3141*io_q2*vo_d2)/100 - (3141*io_d2*vo_q2)/100 - (3141*Q2)/100;
dphi_d2dt=380 - vo_d2 - (13*Q2)/10000;
dphi_q2dt=-vo_q2;
dgamma_d2dt=(3*io_d2)/4 - i_ld2 - (4796153459164483*Q2)/73786976294838206464 + 390*phi_d2 - vo_d2/20 - (pi*vo_q2)/200 + 19;
dgamma_q2dt=(3*io_q2)/4 - i_lq2 + 390*phi_q2 - vo_q2/20 + (pi*vo_d2)/200;
di_ld2dt=(13300*v_dc2)/81 - vo_d2*((35*v_dc2)/81 + 20000/27) - (91*Q2*v_dc2)/162000 + (3200000*gamma_d2*v_dc2)/243 + (175*io_d2*v_dc2)/27 + (91000*phi_d2*v_dc2)/27 - i_lq2*((pi*v_dc2)/9 - 31367/100) - i_ld2*((700*v_dc2)/81 + 2000/27) - (7*pi*v_dc2*vo_q2)/162;
di_lq2dt=(3200000*gamma_q2*v_dc2)/243 - vo_q2*((35*v_dc2)/81 + 20000/27) + (175*io_q2*v_dc2)/27 + (91000*phi_q2*v_dc2)/27 + i_ld2*((pi*v_dc2)/9 - 31367/100) - i_lq2*((700*v_dc2)/81 + 2000/27) + (7*pi*v_dc2*vo_d2)/162;
dvo_d2dt=20000*i_ld2 - 20000*io_d2 + (31367*vo_q2)/100;
dvo_q2dt=20000*i_lq2 - 20000*io_q2 - (31367*vo_d2)/100;
dio_d2dt=(31367*io_q2)/100 + (20000*vo_d2)/7 - io_d2*((20000000*cos(delta2)^2)/7 + (20000000*sin(delta2)^2)/7 + 600/7) + (20000000*i_lineD2*cos(delta2))/7 + (20000000*i_lineQ2*sin(delta2))/7;
dio_q2dt=(20000*vo_q2)/7 - (31367*io_d2)/100 - io_q2*((20000000*cos(delta2)^2)/7 + (20000000*sin(delta2)^2)/7 + 600/7) + (20000000*i_lineQ2*cos(delta2))/7 - (20000000*i_lineD2*sin(delta2))/7;
di_lineD1dt=(6746518852261009*i_lineD2)/2147483648 - (6748070551597029*i_lineD1)/2147483648 + (31367*i_lineQ1)/100 + (6746518852261009*io_d1*cos(delta1))/2147483648 - (6746518852261009*io_d2*cos(delta2))/2147483648 - (6746518852261009*io_q1*sin(delta1))/2147483648 + (6746518852261009*io_q2*sin(delta2))/2147483648;
di_lineQ1dt=(6746518852261009*i_lineQ2)/2147483648 - (6748070551597029*i_lineQ1)/2147483648 - (31367*i_lineD1)/100 + (6746518852261009*io_q1*cos(delta1))/2147483648 - (6746518852261009*io_q2*cos(delta2))/2147483648 + (6746518852261009*io_d1*sin(delta1))/2147483648 - (6746518852261009*io_d2*sin(delta2))/2147483648;
di_lineD2dt=(4652771622248973*i_lineD1)/8589934592 - (4652771622248973*i_loadD1)/8589934592 + (2325571576090593*i_lineD2)/4294967296 + (4652771622248973*i_lineQ1)/8589934592 + (31367*i_lineQ2)/100 - (4652771622248973*io_q1*cos(delta1))/8589934592 - (4652771622248973*io_d1*sin(delta1))/8589934592;
di_lineQ2dt=(4652771622248973*i_lineQ1)/8589934592 - (4652771622248973*i_loadQ1)/8589934592 - (31367*i_lineD2)/100 + (4651957387215079*i_lineQ2)/4294967296 - (4652771622248973*io_q2*cos(delta2))/8589934592 - (4652771622248973*io_d2*sin(delta2))/8589934592;
di_loadD1dt=1000000000000*i_lineD1 - (8396799999999999*i_loadD1)/8192 + 1000000000000*i_lineD2 + (31367*i_loadQ1)/100;
di_loadQ1dt=1000000000000*i_lineQ1 - (8396799999999999*i_loadQ1)/8192 - (31367*i_loadD1)/100 + 1000000000000*i_lineQ2;
dydt=[di_dc1dt;dv_dc1dt;ddelta1dt;dP1dt;dQ1dt;dphi_d1dt;dphi_q1dt;dgamma_d1dt;dgamma_q1dt;di_ld1dt;di_lq1dt;dvo_d1dt;dvo_q1dt;dio_d1dt;dio_q1dt;di_dc2dt;dv_dc2dt;dde2ta1dt;dP2dt;
dQ2dt;dphi_d2dt;dphi_q2dt;dgamma_d2dt;dgamma_q2dt;di_ld2dt;di_lq2dt;dvo_d2dt;dvo_q2dt;dio_d2dt;dio_q2dt;di_lineD1dt;di_lineQ1dt;di_lineD2dt;di_lineQ2dt;di_loadD1dt;di_loadQ1dt];
end
Error: -
Out of memory.
Error in ode23tb (line 680)
yout = [yout, zeros(neq,chunk)]; %#ok<AGROW>
Error in dydt_actual (line 9)
[t, y] = ode23tb(@sysMG2, tspan, y01, options);
採用された回答
Sam Chak
2024 年 9 月 4 日
From the simulation below, you can observe when the solutions begin to blow up. Do you really intend to log the unbounded, arbitrarily large values? If they are meaningful for your analysis, then you will need to increase the memory of your computer to store those values.
tend = [2e-11, 2e-6 2e-4];
y01 = 0.1*ones(36,1);
% y0 =[10 2.5 0 1 0.00025 0 0 0 0 (11.4*380/10000) -(5.5*380/10000) 380.8/380 0 (11.4*380/10000) (0.4*380/10000)...
% 10 2.5 (1.9e-3) 1 1 0 0 0 0 (11.4*380/10000) -(5.5*380/10000) 380.8/380 0 (11.4*380/10000) (0.4*380/10000)...
% 3.8*380/1000 0.4*380/10000 7.6*380/10000 1.6*380/10000 22.8*380/10000 0.8*380/10000];
options = odeset('RelTol', 1e-4, 'AbsTol', 1e-6);
for i = 1:length(tend)
[t, y] = ode23tb(@sysMG2, [0 tend(i)], y01, options);
figure(i)
plot(t, y), grid on, grid minor, xlabel('t'), xlim([0 tend(i)])
end
function dydt = sysMG2(t, y)
i_dc1 = y(1);
v_dc1 = y(2);
delta1 = y(3);
P1 = y(4);
Q1 = y(5);
phi_d1 = y(6);
phi_q1 = y(7);
gamma_d1 = y(8);
gamma_q1 = y(9);
i_ld1 = y(10);
i_lq1 = y(11);
vo_d1 = y(12);
vo_q1 = y(13);
io_d1 = y(14);
io_q1 = y(15);
i_dc2 = y(16);
v_dc2 = y(17);
delta2 = y(18);
P2 = y(19);
Q2 = y(20);
phi_d2 = y(21);
phi_q2 = y(22);
gamma_d2 = y(23);
gamma_q2 = y(24);
i_ld2 = y(25);
i_lq2 = y(26);
vo_d2 = y(27);
vo_q2 = y(28);
io_d2 = y(29);
io_q2 = y(30);
i_lineD1 = y(31);
i_lineQ1 = y(32);
i_lineD2 = y(33);
i_lineQ2 = y(34);
i_loadD1 = y(35);
i_loadQ1 = y(36);
di_dc1dt = 8790923519632281/8796093022208 - (9001905684103455*v_dc1)/9007199254740992 - (7201524547282765*i_dc1)/144115188075855872;
dv_dc1dt = (900970629561481*i_dc1)/4503599627370496 - (562949953421312*P1)/(2813966534836365*v_dc1);
ddelta1dt = 200*pi;
dP1dt = (3141*io_d1*vo_d1)/100 - (3141*P1)/100 + (3141*io_q1*vo_q1)/100;
dQ1dt = (3141*io_q1*vo_d1)/100 - (3141*io_d1*vo_q1)/100 - (3141*Q1)/100;
dphi_d1dt = 380 - vo_d1 - (13*Q1)/10000;
dphi_q1dt = -vo_q1;
dgamma_d1dt = (3*io_d1)/4 - i_ld1 - (4796153459164483*Q1)/73786976294838206464 + 390*phi_d1 - vo_d1/20 - (pi*vo_q1)/200 + 19;
dgamma_q1dt = (3*io_q1)/4 - i_lq1 + 390*phi_q1 - vo_q1/20 + (pi*vo_d1)/200;
di_ld1dt = (13300*v_dc1)/81 - vo_d1*((35*v_dc1)/81 + 20000/27) - (91*Q1*v_dc1)/162000 + (3200000*gamma_d1*v_dc1)/243 + (175*io_d1*v_dc1)/27 + (91000*phi_d1*v_dc1)/27 - i_lq1*((pi*v_dc1)/9 - 31367/100) - i_ld1*((700*v_dc1)/81 + 2000/27) - (7*pi*v_dc1*vo_q1)/162;
di_lq1dt = (3200000*gamma_q1*v_dc1)/243 - vo_q1*((35*v_dc1)/81 + 20000/27) + (175*io_q1*v_dc1)/27 + (91000*phi_q1*v_dc1)/27 + i_ld1*((pi*v_dc1)/9 - 31367/100) - i_lq1*((700*v_dc1)/81 + 2000/27) + (7*pi*v_dc1*vo_d1)/162;
dvo_d1dt = 20000*i_ld1 - 20000*io_d1 + (31367*vo_q1)/100;
dvo_q1dt = 20000*i_lq1 - 20000*io_q1 - (31367*vo_d1)/100;
dio_d1dt = (31367*io_q1)/100 + (20000*vo_d1)/7 - io_d1*((20000000*cos(delta1)^2)/7 + (20000000*sin(delta1)^2)/7 + 600/7) + (20000000*i_lineD1*cos(delta1))/7 + (20000000*i_lineQ1*sin(delta1))/7;
dio_q1dt = (20000*vo_q1)/7 - (31367*io_d1)/100 - io_q1*((20000000*cos(delta1)^2)/7 + (20000000*sin(delta1)^2)/7 + 600/7) + (20000000*i_lineQ1*cos(delta1))/7 - (20000000*i_lineD1*sin(delta1))/7;
di_dc2dt = 8790923519632281/8796093022208 - (9001905684103455*v_dc2)/9007199254740992 - (7201524547282765*i_dc2)/144115188075855872;
dv_dc2dt = (900970629561481*i_dc2)/4503599627370496 - (562949953421312*P2)/(2813966534836365*v_dc2);
dde2ta1dt = (6935975771714791*P1)/73786976294838206464 - (6935975771714791*P2)/73786976294838206464 + 200*pi;
dP2dt = (3141*io_d2*vo_d2)/100 - (3141*P2)/100 + (3141*io_q2*vo_q2)/100;
dQ2dt = (3141*io_q2*vo_d2)/100 - (3141*io_d2*vo_q2)/100 - (3141*Q2)/100;
dphi_d2dt = 380 - vo_d2 - (13*Q2)/10000;
dphi_q2dt = -vo_q2;
dgamma_d2dt = (3*io_d2)/4 - i_ld2 - (4796153459164483*Q2)/73786976294838206464 + 390*phi_d2 - vo_d2/20 - (pi*vo_q2)/200 + 19;
dgamma_q2dt = (3*io_q2)/4 - i_lq2 + 390*phi_q2 - vo_q2/20 + (pi*vo_d2)/200;
di_ld2dt = (13300*v_dc2)/81 - vo_d2*((35*v_dc2)/81 + 20000/27) - (91*Q2*v_dc2)/162000 + (3200000*gamma_d2*v_dc2)/243 + (175*io_d2*v_dc2)/27 + (91000*phi_d2*v_dc2)/27 - i_lq2*((pi*v_dc2)/9 - 31367/100) - i_ld2*((700*v_dc2)/81 + 2000/27) - (7*pi*v_dc2*vo_q2)/162;
di_lq2dt = (3200000*gamma_q2*v_dc2)/243 - vo_q2*((35*v_dc2)/81 + 20000/27) + (175*io_q2*v_dc2)/27 + (91000*phi_q2*v_dc2)/27 + i_ld2*((pi*v_dc2)/9 - 31367/100) - i_lq2*((700*v_dc2)/81 + 2000/27) + (7*pi*v_dc2*vo_d2)/162;
dvo_d2dt = 20000*i_ld2 - 20000*io_d2 + (31367*vo_q2)/100;
dvo_q2dt = 20000*i_lq2 - 20000*io_q2 - (31367*vo_d2)/100;
dio_d2dt = (31367*io_q2)/100 + (20000*vo_d2)/7 - io_d2*((20000000*cos(delta2)^2)/7 + (20000000*sin(delta2)^2)/7 + 600/7) + (20000000*i_lineD2*cos(delta2))/7 + (20000000*i_lineQ2*sin(delta2))/7;
dio_q2dt = (20000*vo_q2)/7 - (31367*io_d2)/100 - io_q2*((20000000*cos(delta2)^2)/7 + (20000000*sin(delta2)^2)/7 + 600/7) + (20000000*i_lineQ2*cos(delta2))/7 - (20000000*i_lineD2*sin(delta2))/7;
di_lineD1dt = (6746518852261009*i_lineD2)/2147483648 - (6748070551597029*i_lineD1)/2147483648 + (31367*i_lineQ1)/100 + (6746518852261009*io_d1*cos(delta1))/2147483648 - (6746518852261009*io_d2*cos(delta2))/2147483648 - (6746518852261009*io_q1*sin(delta1))/2147483648 + (6746518852261009*io_q2*sin(delta2))/2147483648;
di_lineQ1dt = (6746518852261009*i_lineQ2)/2147483648 - (6748070551597029*i_lineQ1)/2147483648 - (31367*i_lineD1)/100 + (6746518852261009*io_q1*cos(delta1))/2147483648 - (6746518852261009*io_q2*cos(delta2))/2147483648 + (6746518852261009*io_d1*sin(delta1))/2147483648 - (6746518852261009*io_d2*sin(delta2))/2147483648;
di_lineD2dt = (4652771622248973*i_lineD1)/8589934592 - (4652771622248973*i_loadD1)/8589934592 + (2325571576090593*i_lineD2)/4294967296 + (4652771622248973*i_lineQ1)/8589934592 + (31367*i_lineQ2)/100 - (4652771622248973*io_q1*cos(delta1))/8589934592 - (4652771622248973*io_d1*sin(delta1))/8589934592;
di_lineQ2dt = (4652771622248973*i_lineQ1)/8589934592 - (4652771622248973*i_loadQ1)/8589934592 - (31367*i_lineD2)/100 + (4651957387215079*i_lineQ2)/4294967296 - (4652771622248973*io_q2*cos(delta2))/8589934592 - (4652771622248973*io_d2*sin(delta2))/8589934592;
di_loadD1dt = 1000000000000*i_lineD1 - (8396799999999999*i_loadD1)/8192 + 1000000000000*i_lineD2 + (31367*i_loadQ1)/100;
di_loadQ1dt = 1000000000000*i_lineQ1 - (8396799999999999*i_loadQ1)/8192 - (31367*i_loadD1)/100 + 1000000000000*i_lineQ2;
dydt = [di_dc1dt;
dv_dc1dt;
ddelta1dt;
dP1dt;
dQ1dt;
dphi_d1dt;
dphi_q1dt;
dgamma_d1dt;
dgamma_q1dt;
di_ld1dt;
di_lq1dt;
dvo_d1dt;
dvo_q1dt;
dio_d1dt;
dio_q1dt;
di_dc2dt;
dv_dc2dt;
dde2ta1dt;
dP2dt;
dQ2dt;
dphi_d2dt;
dphi_q2dt;
dgamma_d2dt;
dgamma_q2dt;
di_ld2dt;
di_lq2dt;
dvo_d2dt;
dvo_q2dt;
dio_d2dt;
dio_q2dt;
di_lineD1dt;
di_lineQ1dt;
di_lineD2dt;
di_lineQ2dt;
di_loadD1dt;
di_loadQ1dt];
end
その他の回答 (1 件)
Walter Roberson
2024 年 8 月 30 日
If you use something like
tspan = linspace(0, 2, 1001);
then it should not run out of memory.
It is running out of memory trying to store the dy results of an oscillating function.
3 件のコメント
Walter Roberson
2024 年 9 月 3 日
I would experiment with something like tspan = [0 0.01] to get an idea of how the system reacts.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!