总结计算的导论,我们可以得到以下几点:
•计算的格式是LHS = RHS(左手侧=右手侧)
•LHS接收来自RHS的计算结果
•LHS的格式必须为[TAG.TYPE.ATTRIBUTE]
•在函数格式中RHS项可能是包含有多个[Tag.Type.Attribute]的组合。RHS中可以使用内置函数。
**计算校验 **
SMOCPro提供了自动地计算验证功能。无效计算的典型原因是:
•无效的计算语法
•无效的Tag.Type.Attribute
•使用内置函数不正确
每次计算的有效性可以通过显示于电子表格第一列的交通灯的颜色编码来指示。这种方法既用于预置内核计算也用于内核后计算。可用的颜色有:
• **红灯 ** –表示无效的计算。提示工具将显示宣告计算无效的原因。
• ** 绿灯 ** –表示一个有效的计算。
• ** 黄灯 **–这是一个警示信号,表明在计算列表的LHS和RHS中出现过一样的Tag.Type.Attribute。
注:为防止返回意外值,你必须确保计算被安排成需要的执行顺序。
在上述截图中,计算1之所以被标记为黄色,是因为计算中的LHS和RHS项同时出现了Tag.Type.Attribute [41FC17.MV.SPHighLim]。请注意如果一个特定的Tag.Type.Attribute同时出现在一个计算的LHS和另一个计算的RHS中,两个计算都将被标记为黄色。计算3被标记为红色是因为栏内没有输入公式。
Tag.Type 根据位号类型,这里也有几个层次的Tag.Type。对于每个Tag.Type,下表的栏里描述了每个Tag.Type的可用属性。
Tag.Type 相关属性
ControllerName.CON 内核输入/栏是控制器层的对象,例如:控制器请求/实际标志
Sub-contName.SUB 内核输入/栏是子控制器层的对象,例如:子控制器请求/实际标志
MVTagName.MV 关于MV的内核输入,MV位号,例如:MV位号的控制状态
DVTagName.DV 关于DV的内核输入,DV位号,例如:DV位号必须的标志
**POVTagName.POV **关于POV的内核输入,POV位号,例如:POV位号断开的标志
CVTagName.CV 关于CV的内核输入,CV位号,例如:CV位号优先级
EconomicCoefficientName.EFC 关于经济系数的内核输入,例如:一些经济系数
**ExternalInputTag.EXTIN **关于外部输入位号的内核输入,例如:某个外部输入位号的高限
ExternalOutputTag.EXTOUT 关于外部输出位号的内核输出,例如:某个外部输入位号的低限
原文:
Summarizing the introduction to calculations we get the following points:
• The format of a calculation is LHS = RHS (left hand side = right hand side)
• The LHS receives the result of the calculation from the RHS
• The LHS must have the form [TAG.TYPE.ATTRIBUTE]
• The RHS may combine a number of [Tag.Type.Attribute]'s in a functional format. Built-in functions may be used on the RHS.
**Validating a Calculation **
SMOCPro provides automatic validation for calculations. Typical causes for invalid calculations are
• Invalid calculation syntax
• Invalid Tag.Type.Attribute
• Incorrect use of built-in functions
The validity of each calculation is indicated using a color-coding approach with a traffic light displayed in the first column of the spreadsheet. This approach is used for both pre-kernel and post-kernel calculations. The available colors are:
• Red traffic light – Denotes an invalid calculation. A tool tip highlights the reason for declaring the calculation invalid.
• **Green traffic light – Denotes a valid calculation
•Yellow traffic light **– This is a warning/cautionary signal that indicates that the same Tag.Type.Attribute appears on the LHS and RHS in the list of calculations.
NOTE: To prevent unexpected return values, you must ensure that the calculations are arranged in the desired execution order.
In the screenshot above, calculation 1 is marked yellow because the Tag.Type.Attribute [41FC17.MV.SPHighLim] appears on both the LHS and RHS of the calculation. Please note that if a particular Tag.Type.Attribute appears on the LHS of one calculation and on the RHS of another calculation, both calculations will be marked yellow. Calculation 3 is marked red because no formula has been entered into its field.
Tag.Type Based on the tag type, there are several levels for Tag.Type. For each Tag.Type, the permissible attributes are a subset of the list described in the table below.
Tag.Type Relevant Attributes
ControllerName.CON Kernel inputs/fields that are controller level objects, e.g. controller request/actual flag
Sub-contName.SUB Kernel inputs that are sub-controller level objects, e.g., Sub-controller request/actual flag
MVTagName.MV Kernel inputs pertaining to the MV MVTag, e.g., control status for MVTag
DVTagName.DV Kernel inputs pertaining to the DV DVTag, e.g., essential flag for DVTag
POVTagName.POV Kernel inputs pertaining to the POV POVTag, e.g., disconnect flag for POVTag
CVTagName.CV Kernel inputs pertaining to the CV CVTag, e.g., priority for CVTag
EconomicCoefficientName.EFC Kernel inputs pertaining to an economic coefficient, e.g., number of economic coefficients
**ExternalInputTag.EXTIN **Kernel inputs pertaining to an external input tag, e.g., high limit for an external input tag
ExternalOutputTag.EXTOUT Kernel inputs pertaining to an external output tag, e.g., low limit for an external input tag
2016.4.20