help-octave
[Top][All Lists]

## Re: DAE solver with additional parameters

 From: Yu Liu Subject: Re: DAE solver with additional parameters Date: Wed, 2 Jul 2014 08:41:16 -0700

I am not sure if this help, but how about using ode package that is similar to Matlab's solver.

You can pass additional parameters directly in the ode45 function call. Additionally, differential algebraic equations could be solved by the same function by using 'Mass' option, if your problem can be written in a compatible format.

On Tue, Jul 1, 2014 at 10:00 PM, lordgogi wrote:

Hi,

I use Octave to simulate thermodynamic system. I have a set of DAE and solve
them with
dassl function. However I would like to pass additional parameters. Can
anyone help me with that? I also tried to use global variables but it does
not work either.

Thank you

Code:

x =
[A(1,12);A(1,11);A(1,3);A(1,5);A(1,10);eva_pressure_ini;0;-0;0;0;0;0.26;4];
xdot =
[7820.5;-0.053909;-0.83435;0.24349;0.53694;0.54863;8000;-3.867;0;4;0;0;0];
t = linspace(0,time_stop);
[x, xdot] = dassl("f", x, xdot, t);

/function res = f (x, xdot, t)
res (1) = xdot(9)+xdot(11)+xdot(7)-xdot(1);
res (2) = xdot(8)+xdot(10)-xdot(2);
res (3) = x(3)+x(4)+x(5)-x(2);
res (4) =
x(3)*XSteam('hL_p',x(6))+x(4)*XSteam('hV_p',x(6))+x(5)*XSteam('h_pT',x(6),450)-x(1);
res (5) = x(3)*XSteam('vL_p',x(6))+x(4)*XSteam('vV_p',x(6))-3;
res (6) = x(5)*XSteam('v_pT',x(6),450)-3;
res (7) = 8600-xdot(7);
res (8) =
-x(12)*sqrt(1.29*(2/(1.29+1))^((1.29+1)/(1.29-1)))*sqrt(x(6)/XSteam('v_pT',x(6),450))-xdot(8);
res (9) = xdot(8)*XSteam('h_pT',x(6),450)-xdot(9);
res (10) =x(13)-xdot(10);
res (11) = xdot(10)*XSteam('hL_p',x(6))-xdot(11);
res (12) = 0.00015*(x(6)-33)-xdot(12);
res (13) = 0.0005*(1596.7-x(3))-xdot(13);

--
View this message in context: http://octave.1599824.n4.nabble.com/DAE-solver-with-additional-parameters-tp4665151.html
Sent from the Octave - General mailing list archive at Nabble.com.

_______________________________________________
Help-octave mailing list