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
  • Index
  • » Users
  • » victor
  • » Profile

Posts

Posts

Sep-06-21 07:58:38
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

Jul-26-21 07:28:36
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?

Mar-09-21 05:44:32
Fluid library to complicated for OMC?

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

Mar-08-21 11:06:23
Fluid library to complicated for OMC?

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

Jan-07-21 13:32:38
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;

Dec-02-20 12:24:31
Dip pipe in closed tank

I’ve been working on what should be a fairly simple model. I have a dip pipe inside a closed tank. There is also an air/water inlet and a water outlet. The variable h varies with the water level. I’ve tried to implement this but none of the solutions seems to work. Any recommendation.

What I thought would work:

Code:


Real h(start=0.5);
when h > 0.5 then
    // Use equations for water out the dip pipe
end when;

when h < 0.5 then
    // Use equations for air out the dip pipe
end when;

Any ideas? I’ve also tried using a variable in the when statements that “activates” the different function. Like Q_out = someequation * water_level_high

Nov-02-20 14:42:48
Ramp overshoots and crashes simulation

I've made a simulation where I use blocks.sources.ramp to open a valve (go from 0-1) the problem is that the ramp does not stop at 1 as expected. It keeps going until the simulation crashes. Any idea what I'm done wrong?

Code:


Modelica.Blocks.Sources.Ramp ramp(duration = 6, height = 1, offset = 0, startTime = 30)

Between the valve and ramp I’ve inserted a gain(k=1) since there is some strange bug if this is not there. The error I get without the gain:

Code:

[1] 14:47:20 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:47:20 Translation Error
Jacobian StateSetJac28 contains non-linear components. This indicates a singular system or internal generation errors.

[3] 14:47:20 Translation Warning
Assuming fixed start value for the following 2 variables:
         tank.medium.T:VARIABLE(min = max(1.0, max(1.0, 1.0)) max = min(10000.0, min(10000.0, 10000.0)) start = tank.T_start unit = "K" fixed = true nominal = 300.0 stateSelect=StateSelect.prefer )  "Temperature of medium"test, Modelica.Fluid.Vessels.OpenTank, tank.Medium.BaseProperties type: Real
         $STATESET1.x[1]:VARIABLE(start = /*Real*/($STATESET1.A[1,1]) * $START.tank.level + /*Real*/($STATESET1.A[1,2]) * $START.pump.medium.p + /*Real*/($STATESET1.A[1,3]) * $START.pump.s + /*Real*/($STATESET1.A[1,4]) * $START.firstOrder.y fixed = true )  type: Real [2]

[4] 14:47:20 Translation Error
Jacobian StateSetJac36 contains non-linear components. This indicates a singular system or internal generation errors.

[5] 14:47:20 Translation Error
[C:/OM116/OM64bit/OMCompiler/Compiler/SimCode/SimCodeUtil.mo: 4493:9-4493:59]: Internal error function createStateSetsSets failed.

[6] 14:47:20 Translation Error
[C:/OM116/OM64bit/OMCompiler/Compiler/SimCode/SimCodeUtil.mo: 748:5-748:146]: Internal error function createSimCode failed [Transformation from optimised DAE to simulation code structure failed]

Any idea?

Getting the same problem with the latest release. Added bug report here: https://trac.openmodelica.org/OpenModel … 166#ticket

Trying to find the bug in my other post I’ve been running examples. When trying to run /Fluid/Examples/PumpingSystem.mo in OpenModelica v1.16.0-dev.beta1 (64-bit). I get errors and can’t start the simulation. Anyone know what’s going on?

Code:


[1] 14:48:00 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:48:00 Translation Error
Internal error IndexReduction.pantelidesIndexReduction failed! System is structurally singular and cannot be handled because the number of unassigned equations is larger than the number of states. Use -d=bltdump to get more information.

[3] 14:48:00 Translation Error
post-optimization module replaceHomotopyWithSimplified (initialization) failed.

[4] 14:48:00 Translation Error
No system for the symbolic initialization was generated

Hi!

I’m trying to work with openModelica but I keep running in to bugs (or more likely user mistakes) like this. The model shown below works when the pipe is removed, but as soon as I add it I get errors. My biggest issue is not knowing where to start to debug this. Can one able to help?

Code:


