ā10-26-2005 05:55 AM
I am monitoring the performance of our manufacturing plant on a daily basis. One of the things I would like to indicate on my front panel is how the plant is performing hour-to-hour throughout the production shift. I would like to measure the average between two times (e.g. average production rate for 07:00 ā 08:00, 08:00 ā 09:00⦠14:00 ā 15:00 etc) and report this on a numerical indicator. I have attached a jpeg of my block diagram to best show you what I am aiming to do.
Basically, I have tried to initialise the loop at 10:00 hours; gather data from a memory tag in an array (values are read out upon change); close the loop at 11:00 hours; upon closure of the loop average all the values collected in that hour. This doesnāt seem to be working.
If you can spot any problems with my code, I would really appreciate an alternative way of doing this. Your help is greatly appreciated.
Best regards,
Stuart Wilson
ā10-26-2005 06:42 AM
ā10-26-2005 07:02 AM
Hi Stuart,
As pincpanter said...
The code on the left doesn't do much and you should initialize the shift register otherwise you will get surprises.
What you could do is create an array of start times (ie. 7:00 to 15:00). Within the while loop do a compare (System time vs time in the array) and use the boolean to trigger a Case Statement that takes the timestamp and your data to update your display. In order to avoid multiple triggering of the Case Statement, you could update the index to the time array within the Case Statement and the system time would have to reach the next hour before the Case Statement is triggered again...
Ray
ā10-26-2005 07:11 AM
Many thanks for the reply Paolo. A few questions though:
Re: 1) is there a Get time only function? I do not want to have to ask the user of this program to manually enter todays date in the constant every time we run the vi
Re: 2) If the boolean won't initialise the while loop then can you offer any alternative to start the while loop at the specified time and stop it after 1 hour? I am pretty inexperienced and have run out of ideas
Re: 3) I want the loop to execute once in a day between two specific times. Does this mean i can ignore the initialising of the shift register? I also don't want a zero in my array as this will throw out the averages.
Re: 4) Why is the array size better used outside loop?
A very big thanks for all your answers. I look forward to hearing from you again if you get the time.
stuart
ā10-26-2005 07:35 AM
Ray, a couple of quick questions if get a chance to revisit this...
If i initialise the shift register with zero, I will have forced a zero into my array and this will throw out my averages will it not? i.e. how do I initialise it without spoiling my analysis?
I understand perfectly what you are suggesting as an alternative, however I am a little lost on how to achieve it. Firstly, how do i create an array of start times? If it's only start times, how does the vi know to finish at 15:00 (the end of production). System time obtained using "Get date/time in seconds", then as Paolo explains above, I will need to put the date in manually every single time i run the vi - can this be avoided? I also don't want to lose the 07:00 - 08:00 data once the 08:00 - 09:00 calculates. Will these be possible using your suggestion below? I have attached a screen shot of my front panel to show you the end result i am looking for. If you could show me exactly what kind of approach you mean, this would help me greatly.
Many thanks for your help so far.
stuart
ā10-26-2005 07:39 AM
Hi Stuart
I did something similar a while back. This is the approach I used.
Regards
ā10-26-2005 09:07 AM - edited ā10-26-2005 09:07 AM
Message Edited by Donald on 10-26-2005 10:08 AM
ā10-27-2005 12:48 AM
ā10-27-2005 10:32 AM
@stuart wrote:
... I'm afraid I can't see how the "Read Trace.vi" is connected with the timestamp. Could you (or any reader) please send me a screen shot of how this should be connected, or even a way of opening the file so that I can see the older code??
Sorry, Stuart. In LVDSCv6, there were seperate terminals for the Start and End times. In LVDSCv7, I think it was changed to a single terminal to which you have to feed a cluster consisting of the Start and End timestamps. Check the context help for 'Read Trace' to verify. If yes, then you just need to bundle the Start and End timestamps as per the attached mock up sceenshot, and check to make sure you get the bundle order correct.
Your icons for the VIs will probably be different since what are "traces" in v7 were "historical trends" in v6 (... and timestamp representation didn't exist either, time was either a U32 or DBL).
ā11-02-2005 04:22 AM