在Dymola中,如何使用3个或更多的输入变量进行插值(输出)?

huangapple go评论68阅读模式
英文:

How do I interpolate a value (output) with 3 or more input variables in Dymola?

问题

以下是要翻译的内容:

这张图片展示了我想要解决的问题。
我将会得到一个以CSV格式呈现的数据表格(从输入得到的输出)。

对于两个输入和一个输出的插值是没有问题的。我可以使用combiTable2Dv来解决这个问题。我能够扩展这个表格来解决我的问题吗?在参数中,我看到了一个维度设置选项。

更新:
我现在已经创建了一个包含4个输入和1个输出的SDF格式的映射(见第4张图片)。
我已经将其加载到SDF.NDTable中,并得到以下错误信息。

这是我在Dymola中的错误:

检查Unnamed2:

在同一连接集中,因果信号有多个来源。
在输出m_in.y内 = 在输出n.y内 = 在输入nDTable.u[4]内 = 在输出p_in.y内 = 在输出p_out.y内

问题在于结构上是奇异的。

它有13个标量未知数和13个标量方程。
实部有12个未知数和12个方程。
整数部分有1个未知数和1个方程。
布尔部分有0个未知数和0个方程。
字符串部分有0个未知数和0个方程。

该模型无法被推断为符号上良态。
该模型有9+nDTable.nin个标量未知数和13个标量方程。
然而,利用给定的参数数值设置得到的未知数和方程的数量相同:
13

尝试进一步定位奇异性。

Unnamed2的奇异性位于顶层。

模型Unnamed2在结构上是奇异的。

在同一连接集中,因果信号有多个来源。
在输出m_in.y内 = 在输出n.y内 = 在输入nDTable.u[4]内 = 在输出p_in.y内 = 在输出p_out.y内

nDTable的输入连接器u的某些元素未从外部连接。
很可能它们都应该被连接起来,递归检查也是这样假设的。
缺失的连接很可能是模型中出现错误的原因。

已发出警告。

已发出错误。

英文:

在Dymola中,如何使用3个或更多的输入变量进行插值(输出)?

在Dymola中,如何使用3个或更多的输入变量进行插值(输出)?

The picture shows the problem that I want to solve.
I will have the data (output from inputs) as a table in csv format.

Interpolating with 2 inputs and one output is no problem. I could solve this with the combiTable2Dv. Can I extend this table to solve my problem? Under parameters I saw a setting option for the dimensions.在Dymola中,如何使用3个或更多的输入变量进行插值(输出)?

Update:
I have now created a map with 4 inputs and 1 output in the SDF format. (see picture 4)
I have loaded this into the SDF.NDTable and get the following error message.
在Dymola中,如何使用3个或更多的输入变量进行插值(输出)?

在Dymola中,如何使用3个或更多的输入变量进行插值(输出)?

This is my Error in Dymola:

Check of Unnamed2:

Multiple sources for causal signal in the same connection set.
inside output m_in.y =inside output n.y =inside input nDTable.u[4] =inside output p_in.y =inside output p_out.y

The problem is structurally singular.

It has 13 scalar unknowns and 13 scalar equations.
The Real part has 12 unknowns and 12 equations.
The Integer part has 1 unknowns and 1 equations.
The Boolean part has 0 unknowns and 0 equations.
The String part has 0 unknowns and 0 equations.

The model could not be deduced to be symbolically well-posed.
The model has
9+nDTable.nin
scalar unknowns and
13
scalar equations.
However, exploiting the given numerical settings of parameters gives the same number of unknowns and equations:
13

Attempting to further localize singularity.

Singularity of Unnamed2 is at the top level.

The model Unnamed2 is structurally singular.

Multiple sources for causal signal in the same connection set.
inside output m_in.y =inside output n.y =inside input nDTable.u[4] =inside output p_in.y =inside output p_out.y

Some elements of the input connector u of nDTable are not connected from the outside.
It is likely that they all should have been connected, and recursive check assumes this.
The missing connection is a likely cause of errors in the model.

WARNINGS have been issued.

ERRORS have been issued.

答案1

得分: 4

关于你提到的“dimensions”问题:
模型Modelica.Blocks.Tables.CombiTable2Dv确实有一个参数n。假设这是你所指的:它基本上创建了一个表的向量,根据相同的源数据(表/文件)对一个(两个)输入向量进行查找/插值,从而得到一个输出向量。因此,输入和输出的大小都是n。所以在给定的情况下,这可能不会有帮助。

关于原始问题:
据我所了解,你需要一个具有三个输入或三个独立变量的表。Modelica标准库中没有提供这种类型的表。在Dymola中,我知道有两个选项,你可以在“文件”->“库”中找到它们:

  • DataFiles.TableND,它基于.mat(版本4)文件,现在有点过时。
  • SDF.NDTable使用基于HDF5的.sdf文件,https://github.com/ScientificDataFormat/SDF。Dymola附带了一个名为“SDF Editor”的工具,可以在GUI中查看和编辑这些文件。
    注意:GUI限制为三个维度,因为在大多数情况下这已经足够了。你可以使用PythonMATLAB函数创建具有更多独立变量的数据集。Modelica库SDF.Functions中也提供了一部分函数,可以从.mos脚本中使用。

上述两个软件包都提供了函数,可以从Dymola和/或Matlab创建所需的文件。这些函数应该有足够的文档说明,可以使用。

英文:

Regarding your question with "dimensions":

The model Modelica.Blocks.Tables.CombiTable2Dv does have a parameter n. Assuming this is what you are referring to: This basically creates a vector of tables which do a look-up/interpolation based on the same source data (=table/file) for a vector of (two) inputs resulting in a vector of outputs. Inputs and outputs are therefore vectors of size n. So this will likely not help in the given case.

The original issue:

From what I understand, you need a table with there inputs, or three independent variables. Tables of this kind are not provided with the Modelica Standard Library. In Dymola I know about two options, which you will find under File -> Libraries:

  • DataFiles.TableND which is based on .mat (version 4) files and a bit aged by now.
  • SDF.NDTable uses .sdf files, which are based on HDF5, https://github.com/ScientificDataFormat/SDF. Dymola comes with a tool called "SDF Editor" which will enable you to view and edit those files in a GUI.
    NOTE: The GUI is limited to three dimensions as this is enough in most cases. You can use Python or MATLAB functions to create datasets with more independent variables. A subset of functions is also available in the Modelica Library SDF.Functions which can be used from .mos scripts.

Both of the above packages provide functions which allow the creation of the necessary files from Dymola and/or Matlab. Those should be documented well enough to be usable.

huangapple
  • 本文由 发表于 2023年8月8日 21:40:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/76860131.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定