From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
02-13-2019 03:45 AM
Hi everyone, I would really appreaciate it if you could help me with this small issue. I have to carry out a test of one system , to make this test I need to use values of one array each certain of time.
Basically its a table , first column each row its the time when i have to use the values, and the rest of columns are the values for that specific time.
Example
7:00 4 5
8:46 10 6
9:03 3 8
etc
So I am thinking of using a timer that counts each 30 seconds, and a function to gets the hour and each 30 seconds check the array and if the current time and the value match i get the value and i do the operations. First if you think an easier way of doing this it will be great. Secondly I am not able to use the function "Search 1D array" in order to compare the value I got "in the get time " with the position of the array since it has a red colour and "Search 1D array does not allow me to introduce that kind of data " ... any advice ?? many thanks !!
Solved! Go to Solution.
02-13-2019 04:09 AM
02-13-2019 02:34 PM
What else does the program need to do? At any time, you can calculate the time to the next action in ms and place it into the timeout of an event structure (via shift register). Redo whenever one of the other events fires (simple example). This avoids polling the time.
A simple state machine should suffice unless a test can take a long time.
What is a "red color". Are you talking about a coercion dot? It always helps to attach actual code. What exactly did you wire to where?
02-14-2019 08:02 AM
Thanks for your answer. May i ask you a really easy question, if I have a module that need to carry out an equation as you see, the problem is , if the value i get doesnt meet the condition i need to carry out the equation again but starting the Q from the new value. So I am not sure how to keep the value I get from the Q and keep reusing it until i get the result of the loop and i finish this loop. So i would need the value to update and keep reusing it... any idea please ?
02-14-2019 08:48 AM
@Jalatruken wrote:
So i would need the value to update and keep reusing it... any idea please ?
Use a Shift Register.
02-16-2019 10:44 AM - edited 02-16-2019 10:45 AM
I am so sorry for asking you again but it is a question related to your previous answer, you told me to use a shift,
but let me explain my current situation to you. I have one equation block and in order to enter to that equation block i need to meet a condition so I added a true/false structure, so I need the value of the Q that I get in a previous iteration of the equation I need to reuse it again until the result of the equation meets a condition. Therefore, I would need to enter in true/ case a shift that (I am not allowed to do that ) and I would need to enter the update value of the sensors for the new iteration. So basically its a equation that is running , an for each iteration i need the previous value i got plus the new values i got from the sensors , as long as these new values meet the condition.
Please any help ??
02-16-2019 01:37 PM
You seem to have a complete mess in your data flow. So I recommend you completely rearchitect what you have into a State Machine. But before you write ANY more code, WRITE down the exact process you need your data and application need to do. You will notice the states develop. Then you can program the State Machine pretty easily.
02-16-2019 02:00 PM
sorry but how can i programme that ? I think you havent answered to my question you just say i need to tidy everything, I completly agree. But Could you please tell me how I can manage to introduce the result of the equation and the new iteration of the values from the sensors again in a true case. Is there any way of keeping the result in avariable like normal programming and use it from that point ? I have been looking for that but I only get information about shift register that i think i cant use it here...
02-16-2019 03:23 PM
Hi jalatruken,
Is there any way of keeping the result in avariable like normal programming
Learn about DATAFLOW: "variables" are wires in LabVIEW. Use shift registers to store data for next iteration.
Btw what is "normal" programming? Is LabVIEW "unnormal" programming?