<< 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.
Tag configuration |
Configure the tags. |
|
Action Settings |
Set the logger action |
|
Event Settings |
Set the trigger Tag event. |
|
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 |
... |
... |
... |
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".
A selection dialog will appear, so select "Memory", "Virtual Communication", and "Virtual Device", and then click "OK".
2.Add Folder
Right-click "U01" to display the menu and select "Add Folder".
3.Add Tag
Right-click "F01" and select "Add Continuous Tags".
4.The Add Tags Continuously dialog will appear, so select "SD Special Register" and click "Next".
5.You will be shown how to create a tag name, but this time just click "Next" without setting anything.
6.Set "Number to create" to 10 and press "Done".
7.Please confirm that this operation has created 10 numeric tags, SD0000-SD0009.
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.
2.From the Add Action dialog that appears, select "Logger (CSV)" and press "OK".
3.Log file settings
Right-click the added "A01" and select "Properties".
4.Log file settings
In the dialog that appears, set the file name to c:\event.csv as shown below and click "OK".
5.Adding a time field
Right-click on "A01" and select "Add" "Time Field" (this will add the time field "F01").
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.
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.
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.
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".
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.
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.
4.This will create 10 Tag event in the "F01" folder.
5.Registering an execution action
Display the properties of the "F01" folder and add "A02" from the "Execution Actions" tab.
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.
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. |
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.
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.
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.
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.