Page 1 of 1
Globals.DataLogger1.LogItems(); usage?
Posted: Thu Nov 01, 2012 3:17 am
by memethemyn
Hi..
For an automatic data logging project I must use a rising edge triggered datalogging..
So I want to use this script but always it returned me error..
Would anybody help me to usage of this script.
Thanks..[/b]
Re: Globals.DataLogger1.LogItems(); usage?
Posted: Thu Nov 01, 2012 7:58 am
by mark.monroe
You should associate a tag with the datalogger's "Log on Tag event". When that tag's value changes, the datalogger will log data.
HMI's are not fast enough to allow you to log data on "rising edges" or "falling edges". HMI's are not realtime systems therefore there is an arbitrary time lag between when you tell the system to log data and the system actually logs data. Plus, the HMI can only poll tags at a maximum rate of 20-100 ms. Which means that the data that you are logging is not the exact data that is in the memory address of the controller.
- Snap 2012-11-01 at 07.57.01.jpg (36.21 KiB) Viewed 14954 times
Re: Globals.DataLogger1.LogItems(); usage?
Posted: Thu Nov 01, 2012 8:58 am
by memethemyn
Ok..
First thanks for your information but I dont want to log data very fast.. I only want to log data in some variable conditions..
For example in the system I want to log in this situations..
1. situation:
Log on Tag5
2. situation:
log on tag6 when tag4's value is 1
then I try to write codes because in scripting it will be very simple but I didin't find the code to log once into datalogger1..
I hope to tell myself
PS: I try to use expressions.. But didnt work..
Re: Globals.DataLogger1.LogItems(); usage?
Posted: Thu Nov 01, 2012 9:22 am
by mark.monroe
To log once, just change the value of the tag associated with the "Log on Tag event". Everytime that tag's value is changed, it will log once and only once.
Only change that tag's value when you want it to log. Change the value of that tag in your script. Write a set of if statements and in those if statements decide whether or not to change the tag associated with the "Log on Tag event".
Rather than calling a function to force the data logger to log, you change the value of tag associated with the "Log on Tag event". You can add 1 to that tag for example.
If you follow my previous post, it will do exactly what you want.
Re: Globals.DataLogger1.LogItems(); usage?
Posted: Thu Nov 01, 2012 10:01 am
by memethemyn
ok..
so the datalogger logs when the tag goes to set and logs again when goes to reset..
Here is a database export file.. When I try to Log on event the logger takes two values..
some of logs which I desired and some of logs that I dont desire.
It is very bad not to use logOnce in script
Re: Globals.DataLogger1.LogItems(); usage?
Posted: Thu Nov 01, 2012 11:54 am
by mark.monroe
The logger logs when the value of the tag associated with the "log on tag event" changes value. Any change causes it to log. You can therefore add 1 to the tag and every time 1 is added, it will log.
From your data I can not tell whether or not it is logging twice. Please use a tag to trigger your logger that is an int and then log that tag's value along with the other data you are logging.
If it logs twice you will see the tag associated with the "log on tag event" with the same number twice.
Re: Globals.DataLogger1.LogItems(); usage?
Posted: Thu Nov 01, 2012 12:18 pm
by memethemyn
so when I will use an analog value in "Log on tag event" the problem will be solved.. is it true ?
Re: Globals.DataLogger1.LogItems(); usage?
Posted: Thu Nov 01, 2012 1:20 pm
by mark.monroe
From your excel document, I can not tell whether the datalogger is logging twice or not. You could simply have a bug in your program where you mistakenly tell the datalogger to log twice.
You need to show me evidence that the datalogger is actually logging data twice when you change the "log on event" tag only once.
Re: Globals.DataLogger1.LogItems(); usage?
Posted: Fri Nov 02, 2012 12:49 am
by memethemyn
Dear Mark..
I created a tag as named "LOGCounter" as int16. So when the situaitons happened I increase the Logcounter. The mistake ı made I only think the log on event as a bit..
Thank for your helps..
Re: Globals.DataLogger1.LogItems(); usage?
Posted: Mon Nov 05, 2012 11:48 am
by jcjelektro
Hello
I have the same problem with 2 log entry's when i logged from a button.
I have a simple solution for that.
Go to Tags, Select the tag you want to use. Fx. "TAG3"
Select Action, Then add a condition Fx. (==1), and then Add the Action, Datalogger, Log ONCE, then select the Datalogger you want to log.
- datalogger.png (245.68 KiB) Viewed 14891 times
In the datalogger set it to Log in Tag event, But use another tag, there is not used, and not will be used! Fx. "not_used"
- datalogger2.png (193.41 KiB) Viewed 14891 times
Forget about start /stop logging, it will work this way, so you only log once, each time you press the button/tag is =1.
- Emil