Best way to enable logging after plc boot


#1

Hi friends,
i have a question about enabling historical logging on ewon flexy after the plc has booted up only.
I have an s7-300 that at startup via OB100 initialize some values in some db.
At the end of the OB100 i have a merker that is set to 1 to inform that the first plc cycle is finished,
i want to enable the historical logging only in this condition because before that i log inconsistent data.

The way to iterate via script to all tags and enable the historical logging on each tag is not praticable because not all tags have the historical logging enabled ;

I’m trying to disabling the 3 topics in the io-server via a script using:

SETSYS SYS,“IOSrvData1:EnabledA”,“0”
SETSYS SYS,“IOSrvData1:EnabledB”,“0”
SETSYS SYS,“IOSrvData1:EnabledC”,“0”

so normally i have only the Topic A enabled, and i have only a tag configured on the Topic A to monitoring when the OB100 finish the first plc cycle; when the tag change from 0 to 1 i enable via script the other 2 topics that are configured in all other my tags.

is this the best way to enable/disable all the history logging or there are some other way?

regards


#2

Hello,

This would be the best option I can think of off hand. If you wanted to get a little more complex you could use set the tags you want to enable logging for to a particular tag page. You would then load the tag list and iterate though checking the page before make the enabling logging.

It would look something like this:

SETSYS SYS, "LOAD"
//get tag count
C% = GETSYS PRG,"NBTAGS"

For i%=0 To (C%-1)
  Setsys Tag,"load",-i%
  P$ = Getsys Tag,"PageId"
  //only update tags in page 3 
  If Val(P$) = 3 Then
    //Do something
  Endif
Next i%

#4

Hi deryck
thank you for your answer!
It’s there a way to read the name of the page instead the page id?

i’m trying my script on the firmware 13.1 PR and i have this error:
Operation Failed (28) 22 :SETSYS SYS,“IOSrvData1:EnabledB”,“1”


#5

Hello @iw3bti1,

After correcting the quotes I was able to run that line with out issue.

IOserver:
  SETSYS SYS, "load"
  A$ = GETSYS SYS, "IOSrvData1:EnabledA"
  print A$
  SETSYS SYS,"IOSrvData1:EnabledA","0"
  A$ = GETSYS SYS, "IOSrvData1:EnabledA"
  print A$
END