model test
replaceable package Medium =
      Modelica.Media.Water.ConstantPropertyLiquidWater                           constrainedby
    Modelica.Media.Interfaces.PartialMedium "Medium in the component"
      annotation (choicesAllMatching = true);
     
  Modelica.Fluid.Vessels.OpenTank tank(redeclare package Medium = Medium, crossArea = 1, height = 4, level(start = 4 * 0.8), nPorts = 1, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.3, height = 0)}, use_portsData = true)  annotation(
    Placement(visible = true, transformation(origin = {-42, 64}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Sources.FixedBoundary boundary(redeclare package Medium = Medium, nPorts = 1, p = 200000) annotation(
    Placement(visible = true, transformation(origin = {44, 8}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
  inner Modelica.Fluid.System system annotation(
    Placement(visible = true, transformation(origin = {-78, 84}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Machines.PrescribedPump pump(
  redeclare function flowCharacteristic =
        Modelica.Fluid.Machines.BaseClasses.PumpCharacteristics.quadraticFlow (
          V_flow_nominal={0.1,0.25,0.46}, head_nominal={46,40,30}), redeclare package Medium = Medium,N_const = 300, N_nominal = 1200, T_start = system.T_start, V = 50, checkValve = true, energyDynamics = Modelica.Fluid.Types.Dynamics.FixedInitial, massDynamics = Modelica.Fluid.Types.Dynamics.FixedInitial, use_N_in = false
  )  annotation(
    Placement(visible = true, transformation(origin = {-40, 8}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Pipes.StaticPipe pipe(redeclare package Medium = Medium, diameter = 0.3, length = 5)  annotation(
    Placement(visible = true, transformation(origin = {0, 8}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(tank.ports[1], pump.port_a) annotation(
    Line(points = {{-42, 54}, {-50, 54}, {-50, 8}, {-50, 8}}, color = {0, 127, 255}));
  connect(pump.port_b, pipe.port_a) annotation(
    Line(points = {{-30, 8}, {-10, 8}, {-10, 8}, {-10, 8}}, color = {0, 127, 255}));
  connect(pipe.port_b, boundary.ports[1]) annotation(
    Line(points = {{10, 8}, {34, 8}, {34, 8}, {34, 8}}, color = {0, 127, 255}));

annotation(
    uses(Modelica(version = "3.2.3")));
end test;

Errors:

Code:


[3] 08:22:04 Translation Error
Internal error IndexReduction.pantelidesIndexReduction failed! System is structurally singular and cannot be handled because the number of unassigned equations is larger than the number of states. Use -d=bltdump to get more information.

[4] 08:22:04 Translation Error
Internal error Transformation Module PFPlusExt index Reduction Method Pantelides failed!

[5] 08:22:04 Translation Error
[C:/OM116/OM64bit/OMCompiler/Compiler/SimCode/SimCodeUtil.mo: 4491:9-4491:59]: Internal error function createStateSetsSets failed.

[6] 08:22:04 Translation Error
[C:/OM116/OM64bit/OMCompiler/Compiler/SimCode/SimCodeUtil.mo: 746:5-746:146]: Internal error function createSimCode failed [Transformation from optimised DAE to simulation code structure failed]

Adding more complexity made it work again. So I think this must be a bug
Using OpenModelica v1.16.0-dev.beta1 (64-bit)

May-16-20 17:17:02
Div by zero error in simple heat flow model

Thanks I upgraded from v.1.14.0-Dev beta 3 and now it works

May-15-20 18:51:41
Div by zero error in simple heat flow model

Hi! I'm trying to run the simple model below in OpenModelica. But I get an error like below. I can't fingure out what I'm doing wrong. Any ideas?

Error:
solver will try to handle division by zero at time 0: if (-pump.flowPort_a.m_flow) >= 0.0 then -pump.flowPort_a.m_flow else -0.0

Code:

model test

    parameter Modelica.Thermal.FluidHeatFlow.Media.Medium medium=Modelica.Thermal.FluidHeatFlow.Media.Medium()
    "Cooling medium"
    annotation(choicesAllMatching=true);
  parameter Modelica.SIunits.Temperature TAmb(displayUnit="degC")=293.15
    "Ambient temperature";
  Modelica.Thermal.FluidHeatFlow.Sources.Ambient ambient2(constantAmbientPressure = 0, constantAmbientTemperature = TAmb, medium = medium) annotation(
    Placement(visible = true, transformation(extent = {{40, -10}, {60, 10}}, rotation = 0)));
  Modelica.Thermal.FluidHeatFlow.Sources.Ambient ambient1(constantAmbientPressure = 0, constantAmbientTemperature = TAmb, medium = medium) annotation(
    Placement(visible = true, transformation(extent = {{-60, -10}, {-80, 10}}, rotation = 0)));
  Modelica.Thermal.FluidHeatFlow.Components.Pipe pipe(T0 = TAmb, T0fixed = true, V_flowLaminar = 0.1, V_flowNominal = 1, dpLaminar(displayUnit = "Pa") = 0.1, dpNominal(displayUnit = "Pa") = 1, h_g = 0, m = 0.1, medium = medium, useHeatPort = false) annotation(
    Placement(visible = true, transformation(extent = {{0, -10}, {20, 10}}, rotation = 0)));
  Modelica.Thermal.FluidHeatFlow.Sources.VolumeFlow pump(T0 = TAmb, constantVolumeFlow = 1, m = 0, medium = medium, useVolumeFlowInput = true) annotation(
    Placement(visible = true, transformation(extent = {{-40, -10}, {-20, 10}}, rotation = 0)));
  Modelica.Blocks.Sources.Constant volumeFlow(k = 1) annotation(
    Placement(visible = true, transformation(extent = {{-60, 10}, {-40, 30}}, rotation = 0)));
equation
  connect(ambient1.flowPort, pump.flowPort_a) annotation(
    Line(points = {{-60, 0}, {-40, 0}}, color = {255, 0, 0}));
  connect(volumeFlow.y, pump.volumeFlow) annotation(
    Line(points = {{-39, 20}, {-30, 20}, {-30, 10}}, color = {0, 0, 127}));
  connect(pump.flowPort_b, pipe.flowPort_a) annotation(
    Line(points = {{-20, 0}, {0, 0}}, color = {255, 0, 0}));
  connect(pipe.flowPort_b, ambient2.flowPort) annotation(
    Line(points = {{20, 0}, {40, 0}}, color = {255, 0, 0}));
  annotation(
    uses(Modelica(version = "3.2.3")));
end test;

Jan-03-20 12:47:39
Is there any way to set travel time (open/close) on fluid valves in Modelica?

thanks that solves it

Jan-02-20 14:24:03
Is there any way to set travel time (open/close) on fluid valves in Modelica?

Is there any way to set travel time (open/close) on fluid valves in Modelica?

I have a PID controlling a valve by pressure, but it doesn’t get very realistic with out travel time on the valve.

Dec-06-19 12:52:54
Heat flow not changing with mass flow
Category: Programming

Potential fix comming on monday - https://trac.openmodelica.org/OpenModel … 735#ticket

Dec-05-19 19:59:08
Heat flow not changing with mass flow
Category: Programming

I've tried switching to StandardWater but I cant complie the model with this. Seems like a bug since I can't run the example HeatingSystem either

penModelica 1.14.0

Dec-05-19 18:21:50
Heat flow not changing with mass flow
Category: Programming

Hi!

I'm trying to build a system that show how much my flow will heat up. I've built the model below. The issue is that over 10s it heats to 25C, this is the same if I change the flow rate. It looks like it's just heating the water and not taking flow in to account. Any one know what I'm doing wrong?

Code:


model test
replaceable package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater
    constrainedby Modelica.Media.Interfaces.PartialMedium;
  inner Modelica.Fluid.System system(T_ambient = 288.15)  annotation(
    Placement(visible = true, transformation(origin = {-82, 88}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Sources.FixedBoundary boundary(redeclare package Medium = Medium, T = Modelica.SIunits.Conversions.from_degC(15), nPorts = 1, p = Modelica.SIunits.Conversions.from_bar(3), use_T = true, use_p = true)  annotation(
    Placement(visible = true, transformation(origin = {-76, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Sources.FixedBoundary boundary1(redeclare package Medium = Medium, nPorts = 1, p = Modelica.SIunits.Conversions.from_bar(1))  annotation(
    Placement(visible = true, transformation(origin = {76, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
  Modelica.Fluid.Valves.ValveLinear valveLinear(redeclare package Medium = Medium, dp_nominal = 200000, m_flow_nominal = 0.166667)  annotation(
    Placement(visible = true, transformation(origin = {26, -4}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
   Modelica.Fluid.Pipes.DynamicPipe heater(
    redeclare package Medium = Medium,
    redeclare model HeatTransfer =
        Modelica.Fluid.Pipes.BaseClasses.HeatTransfer.IdealFlowHeatTransfer,
    redeclare model FlowModel =
        Modelica.Fluid.Pipes.BaseClasses.FlowModels.DetailedPipeFlow,
    diameter= 0.5,
    length= 1,
    modelStructure=Modelica.Fluid.Types.ModelStructure.a_v_b,
    nNodes=1,
    use_HeatTransfer=true, use_T_start = false)
    annotation (Placement(visible = true, transformation(extent = {{-38, -12}, {-18, 8}}, rotation = 0)));
  Modelica.Blocks.Sources.Constant const(k = 1)  annotation(
    Placement(visible = true, transformation(origin = {6, 26}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow fixedHeatFlow(Q_flow = 400000, T_ref = 288.15, alpha = 0)  annotation(
    Placement(visible = true, transformation(origin = {-46, 22}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(const.y, valveLinear.opening) annotation(
    Line(points = {{17, 26}, {26, 26}, {26, 4}}, color = {0, 0, 127}));
  connect(valveLinear.port_b, boundary1.ports[1]) annotation(
    Line(points = {{36, -4}, {66, -4}, {66, -2}, {66, -2}}, color = {0, 127, 255}));
  connect(boundary.ports[1], heater.port_a) annotation(
    Line(points = {{-66, -2}, {-38, -2}, {-38, -2}, {-38, -2}}, color = {0, 127, 255}));
  connect(heater.port_b, valveLinear.port_a) annotation(
    Line(points = {{-18, -2}, {16, -2}, {16, -4}, {16, -4}, {16, -4}}, color = {0, 127, 255}));
  connect(fixedHeatFlow.port, heater.heatPorts[1]) annotation(
    Line(points = {{-36, 22}, {-28, 22}, {-28, 2}, {-28, 2}}, color = {191, 0, 0}));
  annotation(
    uses(Modelica(version = "3.2.2")));
end test;

I'm new to openmodelica and I'm trying to get to know the fluid package. Do you really need to manualy add the medium to every component?

Now I'm adding this to every component

Code:

redeclare package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater

Cant this be done from the GUI?

  • Index
  • » Users
  • » victor
  • » Profile
You are here: