gpt4 book ai didi

modelica - 如何在 Dymola 中找到撕裂算法选择的变量

转载 作者:行者123 更新时间:2023-12-02 16:14:50 26 4
gpt4 key购买 nike

我想找到由 Dymola 中的撕裂算法选择的变量集。这样我就可以知道哪些变量将系统的不同部分连接在一起。但我不确定如何在 Dymola 中显示这些变量。我查看了 Dymola 的帮助文档,但没有找到任何与如何显示这些变量相关的内容。 enter image description here

最佳答案

您应该能够在 dsmodel.mof 中看到它,它是在设置 Advanced.OutputModelicaCode = true; 或使用“Simulation Setup”在 UI 中激活它之后创建的-> 翻译 -> 在 dsmodel.mof 中生成翻译后的 Modelica 代码列表。

Dymola 会在//Torn 部分 生成相关代码。在 dsmodel.mof 中搜索它是一个不错的选择,因为该文件可能会变得非常大。

确切的代码将取决于问题的类型。两个例子:

(1) 像这样一个相当简单的电气 RLC-circuit with algebraic loop将被象征性地解决,结果代码:

...
// Linear system of equations
// Tag: simulation.linear[1]
// Symbolic solution
/* Original equation
resistor1.v = constantVoltage.V-resistor.v-capacitor.v;
*/
resistor1.p.i := -(capacitor.v-constantVoltage.V+resistor.R_actual*
inductor.i)/(resistor.R_actual+resistor1.R_actual);
// Torn part
resistor.p.i := inductor.i+resistor1.p.i;
resistor.v := resistor.R_actual*resistor.p.i;
resistor1.v := resistor1.R_actual*resistor1.p.i;
// End of linear system of equations
...

在这种情况下,撕裂变量是 resistor1.p.i,其中直接说明了计算它的方程式。

(2) 翻译 Modelica.Thermal.FluidHeatFlow.Examples.TwoMass 会给你一个非线性的情况,即当需要迭代来求解方程组时。你应该找到像这样的东西:

...
// Start values for iteration variables of non-linear system of 1 equations:
// pipe2.V_flow(start = 0)
algorithm // Torn part
pipe2.flowPort_a.m_flow := pipe2.V_flow*pipe2.medium.rho;
pipe1.flowPort_a.m_flow := -(pipe2.flowPort_a.m_flow+ambient1.flowPort.m_flow);
...

在这种情况下,撕裂变量是 pipe2.V_flow,具有迭代的起始值。

关于modelica - 如何在 Dymola 中找到撕裂算法选择的变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67036903/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com