Automatización de la Generación y Medida de Mezclas Gaseosas...

359
Automatización de la Generación y Medida de Mezclas Gaseosas Mediante MassFlow TITULACIÓ: Enginyeria Tècnica en Electrònica Industrial AUTOR: Raphaël Verlaat DIRECTOR: Jesús Brezmes LLecha DATA: Juny / 2.007.

Transcript of Automatización de la Generación y Medida de Mezclas Gaseosas...

Page 1: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

Automatización de la Generación y Medida de Mezclas Gaseosas Mediante MassFlow

TITULACIÓ: Enginyeria Tècnica en Electrònica Industrial

AUTOR: Raphaël Verlaat DIRECTOR: Jesús Brezmes LLecha

DATA: Juny / 2.007.

Page 2: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

Índice: 1. Introducción.......................................................................................................... 3

1.1. Antecedentes...................................................................................................... 3 1.2. Objetivos............................................................................................................ 3

2. Memoria Descriptiva............................................................................................. 4 2.1. Funcionalidad del Programa ............................................................................... 4 2.2. Esquema General ............................................................................................... 5 2.3. Manual del Usuario ............................................................................................ 6 2.3.1. Establecer la comunicación ....................................................................... 6 2.3.2. El Planificador........................................................................................... 8 2.3.3. Planificar una Medida................................................................................ 9 2.3.4. Editar una Medida ................................................................................... 11 2.3.5. Definir un Nuevo Tramo.......................................................................... 13 2.3.6. Crear una Medida Nueva o Copiar una Existente ..................................... 14 2.3.7. Ejecución de un Proceso.......................................................................... 15

3. Memoria de Cálculo ............................................................................................ 17 3.1. Flujograma....................................................................................................... 17 3.2. Código ............................................................................................................. 18 3.2.1. Programa Principal (Programa.bas) ......................................................... 18 3.2.2. API Comunicación Mass Flow (modFlowbusAPI.bas) ............................ 55 3.2.3. Desarrollo de las funciones de la API (modFlowbusAvanzado.bas) ....... 105 3.2.4. API para Tarjeta de Adquisición de Datos (nidaq32.bas) ....................... 141 3.2.5. Funciones Sobre la API (nidex32.bas) ................................................... 149 3.2.6. Módulo de constantes para la API de la Adq. de datos(nidaqcns.inc) ..... 151 3.2.7. Módulo de errores de la API de Adquisición de Datos (nidaqerr.inc) ..... 169 3.2.8. Formulario de conexión (frmConexion.frm) .......................................... 189 3.2.9. Formulario del Planificador (frmPlanificador.frm) ................................. 194 3.2.10. Formulario para Planificar una Nueva Medida (frmPlanificar.frm) ........ 196 3.2.11. Formulario para Listar las Medidas Existentes (frmMedidas.frm) ......... 200 3.2.12. Formulario para Crear/Copiar una Medida Nueva (frmNewMedida.frm) 203 3.2.13. Formulario para Crear un Nuevo Tramo (frmTramo.frm) ...................... 206 3.2.14. Formulario para Monitorizar la Ejecución del Proceso (frmProceso.frm) 211 3.2.15. Temporizador de TimeOut (clsTemporizadorTimeOut.cls) .................... 219

4. Conclusiones..................................................................................................... 222 5. Anexos.............................................................................................................. 223

Page 3: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

3

1. Introducción

1.1. Antecedentes

En el laboratorio de la universidad URV se dispone de una cámara de test de mezclas gaseosas. Estas mezclas se controlan a través de controladores de flujo másico (en adelante Mass Flow Controllers). Actualmente para la gestión de los Mass Flow Controllers se utilizan en el laboratorio dos programas subministrados por la propia casa Bronkhorst HI-TEC.

El primero de estos programas es el FLOWDDE encargado de la comunicación a través del puerto serie entre el PC y los Mass Flows. En él se pueden definir todos los parámetros relativos a la comunicación (puerto, velocidad, paridad…) y establecer dicha comunicación correctamente. Además, el FLOWDDE se encargará de obtener la configuración actual de los Mass Flows (Nº de nodos, direcciones de memoria, canales…) para establecer dicha comunicación con una configuración adecuada.

Una vez establecida la comunicación, el segundo programa, llamado FLOWVIEW, se encargará de establecer los setpoints que nos interese en los Mass Flows, entendiendo por setpoint el valor en tanto por ciento de apertura (o fondo de escala) al que queremos tener cada uno de los Mass Flows. Además, también podemos establecer con el FLOWVIEW cuál es el gas que circula por los tubos y calibrar los Mass Flow correctamente en función de dicho gas.

La principal limitación de la configuración actual es la automatización de este proceso, ya que para poder controlar las cantidades de gas a mezclar, el tiempo de mezcla y obtener datos relativos a la mezcla se debe hacer todo manualmente.

1.2. Objetivos

Con el objetivo de paliar las limitaciones comentadas en el apartado anterior, se pretende construir un programa capaz de automatizar el proceso de mezcla de gases, determinar el tiempo de mezcla y adquirir un muestreo de datos para su posterior tratamiento con MATLAB.

Los objetivos a cubrir son:

Ø Diseñar un programa que controle los Mass Flow Controllers. Ø Programar una tarjeta de adquisición de datos. Ø Guardar el muestreo de datos obtenido en ficheros para el posterior tratamiento

con MATLAB. Ø Integrar todo el control en una agenda de experimentos. Ø Facilitar a la comunidad universitaria que utiliza la cámara de test el estudio de

la mezcla de gases.

Page 4: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

4

2. Memoria Descriptiva

2.1. Funcionalidad del Programa

Para crear el programa de control de los Mass Flows y de adquisición de datos utilizaremos Visual Basic estableciendo los siguientes pasos de ejecución:

Ejecutaremos el programa con una pantalla inicial. Dicha pantalla inicial tendrá los parámetros de configuración del programa y de conexión así como la velocidad, el puerto de comunicación y los canales de lectura de la tarjeta de adquisición de datos.

La comunicación tanto con los Mass Flows como con la tarjeta de adquisición de datos se hará a través de 2 API’s, una para cada dispositivo. En ellas encontraremos todas las funciones necesarias para poder realizar correctamente la conexión a través del puerto serie.

Una vez establecida correctamente la conexión pasaremos a una pantalla que mostrará las tareas ya planificadas y el estado de cada una. Indicará que tareas han finalizado correctamente en ejecuciones anteriores del programa, así como también repasará todas aquellas que estando planificadas no se han podido llevar a cabo por alguna razón, poniéndolas en un estado de no procesado.

A través de una serie de botones y con la idea de dar un tratamiento más visual al programa, se permitirá el acceso a diferentes pantallas que nos permitirán modificar los parámetros relacionados con el experimento en cuestión.

A través de las diferentes pantallas podremos ir estableciendo diferentes setpoints. Estos setpoints los podremos ir variando según avance el tiempo. La variación de estos setpoints hará variar la concentración de los diferentes gases en la mezcla final.

Para cada tramo (definiremos tramo como el tiempo transcurrido desde que hemos establecido un setpoint hasta que establecemos otro setpoint diferente o acabamos con el proceso actual) estableceremos un valor concreto de setpoint para cada uno de los tres Mass Flows.

Durante la ejecución de dicho tramo podremos establecer si queremos o no recoger datos de la tarjeta de adquisición de datos y cada cuanto tiempo. Es decir, podremos establecer un tiempo de muestreo. La escala de este intervalo será en segundos y podremos definir un decimal.

Entenderemos por medida, entonces, la ejecución de uno o más tramos consecutivos durante un tiempo determinado.

Una vez establecidos los parámetros dentro de cada medida, podremos planificarla tantas veces como queramos, y obtener los resultados para su estudio.

Page 5: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

5

Tras planificar una medida, ésta quedará en estado pendiente hasta que venza la hora de inicio de su ejecución. Entonces el programa se encargará de ir variando los parámetros del sistema de acuerdo con las indicaciones establecidas por la medida. Automáticamente se irán recogiendo, si así se hubiesen establecido, los datos correspondientes a las mediciones hechas en la tarjeta de adquisición de datos para almacenarlas en los ficheros.

Durante la ejecución del proceso establecido aparece una pantalla que monitoriza los datos obtenidos y los parámetros establecidos Todo ello está hecho con dos propósitos:

El primer propósito es mostrar al usuario la evolución del sistema y así saber en cada momento que valores se han conseguido establecer: valores como el setpoint establecido, el caudal de gas que circula por los Mass Flows (lo que se denomina measure) o el tiempo que resta hasta el final de la ejecución total de la medida. Finalmente también el valor en voltios que se puede leer en la tarjeta de adquisición de datos y que se mostrará gráficamente por la pantalla.

En segundo propósito es el hecho de que el usuario pueda visualizar la evolución cosa que da la sensación de actividad y le indica al usuario que el sistema está trabajando y que todo va según lo esperado. Dicha pantalla de monitorización del proceso no debe ser cerrada mientras dure la ejecución sino ésta quedará interrumpida. De hecho para cerrarla únicamente se puede hacer a través de un botón, que tras una confirmación, dará el proceso por finalizado, dejando el estado en “No Ejecutado”. Cerrará todos los ficheros abiertos y cerrará la ventana de monitorización. El sistema quedará en reposo a la espera del vencimiento de la siguiente planificación.

Se considerará el estado de reposo para los Mass Flows (0%) cifra que corresponderá dichos Mass Flows cuando éstos están totalmente cerrados. Esto es así para impedir la circulación de los gases y el consecuente vaciado de las botellas.

Teniendo el programa en cualquier fase (por ejemplo, pendiente de ejecutar alguna planificación o bien ejecutándola), si se desea, se puede planificar la ejecución de otras medidas que se ejecutarían con posterioridad. Eso sí, se debe tener en cuenta que mientras se está ejecutando una medida no pueda entrar ninguna otra en ejecución ya que el sistema está ocupado con la mezcla actual. Es por eso que no se debe permitir el solapamiento en la planificación de medidas. Es más, se establecerá un intervalo de al menos 5 minutos entre la ejecución de dos medidas y la próxima planificación, para así dar tiempo a preparar al sistema las condiciones necesarias para que se realice la medida o para que ésta se controle correctamente para conseguir adecuadamente la mezcla que se pretende experimentar.

Finalmente cuando deseemos acabar con la ejecución del programa, con el botón salir, se cerrarán las comunicaciones y se acabará con la ejecución del programa.

2.2. Esquema General

El sistema de la cámara de test de mezcla de gases lo componen 3 controladores de flujo másico (Mass Flow Controllers) de la casa Bronkhorst de HI-TEC. Estos controladores son del tipo EL-FLOW (laboratory style) F201-CV y controlan el flujo de gas que dejan pasar a la mezcla. A su vez el grado de apertura o fondo de escala de los Mass Flows es determinado a través del PC estableciendo el setpoint concreto. Para ello se utiliza una tarjeta de adquisición de datos de la Nacional Instruments con referencia 6023E.

Page 6: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

6

El esquema general seria el siguiente:

Figura 1. Esquema General del Sistema.

2.3. Manual del Usuario

2.3.1. Establecer la comunicación

Al iniciar la ejecución del programa, la primera pantalla que aparece es la que establece los parámetros iniciales y de conexión.

Esta pantalla presenta, por defecto, los últimos valores establecidos y si es la primera vez que se ejecuta el programa, entonces, mostrará los valores preconfigurados que son:

Ø Puerto de comunicación: El primero disponible. Ø Velocidad de conexión: 38400 Baudios. Ø Canales activados: Ninguno.

La pantalla es la correspondiente a la figura 1.

Page 7: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

7

Figura 1. Conexión.

Si observamos la pantalla, en primera instancia los campos aparecen protegidos. Si no estamos de acuerdo con la configuración actual, se puede pulsar el botón “Cambiar Configuración” y se desprotegen los campos para poder modificarlos.

Puerto: Establece el puerto de comunicaciones a través del cual se conectará el ordenador con los MassFlows. Los puertos disponibles serán los que tiene disponibles el ordenador.

Baudios: Establece la velocidad de conexión entre el ordenador y los MassFlows. La velocidad por defecto es 38400 y las disponibles son: 4800, 9600, 19200, 38400.

Canales de lectura activados: Se disponen de 16 canales para la adquisición de datos. Cada uno de estos canales se puede activar o desactivar independientemente. Esto dependerá de la configuración del sistema y de los canales que el usuario quiera leer.

Tanto si inicialmente estábamos de acuerdo con la configuración que propuso el programa como si hemos cambiado los parámetros, presionando “Aceptar” intentaremos la comunicación con los MassFlows. Si ésta tiene éxito pasaremos a la pantalla del planificador y se guardará dicha configuración para la próxima vez que se ejecute el programa. Si pasado un tiempo la comunicación no se establece, se abortará el intento y se dejará que el usuario establezca otra configuración diferente o lo intente con la misma si lo cree oportuno.

Actuando sobre “Cancelar” el programa no intenta la conexión y sale del programa.

Page 8: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

8

2.3.2. El Planificador

Después de establecer la conexión con éxito, la primera pantalla que aparece es la del planificador. Esta pantalla tiene la función de actuar de “Programa Principal”. En ella planificamos la ejecución de los diferentes procesos y comprobamos el estado de su ejecución.

En la pantalla observamos diferentes campos:

Num: Indica el número de orden de una planificación. Es único para cada planificación y ayuda a identificarla.

Nombre de la Medida: Indica el nombre de la medida de la cual hemos planificado su ejecución.

Fecha de Inicio: Indica en que día se inicia la ejecución del proceso.

Hora de Inicio: Indica a que hora se inicia la ejecución del proceso.

Fecha de Finalización: Teniendo en cuenta la duración de la ejecución del proceso el programa calcula el día que finalizará el proceso.

Hora de Finalización: Teniendo en cuenta la duración de la ejecución del proceso el programa calcula a que hora del día finalizará el proceso.

Estado: Indica en que estado se encuentran los procesos planificados. Estos estados pueden ser:

Ø Completado: El proceso planificado se ejecutado correctamente y ha concluido satisfactoriamente.

Ø No Ejecutado: El proceso no se ha ejecutado correctamente. Esto ocurre si por ejemplo iniciamos el programa a una hora determinada y había procesos que ya deberían haberse ejecutado. O bien si por el contrario durante la ejecución del proceso ocurre alguna incidencia que altere la ejecución normal del programa o se aborta intencionadamente el proceso.

Ø Pendiente: Indica que un proceso esta planificando y pendiente de su vencimiento para iniciar su ejecución.

Ø En Ejecución: Indica que un proceso se encuentra actualmente en ejecución.

La pantalla que le corresponde se muestra a continuación en la figura 2.

Page 9: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

9

Figura 2. Planificador.

Los diferentes botones realizan las siguientes acciones:

Ø Planificar Medida: Pasamos a la pantalla encargada de planificar una ejecución de entre las medidas existentes.

Ø Desplanificar Medida: Se encarga del paso inverso a “Planificar Medida”. Si nos interesa que no se realice la ejecución de una medida planificada en estado “Pendiente”, seleccionaremos la medida en cuestión y actuaremos sobre este botón. Nos pedirá una confirmación de la desplanificación y, si aceptamos, el programa procederá a eliminar dicha medida del planificador. Si actuamos sobre una medida planificada en otro estado diferente a “Pendiente”, después de la confirmación de la acción, eliminará el registro correspondiente con la idea de limpiar el planificador. El botón “Desplanificar Medida” no puede actuar sobre los procesos que se encuentran en ejecución, cuyos estados corresponden a “En Ejecución”.

Ø Editar Medidas: Se accede a la operativa para editar, borrar o modificar las medidas existentes.

Ø Eliminar Completados: Elimina del planificador todas las medidas en estado diferente a “Pendiente” o “En Ejecución”. Tiene como finalidad eliminar las entradas correspondientes a las medidas ya procesadas y limpiar el planificador.

Salir: Cierra la comunicación con los MassFlows y termina con la ejecución del programa.

2.3.3. Planificar una Medida

Si estando en la pantalla del planificar se acciona el botón “Planificar Medida” se accede a la siguiente pantalla que se muestra en la figura 3:

Page 10: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

10

Figura 3. Planificar una Medida.

En ella podemos establecer los parámetros necesarios para planificar una nueva ejecución de una medida existente.

En el primer campo, “Fecha de Inicio”, se informa por defecto con la fecha de hoy. Si nos interesa que el día de la ejecución sea un día diferente, actuando sobre el desplegable, nos mostrará un calendario en el cual podremos señalar el día que preferimos para que se ejecute el proceso.

En el campo “Hora de Inicio” podemos actuar para establecer a que hora queremos que empiece la ejecución del proceso. Esta deberá ser siempre necesariamente superior a cinco minutos de la hora actual, entendiendo por hora actual la hora y la fecha en el momento que pulsemos el botón “Aceptar”. Tampoco podrá coincidir la fecha y la hora de inicio o de fin de una planificación con todo el intervalo de tiempo de ejecución de alguna planificación ya establecida con anterioridad. Si esto ocurre o cambiamos la hora de la nueva planificación o borramos primeramente la planificación que causa el solapamiento.

El campo “Medida” es un desplegable sobre el que podremos actuar para obtener todas las medidas disponibles y estaremos obligados a seleccionar una para establecer la planificación.

En el campo “Nombre de Archivo” deberemos establecer un nombre y una ruta para guardar los archivos de datos que se generan durante la ejecución del proceso de una medida planificada. Se generarán 2 ficheros:

- Uno .dat con los datos más relevantes de la ejecución y el muestreo de datos obtenidos para dar la idea al usuario del transcurso de la ejecución.

- Y un segundo fichero con el mismo nombre .mat con los datos únicamente del muestreo obtenido para su posterior tratamiento por MATLAB.

Page 11: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

11

El literal que aparece al final de la pantalla que indica “Fecha y Hora de Finalización” se calcula a partir de la fecha y la hora establecidas por el usuario y sabiendo la duración de ésta.

Una vez introducidos todos los parámetros se pulsará el botón “Aceptar” y si todos los parámetros son correctos, se planificará la nueva ejecución. Si no es así dejaremos la pantalla actual el programa devolverá el error correspondiente y será entonces cuando se permitirá corregir de nuevos los parámetros.

Si se actúa sobre el botón “Cancelar” la nueva ejecución no se planificará y volveremos a la pantalla del planificador.

2.3.4. Editar una Medida

Si estando en la pantalla del planificador actuamos sobre el botón “Editar Medida” accederemos a la pantalla que muestra la figura 4, donde podremos actuar sobre todas las opciones para crear, borrar o modificar una medida nueva o existente.

Figura 4. Editar una Medida.

Page 12: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

12

Una medida es un proceso que agrupa una serie de tramos. Y un tramo se considera el tiempo transcurrido entre el establecimiento de un setpoint en los MassFlows y el establecimiento del siguiente setpoint o el final del proceso.

Por tanto una medida vendrá definida por uno o más tramos agrupados bajo un nombre. Este nombre será el que aparecerá en el desplegable que hay al principio de la pantalla que muestra la figura 4. Una vez seleccionado el nombre se actualizará la pantalla con los diferentes tramos que contiene la medida seleccionada.

El orden de la disposición de los tramos, y por tanto de sus diferentes setpoints, tiene mucha importancia ya que actúa directamente en el proceso y la secuencia de mezcla de los gases. Estos tramos se pueden reordenar seleccionando el tramo que queremos desplazar y actuando sobre las flechas “arriba” y “abajo” para cambiar el orden de éstos. Se permitirá modificar el orden de los tramos aunque la medida esté planificada para su ejecución. Únicamente se prohibirá la alteración de éstos si la medida entra o está en ejecución.

Al final de la pantalla aparece un literal que indica el tiempo total de ejecución de la medida seleccionada.

Si nos interesa definir un nuevo tramo (un nuevo setpoint) actuaremos sobre el botón “Nuevo Tramo” y accederemos a las opciones para definir el nuevo tramo. Para poder actuar sobre este botón deberemos tener una medida seleccionada.

Si nos interesa eliminar un tramo existente actuaremos sobre el botón “Eliminar Tramo”. Nos pedirá confirmación de la acción a realizar. Para poder actuar sobre este botón deberemos tener una medida seleccionada.

Si por el contrario queremos crear una medida nueva bien sin tramos o bien copia con los tramos de una medida ya existente actuaremos sobre el botón “Crear Medida”.

Si lo que se pretende es borrar toda una medida incluidos sus tramos y su nombre actuaremos sobre el botón “Eliminar Medida”.

Una vez concluidas las acciones, para salir de la pantalla de edición de medida y volver al planificador pulsaremos el botón “OK”.

Deberemos tener en cuenta que:

Ø No podremos ni insertar tramos ni eliminarlos, ni eliminar una medida si ésta está planificada. Deberemos primero eliminar su planificación.

Page 13: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

13

Ø Si una medida tiene su ejecución planificada y la seleccionamos nos aparecerá un mensaje que nos indicará que cualquier cambio que realicemos afectará a la planificación. Por otro lado los botones que modifican el número de tramos o la propia medida aparecerán inhabilitados. Podremos hacer cambios mientras el tiempo que queda hasta la ejecución de la medida sea superior a un minuto.

Ø Si eliminamos todos los tramos de una medida o a una medida nueva, no le definimos ningún tramo y salimos de la pantalla, el nombre de esta medida desaparece.

2.3.5. Definir un Nuevo Tramo

Si estando en la pantalla donde se editan las medidas (ver figura 4) se actúa sobre el botón de “Crear Tramo” se accede directamente a la pantalla que se muestra en la figura 5.

Figura 5. Definir un Tramo.

En ella se aprecian tres barras desplazables que sirven para establecer el grado de apertura o cierre (el tanto por ciento) de los diferentes MassFlows para poder establecer el setpoint cuando toque.

En la casilla “Tiempo” se establecerá un tiempo comprendido entre 1 y 525.600 minutos que corresponde a un año. Este tiempo representará el intervalo de tiempo desde el establecimiento del setpoint hasta el establecimiento del siguiente setpoint o el final de la medida si no existe ningún tramo más definido.

Page 14: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

14

Existe un área definida bajo el literal “¿Tomar medidas durante la ejecución del tramo?”. Indica si quiere o no leer datos de la tarjeta de adquisición y cada cuanto tiempo. Para ello hay que marcar la opción “Sí” si se quiere leer o “No” sino se quiere leer y en la casilla “Tiempo del intervalo” indicar cuanto tiempo. Este valor es un valor de entre 0 (Si no se quiere leer) y 86.400 segundos que corresponden a un día.

Una vez establecidos los datos correctos se pulsa “Aceptar” y en la pantalla de editar medida se incluirá el nuevo tramo al final de la medida.

Si se actúa sobre el botón “Cancelar” no se insertará el tramo y se cerrará la pantalla volviendo a la pantalla anterior de editar medidas.

2.3.6. Crear una Medida Nueva o Copiar una Existente

Si estando en la pantalla de editar medidas (ver figura 4) se quiere crear una medida nueva aparte de las ya existentes y pulsamos el botón de “Crear Medida” accedemos directamente a la pantalla que muestra la figura 6.

Figura 6. Creando una Medida Nueva.

En ella disponemos de dos opciones:

- la primera, si seleccionamos la opción “Crear medida nueva” se habilitará el campo “Medida Nueva” donde podremos poner el nuevo nombre y si oprimimos “Aceptar” regresaremos a la pantalla de editar medidas, donde la medida seleccionada será la nueva medida y no habrá ningún tramo añadido.

- la segunda, si seleccionamos la opción “Crear copia de una medida existente” (ver figura 7) se deshabilitarán las dos casillas. En la casilla “Medida Existente” desplegaremos

Page 15: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

15

la barra y seleccionaremos una de entre las diferentes medidas que existen en ese momento. A continuación en la casilla “Medida Nueva” introduciremos el nuevo nombre para la nueva medida. Esta vez, al oprimir el botón “Aceptar”, regresaremos al igual que antes a la pantalla de editar medidas, la medida seleccionada será la nueva medida y los tramos que se mostrarán serán los mismos que los de la medida de que se ha hecho la copia.

Figura 7. Copiando una Medida Existente.

Si accedemos al botón “Cancelar” no daremos de alta ninguna medida y también volveremos a la pantalla de editar medidas, sin alterar nada.

2.3.7. Ejecución de un Proceso

Automáticamente, si estando planificado un proceso vence el plazo de inicio, se abre una ventana que monitoriza la ejecución del proceso (ver figura 8).

Existe una gráfica que irá mostrando en función del tiempo la evolución de la adquisición de datos a través de los diferentes canales representados en los diferentes colores que indica el apartado “Canales”. Sólo se representarán los canales que se hayan indicado al inicio (ver figura 1) como canales activados.

El apartado “Tiempo restante”, indica el tiempo en “hh:mm:ss” que queda hasta concluir con la medida.

En el apartado Parámetros existen 3 parámetros recogidos para cada MassFlow:

Set: Indica el setpoint real establecido para cada MassFlow.

Cdl: Indica en función del gas que hay conectado a cada MassFlow y del volumen de gas que circula, el caudal (Measure) real que circula para el setpoint establecido.

Page 16: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

16

Gas: Muestra el nombre del gas configurado como conectado a los MassFlows.

Figura 8. Proceso en Ejecución.

Si accionamos el botón “Terminar Proceso” abortará la ejecución del proceso en curso y en el planificador el estado del proceso correspondiente será “No Ejecutado”.

Page 17: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

17

3. Memoria de Cálculo

3.1. Flujograma

El flujograma correspondiente a la aplicación sería el siguiente:

Figura 9. Flujograma.

Page 18: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

18

3.2. Código

A continuación se adjunta el código referente a la aplicación implementada. El siguiente esquema general indica los elementos existentes:

Figura 10. Esquema de la Aplicación.

3.2.1. Programa Principal (Programa.bas)

' Tipo de dato para el planificador

Public Type typPlanificador

Nombre As String

Fecha_ini As String

Hora_ini As String

Date_ini As Date

Fecha_fin As String

Hora_fin As String

Date_fin As Date

Tiempo As Double

Estado As String

Path As String

End Type

Page 19: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

19

' Tipo de dato para las medidas

Public Type typMedidas

Nombre As String

Numero As Integer

Tramo As Integer

Nodo3 As Integer

Nodo4 As Integer

Nodo5 As Integer

Medidas As Boolean

Intervalo As Double

Tiempo As Double

TmpTot As Double

End Type

'Variable para saber estado de ejecución

Public Type typEstado

Medida As String

Tramo As Integer

Inicio As Date

Fin As Date

Nodo3 As Integer

Nodo4 As Integer

Nodo5 As Integer

End Type

Dim arrMedidas() As typMedidas

Dim Num_med As Integer

Dim Num_Array_Med As Integer

Dim arrPlanif() As typPlanificador

Dim Num_plan As Integer

Dim Num_Array_Plan As Integer

Dim ind As Integer

Dim Lst As ListItem

Dim Tiempo_Intervalo As Double

Dim T_Transcurrido As Double

Global Estado_act As typEstado

Dim Direc_def As String

Page 20: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

20

'Datos de archivo

Dim intArchivo_Datos As Integer

Dim strArchivo_Nombre As String

Private Type Configuracion

IdApl As Integer

Abierto As Boolean

Puerto As String

Baudios As String

Canal(16) As Boolean

End Type

Global cfg As Configuracion

Global Salir_PGM As Boolean

Sub main()

Dim txtError As String

'Se establece el directorio de trabajo

Direc_def = App.Path & "\"

Call Crear_Direc_Medidas

ReDim arrMedidas(50)

Num_med = 0

Num_Array_Med = 50

ReDim arrPlanif(50)

Num_plan = 0

Num_Array_Plan = 50

Salir_PGM = False

Call Inicializar_cfg

Call Inicializar_Array_Medidas

Call Inicializar_Array_Planif

cfg.IdApl = modFlowbusAPI.OpenDLL(0)

frmConexion.Show vbModal

If (cfg.Abierto) Then

frmPlanificador.Show

Page 21: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

21

End If

Do While Not Salir_PGM

DoEvents

Loop

Call Guardar_cfg

If (cfg.Abierto) Then

txtError = modFlowbusAvanzado.CloseCommunication

End If

If (Len(txtError) <> 0) Then

MsgBox (txtError)

End If

End Sub

Public Sub Agregar_Tramo(Tramo_ent As typMedidas)

Dim i, j, Tramo, Numero As Integer

Dim Tiempo_tot As Double

Do While ((i <= Num_med) And (Tramo_ent.Nombre <> arrMedidas(i).Nombre))

i = i + 1

Loop

Tiempo_tot = 0

Tramo = 1

Numero = 0

Do While ((i <= Num_med) And (Tramo_ent.Nombre = arrMedidas(i).Nombre))

Tiempo_tot = arrMedidas(i).TmpTot

Tramo = Tramo + 1

Numero = arrMedidas(i).Numero

arrMedidas(i).TmpTot = arrMedidas(i).TmpTot + Tramo_ent.Tiempo

i = i + 1

Loop

'En caso de que deba ser el último elemento de la tabla

If (i > Num_med) Then

Page 22: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

22

Num_med = Num_med + 1

Else 'Va intercalado en la tabla

Num_med = Num_med + 1

For j = Num_med To i + 1 Step -1

arrMedidas(j) = arrMedidas(j - 1)

Next j

End If

If (Numero = 0) Then

Numero = Obtener_Num_Medida

End If

arrMedidas(i) = Tramo_ent

arrMedidas(i).Numero = Numero

arrMedidas(i).Tramo = Tramo

arrMedidas(i).TmpTot = Tiempo_tot + Tramo_ent.Tiempo

Call Refrescar_Lista_Medidas(Tramo_ent.Nombre, True)

Call Validar_Array_Medidas

End Sub

Function Obtener_Num_Medida() As Integer

Dim Num, i As Integer

Num = 0

For i = 1 To Num_med

If (arrMedidas(i).Numero > Num) Then

Num = arrMedidas(i).Numero

End If

Next i

If (Num = 0) Then

Num = 1

End If

Obtener_Num_Medida = Num

End Function

Sub Validar_Array_Medidas()

Page 23: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

23

'Call Mostrar_Matriz

'si quedan menos de 5 elementos libres se amplia en 50 elementos la array

If ((Num_Array_Med - Num_med) < 5) Then

Num_Array_Med = Num_Array_Med + 50

ReDim Preserve arrMedidas(Num_Array_Med)

MsgBox ("Se redimensiona el array medidas añadiendo elementos: " & UBound(arrMedidas))

End If

'Si quedan más de 60 elementos libres se quitan 50

Do While ((Num_Array_Med - Num_med) > 60)

Num_Array_Med = Num_Array_Med - 50

ReDim Preserve arrMedidas(Num_Array_Med)

MsgBox ("Se redimensiona el array medidas quitando elementos: " & UBound(arrMedidas))

Loop

End Sub

Sub Refrescar_Lista_Medidas(ByVal Nombre As String, ByVal Guardar As Boolean)

Dim i As Integer

Dim TmpTot, Horas, Mins As Double

Dim Nombre_Archivo As String

'Se borran todos lo elementos

frmMedidas.lstMedidas.ListItems.Clear

'Y se vuelven a insertar

For i = 1 To Num_Array_Med

If (arrMedidas(i).Nombre = Nombre) Then

TmpTot = arrMedidas(i).TmpTot

Set Lst = frmMedidas.lstMedidas.ListItems.Add(, , arrMedidas(i).Nodo3 & "%")

Lst.SubItems(1) = arrMedidas(i).Nodo4 & "%"

Lst.SubItems(2) = arrMedidas(i).Nodo5 & "%"

Lst.SubItems(3) = arrMedidas(i).Tiempo & " mins"

If (arrMedidas(i).Medidas) Then

Lst.SubItems(4) = "Sí"

Else: Lst.SubItems(4) = "No"

Page 24: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

24

End If

Lst.SubItems(5) = arrMedidas(i).Intervalo & " segs"

End If

Next i

Mins = TmpTot

Horas = Int(Mins / 60)

Mins = Mins - (Horas * 60)

frmMedidas.lblTmpTot = "Tiempo total de ejecución: " & Horas & "h:" & Mins & "m" & " (" & TmpTot & " mins)."

If (Guardar) Then

'Grabar archivo de inicio

Call Copias_Seguridad_Medidas

Archivo = FreeFile

Nombre_Archivo = Direc_def & "Medidas.ini"

Open Nombre_Archivo For Binary As Archivo

For i = 1 To Num_med

Put Archivo, , arrMedidas(i)

Next i

Close Archivo

Call Eliminar_Temporal_Medidas

End If

End Sub

Public Function Mover_Tramo(Nombre As String, Tramo As Integer, Accion As Boolean) As Integer

Dim i, Tramo_aux, Sig, Pos, Res As Integer

Dim Med_aux As typMedidas

Dim Enc_uno, Enc_dos As Boolean

If (Accion) Then

Sig = Tramo - 1

Else: Sig = Tramo + 1

End If

Page 25: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

25

Pos = 0

'Buscamos el tramo siguiente/anterior

For i = 1 To Num_med

If ((arrMedidas(i).Nombre = Nombre) And (arrMedidas(i).Tramo = Sig)) Then

Med_aux = arrMedidas(i)

Pos = i

Tramo_aux = arrMedidas(i).Tramo

Enc_uno = True

End If

Next i

'Buscamos el tramo seleccionado

For i = 1 To Num_med

If ((arrMedidas(i).Nombre = Nombre) And (arrMedidas(i).Tramo = Tramo) And (Enc_uno)) Then

arrMedidas(Pos) = arrMedidas(i)

arrMedidas(Pos).Tramo = Tramo_aux

Med_aux.Tramo = arrMedidas(i).Tramo

arrMedidas(i) = Med_aux

Enc_dos = True

End If

Next i

If (Not Enc_uno) Then

If (Accion) Then

Res = MsgBox("Ya se encuentra en la primera posición", , "Aviso")

Else: Res = MsgBox("Ya se encuentra en la última posición", , "Aviso")

End If

ElseIf (Not Enc_dos) Then

Res = MsgBox("Error en la aplicación!!!")

End If

Call Refrescar_Lista_Medidas(Nombre, True)

Call Validar_Array_Medidas

If (Pos = 0) Then

Mover_Tramo = Tramo

Else: Mover_Tramo = arrMedidas(Pos).Tramo

Page 26: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

26

End If

End Function

Sub Cargar_cmbMedida_Medidas()

Dim i As Integer

For i = 1 To Num_med

If (arrMedidas(i).Tramo = 1) Then

frmMedidas.cmbMedida.AddItem (arrMedidas(i).Nombre)

End If

Next i

End Sub

Sub Cargar_cmbMedida_Planificar()

Dim i As Integer

For i = 1 To Num_med

If (arrMedidas(i).Tramo = 1) Then

frmPlanificar.cmbMedida.AddItem (arrMedidas(i).Nombre)

End If

Next i

End Sub

Sub Cargar_cmbCopia()

Dim i As Integer

For i = 1 To Num_med

If (arrMedidas(i).Tramo = 1) Then

frmNewMedida.cmbCopia.AddItem (arrMedidas(i).Nombre)

End If

Next i

End Sub

Sub Inicializar_Array_Medidas()

Dim Archivo As Integer

Dim Elem As typMedidas

Page 27: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

27

Dim Nombre_Archivo As String

Archivo = FreeFile

Nombre_Archivo = Direc_def & "Medidas.ini"

Open Nombre_Archivo For Binary As Archivo

Get Archivo, , Elem

Do While (Not EOF(Archivo))

Num_med = Num_med + 1

arrMedidas(Num_med) = Elem

Call Validar_Array_Medidas

Get Archivo, , Elem

Loop

Close Archivo

'Call Mostrar_Matriz

End Sub

Sub Mostrar_Matriz()

Dim i As Integer

MsgBox ("Matriz Medidas" & vbCrLf & _

"Num_med: " & Num_med & vbCrLf & _

"Num_Array_Med: " & Num_Array_Med & vbCrLf & _

"Ubound: " & UBound(arrMedidas))

For i = 1 To Num_Array_Med

MsgBox ("Elemento " & i & ":" & vbCrLf & _

"Nombre: " & arrMedidas(i).Nombre & vbCrLf & _

"Numero: " & arrMedidas(i).Numero & vbCrLf & _

"Nodo3: " & arrMedidas(i).Nodo3 & vbCrLf & _

"Nodo4: " & arrMedidas(i).Nodo4 & vbCrLf & _

"Nodo5: " & arrMedidas(i).Nodo5 & vbCrLf & _

"Medidas: " & arrMedidas(i).Medidas & vbCrLf & _

"Tiempo: " & arrMedidas(i).Tiempo & vbCrLf & _

"Tramo: " & arrMedidas(i).Tramo & vbCrLf & _

"TmpTot: " & arrMedidas(i).TmpTot)

Page 28: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

28

Next i

End Sub

Sub Mostrar_Matriz_Planif()

Dim i As Integer

MsgBox ("Matriz Planif" & vbCrLf & _

"Num_plan: " & Num_plan & vbCrLf & _

"Num_Array_plan: " & Num_Array_Plan & vbCrLf & _

"Ubound: " & UBound(arrPlanif))

For i = 1 To Num_Array_Plan

MsgBox ("Elemento " & i & ":" & vbCrLf & _

"Nombre: " & arrPlanif(i).Nombre & vbCrLf & _

"Date_ini: " & arrPlanif(i).Date_ini & vbCrLf & _

"Fecha_ini: " & arrPlanif(i).Fecha_ini & vbCrLf & _

"Hora_ini: " & arrPlanif(i).Hora_ini & vbCrLf & _

"Date_fin: " & arrPlanif(i).Date_fin & vbCrLf & _

"Fecha_fin: " & arrPlanif(i).Fecha_fin & vbCrLf & _

"Hora_fin: " & arrPlanif(i).Hora_fin & vbCrLf & _

"Estado: " & arrPlanif(i).Estado & vbCrLf & _

"Tiempo: " & arrPlanif(i).Tiempo & vbCrLf & _

"Path: " & arrPlanif(i).Path)

Next i

End Sub

Sub Copiar_Medida(Original, Copia As String)

Dim i, Tope, Numero As Integer

Tope = Num_med

Numero = Obtener_Num_Medida

For i = 1 To Tope

If (arrMedidas(i).Nombre = Original) Then

Num_med = Num_med + 1

arrMedidas(Num_med) = arrMedidas(i)

arrMedidas(Num_med).Nombre = Copia

arrMedidas(Num_med).Numero = Numero

Page 29: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

29

Call Validar_Array_Medidas

End If

Next i

End Sub

Sub Eliminar_Tramo(Nombre As String, Tramo As Integer)

Dim i As Integer

Dim Tiempo As Integer

'Se busca el tramo en cuestión

i = 1

Do While ((i <= Num_med) And ((arrMedidas(i).Nombre <> Nombre) Or (arrMedidas(i).Tramo <> Tramo)))

i = i + 1

Loop

'Se elimina el registro buscado

If (i <= Num_med) Then

Tiempo = arrMedidas(i).Tiempo

Eliminar_Elemento_Medidas (i)

End If

'Se recalculan los tramos

For i = 1 To Num_med

If ((arrMedidas(i).Nombre = Nombre) And (arrMedidas(i).Tramo > Tramo)) Then

arrMedidas(i).Tramo = arrMedidas(i).Tramo - 1

End If

If (arrMedidas(i).Nombre = Nombre) Then

arrMedidas(i).TmpTot = arrMedidas(i).TmpTot - Tiempo

End If

Next i

Call Refrescar_Lista_Medidas(Nombre, True)

End Sub

Sub Eliminar_Elemento_Medidas(Elemento As Integer)

Dim i As Integer

Page 30: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

30

For i = Elemento To Num_med

arrMedidas(i) = arrMedidas(i + 1)

Next i

Num_med = Num_med - 1

Call Validar_Array_Medidas

End Sub

Sub Eliminar_Medida(Nombre As String)

Dim i As Integer

'Se eliminan todos los tramos de la medida

i = 1

Do While (i <= Num_med)

If (arrMedidas(i).Nombre = Nombre) Then

Call Eliminar_Elemento_Medidas(i)

Else: i = i + 1

End If

Loop

Call Refrescar_Lista_Medidas(Nombre, True)

End Sub

Function Obtener_Tiempo_Total(Nombre As String) As Double

Dim i As Integer

i = 1

Do While ((i <= Num_med) And (arrMedidas(i).Nombre <> Nombre))

i = i + 1

Loop

If (i <= Num_med) Then

Obtener_Tiempo_Total = arrMedidas(i).TmpTot

Else: Obtener_Tiempo_Total = 0

End If

End Function

Function Obtener_FechaFin(ByVal Fecha_ent As Date, Tiempo_ent As Double) As Date

Page 31: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

31

Dim Dia_ent, Mes_ent, Año_ent, Horas_ent, Min_ent As Integer

Dim Num_dias, Num_horas, Num_min As Integer

Dim Dia_sal, Mes_sal, Año_sal, Hora_sal, Min_sal As Integer

Dim Dias_rest, Dia_act, Mes_act, Año_act, Dias_mes As Integer

Dim Encontrado, Fecha_fmt, Hora_str As String

Fecha_fmt = Format(Fecha_ent, "dd/mm/yyyy HH:mm")

Dia_ent = Int(Mid(Fecha_fmt, 1, 2))

Mes_ent = Int(Mid(Fecha_fmt, 4, 2))

Año_ent = Int(Mid(Fecha_fmt, 7, 4))

Horas_ent = Int(Mid(Fecha_fmt, 12, 2))

Min_ent = Int(Mid(Fecha_fmt, 15, 2))

Num_dias = Int(Tiempo_ent / 1440)

Num_min = Tiempo_ent - (Num_dias * 1440)

Num_horas = Int(Num_min / 60)

Num_min = Num_min - (Num_horas * 60)

'se suman los minutos

If ((Num_min + Min_ent) > 59) Then

Min_sal = Min_ent + Num_min - 60

If (Num_horas = 23) Then

Num_horas = 0

Num_dias = Num_dias + 1

Else: Num_horas = Num_horas + 1

End If

Else: Min_sal = Min_ent + Num_min

End If

'Se suman las horas

If ((Num_horas + Horas_ent) > 23) Then

Hora_sal = Horas_ent + Num_horas - 24

Num_dias = Num_dias + 1

Else: Hora_sal = Horas_ent + Num_horas

End If

'Se suman los días

Encontrado = "N"

Page 32: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

32

Dias_rest = Num_dias

Dia_act = Dia_ent

Mes_act = Mes_ent

Año_act = Año_ent

Do While (Encontrado = "N")

Select Case (Mes_act)

Case 2

If ((Año_act Mod 4 = 0) And ((Año_act Mod 100 <> 0) Or (Año_act Mod 400 = 0))) Then

Dias_mes = 29

Else: Dias_mes = 28

End If

Case 4, 6, 9, 11

Dias_mes = 30

Case Else

Dias_mes = 31

End Select

If (Dias_rest > (Dias_mes - Dia_act)) Then

Dias_rest = Dias_rest - (Dias_mes - Dia_act)

Dia_act = 0

If (Mes_act = 12) Then

Mes_act = 1

Año_act = Año_act + 1

Else: Mes_act = Mes_act + 1

End If

Else: Dia_sal = Dia_act + Dias_rest

Mes_sal = Mes_act

Año_sal = Año_act

Encontrado = "S"

End If

Loop

Obtener_FechaFin = Dia_sal & "/" & Mes_sal & "/" & Año_sal & " " & Hora_sal & ":" & Min_sal

End Function

Function Añadir_Planificacion(ByVal Medida As String, ByVal Fecha As Date, ByVal Path As String) As Boolean

Dim i, Ind_ant As Integer

Dim Fecha_fin As Date

Page 33: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

33

Dim strFecha_ini, strFecha_fin As String

Dim Insertado As Boolean

Dim TmpTot As Double

Insertado = True

'Se busca el lugar que le toca, según planificacción

i = 1

Do While ((i <= Num_plan) And (Formato_Date(arrPlanif(i).Fecha_ini, arrPlanif(i).Hora_ini) < Fecha))

i = i + 1

Loop

TmpTot = Obtener_Tiempo_Total(Medida)

Fecha_fin = Obtener_FechaFin(Fecha, TmpTot)

strFecha_ini = Format(Fecha, "dd/mm/yyyy HH:mm")

strFecha_fin = Format(Fecha_fin, "dd/mm/yyyy HH:mm")

'Se valida que no se solape con otra medida

If (i > 1) Then

If ((Fecha <= arrPlanif(i - 1).Date_fin) And (arrPlanif(i - 1).Estado = "Pendiente")) Then

Insertado = False

End If

End If

If (Insertado) Then

Num_plan = Num_plan + 1

If (i <= Num_plan) Then

For j = Num_plan To i + 1 Step -1

MsgBox ("se asigna a la posicion: " & j)

arrPlanif(j) = arrPlanif(j - 1)

Next j

arrPlanif(i).Nombre = Medida

arrPlanif(i).Fecha_ini = Mid(strFecha_ini, 1, 10)

arrPlanif(i).Hora_ini = Mid(strFecha_ini, 12, 5)

arrPlanif(i).Date_ini = Fecha

arrPlanif(i).Fecha_fin = Mid(strFecha_fin, 1, 10)

arrPlanif(i).Hora_fin = Mid(strFecha_fin, 12, 5)

arrPlanif(i).Date_fin = Fecha_fin

arrPlanif(i).Estado = "Pendiente"

Page 34: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

34

arrPlanif(i).Tiempo = TmpTot

arrPlanif(i).Path = Path

Else: arrPlanif(Num_plan).Nombre = Medida

arrPlanif(Num_plan).Fecha_ini = Mid(strFecha_ini, 1, 10)

arrPlanif(Num_plan).Hora_ini = Mid(strFecha_ini, 12, 5)

arrPlanif(Num_plan).Date_ini = Fecha

arrPlanif(Num_plan).Fecha_fin = Mid(strFecha_fin, 1, 10)

arrPlanif(Num_plan).Hora_fin = Mid(strFecha_fin, 12, 5)

arrPlanif(Num_plan).Date_fin = Fecha_fin

arrPlanif(Num_plan).Estado = "Pendiente"

arrPlanif(Num_plan).Tiempo = TmpTot

arrPlanif(i).Path = Path

End If

Call Refrescar_Lista_Planificador

Call Validar_Array_Planif

End If

If (ind = 0) Then

ind = Num_plan

End If

Añadir_Planificacion = Insertado

End Function

Sub Refrescar_Lista_Planificador()

Dim i, Archivo As Integer

Dim TmpTot, Horas, Mins As Double

Dim Nombre_Archivo As String

'Se borran todos los elementos

frmPlanificador.lstPlanif.ListItems.Clear

'Y se vuelven a insertar

For i = 1 To Num_plan

Set Lst = frmPlanificador.lstPlanif.ListItems.Add(, , i)

Lst.SubItems(1) = arrPlanif(i).Nombre

Lst.SubItems(2) = arrPlanif(i).Fecha_ini

Lst.SubItems(3) = arrPlanif(i).Hora_ini

Lst.SubItems(4) = arrPlanif(i).Fecha_fin

Page 35: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

35

Lst.SubItems(5) = arrPlanif(i).Hora_fin

Lst.SubItems(6) = arrPlanif(i).Estado

Next i

'Grabar archivo de inicio

Call Copias_Seguridad_Planificador

Archivo = FreeFile

Nombre_Archivo = Direc_def & "Planif.ini"

Open Nombre_Archivo For Binary As Archivo

For i = 1 To Num_plan

Put Archivo, , arrPlanif(i)

Next i

Close Archivo

Call Eliminar_Temporal_Planificador

End Sub

Sub Validar_Array_Planif()

'Call Mostrar_Matriz

'si quedan menos de 5 elementos libres se amplia en 50 elementos la array

If ((Num_Array_Plan - Num_plan) < 5) Then

Num_Array_Plan = Num_Array_Plan + 50

ReDim Preserve arrPlanif(Num_Array_Plan)

MsgBox ("Se redimensiona el array planif añadiendo elementos: " & UBound(arrPlanif))

End If

'Si quedan más de 60 elementos libres se quitan 50

Do While ((Num_Array_Plan - Num_plan) > 60)

Num_Array_Plan = Num_Array_Plan - 50

ReDim Preserve arrPlanif(Num_Array_Plan)

MsgBox ("Se redimensiona el array planif quitando elementos: " & UBound(arrPlanif))

Loop

End Sub

Page 36: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

36

Sub Inicializar_Array_Planif()

Dim i, Archivo As Integer

Dim Elem As typPlanificador

Dim Nombre_Archivo As String

Archivo = FreeFile

Nombre_Archivo = Direc_def & "Planif.ini"

Open Nombre_Archivo For Binary As Archivo

Get Archivo, , Elem

Do While (Not EOF(Archivo))

Num_plan = Num_plan + 1

arrPlanif(Num_plan) = Elem

Call Validar_Array_Planif

Get Archivo, , Elem

Loop

Close Archivo

'Estudiar estados

Fecha_act = Now

For i = 1 To Num_plan

If ((arrPlanif(i).Estado <> "Completado") And (arrPlanif(i).Date_ini < Fecha_act)) Then

arrPlanif(i).Estado = "No Ejecutado"

End If

If ((arrPlanif(i).Estado = "Pendiente") And (ind = 0)) Then

ind = i

End If

Next i

'Call Mostrar_Matriz_Planif

End Sub

Function Formato_Date(ByVal Fecha As String, ByVal Hora As String) As Date

Dim Fecha_sal, Hora_sal As String

If ((Fecha = "") Or (Fecha = " ")) Then

Page 37: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

37

Fecha_sal = "01/01/0000"

Else: Fecha_sal = Fecha

End If

If ((Hora = "") Or (Hora = " ")) Then

Hora_sal = "00:00"

Else: Hora_sal = Hora

End If

Formato_Date = Fecha_sal & " " & Hora_sal

End Function

Sub Eliminar_Elemento_Planificador(Index As Integer)

Dim i As Integer

For i = Index To Num_plan

arrPlanif(i) = arrPlanif(i + 1)

Next i

Num_plan = Num_plan - 1

End Sub

Sub Eliminar_planificacion(Index As Integer)

Call Eliminar_Elemento_Planificador(Index)

Call Refrescar_Lista_Planificador

Call Validar_Array_Planif

End Sub

Function Eliminar_Completados() As Integer

Dim i, Eliminados, Index As Integer

MsgBox ("num_plan: " & Num_plan)

i = 1

Eliminados = 0

Do While (i <= Num_plan)

Index = i

If (arrPlanif(i).Estado = "Completado") Then

Page 38: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

38

Eliminados = Eliminados + 1

Call Eliminar_Elemento_Planificador(Index)

Else: i = i + 1

End If

Loop

MsgBox ("num_plan: " & Num_plan)

Call Refrescar_Lista_Planificador

Call Validar_Array_Planif

Eliminar_Completados = Eliminados

End Function

Sub Set_Tiempo_Intervalo(Tiempo As Double)

Tiempo_Intervalo = Tiempo

If (Tiempo_Intervalo > 0) Then

frmPlanificador.tmrIntervalo.Enabled = True

Else: frmPlanificador.tmrIntervalo.Enabled = False

T_Transcurrido = 0

End If

End Sub

Function Get_Tiempo_Intervalo() As Double

Dim Acabado As Boolean

T_Transcurrido = T_Transcurrido + 1

If ((T_Transcurrido = Tiempo_Intervalo) And (Tiempo_Intervalo > 0)) Then

Acabado = True

T_Transcurrido = 0

Else: Acabado = False

End If

Get_Tiempo_Intervalo = Acabado

End Function

Sub Copias_Seguridad_Planificador()

On Error Resume Next

Dim Nombre_Archivo1, Nombre_Archivo2 As String

Page 39: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

39

'Se hacen copias de seguridad de los archivos existentes del planificador

Nombre_Archivo1 = Direc_def & "Planif.old"

Nombre_Archivo2 = Direc_def & "Planif.tmp"

FileCopy Nombre_Archivo1, Nombre_Archivo2

Kill Nombre_Archivo1

Nombre_Archivo1 = Direc_def & "Planif.ini"

Nombre_Archivo2 = Direc_def & "Planif.old"

FileCopy Nombre_Archivo1, Nombre_Archivo2

Kill Nombre_Archivo1

End Sub

Sub Copias_Seguridad_Medidas()

On Error Resume Next

Dim Nombre_Archivo1, Nombre_Archivo2 As String

'Se hacen copias de seguridad de los archivos existentes de las medidas

Nombre_Archivo1 = Direc_def & "Medidas.old"

Nombre_Archivo2 = Direc_def & "Medidas.tmp"

FileCopy Nombre_Archivo1, Nombre_Archivo2

Kill Nombre_Archivo1

Nombre_Archivo1 = Direc_def & "Medidas.ini"

Nombre_Archivo2 = Direc_def & "Medidas.old"

FileCopy Nombre_Archivo1, Nombre_Archivo2

Kill Nombre_Archivo1

End Sub

Sub Eliminar_Temporal_Medidas()

On Error Resume Next

Dim Nombre_Archivo As String

Nombre_Archivo = Direc_def & "Medidas.tmp"

Kill Nombre_Archivo

End Sub

Sub Eliminar_Temporal_Planificador()

Page 40: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

40

On Error Resume Next

Dim Nombre_Archivo As String

Nombre_Archivo = Direc_def & "Planif.tmp"

Kill Nombre_Archivo

End Sub

Function Existe_Path(Path As String) As Integer

Dim i As Integer

i = 1

Do While ((i <= Num_plan) And ((Path <> arrPlanif(i).Path) Or (arrPlanif(i).Estado <> "Pendiente")))

i = i + 1

Loop

If (i > Num_plan) Then

i = 0

End If

Existe_Path = i

End Function

Sub Validar_Planificacion()

If (Estado_act.Medida = "") Then

If ((Now > arrPlanif(ind).Date_ini) And (arrPlanif(ind).Estado = "Pendiente")) Then

Call Iniciar_Ejecucion

End If

Else

If (Now > Estado_act.Fin) Then

Call Cambiar_Tramo_Ejecucion

End If

End If

End Sub

Page 41: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

41

Sub Iniciar_Ejecucion()

Dim ind_tram As Integer

arrPlanif(ind).Estado = "En Ejecución"

Call Refrescar_Lista_Planificador

Estado_act.Medida = arrPlanif(ind).Nombre

ind_tram = Obtener_Indicador_Siguiente_Tramo(Estado_act.Medida, 0)

If (ind_tram > 0) Then

Estado_act.Tramo = arrMedidas(ind_tram).Tramo

Estado_act.Inicio = arrPlanif(ind).Date_ini

Estado_act.Fin = Obtener_FechaFin(arrPlanif(ind).Date_ini, arrMedidas(ind_tram).Tiempo)

Call Iniciar_Fichero(arrPlanif(ind).Path)

Print #intArchivo_Datos, "Estados de los nodos: -Nodo3: " & arrMedidas(ind_tram).Nodo3 & "%. -Nodo4: " & arrMedidas(ind_tram).Nodo4 & "%. -Nodo5: " & arrMedidas(ind_tram).Nodo5 & "%."

Print #intArchivo_Datos, " "

If (arrMedidas(ind_tram).Medidas) Then

Set_Tiempo_Intervalo (arrMedidas(ind_tram).Intervalo)

Else: Print #intArchivo_Datos, "- Tramo sin medidas"

Set_Tiempo_Intervalo (0)

End If

Call Establecer_Setpoint(arrMedidas(ind_tram).Nodo3, arrMedidas(ind_tram).Nodo4, arrMedidas(ind_tram).Nodo5)

frmProceso.Show vbModeless, Me

Else: Res = MsgBox("La medida: " & arrPlanif(ind).Nombre & ", que se pretendia ejecutar no existe", "Error")

arrPlanif(ind).Estado = "No Ejecutado"

If (ind < Num_plan) Then

ind = ind + 1

End If

End If

End Sub

Function Obtener_Indicador_Siguiente_Tramo(ByVal Medida As String, Tramo As Integer) As Integer

Dim i, Tramo_act, Ind_act As Integer

For i = 1 To Num_med

If ((arrMedidas(i).Nombre = Medida) And (arrMedidas(i).Tramo > Tramo) And ((arrMedidas(i).Tramo < Tramo_act) Or (Tramo_act = 0))) Then

Page 42: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

42

Tramo_act = arrMedidas(i).Tramo

Ind_act = i

End If

Next i

Obtener_Indicador_Siguiente_Tramo = Ind_act

End Function

Sub Crear_Direc_Medidas()

On Error Resume Next

Dim Nombre_Directorio As String

Nombre_Directorio = Direc_def & "Medidas\"

MkDir (Nombre_Directorio)

End Sub

Function Obtener_Direc_Medidas() As String

Obtener_Direc_Medidas = Direc_def & "Medidas\"

End Function

Sub Cambiar_Tramo_Ejecucion()

Dim ind_tram As Integer

Dim Caudal3 As Integer

Dim Caudal4 As Integer

Dim Caudal5 As Integer

ind_tram = Obtener_Indicador_Siguiente_Tramo(Estado_act.Medida, Estado_act.Tramo)

If (ind_tram > 0) Then

Call Obtener_Caudal(Caudal3, Caudal4, Caudal5)

Print #intArchivo_Datos, " "

Print #intArchivo_Datos, "Caudal 3: " & Caudal3 & "% - Caudal 4: " & Caudal4 & "% - Caudal 5: " & Caudal5 & "%"

Print #intArchivo_Datos, " "

Estado_act.Tramo = arrMedidas(ind_tram).Tramo

Estado_act.Inicio = Estado_act.Fin

Page 43: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

43

Estado_act.Fin = Obtener_FechaFin(Estado_act.Inicio, arrMedidas(ind_tram).Tiempo)

Print #intArchivo_Datos, "Tramo " & Estado_act.Tramo & ":"

Print #intArchivo_Datos, " "

Print #intArchivo_Datos, "Estados de los nodos: -Nodo3: " & arrMedidas(ind_tram).Nodo3 & "%. -Nodo4: " & arrMedidas(ind_tram).Nodo4 & "%. -Nodo5: " & arrMedidas(ind_tram).Nodo5 & "%."

Print #intArchivo_Datos, " "

If (arrMedidas(ind_tram).Medidas) Then

Set_Tiempo_Intervalo (arrMedidas(ind_tram).Intervalo)

Else: Print #intArchivo_Datos, "- Tramo sin medidas"

Set_Tiempo_Intervalo (0)

End If

Call Establecer_Setpoint(arrMedidas(ind_tram).Nodo3, arrMedidas(ind_tram).Nodo4, arrMedidas(ind_tram).Nodo5)

Else: Call Acabar_Proceso("Completado")

End If

End Sub

Sub Iniciar_Fichero(ByVal Path As String)

intArchivo_Datos = FreeFile

Open Path For Output As intArchivo_Datos

Print #intArchivo_Datos, "Datos medida: " & Estado_act.Medida

Print #intArchivo_Datos, "Tramo 1:"

Print #intArchivo_Datos, " "

End Sub

Sub Tomar_Medidas()

Dim i As Integer

Dim Estado As Integer

Dim Valor_ret As Integer

Dim Ignorar_Avisos As Integer

Dim Valor As Double

Dim can(16) As String

Dim str_Canales As String

For i = 1 To 16

If (cfg.Canal(i)) Then

Page 44: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

44

Estado = AI_VRead(1, i, 1, Valor)

Valor_ret = NIDAQErrorHandler(Estado, "AI_VRead", Ignorar_Avisos)

If (Estado = 0) Then

If (Valor > 0) Then

can(i) = Format(Valor, "0.00")

Else: can(i) = "Err"

End If

Else: can(i) = "Err"

End If

Else: can(i) = "ND"

End If

str_Canales = str_Canales & "[Can " & i & ": " & can(i) & "] "

Next i

Print #intArchivo_Datos, Format(Fecha_ent, "dd/mm/yyyy HH:mm") & " - " & str_Canales

End Sub

Sub Establecer_Setpoint(ByVal Nodo3 As Integer, ByVal Nodo4 As Integer, ByVal Nodo5 As Integer)

Dim txtError As String

Dim ValError As Integer

Dim Estado As Byte

Dim Valor As String

Dim Res As Integer

If (Not cfg.Abierto) Then

MsgBox ("Puerto comunicaciones cerrado")

Else:

'Se establece el valor del nodo 3

Valor = Int(32000 * (Nodo3 / 100))

txtError = modFlowbusAvanzado.WriteParameterDirect(3, 1, 1, "i", 0, 150, Valor, ValError, Estado)

If (Len(txtError) <> 0) Then

Res = MsgBox(txterrorm, , "Error MassFlow 1")

txtError = ""

End If

Page 45: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

45

'Se establece el valor del nodo 4

Valor = Int(32000 * (Nodo4 / 100))

txtError = modFlowbusAvanzado.WriteParameterDirect(4, 1, 1, "i", 0, 150, Valor, ValError, Estado)

If (Len(txtError) <> 0) Then

Res = MsgBox(txterrorm, , "Error MassFlow 2")

txtError = ""

End If

'Se establece el valor del nodo 5

Valor = Int(32000 * (Nodo5 / 100))

txtError = modFlowbusAvanzado.WriteParameterDirect(5, 1, 1, "i", 0, 150, Valor, ValError, Estado)

If (Len(txtError) <> 0) Then

Res = MsgBox(txterrorm, , "Error MassFlow 3")

txtError = ""

End If

End If

End Sub

Sub Obtener_Caudal(ByRef Caudal3 As Integer, ByRef Caudal4 As Integer, ByRef Caudal5 As Integer)

Dim txtError As String

Dim ValError As Integer

Dim txtCaudal As String

Dim Estado As Byte

Dim Res As Integer

If (Not cfg.Abierto) Then

txtError = "Puerto comunicaciones no abierto"

Res = MsgBox(txtError, , "Error MassFlows")

Else

'Obtener Caudal Nodo3

txtError = modFlowbusAvanzado.ReadParameterDirect(3, 1, 0, "i", 0, 150, txtCaudal, ValError, Estado)

Page 46: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

46

If (Len(txtError) <> 0) Then

Res = MsgBox(txtError, , "Error MassFlow 3")

Caudal3 = 0

txtError = ""

Else

Caudal3 = Int(txtCaudal * (100 / 32000))

End If

'Obtener Caudal Nodo4

txtError = modFlowbusAvanzado.ReadParameterDirect(4, 1, 0, "i", 0, 150, txtCaudal, ValError, Estado)

If (Len(txtError) <> 0) Then

Res = MsgBox(txtError, , "Error MassFlow 4")

Caudal4 = 0

txtError = ""

Else

Caudal4 = Int(txtCaudal * (100 / 32000))

End If

'Obtener Caudal Nodo5

txtError = modFlowbusAvanzado.ReadParameterDirect(5, 1, 0, "i", 0, 150, txtCaudal, ValError, Estado)

If (Len(txtError) <> 0) Then

Res = MsgBox(txtError, , "Error MassFlow 5")

Caudal5 = 0

txtError = ""

Else

Caudal5 = Int(txtCaudal * (100 / 32000))

End If

End If

End Sub

Sub Inicializar_cfg()

Dim Archivo As Integer

Dim Nombre_Archivo As String

Archivo = FreeFile

Page 47: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

47

Nombre_Archivo = Direc_def & "Config.ini"

Open Nombre_Archivo For Binary As Archivo

Get Archivo, , cfg

Close Archivo

End Sub

Sub Guardar_cfg()

Dim Archivo As Integer

Dim Nombre_Archivo As String

Call Copias_Seguridad_cfg

cfg.Abierto = False

Archivo = FreeFile

Nombre_Archivo = Direc_def & "Config.ini"

Open Nombre_Archivo For Binary As Archivo

Put Archivo, , cfg

Close Archivo

End Sub

Sub Copias_Seguridad_cfg()

On Error Resume Next

Dim Nombre_Archivo1, Nombre_Archivo2 As String

'Se hacen copias de seguridad de los archivos de configuración existentes

Nombre_Archivo1 = Direc_def & "Config.old"

Nombre_Archivo2 = Direc_def & "Config.tmp"

FileCopy Nombre_Archivo1, Nombre_Archivo2

Kill Nombre_Archivo1

Nombre_Archivo1 = Direc_def & "Config.ini"

Nombre_Archivo2 = Direc_def & "Config.old"

FileCopy Nombre_Archivo1, Nombre_Archivo2

Kill Nombre_Archivo1

Page 48: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

48

End Sub

Function Tiempo_Horas(ByVal Tiempo As Integer) As String

Dim Horas As Integer

Dim minutos As Integer

Horas = Int(Tiempo / 60)

minutos = Tiempo - Horas

Tiempo_Horas = Format(Horas & ":" & minutos & ":00", "HH:mm:ss")

End Function

Sub Obtener_Setpoint(ByRef Nodo3 As Integer, ByRef Nodo4 As Integer, ByRef Nodo5 As Integer)

Dim txtError As String

Dim ValError As Integer

Dim Estado As Byte

Dim Valor As String

Dim Res As Integer

If (Not cfg.Abierto) Then

MsgBox ("Puerto comunicaciones cerrado")

Else

'Se obtiene el valor del nodo 3

txtError = modFlowbusAvanzado.ReadParameterDirect(3, 1, 1, "i", 0, 150, Valor, ValError, Estado)

If (Len(txtError) <> 0) Then

Res = MsgBox(txtError, , "Error MassFlow 3")

txtError = ""

Nodo3 = 0

Else

Nodo3 = Int(Valor * (100 / 32000))

End If

'Se obtiene el valor del nodo 4

txtError = modFlowbusAvanzado.ReadParameterDirect(4, 1, 1, "i", 0, 150, Valor, ValError, Estado)

Page 49: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

49

If (Len(txtError) <> 0) Then

Res = MsgBox(txtError, , "Error MassFlow 4")

txtError = ""

Nodo4 = 0

Else

Nodo4 = Int(Valor * (100 / 32000))

End If

'Se obtiene el valor del nodo 5

txtError = modFlowbusAvanzado.ReadParameterDirect(5, 1, 1, "i", 0, 150, Valor, ValError, Estado)

If (Len(txtError) <> 0) Then

Res = MsgBox(txtError, , "Error MassFlow 5")

txtError = ""

Nodo5 = 0

Else

Nodo5 = Int(Valor * (100 / 32000))

End If

End If

End Sub

Sub Obtener_Gas(ByRef Gas3 As String, ByRef Gas4 As String, ByRef Gas5 As String)

Dim txtError As String

Dim ValError As Integer

Dim Estado As Byte

Dim Valor As String * 10

Dim Res As Integer

If (Not cfg.Abierto) Then

MsgBox ("Puerto comunicaciones cerrado")

Else

'Se obtiene el gas del nodo 3

txtError = modFlowbusAvanzado.ReadParameterDirect(3, 1, 17, "c", 10, 150, Valor, ValError, Estado)

If (Len(txtError) <> 0) Then

Res = MsgBox(txtError, , "Error MassFlow goas 3")

Page 50: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

50

txtError = ""

Gas3 = ""

Else

Gas3 = Valor

End If

'Se obtiene el gas del nodo 4

txtError = modFlowbusAvanzado.ReadParameterDirect(4, 1, 17, "c", 10, 150, Valor, ValError, Estado)

If (Len(txtError) <> 0) Then

Res = MsgBox(txtError, , "Error MassFlow goas 4")

txtError = ""

Gas4 = ""

Else

Gas4 = Valor

End If

'Se obtiene el gas del nodo 5

txtError = modFlowbusAvanzado.ReadParameterDirect(5, 1, 17, "c", 10, 150, Valor, ValError, Estado)

If (Len(txtError) <> 0) Then

Res = MsgBox(txtError, , "Error MassFlow goas 5")

txtError = ""

Gas5 = ""

Else

Gas5 = Valor

End If

End If

End Sub

Sub Obtener_Val_Gas()

Dim txtError As String

Dim ValError As Integer

Dim Estado As Byte

Dim Valor As String

Dim Res As Integer

Page 51: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

51

If (Not cfg.Abierto) Then

MsgBox ("Puerto comunicaciones cerrado")

Else

'Se obtiene el gas del nodo 3

txtError = modFlowbusAvanzado.ReadParameterDirect(3, 1, 16, "c", 0, 150, Valor, ValError, Estado)

If (Len(txtError) <> 0) Then

Res = MsgBox(txtError, , "Error MassFlow gas 3")

txtError = ""

Else

MsgBox (Valor)

End If

'Se obtiene el gas del nodo 4

txtError = modFlowbusAvanzado.ReadParameterDirect(4, 1, 16, "c", 0, 150, Valor, ValError, Estado)

If (Len(txtError) <> 0) Then

Res = MsgBox(txtError, , "Error MassFlow gas 4")

txtError = ""

Else

MsgBox (Valor)

End If

'Se obtiene el gas del nodo 5

txtError = modFlowbusAvanzado.ReadParameterDirect(5, 1, 16, "c", 0, 150, Valor, ValError, Estado)

If (Len(txtError) <> 0) Then

Res = MsgBox(txtError, , "Error MassFlow gas 5")

txtError = ""

Else

MsgBox (Valor)

End If

End If

End Sub

Sub Acabar_Proceso(ByVal Estado As String)

Page 52: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

52

Dim Caudal3 As Integer

Dim Caudal4 As Integer

Dim Caudal5 As Integer

Dim i As Integer

Dim Encontrado As Boolean

Call Obtener_Caudal(Caudal3, Caudal4, Caudal5)

Print #intArchivo_Datos, " "

Print #intArchivo_Datos, "Caudal 3: " & Caudal3 & "% - Caudal 4: " & Caudal4 & "% - Caudal 5: " & Caudal5 & "%"

Print #intArchivo_Datos, " "

Close intArchivo_Datos

Call Establecer_Setpoint(0, 0, 0)

Unload frmProceso

arrPlanif(ind).Estado = Estado

Call Refrescar_Lista_Planificador

Estado_act.Medida = ""

Estado_act.Tramo = 0

Estado_act.Inicio = 0

Estado_act.Fin = 0

Set_Tiempo_Intervalo (0)

Encontrado = False

i = ind + 1

Do While ((i <= Num_plan) And (Not Encontrado))

If (arrPlanif(i).Estado = "Pendiente") Then

ind = i

Encontrado = True

End If

Loop

End Sub

Function Dif_Dias(ByVal Dia_act As Integer, ByVal Mes_act As Integer, ByVal Any_act As Integer, _

ByVal Dia_ant As Integer, ByVal Mes_ant As Integer, ByVal Any_ant As Integer) As Integer

Dim i As Integer

Dim Dias As Integer

Dim Dias_act As Integer

Page 53: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

53

'Función que calcula la diferencia de dias entre dos fechas del mismo año.

'Se considera que si el año es igual a o queremos los dias que llevamos del año.

'Si el año es diferente queremos los dias que faltan para acabar el año.

'Si el año es igual la diferencia entre las dos fechas.

If (Any_ant = 0) Then 'Se quieren los dias que se llevan del año.

For i = 1 To Mes_act - 1

Dias = Dias + (Obtener_Dias_Mes(i, Any_act))

Next i

Dias = Dias + Dia_act

ElseIf (Any_act <> Any_ant) Then 'Se quieren los dias del año que quedan

For i = 1 To Mes_ant - 1

Dias = Dias + (Obtener_Dias_Mes(i, Any_ant))

Next i

Dias = Dias + Dia_ant

If (Es_Bisiesto(Any_ant)) Then

Dias = 366 - Dias

Else: Dias = 665 - Dias

End If

Else 'Se quiere la diferencia de dias entre dos fechas dentro del mismo año

For i = 1 To Mes_act - 1

Dias = Dias + (Obtener_Dias_Mes(i, Any_act))

Next i

Dias = Dias + Dia_act

Dias_act = Dias

Dias = 0

For i = 1 To Mes_ant - 1

Dias = Dias + (Obtener_Dias_Mes(i, Any_ant))

Next i

Dias = Dias + Dia_ant + 1 'se suma 1 porque se quiere a partir de las 00:00:00 del

'dia siguiente.

If (Dias_act >= Dias) Then

Dias = Dias_act - Dias

Else

Dias = 0

Page 54: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

54

MsgBox ("Error dif_dias")

End If

End If

Dif_Dias = Dias

End Function

Function Es_Bisiesto(ByVal Any_act As Integer) As Boolean

Dim Bisiesto As Boolean

If ((Any_act Mod 4 = 0) And ((Any_act Mod 100 <> 0) Or (Any_act Mod 400 = 0))) Then

Bisiesto = True

Else: Bisiesto = False

End If

Es_Bisiesto = Bisiesto

End Function

Function Obtener_Dias_Mes(ByVal Mes_act As Integer, Any_act As Integer) As Integer

Dim Dias As Integer

Select Case (Mes_act)

Case 2

If (Es_Bisiesto(Any_act)) Then

Dias = 29

Else: Dias = 28

End If

Case 4, 6, 9, 11

Dias = 30

Case 1, 3, 5, 7, 8, 10, 12

Dias = 31

Case Else

Dias = 0

End Select

Obtener_Dias_Mes = Dias

Page 55: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

55

End Function

3.2.2. API Comunicación Mass Flow (modFlowbusAPI.bas)

Option Explicit

'-----------------------USER DEFINED TYPES----------------------------------------------

'Type which contains information about available communication ports and cards

'prefix: udt_PortInfo_

Public Type PortInfoType

bInUse As Boolean 'Tells wheter or not the port / card is currently in use

sPortName As String * 25 'Name of the port / card, maximum of 25 characters

End Type

'-----------------------END OF USER DEFINED TYPES----------------------------------------

' FLOWB32.DLL function description for use in Microsoft Visual Basic

' NOTE: This functions can also be called from other environments, such as C or Pascal.

' In that case only the calling syntax will be different, not the functionality

' of these routines.

' For calling syntax in BorlandC, see file FLOWBUS.H

' Following functions can be called by WINDOWS application programs

' The FLOWB32.DLL provides a mechanism to transport parameter values to a specific

' module connected to the Bronkhorst High-Tech FLOW-BUS.

' Each module has its specific list with parameters

' Each parameter is of type integer/float/long/char/string and mostly has min and max values

' Some parameters are read-only or write-only

' On FLOW-BUS modules a parameter is located on a 'process'

' Each FLOW-BUS module has its own 'node-address' in the system (systems can have up

' to 120 nodes (addresses)

' So, when locating a parameter for changing/reading its value you need to know:

' node - process - parameter number

Page 56: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

56

' For more convenience in addressing parameters there are virtual channel numbers linked

' to node-processes.

' This means that you can work with parameters on a certain channel.

' When communication is openened, the actual FLOW-BUS system configuration is read and

' stored in a large structure in memory.

' You can determine the amount of nodes, amount of channels and the link of a channel

' to a certain node-process with help of following functions

' Bronkhorst High-Tech also offers a WINDOWS DDE-server which makes use of all functions

' below and actually behaves as a software layer between your application and FLOW-BUS.

' For communication, just select an interface in the DDE-server and start-up.

' When the program is running you can read/write parameters on a DDE-channel

' Advantage: much easier for the user, Disadvantage: slower than communication directly

' through C or Pascal

' Globals

'--------------ERROR LIST SECTION------------------------------------------------------------------

'FBE_NO_ERROR 0 No error

'FBE_PROCESS_CLAIM 1 This process cannot be operated by this module

'FBE_COMMAND 2 No such command possible for this module

'FBE_PROCESS 3 No such process at this module

'FBE_PARM_NUMBER 4 No such parameter at this process

'FBE_PARM_TYPE 5 Type of parameter sent differs from type on module

'FBE_PARM_VALUE 6 Wrong value for this parameter or not accepted

'FBE_NETWORK_NOT_ACTIVE 7 No communication activity on FLOW-BUS detected

'FBE_TIME_OUT_START_CHAR 8 Start character serial communication failed

'FBE_TIME_OUT_SERIAL_LINE 9 Serial communication failed

'FBE_MODULE_HARDWARE_MEM 10 Memory on FLOW-BUS module failed

'FBE_NODE_ADDRESS 11 Wrong node number

Page 57: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

57

'FBE_COMMUNICATION 12 General communication error

'FBE_READ_ONLY_PARM 13 This parameter value can only be read

'FBE_PC_COMMUNICATION 14 There is no communication between PC and FLOW -BUS

'FBE_RS232_CONNECTION 15 HOST_ERROR, no/bad connection between PC and a RS232-module

'FBE_PC_MEMORY 16 DLL ERROR, not enough memory in your PC for communication structure

'FBE_WRITE_ONLY_PARM 17 this parameter value can only be send

'FBE_SYS_CONFIG_UNKNOWN 18 FLOW-BUS system configuration is unknown

'FBE_NO_FREE_NODE_ADDR 19 FLOW-BUS system reached maximum size (32 nodes)

'FBE_WRONG_INTERFACE_TYPE 20 need other type of interface for this option

'FBE_BUILD_DCB 21 DLL_ERROR, error building device control block serial port

'FBE_OPEN_COMM 22 DLL ERROR, open communication went wrong

'FBE_COMM_STATE 23 DLL ERROR, communication status error

'FBE_INTERFACE_BUSMASTER 24 interface tries to start communication (alone in system)

'FBE_TIMEOUT_ON_RX_ANSWER 25 time out on rx answer

'FBE_NO_START_CHAR 26 HOST ERROR, no ':' on start of message

'FBE_FIRST_DIGIT 27 HOST ERROR, error in first digit

'FBE_HOST_OVERFLOW 28 HOST ERROR, buffer overflow in host

'FBE_BUFFER_OVERFLOW 29 DLL ERROR, buffer overflow in DLL

'FBE_NO_ANSWER_FOUND 30 DLL ERROR, requested answer not found

'FBE_CLOSE_COMM 31 DLL ERROR, closing communication error

'FBE_SYNCHRON_ERROR 32 DLL ERROR, other application performs action

'FBE_SEND_ERROR 33 DLL ERROR, requested msg. not send

'FBE_PROTOCOL_ERROR 34 DLL ERROR, error in received data

'FBE_NO_EVENT 35 DLL ERROR, no event present on realtimechannel

'--------------END OF ERROR LIST SECTION-----------------------------------------------------------

'--------------FUNCTIONS TO OPEN / CLOSE THE DLL---------------------------------------------------

'****************************************************************************

'

' OpenDLL

'

' Author : Bronkhorst High-Tech B.V.

Page 58: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

58

' Date : 16-Dec-2003

'

' Function : Function which opens the DLL for a certain application.

' In theory it should be possible to attach different applications to the same DLL.

' In practice, however it will not work. Therefore you should call this function

' ONLY ONCE in your code (at initialization), to avoid problems.

' Parameters:

' (In) lHwnd: Always supply value 0 for this parameter

' (Out)

' Returned : 0, if the function failed, otherwise an ApplicationId. Don't throw this

' ApplicationId away, because you must use it in almost every other DLL-function..

' Remarks :

'

Public Declare Function OpenDLL Lib "Flowb32.dll" (ByVal lHwnd As Long) As Integer

'****************************************************************************

'

' CloseDLL

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which closes the DLL for a certain application.

' In theory it should be possible to attach different applications to the same DLL.

' In practice, however it will not work. Therefore you should call this function

' ONLY ONCE in your code (when closing the application), to avoid problems.

' Parameters:

' (In) iAppId: The ApplicationId of your application (retrieved from function OpenDLL())

' (Out)

' Returned :

' Remarks :

'

Public Declare Sub CloseDLL Lib "Flowb32.dll" (ByVal iAppId As Integer)

Page 59: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

59

'--------------END OF FUNCTIONS TO OPEN / CLOSE THE DLL--------------------------------------------

'--------------FUNCTIONS TO OPEN / CLOSE THE COMMUNICATION WITH THE FLOWBUS------------------------

'****************************************************************************

'

' OpenCommunication

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which opens the communication with the flowbus on a specified COM-port.

' Parameters:

' (In) sPortName: Name of the port to open ("COM1" or "COM2" for example)

' (Out)

' Returned : 0 on succes, an error from the "ERROR LIST SECTION" (see beginning of this module)

' on failure

' Remarks :

'

Public Declare Function OpenCommunication Lib "Flowb32.dll" (ByVal sPortName As String) As Integer

'****************************************************************************

'

' CloseCommunication

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which closes the communication with the flowbus on a specified port.

' Parameters:

' (In) sPortName: Name of the port to close ("COM1" or "COM2" for example)

' (Out)

' Returned : 0 on succes, an error from the "ERROR LIST SECTION" (see beginning of this module)

' on failure

Page 60: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

60

' Remarks :

'

Public Declare Function CloseCommunication Lib "Flowb32.dll" () As Integer

'--------------END OF FUNCTIONS TO OPEN / CLOSE THE COMMUNICATION WITH THE FLOWBUS-----------------

'--------------FUNCTIONS TO GET / SET THE BAUDRATE OF YOUR COM-PORT--------------------------------

'Baudrates are always positive values in the range 0 - 65535 (65535 included)

'However because of the datatypes Visual Basic supplies the baudrate has to be recalculated.

'

'In the "Remarks"-section of the following function, I assume you have a baudrate of type

'Long (lBaudRate). The "Remarks"-section contains the code to convert the baudrate (lBaudRate).

'****************************************************************************

'

' ConfigureRS232

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function to configure the baudrate of a certain COM-port.

' This function should be called before calling OpenCommunication().

' The baudrate of your pc's COM-port (the one you use to communicate with

' flowbus), must of course be the same as the baudrate of your

' "RS232/Flowbus interface"-box

' Parameters:

' (In) sPortName: Name of the port to configure ("COM1" or "COM2" for example)

' iBaudRate: New baudrate for the port

' (calculated from the formula in the "Remarks" section, see below)

' (Out)

' Returned : 0 on succes, non-zero on failure

' Remarks : Converting the baudrate (lBaudRate) to iBaudrate

Page 61: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

61

' If lBaudRate <= 32767 Then

' iBaudRate = lBaudRate

' Else

' iBaudRate = lBaudRate - 65536

' End If

Public Declare Function ConfigureRS232 Lib "Flowb32.dll" (ByVal sPortName As String, _

ByVal iBaudRate As Integer) As Integer

'****************************************************************************

'

' GetRS232Config

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function to read / get the baudrate of a certain COM-port.

' Parameters:

' (In)

' (Out) sPortName: Name of the current communication port ("COM1" or "COM2" for example)

' iBaudRate: Baudrate of the port (needs to be converted to a long, lBaudRate)

' (See "Remarks"-section below)

' Returned : 0 on succes, non-zero on failure

' Remarks : Extracting the baudrate(lBaudRate) from iBaudRate

' Dim lBaudrate As Long

' If iBaudRate >= 0 Then

' lBaudrate = iBaudRate

' Else

' lBaudrate = iBaudRate + 65536

' End If

Public Declare Sub GetRS232Config Lib "Flowb32.dll" (ByVal sPortName As String, _

ByRef iBaudRate As Integer)

'--------------END OF FUNCTIONS TO GET / SET THE BAUDRATE OF YOUR COM-PORT-------------------------

'--------------FUNCTIONS TO GET / SET PC(ISA)-CARD CONFIGURATION AND NETWORK SETTINGS--------------

Page 62: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

62

'****************************************************************************

'

' ConfigureTNet

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which configures the PC(ISA)/FLOW-BUS interface card or

' the FLOW-BUS network settings of your "RS232/flowbus interface"-box which is

' directly connected to your pc..

' In case the application wants to use an ISA card it configures the specified card

' with: device name, node number, secondary node, next node and arbitration mode.

' Only device name and arbitrage are used internally.

' Parameters:

' (In) bytNode: Primary node adress of the "RS232/flowbus interface"-box.

' bytSecNode: Second node adress of the "RS232/flowbus interface"-box.

' bytNextNode: Next node adress of the "RS232/flowbus interface"-box.

' bytLastNode: Last node adress of the "RS232/flowbus interface"-box.

' bytArbiterMode: Arbiter mode of the "RS232/flowbus interface"-box.

' bytTxRetries: Number of attempts to write a parameter, before an error occurs

' bytRxRetries: Number of attempts to read a parameter, before an error occurs

' sPort: COM-port on which to start communication with flowbus

' (Out)

' Returned : 0 on succes, non-zero on failure

' Remarks :

'

Public Declare Function ConfigureTNet Lib "Flowb32.dll" (ByVal bytNode As Byte, _

ByVal bytSecNode As Byte, ByVal bytNextNode As Byte, ByVal bytLastNode As Byte, _

ByVal bytArbiterMode As Byte, ByVal bytTxRetries As Byte, ByVal bytRxRetries As Byte, _

Page 63: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

63

ByVal sPort As String) As Integer

'****************************************************************************

'

' GetTNetConfig

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function to get the current configuration of the PC(ISA)/FLOW-BUS interface card or

' the FLOW-BUS network settings of your "RS232/flowbus interface"-box which is

' directly connected to your pc..

' Parameters:

' (In)

' (Out) bytNode: Primary node adress of the "RS232/flowbus interface"-box.

' bytSecNode: Second node adress of the "RS232/flowbus interface"-box.

' bytNextNode: Next node adress of the "RS232/flowbus interface"-box.

' bytLastNode: Last node adress of the "RS232/flowbus interface"-box.

' bytArbiterMode: Arbiter mode of the "RS232/flowbus interface"-box.

' bytTxRetries: Number of attempts to write a parameter, before an error occurs

' bytRxRetries: Number of attempts to read a parameter, before an error occurs

' sPort: COM-port on which the communication with flowbus is currenly

' handled.

' Returned :

' Remarks :

'

Public Declare Sub GetTNetConfig Lib "Flowb32.dll" (ByRef bytNode As Byte, _

ByRef bytSecNode As Byte, ByRef bytNextNode As Byte, ByRef bytLastNode As Byte, _

ByRef bytArbiterMode As Byte, ByRef bytTxRetries As Byte, ByRef bytRxRetries As Byte, _

ByVal sPort As String)

Page 64: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

64

'--------------END OF FUNCTIONS TO GET / SET PC(ISA)-CARD CONFIGURATION AND NETWORK SETTINGS-------

'--------------FUNCTIONS TO CONFIGURE CHAINING-----------------------------------------------------

'****************************************************************************

'

' ConfigureChaining

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function with which you can configure the settings for process and parameter

' chaining. Process chaining is not supported on older FlowBus modules.

' Therefore the advise is to disable process-chaining, unless you know

' that all flowbus modules in the network support process chaining (in which case

' enabling process chaining is better).

' Parameter chaining should be enabled to decrease the number of messages send over

' the network (decrease network traffic)

' Parameters:

' (In) bProcChain: Boolean which indicates if process chaining should be enabled

' bParChain: Boolean which indicates if parameter chaining should be enabled

' (Out)

' Returned :

' Remarks :

'

Public Declare Sub ConfigureChaining Lib "Flowb32.dll" (ByVal bProcChain As Boolean, _

ByVal bParChain As Boolean)

'--------------END FUNCTIONS TO CONFIGURE CHAINING-------------------------------------------------

'--------------FUNCTIONS TO CHECK THE NETWORK FOR ERRORS-------------------------------------------

'****************************************************************************

'

Page 65: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

65

' GetError

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which checks if a network error occurred and clears the possible error.

' This function can be called any time. Especially when a function returns no error,

' you can call this method after executing the function.

' Parameters:

' (In)

' (Out)

' Returned : 0 No error occured

' -1 Device identifier invalid, unsupported or lack of memory

' -2 Device is already open.

' -3 Device is NOT open.

' -4 The function cannot allocate enough memory for the queues.

' -5 Default parameters are in error.

' -10 The hardware is not available (locked by another device).

' -11 Specified byte size is invalid.

' -12 Baudrate of the device is unsupported.

' 22 Com port not opened (for PC-ISA card)

' 28 Too many messages sent to host (for PC-ISA card)

' 31 Network not opened (for PC-ISA card)

' 33 Error sending data

' 34 Error in received data

' Remarks :

'

Public Declare Function GetError Lib "Flowb32.dll" () As Integer

'--------------END OF FUNCTIONS TO CHECK THE NETWORK FOR ERRORS------------------------------------

'--------------FUNCTIONS TO SEND A READ-REQUEST FOR A CERTAIN PARAMETER----------------------------

'****************************************************************************

'

' ReadChar

'

Page 66: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

66

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function sends a request / message to a certain node, that it wants to know the

' value of a certain parameter. The parameter type is Byte (1 character).

' The value of the parameter is send by the node in another messsage.

' You have to call CheckReceivedMsg() to check if you have received an answer on

' your request-message. If so, you can call GetChar() to get the value of the

' parameter.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' lHwnd: Supply always 0 for this parameter

' bytNode: Node

' bytProc: Process

' bytParm: Parameter

' iMsgId: MessageId of the message.

' You may choose any value for it with restriction to the following:

' - No 2 messages can have the same MessageId. Only if a message is removed

' the MessageId can be used again.

' Keep the MessageId, you will need it later to check if you received

' an answer-message on your request

' (Out)

' Returned : 0 on succes, non-zero on failure

' Remarks : There can be no 2 messages at the same time with the same (Node, Proces, Parameter)

' combination. Only if the message has been removed, another message can be send to

' this (Node, Process, Parameter) combination

'

Public Declare Function ReadChar Lib "Flowb32.dll" (ByVal iAppId As Integer, ByVal lHwnd As Long, _

ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, ByVal iMsgId As Integer) _

As Integer

Page 67: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

67

'****************************************************************************

'

' ReadInt

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function sends a request / message to a certain node, that it wants to know the

' value of a certain parameter. The parameter type is Integer.

' The value of the parameter is send by the node in another messsage.

' You have to call CheckReceivedMsg() to check if you have received an answer on

' your request-message. If so, you can call GetInt() to get the value of the

' parameter.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' lHwnd: Supply always 0 for this parameter

' bytNode: Node

' bytProc: Process

' bytParm: Parameter

' iMsgId: MessageId of the message.

' You may choose any value for it with restriction to the following:

' - No 2 messages can have the same MessageId. Only if a message is removed

' the MessageId can be used again.

' Keep the MessageId, you will need it later to check if you received

' an answer-message on your request

' (Out)

' Returned : 0 on succes, non-zero on failure

' Remarks : There can be no 2 messages at the same time with the same (Node, Proces, Parameter)

' combination. Only if the message has been removed, another message can be send to

' this (Node, Process, Parameter) combination

'

Public Declare Function ReadInt Lib "Flowb32.dll" (ByVal iAppId As Integer, ByVal lHwnd As Long, _

Page 68: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

68

ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, ByVal iMsgId As Integer) _

As Integer

'****************************************************************************

'

' ReadFloat

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function sends a request / message to a certain node, that it wants to know the

' value of a certain parameter. The parameter type is Float.

' The value of the parameter is send by the node in another messsage.

' You have to call CheckReceivedMsg() to check if you have received an answer on

' your request-message. If so, you can call GetFloat() to get the value of the

' parameter.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' lHwnd: Supply always 0 for this parameter

' bytNode: Node

' bytProc: Process

' bytParm: Parameter

' iMsgId: MessageId of the message.

' You may choose any value for it with restriction to the following:

' - No 2 messages can have the same MessageId. Only if a message is removed

' the MessageId can be used again.

' Keep the MessageId, you will need it later to check if you received

' an answer-message on your request

' (Out)

' Returned : 0 on succes, non-zero on failure

' Remarks : There can be no 2 messages at the same time with the same (Node, Proces, Parameter)

' combination. Only if the message has been removed, another message can be send to

Page 69: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

69

' this (Node, Process, Parameter) combination

'

Public Declare Function ReadFloat Lib "Flowb32.dll" (ByVal iAppId As Integer, ByVal lHwnd As Long, _

ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, ByVal iMsgId As Integer) _

As Integer

'****************************************************************************

'

' ReadLong

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function sends a request / message to a certain node, that it wants to know the

' value of a certain parameter. The parameter type is Long.

' The value of the parameter is send by the node in another messsage.

' You have to call CheckReceivedMsg() to check if you have received an answer on

' your request-message. If so, you can call GetLong() to get the value of the

' parameter.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' lHwnd: Supply always 0 for this parameter

' bytNode: Node

' bytProc: Process

' bytParm: Parameter

' iMsgId: MessageId of the message.

' You may choose any value for it with restriction to the following:

' - No 2 messages can have the same MessageId. Only if a message is removed

' the MessageId can be used again.

' Keep the MessageId, you will need it later to check if you received

' an answer-message on your request

' (Out)

' Returned : 0 on succes, non-zero on failure

Page 70: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

70

' Remarks : There can be no 2 messages at the same time with the same (Node, Proces, Parameter)

' combination. Only if the message has been removed, another message can be send to

' this (Node, Process, Parameter) combination

'

Public Declare Function ReadLong Lib "Flowb32.dll" (ByVal iAppId As Integer, ByVal lHwnd As Long, _

ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, ByVal iMsgId As Integer) _

As Integer

'****************************************************************************

'

' ReadString

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function sends a request / message to a certain node, that it wants to know the

' value of a certain parameter. The parameter type is String (1 or more characters).

' The value of the parameter is send by the node in another messsage.

' You have to call CheckReceivedMsg() to check if you have received an answer on

' your request-message. If so, you can call GetString() to get the value of the

' parameter.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' lHwnd: Supply always 0 for this parameter

' bytNode: Node

' bytProc: Process

' bytParm: Parameter

' bytExpLen: Expected length of the string.

' If you supply 0, a zero-terminated string is expected.

' iMsgId: MessageId of the message.

' You may choose any value for it with restriction to the following:

Page 71: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

71

' - No 2 messages can have the same MessageId. Only if a message is removed

' the MessageId can be used again.

' Keep the MessageId, you will need it later to check if you received

' an answer-message on your request

' (Out)

' Returned : 0 on succes, non-zero on failure

' Remarks : There can be no 2 messages at the same time with the same (Node, Proces, Parameter)

' combination. Only if the message has been removed, another message can be send to

' this (Node, Process, Parameter) combination

'

Public Declare Function ReadString Lib "Flowb32.dll" (ByVal iAppId As Integer, _

ByVal lHwnd As Long, ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, _

ByVal bytExpLen As Byte, ByVal iMsgId As Integer) As Integer

'--------------END OF FUNCTIONS TO SEND A READ-REQUEST FOR A CERTAIN PARAMETER---------------------

'--------------FUNCTIONS TO WRITE A PARAMETER------------------------------------------------------

'****************************************************************************

'

' WriteChar

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which gives a certain parameter a new value (writes a parameter value).

' The parameter type is Byte (1 character).

' You have to call CheckReceivedMsg() to check if you have received an answer on

' your message. The answer-message contains a statuscode which indicates if the

' value was succesfully written, or an error occured. Call GetStatus() to,

' determine if the parameter was succesfully written.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

Page 72: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

72

' lHwnd: Supply always 0 for this parameter

' bytNode: Node

' bytProc: Process

' bytParm: Parameter

' bytNewValue: New value for the parameter

' iMsgId: MessageId of the message.

' You may choose any value for it with restriction to the following:

' - No 2 messages can have the same MessageId. Only if a message is

' removed the MessageId can be used again.

' Keep the MessageId, you will need it later to check if you received

' an answer-message on your request

' (Out)

' Returned : 0 on succes, non-zero on failure

' Remarks : There can be no 2 messages at the same time with the same (Node, Proces, Parameter)

' combination. Only if the message has been removed, another message can be send to

' this (Node, Process, Parameter) combination

'

Public Declare Function WriteChar Lib "Flowb32.dll" (ByVal iAppId As Integer, _

ByVal lHwnd As Long, ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, _

ByVal bytNewValue As Byte, ByVal iMsgId As Integer) As Integer

'****************************************************************************

'

' WriteInt

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which gives a certain parameter a new value (writes a parameter value).

' The parameter type is Integer.

' You have to call CheckReceivedMsg() to check if you have received an answer on

' your message. The answer-message contains a statuscode which indicates if the

Page 73: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

73

' value was succesfully written, or an error occured. Call GetStatus() to,

' determine if the parameter was succesfully written.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' lHwnd: Supply always 0 for this parameter

' bytNode: Node

' bytProc: Process

' bytParm: Parameter

' iNewValue: New value for the parameter

' iMsgId: MessageId of the message.

' You may choose any value for it with restriction to the following:

' - No 2 messages can have the same MessageId. Only if a message is

' removed the MessageId can be used again.

' Keep the MessageId, you will need it later to check if you received

' an answer-message on your request

' (Out)

' Returned : 0 on succes, non-zero on failure

' Remarks : There can be no 2 messages at the same time with the same (Node, Proces, Parameter)

' combination. Only if the message has been removed, another message can be send to

' this (Node, Process, Parameter) combination

'

Public Declare Function WriteInt Lib "Flowb32.dll" (ByVal iAppId As Integer, _

ByVal lHwnd As Long, ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, _

ByVal iNewValue As Integer, ByVal iMsgId As Integer) As Integer

'****************************************************************************

'

' WriteFloat

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which gives a certain parameter a new value (writes a parameter value).

Page 74: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

74

' The parameter type is Float.

' You have to call CheckReceivedMsg() to check if you have received an answer on

' your message. The answer-message contains a statuscode which indicates if the

' value was succesfully written, or an error occured. Call GetStatus() to,

' determine if the parameter was succesfully written.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' lHwnd: Supply always 0 for this parameter

' bytNode: Node

' bytProc: Process

' bytParm: Parameter

' fNewValue: New value for the parameter

' iMsgId: MessageId of the message.

' You may choose any value for it with restriction to the following:

' - No 2 messages can have the same MessageId. Only if a message is

' removed the MessageId can be used again.

' Keep the MessageId, you will need it later to check if you received

' an answer-message on your request

' (Out)

' Returned : 0 on succes, non-zero on failure

' Remarks : There can be no 2 messages at the same time with the same (Node, Proces, Parameter)

' combination. Only if the message has been removed, another message can be send to

' this (Node, Process, Parameter) combination

'

Public Declare Function WriteFloat Lib "Flowb32.dll" (ByVal iAppId As Integer, _

ByVal lHwnd As Long, ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, _

ByVal fNewValue As Single, ByVal iMsgId As Integer) As Integer

'****************************************************************************

'

' WriteLong

'

Page 75: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

75

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which gives a certain parameter a new value (writes a parameter value).

' The parameter type is Long.

' You have to call CheckReceivedMsg() to check if you have received an answer on

' your message. The answer-message contains a statuscode which indicates if the

' value was succesfully written, or an error occured. Call GetStatus() to,

' determine if the parameter was succesfully written.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' lHwnd: Supply always 0 for this parameter

' bytNode: Node

' bytProc: Process

' bytParm: Parameter

' lNewValue: New value for the parameter

' iMsgId: MessageId of the message.

' You may choose any value for it with restriction to the following:

' - No 2 messages can have the same MessageId. Only if a message is

' removed the MessageId can be used again.

' Keep the MessageId, you will need it later to check if you received

' an answer-message on your request

' (Out)

' Returned : 0 on succes, non-zero on failure

' Remarks : There can be no 2 messages at the same time with the same (Node, Proces, Parameter)

' combination. Only if the message has been removed, another message can be send to

' this (Node, Process, Parameter) combination

'

Public Declare Function WriteLong Lib "Flowb32.dll" (ByVal iAppId As Integer, _

ByVal lHwnd As Long, ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, _

ByVal lNewValue As Long, ByVal iMsgId As Integer) As Integer

Page 76: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

76

'****************************************************************************

'

' WriteString

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which gives a certain parameter a new value (writes a parameter value).

' The parameter type is String.

' You have to call CheckReceivedMsg() to check if you have received an answer on

' your message. The answer-message contains a statuscode which indicates if the

' value was succesfully written, or an error occured. Call GetStatus() to,

' determine if the parameter was succesfully written.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' lHwnd: Supply always 0 for this parameter

' bytNode: Node

' bytProc: Process

' bytParm: Parameter

' bytExpLen: Expected length of the string.

' If you supply 0, a zero-terminated string is expected.

' sNewValue: New value for the parameter

' iMsgId: MessageId of the message.

' You may choose any value for it with restriction to the following:

' - No 2 messages can have the same MessageId. Only if a message is

' removed the MessageId can be used again.

' Keep the MessageId, you will need it later to check if you received

' an answer-message on your request

' (Out)

' Returned : 0 on succes, non-zero on failure

' Remarks : There can be no 2 messages at the same time with the same (Node, Proces, Parameter)

' combination. Only if the message has been removed, another message can be send to

Page 77: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

77

' this (Node, Process, Parameter) combination

'

Public Declare Function WriteString Lib "Flowb32.dll" (ByVal iAppId As Integer, _

ByVal lHwnd As Long, ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, _

ByVal bytExpLen As Byte, ByVal sNewValue As String, ByVal iMsgId As Integer) As Integer

'--------------END OF FUNCTIONS TO WRITE A PARAMETER-----------------------------------------------

'--------------FUNCTIONS TO READ A PARAMETER VALUE--------------------------------------------------

'****************************************************************************

'

' GetChar

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which reads the value of a certain parameter.

' The parameter type is Byte (1 character).

' Before you can read a parameter value you have to:

' - Call ReadChar() to send a read-request.

' - Call CheckReceivedMsg() to check if you have received an answer on

' your read-request message.

' - Call GetError() to check if no errors occured

' - Check the status of the received message by calling GetStatus()

' After you have done all this and everything was OK, you can read the value

' of the parameter.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' bytNode: Node

' bytProc: Process

' bytParm: Parameter

' (Out) bytValue: Value of the parameter

' iMsgId: MessageId of the message.

' Returned : 0 on succes, non-zero on failure

' Remarks :

Page 78: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

78

'

Public Declare Function GetChar Lib "Flowb32.dll" (ByVal iAppId As Integer, ByVal bytNode As Byte, _

ByVal bytProc As Byte, ByVal bytParm As Byte, ByRef bytValue As Byte, _

ByRef iMsgId As Integer) As Integer

'****************************************************************************

'

' GetInt

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which reads the value of a certain parameter.

' The parameter type is Integer.

' Before you can read a parameter value you have to:

' - Call ReadInt() to send a read-request.

' - Call CheckReceivedMsg() to check if you have received an answer on

' your read-request message.

' - Call GetError() to check if no errors occured

' - Check the status of the received message by calling GetStatus()

' After you have done all this and everything was OK, you can read the value

' of the parameter.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' bytNode: Node

' bytProc: Process

' bytParm: Parameter

' (Out) iValue: Value of the parameter

' iMsgId: MessageId of the message.

' Returned : 0 on succes, non-zero on failure

' Remarks :

'

Public Declare Function GetInt Lib "Flowb32.dll" (ByVal iAppId As Integer, ByVal bytNode As Byte, _

ByVal bytProc As Byte, ByVal bytParm As Byte, ByRef iValue As Integer, _

ByRef iMsgId As Integer) As Integer

Page 79: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

79

'****************************************************************************

'

' GetFloat

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which reads the value of a certain parameter.

' The parameter type is Float.

' Before you can read a parameter value you have to:

' - Call ReadFloat() to send a read-request.

' - Call CheckReceivedMsg() to check if you have received an answer on

' your read-request message.

' - Call GetError() to check if no errors occured

' - Check the status of the received message by calling GetStatus()

' After you have done all this and everything was OK, you can read the value

' of the parameter.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' bytNode: Node

' bytProc: Process

' bytParm: Parameter

' (Out) fValue: Value of the parameter

' iMsgId: MessageId of the message.

' Returned : 0 on succes, non-zero on failure

' Remarks :

'

Public Declare Function GetFloat Lib "Flowb32.dll" (ByVal iAppId As Integer, ByVal bytNode As Byte, _

ByVal bytProc As Byte, ByVal bytParm As Byte, ByRef fValue As Single, _

ByRef iMsgId As Integer) As Integer

'****************************************************************************

'

' GetLong

'

' Author : Bronkhorst High-Tech B.V.

Page 80: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

80

' Date : 16-Dec-2003

'

' Function : Function which reads the value of a certain parameter.

' The parameter type is Long.

' Before you can read a parameter value you have to:

' - Call ReadLong() to send a read-request.

' - Call CheckReceivedMsg() to check if you have received an answer on

' your read-request message.

' - Call GetError() to check if no errors occured

' - Check the status of the received message by calling GetStatus()

' After you have done all this and everything was OK, you can read the value

' of the parameter.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' bytNode: Node

' bytProc: Process

' bytParm: Parameter

' (Out) lValue: Value of the parameter

' iMsgId: MessageId of the message.

' Returned : 0 on succes, non-zero on failure

' Remarks :

'

Public Declare Function GetLong Lib "Flowb32.dll" (ByVal iAppId As Integer, ByVal bytNode As Byte, _

ByVal bytProc As Byte, ByVal bytParm As Byte, ByRef lValue As Long, _

ByRef iMsgId As Integer) As Integer

'****************************************************************************

'

' GetString

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which reads the value of a certain parameter.

' The parameter type is String (1 or more characters).

' Before you can read a parameter value you have to:

Page 81: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

81

' - Call ReadString() to send a read-request.

' - Call CheckReceivedMsg() to check if you have received an answer on

' your read-request message.

' - Call GetError() to check if no errors occured

' - Check the status of the received message by calling GetStatus()

' After you have done all this and everything was OK, you can read the value

' of the parameter.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' bytNode: Node

' bytProc: Process

' bytParm: Parameter

' (Out) iMsgId: MessageId of the message.

' sValue: Value of the parameter

' bytActLen: Actual length of the value

' Returned : 0 on succes, non-zero on failure

' Remarks :

'

Public Declare Function GetString Lib "Flowb32.dll" (ByVal iAppId As Integer, ByVal bytNode As Byte, _

ByVal bytProc As Byte, ByVal bytParm As Byte, ByRef iMsgId As Integer, _

ByVal sValue As String, ByRef bytActLen As Byte) As Integer

'--------------END OF FUNCTIONS TO READ A PARAMETER VALUE-------------------------------------------

'--------------FUNCTIONS TO READ A PARAMETER VALUE (REALTIME)---------------------------------------

'****************************************************************************

'

' GetRealTimeChar

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which reads the value of a certain parameter.

' The parameter type is Byte (1 character).

' Before you can read a parameter value you have to:

' - Call ReadChar() to send a read-request.

Page 82: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

82

' - Call CheckReceivedMsg() to check if you have received an answer on

' your read-request message.

' - Call GetError() to check if no errors occured

' - Check the status of the received message by calling GetStatus()

' After you have done all this and everything was OK, you can read the value

' of the parameter.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' bytNode: Node

' bytProc: Process

' bytParm: Parameter

' (Out) bytValue: Value of the parameter

' lRealTime: Timestamp which indicates at which moment the value was read

' in the instrument. Time is in milliseconds..

' iMsgId: MessageId of the message.

' Returned : 0 on succes, non-zero on failure

' Remarks :

'

Public Declare Function GetRealTimeChar Lib "Flowb32.dll" (ByVal iAppId As Integer, _

ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, ByRef bytValue As Byte, _

ByRef lRealTime As Long, ByRef iMsgId As Integer) As Integer

'****************************************************************************

'

' GetRealTimeInt

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which reads the value of a certain parameter.

' The parameter type is Integer.

' Before you can read a parameter value you have to:

' - Call ReadInt() to send a read-request.

' - Call CheckReceivedMsg() to check if you have received an answer on

Page 83: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

83

' your read-request message.

' - Call GetError() to check if no errors occured

' - Check the status of the received message by calling GetStatus()

' After you have done all this and everything was OK, you can read the value

' of the parameter.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' bytNode: Node

' bytProc: Process

' bytParm: Parameter

' (Out) iValue: Value of the parameter

' lRealTime: Timestamp which indicates at which moment the value was read

' in the instrument. Time is in milliseconds..

' iMsgId: MessageId of the message.

' Returned : 0 on succes, non-zero on failure

' Remarks :

'

Public Declare Function GetRealTimeInt Lib "Flowb32.dll" (ByVal iAppId As Integer, _

ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, ByRef iValue As Integer, _

ByRef lRealTime As Long, ByRef iMsgId As Integer) As Integer

'****************************************************************************

'

' GetRealTimeFloat

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which reads the value of a certain parameter.

' The parameter type is Float.

' Before you can read a parameter value you have to:

' - Call ReadFloat() to send a read-request.

' - Call CheckReceivedMsg() to check if you have received an answer on

' your read-request message.

' - Call GetError() to check if no errors occured

Page 84: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

84

' - Check the status of the received message by calling GetStatus()

' After you have done all this and everything was OK, you can read the value

' of the parameter.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' bytNode: Node

' bytProc: Process

' bytParm: Parameter

' (Out) fValue: Value of the parameter

' lRealTime: Timestamp which indicates at which moment the value was read

' in the instrument. Time is in milliseconds..

' iMsgId: MessageId of the message.

' Returned : 0 on succes, non-zero on failure

' Remarks :

'

Public Declare Function GetRealTimeFloat Lib "Flowb32.dll" (ByVal iAppId As Integer, _

ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, ByRef fValue As Single, _

ByRef lRealTime As Long, ByRef iMsgId As Integer) As Integer

'****************************************************************************

'

' GetRealTimeLong

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which reads the value of a certain parameter.

' The parameter type is Long.

' Before you can read a parameter value you have to:

' - Call ReadLong() to send a read-request.

' - Call CheckReceivedMsg() to check if you have received an answer on

' your read-request message.

' - Call GetError() to check if no errors occured

' - Check the status of the received message by calling GetStatus()

Page 85: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

85

' After you have done all this and everything was OK, you can read the value

' of the parameter.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' bytNode: Node

' bytProc: Process

' bytParm: Parameter

' (Out) lValue: Value of the parameter

' lRealTime: Timestamp which indicates at which moment the value was read

' in the instrument. Time is in milliseconds..

' iMsgId: MessageId of the message.

' Returned : 0 on succes, non-zero on failure

' Remarks :

'

Public Declare Function GetRealTimeLong Lib "Flowb32.dll" (ByVal iAppId As Integer, _

ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, ByRef lValue As Long, _

ByRef lRealTime As Long, ByRef iMsgId As Integer) As Integer

'--------------END OF FUNCTIONS TO READ A PARAMETER VALUE (REALTIME)-------------------------------

'--------------FUNCTIONS TO CLAIM / UNCLAIM PROCESSES----------------------------------------------

'****************************************************************************

'

' ClaimCommand

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which claims a certain process of a node.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' lHwnd: Supply always 0 for this parameter

' bytNode: Node

' bytProc: Process to claim

' iMsgId: MessageId of the message.

Page 86: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

86

' You may choose any value for it with restriction to the following:

' - No 2 messages can have the same MessageId. Only if a message is

' removed the MessageId can be used again.

' Keep the MessageId, you will need it later to check if you received

' an answer-message with the status code in it (to determine if an

' error occured)

' (Out)

' Returned : 0 on succes, non-zero on failure

' Remarks : ClaimCommand() and UnClaimCommand() should not be called until an answer-message

' is received and removed (by calling RemoveMsg()). This is because of the

' (Node, Process, Parameter) combination which must be unique.

'

Public Declare Function ClaimCommand Lib "Flowb32.dll" (ByVal iAppId As Integer, _

ByVal lHwnd As Long, ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal iMsgId As Integer) _

As Integer

'****************************************************************************

'

' UnClaimCommand

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which unclaims a certain process of a node.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' lHwnd: Supply always 0 for this parameter

' bytNode: Node

' bytProc: Process to unclaim

' iMsgId: MessageId of the message.

' You may choose any value for it with restriction to the following:

' - No 2 messages can have the same MessageId. Only if a message is

Page 87: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

87

' removed the MessageId can be used again.

' Keep the MessageId, you will need it later to check if you received

' an answer-message with the status code in it (to determine if an

' error occured)

' (Out)

' Returned : 0 on succes, non-zero on failure

' Remarks : ClaimCommand() and UnClaimCommand() should not be called until an answer-message

' is received and removed (by calling RemoveMsg()). This is because of the

' (Node, Process, Parameter) combination which must be unique.

'

Public Declare Function UnClaimCommand Lib "Flowb32.dll" (ByVal iAppId As Integer, _

ByVal lHwnd As Long, ByVal bytNode As Byte, ByVal cProc As Byte, ByVal iMsgId As Integer) _

As Integer

'****************************************************************************

'

' GetClaimStatus

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which if a certain process of a certain node is claimed or not.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' lHwnd: Supply always 0 for this parameter

' bytNode: Node

' bytProc: Process to check

' (Out) bytStatus: Claim status of the node (0 = not claimed)

' iMsgId: MessageId of the message.

' Returned : 0 on succes, non-zero on failure

' Remarks : ClaimCommand() and UnClaimCommand() should not be called until an answer-message

' is received and removed (by calling RemoveMsg()). This is because of the

Page 88: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

88

' (Node, Process, Parameter) combination which must be unique.

'

Public Declare Function GetClaimStatus Lib "Flowb32.dll" (ByVal iAppId As Integer, _

ByVal bytNode As Byte, ByVal bytProc As Byte, ByRef bytStatus As Byte, ByRef iMsgId As Integer) _

As Integer

'--------------END OF FUNCTIONS TO CLAIM / UNCLAIM PROCESSES---------------------------------------

'--------------FUNCTIONS TO INSTRUCT A CERTAIN PROCESS TO BROADCAST IT'S PARAMETERS----------------

'****************************************************************************

'

' StartBroadcast

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which instructs a certain process of a certain node to broadcast it's

' parameters on the flowbus. Depending on amount of channels connected to FLOWBUS

' bytRepTime (Time between 2 broadcast messages) may have to be decreased in order to

' keep amount of broadcastmessages limited.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' lHwnd: Supply always 0 for this parameter

' bytNode: Node

' bytProc: Process

' bytRepTime: Interval (in 10 msec) between 2 broadcast messages

' iMsgId: MessageId of the message.

' You may choose any value for it with restriction to the following:

' - No 2 messages can have the same MessageId. Only if a message is

' removed the MessageId can be used again.

' Keep the MessageId, you will need it later to check if you received

Page 89: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

89

' an answer-message with the status code in it (to determine if an

' error occured)

' (Out)

' Returned : 0 on succes, non-zero on failure

' Remarks :

'

Public Declare Function StartBroadcast Lib "Flowb32.dll" (ByVal iAppId As Integer, _

ByVal lHwnd As Long, ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytRepTime As Byte, _

ByVal iMsgId As Integer) As Integer

'****************************************************************************

'

' GetStartBroadcastStatus

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which checks the answer on the broadcast-request message (send when

' StartBroadcast() was called).

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' bytNode: Node

' bytProc: Process

' (Out) bytStatus: Status of the broadcast-request (0 = no error, everything OK)

' iMsgId: MessageId of the message.

' Returned : 0 on succes, non-zero on failure

' Remarks :

'

Public Declare Function GetStartBroadcastStatus Lib "Flowb32.dll" (ByVal iAppId As Integer, _

ByVal bytNode As Byte, ByVal bytProc As Byte, ByRef bytStatus As Byte, ByRef iMsgId As Integer) _

As Integer

'--------------END OF FUNCTIONS TO INSTRUCT A CERTAIN PROCESS TO BROADCAST IT'S PARAMETERS---------

Page 90: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

90

'****************************************************************************

'

' GetStatus

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which determines the status of a received message.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' lHwnd: Supply always 0 for this parameter

' bytNode: Node

' bytProc: Process

' bytParm: Parameter

' (Out) bytStatus: Status of the received message (0 = no error, see "ERROR LIST SECTION"

' at the top of this class for other possible codes..)

' iMsgId: MessageId of the message.

' Returned : 0, on succes. See "ERROR LIST SECTION" at the top of this class for other possible codes

' Remarks :

'

Public Declare Function GetStatus Lib "Flowb32.dll" (ByVal iAppId As Integer, _

ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, ByRef bytStatus As Byte, _

ByRef iMsgId As Integer) As Integer

'****************************************************************************

'

' RemoveMsg

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which removes a message from the message buffer.

' The message is identified by the unique combination of (Node, Process, Parameter)

Page 91: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

91

' After calling this function the messageId you assigned to the message with

' combination (Node, Process, Parameter) is available again.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' bytNode: Node

' bytProc: Process

' bytParm: Parameter

' (Out)

' Returned :

' Remarks :

'

Public Declare Sub RemoveMsg Lib "Flowb32.dll" (ByVal iAppId As Integer, _

ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte)

'****************************************************************************

'

' CheckReceivedMsg

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which checks if a message has been received. If so it fills

' the parameters you supplied with the parameters of the received message.

' This function does not remove a message, so if you call this function

' multiple times without calling RemoveMsg() between 2 calls, you will always

' get the same message!!!

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling OpenDLL())

' (Out) bytNode: Node

' bytProc: Process

' bytParm: Parameter

' bytMsgType: Byte which indicates if the answer is on a read-request (1) or on a

' write-request (0).

Page 92: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

92

' bytParmType: Parameter type (0 = Byte\Char, 1=Int, 2=Float, 3=Long, 4=String)

' iMsgId: MessageId of the message

' Returned : 0 if no error occured, otherwise an error value

' Remarks :

'

Public Declare Function CheckReceivedMsg Lib "Flowb32.dll" (ByVal iAppId As Integer, _

ByRef bytNode As Byte, ByRef bytProc As Byte, ByRef bytParm As Byte, ByRef bytMsgType As Byte, _

ByRef bytParmType As Byte, ByRef iMsgId As Integer) As Integer

'****************************************************************************

'

' GetInterfaceType

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which indicates which port is currently used for communication with

' flowbus.

' Parameters:

' (In)

' (Out) sPort: Name of the port which is currently used for flowbus-communication.

' Returned :

' Remarks :

'

Public Declare Sub GetInterfaceType Lib "Flowb32.dll" (ByVal sPort As String)

'****************************************************************************

'

' GetCommunication

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which checks if the communication with flowbus is open or closed.

Page 93: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

93

' Parameters:

' (In)

' (Out)

' Returned : 1 if communication is open, 0 if communication is closed

' Remarks :

'

Public Declare Function GetCommunication Lib "Flowb32.dll" () As Integer

'****************************************************************************

'

' CheckPCISA

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which checks if the PC(ISA)/FLOW-BUS interface is present in then PC.

' WARNING: There have been some troubles using this function (the function returned

' a 1, while we didn't have a PCISA card installed), so do our advise is

' not to use this function.

' Parameters:

' (In)

' (Out)

' Returned : 1 if a PCISA-card is present, 0 if no PCISA-card is present

' Remarks :

'

Public Declare Function CheckPCISA Lib "Flowb32.dll" () As Integer

'****************************************************************************

'

' GetNrPorts

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which returns the number of available ports for communication.

' Parameters:

Page 94: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

94

' (In)

' (Out)

' Returned : Number of available ports for communication

' Remarks :

'

Public Declare Function GetNrPorts Lib "Flowb32.dll" () As Byte

'****************************************************************************

'

' GetPort

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which gets information about a certain communication port

' Parameters:

' (In) bytPortIndex: Index of the communication port in the array of available

' communication ports. The first available port has index 0.

' iMemSize: Amount of memory reserved to store all information.

' Formula to calculate this value: 2 + ExpectedLengthPortName * 2

' (Out) bInUse: Boolean which indicates if the port is currently in use

' sPort: Name of the port

' Returned : Number of available ports for communication

' Remarks : 0, if iMemSize is sufficient to return data

' > 0, (iMemSize to small), the returnvalue indicates how much memory is needed

' -1, index out of range

'

Public Declare Function GetPort Lib "Flowb32.dll" (ByVal bytPortIndex As Byte, ByVal iMemSize As Integer, _

ByRef bInUse As Boolean, ByVal sPort As String) As Integer

'****************************************************************************

'

' GetAvailableInterfaces

'

Page 95: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

95

' Author : Bronkhorst High-Tech B.V.

' Date : 15-Jan-2004

'

' Function : Function which returns info about the physical ports

' (interfaces) in the pc. These ports can be COM-ports

' and PC-ISA cards.

'

' You should make 2 calls to this function:

' - The first time you supply iMemSize = 0

' Furthermore declare variable udt_PortInfo_Ports as

' follows:

' Dim udt_PortInfo_Ports() As PortInfoType

' - The second time you supply iMemSize =

' return value first call

' Furthermore recalcultate the size of variable

' udt_PortInfo_Ports as follows:

' ReDim udt_PortInfo_Ports(bytNrOfElem from first call)

' Parameters:

' (In) iMemSize: Amount of memory allocated by your application

' to store info

' bytNrOfElem: Number of ports in the PC

' udt_PortInfo_Ports: Array in which the information of

' all ports can be stored.

' (Out)

' Returned : 0 if no error occured, otherwise an error value

' Remarks :

'

Public Declare Function GetAvailableInterfaces Lib "Flowb32.dll" ( _

ByVal iMemSize As Integer, ByRef bytNrOfElem As Byte, _

ByRef udt_PortInfo_Ports() As PortInfoType) As Integer

'****************************************************************************

'

' ReadSystemConfig

'

' Author : Bronkhorst High-Tech B.V.

' Date : 15-Jan-2004

'

' Function : Function which reads the flowbus configuration and builds

' the channels database.

Page 96: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

96

' Parameters:

' (In) iNode: Last node to scan (0 means stop scan in progress)

' (Out)

' Returned : 0, no error

' 1, communication not open

' 2, scan already in progress

' 3, busy with open/close or change communication action

' Remarks :

'

Public Declare Function ReadSystemConfig Lib "Flowb32.dll" ( _

ByVal iNode As Integer) As Integer

'****************************************************************************

'

' FindFirstFreeNode

'

' Author : Bronkhorst High-Tech B.V.

' Date : 15-Jan-2004

'

' Function : Function which scans the flowbus network for the first node

' address which is NOT in use (free).

' Parameters:

' (In) iStartNode: Node address of the node at which the search

' should start (0 means cancel previous search)

' (Out)

' Returned : 0, if an error occured (communication was closed, busy with

' other action, already searching node),

' otherwise the node address of the first free node

' Remarks :

'

Public Declare Function FindFirstFreeNode Lib "Flowb32.dll" ( _

ByVal iStartNode As Integer) As Integer

'****************************************************************************

'

' GetProgress

'

' Author : Bronkhorst High-Tech B.V.

Page 97: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

97

' Date : 15-Jan-2004

'

' Function : Function which determines the progress after a call to

' ReadSystemConfig() or FindFirstFreeNode().

' These function take a long time to complete.

' Parameters:

' (In)

' (Out)

' Returned : The progress of action as a percentage (0 - 100%)

' Remarks :

'

Public Declare Function GetProgress Lib "Flowb32.dll" () As Byte

'****************************************************************************

'

' GetDLLVersion

'

' Author : Bronkhorst High-Tech B.V.

' Date : 15-Jan-2004

'

' Function : Function which gets the version number of FLOWB32.DLL

' Parameters:

' (In)

' (Out) sDllVersion: Version of Flowb32.dll

' Returned :

' Remarks : ATTENTION

' Flowb32.dll is made in C++.

' The datatypes for character strings in C++ and Visual Basic

' are not the same. If you don't know how to get character

' strings, see function modFlowbusAvanzado.GetAnswer().

' Search for the "case 4" statement. Here you will find

' an example of how to retrieve character strings.

'

Public Declare Sub GetDLLVersion Lib "Flowb32.dll" ( _

ByVal sDllVersion As String)

'****************************************************************************

'

Page 98: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

98

' GetChannel

'

' Author : Bronkhorst High-Tech B.V.

' Date : 15-Jan-2004

'

' Function : Function which returns the (virtual) channel number for a

' certain (node, process)-combination.

' Parameters:

' (In) iNode: Node number

' iProc: Process number

' (Out)

' Returned : The channel number of the (node, process)-combination

' Remarks :

'

Public Declare Function GetChannel Lib "Flowb32.dll" ( _

ByVal iNode As Integer, ByVal iProc As Integer) As Integer

'****************************************************************************

'

' GetModuleType

'

' Author : Bronkhorst High-Tech B.V.

' Date : 15-Jan-2004

'

' Function : Function which returns the type of a node / module.

' It tells you what kind of instrument the node / module is.

'

' Parameters:

' (In) iNode: Node number

' (Out)

' Returned : The type of the module

' The list below provides some information about the returned

' numbers. This is an old list, so the newer instruments are

' NOT listed.

' 0 = None - No device found with this node number

' 1 = RS232 - RS232 interface to FLOW-BUS

' 2 = PC/ISA - PC(ISA) interface to FLOW-BUS

Page 99: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

99

' 3 = ADDA4 - 4 Channel 0..5Vdc/0..10Vdc/0..20mA/4..20mA

' interface to FLOW-BUS

' 4 = R/C - Readout and control module for up to 32

' channels

' 5 = T/A - Totalizer and alarm module with 8 alarms and

' 8 counters

' 6 = ADDA1 - 1 Channel 0..5Vdc/0..10Vdc/0..20mA/4..20mA

' interface to FLOW-BUS

' 7 = DMFC - Digital Mass Flow Controller

' 8 = DMFM - Digital Mass Flow Meter

' 9 = DEPC - Digital Electronic Pressure Controller

' 10 = DEPM - Digital Electronic Pressure Meter

' 11 = ACT - single actuator

' 12 = DLFC - Digital Liquid Flow Controller

' 13 = DLFM - Digital Liquid FLow Meter

' 14 = DSCM-A - Digital Single Channel Module for analog

' instruments

' 15 = DSCM-D - Digital Single Channel Module for digital

' instruments

' 16 = FRM - FLOW-BUS Rotor Meter (calibration instrument)

' 17 = FTM - FLOW-BUS Turbine Meter (calibration instrument)

' 18 = FPP - FLOW-BUS Piston Prover (calibration instrument)

' 19 = F/A - Flow/Alarm module (special T/A-module)

' 20 = DSCM-F - Single channel fuzzy controller module

' 21 = DSCM-C - Single channel operation module for calibrators

' 22 = DDCM-D - Dual channel module for analog instruments

' Remarks :

'

Public Declare Function GetModuleType Lib "Flowb32.dll" ( _

ByVal iNode As Integer) As Integer

'****************************************************************************

'

' GetModuleDevType

Page 100: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

100

'

' Author : Bronkhorst High-Tech B.V.

' Date : 15-Jan-2004

'

' Function : Function which gets the device type associated with a

' certain node / module. The device type tells you something

' about the functionality / capabillities of the module.

' You could see it as the group of instruments to which

' the node / module belongs.

'

' Parameters:

' (In) iNode: Node number

' (Out)

' Returned : The device type of the module.

' Possible types:

' 0 = Unknown

' 1 = TYPE_INTERFACE

' 2 = TYPE_MODULE / TYPE_ADDA

' 3 = TYPE_OPERATOR

' 4 = TYPE_SUPERVISE

' 5 = TYPE_CONTROLLER

' 6 = TYPE_METER

' 7 = TYPE_SPECIAL

' 8 = TYPE_CONVERTER

' Remarks :

'

Public Declare Function GetModuleDevType Lib "Flowb32.dll" ( _

ByVal iNode As Integer) As Integer

'****************************************************************************

'

' GetModuleNumber

'

' Author : Bronkhorst High-Tech B.V.

' Date : 15-Jan-2004

'

' Function : Function which gets the identification string of a

' module / node connected to the FLOW-BUS.

' This identification tells some information about

Page 101: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

101

' version and module type

'

' Parameters:

' (In) iNode: Node number

' (Out) sIdent: Identification string of the module

' Returned :

' Remarks : ATTENTION

' Flowb32.dll is made in C++.

' The datatypes for character strings in C++ and Visual Basic

' are not the same. If you don't know how to get character

' strings, see function modFlowbusAvanzado.GetAnswer().

' Search for the "case 4" statement. Here you will find

' an example of how to retrieve character strings.

'

Public Declare Sub GetModuleNumber Lib "Flowb32.dll" ( _

ByVal iNode As Integer, ByVal sIdent As String)

'****************************************************************************

'

' GetMaxChannel

'

' Author : Bronkhorst High-Tech B.V.

' Date : 15-Jan-2004

'

' Function : Function which gets the node and process number of a

' (virtual) channel.

' Parameters:

' (In) iChannel: Channel number. You must supply an existing

' channel number.

' (Out) iNode: Node number

' iProc: Process number

' Returned : True if node and process number could be found,

' otherwise false

' Remarks :

'

'

Public Declare Function GetNodeProc Lib "Flowb32.dll" ( _

ByVal iChannel As Integer, ByRef iNode As Integer, _

ByRef iProc As Integer) As Boolean

Page 102: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

102

'****************************************************************************

'

' GetMaxChannel

'

' Author : Bronkhorst High-Tech B.V.

' Date : 15-Jan-2004

'

' Function : Function which returns the maximum (virtual) channel number

' in the flowbus network.

' Parameters:

' (In)

' (Out)

' Returned : The maximum (virtual) channel number in the flowbus network

' Remarks :

'

Public Declare Function GetMaxChannel Lib "Flowb32.dll" () As Integer

'****************************************************************************

'

' GetMaxNode

'

' Author : Bronkhorst High-Tech B.V.

' Date : 15-Jan-2004

'

' Function : Function which returns the highest address of all nodes

' connected to the FLOW-BUS

' Parameters:

' (In)

' (Out)

' Returned : The highest address of all nodes connected to the FLOW-BUS

' Remarks :

'

Public Declare Function GetMaxNode Lib "Flowb32.dll" () As Integer

'****************************************************************************

Page 103: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

103

'

' SetSystemLNA

'

' Author : Bronkhorst High-Tech B.V.

' Date : 15-Jan-2004

'

' Function : Function which alters the last node address of FLOW-BUS

' system. The LNA is a parameter used for communciation speed

' efficiency. Flowbus is a token ring network.

' After a node has finished his tasks, it passes the token

' to the next node on the network. To determine when the token

' should be passed to the first node again, LNA is used.

' If you are not familiar with parameter LNA, leave it as it is!

' A wrong value for this parameter could result in your

' network not finding certain nodes anymore.

' Parameters:

' (In) iLNA: New value for parameter LNA (Last Node Address)

' (Out)

' Returned :

' Remarks :

'

Public Declare Sub SetSystemLNA Lib "Flowb32.dll" (ByVal iLNA As Integer)

'****************************************************************************

'

' GetSystemLNA

'

' Author : Bronkhorst High-Tech B.V.

' Date : 15-Jan-2004

'

' Function : Function which returns the last node address of FLOW-BUS

' system. The LNA is a parameter used for communciation speed

' efficiency. Flowbus is a token ring network.

' After a node has finished his tasks, it passes the token

' to the next node on the network. To determine when the token

' should be passed to the first node again, LNA is used.

Page 104: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

104

' Parameters:

' (In)

' (Out)

' Returned : The value of parameter LNA (Last Node Address)

' Remarks :

'

Public Declare Function GetSystemLNA Lib "Flowb32.dll" () As Integer

'****************************************************************************

'

' GetNrPendingMessages

'

' Author : Bronkhorst High-Tech B.V.

' Date : 15-Jan-2004

'

' Function : Function which returns the amount of outstanding messages.

' Each read or write action consists of 2 parts:

' - Sending a request for a parameter / Writing a parameter.

' This message is called a request-message.

' - Waiting for an answer (waiting for a message containing a

' statuscode, which tells you wheter or not the operation has

' succeeded). In case of a read request, this message also

' contains the value of your parameter.

' This message is called an answer-message.

'

' The term "outstanding messages" can now be defined as follows:

' The number of request-messages of which the corresponding

' answer-message is not yet removed from the dll's message

' buffer.

'

' This means that request-messages which are not already sent

' are included (no answer-message are received on these

' messages, so the answer-message on these request-messages

' could not have been removed from the dll's message buffer)

Page 105: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

105

'

' This also includes request-messages on which an

' answer-message was received which was not yet removed from

' the dll's message buffer.

' Parameters:

' (In) iAppId: ApplicationId (which you received by calling

' OpenDLL())

' (Out)

' Returned : The number of outstanding messages

' Remarks :

'

Public Declare Function GetNrPendingMessages Lib "Flowb32.dll" ( _

ByVal iAppId As Integer) As Integer

3.2.3. Desarrollo de las funciones de la API (modFlowbusAvanzado.bas)

Option Explicit

'--------------USER DEFINED TYPES------------------------------------------------------------------

'Structure / Type which holds message-information

'Prefix: "udtMessageType_"

Private Type MessageType

iMsgId As Integer 'MessageId of the message

sValue As String 'Parameter value (answer on a read-request)

iErrVal As Integer 'Error value which indicates what error occured

bytStatus As Byte 'Statuscode of the received / answer message

lNodeProcParm As Long 'Number in which Node, Process and parameter number is stored

sErr As String 'Error string which indicates what error occured

bAnswered As Boolean 'Boolean which indicates if an answer has been received on this message

End Type

'--------------END OF USER DEFINED TYPES-----------------------------------------------------------

'--------------MODULE VARIABLES--------------------------------------------------------------------

Private Type ModuleVariables

udtMessageType_Messages() As MessageType 'Local message buffer

lMessages As Long 'Number of messages in the local message buffer

Page 106: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

106

End Type

Private m As ModuleVariables

'--------------END OF MODULE VARIABLES-------------------------------------------------------------

'--------------FUNCTIONS TO OPEN THE COMMUNICATION-------------------------------------------------

'****************************************************************************

'

' StartCommunication

'

' Author : Bronkhorst High-Tech B.V.

' Date : 12-Dec-2003

'

' Function : This starts the communication with flowbus on a certain port.

' Furthermore it configures the chaining of process.

' ATTENTION: If you always call ReadParameterDirect() or WriteParameterDirect(),

' you don't take any advantage of process and parameter chaining,

' because you are sending one message at a time

' (and wait for the anwer, before sending another message)

' Parameters:

' (In) sPort: Name of the port on which the communication should be openend.

' bProcChain: Boolean which indicates if processes should be chained or not.

' CAUTION > Older flowbus modules might not support this functionality,

' we therefore advise you to set this option to False unless

' you are sure that all modules in your network support this

' functionality.

' bParmChain: Boolean which indicates if processes should be chained or not.

' lBaudRate: The desired baudrate at which the port should be configured.

' Supported baudrates are: 4800, 9600, 19200 and 38400

' (Out) iErrVal: An error-value indicating which error occured.

Page 107: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

107

' Returned : "" if no error occured, otherwise an error-string

' Remarks :

'

Public Function StartCommunication(ByVal sPort As String, ByVal bProcChain As Boolean, _

ByVal bParmChain As Boolean, ByRef iErrVal As Integer, ByVal lBaudRate As Long) As String

Dim sRetVal As String 'Error-string

Dim bytNode As Byte

Dim bytSecNode As Byte

Dim bytNextNode As Byte

Dim bytLastNode As Byte

Dim bytArbiterMode As Byte

Dim bytTxRetries As Byte

Dim bytRxRetries As Byte

Dim sOldPort As String

Dim iBaudRate As Integer

Dim iAttempt As Integer

Const MAXATTEMPTS As Long = 3

'Create a String containing 256 spaces, because of C++. If your String contains too few

'spaces C++ may generate a memory error. The String you supply must contain at least as

'many characters as the C++ function will write into your variable.

sOldPort = Space(256)

'No errors yet

sRetVal = ""

'Strip off leading and trailing spaces from the portname

sPort = Trim(sPort)

'Get TNet configuration

modFlowbusAPI.GetTNetConfig bytNode, bytSecNode, bytNextNode, bytLastNode, bytArbiterMode, _

bytTxRetries, bytRxRetries, sOldPort

'Set TNet configuration (only port is different)

iErrVal = modFlowbusAPI.ConfigureTNet(bytNode, bytSecNode, bytNextNode, bytLastNode, _

bytArbiterMode, bytTxRetries, bytRxRetries, sPort)

Page 108: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

108

'If no error occured..

If iErrVal = 0 Then

'Calculate baudrate

Select Case lBaudRate

Case 4800, 9600, 19200

iBaudRate = lBaudRate

Case 38400

iBaudRate = lBaudRate - 65536

Case Else

'Baudrate not supported, set error

sRetVal = "Baudrate not supported.."

End Select

'Configure the port with the new baudrate

iErrVal = modFlowbusAPI.ConfigureRS232(sPort, iBaudRate)

'If no error occured..

If iErrVal = 0 Then

'Configure chaining of processes and parameters

modFlowbusAPI.ConfigureChaining bProcChain, bParmChain

'Try to open the communication on port sPort.

'Maximum number of attempts is MAXATTEMPTS

For iAttempt = 1 To MAXATTEMPTS

'Open the communication on port sPort

iErrVal = modFlowbusAPI.OpenCommunication(sPort)

'Communication opened??

If iErrVal = 0 Then

'Communication is opened

cfg.Abierto = True

'Communication opened, so exit this loop

Exit For

End If

Next

'Check if the communication is NOT open

If Not cfg.Abierto Then

Page 109: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

109

sRetVal = "Imposible abrir puerto"

End If

Else

sRetVal = "Baudrate could not be set"

End If

Else

sRetVal = "TNet could not be configured on the supplied port.."

End If

StartCommunication = sRetVal

End Function

'****************************************************************************

'

' CloseCommunication

'

' Author : Bronkhorst High-Tech B.V.

' Date : 16-Dec-2003

'

' Function : Function which closes the communication with the flowbus on a specified port.

' If the communication could not be closed, a message box with error information

' will appear.

' Parameters:

' (In) sPortName: Name of the port to close ("COM1" or "COM2" for example)

' (Out)

' Returned : "" if no error occured, otherwise an error string

' Remarks :

'

Public Function CloseCommunication() As String

Dim iErrVal As Integer

Dim sErrVal As String

'No error occured yet

sErrVal = ""

'Is communication with flowbus opened

If cfg.Abierto Then

'If so, try to close the communication

Page 110: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

110

iErrVal = modFlowbusAPI.CloseCommunication

'Error occured while closing the communication?

If iErrVal <> 0 Then

sErrVal = "Error closing communication, Err number=" & iErrVal

Else

cfg.Abierto = False

End If

End If

CloseCommunication = sErrVal

End Function

'--------------END OF FUNCTIONS TO OPEN / CLOSE THE COMMUNICATION------------------------------------------

'--------------FUNCTIONS TO WRITE A PARAMETER VALUE------------------------------------------------

'****************************************************************************

'

' WriteParameterDirect

'

' Author : Bronkhorst High-Tech B.V.

' Date : 12-Dec-2003

'

' Function : This function directly writes a parameter to a certain instrument on the flowbus.

' This function waits for an answer before it returns.

' Parameters:

' (In) iNode: Node (instrument)

' iProc: Process

' iParm: Parameter

' sParmType: Parametertype of the parameter

' "c" is String / Byte

' "f" is Float

' "i" is Integer

' "l" is Long

' iParmTypeLength: length of parameter-value (only meaningfull if sParmType = "c"):

' 0 means Byte (1 character)

Page 111: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

111

' -2 means Zero Terminated String

' x (all other values) means Fixed String of x characters

' lTimeOut: Time (in milliseconds) before a timeout occurs, we can't wait forever..

' sValue: The parameter value to write..

' (Out) iErrVal: An error-value indicating which error occured.

' bytStatus: Status code of the received message

' Returned : "" if no error occured, otherwise an error-string

' Remarks :

'

Public Function WriteParameterDirect(ByVal iNode As Integer, ByVal iProc As Integer, _

ByVal iParm As Integer, ByVal sParmType As String, ByVal iParmTypeLength As Integer, _

ByVal lTimeOut As Long, ByVal sValue As String, ByRef iErrVal As Integer, _

ByRef bytStatus As Byte) As String

Dim sRetVal As String 'Error-string

Dim iMsgId As Integer 'MessageId of the message we sent..

'Send a write-request (write some parameter value).

'The function will return a messageId it has assigned to the message (iMsgId),

'the error-string containing error-information (sRetVal) and

'an error-value which indicates the cause of the error (iErrVal) corresponding to sRetVal

sRetVal = SendWriteRequest(iNode, iProc, iParm, sParmType, iParmTypeLength, sValue, iMsgId, _

iErrVal)

'Check to see if no error occured yet..

If Len(sRetVal) = 0 Then

'If no answer was received on the read-request

If Not GetInfoDirect(iMsgId, lTimeOut, bytStatus, iErrVal, sRetVal) Then

'Set an error that no answer was received on the write-request

sRetVal = "No answer received on write-request, timeout"

End If

End If

WriteParameterDirect = sRetVal

Page 112: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

112

End Function

'****************************************************************************

'

' SendWriteRequest

'

' Author : Bronkhorst High-Tech B.V.

' Date : 11-Dec-2003

'

' Function : This function writes a parameter-value to a specific instrument on the flowbus

' Parameters:

' (In) iNode: the busaddress of the node

' iProc: the processnumber

' iParm: the parameternumber

' sParmType: parmetertype of the parameter:

' "c" is String / Byte

' "f" is Float

' "i" is Integer

' "l" is Long

' iParmTypeLength: length of parameter-value (only meaningfull if sParmType = "c"):

' 0 means Byte (1 character)

' -2 means Zero Terminated String

' x (all other values) means Fixed String of x characters

' sValue: the parameter value to write..

' (Out) iMsgId: the messageId which corresponds to the message that was sent.

' This messageId is valuable because with this id, we can determine

' which message (sent by an instrument on the flowbus) contains our value.

' It goes like this:

' 1. Person x sends person y a message that he would like to know value z.

' Person x identifies the message with messageId i

' 2. Person y sends a message back which contains value z.

' Person y identifies the message with messageId i

Page 113: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

113

' 3. Person x sees that he has received a message with messageId i,

' therefore person x knows that this message contains value z.

' iErrVal: an error-value indicating which error occured.

' Returned : If no error occured "" is returned,

' otherwise an error-message is returned.

' Remarks : You can use iMsgId to get the value at a later time, if you don't want to read

' the value from the flowbus directly.

'

Public Function SendWriteRequest(ByVal iNode As Integer, ByVal iProc As Integer, _

ByVal iParm As Byte, ByVal sParmType As String, ByVal iParmTypeLength As Integer, _

ByVal sValue As String, ByRef iMsgId As Integer, ByRef iErrVal As Integer) As String

Dim sRetVal As String

sRetVal = "" 'No error occured yet..

'If length of the parameter is less then the expected length of the parameter,

'add trailing spaces (charactercode 32) to the parameter value.

If iParmTypeLength > Len(sValue) Then

sValue = sValue + String$(iParmTypeLength - Len(sValue), 32)

End If

If sParmType = "i" Or sParmType = "f" Or sParmType = "l" Or sParmType = "c" Then

'Get a new messageId for the parameter in iMsgId.

'Is there NOT already a message with this node, process and parameter?

If Not GetFreeMsgId(iNode, iProc, iParm, iMsgId) Then

'Send a proper read-request to the instrument on the flowbus

Select Case sParmType

'-----------------------------------------------------------------------------------

Case "i" 'Parameter of type Integer?

iErrVal = modFlowbusAPI.WriteInt(cfg.IdApl, 0, CByte(iNode), CByte(iProc), _

CByte(iParm), CInt(sValue), iMsgId)

'-----------------------------------------------------------------------------------

Page 114: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

114

Case "f" 'Parameter of type Float?

iErrVal = modFlowbusAPI.WriteFloat(cfg.IdApl, 0, CByte(iNode), CByte(iProc), _

CByte(iParm), Val(Format$(sValue, "0.00000E+0")), iMsgId)

'-----------------------------------------------------------------------------------

Case "l" 'Parameter of type Long?

iErrVal = modFlowbusAPI.WriteLong(cfg.IdApl, 0, CByte(iNode), CByte(iProc), _

CByte(iParm), CLng(sValue), iMsgId)

'-----------------------------------------------------------------------------------

Case "c" 'Parameter of type String?

'Is the parameter of type Byte (1 character)?

If iParmTypeLength = 0 Then

iErrVal = modFlowbusAPI.WriteChar(cfg.IdApl, 0, CByte(iNode), CByte(iProc), _

CByte(iParm), CByte(sValue), iMsgId)

Else

'Is the parameter of type Zero Terminated String?

If iParmTypeLength = -2 Then

iParmTypeLength = 0

End If

'Check if the parameter value is not an empty string.

'Sending an empty string will hang-up FLOWDDE !!!!!

If sValue = "" Then

sValue = " "

End If

iErrVal = modFlowbusAPI.WriteString(cfg.IdApl, 0, CByte(iNode), _

CByte(iProc), CByte(iParm), CByte(iParmTypeLength), sValue, iMsgId)

End If

'-----------------------------------------------------------------------------------

End Select

'If an error occured

If iErrVal <> 0 Then

Page 115: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

115

'Set an error indicating the cause of the error

sRetVal = "An error was returned on the write-request (error calling WriteXXX())"

End If

Else

'Set an error indicating the combination(node, process, parameter) is already in the

'message buffer

iErrVal = 2

sRetVal = "A message already exists for the combination (node, process, parameter)"

End If

Else

'Set an error indicating the supplied parameter type does not exist

iErrVal = 1

sRetVal = "Parameter type not found"

End If

SendWriteRequest = sRetVal

End Function

'--------------END OF FUNCTIONS TO WRITE A PARAMETER VALUE-----------------------------------------

'--------------FUNCTIONS TO READ A PARAMETER VALUE-------------------------------------------------

'****************************************************************************

'

' ReadParameterDirect

'

' Author : Bronkhorst High-Tech B.V.

' Date : 12-Dec-2003

'

' Function : This function directly reads a parameter from an instrument on the flowbus

' This function waits for an answer before it returns.

' Parameters:

' (In) iNode: Node (instrument)

' iProc: Process

' iParm: Parameter

' sParmType: Parametertype of the parameter

' "c" is String / Byte

Page 116: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

116

' "f" is Float

' "i" is Integer

' "l" is Long

' iParmTypeLength: length of parameter-value (only meaningfull if sParmType = "c"):

' 0 means Byte (1 character)

' -2 means Zero Terminated String

' x (all other values) means Fixed String of x characters

' lTimeOut: Time (in milliseconds) before a timeout occurs, we can't wait forever..

' (Out) sAnswer: Parameter-value (the value which was received from the node)

' iErrVal: An error-value indicating which error occured.

' bytStatus: Status code of the received message

' Returned : "" if no error occured, otherwise an error-string

' Remarks :

'

Public Function ReadParameterDirect(ByVal iNode As Integer, ByVal iProc As Integer, _

ByVal iParm As Integer, ByVal sParmType As String, ByVal iParmTypeLength As Integer, _

ByVal lTimeOut As Long, ByRef sAnswer As String, ByRef iErrVal As Integer, _

ByRef bytStatus As Byte) As String

Dim sRetVal As String 'Error-string

Dim iMsgId As Integer 'MessageId of the message we sent..

'Send a read-request (request for some parameter value).

'The function will return a messageId it has assigned to the message (iMsgId),

'the error-string containing error-information (sRetVal) and

'an error-value which indicates the cause of the error (iErrVal) corresponding to sRetVal

sRetVal = SendReadRequest(iNode, iProc, iParm, sParmType, iParmTypeLength, iMsgId, iErrVal)

'Check to see if no error occured yet..

If Len(sRetVal) = 0 Then

'If no answer was received on the read-request

If Not GetInfoDirect(iMsgId, lTimeOut, bytStatus, iErrVal, sRetVal, sAnswer) Then

'Set an error that the parameter value was not found

Page 117: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

117

sRetVal = "Parameter value not found, timeout"

End If

End If

ReadParameterDirect = sRetVal

End Function

'****************************************************************************

'

' SendReadRequest

'

' Author : Bronkhorst High-Tech B.V.

' Date : 11-Dec-2003

'

' Function : This function sends a Read-request to the dll.

' A Read-request is a message telling the dll that we would like to know the value

' of a specified parameter.

' Parameters:

' (In) iNode: the busaddress of the node

' iProc: the processnumber

' iParm: the parameternumber

' sParmType: parmetertype of the parameter:

' "c" is String / Byte

' "f" is Float

' "i" is Integer

' "l" is Long

' iParmTypeLength: length of parameter-value (only meaningfull if sParmType = "c"):

' 0 means Byte (1 character)

' -2 means Zero Terminated String

' x (all other values) means Fixed String of x characters

' (Out) iMsgId: the messageId which corresponds to the message that was sent.

' This messageId is valuable because with this id, we can determine

' which message (sent by an instrument on the flowbus) contains our value.

' It goes like this:

' 1. Person x sends person y a message that he would like to know value z.

Page 118: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

118

' Person x identifies the message with messageId i

' 2. Person y sends a message back which contains value z.

' Person y identifies the message with messageId i

' 3. Person x sees that he has received a message with messageId i,

' therefore person x knows that this message contains value z.

' iErrVal: an error-value indicating which error occured.

' Returned : If no error occured "" is returned,

' otherwise an error-message is returned.

' Remarks : You can use iMsgId to get the value at a later time, if you don't want to read

' the value from the flowbus directly.

'

Private Function SendReadRequest(ByVal iNode As Integer, ByVal iProc As Integer, _

ByVal iParm As Integer, ByVal sParmType As String, ByVal iParmTypeLength As Integer, _

ByRef iMsgId As Integer, ByRef iErrVal As Integer) As String

Dim sRetVal As String 'Error string which indicates the cause of the error

iErrVal = 0 'No error occured yet..

If sParmType = "i" Or sParmType = "f" Or sParmType = "l" Or sParmType = "c" Then

'Get a new messageId for the parameter in iMsgId.

'Is there NOT already a message with this node, process and parameter?

If Not GetFreeMsgId(iNode, iProc, iParm, iMsgId) Then

'Send a proper read-request to the instrument on the flowbus

Select Case sParmType

'-----------------------------------------------------------------------------------

Case "i" 'Parameter of type Integer?

iErrVal = modFlowbusAPI.ReadInt(cfg.IdApl, 0, CByte(iNode), CByte(iProc), _

CByte(iParm), iMsgId)

'-----------------------------------------------------------------------------------

Case "f" 'Parameter of type Float?

Page 119: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

119

iErrVal = modFlowbusAPI.ReadFloat(cfg.IdApl, 0, CByte(iNode), CByte(iProc), _

CByte(iParm), iMsgId)

'-----------------------------------------------------------------------------------

Case "l" 'Parameter of type Long?

iErrVal = modFlowbusAPI.ReadLong(cfg.IdApl, 0, CByte(iNode), CByte(iProc), _

CByte(iParm), iMsgId)

'-----------------------------------------------------------------------------------

Case "c" 'Parameter of type String?

'Is the parameter of type Byte?

If iParmTypeLength = 0 Then

iErrVal = modFlowbusAPI.ReadChar(cfg.IdApl, 0, CByte(iNode), CByte(iProc), _

CByte(iParm), iMsgId)

Else

'Is the parameter is of type Zero Terminated String?

If iParmTypeLength = -2 Then

'Set length of the parameter to 0, indicating zero terminated string

iParmTypeLength = 0

'Else the length of the parameter remains as it was, indicating Fixed String

End If

iErrVal = modFlowbusAPI.ReadString(cfg.IdApl, 0, CByte(iNode), CByte(iProc), _

CByte(iParm), CByte(iParmTypeLength), iMsgId)

End If

End Select

'If an error occured

If iErrVal <> 0 Then

'Set an error indicating the cause of the error

sRetVal = "An error was returned on the read-request (error calling ReadXXX())"

End If

Else

'Set an error indicating the combination(node, process, parameter) is already in the

'message buffer

iErrVal = 2

Page 120: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

120

sRetVal = "A message already exists for the combination (node, process, parameter)"

End If

Else

'Set an error indicating the supplied parameter type does not exist

iErrVal = 1

sRetVal = "Parameter type not found"

End If

SendReadRequest = sRetVal

End Function

'--------------END OF FUNCTIONS TO READ A PARAMETER VALUE------------------------------------------

'--------------FUNCTIONS TO EXTRACT INFORMATION FROM RECEIVED MESSAGES-----------------------------

'****************************************************************************

'

' GetInfoDirect

'

' Author : Bronkhorst High-Tech B.V.

' Date : 12-Dec-2003

'

' Function : With this function you get the information contained in the received

' answer-message of a read-request or a write-request.

' This function first checks the local queue for the message.

' If not found, it asks the DLL if it has other messages. This function only stops

' if a timeout occured, or if it has found the answer

' After extracting the information from the received message, the message will

' be removed from the local queue.

' Parameters:

' (In) iMsgId: The messageId of the message from which the value needs to be extraced

' lTimeOut: Number of milliseconds before a timeout occurs

' (Out) bytStatus: Status code of the received message / answer-message

' iErrVal: Error value which indicates what error occured

Page 121: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

121

' sErr: Error message which corresponds to the error value

' sAnswer: Value of the parameter (only meaningfull with read-request) and

' therefore this parameter is optional..

' Returned : True if the parameter was found, False otherwise

' Remarks :

'

Public Function GetInfoDirect(ByVal iMsgId As Integer, ByVal lTimeOut As Long, _

ByRef bytStatus As Byte, ByRef iErrVal As Integer, ByRef sErr As String, _

Optional ByRef sAnswer As String) As Boolean

Dim bFound As Boolean 'Boolean which indicates if the message has been found

Dim bRetVal As Boolean 'Boolean which indicates if the message was answered

Dim sValue As String 'Parameter value on a read-request

Dim oTimeOut_Timer As clsTemporizadorTimeOut 'Variable to hold the timeout timer

Set oTimeOut_Timer = New clsTemporizadorTimeOut 'Initialize the variable

bRetVal = False 'Message not answered yet

oTimeOut_Timer.StartTimeOutTimer 'Start the timeout timer

Do

'Check if a message with messageId iMsgId exists. If so, load information into the

'supplied parameters

bFound = GetMsg(iMsgId, bRetVal, bytStatus, iErrVal, , sErr, sValue)

'Check if the message was found

If bFound Then

'Check if an answer has been received on the message

If bRetVal Then

'If parameter sAnswer is supplied, fill it..

If Not IsMissing(sAnswer) Then

sAnswer = sValue

End If

Else

'If message was not answered yet, handle pending message to see if the message

Page 122: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

122

'if an answer on the message is received now..

HandlePendingMsg

End If

'Else (if the message was not found, it means there was no message sent, so we will not

' receive an answer for sure..)

End If

Loop Until (Not bFound) Or bRetVal Or oTimeOut_Timer.TimeUp(lTimeOut)

'Remove the message from the local message buffer (not from DLL, but from application)

RemoveMessage iMsgId

GetInfoDirect = bRetVal

End Function

'--------------END OF FUNCTIONS TO EXTRACT INFORMATION FROM RECEIVED MESSAGES----------------------

'--------------FUNCTIONS TO HANDLE PENDING MESSAGES------------------------------------------------

'****************************************************************************

'

' HandlePendingMsg

'

' Author : Bronkhorst High-Tech B.V.

' Date : 12-Dec-2003

'

' Function : Function which handles pending messages (messages that are queued in the Dll)

' These messages will be stored in the local queue of this application.

' Parameters:

' (In)

' (Out)

' Returned :

' Remarks :

'

Public Sub HandlePendingMsg()

Dim iMsgId As Integer

Dim sValue As String

Dim iErrVal As Integer

Dim bytStatus As Byte

Page 123: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

123

Dim sErr As String

Dim iMsgIndex As Integer

'While there are messages in the DLL-queue

While GetAnswer(iMsgId, sValue, sErr, iErrVal, bytStatus)

'Find the index / position (in the local message buffer) of the message

If GetMsg(iMsgId, , , , , , , iMsgIndex) Then

'Fill the message structure with message information of the received message

With m.udtMessageType_Messages(iMsgIndex)

.bAnswered = True

.bytStatus = bytStatus

.iErrVal = iErrVal

.sValue = sValue

.sErr = sErr

End With

End If

Wend

End Sub

'--------------END OF FUNCTIONS TO HANDLE PENDING MESSAGES-----------------------------------------

'--------------PRIVATE FUNCTIONS AND PROCEDURES----------------------------------------------------

'****************************************************************************

'

' RemoveMessage

'

' Author : Bronkhorst High-Tech B.V.

' Date : 12-Dec-2003

'

' Function : Removes a message from the DLL-queue and the messageId's collection in this

' application.

' Parameters:

' (In) iMsgId: MessageId of the message to be removed

' (Out)

' Returned :

' Remarks :

'

Page 124: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

124

Private Sub RemoveMessage(ByVal iMsgId As Integer)

Dim iMsgIndex As Integer

'Check if a message with this messageId exists

If GetMsg(iMsgId, , , , , , , iMsgIndex) Then

'If the message exists, move the message to the end of the array, but the array must

'stay sorted.

While iMsgIndex <> (m.lMessages - 1)

ExchangeMsgIds iMsgIndex, iMsgIndex + 1

iMsgIndex = iMsgIndex + 1

Wend

'Remove the message from the message buffer

ReDim Preserve m.udtMessageType_Messages(m.lMessages - 1)

m.lMessages = m.lMessages - 1

End If

End Sub

'****************************************************************************

'

' GetMsg

'

' Author : Bronkhorst High-Tech B.V.

' Date : 15-Dec-2003

'

' Function : Function which tries to get a new / free messageId.

' If no free messageId is found, the message will NOT be stored

' in the message buffer. This means the message will not be send.

' Due to the method RemoveMsg() found in flowb32.dll it is not possible

' to have multiple messages in the message buffer with the same

' (Node, Process, Parameter)-combintation.

' Parameters:

' (In) iMsgId: Message Id of the message you want to get information from

' (Out) bAnswered: Boolean which indicates if an answer message has been received on this

Page 125: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

125

' message. If not, the other parameters mentioned below are not valid!!

' bytStatus: Statuscode of the received message

' iErrVal: Error value of the received message

' lNodeProcParm: Long-value (4 bytes) which contains

' node, process and parameter values...

' lNodeProcParm = Node * (2^16) + Process * (2^8) + Parameter

' sErr: Error string which corresponds to iErrVal

' sValue: Parametervalue extracted from the received message (only filled when

' a parameter is read, not when a parameter is written)

' iMsgIndex: Index in the local message buffer, where the message is stored

' Returned : 0, if a new / messageId was found for the message

' 1, if the message buffer was full (message NOT added)

' 2, if the message buffer already contained a message with the same

' (Node, Process, Parameter)-combination

' Remarks : The message buffer is sorted on messageId. The lowest messageId comes first.

'

Private Function GetMsg(ByVal iMsgId As Integer, Optional ByRef bAnswered As Boolean, _

Optional ByRef bytStatus As Byte, Optional ByRef iErrVal As Integer, _

Optional ByRef lNodeProcParm As Long, Optional ByRef sErr As String, _

Optional ByRef sValue As String, Optional ByRef iMsgIndex As Integer) As Boolean

Dim iIndex As Integer 'Index in the message buffer

Dim bRetVal As Boolean 'Boolean which indicates if the message buffer contains

'such a message

bRetVal = False 'Message not found yet

'Check every message in the local message buffer

For iIndex = 0 To m.lMessages - 1

With m.udtMessageType_Messages(iIndex)

'MessageId same as messageId of current message?

If .iMsgId = iMsgId Then

'Message found

bRetVal = True

Page 126: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

126

'If parameter bAnswered is supplied, then set bAnswered

If Not IsMissing(bAnswered) Then

bAnswered = .bAnswered

End If

'If parameter bytStatus is supplied, then set bytStatus

If Not IsMissing(bytStatus) Then

bytStatus = .bytStatus

End If

'If parameter iErrVal is supplied, then set iErrVal

If Not IsMissing(iErrVal) Then

iErrVal = .iErrVal

End If

'If parameter lNodeProcParm is supplied, then set lNodeProcParm

If Not IsMissing(lNodeProcParm) Then

lNodeProcParm = .lNodeProcParm

End If

'If parameter sErr is supplied, then set sErr

If Not IsMissing(sErr) Then

sErr = .sErr

End If

'If parameter sErr is supplied, then set sErr

If Not IsMissing(sErr) Then

sErr = .sErr

End If

'If parameter iMsgIndex is supplied, then set iMsgIndex

If Not IsMissing(iMsgIndex) Then

iMsgIndex = iIndex

End If

'If parameter sValue is supplied, then set sValue

If Not IsMissing(sValue) Then

sValue = .sValue

End If

Page 127: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

127

'If parameter iMsgIndex is supplied, then set iMsgIndex

If Not IsMissing(iMsgIndex) Then

iMsgIndex = iIndex

End If

Exit For

End If

End With

Next

GetMsg = bRetVal

End Function

'****************************************************************************

'

' GetFreeMsgId

'

' Author : Bronkhorst High-Tech B.V.

' Date : 15-Dec-2003

'

' Function : Function which tries to get a new / free messageId.

' If no free messageId is found, the message will NOT be stored

' in the message buffer. This means the message will not be send.

' Due to the method RemoveMsg() found in flowb32.dll it is not possible

' to have multiple messages in the message buffer with the same

' (Node, Process, Parameter)-combintation.

' Parameters:

' (In) iNode: Node

' iProc: Process

' iParm: Parameter

' (Out) iMsgId: New / free messageId that was assigned to the message

' Returned : 0, if a new / messageId was found for the message

' 1, if the message buffer was full (message NOT added)

' 2, if the message buffer already contained a message with the same

' (Node, Process, Parameter)-combination

Page 128: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

128

' Remarks : The message buffer is sorted on messageId. The lowest messageId comes first.

'

Private Function GetFreeMsgId(ByVal iNode As Integer, ByVal iProc As Integer, _

ByVal iParm As Integer, ByRef iMsgId As Integer) As Integer

Dim iIndex As Integer 'Index in the message buffer

Dim iRetVal As Integer 'Return value

Dim bFound As Boolean 'Boolean which indicates if a free messageId has been found

Const MAX_MESSAGES As Long = 32767 'Maximum number of messages that can be buffered

bFound = False 'No free messageId found so far

iRetVal = 0 'Everything Ok, so far..

'Does message buffer already contain such a message?

If MsgBufContains(iNode, iProc, iParm) Then

iRetVal = 2 'Message buffer already contained a message with iNode, iProc and iParm

End If

'No errors so far?

If iRetVal = 0 Then

'If the local message buffer is not full (there is still place for a message)

If m.lMessages < MAX_MESSAGES Then

'Try iMsgId = 1 as the first free msgId

iMsgId = 1

'Check the msgId of every message in the local buffer

For iIndex = 0 To m.lMessages

'Check if the msgId of the current message is greater than iMsgId, or

'the end of the message buffer has been reached..

If iIndex = m.lMessages Then

'iMsgId is a free message id (a free message id has been found)

bFound = True

Else

If m.udtMessageType_Messages(iIndex).iMsgId > iMsgId Then

'iMsgId is a free message id (a free message id has been found)

Page 129: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

129

bFound = True

End If

End If

'If a free messageId has been found..

If bFound Then

'Increase the size of the message buffer with 1..

ReDim Preserve m.udtMessageType_Messages(m.lMessages + 1)

'Store the new message in the message buffer

m.udtMessageType_Messages(m.lMessages).iMsgId = iMsgId

'Place the new message at the right position in the message buffer (so that the

'message buffer stays sorted)

ExchangeMsgIds m.lMessages, iIndex

'Increase number of messages in the message buffer with 1

m.lMessages = m.lMessages + 1

'Initialize the message..

With m.udtMessageType_Messages(iIndex)

.bAnswered = False

.bytStatus = 0

.iErrVal = 0

.iMsgId = iMsgId

.lNodeProcParm = iNode * (2 ^ 16) + iProc * (2 ^ 8) + iParm

.sErr = ""

.sValue = ""

End With

'Exit loop, because a free msgId has been found

Exit For

Else

'If the msgId of the current message is equal to iMsgId

'(less than is not possible), iMsgId is not a free iMsgId, so increase iMsgId

iMsgId = iMsgId + 1

End If

Next

Else

Page 130: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

130

iRetVal = 1 'Message buffer was full

End If

End If

GetFreeMsgId = iRetVal

End Function

'****************************************************************************

'

' MsgBufContains

'

' Author : Bronkhorst High-Tech B.V.

' Date : 15-Dec-2003

'

' Function : Function which checks if the local message buffer already contains a message for

' the specified (node, process, parameter)-combination. No 2 messages of this

' combination can be in the message buffer at the same time. This is due to the

' function RemoveMsg() found in Flowb32.dll.

' Parameters:

' (In) bytNode: Node

' bytProc: Process

' bytParm: Parameter

' (Out)

' Returned : True if a such a message (specified by the input parameters) exists, False otherwise

' Remarks :

'

Private Function MsgBufContains(ByVal bytNode As Byte, ByVal bytProc As Byte, _

ByVal bytParm As Byte) As Boolean

Dim iIndex As Integer 'Index in the message buffer

Dim bRetVal As Boolean 'Boolean which indicates if the message buffer contains

'such a message

bRetVal = False 'Message not found yet

'Check every message in the local message buffer

For iIndex = 0 To m.lMessages - 1

Page 131: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

131

With m.udtMessageType_Messages(iIndex)

'Node, process and parameter same as values found in current message?

If .lNodeProcParm = (bytNode * (2 ^ 16) + bytProc * (2 ^ 8) + bytParm) Then

'Values same, so message was found

bRetVal = True

Exit For

End If

End With

Next

MsgBufContains = bRetVal

End Function

'****************************************************************************

'

' ExchangeMsgIds

'

' Author : Bronkhorst High-Tech B.V.

' Date : 15-Dec-2003

'

' Function : Function which exchanges 2 messages in the message buffer. The messages will change

' from position in the message buffer, so that the message buffer stays sorted on

' messageId.

' Parameters:

' (In) iMsgIndexA: Position / Index of messageId A in the message buffer

' iMsgIndexB: Position / Index of messageId B in the message buffer

' (Out)

' Returned :

' Remarks : The message buffer is sorted on messageId. The lowest messageId comes first.

' Preconditions: - iMsgIndexA >= 0

' - iMsgIndexA < m.lMessages

' - iMsgIndexB >= 0

' - iMsgIndexB < m.lMessages

'

Page 132: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

132

Private Sub ExchangeMsgIds(ByVal iMsgIndexA As Integer, ByVal iMsgIndexB As Integer)

Dim udtMessageType_Temp As MessageType

'Exchange 2 messages..

'Temp = MessageA

udtMessageType_Temp = m.udtMessageType_Messages(iMsgIndexA)

'MessageA = MessageB

m.udtMessageType_Messages(iMsgIndexA) = m.udtMessageType_Messages(iMsgIndexB)

'MessageB = Temp

m.udtMessageType_Messages(iMsgIndexB) = udtMessageType_Temp

End Sub

'****************************************************************************

'

' GetAnswer

'

' Author : Bronkhorst High-Tech B.V.

' Date : 12-Dec-2003

'

' Function : Function which gets a message from the DLL-queue. Only the first message

' can be popped of the queue (we can NOT start in the middle or at the back)

' Parameters:

' (In)

' (Out) iMsgId: The messageId of the message that was found

' sAnswer: Parameter value extracted from the answer message

' sErrVal: Error string which indicates if an error occured. "", if there where no

' errors (iErrVal and bytStatus are both 0). Otherwise it contains an

' error-string

' iErrVal: Error value, of the error that occured

' bytStatus: Status code of the received message

' Returned : True if a message has been received, False otherwise

' Remarks :

'

Page 133: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

133

Private Function GetAnswer(ByRef iMsgId As Integer, ByRef sAnswer As String, _

ByRef sErrVal As String, ByRef iErrVal As Integer, ByRef bytStatus As Byte) _

As Boolean

On Error GoTo ErrorHandler

Dim bytNode As Byte

Dim bytProc As Byte

Dim bytParm As Byte

Dim bytMsgType As Byte

Dim bytParmType As Byte

Dim bytValue As Byte

Dim iValue As Integer

Dim fValue As Single

Dim lValue As Long

Dim bytStrLen As Byte

Dim bMsgFound As Boolean

bMsgFound = False

sErrVal = ""

iErrVal = 0

'Check if ther is a message in the dll's message buffer

'If so, load our parameters with the values of the messages that was found

iErrVal = modFlowbusAPI.CheckReceivedMsg(cfg.IdApl, bytNode, bytProc, bytParm, bytMsgType, _

bytParmType, iMsgId)

'Did the DLL receive a message?

If iErrVal = 0 Then

bMsgFound = True

'See if an internal error occured...

iErrVal = modFlowbusAPI.GetError()

'No internal error occured?

If iErrVal = 0 Then

'Are we writing a parameter to flowbus (0) or are we reading a parameter from

'flowbus(1)? In both cases we want to know the status of the answer-message

'to know if everything went OK. In case of reading a parameter we ar also

'interested in the parameter-value contained in the message.

Page 134: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

134

If bytMsgType = 0 Or bytMsgType = 1 Then

'iErrVal contains an errorvalue (some internal value or a flobus-status error)

'bytStatus now contains a flowbus-status error.

iErrVal = _

modFlowbusAPI.GetStatus(cfg.IdApl, bytNode, bytProc, bytParm, bytStatus, iMsgId)

'Are we reading a paramater from the flowbus?

If bytMsgType = 1 Then

'According to the comments above, you might think that we could only test on

'iErrVal, because it contains both internal and flowbus-status errors.

'Because I'm not certain of this, I will just test on both variables.

'No error occured?

If iErrVal = 0 And bytStatus = 0 Then

'Extract the parameter-value from the answer-message

Select Case bytParmType

'--------------------------------------------------------------------------

'Is the parameter of type Byte?

Case 0

iErrVal = modFlowbusAPI.GetChar(cfg.IdApl, bytNode, bytProc, bytParm, _

bytValue, iMsgId)

sAnswer = Str(bytValue)

'--------------------------------------------------------------------------

'Is the parameter of type Integer?

Case 1

iErrVal = modFlowbusAPI.GetInt(cfg.IdApl, bytNode, bytProc, bytParm, _

iValue, iMsgId)

sAnswer = Str(iValue)

'--------------------------------------------------------------------------

'Is the parameter of type Float?

Case 2

iErrVal = modFlowbusAPI.GetFloat(cfg.IdApl, bytNode, bytProc, bytParm, _

fValue, iMsgId)

sAnswer = Format$(fValue, "0.00000E+0")

Page 135: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

135

'--------------------------------------------------------------------------

'Is the parameter of type Long?

Case 3

iErrVal = modFlowbusAPI.GetLong(cfg.IdApl, bytNode, bytProc, bytParm, _

lValue, iMsgId)

sAnswer = Str(lValue)

'--------------------------------------------------------------------------

'Is the parameter of type String?

Case 4

'Create a String containing 256 spaces, because of C++.

'If your String contains too few spaces C++ may generate a

'memory error. The String you supply must contain at least as

'many characters as the C++ function will write into your variable.

sAnswer = Space(256)

iErrVal = modFlowbusAPI.GetString(cfg.IdApl, bytNode, bytProc, _

bytParm, iMsgId, sAnswer, bytStrLen)

'Trim the answer, leading and trailing spaces are not interesting.

sAnswer = Trim(sAnswer)

'--------------------------------------------------------------------------

'Parameter type not found??

Case Else

'Set an error..

sErrVal = "Parameter type not found!!"

iErrVal = 12

'--------------------------------------------------------------------------

End Select

'If an error occured while reading the parameter value

If iErrVal <> 0 Then

sErrVal = "Error while reading parameter value"

End If

Else

Page 136: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

136

'The statuscode indicated an error, so set an error..

sErrVal = "Statuscode indicated an error"

End If

End If

Else

'The messagetype was not found, so set an error..

sErrVal = "Message type not found"

End If

Else

'Save the error number in the return-string, so the user can use this value to

'determine the cause

sErrVal = "modFlowbusAPI.GetError() detected an internal error"

End If

'A message was found, remove the message from the queue

modFlowbusAPI.RemoveMsg cfg.IdApl, bytNode, bytProc, bytParm

End If

GetAnswer = bMsgFound

Exit Function

ErrorHandler:

MsgBox "Runtime error: " & Err.Number & " (" & Err.Description & ")"

Resume Next

End Function

'--------------END OF PRIVATE FUNCTIONS AND PROCEDURES---------------------------------------------

'****************************************************************************

'

' HandleErrorMessage

'

' Author : Bronkhorst High-Tech B.V.

' Date : 11-Dec-2003

'

' Function : Function which returns an error message, depending on the error that occured..

' Parameters:

' (In) iErrVal: Error value of the error that occured (This error is received on a

Page 137: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

137

'

' iNode: Node address of the node which caused the error

' iParm: Parameter number of the parameter which caused the error

' (Out)

' Returned :

' Remarks : This Function is not used yet. It is not used because the complete list of error

' codes was not clearly documented. The errorvalue iErrVal which servers as input

' is returned from a call to (GetXXX(), ReadXXX() or WriteXXX())

' XXX = Char | Int | Float | Long | String.

' If you get an error, from which you can not identify the cause, you can take

' a look at the contents of this function..

'

Public Function HandleErrorMessage(ByVal iErrVal As Integer, ByVal iNode As Integer, _

ByVal iParm As Integer) As String

Dim sMessage As String

Dim sAdvise As String

'No error yet..

sMessage = ""

sAdvise = ""

Select Case iErrVal

Case 1:

If iParm <> 189 Then

sMessage = "This process cannot be operated by your PC-application"

sAdvise = "Probably another device will have exclusive operation rights"

End If

Case 2:

sMessage = "No such command possible for this module"

sAdvise = "Command not supported by FLOW-BUS module"

Case 3:

sMessage = "No such process at this module"

sAdvise = "Process not supported by FLOW-BUS module"

Case 4:

sMessage = "No such parameter at this process"

Page 138: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

138

sAdvise = "Parameter not supported by FLOW-BUS module"

Case 5:

sMessage = "Type of parameter sent differs from type on module"

sAdvise = "Check parameter type in parameter list"

Case 6:

sMessage = "Wrong value for this parameter or not accepted"

sAdvise = "Check parameter value range in parameter list or parameter value list"

Case 7:

sMessage = "No communication activity on FLOW-BUS detected"

sAdvise = "First connect and power-up other FLOW-BUS modules or start-up now"

Case 8:

sMessage = "Start character serial communication failed"

sAdvise = "Communication with RS232 interface fails, check connection and port settings"

Case 9:

sMessage = "Serial communication failed"

sAdvise = "Communication with RS232 interface fails, check connection and port settings"

Case 10:

sMessage = "Memory on FLOW-BUS module failed"

sAdvise = "Try to restore original factory settings or contact local supplier for service"

Case 11:

sMessage = "Wrong FLOW-BUS node number"

sAdvise = "Try to re-install this module on the FLOW-BUS"

Case 12:

sMessage = "General communication error with FLOW-BUS (DLL retries expired)"

sAdvise = "Bad connection: check all cabling, network terminations and individual modules"

Case 13:

sMessage = "This parameter value can only be read"

sAdvise = "Check parameter list to see what is allowed"

Case 14:

sMessage = "There is no communication between PC and FLOW-BUS"

sAdvise = "Check settings and connections and open/start communication"

Case 15:

Page 139: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

139

sMessage = "No/bad communication between PC and RS232-interface module"

sAdvise = "Check settings and connections and open/start communication"

Case 16:

sMessage = "Not enough memory in your PC for communication structure"

sAdvise = "Maybe the time has come to look around for a newer type ?"

Case 17:

sMessage = "This parameter value can only be send"

sAdvise = "Check parameter list to see what is allowed"

Case 18:

sMessage = "FLOW-BUS system configuration is unknown"

sAdvise = "(Re)-run 'Read system configuration'-routine"

Case 19:

sMessage = "FLOW-BUS system reached maximum size"

sAdvise = "Check LNA-settings (last node address) of FLOW-BUS modules. When >120 is wanted make new bus-segment"

Case 20:

sMessage = "You need another type of interface for this option"

sAdvise = "There are two types available: RS232 and PC(ISA)"

Case 21:

sMessage = "Error building device control block for serial port"

sAdvise = "Communication with interface fails, check connection and settings"

Case 22:

If iParm = 27 Then

sMessage = "Open communication went wrong"

sAdvise = "Communication with interface fails, check connection and settings"

End If

Case 23:

sMessage = "Communication status error"

sAdvise = "Communication with module fails, check connection and settings"

Case 24:

sMessage = "Interface tries to start communication (alone in system)"

sAdvise = "This is no error; the first module in the system has a special function"

Case 25:

Page 140: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

140

sMessage = "Time out on receiving a message"

sAdvise = "Communication with module fails, check connection and settings"

Case 26:

sMessage = "No ':' on start of message"

sAdvise = "Communication with interface fails, check connection and settings"

Case 27:

sMessage = "Error in first digit"

sAdvise = "Communication with interface fails, check connection and settings"

Case 28:

sMessage = "Buffer overflow in interface module"

sAdvise = "Communication with interface fails, check connection and settings"

Case 29:

sMessage = "Buffer overflow in FLOWBUS.DLL"

sAdvise = "There are too many messages from applications to the DLL, wait until all messages are handled, then proceed"

Case 30:

sMessage = "Requested answer not found"

sAdvise = "Communication with FLOWBUS.DLL fails, check connection and settings"

Case 31:

sMessage = "Closing communication error"

sAdvise = "It's not possible to stop communication correctly. Maybe you have to reset PC or FLOW-BUS modules."

Case 32:

sMessage = "Other application performs action"

sAdvise = "The FLOWBUS.DLL is still in use by another application or not correctly closed and still in memory (restart PC)"

Case 33:

sMessage = "Requested message has not been send"

sAdvise = "Communication with FLOWBUS.DLL fails, check connection and settings"

Case 34:

sMessage = "Error in received data"

sAdvise = "Communication with FLOWBUS.DLL fails, check connection and settings"

Case 35:

sMessage = "No event present in real-time channel on interface module"

sAdvise = "Try reading again; check real-time initialization settings when problem remains"

Page 141: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

141

Case 36:

sMessage = "Module not available on FLOWBUS"

sAdvise = "Probably module is temporarily disconnected from the bus for service purposes"

Case 37:

sMessage = "FLOWDDE not ready to communicate with FLOWBUS"

sAdvise = "Communication with FLOW-BUS has to be started correctly first."

Case 38:

sMessage = "Parameter not correctly in FLOWDDE database"

sAdvise = "Check variable type of parameter and if you have a correct version of FLOWDDE"

Case 39:

sMessage = "Requested parameter value not received"

sAdvise = "Check settings, connections and module where request failed"

Case 40:

sMessage = "There are too many messages to be handled in the DLL"

sAdvise = "Wait until all messages are handled, then proceed"

Case 41:

sMessage = "There are some unhandled/unremoved messages in the DLL"

sAdvise = "This is a serious error, restart FLOWDDE"

Case 42:

sMessage = "Buffer overflow in FLOW-BUS module"

sAdvise = "There are too many messages for this module to handle in the time available"

Case Else:

sMessage = "Unknown error occured"

sAdvise = "When this happens more frequently, contact your local sales/service representative"

End Select

HandleErrorMessage = sMessage & Chr(10) & sAdvise

End Function

3.2.4. API para Tarjeta de Adquisición de Datos (nidaq32.bas)

'***************************************************************************

'*

'* NI-DAQ Windows - Function Prototypes for Visual Basic

Page 142: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

142

'* Copyright (C) National Instruments 1995.

'*

'**************************************************************************

Declare Function AI_Change_Parameter% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c&, ByVal d&)

Declare Function AI_Check% Lib "nidaq32.dll" (ByVal a%, b%, c%)

Declare Function AI_Clear% Lib "nidaq32.dll" (ByVal a%)

Declare Function AI_Configure% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, ByVal f%)

Declare Function AI_Mux_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%)

Declare Function AI_Read% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, d%)

Declare Function AI_Read32% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, d&)

Declare Function AI_Setup% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%)

Declare Function AI_VRead% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, d#)

Declare Function AI_VScale% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d#, ByVal e#, ByVal f%, g#)

Declare Function Align_DMA_Buffer% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c As Any, ByVal d&, ByVal e&, f&)

Declare Function AO_Calibrate% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%)

Declare Function AO_Configure% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e#, ByVal f%)

Declare Function AO_Change_Parameter% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c&, ByVal d&)

Declare Function AO_Update% Lib "nidaq32.dll" (ByVal a%)

Declare Function AO_VWrite% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c#)

Declare Function AO_Write% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%)

Declare Function Calibrate_E_Series% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&, ByVal d#)

Declare Function Calibrate_59xx% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c#)

Declare Function Calibrate_DSA% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c#)

Declare Function Config_Alarm_Deadband% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c$, ByVal d#, ByVal e#, ByVal f%, ByVal g%, ByVal h%, ByVal i&)

Declare Function Config_ATrig_Event_Message% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c$, ByVal d#, ByVal e#, ByVal f%, ByVal g&, ByVal h&, ByVal i&, ByVal j%, ByVal k%, ByVal l&)

Page 143: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

143

Declare Function Config_DAQ_Event_Message% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c$, ByVal d%, ByVal e&, ByVal f&, ByVal g&, ByVal h&, ByVal i&, ByVal j%, ByVal k%, ByVal l&)

Declare Function Configure_HW_Analog_Trigger% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&, ByVal d&, ByVal e&, ByVal f&)

Declare Function CTR_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, ByVal f%)

Declare Function CTR_EvCount% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%)

Declare Function CTR_EvRead% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, d%)

Declare Function CTR_FOUT_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%)

Declare Function CTR_Period% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%)

Declare Function CTR_Pulse% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%)

Declare Function CTR_Rate% Lib "nidaq32.dll" (ByVal a#, ByVal b#, c%, d%, e%)

Declare Function CTR_Reset% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%)

Declare Function CTR_Restart% Lib "nidaq32.dll" (ByVal a%, ByVal b%)

Declare Function CTR_Simul_Op% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, ByVal d%)

Declare Function CTR_Square% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%)

Declare Function CTR_State% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%)

Declare Function CTR_Stop% Lib "nidaq32.dll" (ByVal a%, ByVal b%)

Declare Function DAQ_Check% Lib "nidaq32.dll" (ByVal a%, b%, c&)

Declare Function DAQ_Clear% Lib "nidaq32.dll" (ByVal a%)

Declare Function DAQ_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%)

Declare Function DAQ_DB_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%)

Declare Function DAQ_DB_HalfReady% Lib "nidaq32.dll" (ByVal a%, b%, c%)

Declare Function DAQ_DB_Transfer% Lib "nidaq32.dll" (ByVal a%, b As Any, c&, d%)

Declare Function DAQ_Monitor% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d&, e As Any, f&, g%)

Declare Function DAQ_Op% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, d As Any, ByVal e&, ByVal f#)

Declare Function DAQ_Rate% Lib "nidaq32.dll" (ByVal a#, ByVal b%, c%, d%)

Declare Function DAQ_Start% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, d As Any, ByVal e&, ByVal f%, ByVal g%)

Declare Function DAQ_StopTrigger_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c&)

Declare Function DAQ_to_Disk% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d$, ByVal e&, ByVal f#, ByVal g%)

Page 144: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

144

Declare Function DAQ_VScale% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d#, ByVal e#, ByVal f&, g%, h#)

Declare Function DIG_Block_Check% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c&)

Declare Function DIG_Block_Clear% Lib "nidaq32.dll" (ByVal a%, ByVal b%)

Declare Function DIG_Block_In% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c As Any, ByVal d&)

Declare Function DIG_Block_Out% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c As Any, ByVal d&)

Declare Function DIG_Block_PG_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, ByVal f%, ByVal g%)

Declare Function DIG_DB_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%)

Declare Function DIG_DB_HalfReady% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%)

Declare Function DIG_DB_Transfer% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c As Any, ByVal d&)

Declare Function DIG_Grp_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%)

Declare Function DIG_Grp_Mode% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, ByVal f%, ByVal g%)

Declare Function DIG_Grp_Status% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%)

Declare Function DIG_In_Grp% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%)

Declare Function DIG_In_Line% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, d%)

Declare Function Query_Optimizations_GFS% Lib "nidaq32.dll" (ByVal a%)

Declare Function DIG_In_Port_GFS% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%)

Declare Function DIG_In_Port% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%)

Declare Function DIG_Line_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%)

Declare Function DIG_Out_Grp% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%)

Declare Function DIG_Out_Line% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%)

Declare Function DIG_Out_Port_GFS% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%)

Declare Function DIG_Out_Port% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%)

Declare Function DIG_Prt_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%)

Declare Function DIG_Prt_Status% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%)

Declare Function DIG_SCAN_Setup% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, d%, ByVal e%)

Declare Function Get_DAQ_Device_Info% Lib "nidaq32.dll" (ByVal a%, ByVal b&, c&)

Page 145: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

145

Declare Function Get_DAQ_Event% Lib "nidaq32.dll" (ByVal a&, b%, c%, d%, e&)

Declare Function Get_NI_DAQ_Version% Lib "nidaq32.dll" (a&)

Declare Function GPCTR_Config_Buffer% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&, ByVal d&, e As Any)

Declare Function GPCTR_Read_Buffer% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&, ByVal d&, ByVal e&, ByVal f#, g&, h&)

Declare Function Line_Change_Attribute% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&, ByVal d&)

Declare Function GPCTR_Control% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&)

Declare Function GPCTR_Set_Application% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&)

Declare Function GPCTR_Watch% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&, d&)

Declare Function ICTR_Read% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%)

Declare Function ICTR_Reset% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%)

Declare Function ICTR_Setup% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%)

Declare Function Init_DA_Brds% Lib "nidaq32.dll" (ByVal a%, b%)

Declare Function Lab_ISCAN_Check% Lib "nidaq32.dll" (ByVal a%, b%, c&, d%)

Declare Function Lab_ISCAN_Op% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, d As Any, ByVal e&, ByVal f#, ByVal g#, h%)

Declare Function Lab_ISCAN_Start% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, d As Any, ByVal e&, ByVal f%, ByVal g%, ByVal h%)

Declare Function Lab_ISCAN_to_Disk% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d$, ByVal e&, ByVal f#, ByVal g#, ByVal h%)

Declare Function LPM16_Calibrate% Lib "nidaq32.dll" (ByVal a%)

Declare Function MIO_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%)

Declare Function Peek_DAQ_Event% Lib "nidaq32.dll" (ByVal a&, b%, c%, d%, e&)

Declare Function REG_Level_Read% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c&)

Declare Function REG_Level_Write% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c&, ByVal d&, e&)

Declare Function RTSI_Clear% Lib "nidaq32.dll" (ByVal a%)

Declare Function RTSI_Clock% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%)

Declare Function RTSI_Conn% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%)

Declare Function RTSI_DisConn% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%)

Declare Function SC_2040_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%)

Page 146: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

146

Declare Function SCAN_Demux% Lib "nidaq32.dll" (a%, ByVal b&, ByVal c%, ByVal d%)

Declare Function SCAN_Op% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, d%, e As Any, ByVal f&, ByVal g#, ByVal h#)

Declare Function SCAN_Sequence_Demux% Lib "nidaq32.dll" (ByVal a%, b%, ByVal c&, d%, ByVal e%, f%, g&)

Declare Function SCAN_Sequence_Retrieve% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%)

Declare Function SCAN_Sequence_Setup% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, d%, e%, f%, g%)

Declare Function SCAN_Setup% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, d%)

Declare Function SCAN_Start% Lib "nidaq32.dll" (ByVal a%, b As Any, ByVal c&, ByVal d%, ByVal e%, ByVal f%, ByVal g%)

Declare Function SCAN_to_Disk% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, d%, ByVal e$, ByVal f&, ByVal g#, ByVal h#, ByVal i%)

Declare Function Calibrate_1200% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, ByVal f%, ByVal g%, ByVal h%, ByVal i#, ByVal j#)

Declare Function SCXI_AO_Write% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, ByVal f#, ByVal g%, h%)

Declare Function SCXI_Cal_Constants% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, ByVal f%, ByVal g#, ByVal h%, ByVal i%, ByVal j%, ByVal k#, ByVal l#, ByVal m#, ByVal n#, ByVal o#, p#, q#)

Declare Function InitChannelWizardStrainCal% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e!, ByVal f!, g#, h%, i%, ByVal j!, ByVal k%)

Declare Function ChannelWizardSCXIStrainCal% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, ByVal f#, ByVal g%, ByVal h$, ByVal i$, j#, k#, l#)

Declare Function SCXI_1520_Transducer_Cal% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d#, ByVal e%, ByVal f%)

Declare Function SCXI_Calibrate% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, ByVal f#, ByVal g#, ByVal h%, ByVal i%)

Declare Function SCXI_Strain_Null% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, f!)

Declare Function SCXI_Strain_Null_Ex% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, f!, ByVal g!, ByVal h&, i%, j%)

Declare Function SCXI_Calibrate_Setup% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%)

Declare Function SCXI_Change_Chan% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%)

Declare Function SCXI_Set_Potentiometer% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e$)

Declare Function SCXI_Set_Excitation% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e!, f!)

Declare Function SCXI_Configure_Connection% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%)

Declare Function SCXI_Configure_Filter% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e#, ByVal f%, ByVal g%, h#)

Page 147: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

147

Declare Function SCXI_Get_Chassis_Info% Lib "nidaq32.dll" (ByVal a%, b%, c%, d%, e%, f%)

Declare Function SCXI_Get_Module_Info% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c&, d%, e%)

Declare Function SCXI_Get_State% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, e&)

Declare Function SCXI_Get_Status% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, d&)

Declare Function SCXI_Load_Config% Lib "nidaq32.dll" (ByVal a%)

Declare Function SCXI_MuxCtr_Setup% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%)

Declare Function SCXI_Reset% Lib "nidaq32.dll" (ByVal a%, ByVal b%)

Declare Function SCXI_Scale% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d#, ByVal e#, ByVal f%, ByVal g%, ByVal h%, ByVal i&, j%, k#)

Declare Function SCXI_SCAN_Setup% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, d%, e%, ByVal f%, ByVal g%)

Declare Function SCXI_Set_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, ByVal f%, g&, h%, i%)

Declare Function SCXI_Set_Gain% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d#)

Declare Function SCXI_Set_Input_Mode% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%)

Declare Function SCXI_Set_State% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e&)

Declare Function SCXI_Single_Chan_Setup% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%)

Declare Function SCXI_Track_Hold_Control% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%)

Declare Function SCXI_Track_Hold_Setup% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, ByVal f%, ByVal g%)

Declare Function Select_Signal% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&, ByVal d&)

Declare Function Set_DAQ_Device_Info% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&)

Declare Function Timeout_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b&)

Declare Function WFM_Chan_Control% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%)

Declare Function WFM_Check% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, d&, e&)

Declare Function WFM_ClockRate% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e&, ByVal f%)

Declare Function WFM_DB_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, ByVal d%, ByVal e%, ByVal f%)

Declare Function WFM_DB_HalfReady% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, d%)

Declare Function WFM_DB_Transfer% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, d As Any, ByVal e&)

Page 148: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

148

Declare Function WFM_from_Disk% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, ByVal d$, ByVal e&, ByVal f&, ByVal g&, ByVal h#)

Declare Function WFM_Group_Control% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%)

Declare Function WFM_Group_Setup% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, ByVal d%)

Declare Function WFM_Load% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, d As Any, ByVal e&, ByVal f&, ByVal g%)

Declare Function WFM_Op% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, d As Any, ByVal e&, ByVal f&, ByVal g#)

Declare Function WFM_Rate% Lib "nidaq32.dll" (ByVal a#, ByVal b%, c%, d&)

Declare Function WFM_Scale% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c&, ByVal d#, e#, f%)

Declare Function AI_Read_Scan% Lib "nidaq32.dll" (ByVal a%, b%)

Declare Function AI_VRead_Scan% Lib "nidaq32.dll" (ByVal a%, b#)

Declare Function SCXI_ModuleID_Read% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c&)

Declare Function AO_VScale% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c#, d%)

Declare Function GPCTR_Change_Parameter% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&, ByVal d&)

Declare Function USE_MIO% Lib "nidaq32.dll" ()

Declare Function USE_LPM% Lib "nidaq32.dll" ()

Declare Function USE_LAB% Lib "nidaq32.dll" ()

Declare Function USE_DIO_96% Lib "nidaq32.dll" ()

Declare Function USE_DIO_32F% Lib "nidaq32.dll" ()

Declare Function USE_DIO_24% Lib "nidaq32.dll" ()

Declare Function USE_AO_610% Lib "nidaq32.dll" ()

Declare Function USE_AO_2DC% Lib "nidaq32.dll" ()

Declare Function DIG_Trigger_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, ByVal f%, ByVal g&, ByVal h&, ByVal i&)

Declare Function SCXI_Set_Threshold% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d#, ByVal e#)

Declare Function WFM_Set_Clock% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c&, ByVal d#, ByVal e&, f#)

Declare Function DAQ_Set_Clock% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c#, ByVal d&, e#)

Declare Function Tio_Select_Signal% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&, ByVal d&)

Declare Function Tio_Combine_Signals% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&)

Declare Function DIG_In_Prt% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c&)

Declare Function DIG_Out_Prt% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c&)

Declare Function AI_Get_Overloaded_Channels% Lib "nidaq32.dll" (ByVal a%, b%, c%)

Page 149: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

149

Declare Function Calibrate_TIO% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&, ByVal d#)

Declare Function DIG_Change_Message_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c$, ByVal d$, ByVal e%, ByVal f%, ByVal g&)

Declare Function DIG_Change_Message_Control% Lib "nidaq32.dll" (ByVal a%, ByVal b%)

Declare Function DIG_Filter_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c$, ByVal d#)

Declare Function SCXI_TerminalBlockID_Read% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c&)

Declare Function ni62xx_CalStart% Lib "nidaq32.dll" (ByVal a%, ByVal b$)

Declare Function ni62xx_CalAdjust% Lib "nidaq32.dll" (ByVal a%, ByVal b&, c#, ByVal d%)

Declare Function ni62xx_CalEnd% Lib "nidaq32.dll" (ByVal a%, ByVal b&)

Declare Function ni62xx_SelfCalibrate% Lib "nidaq32.dll" (ByVal a%)

Declare Function CalFetchInternalReference% Lib "nidaq32.dll" (ByVal a%, b#)

Declare Function CalChangePassword% Lib "nidaq32.dll" (ByVal a%, ByVal b$, ByVal c$)

Declare Function CalFetchCount% Lib "nidaq32.dll" (ByVal a%, ByVal b&, c&)

Declare Function CalFetchDate% Lib "nidaq32.dll" (ByVal a%, ByVal b&, c&, d&, e&)

Declare Function CalFetchTemperature% Lib "nidaq32.dll" (ByVal a%, ByVal b&, c#)

Declare Function CalFetchMiscInfo% Lib "nidaq32.dll" (ByVal a%, ByVal b$)

Declare Function CalStoreMiscInfo% Lib "nidaq32.dll" (ByVal a%, ByVal b$)

3.2.5. Funciones Sobre la API (nidex32.bas)

'************************************************************************

'* TITLE: NIDEx32.bas

'* Header for supporting code module for NI-DAQ Examples

'* (32-bit Visual Basic version)

'*

'* DESCR: This header file is to be used with any NI-DAQ example

'* program.

'*

'* Copyright (c) 1997, National Instruments Corp. All rights reserved.

'************************************************************************/

' NOTE: must also use nidaq32.bas

' and nidaqcns.bas

Page 150: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

150

'*

'* Constants

'*

'* for 'lType'

Global Const WFM_DATA_U8 = 0

Global Const WFM_DATA_I16 = 2

Global Const WFM_DATA_F64 = 4

Global Const WFM_DATA_U32 = 7

'* internal constants - change if needed...

Global Const WFM_PERIODS = 10

Global Const WFM_MIN_PTS_IN_PERIOD = 2

Global Const WFM_U8_MODULO = 256

Global Const WFM_I16_AMPL = 2047

Global Const WFM_F64_AMPL = 4.99

'* error return codes for NIDAQPlotWaveform and NIDAQMakeBuffer

'* these error codes are consistent with CVI error codes

Global Const NIDAQEX_INVALID_BUFFER = -12

Global Const NIDAQEX_INVALID_NUMPTS = -14

Global Const NIDAQEX_INVALID_TYPE = -53

'*

'* Function prototypes

'*

Declare Function NIDAQPlotWaveform Lib "nidex32.dll" (pvBuffer As Any, ByVal lNumPts&, ByVal lType&) As Integer

Declare Function NIDAQMakeBuffer Lib "nidex32.dll" (pvBuffer As Any, ByVal lNumPts&, ByVal lType&) As Integer

Declare Function NIDAQErrorHandler Lib "nidex32.dll" (ByVal iStatus%, ByVal strFuncName$, ByVal iIgnoreWarning%) As Integer

Declare Function NIDAQDelay Lib "nidex32.dll" (ByVal dSec#) As Integer

Declare Function NIDAQYield Lib "nidex32.dll" (ByVal iYieldMode%) As Integer

Declare Function NIDAQMean Lib "nidex32.dll" (pvBuffer As Any, ByVal lNumPts&, ByVal lType&, dMean#) As Integer

Declare Function NIDAQWaitForKey Lib "nidex32.dll" (ByVal dTimeLimit#) As Integer

Page 151: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

151

3.2.6. Módulo de constantes para la API de la Adq. de datos(nidaqcns.inc)

'*********************************************************************'

'* *'

'* This file contains definitions for constants required for some *'

'* of the NI-DAQ functions. *'

'* *'

'* You should use symbols defined here in your programs; do not *'

'* use the numerical values. *'

'* *'

'* See your NI-DAQ Function Reference Manual for details concerning *'

'* use of constants defined here. *'

'* *'

'*********************************************************************'

Global Const ND_ABOVE_HIGH_LEVEL& = 11020

Global Const ND_ABOVE_LEVEL_A& = 11021

Global Const ND_ABOVE_LEVEL_A_HYSTERESIS& = 11022

Global Const ND_AC& = 11025

Global Const ND_ACK_REQ_EXCHANGE_GR1& = 11030

Global Const ND_ACK_REQ_EXCHANGE_GR2& = 11035

Global Const ND_ACTIVE& = 11037

Global Const ND_ADC_RESOLUTION& = 11040

Global Const ND_AI_CALDAC_COUNT& = 11050

Global Const ND_AI_CHANNEL_COUNT& = 11060

Global Const ND_AI_COUPLING& = 11055

Global Const ND_AI_FIFO_INTERRUPTS& = 11600

Global Const ND_ANALOG_FILTER& = 11065

Global Const ND_AO48XDC_SET_POWERUP_STATE& = 42100

Global Const ND_AO_CALDAC_COUNT& = 11070

Global Const ND_AO_CHANNEL_COUNT& = 11080

Global Const ND_AO_EXT_REF_CAPABLE& = 11090

Global Const ND_AO_UNIPOLAR_CAPABLE& = 11095

Global Const ND_ARM& = 11100

Global Const ND_ARMED& = 11200

Global Const ND_ATC_OUT& = 11250

Global Const ND_ATTENUATION& = 11260

Global Const ND_AUTOINCREMENT_COUNT& = 11300

Global Const ND_AUTOMATIC& = 11400

Global Const ND_AVAILABLE_POINTS& = 11500

Global Const ND_BASE_ADDRESS& = 12100

Page 152: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

152

Global Const ND_BELOW_LEVEL_A& = 12110

Global Const ND_BELOW_LEVEL_A_HYSTERESIS& = 12115

Global Const ND_BELOW_LOW_LEVEL& = 12130

Global Const ND_BETWEEN_LEVEL_A_LEVEL_B& = 12135

Global Const ND_BOARD_CLOCK& = 12170

Global Const ND_BUFFERED_EVENT_CNT& = 12200

Global Const ND_BUFFERED_PERIOD_MSR& = 12300

Global Const ND_BUFFERED_PULSE_WIDTH_MSR& = 12400

Global Const ND_BUFFERED_SEMI_PERIOD_MSR& = 12500

Global Const ND_BURST& = 12600

Global Const ND_BURST_INTERVAL& = 12700

Global Const ND_CAL_CONST_AUTO_LOAD& = 13050

Global Const ND_CALIBRATION_ENABLE& = 13055

Global Const ND_CALIBRATION_FRAME_SIZE& = 13060

Global Const ND_CALIBRATION_FRAME_PTR& = 13065

Global Const ND_CJ_TEMP% = &H8000

Global Const ND_CALGND% = &H8001

Global Const ND_P_POS_0% = &H4000

Global Const ND_P_POS_1% = &H4001

Global Const ND_P_POS_2% = &H4002

Global Const ND_P_POS_3% = &H4003

Global Const ND_P_POS_4% = &H4004

Global Const ND_P_POS_5% = &H4005

Global Const ND_P_POS_6% = &H4006

Global Const ND_P_POS_7% = &H4007

Global Const ND_P_NEG_0% = &H2000

Global Const ND_P_NEG_1% = &H2001

Global Const ND_P_NEG_2% = &H2002

Global Const ND_P_NEG_3% = &H2003

Global Const ND_P_NEG_4% = &H2004

Global Const ND_P_NEG_5% = &H2005

Global Const ND_P_NEG_6% = &H2006

Global Const ND_P_NEG_7% = &H2007

Global Const ND_CLEAN_UP& = 13100

Global Const ND_CLOCK_REVERSE_MODE_GR1& = 13120

Global Const ND_CLOCK_REVERSE_MODE_GR2& = 13130

Global Const ND_CONFIG_MEMORY_SIZE& = 13150

Global Const ND_CONTINUOUS& = 13160

Global Const ND_COUNT& = 13200

Page 153: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

153

Global Const ND_COUNTER_0& = 13300

Global Const ND_COUNTER_1& = 13400

Global Const ND_COUNTER_2& = 13310

Global Const ND_COUNTER_3& = 13320

Global Const ND_COUNTER_4& = 13330

Global Const ND_COUNTER_5& = 13340

Global Const ND_COUNTER_6& = 13350

Global Const ND_COUNTER_7& = 13360

Global Const ND_COUNTER_1_SOURCE& = 13430

Global Const ND_COUNT_AVAILABLE& = 13450

Global Const ND_COUNT_DOWN& = 13465

Global Const ND_COUNT_UP& = 13485

Global Const ND_COUNT_1& = 13500

Global Const ND_COUNT_2& = 13600

Global Const ND_COUNT_3& = 13700

Global Const ND_COUNT_4& = 13800

Global Const ND_CURRENT_OUTPUT& = 40200

Global Const ND_DAC_RESOLUTION& = 13950

Global Const ND_DATA_TRANSFER_CONDITION& = 13960

Global Const ND_DATA_XFER_MODE_AI& = 14000

Global Const ND_DATA_XFER_MODE_AO_GR1& = 14100

Global Const ND_DATA_XFER_MODE_AO_GR2& = 14200

Global Const ND_DATA_XFER_MODE_DIO_GR1& = 14300

Global Const ND_DATA_XFER_MODE_DIO_GR2& = 14400

Global Const ND_DATA_XFER_MODE_DIO_GR3& = 14500

Global Const ND_DATA_XFER_MODE_DIO_GR4& = 14600

Global Const ND_DATA_XFER_MODE_DIO_GR5& = 14700

Global Const ND_DATA_XFER_MODE_DIO_GR6& = 14800

Global Const ND_DATA_XFER_MODE_DIO_GR7& = 14900

Global Const ND_DATA_XFER_MODE_DIO_GR8& = 15000

Global Const ND_DATA_XFER_MODE_GPCTR0& = 15100

Global Const ND_DATA_XFER_MODE_GPCTR1& = 15200

Global Const ND_DATA_XFER_MODE_GPCTR2& = 15110

Global Const ND_DATA_XFER_MODE_GPCTR3& = 15120

Global Const ND_DATA_XFER_MODE_GPCTR4& = 15130

Global Const ND_DATA_XFER_MODE_GPCTR5& = 15140

Page 154: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

154

Global Const ND_DATA_XFER_MODE_GPCTR6& = 15150

Global Const ND_DATA_XFER_MODE_GPCTR7& = 15160

Global Const ND_DATA_XFER_MODE_GPCTR8& = 15165

Global Const ND_DATA_XFER_MODE_GPCTR9& = 15170

Global Const ND_DATA_XFER_MODE_GPCTR10& = 15175

Global Const ND_DATA_XFER_MODE_GPCTR11& = 15180

Global Const ND_DC& = 15250

Global Const ND_DDS_BUFFER_SIZE& = 15255

Global Const ND_DEVICE_NAME& = 15260

Global Const ND_DEVICE_POWER& = 15270

Global Const ND_DEVICE_SERIAL_NUMBER& = 15280

Global Const ND_DEVICE_STATE_DURING_SUSPEND_MODE& = 15290

Global Const ND_DEVICE_TYPE_CODE& = 15300

Global Const ND_DIGITAL_FILTER& = 15350

Global Const ND_DIGITAL_RESTART& = 15375

Global Const ND_DIO128_GET_PORT_THRESHOLD& = 41200

Global Const ND_DIO128_SELECT_INPUT_PORT& = 41100

Global Const ND_DIO128_SET_PORT_THRESHOLD& = 41300

Global Const ND_DISABLED& = 15400

Global Const ND_DISARM& = 15450

Global Const ND_DIVIDE_DOWN_SAMPLING_SUPPORTED& = 15475

Global Const ND_DMA_A_LEVEL& = 15500

Global Const ND_DMA_B_LEVEL& = 15600

Global Const ND_DMA_C_LEVEL& = 15700

Global Const ND_DONE& = 15800

Global Const ND_DONT_CARE& = 15900

Global Const ND_DONT_KNOW& = 15950

Global Const ND_EDGE_SENSITIVE& = 16000

Global Const ND_ENABLED& = 16050

Global Const ND_END& = 16055

Global Const ND_EXTERNAL& = 16060

Global Const ND_EXTERNAL_CALIBRATE& = 16100

Global Const ND_FACTORY_CALIBRATION_EQUIP& = 16210

Global Const ND_FACTORY_EEPROM_AREA& = 16220

Global Const ND_FIFO_EMPTY& = 16230

Global Const ND_FIFO_HALF_FULL_OR_LESS& = 16240

Global Const ND_FIFO_HALF_FULL_OR_LESS_UNTIL_FULL& = 16245

Page 155: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

155

Global Const ND_FIFO_NOT_FULL& = 16250

Global Const ND_FIFO_TRANSFER_COUNT& = 16260

Global Const ND_FILTER_CORRECTION_FREQ& = 16300

Global Const ND_FOREGROUND& = 16350

Global Const ND_FREQ_OUT& = 16400

Global Const ND_FSK& = 16500

Global Const ND_EDGE_BASED_FSK& = 16500

Global Const ND_GATE& = 17100

Global Const ND_GATE_POLARITY& = 17200

Global Const ND_GPCTR0_GATE& = 17300

Global Const ND_GPCTR0_OUTPUT& = 17400

Global Const ND_GPCTR0_SOURCE& = 17500

Global Const ND_GPCTR1_GATE& = 17600

Global Const ND_GPCTR1_OUTPUT& = 17700

Global Const ND_GPCTR1_SOURCE& = 17800

Global Const ND_GPCTR2_GATE& = 17320

Global Const ND_GPCTR2_OUTPUT& = 17420

Global Const ND_GPCTR2_SOURCE& = 17520

Global Const ND_GPCTR3_GATE& = 17330

Global Const ND_GPCTR3_OUTPUT& = 17430

Global Const ND_GPCTR3_SOURCE& = 17530

Global Const ND_GPCTR4_GATE& = 17340

Global Const ND_GPCTR4_OUTPUT& = 17440

Global Const ND_GPCTR4_SOURCE& = 17540

Global Const ND_GPCTR5_GATE& = 17350

Global Const ND_GPCTR5_OUTPUT& = 17450

Global Const ND_GPCTR5_SOURCE& = 17550

Global Const ND_GPCTR6_GATE& = 17360

Global Const ND_GPCTR6_OUTPUT& = 17460

Global Const ND_GPCTR6_SOURCE& = 17660

Global Const ND_GPCTR7_GATE& = 17370

Page 156: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

156

Global Const ND_GPCTR7_OUTPUT& = 17470

Global Const ND_GPCTR7_SOURCE& = 17570

Global Const ND_GROUND_DAC_REFERENCE& = 17900

Global Const ND_HARDWARE& = 18000

Global Const ND_HI_RES_SAMPLING& = 18020

Global Const ND_HIGH& = 18050

Global Const ND_HIGH_HYSTERESIS& = 18080

Global Const ND_HIGH_TO_LOW& = 18100

Global Const ND_HW_ANALOG_TRIGGER& = 18900

Global Const ND_IMPEDANCE& = 19000

Global Const ND_INACTIVE& = 19010

Global Const ND_INITIAL_COUNT& = 19100

Global Const ND_INIT_PLUGPLAY_DEVICES& = 19110

Global Const ND_INSIDE_REGION& = 19150

Global Const ND_INTERNAL& = 19160

Global Const ND_INTERNAL_100_KHZ& = 19200

Global Const ND_INTERNAL_10_MHZ& = 19300

Global Const ND_INTERNAL_1250_KHZ& = 19320

Global Const ND_INTERNAL_20_MHZ& = 19400

Global Const ND_INTERNAL_25_MHZ& = 19410

Global Const ND_INTERNAL_2500_KHZ& = 19420

Global Const ND_INTERNAL_5_MHZ& = 19450

Global Const ND_INTERNAL_7160_KHZ& = 19460

Global Const ND_INTERNAL_TIMER& = 19500

Global Const ND_INTERRUPTS& = 19600

Global Const ND_INTERRUPT_A_LEVEL& = 19700

Global Const ND_INTERRUPT_B_LEVEL& = 19800

Global Const ND_INTERRUPT_TRIGGER_MODE& = 19850

Global Const ND_IN_CHANNEL_CLOCK_TIMEBASE& = 19900

Global Const ND_IN_CHANNEL_CLOCK_TB_POL& = 20000

Global Const ND_IN_CONVERT& = 20100

Global Const ND_IN_CONVERT_POL& = 20200

Global Const ND_IN_DATA_FIFO_SIZE& = 20250

Page 157: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

157

Global Const ND_IN_EXTERNAL_GATE& = 20300

Global Const ND_IN_EXTERNAL_GATE_POL& = 20400

Global Const ND_IN_SCAN_CLOCK_TIMEBASE& = 20500

Global Const ND_IN_SCAN_CLOCK_TB_POL& = 20600

Global Const ND_IN_SCAN_IN_PROG& = 20650

Global Const ND_IN_SCAN_START& = 20700

Global Const ND_IN_SCAN_START_POL& = 20800

Global Const ND_IN_START_TRIGGER& = 20900

Global Const ND_IN_START_TRIGGER_POL& = 21000

Global Const ND_IN_STOP_TRIGGER& = 21100

Global Const ND_IN_STOP_TRIGGER_POL& = 21200

Global Const ND_INT_AI_GND& = 21210

Global Const ND_INT_AO_CH_0& = 21230

Global Const ND_INT_AO_CH_0_VS_REF_5V& = 21235

Global Const ND_INT_AO_CH_1& = 21240

Global Const ND_INT_AO_CH_1_VS_AO_CH_0& = 21245

Global Const ND_INT_AO_CH_1_VS_REF_5V& = 21250

Global Const ND_INT_AO_CH_2& = 21220

Global Const ND_INT_AO_CH_3& = 21221

Global Const ND_INT_AO_CH_4& = 21222

Global Const ND_INT_AO_CH_5& = 21223

Global Const ND_INT_AO_CH_6& = 21224

Global Const ND_INT_AO_CH_7& = 21225

Global Const ND_INT_AO_GND& = 21260

Global Const ND_INT_AO_GND_VS_AI_GND& = 21265

Global Const ND_INT_CM_REF_5V& = 21270

Global Const ND_INT_DEV_TEMP& = 21280

Global Const ND_INT_REF_5V& = 21290

Global Const ND_INT_REF_EXTERN& = 21296

Global Const ND_INT_CAL_BUS& = 21295

Global Const ND_INT_MUX_BUS& = 21305

Global Const ND_INT_AI_GND_AMP_0& = 21211

Global Const ND_INT_AI_GND_AMP_1& = 21212

Global Const ND_INT_AI_GND_AMP_2& = 21213

Global Const ND_INT_AI_GND_AMP_3& = 21214

Global Const ND_INT_AI_GND_AMP_4& = 21215

Global Const ND_INT_AI_GND_AMP_5& = 21216

Global Const ND_INT_AI_GND_AMP_6& = 21217

Global Const ND_INT_AI_GND_AMP_7& = 21218

Page 158: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

158

Global Const ND_INT_AO_CH_0_AMP_0& = 21231

Global Const ND_INT_AO_CH_0_AMP_1& = 21232

Global Const ND_INT_AO_CH_0_AMP_2& = 21233

Global Const ND_INT_AO_CH_0_AMP_3& = 21234

Global Const ND_INT_AO_CH_1_AMP_0& = 21241

Global Const ND_INT_AO_CH_1_AMP_1& = 21242

Global Const ND_INT_AO_CH_1_AMP_2& = 21243

Global Const ND_INT_AO_CH_1_AMP_3& = 21244

Global Const ND_INT_AO_CH_0_VS_REF_AMP_0& = 21236

Global Const ND_INT_AO_CH_0_VS_REF_AMP_1& = 21237

Global Const ND_INT_AO_CH_0_VS_REF_AMP_2& = 21238

Global Const ND_INT_AO_CH_0_VS_REF_AMP_3& = 21239

Global Const ND_INT_AO_CH_1_VS_REF_AMP_0& = 21251

Global Const ND_INT_AO_CH_1_VS_REF_AMP_1& = 21252

Global Const ND_INT_AO_CH_1_VS_REF_AMP_2& = 21253

Global Const ND_INT_AO_CH_1_VS_REF_AMP_3& = 21254

Global Const ND_INT_AO_GND_VS_AI_GND_AMP_0& = 21266

Global Const ND_INT_AO_GND_VS_AI_GND_AMP_1& = 21267

Global Const ND_INT_AO_GND_VS_AI_GND_AMP_2& = 21268

Global Const ND_INT_AO_GND_VS_AI_GND_AMP_3& = 21269

Global Const ND_INT_CM_REF_AMP_0& = 21271

Global Const ND_INT_CM_REF_AMP_1& = 21272

Global Const ND_INT_CM_REF_AMP_2& = 21273

Global Const ND_INT_CM_REF_AMP_3& = 21274

Global Const ND_INT_REF_AMP_0& = 21291

Global Const ND_INT_REF_AMP_1& = 21292

Global Const ND_INT_REF_AMP_2& = 21293

Global Const ND_INT_REF_AMP_3& = 21294

Global Const ND_INT_REF_AMP_4& = 21301

Global Const ND_INT_REF_AMP_5& = 21302

Global Const ND_INT_REF_AMP_6& = 21303

Global Const ND_INT_REF_AMP_7& = 21304

Global Const ND_ROUTE_INT_REFERENCE& = 21299

Global Const ND_INTERRUPT_EVERY_SAMPLE& = 11700

Global Const ND_INTERRUPT_HALF_FIFO& = 11800

Global Const ND_IO_CONNECTOR& = 21300

Global Const ND_LEVEL_A& = 21410

Page 159: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

159

Global Const ND_LEVEL_B& = 21420

Global Const ND_LEVEL_SENSITIVE& = 24000

Global Const ND_LINK_COMPLETE_INTERRUPTS& = 24010

Global Const ND_LOW& = 24050

Global Const ND_LOW_HYSTERESIS& = 24080

Global Const ND_LOW_TO_HIGH& = 24100

Global Const ND_LPT_DEVICE_MODE& = 24200

Global Const ND_MARKER& = 24500

Global Const ND_MARKER_QUANTUM& = 24550

Global Const ND_MAX_ARB_SEQUENCE_LENGTH& = 24600

Global Const ND_MAX_FUNC_SEQUENCE_LENGTH& = 24610

Global Const ND_MAX_LOOP_COUNT& = 24620

Global Const ND_MAX_NUM_WAVEFORMS& = 24630

Global Const ND_MAX_SAMPLE_RATE& = 24640

Global Const ND_MAX_WFM_SIZE& = 24650

Global Const ND_MEMORY_TRANSFER_WIDTH& = 24700

Global Const ND_MIN_SAMPLE_RATE& = 24800

Global Const ND_MIN_WFM_SIZE& = 24810

Global Const ND_NEGATIVE& = 26100

Global Const ND_NEW& = 26190

Global Const ND_NI_DAQ_SW_AREA& = 26195

Global Const ND_NO& = 26200

Global Const ND_NO_STRAIN_GAUGE& = 26225

Global Const ND_NO_TRACK_AND_HOLD& = 26250

Global Const ND_NONE& = 26300

Global Const ND_NOT_APPLICABLE& = 26400

Global Const ND_NUMBER_DIG_PORTS& = 26500

Global Const ND_OFF& = 27010

Global Const ND_OFFSET& = 27020

Global Const ND_ON& = 27050

Global Const ND_OTHER& = 27060

Global Const ND_OTHER_GPCTR_OUTPUT& = 27300

Global Const ND_OTHER_GPCTR_TC& = 27400

Global Const ND_OUTSIDE_LEVEL_A_LEVEL_B& = 27065

Global Const ND_OUT_DATA_FIFO_SIZE& = 27070

Global Const ND_OUT_EXTERNAL_GATE& = 27080

Global Const ND_OUT_EXTERNAL_GATE_POL& = 27082

Page 160: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

160

Global Const ND_OUT_START_TRIGGER& = 27100

Global Const ND_OUT_START_TRIGGER_POL& = 27102

Global Const ND_OUT_UPDATE& = 27200

Global Const ND_OUT_UPDATE_POL& = 27202

Global Const ND_OUT_UPDATE_CLOCK_TIMEBASE& = 27210

Global Const ND_OUT_UPDATE_CLOCK_TB_POL& = 27212

Global Const ND_OUTPUT_ENABLE& = 27220

Global Const ND_OUTPUT_MODE& = 27230

Global Const ND_OUTPUT_POLARITY& = 27240

Global Const ND_OUTPUT_STATE& = 27250

Global Const ND_OUTPUT_TYPE& = 40000

Global Const ND_DIGITAL_PATTERN_GENERATION& = 28030

Global Const ND_PAUSE& = 28040

Global Const ND_PAUSE_ON_HIGH& = 28045

Global Const ND_PAUSE_ON_LOW& = 28050

Global Const ND_PFI_0& = 28100

Global Const ND_PFI_1& = 28200

Global Const ND_PFI_2& = 28300

Global Const ND_PFI_3& = 28400

Global Const ND_PFI_4& = 28500

Global Const ND_PFI_5& = 28600

Global Const ND_PFI_6& = 28700

Global Const ND_PFI_7& = 28800

Global Const ND_PFI_8& = 28900

Global Const ND_PFI_9& = 29000

Global Const ND_PFI_10& = 50280

Global Const ND_PFI_11& = 50290

Global Const ND_PFI_12& = 50300

Global Const ND_PFI_13& = 50310

Global Const ND_PFI_14& = 50320

Global Const ND_PFI_15& = 50330

Global Const ND_PFI_16& = 50340

Global Const ND_PFI_17& = 50350

Global Const ND_PFI_18& = 50360

Global Const ND_PFI_19& = 50370

Global Const ND_PFI_20& = 50380

Global Const ND_PFI_21& = 50390

Global Const ND_PFI_22& = 50400

Global Const ND_PFI_23& = 50410

Page 161: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

161

Global Const ND_PFI_24& = 50420

Global Const ND_PFI_25& = 50430

Global Const ND_PFI_26& = 50440

Global Const ND_PFI_27& = 50450

Global Const ND_PFI_28& = 50460

Global Const ND_PFI_29& = 50470

Global Const ND_PFI_30& = 50480

Global Const ND_PFI_31& = 50490

Global Const ND_PFI_32& = 50500

Global Const ND_PFI_33& = 50510

Global Const ND_PFI_34& = 50520

Global Const ND_PFI_35& = 50530

Global Const ND_PFI_36& = 50540

Global Const ND_PFI_37& = 50550

Global Const ND_PFI_38& = 50560

Global Const ND_PFI_39& = 50570

Global Const ND_PLL_REF_FREQ& = 29010

Global Const ND_PLL_REF_SOURCE& = 29020

Global Const ND_PRE_ARM& = 29050

Global Const ND_POSITIVE& = 29100

Global Const ND_PREPARE& = 29200

Global Const ND_PROGRAM& = 29300

Global Const ND_PULSE& = 29350

Global Const ND_PULSE_SOURCE& = 29500

Global Const ND_PULSE_TRAIN_GNR& = 29600

Global Const ND_PXI_BACKPLANE_CLOCK& = 29900

Global Const ND_REGLITCH& = 31000

Global Const ND_RESERVED& = 31100

Global Const ND_RESET& = 31200

Global Const ND_RESUME& = 31250

Global Const ND_RETRIG_PULSE_GNR& = 31300

Global Const ND_REVISION& = 31350

Global Const ND_RTSI_0& = 31400

Global Const ND_RTSI_1& = 31500

Global Const ND_RTSI_2& = 31600

Global Const ND_RTSI_3& = 31700

Global Const ND_RTSI_4& = 31800

Global Const ND_RTSI_5& = 31900

Page 162: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

162

Global Const ND_RTSI_6& = 32000

Global Const ND_RTSI_CLOCK& = 32100

Global Const ND_PXI_STAR& = 32200

Global Const ND_PXI_STAR_3& = 32210

Global Const ND_PXI_STAR_4& = 32220

Global Const ND_PXI_STAR_5& = 32230

Global Const ND_PXI_STAR_6& = 32240

Global Const ND_PXI_STAR_7& = 32250

Global Const ND_PXI_STAR_8& = 32260

Global Const ND_PXI_STAR_9& = 32270

Global Const ND_PXI_STAR_10& = 32280

Global Const ND_PXI_STAR_11& = 32290

Global Const ND_PXI_STAR_12& = 32300

Global Const ND_PXI_STAR_13& = 32310

Global Const ND_PXI_STAR_14& = 32320

Global Const ND_PXI_STAR_15& = 32330

Global Const ND_SCANCLK& = 32400

Global Const ND_SCANCLK_LINE& = 32420

Global Const ND_SC_2040_MODE& = 32500

Global Const ND_SC_2043_MODE& = 32600

Global Const ND_SELF_CALIBRATE& = 32700

Global Const ND_SET_DEFAULT_LOAD_AREA& = 32800

Global Const ND_RESTORE_FACTORY_CALIBRATION& = 32810

Global Const ND_SET_POWERUP_STATE& = 42100

Global Const ND_SIGNAL_CONDITIONING_SPEC& = 32900

Global Const ND_SIMPLE_EVENT_CNT& = 33100

Global Const ND_SINGLE& = 33150

Global Const ND_SINGLE_PERIOD_MSR& = 33200

Global Const ND_SINGLE_PULSE_GNR& = 33300

Global Const ND_SINGLE_PULSE_WIDTH_MSR& = 33400

Global Const ND_SINGLE_TRIG_PULSE_GNR& = 33500

Global Const ND_SOURCE& = 33700

Global Const ND_SOURCE_POLARITY& = 33800

Global Const ND_STABLE_10_MHZ& = 33810

Global Const ND_STEPPED& = 33825

Global Const ND_STRAIN_GAUGE& = 33850

Global Const ND_STRAIN_GAUGE_EX0& = 33875

Global Const ND_SUB_REVISION& = 33900

Global Const ND_SYNC_DUTY_CYCLE_HIGH& = 33930

Page 163: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

163

Global Const ND_SYNC_OUT& = 33970

Global Const ND_TC_REACHED& = 34100

Global Const ND_THE_AI_CHANNEL& = 34400

Global Const ND_TOGGLE& = 34700

Global Const ND_TOGGLE_GATE& = 34800

Global Const ND_TRACK_AND_HOLD& = 34850

Global Const ND_TRIG_PULSE_WIDTH_MSR& = 34900

Global Const ND_TRIGGER_SOURCE& = 34930

Global Const ND_TRIGGER_MODE& = 34970

Global Const ND_UI2_TC& = 35100

Global Const ND_UP_DOWN& = 35150

Global Const ND_UP_TO_1_DMA_CHANNEL& = 35200

Global Const ND_UP_TO_2_DMA_CHANNELS& = 35300

Global Const ND_USE_CAL_CHAN& = 36000

Global Const ND_USE_AUX_CHAN& = 36100

Global Const ND_USER_EEPROM_AREA& = 37000

Global Const ND_USER_EEPROM_AREA_2& = 37010

Global Const ND_USER_EEPROM_AREA_3& = 37020

Global Const ND_USER_EEPROM_AREA_4& = 37030

Global Const ND_USER_EEPROM_AREA_5& = 37040

Global Const ND_DSA_RTSI_CLOCK_AD& = 44000

Global Const ND_DSA_RTSI_CLOCK_DA& = 44010

Global Const ND_DSA_OUTPUT_TRIGGER& = 44020

Global Const ND_DSA_INPUT_TRIGGER& = 44030

Global Const ND_DSA_SHARC_TRIGGER& = 44040

Global Const ND_DSA_ANALOG_TRIGGER& = 44050

Global Const ND_DSA_HOST_TRIGGER& = 44060

Global Const ND_DSA_EXTERNAL_DIGITAL_TRIGGER& = 44070

Global Const ND_DSA_EXCITATION& = 44080

Global Const ND_VOLTAGE_OUTPUT& = 40100

Global Const ND_VOLTAGE_REFERENCE& = 38000

Global Const ND_VXI_SC% = &H2000

Global Const ND_PXI_SC% = &H2010

Global Const ND_WALRUS_SCXI_HV_BACKPLANE% = &H2011

Global Const ND_WALRUS_SCXI_LV_BACKPLANE% = &H2012

Page 164: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

164

Global Const ND_VXIMIO_SET_ALLOCATE_MODE& = 43100

Global Const ND_VXIMIO_USE_ONBOARD_MEMORY_AI& = 43500

Global Const ND_VXIMIO_USE_ONBOARD_MEMORY_AO& = 43600

Global Const ND_VXIMIO_USE_ONBOARD_MEMORY_GPCTR& = 43700

Global Const ND_VXIMIO_USE_PC_MEMORY_AI& = 43200

Global Const ND_VXIMIO_USE_PC_MEMORY_AO& = 43300

Global Const ND_VXIMIO_USE_PC_MEMORY_GPCTR& = 43400

Global Const ND_WFM_QUANTUM& = 45000

Global Const ND_YES& = 39100

Global Const ND_3V_LEVEL& = 43450

Global Const ND_WRITE_MARK& = 50000

Global Const ND_READ_MARK& = 50010

Global Const ND_BUFFER_START& = 50020

Global Const ND_TRIGGER_POINT& = 50025

Global Const ND_BUFFER_MODE& = 50030

Global Const ND_DOUBLE& = 50050

Global Const ND_QUADRATURE_ENCODER_X1& = 50070

Global Const ND_QUADRATURE_ENCODER_X2& = 50080

Global Const ND_QUADRATURE_ENCODER_X4& = 50090

Global Const ND_TWO_PULSE_COUNTING& = 50100

Global Const ND_LINE_FILTER& = 50110

Global Const ND_SYNCHRONIZATION& = 50120

Global Const ND_5_MICROSECONDS& = 50130

Global Const ND_1_MICROSECOND& = 50140

Global Const ND_500_NANOSECONDS& = 50150

Global Const ND_100_NANOSECONDS& = 50160

Global Const ND_1_MILLISECOND& = 50170

Global Const ND_10_MILLISECONDS& = 50180

Global Const ND_100_MILLISECONDS& = 50190

Global Const ND_OTHER_GPCTR_SOURCE& = 50580

Global Const ND_OTHER_GPCTR_GATE& = 50590

Global Const ND_AUX_LINE& = 50600

Global Const ND_AUX_LINE_POLARITY& = 50610

Global Const ND_TWO_SIGNAL_EDGE_SEPARATION_MSR& = 50630

Global Const ND_BUFFERED_TWO_SIGNAL_EDGE_SEPARATION_MSR& = 50640

Page 165: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

165

Global Const ND_SWITCH_CYCLE& = 50650

Global Const ND_INTERNAL_MAX_TIMEBASE& = 50660

Global Const ND_PRESCALE_VALUE& = 50670

Global Const ND_MAX_PRESCALE& = 50690

Global Const ND_INTERNAL_LINE_0& = 50710

Global Const ND_INTERNAL_LINE_1& = 50720

Global Const ND_INTERNAL_LINE_2& = 50730

Global Const ND_INTERNAL_LINE_3& = 50740

Global Const ND_INTERNAL_LINE_4& = 50750

Global Const ND_INTERNAL_LINE_5& = 50760

Global Const ND_INTERNAL_LINE_6& = 50770

Global Const ND_INTERNAL_LINE_7& = 50780

Global Const ND_INTERNAL_LINE_8& = 50790

Global Const ND_INTERNAL_LINE_9& = 50800

Global Const ND_INTERNAL_LINE_10& = 50810

Global Const ND_INTERNAL_LINE_11& = 50820

Global Const ND_INTERNAL_LINE_12& = 50830

Global Const ND_INTERNAL_LINE_13& = 50840

Global Const ND_INTERNAL_LINE_14& = 50850

Global Const ND_INTERNAL_LINE_15& = 50860

Global Const ND_INTERNAL_LINE_16& = 50862

Global Const ND_INTERNAL_LINE_17& = 50864

Global Const ND_INTERNAL_LINE_18& = 50866

Global Const ND_INTERNAL_LINE_19& = 50868

Global Const ND_INTERNAL_LINE_20& = 50870

Global Const ND_INTERNAL_LINE_21& = 50872

Global Const ND_INTERNAL_LINE_22& = 50874

Global Const ND_INTERNAL_LINE_23& = 50876

Global Const ND_START_TRIGGER& = 51150

Global Const ND_START_TRIGGER_POLARITY& = 51151

Global Const ND_COUNTING_SYNCHRONOUS& = 51200

Global Const ND_SYNCHRONOUS& = 51210

Page 166: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

166

Global Const ND_ASYNCHRONOUS& = 51220

Global Const ND_CONFIGURABLE_FILTER& = 51230

Global Const ND_ENCODER_TYPE& = 51240

Global Const ND_Z_INDEX_ACTIVE& = 51250

Global Const ND_Z_INDEX_VALUE& = 51260

Global Const ND_SNAPSHOT& = 51270

Global Const ND_POSITION_MSR& = 51280

Global Const ND_BUFFERED_POSITION_MSR& = 51290

Global Const ND_SAVED_COUNT& = 51300

Global Const ND_READ_MARK_H_SNAPSHOT& = 51310

Global Const ND_READ_MARK_L_SNAPSHOT& = 51320

Global Const ND_WRITE_MARK_H_SNAPSHOT& = 51330

Global Const ND_WRITE_MARK_L_SNAPSHOT& = 51340

Global Const ND_BACKLOG_H_SNAPSHOT& = 51350

Global Const ND_BACKLOG_L_SNAPSHOT& = 51360

Global Const ND_ARMED_SNAPSHOT& = 51370

Global Const ND_EDGE_GATED_FSK& = 51371

Global Const ND_SIMPLE_GATED_EVENT_CNT& = 51372

Global Const ND_VIDEO_TYPE& = 51380

Global Const ND_PAL_B& = 51390

Global Const ND_PAL_G& = 51400

Global Const ND_PAL_H& = 51410

Global Const ND_PAL_I& = 51420

Global Const ND_PAL_D& = 51430

Global Const ND_PAL_N& = 51440

Global Const ND_PAL_M& = 51450

Global Const ND_NTSC_M& = 51460

Global Const ND_COUNTER_TYPE& = 51470

Global Const ND_NI_TIO& = 51480

Global Const ND_AM9513& = 51490

Global Const ND_STC& = 51500

Global Const ND_8253& = 51510

Global Const ND_A_HIGH_B_HIGH& = 51520

Global Const ND_A_HIGH_B_LOW& = 51530

Global Const ND_A_LOW_B_HIGH& = 51540

Global Const ND_A_LOW_B_LOW& = 51550

Global Const ND_Z_INDEX_RELOAD_PHASE& = 51560

Global Const ND_UPDOWN_LINE& = 51570

Global Const ND_DEFAULT& = 51575

Page 167: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

167

Global Const ND_DEFAULT_PFI_LINE& = 51580

Global Const ND_BUFFER_SIZE& = 51590

Global Const ND_ELEMENT_SIZE& = 51600

Global Const ND_NUMBER_GP_COUNTERS& = 51610

Global Const ND_BUFFERED_TIME_STAMPING& = 51620

Global Const ND_TIME_0_DATA_32& = 51630

Global Const ND_TIME_8_DATA_24& = 51640

Global Const ND_TIME_16_DATA_16& = 51650

Global Const ND_TIME_24_DATA_8& = 51660

Global Const ND_TIME_32_DATA_32& = 51670

Global Const ND_TIME_48_DATA_16& = 51680

Global Const ND_ABSOLUTE& = 51690

Global Const ND_RELATIVE& = 51700

Global Const ND_TIME_DATA_SIZE& = 51710

Global Const ND_TIME_FORMAT& = 51720

Global Const ND_HALT_ON_OVERFLOW& = 51730

Global Const ND_OVERLAY_RTSI_ON_PFI_LINES& = 51740

Global Const ND_STOP_TRIGGER& = 51750

Global Const ND_TS_INPUT_MODE& = 51760

Global Const ND_BOTH_EDGES& = 51770

Global Const ND_CLOCK_0& = 51780

Global Const ND_CLOCK_1& = 51790

Global Const ND_CLOCK_2& = 51800

Global Const ND_CLOCK_3& = 51810

Global Const ND_SYNCHRONIZATION_LINE& = 51820

Global Const ND_TRANSFER_METHOD& = 51830

Global Const ND_SECONDS& = 51840

Global Const ND_PRECISION& = 51850

Global Const ND_NANO_SECONDS& = 51860

Global Const ND_SYNCHRONIZATION_METHOD& = 51870

Global Const ND_PULSE_PER_SECOND& = 51880

Global Const ND_IRIG_B& = 51890

Global Const ND_SIMPLE_TIME_MSR& = 51900

Global Const ND_SINGLE_TIME_MSR& = 51910

Global Const ND_BUFFERED_TIME_MSR& = 51920

Global Const ND_DMA& = 51930

Global Const ND_INTERNAL_SYNCHRONIZATION& = 51940

Global Const ND_INITIAL_SECONDS& = 51950

Global Const ND_INITIAL_SECONDS_ENABLE& = 51951

Page 168: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

168

Global Const ND_EXTERNAL_CALIBRATION& = 51990

Global Const ND_INTERNAL_CALIBRATION& = 51200

Global Const ND_ABORT_CALIBRATION& = 51210

Global Const ND_STORE_CALIBRATION& = 51220

Global Const ND_MEASUREMENT_MODE& = 51230

Global Const ND_CURRENT& = 51240

Global Const ND_FREQUENCY& = 52250

Global Const ND_VOLTAGE& = 52260

Global Const ND_OHMS& = 52270

Global Const ND_EXCITATION_CURRENT& = 52280

Global Const ND_FREQ_STARTING_EDGE& = 52290

Global Const ND_FREQ_TRIG_LOW& = 52300

Global Const ND_FREQ_TRIG_HIGH& = 52310

Global Const ND_FREQ_NUM_OF_CYCLES& = 52320

Global Const ND_FREQ_TIME_BASE& = 52330

Global Const ND_FREQ_LOW_LIMIT& = 52340

Global Const ND_AVERAGING_NUM_OF_SAMPLES& = 52350

Global Const ND_AVERAGING_FREQUENCY& = 52360

Global Const ND_OFFSET_COMP_MODE& = 52370

Global Const ND_DIGITAL_LINE& = 52380

Global Const ND_DIGITAL_PORT& = 52390

Global Const ND_GPCTR0_UP_DOWN& = 52400

Global Const ND_GPCTR1_UP_DOWN& = 52410

Global Const ND_DIGITAL_LINE_0& = 52420

Global Const ND_DIGITAL_LINE_1& = 52430

Global Const ND_DIGITAL_LINE_2& = 52440

Global Const ND_DIGITAL_LINE_3& = 52450

Global Const ND_DIGITAL_LINE_4& = 52460

Global Const ND_DIGITAL_LINE_5& = 52470

Global Const ND_DIGITAL_LINE_6& = 52480

Global Const ND_DIGITAL_LINE_7& = 52490

Global Const ND_SCARAB_A_MEMORY_SIZE& = 52510

Global Const ND_SCARAB_B_MEMORY_SIZE& = 52520

Global Const ND_PATTERN_GENERATION_LOOP_ENABLE& = 52530

Global Const ND_MEASUREMENT_TYPE& = 52540

Global Const ND_DIFFERENTIAL& = 52550

Page 169: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

169

Global Const ND_NRSE& = 52560

Global Const ND_4WIRE& = 52570

Global Const ND_READ_MARK_H_SNAPSHOT_GR1& = 52580

Global Const ND_READ_MARK_L_SNAPSHOT_GR1& = 52590

Global Const ND_READ_MARK_H_SNAPSHOT_GR2& = 52600

Global Const ND_READ_MARK_L_SNAPSHOT_GR2& = 52610

Global Const ND_WRITE_MARK_H_SNAPSHOT_GR1& = 52620

Global Const ND_WRITE_MARK_L_SNAPSHOT_GR1& = 52630

Global Const ND_WRITE_MARK_H_SNAPSHOT_GR2& = 52640

Global Const ND_WRITE_MARK_L_SNAPSHOT_GR2& = 52650

Global Const ND_PARAM_SCXI_SETTLING_TIME& = 52710

Global Const ND_PARAM_USER_DEFINED_SETTLING_TIME& = 52720

Global Const ND_PARAM_SCXI_SCAN_INFO& = 52730

Global Const ND_PARAM_SCXI_MODULE_CODE& = 52740

Global Const ND_PARAM_SCXI_DUMMY& = 52750

Global Const ND_PARAM_CHANNEL_NAME& = 52760

Global Const ND_PARAM_TASKID& = 52770

Global Const ND_PARAM_CJC& = 52780

Global Const ND_PARAM_CHANNEL_CLOCK_TIMEBASE& = 52790

Global Const ND_PARAM_CHANNEL_CLOCK_INTERVAL& = 52800

Global Const ND_PARAM_CHANNEL_CLOCK_FREQUENCY& = 52810

Global Const ND_PARAM_CHANNEL_CLOCK_SOURCE& = 52820

Global Const ND_PARAM_CHANNEL_CLOCK_DEFAULT& = 52830

Global Const ND_PARAM_SCAN_CLOCK_TIMEBASE& = 52840

Global Const ND_PARAM_SCAN_CLOCK_INTERVAL& = 52850

Global Const ND_PARAM_SCAN_CLOCK_FREQUENCY& = 52860

Global Const ND_PARAM_SCAN_CLOCK_SOURCE& = 52870

Global Const ND_PARAM_SCAN_CLOCK_DEFAULT& = 52880

Global Const ND_PARAM_NUM_CHANNELS& = 52890

3.2.7. Módulo de errores de la API de Adquisición de Datos (nidaqerr.inc)

'*********************************************************************'

'* nidaqerr.inc *'

'* header file for platform-independent ni-daq errors/warnings *'

'* *'

'* NOTE: *'

'* You should use symbols defined here in your programs; do not *'

'* use the numerical values. *'

'* *'

Page 170: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

170

'* Warnings are returned as positive numbers. For example *'

'* overWriteError may be returned as a warning and its value *'

'* would be -(overWriteError). *'

'* *'

'* THIS FILE IS AUTOMATICALLY GENERATED FROM A DATABASE: DO NOT EDIT *'

'* *'

'*********************************************************************'

Global Const noError = 0

Global Const syntaxError = -10001 ' An error was detected in the input string; the arrangement or ordering ...

Global Const semanticsError = -10002 ' An error was detected in the input string; the syntax of the string is ...

Global Const invalidValueError = -10003 ' The value of a numeric parameter is invalid.

Global Const valueConflictError = -10004 ' The value of a numeric parameter is inconsistent with another one, and ...

Global Const badDeviceError = -10005 ' The device is invalid.

Global Const badLineError = -10006 ' The line is invalid.

Global Const badChanError = -10007 ' A channel, port, or counter is out of range for the device type or device ...

Global Const badGroupError = -10008 ' The group is invalid.

Global Const badCounterError = -10009 ' The counter is invalid.

Global Const badCountError = -10010 ' The count is too small or too large for the specified counter, or the ...

Global Const badIntervalError = -10011 ' The analog input scan rate is too fast for the number of channels and ...

Global Const badRangeError = -10012 ' The analog input or analog output voltage or current range is invalid ...

Global Const badErrorCodeError = -10013 ' The driver returned an unrecognized or unlisted error code.

Global Const groupTooLargeError = -10014 ' The group size is too large for the board.

Global Const badTimeLimitError = -10015 ' The time limit is invalid.

Global Const badReadCountError = -10016 ' The read count is invalid.

Global Const badReadModeError = -10017 ' The read mode is invalid.

Global Const badReadOffsetError = -10018 ' The offset is unreachable.

Page 171: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

171

Global Const badClkFrequencyError = -10019 ' The frequency is invalid.

Global Const badTimebaseError = -10020 ' The timebase is invalid.

Global Const badLimitsError = -10021 ' The limits are beyond the range of the board.

Global Const badWriteCountError = -10022 ' Your data array contains an incomplete update, or you are trying to write ...

Global Const badWriteModeError = -10023 ' The write mode is out of range or is disallowed.

Global Const badWriteOffsetError = -10024 ' Adding the write offset to the write mark places the write mark outside ...

Global Const limitsOutOfRangeError = -10025 ' The requested input limits exceed the board's capability or configuration. ...

Global Const badBufferSpecificationError = -10026 ' The requested number of buffers or the buffer size is not allowed. For ...

Global Const badDAQEventError = -10027 ' For DAQEvents 0 and 1 general value A must be greater than 0 and less ...

Global Const badFilterCutoffError = -10028 ' The cutoff frequency specified is not valid for this device.

Global Const obsoleteFunctionError = -10029 ' The function you are calling is no longer supported in this version of ...

Global Const badBaudRateError = -10030 ' The specified baud rate for communicating with the serial port is not ...

Global Const badChassisIDError = -10031 ' The specified baud rate for communicating with the serial port is not ...

Global Const badModuleSlotError = -10032 ' The SCXI module slot that was specified is invalid or corresponds to an ...

Global Const invalidWinHandleError = -10033 ' The window handle passed to the function is invalid.

Global Const noSuchMessageError = -10034 ' No configured message matches the one you tried to delete.

Global Const irrelevantAttributeError = -10035 ' The specified attribute is not relevant.

Global Const badYearError = -10036 ' The specified year is invalid.

Global Const badMonthError = -10037 ' The specified month is invalid.

Global Const badDayError = -10038 ' The specified day is invalid.

Global Const stringTooLongError = -10039 ' The specified input string is too long. For instance, DAQScope 5102 devices ...

Global Const badGroupSizeError = -10040 ' The group size is invalid.

Global Const badTaskIDError = -10041 ' The specified task ID is invalid. For instance, you may have connected ...

Global Const inappropriateControlCodeError = -10042 ' The specified control code is inappropriate for the current configuration ...

Page 172: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

172

Global Const badDivisorError = -10043 ' The specified divisor is invalid.

Global Const badPolarityError = -10044 ' The specified polarity is invalid.

Global Const badInputModeError = -10045 ' The specified input mode is invalid.

Global Const badExcitationError = -10046 ' The excitation value specified is not valid for this device.

Global Const badConnectionTypeError = -10047 ' The excitation value specified is not valid for this device.

Global Const badExcitationTypeError = -10048 ' The excitation type specified is not valid for this device.

Global Const badChanListError = -10050 ' There is more than one channel name in the channel list that corresponds ...

Global Const badTrigSkipCountError = -10079 ' The trigger skip count is invalid.

Global Const badGainError = -10080 ' The gain or gain adjust is invalid.

Global Const badPretrigCountError = -10081 ' The pretrigger sample count is invalid.

Global Const badPosttrigCountError = -10082 ' The posttrigger sample count is invalid.

Global Const badTrigModeError = -10083 ' The trigger mode is invalid.

Global Const badTrigCountError = -10084 ' The trigger count is invalid.

Global Const badTrigRangeError = -10085 ' The trigger range or trigger hysteresis window is invalid.

Global Const badExtRefError = -10086 ' The external reference is invalid.

Global Const badTrigTypeError = -10087 ' The trigger type is invalid.

Global Const badTrigLevelError = -10088 ' The trigger level is invalid.

Global Const badTotalCountError = -10089 ' The total count is inconsistent with the buffer size and pretrigger scan ...

Global Const badRPGError = -10090 ' The individual range, polarity, and gain settings are valid but the combination ...

Global Const badIterationsError = -10091 ' You have attempted to use an invalid setting for the iterations parameter. ...

Global Const lowScanIntervalError = -10092 ' Some devices require a time gap between the last sample in a scan and ...

Global Const fifoModeError = -10093 ' FIFO mode waveform generation cannot be used because at least one condition ...

Global Const badCalDACconstError = -10094 ' The calDAC constant passed to the function is invalid.

Global Const badCalStimulusError = -10095 ' The calibration stimulus passed to the function is invalid.

Page 173: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

173

Global Const badCalibrationConstantError = -10096 ' The specified calibration constant is invalid.

Global Const badCalOpError = -10097 ' The specified calibration operation is invalid.

Global Const badCalConstAreaError = -10098 ' The specified calibration constant area is invalid. For instance, the ...

Global Const badPortWidthError = -10100 ' The requested digital port width is not a multiple of the hardware port ...

Global Const gpctrBadApplicationError = -10120 ' Invalid application used.

Global Const gpctrBadCtrNumberError = -10121 ' Invalid counterNumber used.

Global Const gpctrBadParamValueError = -10122 ' Invalid paramValue used.

Global Const gpctrBadParamIDError = -10123 ' Invalid paramID used.

Global Const gpctrBadEntityIDError = -10124 ' Invalid entityID used.

Global Const gpctrBadActionError = -10125 ' Invalid action used.

Global Const gpctrSourceSelectError = -10126 ' Invalid source selected.

Global Const badCountDirError = -10127 ' The specified counter does not support the specified count direction.

Global Const badGateOptionError = -10128 ' The specified gating option is invalid.

Global Const badGateModeError = -10129 ' The specified gate mode is invalid.

Global Const badGateSourceError = -10130 ' The specified gate source is invalid.

Global Const badGateSignalError = -10131 ' The specified gate signal is invalid.

Global Const badSourceEdgeError = -10132 ' The specified source edge is invalid.

Global Const badOutputTypeError = -10133 ' The specified output type is invalid.

Global Const badOutputPolarityError = -10134 ' The specified output polarity is invalid.

Global Const badPulseModeError = -10135 ' The specified pulse mode is invalid.

Global Const badDutyCycleError = -10136 ' The specified duty cycle is invalid.

Global Const badPulsePeriodError = -10137 ' The specified pulse period is invalid.

Global Const badPulseDelayError = -10138 ' The specified pulse delay is invalid.

Global Const badPulseWidthError = -10139 ' The specified pulse width is invalid.

Page 174: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

174

Global Const badFOUTportError = -10140 ' The specified frequency output (FOUT or FREQ_OUT) port is invalid.

Global Const badAutoIncrementModeError = -10141 ' The specified autoincrement mode is invalid.

Global Const CfgInvalidatedSysCalError = -10150 ' Hardware configuration has changed since last system calibration

Global Const sysCalOutofDateError = -10151 ' system calibration is out of date

Global Const badNotchFilterError = -10180 ' The specified notch filter is invalid.

Global Const badMeasModeError = -10181 ' The specified measurement mode is invalid.

Global Const EEPROMreadError = -10200 ' Unable to read data from EEPROM.

Global Const EEPROMwriteError = -10201 ' Unable to write data to EEPROM.

Global Const EEPROMwriteProtectionError = -10202 ' You cannot write into this location or area of your EEPROM because it ...

Global Const EEPROMinvalidLocationError = -10203 ' The specified EEPROM location is invalid.

Global Const EEPROMinvalidPasswordError = -10204 ' The password for accessing the EEPROM is incorrect.

Global Const noDriverError = -10240 ' The driver interface could not locate or open the driver..

Global Const oldDriverError = -10241 ' One of the driver files or the configuration utility is out of date, or ...

Global Const functionNotFoundError = -10242 ' The specified function is not located in the driver.

Global Const configFileError = -10243 ' The driver could not locate or open the configuration file, or the format ...

Global Const deviceInitError = -10244 ' The driver encountered a hardware-initialization error while attempting ...

Global Const osInitError = -10245 ' The driver encountered an operating-system error while attempting to perform ...

Global Const communicationsError = -10246 ' The driver encountered an operating-system error while attempting to perform ...

Global Const cmosConfigError = -10247 ' The CMOS configuration-memory for the device is empty or invalid, or the ...

Global Const dupAddressError = -10248 ' The base addresses for two or more devices are the same; consequently, ...

Global Const intConfigError = -10249 ' The interrupt configuration is incorrect given the capabilities of the ...

Global Const dupIntError = -10250 ' The interrupt levels for two or more devices are the same.

Global Const dmaConfigError = -10251 ' The DMA configuration is incorrect given the capabilities of the computer/DMA ...

Global Const dupDMAError = -10252 ' The DMA channels for two or more devices are the same.

Page 175: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

175

Global Const jumperlessBoardError = -10253 ' Unable to find one or more jumperless boards you have configured using ...

Global Const DAQCardConfError = -10254 ' Cannot configure the DAQCard because 1) the correct version of the card ...

Global Const remoteChassisDriverInitError = -10255 ' There was an error in initializing the driver for Remote SCXI.

Global Const comPortOpenError = -10256 ' There was an error in opening the specified COM port.

Global Const baseAddressError = -10257 ' Bad base address specified in Measurement & Automation Explorer.

Global Const dmaChannel1Error = -10258 ' Bad DMA channel 1 specified in Measurement & Automation Explorer or by ...

Global Const dmaChannel2Error = -10259 ' Bad DMA channel 2 specified in Measurement & Automation Explorer or by ...

Global Const dmaChannel3Error = -10260 ' Bad DMA channel 3 specified in Measurement & Automation Explorer or by ...

Global Const userModeToKernelModeCallError = -10261 ' The user mode code failed when calling the kernel mode code.

Global Const noConnectError = -10340 ' No RTSI or PFI signal/line is connected, or the specified signal and the ...

Global Const badConnectError = -10341 ' The RTSI or PFI signal/line cannot be connected as specified.

Global Const multConnectError = -10342 ' The specified RTSI signal is already being driven by a RTSI line, or the ...

Global Const SCXIConfigError = -10343 ' The specified SCXI configuration parameters are invalid, or the function ...

Global Const chassisSynchedError = -10344 ' The Remote SCXI unit is not synchronized with the host. Reset the chassis ...

Global Const chassisMemAllocError = -10345 ' The required amount of memory cannot be allocated on the Remote SCXI unit ...

Global Const badPacketError = -10346 ' The packet received by the Remote SCXI unit is invalid. Check your serial ...

Global Const chassisCommunicationError = -10347 ' There was an error in sending a packet to the remote chassis. Check your ...

Global Const waitingForReprogError = -10348 ' The Remote SCXI unit is in reprogramming mode and is waiting for reprogramming ...

Global Const SCXIModuleTypeConflictError = -10349 ' The module ID read from the SCXI module conflicts with the configured ...

Global Const CannotDetermineEntryModuleError = -10350 ' Neither an SCXI entry module (i.e.: the SCXI module cabled to the measurement ...

Global Const DSPInitError = -10360 ' The DSP driver was unable to load the kernel for its operating system.

Global Const badScanListError = -10370 ' The scan list is invalid; for example, you are mixing AMUX-64T channels ...

Global Const invalidSignalSrcError = -10380 ' The specified signal source is invalid for the selected signal name.

Global Const invalidSignalNameError = -10381 ' The specified signal name is invalid.

Page 176: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

176

Global Const invalidSrcSpecError = -10382 ' The specified source specification is invalid for the signal source or ...

Global Const invalidSignalDestError = -10383 ' The specified signal destination is invalid.

Global Const routingError = -10390 ' The routing manager was unable to complete the request due to a lack of ...

Global Const pfiBadLineError = -10391 ' The routing manager was unable to complete the request due to an invalid ...

Global Const pfiGPCTRNotRoutedError = -10392 ' The specified General Purpose Counter Output and/or Up/Down signal(s) ...

Global Const pfiDefaultLineUndefinedError = -10393 ' A default PFI line does not exist for the given signal. You must specify ...

Global Const pfiDoubleRoutingError = -10394 ' Given PFI line is already reserved for a different signal, or given signal ...

Global Const userOwnedRsrcError = -10400 ' The specified resource is owned by the user and cannot be accessed or ...

Global Const unknownDeviceError = -10401 ' The specified device is not a National Instruments product, the driver ...

Global Const deviceNotFoundError = -10402 ' The specified device is not a National Instruments product, the driver ...

Global Const deviceSupportError = -10403 ' The specified device does not support the requested action (the driver ...

Global Const noLineAvailError = -10404 ' No line is available.

Global Const noChanAvailError = -10405 ' No channel is available.

Global Const noGroupAvailError = -10406 ' No group is available.

Global Const lineBusyError = -10407 ' The specified line is in use.

Global Const chanBusyError = -10408 ' The specified channel is in use.

Global Const groupBusyError = -10409 ' The specified group is in use.

Global Const relatedLCGBusyError = -10410 ' A related line, channel, or group is in use; if the driver configures ...

Global Const counterBusyError = -10411 ' The specified counter is in use.

Global Const noGroupAssignError = -10412 ' No group is assigned, or the specified line or channel cannot be assigned ...

Global Const groupAssignError = -10413 ' A group is already assigned, or the specified line or channel is already ...

Global Const reservedPinError = -10414 ' The selected signal requires a pin that is reserved and configured only ...

Global Const externalMuxSupportError = -10415 ' This function does not support your DAQ device when an external multiplexer ...

Global Const sysOwnedRsrcError = -10440 ' The specified resource is owned by the driver and cannot be accessed or ...

Page 177: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

177

Global Const memConfigError = -10441 ' No memory is configured to support the current data-transfer mode, or ...

Global Const memDisabledError = -10442 ' The specified memory is disabled or is unavailable given the current addressing ...

Global Const memAlignmentError = -10443 ' The transfer buffer is not aligned properly for the current data-transfer ...

Global Const memFullError = -10444 ' No more system memory is available on the heap, or no more memory is available ...

Global Const memLockError = -10445 ' The transfer buffer cannot be locked into physical memory. On PC AT machines, ...

Global Const memPageError = -10446 ' The transfer buffer contains a page break; system resources may require ...

Global Const memPageLockError = -10447 ' The operating environment is unable to grant a page lock.

Global Const stackMemError = -10448 ' The operating environment is unable to grant a page lock.

Global Const cacheMemError = -10449 ' A cache-related error occurred, or caching is not supported in the current ...

Global Const physicalMemError = -10450 ' A hardware error occurred in physical memory, or no memory is located ...

Global Const virtualMemError = -10451 ' The driver is unable to make the transfer buffer contiguous in virtual ...

Global Const noIntAvailError = -10452 ' No interrupt level is available for use.

Global Const intInUseError = -10453 ' The specified interrupt level is already in use by another device.

Global Const noDMACError = -10454 ' No DMA controller is available in the system.

Global Const noDMAAvailError = -10455 ' No DMA channel is available for use.

Global Const DMAInUseError = -10456 ' The specified DMA channel is already in use by another device.

Global Const badDMAGroupError = -10457 ' DMA cannot be configured for the specified group because it is too small, ...

Global Const diskFullError = -10458 ' The storage disk you specified is full.

Global Const DLLInterfaceError = -10459 ' The NI-DAQ DLL could not be called due to an interface error.

Global Const interfaceInteractionError = -10460 ' You have mixed VIs from the DAQ library and the _DAQ compatibility library ...

Global Const resourceReservedError = -10461 ' The specified resource is unavailable because it has already been reserved ...

Global Const resourceNotReservedError = -10462 ' The specified resource is unavailable because it has already been reserved ...

Global Const mdResourceAlreadyReservedError = -10463 ' Another entity has already reserved the requested resource.

Global Const mdResourceReservedError = -10464 ' Another entity has already reserved the requested resource.

Page 178: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

178

Global Const mdResourceNotReservedError = -10465 ' Attempting to lift a reservation off a resouce that previously had no ...

Global Const mdResourceAccessKeyError = -10466 ' The requested operation cannot be performed because the key supplied is ...

Global Const mdResourceNotRegisteredError = -10467 ' The resource requested is not registered with the minidriver.

Global Const muxMemFullError = -10480 ' The resource requested is not registered with the minidriver.

Global Const bufferNotInterleavedError = -10481 ' You must provide a single buffer of interleaved data, and the channels ...

Global Const waveformBufferSizeError = -10482 ' You have specified channels with different waveform lengths. To fix the ...

Global Const SCXIModuleNotSupportedError = -10540 ' You have specified channels with different waveform lengths. To fix the ...

Global Const TRIG1ResourceConflict = -10541 ' CTRB1 will drive COUTB1, however CTRB1 will also drive TRIG1. This may ...

Global Const matrixTerminalBlockError = -10542 ' This function requires that no Matrix terminal block is configured with ...

Global Const noMatrixTerminalBlockError = -10543 ' This function requires that some matrix terminal block is configured with ...

Global Const invalidMatrixTerminalBlockError = -10544 ' The type of matrix terminal block configured will not allow proper operation ...

Global Const invalidDSPHandleError = -10560 ' The DSP handle input is not valid .

Global Const DSPDataPathBusyError = -10561 ' Either DAQ or WFM can use a PC memory buffer, but not both at the same ...

Global Const noSetupError = -10600 ' No setup operation has been performed for the specified resources. Or, ...

Global Const multSetupError = -10601 ' No setup operation has been performed for the specified resources. Or, ...

Global Const noWriteError = -10602 ' No output data has been written into the transfer buffer.

Global Const groupWriteError = -10603 ' The output data associated with a group must be for a single channel or ...

Global Const activeWriteError = -10604 ' Once data generation has started, only the transfer buffers originally ...

Global Const endWriteError = -10605 ' No data was written to the transfer buffer because the final data block ...

Global Const notArmedError = -10606 ' The specified resource is not armed.

Global Const armedError = -10607 ' The specified resource is already armed.

Global Const noTransferInProgError = -10608 ' No transfer is in progress for the specified resource.

Global Const transferInProgError = -10609 ' A transfer is already in progress for the specified resource, or the operation ...

Global Const transferPauseError = -10610 ' A single output channel in a group may not be paused if the output data ...

Page 179: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

179

Global Const badDirOnSomeLinesError = -10611 ' Some of the lines in the specified channel are not configured for the ...

Global Const badLineDirError = -10612 ' The specified line does not support the specified transfer direction.

Global Const badChanDirError = -10613 ' The specified channel does not support the specified transfer direction, ...

Global Const badGroupDirError = -10614 ' The specified group does not support the specified transfer direction.

Global Const masterClkError = -10615 ' The clock configuration for the clock master is invalid.

Global Const slaveClkError = -10616 ' The clock configuration for the clock slave is invalid.

Global Const noClkSrcError = -10617 ' No source signal has been assigned to the clock resource.

Global Const badClkSrcError = -10618 ' The specified source signal cannot be assigned to the clock resource.

Global Const multClkSrcError = -10619 ' A source signal has already been assigned to the clock resource.

Global Const noTrigError = -10620 ' No trigger signal has been assigned to the trigger resource.

Global Const badTrigError = -10621 ' No trigger signal has been assigned to the trigger resource.

Global Const preTrigError = -10622 ' The pretrigger mode is not supported or is not available in the current ...

Global Const postTrigError = -10623 ' No posttrigger source has been assigned.

Global Const delayTrigError = -10624 ' The delayed trigger mode is not supported or is not available in the current ...

Global Const masterTrigError = -10625 ' The trigger configuration for the trigger master is invalid.

Global Const slaveTrigError = -10626 ' The trigger configuration for the trigger slave is invalid.

Global Const noTrigDrvError = -10627 ' No signal has been assigned to the trigger resource.

Global Const multTrigDrvError = -10628 ' A signal has already been assigned to the trigger resource.

Global Const invalidOpModeError = -10629 ' The specified operating mode is invalid, or the resources have not been ...

Global Const invalidReadError = -10630 ' The parameters specified to read data were invalid in the context of the ...

Global Const noInfiniteModeError = -10631 ' Continuous input or output transfers are not allowed in the current operating ...

Global Const someInputsIgnoredError = -10632 ' Certain inputs were ignored because they are not relevant in the current ...

Global Const invalidRegenModeError = -10633 ' The specified analog output regeneration mode is not allowed for this ...

Global Const noContTransferInProgressError = -10634 ' No continuous (double buffered) transfer is in progress for the specified ...

Page 180: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

180

Global Const invalidSCXIOpModeError = -10635 ' Either the SCXI operating mode specified in a configuration call is invalid, ...

Global Const noContWithSynchError = -10636 ' You cannot start a continuous (double-buffered) operation with a synchronous ...

Global Const bufferAlreadyConfigError = -10637 ' Attempted to configure a buffer after the buffer had already been configured. ...

Global Const badClkDestError = -10638 ' The clock cannot be assigned to the specified destination.

Global Const rangeBadForMeasModeError = -10670 ' The input range is invalid for the configured measurement mode.

Global Const autozeroModeConflictError = -10671 ' Autozero cannot be enabled for the configured measurement mode.

Global Const badChanGainError = -10680 ' All channels of this board must have the same gain.

Global Const badChanRangeError = -10681 ' All channels of this board must have the same range.

Global Const badChanPolarityError = -10682 ' All channels of this board must be the same polarity.

Global Const badChanCouplingError = -10683 ' All channels of this board must have the same coupling.

Global Const badChanInputModeError = -10684 ' All channels of this board must have the same input mode.

Global Const clkExceedsBrdsMaxConvRateError = -10685 ' The clock rate exceeds the board's recommended maximum rate.

Global Const scanListInvalidError = -10686 ' A configuration change has invalidated the scan list.

Global Const bufferInvalidError = -10687 ' A configuration change has invalidated the acquisition buffer, or an acquisition ...

Global Const noTrigEnabledError = -10688 ' The number of total scans and pretrigger scans implies that a triggered ...

Global Const digitalTrigBError = -10689 ' Digital trigger B is illegal for the number of total scans and pretrigger ...

Global Const digitalTrigAandBError = -10690 ' This board does not allow digital triggers A and B to be enabled at the ...

Global Const extConvRestrictionError = -10691 ' This board does not allow an external sample clock with an external scan ...

Global Const chanClockDisabledError = -10692 ' This board does not allow an external sample clock with an external scan ...

Global Const extScanClockError = -10693 ' You cannot use an external scan clock when doing a single scan of a single ...

Global Const unsafeSamplingFreqError = -10694 ' The scan rate is above the maximum or below the minimum for the hardware, ...

Global Const DMAnotAllowedError = -10695 ' You have set up an operation that requires the use of interrupts. DMA ...

Global Const multiRateModeError = -10696 ' Multi-rate scanning cannot be used with the AMUX-64, SCXI, or pretriggered ...

Global Const rateNotSupportedError = -10697 ' Unable to convert your timebase/interval pair to match the actual hardware ...

Page 181: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

181

Global Const timebaseConflictError = -10698 ' You cannot use this combination of scan and sample clock timebases for ...

Global Const polarityConflictError = -10699 ' You cannot use this combination of scan and sample clock source polarities ...

Global Const signalConflictError = -10700 ' You cannot use this combination of scan and convert clock signal sources ...

Global Const noLaterUpdateError = -10701 ' The call had no effect because the specified channel had not been set ...

Global Const prePostTriggerError = -10702 ' Pretriggering and posttriggering cannot be used simultaneously on the ...

Global Const noHandshakeModeError = -10710 ' The specified port has not been configured for handshaking.

Global Const noEventCtrError = -10720 ' The specified counter is not configured for event-counting operation.

Global Const SCXITrackHoldError = -10740 ' A signal has already been assigned to the SCXI track-and-hold trigger ...

Global Const sc2040InputModeError = -10780 ' When you have an SC2040 attached to your device, all analog input channels ...

Global Const outputTypeMustBeVoltageError = -10781 ' When you have an SC2040 attached to your device, all analog input channels ...

Global Const sc2040HoldModeError = -10782 ' The specified operation cannot be performed with the SC-2040 configured ...

Global Const calConstPolarityConflictError = -10783 ' Calibration constants in the load area have a different polarity from ...

Global Const masterDeviceNotInPXISlot2 = -10784 ' Your master device must be PXI slot number 2 in order to route clocks ...

Global Const timeOutError = -10800 ' The operation could not complete within the time limit.

Global Const calibrationError = -10801 ' An error occurred during the calibration process. Possible reasons for ...

Global Const dataNotAvailError = -10802 ' The requested amount of data has not yet been acquired.

Global Const transferStoppedError = -10803 ' The on-going transfer has been stopped. This is to prevent regeneration ...

Global Const earlyStopError = -10804 ' The transfer stopped prior to reaching the end of the transfer buffer.

Global Const overRunError = -10805 ' The clock rate is faster than the hardware can support. An attempt to ...

Global Const noTrigFoundError = -10806 ' No trigger value was found in the input transfer buffer.

Global Const earlyTrigError = -10807 ' The trigger occurred before sufficient pretrigger data was acquired.

Global Const LPTcommunicationError = -10808 ' The trigger occurred before sufficient pretrigger data was acquired.

Global Const gateSignalError = -10809 ' Attempted to start a pulse width measurement with the pulse in the phase ...

Global Const internalDriverError = -10810 ' An unexpected error occurred inside the driver when performing this given ...

Page 182: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

182

Global Const frequencyMeasurementError = -10811 ' The input signal's frequency could not be measured. The input signal's ...

Global Const softwareError = -10840 ' The contents or the location of the driver file was changed between accesses ...

Global Const firmwareError = -10841 ' The firmware does not support the specified operation, or the firmware ...

Global Const hardwareError = -10842 ' The hardware is not responding to the specified operation, or the response ...

Global Const underFlowError = -10843 ' Because of system and/or bus-bandwidth limitations, the driver could not ...

Global Const underWriteError = -10844 ' Your application was unable to deliver data to the background generation ...

Global Const overFlowError = -10845 ' Because of system and/or bus-bandwidth limitations, the driver could not ...

Global Const overWriteError = -10846 ' Your application was unable to retrieve data from the background acquisition ...

Global Const dmaChainingError = -10847 ' New buffer information was not available at the time of the DMA chaining ...

Global Const noDMACountAvailError = -10848 ' The driver could not obtain a valid reading from the transfer-count register ...

Global Const OpenFileError = -10849 ' The configuration file or DSP kernel file could not be opened.

Global Const closeFileError = -10850 ' Unable to close a file.

Global Const fileSeekError = -10851 ' Unable to seek within a file.

Global Const readFileError = -10852 ' Unable to read from a file.

Global Const writeFileError = -10853 ' Unable to write to a file.

Global Const miscFileError = -10854 ' An error occurred accessing a file.

Global Const osUnsupportedError = -10855 ' NI-DAQ does not support the current operation on this particular version ...

Global Const osError = -10856 ' An unexpected error occurred from the operating system while performing ...

Global Const internalKernelError = -10857 ' An unexpected error occurred inside the kernel of the device while performing ...

Global Const hardwareConfigChangedError = -10858 ' The system has reconfigured the device and has invalidated the existing ...

Global Const updateRateChangeError = -10880 ' A change to the update rate is not possible at this time because 1) when ...

Global Const partialTransferCompleteError = -10881 ' You cannot do another transfer after a successful partial transfer.

Global Const daqPollDataLossError = -10882 ' The data collected on the Remote SCXI unit was overwritten before it could ...

Global Const wfmPollDataLossError = -10883 ' New data could not be transferred to the waveform buffer of the Remote ...

Page 183: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

183

Global Const pretrigReorderError = -10884 ' Could not rearrange data after a pretrigger acquisition completed.

Global Const overLoadError = -10885 ' The input signal exceeded the input range of the ADC.

Global Const gpctrDataLossError = -10920 ' One or more data points may have been lost during buffered GPCTR operations ...

Global Const chassisResponseTimeoutError = -10940 ' No response was received from the Remote SCXI unit within the specified ...

Global Const reprogrammingFailedError = -10941 ' Reprogramming the Remote SCXI unit was unsuccessful. Please try again.

Global Const invalidResetSignatureError = -10942 ' Reprogramming the Remote SCXI unit was unsuccessful. Please try again.

Global Const chassisLockupError = -10943 ' The interrupt service routine on the remote SCXI unit is taking longer ...

'*********************************************************************'

'*

'* Mapping of old errors and warnings to new

'*

'* Warnings

'*

'* dupIOaddrRange -(dupAddressError)

'* dupIntLevels -(dupIntError)

'* dupDMALevels -(dupDMAError)

'* readOutputPort -(badChanDirError)

'* calibrationErr -(calibrationError)

'* noPreTrigUnwrap -(memFullError)

'* relatedPortBusy -(relatedLCGBusyError)

'* readOutputLine -(badDirOnSomeLinesError)

'* outOnSomeInLines -(badDirOnSomeLinesError)

'* inOnSomeOutLines -(badDirOnSomeLinesError)

'* simulOpAcrossChips -(invalidOpModeError)

'* overWriteBeforeCopy -(overWriteError)

'* pageBreakinWFbuf -(memPageError)

'* wrongNumConfigBytes -(noSetupError)

'* DMAReprogramming -(memPageError)

'* SCXImoduleTypeConflict -(SCXIModuleTypeConflictError)

'* notEnoughExtMem -(memFullError)

'* inputModeConflict -(invalidOpModeError)

'* SCXIConfigWarning -(SCXIConfigError)

'* messageIntervalTooLong -(badDAQEventError)

'* logicalDeviceWarning -(badDeviceError)

'* calConstPolarityConflict -(calConstPolarityConflictError)

Page 184: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

184

'* irqConflict -(dupIntError)

'* dmaConflict -(dupDMAError)

'* jumperlessBoardWarning -(jumperlessBoardError)

'* gpctrDataLossWarning -(gpctrDataLossError)

'*

'*

'* Errors

'*

'* notOurBrdErr unknownDeviceError

'* badBrdNumErr badDeviceError

'* badGainErr badGainError

'* badChanErr badChanError

'* noSupportErr deviceSupportError

'* badPortErr badChanError

'* badOutPortErr badChanDirError

'* noLatchModeErr noHandshakeModeError

'* noGroupAssign noGroupAssignError

'* badInputValErr invalidValueError

'* timeOutErr timeOutError

'* outOfRangeErr badRangeError

'* daqInProgErr transferInProgError

'* counterInUseErr counterBusyError

'* noDAQErr noTransferInProgError

'* overFlowErr overFlowError

'* overRunErr overRunError

'* badCntErr badCountError

'* brdTypeErr deviceSupportError

'* noCountOpErr noEventCtrError

'* ctrReservedErr sysOwnedRsrcError

'* portAssignToGrp groupAssignError

'* noPortAssignErr noGroupAssignError

'* badGrpDirErr badGroupDirError

'* noGrpBlockInProg noTransferInProgError

'* grpBlockInProg transferInProgError

'* setLatchWGrpCall invalidValueError

'* laterIntUpdateNotSet noLaterUpdateError

'* wfInProgErr transferInProgError

'* noWfLoadErr noWriteError

'* noWfInProgErr noTransferInProgError

'* badPreTrigCntErr badPretrigCountError

Page 185: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

185

'* buffNotFullErr earlyTrigError

'* prePostTrigErr prePostTriggerError

'* extConvErr extConvRestrictionError

'* badSigDirErr badLineDirError

'* noDbDaqErr noContTransferInProgError

'* overWriteErr overWriteError

'* memErr memFullError

'* noConfigFile configFileError

'* badGrpSize badGroupError

'* intLevelInUse intInUseError

'* DMAChanInUse DMAInUseError

'* multSourceInputErr multConnectError

'* lowScanIntervalErr lowScanIntervalError

'* noConnectionErr noConnectError

'* noPGInProg noTransferInProgError

'* PGInProg transferInProgError

'* grpRateErr counterBusyError

'* extGateErr invalidOpModeError

'* openFileErr openFileError

'* writeFileErr writeFileError

'* noDbWvfmErr noTransferInProgError

'* oldDataErr transferStoppedError

'* dataNotAvailErr dataNotAvailError

'* DMATransferCntNotAvail noDMACountAvailError

'* noLabScanErr noTransferInProgError

'* dbOpErr noContWithSynchError

'* DMADisabledErr noDMAAvailError

'* invalidConfigErr cmosConfigError

'* brdIsArmedErr armedError

'* clockSourceErr multClkSrcError

'* noSetupErr noSetupError

'* extConvDrvErr multClkSrcError

'* triggerSourceErr badTrigError

'* noArmErr notArmedError

'* intDisabledErr noIntAvailError

'* keyNotFoundErr configFileError

'* noTrigEnabledErr preTrigError

'* digPortReserved sysOwnedRsrcError

'* RTSIlineInUseErr sysOwnedRsrcError

'* dacUpdateRTSIinUseErr sysOwnedRsrcError

Page 186: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

186

'* noRTSIlineAvailErr noLineAvailError

'* preTrigScansErr badPretrigCountError

'* postTrigScansErr badPosttrigCountError

'* scanRateErr badIntervalError

'* invalidGetErr invalidReadError

'* calInputOutOfRange badExtRefError

'* EEPROMaddrErr EEPROMreadError

'* EEPROMresponseErr EEPROMreadError

'* EEPROMreadErr EEPROMreadError

'* EEPROMwriteErr EEPROMwriteError

'* calResponseErr calibrationError

'* calConvergeErr calibrationError

'* calDACerr calibrationError

'* externalCalRefErr badExtRefError

'* internalCalRefErr hardwareError

'* badOutLineErr badLineDirError

'* relatedPortAssignToGrpBusy relatedLCGBusyError

'* dacUpdateErr underFlowError

'* muxMemFullErr muxMemFullError

'* interlvdDataAlignErr memAlignmentError

'* cannotAlignBufErr memAlignmentError

'* cannotLockBufErr memLockError

'* cannotPageLockErr memPageLockError

'* invalidChassisIDErr badChassisIDError

'* invalidModuleSlotErr badModuleSlotError

'* configFileErr configFileError

'* outdatedVDMADErr oldDriverError

'* ctrRTSINotAvailErr lineBusyError

'* dacUpdateRTSINotAvailErr lineBusyError

'* SCXIConfigErr SCXIConfigError

'* noDbDigErr noTransferInProgError

'* DbDigPartialComplete transferStoppedError

'* SCXITrackHoldErr SCXITrackHoldError

'* wvfmGrpAssignErr groupAssignError

'* chanNotAssignedGrpErr noGroupAssignError

'* grpLoadErr groupWriteError

'* loadAfterStartErr activeWriteError

'* noUpdateRateErr noClkSrcError

'* chanPauseErr transferPauseError

'* DSPInitFailure DSPInitError

Page 187: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

187

'* DSPDataPathInUse DSPDataPathBusyError

'* DSPDAQErr internalKernelError

'* DSPreserved3 badErrorCodeError

'* DSPreserved4 badErrorCodeError

'* DSPreserved5 badErrorCodeError

'* SCXICommErr communicationsError

'* invalidOpModeErr invalidSCXIOpModeError

'* moduleNotSupported SCXIModuleNotSupportedError

'* DAQboardNotSupported deviceSupportError

'* noNIDAQLibErr noDriverError

'* noNIDAQFuncErr functionNotFoundError

'* incompatibleVISRDErr oldDriverError

'* port1InLatchedModeErr relatedLCGBusyError

'* invalidMemRegionErr memLockError

'* fifoModeErr fifoModeError

'* cannotFreeMemErr memConfigError

'* memNotLockedErr memConfigError

'* invalidWinHandleErr invalidWinHandleError

'* trigEventNotAvailErr DMANotAllowedError

'* memTypeNotSupportedErr memConfigError

'* badChanStrErr syntaxError

'* parseErr syntaxError

'* noSuchMessageErr noSuchMessageError

'* badChanTypeErr badChanError

'* badTrigValErr badDAQEventError

'* notOurDSPHandleErr invalidDSPHandleError

'* NIDAQInternalErr internalDriverError

'* preTrigReorderErr pretrigReorderError

'* badCtrErr badCounterError

'* invalidCtrErr badCounterError

'* timedMsgInUseErr counterBusyError

'* invDAQModeTimedMsgErr DMANotAllowedError

'* lptCommunicationErr LPTcommunicationError

'* multiRateAMUXErr multiRateModeError

'* multiRatePreTrigErr multiRateModeError

'* functionNotLinkedErr internalDriverError

'* scanIntervalTooLongErr badIntervalError

'* sampleIntervalTooLongErr badIntervalError

'* updateIntervalTooLongErr badIntervalError

'* gpctrBadApplicationErr gpctrBadApplicationError

Page 188: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

188

'* gpctrBadCounterNumberErr gpctrBadCounterNumberError

'* gpctrBadParamValueErr gpctrBadParamValueError

'* gpctrBadParamIdErr gpctrBadParamIdError

'* gpctrBadEntityIdErr gpctrBadEntityIdError

'* gpctrBadActionErr gpctrBadActionError

'* gpctrBadGateSignalErr gateSignalError

'* gpctrNotArmedErr noSetupError

'* gpctrNotResetErr counterBusyError

'* gpctrNotProgrammedErr noSetupError

'* gpctrApplicationNotSetErr noSetupError

'* gpctrBufferNotConfiguredErr bufferInvalidError

'* gpctrCantChangeParameterErr counterBusyError

'* lptProtocolNotSupported LPTcommunicationError

'* rateNotSupportedErr rateNotSupportedError

'* timebaseConflictErr timebaseConflictError

'* polarityConflictErr polarityConflictError

'* signalConflictErr signalConflictError

'* baseAddressErr baseAddressError

'* interruptLevel1Err badErrorCodeError

'* interruptLevel2Err badErrorCodeError

'* dmaChannel1Err dmaChannel1Error

'* dmaChannel2Err dmaChannel2Error

'* openSCManagerErr badErrorCodeError

'* openNIDAQServiceErr badErrorCodeError

'* startNIDAQServiceErr badErrorCodeError

'* criticalResourceConflictErr badErrorCodeError

'* jumperlessBoardErr jumperlessBoardError

'* reservedPinErr reservedPinError

'* bufferNotInterleavedErr bufferNotInterleavedError

'* gpctrInUseErr counterBusyError

'* gpctrDataLossErr gpctrDataLossError

'* updateRateChangeErr updateRateChangeError

'* gpctrBufferConfiguredErr bufferAlreadyConfigError

'* gpctrBufOprnNotInProgErr noTransferInProgError

'* badFilterFreqErr badFilterCutoffError

'* sc2040HoldModeErr sc2040HoldModeError

'* sc2040InputModeErr sc2040InputModeError

'* noSC2040ConfigErr noSetupError

'* DAQCardConfigErr DAQCardConfigError

'* partialTransferCompleteErr partialTransferCompleteError

Page 189: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

189

'* DMABufferAlignmentErr memAlignmentError

'* outputTypeMustBeVoltageErr outputTypeMustBeVoltageError

'* osUnsupportedErr osUnsupportedError

'* osErr osError

'*********************************************************************'

3.2.8. Formulario de conexión (frmConexion.frm)

Option Explicit

Private Sub cmdAceptar_Click()

Dim Res As String

Dim iRes As Integer

Dim Puerto As String

Dim i As Integer

frmConexion.Enabled = False

cmdAceptar.Enabled = False

cmdCancelar.Enabled = False

cmdConfig.Enabled = False

barConexion.Visible = True

barConexion.Enabled = True

tmrPBAR.Enabled = True

Puerto = Format(cmbPuerto.Text, ">")

'Se establece la comunicación

Res = modFlowbusAvanzado.StartCommunication(Puerto, False, True, iRes, cmbBaudios.Text)

If (Res = "") Then

'Se guardan los parámetros de conexión y configuración

cfg.Puerto = cmbPuerto.Text

cfg.Baudios = cmbBaudios.Text

For i = 1 To 16

If (chkCanal(i).Value = 1) Then

cfg.Canal(i) = True

Else

cfg.Canal(i) = False

End If

Page 190: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

190

Next

Unload frmConexion

Else

MsgBox (Res)

tmrPBAR.Enabled = False

barConexion.Enabled = False

barConexion.Visible = False

frmConexion.Enabled = True

cmdAceptar.Enabled = True

cmdCancelar.Enabled = True

Call Habilitar_Form

End If

End Sub

Private Sub cmdCancelar_Click()

Unload frmConexion

End Sub

Private Sub ProgressBar1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

End Sub

Private Sub cmdConf_Click()

Call Habilitar_Form

End Sub

Private Sub cmdConfig_Click()

Call Habilitar_Form

End Sub

Private Sub Form_Load()

Call Deshabilitar_Form

Page 191: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

191

tmrPBAR.Enabled = False

barConexion.Enabled = False

barConexion.Visible = False

Call Cargar_Puertos

Call Cargar_Baudios

Call Cargar_cfg

End Sub

Private Sub tmrPBAR_Timer()

If barConexion.Value >= barConexion.Max - 1 Then

barConexion.Value = barConexion.Min

Else

barConexion.Value = barConexion.Value + 1

End If

End Sub

Sub Cargar_Puertos()

Dim Num_Puertos As Byte

Dim Ind_Puerto As Long

Dim Long_Memoria As Integer

Dim Error_val As Integer

Dim EnUso As Boolean

Dim Puerto As String

Dim Indice As Integer

Dim fmtPuerto As String

'Se vacía el cmbPuerto del puerto

cmbPuerto.Clear

'Se obtiene el número de puertos disponibles

Num_Puertos = modFlowbusAPI.GetNrPorts

'Se añaden los puerto encontrados al cmbPuerto

For Ind_Puerto = 0 To Num_Puertos - 1

Page 192: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

192

Puerto = Space(256) 'Se inicializa la variable

Long_Memoria = modFlowbusAPI.GetPort(Ind_Puerto, 0, EnUso, Puerto)

If Long_Memoria > 0 Then

Puerto = Space(256) 'Se innicializa

Error_val = modFlowbusAPI.GetPort(CByte(Ind_Puerto), Long_Memoria, EnUso, Puerto) 'Se obtiene el puerto

Puerto = Trim(Puerto) 'Se eliminan los blancos

If Error_val = 0 Then

Indice = InStr(1, Puerto, Chr(9)) 'Se lecoliza el COM

If Indice <> 0 Then

Puerto = Mid(Puerto, Indice + 1, Len(Puerto) - Indice)

End If

fmtPuerto = "C" & Mid(Format(Puerto, "<"), 2, Len(Puerto) - 1)

cmbPuerto.AddItem fmtPuerto

End If

End If

Next

'Se selecciona el primer puerto de la lista

If cmbPuerto.ListCount > 0 Then

cmbPuerto.ListIndex = 0

End If

End Sub

Sub Cargar_Baudios()

cmbBaudios.Clear

cmbBaudios.AddItem (4800)

cmbBaudios.AddItem (9600)

cmbBaudios.AddItem (19200)

cmbBaudios.AddItem (38400)

cmbBaudios.Text = 38400

End Sub

Sub Deshabilitar_Form()

Page 193: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

193

Dim i As Integer

frmConexion.cmbPuerto.Enabled = False

frmConexion.cmbBaudios.Enabled = False

For i = 1 To 16

frmConexion.chkCanal(i).Enabled = False

Next

End Sub

Sub Habilitar_Form()

Dim i As Integer

frmConexion.cmbPuerto.Enabled = True

frmConexion.cmbBaudios.Enabled = True

For i = 1 To 16

frmConexion.chkCanal(i).Enabled = True

Next

End Sub

Sub Cargar_cfg()

Dim i As Integer

For i = 0 To (cmbPuerto.ListCount - 1)

If (cmbPuerto.List(i) = cfg.Puerto) Then

cmbPuerto.ListIndex = i

End If

Next i

For i = 0 To (cmbBaudios.ListCount - 1)

If (cmbBaudios.List(i) = cfg.Baudios) Then

cmbBaudios.ListIndex = i

End If

Next i

For i = 1 To 16

If (cfg.Canal(i)) Then

Page 194: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

194

chkCanal(i).Value = 1

Else

chkCanal(i).Value = 0

End If

Next i

End Sub

3.2.9. Formulario del Planificador (frmPlanificador.frm)

Option Explicit

Dim X As ListItem

Private Sub cmdDesplanificar_Click()

Dim Index As Integer

'Si hay un item seleccionado...

If Not lstPlanif.SelectedItem Is Nothing Then

'Pregunta si lo quiere eliminar

If MsgBox("¿Seguro que desea desplanificar " & lstPlanif.SelectedItem.Text & "?", vbYesNo, "Confirmación") = vbYes Then

Index = lstPlanif.SelectedItem.Index

MsgBox (Index)

Call Eliminar_planificacion(Index)

MsgBox (Index)

MsgBox (lstPlanif.ListItems.Count)

If (Index <= lstPlanif.ListItems.Count) Then

lstPlanif.ListItems.Item(Index).Selected = True

ElseIf ((Index - 1) > 0) Then

lstPlanif.ListItems.Item(Index - 1).Selected = True

ElseIf (lstPlanif.ListItems.Count > 0) Then

lstPlanif.ListItems.Item(1).Selected = True

End If

End If

End If

'Se puede eliminar la selección si se inhibe.

End Sub

Page 195: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

195

Private Sub cmdEditar_Click()

frmMedidas.Show vbModeless, Me

End Sub

Private Sub cmdEliminarCompletados_Click()

Dim Num, Res As Integer

Num = Eliminar_Completados

MsgBox ("Se han eliminado " & Num & " elementos.")

End Sub

Private Sub cmdPlanificar_Click()

frmPlanificar.Show vbModeless, Me

End Sub

Private Sub cmdSalir_Click()

Unload frmPlanificador

Salir_PGM = True

End Sub

Private Sub Form_Load()

Call Refrescar_Lista_Planificador

frmPlanificador.tmrFlow.Enabled = True

End Sub

Private Sub tmrFlow_Timer()

If (Estado_act.Medida <> "") Then

frmProceso.Actualizar_Tiempo

End If

Page 196: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

196

Call Validar_Planificacion

End Sub

Private Sub tmrIntervalo_Timer()

If (Get_Tiempo_Intervalo) Then

Call Tomar_Medidas

End If

End Sub

3.2.10. Formulario para Planificar una Nueva Medida (frmPlanificar.frm)

Option Explicit

Dim X As ListItem

Private Sub cmbMedida_Click()

Call Calcular_Fechas

End Sub

Private Sub cmdAceptar_Click()

Dim Fecha_new, Fecha_act As Date

Dim i, Res, Planif As Integer

Fecha_new = 0

'Se validan los campos

If (cmbMedida.Text = "") Then

Res = MsgBox("Informar campo Medida", , "Error!")

End If

If (txtArchivo.Text = "") Then

Res = MsgBox("Informar campo Archivo", , "Error!")

End If

'Se valida que las fechas sean correctas respecto al formulario

If (Res = 0) Then

Fecha_new = Fecha_Seleccionada

Page 197: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

197

If (Fecha_new < Obtener_FechaFin(Now, 5)) Then 'Mínimo mayor que 5 minutos

Res = MsgBox("El inicio de la próxima planificación debe ser mayor a 5 minutos de la hora actual.", , "Error")

End If

End If

'Se valida que el fichero que se pide no esté informado de antes

If (Res = 0) Then

Planif = Existe_Path(txtArchivo.Text)

If (Planif <> 0) Then

Res = MsgBox("Debe eliminar la planificación " & Planif & " o cambiar el nombre del archivo.", , "Error")

End If

End If

If (Res = 0) Then

'Se verifica que se pueda crear y se crea el archivo necesario.

Res = Crear_Archivo(txtArchivo, cmbMedida.Text, Fecha_new)

If (Res <> 0) Then

Res = MsgBox("Ruta de fichero inexistente", , "Error")

End If

End If

'Se incluye la planificación

If (Res = 0) Then

If (Añadir_Planificacion(cmbMedida.Text, Fecha_new, txtArchivo.Text)) Then

Unload frmPlanificar

Else: Res = MsgBox("La planificación se solapa con alguna de las medidas ya planificadas", , "Error")

End If

End If

End Sub

Private Sub cmdArchivo_Click()

Dim Direc_ini As String

dlgArchivo.InitDir = Obtener_Direc_Medidas

dlgArchivo.ShowSave

Page 198: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

198

txtArchivo.Text = dlgArchivo.FileName

End Sub

Private Sub cmdCancelar_Click()

Unload frmPlanificar

End Sub

Private Sub Form_Load()

Dim i, num_elems As Integer

frmPlanificador.Enabled = False

'Informar fecha y hora

timFecha.Value = Now

timHora.Value = timFecha.Value

'Cargar medidas

Call Cargar_cmbMedida_Planificar

End Sub

Sub Calcular_Fechas()

Dim Fecha_new, Fecha_fin As Date

Dim TmpTot As Double

Fecha_new = Fecha_Seleccionada

TmpTot = Obtener_Tiempo_Total(cmbMedida.Text)

Fecha_fin = Obtener_FechaFin(Fecha_new, TmpTot)

If (cmbMedida.Text <> "") Then

lblFechaFin.Caption = Format(Fecha_fin, "dd/mm/yyyy - HH:mm")

End If

End Sub

Private Sub Form_Unload(Cancel As Integer)

Page 199: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

199

frmPlanificador.Enabled = True

End Sub

Private Sub timFecha_Change()

Call Calcular_Fechas

End Sub

Private Sub timFecha_Click()

Call Calcular_Fechas

End Sub

Private Sub timHora_Change()

Call Calcular_Fechas

End Sub

Private Sub timHora_Click()

Call Calcular_Fechas

End Sub

Private Sub timHora_LostFocus()

Call Calcular_Fechas

End Sub

Function Fecha_Seleccionada() As String

Dim Fecha_fmt, Fecha_ini, Hora_ini As String

Fecha_fmt = Format(timFecha.Value, "dd/mm/yyyy HH:mm")

Fecha_ini = Mid(Fecha_fmt, 1, 10)

Page 200: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

200

Fecha_fmt = Format(timHora.Value, "dd/mm/yyyy HH:mm")

Hora_ini = Mid(Fecha_fmt, 12, 5)

Fecha_Seleccionada = Fecha_ini & " " & Hora_ini

End Function

Function Crear_Archivo(ByVal strArchivo As String, ByVal Medida As String, ByVal Fecha As Date) As Integer

On Error GoTo Error

Dim intArchivo As Integer

intArchivo = FreeFile

Open strArchivo For Output As intArchivo

Print #intArchivo, "El archivo se llenará con los datos obtenidos de la Medida: " & Medida; ". Con fecha y hora: " & Fecha

Close intArchivo

Crear_Archivo = 0

Exit Function

Error:

Crear_Archivo = 1

End Function

3.2.11. Formulario para Listar las Medidas Existentes (frmMedidas.frm)

Private Sub cmbCopia_Click()

txtNueva.SetFocus

End Sub

Private Sub cmdAceptar_Click()

Dim i, Res As Integer

Page 201: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

201

Res = 0

If ((Not optCopia.Value) And (Not optNueva.Value)) Then

Res = MsgBox("Debe seleccionar una opción crear/copiar", , "Error")

ElseIf (optCopia.Value) Then

If ((cmbCopia.Text = "") Or (txtNueva.Text = "")) Then

Res = MsgBox("Debe seleccionar una medida e informar un nombre nuevo", , "Error")

Else: For i = 0 To frmMedidas.cmbMedida.ListCount

If (StrComp(frmMedidas.cmbMedida.List(i), txtNueva.Text, vbTextCompare) = 0) Then

Res = MsgBox("El nombre ya existe", , "Error")

End If

Next i

End If

Else

If (txtNueva.Text = "") Then

Res = MsgBox("Debe informar el nombre")

Else: For i = 0 To frmMedidas.cmbMedida.ListCount

If (StrComp(frmMedidas.cmbMedida.List(i), txtNueva.Text, vbTextCompare) = 0) Then

Res = MsgBox("El nombre ya existe", , "Error")

Accion = False

End If

Next i

End If

End If

If (Res = 0) Then

If (optCopia.Value) Then

Call Copiar_Medida(cmbCopia.Text, txtNueva.Text)

End If

frmMedidas.cmbMedida.AddItem (txtNueva.Text)

'Se presenta el nuevo elemento

For i = 0 To frmMedidas.cmbMedida.ListCount

If (StrComp(frmMedidas.cmbMedida.List(i), txtNueva.Text, vbTextCompare) = 0) Then

frmMedidas.cmbMedida.ListIndex = i

End If

Next i

Unload frmNewMedida

End If

Page 202: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

202

End Sub

Private Sub cmdCancelar_Click()

Unload frmNewMedida

End Sub

Private Sub Form_Load()

frmMedidas.Enabled = False

Call Cargar_cmbCopia

optNueva.Value = False

txtNueva.Enabled = False

txtNueva.BackColor = &H8000000F

txtNueva.Text = ""

optCopia.Value = False

cmbCopia.Enabled = False

cmbCopia.BackColor = &H8000000F

cmbCopia.ListIndex = -1

End Sub

Private Sub Form_Unload(Cancel As Integer)

frmMedidas.Enabled = True

End Sub

Private Sub optCopia_Click()

If (optCopia.Value = True) Then

cmbCopia.Enabled = True

cmbCopia.BackColor = &H80000005

cmbCopia.ListIndex = -1

txtNueva.Enabled = True

txtNueva.BackColor = &H80000005

Page 203: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

203

txtNueva.Text = ""

cmbCopia.SetFocus

End If

End Sub

Private Sub optNueva_Click()

If (optNueva.Value = True) Then

cmbCopia.Enabled = False

cmbCopia.ListIndex = -1

cmbCopia.BackColor = &H8000000F

txtNueva.Enabled = True

txtNueva.Text = ""

txtNueva.BackColor = &H80000005

txtNueva.SetFocus

End If

End Sub

3.2.12. Formulario para Crear/Copiar una Medida Nueva (frmNewMedida.frm)

Option Explicit

Private Sub cmbMedida_Click()

Call Refrescar_Lista_Medidas(cmbMedida.Text, False)

End Sub

Private Sub cmdBajar_Click()

Dim Index, Res As Integer

If (frmMedidas.lstMedidas.ListItems.Count > 0) Then

Index = Mover_Tramo(frmMedidas.cmbMedida, frmMedidas.lstMedidas.SelectedItem.Index, False)

frmMedidas.lstMedidas.ListItems.Item(Index).Selected = True

Else: Res = MsgBox("No existen elementos en la lista", , "Aviso")

End If

Page 204: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

204

End Sub

Private Sub cmdCrear_Click()

frmNewMedida.Show vbModeless, Me

End Sub

Private Sub cmdEliminar_Click()

Dim Res As Integer

Dim Permiso As Integer

Dim Index As Integer

Res = 0

Permiso = 0

If (cmbMedida.Text = "") Then

Res = MsgBox("Debe seleccionar una medida", , "Error")

ElseIf (lstMedidas.ListItems.Count = 0) Then

Res = MsgBox("La lista está vacia", , "Aviso")

ElseIf (lstMedidas.SelectedItem.Checked) Then

Else: Res = MsgBox("Debe seleccionar un tramo", , "Error")

End If

If (Res = 0) Then

Index = lstMedidas.SelectedItem.Index

Permiso = MsgBox("Seguro que quiere eliminar el tramo " & Index, vbOKCancel, "Aviso")

End If

If (Permiso = 1) Then

Call Eliminar_Tramo(cmbMedida.Text, lstMedidas.SelectedItem.Index)

If (Index <= lstMedidas.ListItems.Count) Then

lstMedidas.ListItems.Item(Index).Selected = True

ElseIf ((Index - 1) > 0) Then

lstMedidas.ListItems.Item(Index - 1).Selected = True

ElseIf (lstMedidas.ListItems.Count > 0) Then

lstMedidas.ListItems.Item(1).Selected = True

End If

End If

Page 205: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

205

End Sub

Private Sub cmdElimMedida_Click()

Dim Res, Permiso, Index As Integer

Res = 0

Permiso = 0

If (cmbMedida.Text = "") Then

Res = MsgBox("Debe seleccionar una medida", , "Error")

End If

If (Res = 0) Then

Index = cmbMedida.ListIndex

Permiso = MsgBox("Seguro que quiere eliminar todos los tramos y la medida", vbOKCancel, "Aviso")

End If

If (Permiso = 1) Then

Call Eliminar_Medida(cmbMedida.Text)

cmbMedida.RemoveItem (Index)

End If

End Sub

Private Sub cmdInsertar_Click()

Dim Res As Integer

If (cmbMedida.Text = "") Then

Res = MsgBox("Debe elegir una medida primero", , "Error")

Else: frmTramo.Show vbModeless, Me

End If

End Sub

Private Sub cmdOk_Click()

Unload frmMedidas

End Sub

Page 206: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

206

Private Sub cmdSubir_Click()

Dim Index, Res As Integer

If (frmMedidas.lstMedidas.ListItems.Count > 0) Then

Index = Mover_Tramo(frmMedidas.cmbMedida, frmMedidas.lstMedidas.SelectedItem.Index, True)

frmMedidas.lstMedidas.ListItems.Item(Index).Selected = True

Else: Res = MsgBox("No existen elementos en la lista", , "Aviso")

End If

End Sub

Private Sub Command1_Click()

End Sub

Private Sub Form_Load()

frmPlanificador.Enabled = False

Call Cargar_cmbMedida_Medidas

End Sub

Private Sub Form_Unload(Cancel As Integer)

frmPlanificador.Enabled = True

End Sub

3.2.13. Formulario para Crear un Nuevo Tramo (frmTramo.frm)

Option Explicit

Private Sub cmdAceptar_Click()

Dim Opcion As Boolean

Dim New_Tramo As typMedidas

Dim TmpNodos, TmpIntervalo As Double

Dim Res As Integer

Page 207: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

207

'Se valida el tiempo

If (Validar_txtBoxes(txtTmpNodos.Text)) Then

TmpNodos = txtTmpNodos.Text

End If

If ((Res = 0) And (TmpNodos = 0)) Then

Res = MsgBox("Debe asignar un tiempo mayor que 0 a los Nodos", , "Error")

txtTmpNodos.SetFocus

End If

If ((Res = 0) And (TmpNodos > 525600)) Then

Res = MsgBox("Tiempo máximo Nodos es de 525600 mins (1 año)", , "Error")

txtTmpNodos.SetFocus

End If

'Se valida la opcion

If (Res = 0) Then

If ((OptSiNo(0).Value = False) And (OptSiNo(1).Value = False)) Then

Res = MsgBox("Debe seleccionar una opción de si quiere o no medidas", , "Error")

ElseIf (OptSiNo(0).Value = True) Then

Opcion = True

Else

Opcion = False

End If

End If

'Se valida el intervalo

If ((Res = 0) And (OptSiNo(0) = True) And (Validar_txtBoxes(txtIntervalo.Text))) Then

TmpIntervalo = txtIntervalo.Text

End If

If ((Res = 0) And (OptSiNo(0) = True) And (TmpIntervalo = 0)) Then

Res = MsgBox("Debe asignar un tiempo mayor que 0 al Intervalo", , "Error")

txtIntervalo.SetFocus

End If

If ((Res = 0) And (TmpIntervalo > 86400)) Then

Page 208: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

208

Res = MsgBox("Tiempo máximo del intervalo es de 86400segs (1 día)", , "Error")

txtIntervalo.SetFocus

End If

If (Res = 0) Then

New_Tramo.Nombre = frmMedidas.cmbMedida.Text

New_Tramo.Numero = 0

New_Tramo.Nodo3 = sldNodo3.Value

New_Tramo.Nodo4 = sldNodo4.Value

New_Tramo.Nodo5 = sldNodo5.Value

New_Tramo.Medidas = Opcion

New_Tramo.Intervalo = TmpIntervalo

New_Tramo.Tramo = 0

New_Tramo.Tiempo = TmpNodos

New_Tramo.TmpTot = 0

Call Programa.Agregar_Tramo(New_Tramo)

Unload frmTramo

End If

End Sub

Private Sub cmdCancelar_Click()

Unload frmTramo

End Sub

Private Sub Option1_Click(Index As Integer)

End Sub

Private Sub Opt_Click(Index As Integer)

End Sub

Private Sub Form_Load()

frmMedidas.Enabled = False

'Se inicia el formulario

Page 209: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

209

txtIntervalo.Text = ""

txtIntervalo.BackColor = &H8000000F

txtIntervalo.Enabled = False

End Sub

Private Sub Form_Unload(Cancel As Integer)

frmMedidas.Enabled = True

End Sub

Private Sub OptSiNo_Click(Index As Integer)

If (OptSiNo(0).Value = True) Then

txtIntervalo.Text = "0"

txtIntervalo.BackColor = &H80000005

txtIntervalo.Enabled = True

txtIntervalo.SetFocus

Else: txtIntervalo.Text = ""

txtIntervalo.BackColor = &H8000000F

txtIntervalo.Enabled = False

End If

End Sub

Private Sub sldNodo3_Change()

txtNodo3.Text = sldNodo3.Value

End Sub

Private Sub sldNodo4_Change()

txtNodo4.Text = sldNodo4.Value

End Sub

Private Sub sldNodo5_Change()

Page 210: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

210

txtNodo5.Text = sldNodo5.Value

End Sub

Private Sub txtNodo3_Change()

If (Validar_txtBoxes(txtNodo3.Text)) Then

sldNodo3.Value = txtNodo3.Text

End If

End Sub

Private Sub txtNodo3_LostFocus()

If (Not Validar_txtBoxes(txtNodo3.Text)) Then

sldNodo3.Value = 0

txtNodo3.Text = 0

End If

End Sub

Private Sub txtNodo4_Change()

If (Validar_txtBoxes(txtNodo4.Text)) Then

sldNodo4.Value = txtNodo4.Text

End If

End Sub

Private Sub txtNodo4_LostFocus()

If (Not Validar_txtBoxes(txtNodo4.Text)) Then

sldNodo4.Value = 0

txtNodo4.Text = 0

End If

End Sub

Private Sub txtNodo5_Change()

If (Validar_txtBoxes(txtNodo5.Text)) Then

sldNodo5.Value = txtNodo5.Text

Page 211: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

211

End If

End Sub

Private Sub txtNodo5_LostFocus()

If (Not Validar_txtBoxes(txtNodo5.Text)) Then

sldNodo5.Value = 0

txtNodo5.Text = 0

End If

End Sub

Private Function Validar_txtBoxes(Cadena As String) As Boolean

Dim i As Integer

Validar_txtBoxes = True

For i = 1 To Len(Cadena)

Select Case (Mid(Cadena, i, 1))

Case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"

Case " "

If (Mid(Cadena, i) = " ") Then

Else: Validar_txtBoxes = False

End If

Case Else

Validar_txtBoxes = False

End Select

Next i

If ((Cadena = "") Or (Cadena = " ")) Then

Validar_txtBoxes = False

End If

End Function

3.2.14. Formulario para Monitorizar la Ejecución del Proceso (frmProceso.frm)

Option Explicit

Dim X0 As Integer

Dim Y0 As Integer

Page 212: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

212

Dim Inc_T As Integer

Dim Ejes As ColorConstants

Dim Cur_X(17) As Integer

Dim Cur_Y(17) As Integer

Dim Max As Integer

Dim a As Double

Dim b As Double

Dim Fecha_ant As String

Private Sub cmdTerminar_Click()

Call Acabar_Proceso("No Ejecutado")

End Sub

Private Sub Form_Load()

Fecha_ant = Format(Now, "dd/mm/yyyy HH:mm:ss")

Fecha_ant = Mid(Fecha_ant, 1, 17) & "00"

lblTiempo.Caption = Format(Tiempo_Horas(Obtener_Tiempo_Total(Estado_act.Medida)), "hh:mm:ss")

frmProceso.Caption = " Proceso en ejecución: " & Estado_act.Medida

Call Obtener_Val_Gas

Call Establecer_Colores

Call Actualizar_Caudales

Call Actualizar_Setpoints

Call Actualizar_Gases

Call dibujar_ejes

tmrProceso.Enabled = True

End Sub

Private Sub dibujar_ejes()

Dim LongX As Integer

Dim LongY As Integer

Dim Sep As Integer

Dim Bord As Integer

Page 213: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

213

Dim Tension As Integer

Dim i As Integer

Tension = 10

Ejes = vbBlack

LongY = pctProceso.Height

Bord = 40

LongX = pctProceso.Width

Sep = 10

X0 = Bord

Y0 = pctProceso.Height - Bord

pctProceso.Line (Sep, LongY - Bord)-(LongX - Sep, LongY - Bord), Ejes

pctProceso.Line (Bord, LongY - Sep)-(Bord, Sep), Ejes

pctProceso.CurrentX = X0

pctProceso.CurrentY = Y0

For i = 1 To 16

Cur_X(i) = X0

Cur_Y(i) = Y0

Next i

Max = pctProceso.Width - Sep

a = (Bord - Y0) / Tension

b = Y0

Inc_T = (pctProceso.Width - Bord - Sep) / 3600

End Sub

Private Sub Timer1_Timer()

End Sub

Private Sub tmrDatos_Timer()

Page 214: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

214

Call Actualizar_Caudales

Call Actualizar_Setpoints

Call Actualizar_Gases

End Sub

Private Sub tmrProceso_Timer()

Dim Tiempo As Integer

Dim i As Integer

Dim Estado As Integer

Dim Valor As Double

Tiempo = pctProceso.CurrentX + 1

For i = 1 To 16

If (cfg.Canal(i)) Then

Estado = AI_VRead(1, i, 1, Valor)

Call Dibujar_Valor_Canal(Tiempo, Obtener_Tension(i), i)

End If

Next i

End Sub

Private Sub Dibujar_Valor_Canal(ByVal X1 As Integer, ByVal Y1 As Integer, ByVal Canal)

pctProceso.CurrentX = Cur_X(Canal)

pctProceso.CurrentY = Cur_Y(Canal)

pctProceso.Line -(X1, (a * Y1 + b)), Linea(Canal).BorderColor

Cur_X(Canal) = pctProceso.CurrentX

Cur_Y(Canal) = pctProceso.CurrentY

End Sub

Function Obtener_Tension(ByVal nodo As Integer)

If (nodo = 1) Then

Obtener_Tension = Rnd() + 4

End If

If (nodo = 2) Then

Page 215: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

215

Obtener_Tension = Rnd() + 2

End If

If (nodo = 3) Then

Obtener_Tension = Rnd()

End If

End Function

Sub Actualizar_Caudales()

Dim Caudal3 As Integer

Dim Caudal4 As Integer

Dim Caudal5 As Integer

Call Obtener_Caudal(Caudal3, Caudal4, Caudal5)

lblCdl(3).Caption = Caudal3 & " %"

lblCdl(4).Caption = Caudal4 & " %"

lblCdl(5).Caption = Caudal5 & " %"

End Sub

Sub Actualizar_Setpoints()

Dim Setpoint3 As Integer

Dim Setpoint4 As Integer

Dim Setpoint5 As Integer

Call Obtener_Setpoint(Setpoint3, Setpoint4, Setpoint5)

lblSet(3).Caption = Setpoint3 & " %"

lblSet(4).Caption = Setpoint4 & " %"

lblSet(5).Caption = Setpoint5 & " %"

End Sub

Sub Actualizar_Gases()

Dim Gas3 As String

Dim Gas4 As String

Dim Gas5 As String

Call Obtener_Gas(Gas3, Gas4, Gas5)

Page 216: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

216

lblGas(3).Caption = Gas3

lblGas(4).Caption = Gas4

lblGas(5).Caption = Gas5

End Sub

Sub Actualizar_Tiempo()

Dim Horas As Integer

Dim Mins As Integer

Dim Segs As Integer

'Dim Fecha_ant As String ya defindo

Dim Dia_ant As Double

Dim Mes_ant As Double

Dim Any_ant As Double

Dim Hora_ant As Double

Dim Min_ant As Double

Dim Seg_ant As Double

Dim Fecha_act As String

Dim Dia_act As Double

Dim Mes_act As Double

Dim Any_act As Double

Dim Hora_act As Double

Dim Min_act As Double

Dim Seg_act As Double

Dim i As Double

Dim Dias_tot As Double

Dim Num_Segs As Double

Dim Num_act As Double

Dim Num_ant As Double

'Se obtiene del contador la hora que esta mostrando actualmente.

Horas = Mid(Format(lblTiempo.Caption, "HH:mm:ss"), 1, 2)

Mins = Mid(Format(lblTiempo.Caption, "HH:mm:ss"), 4, 2)

Segs = Mid(Format(lblTiempo.Caption, "HH:mm:ss"), 7, 2)

'Se quiere contabilizar el numero de segundos que han transcurrido desde la última vez que se llamó

Page 217: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

217

'a la función, para actualizar el contador.

'Se calcula en función de los dias, meses, años, horas, minutos y segundos transcurridos.

'Separamos datos de la última fecha guardada.

Dia_ant = Mid(Format(Fecha_ant, "dd/mm/yyyy HH:mm:ss"), 1, 2)

Mes_ant = Mid(Format(Fecha_ant, "dd/mm/yyyy HH:mm:ss"), 4, 2)

Any_ant = Mid(Format(Fecha_ant, "dd/mm/yyyy HH:mm:ss"), 7, 4)

Hora_ant = Mid(Format(Fecha_ant, "dd/mm/yyyy HH:mm:ss"), 12, 2)

Min_ant = Mid(Format(Fecha_ant, "dd/mm/yyyy HH:mm:ss"), 15, 2)

Seg_ant = Mid(Format(Fecha_ant, "dd/mm/yyyy HH:mm:ss"), 18, 2)

'Se separa al igual la fecha actual

Fecha_act = Format(Now, "dd/mm/yyyy HH:mm:ss")

Dia_act = Mid(Format(Fecha_act, "dd/mm/yyyy HH:mm:ss"), 1, 2)

Mes_act = Mid(Format(Fecha_act, "dd/mm/yyyy HH:mm:ss"), 4, 2)

Any_act = Mid(Format(Fecha_act, "dd/mm/yyyy HH:mm:ss"), 7, 4)

Hora_act = Mid(Format(Fecha_act, "dd/mm/yyyy HH:mm:ss"), 12, 2)

Min_act = Mid(Format(Fecha_act, "dd/mm/yyyy HH:mm:ss"), 15, 2)

Seg_act = Mid(Format(Fecha_act, "dd/mm/yyyy HH:mm:ss"), 18, 2)

'Comprobamos que no haya cabiado el dia, el mes o el año.

Dias_tot = 0

If (Any_act <> Any_ant) Then

For i = Any_ant To (Any_act - 1)

If (Es_Bisiesto(i)) Then

Dias_tot = Dias_tot + 366

Else: Dias_tot = Dias_tot + 365

End If

Next i

Dias_tot = Dias_tot + Dif_Dias(Dia_act, Mes_act, Any_act, 0, 0, 0) + Dia_act - 1

'Se resta 1 por que del día actual solo han pasado unas horas

Dias_tot = Dias_tot + Dif_Dias(1, 1, Any_ant + 1, Dia_ant, Mes_ant, Any_ant)

'Como se trata de numeros muy grandes hay que hacerlo por partes

'Num_Segs = Dias_tot * 86400 + Hora_act * 3600 + Min_act * 60 + Seg_act + _

(86400 - ((Hora_ant * 3600) + (Min_ant * 60) + (Seg_ant)))

Page 218: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

218

ElseIf ((Mes_act <> Mes_ant) Or (Dia_act <> Dia_ant)) Then

Dias_tot = Dif_Dias(Dia_act, Mes_act, Any_act, Dia_ant, Mes_ant, Any_ant)

Num_Segs = Dias_tot * 86400 + Hora_act * 3600 + Min_act * 60 + Seg_act + _

(86400 - ((Hora_ant * 3600) + (Min_ant * 60) + (Seg_ant)))

Else

Num_Segs = ((Hora_act * 3600) + (Min_act * 60) + (Seg_act)) - _

((Hora_ant * 3600) + (Min_ant * 60) + (Seg_ant))

End If

'Se actualiza el contador

For i = 1 To Num_Segs

If (Segs > 0) Then

Segs = Segs - 1

Else

If (Mins > 0) Then

Segs = 59

Mins = Mins - 1

Else

If (Horas > 0) Then

Horas = Horas - 1

Else: Segs = 0

Mins = 0

Horas = 0

End If

End If

End If

Next i

Fecha_ant = Fecha_act

lblTiempo.Caption = Format(Horas & ":" & Mins & ":" & Segs, "hh:mm:ss")

End Sub

Sub Establecer_Colores()

Linea(1).BorderColor = vbRed

Linea(2).BorderColor = vbBlue

Linea(3).BorderColor = vbGreen

Page 219: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

219

Linea(4).BorderColor = vbBlack

Linea(5).BorderColor = vbCyan

Linea(6).BorderColor = vbMagenta

Linea(7).BorderColor = vbWhite

Linea(8).BorderColor = vbYellow

Linea(9).BorderColor = &HC0FFFF

Linea(10).BorderColor = &HFF8080

Linea(11).BorderColor = &H40C0&

Linea(12).BorderColor = &H4000&

Linea(13).BorderColor = &H400000

Linea(14).BorderColor = &H80&

Linea(15).BorderColor = &H808000

Linea(16).BorderColor = &HFFC0FF

End Sub

ÑÑÑ

3.2.15. Temporizador de TimeOut (clsTemporizadorTimeOut.cls)

Option Explicit

'Prefix: "oTimeOut_"

Private Const mcsModuleName = "clsTemporizadorTimeOut"

'---------------USER DEFINED TYPES-----------------------------------------------------------------

'Structure / type in which the current windows system time is stored

'prefix: "systime_"

Private Type SystemTimeType

iYear As Integer 'Current year

iMonth As Integer 'Current month (1=January ... 12=December)

iDayOfWeek As Integer 'Current day of week (0=Sunday ... 6=Saturday)

iDay As Integer 'Current day of month

iHour As Integer 'Current time in hours

iMinute As Integer 'Current time in minutes

iSecond As Integer 'Current time in seconds

iMilliseconds As Integer 'Current time in milliseconds

End Type

Page 220: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

220

'---------------END OF USER DEFINED TYPES----------------------------------------------------------

'---------------MODULE VARIABLES-------------------------------------------------------------------

Private Type ModuleVariables

systime_Start As SystemTimeType 'Current time at the moment the timer was started

End Type

Private m As ModuleVariables

'---------------END OF MODULE VARIABLES------------------------------------------------------------

'---------------IMPORT LIBRARIES-------------------------------------------------------------------

'****************************************************************************

'

' GetSystemTime

'

' Author : Bronkhorst High-Tech B.V.

' Date : 12-Dec-2003

'

' Function : Function which gets the windows system time.

' Parameters:

' (In)

' (Out)

' Returned :

' Remarks :

'

Private Declare Sub GetSystemTime Lib "KERNEL32" (ByRef systime_Time As SystemTimeType)

'---------------END OF IMPORT LIBRARIES------------------------------------------------------------

'---------------PUBLIC FUNCTIONS AND PROCEDURES----------------------------------------------------

'****************************************************************************

'

' StartTimeOutTimer

'

' Author : Bronkhorst High-Tech B.V.

Page 221: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

221

' Date : 12-Dec-2003

'

' Function : Function which starts the timer.

' Parameters:

' (In)

' (Out)

' Returned :

' Remarks :

'

Public Sub StartTimeOutTimer()

GetSystemTime m.systime_Start

End Sub

'****************************************************************************

'

' TimeUp

'

' Author : Bronkhorst High-Tech B.V.

' Date : 12-Dec-2003

'

' Function : Function which checks if time has expired (if a timeout occured).

' It measures the time from the moment you started the timer until now and

' then checks if time has expired.

' Parameters:

' (In) lTimeOut: Time in milliseconds before a timeout occurs.

' (Out)

' Returned : True if a timeout occured, False if there is still time left.

' Remarks :

'

Public Function TimeUp(ByVal lTimeOut As Long) As Boolean

Dim systime_Now As SystemTimeType 'Current windows system time

Dim lStart As Long 'Time in milliseconds at the moment the timer was started

'(only hours, minutes, seconds and milliseconds processed)

Dim lNow As Long 'Current time in milliseconds

'(only hours, minutes, seconds and milliseconds processed)

Page 222: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

222

GetSystemTime systime_Now 'Get the current system time

'Get the time in milliseconds at the moment the timer was started

With m.systime_Start

lStart = .iMilliseconds + 1000 * (.iSecond + 60 * (.iMinute + 60 * CLng(.iHour)))

End With

'Get the current time in milliseconds

With systime_Now

lNow = .iMilliseconds + 1000 * (.iSecond + 60 * (.iMinute + 60 * CLng(.iHour)))

End With

'If starting time greater then the current time, a day has passed, so add the milliseconds

'of 1 day to the current time

If lStart > lNow Then

lNow = lNow + 1000 * 60 * 60 * 24

End If

'Check if timeout occured

TimeUp = ((lNow - lStart) >= lTimeOut)

End Function

'---------------END OF PUBLIC FUNCTIONS AND PROCEDURES---------------------------------------------

4. Conclusiones

Una vez creado el programa y probado para ir ajustándolo al máximo a las necesidades del usuario final y para eliminar cualquier posible error de codificación, de implementación o comunicación entre el programa y la máquina, hemos podido llegar a las siguientes conclusiones:

- El programa nos permite tener un control total sobre el experimento que se pretende realizar, tiempos de mezcla, intervalo de adquisición de datos, concentración de gases en la mezcla, etc.

- El programa es una buena herramienta para visualizar en todo momento la evolución del experimento así como para el almacenaje de los datos relativos, para más tarde poder tratarlos o procesarlos consecuentemente.

Page 223: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

223

- Se han tenido que utilizar formularios no modales y permitir la ejecución de eventos en determinados momentos interrumpiendo el transcurso normal del programa, para permitir realizar algunas acciones mientras se estaban realizando otras. Hemos conseguido así un efecto multi-tarea. Sería interesante estudiar la problemática utilizando una versión posterior de Visual Basic u otro lenguaje que permita la ejecución de threads.

- Entendiendo que es un programa de utilización eminentemente práctico y pensando que con el tiempo y la experiencia (como sucede a demás en todos los programas) se querrán ampliar las funcionalidades del programa, a parte de intentar programar utilizando una estructura fácilmente ampliable, se han dejado más funciones de las estrictamente necesarias comentadas y declaradas para abordar en el futuro la ampliación de dichas funcionalidades. Es decir, ante la necesidad de nuevas opciones es suficiente con abrir el programa inspeccionar el código y abordar las ampliaciones sin necesidad de añadir ningún componente ni ninguna función de comunicación nueva.

5. Anexos

Ver volumen II

Page 224: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

Automatización de la Generación y Medida deMezclas Gaseosas Mediante MassFlow

(ANEXOS)

TITULACIÓ: Enginyeria Tècnica en Electrònica Industrial

AUTOR: Raphaël Verlaat DIRECTOR: Jesús Brezmes LLecha

DATA: Juny / 2.007.

Page 225: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

IDDFLD32_D.doc - P1Drev. date: 1999-12-21

1

Interface Design DocumentFlow-Bus DLL FOR WIN32

Interface Design Document Project: BHT934.2Author: G. Binnenmars Title: Interface Design Document

FlowBus DLL FOR WIN 32Approved: Revision: P1D

Date: 1999-03-04Filename: IDDFLD32.DOC

Page 226: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

IDDFLD32_D.doc - P1Drev. date: 1999-12-21

1

1 SCOPE 2

1.1 Identification 2

1.2 System Overview 2

1.3 Document overview 2

1.4 Document history 2

2 APPLICABLE DOCUMENTS 3

3 APPLICATION INTERFACE DESIGN 4

3.1 Introduction 4

3.2 Reference 43.2.1 Data-structures 43.2.2 API - functions 43.2.3 Error values 12

3.3 Procedures 143.3.1 Using the DLL 143.3.2 Open and Closing communication 143.3.3 Configuring communication 143.3.4 Sending / Receiving data 153.3.5 Database functions 16

4 PHYSICAL INTERFACE DESIGN 17

A. EXAMPLE APPLICATION PROGRAM 18

Page 227: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

IDDFLD32_D.doc - P1Drev. date: 1999-12-21

2

1 SCOPE

1.1 IDENTIFICATIONThis document describes the design of the interface between the Flow-Bus communicationDLL and applications using this DLL.

1.2 SYSTEM OVERVIEWThe systems E6000 and E7000 of Bronkhorst allow the control and the security of differentflow-systems. A communication network (3T-NET) connects the modules in these systems.The systems can be controlled from the PC. There are several levels at which the control canoccur. At a low level there is a RS232 interface to the system. Above it is a Windows DLL thatallows different applications to communicate with the system. At the top is a Windows DDEwhich also allows different application to communicate with the system, but then lessknowledge about the internals of the system (the PROPAR modal) is required.

The overview of the Flow-Bus DDE and the various parts is given in the next figure.

application

Flowbus

DDE DLL

3T-Net

RS232

network

Host

application

application

Figure 1 System overview

1.3 DOCUMENT OVERVIEWThis document contains the following parts:• chapter 2 gives a reference of applicable documents• chapter 3 gives the interface design• chapter 4 gives the interface to the lower layers• appendix A shows a programming example

1.4 DOCUMENT HISTORYRevision Author DescriptionP1A G. Binnenmars Initial versionP1B G.,Binnenmars Update after implementationP1C G. Binnenmars Final release

Page 228: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

IDDFLD32_D.doc - P1Drev. date: 1999-12-21

3

2 APPLICABLE DOCUMENTS

[1] Title:

Author:Doc.no:Revision:

Software Design DocumentPROPAR DLL (in Dutch)G. BinnenmarsRAP\121BHT.R10P1A

[2] Title:

Author:Doc.no:Revision:

Interface Design DocumentRS232 Protocol between PCand FlowBus host and DPMprotocol between PC and PCISA card.W. KlarenIDDFBRS.DOCP1B

[3] Title:

Author:Doc.no:Revision:

Instruction Manual DigitalReadout and Control System E-6000 serie.-Preliminary version 28-11-1991

[4] Title:

Author:Doc. No:Revision:

Software Design DocumentFlow-Bus DLL FOR WIN32G. BinnenmarsSDDFLD32_B.DOCP1B

Page 229: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

IDDFLD32_D.doc - P1Drev. date: 1999-12-21

4

3 Application interface design

3.1 INTRODUCTIONThe interface from the PC to the DLL is based on several “C-functions” exported by the DLL.The data exchanged between application and DLL consists of minimal PROPAR informationand on application identification. See [3] for a definition of the PROPAR protocol.

3.2 REFERENCE

3.2.1 Data-structures

Several data-types used by the DLL and available for the applications are given below. Thefollowing conversion is used:• char, 1 byte• int, 2 bytes• float, 4 bytes• long, 4 bytes

Type Description RemarksHWND Windows typedef used for

handle of a windowsize is long

typedef int APPL_ID Unique applicationidentification number

size is int

typedef struct{int NrPorts,int PortNameLen,bool bInUse,char *szPortName…..} PORT_INFO

Gives an overview of thenumber of ports in the PC, andfor each port, the length of theport name, an in use indicationand the port name.

Size is varying

3.2.2 API - functions

The following functions are exported by the DLL.

Function Description Parameters Returnint OpenDLL(HWND hWnd)

Makes the applicationknown to the DLL.

hWnd - window handleof main windowapplication

0, on error>0, APPL_ID whichshould be used in almostevery function

void CloseDLL(APPL_ID id)

Tells the DLL that theapplication closes

id - applicationidentification

none

PORT_INFO *GetAvail-ableInterfaces()

Returns info about thephysical ports in thePC

none pointer to a varying sizestructure with port info(always valid)

int OpenCommunication(char *pszName)

Tries to open thespecified network.

pszName - name ofdevice port to beopened

return values: 0, on success > 0 in case of error (oneof the FBE_ errors )

Page 230: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

IDDFLD32_D.doc - P1Drev. date: 1999-12-21

5

Function Description Parameters Returnint CloseCommunication(APPL_ID id)

Tries to close theopened network.

id - applicationidentification

return values:0, on success> 0 in case of error (oneof the FBE_ errors)

int ConfigureRS232( char *pszName, unsigned int iBaud)

Configures the RS232baudrate and reopensthe port if RS232already open.

pszName - name of comport

iBaud - preferredbaudrate

return values: 0, on success > 0, on error (port isclosed)

int ConfigureT_NET( char cNode, char cSecNode, char cNextNode, char cLastNode, char cArbiter, char cTxBuf, char cRxBuf, char *pszName)

Configures theFlowBus settings andreopens the port withthe new settings. Usedfor both configuring thePC_ISA parameters ona PC_ISA Host and forthe PC_ISAparameters of theRS232 Host

cNode - node numbercard

cSecNode- secondarynode number

cNextNode - next nodenumber

cLastNode - last nodenumber

cArbiter - arbitration modecRxBuf - number of

receive bufferscTxBuf - number of

transmit bufferpszName - name of ISA

device port

return values: 0, on success > 0, on error

void GetRS232Config( char *pszName, unsigned int *piBaud)

Determines currentCom port settings

piBaud - storage forbaudrate

pszName - name of comport

none

void GetTNetConfig(char *pcNode, char *pcSecNode, char *pcNextNode, char *pcLastNode, char *pcArbiter, char *pcTxBuf, char *pcRxBuf, char *pszName)

Determines the currentFlowBus settings.

pcNode - storage for nodenumber

pcSecNode- storage forsecondary nodenumber

pcNextNode - storage fornext node number

pcLastNode – storage forlast node numberin network

pcArbiter - storagefor arbitrationmode

pcRxBuf -storagefor number ofreceive buffers

pcTxBuf - storagefor number oftransmit buffer

pszName - name ofISA port

none

void ConfigureChaining( bool bProc, bool bParm)

Sets usage ofchaining. Parametersare used immediately

bProc enable processchaining

bParm enable parameterchaining

none

void GetDLLVersion(char *pszVersion)

Determines the versionof the DLL

pszVersion Version ofthe DLL, if lessthan 5.0 theinterface is notvalid.

none

Page 231: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

IDDFLD32_D.doc - P1Drev. date: 1999-12-21

6

Function Description Parameters Returnint ReadChar(APPL_ID id, HWND hWnd, char cNode, char cProcNr, char cParmNr, int iMsgId)

Adds a parameter readrequest of type char tothe interface buffer ofthe DLL

id - applicationidentification

hWnd - notify windowhandle (NULLindicates polling)

cNode - destinationnode number

cProcNr - processnumber

cParmNr -parameternumber

iMsgId - messageidentificationused and filled inby application

return values: 0, on success >0, on error

int GetChar(APPL_ID id,char cNode,char cProcNr,char cParmNr,char *pcDest, int *piMsgId)

Retrieves theparameter that isreceived by the DLL.

id - applicationidentification

cNode - destinationnode number

cProcNr - processnumber

cParmNr - parameternumber

pcDest - pointer to charbuffer wheredata can bestored

piMsgId - pointer tomessage id.

return values:0, on success>0, on error

int ReadInt() equal as read_char()int GetInt() equal as get_char() piDest - pointer to int

buffer wheredata can bestored

int ReadFloat() equal as read_char()int GetFloat() equal as get_char() pfDest - pointer to float

buffer wheredata can bestored

int ReadLong() equal as read_char()int GetLong() equal as get_char() plDest - pointer to long

buffer wheredata can bestored

Page 232: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

IDDFLD32_D.doc - P1Drev. date: 1999-12-21

7

Function Description Parameters Returnint ReadString((APPL_ID id, HWND hWnd, char cNode, char cProcNr, char cParmNr, char cExpLen, int iMsgId)

Equal as read_char(),if cExpLen is 0 anASCII response stringis expected

id - applicationidentification

hWnd - notify windowhandle (NULLindicates polling)

cNode - destinationnode number

cProcNr - processnumber

cParmNr -parameternumber

cExpLen- expected stringlength or 0

iMsgId - messageidentificationused and filled inby application

return values: 0, on success >0, on error

int GetString(APPL_ID id, char cNode, char cProcNr, char cParmNr, int *piMsgId,char *pszDest,char *pcLen)

Retrieves the stringparameter that isreceived by the DLL.

id - applicationidentification

cNode - destinationnode number

cProcNr - processnumber

cParmNr - parameternumber

piMsgId - pointer tomessage id.

pszDest - pointer to charbuffer for datastorage

pcLen - char pointer forstorage of stringlength (in case ofASCII stringtrailing zeroincluded)

return values:0, on success>0, on error

int GetRealTimeChar(APPL_ID id,char cNode,char cProcNr,char cParmNr,char *pcDest,long *plTime, int *piMsgId)

Retrieves theparameter that isreceived by the DLL.

id - applicationidentification

cNode - destinationnode number

cProcNr - processnumber

cParmNr - parameternumber

pcDest - pointer to charbuffer wheredata can bestored

plTime - timestamppiMsgId - pointer to

message id.

return values:FBE_NO_ERROR, onsuccess

FBE_NO_ANSWER_-FOUND, on error

FBE_NO_EVENT, whenno event present onrealtime channel

int GetRealTimeInt() equal asGetRealTimeChar()

int GetRealTimeLong() equal asGetRealTimeChar()

int GetRealTimeFloat() equal asGetRealTimeChar()

Page 233: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

IDDFLD32_D.doc - P1Drev. date: 1999-12-21

8

Function Description Parameters Returnint WriteChar(APPL_ID id, HWND hWnd, char cNode, char cProcNr, char cParmNr, unsigned char ucPar, int iMsgId)

Adds a parametersend request of typechar to the interfacebuffer of the DLL

id - applicationidentification

hWnd - notify windowhandle (NULLindicates polling)

cNode - destinationnode number

cProcNr - processnumber

cParmNr - parameternumber

ucPar - parametervalue

IMsgId - messageidentificationused and filled inby application

return values:0, on success>0, on error

This function will alsotrigger the different tasksin the DLL to do someaction.

int WriteInt() equal as write_char() uiPar - parameter valueint WriteFloat() equal as write_char(0 fPar - parameter valueint WriteLong() equal as write_char() lPar - parameter valueint WriteString(APPL_ID id, HWND hWnd, char cNode, char cProcNr, char cParmNr, char cLen, char *pszBuf, int iMsgId)

Adds a parametersend request of typestring to the interfacebuffer of the DLL

id - applicationidentification

hWnd - notify windowhandle (NULLindicates polling)

cNode - destinationnode number

cProcNr - processnumber

cParmNr -parameternumber

cLen - length of string(0 for ASCIIstrings)

pszBuf - pointer to stringiMsgId - message

identificationused and filled inby application

return values: 0, onsuccess 1, on error

int GetStatus(APPL_ID id, char cNode, char cProcNr, char cParmNr, char *pcStatus, int *piMsgId)

Retrieves the statusthat the DLL receivedon one of the write_xxxcommands.

id - applicationidentification

cNode - destinationnode number

cProcNr - processnumber

cParmNr -parameternumber

pcStatus - pointerto integer bufferwhere status canbe stored

piMsgId- message id.

return values: 0, onsuccessFBE_XXXX (1 .. 30), onerror

Page 234: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

IDDFLD32_D.doc - P1Drev. date: 1999-12-21

9

Function Description Parameters Returnint GetError() Indicates if a network

error occurred andclears the possibleerror.

None return value:0, no error occurredIE_BADID (-1) Thedevice identifier is invalidor unsupported or lack ofmemory IE_OPEN (-2)

The device isalready open. IE_NOPEN (-3)

The device is notopen. IE_MEMORY (-4)

The functioncannot allocate thequeues. IE_DEFAULT (-5)

The defaultparameters are in error. IE_HARDWARE (-10)

The hardware isnot available(is locked by anotherdevice).IE_BYTESIZE (-11)

The specified bytesize is invalid. IE_BAUDRATE (-12)

The device's baudrate is unsupported.FBE_PROTOCOLL_ERROR, error in received dataFBE_SEND_ERROR,error sending dataFBE_OPEN_COMM, forPC-ISA in case com portnot openedFBE_CLOSE_COMM, forthe PC-ISA card in casenetwork not openedFBE_HOST_OVERFLOW, for PC-ISA in case tomany messages send toHost

Page 235: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

IDDFLD32_D.doc - P1Drev. date: 1999-12-21

10

Function Description Parameters Returnint CheckReceivedMsg( APPL_ID id, char *pcNode, char *pcProc, char *pcParm, char *pMType, char *pcType, int *piMsgId)

Indicates if a messageis available for theapplication. If so, thennode, process,parameter, type andmsg id. are filled.

Id - applicationidentification

pcNode - destinationnode number

pcProc - processnumber

pcParm - parameternumber

pMType - indicates type ofmessage(send/ask)

pcType - indicates theanswer is on aReadXxx() or ona WriteXxx()request.

piMsgId- message id.

return value:0, on success>0, on error (no messageavailable)

If no answer is availableand time since the last callto this function is morethen 10 msec, the internalstate-machine istriggered. This is used forpolling in case the ISAcard is used.

int ClaimCommand(APPL_ID id, HWND hWnd, char cNode, char cProcNr, int iMsgId);

Adds a claim processmessage to the DLL

id - applicationidentification

pcNode - destinationnode number

pcProc - processnumber

piMsgId- message id.

return value:0, on success>0, on error

int UnClaimCommand(APPL_ID id, HWND hWnd, char cNode, char cProcNr, int iMsgId);

Adds an unclaimprocess message tothe DLL

id - applicationidentification

pcNode - destinationnode number

pcProc - processnumber

piMsgId- message id.

return value:0, on success>0, on error

int GetClaimStatus(APPL_ID id, char cNode, char cprocNr, char *pcStatus, int *piMsgId);

Determines the answeron the claim request

id - applicationidentification

cNode - destinationnode number

cProcNr - processnumber

pcStatus statuspiMsgId- message id.

return value:0, on success>0, on error

int StartBroadcast(APPL_ID id, HWND hWnd, char cNode, char cProcNr, char cRepTime, int iMsgId);

Adds an startbroadcast processmessage to the DLL

id - applicationidentification

cNode - destinationnode number

cProcNr - processnumber

cRepTime repetitiontime in 10 msec.

iMsgId - message id.

return value,0, on success>0, on error

intGetStartBroadcastStatus(APPL_ID id, char cNode, char cProcNr, char *pcStatus, int *piMsgId)

Determines the answeron the start broadcastrequest

id - applicationidentification

cNode - destinationnode number

cProcNr - processnumber

pcStatus statuspiMsgId- message id.

return value:0, on success>0, on error

Page 236: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

IDDFLD32_D.doc - P1Drev. date: 1999-12-21

11

Function Description Parameters Returnvoid RemoveMsg( APPL_ID id, char cNode, char cProc, char cParm)

Deletes a read answerfrom the DLL

id application ident.cNode desti. node nrcProc process numbercParm parameter

number.

None

void GetInterfaceType(char *pszName)

Indicates the networkcurrently used. Defaultis COM1.

pszName - name ofdevice currentlyused

none

int GetCommunication() Indication if theconnection with theHost is correct.

none return value:0, no connection1, connection ok

intGetNrPendingMessages(APPL_ID id)

Determines thenumber of outstandingrequests of theapplication.

Id - application ident. return value: number ofrequests

void SetSystemLNA(int iNode)

Sets the last nodeaddress in the network(default 125). Has tobe called in front ofReadSystemConfig

iNode - last nodenumber

none

int GetSystemLNA(void) Returns last nodeaddress.

None last node address

int ReadSystemConfig(int iNode)

Reads the systemconfiguration andbuilds the channeldatabase.

iNode - last node toscan ( 0 meansstop scan inprogress)

return value:0, on success1, communication notopen2, scan already inprogress3, busy with open/close orchange communicationaction

int FindFirstFreeNode(int iStartNode)

Scans the network forthe first node addressnot in use

iStartNode - address ofnode wheresearch shouldstart (0 meanscancel previoussearch)

return value:0, on error(communication closed,busy with other action,already searching node)> 0 node found

char GetProgress() Gives an indication ofthe progress of theReadSystemConfigand FindFirstFreeNodefunctions

none progress of action as apercentage

int GetChannel(int iNode,int iProc)

Determines thechannel correspondingwith the node andprocess

iNode - node addressiProc - process number

return value:0, on error> 0 channel number

bool GetNodeProc(int iChannel,int *piNode,int *piProc)

Gets node andprocess from achannel

iChannel - channelnumber

piNode - storage for nodepiProc - storage for

process

return value,false (0), channel notfoundtrue, channel found

int GetModuleType(int iNode)

Determines moduletype on node address

iNode - node address return value:0, on error> 0 module type

void GetModuleNumber(int iNode,char *pszIDNumber)

Determines themodule serial numberon node address

iNode - node addresspszIDNumber - storage

for serial number

none

Page 237: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

IDDFLD32_D.doc - P1Drev. date: 1999-12-21

12

Function Description Parameters Returnint GetModuleDevType(int iNode)

Determines themodule functionalgroup

iNode - node address return value,module function type

int GetMaxChannel() Retrieves maximumchannel number

none maximum channel value

int GetMaxNode() Retrieves maximumnode number

none maximum node addressfound

Notes:1. MsgId. is an identification number applied by the application. It is not used inside the DLL.

The DLL just copies it back in the answer. The application can use this message id. forown purposes. For example, root the answer back to a specific part of the program.

2. APPL_ID is an identification number of the application. It is assigned by the DLL when anapplication calls OpenCommunication. This identification is used in WIN16 by the DLL toconnect the received answers back to the correct application. In WIN 32 it can be used toidentify threads in an application.

3.2.3 Error values

The following table gives an overview of possible error values.

Name Value DescriptionFBE_NO_ERROR 0 No errorFBE_PROCESS_CLAIM 1 STATUS RESPONSE MODULE, this process

cannot be operated by this module */

FBE_COMMAND 2 STATUS RESPONSE MODUL, no suchcommand possible for this module

FBE_PROCESS 3 STATUS RESPONSE MODULE, no suchprocess at this module

FBE_PARM_NUMBER 4 STATUS RESPONSE MODULE, no suchparameter at this process

FBE_PARM_TYPE 5 STATUS RESPONSE MODULE, type ofparameter sent differs from type on module

FBE_PARM_VALUE 6 DLL ERROR, wrong value for this parameter ornot accepted

FBE_NETWORK_NOT_ACTIVE

7 HOST ERROR, no communication activity onFLOW-BUS detected

FBE_TIME_OUT_START_CHAR

8 HOST ERROR, start character serialcommunication failed

FBE_TIME_OUT_SERIAL_LINE

9 HOST ERROR, serial communication failed

FBE_MODULE_HARDWARE_MEM

10 memory on FLOW-BUS module failed

FBE_NODE_ADDRESS 11 wrong node numberFBE_COMMUNICATION 12 HOST ERROR, general communication error

with FLOW-BUSDLL_ERROR, retires expired

FBE_READ_ONLY_PARM 13 this parameter value can only be read

Page 238: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

IDDFLD32_D.doc - P1Drev. date: 1999-12-21

13

Name Value DescriptionFBE_PC_COMMUNI-CATION

14 there is no communication between PC andFLOW-BUS

FBE_RS232_CONNECTION 15 HOST_ERROR, no/bad connection betweenPC and a RS232-module

FBE_PC_MEMORY 16 DLL ERROR, not enough memory in your PCfor communication structure

FBE_WRITE_ONLY_PARM 17 this parameter value can only be send

FBE_SYS_CONFIG_UNKNOWN

18 FLOW-BUS system configuration is unknown

FBE_NO_FREE_NODE_ADDR

19 FLOW-BUS system reached maximum size (32nodes)

FBE_WRONG_INTERFACE_TYPE

20 need other type of interface for this option

FBE_BUILD_DCB 21 DLL_ERROR, error building device controlblock serial port

FBE_OPEN_COMM 22 DLL ERROR, open communication went wrong

FBE_COMM_STATE 23 DLL ERROR, communication status error

FBE_INTERFACE_BUSMASTER

24 interface tries to start communication (alone insystem)

FBE_TIMEOUT_ON_RX_ANSWER

25 time out on rx answer

FBE_NO_START_CHAR 26 HOST ERROR, no ':' on start of message

FBE_FIRST_DIGIT 27 HOST ERROR, error in first digit

FBE_HOST_OVERFLOW 28 HOST ERROR, buffer overflow in host

FBE_BUFFER_OVERFLOW 29 DLL ERROR, buffer overflow in DLL

FBE_NO_ANSWER_FOUND

30 DLL ERROR, requested answer not found

FBE_CLOSE_COMM 31 DLL ERROR, closing communication error

FBE_SYNCHRON_ERROR 32 DLL ERROR, other application performs action

FBE_SEND_ERROR 33 DLL ERROR, requested msg. not send

FBE_PROTOCOL_ERROR 34 DLL ERROR, error in received data

FBE_NO_EVENT 35 DLL ERROR, no event present on realtime-channel

Page 239: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

IDDFLD32_D.doc - P1Drev. date: 1999-12-21

14

3.3 PROCEDURES

3.3.1 Using the DLLThis paragraph explains the minimal steps necessary to use the DLL.1. First an application opens the DLL and gets an application id. (Function OpenDLL). The

DLL start the internal threads. Default the DLL sets the RS232 connection as the activenetwork.

2. The application should check the software version. (Function GetDLLVersion)3. The application should set the chaining attributes. Default the DLL supports both process

and parameter chaining. Process chaining is not supported on older FlowBus modules.Therefor process chaining should be disabled. (Function ConfigureChaining should becalled with the parameters (false, true))

4. The application should determine a free network it wants to use. First the number of portsshould be determines (Function GetNrPorts), then for each port the name and an in-useindication should be determined (Function GetPort).

3 The application should configure the network (port) it wants to use.• In case the application wants to use an ISA card it configures the specified card

(Function ConfigureTNet with device name, node number, secondary node, next nodeand arbitration mode (only device name and arbitrage are used internally)).

• In case the application wants to use a RS232 host it should configure both the nameand baudrate of the com port and also the ISA settings the RS232 host should use.From the ISA settings only the arbitrage will be used and then only for old host types.(Functions ConfigureTNet and ConfigureRS232). See also 3.3.3

5. The application opens the communication on a specified port. (FunctionOpenCommunication)

6. The application performs some communication task actions.7. The application closes the communication (Function CloseCommunication)8. The application ends the connection with the DLL, the application tells the DLL is closes

and the DLL closes all threads (Function CloseDLL)

3.3.2 Open and Closing communicationThis paragraph explains how communication can be opened and closed.1. After the application has obtained an application id. It should determine which physical

network is available, if any. (Function GetAvailableInterfaces or GetNrPorts + GetPort).2. Then the application opens the communication (Function OpenComm ) with a free port

returned in 1.3. If the communication is already open, it is closed automatically. All messages that are in

the DLL buffer that still have to be send are flushed. The physical port is opened.4. In case of an RS232 host it is checked if this node is already installed on a node number

(only true for new host types), if so this node number will be used.5. In contrast, old RS232 hosts and all ISA hosts are started by the DLL on node 0. In this

case the DLL searches for a free node number. If a node is found the host is installed tothis free node number.

6. The DLL checks if the host takes part in the network arbitrage scheme for a maximum of20 seconds.

7. When the application closes the communication, (Function CloseCommunication) the DLLfirst waits till an answer is received on pending messages. Afterwards the physical port isclosed and messages that still have to be send, are flushed

8. If the application closes it is not necessary to close the communication. The DLL will closethe communication when the application calls CloseDLL() or if the DLLEntryPoint functionis called with PROCESS_DETACH (the DLL is unloaded from memory).

9. The communication can be checked (Function GetCommunication) which indicates if theconnection with the Host is correct (or at least the DLL thinks this connection is correct).

3.3.3 Configuring communication

Page 240: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

IDDFLD32_D.doc - P1Drev. date: 1999-12-21

15

1. First there is a FlowBus configuration for the Host. The current configuration can bedetermined (Function GetTNetConfig). The configuration can be changed (FunctionConfigureTNet). These functions apply both to the settings of the PC-ISA card and to theFlowBus settings of the RS232 Host.Only if the function ConfigureTNet is called when a port is open the host will use all theISA settings. The physical port is claimed (wait till there are no more messages pending tothe modules). Then the port is closed and reopened with the new settings.

2. Second there is the RS232 configuration. The current configuration can be determined(Function GetRS232Config) The settings can be changed (Function ConfigureRS232). Ifthe RS232 port is opened and ConfigureRS232 is called, the port is claimed, than closedand then reopened with the new settings.

3. If an application calls ConfigureTNet and ConfigureRS232 at the same time. The last callis only used to store the settings internally. This can happen with two threads in oneapplication.

The following table lists the internal usage of the FlowBus settings:

Port Open Host Type FlowBus SettingsUsed

No new RS232 (withauto-install)

none

No old RS232 secondary node +arbitration

No ISA host device name +arbitration

Yes new RS232 all settings except devicename

Yes old RS232 all settings except devicename

Yes ISA host all settings

Table 1 Usage of ConfigureTNet settings.

3.3.4 Sending / Receiving data• First an application opens the DLL and gets an application id. See 3.3.1• Next the DLL opens a physical network. See 3.3.2• An application can now start placing messages in the Interface-Buffer (Functions

‘ReadXxx’ or ‘WriteXxx’).• If the application passes a valid Window Handle the DLL will notify the application

when an answer is received, otherwise the DLL has to poll the DLL (FunctionCheckReceivedMsg. )

• If an answer is received, the application should first check if a network error occurred(Function GetError).

• Parameters returned with CheckReceivedMsg are node, process, parameter andrequest-type for which an answer is received. The following steps are dependent of themessage type:- parameter send: determine the status of the answer (GetStatus).

This can be a status response from the Host or an internal error value from the DLL.- parameter ask: determine the status of the answer (GetStatus) to check for error responses. If no error occurred, call one of the GetXxx functions to determine the received parameter value- claim: determine the status of the answer (GetClaimStatus)

to check for errors.- unclaim: determine the status of the answer (GetClaimStatus)

to check for errors

Page 241: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

IDDFLD32_D.doc - P1Drev. date: 1999-12-21

16

- broadcast: determine the status of the answer(GetStartBroadcastStatus) to check for errors

• The application can now remove the message data from the DLL buffer (FunctionRemoveMsg)

To prevent the application places too many requests in the DLL (with a corresponding longperiod between request and response) the application can ask for the number of outstandingrequest (Function GetNrPendingMessages).

To get a better throughput of requests (performance) the following notes give some ideas:1. Place requests on a timer interval and continue with requests while

GetNrPendingMessages is still smaller than 100 messages2. Try to place several requests for the same node at the same time (to make use of the

chaining of request)3. Try to place requests for different nodes at the same time (the hosts support at this

moment concurrent requests for 5 different nodes)4. Maintain a start point, at this point the application should wait till all pending requests are

handled. This should prevent that the interface buffer gets filled with one kind of slowrequest. An overflow because some kind of request to some kind of node takes more timethan the other kind of requests.

3.3.5 Database functionsInternally the DLL maintains a database of FlowBus Channels. Each node at least as onechannel assigned to it. A channel represents a single process in a node. Nodes with severalinputs can have more than one channel. This database is available after the application callsReadSystemConfig. This function takes as parameter the number of nodes to scan, startingfrom 1. This parameter should be filled in based on system knowledge. The maximum nodevalue supported is 125. The channel database is sorted. Controller modules come in front ofoperator and interface modules.

Page 242: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

IDDFLD32_D.doc - P1Drev. date: 1999-12-21

17

4 Physical Interface design

There are three lower level interfaces:1. serial interface with RS232 host, described in [2]2. DPM interface with ISA host on Win95 operating system, described in [2]3. DeviceIOControl function interface with ISA Device Driver on Win NT4.0 operating system

Page 243: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

IDDFLD32_D.doc - P1Drev. date: 1999-12-21

18

A. Example application program

This appendix gives a short programming example.

1. Initialisation

char pszPortName[MAX_PORT_LEN];bool chain_proc;bool chain_parm;NETWORK_TYPE net;int idTimer;HWND NotifyHandler;int polling_period;char Version[10];APPL_ID AppId;

GetDLLVersion(Version);// check version, only continue if appropriate…// determine current configurationAppId = OpenDLL(NULL);strcpy(pszPortName, "COM1");if (GetCommunication())

{ GetInterfaceType(pszPortName); if (strncmp(pszPortName, "COM", 3) == 0) net = RS232;

else net = T_NET;

if (net == T_NET){

idTimer = SetTimer(1, polling_period); // NotifyHandler = NULL;

}else

{ NotifyHandler = this->HWindow; } }

chain_proc = false; chain_parm = true; ConfigureChaining(chain_proc, chain_parm);

2. Open RS232 portRS232_SET set;

TNET_SET set_tnet; char pszPort[MAX_PORT_LEN];

char szName[MAX_PORT_LEN];int iRes;

GetRS232Config(pszPort, (unsigned short *)&set.baudrate);GetTNetConfig(&set_tnet.cNode, &set_tnet.cSecNode,

&set_tnet.cNextNode, &set_tnet.cLastNode, &set_tnet.cArbiter, &set_tnet.cTxRetries, &set_tnet.cRxRetries, szName);

// change settings as necessarysprintf(pszPort, “COM1”);iRes = ConfigureTNet(set_tnet.cNode, set_tnet.cSecNode,

set_tnet.cNextNode, set_tnet.cLastNode, set_tnet.cArbiter, set_tnet.cTxRetries, set_tnet.cRxRetries, szName);

iRes = ConfigureRS232(pszPort, set.baudrate);

Page 244: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

IDDFLD32_D.doc - P1Drev. date: 1999-12-21

19

iRes = OpenCommunication(pszPort);

3. Send some request and check answers

char buffer[125];char cNode;char cParm;char cProc;char cStatus;char mType;char cType;int iError;short iMsgId;

float fDest;long lDest;int msg_rec = 0;

int error_rec = 0;

if (GetNrPendingMessages(AppId) <= pInputScript->GetCyclusSize()){

// number of pending messages smaller than max. number of messages that // can be send in a cyclus

bRes = pInputScript->HandleNext();// e.giRes = WriteChar(AppId, NotifyHandler, 1, 0, 3, 125, MsgId++);iRes = ReadInt(AppId, NotifyHandler, 1, 1, 1, MsgId++);

}while (CheckReceivedMsg(AppId, &cNode, &cProc, &cParm, &mType, &cType,

&iMsgId) == FBE_NO_ERROR){

// answer availableiError = GetError(); //get info about network errorif (iError == FBE_NO_ERROR){ switch (mType)

{ case PARM_SEND_TYPE:

// get info about error or status responseiError = GetStatus(AppId, cNode, cProc, cParm, &cStatus,

&iMsgId);if (cStatus <= FBE_PARM_VALUE){

ReportStatus(AppId, cNode, cProc, cParm, cStatus);}else{

ReportError(AppId, cNode, cProc, cParm, cStatus);}

break; case PARM_ASK_TYPE:

// get info about error or status responseGetStatus(AppId, cNode, cProc, cParm, &cStatus, &iMsgId);if (cStatus == FBE_NO_ERROR){

switch (cType){case PARM_CHAR:

if (GetChar(AppId, cNode, cProc, cParm, (char *)&lDest, &iMsgId) ==

FBE_NO_ERROR)

Page 245: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

IDDFLD32_D.doc - P1Drev. date: 1999-12-21

20

ReportParm(AppId, cNode, cProc, cParm, PARM_CHAR, (char)lDest);

elseReportError(AppId, cNode, cProc,

cParm, FBE_NO_ANSWER_FOUND);break;

default:// handle other parm types…break;

}}else

// handle errorbreak;

default:// handle other message typesbreak;

}}else{

// handle error}RemoveMsg(AppId, cNode, cProc, cParm);

}

4. TerminateiRes = CloseCommunication(); // not really necessaryCloseDLL(AppId); // required

Page 246: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

INSTRUCTION MANUAL

RS232 INTERFACEwith FLOW-BUS protocol

FOR DIGITAL MASS FLOW / PRESSURE INSTRUMENTS

Doc. no.: 9.17.027 BDate: 18-06-2001

Multi-bus

ATTENTION:Before installing and operating the instrument itis recommended that this instruction be read.Not following the guidelines could result inpersonal injury and/or damage to the equipment.

Page 247: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

Short form start-up

All necessary settings for this module are already performed at Bronkhorst High-Tech B.V.To follow next steps carefully is the quickest way to get this module operational in your own system.

Procedure:

- Make sure your PC or PLC is connected to the RS232 interface by means of the correct cable

• Multibus instruments need a special cable with T-connector (7.03.313) see figure 1.• RS232/FLOW-BUS interfaces need a one-on-one 9-pole cable without crossings with male

and female connector• Cable lengths for RS232 must not exceed 10 meters.

- Make sure instrument or interface is powered (+15Vdc or +24Vdc)

- In case of RS232/FLOW-BUS interface without micro-switch and LED’s, first see that interfacegets a free address on the FLOW-BUS. Follow initialisation procedure described at [InitialisingRS232/FLOW-BUS interface]

- Use settings [19200,n,8,1] for your COM-port: Baudrate = 19K2 Baud, no parity, 8 databits, 1stopbit.

- Start sending messages as described in following paragraphs.

- In case of trouble programs like Hyperterminal (available in MS-Windows) or FlowDDE (fromBronkhorst High-Tech B.V.) could be very usefull.

Page 248: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 3

Table of contents

1 INTRODUCTION........................................................................................................................................ 42 Available interfaces .................................................................................................................................... 5

2.1 RS232/FLOW-BUS interface .............................................................................................................. 52.1.1 D-connector for RS232 ................................................................................................................ 52.1.2 Specifications ............................................................................................................................... 5

2.2 RS232 on multibus instrument ............................................................................................................ 62.2.1 D-Connector for analog operation, power, RS232:...................................................................... 62.2.2 Specifications multibus RS232: ................................................................................................... 72.2.3 Connection diagram interface cable (7.03.313):.......................................................................... 7

3 FLOW-BUS protocol description ................................................................................................................ 83.1 General................................................................................................................................................ 83.2 Initialising RS232/FLOW-BUS interface.............................................................................................. 83.3 Communication messages.................................................................................................................. 83.4 Chaining .............................................................................................................................................. 93.5 Status message................................................................................................................................... 93.6 Send parameters............................................................................................................................... 113.7 Request parameter............................................................................................................................ 113.8 Initialising RS232/FLOW-BUS interface............................................................................................ 133.9 Examples........................................................................................................................................... 14

3.9.1 Sending setpoint ........................................................................................................................ 143.9.2 Sending chained parameters ..................................................................................................... 143.9.3 Request setpoint ........................................................................................................................ 163.9.4 Request chained parameters..................................................................................................... 16

4 Dual interface operation ........................................................................................................................... 195 Parameter information .............................................................................................................................. 20

5.1 General.............................................................................................................................................. 205.2 Parameter properties......................................................................................................................... 235.3 Parameter values: ............................................................................................................................. 29

6 Troubleshooting........................................................................................................................................ 38

Page 249: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 4

1 INTRODUCTION

This manual will explain how to communicate with a Bronkhorst High-Tech instrument to your PC/PLC usingRS232 serial communication. You have to write software yourself using the information of this document inorder to be able to operate these instruments.

Bronkhorst High-Tech B.V. also offers software to support a quicker way to operate digital instruments withyour PC using MS-Windows 95, 98, NT or 2000.

On the highest supported communication level, you may use DDE-channels for Windows application-programs with this facility. You can use the program FlowDDE for easy connection between MS-Windowsapplications (e.g. Excel, Visual Basic, LabView, Delphi, Borlandc) and digital instruments.There are several examples available for LabView, Visual Basic and Excel environments.

On a lower communication level, you can also use the FLOWB32.DLL for reading/changing parametervalues.

To read and write parameter values from or to FLOW-BUS devices directly through the available interfacesthere is a special protocol for messages between these devices.This protocol has been specially developped for Bronkhorst High-Tech equipment so no third partyequipment can be connected.It consists of a hierarchical setup for instruments/nodes (max. 128) containing processes (max. 128) withparameters (max. 32) which values can be set to certain values to enable settings/properties for theinstruments.

When operating a FLOW-BUS system with a HOST computer, you need to know this message protocol ifyou choose to drive the interfaces directly.

When you use a new type of RS232/FLOW-BUS (baudrates up to 38K4 with switch and 2 LEDs) interfaceyou first have to initialize the interface. This can be done by means of sending some ASCII-strings to theinterface through RS232 or by means of the micro-switch. See chapter 2 for more details.When you communicate directly via RS232 on a multibus instrument, no special initialisation is needed.

Page 250: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 5

2 Available interfaces

2.1 RS232/FLOW-BUS interface

The RS232/FLOW-BUS interface is an interface between the FLOW-BUS and the RS232 V24 serial(computer) port.It will either be supplied as a separate enclosed unit with a FLOW-BUS connector and a RS232 connector oras an integral 14TE module of your E-7000 readout and control system.The converter offers communication with a baudrate up to 38,4 kBaud.Communication software support is available. Communication settings are: 38400,n,8,1.

2.1.1 D-connector for RS232The female RS232 (x) (subminiature 9-pin) D-connector has the following pin configuration:

Pinnumber Description123456789

not connectedTXDRXDnot connected0 VdDTRCTSRTSShield

2.1.2 SpecificationsPower supply +15Vdc/+24Vdc +/- 10%Power consumption +15Vdc : 50 mA

+24Vdc : 35 mAOperatingtemperature

0…+50 ºC

Storing temperature -20…+60 ºCHousingdimensions

box: 160x80x44mmmodule: 14TE

Baudrates 4800 Baud9600 Baud19200 Baud38400 Baud

Galvanic Isolation FLOW-BUS: opto isolated

FLOW-BUS

RS232

FLOW-BUS status

Page 251: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 6

Power : DC-DC converter

2.2 RS232 on multibus instrument

The RS232 interface on a multibus instrument can be connected to any RS232 V24 serial (computer) port.The interface offers communication with a baudrate of 19.2 kBaud.On the 9-pin male subD connecter of the instrument RX and TX are available on pin 6 and pin 1 (see tablebelow).

2.2.1 D-Connector for analog operation, power, RS232:Pinnumber Description123456789

TX-RS232Analog outputAnalog input (setpoint)sense+ValveRX-RS232+15Vdc/+24Vdccommon/0 VdcShield

No handshaking facilities are used. On the side of the PC/PLC a nul-modem connector is needed.Communication settings are: 19200,n,8,1.Bronkhorst High-Tech B.V. offers a special cable needed for communication (7.03.313).

Communication software support is available.

7.03.300

RS2327.03.313

+15Vdc/+24Vdc

Page 252: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 7

2.2.2 Specifications multibus RS232:Operatingtemperature

0…+70 ºC

Storing temperature -20…+60 ºCBaudrates 19200 BaudGalvanic Isolation not for RS232

The multibus RS232 interface is a serial interface between the multibus instrument and the RS232 V24 serial(computer) port using the FLOW-BUS protocol for communication.This means that for serial RS232 communication a multibus instrument with RS232 can be treated as aFLOW-BUS system with one instrument and a FLOW-BUS/RS232 interface.All available software already existing for FLOW-BUS RS232 communication can be used for multibusinstruments also. Only initialization is different. Use of FLOWDDE32 is only possible from V4.23 and higher.

2.2.3 Connection diagram interface cable (7.03.313):

Ana log /RS2329 pin sub-Dchassis part male

1

2

4

3

5

6

7

8

9

1

2

4

3

5

6

7

8

9

Ana log /RS2329 pin sub-Dcable part female

TX-RS232

Analog output

Analog input (setpoint)

sense

+15 Vdc/ +24Vdc

Common/0 Vdc

Shield

+Valve

instrument

RX-RS232

6 7 8 954321

RS232 COM-por t a t PC

Power

Page 253: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 8

3 FLOW-BUS protocol description

3.1 GeneralOn the highest supported communication level, you may use DDE-channels for Windows application-programs with this facility.

On a lower communication level, you can use the FLOWB32.DLL, FLOWBUS.DLL or FLOWBUS.LIB, forchanging parameter values.

To read and write parameter values from or to FLOW-BUS devices directly through the available interfacesthere is a special protocol for messages between these devices. When operating a FLOW-BUS system witha HOST computer, you need to know this message protocol if you choose to drive the interfaces directly.

When you use a type of RS232/FLOW-BUS interface (baudrate up to 38K4) you first have to initialise theinterface. This can be done by means of sending some ASCII-strings to the interface through RS232.How this should be implemented is described in 3.88

3.2 Initialising RS232/FLOW-BUS interfaceWhen you use a digital instrument with RS232 interface, baudrate is fixed on 19K2 baud and no specialinitialisation is needed. Through the serial line connected to a COM-port of your computer or to a PLC youhave to communicate with the instrument using the FLOW-BUS protocol.Each instrument has its own node-address (3...120). If you want to send a message to the instrument youhave to know this node-address. However, if you send a message to node-address 128 the instrument willalways respond to your message. On a point-to-point connection like RS232 it is the easiest way to make thecommunication work under all circumstances (its independant of the real node-address of the instrument).

3.3 Communication messagesCommunication messages between FLOW-BUS interfaces and other devices consist of command stringswith specific information. This command string is either ASCII (RS232) or BINARY. Basically the stringcontains several information bytes. Through RS232 these hexadecimal bytes are converted in ASCII (f.i.:bytevalue 0x0A is "0A" in ASCII and capital letters should be used). Messages via RS232 are preceded bythe ':' character and terminated with "\r\n" (Carriage return-Line-feed).

There are several COMMANDS available in the FLOW-BUS messages. However only Command RD (04)and WR (01) are enough to do all the standard parameter reading and writing. A RD command will beanswered with a WR command, containing the value asked for or a status message, containing an error-number. A WR command will be answered with a status message, containing an error-number (if error-number = 0, than WR command was OK).

Note:ASCII character ‘:’ has hexadecimal value: 3AASCII character ‘\r’ has hexadecimal value: 0DASCII character ‘\n’ has hexadecimal value: 0A

Communication commandsCommand Description

00 Status message01 Send parameter with destination address, will be answered with type 00 command02 Send parameter with destination address, no status requested03 Send parameter with source address, no status requested04 Request parameter, will be answered with type 02 or 00 command05 Instruction: send parameter repeatedly (followed by byte with repeating time)06 Stop process07 Start process08 Claim process09 Unclaim process

Page 254: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 9

To access a specific parameter you need to know the following numbers.

1. Node-address, each FLOW-BUS device is connected to a specific node-address in the system.2. Process number, each device (node) consists of several processes.3. Parameter number, each process consists of several parameters.4. Parameter type, each parameter can be of a different type and value.

For parameters numbers and values see PARTABLE.DOC and PARVALUE.DOC

Parameter typesType Id Bytes RangeCharacter 00h 1 0…255Integer 20h 2 0…65535Float 40h 4 +-1.18e-38...+-3.39e+38Long 40h 4 4 bytes 0... 4294967296String 60h X length needs to be specified

3.4 ChainingChaining can be used to send or request more than one parameter per message. When the parameters areall members of the same process, they can be chained at parameter level. When the parameters aremembers of different processes, they can be chained at process level. A combination is also possible.For chaining at parameter level the first bit of the parameter number should be set if there is followinganother parameter at the same process. For chaining at process level the first bit of the process numbershould be set if there is another process following.

3.5 Status messagestatusNr Byte Description0 : Start character

1 04 Fixed message length 4.

2 Node Node address

3 00 Command status

Page 255: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 10

4 Status 00 No error01 Process claimed02 Command error03 Process error04 Parameter error05 Parameter type error06 Parameter value error07 Network not active08 Time-out start character09 Time-out serial line0A Hardware memory error0B Node number error0C General communication error0D Read only parameter.0E Error PC-communication0F No RS232 connection10 PC out of memory11 Write only parameter12 System configuration unknown13 No free node address14 Wrong interface type15 Error serial port connection16 Error opening communication17 Communication error18 Error interface busmaster19 Timeout answer1A No start character1B Error first digit1C Buffer overflow in host1D Buffer overflow1E No answer found1F Error closing communication20 Synchronisation error21 Send error22 Protocol error23 Buffer overflow in module

5 Index orClaimed process

Index pointing to the first byte in the send message for witch the above status applies.In case of the status CLAIM ERROR, this field contains the claimed process.

6 ‘\r’ Carriage Return

7 ‘\n’ Line Feed

*Note: Value from byte 5 of status message may be neglected if value of byte 4 = 0 !

Page 256: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 11

3.6 Send parametersSendNr Byte Layout Description0 : start character1 Length Message length2 Node Node address3 01 or 02 Command write, for type 01 a status message (00) will be returned

c Process chained4 Process Cppppppp

p Process numberc Parameter chainedt Parameter type

5 Parametertype

Cttppppp

p Parameter number6 Value 1 Value for all types. For ‘strings’ this field contains the string length.

7 Value 2 Value for type ‘integer’, ‘float’ or ‘long’.

8 Value 3 Value for type ‘float’ or ‘long’.

9 Value 4 Value for type ‘float’ or ‘long’.

X Value x More value fields follow for type ‘string’ depending on string length. If givenstring length is zero, the final field should also contain a zero.

X+1 ‘\r’ Carriage Return

X+2 ‘\n’ Line Feed

3.7 Request parameterFor each requested parameter an index number can be given. The answering node will return this indexnumber with the requested parameter. This can be used to check which parameter is returned when severalparameters are requested.

RequestNr Byte Layout Description0 : start character1 Length Message length2 Node Node address3 04 Command read

c Process chained4* Process (return) Cppppppp

p Process numberc Parameter chainedt Parameter type

5* Parameter type &index (return)

Cttnnnnn

n Parameter index 0…31- Not used6 Process -ppppppp

p Process number- Not usedt Type parameter

7 Parameter -ttppppp

p Parameter number8 String length For parameter type ‘string’ this field contains the expected string length.9 ‘\r’ Carriage Return10 ‘\n’ Line Feed

Page 257: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 12

Answer of requestNr Byte Layout Description0 : start character1 Length Message length2 Node Node address3 02 Command write

c Process chained4* Process Cppppppp

p Process numberc Parameter chainedt Parameter type

5* Parameter type& index

Cttnnnnn

n Parameter index 0…316 Value 1 Value for all types. For ‘strings’ this field contains the string length.

7 Value 2 Value for type ‘integer’, ‘float’ or ‘long’.

8 Value 3 Value for type ‘float’ or ‘long’.

9 Value 4 Value for type ‘float’ or ‘long’.

X Value x More value fields follow for type ‘string’ depending on string length. Ifgiven string length is zero, the final field should also contain a zero.

X+1 ‘\r’ Carriage Return

X+2 ‘\n’ Line Feed

*The requested module copies these values from the request message directly into the answer message.

Page 258: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 13

3.8 Initialising RS232/FLOW-BUS interfaceIf you use a RS232/FLOW-BUS interface for communication (without the micro-switch and 2 LED’s), notethat this module is not part of the (FLOW-BUS) token-ring network, directly at power-up. This means that it isalways necessary to re-initialise the module when power has been interrupted!

This is not the case when using an RS232/FLOW-BUS interface with micro-switch, red LED, green LED andRJ45 connector for FLOW-BUS. By means of the switch you may force the interface to find a free addresson the FLOW-BUS once. You may skip the initialisation and start directly sending messages.

Also when using digital (Multibus) instruments with RS232 directly on the instrument it is not needed toinitialise (give a free node-address to) the instrument on the FLOW-BUS because instrument is not physicallyconnected to the FLOW-BUS, but only uses the same protocol. You may start directly sending yourmessages to the instrument on either the node-address of the instrument in its memory e.g. node 3(selective response) or to node-address 128 (always response).

At power-up situation you can communicate with the RS232 interface only at the RS232 side via node 0. Toget part of the FLOW-BUS you have to send an init. command, send the network parameters PNA, SNA,NNA, LNA and BM and send a reset command. From this moment the interface is part of the FLOWBUS.Ensure the module gets a free and unique address on the bus, 2 modules on the same address will causecommunication problems. When you are sure that there are no more interfaces in the system, simply forcethe RS232/FLOW-BUS interface to address 1. This address is reserved for an interface.PC-support software (FLOWB32.DLL, FLOWBUS.DLL and FLOWBUS.LIB) will search for a free address onwhich the interface will be installed.

Follow the steps below to realise correct initialisation for this interface via RS232:

Initialisation RS232 interface (needed for FLOW-BUS/RS232 interfaces without switch and LEDs only)Send Response Comment:050001000A49\r\n* Init instruction for node 0 process 0.

:04000000XX\r\n No error.:050001000101\r\n PNA = Primary Node Address = 1

:04000000XX\r\n No error.:05000100027F\r\n SNA = Secondary Node Address = 127

:04000000XX\r\n No error.:050001000302\r\n NNA = Next Node Address = 2

:04000000XX\r\n No error.:050001000420\r\n LNA = Last Node Address = 32 (depends on system size)

:04000000XX\r\n No error.:050001000502\r\n BM = Bus Management = 67

67 = everything automatically (auto arbitration+gap skipping) 3 = auto arbitration2 = always busmaster1 = temporaryIn older systems: when no R/C-modules in system make BM= 2, when R/C-modules in system (already busmasterspresent) than make BM = 1; otherwise make = 67

:04000000XX\r\n No error.:050001000A52\r\n Reset instruction for module; from this moment on module will

be active on FLOW-BUS at node address = PNA:04000000XX\r\n No error.

• Sometimes it could be necessary to repeat the first instruction. Wait approx. 2 seconds before sendingthe next command.

• XX means: don’t careCommunication can be closed and interface can be disabled from FLOW-BUS token-ring traffic by sendingthe command below via the RS232 to the interface.

Stop communication RS232 interfaceSend Comment:050101001101\r\n close communication instruct. for interface module there will be no aswer (because

Page 259: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 14

communication stops) second byte is actual node address for interface (here: 01)

3.9 Examples

3.9.1 Sending setpointSending setpoint 50% to node 3 process 1. Setpoint values should be given in a range from 0 to 32000 sofor this example 16000 should be send.

Node 1 sends to node 3Nr Byte Layout Description0 ':' Start character1 06 Length 62 03 Node 33 01 Command write with status response

C 00 Process not chained4 01 00000001

P 01 Process 1C 00 Parameter not chainedT 20 Parameter type ‘integer’

5 21 00100001

N 01 Parameter number 16 3E

7 80

Setpoint 16000 = 3E80h

8 ‘\r’ Carriage Return9 ‘\n’ Line Feed

Answer node 3 to node 1Nr Byte Description0 ‘:’ Start character

1 04 Fixed message length 4.

2 01 Node address 01

3 00 Command status

4 00 Status ok.

5 05 Status ok, value points to end of send message.

6 ‘\r’ Carriage Return

7 ‘\n’ Line Feed

3.9.2 Sending chained parametersModule at node 1 sends following parameters to module at node 3:Process 0: INIT MODE (10), 64 = soft initProcess 1: FLUIDNUMBER(16). 1Process 1: POLYNOMIAL CONSTANTE A(5), 0.0Process 1: POLYNOMIAL CONSTANTE B(6), 1.0Process 1: POLYNOMIAL CONSTANTE C(7), 0.0Process 1: POLYNOMIAL CONSTANTE D(8), 0.0Process 0: INIT MODE (10), 82 = reset initmode.

Send parameters to node 3Nr Byte Layout Description0 ':'

1 1D Length 292 03 Node 33 01 Command write with status response

C 80 Process chained4 80 10000000

P 00 Process 05 0A 00001010 C 00 Parameter not chained

Page 260: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 15

T 00 Parameter type ‘character’N 0A Parameter number 10

6 40 01000000 Parameter value 64 set soft init modeC 80 Process chained7 81 10000001

P 01 Process 1C 80 Parameter chainedT 40 Parameter type ‘float’

8 C5 11000101

N 05 Parameter number 59 00

10 00

11 00

12 00

Parameter value ‘float’ 0.0

C 80 Parameter chainedT 40 Parameter type ‘float’

13 C6 11000110

N 06 Parameter number 614 3F

15 80

16 00

17 00

Parameter value ‘float’ 1.0

C 80 Parameter chainedT 40 Parameter type ‘float’

18 C7 1100111

N 07 Parameter number 719 00

20 00

21 00

22 00

Parameter value ‘float’ 0.0

C 80 Parameter chainedT 40 Parameter type ‘float’

23 C8 11001000

N 08 Parameter number 824 00

25 00

26 00

27 00

Parameter value ‘float’ 0.0

C 00 Process not chained28 00 00000000

P 00 Process 0C 00 Parameter not chainedT 00 Parameter type ‘character’

29 0A 00001010

N 0A Parameter number 1030 52 01010010 Parameter value 82, reset init mode31 ‘\r’ Carriage Return32 ‘\n’ Line Feed

Page 261: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 16

Answer node 3 to node 1Nr Byte Description0 ‘:’ Start character

1 04 Fixed message length 4.

2 03 Node address

3 00 Command status

4 00 Status ok.

5 1C Status ok, value points to end of send message.

6 ‘\r’ Carriage Return

7 ‘\n’ Line Feed

3.9.3 Request setpointRequest setpoint from node 3 process 1, type integer.Request by node 1Nr Byte Layout Description0 ':'

1 06 Length 62 03 Node 33 04 Command read

C 00 Process not chained (return)4 01 00000001

P 01 Process 1 (return)C 00 Parameter not chained (return)T 20 Parameter type ‘integer’ (return)

5 21 00100001

N 01 Parameter index 1 (return)6 01 -0000001 P 00 Process 17 21 -0100001 T 20 Parameter type ‘integer’

P 01 Parameter number 1 ( setpoint)8 ‘\r’ Carriage Return9 ‘\n’ Line Feed

Answer by node 3Nr Byte Layout Description0 ':'

1 06 Length 62 03 Node 33 02 Command write

C 00 Process not chained4 01 00000001

P 01 Process 1 ( receiving process)C 00 Parameter chainedT 20 Parameter type ‘integer’

5 21 00100001

N 0C Parameter index 16 3E

7 80

Value 3E80h = 16000 = 50%

8 ‘\r’ Carriage Return9 ‘\n’ Line Feed

3.9.4 Request chained parametersModule at node 1 sends a request for the following parameters to module at node 3:Process 0: LNA(5), ARBITRAGE(6), CHANNELS(12) and INSTRUMENT TYPE(13).Process 1: POLYNOMIAL CONSTANTES A(5), B(6), C(7), D(8) and FLUIDNUMBER(16).

Page 262: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 17

Request by node 1Nr Byte Layout Description0 ':'

1 1F Length 312 03 Node 33 04 Command read

C 80 Process chained (return)4 81 10000001

P 01 Process 1 (return)C 80 Parameter chained (return)T 00 Parameter type ‘character’ (return)

5 8C 10001100

N 0C Parameter index 12 (return)6 00 -0000000 P 00 Process 0

T 00 Parameter type ‘character’7 04 -0000100

P 04 Parameter number 4C 80 Parameter chained (return)T 00 Parameter type ‘character’ (return)

8 8D 10001101

N 0D Parameter index 13 (return)9 00 -0000000 P 00 Process 0

T 00 Parameter type ‘character’10 05 -0000101

N 05 Parameter number 5C 80 Parameter chained (return)T 00 Parameter type ‘character’ (return)

11 8E 10001110

N 0E Parameter index 14 (return)12 00 -0000000 P 00 Process 0

T 00 Parameter type ‘character’13 0C -0001100

P 0C Parameter number 12C 00 Parameter not chained (return)T 00 Parameter type ‘character’ (return)

14 0F 00001111

N 0F Parameter index 15 (return)15 00 -0000000 P 00 Process 0

T 00 Parameter type ‘character’16 0D -0001101

P 0D Parameter number 13C 00 Process not chained (return)17 01 00000001

P 01 Process 1 (return)C 80 Parameter chained (return)T 40 Parameter type ‘float’ (return)

18 D0 11010000

N 10 Parameter index 16 (return)19 01 -0000001 P 01 Process 1

T 40 Parameter type ‘float’20 45 -1000101

P 05 Parameter number 5C 80 Parameter chained (return)T 40 Parameter type ‘float’ (return)

21 D1 11010001

N 11 Parameter index 17 (return)22 01 -0000001 P 01 Process 1

T 40 Parameter type ‘float’23 46 -1000110

P 06 Parameter number 6C 80 Parameter chained (return)T 40 Parameter type ‘float’ (return)

24 D2 11010010

N 12 Parameter index 18 (return)25 01 -0000001 P 01 Process 126 47 -1000111 T 40 Parameter type ‘float’

Page 263: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 18

P 07 Parameter number 7C 80 Parameter chained (return)T 40 Parameter type ‘float’ (return)

27 D3 11010011

N 13 Parameter index 19 (return)28 01 -0000001 P 01 Process 1

T 40 Parameter type ‘float’29 48 -1001000

P 08 Parameter number 8C 00 Parameter not chained (return)T 00 Parameter type ‘character’ (return)

30 14 00010100

N 14 Parameter index 20 (return)31 01 -0000001 P 01 Process 1

T 00 Parameter type ‘character’32 10 -0010000

P 10 Parameter number 1633 ‘\r’ Carriage Return34 ‘\n’ Line Feed

Answer by node 3Nr Byte Layout Description0 ':'

1 22 Length 342 03 Node 33 02 Command write

C 80 Process chained4 81 10000001

P 01 Process 1 ( receiving process)C 80 Parameter chainedT 00 Parameter type ‘character’

5 8C 10001100

N 0C Parameter index 126 06 Parameter value 6

C 80 Parameter chainedT 00 Parameter type ‘character’

7 8D 10001101

N 0D Parameter index 138 43 Parameter value 67

C 80 Parameter chainedT 00 Parameter type ‘character’

9 8E 10001110

N 0E Parameter index 1410 01 00000001 Parameter value 1

C 00 Parameter not chainedT 00 Parameter type ‘character’

11 0F 00001111

N 0F Parameter index 1512 02 Parameter value 2

C 00 Process not chained13 01 00000001

P 01 Process 1 ( receiving process)C 80 Parameter chainedT 40 Parameter type ‘float’

14 D0 11010000

N 10 Parameter index 1615 00

16 00

17 00

18 00

Parameter value ‘float’ 0.0

C 80 Parameter chainedT 40 Parameter type ‘float’

19 D1 11010001

N 11 Parameter index 17

Page 264: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 19

20 3F

21 80

22 00

23 00

Parameter value ‘float’ 1.0

C 80 Parameter chainedT 40 Parameter type ‘float’

24 D2 11010010

N 12 Parameter index 1825 00

26 00

27 00

28 00

Parameter value ‘float’ 0,0

C 80 Parameter chainedT 40 Parameter type ‘float’

29 D3 11010011

N 13 Parameter index 1930 00

31 00

32 00

33 00

Parameter value ‘float’ 0,0

C 00 Parameter not chainedT 00 Parameter type ‘character’

34 14 00010100

N 14 Parameter index 2035 02 Parameter value 2

36 ‘\r’ Carriage Return

37 ‘\n’ Line Feed

4 Dual interface operation

When operating a controller (reading measured value and sending setpoint) for proper operation it isimportant that the controller gets its setpoint from the right source.Setpoints may come from different sources: analog input, fieldbus interface or RS232 or may be overruled byclose valve or open valve (purge) commands.Therefore it is important to know what is the setpoint source of the controller.This can be set by means of parameter controlmode (process 1, parameter 12).

In some cases it is possible that the setpoints may come from 2 sources at the same time.The last send setpoint will be valid and send to the controller.This is the case in controlmode = 0, when setpoints may come through any fieldbus interface or RS232.

However, there could be situations where control over the instrument seems impossible.This is the case when the instrument comes into a safe-state e.g. when fieldbus communication is disturbedor disconnected. Valve will be forced to a safe state automatically: closed (NC) or fully open (NO).

In case you want to get control back via RS232 operation, you have to change the controlmode.When controlmode gets value 18, safe state will be overruled and sending setpoints via RS232 interface willhave effect on the controller again.

See also document nr. 9.17.023 for more detailed description about digital instrument parameters and theirbehaviour.

Page 265: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 20

5 Parameter information

5.1 GeneralFLOW-BUS is used for parameter value exchange between instruments and operation modules (keyboard orPC-interface).Parameter information consists of several properties for behaviour within the FLOW-BUS system.In the parameter table you will find a list of parameters and their properties filled in.In the parameter value table values are described more detailed if necessary. These list consists mostly ofparameters for mode settings.

Property description in parameter table:Item DescriptionParameter unique parameter number (also used for DDE-communication : P(x))

Nameparameter name (max. 10 characters)used for parameter identification

process

process where parameter is used on FLOW-BUS moduleused for communication directly through RS232 when filled in the table, this value hasto be used (for parameters located in only 1 process)when empty in the table, process has to be determined from the FLOW-BUS systeminformation (for parameters located in more than one process, f.i. setpoint, measure);

FBnrparameter number in process on FLOW-BUS module used for commucication directlythrough RS232

VarType

variable type for information about amount of bytesc : (unsigned) char type; 1 byte; value 0..255i : (unsigned) integer type; 2 bytes; value 0..65535f : float type, 4 bytes, value +-1.18E-38..+-3.39E+38 (IEEE-floating point notation)l : (unsigned) long type, 4 bytes, value 0..4294967295data types > 1 byte are MSB first.

VarLength

variable length to indicate length of string of chars used in combination with VarType cfor transportation of strings through FLOW-BUS: value 0..65535VarLength indicates the amount of bytes for a parameter type-2: indicates that a string is zero-terminated, not defined for lengthX : indicates a string with a length of X bytes (characters)0 : means no info required.

Minminimum value of parameter allowed when parameter is read/written via RS232, thevalue will be checked on this limit (error when out of limit)

Maxmaximum value of parameter allowed when parameter is read/written via RS232, thevalue will be checked on this limit (error when out of limit)

Read indication if parameter is allowed to be read via FLOW-BUSWrite indication if parameter is allowed to be written via FLOW-BUS

Pollindication if parameter should be polled continuously by RS232 application in order tokeep (changing) parameter information up to date

Advancedindication if parameter is for advanced users only these are mainly parameters formaintenance/service

Securedindication if parameter is secured for use through FLOW-BUSreading this parameter is possible, but changing it needs special handling

High securityindication if parameter is highly secured (only few parameters)reading this parameter is possible, but changing it needs special handling

Description short description about meaning of parameter or what it is used for

Parameter acceptance:Changing parameter values is possible when a parameter is not read-only and not secured. The range andtype of parameters are described in the tables. When parameter values are out of range they will be either'clipped' on the nearest value allowed or you will get an error message: 'parameter value error'.

Parameter numbers:

Page 266: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 21

All parameter information is referenced to the parameter number. This is a unique number for a parameter toavoid redundancy. These numbers are needed for DDE communcation only.

Page 267: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 22

For communication with FLOW-BUS through other ways than DDE: directly via RS232 ASCII-strings or viaC-libraries (DOS or Windows), use the parameter numbers for the FLOW-BUS modules (in column FBnr ofPARTABLE). Now you will always have to know the node-address of the instrument on the FLOW-BUS, theprocess number on the instrument and the parameter number on the instrument.

Process nr could be read from the table or has to be determined, when nothing is filled-in. In most casesprocess number will be = 1.Node-address should be determined also. This is the node-address of the instrument on the FLOW-BUS.Newer RS232 protocols on multibus instruments accept node = 128. When sending messages to this nodeaddress, the message will be always accepted, unregarding the node-address of the instrument on the bus.When possible see system description added to manual for link between channels and node-processes.

NOTE:It is important to know that not all parameters are available on all FLOW-BUS/Multibus devices.For more details about parameters and their use see also document nr. 9.17.023 for description ofdigital instruments.If you have the program FLOWDDE, you can also get an overview of which parameters are availableon which devices.In other cases ask your local sales representative or send an e-mail [email protected].

Following tables will give information about parameters, their properties and their possible values.

Page 268: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

5.2 Parameter propertiesParameter

Name Process

FBnr VarType

VarLength

Min Max Read Write Poll Advanced Secured Description

1 identstrng 0 0 c -2 Yes Yes No No No identnr.+softwareversion[+serialnr.]2 pna 0 1 c 0 128 Yes Yes No Yes Yes primary node address: network parameter FLOW-BUS3 sna 0 2 c 0 128 Yes Yes No Yes Yes secundary node address: network parameter FLOW-BUS4 nna 0 3 c 0 128 Yes Yes No Yes No next node address: network parameter FLOW-BUS5 lna 0 4 c 0 128 Yes Yes No Yes No last node address: network parameter FLOW-BUS6 arbitrage 0 5 c 0 255 Yes Yes No Yes Yes FLOW-BUS arbitrage setting and/or automatic optimization7 initreset 0 10 c 0 255 Yes Yes No Yes No init and reset security key commands for network/parameter settings8 measure 0 i 0 65535 Yes No Yes No No measured value (100% = 32000)9 setpoint 1 i 0 32767 Yes Yes Yes No No setpoint: wanted value (100% = 32000)

10 setpslope 2 i 0 30000 Yes Yes No No No setpoint ramp signal 0..100 % in up to 3000 sec.11 analoginp 3 i 0 65535 Yes No Yes No No analog input signal, normally used for ext. setp. (100% = 32000)12 cntrlmode 4 c 0 255 Yes Yes No No No control mode selection for instrument or module13 polycnst A 5 f -10000000000 10000000000 Yes Yes No No Yes polynomial constant A (offset)14 polycnst B 6 f -10000000000 10000000000 Yes Yes No No Yes polynomial constant B (span]15 polycnst C 7 f -10000000000 10000000000 Yes Yes No No Yes polynomial constant C16 polycnst D 8 f -10000000000 10000000000 Yes Yes No No Yes polynomial constant D17 polycnst E 9 f -10000000000 10000000000 Yes Yes No No Yes polynomial constant E (offset) for setpoint or power value18 polycnst F 10 f -10000000000 10000000000 Yes Yes No No Yes polynomial constant F (span) for setpoint or power value19 polycnst G 11 f -10000000000 10000000000 Yes Yes No No Yes polynomial constant G for setpoint or power value20 polycnst H 12 f -10000000000 10000000000 Yes Yes No No Yes polynomial constant H for setpoint or power value21 capacity 13 f 0.0000000001 10000000000 Yes Yes No No Yes maximum value at 100% in sensor base units22 sensortype 14 c 0 255 Yes Yes No No Yes sensor type information for actual reading and sensor/controller indication23 capunit 15 c 0 255 Yes Yes No No Yes pointer to selected actual readout unit (index for list of readout units]24 fluidnr 16 c 0 7 Yes Yes No No No fluid number: pointer to polynome, name and cap.25 fluidname 17 c 10 Yes Yes No No Yes name of fluid26 claimnode 18 c 0 128 Yes Yes No Yes Yes node address of module with operation rights27 modify 19 c 0 255 Yes Yes No Yes No contains number(s) of changed parameters28 alarminfo 20 c 0 255 Yes No Yes No No status information of several alarms/errors in the instrument29 chanamount 0 12 c 1 120 Yes Yes No No No amount of channels which can be operated30 firstchan 0 13 c 1 120 Yes Yes No No No first channel that can be operated31 lastchan 0 14 c 1 120 Yes Yes No No No last channel that can be operated32 hostcontrl 9 1 c 0 1 Yes Yes No Yes No operation by HOST computer enable flag33 alrmmsgTA 10 0 c 16 Yes No Yes No No alarm message string with unit type information34 alrmmsgnr 10 1 c 16 Yes No Yes No No alarm message string with unit number information35 relstatus 10 2 c 8 Yes No No No No status of relays/potential free contacts36 actualval 0 f 0 1000000000 Yes No Yes No No actual value of counter37 signinpsel 1 c 8 Yes Yes No No No signal input selection38 resinpsel 2 c 8 Yes Yes No No No external reset input enable/disable

Page 269: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 24

39 limit 3 f 0 1000000000 Yes Yes No No No limit/batch for counter in sensor standard units40 delaytime 4 c 8 0 99265959 Yes Yes No No No delay time string in days,hours,minutes,seconds41 duratntime 5 c 8 0 99235960 Yes Yes No No No duration time string in days,hours,minutes,seconds42 vlvoutset 6 c 8 Yes Yes No No No valve output setting43 reloutset 7 c 8 Yes Yes No No No relay output setting44 opermodeTA 8 c 0 9 Yes Yes No No No operation mode of T/A module45 readunit 9 c 7 Yes No No No No readout unit string46 readfact 10 f 0.0000000001 10000000000 Yes No No No No readout factor matching readout unit string47 resetunit 12 c 0 1 No Yes No No No reset unit command48 TdValveDn 9 f 0 10000000000 Yes Yes No Yes Yes valve output differentiation time constant downwards49 TdValveUp 10 f 0 10000000000 Yes Yes No Yes Yes valve output differentiation time constant upwards50 TdSensorDn 11 f 0 10000000000 Yes Yes No Yes Yes sensor signal differentiation time constant downwards51 TdSensorUp 12 f 0 10000000000 Yes Yes No Yes Yes sensor signal differentiation time constant upwards52 CycleTime 114 12 c 1 255 Yes Yes No Yes Yes cycle time * 10 msec. main loop signal processing53 AnalogMode 115 3 c 0 255 Yes Yes No Yes Yes analog mode selection for analog operation54 VrefOutput 116 6 i 0 65535 Yes Yes No Yes Yes reference voltage output signal for analog operation55 ValveOut 114 1 l 0 16777216 Yes Yes Yes No No valve output signal (24-bit number in range 0…14.3Vdc/0…23.3Vdc)56 DynDispFct 117 1 f 0 1 Yes Yes No Yes Yes dynamic display factor for display filter (goes with par 57)57 StaDispFct 117 2 f 0 1 Yes Yes No Yes Yes static display factor for display filter (goes with par 56)58 CalMode 115 1 c 0 255 Yes Yes No Yes Yes calibration mode selection (not active until cntrlmode has been set to value59 ValveOffst 116 7 i 0 65535 Yes Yes No Yes Yes valve offset: amount of DAC steps within 1 potmeter step60 Monitor 115 2 c 0 255 Yes Yes No No Yes monitor: output signal (measure) selection for bus and analog output61 AlarmReg1 114 2 c 8 Yes Yes No No Yes alarm register containing warning flags62 AlarmReg2 114 3 c 8 Yes Yes No No Yes alarm register containing critical error flags63 CalRegZS1 116 1 l 0 16777216 Yes Yes No Yes Yes calibration register zero scale input 1 ADC64 CalRegFS1 116 2 l 0 16777216 Yes Yes No Yes Yes calibration register full scale input 1 ADC65 CalRegZS2 116 3 l 0 16777216 Yes Yes No Yes Yes calibration register zero scale input 2 ADC66 CalRegFS2 116 4 l 0 16777216 Yes Yes No Yes Yes calibration register full scale input 2 ADC67 ADCcntrReg 114 4 l 0 16777216 Yes Yes No Yes Yes ADC control register68 BridgePotm 116 5 c 0 255 Yes Yes No Yes Yes sensor bridge zero potmeter setting69 AlarmEnble 115 4 c 0 1 Yes Yes No Yes Yes broadcast alarm messsage enable flag70 TestMode 115 5 c 0 255 Yes Yes No Yes Yes test mode selection (not active until cntrlmode has been set to value 5)71 ChanSelect 115 6 c 1 32 Yes Yes No Yes Yes channel selection ADC72 ContrResp 114 5 c 0 255 Yes Yes No No Yes controller response for normal steps73 ErrInFilCo 117 3 f 0 1 Yes Yes No Yes Yes analog input filter constant74 ExpSmooCon 117 4 f 0 1 Yes Yes No Yes Yes sensor input filter constant75 AnOutCorZS 21 i 0 65535 Yes Yes No Yes Yes analog output correction factor zero scale (measure output)76 AnOutCorFS 22 i 0 65535 Yes Yes No Yes Yes analog output correction factor full scale (measure output)77 AnInpCorZS 23 i 0 65535 Yes Yes No Yes Yes analog input correction factor zero scale (external setpoint)78 AnInpCorFS 24 i 0 65535 Yes Yes No Yes Yes analog input correction factor full scale (external setpoint)79 TuningMode 115 7 c 0 255 Yes Yes No Yes Yes (auto)tuning mode selection (not active until cntrlmode has been set to value80 DefVlvType 114 6 c 0 255 Yes Yes No Yes Yes valve type (needed for controlling behaviour)

Page 270: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 25

81 GlobModify 0 19 c 0 255 Yes Yes No No No contains number(s) of changed processes for indirect polling82 SpanCorr 114 7 f 0 1 Yes Yes No Yes Yes correction factor valve curve ratio high/low area83 VlvCrvStps 114 8 c -2 Yes Yes No Yes Yes Valve curve correction for controller (max. factor*0.1, flow where factor = 1)84 MemShipNor 114 9 c -2 Yes Yes No Yes Yes array with memberships for normal Fuzzy controller85 MemShipOpn 114 10 c -2 Yes Yes No Yes Yes array with memberships for 0-open Fuzzy controller86 IOStatus 114 11 c 0 255 Yes Yes No Yes Yes IO status byte for jumper settings and LED signal modes87 FuzzStNeNo 114 13 c -2 Yes Yes No Yes Yes array with neg nor output steps for Fuzzy contr.88 FuzzStPoNo 114 14 c -2 Yes Yes No Yes Yes array with pos nor output steps for Fuzzy contr.89 FuzzStOpen 114 15 c -2 Yes Yes No Yes Yes array with open at 0 output steps for Fuzzy contr.90 DeviceType 113 1 c 6 Yes No No No No (FLOW-BUS) device type information string91 ModelNum 113 2 c 14 Yes Yes No No Yes model number information string92 SerialNum 113 3 c 20 Yes Yes No No Yes serial number information string (to be changed by Bronkhorst HT only)93 MfrConfig 113 4 c 16 Yes Yes No No Yes manufacturing configuration information string94 BHT1 118 1 c -2 Yes Yes No Yes Yes special BHT parameter (to be changed by Bronkhorst HT only)95 BHT2 118 2 i 0 65535 Yes No No Yes No special BHT parameter96 BHT3 118 3 l -3000000000 3000000000 Yes No No Yes No special BHT parameter97 BHT4 118 4 i 0 65535 Yes No No Yes No special BHT parameter98 BHT5 118 5 c 0 255 Yes No No Yes No special BHT parameter99 BHT6 118 6 c 0 255 Yes Yes No Yes No special BHT parameter

100 BHT7 118 7 c 0 255 Yes No No Yes No special BHT parameter101 BHT8 118 8 c 0 255 Yes No No Yes No special BHT parameter102 BHT9 118 9 l -3000000000 3000000000 Yes No No Yes No special BHT parameter103 BHT10 118 10 c 0 1 No Yes No Yes Yes special BHT parameter (to be changed by Bronkhorst HT only)104 PulseHight 114 16 c 0 255 Yes Yes No Yes Yes height of open at zero pulse train for valve105 Version 113 5 c 5 Yes No No No No revision number of firmware106 PressSensr 115 9 c 0 255 Yes Yes No Yes Yes type of pressure sensor107 BaroPress 116 8 f 800 1200 Yes Yes No No No mbar atmospheric (central) barometer pressure108 AnIn1CorZS 25 i 0 65535 Yes Yes No Yes Yes analog sensor signal input correction factor zero scale109 AnIn1CorFS 26 i 0 65535 Yes Yes No Yes Yes analog sensor signal input correction factor full scale110 AnIn2CorZS 27 i 0 65535 Yes Yes No Yes Yes analog Vref input correction factor zero scale111 AnIn2CorFS 28 i 0 65535 Yes Yes No Yes Yes analog Vref input correction factor full scale112 AnOu1CorZS 29 i 0 65535 Yes Yes No Yes Yes analog setpoint output correction factor zero scale113 AnOu1CorFS 30 i 0 65535 Yes Yes No Yes Yes analog setpoint output correction factor full scale114 Reset 115 8 c 0 255 No Yes No No No reset facilities (program/alarm/batchcounter)115 UserTag 113 6 c -2 Yes Yes No No Yes user definable alias string116 AlrmMaxLim 97 1 i 0 32767 Yes Yes No No Yes maximum limit for sensor signal to trigger alarm situation117 AlrmMinLim 97 2 i 0 32767 Yes Yes No No Yes minimum limit for sensor signal to trigger alarm situation118 AlrmMode 97 3 c 0 255 Yes Yes No No Yes alarm mode119 AlrmOutMod 97 4 c 0 255 Yes Yes No No Yes alarm relais activity mode during alarm situation120 AlrmStpMod 97 5 c 0 1 Yes Yes No No Yes setpoint change enable during alarm situation121 AlrmNwSetp 97 6 i 0 32767 Yes Yes No No Yes new/safe setpoint during alarm situation (until reset)122 CntrValue 104 1 f 0 9999999.99 Yes Yes Yes No Yes actual counter value

Page 271: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 26

123 CntrUnit 104 2 c 0 31 Yes Yes No No Yes counter unit124 CntrLimit 104 3 f 0 10000000 Yes Yes No No Yes counter limit/batch125 CntrOutMod 104 4 c 0 255 Yes Yes No No Yes counter relais activity mode when limit/batch has been reached126 CntrStpMod 104 5 c 0 1 Yes Yes No No Yes setpoint change enable during counter limit/batch situation (until reset)127 CntrNwSetp 104 6 i 0 32767 Yes Yes No No Yes new/safe setpoint at counter limit/batch situation (until reset) (normally = 0%)128 CntrUntstr 104 7 c 4 Yes No No No No readout string at counter (informative)129 capunitstr 31 c 7 Yes Yes No No Yes readout string at capunit (informative)130 CntrMode 104 8 c 0 255 Yes Yes No No Yes counter mode131 HwRev 113 7 c 1 Yes No No Yes No minimum required hardware revision level for firmware version132 RCreadfact 1 f 0.0000000001 10000000000 Yes No No No No readout factor for direct reading (changes with readunit: local on module,133 channumber 2 c 1 120 Yes Yes No No No channel number for operation134 masterchan 3 c 0 120 Yes Yes No No No master channel for master-slave operation135 RCslavefct 4 I 0 32000 Yes Yes No No No RC slave factor136 inputnode 5 c 0 128 Yes Yes No No Yes physical node address for channel number137 inputproc 6 c 0 128 Yes Yes No No Yes physical process for channel number138 RCreadunit 7 c 7 Yes No No No No readout unit for direct reading (local variable on module: read only)139 SlaveFact% 33 1 f 0 500 Yes Yes No No No slave factor for master slave control (setp = master output * slave factor)140 VrefInput 33 2 i 0 65535 Yes No Yes No No reference voltage input for setpoint signal141 RespStable 114 17 c 0 255 Yes Yes No No Yes controller response when controller is stable: |measure-setpoint| < 2%142 temperatur 33 7 f -50 100 Yes Yes Yes No No absolute temperature in degrees Celsius143 pressure 33 8 f -10000000 10000000 Yes Yes Yes No No absolute pressure in mbar144 time 33 9 f 0 1000000000 Yes No Yes No No time in milliseconds145 calvolume 33 10 f 0 1000000000 Yes Yes No No Yes calibrated volume in litres146 sensornr 16 c 0 4 Yes Yes Yes No No pointer to sensor number in calibration tube (FPP)147 rangeselct 115 10 c 0 99 Yes Yes Yes No No Piston Prover operation mode (write) and status information (read back)148 TimeOut 2 i 0 30000 Yes Yes No No Yes maximum admitted duration time for specific procedure149 frequency 33 9 f 0 100000 Yes No Yes No No frequency in Hz150 imp/m3 33 10 f 0 10000000000 Yes Yes No No Yes impulses per m3 volume151 RefVolFlow 33 5 f 0 10000000000 Yes No No No No volume flow referenced to normal conditions i.e. 0 °C, 1013.25 hPa(a) in152 volumeflow 33 6 f 0 10000000000 Yes No No No No volume flow at actual conditions in l/min153 delta-p 33 11 f -100000 100000 Yes No No No No relative pressure between atmosphere and sensor position154 scalefact 33 13 i 1 10000 Yes No No No No scaling factor (multiplication) for readout on display (for optimal resolution)155 sensorname 17 c 10 Yes Yes No No Yes label with information about stopsensor156 RstAlarmEn 97 9 c 0 15 Yes Yes No Yes Yes enable reset of alarm by: keyboard, external signal, FLOW-BUS, automatic157 RstCountEn 104 9 c 0 7 Yes Yes No Yes Yes enable reset of counter by: keyboard, external signal, FLOW-BUS,158 MasterNode 33 14 c 1 128 Yes Yes No No No node number of master instrument output signal for a slave159 MasterProc 33 15 c 1 128 Yes Yes No No No process number of master instrument output signal for a slave160 InstrNode 33 16 c 1 128 Yes Yes No No Yes node number of instrument to be operated by another module161 InstrProc 33 17 c 1 128 Yes Yes No No Yes process number of instrument to be operated by another module162 RangeMin 33 18 f -10000000000 10000000000 Yes Yes No Yes Yes minimum value at 0% for special user readout unit163 RangeMax 33 20 f -10000000000 10000000000 Yes Yes No Yes Yes maximum value at 100% for special user readout unit164 Relay/TTL 115 11 c 0 1 Yes Yes No Yes Yes relay/TTL output setting (disabled when used by alarm or counter)

Page 272: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 27

165 RespOpen0 114 18 c 0 255 Yes Yes No No Yes controller response when valve opens from zero166 ContrType 114 20 c 0 255 Yes Yes No Yes Yes controller settings for special purpose167 PIDKp 114 21 f -10000000000 10000000000 Yes Yes No Yes Yes PID factor Kp168 PIDKi 114 22 f -10000000000 10000000000 Yes Yes No Yes Yes PID factor Ki169 PIDKd 114 23 f -10000000000 10000000000 Yes Yes No Yes Yes PID factor Kd170 Density 33 21 f -10000000000 10000000000 Yes Yes No No Yes Density of selected fluid in kg/m3171 CalCertNr 113 8 c 15 Yes Yes No Yes Yes Number of calibration certificate (last basic calibration)172 CalDate 113 9 c 8 Yes Yes No Yes Yes Date of last (basic) calibration173 ServiceNr 113 10 c 15 Yes Yes No Yes Yes Servicenumber for repair/rebuilding/recalibration174 ServDate 113 11 c 8 Yes Yes No Yes Yes Date of last service action175 IdentNr 113 12 c 0 255 Yes Yes No Yes Yes Identification number (type) of instrument/device176 BHT11 118 11 c 0 255 No Yes No Yes Yes special BHT parameter (to be changed by Bronkhorst HT only)177 PowerMode 115 12 c 0 50 Yes Yes No Yes Yes power supply indication in Vdc178 Pupstream 113 13 f -100000 100000 Yes Yes No Yes Yes upstream pressure of fluid in bara (for first fluidnr only)179 Pdownstrm 113 14 f -100000 100000 Yes Yes No Yes Yes downstream pressure of fluid in bara (for first fluidnr only)180 Orifice 113 15 f 0 1000 Yes Yes No Yes Yes orifice diameter in mm181 FluidTemp 113 16 f -50 100 Yes Yes No Yes Yes temperature of fluid through instrument (for first fluidnr only)182 AlrmDelay 97 7 c 0 255 Yes Yes No No Yes time alarm and reset action will be delayed when alarm limit has been183 capacity0% 33 22 f -10000000000 10000000000 Yes Yes No No Yes capacity of instrument at zero 0% in sensor base units (mostly equal to zero)184 NumOfChan 0 18 c 0 120 Yes No No Yes No number of instrument channels available for this device185 DeviceFunc 0 20 c 0 255 Yes No No Yes No function of device186 ScanChan 123 1 c 1 255 Yes Yes No Yes No Channel number to scan with real time information (to be set once)187 ScanPar 123 3 c 0 255 Yes Yes No Yes No Parameter number to scan with real time information (to be set once)188 ScanTime 123 4 i 0 65535 Yes Yes No Yes No Scan interval time in msec between two samples (to be set once)189 ScanData 123 10 c -2 Yes No No Yes No Scanned data with time label (can be readout event by event)190 UValveOpen 114 24 f 0 24 Yes Yes No No Yes First-step offset voltage for valve when opening from 0% (Uopen-191 NrOfRuns 115 13 c 0 255 Yes Yes No Yes No Amount of runs of a piston prover192 MinProTime 115 14 c 0 255 Yes Yes No Yes No Minimum process time of a piston prover in 0.1 seconds193 LeakRate 116 9 f 0 1 Yes Yes No Yes Yes Leak rate piston prover194 ModeInfReq 115 15 c 4 Yes Yes No Yes Yes Sets instr. in info mode for 1 read-cycle to check available parameter options195 ModeInfOpt 115 16 c 255 Yes No No Yes No Gives info about possible values of a mode in an array as result of ModeInfo196 ModeInfDes 115 17 c 255 Yes No No Yes No Gives description about one of the mode options197 CalType 115 18 c 0 255 Yes Yes No Yes Yes Enables/disables options for calibration device (8 bits for 8 options)198 MassFlow 33 4 f 0 10000000000 Yes No No No No Real mass flow in kg/min199 BusAddress 125 10 c 1 126 Yes Yes No Yes Yes Station address for actual fieldbus system other than FLOW-BUS200 InterfConf 125 3 c 0 3 Yes Yes No Yes No Configuration setting for interface to other bus-systems201 Baudrate 125 9 l 0 10000000000 Yes Yes No Yes Yes Baudrate for actual fieldbus system other than FLOW-BUS202 BusDiagnos 125 20 c -2 Yes No No Yes No Bus diagnose string for actual fieldbus system other than FLOW-BUS203 NrOfVanes 115 22 c 0 255 Yes Yes No Yes Yes Number of vanes for use in a rotor meter204 Fieldbus 125 21 c -2 Yes No No Yes No Fieldbus for which instrument has been equiped205 fMeasure 33 0 f -10000000000 10000000000 Yes No No Yes No measured value for direct reading (in capunits, max.= capacity)206 fSetpoint 33 3 f 0 10000000000 Yes Yes No Yes No setpoint: wanted value for direct reading (in capunits, max.= capacity)

Page 273: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 28

207 Mass 33 23 f 0 10000000000 Yes No No No No Mass in g

Page 274: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

5.3 Parameter values:Parameter Name Filter Value Description

1 identstrng IdentNr (parameter 175) + serialnr/version nr2 pna 1..1283 sna 1..128 (pna/127=broadcast message receive enabled)4 nna 2..128 (pna+1) (automatic change by optimize function)5 lna 3..128 (automatic change by optimize function)6 arbitrage 1 temporary busmaster6 arbitrage 2 always busmaster6 arbitrage 3 automatic busmaster6 arbitrage 67 auto busmaster and auto bus optimalization (fast token ring)7 initreset ask BHT for use8 measure 0...32767 (32000=100 %)9 setpoint 0...32767 (32000=100 %)

10 setpslope 0...30000 (*0.1 seconds)11 analoginp 0...32767 (32000=100 %)12 cntrlmode 0 setpoint = BUS setpoint12 cntrlmode 1 setpoint = analog input12 cntrlmode 2 setpoint = master output(FLOW-BUS) * slave factor(FLOW-12 cntrlmode 3 close valve12 cntrlmode 4 setpoint idle (no reaction on changes in sensor signal)12 cntrlmode 5 testmode enable (select subject with par 70)12 cntrlmode 6 tuningmode enable (select subtject with par 79)12 cntrlmode 7 setpoint = 100%12 cntrlmode 8 purge valve (fully open)12 cntrlmode 9 calibration mode enable (select subject with par 58)12 cntrlmode 10 setpoint = master output(analog in) * slave factor(FLOW-BUS)12 cntrlmode 11 setpoint = keyboard OR FLOW-BUS setpoint12 cntrlmode 12 setpoint = 0%12 cntrlmode 13 setpoint = master output(FLOW-BUS) * slave factor(analog in)12 cntrlmode 14 (FPP) Range select mode12 cntrlmode 15 (FPP) Manual start sensor select, automatic end sensor12 cntrlmode 16 (FPP) Automatic start sensor select, manual end sensor12 cntrlmode 17 (FPP) Automatic start and end sensor12 cntrlmode 18 setpoint = RS232 setpoint13 polycnst A14 polycnst B15 polycnst C16 polycnst D17 polycnst E18 polycnst F19 polycnst G20 polycnst H21 capacity 100% value of instrument (goes with par 23)22 sensortype 0 pressure (controller)22 sensortype 1 liquid volume (controller)22 sensortype 2 liquid/gas mass (controller)22 sensortype 3 gas volume (controller)22 sensortype 4 other sensor type (controller)22 sensortype 128 pressure (sensor)22 sensortype 129 liquid volume (sensor)22 sensortype 130 liquid/gas mass (sensor)

Page 275: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 30

22 sensortype 131 gas volume (sensor)22 sensortype 132 other sensor type (sensor)23 capunit see table with capacity units (depends on sensor type)24 fluidnr25 fluidname26 claimnode 1...12827 modify 0xXX=modified par nr, 0xFF=more than on par changed28 alarminfo &H01 0 no error message in alarm error status register28 alarminfo &H01 1 at least 1 error message in alarm error status register28 alarminfo &H02 0 no warning message in alarm warning status register28 alarminfo &H02 1 at least 1 warning message in alarm warning status register28 alarminfo &H04 0 no minimum alarm message (measure>mimimum limit)28 alarminfo &H04 1 minimum alarm message for measured signal28 alarminfo &H08 0 no maximum alarm message (measure<maximum limit)28 alarminfo &H08 1 maximum alarm message for measured signal28 alarminfo &H10 0 batch counter has not reached its limit28 alarminfo &H10 1 batch counter has reached its limit28 alarminfo &H20 0 response O.K. (setpoint-measure within limit)28 alarminfo &H20 1 response alarm message: setpoint-measure is too high28 alarminfo &H40 0 master output signal O.K. (or not used)28 alarminfo &H40 1 master output signal not received: check master instrument28 alarminfo &H80 0 hardware O.K.28 alarminfo &H80 1 hardware error message: check your hardware29 chanamount30 firstchan31 lastchan32 hostcontrl33 alrmmsgTA34 alrmmsgnr35 relstatus '0' = not activated, '1' = activated36 actualval37 signinpsel ' '=no value,'+'=pos value,'-'=neg value input38 resinpsel 'E'=enable,' '=disable39 limit40 delaytime41 duratntime42 vlvoutset '0'=do nothing, '1'=close valve43 reloutset 'L'=low, 'H'=high, 'P'=pulse (1 sec.)44 opermodeTA 0 OFF44 opermodeTA 1 A: MAX & RESP AUTO; T: UP TO LIMIT44 opermodeTA 2 A: MIN & RESP AUTO; T: UP AND REPEAT44 opermodeTA 3 A: MAX & RESP; T: DOWN FROM LIMIT44 opermodeTA 4 A: MIN & RESP; T: DOWN AND REPEAT44 opermodeTA 5 A: MAXIMUM ALARM; T: ALWAYS UP44 opermodeTA 6 A: MINIMUM ALARM44 opermodeTA 7 A: RESPONSE ALARM45 readunit46 readfact47 resetunit 1=reset T/A unit48 TdValveDn49 TdValveUp50 TdSensorDn51 TdSensorUp

Page 276: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 31

52 CycleTime53 AnalogMode 0 0...5 Vdc operation53 AnalogMode 1 0...10 Vdc operation53 AnalogMode 2 0...20 mA operation53 AnalogMode 3 4...20 mA operation53 AnalogMode 4 15...20 mA operation54 VrefOutput55 ValveOut56 DynDispFct 0…1.0 (0= filter maximum, 1 = filter minimum)57 StaDispFct 0…1.0 (0= filter maximum, 1 = filter minimum)58 CalMode 0 idle: no action58 CalMode 1 adc self calibration58 CalMode 2 dmfc58 CalMode 3 dmfc58 CalMode 4 dmfc58 CalMode 5 dmfc58 CalMode 6 dmfc58 CalMode 7 dmfc58 CalMode 8 dmfc58 CalMode 9 zero sensor bridge circuit58 CalMode 10 adjust Vref output by connecting it to analog in58 CalMode 11 adjust analog out by connecting it to analog in58 CalMode 12 adjust valveoutput by connecting it to analog in58 CalMode 13 dmfc58 CalMode 14 dmfc58 CalMode 15 analog output = 0 %58 CalMode 16 analog output = 100 %58 CalMode 17 analog output = 50 %59 ValveOffst60 Monitor 0 (filtered) setpoint60 Monitor 1 controller error input signal60 Monitor 2 controller output signal to valve60 Monitor 3 sensor signal slow60 Monitor 4 sensor signal slow filtered60 Monitor 5 linearization output60 Monitor 6 differentiator output60 Monitor 7 differentiator output filtered60 Monitor 8 normal sensor signal (Output)60 Monitor 9 analog input signal60 Monitor 10 reference signal input (Vref)60 Monitor 11 mass flow in display unit (normally ln/min)60 Monitor 12 volume flow in l/min60 Monitor 13 temperature in °C60 Monitor 14 pressure absolute in mbara60 Monitor 15 time in msec/frequency in Hz.60 Monitor 16 calibrated volume at actual sensor in ml60 Monitor 17 delta-P pressure in mbarg60 Monitor 18 atmospheric (barometer) pressure in mbara60 Monitor 19 mass flow in kg/min61 AlarmReg162 AlarmReg263 CalRegZS164 CalRegFS1

Page 277: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 32

65 CalRegZS266 CalRegFS267 ADCcntrReg &H000FFF ADC filter selection: value = 5117.1875/-3dB freq.(Hz.)67 ADCcntrReg &H001000 0 ADC bipolar mode67 ADCcntrReg &H001000 1 ADC unipolar mode67 ADCcntrReg &H002000 0 ADC burn-out current off67 ADCcntrReg &H002000 1 ADC burn-out current on67 ADCcntrReg &H004000 0 ADC output compensation current off67 ADCcntrReg &H004000 1 ADC output compensation current on67 ADCcntrReg &H008000 0 ADC 16-bit word length67 ADCcntrReg &H008000 1 ADC 24-bit word length67 ADCcntrReg &H010000 0 ADC no power down mode (normal)67 ADCcntrReg &H010000 1 ADC power down mode67 ADCcntrReg &H020000 0 ADC input channel 1 selection67 ADCcntrReg &H020000 1 ADC input channel 2 selection67 ADCcntrReg &H1C0000 0 ADC gain = 1x67 ADCcntrReg &H1C0000 1 ADC gain = 2x67 ADCcntrReg &H1C0000 2 ADC gain = 4x67 ADCcntrReg &H1C0000 3 ADC gain = 8x67 ADCcntrReg &H1C0000 4 ADC gain = 16x67 ADCcntrReg &H1C0000 5 ADC gain = 32x67 ADCcntrReg &H1C0000 6 ADC gain = 64x67 ADCcntrReg &H1C0000 7 ADC gain = 128x67 ADCcntrReg &HE00000 0 ADC normal (sampling) mode67 ADCcntrReg &HE00000 1 ADC activate self calibration on selected channel67 ADCcntrReg &HE00000 2 ADC activate system calibration ZS on selected channel67 ADCcntrReg &HE00000 3 ADC activate system calibration FS on selected channel67 ADCcntrReg &HE00000 4 ADC activate system offset calibration on selected channel67 ADCcntrReg &HE00000 5 ADC activate background calibration on selected channel67 ADCcntrReg &HE00000 6 ADC read/write ZS calibration coefficients on sel. channel67 ADCcntrReg &HE00000 7 ADC read/write FS calibration coefficients on sel. channel68 BridgePotm69 AlarmEnble 0 disable69 AlarmEnble 1 enable70 TestMode 0 idle; no action70 TestMode 1 uProcessor70 TestMode 2 IO70 TestMode 3 RAM70 TestMode 4 FRAM70 TestMode 5 ADC70 TestMode 6 DAC70 TestMode 7 sensor70 TestMode 8 valve drive circuit70 TestMode 9 Vref70 TestMode 10 FLOW-BUS70 TestMode 11 calibration70 TestMode 12 keyboard71 ChanSelect 1 AD channel 171 ChanSelect 2 AD channel 272 ContrResp 128=normal, <128=slower, >128=faster73 ErrInFilCo 0…1.0 (0= filter maximum, 1 = filter minimum)74 ExpSmooCon 0…1.0 (0= filter maximum, 1 = filter minimum)75 AnOutCorZS DSCM-A: 0 = 0 offset, other modules: 32767 = 0 offset

Page 278: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 33

76 AnOutCorFS 2000 = 1 * multiplication77 AnInpCorZS DSCM-A: 0 = 0 offset, other modules: 32767 = 0 offset78 AnInpCorFS 2000 = 1 * multiplication79 TuningMode 0 idle; no action79 TuningMode 1 sensor79 TuningMode 2 valve79 TuningMode 3 Fuzzy controller normal operation79 TuningMode 4 Fuzzy controller open at zero79 TuningMode 5 PID controller80 DefVlvType 0 normally closed80 DefVlvType 1 normally opened80 DefVlvType 2 normally closed inverse controlled80 DefVlvType 3 normally opened inverse controlled80 DefVlvType 4 remain position81 GlobModify 0xXX=modified proc nr, 0xFF=more than one proc changed82 SpanCorr83 VlvCrvStps boost factor * 0.1, percentage from where amplification = 1*84 MemShipNor85 MemShipOpn86 IOStatus &H03 0 Red LED off86 IOStatus &H03 1 Red LED on86 IOStatus &H03 2 Red LED blinking slow86 IOStatus &H03 3 Red LED blinking fast86 IOStatus &H0C 0 Green LED blinking fast86 IOStatus &H0C 1 Green LED on86 IOStatus &H0C 2 Green LED blinking slow86 IOStatus &H0C 3 WINK; RED-GREEN-RED-GREEN blinking86 IOStatus &H10 16 0x10: external initialization jumper set86 IOStatus &H20 32 0x20: internal initialization jumper set86 IOStatus &H40 64 0x40: cntrlmode = 1: setpoint = analog input86 IOStatus &H80 128 0x80: special jumper set / micro switch pressed87 FuzzStNeNo88 FuzzStPoNo89 FuzzStOpen90 DeviceType91 ModelNum92 SerialNum93 MfrConfig94 BHT195 BHT296 BHT397 BHT498 BHT599 BHT6

100 BHT7101 BHT8102 BHT9103 BHT10104 PulseHight105 Version106 PressSensr 0 delta-P 0..5" W.C.106 PressSensr 1 delta-P 0...10" W.C.106 PressSensr 2 absolute pressure 800-1200 mbar

Page 279: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 34

106 PressSensr 3 absolute pressure 800-1100 mbar106 PressSensr 4 delta-P -5...0 "W.C.106 PressSensr 5 delta-P -10...0 "W.C.106 PressSensr 6 delta-P -10...+10 "W.C.106 PressSensr 7 delta-P 0...1 PSI106 PressSensr 8 delta-P -1...0 PSI107 BaroPress108 AnIn1CorZS DSCM-A: 0 = 0 offset, other modules: 32767 = 0 offset109 AnIn1CorFS 2000 = 1 * multiplication110 AnIn2CorZS DSCM-A: 0 = 0 offset, other modules: 32767 = 0 offset111 AnIn2CorFS 2000 = 1 * multiplication112 AnOu1CorZS DSCM-A: 0 = 0 offset, other modules: 32767 = 0 offset113 AnOu1CorFS 2000 = 1 * multiplication114 Reset 0 no reset114 Reset 1 reset counter value (no mode change) or common reset114 Reset 2 reset alarm114 Reset 3 restart batch counter114 Reset 4 reset counter value (counter off)114 Reset 5 Reset module (soft reset)115 UserTag116 AlrmMaxLim117 AlrmMinLim118 AlrmMode 0 off118 AlrmMode 1 alarm on absolute limits118 AlrmMode 2 alarm on limits related to setpoint (response alarm)118 AlrmMode 3 alarm when instrument powers-up (eg. after power-down)119 AlrmOutMod 0 no relais activity at alarm119 AlrmOutMod 1 relais pulses until reset119 AlrmOutMod 2 relais activated until reset120 AlrmStpMod 0 no setpoint change at alarm120 AlrmStpMod 1 new/safe setpoint at alarm enabled (set at par 121)121 AlrmNwSetp122 CntrValue123 CntrUnit see unit list table124 CntrLimit125 CntrOutMod 0 no relais activity at batch limit125 CntrOutMod 1 relais pulses after reaching batch limit until reset125 CntrOutMod 2 relais activated after reaching batch limit until reset126 CntrStpMod 0 no setpoint change at batch limit127 CntrNwSetp128 CntrUntstr129 capunitstr130 CntrMode 0 off130 CntrMode 1 counting upwards continuously130 CntrMode 2 counting up to limit (batchcounter)131 HwRev132 RCreadfact133 channumber134 masterchan135 RCslavefct136 inputnode137 inputproc138 RCreadunit

Page 280: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 35

139 SlaveFact%140 VrefInput147 rangeselct 0 calibration ready/stop147 rangeselct 1 run calibration until stopsensor 1/select range 1147 rangeselct 2 run calibration until stopsensor 2/select range 2147 rangeselct 3 run calibration until stopsensor 3/select range 3147 rangeselct 4 run calibration until stopsensor 4/select range 4147 rangeselct 5 run calibration and select range 5147 rangeselct 9 run calibration with automatic range selection147 rangeselct 19 run until stopsensor 1 until 3 values between limit147 rangeselct 29 run until stopsensor 2 until 3 values between limit147 rangeselct 39 run until stopsensor 3 until 3 values between limit147 rangeselct 49 run until stopsensor 4 until 3 values between limit147 rangeselct 59 run and select range 5 until 3 values between limit147 rangeselct 99 run with auto-select + 3 values between limit148 TimeOut149 frequency150 imp/m3151 RefVolFlow152 volumeflow153 delta-p154 scalefact155 sensorname156 RstAlarmEn 0 no reset possible156 RstAlarmEn 1 reset: keyboard156 RstAlarmEn 2 reset: external156 RstAlarmEn 3 reset: keyboard or external156 RstAlarmEn 4 reset: FLOW-BUS156 RstAlarmEn 5 reset: FLOW-BUS or keyboard156 RstAlarmEn 6 reset: FLOW-BUS or external156 RstAlarmEn 7 reset: FLOW-BUS or keyboard or external156 RstAlarmEn 8 reset: automatic156 RstAlarmEn 9 reset: automatic or keyboard156 RstAlarmEn 10 reset: automatic or external156 RstAlarmEn 11 reset: automatic or keyboard or external156 RstAlarmEn 12 reset: automatic or FLOW-BUS156 RstAlarmEn 13 reset: automatic or FLOW-BUS or keyboard156 RstAlarmEn 14 reset: automatic or FLOW-BUS or external156 RstAlarmEn 15 reset: automatic or FLOW-BUS or keyboard or external157 RstCountEn 0 no reset possible157 RstCountEn 1 reset: keyboard157 RstCountEn 2 reset: external157 RstCountEn 3 reset: keyboard or external157 RstCountEn 4 reset: FLOW-BUS157 RstCountEn 5 reset: FLOW-BUS or keyboard157 RstCountEn 6 reset: FLOW-BUS or external157 RstCountEn 7 reset: FLOW-BUS or keyboard or external157 RstCountEn 8 reset: automatic157 RstCountEn 9 reset: automatic or keyboard157 RstCountEn 10 reset: automatic or external157 RstCountEn 11 reset: automatic or keyboard or external157 RstCountEn 12 reset: automatic or FLOW-BUS157 RstCountEn 13 reset: automatic or FLOW-BUS or keyboard

Page 281: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 36

157 RstCountEn 14 reset: automatic or FLOW-BUS or external157 RstCountEn 15 reset: automatic or FLOW-BUS or keyboard or external166 ContrType &H01 0 valve in normal position after startup166 ContrType &H01 1 valve in safe position after startup166 ContrType &H02 0 open from zero with PID output to valve166 ContrType &H02 1 open from zero with ramp output to valve166 ContrType &H04 0 fixed monitor output signal166 ContrType &H04 1 monitor output changed at setpoint steps166 ContrType &H08 0 voltage drift compensation for valve output turned on166 ContrType &H08 1 voltage drift compensation for valve output turned off166 ContrType &H10 0 auto slope disabled166 ContrType &H10 1 auto slope enabled for pilot valves166 ContrType &H20 0 voltage drift compensation for valve output turned on166 ContrType &H20 1 voltage drift compensation for valve output turned off166 ContrType &H40 0 controller special mode (valve output steps) turned off166 ContrType &H40 1 controller special mode (valve output steps) turned on175 IdentNr 1 RS232/FLOW-BUS interface175 IdentNr 2 PC(ISA) interface175 IdentNr 3 ADDA4 (4 channels)175 IdentNr 4 R/C-module, 32 channels175 IdentNr 5 T/A-module175 IdentNr 6 ADDA1: 1 channel ADDA converter module175 IdentNr 7 DMFC: digital mass flow controller175 IdentNr 8 DMFM: digital mass flow meter175 IdentNr 9 DEPC: digital electronic pressure controller175 IdentNr 10 DEPM: digital electronic pressure meter175 IdentNr 11 ACT: single actuator175 IdentNr 12 DLFC: digital liquid flow controller175 IdentNr 13 DLFM: digital liquid flow meter175 IdentNr 14 DSCM-A: digital single channel module for analog instruments175 IdentNr 15 DSCM-D: digital single channel module for digital instr.175 IdentNr 16 FRM: FLOW-BUS rotor meter (calibration-instrument)175 IdentNr 17 FTM: FLOW-BUS turbine meter (calibration-instrument)175 IdentNr 18 FPP: FLOW-BUS piston prover/tube (calibration-instrument)175 IdentNr 19 F/A-module: special version of T/A-module175 IdentNr 20 DSCM-E: evaporator controller module (single channel)175 IdentNr 21 DSCM-C: digital single channel module for calibrators175 IdentNr 22 DDCM-A: digital dual channel module for analog instruments175 IdentNr 23 DMCM-D: digital multi channel module for digital instruments175 IdentNr 24 Profibus-DP/FLOW-BUS interface module175 IdentNr 25 FLOW-BUS Coriolis meter175 IdentNr 26 FLOW-BUS Balance Interface176 BHT11185 DeviceFunc 0 Unknown185 DeviceFunc 1 Interface185 DeviceFunc 2 ADDA185 DeviceFunc 3 Operator185 DeviceFunc 4 Supervisor (totalizer/alarm)185 DeviceFunc 5 Controller185 DeviceFunc 6 Meter185 DeviceFunc 7 Special185 DeviceFunc 8 (Protocol) converter197 CalType &H01 0 Manual capacity setting for optimal resolution

Page 282: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 37

197 CalType &H01 1 Automatic capacity setting for optimal resolution197 CalType &H02 0 Barometer value input via parameter 107: BaroPress197 CalType &H02 1 Barometer is master; input automatically from master200 InterfConf 0 Configuration A: 14 ch. Standard parms. with network scan200 InterfConf 1 Configuration B: 14 ch. Standard parms with fixed chan list200 InterfConf 2 Configuration C: 7 ch. Extended parms with fixed chan list200 InterfConf 3 Configuration D: 11 ch. Extended parms with network scan

Page 283: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 38

6 Troubleshooting

• RS232 communication problems Check cables. Make sure correct cables are used forspecific purpose.

Check address of interface (slave). Sendingmessages to node 128 will mostly be accepted bythe interface.

Try to reset the instrument and/or restart yourPC/PLC.

Make sure your messages are assembled accordingto FLOW-BUS protocol description.

Make sure the parameter values you try to read/writeare available and in the correct ranges (checktables).

Controller doesn’t respond on setpoints:- Check control mode, when 0 and other fieldbus

gives error: safe state will be entered, resulting insafe setpoint. Can be overruled by makingcontrolmode = 18 (RS232 only operation)

- Alarm or counter module in instrument forcessetpoint to alarm setpoint. Reset alarm orcounter and proceed.

- Setpoint slope could have very high value. Newsetpoints will be reached when this slope timehas been elapsed. Make setpoint slope smaller.

- Control mode could have other value than 0 or18. Check function when value is different.

- If measure doesn’t change check forwardpressure and piping (evt. shut-off valves).

- Make sure setpoints are within allowed range:0...32000 (= 0...100%).

- Make sure setpoints are send to properinstrument and process (mostly = 1) andparameter (FBnr for setpoint = 1), and type ofdata is correct (short integer = 2 bytes MSB first)

Contact local sales representative or servicedepartment.

• Other (FLOW-BUS) problems Contact Bronkhorst High-Tech local salesrepresentative or send e-mail describing yourproblem to: help.flowbus@bronkhorst com

Page 284: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

Instruction manual

RS232 interface With FLOW-BUS protocol

for digital Mass Flow / Pressure instruments

Doc. no.: 9.17.027G Date: 26-01-2006

ATTENTION Before installing and operating the instrument it is recommended that this instruction be read. Not following the guidelines could result in personal injury and/or damage to the equipment.

Page 285: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 2

SCOPE OF THIS MANUAL

This manual covers the interface part of digital massflow / pressure instruments for gases or liquids. It describes the communication between the instrument and the operator according to the specific (fieldbus) protocol. More information can be found in other documents. Multibus instruments have modular instruction manuals consisting of: - General instructions digital Mass Flow / Pressure instruments

laboratory style / IN-FLOW (document nr. 9.17.022) - General instructions CORI-FLOW (document nr. 9.17.031) - Operation instructions digital instruments (document nr. 9.17.023)

- Fieldbus/interface description:

Page 286: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 3

Short form start-up All necessary settings for this module are already performed at Bronkhorst High-Tech B.V. To follow next steps carefully is the quickest way to get this module operational in your own system. Procedure: - Make sure your PC or PLC is connected to the RS232 interface by means of the correct cable

• Multibus instruments need a special cable with T-connector. • RS232/FLOW-BUS interfaces need a one-on-one 9-pole cable without crossings with male

and female connector • Cable lengths for RS232 must not exceed 10 meters.

- Make sure instrument or interface is powered (+15Vdc or +24Vdc) - In case of RS232/FLOW-BUS interface without micro-switch and LED’s, first see that interface

gets a free address on the FLOW-BUS. Follow initialisation procedure described at [Initialising RS232/FLOW-BUS interface]

- Use settings [38400,n,8,1] for your COM-port: Baudrate = 38K4 Baud, no parity, 8 databits, 1

stopbit.

- Start sending messages as described in following paragraphs.

- In case of trouble programs like Hyperterminal (available in MS-Windows) or FlowDDE (from Bronkhorst High-Tech B.V.) could be very useful.

Page 287: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 4

Table of contents 1 INTRODUCTION ...................................................................................................................................5 2 Available interfaces................................................................................................................................6

2.1 RS232/FLOW-BUS interface...........................................................................................................6 2.1.1 D-connector for RS232 ............................................................................................................6 2.1.2 Specifications ..........................................................................................................................6

2.2 RS232 on multibus instrument ........................................................................................................7 2.2.1 Facilities ..................................................................................................................................8 2.2.2 Specifications multibus RS232: ................................................................................................8

3 FLOW-BUS protocol description ............................................................................................................9 3.1 General ..........................................................................................................................................9 3.2 Initialisation of local host interfaces on Multibus instruments ...........................................................9 3.3 Interface structure.........................................................................................................................10

3.3.1 Basic datalink format..............................................................................................................10 3.3.2 RS232 ASCII protocol............................................................................................................10 3.3.3 Enhanced binary protocol.......................................................................................................11

3.4 Communication messages............................................................................................................13 3.5 Chaining .......................................................................................................................................14 3.6 Status message............................................................................................................................14 3.7 Send parameters ..........................................................................................................................15 3.8 Request parameter .......................................................................................................................15 3.9 Initialising RS232/FLOW-BUS interface ........................................................................................17 3.10 Examples ..................................................................................................................................18

3.10.1 Sending setpoint ....................................................................................................................18 3.10.2 Sending chained parameters .................................................................................................18 3.10.3 Request setpoint....................................................................................................................20 3.10.4 Request chained parameters .................................................................................................21 3.10.5 Request measure ..................................................................................................................23 3.10.6 Request counter value ...........................................................................................................23

4 Dual interface operation.......................................................................................................................24 5 Parameter information .........................................................................................................................25 6 Troubleshooting...................................................................................................................................27 Appendices 1 Parameter properties table 2 Parameter values table

Page 288: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 5

1 INTRODUCTION This manual will explain how to communicate with a Bronkhorst High-Tech instrument to your PC/PLC using RS232 serial communication. You have to write software yourself using the information of this document in order to be able to operate these instruments. Bronkhorst High-Tech B.V. also offers software to support a quicker way to operate digital instruments with your PC using MS-Windows 95, 98, NT, 2000 or XP On the highest supported communication level, you may use DDE-channels for Windows application-programs with this facility. You can use the program FlowDDE for easy connection between MS-Windows applications (e.g. Excel, Visual Basic, LabView, Delphi, Borlandc) and digital instruments. There are several examples available for LabView, Visual Basic and Excel environments. On a lower communication level, you can also use the FLOWB32.DLL for reading/changing parameter values. To read and write parameter values from or to FLOW-BUS devices directly through the available interfaces there is a special protocol for messages between these devices. This protocol has been specially developed for Bronkhorst High-Tech equipment so no third party equipment can be connected. It consists of a hierarchical setup for instruments/nodes (max. 128) containing processes (max. 128) with parameters(FBnr) (max. 32) which values can be set to certain values to enable settings/properties for the instruments. When operating a FLOW-BUS system with a HOST computer, you need to know this message protocol if you choose to drive the interfaces directly. When you use a RS232/FLOW-BUS interface (without the micro-switch and 2 LED’s), you first have to initialise the interface. This can be done by means of sending some ASCII-strings to the interface through RS232. See chapter 3 for more details. When you communicate directly via RS232 on a multibus instrument or when you use a new type of RS232/FLOW-BUS (baudrates up to 38K4 with switch and 2 LED’s) interface, no special initialisation is needed.

Page 289: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 6

2 Available interfaces

2.1 RS232/FLOW-BUS interface The RS232/FLOW-BUS interface is an interface between the FLOW-BUS and the RS232 V24 serial (computer) port. It will either be supplied as a separate enclosed unit with a FLOW-BUS connector and a RS232 connector or as an integral 14TE module of your E-7000 readout and control system. The converter offers communication with a baudrate up to 38,4 kBaud. Communication software support is available. Communication settings are: 38400,n,8,1.

2.1.1 D-connector for RS232 The female RS232 (x) (subminiature 9-pin) D-connector has the following pin configuration: Pinnumber Description 1 2 3 4 5 6 7 8 9

not connected TXD RXD not connected 0 Vd DTR CTS RTS Shield

2.1.2 Specifications Power supply +15Vdc/+24Vdc +/- 10% Power consumption +15Vdc : 50 mA

+24Vdc : 35 mA Operating temperature

0…+50 ºC

Storing temperature -20…+60 ºC Housing dimensions

box: 160x80x44mm module: 14TE

Baudrates 4800 Baud 9600 Baud 19200 Baud 38400 Baud

Galvanic Isolation FLOW-BUS: opto isolated Power : DC-DC converter

FLOW-BUS

RS232

FLOW-BUS status

Page 290: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 7

2.2 RS232 on multibus instrument The RS232 interface on a multibus instrument can be connected to any RS232 V24 serial (computer) port. The interface offers communication with a baudrate of 38.4 kBaud. On the 9-pin male subD connector of the instrument RX and TX are available on pin 6 and pin 1. RS232 communication is possible by: - 9-pin Sub D-connector (non IP65 applications, e.g. EL-FLOW) - 8 DIN connector (IP65 applications, e.g. CORI-FLOW) For the exact connections please advise your hook-up diagram. Non IP65 applications, e.g. EL-FLOW Analog I/O, without businterface Instrument is supplied through 9-pin Sub D-connector. Application with businterface FLOW-BUS/DeviceNet Instrument is supplied through the bus. Application with businterface PROFIBUS Instrument is supplied through 9-pin Sub D-connector. IP65 applications, e.g. CORI-FLOW Analog I/O, without businterface Instrument is supplied through 8 DIN connector.

Powersupply

RS232 COM-port

RS232 COM-port

Powersupply

RS232 COM-port

RS232 COM-port

Powersupply

Page 291: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 8

Application with businterface FLOW-BUS/DeviceNet Instrument is supplied through the bus. Application with businterface PROFIBUS Instrument is supplied through 8 DIN connector.

2.2.1 Facilities No handshaking facilities are used. On the side of the PC/PLC a nul-modem connector is needed. Communication settings are: 38400,n,8,1. Bronkhorst High-Tech B.V. offers a special cable needed for communication. Communication software support is available.

2.2.2 Specifications multibus RS232: Operating temperature

0…+70 ºC

Storing temperature -20…+60 ºC Baudrates 38400 Baud Galvanic Isolation not for RS232 The multibus RS232 interface is a serial interface between the multibus instrument and the RS232 V24 serial (computer) port using the FLOW-BUS protocol for communication. This means that for serial RS232 communication a multibus instrument with RS232 can be treated as a FLOW-BUS system with one instrument and a FLOW-BUS/RS232 interface. All available software already existing for FLOW-BUS RS232 communication can be used for multibus instruments also. Only initialisation is different. Use of FLOWDDE32 is only possible from V4.23 and higher.

RS232 COM-port

RS232 COM-port

Powersupply

Page 292: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 9

3 FLOW-BUS protocol description

3.1 General On the highest supported communication level, you may use DDE-channels for Windows application-programs with this facility. On a lower communication level, you can use the FLOWB32.DLL, FLOWBUS.DLL or FLOWBUS.LIB, for changing parameter values. To read and write parameter values from or to FLOW-BUS devices directly through the available interfaces there is a special protocol for messages between these devices. When operating a FLOW-BUS system with a HOST computer, you need to know this message protocol if you choose to drive the interfaces directly. When you use a type of RS232/FLOW-BUS interface (baudrate up to 38K4) you may first have to initialise the interface. This can be done by means of sending some ASCII-strings to the interface through RS232. See also paragraph 3.2. There are two different communication protocols for the PC and the RS232 HOST: • an ASCII protocol for communication that is compatible with existing Flowbus applications.

This protocol serves only one master/slave dialog at a time. • an enhanced binary protocol that supports concurrent sending of messages to different nodes. This

protocol contains a message-sequence number an serves more than one master/slave dialogs at a time. The RS232-HOST module automatically recognises the protocol used by the PC and adapts its behaviour to the protocol in use. The type of protocol is determined by the first character of a message. • the first character is >:= (0x3A) existing type of message. • the first character is DLE (0x10) enhanced type of message. Via the FLOW-BUS DLL (FLOWB32.DLL)The PC determines which protocol is in use. The communication relation is always master (PC) and slave (HOST). The HOST will always respond on a request from the PC.

3.2 Initialisation of local host interfaces on Multibus instruments When you use a digital instrument with RS232 interface, baudrate is fixed on 38K4 baud and no special initialisation is needed. Through the serial line connected to a COM-port of your computer or to a PLC you have to communicate with the instrument using the FLOW-BUS protocol. Each instrument has its own node-address (3...120). If you want to send a message to the instrument you have to know this node-address. However, if you send a message to node-address 128 the instrument will always respond to your message. On a point-to-point connection like RS232 it is the easiest way to make the communication work under all circumstances (its independent of the real node-address of the instrument).

Page 293: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 10

3.3 Interface structure

3.3.1 Basic datalink format The basic datalink message format has the following fields:

node message destination length data field length data data Data etc.

In the Flowbus environment the data field may contain up to 256 bytes of data. In the HOST application described here, the messages are according to PROPAR coding rules and the data field will contain a maximum of 64 bytes.

3.3.2 RS232 ASCII protocol An ASCII protocol is used on the existing RS232-HOST. To be compatible with existing driver software the ASCII protocol is available. A basic datalink message is coded in ASCII as follows: len node data : len1 len2 node1 node2 data1 data2 CR >:= (semicolon) initial character len1, len2 length of message including the node address in bytes, so (len1,len2) is the basic

message length +1. node1, node2 node address of destination (PC to HOST)

node address of source (HOST to PC) data1, data2 message field CR termination character All bytes (except the initial and termination character) are converted from 1 binary byte to 2 hexadecimal bytes in ASCII representation.

Example: binary data byte 0x2A --> hexadecimal ASCII characters 0x32, 0x41. A special message type is used to pass error messages from the HOST to the PC. Its structure is as follows: 0x01 error : 0x30 0x31 error1 error2 CR >:= (semicolon) initial character 0x30, 0x31 length of the message (1 byte) error error code, two digit HEX number CR termination character

Page 294: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 11

The error code can have the following values:

Value Meaning 1 no >:= at the start of the message 2 error in first byte 3 error in second byte or number of bytes is 0 or message to long 4 error in received message (receiver overrun, framing error etc.) 5 Flowbus communication error: timeout or message rejected by receiver 8 time out during sending 9 no answer received within time out

3.3.3 Enhanced binary protocol Binary coding and control sequences The enhanced protocol is binary coded. Control sequences are used to recognise the begin and end of a message in a byte stream. A control sequence starts with a DLE byte (0x10) and is followed by a control byte. The following control sequences are defined:

First byte Second byte Function DLE (0x10) STX (0x02) Start of message DLE (0x10) ETX (0x03) End of message DLE (0x10) DLE (0x10) Data byte 0x10 DLE (0x10) any other

character Not allowed. Messages that contain such a sequence will be ignored. The receiver waits until a new DLE STX sequence.

The [DLE DLE] sequence is used to prevent possible DLE bytes in the transmitted binary data stream from being recognised as the start of a control sequence. The sender replaces any DLE bytes in the data by two DLE bytes. The datalink of the receiver will convert a [DLE DLE] sequences to one DLE byte. Note: If a RS232 error (receiver overrun, framing error, not allowed control sequence) occurs, the datalink

frame is ignored. Enhanced message coding The enhanced binary coded messages between PC and HOST are structured as follows:

DLE STX seq node len data DLE ETX DLE, STX start sequence seq message sequence number node node address of destination (PC to HOST)

node address of source (HOST to PC) len length of data field in bytes data message field DLE, ETX end sequence The enhanced protocol allows the transmission of more than one request at a time. The sequence number makes it possible to associate the answer to the according request. The HOST has more than one message buffer where messages may be stored (typical 5). When the message buffers are full, the HOST responds with an error message.

Page 295: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 12

The responses from the HOST to the PC have the same message format as the request. An error message has a special format:

DLE STX seq node 0x00 error DLE ETX DLE, STX start sequence seq message sequence number, as in request node node address of source, as in request error error code DLE, ETX end sequence The error code can have the following values:

Value Meaning 3 Message rejected by HOST, host receiver buffer overflow 5 Flowbus communication error: timeout or message rejected by Flowbus node 8 time out during sending 9 no response on a request received within time out

Page 296: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 13

3.4 Communication messages Communication messages between FLOW-BUS interfaces and other devices consist of command strings with specific information. This command string is either ASCII (RS232) or BINARY. Basically the string contains several information bytes. Through RS232 these hexadecimal bytes are converted in ASCII (f.i.: bytevalue 0x0A is "0A" in ASCII and capital letters should be used). Messages via RS232 are preceded by the ':' character and terminated with "\r\n" (Carriage return-Line-feed). There are several COMMANDS available in the FLOW-BUS messages. However only Command RD (04) and WR (01) are enough to do all the standard parameter reading and writing. A RD command will be answered with a WR command, containing the value asked for or a status message, containing an error-number. A WR command will be answered with a status message, containing an error-number (if error-number = 0, than WR command was OK). Note: ASCII character ‘:’ has hexadecimal value: 3A ASCII character ‘\r’ has hexadecimal value: 0D ASCII character ‘\n’ has hexadecimal value: 0A Communication commands Command Description

00 Status message 01 Send parameter with destination address, will be answered with type 00 command 02 Send parameter with destination address, no status requested 03 Send parameter with source address, no status requested 04 Request parameter, will be answered with type 02 or 00 command 05 Instruction: send parameter repeatedly (followed by byte with repeating time) 06 Stop process 07 Start process 08 Claim process 09 Unclaim process

To access a specific parameter you need to know the following numbers. 1. Node-address, each FLOW-BUS device is connected to a specific node-address in the system. 2. Process number, each device (node) consists of several processes. 3. Parameter number(FBnr), each process consists of several parameters. 4. Parameter type, each parameter can be of a different type and value. For parameters numbers and values see tables “parameter properties” and “parameter values” in this manual. Parameter types Type Id Bytes Range Character 00h 1 0…255 Integer 20h 2 0…65535 Float 40h 4 +-1.18e-38...+-3.39e+38 Long 40h 4 4 bytes 0... 4294967296 String 60h X length needs to be specified

Page 297: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 14

3.5 Chaining Chaining can be used to send or request more than one parameter per message. When the parameters are all members of the same process, they can be chained at parameter level. When the parameters are members of different processes, they can be chained at process level. A combination is also possible. For chaining at parameter level the first bit of the parameter number should be set if there is following another parameter at the same process. For chaining at process level the first bit of the process number should be set if there is another process following.

3.6 Status message status Nr Byte Description

0 : Start character

1 04 Fixed message length 4.

2 Node Node address

3 00 Command status

4 Status 00 No error 01 Process claimed 02 Command error 03 Process error 04 Parameter error 05 Parameter type error 06 Parameter value error 07 Network not active 08 Time-out start character 09 Time-out serial line 0A Hardware memory error 0B Node number error 0C General communication error 0D Read only parameter. 0E Error PC-communication 0F No RS232 connection 10 PC out of memory 11 Write only parameter 12 System configuration unknown 13 No free node address 14 Wrong interface type 15 Error serial port connection 16 Error opening communication 17 Communication error 18 Error interface busmaster 19 Timeout answer 1A No start character 1B Error first digit 1C Buffer overflow in host 1D Buffer overflow 1E No answer found 1F Error closing communication 20 Synchronisation error 21 Send error 22 Protocol error 23 Buffer overflow in module

5 Index or Claimed process

Index pointing to the first byte in the send message for witch the above status applies. In case of the status CLAIM ERROR, this field contains the claimed process.

6 ‘\r’ Carriage Return

7 ‘\n’ Line Feed

*Note: Value from byte 5 of status message may be neglected if value of byte 4 = 0 !

Page 298: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 15

3.7 Send parameters Send Nr Byte Layout Description 0 : start character 1 Length Message length 2 Node Node address 3 01 or 02 Command write, for type 01 a status message (00) will be returned

c Process chained 4 Process Cppppppp p Process number c Parameter chained t Parameter type

5 Parameter type

Cttppppp

p Parameter number 6 Value 1 Value for all types. For ‘strings’ this field contains the string length.

7 Value 2 Value for type ‘integer’, ‘float’ or ‘long’.

8 Value 3 Value for type ‘float’ or ‘long’.

9 Value 4 Value for type ‘float’ or ‘long’.

X Value x More value fields follow for type ‘string’ depending on string length. If given string length is zero, the final field should also contain a zero.

X+1 ‘\r’ Carriage Return

X+2 ‘\n’ Line Feed

3.8 Request parameter For each requested parameter an index number can be given. The answering node will return this index number with the requested parameter. This can be used to check which parameter is returned when several parameters are requested. Request Nr Byte Layout Description 0 : start character 1 Length Message length 2 Node Node address 3 04 Command read

c Process chained 4* Process (return) Cppppppp

p Process number c Parameter chained t Parameter type

5* Parameter type & index (return)

Cttnnnnn

n Parameter index 0…31 - Not used 6 Process -ppppppp

p Process number - Not used t Type parameter

7 Parameter -ttppppp

p Parameter number 8 String length For parameter type ‘string’ this field contains the expected string length. 9 ‘\r’ Carriage Return 10 ‘\n’ Line Feed

Page 299: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 16

Answer of request Nr Byte Layout Description 0 : start character 1 Length Message length 2 Node Node address 3 02 Command write

c Process chained 4* Process Cppppppp p Process number c Parameter chained t Parameter type

5* Parameter type & index

Cttnnnnn

n Parameter index 0…31 6 Value 1 Value for all types. For ‘strings’ this field contains the string length.

7 Value 2 Value for type ‘integer’, ‘float’ or ‘long’.

8 Value 3 Value for type ‘float’ or ‘long’.

9 Value 4 Value for type ‘float’ or ‘long’.

X Value x More value fields follow for type ‘string’ depending on string length. If given string length is zero, the final field should also contain a zero.

X+1 ‘\r’ Carriage Return

X+2 ‘\n’ Line Feed

*The requested module copies these values from the request message directly into the answer message.

Page 300: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 17

3.9 Initialising RS232/FLOW-BUS interface If you use a RS232/FLOW-BUS interface for communication (without the micro-switch and 2 LED’s), note that this module is not part of the (FLOW-BUS) token-ring network, directly at power-up. This means that it is always necessary to re-initialise the module when power has been interrupted! This is not the case when using an RS232/FLOW-BUS interface with micro-switch, red LED, green LED and RJ45 connector for FLOW-BUS. By means of the switch you may force the interface to find a free address on the FLOW-BUS once. You may skip the initialisation and start directly sending messages. Also when using digital (Multibus) instruments with RS232 directly on the instrument it is not needed to initialise (give a free node-address to) the instrument on the FLOW-BUS because instrument is not physically connected to the FLOW-BUS, but only uses the same protocol. You may start directly sending your messages to the instrument on either the node-address of the instrument in its memory e.g. node 3 (selective response) or to node-address 128 (always response). At power-up situation you can communicate with the RS232 interface only at the RS232 side via node 0. To get part of the FLOW-BUS you have to send an init. command, send the network parameters PNA, SNA, NNA, LNA and BM and send a reset command. From this moment the interface is part of the FLOWBUS. Ensure the module gets a free and unique address on the bus, 2 modules on the same address will cause communication problems. When you are sure that there are no more interfaces in the system, simply force the RS232/FLOW-BUS interface to address 1. This address is reserved for an interface. PC-support software (FLOWB32.DLL, FLOWBUS.DLL and FLOWBUS.LIB) will search for a free address on which the interface will be installed. Follow the steps below to realise correct initialisation for this interface via RS232: Initialisation RS232 interface (needed for FLOW-BUS/RS232 interfaces without switch and LEDs only) Send Response Comment :050001000A49\r\n* Init instruction for node 0 process 0. :04000000XX\r\n No error. :050001000101\r\n PNA = Primary Node Address = 1 :04000000XX\r\n No error. :05000100027F\r\n SNA = Secondary Node Address = 127 :04000000XX\r\n No error. :050001000302\r\n NNA = Next Node Address = 2 :04000000XX\r\n No error. :050001000420\r\n LNA = Last Node Address = 32 (depends on system size) :04000000XX\r\n No error. :050001000502\r\n BM = Bus Management = 67

67 = everything automatically (auto arbitration+gap skipping) 3 = auto arbitration 2 = always busmaster 1 = temporary In older systems: when no R/C-modules in system make BM = 2, when R/C-modules in system (already busmasters present) than make BM = 1; otherwise make = 67

:04000000XX\r\n No error. :050001000A52\r\n Reset instruction for module; from this moment on module will

be active on FLOW-BUS at node address = PNA :04000000XX\r\n No error. • Sometimes it could be necessary to repeat the first instruction. Wait approx. 2 seconds before sending

the next command. • XX means: don’t care Communication can be closed and interface can be disabled from FLOW-BUS token-ring traffic by sending the command below via the RS232 to the interface. Stop communication RS232 interface Send Comment :050101001101\r\n close communication instruct. for interface module there will be no aswer (because

communication stops) second byte is actual node address for interface (here: 01)

Page 301: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 18

3.10 Examples

3.10.1 Sending setpoint Sending setpoint 50% to node 3 process 1. Setpoint values should be given in a range from 0 to 32000 so for this example 16000 should be send. Send parameters to node 3 Nr Byte Layout Description 0 ':' Start character 1 06 Length 6 2 03 Node 3 3 01 Command write with status response

C 00 Process not chained 4 01 00000001

P 01 Process 1 C 00 Parameter not chained T 20 Parameter type ‘integer’

5 21 00100001

P 01 Parameter number 1 6 3E

7 80

Setpoint 16000 = 3E80h

8 ‘\r’ Carriage Return 9 ‘\n’ Line Feed Answer from node 3 Nr Byte Description

0 ‘:’ Start character

1 04 Fixed message length 4.

2 01 Node address 01

3 00 Command status

4 00 Status ok.

5 05 Status ok, value points to end of send message.

6 ‘\r’ Carriage Return

7 ‘\n’ Line Feed

3.10.2 Sending chained parameters Interface sends following parameters to module at node 3: Process 0: INIT MODE (10), 64 = soft init Process 1: FLUIDNUMBER(16). 1 Process 1: POLYNOMIAL CONSTANTE A(5), 0.0 Process 1: POLYNOMIAL CONSTANTE B(6), 1.0 Process 1: POLYNOMIAL CONSTANTE C(7), 0.0 Process 1: POLYNOMIAL CONSTANTE D(8), 0.0 Process 0: INIT MODE (10), 82 = reset initmode. Send parameters to node 3 Nr Byte Layout Description 0 ':' 1 1D Length 29 2 03 Node 3 3 01 Command write with status response

C 80 Process chained 4 80 10000000

P 00 Process 0

Page 302: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 19

C 00 Parameter not chained T 00 Parameter type ‘character’

5 0A 00001010

N 0A Parameter number 10 6 40 01000000 Parameter value 64 set soft init mode

C 80 Process chained 7 81 10000001

P 01 Process 1 C 80 Parameter chained T 40 Parameter type ‘float’

8 C5 11000101

N 05 Parameter number 5 9 00

10 00

11 00

12 00

Parameter value ‘float’ 0.0

C 80 Parameter chained T 40 Parameter type ‘float’

13 C6 11000110

N 06 Parameter number 6 14 3F

15 80

16 00

17 00

Parameter value ‘float’ 1.0

C 80 Parameter chained T 40 Parameter type ‘float’

18 C7 1100111

N 07 Parameter number 7 19 00

20 00

21 00

22 00

Parameter value ‘float’ 0.0

C 80 Parameter chained T 40 Parameter type ‘float’

23 C8 11001000

N 08 Parameter number 8 24 00

25 00

26 00

27 00

Parameter value ‘float’ 0.0

C 00 Process not chained 28 00 00000000

P 00 Process 0 C 00 Parameter not chained T 00 Parameter type ‘character’

29 0A 00001010

N 0A Parameter number 10 30 52 01010010 Parameter value 82, reset init mode 31 ‘\r’ Carriage Return 32 ‘\n’ Line Feed

Page 303: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 20

Answer from node 3 Nr Byte Description 0 ‘:’ Start character

1 04 Fixed message length 4.

2 03 Node address

3 00 Command status

4 00 Status ok.

5 1C Status ok, value points to end of send message.

6 ‘\r’ Carriage Return

7 ‘\n’ Line Feed

3.10.3 Request setpoint Request setpoint from node 3 process 1, type integer. Nr Byte Layout Description 0 ':' 1 06 Length 6 2 03 Node 3 3 04 Command read

C 00 Process not chained (return) 4 01 00000001

P 01 Process 1 (return) C 00 Parameter not chained (return) T 20 Parameter type ‘integer’ (return)

5 21 00100001

N 01 Parameter index 1 (return) 6 01 -0000001 P 01 Process 1 7 21 -0100001 T 20 Parameter type ‘integer’ P 01 Parameter number 1 ( setpoint) 8 ‘\r’ Carriage Return 9 ‘\n’ Line Feed Answer by node 3 Nr Byte Layout Description 0 ':' 1 06 Length 6 2 03 Node 3 3 02 Command write

C 00 Process not chained 4 01 00000001

P 01 Process 1 ( receiving process) C 00 Parameter not chained T 20 Parameter type ‘integer’

5 21 00100001

N 01 Parameter index 1 6 3E

7 80

Value 3E80h = 16000 = 50%

8 ‘\r’ Carriage Return 9 ‘\n’ Line Feed

Page 304: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 21

3.10.4 Request chained parameters Interface sends a request for the following parameters to module at node 3: Process 113: SerialNum (3), UserTag (6) Process 1 : Measure (0), Capacity (13), Capunitstr (31), Fluidname (17) Request by node 3 Nr Byte Layout Description 0 ':' 1 1A Length 31 2 03 Node 3 3 04 Command read

C 80 Process chained (return) 4 F1 11110001

P 71 Process 113 (return) C 80 Parameter chained (return) T 60 Parameter type ‘string’ (return)

5 EC 11101100

N 0C Parameter index 12 (return) 6 71 -1110001 P 71 Process 113

T 60 Parameter type ‘string’ 7 63 -1100011

P 03 Parameter number 3 – Serial Number 8 14 10000100 14 String length 20

C 00 Parameter not chained (return) T 60 Parameter type ‘string’ (return)

9 6D 01101101

N 0D Parameter index 13 (return) 10 71 -1110001 P 71 Process 113

T 60 Parameter type ‘string’ 11 66 -1100110

P 06 Parameter number 6 – Usertag 12 00 00000000 String length 00, length not defined

C 00 Parameter not chained (return) 13 01 00000001

P 01 Process 1 (return) C 80 Parameter chained (return) T 20 Parameter type ‘integer’ (return)

14 AE 10101110

N 0E Parameter index 14 (return) 15 01 -0000001 P 00 Process 1

T 20 Parameter type ‘integer’ 16 20 -0100000

P 00 Parameter number 0 – Measure C 80 Process chained (return) T 40 Parameter type ‘float’ (return)

17 CF 11001111

N 0F Parameter index 15 (return) 18 01 -0000001 P 01 Process 1

T 40 Parameter type ‘float’ 19 4D -1001101

P 0D Parameter number 13 – Capacity C 80 Parameter chained (return) T 60 Parameter type ‘string’ (return)

20 F0 11110000

N 10 Parameter index 16 (return) 21 01 -0000001 P 01 Process 1 22 7F -1111111 T 60 Parameter type ‘string’ P 1F Parameter number 31 – Capacity Unit Sting 23 07 00001110 07 String length 7

C 00 Parameter not chained (return) T 60 Parameter type ‘string’ (return)

24 71 01110001

N 11 Parameter index 17 (return)

Page 305: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 22

25 01 -0000001 P 01 Process 1 T 60 Parameter type ‘string’ 26 71 01110001

P 11 Parameter number 17 – Fluidname 27 0A String length 10 33 ‘\r’ Carriage Return 34 ‘\n’ Line Feed Answer by node 3 Nr Byte Layout Description 0 ':' 1 41 Number of bytes which do follow: 65 bytes 2 03 Node 3 3 02 Command write

C 80 Process chained 4 F1 11110001 P 71 Process 113 ( recieving process) C 80 Parameter chained T 60 Parameter type ‘string’

5 EC 11101100

N 0C Parameter index 12 6 14 Length of the answer 20 Bytes 7-25 4D 36 32 31 32 33 34 35 41 20 20 20 20 20 20 20 20 20 20 20

Parameter value converted from hex to ASCII : M6212345A 27 6D 01101101 C 00 Process not chained T 60 Parameter type ‘string’ N 0D Parameter index 13 28 00 String length 00, length not defined 29-36 55 53 45 52 54 41 47 00

Parameter value converted from hex to ASCII, the values do read: USERTAG 37 01 00000001 C 00 Process not chained P 01 Process 1 ( receiving process) 38 AE 10101110 C 80 Parameter chained T 20 Parameter type ’integer’ N 0E Parameter index 14 39 1C 40 D8

Parameter value is: 1CD8 (hex) Measure Value is: 7384 (dec)

41 CF 11001111 C 80 Parameter chained T 40 Parameter type ‘float’ N 0F Parameter index 15 42 3F 43 80 44 00 45 00

Parameter Value: 3F 80 00 00 (IEEE-floating point notation , 32-bit single precision ) Parameter value converted from float to decimal , the values do read: 1.0

46 F0 11110000 C 80 Parameter chained T 60 Parameter type ’string N 10 Parameter index 16 47 07 Length of the answer 7 Bytes 48-54 6D 6C 6E 2F 6D 69 6E Parameter value converted from hex to ASCII, the values do read: mln/min

55 71 01110001 C 00 Parameter not chained T 60 Parameter type ’string’ N 11 Parameter index 17 56 0A Length of the answer 10 Bytes 57-66 4E 32 20 20 20 20 20 20 20 20

Parameter value converted from hex to ASCII, the values do read: N2

Page 306: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 23

3.10.5 Request measure Request measure from node 3 process 1, type integer. Nr Byte Layout Description 0 ':' 1 06 Length 6 2 03 Node 3 3 04 Command read

C 00 Process not chained (return) 4 01 00000001

P 01 Process 1 (return) C 00 Parameter not chained (return) T 20 Parameter type ‘integer’ (return)

5 21 00100001

N 01 Parameter index 1 (return) 6 01 -0000001 P 01 Process 1 7 20 -0100000 T 20 Parameter type ‘integer’ P 00 Parameter number 0 ( measure) 8 ‘\r’ Carriage Return 9 ‘\n’ Line Feed Answer by node 3 Nr Byte Layout Description 0 ':' 1 06 Length 6 2 03 Node 3 3 02 Command write

C 00 Process not chained 4 01 00000001

P 01 Process 1 ( receiving process) C 00 Parameter not chained T 20 Parameter type ‘integer’

5 21 00100001

N 01 Parameter index 1 6 3E

7 80

Value 3E80h = 16000 = 50%

8 ‘\r’ Carriage Return 9 ‘\n’ Line Feed

3.10.6 Request counter value Request countervalue (cntrvalue) from node 3 process 104, type float. Nr Byte Layout Description 0 ':' 1 06 Length 6 2 03 Node 3 3 04 Command read

C 00 Process not chained (return) 4 68 01101000

P 68 Process 104 (return) C 00 Parameter not chained (return) T 40 Parameter type ‘float’ (return)

5 41 01000001

N 01 Parameter index 1 (return) 6 68 -1101000 P 68 Process 104 7 41 -1000001 T 40 Parameter type ‘float’ P 01 Parameter number 1 ( cntrvalue) 8 ‘\r’ Carriage Return 9 ‘\n’ Line Feed

Page 307: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 24

Answer by node 3 Nr Byte Layout Description 0 ':' 1 08 Length 8 2 03 Node 3 3 02 Command write

C 00 Process not chained 4 68 01101000

P 68 Process 104 ( receiving process) C 00 Parameter not chained T 40 Parameter type ‘float’

5 41 01000001

N 01 Parameter index 1 6 45

7 9C

Parameter value ‘float’ = 5023.96 dec.

8 FF 9 AE 10 ‘\r’ Carriage Return 11 ‘\n’ Line Feed

4 Dual interface operation When operating a controller (reading measured value and sending setpoint) for proper operation it is important that the controller gets its setpoint from the right source. Setpoints may come from different sources: analog input, fieldbus interface or RS232 or may be overruled by close valve or open valve (purge) commands. Therefore it is important to know what is the setpoint source of the controller. This can be set by means of parameter controlmode (process 1, parameter 12). In some cases it is possible that the setpoints may come from 2 sources at the same time. The last send setpoint will be valid and send to the controller. This is the case in controlmode = 0, when setpoints may come through any fieldbus interface or RS232. However, there could be situations where control over the instrument seems impossible. This is the case when the instrument comes into a safe-state e.g. when fieldbus communication is disturbed or disconnected. Valve will be forced to a safe state automatically: closed (NC) or fully open (NO). In case you want to get control back via RS232 operation, you have to change the controlmode. When controlmode gets value 18, safe state will be overruled and sending setpoints via RS232 interface will have effect on the controller again. See also document nr. 9.17.023 for more detailed description about digital instrument parameters and their behaviour.

Page 308: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 25

5 Parameter information

FLOW-BUS is used for parameter value exchange between instruments and operation modules (keyboard or PC-interface). Parameter information consists of several properties for behaviour within the FLOW-BUS system. In the ‘parameter properties’ table you will find a list of parameters and their properties. In the ‘parameter values’ table values are described more detailed if necessary. These list consists mostly of parameters for mode settings. Property description in ‘parameter properties’ table: Item Description Parameter(DDE) unique parameter number (also used for DDE-communication : P(x)) Name parameter name (max. 10 characters)

used for parameter identification process process where parameter is used on FLOW-BUS module

used for communication directly through RS232 when filled in the table, this value has to be used (for parameters located in only 1 process) when empty in the table, process has to be determined from the FLOW-BUS system information (for parameters located in more than one process, f.i. setpoint, measure);

FBnr(parameter) parameter number in process on FLOW-BUS module used for communication directly through RS232

VarType variable type for information about amount of bytes c : (unsigned) char type; 1 byte; value 0..255 i : (unsigned) integer type; 2 bytes; value 0..65535 f : float type, 4 bytes, value +-1.18E-38..+-3.39E+38 (IEEE-floating point notation) l : (unsigned) long type, 4 bytes, value 0..4294967295 data types > 1 byte are MSB first.

VarLength variable length to indicate length of string of chars used in combination with VarType c for transportation of strings through FLOW-BUS: value 0..65535 VarLength indicates the amount of bytes for a parameter type -2: indicates that a string is zero-terminated, not defined for length X : indicates a string with a length of X bytes (characters) 0 : means no info required.

Min minimum value of parameter allowed when parameter is read/written via RS232, the value will be checked on this limit (error when out of limit)

Max maximum value of parameter allowed when parameter is read/written via RS232, the value will be checked on this limit (error when out of limit)

Read indication if parameter is allowed to be read via FLOW-BUS Write indication if parameter is allowed to be written via FLOW-BUS Poll indication if parameter should be polled continuously by RS232 application in order to

keep (changing) parameter information up to date Advanced indication if parameter is for advanced users only these are mainly parameters for

maintenance/service

Secured indication if parameter is secured for use through FLOW-BUS reading this parameter is possible, but changing it needs special handling

High security indication if parameter is highly secured (only few parameters) reading this parameter is possible, but changing it needs special handling

Description short description about meaning of parameter or what it is used for Parameter acceptance: Changing parameter values is possible when a parameter is not read-only and not secured. The range and type of parameters are described in the tables. When parameter values are out of range they will be either 'clipped' on the nearest value allowed or you will get an error message: 'parameter value error'.

Page 309: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 26

(DDE)Parameter numbers: All parameter information is referenced to the parameter number. This is a unique number for a parameter to avoid redundancy. These numbers are needed for DDE communication only. For communication with FLOW-BUS through other ways than DDE: directly via RS232 ASCII-strings or via C-libraries (DOS or Windows), use the parameter numbers for the FLOW-BUS modules (in column FBnr of table Parameter properties). Now you will always have to know the node-address of the instrument on the FLOW-BUS, the process number on the instrument and the parameter number on the instrument. Process nr could be read from the table or has to be determined, when nothing is filled-in. In most cases process number will be = 1. Node-address should be determined also. This is the node-address of the instrument on the FLOW-BUS. Newer RS232 protocols on multibus instruments accept node = 128. When sending messages to this node address, the message will be always accepted, unregarding the node-address of the instrument on the bus. NOTE: It is important to know that not all parameters are available on all FLOW-BUS/Multibus devices. For more details about parameters and their use see also document nr. 9.17.023 for description of digital instruments. If you have the program FLOWDDE, you can also get an overview of which parameters are available on which devices. In other cases ask your local sales representative or send an e-mail to [email protected]. Appendix 1 and 2 will give information about parameters, their properties and their possible values.

Page 310: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

9.17.027 Page 27

6 Troubleshooting • RS232 communication problems Check cables. Make sure correct cables are used for

specific purpose. Check address of interface (slave). Sending messages to node 128 will mostly be accepted by the interface. Try to reset the instrument and/or restart your PC/PLC. Make sure your messages are assembled according to FLOW-BUS protocol description. Make sure the parameter values you try to read/write are available and in the correct ranges (check tables). Controller doesn’t respond on setpoints: - Check control mode, when 0 and other fieldbus

gives error: safe state will be entered, resulting in safe setpoint. Can be overruled by making controlmode = 18 (RS232 only operation)

- Alarm or counter module in instrument forces setpoint to alarm setpoint. Reset alarm or counter and proceed.

- Setpoint slope could have very high value. New setpoints will be reached when this slope time has been elapsed. Make setpoint slope smaller.

- Control mode could have other value than 0 or 18. Check function when value is different.

- If measure doesn’t change check forward pressure and piping (evt. shut-off valves).

- Make sure setpoints are within allowed range: 0...32000 (= 0...100%).

- Make sure setpoints are send to proper instrument and process (mostly = 1) and parameter (FBnr for setpoint = 1), and type of data is correct (short integer = 2 bytes MSB first)

Contact local sales representative or service department.

• Other (FLOW-BUS) problems Contact Bronkhorst High-Tech local sales representative or send e-mail describing your problem to: help.flowbus@bronkhorst com

Page 311: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

APPENDIX 1

Parameter properties table

Page 312: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

Parameter properties table

Parameternumber

(DDE)

Parametername

Group0

Group1

Group2

Processnumber

FBnr

(par)

VarType

VarLength

Minvalue

Maxvalue

Read Write Poll Secured Highly Secured

Default Value Description

2006-02-01 Page 1 of 5FlowDDE database version V3.49

1 identstrng 13 0 0 c -2 Yes Yes No No No 7SN999999 identnr.+softwareversion[+serialnr.]2 pna 1 0 1 c 0 128 Yes Yes No Yes Yes 0 primary node address: network parameter FLOW-BUS3 sna 1 0 2 c 0 128 Yes Yes No Yes Yes 0 secundary node address: network parameter FLOW-BUS4 nna 1 0 3 c 0 128 Yes Yes No No No 1 next node address: network parameter FLOW-BUS5 lna 1 0 4 c 0 128 Yes Yes No No No 32 last node address: network parameter FLOW-BUS6 arbitrage 1 0 5 c 0 255 Yes Yes No Yes Yes 67 FLOW-BUS arbitrage setting and/or automatic optimization7 initreset 12 0 10 c 0 255 Yes Yes No No No init and reset security key commands for network/parameter settings8 measure 2 0 i -23593 41942 Yes No Yes No No 0 measured value (100% = 32000)9 setpoint 2 18 1 i 0 32767 Yes Yes Yes No No 0 setpoint: wanted value (100% = 32000)

10 setpslope 18 2 i 0 30000 Yes Yes No No No 0 setpoint ramp signal 0..100 % in up to slope x 0.1 sec.11 analoginp 2 18 3 i -23593 41942 Yes No Yes No No 0 analog input signal, normally used for ext. setp. (100% = 32000)12 cntrlmode 18 4 c 0 255 Yes Yes No No No 0 control mode selection for instrument or module13 polycnst A 3 5 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 0.0 polynomial constant A (offset)14 polycnst B 3 6 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 1.0 polynomial constant B (span]15 polycnst C 3 7 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 0.0 polynomial constant C16 polycnst D 3 8 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 0.0 polynomial constant D17 polycnst E 3 9 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 0.0 polynomial constant E (offset) for setpoint or power value18 polycnst F 3 10 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 1.0 polynomial constant F (span) for setpoint or power value19 polycnst G 3 11 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 0.0 polynomial constant G for setpoint or power value20 polycnst H 3 12 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 0.0 polynomial constant H for setpoint or power value21 capacity 3 19 13 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 1.0 maximum value at 100% in sensor base units22 sensortype 3 14 c 0 255 Yes Yes No Yes No 3 sensor type information for actual reading and sensor/controller indication23 capunit 3 19 15 c 0 255 Yes Yes No Yes No 0 pointer to selected actual readout unit (index for list of readout units]24 fluidnr 3 16 c 0 8 Yes Yes No No No 0 fluid number: pointer to polynome, name and cap.25 fluidname 3 17 c 10 Yes Yes No Yes No AIR name of fluid26 claimnode 12 18 c 0 128 Yes Yes No Yes No 0 node address of module with operation rights27 modify 12 19 c 0 255 Yes Yes No No No 0 contains number(s) of changed par (0xXX par nr, 0xFF more than one par cha28 alarminfo 4 20 c 0 255 Yes No Yes No No 0 status information of several alarms/errors in the instrument29 chanamount 17 0 12 c 1 120 Yes Yes No No No 32 amount of channels which can be operated30 firstchan 17 0 13 c 1 120 Yes Yes No No No 1 first channel that can be operated31 lastchan 17 0 14 c 1 120 Yes Yes No No No 32 last channel that can be operated32 hostcontrl 5 9 1 c 0 1 Yes Yes No No No 0 operation by HOST computer enable flag33 alrmmsgTA 5 10 0 c 16 Yes No Yes No No alarm message string with unit type information34 alrmmsgnr 5 10 1 c 16 Yes No Yes No No alarm message string with unit number information35 relstatus 5 10 2 c 8 Yes No No No No status of relays/potential free contacts ('0' = not activated, '1' = activated)36 actualval 5 0 f 0 3.4028E+38 Yes No Yes No No 0 actual value of counter37 signinpsel 5 1 c 8 Yes Yes No No No signal input selection (' '=no value,'+'=pos value,'-'=neg value input)38 resinpsel 5 2 c 8 Yes Yes No No No external reset input enable/disable ('E'=enable,' '=disable)39 limit 5 3 f 0 3.4028E+38 Yes Yes No No No limit/batch for counter in sensor standard units40 delaytime 5 4 c 8 0 99235959 Yes Yes No No No 00000000 delay time string in days,hours,minutes,seconds41 duratntime 5 5 c 8 0 99235959 Yes Yes No No No 00000000 duration time string in days,hours,minutes,seconds42 vlvoutset 5 6 c 8 Yes Yes No No No 00000000 valve output setting ('0'=do nothing, '1'=close valve)43 reloutset 5 7 c 8 Yes Yes No No No LLLLLLLL relay output setting ('L'=low, 'H'=high, 'P'=pulse (1 sec.))44 opermodeTA 5 8 c 0 9 Yes Yes No No No 0 operation mode of T/A module45 readunit 5 9 c 7 Yes No No No No ln/min readout unit string46 readfact 5 10 f 1E-10 1E+10 Yes No No No No 1 readout factor matching readout unit string47 resetunit 5 12 c 0 1 No Yes No No No reset unit command (1=reset T/A unit)48 TdValveDn 6 9 f 0 3.4028E+38 Yes Yes No Yes No 0.1 valve output differentiation time constant downwards49 TdValveUp 6 10 f 0 3.4028E+38 Yes Yes No Yes No 0.1 valve output differentiation time constant upwards50 TdSensorDn 6 11 f 0 3.4028E+38 Yes Yes No Yes No 5.8 sensor signal differentiation time constant downwards51 TdSensorUp 6 12 f 0 3.4028E+38 Yes Yes No Yes No 5.6 sensor signal differentiation time constant upwards52 CycleTime 6 114 12 c 1 255 Yes Yes No Yes No 6 cycle time * 10 msec. main loop signal processing53 AnalogMode 10 115 3 c 0 255 Yes Yes No Yes No 0 analog mode selection for analog operation54 VrefOutput 10 116 6 i 0 65535 Yes Yes No Yes No reference voltage output signal for analog operation55 ValveOut 8 114 1 l 0 16777215 Yes Yes Yes No No 0 valve output signal (24-bit number in range 0…14.3Vdc/0…23.3Vdc)

Page 313: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

Parameternumber

(DDE)

Parametername

Group0

Group1

Group2

Processnumber

FBnr

(par)

VarType

VarLength

Minvalue

Maxvalue

Read Write Poll Secured Highly Secured

Default Value Description

2006-02-01 Page 2 of 5FlowDDE database version V3.49

56 DynDispFct 6 117 1 f 0 1 Yes Yes No Yes No 0,001 dynamic display factor for display filter (0=max, 1=min goes with par 57)57 StaDispFct 6 117 2 f 0 1 Yes Yes No Yes No 0,000001 static display factor for display filter (0=max, 1=min goes with par 56)58 CalMode 7 115 1 c 0 255 Yes Yes No Yes No 0 calibration mode selection (not active until cntrlmode has been set to value 9)59 ValveOffst 8 116 7 i -32767 65535 Yes Yes No Yes No 61000 valve offset: amount of DAC steps within 1 potmeter step60 Monitor 2 115 2 c 0 255 Yes Yes No Yes No 7 monitor: output signal (measure) selection for bus and analog output61 AlarmReg1 4 114 2 c 8 Yes Yes No Yes No alarm register containing warning flags62 AlarmReg2 4 114 3 c 8 Yes Yes No Yes No alarm register containing critical error flags63 CalRegZS1 9 116 1 l 0 16777215 Yes Yes No Yes No 210A7D calibration register zero scale input 1 ADC64 CalRegFS1 9 116 2 l 0 16777215 Yes Yes No Yes No 52A513 calibration register full scale input 1 ADC65 CalRegZS2 9 116 3 l 0 16777215 Yes Yes No Yes No 210A7D calibration register zero scale input 2 ADC66 CalRegFS2 9 116 4 l 0 16777215 Yes Yes No Yes No 52A513 calibration register full scale input 2 ADC67 ADCcntrReg 9 114 4 l 0 4294967295 Yes Yes No Yes No 18904E ADC control register68 BridgePotm 9 116 5 c 0 255 Yes Yes No Yes No 0 sensor bridge zero potmeter setting69 AlarmEnble 4 115 4 c 0 255 Yes Yes No Yes No 1 broadcast alarm messsage enable flag70 TestMode 4 115 5 c 0 255 Yes Yes No Yes No 0 test mode selection (not active until cntrlmode has been set to value 5)71 ChanSelect 9 115 6 c 1 32 Yes Yes No Yes No 1 channel selection ADC72 ContrResp 8 114 5 c 0 255 Yes Yes No Yes No 0 controller response for normal steps (128=normal, <128=slower, >128=faster)73 ErrInFilCo 6 117 3 f 0 1 Yes Yes No Yes No 1.0 analog input filter constant (0=max, 1=min)74 ExpSmooCo 6 117 4 f 0 1 Yes Yes No Yes No 1.0 sensor input filter constant (0=max, 1=min)75 AnOutCorZS 10 21 i -32767 65535 Yes Yes No Yes No 32767 analog output correction factor zero scale (meas outp DSCM-A 0=0 other 327676 AnOutCorFS 10 22 i 0 65535 Yes Yes No Yes No 2000 analog output correction factor full scale (meas outp 2000 = 1 * multiplication)77 AnInpCorZS 10 23 i -32767 65535 Yes Yes No Yes No 32767 analog input correction factor zero scale (ext setp DSCM-A 0=0 other 32767=078 AnInpCorFS 10 24 i 0 65535 Yes Yes No Yes No 2000 analog input correction factor full scale (ext setp 2000 = 1 * multiplication)79 TuningMode 7 115 7 c 0 255 Yes Yes No Yes No 0 (auto)tuning mode selection (not active until cntrlmode has been set to value 680 DefVlvType 8 114 6 c 0 255 Yes Yes No Yes No 0 valve type (needed for controlling behaviour)81 GlobModify 12 0 19 c 0 255 Yes Yes No No No 0 contains number(s) of changed processes for indirect polling (0xXX / 0xFF)82 SpanCorr 8 114 7 f 0 1 Yes Yes No Yes No 0.1 correction factor valve curve ratio high/low area83 VlvCrvStps 8 114 8 c -2 Yes Yes No Yes No 20,80 Valve curve correction for controller (max. factor*0.1, flow where factor = 1)84 MemShipNor 8 114 9 c -2 Yes Yes No Yes No 0,5000,10,5000array with memberships for normal Fuzzy controller85 MemShipOp 8 114 10 c -2 Yes Yes No Yes No 0000,3750,2000array with memberships for 0-open Fuzzy controller86 IOStatus 12 20 114 11 c 0 255 Yes Yes No Yes No 4 IO status byte for jumper settings and LED signal modes87 FuzzStNeNo 8 114 13 c -2 Yes Yes No Yes No 30000,-500,-50array with neg nor output steps for Fuzzy contr.88 FuzzStPoNo 8 114 14 c -2 Yes Yes No Yes No 50,500,25000 array with pos nor output steps for Fuzzy contr.89 FuzzStOpen 8 114 15 c -2 Yes Yes No Yes No 90,180,12000 array with open at 0 output steps for Fuzzy contr.90 DeviceType 13 113 1 c 6 Yes No No No No DMFC (FLOW-BUS) device type information string91 ModelNum 13 113 2 c 14 Yes Yes No Yes No F201C-FA model number information string92 SerialNum 13 113 3 c 20 Yes Yes No Yes Yes SN999999A serial number information string (to be changed by Bronkhorst HT only)93 MfrConfig 11 113 4 c 16 Yes Yes No Yes No STANDARD manufacturing configuration information string94 BHT1 14 118 1 c -2 Yes Yes No Yes Yes 01,01,95 special BHT parameter (to be changed by Bronkhorst HT only)95 BHT2 14 118 2 i 0 65535 Yes No No No No 0 special BHT parameter96 BHT3 14 118 3 l -3000000000 3000000000 Yes No No No No 0 special BHT parameter97 BHT4 14 118 4 i 0 65535 Yes No No No No 0 special BHT parameter98 BHT5 14 118 5 c 0 255 Yes No No No No 0 special BHT parameter99 BHT6 14 118 6 c 0 255 Yes Yes No No No 0 special BHT parameter

100 BHT7 14 118 7 c 0 255 Yes No No No No 0 special BHT parameter101 BHT8 14 118 8 c 0 255 Yes No No No No 0 special BHT parameter102 BHT9 14 118 9 l -3000000000 3000000000 Yes No No No No 0 special BHT parameter103 BHT10 14 118 10 c 0 1 No Yes No Yes Yes 0 special BHT parameter (to be changed by Bronkhorst HT only)104 PulseHight 8 114 16 c 0 255 Yes Yes No Yes No 128 height of open at zero pulse train for valve105 Version 13 20 113 5 c 5 Yes No No No No VX.XX revision number of firmware106 PressSensr 20 115 9 c 0 255 Yes Yes No Yes No 0 type of pressure sensor107 BaroPress 20 116 8 f 0 1200 Yes Yes No No No 1013.25 mbar atmospheric (central) barometer pressure108 AnIn1CorZS 10 25 i -32767 65535 Yes Yes No Yes No 32767 analog sensor signal input corr. factor zero scale (DSCM-A 0=0 other 32767=0109 AnIn1CorFS 10 26 i 0 65535 Yes Yes No Yes No 2000 analog sensor signal input correction factor full scale (2000=1*multiplication)110 AnIn2CorZS 10 27 i -32767 65535 Yes Yes No Yes No 32767 analog Vref input correction factor zero scale (DSCM-A 0=0 other 32767=0)111 AnIn2CorFS 10 28 i 0 65535 Yes Yes No Yes No 2000 analog Vref input correction factor full scale (2000=1*multiplication)112 AnOu1CorZ 10 29 i -32767 65535 Yes Yes No Yes No 32767 analog setpoint output correction factor zero scale (DSCM-A 0=0 other 32767=113 AnOu1CorF 10 30 i 0 65535 Yes Yes No Yes No 2000 analog setpoint output correction factor full scale (2000=1*multiplication)114 Reset 12 115 8 c 0 255 No Yes No No No 0 reset facilities (program/alarm/batchcounter)115 UserTag 11 113 6 c -2 Yes Yes No Yes No USERTAG user definable alias string116 AlrmMaxLim 15 97 1 i 0 32767 Yes Yes No Yes No 0 maximum limit for sensor signal to trigger alarm situation

Page 314: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

Parameternumber

(DDE)

Parametername

Group0

Group1

Group2

Processnumber

FBnr

(par)

VarType

VarLength

Minvalue

Maxvalue

Read Write Poll Secured Highly Secured

Default Value Description

2006-02-01 Page 3 of 5FlowDDE database version V3.49

117 AlrmMinLim 15 97 2 i 0 32767 Yes Yes No Yes No 0 minimum limit for sensor signal to trigger alarm situation118 AlrmMode 15 97 3 c 0 255 Yes Yes No Yes No 0 alarm mode119 AlrmOutMod 15 97 4 c 0 255 Yes Yes No Yes No 0 alarm relais activity mode during alarm situation120 AlrmStpMod 15 97 5 c 0 1 Yes Yes No Yes No 0 setpoint change enable during alarm situation121 AlrmNwSetp 15 97 6 i 0 32767 Yes Yes No Yes No 0 new/safe setpoint during alarm situation (until reset)122 CntrValue 16 104 1 f 0 9999999.99 Yes Yes Yes Yes No 0 actual counter value123 CntrUnit 16 104 2 c 0 31 Yes Yes No Yes No 0 counter unit124 CntrLimit 16 104 3 f 0 10000000 Yes Yes No Yes No 0 counter limit/batch125 CntrOutMod 16 104 4 c 0 255 Yes Yes No Yes No 0 counter relais activity mode when limit/batch has been reached126 CntrStpMod 16 104 5 c 0 1 Yes Yes No Yes No 0 setpoint change enable during counter limit/batch situation (until reset)127 CntrNwSetp 16 104 6 i 0 32767 Yes Yes No Yes No 0 new/safe setpoint at counter limit/batch situation (until reset) (normally = 0%)128 CntrUntstr 16 104 7 c 4 Yes No No No No ln readout string at counter (informative)129 capunitstr 3 19 31 c 7 Yes Yes No Yes No ln/min readout string at capunit (informative)130 CntrMode 16 104 8 c 0 255 Yes Yes No Yes No 0 counter mode131 HwRev 13 113 7 c 1 Yes No No No No VX.XX minimum required hardware revision level for firmware version132 RCreadfact 17 1 f 1E-10 1E+10 Yes No No No No 1.0 readout factor for direct reading (changes with readunit: local on module, R.O.)133 channumber 17 2 c 1 120 Yes Yes No No No 1 channel number for operation134 masterchan 17 3 c 0 120 Yes Yes No No No 0 master channel for master-slave operation135 RCslavefct 17 4 i 0 32000 Yes Yes No No No 32000 RC slave factor136 inputnode 17 5 c 0 128 Yes Yes No Yes No 3 physical node address for channel number137 inputproc 17 6 c 0 128 Yes Yes No Yes No 1 physical process for channel number138 RCreadunit 17 7 c 7 Yes No No No No ln/min readout unit for direct reading (local variable on module: read only)139 SlaveFact% 18 33 1 f 0 500 Yes Yes No No No 100.0 slave factor for master slave control (setp = master output * slave factor)140 VrefInput 18 33 2 i 0 65535 Yes No Yes No No 0 reference voltage input for setpoint signal141 RespStable 8 114 17 c 0 255 Yes Yes No Yes No 0 controller response when controller is stable: |measure-setpoint| < 2%142 temperatur 19 13 33 7 f -250 500 Yes Yes Yes No No 20 absolute temperature in degrees Celsius143 pressure 19 13 33 8 f -3.4028E+38 3.4028E+38 Yes Yes Yes No No 1013.25 absolute pressure in mbar144 time 19 33 9 f 0 3.4028E+38 Yes No Yes No No 0 time in milliseconds145 calvolume 19 33 10 f 0 3.4028E+38 Yes Yes No Yes No 50 calibrated volume in litres146 sensornr 19 16 c 0 4 Yes Yes Yes No No 0 pointer to sensor number in calibration tube (FPP)147 rangeselct 20 19 115 10 c 0 99 Yes Yes Yes No No 0 Piston Prover operation mode (write) and status information (read back)148 TimeOut 20 2 i 0 30000 Yes Yes No Yes No 0 maximum admitted duration time for specific procedure149 frequency 21 33 9 f 0 100000 Yes No Yes No No 0 frequency in Hz150 imp/m3 20 33 10 f 0 3.4028E+38 Yes Yes No Yes No 42773.4 For FRM and FTM imp/m3 and for FCM imp/kg151 RefVolFlow 19 33 5 f 0 3.4028E+38 Yes No No No No 0 volume flow referenced to normal conditions i.e. 0 °C, 1013.25 hPa(a) in ln/min152 volumeflow 19 33 6 f -3.4028E+38 3.4028E+38 Yes No No No No 0 volume flow at actual conditions in l/min153 delta-p 19 33 11 f -100000 100000 Yes No No No No 0 relative pressure between atmosphere and sensor position154 scalefact 21 33 13 i 1 10000 Yes No No No No 1 scaling factor (multiplication) for readout on display (for optimal resolution)155 sensorname 19 17 c 10 Yes Yes No Yes No SENSOR0 label with information about stopsensor156 RstAlarmEn 15 97 9 c 0 15 Yes Yes No Yes No 15 enable reset of alarm by: keyboard, external signal, FLOW-BUS, automatic157 RstCountEn 16 104 9 c 0 15 Yes Yes No Yes No 7 enable reset of counter by: keyboard, external signal, FLOW-BUS, automatic158 MasterNode 18 33 14 c 1 128 Yes Yes No No No 3 node number of master instrument output signal for a slave159 MasterProc 18 33 15 c 1 128 Yes Yes No No No 1 process number of master instrument output signal for a slave160 InstrNode 18 33 16 c 1 128 Yes Yes No Yes No 3 node number of instrument to be operated by another module (keyboard/displa161 InstrProc 18 33 17 c 1 128 Yes Yes No Yes No 1 process number of instrument to be operated by another module (keyboard/dis162 RangeMin 3 33 18 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 0.0 minimum value at 0% for special user readout unit163 RangeMax 3 33 20 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 100.0 Maximum value at 100% for special user readout unit164 Relay/TTL 12 115 11 c 0 1 Yes Yes No Yes No 0 Relay/TTL output setting (disabled when used by alarm or counter)165 RespOpen0 8 114 18 c 0 255 Yes Yes No Yes No 0 Controller response when valve opens from zero166 ContrType 8 114 20 c 0 255 Yes Yes No Yes No 1 Controller settings for special purpose167 PIDKp 8 3 114 21 f 0 3.4028E+38 Yes Yes No Yes No 10 PID factor Kp168 PIDTi 8 114 22 f 0 3.4028E+38 Yes Yes No Yes No 0.05 PID factor Ki169 PIDTd 8 114 23 f 0 3.4028E+38 Yes Yes No Yes No 0 PID factor Kd170 Density 3 33 21 f 0 3.4028E+38 Yes Yes No Yes No 1.293 Density of selected fluid in kg/m3171 CalCertNr 13 3 113 8 c -2 Yes Yes No Yes Yes Number of calibration certificate (last basic calibration)172 CalDate 13 3 113 9 c 8 Yes Yes No Yes Yes 19991231 Date of last (basic) calibration173 ServiceNr 13 113 10 c 15 Yes Yes No Yes Yes 00000000 Servicenumber for repair/rebuilding/recalibration174 ServDate 13 113 11 c 8 Yes Yes No Yes Yes 19991231 Date of last service action175 IdentNr 13 113 12 c 0 255 Yes Yes No Yes Yes 7 Identification number (type) of instrument/device176 BHT11 14 118 11 c 0 255 No Yes No Yes Yes 0 special BHT parameter (to be changed by Bronkhorst HT only)177 PowerMode 12 115 12 c 0 50 Yes Yes No Yes No 0 power supply indication in Vdc

Page 315: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

Parameternumber

(DDE)

Parametername

Group0

Group1

Group2

Processnumber

FBnr

(par)

VarType

VarLength

Minvalue

Maxvalue

Read Write Poll Secured Highly Secured

Default Value Description

2006-02-01 Page 4 of 5FlowDDE database version V3.49

178 Pupstream 13 3 113 13 f -100000 100000 Yes Yes No Yes No 3 upstream pressure of fluid in bara (for first fluidnr only)179 Pdownstrm 13 3 113 14 f -100000 100000 Yes Yes No Yes No 1 downstream pressure of fluid in bara (for first fluidnr only)180 Orifice 13 113 15 f 0 1000 Yes Yes No Yes No 1 orifice diameter in mm181 FluidTemp 13 3 113 16 f -273.15 3.4028E+38 Yes Yes No Yes No 20 temperature of fluid through instrument (for first fluidnr only)182 AlrmDelay 15 97 7 c 0 255 Yes Yes No Yes No 3 time alarm and reset action will be delayed when alarm limit has been exceede183 capacity0% 3 33 22 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 0 capacity of instrument at zero 0% in sensor base units (mostly equal to zero)184 NumOfChan 12 0 18 c 0 120 Yes No No No No 1 number of instrument channels available for this device185 DeviceFunc 12 0 20 c 0 255 Yes No No No No 5 function of device186 ScanChan 4 123 1 c 1 255 Yes Yes No No No 1 Channel number to scan with real time information (to be set once)187 ScanPar 4 123 3 c 0 255 Yes Yes No No No 8 Parameter number to scan with real time information (to be set once)188 ScanTime 4 123 4 i 0 65535 Yes Yes No No No 50 Scan interval time in msec between two samples (to be set once)189 ScanData 22 4 123 10 c -2 Yes No No No No Scanned data with time label (can be readout event by event)190 ValveOpen 8 114 24 f 0 24 Yes Yes No Yes No 0.04 First-step offset current/voltage for valve when opening from 0%191 NrOfRuns 20 115 13 c 0 255 Yes Yes No No No 1 Amount of runs of a piston prover (0 = stability check)192 MinProTime 20 115 14 c 0 255 Yes Yes No No No 10 Minimum process time of a piston prover in 0.1 seconds193 LeakRate 20 116 9 f 0 1 Yes Yes No Yes No 0.0001 Leak rate piston prover194 ModeInfReq 12 115 15 c 4 Yes Yes No Yes No Sets instr. in info mode for 1 read-cycle to check available parameter options195 ModeInfOpt 12 115 16 c 255 Yes No No No No Gives info about possible values of a mode in an array as result of ModeInfo re196 ModeInfDes 12 115 17 c 255 Yes No No No No Gives description about one of the mode options197 CalType 20 115 18 c 0 255 Yes Yes No Yes No 0 Enables/disables options for calibration device (8 bits for 8 options)198 MassFlow 20 33 4 f -3.4028E+38 3.4028E+38 Yes No Yes No No 0 Real mass flow in kg/min199 BusAddress 23 125 10 c 0 255 Yes Yes No Yes No 2 Station address for actual fieldbus system other than FLOW-BUS200 InterfConf 23 125 3 c 0 3 Yes Yes No No Yes 1 Configuration setting for interface to other bus-systems201 Baudrate 23 125 9 l 0 1E+10 Yes Yes No Yes No 12000000 Baudrate for actual fieldbus system other than FLOW-BUS202 BusDiagnos 23 125 20 c -2 Yes No No No No Bus diagnose string for actual fieldbus system other than FLOW-BUS203 NrOfVanes 20 115 22 c 0 255 Yes Yes No Yes No 10 Number of vanes for use in a rotor meter204 Fieldbus 23 125 21 c -2 Yes No No No No FLOW-BUS Fieldbus for which instrument has been equiped205 fMeasure 2 33 0 f -3.4028E+38 3.4028E+38 Yes No No No No 0 measured value for direct reading (in capunits, max.= capacity)206 fSetpoint 2 18 33 3 f -3.4028E+38 3.4028E+38 Yes Yes No No No 0 setpoint: wanted value for direct reading (in capunits, max.= capacity)207 Mass 20 33 23 f -3.4028E+38 3.4028E+38 Yes No Yes No No 0 Mass in g208 Mstatus 4 119 1 c 3 Yes No No No No Manufacturer Status register (1 byte diag code + 2 byte diag bits)209 Mwarning 4 119 2 c 3 Yes No No No No Manufacturer Warning register (1 byte diag code + 2 byte diag bits)210 Merror 4 119 3 c 3 Yes No No No No Manufacturer Error register (1 byte diag code + 2 byte diag bits)211 DiagHist 4 119 4 c -2 Yes Yes No No No Diagnostic history string (contains history of diag codes)212 DiagMode 4 119 5 c 0 255 Yes Yes No Yes No 0 Diagnostic mode (0 = diagnostics off, 1 = diagnostics on)213 MStatEnabl 4 119 6 c 0 255 No Yes No No No 0 Manufacturer Status enable (0-127 or 254 = disable all, 255 = enable all)214 AnOutZA 10 116 21 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 0 Analog measure output, zero adjust215 AnOutSA 10 116 22 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 1 Analog measure output, span adjust216 AnInZA 10 116 23 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 0 Analog setpoint input, zero adjust217 AnInSA 10 116 24 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 1 Analog setpoint input, span adjust218 SensInZA 10 116 25 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 0 Sensor input, zero adjust219 SensInSA 10 116 26 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 1 Sensor input, span adjust220 TempInZA 10 116 27 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 0 Sensor temperature input, zero adjust221 TempInSA 10 116 28 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 1 Sensor temperature input, span adjust222 ExpSmooAd 6 117 5 f 0 1 Yes Yes No Yes No 1.0 Sensor input filter adapt setting223 SlopeSetp 18 33 24 i 0 32000 Yes Yes No Yes No 32000 Slope setpoint step. Setpoint step for the given slopetime224 FilterLen 6 117 6 i 0 255 Yes Yes No Yes No 1 Number of samples for Average filter225 fAccuracy 2 33 25 f -3.4028E+38 3.4028E+38 Yes No No No No 0 Actual accuracy in current unit226 LookI 3 33 26 c 0 20 Yes Yes No No No 0 Lookup table for linearisation index (x and y direction)227 LookX 3 33 27 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 0 Lookup table for linearisation x228 LookY 3 33 28 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 0 Lookup table for linearisation y229 LookTempI 3 33 29 c 0 1 Yes Yes No No No 0 Lookup table for linearisation at certain temperature index (z direction)230 LookTemp 3 33 30 f -273.15 3.4028E+38 Yes Yes No Yes No 0 Lookup table for linearisation at certain temperature (z)231 ValveMax 8 114 25 f 0 24 Yes Yes No Yes No 0.2 Maximum current/voltage for valve232 ValveMode 8 114 26 c 0 255 Yes Yes No Yes No 1 Valve output mode selection (0 = voltage, 1 = current)233 VlvOpenCor 8 114 27 f 0 1.5 Yes Yes No Yes No 0.96 Valve open current/voltage correction (example: 0.96, Open = ValveOpen * 0.9234 VlvZeroHld 8 114 28 f 0 1 Yes Yes No Yes No 0 Valve hold current/voltage at %0 setp (example: 0.8, Hold = ValveOpen * 0.8)235 ValveSlope 8 114 29 f 0 50 Yes Yes No Yes No 0.009 Valve slope time (Seconds)236 IFIData 23 0 21 c -2 Yes Yes No No No 0 IFI data dump protocol communication string237 RangeUsed 20 115 20 c 0 99 Yes No Yes No No 0 Piston Prover information about used sensors238 FldSetProp 3 33 31 c 0 255 Yes Yes No Yes Yes 0 Fluidset properties

Page 316: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

Parameternumber

(DDE)

Parametername

Group0

Group1

Group2

Processnumber

FBnr

(par)

VarType

VarLength

Minvalue

Maxvalue

Read Write Poll Secured Highly Secured

Default Value Description

2006-02-01 Page 5 of 5FlowDDE database version V3.49

239 LUnitType 3 33 12 c 0 255 Yes Yes No Yes Yes 0 Lookup table capacity unit type240 LUnTypNam 3 33 13 c 20 Yes Yes No Yes Yes Lookup table capacity unit type name (informative)241 LUnit 3 33 16 c 0 255 Yes Yes No Yes Yes 0 Lookup table capacity unit (unit LUTy)242 LUnitName 3 33 17 c 7 Yes Yes No Yes Yes kg/s Lookup table capacity unit name (informative)243 CUnitType 3 1 29 c 0 255 Yes Yes No Yes No 0 Output capacity unit type244 CUnTypNam 3 1 30 c 20 Yes Yes No Yes No Output capacity unit type name (informative)245 CUnTypTem 3 33 10 f -273.15 3.4028E+38 Yes Yes No Yes No 0 Output capacity unit type temperature (°C)246 CUnTypPres 3 33 11 f 0 3.4028E+38 Yes Yes No Yes No 1 Output capacity unit type pressure (bar (a))247 CapMin 3 1 27 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 0 Minimum capacity in output capacity units248 CapMax 3 1 28 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 1 Maximum capacity in output capacity units249 FormulaTyp 3 113 17 i 0 65535 Yes Yes No Yes No 0 Formula type needed for conversion250 HeatCap 3 113 18 f 0 3.4028E+38 Yes Yes No Yes No 0 Heat capacity (Cp)251 ThermCond 3 113 20 f 0 3.4028E+38 Yes Yes No Yes No 0 Thermal conductivity (lambda)252 Viscosity 3 113 21 f 0 3.4028E+38 Yes Yes No Yes No 0 Viscosity253 NormMasFlw 3 113 22 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 1 Normalized mass flow in ln/min air equivalent254 Kspeed 8 3 114 30 f 0 3.4028E+38 Yes Yes No Yes No 1 Controller speed factor (gain)255 SensorCode 13 113 23 i 0 65535 Yes Yes No Yes Yes 0 Sensor code256 SensorRevC 13 113 24 c 0 255 Yes Yes No Yes Yes 0 Sensor revision code257 RestrCode 13 113 25 i 0 65535 Yes Yes No Yes Yes 0 Restriction code258 RestrRevC 13 113 26 c 0 255 Yes Yes No Yes Yes 0 Restriction revision code259 RestrNxP 13 113 27 l 0 2147483648 Yes Yes No Yes Yes 0 Restriction NxP (proportional to air equivalent capacity of LFE)260 Seals 13 113 28 c 16 0 255 Yes Yes No Yes Yes V,V Seals information (1st byte = other, 2nd = plunger seal)261 ValveCode 13 113 29 i 0 65535 Yes Yes No Yes Yes 0 Valve code262 ValveRevC 13 113 30 c 0 255 Yes Yes No Yes Yes 0 Valve revision code263 InstrProp 13 113 31 l 0 2147483648 Yes Yes No Yes Yes 0 Instrument properties264 LookFreqI 3 116 10 c 0 1 Yes Yes No Yes No 0 Lookup table for frequency index265 LFFreq 3 116 11 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 0 Lookup table for frequency frequency266 LFTemp 3 116 12 f -273.15 3.4028E+38 Yes Yes No Yes No 0 Lookup table for frequency temperature267 LFDensity 3 116 13 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 0 Lookup table for frequency density268 LFSpanAdj 3 116 14 f -3.4028E+38 3.4028E+38 Yes Yes No Yes No 0 Lookup table for frequency span adjust269 0 0 0 0 0 No No No No No dummy parameter (for now)270 DensityAct 3 116 15 f -3.4028E+38 3.4028E+38 Yes No No No No 0 Actual density, measured by instrument

Page 317: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

APPENDIX 2

Parameter values table

Page 318: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

Parameter values table

Parameternumber

(DDE)

Parametername

Filter Value Description

2006-02-01 Page 1 of 5FlowDDE database version V3.49

6 arbitrage temporary busmaster16 arbitrage always busmaster26 arbitrage automatic busmaster36 arbitrage auto busmaster and auto bus optimalization (fast token ring)67

12 cntrlmode setpoint = 100%712 cntrlmode (FPP) Manual start sensor select, automatic end sensor1512 cntrlmode (FPP) Range select mode1412 cntrlmode setpoint = keyboard OR FLOW-BUS setpoint1112 cntrlmode setpoint = master output(analog in) * slave factor(FLOW-BUS)1012 cntrlmode tuningmode enable (select subtject with par 79)612 cntrlmode purge valve (fully open)812 cntrlmode setpoint = RS232 setpoint1812 cntrlmode setpoint = master output(FLOW-BUS) * slave factor(FLOW-BUS)212 cntrlmode close valve312 cntrlmode setpoint idle (no reaction on changes in sensor signal)412 cntrlmode testmode enable (select subject with par 70)512 cntrlmode calibration mode enable (select subject with par 58)912 cntrlmode (FPP) Automatic start and end sensor1712 cntrlmode setpoint = analog input112 cntrlmode RS232 broadcast mode1912 cntrlmode valve stearing (valve = setpoint)2012 cntrlmode analog valve stearing (valve = analog setpoint)2112 cntrlmode setpoint = 0%1212 cntrlmode setpoint = master output(FLOW-BUS) * slave factor(analog in)1312 cntrlmode setpoint = BUS setpoint012 cntrlmode (FPP) Automatic start sensor select, manual end sensor1622 sensortype liquid/gas mass (sensor)13022 sensortype liquid volume (sensor)12922 sensortype pressure (sensor)12822 sensortype other sensor type (controller)422 sensortype liquid volume (controller)122 sensortype liquid/gas mass (controller)222 sensortype other sensor type (sensor)13222 sensortype pressure (controller)022 sensortype gas volume (controller)322 sensortype gas volume (sensor)13128 alarminfo &H01 at least 1 error message in alarm error status register128 alarminfo &H02 no warning message in alarm warning status register028 alarminfo &H04 no minimum alarm message (measure>minimum limit)028 alarminfo &H08 no maximum alarm message (measure<maximum limit)028 alarminfo &H10 batch counter has not reached its limit028 alarminfo &H20 response O.K. (setpoint-measure within limit)028 alarminfo &H80 hardware O.K.028 alarminfo &H02 at least 1 warning message in alarm warning status register128 alarminfo &H08 maximum alarm message for measured signal128 alarminfo &H20 response alarm message: setpoint-measure is too high128 alarminfo &H40 master output signal not received: check master instrument128 alarminfo &H80 hardware error message: check your hardware128 alarminfo &H10 batch counter has reached its limit128 alarminfo &H40 master output signal O.K. (or not used)028 alarminfo &H04 minimum alarm message for measured signal128 alarminfo &H01 no error message in alarm error status register044 opermodeTA A: MAX & RESP; T: DOWN FROM LIMIT344 opermodeTA A: MIN & RESP; T: DOWN AND REPEAT444 opermodeTA A: MAXIMUM ALARM; T: ALWAYS UP544 opermodeTA A: MINIMUM ALARM644 opermodeTA A: MAX & RESP AUTO; T: UP TO LIMIT144 opermodeTA A: RESPONSE ALARM744 opermodeTA A: MIN & RESP AUTO; T: UP AND REPEAT244 opermodeTA OFF053 AnalogMode &H3F 4...20 mA operation353 AnalogMode &H3F 0...20 mA operation253 AnalogMode &H3F 15...20 mA operation453 AnalogMode &H3F 0...5 Vdc operation053 AnalogMode &H80 Analog output disabled153 AnalogMode &H80 Analog output enabled053 AnalogMode &H40 Analog input disabled153 AnalogMode &H40 Analog input enabled053 AnalogMode &H3F 0...10 Vdc operation158 CalMode adjust Vref output by connecting it to analog in1058 CalMode adjust analog out by connecting it to analog in1158 CalMode zero sensor bridge circuit958 CalMode dmfc8

Page 319: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

Parameternumber

(DDE)

Parametername

Filter Value Description

2006-02-01 Page 2 of 5FlowDDE database version V3.49

58 CalMode dmfc758 CalMode dmfc658 CalMode dmfc458 CalMode adjust valveoutput by connecting it to analog in1258 CalMode dmfc258 CalMode adc self calibration158 CalMode adjust heater balance1858 CalMode idle: no action058 CalMode dmfc358 CalMode analog output = 0 %1558 CalMode dmfc558 CalMode analog output = 50 %1758 CalMode dmfc1358 CalMode analog output = 100 %1658 CalMode dmfc1460 monitor analog input signal960 monitor (filtered) setpoint060 monitor mass flow in display unit (normally ln/min)1160 monitor mass flow in kg/min1960 monitor time in msec/frequency in Hz.1560 monitor atmospheric (barometer) pressure in mbara1860 monitor delta-P pressure in mbarg1760 monitor calibrated volume at actual sensor in ml1660 monitor normal sensor signal (Output)860 monitor power supply voltage1060 monitor controller error input signal160 monitor volume flow in l/min1260 monitor pressure absolute in mbara1460 monitor temperature in °C1360 monitor controller output signal to valve260 monitor differentiator output filtered760 monitor differentiator output660 monitor linearization output560 monitor sensor signal slow filtered460 monitor sensor signal slow361 AlarmReg1 &H8000000000000000 Diagnostics available in warning register161 AlarmReg1 &H8000000000000000 No diagnostics available in warning register062 AlarmReg2 &H8000000000000000 No diagnostics available in error register062 AlarmReg2 &H8000000000000000 Diagnostics available in error register167 ADCcntrReg &H1C0000 ADC gain = 8x367 ADCcntrReg &H020000 ADC input channel 1 selection067 ADCcntrReg &H010000 ADC no power down mode (normal)067 ADCcntrReg &H1C0000 ADC gain = 64x667 ADCcntrReg &H1C0000 ADC gain = 16x467 ADCcntrReg &H020000 ADC input channel 2 selection167 ADCcntrReg &H1C0000 ADC gain = 4x267 ADCcntrReg &H1C0000 ADC gain = 2x167 ADCcntrReg &H1C0000 ADC gain = 1x067 ADCcntrReg &HE00000 ADC read/write FS calibration coefficients on sel. channel767 ADCcntrReg &HE00000 ADC read/write ZS calibration coefficients on sel. channel667 ADCcntrReg &HE00000 ADC activate background calibration on selected channel567 ADCcntrReg &HE00000 ADC activate system offset calibration on selected channel467 ADCcntrReg &HE00000 ADC activate system calibration FS on selected channel367 ADCcntrReg &HE00000 ADC activate self calibration on selected channel167 ADCcntrReg &HE00000 ADC normal (sampling) mode067 ADCcntrReg &H010000 ADC power down mode167 ADCcntrReg &H1C0000 ADC gain = 128x767 ADCcntrReg &HE00000 ADC activate system calibration ZS on selected channel267 ADCcntrReg &H001000 ADC unipolar mode167 ADCcntrReg &H008000 ADC 24-bit word length167 ADCcntrReg &H004000 ADC output compensation current off067 ADCcntrReg &H004000 ADC output compensation current on167 ADCcntrReg &H002000 ADC burn-out current off067 ADCcntrReg &H002000 ADC burn-out current on167 ADCcntrReg &H001000 ADC bipolar mode067 ADCcntrReg &H008000 ADC 16-bit word length067 ADCcntrReg &H1C0000 ADC gain = 32x569 AlarmEnble enable169 AlarmEnble disable070 TestMode IO270 TestMode FRAM470 TestMode RAM370 TestMode keyboard1270 TestMode uProcessor170 TestMode ADC570 TestMode sensor770 TestMode FLOW-BUS1070 TestMode DAC6

Page 320: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

Parameternumber

(DDE)

Parametername

Filter Value Description

2006-02-01 Page 3 of 5FlowDDE database version V3.49

70 TestMode Vref970 TestMode valve drive circuit870 TestMode calibration1170 TestMode idle; no action071 ChanSelect AD channel 1171 ChanSelect AD channel 2279 TuningMode Fuzzy controller open at zero479 TuningMode Fuzzy controller normal operation379 TuningMode sensor179 TuningMode idle; no action079 TuningMode valve279 TuningMode PID controller580 DefVlvType normally opened180 DefVlvType normally closed inverse controlled280 DefVlvType normally opened inverse controlled380 DefVlvType remain position480 DefVlvType normally closed086 IOStatus &H01 don't read diagnostic jumper (no diagnostics, read/write)186 IOStatus &H40 analog jumper set (read only)186 IOStatus &H80 micro switch pressed (read only)186 IOStatus &H10 diagnostic jumper set (read only)186 IOStatus &H08 don't read micro switch (always off, read/write)186 IOStatus &H03 don't read analog jumper (use cntrlmode, read/write)186 IOStatus &H03 Red LED blinking fast386 IOStatus &H03 Red LED off086 IOStatus &H20 initialization jumper set (read only)186 IOStatus &H02 not used1

106 PressSensr absolute pressure 800-1100 mbar3106 PressSensr delta-P 0...10" W.C.1106 PressSensr delta-P 0...1 PSI7106 PressSensr absolute pressure 800-1200 mbar2106 PressSensr delta-P -10...+10 "W.C.6106 PressSensr delta-P -10...0 "W.C.5106 PressSensr delta-P -5...0 "W.C.4106 PressSensr delta-P 0..5" W.C.0106 PressSensr delta-P -1...0 PSI8114 Reset restart batch counter3114 Reset reset counter value (counter off)4114 Reset reset alarm2114 Reset reset counter value (no mode change) or common reset1114 Reset Reset module (soft reset)5114 Reset no reset0118 AlrmMode off0118 AlrmMode alarm on absolute limits1118 AlrmMode alarm on limits related to setpoint (response alarm)2118 AlrmMode alarm when instrument powers-up (eg. after power-down)3119 AlrmOutMod no relais activity at alarm0119 AlrmOutMod relais activated until reset2119 AlrmOutMod relais pulses until reset1120 AlrmStpMod no setpoint change at alarm0120 AlrmStpMod new/safe setpoint at alarm enabled (set at par 121)1125 CntrOutMod relais activated after reaching batch limit until reset2125 CntrOutMod relais pulses after reaching batch limit until reset1125 CntrOutMod no relais activity at batch limit0126 CntrStpMod setpoint change at batch limit disabled0126 CntrStpMod setpoint change at batch limit enabled1130 CntrMode off0130 CntrMode counting up to limit (batchcounter)2130 CntrMode counting upwards continuously1147 rangeselct run calibration with automatic range selection9147 rangeselct calibration ready/stop0147 rangeselct run calibration until stopsensor 1/select range 11147 rangeselct run calibration until stopsensor 2/select range 22147 rangeselct run calibration until stopsensor 3/select range 33147 rangeselct run calibration and select range 55147 rangeselct run until stopsensor 1 until 3 values between limit19147 rangeselct run until stopsensor 2 until 3 values between limit29147 rangeselct run until stopsensor 3 until 3 values between limit39147 rangeselct run until stopsensor 4 until 3 values between limit49147 rangeselct run and select range 5 until 3 values between limit59147 rangeselct run with auto-select + 3 values between limit99147 rangeselct run calibration until stopsensor 4/select range 44156 RstAlarmEn reset: automatic or keyboard9156 RstAlarmEn reset: automatic or keyboard or external11156 RstAlarmEn no reset possible0156 RstAlarmEn reset: automatic or FLOW-BUS or keyboard or external15156 RstAlarmEn reset: automatic or FLOW-BUS or external14156 RstAlarmEn reset: automatic or FLOW-BUS12

Page 321: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

Parameternumber

(DDE)

Parametername

Filter Value Description

2006-02-01 Page 4 of 5FlowDDE database version V3.49

156 RstAlarmEn reset: automatic or external10156 RstAlarmEn reset: FLOW-BUS or keyboard or external7156 RstAlarmEn reset: automatic8156 RstAlarmEn reset: FLOW-BUS or external6156 RstAlarmEn reset: FLOW-BUS or keyboard5156 RstAlarmEn reset: FLOW-BUS4156 RstAlarmEn reset: keyboard or external3156 RstAlarmEn reset: external2156 RstAlarmEn reset: keyboard1156 RstAlarmEn reset: automatic or FLOW-BUS or keyboard13157 RstCountEn reset: automatic or FLOW-BUS or keyboard13157 RstCountEn reset: automatic8157 RstCountEn reset: automatic or FLOW-BUS or external14157 RstCountEn reset: automatic or FLOW-BUS12157 RstCountEn reset: automatic or keyboard or external11157 RstCountEn reset: automatic or external10157 RstCountEn reset: automatic or keyboard9157 RstCountEn reset: automatic or FLOW-BUS or keyboard or external15157 RstCountEn reset: keyboard1157 RstCountEn reset: external2157 RstCountEn reset: keyboard or external3157 RstCountEn reset: FLOW-BUS or external6157 RstCountEn reset: FLOW-BUS4157 RstCountEn reset: FLOW-BUS or keyboard or external7157 RstCountEn no reset possible0157 RstCountEn reset: FLOW-BUS or keyboard5166 ContrType &H40 controller special mode (valve output steps) turned on1166 ContrType &H08 voltage drift compensation for valve output turned off1166 ContrType &H40 controller special mode (valve output steps) turned off0166 ContrType &H20 voltage drift compensation for valve output turned off1166 ContrType &H04 monitor output changed at setpoint steps1166 ContrType &H20 voltage drift compensation for valve output turned on0166 ContrType &H04 fixed monitor output signal0166 ContrType &H02 open from zero with ramp output to valve1166 ContrType &H02 open from zero with PID output to valve0166 ContrType &H01 valve in safe position after startup1166 ContrType &H01 valve in normal position after startup0166 ContrType &H10 auto slope enabled for pilot valves1166 ContrType &H10 auto slope disabled0166 ContrType &H08 voltage drift compensation for valve output turned on0175 IdentNr FLOW-BUS Balance Interface26175 IdentNr FLOW-BUS Switch Interface32175 IdentNr Keithley FLOW-BUS Interface31175 IdentNr Instrument FLOW-BUS Interface30175 IdentNr FLOW-BUS Interface Climate Control29175 IdentNr CoriFlow Controller27175 IdentNr T/A-module5175 IdentNr FLOW-BUS Coriolis Meter25175 IdentNr Profibus-DP/FLOW-BUS interface module24175 IdentNr CoriFlow Meter28175 IdentNr DSCM-A: digital single channel module for analog instruments14175 IdentNr RS232/FLOW-BUS interface1175 IdentNr DSCM-E: evaporator controller module (single channel)20175 IdentNr DSCM-C: digital single channel module for calibrators21175 IdentNr DDCM-A: digital dual channel module for analog instruments22175 IdentNr DMCM-D: digital multi channel module for digital instruments23175 IdentNr F/A-module: special version of T/A-module19175 IdentNr DEPM: digital electronic pressure meter10175 IdentNr FPP: FLOW-BUS piston prover/tube (calibration-instrument)18175 IdentNr FTM: FLOW-BUS turbine meter (calibration-instrument)17175 IdentNr ADDA4 (4 channels)3175 IdentNr DSCM-D: digital single channel module for digital instr.15175 IdentNr PC(ISA) interface2175 IdentNr DLFM: digital liquid flow meter13175 IdentNr DLFC: digital liquid flow controller12175 IdentNr ACT: single actuator11175 IdentNr DEPC: digital electronic pressure controller9175 IdentNr DMFM: digital mass flow meter8175 IdentNr DMFC: digital mass flow controller7175 IdentNr ADDA1: 1 channel ADDA converter module6175 IdentNr R/C-module, 32 channels4175 IdentNr FRM: FLOW-BUS rotor meter (calibration-instrument)16185 DeviceFunc Meter6185 DeviceFunc Unknown0185 DeviceFunc (Protocol) converter8185 DeviceFunc Operator3185 DeviceFunc ADDA2185 DeviceFunc Interface1

Page 322: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

Parameternumber

(DDE)

Parametername

Filter Value Description

2006-02-01 Page 5 of 5FlowDDE database version V3.49

185 DeviceFunc Supervisor (totalizer/alarm)4185 DeviceFunc Controller5185 DeviceFunc Special7197 CalType &H01 Automatic capacity setting for optimal resolution0197 CalType &H01 Manual capacity setting for optimal resolution1197 CalType &H02 Barometer value input via parameter 107: BaroPress0197 CalType &H02 Barometer is master; input automatically from master1200 InterfConf Configuration B: 14 ch. Standard parms with fixed chan list1200 InterfConf Configuration A: 14 ch. Standard parms. with network scan0200 InterfConf Configuration C: 7 ch. Extended parms with fixed chan list2200 InterfConf Configuration D: 11 ch. Extended parms with network scan3208 Mstatus &H800000 No diagnostics available in manufacturer status register0208 Mstatus &H800000 Diagnostics available in manufacturer status register1209 Mwarning &H800000 No diagnostics available in manufacturer warning register0209 Mwarning &H800000 Diagnostics available in manufacturer warning register1210 Merror &H800000 No diagnostics available in manufacturer error register0210 Merror &H800000 Diagnostics available in manufacturer error register1212 DiagMode Debug mode on1212 DiagMode Debug mode off0213 MStatEnabl clear all status bits254213 MStatEnabl set status bit (range 0…127)127213 MStatEnabl set status bit (range 0…127)0213 MStatEnabl set all status bits255232 ValveMode voltage drive mode0232 ValveMode current drive mode1238 FldSetProp &H01 Fluidset enabled1238 FldSetProp &H04 Fluidset is not actual calibrated0238 FldSetProp &H02 Fluidset is not set by Bronkhorst High-Tech0238 FldSetProp &H01 Fluidset is disabled0238 FldSetProp &H02 Fluidset is set by Bronkhorst High-Tech2238 FldSetProp &H04 Fluidset is actual calibrated4263 InstrProp &H04 Instrument is not multi-range multi-fluid capable0263 InstrProp &H01 Instrument has polynomial1263 InstrProp &H02 Instrument has lookup table for linearization2263 InstrProp &H04 Instrument is multi-range multi-fluid capable3263 InstrProp &H01 Instrument has no polynomial0263 InstrProp &H02 Instrument has no lookup table for linearization0

Page 323: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

Instruction manual

Operation instructions digital Mass Flow / Pressure instruments

parameters and properties

Doc. no.: 9.17.023I Date: 26-10-2005

ATTENTION Before installing and operating the instrument it is recommended that this instruction be read. Not following the guidelines could result in personal injury and/or damage to the equipment.

Page 324: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 2 9.17.023

SCOPE OF THIS MANUAL This manual covers the operation part of digital massflow / pressure instruments for gases or liquids. It describes the parameters and their properties needed for (digital) operation. More information can be found in other documents. Multibus instruments have modular instruction manuals consisting of: - General instructions digital Mass Flow / Pressure instruments

laboratory style / IN-FLOW (document nr. 9.17.022) - General instructions CORI-FLOW (document nr. 9.17.031) - General instructions digital LIQUI-FLOW L30 (document nr. 9.17.044) - Operation instructions digital instruments (document nr. 9.17.023)

- Fieldbus/interface descriptions.

- FLOW-BUS interface (document nr. 9.17.024) - PROFIBUS–DP interface (document nr. 9.17.025) - DeviceNet interface (document nr. 9.17.026) - RS232 interface with FLOW-BUS protocol (document nr. 9.17.027) - Modbus interface (document nr. 9.17.035) special request

Page 325: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 3 9.17.023

TABLE OF CONTENTS 1 DIGITAL INSTRUMENT.........................................................................................................................5

1.1 General ..........................................................................................................................................5 1.2 Functional block diagram ................................................................................................................6 1.3 Calibration with mathematical functions...........................................................................................6

1.3.1 General information .................................................................................................................6 1.3.2 Polynomial functions ................................................................................................................6 1.3.3 General form of a polynomial function ......................................................................................6 1.3.4 Polynomial function of sensor signal ........................................................................................7 1.3.5 Look-up tables .........................................................................................................................7 1.3.6 General form of 2-dimensional look-up tables...........................................................................7 1.3.7 Look-up table for sensor signal ................................................................................................7 1.3.8 Look-up tables with temperature compensation........................................................................7 1.3.9 General form of 3-dimensional look-up tables...........................................................................8 1.3.10 Look-up table with temperature compensation for sensor signal ...............................................8 1.3.11 Using mathematical functions at a digital instrument.................................................................8

1.4 Multi Fluid / Multi Range instruments...............................................................................................9 1.4.1 General information .................................................................................................................9 1.4.2 Differences between traditional and MFMR instruments ...........................................................9

2 PARAMETERS AND PROPERTIES ....................................................................................................10 2.1 Measured value (measure) ...........................................................................................................12 2.2 Setpoint ........................................................................................................................................12 2.3 Setpoint slope...............................................................................................................................12 2.4 Analog input .................................................................................................................................12 2.5 Setpoint/control modes .................................................................................................................13

2.5.1 Dual interface operation.........................................................................................................13 2.5.2 Master/slave (ratio) control.....................................................................................................14 2.5.3 Tuning, test and calibration ....................................................................................................14

2.6 Fluid number.................................................................................................................................14 2.7 Fluid name....................................................................................................................................14 2.8 Valve output .................................................................................................................................15 2.9 Temperature.................................................................................................................................15

3 DIRECT READING PARAMETERS .....................................................................................................16 3.1 Sensor type ..................................................................................................................................16 3.2 Capacity (100%) ...........................................................................................................................16 3.3 Capacity 0% .................................................................................................................................16 3.4 Fmeasure .....................................................................................................................................16 3.5 Fsetpoint.......................................................................................................................................17 3.6 Capunit.........................................................................................................................................17 3.7 Capacity unit string .......................................................................................................................17

4 IDENTIFICATION PARAMETERS .......................................................................................................18 4.1 Serialnumber ................................................................................................................................18 4.2 Modelnumber................................................................................................................................18 4.3 Firmware version ..........................................................................................................................18 4.4 Usertag.........................................................................................................................................18 4.5 Manufacturer config ......................................................................................................................18 4.6 Identnumber .................................................................................................................................19 4.7 Device type...................................................................................................................................19

5 ALARM/STATUS PARAMETERS ........................................................................................................20 5.1 Alarminfo ......................................................................................................................................20 5.2 Status...........................................................................................................................................20 5.3 Alarm mode ..................................................................................................................................20 5.4 Alarm maximum limit.....................................................................................................................21 5.5 Alarm minimum limit......................................................................................................................21 5.6 Alarm output mode .......................................................................................................................21 5.7 Alarm setpoint mode.....................................................................................................................21 5.8 Alarm new setpoint .......................................................................................................................21 5.9 Alarm delay time...........................................................................................................................21 5.10 Reset alarm enable ...................................................................................................................22 5.11 Using an alarm (examples)........................................................................................................22

Page 326: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 4 9.17.023

6 COUNTER PARAMETERS..................................................................................................................24 6.1 Counter value ...............................................................................................................................24 6.2 Counter mode...............................................................................................................................24 6.3 Counter setpoint mode..................................................................................................................24 6.4 Counter new setpoint ....................................................................................................................24 6.5 Counter limit .................................................................................................................................24 6.6 Counter output mode ....................................................................................................................24 6.7 Counter unit..................................................................................................................................25 6.8 Counter unit string ........................................................................................................................25 6.9 Using a counter (example) ............................................................................................................25

7 SPECIAL PARAMETERS ....................................................................................................................26 7.1 Reset............................................................................................................................................26 7.2 Init/reset (key-parameter)..............................................................................................................26 7.3 Wink.............................................................................................................................................26

8 CONTROLLER PARAMETERS ...........................................................................................................27 8.1 Controller......................................................................................................................................27 8.2 RespOpen0 ..................................................................................................................................27 8.3 ContrResp ....................................................................................................................................27 8.4 RespStable...................................................................................................................................27 8.5 PIDKp...........................................................................................................................................27 8.6 PIDTi ............................................................................................................................................27 8.7 PIDTd...........................................................................................................................................27 8.8 TdsUp...........................................................................................................................................28 8.9 TdsDn...........................................................................................................................................28 8.10 ExpSmooCon............................................................................................................................28 8.11 ExpSmooAd ..............................................................................................................................28

9 SPECIAL INSTRUMENT FEATURES..................................................................................................29 9.1 Zero (mass flow instruments only).................................................................................................29

9.1.1 Zeroing with the Micro-switch.................................................................................................29 9.1.2 Zeroing with digital communication.........................................................................................29

9.2 Restore parameter settings...........................................................................................................30 10 MANUAL INTERFACE: micro-switch and LED’s ...............................................................................31

10.1 General .....................................................................................................................................31 10.2 Readout/change bus-address/MAC-ID and baudrate .................................................................34

10.2.1 Set instrument to default installation address/MAC-ID: ...........................................................34 10.2.2 Readout bus-address/MAC-ID and baudrate: .........................................................................34 10.2.3 Change bus-address/MAC-ID and baudrate: ..........................................................................35

11 JUMPER SETTINGS MULTIBUS INSTRUMENTS ...........................................................................36 12 TESTING AND DIAGNOSTICS........................................................................................................37

Page 327: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 5 9.17.023

1 DIGITAL INSTRUMENT

1.1 General A digital instrument of Bronkhorst High-Tech is a Mass Flow or Pressure Meter/Controller which is equipped with a digital electronic multibus PCB. These electronics consist of a micro-controller with peripheral circuitry for measuring, controlling and communication. The flow/pressure signal, is measured and digitized directly at the sensor and processed by means of the internal software (firmware). Measured and processed values can be output through the analog interface or through the digital communication line (RS232 or optional fieldbus interface). For controllers the setting for the actuator is calculated by the firmware. Setpoint can be given through the analog interface or through the digital communication line. Digital instruments have many parameters for settings for signal processing, controlling and many extra features and therefore they have a wide range in use. Reading and changing of these settings is only possible through fieldbus or RS232, except for measured value, setpoint and valve output, which is also possible through the analog interface. (Depending on parameter setting) See operating instructions of Readout and Control module or PC-program how to read/change parameter values of digital instruments. Digital instruments can be operated by means of:

1. Analog interface (0...5Vdc/0...10Vdc/0...20mA/4...20mA) 2. RS232 interface (connected to COM-port by means of special cable on 38400 Baud) 3. FLOW-BUS 4. PROFIBUS-DP 5. DeviceNet 6. Modbus (special request)

Option 1 and 2 are always present on multibus instruments. An interface to any available fieldbus is optional. Operation via analog interface, RS232 interface and an optional fieldbus can be performed at the same time. A special parameter called “control mode” indicates to which setpoint the controller should listen: analog or digital (via fieldbus or RS232). The RS232 interface behaves like a FLOW-BUS interface. When using more interfaces at the same time, reading can be done simultaneously without problems. When changing a parameter value, the last value send by an interface will be valid. Also the micro push-switch switch and the LED’s on top of the instrument can be used for manual operation of some options. The green LED will indicate in what mode the instrument is active. The red LED will indicate error/warning situations.

Page 328: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 6 9.17.023

1.2 Functional block diagram

DMFC/DEPC functional block diagram

1.3 Calibration with mathematical functions

1.3.1 General information A standard calibrated digital instrument has a linearized transfer function within 1% F.S. accuracy. This means that real flow/pressure is proportional to the output and setpoint signal (0-5 V, 0-10 V, 0-20 mA or 4-20 mA) within 1% of the full scale range. Depending on instrument and sensor type an instrument output signal is calculated with one of the following mathematical methods:

• polynomial function • look-up table (2 dimensions) • look-up table with temperature compensation (3 dimensions)

All these methods are methods of approximation which mathematically describes a continues transfer function to calculate a flow/pressure out of the sensor signal of the device.

1.3.2 Polynomial functions By means of a few samples, a polynomial function can be obtained. After determining the polynomial function, the original calibration points and an infinite amount of values in between, can be calculated with high accuracy. In a system where pressure- and/or flow meters and -controllers should be readout and set with high accuracy, these polynomial functions often are used for approximation of their transfer function.

1.3.3 General form of a polynomial function The general form of a polynomial function of the n-nd degree is as follows:

nn XaXaXaXaay ⋅++⋅+⋅+⋅+= .....3

32

210

Where 'a0' to 'an' are polynomial parameters, which can be calculated. When you have 'n + 1' measure-points, they can be approximated by means of a 'nnd' degree polynomial function.

Microcontroller

ControlMeasure

Analog Output

DACSwitch LED's

Analog Input

ADC

Setpoint

Slope

Difference

PID controllerDifferentiator

Linearisation

Filter

ADC

Sensor Valve

DAC

Digitalcommunication

Page 329: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 7 9.17.023

1.3.4 Polynomial function of sensor signal By means of a calibration at Bronkhorst High-Tech B.V. several measured calibration points will be used to obtain a polynomial function. The form of this function of the 3rd degree is:

32 XdXcXbaY ⋅+⋅+⋅+= In which 'Y' is the normalized measured value (0-100%) and 'X' is the value of the sensor signal. Characters 'a - d' are polynomial parameters, which can be obtained by a mathematical program. The polynomial parameters are calculated in such a way that the fit error between the calibration points and the polynomial function is minimized.

1.3.5 Look-up tables In certain cases it is not possible to describe a sensor signal curve by means of a polynomial function of the 3rd degree. In those cases a look-up table is a good alternative. A look-up table is a table filled with calibration points. The embedded software inside the digital instrument calculates a continues smooth function which fits exactly through these calibration points. Using this method it is possible to describe any monotone rising sensor signal curve with high accuracy.

1.3.6 General form of 2-dimensional look-up tables The general form of a 2-dimensional look-up table is as follows:

index X Y

0 x0 y0

1 x1 y1

2 x2 y2

3 x3 y3

… … …

n xn yn

In which 'Y' is the normalized measured value (0-100%), 'X' is the value of the sensor signal and ‘index’ represents the position in the look-up table.

1.3.7 Look-up table for sensor signal A digital instrument with look-up table capability for sensor signal can store look-up tables with at maximum 21 calibration points.

1.3.8 Look-up tables with temperature compensation Almost all flow and pressure sensors are temperature sensitive. For most of these sensors it is easy to decrease the temperature sensitivity to acceptable level by means of easy methods. This is called ‘intrinsic temperature compensation’. For some sensor types intrinsic temperature compensation is hard to establish. In those cases Bronkhorst uses a 3-dimensional look-up table with temperature compensation in its instruments. To compensate the measured sensor signal for the actual temperature, in those instruments a temperature sensor is added inside the flow or pressure sensor. The temperature signal is used to compensate the flow or pressure sensor signal to the correct value.

Page 330: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 8 9.17.023

1.3.9 General form of 3-dimensional look-up tables The general form of a 3-dimensional look-up table is as follows:

In which 'T' is the calibration temperature, 'Y' is the normalized measured value (0-100%), 'X' is the value of the sensor signal and ‘index’ represents the position in the look-up table.

1.3.10 Look-up table with temperature compensation for sensor signal By means of a calibration at two different temperatures several measured calibration points will be used to obtain two look-up tables. Bronkhorst uses climatic chambers and fully automated calibration systems for calibration of the sensor signal. The actual measurement is based on both sensor and temperature measurement.

1.3.11 Using mathematical functions at a digital instrument Digital instruments are capable of storing 8 different fluid calibrations. Parameters for these calibrations are stored inside the instrument and can be changed through the fieldbus or the RS232 connection by means of a PC-program or a digital Readout and Control module. Factory calibration parameters are secured and can not be changed unless you have special rights to do this. Selection of another fluid is part of operation and therefore not secured. Digital instruments will need at least 1 fluidset of calibration parameters for operation.

Page 331: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 9 9.17.023

1.4 Multi Fluid / Multi Range instruments

1.4.1 General information Multi Fluid / Multi Range (MFMR) instruments are calibrated for standard ranges which can easily be configured for other fluids and ranges. This applies for both Bronkhorst and its customers. Changing fluid and range can be performed by means of a simple computer program through the RS232 connection of an instrument. The program can convert the primal calibration curve inside the instrument to the selected fluid and range.

1.4.2 Differences between traditional and MFMR instruments In traditional digital instruments the parameters capacity, density, unittype, unitname etc are static parameters and do not harm the behavior of the instrument. These parameters are used by for example read out units or PC-software to convert the measured value in percentage of the maximum output to a real value in a certain unit. However in MFMR instruments these parameters are dynamic. Examples: An instrument is configured for 2000 mln/min Air.

Changing the unit name from ‘mln/min’ to ‘ln/min’ effects that the capacity automatically changes from ‘2000’ to ‘2’. The 100% output is not affected. Changing the capacity from ‘2000’ to ‘1000’ effects that the instruments full scale range (100% output) changes to 1000 mln/min. The instrument is reranged.

Page 332: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 10 9.17.023

2 PARAMETERS AND PROPERTIES Digital instruments consist of a microcontroller with several processes running simultaneously for: Measuring sensor value Reading analog input signal Digital signal processing Driving valve Setting analog output signal Communication with world outside Memory handling Each process needs its own specific parameters in order to function correctly. Most parameter values are accessible through the available interface(s) to influence the process behaviour. Many parameters may be controlled by end-users for more flexible use of the instruments. Bronkhorst High-Tech offers special software for these purposes (in combination with FLOWDDE): FlowView : Windows application for operation of max. 8 instruments FlowPlot : Windows application for adjustment of controllers (Value versus time on screen) End-users are also free to use their own software using either: FLOWDDE : DDE-server for data exchange with Microsoft Windows applications FLOWB32.DLL : Dynamic Link Library for Microsoft Windows applications RS232 interface : Protocol description for instructions with ASCII or Binary HEX telegrams Each parameter has its own properties, like data-type, size, reading/writing allowance, security. In general: all parameters used for operation of instruments are free to be used by end-users. (eg.: measure, setpoint, control mode, slope, fluid number, alarm and counter) all parameter for settings of instruments are meant for BHT-service personnel only. (eg.: calibration settings, controller settings, identification, network/fieldbus settings) Parameters for settings are secured. They can be read-out, but can not be changed without knowledge of special key-parameters and knowledge of the instrument. FLOWDDE parameter numbers: Reading/changing parameter values via FLOWDDE offers the user a different interface to the instrument. Besides the application name: ‘FLOWDDE’ there is only need of: topic, used for channel number: ‘C(X)’ item, used for parameter number: ‘P(Y)’ A DDE-parameter number is a unique number in a special FLOWDDE instruments/parameter database and not the same as the parameter number from the process on an instrument. Node-address and process number will be translated by FLOWDDE to a channel number. When not using FLOWDDE for communication with FLOW-BUS, each parameter value needs: node-address of instrument on FLOW-BUS process number on instrument parameter number on instrument All parameter information needed can be found in the parameter table(s) of FLOWDDE.MDB.

Page 333: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 11 9.17.023

Following paragraphs will give short descriptions of how to use parameters for operation. For a more complete description of the parameters the document “917030 FLOWPLOT” can be used. The second line after the parameter name gives some additional information about the parameter. An explanation of the line is: Valve output [unsigned long, RW, secured, 0…16777215, DDEpar. = 55, Proces/par. = 114/1] unsigned long = one of the datatypes below.

Unsigned char 1 byte Unsigned int 2 bytes, MSB first Unsigned long 4 bytes, MSB first Float 4 bytes IEEE 32-bit single precision numbers, MSB first Unsigned char [] array of characters (string)

RW = R - parameter can be read, W – parameter can be written. Secured = Parameter is secured. If omitted parameter is not secured. 0…16777215 = Parameter range. DDEpar. = 55 = FlowDDE parameter number Process/par. = 114/1 = Process number / process parameter number Another example is: Fluidname [unsigned char[10], RW,secured,a...Z, 0...9, DDEpar. = 25, Proces/par. = 1/17] unsigned char[10] = Datatype Unsigned char[], array of characters. [10] = number of characters. RW = R - parameter can be read, W – parameter can be written. Secured = Parameter is secured. If omitted parameter is not secured. a...Z = characters which can be used in the string 0...9 = numbers which can be used in the string DDEpar. = 25 = FlowDDE parameter number Process/par. = 1/17 = Process number / process parameter number

Page 334: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 12 9.17.023

Normal operation parameters

2.1 Measured value (measure) [unsigned int, R ,0...41942, DDEpar. = 8, Proces/par. = 1/0] Depending on the type of instrument, measured value indicates the amount of mass flow or pressure metered by the instrument. Sensor signals at digital instruments will be digitized at the sensor bridge by means of highly accurate AD-converters, using at least 16 bits. Digitized signals will be internally processed by the microcontroller using floating point notation. The sensor signal will be differentiated, linearized and filtered. At the digital output measured values will be presented as an unsigned integer in the range of 0...65535. For Unipolair mode the signal of 0...100% will be presented in a range of 0...32000. For the instruments, maximum signal to be expected is 131.07 %, which is: 41942. 0 32000 41942 65535

Not used 0% 100% 130.07% For Bipolair mode the signal of 0...100% will be presented in a range of 0...32000. Maximum signal is 131.07 %, which is: 41942, minimum signal is -73.73 %, which is 41943 0 32000 41942 41943 65535

0% 100% 130.07% -73.73% -0.003%

2.2 Setpoint [unsigned int, RW,0...32000, DDEpar. = 9, Proces/par. = 1/1] Setpoint is used to tell the controller of an instrument what the wanted amount of mass flow or pressure is. Signals are in the same range as the measured value, only setpoint is limited between 0 and 100 %. Setpoint can be given either via optional fieldbus or RS232 or via analog interface. Parameter control mode selects the active setpoint for the controller. See that paragraph for more detailed information.

2.3 Setpoint slope [unsigned int, RW,0...30000, DDEpar. = 10, Proces/par. = 1/2] Digital instruments can establish a smooth setpoint control using the setpoint slope time. The setpoint will be linear increased in time from old setpoint to new setpoint value. A value between 0 and 3000 seconds, with a resolution of 0.1 seconds, can be given to set the time for the integrator on the setpoint signal. Setpoint will reach its endvalue after

=⋅−slope

100oldspnewsp

seconds

Example; When slope = 10 seconds how long will it take to go from 20% to 80%?

610100

2080 =⋅− seconds

2.4 Analog input [unsigned int, R ,0...65535, DDEpar. = 11, Proces/par. = 1/3] Depending on the parameter value of analog mode, this signal converts either 0..5Vdc / 0..10Vdc / 0..20mA / 4..20mA. Analog input signals (digitized) are in the same range as measured values (0...32000 = 0...100%). This input can be used to give setpoint or slave factor, depending on the value of control mode.

Page 335: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 13 9.17.023

2.5 Setpoint/control modes [unsigned char, RW,0...255, DDEpar. = 12, Proces/par. = 1/4] For switching between different functions in use of a digital meter or controller several modes are available. Output signals (sensor signal) on both analog and fieldbus interface are available at the same time. Table 1: Overview setpoint/control modes Nr Mode Instrument action Setpoint source Master source Slave factor

source 0 BUS/RS232 Controlling BUS/RS232 1 external input Controlling analog input 2 FLOW-BUS/

RS232 slave controlling as slave from other instrument on bus

Master/slave process

FLOW-BUS FLOW-BUS/ RS232

3 valve close close valve 4 controller idle stand-by on

BUS/RS232

5 test mode testing enabled (BHT only)

6 tuning mode tuning enabled (BHT only)

7 setpoint 100% controlling on 100% 100% 8 valve purge purge valve 9 calibration mode calibration enabled

(BHT only)

10 ext input slave controlling as slave from other instrument on analog input

Master/slave process

analog input FLOW-BUS/ RS232

12 setpoint 0% controlling on 0% 0% 13 FLOW-BUS

slave external input

controlling as slave from other instrument on bus, slavefactor is set with signal on analog input

Master/slave process

FLOW-BUS analog input

18 RS232 Controlling RS232 note: analog input= external input= pin 3 on DB 9 connector.

BUS = any available fieldbus

2.5.1 Dual interface operation When operating a controller (reading measured value and sending setpoint) for proper operation it is important that the controller gets its setpoint from the right source. Setpoints may come from different sources: analog input, fieldbus interface or RS232 or may be overruled by close valve or open valve (purge) commands. Therefore it is important to know what is the setpoint source of the controller. This can be set by means of parameter controlmode (parameter 12). In some cases it is possible that the setpoints may come from 2 sources at the same time. The last send setpoint will be valid and send to the controller. This is the case in controlmode = 0, when setpoints may come through any fieldbus interface or RS232. However, there could be situations where control over the instrument seems impossible. This is the case when the instrument comes into a safe-state e.g. when fieldbus communication is disturbed or disconnected. Valve will be forced to a safe state automatically: closed (NC) or fully open (NO). In case you want to get control back via RS232 operation, you have to change the controlmode. When controlmode gets value 18, safe state will be overruled and sending setpoints via RS232 interface will have effect on the controller again.

Page 336: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 14 9.17.023

2.5.2 Master/slave (ratio) control In master/slave or ratio control the setpoint of an instrument is related to the output signal of another instrument. Setpoint (slave) = Output signal (master) * slave factor/100% Digital instruments offer possibilities for master/slave control via the FLOW-BUS. The output value of any instrument connected to the FLOW-BUS is automatically available to all other instruments (without extra wiring). When master/slave control is wanted the instrument can be put in control mode 2 or 13, depending on how the slave factor should be set (see table above). Through FLOW-BUS an instrument can be told that it should be a slave, who should be its master and what should be the slave factor to follow the master with. It is possible to have more masters and more slaves in one system. A slave can also be a master itself for other instruments. Notes: These options are available for FLOW-BUS or RS232 instruments only. Output signals from master can be received via FLOW-BUS only. Slave factors can also be changed via RS232. Master/slave is ment here for controlling purposes and has nothing to do with master and slave behaviour on fieldbus networks.

2.5.3 Tuning, test and calibration These are special modes to prepare the instrument for either a tuning, test or calibration action. These modes are used by Bronkhorst High-Tech service personnel only and are not meant for customer use. Putting the instrument in this mode, will disable normal control. The instrument will wait until: 1. Control mode will change again. 2. Instrument receives command (secured parameter) via bus which item should be tuned, tested or

calibrated. When ready perfoming the wanted action the instrument will return to its previous control mode again.

2.6 Fluid number [unsigned char, RW,0...7, DDEpar. = 24, Proces/par. = 1/16] Fluid number is a pointer to the set of calibration parameters. For each fluid (gas or liquid) several parameters get values in order to store the calibration for a specific fluid. This increases accuracy. Fluid number is an unsigned char parameter (ucFluidnr) in a range of 0...7, where 0 = fluid1 and 7=fluid8. Up to 8 fluids can be stored in one instrument. Default value = 0 (fluid 1).

2.7 Fluid name [unsigned char[10], RW,secured,a...Z, 0...9, DDEpar. = 25, Proces/par. = 1/17] Fluid name consists of the name of the fluid of the actual selected fluidnumber. Up to 10 characters are available for storage of this name. Parameter is secured and read-only for normal users. During calibration of the instrument this parameter will get its value. Default value is “Air”.

Page 337: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 15 9.17.023

2.8 Valve output [unsigned long, RW,secured,0...16777215, DDEpar. = 55, Proces/par. = 114/1] This parameter is the signal coming out of the controller, going to the DAC for driving the valve. 0...16777215 corresponds with approximately 0...265mAdc for a 60 Ohm .valve coil. Maximum output voltage is approximately 14V.

2.9 Temperature [float, RW,,-250..500, DDEpar. = 142, Proces/par. = 33/7] This parameter shows the temperature of the tubes in the Cori-Flow. It is not used in other instruments.

Page 338: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 16 9.17.023

3 DIRECT READING PARAMETERS

3.1 Sensor type [unsigned char, RW,secured,0...4, DDEpar. = 22, Proces/par. = 1/14] Unsigned char used to select proper set of units for certain sensor, together with Counter unit. Default settings is 3.

Value Description Controller/Sensor 0 pressure ( no counting allowed) 1 liquid volume 2 liquid/gas mass 3 gas volume 4 other sensor type (no counting allowed)

Controller

128 pressure ( no counting allowed) 129 liquid volume 130 liquid/gas mass 131 gas volume 132 other sensor type (no counting allowed)

Sensor

3.2 Capacity (100%) [float, RW,secured,1E-10...1E+10, DDEpar. = 21, Proces/par. = 1/13] Capacity is the maximum value (span) at 100% for direct reading in sensor base units. The base unit will be determined by ‘sensor type’. For each fluid(number) capacity will be stored seperately.

3.3 Capacity 0% [float, RW,secured,-1E-10...1E+10, DDEpar. = 183, Proces/par. = 33/22] This is the capacity zero point (offset) for direct reading in sensor base units. The base unit will be determined by ‘sensor type’. This capacity 0% is the same for all stored fluid(number)s.

3.4 Fmeasure [float,R, 1E-10...1E+10, DDEpar. = 205, Proces/par. = 33/0] Floating point version of variable measure (see 2.1). The user will read-out the measured value in the capacity and capacity unit for which the instrument has been calibrated. These settings depend on variables: capacity, capunit, sensortype and capacity0%. Fmeasure is a read-only float on (FLOW-BUS) proc 33, par 0. Value is calculated as follows: proc33,par0 proc1,par 0 proc1,par13 proc33,par 22 proc33,par22

fmeasure = ((measure/32000)*(capacity-capacity0%)) + capacity0% The value is in units as described in parameter capunitstr (proc 1, par 31).

Page 339: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 17 9.17.023

3.5 Fsetpoint [float,RW, 1E-10...1E+10, DDEpar. = 206, Proces/par. = 33/3] With the use of parameter fmeasure, also fsetpoint is often needed. This parameter is R/W as variable in FLOW-BUS proc33, par3. Setpoint can be operated via 2 parameters at the same time. One parameter is setpoint (see 2.1), a short integer. The other one is fsetpoint, a float (in the capacity in which the instrument was calibrated (see also fmeasure). Last received setpoint by the instrument will be valid. It is not advised to use setpoint and fsetpoint at the same time. Choose either one or the other. Relation between setpoint and fsetpoint is calculated as follows: proc1,par1 proc33,par3 proc33,par22 proc1,par13 proc33,par22 setpoint = ((fsetpoint – capacity0% ) / (capacity - capacity0%)) * 32000 Note: Reading back actual values of fsetpoint is also possible. When a value has been send to proc1, par1 (integer setpoint), then this will be converted to the float setpoint for direct reading in the right capacity and unit.

3.6 Capunit [unsigned char, RW,secured,0...9, DDEpar. = 23, Proces/par. = 1/15] Capacity unit is a pointer to select an actual readout unit (see list below). For FLOW-BUS instruments all capacity units are available for direct reading. Other fieldbusses (eg. DeviceNet) are limited in options for direct reading facilities. Overview of capacity-unit strings in digital instruments and E-7000 for analog instruments: capunit

Sensor Type

0 1 2 3 4 5 6 7 8 9

0 bar mbar psi kPa cmH2O cmHg atm kgf/cm2 unused unused 1 l/min ml/h ml/min l/h mm3/s cm3/min unused unused unused unused 2 kg/h kg/min kg/s g/h g/min g/s mg/h mg/min mg/s unused 3 ln/min mln/h mln/min ln/h m3n/h mls/min mls/h ls/min ls/h m3s/h 4 usrtype usrtype usrtype unused Unused unused unused unused unused unused 5 °C °F K unused Unused unused unused unused unused unused 6 hour minute seconds unused Unused unused unused unused unused unused 7 kHz Hz rpm unused Unused unused unused unused unused unused 8 kg g mg ug Unused unused` unused unused unused unused 9 g/l kg/l g/m3 kg/m3 Unused unused unused unused unused unused

name description sensortype Indicator for type of sensor in instrument in relation with a list of units for direct

reading capunit Points to wanted capacity unit for direct reading in list of available units Example: If you want to readout your instrument in ln/min, then make sure parameter ‘sensortype’ has value 3 and parameter ‘capunit’ has value 0. By means of parameter ‘capunitstr’ the unit string can read-back as a 7 character string.

3.7 Capacity unit string [unsigned char[7], RW,secured, DDEpar. = 129, Proces/par. = 1/31] Parameter ‘capunitstr’ consisting of 7 characters (string) with selected unit out of table. Can only be written when sensortype = 4: usertype, userunit string of 7 chars can be send.

Page 340: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 18 9.17.023

4 IDENTIFICATION PARAMETERS

4.1 Serialnumber [unsigned char[20], RW,secured, DDEpar. = 92, Proces/par. = 113/3] This parameter consists of a maximum 20-byte string with instrument serial number for identification. Example: “M0202123A”

4.2 Modelnumber [unsigned char[14], RW,secured, DDEpar. = 91, Proces/par. = 113/2] Bronkhorst High-Tech instrument model number information string.

4.3 Firmware version [unsigned char[5], R, DDEpar. = 105, Proces/par. = 113/5] Revision number of firmware. Eg. “V6.01”

4.4 Usertag [unsigned char[13], RW,secured, DDEpar. = 115, Proces/par. = 113/6] User definable alias string. Maximum 13 characters allow the user to give the instrument his own tagname. It is advised here to limit the name up to 7 characters when using E-7000 readout and control modules. These modules can display the tagname of an instrument only up to 7 characters. Eg.: “Room1s6”

4.5 Manufacturer config [unsigned char[16], RW,secured, DDEpar. = 93, Proces/par. = 113/4] Digital instrument manufacturing configuration information string. This string can be used by Bronkhorst High-Tech to add extra information to the model number information.

Page 341: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 19 9.17.023

4.6 Identnumber [unsigned char, RW,secured,0...255, DDEpar. = 175, Proces/par. = 113/12] Bronkhorst High-Tech (digital) device/instrument identification number (pointer). See list below:

Value Description 1 RS232/FLOW-BUS interface 2 PC(ISA) interface 3 ADDA4 (4 channels) 4 R/C-module, 32 channels 5 T/A-module 6 ADDA1: 1 channel ADDA converter module 7 DMFC: digital mass flow controller 8 DMFM: digital mass flow meter 9 DEPC: digital electronic pressure controller

10 DEPM: digital electronic pressure meter 11 ACT: single actuator 12 DLFC: digital liquid flow controller 13 DLFM: digital liquid flow meter 14 DSCM-A: digital single channel module for analog instruments 15 DSCM-D: digital single channel module for digital instr. 16 FRM: FLOW-BUS rotor meter (calibration-instrument) 17 FTM: FLOW-BUS turbine meter (calibration-instrument) 18 FPP: FLOW-BUS piston prover/tube (calibration-instrument) 19 F/A-module: special version of T/A-module 20 DSCM-E: evaporator controller module (single channel) 21 DSCM-C: digital single channel module for calibrators 22 DDCM-A: digital dual channel module for analog instruments 23 DMCM-D: digital multi channel module for digital instruments 24 PRODPS: FLOW-BUS/PROFIBUS DP-slave interface 25 FCM: FLOW-BUS Coriolis meter 26 FBI: FLOW-BUS Balance Interface 27 CoriFC: Cori-Flow Controller 28 CoriFM: Cori-Flow Meter

4.7 Device type [unsigned char[6], R, DDEpar. = 90, Proces/par. = 113/1] Devicetype information string: String value in max. 6 chars of descriptions in table above.

Page 342: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 20 9.17.023

5 ALARM/STATUS PARAMETERS

5.1 Alarminfo [unsigned char, R,0...255, DDEpar. = 28, Proces/par. = 1/20] This parameter contains 8 bits with status information about some (alarm) events in the instrument.

Bit Meaning 0 0 – no error, 1 – Error message in alarm error status register 1 0 – no error, 1 – Warning message in alarm warning status register 2 0 – no error, 1 – Minimum alarm (sensor signal < minimum limit) 3 0 – no error, 1 – Maximum alarm (sensor signal > maximum limit) 4 0 – no error, 1 – Batch counter has reached its limit 5 0 – no error, 1 – This bit only: Power-up alarm (probably power dip occurred)

Together wit bit 2 or bit 3: Response alarm message (setpoint-measure too much difference) (bit 2 or bit 3 indicate if difference is positive or negative)

6 0 – no error, 1 – Master/slave alarm: master output signal not received or slave factor out of limits (> 100%)

7 0 – no error, 1 – Hardware alarm: check hardware

5.2 Status [unsigned char, R,,0...255] This parameter is a special byte for monitoring communication between converter and instruments (via FLOW-BUS). It contains 8 bits with information about certain (alarm) events. This parameter is unlike the other parameters not a PROPAR parameter and can not be read via FLOW-BUS but only via PROFIBUS.

Bit Meaning 0 0 - no error in communication with channel, 1 - error in communication 1 0 - no PROPAR process error, 1 - a PROPAR process error has occurred 2 0 - no PROPAR parameter error, 1 - a PROPAR parameter error has occurred 3 0 - no PROPAR type error, 1 - a PROPAR type error has occurred 4 0 - no PROPAR value error, 1 - a PROPAR value error has occurred 5 0 - no error, 1 - a PROPAR process claim or command error has occurred 6 Reserved 7 Reserved

5.3 Alarm mode [unsigned char, RW,secured,0...3, DDEpar. = 118, Proces/par. = 97/3] Available alarm modes for device:

Value Description 0 Off 1 alarm on absolute limits 2 alarm on limits related to setpoint (response alarm) 3 alarm when instrument powers-up (eg. after power-down)

Note: Not all modes are available for all fieldbusses. Eg. For DeviceNet only mode 0 and 1 are available.

Page 343: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 21 9.17.023

5.4 Alarm maximum limit [unsigned int, RW,secured,0...32000, DDEpar. = 116, Proces/par. = 97/1] Maximum limit for sensor signal to trigger alarm situation (after delay time). Note: Minimum limit ≤ Maximum limit ≤ 100 %

5.5 Alarm minimum limit [unsigned int, RW,secured,0...32000, DDEpar. = 117, Proces/par. = 97/2] Minimum limit for sensor signal to trigger alarm situation (after delay time). Note: 0 % ≤ Minimum limit ≤ Maximum limit

5.6 Alarm output mode [unsigned char, RW,secured,0...2, DDEpar. = 119, Proces/par. = 97/4] Available alarm output modes for device:

Value Description 0 no relais/TTL-output activity at alarm 1 relais/TTL-output pulses until reset 2 relais/TTL-output activated until reset

5.7 Alarm setpoint mode [unsigned char, RW,secured,0...1, DDEpar. = 120, Proces/par. = 97/5] Available alarm setpoint modes for device:

Value Description 0 no setpoint change at alarm 1 new/safe setpoint at alarm enabled (set at alarm new setpoint)

5.8 Alarm new setpoint [unsigned int, RW,secured,0...32000, DDEpar. = 121, Proces/par. = 97/6] New/safe setpoint during alarm situation until reset.

5.9 Alarm delay time [unsigned char, RW,secured,0...255, DDEpar. = 182, Proces/par. = 97/7] Time in seconds alarm action will be delayed when alarm limit has been exceeded. Also time in seconds automatic reset will be delayed when sensor signal reaches safe level again.

Page 344: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 22 9.17.023

5.10 Reset alarm enable [unsigned char, RW,secured,0...15, DDEpar. = 69, Proces/par. = 115/4] Available alarm reset options:

Value Description 0 no reset possible 1 reset: keyboard/micro-switch 2 reset: external 3 reset: keyboard/micro-switch or external 4 reset: BUS/RS232 5 reset: BUS/RS232 or keyboard/micro-switch 6 reset: BUS/RS232 or external 7 reset: BUS/RS232 or keyboard/micro-switch or external 8 reset: automatic 9 reset: automatic or keyboard/micro-switch

10 reset: automatic or external 11 reset: automatic or keyboard/micro-switch or external 12 reset: automatic or BUS/RS232 13 reset: automatic or BUS/RS232 or keyboard/micro-switch 14 reset: automatic or BUS/RS232 or external 15 reset: automatic or BUS/RS232 or keyboard/micro-switch or external

5.11 Using an alarm (examples) Using the alarms will take three steps: 1. Preparing the instrument (setting correct values for mode, limits etc.) 2. Monitoring the alarm info byte (gives info which alarm has occurred) 3. Resetting the alarm (will re-initialize the alarm and set output to normal values again) All settings needed are secured parameters. These parameters can only be changed if a key-parameter (‘init/reset’) value has been send first to get the instrument in a soft-init mode. It will stay in this mode until a new power-up situation. Using maximum and minimum alarm This alarm will check if the measured signal crosses the maximum or minimum limit set by the user. Example: Setting maximum alarm on 90 %. Setting minimum alarm on 10 %. Relay/TTL output should be on off. No new setpoint wanted at crossing alarm limit. Delay on action at output should be 10 seconds. Reset should be automatically, when signal comes into safe area again or via FLOW-BUS. Through DDE links send following parameter values:

Parameter Value init/reset 64 alarm maximum limit 28800 alarm minimum limit 3200 alarm output mode 0 alarm setpoint mode 0 alarm reset enable * 12 alarm delay time 10 alarm mode 1

*) Default all reset inputs are enabled, so this command isn’t really necessary

Page 345: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 23 9.17.023

Now the alarm will be active. Alarm status can be monitored by means of parameter alarminfo. Resetting the alarm will need the following command reset = 0 and then reset=2. To inactivate the alarm, put it in alarm mode “off”. This will also reset your outputs. This can be done sending command: alarm mode = 0. Using instrument with response alarm. This alarm will check if the measured value will come within an area limited by maximum limit and minimum limit, related to the setpoint, within a certain delay-time. Example: Setting maximum alarm limit on setpoint + 3 % . Setting minimum alarm limit on setpoint – 0.9 %. Relay/TTL output should not be used. Setpoint wanted at crossing alarm limit = 0 %. Delay on action at output should be 2 minutes. Reset via keyboard or BUS/RS232. Send following parameter values:

Parameter Value init/reset 64 alarm maximum limit 960 alarm minimum limit 288 alarm output mode 0 alarm setpoint mode 1 alarm new setpoint 0 alarm reset enable * 5 alarm delay time 120 alarm mode 2

*) Default all reset inputs are enabled, so this command isn’t really necessary Now the alarm will be active. Alarm status can be monitored by means of parameter alarminfo. Resetting the alarm will need following command: reset = 2. To inactivate the alarm, put it in alarm mode “off”. This will also reset your outputs. This can be done sending command: alarm mode = 0.

Page 346: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 24 9.17.023

6 COUNTER PARAMETERS

6.1 Counter value [float, RW,secured,0...10000000, DDEpar. = 122, Proces/par. = 104/1] Actual counter value in units selected at Counter unit. Value is a float in IEEE 32-bits single precision notation.

6.2 Counter mode [unsigned char, RW,secured,0...2, DDEpar. = 130, Proces/par. = 104/8] Available counter modes for device:

Value Description 0 Off 1 counting upwards continuously 2 counting up to limit (batchcounter)

Default value = 0.

6.3 Counter setpoint mode [unsigned char, RW,secured,0...1, DDEpar. = 126, Proces/par. = 104/5] Setpoint change enable during counter limit/batch situation (until reset). Default = 0.

Value Description 0 no setpoint change at batch limit allowed 1 setpoint change at batch limit allowed

6.4 Counter new setpoint [unsigned int, RW,secured,0...32000, DDEpar. = 127, Proces/par. = 104/6] New/safe setpoint at counter limit/batch situation (until reset). See measure for range. Normally this value is set to 0%.

6.5 Counter limit [float, RW,secured,0...10000000, DDEpar. = 124, Proces/par. = 104/3] Counter limit/batch. in units selected at Counter unit. Value is a float in IEEE 32-bits single precision notation. Default setting is 1000000 ln.

6.6 Counter output mode [unsigned char, RW,secured,0...2, DDEpar. = 125, Proces/par. = 104/4] Parameter to determine counter relais/TTL-output activity mode when limit/batch has been reached. Default setting is 0.

Value Description 0 no relais/TTL-output activity at batch limit 1 relais/TTL-output pulses after reaching batch limit until reset 2 relais/TTL-output activated after reaching batch limit until reset

Page 347: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 25 9.17.023

6.7 Counter unit [unsigned char, RW,secured,0...13, DDEpar. = 123, Proces/par. = 104/2] Parameter used to select a unit from for certain sensor type (pointer to a unit). Default setting is 0: ‘ln’ (for sensor type 3).

Sensor type

0 1 2 3 4 5 6 7 8 9 10 11 12 13

0 n.a. n.a. n.a. n.a. n.a. n.a. n.a. n.a. n.a. n.a. n.a. n.a. n.a. n.a. 1 l mm3 ml cm3 ul m3 n.a. n.a. n.a. n.a. n.a. n.a. n.a. n.a. 2 g mg ug kg n.a. n.a. n.a. n.a. n.a. n.a. n.a. n.a. n.a. n.a. 3 ln mm3n mln cm3n uln dm3n m3n Uls mm3s mls cm3s ls dm3s m3s 4 and > n.a. n.a. n.a. n.a. n.a. n.a. n.a. n.a. n.a. n.a. n.a. n.a. n.a. n.a.

6.8 Counter unit string [unsigned char[4], R, DDEpar. = 128, Proces/par. = 104/7] Parameter ‘CntrUntstr’ consisting of 4 characters (string) with selected unit out of table. Read-only parameter.

6.9 Using a counter (example) Using the counter will take three steps: 1. Preparing the instrument (setting correct values for mode, limit etc.) 2. Monitoring the alarm info byte (gives info which alarm has occurred) 3. Resetting the counter (will re-initialize the counter and set output to normal values again) All settings needed are secured parameters. These parameters can only be changed if a key-parameter (‘init/reset’) value has been send first to get the instrument in a soft-init mode. It will stay in this mode until a new power-up situation. Using a batch counter The measured signal will be integrated in time and there will be a check on a certain limit set by the user. Example: You have an instrument with a range of 1 ln/min. Setting the batch to be reached on 1000 ln. Relay/TTL output should do nothing. New setpoint wanted at reaching the limit is 0% (valve should be closed). Reset should be enabled via BUS/RS232 or by means of keyboard/micro-switch. Through DDE links send following parameter values:

Parameter Value init/reset 64 counter limit 1000.0 counter output mode 0 counter setpoint mode 1 counter new setpoint 0 counter reset enable * 5 counter mode 2

*) Default all reset inputs are enabled, so this command isn’t really necessary Now the counter will be active. Alarm/counter status can be monitored by means of parameter alarminfo. Resetting the counter will need following command: reset = 1. To inactivate the counter, put it in counter mode “off”. This will also reset your outputs. This can be done sending command: counter mode = 0.

Page 348: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 26 9.17.023

7 SPECIAL PARAMETERS

7.1 Reset [unsigned char, W,secured,0...5, DDEpar. = 114, Proces/par. = 115/8] Parameter to reset program, counter or alarms. Default value = 0.

Value Description 0 no reset 1 reset counter value (no mode change) or common reset 2 reset alarm 3 restart batch counter 4 reset counter value (counter off) 5 Reset module (soft reset)

Note: To make sure the parameter is accepted send a 0 first.

7.2 Init/reset (key-parameter) [unsigned char, RW,0...255, DDEpar. = 7, Proces/par. = 0/10] Init and reset security key command for network/parameter settings. Make 64 to enable changing of secured parameters. Make 0 again to reset. Default setting is 82. Note: when an instrument powers-up this value will be reset to 82 always automatically.

7.3 Wink [unsigned char, W,0...9, DDEpar. = 1, Proces/par. = 0/0] Unsigned char in range 0...9 enables master to let the instrument connected to that channel wink for several seconds for tracing the physical location. Type of winking depends on instrument. This will be either with red and green LED turn-by-turn or with special characters on an LCD. Default setting = 0.

Page 349: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 27 9.17.023

8 CONTROLLER PARAMETERS

8.1 Controller The controlling algorithm for the valve handled by the micro-controller consists of several parameters which can be set via the BUS/RS232. Although many parameters could be accessed via BUS/RS232, Bronkhorst High-Tech advises not to change these parameters because during manufacturing they have got optimal values for their purposes. Controller parameters are classified as setting parameters. Changing of controller settings should be performed by or under supervision from trained service personnel only. Main parameter settings for controller adjustment are listed below:

8.2 RespOpen0 [unsigned char, RW,secured,0...255, DDEpar. = 165, Proces/par. = 114/18] Controller response when starting-up from 0% (when valve opens). Value 128 is default and means: no correction. Otherwise controller speed will be adjusted as follows: (128-RespOpen0) New response = old response * 1.05

8.3 ContrResp [unsigned char, RW, secured,0...255, DDEpar. = 72, Proces/par. = 114/5] Controller response during normal control (at setpoint step) (128-ContrResp) New response = old response * 1.05

8.4 RespStable [unsigned char, RW, secured,0...255, DDEpar. = 141, Proces/par. = 114/17] Controller response when controller is stable (within band of 2 %) (128-RespStable) New response = old response * 1.05

8.5 PIDKp [float, RW, secured,0...1E+10, DDEpar. = 167, Proces/par. = 114/21] PID controller response, proportional action, multiplication factor.

8.6 PIDTi [float, RW, secured,0...1E+10, DDEpar. = 168, Proces/par. = 114/22] PID controller response, integration action in seconds.

8.7 PIDTd [float, RW, secured,0...1E+10, DDEpar. = 169, Proces/par. = 114/23] PID controller response, differentiation action in seconds.

Page 350: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 28 9.17.023

8.8 TdsUp [float, RW, secured,0...1E+10, DDEpar. = 51, Proces/par. = 1/12] Sensor signal differentiation time in seconds needed to speed-up sensor signals going upwards.

8.9 TdsDn [float, RW, secured,0...1E+10, DDEpar. = 50, Proces/par. = 1/11] Sensor signal differentiation time in seconds needed to speed-up sensor signals going downwards.

8.10 ExpSmooCon [float, RW, secured,0...1, DDEpar. = 74, Proces/par. = 117/4] This factor is used for filtering the signal coming from the sensor circuitry before it is further processed. It filter according the following formula: out = in * ExpSmooCon + (1 - ExpSmooCon) * out For El-flow types of instruments it will be the “slow” (not differentiated), non-linearized sensor signal. Only in case of much noise on the sensor this value will have another value than 1.0. Advise: do not give a value much lower than 0.8, otherwise it would slow down sensor response too much. Best setting here: 1.0. For CoriFlow instruments it will influence the amount of averaging of the “bare” values. The smaller this value gets, the slower a CoriFlow instrument will get a sensor signal, but less noise will be on the signal.

Response Factor setting Slow 0.05 Normal 0.1 Fast 0.2 Very fast 0.5...1.0 (not advised)

This filter is in the control loop so it affects the response time.

8.11 ExpSmooAd [float, RW, secured,0...1, DDEpar. = 222, Proces/par. = 117/5] This parameter is used in combination with the ExpSmooCon. It changes the rate of filtering for the exponential filter depending on the change of the measuring value. So it is adapting to the measuring input. If a step is seen on the measuring signal the exponential filter is decreased so a fast response is possible. If only noise is seen the exponential filter is increased to its set value to suppress noise. Possible values:

0.0 -> Exponential Smoothing filter behaves as an standard exponential smoothing filter. 1.0 -> Exponential Smoothing filter behaves as an adaptive exponential smoothing filter

Page 351: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 29 9.17.023

9 SPECIAL INSTRUMENT FEATURES

9.1 Zero (mass flow instruments only) The zero procedure is able to remove zero offset signals on the sensor signal automatically. This automatic procedure can be started through the BUS/RS232 or by means of the micro-switch on top of the instrument.

9.1.1 Zeroing with the Micro-switch • Set process conditions

Warm-up, pressure up the system and fill the instrument according to the process conditions. • Stop flow

Make sure no flow is going through the instrument by closing valves near the instrument. • Press and hold, Until

With no flow, use the push-button switch (#) on the outside of the instrument to start the zero adjustment procedure. Press the push-button (#) and hold it, after a short time the red LED will go ON and OFF then the green LED will go ON. At that moment release the push-button (#).

• Zeroing The zeroing procedure will start at that moment and the green LED will blink fast. The zeroing procedure waits for a stable signal and saves the zero. If the signal is not stable zeroing will take long and the nearest point to zero is accepted. The procedure will take approx. 10 sec. So make always sure that there is going no flow through the instrument when performing the zeroing procedure.

• Ready When indication is showing 0% signal and the green indication LED is burning continuously again, then zero has been performed well.

9.1.2 Zeroing with digital communication The following parameters must be used for zeroing an instrument:

Initreset [unsigned char, RW,0...255, DDEpar. = 7, Proces/par. = 0/10] Cntrlmode [unsigned char, RW,0...255, DDEpar. = 12, Proces/par. = 1/4]

CalMode [unsigned char, RW,0...255, DDEpar. = 58, Proces/par. = 115/1] • Set process conditions

Warm-up, pressure up the system and fill the instrument according to the process conditions. • Stop flow

Make sure no flow is going through the instrument by closing valves near the instrument. • Send parameters

Send the following values to the parameters in this sequence. Initreset 64

Cntrlmode 9 Calmode 255 Calmode 0 Calmode 9 • Zeroing

The zeroing procedure will start at that moment and the green LED will blink fast. The zeroing procedure waits for a stable signal and saves the zero. If the signal is not stable zeroing will take long and the nearest point to zero is accepted. The procedure will take approx. 10 sec. So make always sure that there is going no flow through the instrument when performing the zeroing procedure.

• Ready When indication is showing 0% signal and the green indication LED is burning continuously again, then zero has been performed well. Also parameter Cntrlmode goes back to zero.

As last send 0 to parameter Initreset. This action will be performed already during production at Bronkhorst High-Tech, but may be repeated at wish on site (For Cori-Flow always perform a zero on site).

Page 352: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 30 9.17.023

9.2 Restore parameter settings All parameter value settings in the instruments are stored in non-volatile memory so each time at power-up these settings are known. However, several settings can be changed afterwards in the field by a user if needed. Sometimes it may be necessary to get back all original settings. Therefore a backup of all settings at production final-test will be stored in non-volatile memory also. Because of this it will be possible to restore these original factory settings at any moment. Of course this will only function as long as there is no memory failure. Restoring original factory settings can be achieved by means of the micro-switch on top of the instrument or through a command via BUS/RS232. See instructions for manual operation with switch and LED’s for details.

Page 353: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 31 9.17.023

10 MANUAL INTERFACE: micro-switch and LED’s

10.1 General The micro-switch on top of the digital instrument can be used to start a certain function at the instrument. When the switch is pressed down, both LED’s will start indicating different patterns in a loop. The switch has to be pressed down until the 2 LED’s are indicating the right pattern. Then the switch has to be released and the choice has been made. Normally (when the switch is not pressed) the green and red LED are used for mode indication on digital instruments (FLOW-BUS / PROFIBUS-DP / DeviceNet). (see table 1 and 2). When the switch is pressed-down both LED’s will be switched-off for function selection. As long as the switch will be pressed-down, there will be a change in indication by the 2 LED’s after each 4 seconds. The moment the user recognizes the indication (LED-pattern) for the function he wants, he must release the switch. Now he has triggered the wanted function. In table 3 is described what the indications are for the function to be performed at normal situation. This is when the switch will be pressed-down during normal operation of the instrument. In table 4 is described what the indications are for the functions to be performed at power-up situation of an instrument. This can be realized by pressing the switch first and while pressing, connecting the power. These actions have a more ‘initializing’ character for the instrument. In paragraph 10.2 is described how bus-address and baudrate can be set for an instrument. Using this 1 switch and 2 LED’s this way, offers the user a maximum of possibilities, even if this instrument is only operated by an analog interface.

Page 354: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 32 9.17.023

Table 1: Green LED indication modes for digital instrument (no switch used)

Green LED Time Indication off Continuously Power-off or program not running on Continuously Normal running/operation mode

Special mode, see specific fieldbus for more details FLOW-BUS PROFIBUS-DP DeviceNet

short flash 0.1 sec on, 2 sec off

Initialization mode Secured params can be changed/ Remote install to FLOW-BUS

Initialization mode Secured params can be changed

Abort state or Initialization mode Secured params can be changed

normal flash 0.2 sec on, 0.2 sec off Special function mode Instrument is busy performing any special function. E.g. auto-zero or self-test Special mode, see specific fieldbus for more details FLOW-BUS PROFIBUS-DP DeviceNet

long flash 2 sec on, 0.1 sec off

not used not used Idle state slow wink 0.2 sec on, 0.2 sec off Wink mode

By a command send via FLOW-BUS the instrument can “wink” with LED’s to indicate its position in a (large) system

normal wink 1 sec on, 1 sec off Alarm indication: minimum alarm, limit/maximum alarm; power-up alarm or limit exceeded or batch reached.

fast wink 0.1 sec on, 0.1 sec off Switch-released, selected action started Note: wink = green-red-green-red turn-by-turn Table 2: Red LED indication modes for digital instrument (no switch used)

Red LED Time Indication off Continuously No error

Bus communication warning. Instrument functions o.k. See specific fieldbus for more details.

FLOW-BUS PROFIBUS-DP DeviceNet

short flash 0.1 sec on, 2 sec off

Node occupied: Re-install instrument

No data-exchange between master and slave Automatic recovery

Minor communication error

Warning message An error occurred of minor importance It would be wise to investigate the cause of this You are still able to work with your instrument See specific fieldbus for more details FLOW-BUS PROFIBUS-DP DeviceNet

normal flash 0.2 sec on, 0.2 sec off

No details No details No bus power

See specific fieldbus for more details FLOW-BUS PROFIBUS-DP DeviceNet

long flash 2 sec on, 0.1 sec off

Not used For special service purpose only

Serious communication error; manual intervention needed

on Continuously Critical error message A serious error occured in the instrument Instrument needs service before further using

Page 355: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 33 9.17.023

Table 3: LED indications using micro-switch at normal running mode of an instrument Green LED Red LED Time Indication off off 0 – 1 sec Pressing a switch shortly by accident will not

cause unwanted reactions of instrument. Pressing the switch 3x briefly with intervals of max. 1 sec. will force instrument to indicate its bus-address/MAC-ID and evt. baudrate. See paragraph 10.2 for more details. In case of min/max alarm or counter batch reached: Reset alarm (only if reset by keyboard has been enabled) See specific fieldbus for more details. FLOW-BUS PROFIBUS-DP DeviceNet

off off 1 – 4 sec

When address is occupied: Autom. installation on FLOW-BUS.

Not used Not used

off on 4 – 8 sec Reset instrument Instrument program will be restarted and all warning and error message will be cleared During (new) start-up intrument will perform a (new) self-test

on off 8 – 12 sec Auto-zero Instrument will be re-adjusted for measurement of zero-flow (not for pressure meter/controller) NOTE: First make sure there is no flow and instrument is connected to power for at least 30 minutes !

on on 12 – 16 sec Prepare instrument for FLASH mode At next power-up FLASH mode will be active This mode will be indicated by both LEDs off when instrument is normally powered

Note: short flash = 0.1 sec on, 2 sec off Table 4: LED indications using micro-switch at power-up situation of an instrument Green LED Red LED Time Indication off off 0 – 4 sec No action

Pressing a switch shortly by accident will not cause unwanted reactions of the instrument

off normal flash 4 – 8 sec Restore parameters All parameter settings (except fieldbus settings) will be restored to situation of final test at BHT production See specific fieldbus for more details.

FLOW-BUS PROFIBUS-DP DeviceNet

normal flash off 8 – 12 sec

Auto install to bus Instrument will install itself to a (new) free node- address on the FLOW-BUS

Not used Not used

Remote/manual install. Instrument will get a default address.This can be changed by means of micro-switch and LEDs. See description below for description of this procedure. See specific fieldbus for default installation address: FLOW-BUS PROFIBUS-DP DeviceNet

normal flash normal flash 12 – 16 sec

Node-address = 0 Station address = 126 MAC-ID = 63

Note: normal flash = 0.2 sec on, 0.2 sec off

Page 356: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 34 9.17.023

10.2 Readout/change bus-address/MAC-ID and baudrate

10.2.1 Set instrument to default installation address/MAC-ID: First instrument needs to be forced into “remote/manual install mode”. The switch needs to be pressed-down during power-up and released when both LEDs indicate normal flash (pattern: 0.2 sec. on, 0.2 sec. off). See also table 4 for more details. When the switch is released, instrument will get the default installation address. This will be different for each fieldbus system. Instrument may be switched-off now or will return into “normal running/operation mode” automatically after 60 sec.. Baudrate setting will not be changed by this action.

10.2.2 Readout bus-address/MAC-ID and baudrate: Pressing the switch 3x briefly with intervals of max. 1 second in normal running/operation mode will trigger the instrument to “show” its bus-address/MAC-ID and baudrate. For indication the bus-address/MAC-ID the green LED will flash the amount of tens and the red LED the amount of units in the number. For indication of baudrate setting, both LEDs will flash. The flashes are called “count-flashes” and have a pattern of 0.5 sec. on, 0.5 sec. off. Table 5: LED indications for bus-address/MAC-ID and baudrate Green LED Red LED Time Indication amount of count flashes(0...12)

Off 0 ... 12 sec. Maximum

tens in bus-address/MAC-ID for instrument

off Amount of count flashes (0...9)

0 ... 9 sec. Maximum

units in bus-address/MAC-ID for instrument

amount of count flashes(0...10)

amount of count flashes (0...10)

0 ... 10 sec. Maximum

baudrate setting for instrument

Note: Value zero will be indicated by a period of 1 sec. off (0.5 sec. off + 0.5 sec. off). E.g.: - for bus-address/MAC-ID 35 the green LED will flash 3 times and the red LED will flash 5 times. - for bus-address/MAC-ID 20 the green LED will flash 2 times and the red LED will flash 0 times. - for bus-address/MAC-ID 3 the green LED will flash 0 times and the red LED will flash 3 times. - for bus-address 126 the the green LED will flash 12 times and the red LED will flash 6 times. Table 6: Baudrate settings for different fieldbus systems: FLOW-BUS PROFIBUS-DP DeviceNet 0 = 187500 Baud (only 1 fixed baudrate)

0 = not detected 1 = 9600 Baud 2 = 19200 Baud 3 = 45450 Baud 4 = 93750 Baud 5 = 187500 Baud 6 = 500000 Baud 7 = 1500000 Baud 8 = 3000000 Baud 9 = 6000000 Baud 10 = 12000000 Baud

1 = 125000 Baud 2 = 250000 Baud 3 = 500000 Baud

E.g.: - for PROFIBUS-DP baudrate readout of 12000000 Baud, both LEDs will flash 10 times. - for DeviceNet baudrate readout of 250000 Baud, both LEDs will flash 2 times.

Page 357: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 35 9.17.023

10.2.3 Change bus-address/MAC-ID and baudrate: First instrument needs to be forced into “remote/manual install mode”. Within the time-out period of 60 sec. it is possible to start changing the bus-address/MAC-ID of the instrument. For certain fieldbus systems it is necessary to select the baudrate also. Other fieldbus systems only have one baudrate or the baudrate setting will adapt to the setting of the master automatically. In these cases baudrate selection is not needed and will be skipped. Table 7: Procedure for changing bus-address/MAC-ID and baudrate step action Indication time handling 1 Force instrument into

“remote/manual install mode”

both LEDs flashing normal 0.2 sec on, 0.2 sec

12-16 sec after power-up

Press switch during power-up and release when both LEDs indicate normal flash.

2 Set tens of bus- address/MAC-ID

Green LED flashes 0.1 sec on, 0.1 sec off count-flashes start when switch is pressed: 0.5 sec on, 0.5 sec off

time-out: 60 sec

Press switch and count green flashes for tens of bus-address/MAC-ID. Release when wanted amount has been count. Counts up to max. 12 and than starts at 0 again. When counting fails, keep switch pressed and restart counting for next attempt.

3 Set units of bus- address/MAC-ID

red LED flashes 0.1 sec on, 0.1 sec off count-flashes start when switch is pressed: 0.5 sec on, 0.5 sec off

time-out: 60 sec

Press switch and count red flashes for units of bus-address/MAC-ID. Release when wanted amount has been count. Counts up to max. 9 and than starts at 0 again. When counting failed, keep switch pressed and restart counting for next attempt.

4 Set baudrate of fieldbus communication.Only for specific types of fieldbusses: e.g. DeviceNet. This part will be skipped if no baudrate needs to be selected.

both red and green LED flashes 0.1 sec on, 0.1 sec off count-flashes start when switch is pressed: 0.5 sec on, 0.5 sec off

time-out: 60 sec

Press switch and count red and green flashes for baudrate setting of the specific fieldbus. Release when wanted amount has been count. Counts up to max. 10 and than starts at 0 again. When counting failed, keep switch pressed and restart counting for next attempt. Note: selection of 0 means: No change

Instrument returns to normal running/operation mode. Changes are valid when they are made within the time-out times. Actual setting can be checked by pressing the switch 3x briefly with intervals of max. 1 sec. for readout the bus-address/MAC-ID and baudrate (see paragraph 10.2.2 for more details). Note 1: Value zero will be indicated by a period of 1 sec. off (0.5 sec. off + 0.5 sec. off). When value zero is wanted, press switch shortly and release it again within 1 sec. Note 2: Before each action of flash-counting, the LED(s) to be used for counting will flash in a high frequency. (Pattern: 0.1 sec on, 0.1 sec off). As soon as the switch is pressed-down, this LED (or both LEDs) will be off and the counting sequence will start.

Page 358: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 36 9.17.023

Flatconductorcable

main PC board

fieldbusinterface

1234

S1S2S3S4

on

off

11 JUMPER SETTINGS MULTIBUS INSTRUMENTS

Multibus instruments consist of 4 jumpers or a DIPswitch on the pc-board. In normal operation it is not necessary to change the jumpersetting (see table 8) If it is inevitable, the jumpers can only be reached when the uppercase of the housing is opened. Opening the uppercase should be done with great care, because the connection of the fieldbus and main p.c.board is accomplished by a small flatconductor cable. Each jumper or switch can be used to make a certain setting by placing a link between a set of pins or by switching one of the DIPswitches as shown below:

with DIPswitch with jumpers

Table 8: Jumper settings digital pc-board

Switch Jumper When placed (on) When not placed (off) Remarks S2 J1 Default settings from

EPROM loaded at power-up

Settings loaded from non-volatile memory at power-up

Normally not placed

S3 J2 Analog input used as standard setpoint for controller at power-up

Digital (bus) input used as standard setpoint for controller at power-up

Setting depends on how instrument was ordered. Setting can be changed during normal operation using parameter ControlMode so take-over of setpoint control by RS232 or fieldbus is possible. At next power-up however, controller will read jumper first for actual setpoint source.

S4 J3 reserved - J4 reserved Not always present

S1 J5 Normal RS232 communication

Instrument in FLASH mode RS232 used for download of new firmware

FLASH mode can also be selected using the micro-switch on top of the instrument (see chapter 10, table 3).

(J4) J5

J1

J3J2

J5

CORI-FLOW

J2J1

J3

MBC-II

J1J2J3

J5

L30 digital

Page 359: Automatización de la Generación y Medida de Mezclas Gaseosas …deeea.urv.cat/public/PROPOSTES/pub/pdf/1136pub.pdf · 2009. 9. 22. · tratamiento con MATLAB. Los objetivos a cubrir

BRONKHORST HIGH-TECH B.V.

page 37 9.17.023

12 TESTING AND DIAGNOSTICS All digital instruments have facilities to run self-test procedures for diagnostics. Most of the instrument functions will be tested automatically during start-up or normal running mode of the instrument. All results of testing or malfunctioning will be stored in special diagnostics registers in the non-volatile memory of the instrument. These registers will contain actual information about the functioning of the instrument. The red LED on top of the instrument is used to indicate if there is something wrong. The longer the LED is burning (blinking) red, the more is wrong with the instrument. See chapter 10 for more details about the LEDs and other documents for more specific troubleshooting.