- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
任务 :
y1
其衍生物受某种规律的驱动y1 = sin(time)
我为其设置了起始值y1 = 3.0
y2
由 y2 = y1 + offset
定义Parameter
(因此在模拟过程中保持不变)并根据 y1
的起始/初始值进行评估和 y2
喜欢 offset = y2.start - y1.start
model SetParametersFromInitialValues
Real y1(start = 3.0, fixed = true);
Real y2(start = 3.0, fixed = true);
parameter Real offset(fixed = false);
initial equation
offset = y2.start - y1.start;
equation
der(y1) = sin(time);
y2 = y1 + offset;
end SetParametersFromInitialValues;
start
应该是内置类型Real的参数属性,但是这种方式不可用。
discrete
而不是
parameter
,但我不知道这是否会影响性能。
model SetParametersFromInitialValues
Real y1(start = 3.0, fixed = true);
discrete Real offset(fixed = false);
Real y2(start = 5.0, fixed = true);
equation
when initial() then
offset = y2 - y1;
end when;
der(y1) = sin(time);
y2 = y1 + offset;
end SetParametersFromInitialValues;
Parameter
实现我想要的?我是否被迫使用更多“可变”变量? fixed
属性要求?如果y1
怎么办和 y2
值为 fixed
从其他组件?如果不是呢? 最佳答案
变量的初始值在初始方程部分中使用它们的名称进行访问。
通过一些较小的修改,您的代码可以与 Dymola 和 OpenModlica 一起使用:
model SetParametersFromInitialValues
Real y1(start=3.0, fixed=true);
Real y2(start=2.0, fixed=true);
final parameter Real offset(fixed=false);
equation
der(y1) = sin(time);
y2 = y1 + offset;
end SetParametersFromInitialValues;
The initialization uses all equations and algorithms that are utilized in the intended operation [such as simulation or linearization].
y2 = y1 + offset
在方程部分已经,这个方程不能在初始方程部分再次声明(
offset = y2 - y1
是同一个方程,只是用另一种方式写的)。
y2 = y1 + offset
offset := y2 - y1
y1
的起始值和
y2
.
y2 := y1 + offset.
The fixed attribute changes the way the start attribute is used when the start attribute is used as an initial condition. Normally, the start attribute is considered a “fallback” initial condition and only used if there are insufficient initial conditions explicitly specified in the initial equation sections. However, if the fixed attribute is set to true, then the start attribute is treated as if it was used as an explicit initial equation (i.e., it is no longer used as a fallback, but instead treated as a strict initial condition).
model SetParametersFromInitialValues2
Real y1;
Real y2;
final parameter Real offset(fixed=false);
initial equation
y1 = 3;
y2 = 1;
equation
der(y1) = sin(time) + 1;
y2 = y1 + offset;
end SetParametersFromInitialValues2;
关于modelica - 根据连续变量的起始/初始值设置参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56475666/
我想知道是否有其他正则化技术(例如双曲正切)而不是 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
我是一名优秀的程序员,十分优秀!