simulation - OpenModelica:“警告:达到最大迭代次数但未找到根”,带有条件方程
问题描述
我是一名 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;
每当我模拟时,电压和电流的结果看起来就像我预期的那样,所以计算似乎是正确的。但是,我收到警告
达到最大迭代次数,但未找到根。
谁能给我解释一下?谢谢!
解决方案
不幸的是,您必须了解 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;
推荐阅读
- c - 为什么这个动态字符数组在 C 中没有得到正确的输入?
- c# - 通过 Oledb c# 防止重复数据从 Excel 到 db
- asp.net-core - ThenInclude Collection 不包括我的收藏数据
- java - org.chromium.android_webview.AwContentsClientBridge$$Lambda$1.run 的 NoSuchMethod
- dialogflow-es - 为什么我在 Google 上为 Actions 实施数字商品购买时会收到 402 请求代码?
- sql - 选择值大于 0 的列
- java - 如何在 Eclipse 工作场所解决“无法找到或加载主类..”
- mysql - 来自不同列和不同表的 SUM 并在每年的一行中显示结果
- jmeter - 我们如何从 jmeter 的下拉列表中获取随机选项值?
- android - 离子错误:运行子进程cordova时发生错误