Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

steady state-non linear system(problem with start values of variables)

steady state-non linear system(problem with start values of variables)

Hi all,
I'm trying to solve a steady state problem which i intend to change to dynamic model later with steady state conditions as initial conditions.
To get the steady state values i have all the equations required. But there seems to be an issue in solving non linear system. (Matrix singular). can anyone help?
Below is the test code.

Code:


model test
parameter Integer N = 3, NOC = 2, P0 = 130325, FT = 2;
parameter Real F[N]={0,100,0}, z[NOC,N]=[0,0.5,0;0,0.5,0], R = 6, D=40;
Real B,L[N], V[N], y[NOC, N], x[NOC, N]/*(each start = 0.5,each min =0)*/, p[N], T[N](each start =350, each nominal= 1), pi[NOC,N],L0;
Real Qc,Qb,Hif[NOC,N],HiL[NOC,N],HiV[NOC,N],H0L[NOC];


equation
F[FT]=D+B;
F[FT]*sum(Hif[:,FT].*z[:,FT])+Qb=Qc+D*sum(H0L[:].*y[:,1])+B*sum(HiL[:,N].*x[:,N]);

for j in 1:N loop
sum(y[:,j])=1;
sum(x[:,j])=1;
p[j]=P0+690*j;
y[:,j]=pi[:,j].*x[:,j]/p[j];
pi[1,j]=10*T[j]+100/T[j] + T[j]^2;
pi[2,j]=20*T[j]+10/T[j] + T[j]^2;
HiV[1,j]=40*(T[j]-298)+4000;
HiV[2,j]=60*(T[j]-298)+8000;
HiL[1,j]=40*(T[j]-298);
HiL[2,j]=60*(T[j]-298);
Hif[1,j]=40*(398-298);
Hif[2,j]=60*(T[j]-298);

end for; 

L0=R*D;
V[1]=D+L0;
V[1].*y[:,1] + L[1].*x[:,1]=L0.*y[:,1] + V[2].*y[:,2];
Qc=V[1]*sum(HiV[:,1].*y[:,1])-V[1]*sum(H0L[:].*y[:,1]);
H0L[1]=40*(305-298);
H0L[2]=60*(305-298);


V[N]+L[N] = L[N-1];
L[N]=B;
Qb= V[N]*sum(HiV[:,N].*y[:,N])+ B*sum(HiL[:,N].*x[:,N])-L[N-1]*sum(HiL[:,N-1].*x[:,N-1]) ;


for j in 2:N-1 loop
L[j-1].*x[:,j-1] + V[j+1].*y[:,j+1] + F[j].*z[:,j] = L[j].*x[:,j] + V[j].*y[:,j]+F[j].*z[:,j];
L[j-1]*sum(HiL[:,j-1].*x[:,j-1]) + V[j+1]*sum(HiV[:,j+1].*y[:,j+1]) + F[j]*sum(Hif[:,j].*z[:,j]) = L[j]*sum(HiL[:,j].*x[:,j]) + V[j]*sum(HiV[:,j].*y[:,j]);
end for;
end test;

There are 0 guests and 0 other users also viewing this topic
You are here: