Reputation: 145
I try to model a hydraulic system in Twinbuilder with Modelica. But I get always errors which I think has to do with convergence problem. To understand what the problem is, I simplified my system to a dynamic pipe, fixed boundary, and swept volume whose movement will be given by a sinus function. But I still get an error in this simplified case. I am able to compile the model even though I get warnings. When I try to solve the model,. It is not solved. I want to ask if you give me a suggestion on this problem?
This is block diagramm of the model
Errors which I get when I try to solve the model are as follows:
Error occured when entering initialization mode on Hochdruckreiniger3_1.
Error encountered in the Initialize function of user model.
Error encountered while initializing the simulators
Residual function evaluation failed at initial point for "1" From Hochdruckreiniger3_1: Jacobian evaluation failed at initial point for "1" From Hochdruckreiniger3_1: Failed to find a consistent solution in event iteration in "1", 0 at 0.0000000000000000E+000 From Hochdruckreiniger3_1: Residual function evaluation failed at initial point for "3" "#r171#" From Hochdruckreiniger3_1: Initialization failed.
The code is as follows:
model Hochdruckreiniger3
//Declaration(s)
Real V_max = 0.000003;
Real V_tod = 0.000002;
Real pi = 3.14;
Real N = 2800;
//Component(s)
Modelica.Fluid.Machines.SweptVolume Swept1 (
pistonCrossArea = 0.0001131,
clearance = 0.00000250621,
redeclare package Medium = Modelica.Media.Water.StandardWater,
nPorts = 1,
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.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.Pipes.DynamicPipe pipe1 (
length = 0.5,
diameter = 0.03,
redeclare package Medium = Modelica.Media.Water.StandardWater,
modelStructure = Modelica.Fluid.Types.ModelStructure.av_b);
equation
//Connection(s)
connect(Posit1.flange, Swept1.flange);
connect(Sine1.y, Posit1.s_ref);
connect(pipe1.port_b, Swept1.ports[1]);
connect(boundary.ports[1], pipe1.port_a);
end Hochdruckreiniger3;
Upvotes: 0
Views: 213
Reputation: 3413
Dymola shows two errors in you model:
pi
must be a constant
or parameter
to comply with the variability of the parameter phase
in the sine
block. By the way, it is good practice to refer to Modelica.Constants.pi
.swept1
you set use_portsData = true
but don´t provide any port data.Fixing these two issues, the model simulates but warns you about initial values not being explicitly set.
Upvotes: 5