- Index
- » Users
- » lwinklmann
- » Profile
Posts
Posts
Sure! It was only a model for testing the Modelic.Utilities library. It only consists of that one command that i wrote before. My full model is:
model test2
String[:] file_content= Modelica.Utilities.Streams.readFile("C:/01_Data/Lukas/Hoehenverstellung/WriteBackData.txt");
end test2;
Also i double checked, the path i used is correct.
Hi adrpo,
Thanks for your quick reply! Unfortunately, it still doesnt work. Can you think of any other error when using this command? Btw. it says when checking that my class has 0 equations and 1 variable.
Thanks
lwinklmann
Hi everyone,
i'm trying to read the file'WritebackData.txt and save it in file_content. I'm using this command:
String[:] file_content= Modelica.Utilities.Streams.readFile("C:\01_Data\Lukas\Hoehenverstellung\WriteBackData.txt");
When trying to simulate, nothing happens, no Simulation and no (error) message appears.
Can someone tell me how to use Modelica.Utilities.Streams.readFile properly
Thanks
lwinklmann
Hi everyone,
i'm currently trying to create a Tank model that is able to handle two fluids. Here's my model:
model TankWaterCO2
import Modelica.Constants.pi;
import Modelica.Fluid.Types;
import Modelica.Fluid.Types.Dynamics;
import Modelica.Media.Interfaces.Choices.IndependentVariables;
////////////////////Variablen/Attribute////////////////////
Modelica.SIunits.Mass m "Mass of fluid";
Modelica.SIunits.Mass m2 "Mass of fluid2";
// Tank properties
Modelica.SIunits.Height level(stateSelect=StateSelect.prefer, start=level_start_eps) "Level height of tank";
Modelica.SIunits.Volume V(stateSelect=StateSelect.never) "Actual tank volume";
Modelica.SIunits.Volume V_ges(stateSelect=StateSelect.never) "Actual tank volume";
//Ports
parameter Integer nPortsWater=2;
parameter Integer nPortsCO2=3;
Modelica.SIunits.MassFlowRate mb_flow "Mass flows across boundaries";
Modelica.SIunits.MassFlowRate mb_flow2 "Mass flows across boundaries";
Modelica.Fluid.Vessels.BaseClasses.VesselFluidPorts_b portsWater[nPortsWater](redeclare each package Medium = Mediumw) annotation(
Placement(visible = true, transformation(origin = {35, -80}, extent = {{-29, -18}, {29, 18}}, rotation = 0), iconTransformation(origin = {35, -80}, extent = {{-29, -18}, {29, 18}}, rotation = 0)));
Modelica.Fluid.Vessels.BaseClasses.VesselFluidPorts_b portsCO2[nPortsCO2](redeclare each package Medium = Medium) annotation(
Placement(visible = true, transformation(origin = {-35, -80}, extent = {{-29, -18}, {29, 18}}, rotation = 0), iconTransformation(origin = {-35, -80}, extent = {{-29, -18}, {29, 18}}, rotation = 0)));
//Ambient
outer Modelica.Fluid.System system "System properties";
////////////////////Parameter////////////////////
// Tank geometry
parameter Modelica.SIunits.Height height "Height of tank";
parameter Modelica.SIunits.Area crossArea "Area of tank";
// Ambient
parameter Medium.Temperature T_ambient=system.T_ambient
"Tank surface Temperature"
annotation(Dialog(tab = "Assumptions", group = "Ambient"));
// Initialization
parameter Modelica.SIunits.Height level_start(min=0) = 0
"Start value of tank level"
annotation(Dialog(tab="Initialization"));
parameter Boolean initialize_p=true;
parameter Modelica.SIunits.Temperature T=289;
protected
final parameter Modelica.SIunits.Height level_start_eps = max(level_start, Modelica.Constants.eps);
////////////////////Medium Deklaration////////////////////
//Medium=CO2, Mediumw=Wasser
replaceable package Medium =
Modelica.Media.Interfaces.PartialMedium "Medium in the component"
annotation (choicesAllMatching = true);
replaceable package Mediumw =
Modelica.Media.Interfaces.PartialMedium "Mediumw in the component"
annotation (choicesAllMatching = true);
// Initialization
parameter Medium.AbsolutePressure p_start = system.p_start
"Start value of pressure"
annotation(Dialog(tab = "Initialization"));
parameter Boolean use_T_start = true
"= true, use T_start, otherwise h_start"
annotation(Dialog(tab = "Initialization"), Evaluate=true);
parameter Medium.Temperature T_start=
if use_T_start then system.T_start else Medium.temperature_phX(p_start,h_start,X_start)
"Start value of temperature"
annotation(Dialog(tab = "Initialization", enable = use_T_start));
parameter Medium.SpecificEnthalpy h_start=
if use_T_start then Medium.specificEnthalpy_pTX(p_start, T_start, X_start) else Medium.h_default
"Start value of specific enthalpy"
annotation(Dialog(tab = "Initialization", enable = not use_T_start));
parameter Medium.MassFraction X_start[Medium.nX] = Medium.X_default
"Start value of mass fractions m_i/m"
annotation (Dialog(tab="Initialization", enable=Medium.nXi > 0));
parameter Medium.ExtraProperty C_start[Medium.nC](
quantity=Medium.extraPropertiesNames)=fill(0, Medium.nC)
"Start value of trace substances"
annotation (Dialog(tab="Initialization", enable=Medium.nC > 0));
//Innitialization2
parameter Mediumw.AbsolutePressure p_start2 = system.p_start
"Start value of pressure"
annotation(Dialog(tab = "Initialization"));
parameter Boolean use_T_start2 = true
"= true, use T_start2, otherwise h_start"
annotation(Dialog(tab = "Initialization"), Evaluate=true);
parameter Mediumw.Temperature T_start2=
if use_T_start2 then system.T_start else Mediumw.temperature_phX(p_start2,h_start2,X_start2)
"Start value of temperature"
annotation(Dialog(tab = "Initialization", enable = use_T_start2));
parameter Mediumw.SpecificEnthalpy h_start2=
if use_T_start2 then Mediumw.specificEnthalpy_pTX(p_start2, T_start2, X_start2) else Mediumw.h_default
"Start value of specific enthalpy"
annotation(Dialog(tab = "Initialization", enable = not use_T_start2));
parameter Mediumw.MassFraction X_start2[Mediumw.nX] = Mediumw.X_default
"Start value of mass fractions m_i/m"
annotation (Dialog(tab="Initialization", enable=Mediumw.nXi > 0));
parameter Mediumw.ExtraProperty C_start2[Mediumw.nC](
quantity=Mediumw.extraPropertiesNames)=fill(0, Mediumw.nC)
"Start value of trace substances"
annotation (Dialog(tab="Initialization", enable=Mediumw.nC > 0));
// Medium.ExtraProperty C[Medium.nC] "Trace substance mixture content";
// Mediumw.ExtraProperty C2[Mediumw.nC] "Trace substance mixture content";
Medium.BaseProperties medium(
preferredMediumStates=true,
p(start=p_start),
h(start=h_start),
T(start=T_start),
Xi(start=X_start[1:Medium.nXi]));
Medium.BaseProperties mediumw(
preferredMediumStates=true,
p(start=p_start2),
h(start=h_start2),
T(start=T_start2),
Xi(start=X_start2[1:Mediumw.nXi]));
equation
V_ges=height*crossArea;
V = crossArea*level "Volume of fluid";
mb_flow = sum(portsCO2.m_flow);
mb_flow2 = sum(portsWater.m_flow);
m=(V_ges-V)*medium.d;
m2=V*mediumw.d;
der(m)=mb_flow;
der(m2)=mb_flow2;
medium.p=mediumw.p;
medium.p(m/0.01801528)*8.3144598*T)/(V_ges-V);
for i in 1:nPortsWater loop
mediumw.p=portsWater[i].p;
mediumw.h=portsWater[i].h_outflow;
end for;
for i in 1:nPortsCO2 loop
medium.p=portsCO2[i].p;
medium.h=portsCO2[i].h_outflow;
end for;
initial equation
if initialize_p then
medium.p = p_start;
der(medium.h) = 0;
end if;
medium.T = T_start;
level=level_start_eps;
p_start=((m/0.01801528)*8.3144598*T)/(V_ges-V);
m2=V*mediumw.d;
annotation(
defaultComponentName = "tank",
Icon(coordinateSystem(initialScale = 0.2), graphics = {Rectangle(lineColor = {255, 255, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.VerticalCylinder, extent = {{-100, 100}, {100, -100}}), Rectangle(fillColor = {85, 170, 255}, fillPattern = FillPattern.VerticalCylinder, extent = {{-100, -100}, {100, 10}}), Line(points = {{-100, 100}, {-100, -100}, {100, -100}, {100, 100}}), Text(extent = {{-95, 60}, {95, 40}}, textString = "level ="), Text(origin = {0, 14},extent = {{-95, -24}, {95, -44}}, textString = "%level_start", fontName = "0"), Line(origin = {0, 100}, points = {{-100, 0}, {100, 0}, {100, 0}}), Text(origin = {-36, -52}, extent = {{14, -22}, {-14, 22}}, textString = "CO2"), Text(origin = {34, -52}, extent = {{14, -22}, {-14, 22}}, textString = "H2O")}),
Documentation(info = "<html>
<p>
Model of a tank that is open to the ambient at the fixed pressure
<code>p_ambient</code>.
</p>
<p>
The vector of connectors <b>ports</b> represents fluid ports at configurable heights, relative to the bottom of tank.
Fluid can flow either out of or in to each port.
</p>
The following assumptions are made:
<ul>
<li>The tank is filled with a single or multiple-substance medium having a density higher than the density of the ambient medium.</li>
<li>The fluid has uniform density, temperature and mass fractions</li>
<li>No liquid is leaving the tank through the open top; the simulation breaks with an assertion if the liquid level growths over the height.</li>
</ul>
<p>
The port pressures represent the pressures just after the outlet (or just before the inlet) in the attached pipe.
The hydraulic resistances <code>portsData.zeta_in</code> and <code>portsData.zeta_out</code> determine the dissipative pressure drop between tank and port depending on
the direction of mass flow. See <a href=\"modelica://Modelica.Fluid.Vessels.BaseClasses.VesselPortsData\">VesselPortsData</a> and <i>[Idelchik, Handbook of Hydraulic Resistance, 2004]</i>.
</p>
<p>
With the setting <code>use_portsData=false</code>, the port pressure represents the static head
at the height of the respective port.
The relationship between pressure drop and mass flow rate at the port must then be provided by connected components;
Heights of ports as well as kinetic and potential energy of fluid entering or leaving are not taken into account anymore.
</p>
</html>", revisions = "<html>
<ul>
<li><i>Dec. 12, 2008</i> by Ruediger Franke: move port definitions
to BaseClasses.PartialLumpedVessel; also use energy and mass balance from common base class</li>
<li><i>Dec. 8, 2008</i> by Michael Wetter (LBNL):<br>
Implemented trace substances.</li>
<li><i>Jan. 6, 2006</i> by Katja Poschlad, Manuel Remelhe (AST Uni Dortmund),
Martin Otter (DLR):<br>
Implementation based on former tank model.</li>
<li><i>Oct. 29, 2007</i> by Carsten Heinrich (ILK Dresden):<br>
Adapted to the new fluid library interfaces:
<ul> <li>FluidPorts_b is used instead of FluidPort_b (due to it is defined as an array of ports)</li>
<li>Port name changed from port to ports</li></ul>Updated documentation.</li>
<li><i>Apr. 25, 2006</i> by Katrin Prölß (TUHH):<br>
Limitation to bottom ports only, added inlet and outlet loss factors.</li>
</ul>
</html>"),
uses(Modelica(version = "3.2.2")));
end TankWaterCO2;
unfortuately, i am missing a equation. Can someone tell me which one that is? What i'd also like to know is: is there a easier way to create that model being able to handle two media? Simply defining a two-substance-medium doesn't work for my purposes as i want the composition of the two media to be variable.
I'd really appreciate any help as i'm trying to find a solution for one week now.
Thanks in advance
lwinklmann
Is there really nobody who can help me with this?
If necessary i can give further Information about the Problem. Anyone please give a answer if you can help me.
Hi everyone,
i'm trying to create a model where there is a closed volume with water- and CO2 inlet and outlet ports. Using valves, i'm trying to keep water level and pressure in the volume constant. But unfortunately the outcome was quite strange. I think the problem is that i redeclared the Medium in the closed volume as LinearColdWater(without mentioning the CO2). How can i redeclare Medium in the closed volume so that the model works properly? Do i have to create a new Medium Package for that purpose? But how do i then handle the Mass fractions as the aren't constant?
I hope anyone can help me.
Thanks in advance
lwinklmann
Hello,
i use openModelica-v1.12.0 and openModelica Standard library Version 3.2.2. Yes, i did try to restart my Computer. I didnt mess around with the flags. As i am a beginner at modelica i dont know which flags are set by Default and which are Special. I dont have any compilation flags set and the only box ticked in the Simulation flags tab is LOG_STATS.
Best regards
lwinklmann
Hello, Joel
thanks for your answer. Maybe these others can respond even though there might not yet be enough Details given because perhaps i can give the Information they need to solve the problem
Best regards
lwinklmann
Hi Joel,
Thanks! That worked, but there's still some issues in the Compilation window, it's stating that there are under-determined linear Systems.
And i still dont know why or how my Programm changed as it could run the example before the Crash. I'd really like to know what i can do about that.
Best regards
lwinklmann
Hi Joel,
thanks for the quick reply. Unfortunately i cant simply copy the code as the following error occurs:
Syntax Error
Redefining class(es) Modelica.Fluid.Examples.PumpingSystem which already exist(s). Delete the existing class(es) before loading the file/library .
I forgot to mention: the problem occured after a crash of OMEdit.
Before that it worked perfectly fine.
So i dont really think it's a initialization Problem.
Best regards
lwinklmann
Hi everyone,
i was trying to run the example "pumpingsystem" in omedit. But the following error occured:
[1] 07:22:01 Translation Error
post-optimization module solveSimpleEquations (initialization) failed.
[2] 07:22:01 Translation Error
No system for the symbolic initialization was generated
why does that happen?? And how can i fix this?
Thanks
lwinklmann
Hi everyone,
i'd like to make a model where water is pumpt in a closed volume.
From there, the water should flow (equally spreaded) in two open tanks.
Is this even possible to do? I hope anyone can help.
Here's a try of mine that didnt work properly:
model Test_Abfueller2
inner Modelica.Fluid.System system annotation(
Placement(visible = true, transformation(origin = {-80, 78}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.Boundary_pT boundary(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater,nPorts = 1, p = 600000) annotation(
Placement(visible = true, transformation(origin = {-84, -32}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.StaticPipe pipe(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater,diameter = 0.05, length = 1) annotation(
Placement(visible = true, transformation(origin = {-46, -32}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Vessels.ClosedVolume volume(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater,V = 10, nPorts = 3) annotation(
Placement(visible = true, transformation(origin = {-30, 50}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Vessels.OpenTank tank(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, crossArea = 1, height = 10, level_start = 0, nPorts = 1, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05)}) annotation(
Placement(visible = true, transformation(origin = {52, 62}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
Modelica.Fluid.Vessels.OpenTank tank1(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, crossArea = 1, height = 10, level_start = 0, nPorts = 1, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05)}) annotation(
Placement(visible = true, transformation(origin = {46, -22}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
equation
connect(volume.ports[2], tank.ports[1]) annotation(
Line(points = {{-30, 40}, {-14, 40}, {-14, 22}, {54, 22}, {54, 42}, {52, 42}}, color = {0, 127, 255}, thickness = 0.5));
connect(volume.ports[3], tank1.ports[1]) annotation(
Line(points = {{-30, 40}, {-2, 40}, {-2, -64}, {46, -64}, {46, -42}, {46, -42}}, color = {0, 127, 255}, thickness = 0.5));
connect(pipe.port_a, boundary.ports[1]) annotation(
Line(points = {{-56, -32}, {-74, -32}}, color = {0, 127, 255}));
connect(pipe.port_b, volume.ports[1]) annotation(
Line(points = {{-36, -32}, {-30, -32}, {-30, 40}}, color = {0, 127, 255}));
annotation(
uses(Modelica(version = "3.2.2")));
end Test_Abfueller2;
Thanks,
lwinklmann
Hi everyone,
i have a problem with extracting CO2 from closed volume.
The following example works perfectly fine:
model Test_Abfueller
Modelica.Fluid.Pipes.StaticPipe pipe(diameter = 0.05, redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, length = 1) annotation(
Placement(visible = true, transformation(origin = {-28, -46}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
inner Modelica.Fluid.System system annotation(
Placement(visible = true, transformation(origin = {-80, -86}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.MassFlowSource_T boundary1(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, T = 278, m_flow = 1, nPorts = 1) annotation(
Placement(visible = true, transformation(origin = {-86, -46}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.StaticPipe pipe1(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.CO2, diameter = 0.05, length = 1) annotation(
Placement(visible = true, transformation(origin = {-28, -20}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Vessels.ClosedVolume volume(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, V = 10, nPorts = 4, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05), Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05), Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05), Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05)}) annotation(
Placement(visible = true, transformation(origin = {26, 48}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.StaticPipe pipe2(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, diameter = 0.05, length = 1) annotation(
Placement(visible = true, transformation(origin = {52, -46}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Vessels.OpenTank tank(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, crossArea = 1, height = 10, level_start = 0, nPorts = 1, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05)}) annotation(
Placement(visible = true, transformation(origin = {70, -2}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
// Modelica.Fluid.Vessels.OpenTank tank_co2(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.CO2, crossArea = 1, height = 10, level_start = 0, nPorts = 1, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05)}) annotation(
// Placement(visible = true, transformation(origin = {-70, 68}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
// Modelica.Fluid.Pipes.StaticPipe pipe3(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, diameter = 0.05, length = 1) annotation(
// Placement(visible = true, transformation(origin = {-24, 30}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.Boundary_pT boundary(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.CO2, nPorts = 1, p = 600000) annotation(
Placement(visible = true, transformation(origin = {-86, -18}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(boundary.ports[1], pipe1.port_a) annotation(
Line(points = {{-76, -18}, {-38, -18}, {-38, -20}, {-38, -20}}, color = {0, 127, 255}, thickness = 0.5));
// connect(volume.ports[4], pipe3.port_a) annotation(
// Line(points = {{26, 38}, {22, 38}, {22, 30}, {-14, 30}, {-14, 30}}, color = {0, 127, 255}, thickness = 0.5));
// connect(pipe3.port_b, tank_co2.ports[1]) annotation(
// Line(points = {{-34, 30}, {-70, 30}, {-70, 48}, {-70, 48}}, color = {0, 127, 255}));
connect(pipe.port_b, volume.ports[1]) annotation(
Line(points = {{-18, -46}, {26, -46}, {26, 38}}, color = {0, 127, 255}));
connect(pipe1.port_b, volume.ports[2]) annotation(
Line(points = {{-18, -20}, {26, -20}, {26, 38}}, color = {0, 127, 255}));
connect(volume.ports[3], pipe2.port_a) annotation(
Line(points = {{26, 38}, {26, 1}, {42, 1}, {42, -46}}, color = {0, 127, 255}, thickness = 0.5));
connect(pipe2.port_b, tank.ports[1]) annotation(
Line(points = {{62, -46}, {70, -46}, {70, -22}, {70, -22}}, color = {0, 127, 255}));
connect(boundary1.ports[1], pipe.port_a) annotation(
Line(points = {{-76, -46}, {-38, -46}}, color = {0, 127, 255}, thickness = 0.5));
annotation(
uses(Modelica(version = "3.2.2")));
end Test_Abfueller;
But if i want to add a pipe and a open tank now to extract co2 from the volume, an error occurs and i dont understand why.
I'd really appreciate it if someone could tell me why this happens.
Here's the sourcecode of my try to add pipe and tank:
model Abfueller
//Erstellung des Rohrs für die CO2-Ausführung
inner Modelica.Fluid.System system annotation(
Placement(visible = true, transformation(origin = {-80, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
//Erstellung des Rohrs für die Bierausführung
Modelica.Fluid.Pipes.StaticPipe pipe_beer_out(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, diameter = 0.05, height_ab = -0.5, length = 1) annotation(
Placement(visible = true, transformation(origin = {70, 18}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
//Erstellung des Rohrs fpr die CO2-Einführung
Modelica.Fluid.Pipes.StaticPipe pipe_co2_in(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.CO2, diameter = 0.05, length = 1) annotation(
Placement(visible = true, transformation(origin = {-62, 18}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
//Erstellung der Bierquelle
Modelica.Fluid.Sources.Boundary_pT source_beer(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, T = 278, nPorts = 1, p = 560000) annotation(
Placement(visible = true, transformation(origin = {-112, -42}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Valves.ValveIncompressible valve_beer_in(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, CvData = Modelica.Fluid.Types.CvTypes.Kv, Kv = 40, checkValve = true, dp_nominal = 30000, m_flow_nominal = 1, rho_nominal = 1000) annotation(
Placement(visible = true, transformation(origin = {-34, -42}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Valves.ValveCompressible valve_co2_in(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.CO2, CvData = Modelica.Fluid.Types.CvTypes.Kv, Kv = 0.16, allowFlowReversal = false, checkValve = true, dp_nominal = 1000, m_flow_nominal = 1000, p_nominal = 0.3, show_T = true, show_V_flow = true) annotation(
Placement(visible = true, transformation(origin = {-34, 18}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.StaticPipe pipe_co2_out(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.CO2, diameter = 0.05, length = 1) annotation(
Placement(visible = true, transformation(origin = {8, -88}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
Modelica.Fluid.Valves.ValveCompressible valve_co2_out(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.CO2, CvData = Modelica.Fluid.Types.CvTypes.Kv, Kv = 0.16, dp_nominal = 1000, m_flow_nominal = 1000, p_nominal = 0.3) annotation(
Placement(visible = true, transformation(origin = {38, -76}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
Modelica.Fluid.Vessels.ClosedVolume tank_beer(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, V = 0.42137, nPorts = 4, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05), Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05), Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05), Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05)}) annotation(
Placement(visible = true, transformation(origin = {22, 46}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.StaticPipe pipe_co2_in2(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.CO2, diameter = 0.05, length = 1) annotation(
Placement(visible = true, transformation(origin = {-2, 18}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
//Erstellung desr Rohre für die Biereinführung
Modelica.Fluid.Pipes.StaticPipe pipe_beer_in(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, diameter = 0.05, length = 1) annotation(
Placement(visible = true, transformation(origin = {-62, -42}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.StaticPipe pipe_beer_in2(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, diameter = 0.05, length = 1) annotation(
Placement(visible = true, transformation(origin = {-2, -40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
//Blöcke für Ventile
Modelica.Blocks.Sources.Constant const2(k = 1) annotation(
Placement(visible = true, transformation(origin = {40, -48}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.Constant const(k = 1) annotation(
Placement(visible = true, transformation(origin = {-34, 44}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
//Erstellung der C02-Quelle
Modelica.Fluid.Sources.Boundary_pT source_co2(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.CO2, T = 278, nPorts = 1, p = 600000) annotation(
Placement(visible = true, transformation(origin = {-110, 18}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Vessels.OpenTank bottle(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, crossArea = 0.003, height = 0.3, level(start = 0), level_start = 0, nPorts = 1, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05)}) annotation(
Placement(visible = true, transformation(origin = {70, 58}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
Modelica.Blocks.Sources.Step step1(offset = 1) annotation(
Placement(visible = true, transformation(origin = {-34, -16}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Vessels.OpenTank tank_co2(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.CO2, crossArea = 1, height = 10, level_start = 0, nPorts = 1, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05)}) annotation(
Placement(visible = true, transformation(origin = {-80, -72}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
equation
connect(pipe_co2_in2.port_b, tank_beer.ports[2]) annotation(
Line(points = {{8, 18}, {18, 18}, {18, 36}, {22, 36}}, color = {0, 127, 255}));
connect(pipe_beer_out.port_a, tank_beer.ports[4]) annotation(
Line(points = {{60, 18}, {44, 18}, {44, 36}, {22, 36}}, color = {0, 127, 255}));
connect(valve_co2_out.port_a, tank_beer.ports[3]) annotation(
Line(points = {{28, -76}, {28, -23}, {22, -23}, {22, 36}}, color = {0, 127, 255}));
connect(pipe_beer_in2.port_b, tank_beer.ports[1]) annotation(
Line(points = {{8, -40}, {22, -40}, {22, 36}}, color = {0, 127, 255}));
connect(pipe_co2_out.port_b, tank_co2.ports[1]) annotation(
Line(points = {{-2, -88}, {-50, -88}, {-50, -98}, {-80, -98}, {-80, -92}, {-80, -92}}, color = {0, 127, 255}));
connect(valve_beer_in.port_a, pipe_beer_in.port_b) annotation(
Line(points = {{-44, -42}, {-52, -42}}, color = {0, 127, 255}));
connect(pipe_beer_in.port_a, source_beer.ports[1]) annotation(
Line(points = {{-72, -42}, {-102, -42}}, color = {0, 127, 255}));
connect(pipe_beer_in2.port_a, valve_beer_in.port_b) annotation(
Line(points = {{-12, -40}, {-18, -40}, {-18, -42}, {-24, -42}}, color = {0, 127, 255}));
connect(step1.y, valve_beer_in.opening) annotation(
Line(points = {{-23, -16}, {-18, -16}, {-18, -34}, {-34, -34}}, color = {0, 0, 127}));
connect(valve_co2_out.port_b, pipe_co2_out.port_a) annotation(
Line(points = {{28, -76}, {28, -89}, {18, -89}, {18, -88}}, color = {0, 127, 255}));
connect(const2.y, valve_co2_out.opening) annotation(
Line(points = {{51, -48}, {56, -48}, {56, -68}, {38, -68}}, color = {0, 0, 127}));
connect(source_co2.ports[1], pipe_co2_in.port_a) annotation(
Line(points = {{-100, 18}, {-72, 18}}, color = {0, 127, 255}, thickness = 0.5));
connect(pipe_co2_in.port_b, valve_co2_in.port_a) annotation(
Line(points = {{-52, 18}, {-44, 18}}, color = {0, 127, 255}));
//Verbindungen
connect(pipe_beer_out.port_b, bottle.ports[1]) annotation(
Line(points = {{80, 18}, {88, 18}, {88, 28}, {70, 28}, {70, 38}}, color = {0, 127, 255}));
connect(const.y, valve_co2_in.opening) annotation(
Line(points = {{-23, 44}, {-18, 44}, {-18, 26}, {-34, 26}}, color = {0, 0, 127}));
connect(valve_co2_in.port_b, pipe_co2_in2.port_a) annotation(
Line(points = {{-24, 18}, {-12, 18}}, color = {0, 127, 255}));
annotation(
uses(Modelica(version = "3.2.2")));
end Abfueller;
Best Regards
lwinklmann
Hello,
thanks for the quick answer! Now it works, thank you!
best regards,
lwinklmann
Hi everyone,
can someone tell me if there's any library that provides a tank with the same properties like the open tank in modelica.fluid.vessels but closed instead of opened?
I'd really Need this for my work.
Thank you.
I was trying to simulate a simple fluids model that i built up with OMEdit
The Simulation-Output-window says that the Simulation process failed and the grid shows no results. Why does that happen?
Here's my sourcecode:
model Test_Abfueller
Modelica.Fluid.Vessels.OpenTank tank(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, crossArea = 1, height = 1, level_start = 23, nPorts = 1) annotation(
Placement(visible = true, transformation(origin = {62, 4}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
Modelica.Fluid.Pipes.StaticPipe pipe(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, diameter = 0.05, length = 1) annotation(
Placement(visible = true, transformation(origin = {-30, -28}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
inner Modelica.Fluid.System system annotation(
Placement(visible = true, transformation(origin = {-70, 70}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.Boundary_pT boundary(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, T = 278, nPorts = 1, p = 600000) annotation(
Placement(visible = true, transformation(origin = {-92, -28}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(pipe.port_b, tank.ports[1]) annotation(
Line(points = {{-20, -28}, {28, -28}, {28, -46}, {62, -46}, {62, -16}}, color = {0, 127, 255}));
connect(boundary.ports[1], pipe.port_a) annotation(
Line(points = {{-82, -28}, {-40, -28}, {-40, -28}, {-40, -28}}, color = {0, 127, 255}, thickness = 0.5));
annotation(
uses(Modelica(version = "3.2.2")));
end Test_Abfueller;
I hope someone can help me with this. I'd appreciate any help.
- Index
- » Users
- » lwinklmann
- » Profile