LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Manually & Automatically inputting string data in a table

Manually -

I am running a main vi to monitor production in our plant. If production times exceed a certain limit, another vi is called requesting a reason why the production time was excessive (i.e. it requests a downtime reason). The operator/user has to select ONE reason from ONE of the ring controls (i.e. one of electrical or mechanical or process). The selected reason is shown in a string indicator and the user must confirm the selection by clicking OK, or (if they’re not happy with the selection) clear the string indicator by pressing CLEAR. If OK is pressed I would like the information to be passed into the table below. I am unsure how to program this OK and CLEAR command in my code.

Automatically –

When the downtime vi is called, I am sending an initial timestamp into the loop. When a new production cycle starts (i.e. downtime is over) I am outputting a timestamp out of the loop. The difference between the two will be my downtime. I would like this to be fed into the table automatically so that the only manual input is the reason itself. I think this works ok, but I haven’t managed to see it working with the manual string input yet.

I have attached my vi which isn’t as complicated as all this sounds ( - sorry for the lengthy explanation - ). I have made notes which explain clearly what I am looking for at each step of the code. Basically, if I get my OK and CLEAR controls working, it will be able to take it from there.

Many thanks for anyone who is able to help,

Stuart

0 Kudos
Message 1 of 4
(2,981 Views)

Hi stuart,

Take a look at attached vi

modified your VI to add to table, clear and reset rings to 0th position.

Regards

Dev

0 Kudos
Message 2 of 4
(2,976 Views)
Dev, sincere thanks for the help - that is looking a lot more like what i'm after. I am having a few continuing problems though, and if you get a chance to revisit this, then your feedback would be greatly appreciated. Firstly, I know i specified that all data go into the table at once, however in practice this is a little strange. When the user hits "OK" the vi freezes and waits for the timestamp data (as expected). It would be smoother if I could get the text data added to the table as soon as the user hits "OK", however I am unsure how to program this to appear in the table without waiting for the timestamp data. Secondly, the timestamp data always adds 1 hour. E.g. If I had 15 minutes downtime, the stop/start timestamps would be correct (e.g. 14:00:00 - 14:15:00) however the difference between them would be 01:15:00. I can't work out why(?). Thirdly, i am using a discrete tag to recognise the start of a new cycle (my previous condition wasn't correct). I have set my Read Tag vi to read value only when a new value is received, however on the first iteration of the loop it reads the latest value (TRUE) which closes my vi and outputs my time difference. I would like the read tag vi to wait until the NEXT "true" is read from the tag. Is there anyway to ignore the first iteration or to control the read tag vi in order to achieve this? Lastly, (sorry i know....) when my vi is recalled (for the next downtime reason) the table does not show previous downtime entries. How do i set up my code in order to do this? I have attached my updated vi to show you my progress. Geez, i'm sorry i didn't realise there were so many questions.. If you get a chance then I would be very grateful. Thanks for your continuing support. best regards, Stuart
0 Kudos
Message 3 of 4
(2,956 Views)

Hi Stuart,

For your last query,

Just keep writing into a file ( see modified attached file)

Open a file, read it into the 2 D array table, and after finishing the while loop, write it into the same file( remember to replace the existing file)

about your second query, You are subtacting the current time string count from the string count that you acquire in the beginning of while loop, getting a seconsds count. Then, you are giving the second count input to get date time string. This function returns a time stamp of the current time, measured as the number of seconds that have elapsed since 12:00 a.m., January 1, 1904, Universal time.

I sugest you think of an alternative method for finding down time.(try converting seconds to minutes and hours by other logic)

Regarding ur third query, see if you can put this sub vi in the time out event instead of keeping a seperate loop( since this VI si missing, i am not sure what you are doing inside, looks like you are doing a digital read/write)

For your first query, hmm again i must admit, right now with existing flow of your program, it is not possible.

However try this: once you get a time stamp, try inserting it in the relevant row and coloum, with the press of another button say, named 'add time stamp'.

Hope this helps,

Regards

Dev

Message 4 of 4
(2,947 Views)