You are on page 1of 10

Example of External HYSYS Controllers in a DDE Server

By Robb Wheatley, IFACE Group rev 2, April 16, 1998

HYSYS DDE Client DCS Drivers


One of two HYSYS DDE (Dynamic Data Exchange) DCS (Distributed Control System) Drivers may be used to
communicate between HYSYS and DDE Servers via the DDE protocol.

DDE Synchronous Tag Based Client


DDE Synchronous Array Based Client

Both drivers are DDE Clients that initiate communications with DDE Servers. Pressing the Enable button in the
DCS View initiates a DDE conversation. An error dialog is generated if the server is unavailable. Pressing the
Disable button in the DCS View terminates the DDE conversation. The HYSYS DDE Drivers detect if the server
disconnects the conversation with the client. For example, suppose an Excel spreadsheet was closed while a DDE
conversation was in progress with a HYSYS application. An error dialog is generated if this situation occurs. DDE
client transactions are also initiated periodically according to the data transfer interval configured on the Drivers
page tab of the DCS View.

Both drivers are synchronous. This means that DDE client transactions may time out when poking / requesting
data to / from, or attempting to execute DDE commands on a slow DDE server. The timeout is configurable with
the default value set to five thousand milliseconds. If a transaction times out, an error dialog box is generated.

Unfortunately, DDE error dialogs may appear at the bottom of the window stack. If HYSYS seems completely
unresponsive and a DDE driver is being used, using the ALT-TAB key sequence to cycle the visible window stack
may indicate a DDE Error dialog that is causing the problem.

HYSYS DDE DCS Driver Specifics


This section describes the usage and specific details concerning the two HYSYS DDE Client DCS drivers.

General HYSYS DDE Client DCS Driver


Note that HYSYS DCS Drivers are only supported on the Windows NT operating system.

When the DDE Client driver is loaded into HYSYS, some extra columns are added to the General Data page of
the DCS View. The columns include Server, Topic, Enable Cmd, Reset Cmd, Start Cmd, Stop Cmd, and Disable
Cmd.

The Server and Topic column contents are used to initiate the DDE Conversation. All of the data transfers
configured in the HYSYS DDE Client Driver DCS Views use the same Server, Topic pair for that HYSYS case.
For example, when connecting to Microsoft Excel, the <server, topic> pair is as follows.
<excel, [filename.xls]WorksheetName>

When connecting to MATLAB, the <server, topic> pair is as follows.


<matlab, engine>

The Enable, Reset, Start, Stop and Disable Cmd column contents specify the command strings to execute on the
DDE Server when DCS Link Enable, Integrator Reset, Integrator Start, Integrator Stop, DCS Link Disable events
occur in HYSYS.

Unfortunately, each vendor seems to use different CF_TEXT format data delimiters in their DDE Servers. We
have only tested Microsoft Excel (\r\n separated values and \r\n at the end) and Mathworks MATLAB(\t
separated values and \r\n at the end). The General Data page tab column labeled CF_TEXT delimiter exists in an
attempt to provide DDE transfer with DDE Servers that we have not tested and that may use a different delimiter
string. If the DDE Server name is excel or matlab, the delimiter string will be internally set to the correct
delimiter regardless of what the user enters for a delimiter.

The timeout value for synchronous DDE transactions is configured in the Timeout (ms) General Data Page Tab
Column. The default value is 5000 milliseconds. For large array based client transactions with a slow DDE Server,
this timeout value may need to be increased.

DDE Synchronous Tag Based Client


The tag-based version of the driver allows the user to specify individual DDE item strings for each data element to
be transferred. The DDE server and Topic strings are common to each data element and are configured on the
General Data page tab of the DCS View. When using this driver, extra columns are added to the matrices in the
controller and PV page tabs in the DCS View. DDE items for each data element are entered in these columns.

Controller Setpoint (SP) and, possibly, Output (OP) data are requested from the DDE server according to the SP
Item and OP Item tags configured in the controller matrix in the Controller page tab of the DCS View. Data is then
written to the HYSYS controller attached to the matrix row. Note that the Output is only written if the Status entry
in the row is set to DCS. Only the setpoint data is transferred if the Status entry is Internal.

PV data is poked from HYSYS to the DDE Server according to the PV Item tags configured in the PV matrices in
the PV page tabs of the DCS View. The content of the Status column in a PV matrix determines whether the PV
data at that row in the matrix is transferred between HYSYS and the DDE Server. The PV is transferred if the
Status value is DCS. The PV is not transferred if the Status value is Internal.

A unique DDE transaction is initiated for each single tagged data transfer.

The CF_TEXT delimiter for this driver is the end of data character. The delimiter for Excel and MATLAB is
\r\n

DDE Synchronous Array Based Client


The array-based version of the driver differs from the tag-based version in that only three DDE Item tags are
configured. One tag refers to the array of setpoint data, one tag refers to the array of output data, one tag refers to
the array of PV export data and one tag refers to the array of PV import data. These tags are configured on the
General Data page tab of the DCS View.

The Status column of the controller matrix still governs the application of the received setpoint and output data to
HYSYS controllers and PV import data even though the data is transferred between server and client in a single
block. The Status column of the PV is ignored in the array-based version of the driver.

Only four DDE Client transactions are required to complete the array data transfers.

A performance test of data transfer for 20 PID controllers indicated that the array-based data transfer mechanism
was about six times faster than the tag-based version.

The CF_TEXT delimiter for this driver is the data separation character. For excel, the delimiter is \r\n. For
matlab the delimiter is \t.

DDE Demonstration Programs


The basic purpose of this demonstration is to indicate how the HYSYS DCS Link can be used to help design
control algorithms using an external software system to compute control actions and using HYSYS to model the
plant. The control designer can focus on the controller and let HYSYS model the plant. Note that, in general, any
HYSYS DCS driver may be substituted for the DDE drivers presented in this document.

When the DCS link is enabled, an external program interacts with internal HYSYS controllers. Two types of
interaction are possible. As previously mentioned, the Status column in the controller matrix on the controllers
page tab of the DCS View indicates whether setpoint only (Internal) or setpoint and output (DCS) data transfer is
desired for a given controller.
In the first scenario, only the controller setpoint is modified externally. This type of situation might occur in a
multivariable control problem where the setpoints of several dependent controllers are modified according to
some external algorithm. In this case, the internal HYSYS controllers still calculate their own output values.

In the second scenario, an external program modifies both controller setpoints and outputs. This mechanism
allows an external controller to replace an internal HYSYS controller. The output of the external controller is
written directly to the output of the internal HYSYS controller thus bypassing the internal control. Controller
setpoint information is also transferred for HYSYS GUI purposes.

A simple HYSYS case including two tanks with level controls is used for demonstration purposes. Controller
Status fields are both set to DCS in the demonstration HYSYS cases. Control actions are computed by an external
program and results are transferred via the DDE Client DCS link.

Equation 1 gives the basic PID controller response. Both the DDE Server demonstrations use this equation to
calculate the controller outputs signals to send back to HYSYS. Note that the implementation of this equation in
the demonstrations is very basic to keep the example code clear.

The controller output calculations are synchronized with the HYSYS integrator using the Execute Cmd configured
in the General Data Page Tab of the DCS View. Each data transfer period in HYSYS triggers the execution of the
Execute Cmd on the DDE Server allowing iterative calculation of controller outputs.

action kp d error
op bias action kp error
i error dt ction kp d dt (1)

bias control valve bias parameter


1.0 direct
action controller action
1.0 reverse
kp controller gain
error setpoint process variable
i controller integral time constant
d controller derivative time constant

The mechanism to transfer HYSYS integrator data values from HYSYS to an external program is less than
intuitive. Basically, the integrator variables need to be set up in a spreadsheet import cell and a spreadsheet export
cell must be configured to refer to the input cell. The contents of the export cell in the spreadsheet will show up in
the variable navigator brought up from the PV Page Tab in the DCS View. Performing the following steps allows
data transfer of integrator time parameters.

