OpenModelica:"Warning: maximal number of iteration reached but no root found"条件方程



我是OpenModelica初学者,试图对具有恒定电压和电流限制的DC/DC转换器进行建模。基本上,输出应该给出恒定的电压,直到达到最大电流,然后通过降低电压来保持该电流。

到目前为止,这是我代码的等式部分:

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 
annotation (Placement(transformation(extent={{-110, -10},{-90,10}})));
Modelica.Electrical.Analog.Interfaces.NegativePin n 
annotation (Placement(transformation(extent={{110, -10},{90,10}})));
SI.Voltage v;
equation 
v = p.v - n.v;
if n.i > Imax and v <= Vnom then
n.i = Imax;
0 = p.i + n.i;
else
Vnom = p.v - n.v;
0 = p.i + n.i;
end if;
end DC_DC;

每当我模拟时,电压和电流的结果看起来就像我预期的一样,所以计算似乎是正确的。但是,我收到警告

已达到最大迭代次数,但未找到根。

可以向我解释一下吗?谢谢!

但是

,我收到警告

maximum number of iteration reached, but no root found.

可以向我解释一下吗?谢谢!

原因是,积分器无法求解您制定的方程组。
根本的问题是,您试图在不告诉积分器的情况下更改连续状态(此处n.i(。


如果要在事件中更改状态变量的值,则需要使用 reinit 运算符,该运算符只允许在 when 方程内使用。

您可以执行类似于以下模型的操作:

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;

不幸的是,您必须了解s参数化才能解决此问题,例如Modelica.Electrical.Analog.Ideal.IdealDiode。

除了单元检查之外,您应该执行以下操作:

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;

我相信对此的原始参考是 https://ieeexplore.ieee.org/document/808640

这个模型也可以通过添加一个新变量并重写if方程来重写这种风格

Boolean saturatedCurrent=s<0;
equation
v-vNom=if saturatedCurrent then s else 0;
Imax-n.i=if saturatedCurrent then 0 else s; 

相关内容

最新更新