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
  • Index
  • » Users
  • » uschoene
  • » Profile

Posts

Posts

Jan-12-14 16:27:30
Errors using multiple components to define the state of a stream
Category: Programming

Hi there,
I am developing some components, that help to do some steady state simulation of paper plants.
I want to use measured data from the plant.

The data does not directly fit the flow port requirements of m_flow, Xi and h so I have to use my components to convert the parameters to the data required by the fluid ports. Therefor I add parameters to e.g. pipes and leave boundaries with no or only p as parameter.
An example is MoistAir, where I set a VolumeFlowRate, a absolute humidity (ks water / kg dry air), temperature and pressure.

I use Boolean parameters to denable parameters and equations, when ceratain values are known at some points.
Everything is doing fine, as long as I have only simple examples, like on source, on sink and the demand pipe inbetween.

Problem:
When I start to split the known values on multiple pipes in a row, I get problems with determination and the balance of variables and equations.
In therory the model should still be balanced, but it seems like Modelica gets wired about it and quotes me to less equations.
I am aware of the stream issues in general and am using inStream in h_outflow and Xi_outflow of the flowports and use them in all objects.

Any ideas what could be wrong?
Uwe

Hi parameswararaob,

you just have two small errors in your code:

Code:

Modelica.Mechanics.Rotational.Inertia         inertia1(J = 1);

should be still:

Code:

Modelica.Mechanics.Rotational.Components.Inertia      inertia1(J = 1);   

and

Code:

connect(emf1.flange_b, inertia1.flange_a);

should be

Code:

connect(emf1.flange, inertia1.flange_a);

OM pops up with a warning, that iteration start values are missing, but does the simulation now.

Hope this works for you.
Uwe

Jan-06-14 22:30:23
Where to adress this?
Category: Programming

Hi there,
I don't know, where to adress this, so I want describe the problem, and maybe someone knows, where to adress this problem.
It is a problem in MSL not in OM.

The media definition of MSL contains moist air: Modelica.Media.Air.MoistAir
In there one can find the concentration of water (big X) as kg water / kg moist air and the charge (small x) as kg water/kg dry air.
They are both defined as Modelica.SIunits.Massfraction, with min=0, max=1.

This is ok for X but totally wrong for x. The charge x can be min=0 (max=inf), as ther can be a higher humdity than 1kg water / 1 kg dry air.
This leeds to error messages, when x>1, as Modelica checks the type definition.

As there is no SIunit for that, the correct type would be Real.

Does somebody know, where do adress this?
Regards,
Uwe

Dec-29-13 23:27:07
read data from a text file and use it in a simulation

Hi there,

although this topic is a year ago, this might help someone.
I did swear a lot about TimeTable and CombiTable when reading a file with multiple columns.
Everytime I only got the all timesteps for first item y[1], but not the rest of them, y[2:n]

Important is
1. to define the parameter "columns" with either the number of values you want to read, or a real big number to read all of them
2. if youf don't want interpolation, but the real values, you have to set simulation parameters starttime=1, stoptime <= number of time steps in your data files

My example data file "data01.txt" :

Code:

#1 

double tab1(6,3)   # comment line
0 0 0
1 2 5
2 4 7
3 5 8
4 6 9
5 7 10

My Model

Code:

model TestCombiTable

    Modelica.Blocks.Sources.CombiTimeTable combiTimeTable(
    tableOnFile=true,
    fileName="c:/data01.txt",
    tableName="tab1",
    columns=2:1000  // put a big number at the end here
    )
end TestCombiTable;

Simulation using e.g. OMNotbook:

Code:

loadModel(Modelica);

simulate(TestCombiTable,startTime=1,stopTime=6)

Check the values e.g. OMNotebook

Code:

val(TestCombiTable.y[2],{1:6})

Result:
{{5.0,7.0,8.0,9.0,10.0,11.0}}

Maybe this helps someone else a bit of heavy swearing.
Greetings,
Uwe

Aug-06-13 15:23:04
Cannot be solved. To few equations, under-determined system.

Hi Adrian,
thank you for your reply.
I am using OpenModelica 1.9.0 beta4+dev (r16548) on WinXP Prof SP3, 32Bit.

