Search code examples
modelicaopenmodelicapressure

Depressurization of a reservoir with high pressure gas by opening a valve


I'm newbie in modelica and I'm trying to simulate a epressurization of a tank with high pressure hydrogen gas by opening a valve. The idea is to verify the change in flow through the valve with the decrease in pressure over time in the reservoir.

The only model that I see suitable for this is the Modelica.Fluid.Vessels.ClosedVolume.

Model screenshot

But I having trouble to model this, because I getting this error.

The initialization finished successfully with 3 homotopy steps. The following assertion has been violated at time 5.000000 ((valveOpening.y >= 0.0 and valveOpening.y <= 1.0)) --> "Variable violating min/max constraint: 0.0 <= valveOpening.y <= 1.0, has value: 1" The arguments u_min and u_max provided in the function call solveOneNonlinearEquation(f,u_min,u_max) do not bracket the root of the single non-linear equation 0=f(u): u_min = 200 u_max = 6000 fa = f(u_min) = 11416.4 fb = f(u_max) = 1.04699e+08 fa and fb must have opposite sign which is not the case Process crashed

Is this the best way to solve my problem?


Solution

  • Judging from the error message, it seems you have configured valveOpening to output values greater than one. This violates the max condition in this line

    Modelica.Blocks.Interfaces.RealInput opening(min=0,max=1)
    

    of the valve (Modelica.Fluid.Valves.ValveLinear).

    Unfortunately, it is not possible to be sure that this is the error as you didn't post code for the model...