#
msgid ""
msgstr ""
"Project-Id-Version: Modelica by Example 0.2.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-04-14 10:14-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: ../../source/behavior/functions/interpolation.rst:4
#: ../../source/behavior/functions/interpolation.rst:310
msgid "Interpolation"
msgstr "插值"

#: ../../source/behavior/functions/interpolation.rst:6
msgid ""
"In this chapter, we will example different ways of implementing a simple one"
" dimension interpolation scheme.  We'll start with an approach that is "
"written completely in Modelica and then show an alternative implementation "
"that combines Modelica with C.  The advantages and disadvantages of each "
"approach will then be discussed."
msgstr ""
"本节中，我们将通过示例以不同的方法实现一个简单的一维插值法。\ "
"我们首先会通过完全使用Modelica来实现一维插值法，然后展示一个Modelica结合C语言的替代方案。\ "
"最后，将讨论这两种方案的优缺点。\ "

#: ../../source/behavior/functions/interpolation.rst:13
msgid "Modelica Implementation"
msgstr "Modelica实现"

#: ../../source/behavior/functions/interpolation.rst:16
msgid "Function Definition"
msgstr "函数定义"

#: ../../source/behavior/functions/interpolation.rst:22
msgid "Independent Variable, :math:`x`"
msgstr "自变量\ :math:`x`\ "

#: ../../source/behavior/functions/interpolation.rst:22
msgid "Dependent Variable, :math:`y`"
msgstr "因变量\ :math:`y`\ "

#: ../../source/behavior/functions/interpolation.rst:24
msgid ":math:`x_1`"
msgstr ""

#: ../../source/behavior/functions/interpolation.rst:24
msgid ":math:`y_1`"
msgstr ""

#: ../../source/behavior/functions/interpolation.rst:25
msgid ":math:`x_2`"
msgstr ""

#: ../../source/behavior/functions/interpolation.rst:25
msgid ":math:`y_2`"
msgstr ""

#: ../../source/behavior/functions/interpolation.rst:26
msgid ":math:`x_3`"
msgstr ""

#: ../../source/behavior/functions/interpolation.rst:26
msgid ":math:`y_3`"
msgstr ""

#: ../../source/behavior/functions/interpolation.rst:27
#: ../../source/behavior/functions/interpolation.rst:27
msgid "..."
msgstr ""

#: ../../source/behavior/functions/interpolation.rst:28
msgid ":math:`x_n`"
msgstr ""

#: ../../source/behavior/functions/interpolation.rst:28
msgid ":math:`y_n`"
msgstr ""

#: ../../source/behavior/functions/interpolation.rst:31
msgid "where we assume that :math:`x_i<x_{i+1}`."
msgstr "这里我们假设\ :math:`x_i<x_{i+1}`\ 。\ "

#: ../../source/behavior/functions/interpolation.rst:33
msgid ""
"Given this data and the value for the independent variable :math:`x` that we"
" are interested in, our function should return an interpolated value for "
":math:`y`.  Such a function could be implemented in Modelica as follows:"
msgstr ""
"利用以上数据，对于我们某个感兴趣的自变量\ :math:`x`\ 值，我们的函数应对\ :math:`y`\ "
"赋一个内插值。\ "
"这样的函数在Modelica中实现如下："

#: ../../source/behavior/functions/interpolation.rst:42
msgid ""
"Let's go through this function piece by piece to understand what is going "
"on.  We'll start with the argument declarations:"
msgstr "接下来，我们会一步步地对上述函数功能进行讲解。\ "
"首先，从变量声明部分开始："

#: ../../source/behavior/functions/interpolation.rst:49
msgid ""
"The ``input`` argument ``x`` represents the value of the independent "
"variable we wish to use for interpolating our function, the ``input`` "
"argument ``ybar`` represents the interpolation data and the ``output`` "
"argument ``y`` represents the interpolated value.  The next part of the "
"function contains:"
msgstr ""
"\ ``input``\ 变量\ ``x``\ 表示插值函数求解的独立变量值。\ "
"变量\ ``ybar``\ 表示插值数据。\ "
"\ "
"``output``\ 变量\ ``y``\ 表示利用插值函数求得的内插值。\ "
"函数包含的下一部分内容如下所示："

