- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
以下简单模型是正确的并且可以在 dymola 中运行:
model new_timer
Modelica.Blocks.Logical.Timer timer;
Real my_time( start=0);
equation
timer.u=true;
my_time=timer.y;
end new_timer;
但是,下面的内容在使用 dymola“检查”时是正确的,但在模拟过程中不起作用:
model new_timer
Modelica.Blocks.Logical.Timer timer;
Real my_time( start=0);
algorithm
timer.u:=true;
my_time:=timer.y;
end new_timer;
我想知道并寻找一种方法来使后者发挥作用。 dymola报错如下:
Failed to generate code for an algebraic loop
involving when equations or algorithms with when parts.
Unknowns:
my_time
timer.entryTime
timer.u
timer.y
Equations:
when timer.u then
timer.entryTime = time;
end when;
timer.y = (if timer.u then time-timer.entryTime else 0.0);
algorithm
timer.u := true;
my_time := timer.y;
You may be able to cut the loop
by putting 'pre' around some of the references to
unknown continuous time variables in when parts or when conditions.
Translation aborted.
最佳答案
嗯。这是一个很好的例子,说明了为什么您应该尽可能使用方程部分。
以下...
algorithm timer.u:=true; my_time:=timer.y;
...大致等于:
algorithm (timer.u,my_time) := f(timer.y);
现在更清楚的是,timer.u 看起来依赖于 timer.y。这样你就得到了一个循环。
下面创建了两个算法部分,这意味着依赖关系更加分散(有点像方程部分):
algorithm timer.u:=true;algorithm my_time:=timer.y;
尝试始终使用尽可能短的算法部分。
关于modelica:方程部分与算法部分的不同结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21364255/
我想知道是否有其他正则化技术(例如双曲正切)而不是 smoothStep函数存在于 Modelica 中。我处理我使用的复杂代码 smoothStep几次以避免在我的模型中喋喋不休;但是,我已经在我的
尽管 Modelica 是一种非因果建模语言,但我们学到了例如here它可以改变你写方程的方式。MutualInductor的代码模型在 Modelica.Electrical.Polyphase.B
我写了一个函数,返回值为记录类型。 通常我会使用这个函数通过一个初始方程来初始化一个记录类型的实例。 但是因为我想在时钟模型中使用这个函数,所以不可能有初始方程。 对我来说,这似乎是使用属性 star
我有一个本地模型,当我在 Dymola 中检查时,该模型声称有 35 个变量和 34 个未知数,而当我在 OMEdit 中检查完全相同的模型时,它的平衡率为 34/34。在确定什么算作变量时,是否包括
我有一个参数 z,我需要其值始终为 1。 model test Real parameter z = 1; end test; 当我拖放此模型并双击它时,参数选项卡将打开,我可以更改值。我怎样才能防止
我有一组关于不规则网格的数据。我通过插值来找到 f(x,y)。我在维基百科算法的帮助下实现了双线性插值。然而,它并不准确。我想实现双三次插值或双三次样条插值。我已经找到了双三次插值的算法,但我必须找到
我想提出一个我之前问过的关于 Modelica array of partial model 的问题。 。考虑以下两个 Controller 之间的切换模型。 model Switch input
如何使用 Modelica(OpenModelica、jModelica)为工厂和 Controller 的 C/C++ 例程实现控制系统设计的软件在环。您可以建议什么方法?我认为外部 C 函数会有所
我希望使用条件表达式减少具有超过 300000 个方程的大型通用模型,以便仅保留相关部分。为了说明这个问题,我有以下最小模型: model Test parameter Boolean level
我有一组必须进行插值的数据。我的第一个数据集包含每个 x1[:] 和 y1[:] 的 z1[:] 值。我必须将第二个数据集 x2[:], y2[:] w.r.t 插入到我的第一个数据集中以获得 z2[
我有一个参数 z,我需要其值始终为 1。 model test Real parameter z = 1; end test; 当我拖放此模型并双击它时,参数选项卡将打开,我可以更改值。我怎样才能防止
我有一组关于不规则网格的数据。我通过插值来找到 f(x,y)。我在维基百科算法的帮助下实现了双线性插值。然而,它并不准确。我想实现双三次插值或双三次样条插值。我已经找到了双三次插值的算法,但我必须找到
我正在尝试在模型的 equation 部分中实现一个简单的迭代猜测方案,但是,我收到以下错误:No viable alternative near token: while 在 OpenModelic
首先我想说我是 StackOverflow 和 Modelica 的新手。 我的目标是模拟旋转爆震发动机的喷油器系统。从本质上讲,这是一个从油箱到火箭发动机的管道系统。这个系统会根据实验设置而改变,所
我想知道是否有办法“调试”modelica 代码,我的意思是逐行调试代码,您可以看到变量如何变化,诸如此类? 我知道modelica代码被翻译成C,我只是想知道是否有可能以某种方式做到这一点,如果有,
我正在尝试根据电网电压控制并网光伏系统。 这个想法是这样的:当电网电压上升到 VMax 以上时,我想关闭系统 timeOff。当 timeOff 过去后,我想再次打开,但只有当电网电压低于 VMax
我正在尝试在 Modelica.Media 的基础上建立一个新的媒体模型。我的模型从 PartialMixtureMedium 扩展而来。当模拟一个开放的容器(取自 Modelica.Fluid)时,
在 Modelica 中计算连续信号的平均值 (mean) 和标准偏差 (StdDev) 的最佳方法是什么?应计算固定时间段 T 的均值和 StdDev;即,从 t-T 到 t。 最佳答案 下面是该问
在模拟相当复杂的稳态模型以模拟多回路制冷剂系统时,我收到来自 Dymola 的以下警告消息。 The following variables are iteration variables of th
我在 Modelica 上收到一条错误消息: All branches in if equation with non-parameter tests must have the same numbe
我是一名优秀的程序员,十分优秀!