- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Media/Fluid usage
Media/Fluid usage
Media/Fluid usage
Hi,
i am fairly new to (open)modelica and really love to work with it. Unfortunately i am having troubles understanding the Error-messages i am getting. I try to utilize the modelica.fluid library for a small project and already read the fluid.userguid and the media.userguide.
I'd like to build a simple model, that provides a mass flow to / via a fluid_port_b. The model is getting checked succesfully but whenever i try to simulate it, i get two errors stating, that "An independent subset of the model has imbalanced number of equations (14) and variables (15)." and "pre-optimization module clockPartitioning (simulation) failed.".
I tried it by enabling the old frontend for code generation but that didn't help. Do i understand it right, that i have too much equations / not enough variables?
I would be really thankfull for a hint on how to set this up right, since i am totally in the dark with this. Thank you very much for your efforts in advance!
P.S.: I would have liked to upload pictures but get an "The requested page can't be found"-message.
Code:
model Test
Modelica.Fluid.Sources.MassFlowSource_T boundary(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.H2, nPorts = 1, use_m_flow_in = true) annotation(
Placement(visible = true, transformation(origin = {2, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.RealExpression realExpression(y = 2.4) annotation(
Placement(visible = true, transformation(origin = {-4, 34}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
inner Modelica.Fluid.System system annotation(
Placement(visible = true, transformation(origin = {-90, 90}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Interfaces.FluidPort_b port_b(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.H2) annotation(
Placement(visible = true, transformation(origin = {100, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {100, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(realExpression.y, boundary.m_flow_in) annotation(
Line(points = {{-15, 34}, {-24, 34}, {-24, 8}, {-8, 8}}, color = {0, 0, 127}));
connect(boundary.ports[1], port_b) annotation(
Line(points = {{12, 0}, {100, 0}, {100, 0}, {100, 0}}, color = {0, 127, 255}));
annotation(
uses(Modelica(version = "3.2.3")));
end Test;
Error:
[1] 14:33:03 Symbolic Error
An independent subset of the model has imbalanced number of equations (14) and variables (15).
variables:
port_b.h_outflow
port_b.p
boundary.T_in_internal
boundary.ports[1].h_outflow
boundary.ports[1].p
boundary.medium.p_bar
boundary.medium.T_degC
boundary.medium.state.T
boundary.medium.state.p
boundary.medium.R
boundary.medium.u
boundary.medium.T
boundary.medium.d
boundary.medium.h
boundary.medium.p
equations:
1 : boundary.medium.T_degC = -273.15 + boundary.medium.T
2 : boundary.medium.p_bar = 1e-005 * boundary.medium.p
3 : boundary.medium.R = 4124.487568704486
4 : boundary.medium.h = Modelica.Media.IdealGases.Common.Functions.h_T(Modelica.Media.IdealGases.Common.DataRecord("H2", 0.00201588, 0, 4200697.462150524, 1000, {40783.2321, -800.918604, 8.21470201, -0.01269714457, 1.753605076e-005, -1.20286027e-008, 3.36809349e-012}, {2682.484665, -30.43788844}, {560812.801, -837.150474, 2.975364532, 0.001252249124, -3.74071619e-007, 5.936625200000001e-011, -3.6069941e-015}, {5339.82441, -2.202774769}, 4124.487568704486), boundary.medium.T, true, Modelica.Media.Interfaces.Choices.ReferenceEnthalpy.ZeroAt0K, 0.0)
5 : boundary.medium.u = boundary.medium.h - boundary.medium.R * boundary.medium.T
6 : boundary.medium.d = boundary.medium.p / (boundary.medium.T * boundary.medium.R)
7 : boundary.medium.state.T = boundary.medium.T
8 : boundary.medium.state.p = boundary.medium.p
9 : boundary.T_in_internal = boundary.T
10 : boundary.medium.T = boundary.T_in_internal
11 : boundary.ports[1].p = boundary.medium.p
12 : boundary.ports[1].h_outflow = boundary.medium.h
13 : boundary.ports[1].h_outflow = port_b.h_outflow
14 : boundary.ports[1].p = port_b.p
[2] 14:33:03 Translation Error
pre-optimization module clockPartitioning (simulation) failed.
Re: Media/Fluid usage
Hi,
i didn't get any reply to my post so far but i think the fault in my method desribed above is that i didn't test the System with a boundary for the Medium to flow into. So try connecting the port to FixedBoundary or pT_Boundary for example
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Media/Fluid usage