#: ../../source/behavior/functions/interpolation.rst:59
msgid ""
"The part of our function includes the declaration of various ``protected`` "
"variables.  As we saw in our :ref:`polynomial-evaluation` example, these are"
" effectively intermediate variables used internally by the function.  In "
"this case, ``i`` is going to be used as an index variable, ``n`` is the "
"number of data points in our interpolation data and ``p`` represents a "
"weight used in our interpolation scheme."
msgstr ""
"上述函数定义中也包含了各种\ ``protected``\ 变量的声明。\ "
"在\ :ref:`polynomial-evaluation`\ "
"示例中可以看到，函数内部使用了很多有效的中间变量。\ "
"上述例子中，变量\ ``i``\ 表示索引变量，变量\ ``n``\ "
"表示插值数据点的个数，变量\ ``p``\ 表示插值函数使用的权重系数。\ "

#: ../../source/behavior/functions/interpolation.rst:67
msgid ""
"With all the variable declarations out of the way, we can now implement the "
"``algorithm`` section of our function:"
msgstr "当完成所有的变量声明后，接下来需要定义的是函数的\ ``algorithm``\ 区域，如下所示："

#: ../../source/behavior/functions/interpolation.rst:74
msgid ""
"The first two statements are ``assert`` statements that verify that the "
"value of ``x`` is within the interval :math:`[x_1, x_n]`.  If not, an error "
"message will be generated explaining why the interpolation failed."
msgstr ""
"上述部分的前两个语句为\ ``assert``\ 声明，用于验证变量\ ``x``\ 的值是否在插值区间\ :math:`[x_1, "
"x_n]`\ 的范围内。\ "
"如果变量不在上述区间，语句则会生成相应的错误信息。\ "

#: ../../source/behavior/functions/interpolation.rst:79
msgid ""
"The rest of the function searches for the value of ``i`` such that "
":math:`x_i<=x<x_{i+1}`.  Once that value of ``i`` has been identified, the "
"interpolated value is computed as simply:"
msgstr ""
"函数的其余部分则用于查找满足表达式\ :math:`x_i<=x<x_{i+1}`\ 的\ ``i``\ 值。\ "
"当变量\ ``i``\ 的值确定后，变量\ ``x``\ 对应的数值可以通过下述插值表达式进行计算："

#: ../../source/behavior/functions/interpolation.rst:87
msgid "where"
msgstr "其中"

#: ../../source/behavior/functions/interpolation.rst:94
#: ../../source/behavior/functions/interpolation.rst:163
msgid "Test Case"
msgstr "测试用例"

#: ../../source/behavior/functions/interpolation.rst:96
msgid ""
"Now, let's test this function by using it from within a model.  As a simple "
"test case, let's integrate the value returned by the interpolation function."
"  We'll use the following data as the basis for our function:"
msgstr ""
"现在，我们通过编写一个模型来测试上述函数。\ "
"作为一个简单的测试用例，我们将对插值函数的返回值进行积分。\ "
"我们将使用下列数据作为插值函数的基础数据："

#: ../../source/behavior/functions/interpolation.rst:102
msgid ":math:`x`"
msgstr ""

#: ../../source/behavior/functions/interpolation.rst:102
msgid ":math:`y`"
msgstr ""

#: ../../source/behavior/functions/interpolation.rst:104
#: ../../source/behavior/functions/interpolation.rst:104
#: ../../source/behavior/functions/interpolation.rst:105
#: ../../source/behavior/functions/interpolation.rst:107
#: ../../source/behavior/functions/interpolation.rst:108
msgid "0"
msgstr ""

#: ../../source/behavior/functions/interpolation.rst:105
#: ../../source/behavior/functions/interpolation.rst:106
msgid "2"
msgstr ""

#: ../../source/behavior/functions/interpolation.rst:106
msgid "4"
msgstr ""

#: ../../source/behavior/functions/interpolation.rst:107
msgid "6"
msgstr ""

#: ../../source/behavior/functions/interpolation.rst:108
msgid "8"
msgstr ""

#: ../../source/behavior/functions/interpolation.rst:111
msgid ""
"If we plot this data, we see that our interpolated function looks like this:"
msgstr "如果绘制这些数据，所使用的插值函数如下图所示："

#: ../../source/behavior/functions/interpolation.rst:125
msgid ""
"In the following model, the independent variable ``x`` is set equal to "
"``time``.  The sample data is then used to interpolate a value for the "
"variable ``y``.  The value of ``y`` is then integrated to compute ``z``."
msgstr ""
"在下述测试模型中，我们令独立变量\ ``x``\ 等于变量\ ``time``\ 。\ "
"插值函数根据样本数据计算输出变量\ ``y``\ "
"的值。\ "
"然后通过积分\ ``y``\ 值，计算得到变量\ ``z``\ 的值。\ "

#: ../../source/behavior/functions/interpolation.rst:134
msgid ""
"We can see the simulated results from this model in the following plot:"
msgstr "上述模型的仿真结果如下图所示："

#: ../../source/behavior/functions/interpolation.rst:139
msgid ""
"There are a couple of drawbacks to this approach.  The first is that the "
"data needs to be passed around anywhere the function is used. Also, for "
"higher dimensional interpolation schemes, the data required can be both "
"complex (for irregular grids) and large.  So it is not necessarily "
"convenient to store the data in the Modelica source code. For example, it "
"might be preferable to store the data in an external file.  However, to "
"populate the interpolation data from a source other than the Modelica source"
" code, we will need to use an ``ExternalObject``."
msgstr ""
"上述插值方法有几个缺点。\ "
"首先，需要将数据传递到函数所有需求的地方。\ "
"另外，对于多维插值函数，所需求的数据可能会非常复杂（例如不规则网格）和庞大。\ "
"因此，以Modelica源代码的方式进行数据存储将会非常不方便，可以采用其他方式进行数据存储，例如使用外部文件。\ "
"但是，如果使用外部文件进行插值数据的填充，需使用\"
" ``ExternalObject``\ 类型。\ "

#: ../../source/behavior/functions/interpolation.rst:150
msgid "Using an ``ExternalObject``"
msgstr "使用\ ``ExternalObject``\ 类型"

#: ../../source/behavior/functions/interpolation.rst:154
msgid ""
"The ``ExternalObject`` type is a special type used to refer to information "
"that is not (necessarily) represented in the Modelica source code.  The main"
" use of the ``ExternalObject`` type is to represent data or state that is "
"maintained outside the Modelica source code.  This might be interpolation "
"data, as we will see in a moment, or it might represent some other software "
"system that maintains its own state."
msgstr ""
"\ ``ExternalObject``\ "
"类型主要是指定未（或不必）通过Modelica源代码体现的信息。\ "
"这主要用于指定Modelica源代码以外的数据或状态。\ "
"这些信息可以是插值函数所用的数据，也可以是其他软件的相关状态。\ "

#: ../../source/behavior/functions/interpolation.rst:165
msgid ""
"For this example, we will flip things around and start with the test case.  "
"This will provide some useful context about how an ``ExternalObject`` is "
"used.  The Modelica source code for our test case is:"
msgstr ""
"在下述例子中，将围绕上面的测试用例进行讲述。\ "
"在上述应用背景下，可以更清晰的展示如何使用\ ``ExternalObject``\ 类型。\ "
"测试用例的Modelica源代码如下所示："

#: ../../source/behavior/functions/interpolation.rst:174
msgid ""
"Here the main difference between this and our previous test case is the fact"
" that we don't pass our data directly into the interpolation function.  "
"Instead, we create a special variable ``vector`` whose type is "
"``VectorTable``.  We'll discuss exactly what a ``VectorTable`` is in a "
"moment.  But for now think of it as something that represents (only) our "
"interpolation data.  Other than the creation of the ``vector`` object, the "
"rest of the model is virtually identical to the previous case except that we"
" use the ``InterpolateExternalVector`` function to perform our interpolation"
" and we pass the ``vector`` variable into that function in place of our raw "
"interpolation data."
msgstr ""
"上述测试用例与之前测试用例的主要区别在于：插值数据并不是直接传递给插值函数，而是在模型中创建了一个\ ``VectorTable``\ "
"类型的变量\ ``vector``\ ，然后进行数据传递的。\ "
"对于\ ``VectorTable``\ "
"类型，我们可以暂且把它们看作插值数据。\ "
"在后面的章节中，我们将对其进行详细讨论。\ "
"除了使用\ "
"``InterpolateExternalVector``\ 函数调用插值函数，以及创建\ ``vector``\ "
"变量，以替代之前的原始插值数据进行参数传递以外，上述模型的其他部分与之前的测试模型基本是相同的。\ "

#: ../../source/behavior/functions/interpolation.rst:185
msgid ""
"Simulating this model, we see that the results are exactly what we would "
"expect when compared to our previous test case:"
msgstr "对上述测试模型进行仿真，其结果与之前模型的仿真结果是一致的，如下图所示："

#: ../../source/behavior/functions/interpolation.rst:192
msgid "Defining an ``ExternalObject``"
msgstr "\ ``ExternalObject``\ 类型定义"

#: ../../source/behavior/functions/interpolation.rst:194
msgid ""
"To see how this most recent test case is implemented, we'll first look at "
"how the ``VectorTable`` type is implemented.  As mentioned previously, the "
"``VectorTable`` is an ``ExternalObject`` type.  This is a special type in "
"Modelica that is used to represent what is often called an \"opaque\" "
"pointer.  This means that the ``ExternalObject`` represents some data that "
"is not directly accessible (from Modelica)."
msgstr ""
"要明白上述模型的实现，我们首先需要了解如何定义\ ``VectorTable``\ 类型。\ "
"如前所述，\ ``VectorTable``\ "
"是一种\ ``ExternalObject``\ "
"类型。\ "
"在Modelica语言中，它用以代表一种特殊的类型。\ "
"这通常被称为“隐形”指针。\ "
"这也就意味着，\ ``ExternalObject``\ "
"类型主要表示那些不能直接（通过Modelica）访问的数据。\ "

#: ../../source/behavior/functions/interpolation.rst:201
msgid "In our case, we implement our ``VectorTable`` type as:"
msgstr "在本例里，我们通过下列方式定义\ ``VectorTable``\ 类型："

#: ../../source/behavior/functions/interpolation.rst:207
msgid ""
"Note that the ``VectorTable`` inherits from the ``ExternalObject`` type.  An"
" ``ExternalObject`` can have two special functions implemented inside its "
"definition, the ``constructor`` function and the ``destructor`` function.  "
"Both of these functions are seen here."
msgstr ""
"注意，\ ``VectorTable``\ 类型与\ ``ExternalObject``\ 类型是继承关系。\ "
"在\ "
"``ExternalObject``\ 类型定义时，可以同时包含两个特殊的函数：\ ``constructor``\ 函数（构造函数）和\ "
"``destructor``\ 函数（析构函数）。\ "
"下面将对其进行详细讲述。\ "

#: ../../source/behavior/functions/interpolation.rst:213
msgid "Constructor"
msgstr "构造函数"

#: ../../source/behavior/functions/interpolation.rst:215
msgid ""
"The ``constructor`` function is invoked when an instance of a "
"``VectorTable`` is created (*e.g.,* the declaration of the ``vector`` "
"variable in our test case).  This ``constructor`` function is used to "
"initialize our opaque pointer.  Whatever data is required as part of that "
"initialization process should be passed as argument to the ``constructor`` "
"function.  That same data should be present during instantiation (*.e.g,* "
"the ``data`` argument in our declaration of the ``vector`` variable)."
msgstr ""
"当创建\ ``VectorTable``\ 类型时，将调用\ ``constructor``\ 函数（例如在上述测试用例中，对\ "
"``vector``\ 变量的声明）。\ "
"此时，\ ``constructor``\ 函数主要用于初始化模型中定义的隐形指针。\ "
"初始化过程中的所有数据都应以参数的形式传递给\ ``constructor``\ 函数。\ "
"在实例化过程中，相同的数据也必须存在（例如\ ``vector``\ 变量声明时定义的\ ``data``\ 参数）。\ "

#: ../../source/behavior/functions/interpolation.rst:224
msgid ""
"The definition of the ``constructor`` function is unusual because, unlike "
"our previous examples, it does not include an ``algorithm`` section.  The "
"``algorithm`` section is normally used to compute the return value of the "
"function.  Instead, the ``constructor`` function has an ``external`` clause."
"  This indicates that the function is implemented in some other language "
"besides Modelica.  In this case, that other language is C (as indicated by "
"the ``\"C\"`` following the ``external`` keyword).  This tells use that the "
"``table`` variable (which is the ``output`` of this function and represents "
"the opaque pointer) is returned by a C function named ``createVectorTable`` "
"which is passed the contents and size of the ``ybar`` variable."
msgstr ""
"不同于之前的示例，\ ``constructor``\ 函数的定义有些特殊。\ "
"它并不包括\ ``algorithm``\ 区域。\ "
"通常，\ ``algorithm``\ 区域是用来计算函数返回值的。\ "
"相反，\ ``constructor``\ 函数包含一个\ "
"``external``\ 声明，用以表明所定义的函数是通过Modelica以外的语言实现的。\ "
"在上述示例中，实现的语言是C（在\ "
"``external``\ 关键字后以\ ``\"C\"``\ 标明）。\ "
"而且\ ``table``\ 变量（函数的\ "
"``output``\ ，也同时是表示定义的隐形指针）其返回值（变量\ ``ybar``\ 的值及其数组长度）是通过C语言定义的\ "
"``createVectorTable``\ 函数实现的。\ "

#: ../../source/behavior/functions/interpolation.rst:236
msgid ""
"Following the call to ``createVectorTable`` is an ``annotation``. This "
"annotation tells the Modelica compiler where to find the source code for "
"this external C function."
msgstr ""
"紧随\ ``createVectorTable``\ 函数其后的是\ ``annotation``\ 。\ "
"此注解的功能是告诉Modelica编译器在哪里可以找到外部C函数的源代码。\ "

#: ../../source/behavior/functions/interpolation.rst:240
msgid ""
"The essential point here is that from the point of view of the Modelica "
"compiler, a ``VectorTable`` is just an opaque pointer returned by "
"``createVectorTable``.  It is not possible to access the data behind this "
"pointer from Modelica.  But this pointer can be passed to other functions, "
"as we shall see in a minute, that are also implemented in C and which do "
"know how to access the data represented by the ``VectorTable``."
msgstr ""
"至关重要的一点是，从Modelica编译器的角度来看，\ ``VectorTable``\ 变量只是\ "
"``createVectorTable``\ "
"函数返回的一个隐形指针。\ "
"仅仅通过Modelica并不能访问这些指针指向的数据。\ "
"在下面的例子中，我们可以看到，这些指针可以传递给其他由C语言实现的函数，并且可以以此访问变量\"
" ``VectorTable``\ 所代表的数据。\ "

#: ../../source/behavior/functions/interpolation.rst:249
msgid "Destructor"
msgstr "析构函数"

#: ../../source/behavior/functions/interpolation.rst:251
msgid ""
"The ``destructor`` function is invoked whenever the ``ExternalObject`` is no"
" longer needed.  This allows the Modelica runtime to clean up any memory "
"consumed by the ``ExternalObject``.  An ``ExternalObject`` instantiated in a"
" model will generally persist until the end of the simulation.  But an "
"``ExternalObject`` declared as a ``protected`` variable in a function, for "
"example, may be created and destroyed in the course of a single expression "
"evaluation.  For that reason, it is important to make sure that any memory "
"allocated by the ``ExternalObject`` is released."
msgstr ""
"当\ ``ExternalObject``\ 类型不再需要时，将调用\ ``destructor``\ "
"函数。\ "
"这使得Modelica编译器可以清除\ ``ExternalObject``\ 类型运行所占用的内存。\ "
"模型内\ "
"``ExternalObject``\ 类型的实例化通常会一直持续到仿真结束。\ "
"但是，在函数定义时，如果\ ``ExternalObject``\ "
"类型被声明为\ ``protected``\ 变量，则可以在单个表达式的求值过程中创建和销毁。\ "
"出于上述原因，我们必须确保由\ "
"``ExternalObject``\ 类型分配的任何内存在仿真结束后都被释放。\ "

#: ../../source/behavior/functions/interpolation.rst:261
msgid ""
"In general, the ``destructor`` function is also implemented as an external "
"function.  In this case, calling the ``destructor`` function from Modelica "
"invokes the C function ``destroyVectorTable`` which is passed a "
"``VectorTable`` instance as an argument.  Any memory associated with that "
"``VectorTable`` instance should be freed by the call to ``destructor``.  "
"Again, we see the same types of annotations used to inform the Modelica "
"compiler where to find the source code for the ``destoryVectorTable`` "
"function."
msgstr ""
"一般来说，\ ``destructor``\ 函数也是作为外部函数来实现的。\ "
"在这种情况下，Modelica在调用\ "
"``destructor``\ 函数时会调用C语言定义的\ ``destroyVectorTable``\ 。\ "
"上述C函数以\ "
"``VectorTable``\ 作为参数。\ "
"当调用\ ``destructor``\ 函数时，所有与\ ``VectorTable``\ "
"实例相关的内存都将被释放。\ "
"同样的，函数有着与构造函数相同的注释，以此通知Modelica编译器\ ``destoryVectorTable``\ "
"函数源代码的位置。\ "

#: ../../source/behavior/functions/interpolation.rst:271
msgid "External C Code"
msgstr "外部C代码"

#: ../../source/behavior/functions/interpolation.rst:273
msgid "These external C functions are implemented as follows:"
msgstr "这些外部的C函数通过以下方式实现："

#: ../../source/behavior/functions/interpolation.rst:278
msgid ""
"This is not a book on the C programming language so an exhaustive review of "
"this code and exactly how it functions is beyond the scope of the book.  But"
" we can summarize the contents of this file as follows."
msgstr "这不是一本关于C语言编程的书。\ "
"因此我们将不再详细讨论这段代码的语法及其所实现的功能。\ "
"但是，我们可以对此文件的内容作出如下总结。\ "

#: ../../source/behavior/functions/interpolation.rst:283
msgid ""
"First, the ``struct`` called ``VectorTable`` is the data associated wit the "
"``VectorTable`` type in Modelica.  This includes not just the interpolation "
"data (in the form of the ``x`` and ``y`` members), but also the number of "
"data points, ``npoints``, and a cached value for the last used index, "
"``lastIndex``."
msgstr ""
"首先，名为\ ``VectorTable``\ 的\ ``struct``\ 变量内的数据对应Modelica变量\ "
"``VectorTable``\ 的内容。\ "
"这个结构体中不仅仅包括插值数据（以成员变量\ ``x``\ 、\ ``y``\ "
"的形式）。\ "
"它还包括数据点的个数\ ``npoints``\ 以及用于缓存最后使用的索引值\ ``lastIndex``\ 。\ "

#: ../../source/behavior/functions/interpolation.rst:289
msgid ""
"Next, we see the ``createVectorTable`` function which allocates an instance "
"of the ``VectorTable`` structure and initializes all the data inside it.  "
"That instance is then returned to the Modelica runtime. Following the "
"definition of ``createVectorTable`` is the definition of "
"``destroyVectorTable`` which effectively undoes what was done by "
"``createVectorTable``."
msgstr ""
"其次，可以看到\ ``createVectorTable``\ 函数对\ ``VectorTable``\ "
"的结构进行了分配并对所有的数据进行了初始化。\ "
"上述实例化过程完成后返回到Modelica中运行。\ "
"\ ``createVectorTable``\ "
"函数定义完成后，紧接着又对\ ``destroyVectorTable``\ 进行了定义，对\ ``createVectorTable``\ "
"函数定义的功能进行了有效的撤销。\ "

#: ../../source/behavior/functions/interpolation.rst:296
msgid ""
"Finally, we see the function ``interpolateVectorTable``.  This is a C "
"function that is passed an instance of the ``VectorTable`` structure and a "
"value for the independent variable and returns the interpolated value for "
"the dependent variable.  This function performs almost exactly the same "
"function as the ``InterpolateVector`` function presented earlier.  The "
"Modelica runtime provides functions like ``ModelicaFormatError`` so that "
"external C code can report errors.  In the case of "
"``interpolateVectorTable``, these functions are used to implement the "
"assertions we saw previously in ``InterpolateVector``. The lookup of ``i`` "
"is basically the same except that instead of starting from 1 each time, it "
"starts from the value of ``i`` found in the last call to "
"``interpolateVectorTable``."
msgstr ""
"最后，对\ ``interpolateVectorTable``\ 函数进行了定义。\ "
"此函数是用C语言定义的，将\ ``VectorTable``\ 结构体及所需插值的独立变量进行参数传递，\ "
"函数的返回值为利用插值算法计算的插入值。\ "
"此函数实现的功能与之前定义的\ ``InterpolateVector``\ 函数所实现的功能几乎完全相同。\ "
"在 Modelica 运行时，会执行\ ``ModelicaFormatError``\ 函数，以便报告 C 代码运行过程中出现的错误。\ "
"对于\ ``interpolateVectorTable``\ 函数，\ "
"这些错误函数主要用于实现前面\ ``InterpolateVector``\ 函数中的断言。\ "
"在\ ``interpolateVectorTable``\ 函数中对于变量\ ``i``\ 的查找确认和Modelica版本基本相同。\ "
"唯一的不同在于，查找并非每次都从\ ``1``\ 开始。\ "
"函数会读取上次调用时找到的\ ``i``\ 值而开始查找。\ "