I used the mos script and got a log file.
The temperature of the boundary seems to be calculated from the internal parameter which is by default 293.15K.
The equation in the log is:
"58/58 (1): boundary_p.medium.T = boundary_p.T_in_internal

But as referring to the help of the boundary_p object Modelica should ignore this value...

What else to do?
> I could send you my model and the log file.

Adrian, may I ask you for an advice to handle the usage of inStream an object  two streams entering and one stream leaving?

Regards,
Uwe

Aug-05-13 12:19:37
Cannot be solved. To few equations, under-determined system.

Ok, as my torubles are not easily to understand without source code, I created a simple example, what is not working:

For the test I connected two boundaries from Modelica.Fluid.Sources:
MassFlowSource_T and Boundary_pT

If you are looking at the documentation of Boundary_pT, it says:
<p>If <code>use_p_in</code> is false (default option), the <code>p</code> parameter
is used as boundary pressure, and the <code>p_in</code> input connector is disabled; if <code>use_p_in</code> is true, then the <code>p</code> parameter is ignored, and the value provided by the input connector is used instead.</p>
<p>The same thing goes for the temperature, composition and trace substances.</p>

So I define m_flow, T and X fpr MassFlowSource_T and only the pressure for Boundary_pT:

Code:

model TestSingleMoistAir

  inner Modelica.Fluid.System system
    annotation (Placement(transformation(extent={{-76,68},{-56,88}})));

  Modelica.Fluid.Sources.MassFlowSource_T boundary_mT(
 
                                                      nPorts=1,
                                                      redeclare package Medium = Modelica.Media.Air.MoistAir,
                                                      m_flow=1000,
                                                      X={0.01,0.99},
                                                      T=353.15)
                                                      annotation (Placement(transformation(extent={{-66,20},{-46,40}})));
  Modelica.Fluid.Sources.Boundary_pT boundary_p(
                                                  nPorts=1,
                                                  redeclare package Medium = Modelica.Media.Air.MoistAir,
                                                  p=100000)
                                                  annotation (Placement(transformation(extent={{50,20},{30,40}})));                                                     
equation
  connect(boundary_mT.ports[1], boundary_p.ports[1]) annotation (Line(
      points={{-46,30},{30,30}},
      color={0,127,255},
      smooth=Smooth.None));
  annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,
            -100},{100,100}}), graphics));
end TestSingleMoistAir;

When you do the simulation, you can see, that it does not what the documentation is promising:
It takes the default Temp in the bondary_pT and not the one from boundary_mT:

Code:

val(boundary_mT.ports[1].m_flow,1);

val(boundary_p.ports[1].m_flow,1);
val(boundary_mT.ports[1].h_outflow,1);
val(boundary_p.ports[1].h_outflow,1);
val(boundary_mT.medium.T,1);
val(boundary_p.medium.T,1)

Results in:
-1000.0
1000.0
106157.20683546351
45263.2387446934
353.15
293.15

=> Does anybody have an idea why this happens, and what I could do?
Thanks in advance.
Uwe

Jul-30-13 22:23:27
Cannot be solved. To few equations, under-determined system.

Hi,
I am new to Modelica and think it is a great language and OM a very good tool.
I am working on my thesis and get stuck because of under determined system creating a steady state mixer object.
Did anybody try to create a mixer object for moistAir and steam before?

Your help would very much appreciated...
Thanks in advance.
Uwe

Jun-17-13 15:59:32
Error: Class SI.Pressure not found in scope A while instantiating p.
Category: Programming

Hi aeismail!
I had the same problem using the German version of OpenModelica 1.9.0 beta 4.

Just for anybody searching for the problem to use SIunits or an package from Modelica standard library:
e.g. running the EMF I received the message:
[<interactive>:5:3-5:62:writable] Error: Klasse SIunits.Voltage konnte nicht im Geltungsbereich von EMF gefunden werden.
Error: Error occurred while flattening model EMF


I solved it as you indicated, by entering once
loadModel(Modelica)

Maybe this helps someone else while starting off with Modelica current/smile
Ciao Uwe

  • Index
  • » Users
  • » uschoene
  • » Profile
You are here: