Info
This question is closed. Reopen it to edit or answer.
ODE 45 - ??? Error using ==> odearguments at 116
2 views (last 30 days)
Show older comments
hello! i have a big problem with a matlab file: I have to create a control pid of a passage section using a closed ring. the number one problem is that the trends are getting in step
but this first problem is of secondary importance.
the real problem is that the passage section is linked to a flow rate which in turn causes a change in a level. I must complement the level.
for now I wrote this:
close all
clear all
clc
global derivativo integrale errore tempo ORE
global erogata hh Acc hpp richiesta pp qq poterogata erogata1
global Ai eta hp0 rho g POTxintegrale PORxintegrale
H0=400; % Dislivello iniziale [m]
hp0=20; % Perdite [m]
eta=0.9; % Rendimento [adm]
rho=1000; % Densità H2O [kg/m^3]
g=9.81; % Accelerazione gravità [m/s^2]
qn=2; % Portata nominale bacino [m^3/s]
Ai=300000; % Area specchio d'acqua bacino [m^2]
Acmax=qn/(2*g*(H0-hp0))^(1/2); % Area condotto adduzione [m^2]
hp=20;
DatiA=xlsread('DatiNUOVO.xlsx');
potenzarichiesta_giorno=DatiA(1:24,4).*3600.*10^6; % potenza richiesta in J/h
ore_giorno=DatiA(1:24,3); % ore giornaliere
portatafiume=DatiA(:,2).*3600; % portata fiume in m^3/h
giornifiume=DatiA(:,1); % 180gg
potenzarichiesta6mesi=repmat(potenzarichiesta_giorno,180,1);% potenza richiesta in J/h
orefiume1=interp(giornifiume,24)';
orefiume=orefiume1.*24;
portatafiumeore=repmat(portatafiume,1,24)';
portatafiumeore=portatafiumeore(:)';
oreore=cell(1,180);
for i=1:180
oreore{i}=ore_giorno+(24*i-24);
end
ore6mesi=cat(1,oreore{:});
ORE=[0:0.1:4320];
POTENZArichiesta=interp1(ore6mesi,potenzarichiesta6mesi,ORE,'nearets','extrap');
PORTATAfiume=interp1(orefiume,portatafiumeore,ORE,'nearest','extrap');
for j=1:3
if j==1
W=H0;
else
W=sol(end);
end
POTxintegrale=POTENZArichiesta(j:j+1)';
PORxintegrale=PORTATAfiume(j:j+1)';
ORE1=ORE(j:j+1);
tout = linspace(ORE(j),ORE(j+1),10);
Tspan=[ORE(j):0.1:ORE(j+1)];
sol=ode45(@saltoNUOVO,tout,W);
but it does not work !!
1 Comment
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!