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

Hydraulic component problem

Hydraulic component problem

Good morning all !
The objective of my modeling is to model an anti-fall valve which, when it has a too high input flow (adjustable), closes.

So here is what I modeled :

So I put two ports (one input and one output). In between, a FlowSensor followed by a Variable Restriction. As a signal of this restriction, I put the following equation:

if ((Tarage*(1/60000)) < (flowSensor.y)) then 0 else 1



The value of my flow entering my system is 60 l / min. When I adjust my valve below this value, I have this following message:
Model error - differentiated if-then-else was not continuous:
(if clapet_Anti_Chute_Debit_OK.Tarage*1.6666666666666667E-05 < clapet_Anti_Chute_Debit_OK.flowSensor.y then thenExpression0_ else elseExpression1_)
Value jumped from 1 to 0.

Do you have an idea to help me? I've been blocking for days ...

Thank you !!



Edited by: GaelRLQT - Feb-27-20 07:27:17

Re: Hydraulic component problem

Could you attach the complete model you are testing? With so little information it is very difficult to know what gone wrong.

Re: Hydraulic component problem

Unfortunately I can't, I can't download anything from my work computer (security).
Doesn't my problem mean anything to you? The component seems so simple to model ...

Re: Hydraulic component problem

Many of us have no experience in modeling as we are in computer science. A minimal model showing the problem is very important to get good help. Also, it seems this error message does not come from OpenModelica, so it would be even harder to help you...

Re: Hydraulic component problem

Is it possible for you to copy and paste, as text, the model inside your answer?

Re: Hydraulic component problem

Yes of course !! Here it is :

model Clapet_Anti_Chute_Debit_OK
  OpenHydraulics.Interfaces.FluidPort IN
    annotation (Placement(transformation(extent={{-112,20},{-92,40}}), iconTransformation(extent={{-112,20},{-92,40}})));
  OpenHydraulics.Interfaces.FluidPort OUT(m_flow(start=20))
    annotation (Placement(transformation(extent={{208,20},{228,40}}), iconTransformation(extent={{208,20},{228,40}})));

  parameter Real Tarage = 60
  "Tarage du clapet (L/min)" annotation (Dialog(tab="Sizing"));

    // Si la pression détectée en entrée est inférieure à la valeur du tarage, alors cela veut dire que le fluide peut passer
    // A contrario, si la pression détectée est inférieure à la valeur du tarage, alors le fluide doit être bloqué

  OpenHydraulics_mod.Components.Sensors.FlowSensor flowSensor annotation (Placement(transformation(extent={{-26,24},
            {-6,44}})));
  Modelica.Blocks.Sources.RealExpression realExpression(y=if ((Tarage*(1/60000))
         < (flowSensor.y)) then 0 else 1)
    annotation (Placement(transformation(extent={{-52,-22},{56,-2}})));
  OpenHydraulics.Basic.VariableRestriction variableRestriction
    annotation (Placement(transformation(extent={{82,24},{62,44}})));
equation
  connect(realExpression.y, variableRestriction.control) annotation (Line(
        points={{61.4,-12},{72,-12},{72,26}},         color={0,0,127}));
  connect(variableRestriction.port_b, flowSensor.port_b)
    annotation (Line(points={{62,34},{-6,34}}, color={255,0,0}));
  connect(IN, flowSensor.port_a) annotation (Line(points={{-102,30},{-64,30},{-64,
          34},{-26,34}}, color={255,0,0}));
  connect(variableRestriction.port_a, OUT) annotation (Line(points={{82,34},{148,
          34},{148,30},{218,30}}, color={255,0,0}));
  annotation (
    Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{220,
            160}}), graphics={
        Line(points={{-92,30},{-20,30},{-2,30}}, color={0,0,0}),
        Ellipse(extent={{-2,52},{44,6}}, lineColor={0,0,0}),
        Line(points={{44,30},{60,50},{60,10},{78,50},{78,8},{96,50},{96,10},{118,50}}, color={0,0,0}),
        Line(points={{98,70},{138,30}}, color={0,0,0}),
        Line(points={{138,30},{98,-10}}, color={0,0,0}),
        Line(points={{138,30},{216,30}}, color={0,0,0}),
        Text(
          extent={{-134,74},{-68,38}},
          lineColor={0,0,0},
          lineThickness=0.5,
          textString="IN"),
        Text(
          extent={{186,78},{252,42}},
          lineColor={0,0,0},
          lineThickness=0.5,
          textString="OUT")}),
    Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{
            220,160}}), graphics={Text(
          extent={{-92,156},{210,114}},
          lineColor={28,108,200},
          textString="CLAPET ANTI-CHUTE
Je recherche ici a utiliser le VariableFlow comme un Go/No Go
Si le flux mesuré auflowSensor est inférieur à la valeur du tarage du clapet, le flux passe librement.
Si le flux mesuré au flowSensor est supérieur à la valeur du tarage du clapet, le flux est bloqué."),
                                                                                     Text(
          extent={{-58,-24},{212,-98}},
          lineColor={238,46,47},
          textStyle={TextStyle.Bold},
          textString="if ((Tarage*(1/60000)) < (flowSensor.y)) then 0 else 1")}),
    uses(OpenHydraulics(version="1.0"),
      OpenHydraulics_mod(version="1.0"),
      Modelica(version="3.2.2")));
end Clapet_Anti_Chute_Debit_OK;

Re: Hydraulic component problem

Hi,
I reviewed the model, of course it was impossible to know that you were using OpenHydraulics library before reading the code. I didn't know about this library but I have discharged it to test the model.
I think that there are several missunderstandings about how to use the library and connectors.
Regarding the library, the components you are using are extending the model Interfaces.PartialFluidComponent that, in order to supply the media you are going to use and ambient pressure and temperature,  references two outer models: oil and environment. These outer components are supplied by the Interfaces.PartialFluidCircuit model. So, the model that will containt your components should extend  Interfaces.PartialFluidCircuit. When extending you can change the media to the desired one.
Regarding connectors: You connect your components between them and finally you connect to an in port, and to an out port. But as you have two free ports  two equations are missing. This approach is OK if you are going to use your model as a component in connection with other components, but is not correct if you want to run this model as standalone. You need to supply two pressures, or a pressure and flow. If not, how the flow will be calculated?
The last point is regarding the equation you wrote for the realExpression, it seems that it will produce chattering, but I have not looked well to this.
I attach a working code using two tanks at the ends.

model Clapet_Anti_Chute_Debit_OK2
  extends OpenHydraulics.Interfaces.PartialFluidCircuit;
  parameter Real Tarage = 60 "Tarage du clapet (L/min)" annotation(
    Dialog(tab = "Sizing"));
  OpenHydraulics.Basic.OpenTank tank(p_const = 1e6) annotation(
    Placement(visible = true, transformation(extent = {{-58, -36}, {-38, -16}}, rotation = 0)));
  OpenHydraulics.Basic.OpenTank tank1 annotation(
    Placement(transformation(extent = {{50, -40}, {70, -20}}, rotation = 0)));
  OpenHydraulics.Basic.VariableRestriction variableRestriction annotation(
    Placement(transformation(extent = {{20, 10}, {40, 30}}, rotation = 0)));
  OpenHydraulics.Components.Sensors.FlowSensor flowSensor annotation(
    Placement(visible = true, transformation(extent = {{-48, 10}, {-28, 30}}, rotation = 0)));

  Modelica.Blocks.Sources.RealExpression realExpression(y=if ((Tarage*(1/60000))
         < (flowSensor.y)) then 0 else 1)  annotation(
    Placement(visible = true, transformation(origin = {6, -50}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(variableRestriction.port_b, tank1.port) annotation(
    Line(points = {{40, 20}, {60, 20}, {60, -20}}, color = {255, 0, 0}));
  connect(realExpression.y, variableRestriction.control) annotation(
    Line(points = {{18, -50}, {30, -50}, {30, 12}, {30, 12}}, color = {0, 0, 127}));
  connect(flowSensor.port_b, variableRestriction.port_a) annotation(
    Line(points = {{-28, 20}, {20, 20}, {20, 20}, {20, 20}}, color = {255, 0, 0}));
  connect(tank.port, flowSensor.port_a) annotation(
    Line(points = {{-48, -16}, {-48, 20}}, color = {255, 0, 0}));
  annotation(
    Diagram(graphics),
    experiment(StopTime = 5),
    experimentSetupOutput);
end Clapet_Anti_Chute_Debit_OK2;

Regards

Carlos

Re: Hydraulic component problem

Hi Carlos !!
Thank you very much for your answer and your analyse. It will help me a lot !

This component is actually part of a system that already contains oil and pressure. I could not share this model for privacy reasons.

Nevertheless, I have a question. WHAT do you mean "extend a component"? I am a beginner on model and I have to learn everything by myself .. Not easy !!

Thank you again for the work done, I will get back to it right away.

Edited by: GaelRLQT - Feb-28-20 07:42:01

Re: Hydraulic component problem

Hi,
I don't find the phrase "extend a component" in my text. I supose you are speaking about the general concept of extension: it is how inheritance is done in Modelica, when you extend a previous model you inherit all declarations, algorithms and equations from it. I would recommend you to look at this web, I think it is the best internet resource for learning Modelica.

Regards

There are 0 guests and 0 other users also viewing this topic