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

前端 未结 2 1113
鱼传尺愫
鱼传尺愫 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;
    

提交回复
热议问题