Error handling in LabView

When we talk about errors in LabView we can find two kinds, the errors that we can make as designers and the errors that can occur by non-compliance of conditions during the execution of the program.

In the first case LabView is able to detect our mistakes as designers, prevent us from even simulating the program and even tell us where and how we are making the mistake, so I do not think it is a topic of interest in the blog we are building together.

However, the second case is of great interest because our designs must be able to detect when an unwanted data is entered into the system and be able to give the warning and even stop the process if the situation warrants it.

In this article we will learn how to use the error cluster so that our designs can notify our clients of the occurrence of errors during a process, note that it is not a program error (case 1) but a process error (case 2).


Cuando hablamos de errores en LabView podemos encontrar dos clases, los errores que podemos cometer como diseñadores y los errores que pueden ocurrir por inclumplimiento de condiciones durante la ejecución del programa.

En el primer caso LabView es capaz de detectar nuestros errores como diseñadores, impedir que podamos siquiera simular el programa y hasta indicarnos donde y como estamos cometiendo el error, por lo cual no creo que sea un tema de interés en el blog que juntos estamos construyendo.

Sin embargo, el segundo caso es de mucho interés ya que nuestros diseños deben ser capaces de detectar cuando se introduce un dato no deseado en el sistema y poder dar el aviso e incluso detener el proceso si la situación lo amerita.

En este artículo aprenderemos a usar el clúster de error para que nuestros diseños puedan notificar a nuestros clientes la ocurrencia de errores durante un proceso, note que no es un error de programa (caso 1) sino un error de proceso (caso 2).



What we see in the previous image is a SubVI to calculate the square root of a number, for this we create a numeric control in which an operator can enter the data and we create a case structure to establish two possible cases.

We know that in the domain of real numbers we cannot calculate roots of negative numbers, therefore our design must be able to produce an error when an operator enters a negative number.

For this we use zero as a reference knowing that negative numbers are those less than zero and we use the TRUE case to process the square root calculation when the entered number is greater than or equal to zero.


Lo que vemos en la imagen anterior es un SubVI para calcular la raíz cuadrada de un número, para ello creamos un control numérico en el que un operador puede introducir el dato y creamos una estructura case para establecer dos casos posibles.

Sabemos que en el dominio de los números reales no podemos calcular raices de numeros negativos, por lo tanto nuestro diseño debe ser capaz de producir un error cuando un operador introduzca un número negativo.

Para ello usamos el cero como referencia sabiendo que los números negativos son los menores que cero y usamos el caso TRUE para que se procese el cálculo de la raíz cuadrada cuando el número introducido sea mayor o igual a cero.



When the process is executed normally, the error cluster does not undergo modifications during the data flow, remember that the error cluster presents the data Status, Code and Source through which information about an event can be provided.

But this information is defined by us as designers when considering an undesired condition, in our case the undesired condition is the entry of a negative number.

For the case of the negative number (FALSE) we use the Bundle by Name function. This block allows us to modify specific data in a cluster at the point we want.


Cuando el proceso se ejecuta con normalidad el cluster de error no sufre modificaciones durante el flujo de datos, recordemos que el cluster de error presenta los datos Status, Code y Source mediante los cuales se puede suministrar información sobre un evento.

Pero esta información la definimos nosotros como diseñadores al momento de considerar una condición indeseada, en nuestro caso la condición indeseada es la entrada de un número negativo.

Para el caso del número negativo (FALSE) usamos la función Bundle by Name. Este bloque nos permite modificar datos específicos en un cluster en el punto que queramos.



In the cluster modification we must set Status as TRUE to indicate that the error has occurred, in code we can code the error with some number, it is very useful when we want to offer a troubleshooting guide and in source we write a description of why the error is occurring.


En la modificación del cluster debemos establecer Status como TRUE para indicar que ha ocurrido el error, en code podemos codificar el error con algún número, es muy útil cuando queremos ofrecer una guía de solución a problemas y en source escribimos una descripción de por que se esta produciendo el error.



With this we have ready our SubVI that calculates a square root. Now we are going to use it in a program to see how it behaves when an error occurs.


Con esto tenemos listo nuestro SubVI que calcula una raíz cuadrada. Ahora vamos a usarlo en un programa para ver cómo se comporta cuando ocurre un error.



As we can notice it is an error that is presented by data and it is not necessary to correct the program code but the data entered.

I have used a square root SubVI as an example for its simplicity and ease of understanding, but the same principle can be used for more complex processes, an example would be to consider the pressure in a flow line before opening an outlet valve or many other cases in a process where specific conditions are required to operate the process.

Since the error cluster controls the flow of the program, it is possible to stop the execution at the exact moment when the error occurs and prevent subsequent unwanted actions from being executed under the error conditions.

From what we have seen we can conclude that the use of an error cluster is extremely useful for designs in which processes with specific conditions must be handled and have a sequence of execution.


Como podemos notar es un error que se presenta por datos y no se necesita corregir el código del programa sino los datos ingresados.

He usado un SubVI raíz cuadrada como ejemplo por su simplicidad y facilidad de comprensión, pero se puede usar el mismo principio para procesos más complejos, un ejemplo sería considerar la presión en una lineal de flujo antes de abrir una válvula de salida o muchos otros casos en un proceso donde se requieren condiciones específicas para operar el proceso.

Ya que el cluster de error controla el flujo del programa se puede detener la ejecución en el momento exacto en que ocurre el error y evitar que se ejecuten acciones posteriores no deseadas bajo las condiciones de error.

De todo lo visto podemos concluir que el uso de un cluster de error es en extremo útil para los diseños en los que se deben manejar procesos con condiciones específicas y llevar una secuencia de ejecución.









https://images.ecency.com/p/3W72119s5BjW4PvRk9nXBzqrPWMsMTjNrXDPFFf12CAfRz5MY8jCm5vGDUj7o96hwAT3YCMBJgcTgcWmsqeuBbZL1YbmxtaV4gyfByenDkmAkgv6rkm9ZP.webp?format=webp&mode=fit



0
0
0.000
3 comments
avatar

Thanks for your contribution to the STEMsocial community. Feel free to join us on discord to get to know the rest of us!

Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).

Thanks for including @stemsocial as a beneficiary, which gives you stronger support. 
 

0
0
0.000
avatar

I remember using LabView briefly while seeing a course for PIC microcontroller programming with C. In the end, It didn't work but it had to do with the virtual ports. I would love to see your future projects.

Great article.

0
0
0.000
avatar

Thank you very much my friend for your comment. I wonder what would go wrong with your project.

What you say has already been done on the blog, you can read it in the following articles:

As my articles complement each other I recommend you to look at articles written on similar dates to the ones mentioned in case you need additional information, there will surely be other articles in which the bases were laid before writing the ones mentioned above.

Thank you for taking the time to read my blog, any doubt please let me know in the comments section, I also accept suggestions, the idea is that together we can build a blog of interest to all of us who are fascinated by electronics and automation.

0
0
0.000