Example of general log settings

<< Click to Display Table of Contents >>

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

Example of general log settings

overview

Here we will explain a simple setup procedure for performing periodic logging using a logger action.

 

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 Periodic event.

Step 4

Operation check

Check whether the specified CSV file has been output correctly.

 

 

In this example, we will use Virtual device special registers to save the tag values from SD0000 to SD0009 every second to a CSV file as log data.

*The data is an output example.

time

SD0000

SD0001

...

SD0008

SD0009

2003/1/1 10:12:00

0

0

...

0

0

2003/1/1 10:12:01

0

0

...

0

0

2003/1/1 10:12:02

0

0

...

0

0

...

...

...

...

...

...

 

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 Tags Continuously".
 
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, so do not set anything this time and just click "Next".
 
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.In the dialog that appears, set the file name to "c:\text.csv" and click "OK."
 
c_action_logger_0006
 

 

5.Adding a time field
 
Right-click "A01" to display the menu, select "Add" and "Time Field" to add "F01".
 
c_action_logger_0007
 

 

6.Adding a Tag Field
 
Define the tag fields to be included in the log data. From the multiview, select the tags you want to include in the log, "SD0000" to "SD0009", and drag and drop them onto "A01".
 
c_action_logger_0016
 
 

7.When you drop the tag, the following setting screen will be displayed.
 
Here, leave the default settings and click the "Next" button to move on to the next step, then select "Finish" to complete the settings.
 
c_action_logger_0017
 
c_action_logger_0018
 
 

8.Please confirm that fields "U01_F01_SD0000" to "U01_F01_SD0009" have been created.
 
c_action_logger_0019
 
 
The above is the format of the log CSV file. The time field is at the beginning, followed by the values SD0000 to SD0009, separated by commas.
If you want to change the order of fields, right-click the field to display the menu and move it "Up" or "Down".
 

 

Step 3 (Event setup)

1.Add Periodic event
 
Right-click on "Event" in the tree on the left side of the screen to display the menu, then select "Add" and "Periodic event" from the menu.
 
This will add an event called "E01".
 
c_action_logger_0020

 

2.Event Settings
 
Right-click "E01" in the multiview and display "Properties".
 
c_action_logger_0021
 

 

3.On the "Periodic event" tab, make sure 1 second is set.
 
The default setting is 1 second.
 
c_action_logger_0022
 

 

4.In the Execution Actions tab, register the actions to be executed from this event.
 
Here, please register the "A01" you created earlier.
 
c_action_logger_0023
 
This will cause the logger action "A01" to be executed every second when an event occurs.

 

 

hint

The Periodic event "E01" configured here will occur periodically, once every second. By adding "A01" to the execution action settings, "A01" will be executed once every second. As a result, each time "A01" is called, it will retrieve the data required for logging from the tag and log one record's worth of data according to the configured format.

 

 

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.
 

* If you run it by clicking the "Online (Debug)" button (red button), the values of the special registers of the virtual device will not change, so please run it by clicking the "Online (Monitor)" button (yellow button).

 

c_action_logger_0024
 

 

hint

If you execute the command in "Online (Debug)" (red arrow button), the special register values of the virtual device will not change. When executing the above command, please execute the command in "Online (Monitor)" (yellow arrow button).

 

 


 

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 "textyyyymmdd.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_0025