11-21-2022 01:59 AM
Hi guys, I carried on with the work and documented myself. In this way I was able to carry on with the work.
Everything works, I can request the measurements from the comparators and they respond with the measurement. Now I have a problem that I can't solve, I would like to take the 4 string data and connect them to an excel file and place them on 4 columns. Furthermore, on the first two columns of the excel file I would like to have the date and time of the moment in which I press the request button for the first measure.
In reality, the ideal would be to make everything automatic, ie I press a single button and read the date and time and the 4 readings at slightly different times as they work on the same wireless frequency.
11-21-2022 03:58 AM
Hi Valery,
@Valeryhill4 wrote:
Everything works, I can request the measurements from the comparators and they respond with the measurement.
I doubt that sentence!
You are opening one (1) serial connection, but you read/write to your device 4 times in parallel!
And then you try to close that one (1) VISA reference four (4) times!?
@Valeryhill4 wrote:
I would like to take the 4 string data and connect them to an excel file and place them on 4 columns. Furthermore, on the first two columns of the excel file I would like to have the date and time of the moment in which I press the request button for the first measure.
In reality, the ideal would be to make everything automatic, ie I press a single button and read the date and time and the 4 readings at slightly different times as they work on the same wireless frequency.
Suggestions:
11-21-2022 06:38 AM
@GerdW wrote:
Suggestions:
- Save that array to a CSV (!) file using WriteDelimitedSpreadsheetFile…
Due to the international folks, I find using a tab delimited text file (txt) to work better than a comma separated values file (csv). Either can be easily imported into Excel.
11-21-2022 10:29 AM
mine worked there but only by requesting single measurements one at a time and without reporting them in excel
now I did as you indicated, but the measurements are mixed. maybe I need to use a stacked sequence instead of the flat one.
Is this right as I did in the VI?7
11-21-2022 01:21 PM - edited 11-21-2022 01:46 PM
Hi Valery,
@Valeryhill4 wrote:
now I did as you indicated, but the measurements are mixed.
No, you did not…
A statemachine is something different than a large flat sequence structure!
Do you really need to compare the received strings with some constants when you send the commands one after the other?
Why do you use InsertIntoArray when you want to build an array? Why not use BuildArray for simplicity???
Does your device responds with a full message within your 50ms timeout range?
What are "mixed messages"?
Do you really need to wait for 1s, 2s, 3s and 4s in those 4 frames? That's 10s in total per iteration! Why do you need to place an additional 1s wait in the loop?
@Valeryhill4 wrote:
maybe I need to use a stacked sequence instead of the flat one.
No. Sequences are almost always NEVER the solution to any (LabVIEW) problem!
@Valeryhill4 wrote:
mine worked there but only by requesting single measurements one at a time and without reporting them in excel
So the current VI is working - or are there any problems?
Why do you insist on "reporting in Excel" when you create a DelimitedTextFile now? (You know a CSV/TSV file is just text, which can be handled by Excel too?)
See these suggestions:
It should basically do the same as yours, but with much less code…
11-22-2022 02:49 AM
Hello, the comparison of strings with some constants is necessary because the instrument has a limit and that is that when the measurement always remains on the same value which can happen in practical tests, the request generates an error which is the one written as ST1 .......... which is different of course for each comparator. So I need to set the condition that when this happens I take the last result that the comparator device has read to prevent it from printing the error. Furthermore, the response from the instrument appears as DT100000+20.05M, I only need the datum with the sign so I'm going to skim it.
By mixed messages I mean that the comparators work at the same frequency so it occurred to me that the measurement data of one comparator was reported in the box of the other. As for the time, how do I figure out how to set it so that the receiver is able to make the request and the transmitter sends the response? it says that the transmitters work with 2.4 Ghz zigbee technology. How do I determine the time ?
11-22-2022 03:21 AM - edited 11-22-2022 03:25 AM
Hi Valery,
@Valeryhill4 wrote:
As for the time, how do I figure out how to set it so that the receiver is able to make the request and the transmitter sends the response?
You already do that! You send a command and you read the response using VISAWrite+VISARead…
@Valeryhill4 wrote:
it says that the transmitters work with 2.4 Ghz zigbee technology. How do I determine the time ?
Why do you need that time?
Anyway: get the timestamp before sending the command and the timestamp after receiving the response. Subtract one from the other…
@Valeryhill4 wrote:
the response from the instrument appears as DT100000+20.05M, I only need the datum with the sign so I'm going to skim it.
That could be so easy (when there always is a sign char):
11-22-2022 05:27 AM
I built everything as you showed me, the only thing is that when the measurement is repeated I get the ST10002000000998305 error code, I would like to resume the last measurement I made for that comparator.
Furthermore, in the front panel it is possible to view the array for maybe 4 while loops and therefore see 4 measurements in the column for each comparator.
As for the wait, how do I figure out which constant to set to ensure that the requests of a cycle do not conflict with those of the following ones.
In excel I would like to find the time with the value for each comparator and so on for a certain number of repetition measurements
11-22-2022 05:55 AM
Hi Valery,
@Valeryhill4 wrote:
I built everything as you showed me,
You forgot to attach your actual VI…
11-22-2022 06:05 AM
When the inequality is false that I have the ST error....... I would like to report the previous measurement respective to that comparator instead of the error. Is there a way?