#: ../../source/behavior/functions/interpolation.rst:312
msgid ""
"We've seen how ``interpolateVectorTable`` is defined, but so far we haven't "
"seen where it is used.  We mentioned that performs very much the same role "
"as ``InterpolateVector``, but using a ``VectorTable`` object to represent "
"the interpolation data.  To invoke ``interpolateVectorTable`` from Modelica,"
" we simple need to define a Modelica function as follows:"
msgstr ""
"我们已经了解了如何定义\ ``interpolateVectorTable``\ "
"函数。\ "
"但是目前为止，我们还不知道在什么地方调用了它。\ "
"前面我们已经提到，除了使用\ ``VectorTable``\ "
"对象进行插值数据传递以外，其他的运行机理与\ ``InterpolateVector``\ 函数相同。\ "
"在Modelica中调用\ ``interpolateVectorTable``\ 函数需定义一个简单的Modelica函数，如下所示："

#: ../../source/behavior/functions/interpolation.rst:323
msgid ""
"We mentioned previously that ``VectorTable`` is opaque and that Modelica "
"code cannot access the data contained in the ``VectorTable``.  The Modelica "
"function ``InterpolateExternalVector`` invokes its C counterpart "
"``interpolateVectorTable`` which **can** access the interpolation data and, "
"therefore, perform the interpolation."
msgstr ""
"在前面已经提到了，\ ``VectorTable``\ 表示隐形指针，\ "
"而且Modelica代码不能访问\ ``VectorTable``\ 变量包含的数据。\ "
"但是，在Modelica中定义的\ ``InterpolateExternalVector``\ 函数可以调用C语言定义的\ "
"``interpolateVectorTable``\ 函数，\ "
"从而\ **可以**\ 获取插值数据，根据插值算法计算相应的插入值。\ "

#: ../../source/behavior/functions/interpolation.rst:330
msgid "Discussion"
msgstr "讨论"

#: ../../source/behavior/functions/interpolation.rst:332
msgid ""
"As was discussed previously, the initial interpolation approach required us "
"to pass around large amounts of unwieldy data.  By implementing the "
"``VectorTable``, we were able to represent that data by a single variable."
msgstr ""
"如前所述，最初的插值方法需要传递大量复杂的插值数据。\ "
"但是，通过定义\ ``VectorTable``\ 变量，\ "
"可以非常方便的用一个变量表示上述插值数据。\ "

#: ../../source/behavior/functions/interpolation.rst:337
msgid ""
"An important thing to note about the ``ExternalObject`` approach, which "
"isn't adequately explored in our example, is that the initialization data "
"can be completely external to the Modelica source code.  For simplicity, the"
" example code shown in this section initializes the ``VectorTable`` using an"
" array of data.  **But it could just as easily have passed a file name** to "
"the initialization code.  That file could then have been read by the "
"``createVectorTable`` function and the contents of the ``VectorTable`` "
"structure could have been initialized using the data from that file. In many"
" cases, this approach not only makes managing the data easier, but "
"leveraging C allows more complex (new or existing) algorithms to be used."
msgstr ""
"关于\ ``ExternalObject``\ "
"插值方法，有一点在上述示例中并没有充分的展开讨论。\ "
"但这点非常重要：初始化数据可以完全独立于Modelica源代码。\ "
"简便起见，在上述示例中展示的代码中，通过定义数组的方式对\"
" ``VectorTable``\ 变量进行了初始化。\ "
"\ **但是，它也可以简单的通过文件名**\ 完成上述初始化工作。\ "
"\ "
"``createVectorTable``\ 函数通过读取相应的文件，用文件中对应的数据对\ ``VectorTable``\ "
"结构体进行赋值，完成数据的初始化工作。\ "
"很多情况下，这种方法不仅可以更方便的管理数据，而且可以利用C语言实现（新的或已有的）更加复杂的算法。\ "

#: ../../source/behavior/functions/interpolation.rst:350
msgid ""
"The :ref:`next section <sil-controller>` includes another example of how "
"external C code can be called from Modelica."
msgstr "\ :ref:`下一章\ <sil-controller>`\ 里包含了另一个通过Modelica调用外部C代码的例子。\ "

#: ../../source/behavior/functions/interpolation.rst:18
msgid ""
"For this example, we assume that we interpolate data in the following form:"
msgstr "在这个例子中，我们假定插值数据的格式如下："
