OpenModelica: “Warning: maximal number of iteration reached but no root found” with conditional equation

前端 未结 2 1080
鱼传尺愫
鱼传尺愫 2021-01-25 19:53

I am an OpenModelica beginner trying to model a DC/DC converter with constant voltage and current limiting. Basically the output is supposed to give a constant voltage until the

相关标签:
2条回答
  • 2021-01-25 20:16

    However, I get the warning

    maximum number of iteration reached, but no root found.
    

    Can one explain that to me? Thanks!

    The reason for this is, that the integrator can't solve the equation system you formulated.
    The underlying problem is, that you tried to change a continuous state (here n.i) without telling the integrator.


    If you want to change a value of a state variable at an event you need to use the reinit-operator which is only allowed inside a when equation.

    You could do something similar to the following model:

    package minExample
      model DC_DC "Voltage source with current limiting"
        import SI = Modelica.SIunits;
    
        parameter SI.Voltage Vnom(start=1) "Value of nominal output voltage";
        parameter SI.Current Inom(start=1) "Value for maximum continous output current";
        parameter SI.Current Imax(start=1) "Value for maximum output current";
    
        Modelica.Electrical.Analog.Interfaces.PositivePin p "Positive electrical pin";
        Modelica.Electrical.Analog.Interfaces.NegativePin n "Negative electrical pin";
        SI.Voltage v "Voltage drop of the two pins (= p.v - n.v)";
      equation
        when n.i > Imax then
          reinit(n.i,Imax);
        end when;
    
        if n.i > Imax then
          v = 0;
        else
          Vnom = p.v - n.v;
        end if;
    
        // Connect equations
        0 = p.i + n.i;
        v = p.v - n.v;
      end DC_DC;
    
      model test
        Modelica.Electrical.Analog.Basic.Ground ground1;
        Modelica.Electrical.Analog.Basic.Inductor inductor1(L = 0.5);
        DC_DC dc_dc1;
      equation
        connect(inductor1.n, ground1.p);
        connect(dc_dc1.n, ground1.p);
        connect(inductor1.p, dc_dc1.p);
      end test;
    end minExample;
    
    0 讨论(0)
  • 2021-01-25 20:38

    Unfortunately you have to learn about s-parametrization to solve this, as is found in e.g. Modelica.Electrical.Analog.Ideal.IdealDiode.

    Except for unit-checking you should do something like:

     Real s;
    equation 
    
      v = p.v - n.v;
    
      if s<0 then
        s=v-Vnom;
        n.i=Imax;
      else
        Vnom = v;
        s=Imax-n.i;
      end if;
      0 = p.i + n.i;
    

    I believe the original reference for this is https://ieeexplore.ieee.org/document/808640

    This model can also be rewritten sin this style by adding a new variable and rewriting the if-equations

      Boolean saturatedCurrent=s<0;
    equation
      v-vNom=if saturatedCurrent then s else 0;
      Imax-n.i=if saturatedCurrent then 0 else s; 
    
    0 讨论(0)
提交回复
热议问题