Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Fluid library to complicated for OMC?

Fluid library to complicated for OMC?

I’m still struggling with getting the fluid library to work consistently. I’ve created a pretty simple model which uses a PID to control a pump that pumps against a valve that creates some back pressure.

This model works perfectly in Dymola but in OMC I get all kinds of errors both with this and if I do changes. Could any one help with what I’m doing wrong? Or is the fluid library just to “complicated” for OMC at this stage?

Model:

Code:


model test
replaceable package Medium =
      Modelica.Media.Water.ConstantPropertyLiquidWater                           constrainedby
    Modelica.Media.Interfaces.PartialMedium "Medium in the component"
      annotation (choicesAllMatching = true);
  Modelica.Fluid.Sources.FixedBoundary boundary(redeclare package Medium = Medium, nPorts = 1, p = 160000, use_p = true)  annotation(
    Placement(visible = true, transformation(origin = {-86, -36}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Sources.FixedBoundary boundary1(redeclare package Medium = Medium, nPorts = 1, p = system.p_ambient, use_p = true)  annotation(
    Placement(visible = true, transformation(origin = {64, -36}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
  inner Modelica.Fluid.System system(p_start(displayUnit = "Pa") = 160000)  annotation(
    Placement(visible = true, transformation(origin = {-84, 78}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Valves.ValveIncompressible valveIncompressible(redeclare package Medium = Medium, CvData = Modelica.Fluid.Types.CvTypes.OpPoint, dp_nominal(displayUnit = "Pa") = 50000, m_flow(fixed = false), m_flow_nominal = 250, opening_nominal = 1)  annotation(
    Placement(visible = true, transformation(origin = {24, -36}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Machines.PrescribedPump pump(redeclare package Medium = Medium, redeclare function flowCharacteristic =
        Modelica.Fluid.Machines.BaseClasses.PumpCharacteristics.quadraticFlow (
          V_flow_nominal={0,0.25,0.5}, head_nominal={100,60,0}), N(fixed = false), N_nominal = 1200, V = 1, checkValve = true, energyDynamics = Modelica.Fluid.Types.Dynamics.FixedInitial, massDynamics = Modelica.Fluid.Types.Dynamics.FixedInitial, use_N_in = true) annotation(
    Placement(visible = true, transformation(origin = {-58, -36}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Sources.Constant setpoint(k = 0.2) annotation(
    Placement(visible = true, transformation(origin = {-83, 57}, extent = {{-5, -5}, {5, 5}}, rotation = 0)));
  Modelica.Fluid.Sensors.VolumeFlowRate volumeFlowRate(redeclare package Medium = Medium) annotation(
    Placement(visible = true, transformation(origin = {-26, -36}, extent = {{-6, -6}, {6, 6}}, rotation = 0)));
  Modelica.Blocks.Continuous.LimPID pid(Ti = 0.1, controllerType = Modelica.Blocks.Types.SimpleController.PI, k = 125, yMax = 1200, yMin = 300, y_start = 300) annotation(
    Placement(visible = true, transformation(origin = {-54, 60}, extent = {{-6, -6}, {6, 6}}, rotation = 0)));
  Modelica.Blocks.Sources.Constant constant1(k = 0.7) annotation(
    Placement(visible = true, transformation(origin = {1, 13}, extent = {{-5, -5}, {5, 5}}, rotation = 0)));
equation
  connect(valveIncompressible.port_b, boundary1.ports[1]) annotation(
    Line(points = {{34, -36}, {54, -36}}, color = {0, 127, 255}));
  connect(boundary.ports[1], pump.port_a) annotation(
    Line(points = {{-76, -36}, {-68, -36}}, color = {0, 127, 255}));
  connect(pump.port_b, volumeFlowRate.port_a) annotation(
    Line(points = {{-48, -36}, {-32, -36}}, color = {0, 127, 255}));
  connect(setpoint.y, pid.u_s) annotation(
    Line(points = {{-78, 58}, {-61, 58}, {-61, 60}}, color = {0, 0, 127}));
  connect(volumeFlowRate.V_flow, pid.u_m) annotation(
    Line(points = {{-26, -29}, {-34, -29}, {-34, 50}, {-54, 50}, {-54, 53}}, color = {0, 0, 127}));
  connect(pid.y, pump.N_in) annotation(
    Line(points = {{-47, 60}, {-24, 60}, {-24, 38}, {-58, 38}, {-58, -26}}, color = {0, 0, 127}));
  connect(volumeFlowRate.port_b, valveIncompressible.port_a) annotation(
    Line(points = {{-20, -36}, {14, -36}}, color = {0, 127, 255}));
  connect(constant1.y, valveIncompressible.opening) annotation(
    Line(points = {{6.5, 13}, {24.5, 13}, {24.5, -29}}, color = {0, 0, 127}));
  annotation(
    uses(Modelica(version = "3.2.3")));
end test;

Re: Fluid library to complicated for OMC?

Tested in v1.17.0-dev.beta3 (64-bit) (windows) still loads of errors

Re: Fluid library to complicated for OMC?

This seems like a bug. Compiling this with the new front-end gets you:

Code:


[1] 14:52:43 Symbolic Warning
The model contains alias variables with redundant start and/or conflicting nominal values. It is recommended to resolve the conflicts, because otherwise the system could be hard to solve. To print the conflicting alias sets and the chosen candidates please use -d=aliasConflicts.

[2] 14:52:43 Translation Error
Jacobian StateSetJac0 contains non-linear components. This indicates a singular system or internal generation errors.

This is the errors you're getting when compiling? Also there are some errors during simulation:

Code:


C:/temp/FluidTest/FluidTest.exe -port=56775 -logFormat=xmltcp -override=startTime=0,stopTime=1,stepSize=0.002,tolerance=1e-6,solver=dassl,outputFormat=mat,variableFilter=.* -r=C:/temp/FluidTest/FluidTest_res.mat -w -lv=LOG_STATS -inputPath=C:/temp/FluidTest -outputPath=C:/temp/FluidTest
Matrix singular!
The initialization finished successfully with 3 homotopy steps.
Error solving nonlinear system 260 at time 0.366001
Error solving nonlinear system 260 at time 0.366001
nonlinear system 260 fails: at t=0.366001
[1] Real pid.limiter.u(start=0, nominal=1)
[2] Real pump.medium.p(start=160000, nominal=100000)
[3] Real pump.s(start=0, nominal=1)
Simulation process failed. Exited with code -1.

The old frontend seems to simulate this fine. I will make a bug report with this.

Re: Fluid library to complicated for OMC?

Re: Fluid library to complicated for OMC?

Thanks, I seem to end up in something like this every time my fluid models start getting complex

Re: Fluid library to complicated for OMC?

Tested again on v1.18.0-dev.beta1. Still getting same errors. I see there is no issue for this on github, trac issue here https://trac.openmodelica.org/OpenModelica/ticket/6410. Should I open a new one on github?

Re: Fluid library to complicated for OMC?

Same issue with latest v1.18.0. I've opened a new issue on github https://github.com/OpenModelica/OpenMod … ssues/7868

There are 0 guests and 0 other users also viewing this topic
You are here: