Controlling start/stop of logging

<< Click to Display Table of Contents >>

Manual > Monitoring system construction guide > Establishing major functions > Logging/trend graph > Using logger actions > Collection of logger action samples >

Controlling start/stop of logging

overview

This article explains how to set up Tag event to control the start and stop of logging. As an example, we will log at 1-second intervals only between 8:00 and 18:00 from Monday to Friday. We will also introduce how to dynamically switch the logging sampling rate as a sample application example.

 

c_action_logger_0055

 

 

Download the sample

The creation examples shown on this page are provided with samples.

 

The sample can be downloaded from below.

 

 

 

Setup Procedure

Tag configuration

 

1.Set the virtual device tags "U01.F01.SD0000" to "U01.F01.SD0009" to be logged.
 
c_action_logger_0056
 
 

2.Set the memory device tag (time bit tag) "U02.F01.T01" to trigger the start and stop of logging.
 
c_action_logger_0057
 
 

3.The time bit tag on the memory device is set to 8:00:00 to 17:59:59, Monday through Friday.
 
c_action_logger_0058

 

 

 


Action Settings

 

1.Add logger action "A01" and script Ver1 action "A02".
 
A01: Set the following fields:
Time field
・Tag field (*Drag and drop "SD0000" to "SD0009" to "A01")
 
c_action_logger_0050
 

 

2.From the Text Settings tab of A01, set the file name and destination of the log file (below is an example setting).
 

p_logger_0001

 

 

3.In the A02 script, set "//Event/E01!Enable = U02.F01.T01".
 
c_action_logger_0059
 

 

 


Event Settings

 

1.Add Periodic event "E01" and Tag event "E02".
 
E01...Set the cycle to 1 second and set the execution action to "A01". Check "Disable" to disable the initial state.
 
E02...Set the tag to "U02.F01.T01", the comparison condition to "Tag value has changed", and the execution action to "A02".
 
c_action_logger_0060

 

 

Commentary

The time bit tag of a memory device is a bit that can be turned ON only at a specified time or for a specified period of time. In this setting, it will be turned ON from 8:00 to 18:00.

 

c_action_logger_0055

 

(1) Turn on at 08:00

1.When U02.F01.T01 turns ON, Tag event "E02" occurs and script Ver1 action "A02" is executed.

2.In "A02", the formula "//Event/E01!Enable = U02.F01.T01" is executed, Periodic event "E01" is enabled, and logging at 1-second intervals begins.
This expression switches the enable state of "E01", enabled when it is 1 and disabled when it is 0. Since the state of "U02.F01.T01" is ON (1) at this time, "//Event/E01!Enable" is set to "1".

 

(2) Turn off at 18:00

1.When U01.F01.T01 becomes OFF, Tag event "E02" occurs and script Ver1 action "A02" is executed.

2.In "A02", the formula "//Event/E01!Enable = U02.F01.T01" is executed, Periodic event "E01" is disabled, and logging stops.

 

 

hint

E01!Enable is one of the system properties that an event has.

 

 

Examples of applications of this sample

This time we used a time bit tag, but by using a tag that communicates with PLC instead of a time bit tag, you can control the start and end of logging by a trigger from PLC. Also, if you want to dynamically switch the log sampling rate, such as when you want to intensively log at a fast cycle only when an abnormal condition is detected, you can achieve this by preparing two Periodic event, one for high speed and one for low speed, and switching the enable and disable of each event with a script action.

 

Specifically, set it as in the example below. In this example, when "U02.F01.T01" is ON, logging will be done at high speed, and when it is OFF, logging will be done at low speed.

example)

"EVENT_HI" Periodic event (for fast logging)

Set the cycle for high speed.

Check "Disable" to disable the initial setting.

Set the execution action to "A01".

 

"EVENT_LO" Periodic event (for slow logs)

Set the cycle for low speed.

Check "Disable" to disable the initial setting.

Set the execution action to "A01" as in the example above.

 

"A02" Script Action

//Event/EVENT_HI!Enable = U02.F01.T01

//Event/EVENT_LO!Enable = Not U02.F01.T01

 

*The "Not" in "Not U02.F01.T01" inverts True/False.