You need to add a +s to generate code. Else, you could use OMShell/OMNotebook as usual and call setDebugFlags("dumpdaelow").

http://build.openmodelica.org/Documentation/OpenModelica.Scripting.setDebugFlags.html

--
Martin Sjölund

On 2012-01-29 10:09 , aliko wrote:
Because I'm new to openmodelica I was writing the code in OMNotebook and
executed if with Shift+Enter.

I'm not familiar with compiler invoking methods. Now what I've done: I
saved the code to separate text file "pneumoprivod.mo" and have ran in
terminal command:

omc +d=dumpdaelow ./pneumoprivod.mo

In the output I see lines like
Real volume.p(start = 100000.0, fixed = true);
Real volume.V(start = 0.01, fixed = true) "Volume";

Full output is as follows:

class Actuator
Real source.fitting.G "Mass Flow";
Real source.fitting.p "Pressure";
Real source.p(fixed = true);
Real source.G;
Real orifice.fin.G "Mass Flow";
Real orifice.fin.p "Pressure";
Real orifice.fout.G "Mass Flow";
Real orifice.fout.p "Pressure";
Real orifice.G;
input Real orifice.size;
constant Real orifice.M = 0.029;
constant Real orifice.k = 1.4;
constant Real orifice.R = 8.31441;
parameter Real orifice.T = 273.0;
Real volume.fitting.G "Mass Flow";
Real volume.fitting.p "Pressure";
Real volume.p(start = 100000.0, fixed = true);
Real volume.G;
input Real volume.dV "Volume change";
Real volume.Q "Energy given to system with incoming Gas";
Real volume.L "Work of Gas";
Real volume.U "Inner Energy of Gas";
Real volume.V(start = 0.01, fixed = true) "Volume";
Real volume.thetta "Amount of substance in Volume";
Real volume.T(start = 273.0) "Temperature of Gas in volume";
parameter Real volume.T_in = 273.0 "Temperature of incoming Gas";
constant Real volume.c_V = 717.0;
constant Real volume.c_p = 1006.0;
constant Real volume.M = 0.029 "Molar Mass of air";
constant Real volume.R = 8.31441 "Gas constant";
equation
source.p = source.fitting.p;
source.G = source.fitting.G;
0.0 = orifice.fin.G + orifice.fout.G;
orifice.G = orifice.fin.G;
der(volume.Q) = der(volume.U) + der(volume.L);
der(volume.L) = volume.p * der(volume.V);
der(volume.U) = 717.0 * der(volume.thetta * volume.T);
der(volume.Q) = 1006.0 * (volume.T_in * der(volume.thetta));
der(volume.V) = volume.dV;
0.029 * der(volume.thetta) = volume.G;
volume.thetta * volume.T = (volume.p * volume.V) / 8.31441;
volume.p = volume.fitting.p;
volume.G = volume.fitting.G;
volume.dV = 0.0;
orifice.size = 0.0001;
source.p = 300000.0;
source.fitting.G + orifice.fin.G = 0.0;
orifice.fout.G + volume.fitting.G = 0.0;
orifice.fin.p = source.fitting.p;
orifice.fout.p = volume.fitting.p;
algorithm
orifice.G := 0.6847314563772705 * (orifice.fin.p * (orifice.size *
sqrt(0.029 / (orifice.T * 8.31441))));
end Actuator;


29.01.2012 01:45, Jens.Frenkel пишет:
strange think,

I tried with the attached version and it worked. I used the latest
version from trunc.

You could try this.
Please compile with +d=dumpdaelow
Then the compiler reports some more information. For the variable
volume.p there should be something like
"volume.p:VARIABLE(start=100000.0 fixed = true ) "


Mit freundlichen Grüßen,
Kind regards,


Jens Frenkel

_________________________________________________________________


Dipl.-Ing.
Jens Frenkel

*****************************************************************
Technische Universität Dresden
Institut für Verarbeitungsmaschinen und Mobile Arbeitsmaschinen
D-01062 Dresden

Tel: 0351 463-39278
Fax: 0351 463-37731
E-Mail: [email protected]

Internet: http://tu-dresden.de/bft

Wissensportal: www.baumaschine.de
*****************************************************************


*****************************************************************
Dresden University of Technology
Institute of Processing Machines and Mobile Machinery
D-01062 Dresden
Germany

Tel: +49 351 463-39278
Fax: +49 351 463-37731
E-Mail: [email protected]

Internet: http://tu-dresden.de/bft
*****************************************************************


Am 28.01.2012 21:48, schrieb aliko:
Thank you for promptest response, Jens!

I've tried fixed=true parameter as you suggested but with no success.
Also tried expressions like

VariableVolume volume(p.start = 1e5, p.fixed=true, V.start = 1e-2,
V.fixed=true);

with same results.

Maybe the difference in simulation parameters, method? I run
simulation by the command

simulate(Actuator, startTime = 0, stopTime = 1)

And output is unchanged from previous times:

record SimulationResult
resultFile = "/tmp/OpenModelica/Actuator_res.mat",
simulationOptions = "startTime = 0.0, stopTime = 1.0,
numberOfIntervals = 500, tolerance = 0.000001, method = 'dassl',
fileNamePrefix = 'Actuator', storeInTemp = false, noClean = false,
options = '', outputFormat = 'mat', variableFilter = '.*', measureTime
= false, cflags = ''",
messages = "ERROR: Division by zero in partial equation: (717.0 *
(der(volume.thetta) * volume.T) - der(volume.U)) / (-717.0 *
volume.thetta) because -717.0 * volume.thetta == 0.
DASSL-- AT T (=R1) SOME ELEMENT OF WT
In above message, R1 = .2000000000000E-05
DASSL-- HAS BECOME .LE. 0.0
info | DASRT can't continue. time = 0.002002
info | model terminate | Simulation terminated at time 0.002002
",
timeFrontend = 0.041102293999999984,
timeBackend = 0.014174958000000001,
timeSimCode = 0.016377142,
timeTemplates = 0.009396554000000001,
timeCompile = 0.605056829,
timeSimulation = 0.006068048,
timeTotal = 0.69223269
end SimulationResult;

Besides getting volume.p starting from 0 instead of 1e5 I get a
division by zero on time = 0.002002 no matter of using "fixed"
parameter.

By the way I'm using OpenModelica 1.8.0 r10948 under Ubuntu Linux
10.11 x64 if it's matter.


29.01.2012 00:11, Jens.Frenkel пишет:
Hi Ali,

try fixed=true, this means the start value is not only a guess value.

partial class PneumoOneTerm
Fitting fitting;
Real p(fixed=true), G;
equation
p = fitting.p;
G = fitting.G;
end PneumoOneTerm;

"time","volume.p",
0,100000.0014330081,
0.002,101612.6989615345,
0.004,103225.4216372393,
0.006,104838.1579805062,
0.008,106450.8726136756,

Mit freundlichen Grüßen,
Kind regards,


Jens Frenkel

_________________________________________________________________


Dipl.-Ing.
Jens Frenkel

*****************************************************************
Technische Universität Dresden
Institut für Verarbeitungsmaschinen und Mobile Arbeitsmaschinen
D-01062 Dresden

Tel: 0351 463-39278
Fax: 0351 463-37731
E-Mail: [email protected]

Internet: http://tu-dresden.de/bft

Wissensportal: www.baumaschine.de
*****************************************************************


*****************************************************************
Dresden University of Technology
Institute of Processing Machines and Mobile Machinery
D-01062 Dresden
Germany

Tel: +49 351 463-39278
Fax: +49 351 463-37731
E-Mail: [email protected]

Internet: http://tu-dresden.de/bft
*****************************************************************


Am 28.01.2012 17:26, schrieb Adrian Pop:

Hi all,

Forwarding email from Ali.
Ali, i now added you to OpenModelicaInterest as something
went wrong with your subscription email.

Cheers,
Adrian Pop/

From: Ali Tlisov <[email protected]>
Date: Sat, 28 Jan 2012 18:43:58 +0400
Subject: setting of initial values for variables have no effect
To: [email protected]

Hi!
I'm new to modelica and openmodelica in particular but being impressed
about it's capabilities and about physical modeling concept decided to
try it. So maybe my question is stupid one anyway all suggestions are
highly appreciated!
I've tried to build simple model of Volume being filled by Gas through
an Orifice. I try to set initial value of pressure in Volume (p.start
= 1e5) but after simulating I see that it starts from zero in spite of
my directions.
Thank you for any help in advance!

My code is as follows:

connector Fitting
flow Real G "Mass Flow";
Real p "Pressure";
end Fitting;

partial class PneumoTwoTerm
Fitting fin, fout;
Real G;
equation
0 = fin.G + fout.G;
G = fin.G;
end PneumoTwoTerm;

partial class PneumoOneTerm
Fitting fitting;
Real p, G;
equation
p = fitting.p;
G = fitting.G;
end PneumoOneTerm;

model PneumoSource
extends PneumoOneTerm;
end PneumoSource;

model Orifice
extends PneumoTwoTerm;
input Real size;
constant Real M = 29e-3;
constant Real k = 1.4;
constant Real R = 8.31441;
parameter Real T = 273;
algorithm
G := fin.p * size * sqrt(M / (R * T)) * (2 / (k + 1)) ^ (1 / (k-1))
* sqrt(2 * k / (k + 1));
end Orifice;

model VariableVolume
extends PneumoOneTerm;
input Real dV "Volume change";
Real Q "Energy given to system with incoming Gas";
Real L "Work of Gas";
Real U "Inner Energy of Gas";
Real V "Volume";
Real thetta "Amount of substance in Volume";
Real T(start = 273) "Temperature of Gas in volume";
parameter Real T_in = 273 "Temperature of incoming Gas";
constant Real c_V = 717, c_p = 1006;
constant Real M = 29e-3 "Molar Mass of air";
constant Real k = 1.4 "Adiabate characteristic";
constant Real R = 8.31441 "Gas constant";
equation
der(Q) = der(U) + der(L);
der(L) = p * der(V);
der(U) = c_V * der(thetta * T);
der(Q) = c_p * T_in * der(thetta);
der(V) = dV;
der(thetta) * M = G;
thetta * T = p * V / R; // Ideal Gas equation
end VariableVolume;

model Actuator
PneumoSource source;
Orifice orifice;
VariableVolume volume(p.start = 1e5, V.start = 1e-2);
equation
connect(source.fitting, orifice.fin);
connect(orifice.fout, volume.fitting);
volume.dV = 0;
orifice.size = 1e-4;
source.p = 3e5;
end Actuator;







Reply via email to