将模型参数定义为变量 [英] Define Model Parameter as Variable

查看:59
本文介绍了将模型参数定义为变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将模型(块)的参数定义为变量.例如:

I am attempting to define the parameter of a model (block) as a variable. For example:

Real WallThickness = 0.5;
Real WallConductance = 10*WallThickness;
Modelica.Thermal.HeatTransfer.Components.ThermalConductor TopPanelConductor(G=WallConductance);

我想定义G",使其在整个模拟过程中保持不变,但系数会在模拟之前根据另一个变量WallThickness"进行更新.在将 ThermalConductor 参数G"定义为模型中的变量时,在其他地方计算该变量时,我收到错误消息:

I would like to define "G" so that it remains constant throughout the simulation but the coefficient is updated prior to the simulation based on the other variable "WallThickness". When defining the ThermalConductor parameter "G" as a variable in the model, which is being calculated elsewhere, I get the error message:

The variability of the definition equation:
TopPanelConductor.G = WallConductance;
is higher than the declared variability of the variables.

我想将模型的参数定义为变量.这允许我创建参数定义作为所有更改的几何形状.有没有办法让这个定义起作用?

I would like to define the parameters of a model as a variable. This allows me to create parametric definitions as the geometry of the all changes. Is there a way I can make this definition work?

推荐答案

您是说在模拟过程中几何会发生变化?如果是这样,您将不得不重写 ThermalConductor 模型以使用 变量 G,因为变量不能分配给参数.在模拟过程中,变量可能会发生变化.参数在仿真开始时是固定的,但可以在每次运行之间更改,而无需重新编译模型,从而加快迭代/设计工作.

You mean the geometry changes during simulation? If so, you'll have to rewrite the ThermalConductor model to work with a variable G, because a variable cannot be assigned to a parameter. A variable may vary during the course of simulation. A parameter is fixed at the start of simulation, but can be changed from run to run without recompiling the model, which allows for quicker iteration/design work.

请注意,您还可以根据您定义的其他参数计算参数,例如根据给定的壁厚计算传热系数(您在不同的模拟运行中会有所不同).

Note that you can also calculate a parameter from other parameters that you define, e.g. to calculate a heat transfer coefficient from a given wall thickness (which you vary from simulation run to simulation run).

这篇关于将模型参数定义为变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