Example of setting up an event-based log

<< Click to Display Table of Contents >>

Manual > Server Creation Guide > Action Edition > Action Reference > Logger Action (Logging Only) >

Example of setting up an event-based log

overview

This section explains the simple setup procedure for actually using logger actions to perform event-based logging. Event-based logging is used when you want to log only when there is a change in the PLC state, such as operation history or alarm history.

 

The procedure introduced here can be broadly divided into the following four steps.

 

Step 1

Tag configuration

Configure the tags.

Step 2

Action Settings

Set the logger action

Step 3

Event Settings

Set the trigger Tag event.

Step 4

Operation check

Check whether the specified CSV file has been output correctly.

 

 

In this example, Special registers of the virtual device are used to detect changes in tag values from SD0000 to SD0009 using "Tag event", and each time the tag value changes, it is saved to a CSV file in the following format.
 

*The data is an output example.

time

Tag Name

value

2003/1/1 10:12:00

U01.F01.SD005

81

2003/1/1 10:12:01

U01.F01.SD001

163

2003/1/1 10:12:02

U01.F01.SD004

41

...

...

...

 

 

Step 1 (Tag setup)

1.Adding a unit
 
Right-click "Driver" in the tree on the left side of the screen to display the menu and select "Add Unit".
 
c_action_logger_0008
 
A selection dialog will appear, so select "Memory", "Virtual Communication", and "Virtual Device", and then click "OK".
 
c_action_logger_0009
 

 

2.Add Folder
 
Right-click "U01" to display the menu and select "Add Folder".
 
c_action_logger_0010
 
 

3.Add Tag
 
Right-click "F01" and select "Add Continuous Tags".
 
c_action_logger_0011
 
 

4.The Add Tags Continuously dialog will appear, so select "SD Special Register" and click "Next".
 
c_action_logger_0012
 
 

5.You will be shown how to create a tag name, but this time just click "Next" without setting anything.
 
c_action_logger_0013
 
 

6.Set "Number to create" to 10 and press "Done".
 
c_action_logger_0014
 
 

7.Please confirm that this operation has created 10 numeric tags, SD0000-SD0009.
 
c_action_logger_0015
 

 

Step 2 (Setting actions)

 

1.Adding a Logger Action
 
Right-click "Action" in the tree on the left side of the screen and select "Add" and "Action" from the menu.
 
c_action_logger_0003
 

 

2.From the Add Action dialog that appears, select "Logger (CSV)" and press "OK".
 
c_action_logger_0004
 

 

3.Log file settings
 
Right-click the added "A01" and select "Properties".
 
c_action_logger_0005

 

4.Log file settings
 
In the dialog that appears, set the file name to c:\event.csv as shown below and click "OK".
 
c_action_logger_0026
 

 

5.Adding a time field
 
Right-click on "A01" and select "Add" "Time Field" (this will add the time field "F01").
 
c_action_logger_0007
 

 

6.Adding an event field
 
Right-click "A01" again and select "Add" and "Event Field" twice to add two event fields.
 
This operation will result in three fields being added (time field, event field, event field) as shown below.
 
c_action_logger_0027
 

 

7.Event field settings (tag name)
 
Please set the field type to "Tag Name" in the properties of "F02".
This setting causes the tag name to be output in this field.
 
c_action_logger_0028
 

 

8.Setting event fields (tag values)
 
Next, set the field type to "Value" in the properties of "F03".
This setting causes the tag value to be output in this field.
 
c_action_logger_0029
 

 

Step 3 (Event setup)

1.Add a folder to an event
 
Right-click on "Event" from the tree on the left side of the screen and select "Add" and "Folder" from the menu.
Then, an "F01" folder will be added inside "Event".
 
c_action_logger_0030
 

 

2.Add Tag event
 
Define the tag you want to log based on value changes as Tag event.
Then, select the desired tags "SD0000" to "SD0009" from the multiview and drag and drop them into the "F01" folder.
 
c_action_logger_0031
 

 

3.Tag event Continuous addition
 
The following setting screen will be displayed. Here, leave the default settings and proceed by clicking the "Next" button, then select "Finish" to complete the settings.
 
c_action_logger_0032
 
c_action_logger_0033
 
c_action_logger_0034
 

 

4.This will create 10 Tag event in the "F01" folder.
 
c_action_logger_0035
 

 

5.Registering an execution action
 
Display the properties of the "F01" folder and add "A02" from the "Execution Actions" tab.
 
c_action_logger_0023
 

 

With this setting, if any one of the Tag event events contained in F01 occurs, the A01 action will be executed.
Each time the A01 action is called, it retrieves the necessary data from the tag and logs one record's worth of data according to the configured format.

 

 

hint

In this way, you can register execution actions for individual Tag event, but you can also register them all at once in a folder that groups all the events. For the 10 Tag event set up this time, the tag values of each are constantly monitored, and an event is generated when the value changes.

Each Tag event was created under the folder "F01", and by registering "A01" in the execution action settings of the "F01" folder, "A01" will be executed when even one event under the folder occurs.

 

 

Step 4 (Check operation)

Once steps 1 to 3 have been completed, perform logging to check operation.

Logging is performed by going "online"

 

Go online

 

Click "Online (Monitor)" (yellow arrow button) at the top of the FA-Server screen to go online.

 

c_action_0384

 

When you click "Action" in the tree on the left side of the screen while online, the number of times the action has been performed will be displayed in the list on the right. Check that this number is incremented every second.

 

c_action_logger_0024
 

 


 

Checking the log file

 

Once the number of executions after going online reaches an appropriate value, press the "Offline" button (black button) to go offline.

 

c_action_0385

 

When you return to the offline state, the logging process will stop. Check that the log file "eventyyyymmdd.csv" specified in the logger action settings has been created in the specified location, and open the file in a text editor to check that the log data is correct.

 

c_action_logger_0036