译文:
定义计算:结构和语法公式
任何SMOCPro定义的计算都必须遵循规定的语法。例如:考虑一个计算用来计算两个输入的平均值。用于计算的语法必须是下述两种形式之一:
[Calculation output] = 0.5*([Calculation input1] + [Calculation input2])
或者
[Calculation output] = ([Calculation input1] + [Calculation input2])/2
SMOCPro计算的语法主要由三个部分组成:
1.计算输出目标被定义在LHS中,并且必须用左右方括号“[ ]”括起来。计算输出可能被用于向SMOCPro内核中修改输入,也可能写到外部输出位号。
2.计算输出目标位号定义之后,紧跟一个(分配)等号“=”算子以分开计算中的输入与输出。
3.每个输入计算都包含在“=”操作符的右边。用于计算的每个输入位号也必须用方括号括起来。
一系列内置的函数都是可用的,并且可能会在计算中用到。考虑另一个例子,对某一输入变量进行绝对值计算。计算可接受的一种语法是:
[Calculation output] = Abs([Calculation input1])
在上述计算中,内置函数Abs计算输入位号[Calculation input1]的绝对值。注意内置函数的参数必须置于一对圆括号“( )”内。例如,以下语法将返回为错误,因为内置函数Abs的参数没有被圆括号括起来。
[Calculation output] = Abs[Calculation input1]
从上面讨论我们知道,计算中使用的任何位号都必须用方括号括起来。具体来说,每一个位号都必须遵循下述语法:
[Tag.Type.Attribute]
其中
• Tag –位号名称。此字段是下列选项之一:
• 控制器名称
• 子控制器名称
• 每个相关的MV/DV/POV/CV名称
• 经济系数
• 外部输入/输出位号名
•Type – 控制器中每一位号名都与唯一的属性相关联。位号的属性类型可能是:
• MV
• POV
• DV
• CV
• EXTOUT (外部输出位号)
• EXTIN (外部输入位号)
• SUB (子控制器)
• EFC (经济系数)
• CON (控制器级别)
•Attribute – 每个Tag.Type都有相关联的属性。允许的属性是与位号相关联的函数类型(更多信息将在下述章节提供)。
计算中的Tag.Types例子
我们现在以例证为由提供几个例子:
考虑[65T01.POV.ImpulseFactor]。这个定义说明如下:
1.TAG (NAME): 65T01
2. TYPE: POV
3. ATTRIBUTE: Impulse Factor
考虑[41PC16B_Placeholder.EXTIN.Value_Qual]。这个定义说明如下:
1. TAG (NAME): 41PC16B_Placeholder
2. TYPE: EXTIN (外部输入位号)
3. ATTRIBUTE: Value_Qual (值的质量)
考虑[35F01.MV.SPHighLim]。这个定义说明如下:
1. TAG (NAME): 35F01
2. TYPE: MV
3. ATTRIBUTE: SPHighLim (设定值上限)
原文:
Defining calculations: Structure and Syntax for formulae
Any calculation defined in SMOCPro must prescribe to a defined syntax. For example, consider a calculation to compute the mean of two inputs. The syntax for the above mentioned calculation must be in one of the following two forms:
[Calculation output] = 0.5*([Calculation input1] + [Calculation input2])
or
[Calculation output] = ([Calculation input1] + [Calculation input2])/2
The syntax for a calculation in SMOCPro consists of three main parts.
The destination for a calculation output is defined on the LHS and must be enclosed with left and right square brackets “[ ]”. A calculation output may be used to either modify the inputs to the SMOCPro kernel or may be written to external output tags.
The definition of the destination tag for the calculation output is followed by an equal (assignment) “=” operator which separates the output from the inputs for a calculation.
-
Each input for a calculation is included on the RHS of the “=” operator. Each input tag for a calculation must also be enclosed by square brackets.
A number of built in functions are available and may be used in a calculation. As another example, consider a calculation that computes the absolute value of a certain input tag. An acceptable syntax for this calculation is[Calculation output] = Abs([Calculation input1])
In the calculation above, the built in function Abs computes the absolute value of the input tag [Calculation input1]. Notice that the parameters for built in functions must be enclosed within a pair of parenthesis “( )”. For instance, the following syntax will return an error since the parameter for the built-in function Abs is not enclosed within parenthesis.
[Calculation output] = Abs[Calculation input1]
From the discussion above, we now know that any tag used in a calculation must be enclosed within square brackets. Specifically, each tag must prescribe to the following syntax:
[Tag.Type.Attribute]
Where
• Tag – The name of the tag. This field is one of the following:
• Controller name
• Sub-controller name
• Name associated with each MV/DV/POV/CV
• Economic coefficient
• External input/output tag name
• Type – Each tag name in the controller is associated with a unique attribute type. The type attribute for a tag may be one of
• MV
• POV
• DV
• CV
• EXTOUT (for external output tags)
• EXTIN (for external input tags)
• SUB (sub-controller)
• EFC (economic coefficient)
• CON (controller level)
•Attribute – Each Tag.Type has associated attributes. The set of allowed attributes is a function of the type associated with the tag (more information is provided in the coming sections).
Examples of Tag.Types for Calculations
We now provide a few examples for illustration purposes.
Consider [65T01.POV.ImpulseFactor]. This definition indicates the following:
1.TAG (NAME): 65T01
2. TYPE: POV
3. ATTRIBUTE: Impulse Factor
Consider [41PC16B_Placeholder.EXTIN.Value_Qual]. This definition indicates the following:
1. TAG (NAME): 41PC16B_Placeholder
2. TYPE: EXTIN (external input tag)
3. ATTRIBUTE: Value_Qual (quality of the value)
Consider [35F01.MV.SPHighLim]. This definition indicates the following:
1. TAG (NAME): 35F01
2. TYPE: MV
3. ATTRIBUTE: SPHighLim (Setpoint High Limit)