Create a spreadsheet object in the Workbook and open the Spreadsheet page tab.
Open the Integrator View
Click the value of the integrator parameter with the right mouse button and drag and drop it onto a cell in the
spreadsheet( A6 for example). Note that this variable is an import variable.
In a different spreadsheet cell, enter a formula, which refers to the import cell. For example, setting a formula
for the cell B6 = +A6 will create an export variable to export the integrator parameter.
The spreadsheet cell B6 will show up as a spreadsheet variable in the object navigator used to configure the
PV matrix in the DCS view and the value will be identical to the integrator parameter. Add the spreadsheet
cell to the PV matrix.

The current time and step sizes are transferred to calculate integral and derivatives of the error. Note that this
assumes that the Data Transfer Period on the DCS Drivers Page Tab is set to 0.0 so that data is transferred every
time step. If this is not the case the server code must be changed to calculate the previous time and store it.
HYSYS-MATLAB DDE Demo
Several events in HYSYS trigger the execution of MATLAB m-files as indicated in the following table.

Event Occurs When DDE Server Demo m-files


Commands
Enable DCS Link User presses Enable (DCS View) pidstart pidstart.m
Integrator Reset User presses Integrator Reset (Integrator View) pidreset pidreset.m
Integrator Start User presses Integrator Start (Integrator View) none
Data Transfer Event During each data transfer timestep pidexec pidexec.m
Integrator Stop User presses Integrator Stop (Integrator View) none
Disable DCS Link User presses Disable (DCS View) pidstop pidstop.m

The DDE Server Commands in the table above are entered into the appropriate columns of the matrix on the
General Data Page DCS View. The demo m-files indicated in the table are executed when the corresponding event
occurs in HYSYS. The following m-files are used for the demo.
Tparrset.m
Tparrplt.m
Pid.m
Pidstart.m
Pidstop.m
Pidexec.m

The DDE item tags to configure arrays for data transfer of controller setpoints, controller outputs, and process
variables are MATLAB vector names as indicated in the following table.

Array Array Tags


Setpoint sp
Output op
PV Export pv
PV Import pvimport

These tag names are entered in the General Data page tab of the DCS View. Once the HYSYS DCS link is
enabled, these variables may be viewed by typing their names in the MATLAB command window. The contents
of the vector will be listed in the command window. Other MATLAB vectors of interest include kp, ti, and td.

Instructions for Running the MATLAB-HYSYS DDE demo


Note that this demo was constructed with MATLAB version 4.2.1c. It has since been updated to work correctly on
MATLAB 5.2 as well, although the earlier version is still supplied.

Start HYSYS and load the "mlbdemo.hsc" case.


Start MATLAB
In the MATLAB command window, cd to the directory that contains the demo m-files (depending on the
version of MATLAB in use, the m-files will be in either the 42 or 52 folders).
In HYSYS, open the DCS View (:Tools:DCS: from the menu bar if it is not visible)
In HYSYS, press the DCS View Enable button. A MATLAB figure window that contains two empty
controller response plots will appear.
In HYSYS, press the Integrator Reset button (:Simulation:Integrator View). This resets the time to zero.
In HYSYS, press the Integrator Start button. Plot traces indicating controller response trajectories will begin
to appear in the plot window as data transfer events occur.
In HYSYS, press the Integrator Stop button to stop the data transfer.
In HYSYS, press the DCS View Disable button to disable the DCS link.
HYSYS-MATLAB Demo Notes
In the MATLAB 5.2 demo, the figure does not appear after the first time the DDE link is enabled. Simply disable
the link and enable it once more and the figure should appear. This seems to only be a problem the first time the
link is enabled on a particular MATLAB session.

The plots in MATLAB are dynamically generated and the data is NOT stored. If the plot is repainted, the existing
trace is erased. Only the currently plotted point actually exists as part of the MATLAB plot object. Thus, upon
resizing of the MATLAB figure window, all previous drawn points are erased.

After the simulation has exceeded the time scale, the plot window may be re-scaled interactively by clicking the
left mouse button on the plot window

Any of the controller parameters (sp, pvimport, kp, ti, or td) may be modified interactively by setting the
appropriate vector entry in the MATLAB command window. For example, to change the setpoint of controller
LIC-101 to 50.0, type "sp(2) = 50.0" in the MATLAB command window. The change will be reflected in the
HYSYS DCS View, HYSYS controller faceplates, and the MATLAB plot.

HYSYS-Excel DDE Demo


Several events in HYSYS trigger the execution of Excel Macros as indicated in the following table.

Event Occurs When DDE Server Demo XL


Cmd Macro
Enable DCS Link User presses Enable (DCS View) [run(PidStart)] PidStart
Integrator Reset User presses Integrator Reset (Integrator View) [run(PidReset)] PidReset
Integrator Start User presses Integrator Start (Integrator View) none
Data Transfer Event During each data transfer timestep [run(PidExec)] PidExec
Integrator Stop User presses Integrator Stop (Integrator View) None
Disable DCS Link User presses Disable (DCS View) [run(PidStop)] PidStop

The DDE Server Commands in the table above are entered into the appropriate columns of the matrix on the
General Data Page of the DCS View. The indicated Excel macro is executed when the corresponding event occurs
in HYSYS. The Excel macros are contained in a module named DDEAccess in the demo Excel spreadsheet file.

HYSYS-Excel DDE Array-Based Demo


The DDE item tags to configure arrays for data transfer of controller setpoints, controller outputs, and process
variables are ranges of cells in the Excel demo worksheet as indicated in the following table.

Array Array Tags


Setpoint R3C3:R4C3
Output R3C5:R4C5
PV R8C3:R14C3
PVImport R18C4:R19C4

These tag names are entered in the General Data page tab of the DCS View. The contents of the data vectors are
displayed in the demo Excel worksheet. It is straightforward to modify the other controller parameters on the
Excel spreadsheet.

Instructions for running the Excel-HYSYS DDE Demos


Start HYSYS and load the xldemo.hsc case
Start Excel and load the xldemo.xls spreadsheet
In HYSYS, open the DCS View (:Tools:DCS: from the menu bar if it is not visible)
In HYSYS, press the DCS View Enable button.
In HYSYS, press the Integrator Reset button (:Simulation:Integrator View). This resets the time to zero.
In HYSYS, press the Integrator Start button. Plot traces indicating controller response trajectories will begin
to appear in the Excel spreadsheet as data transfer events occur.
In HYSYS, press the Integrator Stop button to stop the data transfer.
In HYSYS, press the DCS View Disable button to disable the DCS link.

HYSYS-Excel DDE Tag-Based Demo


Note that a second HYSYS case named xlddetag.hsc is used to demonstrate the tag-based DDE Client driver.
The difference between the tag-based and array-based examples is that the tag-based example has a single Excel
worksheet cell configured for each SP, OP, and PV data element, rather than three arrays configured with ranges of
Excel cells. Cell references are configured on the Controller and PV page tabs of the DCS View. Instructions for
running the tag-based example are similar to those for the array-based example, just substitute the name
xlddetag.hsc for xldemo.hsc

HYSYS-Excel DDE Demo Notes


The ExcelToHYSYS worksheet will update the display in a rather annoying fashion.

The variables of the controllers may be manipulated by editing the appropriate spreadsheet cells.

Note that a buffer keeps track of 100 data points. Once the 100 points have been collected, the buffer is erased and
the old points are lost. Flushing the buffer erases a portion of the data visible on the screen

The controller response plots on the Excel worksheet re-scale automatically.

Ejemplo de controladores HYSYS externos en un servidor DDE


Por Robb Wheatley, Grupo IFACE - rev 2, 16 de abril de 1998
Controladores de cliente de HYSYS DDE DCS

Uno de los dos controladores DCS (Distributed Control System) HYSYS DDE (intercambio dinmico de datos)
se puede utilizar para comunicarse entre servidores HYSYS y DDE a travs del protocolo DDE.

Cliente basado en etiquetas sncronas DDE


Cliente basado en matriz sncrona DDE
Ambos controladores son clientes DDE que inician comunicaciones con servidores DDE. Al presionar el botn
Habilitar en la vista DCS se inicia una conversacin DDE. Se genera un cuadro de dilogo de error si el servidor
no est disponible. Al presionar el botn Disable en la vista DCS se termina la conversacin DDE. Los
controladores HYSYS DDE detectan si el servidor desconecta la conversacin con el cliente. Por ejemplo,
supongamos que una hoja de clculo de Excel se cerr mientras se estaba realizando una conversacin DDE con
una aplicacin HYSYS. Si se produce esta situacin, se genera un cuadro de dilogo de error. Las transacciones
de cliente DDE tambin se inician peridicamente de acuerdo con el intervalo de transferencia de datos
configurado en la pestaa de la pgina de controladores de la vista DCS.

Ambos controladores son sncronos. Esto significa que las transacciones de cliente DDE pueden tiempo de espera
al empujar / solicitar datos a / de, o intentar ejecutar comandos DDE en un servidor DDE lento. El tiempo de
espera es configurable con el valor predeterminado establecido en cinco mil milisegundos. Si una transaccin se
agota, se genera un cuadro de dilogo de error.

Desafortunadamente, los cuadros de dilogo de error DDE pueden aparecer en la parte inferior de la pila de la
ventana. Si HYSYS parece completamente no responde y se utiliza un controlador DDE, utilizar la secuencia de
teclas ALT-TAB para ciclo la pila de ventana visible puede indicar un dilogo de error DDE que est causando el
problema.
Especificaciones del controlador HYSYS DDE DCS
Esta seccin describe el uso y los detalles especficos relativos a los dos controladores DCS del cliente HYSYS
DDE.
General HYSYS DDE Cliente DCS Driver
Tenga en cuenta que los controladores Hysys DCS slo se admiten en el sistema operativo Windows NT.

Cuando se carga el controlador de cliente DDE en HYSYS, algunas columnas adicionales se agregan a la pgina
datos generales de la vista DCS. Las columnas incluyen Servidor, Tema, Activar Cmd, Reiniciar Cmd, Iniciar
Cmd, Detener Cmd y Deshabilitar Cmd.

Los contenidos de la columna Server y Topic se utilizan para iniciar la conversacin DDE. Todas las
transferencias de datos configuradas en el controlador de cliente HYSYS DDE DCS Views utilizan el mismo par
de Servidor y Tema para ese caso de HYSYS. Por ejemplo, al conectarse a Microsoft Excel, el par <servidor,
tema> es el siguiente.
? <Excel, [filename.xls] WorksheetName>

Cuando se conecta a MATLAB, el par <servidor, tema> es el siguiente.


<matlab, motor>

El contenido de la columna Activar, Restaurar, Iniciar, Detener y Deshabilitar Cmd especifica las cadenas de
comandos que se deben ejecutar en el servidor DDE cuando se producen los eventos Activacin de enlace DCS,
Reinicio del integrador, Inicio del integrador, Parada del integrador y Desactivacin del enlace DCS en HYSYS.

Desafortunadamente, cada proveedor parece usar diferentes delimitadores de datos de formato CF_TEXT en sus
servidores DDE. Slo hemos probado Microsoft Excel ("\ r \ n" valores separados y "\ r \ n" al final) y Mathworks
MATLAB ("\ t" valores separados y \ r \ n al final). La pestaa de la pgina Datos generales denominada
CF_TEXT delimitador existe en un intento de proporcionar transferencia DDE con servidores DDE que no hemos
probado y que pueden utilizar un delimitador diferente cuerda. Si el nombre del servidor DDE es "excel" o
"matlab", la cadena de delimitador se establecer internamente en el delimitador correcto, independientemente de
lo que el usuario introduzca para un delimitador.
El valor de tiempo de espera para las transacciones DDE sncronas se configura en la columna de pestaa de
pgina de datos generales de tiempo de espera (ms). El valor predeterminado es 5000 milisegundos. Para las
transacciones de cliente basadas en matrices grandes con un servidor DDE lento, puede ser necesario aumentar
este valor de tiempo de espera.
Cliente basado en etiquetas sncronas DDE
La versin basada en etiquetas del controlador permite al usuario especificar cadenas de elementos DDE
individuales para cada elemento de datos que se va a transferir. El servidor DDE y las cadenas Tema son comunes
a cada elemento de datos y se configuran en la pestaa de la pgina Datos generales de la vista DCS. Al utilizar
este controlador, se agregan columnas adicionales a las matrices de las fichas de controladores y de pginas PV en
la vista DCS. Los elementos DDE para cada elemento de datos se introducen en estas columnas.

Los datos del punto de consigna del controlador (SP) y, posiblemente, de la salida (OP) se solicitan al servidor
DDE de acuerdo con las etiquetas de elementos SP y de elementos OP configurados en la matriz del controlador
en la pestaa de la pgina DCS. Los datos se escriben entonces en el controlador HYSYS conectado a la fila de la
matriz. Tenga en cuenta que la salida slo se escribe si la entrada de estado en la fila est establecida en DCS. Slo
los datos de consigna se transfieren si la entrada de estado es interna.

Los datos de PV se introducen desde HYSYS al servidor DDE de acuerdo con las etiquetas de elemento PV
configuradas en las matrices PV en las fichas de pginas PV de la vista DCS. El contenido de la columna Estado
en una matriz fotovoltaica determina si los datos fotovoltaicos en esa fila de la matriz se transfieren entre HYSYS
y el servidor DDE. La PV se transfiere si el valor de estado es DCS. La PV no se transfiere si el valor de estado es
interno.

Se inicia una transaccin DDE nica para cada transferencia de datos marcada individualmente.

El delimitador CF_TEXT para este controlador es el final del carcter de datos. El delimitador para Excel y
MATLAB es "\ r \ n"
DDE Synchronous Array Basado en Cliente
La versin basada en matriz del controlador difiere de la versin basada en etiquetas en que slo se configuran
tres etiquetas de elemento DDE. Una etiqueta se refiere a la matriz de datos de punto de referencia, una etiqueta se
refiere a la matriz de datos de salida, una etiqueta se refiere a la matriz de datos de exportacin de PV y una
etiqueta se refiere a la matriz de datos de importacin PV. Estas etiquetas se configuran en la ficha General Data
de la vista DCS.

La columna Estado de la matriz del controlador todava gobierna la aplicacin del punto de consigna recibido y
los datos de salida a los controladores HYSYS y los datos de importacin de PV aunque los datos se transfieren
entre el servidor y el cliente en un solo bloque. La columna Estado del PV se ignora en la versin basada en matriz
del controlador.

Slo se requieren cuatro transacciones de cliente DDE para completar las transferencias de datos de matriz.

Una prueba de rendimiento de transferencia de datos para 20 controladores PID indic que el mecanismo de
transferencia de datos basado en matriz era aproximadamente seis veces ms rpido que la versin basada en
etiquetas.

El delimitador CF_TEXT para este controlador es el carcter de separacin de datos. Para excel, el delimitador es
"\ r \ n". Para matlab el delimitador es "\ t".
Programas de Demostracin DDE
El objetivo bsico de esta demostracin es indicar cmo se puede utilizar el HYSYS DCS Link para ayudar a
disear algoritmos de control utilizando un sistema de software externo para calcular las acciones de control y
utilizar HYSYS para modelar la planta. El diseador de control puede enfocarse en el controlador y dejar que
HYSYS modele la planta. Tenga en cuenta que, en general, cualquier controlador HYSYS DCS puede sustituir a
los controladores DDE presentados en este documento.

Cuando el enlace DCS est habilitado, un programa externo interacta con los controladores HYSYS internos.
Son posibles dos tipos de interaccin. Como se mencion anteriormente, la columna Estado en la matriz del
controlador en la pestaa de la pgina de controladores de la vista DCS indica si se desea una transferencia de
datos de punto de consigna (interno) o de consigna y salida (DCS) para un controlador dado.
En el primer escenario, slo el punto de ajuste del controlador se modifica externamente. Este tipo de situacin
puede ocurrir en un problema de control multivariable donde los puntos de ajuste de varios controladores
dependientes se modifican de acuerdo con algn algoritmo externo. En este caso, los controladores HYSYS
internos todava calculan sus propios valores de salida.

En el segundo escenario, un programa externo modifica los puntos de ajuste y salidas del controlador. Este
mecanismo permite a un controlador externo reemplazar un controlador HYSYS interno. La salida del controlador
externo se escribe directamente en la salida del controlador HYSYS interno, evitando as el control interno. La
informacin de consigna del controlador tambin se transfiere para los propsitos de HYSYS GUI.

Un simple caso HYSYS que incluye dos tanques con controles de nivel se utiliza para fines de demostracin. Los
campos de estado del controlador estn configurados en DCS en los casos de HYSYS de demostracin. Las
acciones de control se calculan mediante un programa externo y los resultados se transfieren a travs del enlace
DCS del cliente DDE.

La ecuacin 1 da la respuesta bsica del controlador PID. Ambas demostraciones del servidor DDE utilizan esta
ecuacin para calcular las seales de salida del controlador para enviar de nuevo a HYSYS. Tenga en cuenta que
la implementacin de esta ecuacin en las demostraciones es muy bsica para mantener el cdigo de ejemplo
claro.

Los clculos de la salida del controlador se sincronizan con el integrador HYSYS utilizando el comando de
ejecucin configurado en la ficha General Data Page de la vista DCS. Cada perodo de transferencia de datos en
HYSYS activa la ejecucin de Execute Cmd en el servidor DDE permitiendo el clculo iterativo de las salidas del
controlador.
El mecanismo para transferir valores de datos integradores HYSYS de HYSYS a un programa externo es menos
intuitivo. Bsicamente, las variables del integrador deben configurarse en una celda de importacin de hoja de
clculo y una celda de exportacin de hoja de clculo debe configurarse para referirse a la celda de entrada. El
contenido de la celda de exportacin de la hoja de clculo se mostrar en el navegador de variables que aparece en
la pestaa Pgina PV de la vista DCS. Realizar los siguientes pasos permite la transferencia de datos de los
parmetros de tiempo del integrador.

op bias action kp error


action kp
error dt ction kp d d error (1)
i dt
bias control valve bias parameter
1.0 direct
action controller action
1.0 reverse
kp controller gain
error setpoint process variable
i controller integral time constant
d controller derivative time constant

Cree un objeto de hoja de clculo en el libro y abra la pestaa de la hoja de clculo.


Abrir la vista del integrador
Haga clic en el valor del parmetro integrador con el botn derecho del ratn y arrstrelo y colquelo en una
celda de la hoja de clculo (A6, por ejemplo). Tenga en cuenta que esta variable es una variable de importacin.
En una celda de hoja de clculo diferente, introduzca una frmula, que se refiere a la celda de importacin. Por
ejemplo, establecer una frmula para la celda B6 = + A6 crear una variable de exportacin para exportar el
parmetro integrador.
La celda de hoja de clculo B6 aparecer como una variable de hoja de clculo en el navegador de objetos
utilizado para configurar la matriz FV en la vista DCS y el valor ser idntico al parmetro integrador. Agregue la
celda de la hoja de clculo a la matriz fotovoltaica.
Se transfieren los tiempos y escalones actuales para calcular la integral y los derivados del error. Tenga en cuenta
que esto supone que el perodo de transferencia de datos en la ficha Pgina de controladores de DCS se establece
en 0.0 para que los datos se transfieren cada paso de tiempo. Si este no es el caso, el cdigo del servidor debe
cambiarse para calcular el tiempo anterior y almacenarlo.

You might also like