Start value problem in der() function of medium - Modelica - modelica

I am modeling with Modelica in Ansys Twin builder. I encounter with an initialization error when I compile the code, although I give initialization values. Error is as follows;
Iteration variable "der(Hochdrucktank.medium.h)" is missing start
value!
Iteration variable "der(Niederdrucktank.medium.h)" is missing start
value!
Iteration variable "der(Swept1.medium.p)" is missing start value!
The code is as follows;
model Hochdruckreiniger2
//Declaration(s)
Real V_max = 0.000003;
Real V_tod = 0.000002;
Real pi = 3.14;
Real N = 2800;
Real T_per;
Real f;
Real opening_NP;
Real opening_HP;
Real dummyStart_V_hochdrucktank(start=0);
Real dummyStart_V_niederdrucktank(start=0);
Real dummyStart_h_sweptvolume(start=0);
Real dummyStart2(start=0);
Real dummyStart3(start=0);
//Component(s)
Modelica.Fluid.Machines.SweptVolume Swept1 (
pistonCrossArea = 0.0001131,
clearance = 0.000002,
portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=
0.1),Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=
0.1)},
redeclare package Medium = Modelica.Media.Water.StandardWater,
nPorts = 2,
use_portsData = true,
p_start = 100,
use_T_start = true,
T_start = 293.15,
V(start = 10),
U(start = 20),
m(start = 10));
inner Modelica.Fluid.System system;
Modelica.Fluid.Vessels.OpenTank Niederdrucktank (
redeclare package Medium = Modelica.Media.Water.StandardWater,
nPorts = 1,
height = 40.84,
crossArea = 10,
portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=
0.1)},
h_start = 100,
V(start = 10));
Modelica.Fluid.Vessels.OpenTank Hochdrucktank (
redeclare package Medium = Modelica.Media.Water.StandardWater,
nPorts = 1,
height = 4997,
crossArea = 10,
portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=
0.1)},
h_start = 100,
V(start = 100));
Modelica.Mechanics.Translational.Sources.Position Posit1 (exact = true);
Modelica.Fluid.Valves.ValveIncompressible Hochdruckventile (
dp_nominal = 66.6175,
m_flow_nominal = 0.04873,
rho_nominal = 1019.921,
opening = opening_HP,
redeclare package Medium = Modelica.Media.Water.StandardWater);
Modelica.Fluid.Valves.ValveIncompressible Niederdruckventile (
dp_nominal = 65.21,
m_flow_nominal = 0.04873,
rho_nominal = 998.388,
opening = opening_NP,
redeclare package Medium = Modelica.Media.Water.StandardWater);
Modelica.Blocks.Sources.Sine Sine1 (amplitude = 0.000000629669, freqHz = 46.6666, offset = 0.00000313588);
equation
T_per=pi/(180*3600*N/60);//Radian
f=((V_max-V_tod)/2)*sin((2*pi*time*T_per)+(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;
dummyStart_V_hochdrucktank=der(Hochdrucktank.V);
dummyStart_V_niederdrucktank=der(Niederdrucktank.V);
dummyStart2=der(Hochdrucktank.medium.h);
dummyStart3=der(Niederdrucktank.medium.h);
dummyStart_h_sweptvolume=der(Swept1.medium.p);
//Connection(s)
connect(Posit1.flange, Swept1.flange);
connect(Hochdrucktank.ports[1], Hochdruckventile.port_a);
connect(Hochdruckventile.port_b, Swept1.ports[2]);
connect(Niederdrucktank.ports[1], Niederdruckventile.port_a);
connect(Niederdruckventile.port_b, Swept1.ports[1]);
connect(Sine1.y, Posit1.s_ref);
end Hochdruckreiniger2;
Do you know how to solve this problem? Thanks in advance for your helps!

Related

Simulation of a hydraulic system

I try to simulate a hydraulic machine in Ansys Twinbuilder 2021 R1 with Modelica language.
The whole system is in the following image;
Firstly I tried to divide the whole system into the subsystems. And I simulated the subsystems of pumpraum-1, pumpraum-2, pumpraum-3, outlet-components. And the subsystems work individually without any problem. Then I tried to compile the subsystems into the whole system. Then the simulation doesn`t proceed smoothly. It stops at any timestep and doesnt continue to the end of the simulation. What could be reason of that? How can I understand where is the problem in my whole system?
The code of my model 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_CV_HD_1 (
length = 0.005,
diameter = 0.002,
redeclare package Medium = medium,
roughness = 2.5E-5);
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.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.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.Vessels.ClosedVolume volume2 (
V = 3.13e-6,
nPorts = 4,
redeclare package Medium = medium,
use_portsData = false);
Modelica.Fluid.Pipes.StaticPipe pipe (length = 0.001, diameter = 0.002, redeclare package Medium = medium);
Modelica.Fluid.Pipes.StaticPipe pipe6 (length = 0.001, diameter = 0.002, redeclare package Medium = medium);
Modelica.Fluid.Pipes.StaticPipe pipe7 (length = 0.001, diameter = 0.002, redeclare package Medium = medium);
Modelica.Fluid.Pipes.DynamicPipe pipe10_steig (
length = 0.003,
diameter = 0.002721,
redeclare package Medium = medium,
roughness = 2.5E-5,
nNodes = 1,
modelStructure = Modelica.Fluid.Types.ModelStructure.av_b);
Modelica.Fluid.Pipes.DynamicPipe pipe9_steig (
length = 0.008,
diameter = 0.00598,
redeclare package Medium = medium,
roughness = 2.5E-5,
nNodes = 1,
modelStructure = Modelica.Fluid.Types.ModelStructure.av_b);
Modelica.Fluid.Pipes.DynamicPipe pipe8 (
length = 5,
diameter = 0.0057,
redeclare package Medium = medium,
roughness = 2.5E-5,
nNodes = 1,
modelStructure = Modelica.Fluid.Types.ModelStructure.av_b);
Modelica.Fluid.Fittings.SimpleGenericOrifice orifice4 (diameter = 0.00452, zeta = 3.5, redeclare package Medium = medium);
Modelica.Fluid.Pipes.DynamicPipe Duese_2 (
length = 0.0082,
diameter = 0.0042,
redeclare package Medium = medium,
roughness = 2.5E-5,
nNodes = 1,
modelStructure = Modelica.Fluid.Types.ModelStructure.av_b);
Modelica.Fluid.Pipes.DynamicPipe Duese_3 (
length = 0.018,
diameter = 0.00452,
redeclare package Medium = medium,
roughness = 2.5E-5,
nNodes = 1,
modelStructure = Modelica.Fluid.Types.ModelStructure.av_b);
Modelica.Fluid.Pipes.DynamicPipe Duese_4 (
length = 0.0002,
diameter = 0.0005,
redeclare package Medium = medium,
roughness = 2.5E-5,
nNodes = 1,
modelStructure = Modelica.Fluid.Types.ModelStructure.av_b);
Modelica.Fluid.Pipes.DynamicPipe Duese_1 (
length = 0.393,
diameter = 0.0074,
redeclare package Medium = medium,
roughness = 2.5E-5,
nNodes = 1,
modelStructure = Modelica.Fluid.Types.ModelStructure.av_b);
Modelica.Fluid.Pipes.DynamicPipe pistole_3 (
length = 0.02,
diameter = 0.004,
redeclare package Medium = medium,
roughness = 2.5E-5,
nNodes = 1,
modelStructure = Modelica.Fluid.Types.ModelStructure.av_b);
Modelica.Fluid.Fittings.SimpleGenericOrifice orifice2 (diameter = 0.005, zeta = 0.98, redeclare package Medium = medium);
Modelica.Fluid.Pipes.DynamicPipe pistole_1 (
length = 0.041,
diameter = 0.0057,
redeclare package Medium = medium,
roughness = 2.5E-5,
nNodes = 1,
modelStructure = Modelica.Fluid.Types.ModelStructure.av_b);
Modelica.Fluid.Fittings.SimpleGenericOrifice orifice1 (diameter = 0.005, zeta = 1, redeclare package Medium = medium);
Modelica.Fluid.Pipes.DynamicPipe pistole_2 (
length = 0.269,
diameter = 0.0069,
redeclare package Medium = medium,
roughness = 2.5E-5,
nNodes = 1,
modelStructure = Modelica.Fluid.Types.ModelStructure.av_b);
Modelica.Fluid.Pipes.DynamicPipe pipe9 (
length = 0.24,
diameter = 0.005,
redeclare package Medium = medium,
roughness = 2.5E-5,
modelStructure = Modelica.Fluid.Types.ModelStructure.av_b,
nNodes = 1);
Modelica.Fluid.Sources.FixedBoundary Auslass (p = patm, redeclare package Medium = medium, nPorts = 1);
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_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(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(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_ND_CV_1.port_b, ClosedVolume1.ports[2]);
connect(pipe_CV_HD_1.port_a, ClosedVolume1.ports[3]);
connect(pipe_ND_CV_2.port_b, ClosedVolume2.ports[2]);
connect(pipe_CV_HD_2.port_a, ClosedVolume2.ports[3]);
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(Kolben1.ports[1], pipe.port_a);
connect(pipe.port_b, ClosedVolume1.ports[1]);
connect(Kolben2.ports[1], pipe6.port_a);
connect(pipe6.port_b, ClosedVolume2.ports[1]);
connect(Kolben3.ports[1], pipe7.port_a);
connect(pipe7.port_b, ClosedVolume3.ports[1]);
connect(pipe10_steig.port_a, Duese_3.port_b);
connect(pipe9_steig.port_b, Duese_2.port_a);
connect(pipe9_steig.port_a, Duese_1.port_b);
connect(pipe10_steig.port_b, orifice4.port_a);
connect(pistole_3.port_a, pistole_2.port_b);
connect(pistole_1.port_b, pistole_2.port_a);
connect(pipe8.port_b, pistole_1.port_a);
connect(pipe8.port_a, orifice2.port_b);
connect(orifice4.port_b, Duese_4.port_a);
connect(Duese_2.port_b, Duese_3.port_a);
connect(Duese_4.port_b, Auslass.ports[1]);
connect(Duese_1.port_a, orifice1.port_b);
connect(pistole_3.port_b, orifice1.port_a);
connect(orifice2.port_a, pipe9.port_b);
connect(pipe9.port_a, volume2.ports[4]);
end HD_3Kolben_bsp;
//----------------------------------------------------------------------------
Using Dymola, and after reducing the relative tolerance of the solver, I'm getting this:
Model error - differentiated if-then-else was not continuous: (if
time < 0.050724637681159424 then 0 else Sine2.amplitudesin(289.02652413026095(time-0.050724637681159424)+Sine2.phase))
Value jumped from 0 to 0.00556683.
This error can be overcome by setting Posit2.exact = false. But then a follow-up error emerges, likely due to the quick change or an inconsistent overall system. This is difficult to judge without knowing the model in detail. So I'll leave that to somebody else to solve.
Besides that there are some issues with initialization, but they seem to be rather minor:
IF97 medium function called with too low pressure p = -35428.5 Pa <= 611.657 Pa (triple point pressure)
Failed condition: p > 611.657
Regarding the second comment:
The initialization issue should be solvable by setting (the important) variables from the following list. The list actually contains variables for which the simulation environment has to guess initial values, as they are not specified.
Assuming fixed start value for the continuous states:
ClosedVolume1.medium.h(start = ClosedVolume1.h_start)
ClosedVolume1.medium.p(start = 101325.0)
ClosedVolume2.medium.h(start = ClosedVolume2.h_start)
ClosedVolume2.medium.p(start = 101325.0)
ClosedVolume3.medium.h(start = ClosedVolume3.h_start)
ClosedVolume3.medium.p(start = 101325.0)
Duese_1.mediums[1].h(start = Duese_1.h_start)
Duese_1.mediums[1].p(start = Duese_1.ps_start[1])
Duese_2.mediums[1].h(start = Duese_2.h_start)
Duese_2.mediums[1].p(start = Duese_2.ps_start[1])
Duese_3.mediums[1].h(start = Duese_3.h_start)
Duese_3.mediums[1].p(start = Duese_3.ps_start[1])
Duese_4.mediums[1].h(start = Duese_4.h_start)
Duese_4.mediums[1].p(start = Duese_4.ps_start[1])
Kolben1.medium.h(start = Kolben1.h_start)
Kolben1.medium.p(start = 101325.0)
Kolben2.medium.h(start = Kolben2.h_start)
Kolben2.medium.p(start = 101325.0)
Kolben3.medium.h(start = Kolben3.h_start)
Kolben3.medium.p(start = 101325.0)
pipe1.mediums[1].h(start = pipe1.h_start)
pipe1.mediums[2].h(start = pipe1.h_start)
pipe1.mediums[2].p(start = pipe1.ps_start[2])
pipe2.mediums[1].h(start = pipe2.h_start)
pipe2.mediums[2].h(start = pipe2.h_start)
pipe2.mediums[2].p(start = pipe2.ps_start[2])
pipe3.mediums[1].h(start = pipe3.h_start)
pipe3.mediums[1].p(start = pipe3.ps_start[1])
pipe3.mediums[2].h(start = pipe3.h_start)
pipe3.mediums[2].p(start = pipe3.ps_start[2])
pipe4.mediums[1].h(start = pipe4.h_start)
pipe4.mediums[1].p(start = pipe4.ps_start[1])
pipe4.mediums[2].h(start = pipe4.h_start)
pipe4.mediums[2].p(start = pipe4.ps_start[2])
pipe5.mediums[1].h(start = pipe5.h_start)
pipe5.mediums[1].p(start = pipe5.ps_start[1])
pipe5.mediums[2].h(start = pipe5.h_start)
pipe5.mediums[2].p(start = pipe5.ps_start[2])
pipe8.mediums[1].h(start = pipe8.h_start)
pipe8.mediums[1].p(start = pipe8.ps_start[1])
pipe9.mediums[1].h(start = pipe9.h_start)
pipe9_steig.mediums[1].h(start = pipe9_steig.h_start)
pipe9_steig.mediums[1].p(start = pipe9_steig.ps_start[1])
pipe10_steig.mediums[1].h(start = pipe10_steig.h_start)
pipe10_steig.mediums[1].p(start = pipe10_steig.ps_start[1])
pipe_CV_HD_1.mediums[1].h(start = pipe_CV_HD_1.h_start)
pipe_CV_HD_1.mediums[2].h(start = pipe_CV_HD_1.h_start)
pipe_CV_HD_1.mediums[2].p(start = pipe_CV_HD_1.ps_start[2])
pipe_CV_HD_2.mediums[1].h(start = pipe_CV_HD_2.h_start)
pipe_CV_HD_2.mediums[2].h(start = pipe_CV_HD_2.h_start)
pipe_CV_HD_2.mediums[2].p(start = pipe_CV_HD_2.ps_start[2])
pipe_CV_HD_3.mediums[1].h(start = pipe_CV_HD_3.h_start)
pipe_CV_HD_3.mediums[2].h(start = pipe_CV_HD_3.h_start)
pipe_CV_HD_3.mediums[2].p(start = pipe_CV_HD_3.ps_start[2])
pipe_Ein_ND.mediums[1].h(start = pipe_Ein_ND.h_start)
pipe_Ein_ND.mediums[2].h(start = pipe_Ein_ND.h_start)
pipe_Ein_ND.mediums[2].p(start = pipe_Ein_ND.ps_start[2])
pipe_ND_CV_1.mediums[1].h(start = pipe_ND_CV_1.h_start)
pipe_ND_CV_1.mediums[1].p(start = pipe_ND_CV_1.ps_start[1])
pipe_ND_CV_1.mediums[2].h(start = pipe_ND_CV_1.h_start)
pipe_ND_CV_2.mediums[1].h(start = pipe_ND_CV_2.h_start)
pipe_ND_CV_2.mediums[1].p(start = pipe_ND_CV_2.ps_start[1])
pipe_ND_CV_2.mediums[2].h(start = pipe_ND_CV_2.h_start)
pipe_ND_CV_3.mediums[1].h(start = pipe_ND_CV_3.h_start)
pipe_ND_CV_3.mediums[1].p(start = pipe_ND_CV_3.ps_start[1])
pipe_ND_CV_3.mediums[2].h(start = pipe_ND_CV_3.h_start)
pistole_1.mediums[1].h(start = pistole_1.h_start)
pistole_1.mediums[1].p(start = pistole_1.ps_start[1])
pistole_2.mediums[1].h(start = pistole_2.h_start)
pistole_2.mediums[1].p(start = pistole_2.ps_start[1])
pistole_3.mediums[1].h(start = pistole_3.h_start)
pistole_3.mediums[1].p(start = pistole_3.ps_start[1])
volume2.medium.h(start = volume2.h_start)
volume2.medium.p(start = 101325.0)

Warning : The component is declared multiple times and can not be verified to be identical to other declaration(s) with the same name - Modelica

I get a warning when I model with Modelica on Twin builder. Warning is: The component m_flow_start is declared multiple times and can not be verified to be identical to other declaration(s) with the same name. Even though this warning seems not so important for my model, I would like to learn why this warning occurs and how to avoid it.
Do you know how to deal with this warning?
model Hochdruckreiniger3
//Declaration(s)
Real V_max = 2506e-6;
Real V_tod = 3765e-6;
Real N = 2800;
Real opening_NP;
Real opening_HP;
Real dp_nominal_ND = (0.7*rho_ND*0.01135*0.01135)/(3600/(2*N*N));
Real dp_nominal_HD = (0.7*rho_HD*0.01135*0.01135)/(3600/(2*N*N));
Real rho_ND = 998.388;
Real rho_HD = 1019.921;
Real m_flow_ND = rho_ND*0.000113097*0.01135*N/60;
Real m_flow_HD = rho_HD*0.000113097*0.01135*N/60;
//Component(s)
Modelica.Fluid.Machines.SweptVolume Swept1 (
pistonCrossArea = 0.0001131,
clearance = 0.00000250621,
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;
Modelica.Mechanics.Translational.Sources.Position Posit1 (exact = true, useSupport = false);
Modelica.Blocks.Sources.Sine Sine1 (
amplitude = 0.005567,
freqHz = 16.66,
offset = 0.005567,
phase = -Modelica.Constants.pi/4);
Modelica.Fluid.Sources.FixedBoundary boundary (p = 4e5, redeclare package Medium = Modelica.Media.Water.StandardWater, nPorts = 1);
Modelica.Fluid.Pipes.DynamicPipe pipe1 (
length = 0.5,
diameter = 0.03,
redeclare package Medium = Modelica.Media.Water.StandardWater,
modelStructure = Modelica.Fluid.Types.ModelStructure.av_b);
Modelica.Fluid.Valves.ValveIncompressible Niederdruckventile (
dp_nominal = dp_nominal_ND,
m_flow_nominal = m_flow_ND,
rho_nominal = rho_ND,
opening = opening_NP,
redeclare package Medium = Modelica.Media.Water.StandardWater);
Modelica.Fluid.Pipes.DynamicPipe pipe2 (
length = 0.002,
diameter = 0.011,
redeclare package Medium = Modelica.Media.Water.StandardWater,
modelStructure = Modelica.Fluid.Types.ModelStructure.av_b);
Modelica.Fluid.Pipes.DynamicPipe pipe3 (
length = 0.019,
diameter = 0.0055,
redeclare package Medium = Modelica.Media.Water.StandardWater,
modelStructure = Modelica.Fluid.Types.ModelStructure.a_vb);
Modelica.Fluid.Valves.ValveIncompressible Hochdruckventile (
dp_nominal = dp_nominal_HD,
m_flow_nominal = m_flow_HD,
rho_nominal = rho_HD,
opening = opening_HP,
redeclare package Medium = Modelica.Media.Water.StandardWater);
Modelica.Fluid.Pipes.DynamicPipe pipe4 (
length = 0.5,
diameter = 0.03,
redeclare package Medium = Modelica.Media.Water.StandardWater,
modelStructure = Modelica.Fluid.Types.ModelStructure.a_vb);
Modelica.Fluid.Sources.FixedBoundary boundary1 (p = 5e5, redeclare package Medium = Modelica.Media.Water.StandardWater, nPorts = 1);
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(Niederdruckventile.port_b, pipe2.port_a);
connect(pipe2.port_b, Swept1.ports[1]);
connect(boundary.ports[1], pipe1.port_a);
connect(pipe1.port_b, Niederdruckventile.port_a);
connect(Swept1.ports[2], pipe3.port_a);
connect(pipe3.port_b, Hochdruckventile.port_a);
connect(Hochdruckventile.port_b, pipe4.port_a);
connect(pipe4.port_b, boundary1.ports[1]);
end Hochdruckreiniger3;
Thanks in advance!
I believe you can just ignore it.
As far as I could see internally in Dymola the issue is in Modelica.Fluid.Pipes.BaseClasses.FlowModels.PartialStaggeredFlowModel inheriting from Modelica.Fluid.Interfaces.PartialDistributedFlow, and both contain definitions of m_flow_start that differ slightly in MSL 3.2.3 - but only in terms of the parameter-dialog:
parameter Medium.MassFlowRate m_flow_start=system.m_flow_start
"Start value of mass flow rates"
annotation(Dialog(tab="Internal Interface",enable=false,group = "Initialization"));
vs.
parameter Medium.MassFlowRate m_flow_start=system.m_flow_start
"Start value of mass flow rates"
annotation(Dialog(tab="Initialization"));
BTW: The model has a number of issues with lack of parameter it should be:
parameter Real V_max = 2506e-6;
parameter Real V_tod = 3765e-6;
parameter Real N = 2800;
Real opening_NP;
Real opening_HP;
parameter Real dp_nominal_ND = (0.7*rho_ND*0.01135*0.01135)/(3600/(2*N*N));
parameter Real dp_nominal_HD = (0.7*rho_HD*0.01135*0.01135)/(3600/(2*N*N));
parameter Real rho_ND = 998.388;
parameter Real rho_HD = 1019.921;
parameter Real m_flow_ND = rho_ND*0.000113097*0.01135*N/60;
parameter Real m_flow_HD = rho_HD*0.000113097*0.01135*N/60;

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!