LabView Structures: Flat Sequence EN/ES 🥃SPECIAL EDITION🥃

Life is a sequential process, events always occur in an order, to be parents you must first beget and before that there are many other events that must occur, for safety sometimes some events must occur first than others, for example if we stop a cab this should not go without first we get in the vehicle.

It is so logical that only to mention it can make you doubt on what things I am rambling, because now let's take that to the programming, when we write codes we know that they will be executed line by line, if we create a loop while the program will not go out of there while the condition that executes it is fulfilled ignoring the rest of the code.

But LabView is different in this sense, we have already demonstrated that two while loops can be executed simultaneously and depending on the application we want to develop this can become a problem because it does not respect the principle of sequence, that leads us to seek mechanisms that give us control of the order in which events are executed, so today we will see the Flat Sequence structure in a special edition of the father's day.


La vida es un proceso secuencial, los eventos siempre ocurren en un orden, para ser padres primero hay que engendrar y antes de eso hay muchos otros eventos que deben ocurrir, por seguridad a veces deben ocurrir unos eventos primeros que otros, por ejemplo si paramos un taxi este no debe irse sin que primero nos montemos en el vehículo.

Es tan lógico que solo mencionarlo puede hacerte dudar sobre qué cosas estoy divagando, pues ahora llevemos eso a la programación, cuando escribimos códigos sabemos que se ejecutarán linea por linea, si creamos un bucle while el programa no saldrá de ahí mientras se cumpla la condición que lo ejecuta ignorando el resto del código.

Pero LabView es distinto en este sentido, ya demostramos que dos bucles while se pueden ejecutar de forma simultánea y dependiendo de la aplicación que queramos desarrollar esto puede convertirse en un problema ya que no respeta el principio de secuencia, eso nos lleva a buscar los mecanismos que nos den el control de el orden en que se ejecutarán los eventos, por eso hoy veremos la estructura Flat Sequence en una edición especial del dia del padre.


We want to celebrate Father's Day by giving away a machine that allows to dispense beers served to fathers who in a relaxed attitude enjoy a celebratory atmosphere.

The algorithm is simple, place the empty glass, wait for the father to request a beer, fill it with beer when there is a request, deliver it and repeat.

If we try to do this in Labview without further ado, the parent may end up receiving empty glasses, so we must first learn to control the flow of our program, for this we can establish that the actions are linked under conditions so that the second step does not meet the conditions to be executed until the first is complete or use the Flat Sequence structure.


Queremos celebrar el dia del padre obsequiando una máquina que permita despachar cervezas servidas a los padres que en una actitud relajada disfrutan de un ambiente de celebración.

El algoritmo es simple, colocar el vaso vacío, esperar que el padre solicite una cerveza, llenarlo de cerveza cuando exista la solicitud, entregarlo y repetir.

Si intentamos hacer esto en Labview sin más puede que el padre termine recibiendo vasos vacios, por eso primero debemos aprender a controlar el flujo de nuestro programa, para ello podemos establecer que las acciones estén enlazadas bajo condiciones de manera que el segundo paso no cumpla las condiciones para ejecutarse hasta que el primero este completo o usar la estructura Flat Sequence.


This structure is presented as a film "reel", you can add as many frames as you want and the program will run in order from left to right. The steps of the algorithm are written in each frame in the order we want the execution of each step.


Esta estructura se presenta como un "rollo" de cine, se puede agregar la cantidad de cuadros que deseemos y el programa se ejecutará de forma ordenada de izquierda a derecha. Los pasos del algoritmo se escriben en cada cuadro en el orden que deseamos la ejecución de cada paso.


With that I have already explained the Flat Sequence structure, as you can see it is very simple 😅. But let's design our example making the gift for parents that we have described.

First we are going to create a custom environment, for that we create custom controls and indicators that will give us the appearance of the cover image, by the way the subject that appears there I have hired him to act as a parent from pxhere.

Apart from our actor we have custom indicators in the form of text, this will change color as if made with LEDs, we have disc lights which we can adjust the speed of movement with the beautiful ferrari which is a slide control, we have two vertical slides that bring the empty glass up to the filling place, a modified level representation to represent our glass being filled, a horizontal slide to bring the full glass to the relaxed parent, a request button and a stop button.

The first thing we will do is to make our WELCOME... text have a fixed flashing using a while loop as we saw in previous articles.


Con eso ya te he explicado la estructura Flat Sequence, como ves es muy simple 😅. Pero vamos a diseñar nuestro ejemplo haciendo el regalo para los padres que hemos descrito.

Primero vamos a crear un ambiente personalizado, para ello creamos controles e indicadores personalizados que nos darán la apariencia de la imagen de portada, por cierto el sujeto que aparece ahí lo he contratado para actuar como padre desde pxhere.

A parte de nuestro actor tenemos indicadores personalizados en forma de texto, este cambiará de color como si estuviese hecho con LEDs, tenemos luces de disco las cuales podemos ajustar la velocidad de movimiento con el hermoso ferrari que es un control slide, tenemos dos slides verticales que hacen subir el vaso vacío hasta el lugar de llenado, una representación de nivel modificada para representar nuestro vaso en proceso de llenado, un slide horizontal para llevar el vaso lleno al padre relajado, un botón de solicitud y un botón de parada.

Lo primero que haremos será que nuestro texto WELCOME... tenga una intermitencia fija usando un while loop como lo vimos en artículos anteriores.


Now we want HAPPY FATHERS DAY also to be intermittent but each word separately in a sequential way, for this we can use the same pattern of the while loop with the shift registers but this time we will use a Flat Sequence to establish the order of execution, it is important to note that the delay is inside the frames needing one per frame and not only one per while loop, this is so to establish the delay between a sequence and another.


Ahora queremos que HAPPY FATHERS DAY también sea intermitente pero cada palabra por separado de forma secuencial, para ello podemos usar el mismo patrón del while loop con los shift registers pero esta vez usaremos un Flat Sequence para establecer el orden de ejecución, es importante notar que el delay está dentro de los frames necesitando uno por frame y no uno solo por while loop, esto es así para establecer el retardo entre una secuencia y otra.


We have 6 spheres of lights with adjustable speeds, we have made an attractive control so that our friend can adjust the speed of the spheres to his liking and even play with the knob while enjoying his beer.

Again we use a while loop but this time we make the repetition time variable, as the value of our slide increases the execution time decreases, the way I can think of to do it is using the value of our knob as denominator that divides a constant, for this we must make the minimum value to be 1 instead of zero since we don't want to have a zero in the denominator.


Tenemos 6 esferas de luces con velocidades regulables, hemos hecho un control atractivo para que nuestro amigo pueda ajustar la velocidad de las esferas a su gusto e incluso jugar con la perilla mientras disfruta su cerveza.

De nuevo usamos un while loop pero en esta ocasión hacemos que el tiempo de repetición sea variable, a medida que aumenta el valor de nuestro slide disminuye el tiempo de ejecución, la forma que se me ocurre para hacerlo es usando el valor de nuestra perilla como denominador que divide una constante, para ello debemos hacer que el valor mínimo sea 1 en lugar de cero ya que no queremos tener un cero en el denominador.


Now let's take a look at how our environment looks like and test the speed control for the lights at once.


Ahora demos un vistazo a como queda nuestro entorno y de una vez probamos el control de velocidad para las luces.


Now we are going to design our beer dispatcher, it is assumed that in the initial condition there is already an empty glass waiting to be served, a button sends the service request signal and the process starts, this button is not latching, that is, it only sends the condition true when it is pressed and false when it stops being pressed, therefore our friend must press for more than a second for a safe signal.

We have to enclose everything in a while loop because we want that the process can be repeated every time we want, the push button is inside this while loop but outside the flat sequence however it has influence on all the frames, in total we have 3 frames, one to fill the glass, another to deliver the glass and another to place a new glass.

To create the first frame we use the push button signal (TRUE/FALSE) in a CASE structure that will return (1/0), then inside the frame we create a while loop that receives this data through a shift register and compares if it is equal to zero, the result is sent to a selector and when it is zero the level of the glass is taken to zero and a stop is sent to the while loop, only when this stop occurs it goes to the next frame, when it is one it goes through an incrementer and with a delay it continues increasing until it reaches a value of ten (full glass), this condition also stops the while loop to go to the next frame.


Ahora vamos a diseñar nuestro despachador de cervezas, se supone que en la condición inicial ya hay un vaso vacío esperando ser servido, un pulsador envía la señal de solicitud de servicio y el proceso inicia, este pulsador no es de enganche, es decir, solo envía la condición verdadero cuando es pulsado y falso cuando deja de ser pulsado, por lo tanto nuestro amigo deberá pulsar por más de un segundo para una señal segura.

Tenemos que encerrar todo en un while loop porque queremos que el proceso se pueda repetir cada vez que se desee, el pulsador esta dentro de ese while loop pero fuera del flat sequence sin embargo tiene influencia sobre todos los cuadros, en total tenemos 3 cuadros, uno para llenar el vaso, otro para entregar el vaso y otro para colocar un nuevo vaso.

Para crear el primer frame usamos la señal del pulsador (TRUE/FALSE) en una estructura CASE que devolverá (1/0), luego dentro del cuadro creamos un while loop que recibe este dato mediante un shift register y compara si es igual a cero, el resultado se envía a un selector y cuando es cero el nivel del vaso se lleva a cero y se envía un stop al while loop, solo cuando ocurre ese stop pasa al siguiente cuadro, cuando es uno se pasa por un incrementador y con un retardo se sigue incrementando hasta que alcanza un valor de diez (vaso lleno), esa condición también detiene el while loop para que pase al siguiente cuadro.


Since all the indicators have the same numerical range we can copy the same table into the next one and just replace the indicator with the corresponding one, that way we will have our complete flat sequence.


Ya que todos los indicadores tienen el mismo rango numérico podemos copiar el mismo cuadro en el siguiente y solo reemplazar el indicador por el que corresponda, de esa forma tendremos nuestro flat sequence completo.


The stop button has become common to all while loops that have a manual stop, our complete structure would look as follows:


El botón de stop se ha hecho común a todos los while loop que poseen parada manual, nuestra estructura completa se vería de la siguiente forma:


With this we have our design ready, now to continue enjoying father's day and remember not to abuse the service button 😁😵.


Con esto ya tenemos nuestro diseño listo, ahora a seguir disfrutando del dia del padre y recuerda no abusar del botón de servicio 😁😵










0
0
0.000
2 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

Congratulations @electronico! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)

You distributed more than 11000 upvotes.
Your next target is to reach 12000 upvotes.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

0
0
0.000