help-octave
[Top][All Lists]

## DAE solver with additional parameters

 From: lordgogi Subject: DAE solver with additional parameters Date: Tue, 1 Jul 2014 22:00:56 -0700 (PDT)

```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: