LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data from DSC module to create a pie chart

Wow thank you very much Robert for your time and answers.
 
Like you said, your answer are really brief, but I'll try to do it myself with what you gave me hehe
 
For the moment, my only question is about #5:
 
 
5) I'd like to have a log file for each day. Is there any way to change the name of the log file (put the date for the file name)?
You can specify the name of the file to which the data will be written.  There is a LabVIEW primitive, on the timing palette, which will give you the current date, and time, as a string which you can then use to create your log file.
 
 
I know how to create a string with the timing palette, but I don't know which VI from the DSC module function I need to use for this. Where's this log file in my computer?
 
Also I have a 😎 Is it normal that there's a long delay when I run my VI (there's almost nothing in it)? I guess it's because of the shared variable? But if I have 200 shared variable, is the delay going to be longer?
 
Thanx again!
Stephanie
0 Kudos
Message 21 of 48
(4,502 Views)


@Peachy wrote:
Wow thank you very much Robert for your time and answers.
 
Like you said, your answer are really brief, but I'll try to do it myself with what you gave me hehe
 
For the moment, my only question is about #5:
 
 
5) I'd like to have a log file for each day. Is there any way to change the name of the log file (put the date for the file name)?
You can specify the name of the file to which the data will be written.  There is a LabVIEW primitive, on the timing palette, which will give you the current date, and time, as a string which you can then use to create your log file.
 
 
I know how to create a string with the timing palette, but I don't know which VI from the DSC module function I need to use for this. Where's this log file in my computer?
 
Also I have a 😎 Is it normal that there's a long delay when I run my VI (there's almost nothing in it)? I guess it's because of the shared variable? But if I have 200 shared variable, is the delay going to be longer?
 
Thanx again!
Stephanie



Depending on whether you want the alarm data or the boolean data you would use:

  • For boolean data - Write Traces to Spreadsheet File.vi (last icon on the 2nd row)
  • For alarm/event data - Alarm & Event Query To Spreadsheet File.vi (2nd icon on the 3rd row)

Both of these VIs are located on the historical sub-palette of the DSC palette.  Also, in both cases you will be able to specify the file path to which your historical data will be written.

 

As for the delay in running the VI...can you post it here?  Then I can take a look at it and see if anything looks out of place.  The shared variable should not add a significant time to running the VI.

Regards,
Robert
0 Kudos
Message 22 of 48
(4,496 Views)
Arrggg.. few minutes ago, my code worked, but now nothing works haha
 
Well the delay is still there, so maybe you'll see why (Maybe it's the Alarm & Event Display.vi?)
 
Thanx again Robert
Stephanie
Download All
0 Kudos
Message 23 of 48
(4,491 Views)
Feel free to change my code!
 
You can see now how desperate I am haha
 
Thanx
Stephanie
0 Kudos
Message 24 of 48
(4,489 Views)
Mystery #1 solved...your startup delay is caused by the Alarm & Event Display (it's actually an activeX control, not a VI) initializing.  Still looking at the code.
Regards,
Robert
0 Kudos
Message 25 of 48
(4,478 Views)
Hi again Robert,
 
Thanx for the first mystery... it's sad that the Alarm & Event Display is so slow.
 
I fix few things in my code, but it still doing weird thing (probably because of the Even Structure), but it's the only way I found to do this. Any other idea?
 
 
Thank you
Stephanie
0 Kudos
Message 26 of 48
(4,465 Views)

Okay, I've created an example VI which, I hope, will help answer some of your issues.

This VI:

  • Reads a UInt16 shared variable (Variable 2 from your project file) whenever the value of that variable changes
  • Converts that value to an array of booleans
  • Writes one of those booleans to a new shared variable which is logged to Citadel (Variable 1 from your project file)
  • Reads the alarm history of the boolean value whenever its alarm state changes and displays selected information from the previous 24 hours on the front panel

This is a very simple illustration but it should help to get you past some of the rough spots...I have some commenting in the diagram including a necessary instruction for you before you use this.

 

Regards,
Robert
Message 27 of 48
(4,463 Views)

A couple notes from your VI...

Generally speaking, you should not use the database writing VIs on any variable which is being logged by the engine.  Best case, if the engine process is active, the writer VIs will not be able to get the write lock and will do nothing.  Worst case, you will make numerous unnecessary sub-traces which will degrade the database performance.

In order to use the event structure for shared variable value updates you must use the event structure support VIs from the DSC palette (I make use of these in the VI in my previous post.)  There is an excellent example that better shows how to use these VIs.  These VIs also allow you to get notified when alarms occur which will aid in minimizing the frequency in which you update your front panel indicator.  Testing shows that using this mechanism is pretty fast so it should work well for you.

I've asked a couple other people with greater knowledge than I about some of the other areas you asked about to look in on this thread when they have a moment so we may be able to provide you will additional insights in the future.

Regards,
Robert
Message 28 of 48
(4,461 Views)
Thank you very much Robert!
 
You help me a lot! Just give me few hours to understand what you did in your code hehe (it looks hard for a beginner like me)
 
Thanx for your time, you almost stay with me all day long..
 
You guys on this forum are so great, maybe one day I'll be good like you Smiley Wink
 
I'll probably ask few more questions tomorrow hehe
 
 
Stephanie
0 Kudos
Message 29 of 48
(4,459 Views)
Hi Robert
 
I've check your VI today and I think I understand everything.
But there's still a problem with it... when I run it, they don't display the alarms in the time interval we gave.
 
In the alarm history display, I can see alarms from June 22nd... but I'm suppose to see only the alarms from the last 24 hours. I don't understand why it does that because you put the right "start timestamp".
 
Any idea where is the problem?
 
 
Thank you
Stephanie
0 Kudos
Message 30 of 48
(4,442 Views)