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!
