viernes, 13 de marzo de 2015

Database Labview

Temperature database.
The practice is to enter some data and Temperature Time Two Arrays one for each respectively.
These data once entered the export through a database Labview here is Access.
The next step Labview reads this database and reimport, creating two arrays such as those created at the beginning.
Collected data we use to introduce a graph to display the points representing.
The aim of the practice is to use SQL language through labview, ie to create a table, insert, update or delete data read and even said base.
To start this method must first create a database with Microsoft Access software, in my case I own the 2013 version.
After creating the database, create a database compatible with Labview, as shown in the video is the 2003 version.

After creating the database, we must go to Labview to create the udl. What are .udl? are database files associated with Data Link.
Therefore we associate our Labview with the database in the following video is seen as performed. First we open a saw, in this case to make it neater going to be a project, since after create subVI.
Once associated with the .udl that must be in the same folder as our vi, for the simple fact that if we are to carry or want to export our vi will always associate.
Do not change the name because it is associated and not find it, it is recommended that the name is not followed by spaces.

Now it create the environment of our VI, the first thing to do is attempted is a screen pass into tabs, but that is both interactive time.
A video of how to interact and display full practice for better understanding is attached.

First create the buttons to enter data and arrays.

After the button and duplicate arrays and put them in one place, plus configured to start when we saw only the temperature is displayed, but not the Hours, also will confirm button.

Then we create an event structure is an interrupt each time the button is pressed so helps us stick with the program and interactive. In the example you give to Value change so that when changes value shows a table or another, later will change, since the aim is that one is displayed, then it is hidden, display the other and is hidden by accepting following the cadence of our interaction.

By understanding the concept we are going to do to create the table first, first create a subVI to which we will indicate the corresponding statement to create the table. Since we asked for a table name and do not know if that name is in our database, we will delete if the table is already created and we ensure that our table is the only avoiding a mistake.
After creating the table, when we introduce the temperatures indicated that, in accepting use another SQL statement that involves inserting temperature values ​​in the table that we created and also we help with a FOR iterations to add identification numbers which helps us to place the data, or look them in order.
The next step is to enter data relating to hours, as is in fact String, it allows us to write two points separate times.
As we learn the most from SQL statements, because instead of using the same statement INSERT INTO we used before, we will use the UPDATE statement, for it will indicate the column to choose from and also choose the row with the indicators provides us ID column, and say as they are indicated if each row one, because very simple, FOR iterations is used to indicate the row.
When you have entered in the table data relating to hours, is the step of selecting data for display on two arrays of String, to return to the initial step.
For this we have another SELECT statement that is and will indicams we want the reference data in columns temperature and higher Hours Id row indicator to -1, that is all.
By selecting these data, Labview the data becomes Recorset data, which is a type of Variant of Labview data, we should change to String.
We use a FOR to pass data, and index to remove the item you want and use the tool to Variant data, this helps us to transform data Variant to String, in this case because it indicated an empty String constant .
After what we went through an instruction that is to convert data to Flattened String Variant. For the time, to convert the data we need to separate the minutes and seconds to give to the graph, requiring another tool that is String Subset which extracts the data we have told you according to the position they are in., Then try these data the number and FOR the array of numbers is created to pass to the graph. The same is used for temperature except the treaty as the temperature does not need to decompose.
After receiving the data had data for another subVI that makes the transformation of hours to spend at the graph, so we must make the math to show the data of the specific time, ie the minutes only go to 59 then should add another hour. As we have to create an array 2 Dimensions hours and temperature, we join two clusters one hour and a temperature sensor, once out our array attached to the chart.
The graph is an XY Graph, is configured so that we vializar hours on the X axis as shown in the video and Y for temperature. To avoid errors in the X-scale offset must be mutlplicador -3600 and 3600 in the Y 0 and 1 respectively. Select cursors and others to suit the client.

In the last video you can see how the data are to our Access table.


To download the files from all the practice you must click on the picture below.



1 comentario: