Pressure inside the Sweptvolume component in Modelica - simulation

I model a system in Modelica, in which a fluid should be compressed from 4 bar to 500 bar. I give as boundary conditions 4 bar inlet pressure and 500 bar outlet pressure. I want to realize this compression by movement of a piston. The system can simulate when outlet pressure is defined as 10 bar. But it is not able to simulate at 500 bar outlet pressure. When outlet boundary condition is 500 bar then pressure inside the piston chamber is not higher than 500 bar. So I get negative massflow and pressure inside the piston chamber. Therefore simulation doesnt continue. When I look at pressure inside the chamber, it simply assumes medium pressure as the pressure which is defined at the ports of the piston. Compression movement of piston doesnt affect the pressure inside the piston, as pressure in piston given by the pressure at the ports of the piston. Do you know how to increase pressure inside the piston so that I can have a pressure level greater than 500 bar inside the piston?
I add the code and blockdiagram. Any help will be appreciated! Thanks a lot!
//----------------------------------------------------------------------------
// Name of Model: Hochdruckreiniger3
// Date: 11/15/20 21:16:37
// Generated from Modelica Diagram Editor
//----------------------------------------------------------------------------
model Hochdruckreiniger3
//Declaration(s)
Real V_max = 0.000003;
Real V_tod = 0.000002;
Real N = 2800;
Real opening_NP;
Real opening_HP;
replaceable package medium = Modelica.Media.Water.StandardWater( );
//Component(s)
Modelica.Fluid.Machines.SweptVolume Swept1 (
pistonCrossArea = 0.003131,
clearance = 0.000250621,
redeclare package Medium = medium,
nPorts = 3,
use_portsData = false,
p_start = system.p_start,
use_T_start = true,
T_start = 293.15);
inner Modelica.Fluid.System system;
Modelica.Mechanics.Translational.Sources.Position Posit1 (exact = true, useSupport = false);
Modelica.Blocks.Sources.Sine Sine1 (
amplitude = 0.005567,
freqHz = 46.66,
offset = 0.005567,
phase = -Modelica.Constants.pi/2);
Modelica.Fluid.Sources.FixedBoundary boundary (p = 500e5, redeclare package Medium = medium, nPorts = 1);
Modelica.Fluid.Pipes.DynamicPipe pipe2 (
length = 0.5,
diameter = 0.03,
redeclare package Medium = medium,
momentumDynamics = system.momentumDynamics,
massDynamics = Modelica.Fluid.Types.Dynamics.DynamicFreeInitial,
energyDynamics = system.energyDynamics,
allowFlowReversal = system.allowFlowReversal,
modelStructure = Modelica.Fluid.Types.ModelStructure.av_b);
Modelica.Fluid.Pipes.DynamicPipe pipe3 (
length = 0.5,
diameter = 0.03,
redeclare package Medium = medium,
momentumDynamics = system.momentumDynamics,
massDynamics = Modelica.Fluid.Types.Dynamics.DynamicFreeInitial,
energyDynamics = system.energyDynamics,
allowFlowReversal = system.allowFlowReversal,
modelStructure = Modelica.Fluid.Types.ModelStructure.a_vb);
Modelica.Fluid.Pipes.DynamicPipe pipe4 (
length = 0.5,
diameter = 0.03,
redeclare package Medium = medium,
momentumDynamics = system.momentumDynamics,
massDynamics = Modelica.Fluid.Types.Dynamics.DynamicFreeInitial,
energyDynamics = system.energyDynamics,
allowFlowReversal = system.allowFlowReversal,
modelStructure = Modelica.Fluid.Types.ModelStructure.a_vb);
Modelica.Fluid.Sources.FixedBoundary boundary1 (p = 500e5, redeclare package Medium = medium, nPorts = 1);
Modelica.Fluid.Pipes.DynamicPipe pipe5 (
length = 0.5,
diameter = 0.3,
redeclare package Medium = medium,
momentumDynamics = system.momentumDynamics,
massDynamics = Modelica.Fluid.Types.Dynamics.DynamicFreeInitial,
energyDynamics = system.energyDynamics,
allowFlowReversal = system.allowFlowReversal,
modelStructure = Modelica.Fluid.Types.ModelStructure.av_b);
Modelica.Blocks.Sources.Pulse Puls1 (period = 0.02142, width = 45.331);
Modelica.Blocks.Sources.Pulse Puls2 (period = 0.02142, startTime = 0.01071, width = 45.331);
Modelica.Fluid.Valves.ValveLinear NDVentile (dp_nominal = 94.35, m_flow_nominal = 0.05867441, redeclare package Medium = medium);
Modelica.Fluid.Valves.ValveLinear HDVentile (dp_nominal = 95, m_flow_nominal = 0.05867441, redeclare package Medium = medium);
Modelica.Fluid.Sensors.Pressure pressureamSweptvolume (redeclare package Medium = medium);
Modelica.Fluid.Sensors.Pressure PressureanderPipe (redeclare package Medium = medium);
Modelica.Fluid.Sensors.Pressure PressureanBeginnderHochdruckventile (redeclare package Medium = medium);
Modelica.Fluid.Sensors.Pressure Pressure_amEndederHDVentile (redeclare package Medium = medium);
Modelica.Fluid.Pipes.DynamicPipe pipe1 (
length = 0.5,
diameter = 0.03,
redeclare package Medium = medium,
momentumDynamics = system.momentumDynamics,
massDynamics = Modelica.Fluid.Types.Dynamics.DynamicFreeInitial,
energyDynamics = system.energyDynamics,
allowFlowReversal = system.allowFlowReversal,
modelStructure = Modelica.Fluid.Types.ModelStructure.a_vb);
Modelica.Fluid.Vessels.ClosedVolume volume (
V = 7e-9,
nPorts = 2,
use_portsData = false,
redeclare package Medium = medium,
p_start = 26.5e5);
equation
if der(Sine1.y)>=0 then
opening_NP=1;
opening_HP=0;
else
opening_NP=0;
opening_HP=1;
end if;
//Connection(s)
connect(Posit1.flange, Swept1.flange);
connect(Sine1.y, Posit1.s_ref);
connect(pipe2.port_b, Swept1.ports[1]);
connect(Swept1.ports[2], pipe3.port_a);
connect(pipe4.port_b, boundary1.ports[1]);
connect(boundary.ports[1], pipe5.port_a);
connect(pipe5.port_b, NDVentile.port_a);
connect(NDVentile.port_b, pipe2.port_a);
connect(NDVentile.opening, Puls1.y);
connect(Puls2.y, HDVentile.opening);
connect(pipe3.port_b, HDVentile.port_a);
connect(pressureamSweptvolume.port, Swept1.ports[3]);
connect(PressureanderPipe.port, pipe3.port_a);
connect(PressureanBeginnderHochdruckventile.port, HDVentile.port_b);
connect(Pressure_amEndederHDVentile.port, HDVentile.port_a);
connect(pipe1.port_a, PressureanBeginnderHochdruckventile.port);
connect(pipe1.port_b, volume.ports[1]);
connect(volume.ports[2], pipe4.port_a);
end Hochdruckreiniger3;

you can view the annotations by clicking on the down-arrows at the bar with the line numbers on the left side unless you have used the graphical editor to model your model.

Related

Classes in Modelica

I have a complex model in Modelica. As I have lots of components in my model, I want to define classes and include some components inside the classes to reduce the complexity of the model. Since I couldn`t find online an example of the use of classes which are used in Modelica, could you give an idea how to define classes in Modelica?
The code is as follows;
model HD_3Kolben_bsp
//Declaration(s)
Real V_max = 0.000003;
Real V_tod = 0.000002;
Real N = 2800;
replaceable package medium = Modelica.Media.Water.StandardWater( );
Real opening_HP;
Real opening_LP;
constant Modelica.SIunits.AbsolutePressure patm = 1e5;
Real opening_HP_2;
Real opening_LP_2;
Real opening_HP_3;
Real opening_LP_3;
constant Modelica.SIunits.Frequency freq = 46;
//Component(s)
Modelica.Fluid.Machines.SweptVolume Kolben1 (
pistonCrossArea = 0.0001131,
clearance = 0.00000250621,
redeclare package Medium = Modelica.Media.Water.StandardWater,
nPorts = 1,
use_portsData = false,
use_T_start = true,
T_start = 293.15,
V(start = 0.005),
m(start = 0.005));
inner Modelica.Fluid.System system (p_ambient = 101325);
Modelica.Mechanics.Translational.Sources.Position Posit1 (exact = true, useSupport = false);
Modelica.Blocks.Sources.Sine Sine1 (
amplitude = 0.005567,
freqHz = freq,
offset = 0.005567,
phase = +Modelica.Constants.pi/2.01,
startTime = 0);
Modelica.Fluid.Vessels.ClosedVolume ClosedVolume1 (
V = 0.000005/2,
nPorts = 3,
redeclare package Medium = medium,
use_portsData = false);
Modelica.Fluid.Pipes.DynamicPipe pipe_Swept_CV_1 (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Pipes.DynamicPipe pipe_CV_HD_1 (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Sources.FixedBoundary Auslass (p = patm, redeclare package Medium = medium, nPorts = 1);
Modelica.Fluid.Valves.ValveLinear HDVentile1 (
dp_nominal = 95,
m_flow_nominal = 0.05867441,
redeclare package Medium = medium,
opening = opening_HP);
Modelica.Fluid.Pipes.DynamicPipe pipe_ND_CV_1 (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Valves.ValveLinear NDVentile1 (
dp_nominal = 94.35,
m_flow_nominal = 0.05867441,
redeclare package Medium = medium,
opening = opening_LP);
Modelica.Fluid.Pipes.DynamicPipe pipe_Ein_ND (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Sources.FixedBoundary Einlass (p = 4e5, redeclare package Medium = Modelica.Media.Water.StandardWater, nPorts = 1);
Modelica.Mechanics.Translational.Sensors.PositionSensor Position;
Modelica.Mechanics.Translational.Sensors.PositionSensor Position2;
Modelica.Fluid.Valves.ValveLinear NDVentile2 (
dp_nominal = 94.35,
m_flow_nominal = 0.05867441,
redeclare package Medium = medium,
opening = opening_LP_2);
Modelica.Fluid.Pipes.DynamicPipe pipe_ND_CV_2 (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Valves.ValveLinear HDVentile2 (
dp_nominal = 95,
m_flow_nominal = 0.05867441,
redeclare package Medium = medium,
opening = opening_HP_2);
Modelica.Fluid.Pipes.DynamicPipe pipe_CV_HD_2 (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Pipes.DynamicPipe pipe_Swept_CV_2 (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Vessels.ClosedVolume ClosedVolume2 (
V = 0.000005/2,
nPorts = 3,
redeclare package Medium = medium,
use_portsData = false);
Modelica.Blocks.Sources.Sine Sine2 (
amplitude = 0.005567,
freqHz = freq,
offset = 0.005567,
phase = +Modelica.Constants.pi/2.01,
startTime = 7/(3*freq));
Modelica.Mechanics.Translational.Sources.Position Posit2 (exact = true, useSupport = false);
Modelica.Fluid.Machines.SweptVolume Kolben2 (
pistonCrossArea = 0.0001131,
clearance = 0.00000250621,
redeclare package Medium = Modelica.Media.Water.StandardWater,
nPorts = 1,
use_portsData = false,
use_T_start = true,
T_start = 293.15,
V(start = 0.005),
m(start = 0.005));
Modelica.Mechanics.Translational.Sensors.PositionSensor Position3;
Modelica.Fluid.Valves.ValveLinear NDVentile3 (
dp_nominal = 94.35,
m_flow_nominal = 0.05867441,
redeclare package Medium = medium,
opening = opening_LP_3);
Modelica.Fluid.Pipes.DynamicPipe pipe_ND_CV_3 (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Valves.ValveLinear HDVentile3 (
dp_nominal = 95,
m_flow_nominal = 0.05867441,
redeclare package Medium = medium,
opening = opening_HP_3);
Modelica.Fluid.Pipes.DynamicPipe pipe_CV_HD_3 (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Pipes.DynamicPipe pipe_Swept_CV_3 (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Vessels.ClosedVolume ClosedVolume3 (
V = 0.000005/2,
nPorts = 3,
redeclare package Medium = medium,
use_portsData = false);
Modelica.Blocks.Sources.Sine Sine3 (
amplitude = 0.005567,
freqHz = freq,
offset = 0.005567,
phase = +Modelica.Constants.pi/2.01,
startTime = 14/(3*freq));
Modelica.Mechanics.Translational.Sources.Position Posit3 (exact = true, useSupport = false);
Modelica.Fluid.Machines.SweptVolume Kolben3 (
pistonCrossArea = 0.0001131,
clearance = 0.00000250621,
redeclare package Medium = Modelica.Media.Water.StandardWater,
nPorts = 1,
use_portsData = false,
use_T_start = true,
T_start = 293.15,
V(start = 0.005),
m(start = 0.005));
Modelica.Fluid.Sources.FixedBoundary boundary1 (p = 4e5, redeclare package Medium = Modelica.Media.Water.StandardWater, nPorts = 1);
Modelica.Fluid.Pipes.DynamicPipe pipe1 (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Sources.FixedBoundary boundary2 (p = 4e5, redeclare package Medium = Modelica.Media.Water.StandardWater, nPorts = 1);
Modelica.Fluid.Pipes.DynamicPipe pipe2 (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Pipes.DynamicPipe pipe3 (
length = 0.005,
diameter = 0.0055,
redeclare package Medium = medium,
roughness = 2.5E-5,
modelStructure = Modelica.Fluid.Types.ModelStructure.av_b);
Modelica.Fluid.Pipes.DynamicPipe pipe4 (
length = 0.005,
diameter = 0.0055,
redeclare package Medium = medium,
roughness = 2.5E-5,
modelStructure = Modelica.Fluid.Types.ModelStructure.av_b);
Modelica.Fluid.Pipes.DynamicPipe pipe5 (
length = 0.005,
diameter = 0.0055,
redeclare package Medium = medium,
roughness = 2.5E-5,
modelStructure = Modelica.Fluid.Types.ModelStructure.av_b);
Modelica.Fluid.Pipes.DynamicPipe pipe6 (
length = 0.24,
diameter = 0.005,
redeclare package Medium = medium,
roughness = 2.5E-5,
modelStructure = Modelica.Fluid.Types.ModelStructure.a_vb);
Modelica.Fluid.Vessels.ClosedVolume volume2 (
V = 3.13e-6,
nPorts = 4,
redeclare package Medium = medium,
use_portsData = false);
Modelica.Fluid.Fittings.SimpleGenericOrifice orifice (diameter = 0.005, zeta = 0.98, redeclare package Medium = medium);
Modelica.Fluid.Pipes.DynamicPipe pipe7 (
length = 0.005,
diameter = 0.005,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Sensors.VolumeFlowRate Volum1 (redeclare package Medium = medium);
equation
if der(Position.s)>=0 then
opening_LP=1;
opening_HP=0;
else
opening_LP=0;
opening_HP=1;
end if;
if der(Position2.s)>=0 then
opening_LP_2=1;
opening_HP_2=0;
else
opening_LP_2=0;
opening_HP_2=1;
end if;
if der(Position3.s)>=0 then
opening_LP_3=1;
opening_HP_3=0;
else
opening_LP_3=0;
opening_HP_3=1;
end if;
//Connection(s)
connect(Posit1.flange, Kolben1.flange);
connect(Sine1.y, Posit1.s_ref);
connect(pipe_Swept_CV_1.port_a, Kolben1.ports[1]);
connect(pipe_CV_HD_1.port_b, HDVentile1.port_a);
connect(NDVentile1.port_b, pipe_ND_CV_1.port_a);
connect(Einlass.ports[1], pipe_Ein_ND.port_a);
connect(Posit1.flange, Position.flange);
connect(Position2.flange, Posit2.flange);
connect(NDVentile2.port_b, pipe_ND_CV_2.port_a);
connect(HDVentile2.port_a, pipe_CV_HD_2.port_b);
connect(pipe_Swept_CV_2.port_a, Kolben2.ports[1]);
connect(Sine2.y, Posit2.s_ref);
connect(Posit2.flange, Kolben2.flange);
connect(Position3.flange, Posit3.flange);
connect(NDVentile3.port_b, pipe_ND_CV_3.port_a);
connect(HDVentile3.port_a, pipe_CV_HD_3.port_b);
connect(pipe_Swept_CV_3.port_a, Kolben3.ports[1]);
connect(Sine3.y, Posit3.s_ref);
connect(Posit3.flange, Kolben3.flange);
connect(boundary1.ports[1], pipe1.port_a);
connect(boundary2.ports[1], pipe2.port_a);
connect(pipe_Ein_ND.port_b, NDVentile1.port_a);
connect(pipe1.port_b, NDVentile2.port_a);
connect(pipe2.port_b, NDVentile3.port_a);
connect(HDVentile1.port_b, pipe3.port_a);
connect(HDVentile2.port_b, pipe4.port_a);
connect(HDVentile3.port_b, pipe5.port_a);
connect(pipe_Swept_CV_1.port_b, ClosedVolume1.ports[1]);
connect(pipe_ND_CV_1.port_b, ClosedVolume1.ports[2]);
connect(pipe_CV_HD_1.port_a, ClosedVolume1.ports[3]);
connect(pipe_Swept_CV_2.port_b, ClosedVolume2.ports[1]);
connect(pipe_ND_CV_2.port_b, ClosedVolume2.ports[2]);
connect(pipe_CV_HD_2.port_a, ClosedVolume2.ports[3]);
connect(pipe_Swept_CV_3.port_b, ClosedVolume3.ports[1]);
connect(pipe_ND_CV_3.port_b, ClosedVolume3.ports[2]);
connect(pipe_CV_HD_3.port_a, ClosedVolume3.ports[3]);
connect(pipe3.port_b, volume2.ports[1]);
connect(pipe4.port_b, volume2.ports[2]);
connect(pipe5.port_b, volume2.ports[3]);
connect(volume2.ports[4], pipe6.port_a);
connect(orifice.port_a, pipe6.port_b);
connect(orifice.port_b, pipe7.port_a);
connect(Volum1.port_b, Auslass.ports[1]);
connect(Volum1.port_a, pipe7.port_b);
end HD_3Kolben_bsp;
You are already using classes.
From the [doc][1]:
The keyword class is used to define general classes (without any restrictions). It is identical to the keyword model. In most cases, it is recommended to use specialized classes as connector, model, block, package, record, function, type. "class" should be used to define ExternalObjects, and can be used for classes merely containing documentation and/or graphics.
In your example, e.g. the models Modelica.Fluid.Pipes.DynamicPipe, Modelica.Fluid.Vessels.ClosedVolume are reusable classes/models. If you have a reocurring set of pipes, volumes and valves, you may put them into one model to later reuse it.
[1]: https://doc.modelica.org/ModelicaReference%203.2.3/Resources/helpDymola/ModelicaReference_Classes.html#ModelicaReference.Classes

Effect of the pipe diameter in speed of the simulation - Modelica

I use Ansys TwinBuilder R2.4 for Modelica simulations. I modeled a hydraulic system in Modelica which can be simulated in certain conditions, e.g. when the diameter of the pipe, which is located before the "Auslass" boundary condition, is 5 mm, when I change it to 8 mm, simulation doesn´t proceed. It slows down the progress of the simulation considerably. What can be reason of the difference in speed of the simulation only if the diameter of the pipe is changed? I added block diagram and the code of the model.
model HD_3Kolben_bsp
//Declaration(s)
Real V_max = 0.000003;
Real V_tod = 0.000002;
Real N = 2800;
replaceable package medium = Modelica.Media.Water.StandardWater( );
Real opening_HP;
Real opening_LP;
constant Modelica.SIunits.AbsolutePressure patm = 1e5;
Real opening_HP_2;
Real opening_LP_2;
Real opening_HP_3;
Real opening_LP_3;
constant Modelica.SIunits.Frequency freq = 46;
//Component(s)
Modelica.Fluid.Machines.SweptVolume Kolben1 (
pistonCrossArea = 0.0001131,
clearance = 0.00000250621,
redeclare package Medium = Modelica.Media.Water.StandardWater,
nPorts = 1,
use_portsData = false,
use_T_start = true,
T_start = 293.15,
V(start = 0.005),
m(start = 0.005));
inner Modelica.Fluid.System system (p_ambient = 101325);
Modelica.Mechanics.Translational.Sources.Position Posit1 (exact = true, useSupport = false);
Modelica.Blocks.Sources.Sine Sine1 (
amplitude = 0.005567,
freqHz = freq,
offset = 0.005567,
phase = +Modelica.Constants.pi/2.01,
startTime = 0);
Modelica.Fluid.Vessels.ClosedVolume ClosedVolume1 (
V = 0.000005/2,
nPorts = 3,
redeclare package Medium = medium,
use_portsData = false);
Modelica.Fluid.Pipes.DynamicPipe pipe_Swept_CV_1 (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Pipes.DynamicPipe pipe_CV_HD_1 (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Sources.FixedBoundary Auslass (p = patm, redeclare package Medium = medium, nPorts = 1);
Modelica.Fluid.Valves.ValveLinear HDVentile1 (
dp_nominal = 95,
m_flow_nominal = 0.05867441,
redeclare package Medium = medium,
opening = opening_HP);
Modelica.Fluid.Pipes.DynamicPipe pipe_ND_CV_1 (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Valves.ValveLinear NDVentile1 (
dp_nominal = 94.35,
m_flow_nominal = 0.05867441,
redeclare package Medium = medium,
opening = opening_LP);
Modelica.Fluid.Pipes.DynamicPipe pipe_Ein_ND (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Sources.FixedBoundary Einlass (p = 4e5, redeclare package Medium = Modelica.Media.Water.StandardWater, nPorts = 1);
Modelica.Mechanics.Translational.Sensors.PositionSensor Position;
Modelica.Mechanics.Translational.Sensors.PositionSensor Position2;
Modelica.Fluid.Valves.ValveLinear NDVentile2 (
dp_nominal = 94.35,
m_flow_nominal = 0.05867441,
redeclare package Medium = medium,
opening = opening_LP_2);
Modelica.Fluid.Pipes.DynamicPipe pipe_ND_CV_2 (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Valves.ValveLinear HDVentile2 (
dp_nominal = 95,
m_flow_nominal = 0.05867441,
redeclare package Medium = medium,
opening = opening_HP_2);
Modelica.Fluid.Pipes.DynamicPipe pipe_CV_HD_2 (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Pipes.DynamicPipe pipe_Swept_CV_2 (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Vessels.ClosedVolume ClosedVolume2 (
V = 0.000005/2,
nPorts = 3,
redeclare package Medium = medium,
use_portsData = false);
Modelica.Blocks.Sources.Sine Sine2 (
amplitude = 0.005567,
freqHz = freq,
offset = 0.005567,
phase = +Modelica.Constants.pi/2.01,
startTime = 7/(3*freq));
Modelica.Mechanics.Translational.Sources.Position Posit2 (exact = true, useSupport = false);
Modelica.Fluid.Machines.SweptVolume Kolben2 (
pistonCrossArea = 0.0001131,
clearance = 0.00000250621,
redeclare package Medium = Modelica.Media.Water.StandardWater,
nPorts = 1,
use_portsData = false,
use_T_start = true,
T_start = 293.15,
V(start = 0.005),
m(start = 0.005));
Modelica.Mechanics.Translational.Sensors.PositionSensor Position3;
Modelica.Fluid.Valves.ValveLinear NDVentile3 (
dp_nominal = 94.35,
m_flow_nominal = 0.05867441,
redeclare package Medium = medium,
opening = opening_LP_3);
Modelica.Fluid.Pipes.DynamicPipe pipe_ND_CV_3 (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Valves.ValveLinear HDVentile3 (
dp_nominal = 95,
m_flow_nominal = 0.05867441,
redeclare package Medium = medium,
opening = opening_HP_3);
Modelica.Fluid.Pipes.DynamicPipe pipe_CV_HD_3 (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Pipes.DynamicPipe pipe_Swept_CV_3 (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Vessels.ClosedVolume ClosedVolume3 (
V = 0.000005/2,
nPorts = 3,
redeclare package Medium = medium,
use_portsData = false);
Modelica.Blocks.Sources.Sine Sine3 (
amplitude = 0.005567,
freqHz = freq,
offset = 0.005567,
phase = +Modelica.Constants.pi/2.01,
startTime = 14/(3*freq));
Modelica.Mechanics.Translational.Sources.Position Posit3 (exact = true, useSupport = false);
Modelica.Fluid.Machines.SweptVolume Kolben3 (
pistonCrossArea = 0.0001131,
clearance = 0.00000250621,
redeclare package Medium = Modelica.Media.Water.StandardWater,
nPorts = 1,
use_portsData = false,
use_T_start = true,
T_start = 293.15,
V(start = 0.005),
m(start = 0.005));
Modelica.Fluid.Sources.FixedBoundary boundary1 (p = 4e5, redeclare package Medium = Modelica.Media.Water.StandardWater, nPorts = 1);
Modelica.Fluid.Pipes.DynamicPipe pipe1 (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Sources.FixedBoundary boundary2 (p = 4e5, redeclare package Medium = Modelica.Media.Water.StandardWater, nPorts = 1);
Modelica.Fluid.Pipes.DynamicPipe pipe2 (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
Modelica.Fluid.Pipes.DynamicPipe pipe3 (
length = 0.005,
diameter = 0.0055,
redeclare package Medium = medium,
roughness = 2.5E-5,
modelStructure = Modelica.Fluid.Types.ModelStructure.av_b);
Modelica.Fluid.Pipes.DynamicPipe pipe4 (
length = 0.005,
diameter = 0.0055,
redeclare package Medium = medium,
roughness = 2.5E-5,
modelStructure = Modelica.Fluid.Types.ModelStructure.av_b);
Modelica.Fluid.Pipes.DynamicPipe pipe5 (
length = 0.005,
diameter = 0.0055,
redeclare package Medium = medium,
roughness = 2.5E-5,
modelStructure = Modelica.Fluid.Types.ModelStructure.av_b);
Modelica.Fluid.Pipes.DynamicPipe pipe6 (
length = 5,
diameter = 0.005,
redeclare package Medium = medium,
roughness = 2.5E-5,
modelStructure = Modelica.Fluid.Types.ModelStructure.a_vb);
Modelica.Fluid.Vessels.ClosedVolume volume2 (
V = 3.13e-6,
nPorts = 4,
redeclare package Medium = medium,
use_portsData = false);
Modelica.Fluid.Fittings.SimpleGenericOrifice orifice (diameter = 0.005, zeta = 5, redeclare package Medium = medium);
Modelica.Fluid.Pipes.DynamicPipe pipe7 (
length = 0.005,
diameter = 0.005,
redeclare package Medium = medium,
roughness = 2.5E-5);
equation
if der(Position.s)>=0 then
opening_LP=1;
opening_HP=0;
else
opening_LP=0;
opening_HP=1;
end if;
if der(Position2.s)>=0 then
opening_LP_2=1;
opening_HP_2=0;
else
opening_LP_2=0;
opening_HP_2=1;
end if;
if der(Position3.s)>=0 then
opening_LP_3=1;
opening_HP_3=0;
else
opening_LP_3=0;
opening_HP_3=1;
end if;
//Connection(s)
connect(Posit1.flange, Kolben1.flange);
connect(Sine1.y, Posit1.s_ref);
connect(pipe_Swept_CV_1.port_a, Kolben1.ports[1]);
connect(pipe_CV_HD_1.port_b, HDVentile1.port_a);
connect(NDVentile1.port_b, pipe_ND_CV_1.port_a);
connect(Einlass.ports[1], pipe_Ein_ND.port_a);
connect(Posit1.flange, Position.flange);
connect(Position2.flange, Posit2.flange);
connect(NDVentile2.port_b, pipe_ND_CV_2.port_a);
connect(HDVentile2.port_a, pipe_CV_HD_2.port_b);
connect(pipe_Swept_CV_2.port_a, Kolben2.ports[1]);
connect(Sine2.y, Posit2.s_ref);
connect(Posit2.flange, Kolben2.flange);
connect(Position3.flange, Posit3.flange);
connect(NDVentile3.port_b, pipe_ND_CV_3.port_a);
connect(HDVentile3.port_a, pipe_CV_HD_3.port_b);
connect(pipe_Swept_CV_3.port_a, Kolben3.ports[1]);
connect(Sine3.y, Posit3.s_ref);
connect(Posit3.flange, Kolben3.flange);
connect(boundary1.ports[1], pipe1.port_a);
connect(boundary2.ports[1], pipe2.port_a);
connect(pipe_Ein_ND.port_b, NDVentile1.port_a);
connect(pipe1.port_b, NDVentile2.port_a);
connect(pipe2.port_b, NDVentile3.port_a);
connect(HDVentile1.port_b, pipe3.port_a);
connect(HDVentile2.port_b, pipe4.port_a);
connect(HDVentile3.port_b, pipe5.port_a);
connect(pipe_Swept_CV_1.port_b, ClosedVolume1.ports[1]);
connect(pipe_ND_CV_1.port_b, ClosedVolume1.ports[2]);
connect(pipe_CV_HD_1.port_a, ClosedVolume1.ports[3]);
connect(pipe_Swept_CV_2.port_b, ClosedVolume2.ports[1]);
connect(pipe_ND_CV_2.port_b, ClosedVolume2.ports[2]);
connect(pipe_CV_HD_2.port_a, ClosedVolume2.ports[3]);
connect(pipe_Swept_CV_3.port_b, ClosedVolume3.ports[1]);
connect(pipe_ND_CV_3.port_b, ClosedVolume3.ports[2]);
connect(pipe_CV_HD_3.port_a, ClosedVolume3.ports[3]);
connect(pipe3.port_b, volume2.ports[1]);
connect(pipe4.port_b, volume2.ports[2]);
connect(pipe5.port_b, volume2.ports[3]);
connect(volume2.ports[4], pipe6.port_a);
connect(orifice.port_a, pipe6.port_b);
connect(orifice.port_b, pipe7.port_a);
connect(pipe7.port_b, Auslass.ports[1]);
end HD_3Kolben_bsp;
Best regards
This can be a number of things. From a screenshot it is only possible to give very general advice. As it is "only" a parameter the system's structure shouldn't change. Therefore it is likely related to dynamics of the system. I would take a look at the solver log first, starting with the number of computed steps or the step-size. If that changed in an order of magnitude of the slow-down you experience this is a good starting point.
Another issue could be chattering, which could be judged with knowledge about the number of events that happened. These should also be visible from the solver log.
Some additional information that would help:
Which Modelica-Tool are you using?
The model itself (with which all of the below can be generated)
The solver log (before and after the parameter change)
The translation log incl. system properties like the sizes of equation systems (before and after the parameter change)
I'm afraid without any additional information you will not get utterly helpful advice...
It seems to me that you have used the default flowModel to calculate the pressure drop. This model depends on the pipe diameter (flow regime turbulent/laminar).
For a further detailed answer, I would need the information my colleague asks for in his answer above.

Controlled Pump Component - Initialization error - Modelica

I have a hydraulic system on Modelica. When I add Controlled Pump into the system, i get initialization errors.
Error occured when entering initialization mode on Hochdruckreiniger4_1
Initialize
Error encountered in the Initialize function of user model
Could you help me to solve this problem? I add below images of the settings of the model so that you can understand better the settings. I give required initialization values. But I get still errors relating to initialization. Thanks in advance for yor helps!
model Hochdruckreiniger4
//Declaration(s)
Real V_max = 0.000003;
Real V_tod = 0.000002;
Real N = 2800;
replaceable package medium = Modelica.Media.Water.StandardWater( );
//Component(s)
Modelica.Fluid.Sources.FixedBoundary boundary1 (p = 500e5, redeclare package Medium = Modelica.Media.Water.StandardWater, nPorts = 1);
Modelica.Fluid.Valves.ValveLinear HDVentile (dp_nominal = 95, m_flow_nominal = 0.05867441, redeclare package Medium = medium);
Modelica.Fluid.Valves.ValveLinear NDVentile (dp_nominal = 94.35, m_flow_nominal = 0.05867441, redeclare package Medium = medium);
Modelica.Blocks.Sources.Pulse Puls2 (period = 0.02142, startTime = 0.01071, width = 45.331);
Modelica.Blocks.Sources.Pulse Puls1 (period = 0.02142, width = 45.331);
Modelica.Fluid.Pipes.DynamicPipe pipe5 (
length = 0.5,
diameter = 0.3,
redeclare package Medium = Modelica.Media.Water.StandardWater,
momentumDynamics = system.momentumDynamics,
massDynamics = Modelica.Fluid.Types.Dynamics.DynamicFreeInitial,
energyDynamics = system.energyDynamics,
allowFlowReversal = system.allowFlowReversal,
modelStructure = Modelica.Fluid.Types.ModelStructure.av_b);
Modelica.Fluid.Pipes.DynamicPipe pipe4 (
length = 0.5,
diameter = 0.03,
redeclare package Medium = Modelica.Media.Water.StandardWater,
momentumDynamics = system.momentumDynamics,
massDynamics = Modelica.Fluid.Types.Dynamics.DynamicFreeInitial,
energyDynamics = system.energyDynamics,
allowFlowReversal = system.allowFlowReversal,
modelStructure = Modelica.Fluid.Types.ModelStructure.a_vb);
Modelica.Fluid.Pipes.DynamicPipe pipe3 (
length = 0.5,
diameter = 0.03,
redeclare package Medium = Modelica.Media.Water.StandardWater,
momentumDynamics = system.momentumDynamics,
massDynamics = Modelica.Fluid.Types.Dynamics.DynamicFreeInitial,
energyDynamics = system.energyDynamics,
allowFlowReversal = system.allowFlowReversal,
modelStructure = Modelica.Fluid.Types.ModelStructure.a_vb);
Modelica.Fluid.Pipes.DynamicPipe pipe2 (
length = 0.5,
diameter = 0.03,
redeclare package Medium = Modelica.Media.Water.StandardWater,
momentumDynamics = system.momentumDynamics,
massDynamics = Modelica.Fluid.Types.Dynamics.DynamicFreeInitial,
energyDynamics = system.energyDynamics,
allowFlowReversal = system.allowFlowReversal,
modelStructure = Modelica.Fluid.Types.ModelStructure.av_b);
Modelica.Fluid.Sources.FixedBoundary boundary (p = 4e5, redeclare package Medium = Modelica.Media.Water.StandardWater, nPorts = 1);
inner Modelica.Fluid.System system;
Modelica.Fluid.Machines.ControlledPump pump1 (
p_a_nominal = 4e5,
m_flow_nominal = 0.05,
control_m_flow = false,
rho_nominal = 990,
redeclare package Medium = medium,
N_nominal = 2800,
p_set = 550e5,
use_p_set = true,
p_a_start = 4e5,
p_b_start = 550e5,
m_flow_start = 0.05,
T_start = 293,
use_T_start = true,
allowFlowReversal = false,
energyDynamics = Modelica.Fluid.Types.Dynamics.DynamicFreeInitial,
V = 0,
massDynamics = Modelica.Fluid.Types.Dynamics.DynamicFreeInitial,
s(start = 1e-2),
N(start = 2800),
V_flow_single(start = 1));
equation
//Connection(s)
connect(boundary1.ports[1], pipe4.port_b);
connect(HDVentile.opening, Puls2.y);
connect(HDVentile.port_b, pipe4.port_a);
connect(HDVentile.port_a, pipe3.port_b);
connect(NDVentile.opening, Puls1.y);
connect(NDVentile.port_b, pipe2.port_a);
connect(NDVentile.port_a, pipe5.port_b);
connect(pipe5.port_a, boundary.ports[1]);
connect(pipe2.port_b, pump1.port_a);
connect(pump1.port_b, pipe3.port_a);
end Hochdruckreiniger4;

Error: Sizes do not match in connection - Sweptvolume and ClosedVolume -Modelica

I try to a model in which when the pressure inside the ClosedVolume exceed a certain pressure level, then HDVentile opens and the fluid flows into the boundary1 component. I defined the nports=1 in sweptvolume and nPorts =2 in ClosedVolume. In this case it throws an error saying
Sizes do not match in connection, size of 'ClosedVolume.ports' is [2] and size of 'Swept1.ports' is
If I set the nports=2 in sweptvolume and nPorts =2 in ClosedVolume, then it throws an error saying:
Assertion failed: each ports[i] of volume can at most be connected to one component. If two or more connections are present, ideal mixing takes place with these connections, which is usually not the intention of the modeller. Increase nPorts to add an additional port
Do you know how to handle this error? Thanks in advance!
model modelmitclosedvolume
//Declaration(s)
Real V_max = 0.000003;
Real V_tod = 0.000002;
Real N = 2800;
replaceable package medium = Modelica.Media.Water.StandardWater( );
//Component(s)
Modelica.Fluid.Machines.SweptVolume Swept1 (
pistonCrossArea = 0.0001131,
clearance = 0.000000250621,
redeclare package Medium = Modelica.Media.Water.StandardWater,
nPorts = 2,
use_portsData = false,
p_start = 1e5,
use_T_start = true,
T_start = 293.15,
V(start = 0.005),
m(start = 0.005));
inner Modelica.Fluid.System system (p_ambient = 101325);
Modelica.Mechanics.Translational.Sources.Position Posit1 (exact = true, useSupport = false);
Modelica.Blocks.Sources.Sine Sine1 (
amplitude = 0.005567,
freqHz = 46.66,
offset = 0.005567,
phase = -Modelica.Constants.pi/4);
Modelica.Fluid.Pipes.DynamicPipe pipe3 (
length = 0.5,
diameter = 0.03,
redeclare package Medium = Modelica.Media.Water.StandardWater,
momentumDynamics = system.momentumDynamics,
massDynamics = Modelica.Fluid.Types.Dynamics.DynamicFreeInitial,
energyDynamics = system.energyDynamics,
allowFlowReversal = system.allowFlowReversal,
modelStructure = Modelica.Fluid.Types.ModelStructure.a_vb);
Modelica.Fluid.Valves.ValveLinear HDVentile (dp_nominal = 95, m_flow_nominal = 0.05867441, redeclare package Medium = medium);
Modelica.Fluid.Pipes.DynamicPipe pipe4 (
length = 0.5,
diameter = 0.03,
redeclare package Medium = Modelica.Media.Water.StandardWater,
momentumDynamics = system.momentumDynamics,
massDynamics = Modelica.Fluid.Types.Dynamics.DynamicFreeInitial,
energyDynamics = system.energyDynamics,
allowFlowReversal = system.allowFlowReversal,
modelStructure = Modelica.Fluid.Types.ModelStructure.a_vb);
Modelica.Fluid.Sources.FixedBoundary boundary1 (p = 500e5, redeclare package Medium = Modelica.Media.Water.StandardWater, nPorts = 1);
Modelica.Fluid.Vessels.ClosedVolume ClosedVolume (
V = 0.005/6,
nPorts = 2,
portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=0.001),Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=0.001)},
redeclare package Medium = medium);
equation
//Connection(s)
connect(Posit1.flange, Swept1.flange);
connect(Sine1.y, Posit1.s_ref);
connect(pipe3.port_b, HDVentile.port_a);
connect(HDVentile.port_b, pipe4.port_a);
connect(pipe4.port_b, boundary1.ports[1]);
connect(ClosedVolume.ports[1], pipe3.port_a);
connect(ClosedVolume.ports, Swept1.ports);
end modelmitclosedvolume;
I think the last connect should be
connect(ClosedVolume.ports[2], Swept1.ports[1]);
and for Swept1 it should be nPorts = 1.
If you then add an input to HDVentile e.g. using
HDVentile.opening = 0;
the system should work.
Background: nports corresponds to the number of connections to the component. Then you usually only connect a single line to each port. Therefore you need two for the ClosedVolume and single one for Swept1.

Hydraulic system(Valve, Sweeping Volume, Pipe)- Modelica

This is a follow-up question. I am able to solve the simplified case. Now I make it more complicated. I insert valves( High pressure and low-pressure valve). The opening of these valves is dependent on the movement of sweeping volume. if sweeping volume increases, the low-pressure valve opens, if it decreases, high-pressure valve opens.
In this image, it is seen the left system and it works. But when I add another part (high-pressure valve and high-pressure boundary condition) it gives an error when I try to solve.
In this second image, you can see the whole system.
These are the errors that I get when I try to solve
Error occurred when entering initialization mode on Hochdruckreiniger3_1
Error encountered in the Initialize function of the user model.
Error encountered while initializing the simulators
This is the code.
model Hochdruckreiniger2
//Declaration(s)
Real V_max = 0.000003;
Real V_tod = 0.000002;
Real N = 2800;
Real f;
Real opening_NP;
Real opening_HP;
import Modelica.Constants.pi;
//Component(s)
Modelica.Fluid.Machines.SweptVolume Swept1 (
pistonCrossArea = 0.0001131,
clearance = 0.00000250621,
portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.012), Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=
0.012)},
redeclare package Medium = Modelica.Media.Water.StandardWater,
nPorts = 2,
use_portsData = true,
use_T_start = true,
T_start = 293.15);
inner Modelica.Fluid.System system;
Modelica.Mechanics.Translational.Sources.Position Posit1 (exact = true, useSupport = false);
Modelica.Fluid.Valves.ValveIncompressible Hochdruckventile (
dp_nominal = 96.38,
m_flow_nominal = 0.05867441,
rho_nominal = 1019.921,
opening = opening_HP,
redeclare package Medium = Modelica.Media.Water.StandardWater);
Modelica.Fluid.Valves.ValveIncompressible Niederdruckventile (
dp_nominal = 94.35,
m_flow_nominal = 0.05867441,
rho_nominal = 998.388,
opening = opening_NP,
redeclare package Medium = Modelica.Media.Water.StandardWater);
Modelica.Blocks.Sources.Sine Sine1 (
amplitude = 0.005567,
freqHz = 46.72,
offset = 0.005567,
phase = -pi/2);
Modelica.Fluid.Sources.FixedBoundary boundary (p = 4e5, redeclare package Medium = Modelica.Media.Water.StandardWater, nPorts = 1);
Modelica.Fluid.Sources.FixedBoundary boundary1 (p = 10e5, redeclare package Medium = Modelica.Media.Water.StandardWater, nPorts = 1);
Modelica.Fluid.Pipes.DynamicPipe pipe (
length = 0.5,
diameter = 0.03,
redeclare package Medium = Modelica.Media.Water.StandardWater,
modelStructure = Modelica.Fluid.Types.ModelStructure.a_vb);
Modelica.Fluid.Pipes.DynamicPipe pipe1 (
length = 0.5,
diameter = 0.03,
redeclare package Medium = Modelica.Media.Water.StandardWater,
modelStructure = Modelica.Fluid.Types.ModelStructure.a_vb);
Modelica.Fluid.Pipes.DynamicPipe pipe2 (
length = 0.5,
diameter = 0.03,
redeclare package Medium = Modelica.Media.Water.StandardWater,
modelStructure = Modelica.Fluid.Types.ModelStructure.a_vb);
Modelica.Fluid.Pipes.DynamicPipe pipe3 (
length = 0.5,
diameter = 0.03,
redeclare package Medium = Modelica.Media.Water.StandardWater,
modelStructure = Modelica.Fluid.Types.ModelStructure.a_vb);
equation
//T_per=pi/(180*3600*N/60);//Radian
f=(((V_max-V_tod)/2)*sin(2*pi*time*(60/N)))+V_tod+(V_max-V_tod)/2;
if der(f)>=0 then
opening_NP=1;
opening_HP=0;
else
opening_NP=0;
opening_HP=1;
end if;
//Connection(s)
connect(Posit1.flange, Swept1.flange);
connect(Sine1.y, Posit1.s_ref);
connect(boundary.ports[1], pipe.port_a);
connect(pipe.port_b, Niederdruckventile.port_a);
connect(Niederdruckventile.port_b, pipe1.port_a);
connect(pipe1.port_b, Swept1.ports[1]);
connect(Swept1.ports[2], pipe2.port_a);
connect(pipe2.port_b, Hochdruckventile.port_a);
connect(Hochdruckventile.port_b, pipe3.port_a);
connect(pipe3.port_b, boundary1.ports[1]);
end Hochdruckreiniger2;
If you can help me it would be great. Thanks in advance!