案例9:使用计算—离线和在线使用的主要区别

案例9:使用计算—离线和在线使用的主要区别
(\Program Files\ShellGlobalSolutions\PCTP\Tutorial\SMOCPro\Tutorial9_CalculationsRecursive.wsp)
在离线仿真与在线仿真中递归计算(计算中某个输出位号作为自身的函数)的行为是不一样的。行为的不同是因为嵌入离线仿真和嵌入在线系统的设计差异导致的。本教程的目的是着重介绍这一差异。
•在离线仿真器中,k时刻的值被用于初始化k+1时刻的仿真。如果你有计算[A] =[A]+1且[A]=0,那么开始时产生的顺序是1,2,3,4….
•而在在线系统中,嵌入对过去的值没有保存。它从SMOCPro数据库中接收最新值并将其传递到SMOCPro内核。与离线仿真器相反的是,在线系统中,HMI上计算[A] =[A]+1且[A]=0将始终返回1。这是因为在每个新的时间步骤中,[A]的值被重新设置为HMI分配值0。
举一个例子来说明其中的差别。正在考虑的预内核计算是:
1.[Reflux.MV.MaxMove]=Iif([Bot Qual.CV.SetrangeHighLim]-[Bot Qual.POV.Measurement]; [REFLUX.MV.MaxMove];1.5*[REFLUX.MV.MaxMove])

如果底部质量CV超过其上限,计算将把回流的max move size增加到初始值的1.5倍。
2.[Reboiler.MV.MaxMove]=Iif([Bot Qual.CV.SetrangeHighLim]-[Bot Qual.POV.Measurement]; [REBOILER.MV.MaxMove];1.5*[REBOILER.MV.MaxMove])

如果底部质量CV超过其上限,计算将把再沸器负荷的max move size增加到初始值的1.5倍。
离线仿真
下列结果是使用离线仿真器获得的。我们给出了时间的2~5步。在第2步,回流和再沸器负荷的max move sizes初始值分别是100和1。在第2步我们向底部质量CV注入干扰,这导致了其在第3步触碰到了高限。如下图所示,从这个角度上来说计算是活动的且Max Move条目被覆盖。

案例9:使用计算—离线和在线使用的主要区别_第1张图片

案例9:使用计算—离线和在线使用的主要区别_第2张图片

案例9:使用计算—离线和在线使用的主要区别_第3张图片

案例9:使用计算—离线和在线使用的主要区别_第4张图片

注意在第3步时max moves sizes是第2步时的1.5倍。由于离线仿真设计使用第2步的终值初始化第3步,第3步的max move值是第2步的1.5倍。因此,在离线仿真中我们获得一个max moves的递增序列。
在线仿真
如上所述,在线嵌入没有记忆。在每个时间步,其从HMI获取一套全新的值,并将其传递到SMOCPro内核。因此在每个时间步中,回流和再沸器负荷的max move被分别重新设定为HMI值100和1。因此,对于在线系统我们获得:

案例9:使用计算—离线和在线使用的主要区别_第5张图片

案例9:使用计算—离线和在线使用的主要区别_第6张图片

注:由于变量初始化的问题,必须避免将外部输出位号使用于任何计算的右侧(RHS)。如果有任何外部输出位号处于RHS侧,则计算的结果质量通常将设置为“BAD”。
带回家的消息
SMOCPro内置的计算引擎对在线和离线实现的行为可能造成不同的结果。这种差异是由离线软件包仿真在线嵌入的方式引起的。更具体地,在离线环境下,当一个参数被计算引擎修改时,变化被记录到存储中,SMOCPro记住这个值并将其用于下一次执行中。然而,在线环境下计算引擎执行的改变仅修改进入内核的值,而不写入数据库中,下一次执行时的值是从HMI条目中下载的。


原文:
Case 9: Using Calculations – A key difference between offline and online use
Recursive calculations (i.e. a calculation in which an output tag is a function of itself) behave differently in offline simulation compared to their behavior online. The difference in behavior is due to a design difference between the embedding for the offline simulator and the embedding for the online system. The purpose of this tutorial is to highlight this difference.
• In the offline simulator, the values at time k are used to initialize the simulation at time k+1. Consequently, if you have a calculation of the form [A] =[A]+1 and [A]=0 initially, the sequence generated is 1, 2, 3, 4 ….
• In the online system, the embedding has no memory of past values. It receives the latest values from the SMOCPro database and passes that on to the SMOCPro kernel. In contrast to the offline simulator, a calculation of the form [A]=[A]+1 with [A]=0 on the HMI will always return a 1 in the online system. This is because at each new time step, the value of [A] is reset to the HMI assigned value of 0.
Consider an example to illustrate the difference. The pre-kernel calculations under consideration are:
1.[Reflux.MV.MaxMove]=Iif([Bot Qual.CV.SetrangeHighLim]-[Bot Qual.POV.Measurement]; [REFLUX.MV.MaxMove];1.5[REFLUX.MV.MaxMove])
This calculation increases the max move size for the reflux to 1.5 times its original value if the bottom quality CV exceeds its upper limit.
2.[Reboiler.MV.MaxMove]=Iif([Bot Qual.CV.SetrangeHighLim]-[Bot Qual.POV.Measurement]; [REBOILER.MV.MaxMove];1.5
[REBOILER.MV.MaxMove])
This calculation increases the max move size for the reboiler load to 1.5 times its original value if the bottom quality CV exceeds its upper limit.
Offline Simulation
The following results are obtained using the offline simulator. We show the time steps 2-5. At time step 2, the initial values for the max move sizes for reflux and reboiler duty are 100 and 1 respectively. At step 2 we inject a disturbance into the bottom quality CV which makes it violate its upper limit at step 3. From this point on, the calculations are active and the Max Move entries get overwritten as can be seen on the figures below.
Notice at time step 3 that the max moves sizes are 1.5 times their values at time step 2. Because the offline simulator design uses the final values at time step 2 to initialize time step 3, the max move at time step 3 is obtained as 1.5 times its value at time step 2. Hence, we obtain an increasing sequence of max moves with the offline simulator.
Online Simulation
As mentioned above, the online embedding has no memory. At each time step, it picks up a fresh set of values from the HMI and passes that on to the SMOCPro kernel. Consequently, at each time step, the max move for the reflux and reboiler duty are reset to their HMI values i.e. 100 and 1 respectively. Therefore, for the online system we obtain
NOTE: Due to a problem with variable initialization, utilizing External Output Tags on the right hand side (RHS) of any calculations must be avoided. If any External Output Tags appear on the RHS the resulting quality of the calculation will always be set to “BAD.”
Take Home Message
The behavior of the Calculation engine built into SMOCPro may show different results between its online and offline implementation. This discrepancy is caused by how the offline package simulates the online embedding. To be more specific, in the offline environment when a parameter gets modified by the Calculation engine the change gets recorded to memory and SMOCPro remembers this value for its next execution. However, in the online environment a change that gets implemented by the Calculation engine only modifies the values entering the kernel and do not get written to the database, rather the values are updated with the entries from the HMI at the next execution.


2016.6.19

你可能感兴趣的:(案例9:使用计算—离线和在线使用的主要区别)