Data Logging User Guide
Data Logging User Guide
EIO0000000551 04/2014
SoMachine
Data Logging Functions
DataLogging Library Guide
04/2014
EIO0000000551.03
www.schneider-electric.com
The information provided in this documentation contains general descriptions and/or technical
characteristics of the performance of the products contained herein. This documentation is not
intended as a substitute for and is not to be used for determining suitability or reliability of these
products for specific user applications. It is the duty of any such user or integrator to perform the
appropriate and complete risk analysis, evaluation and testing of the products with respect to the
relevant specific application or use thereof. Neither Schneider Electric nor any of its affiliates or
subsidiaries shall be responsible or liable for misuse of the information contained herein. If you
have any suggestions for improvements or amendments or have found errors in this publication,
please notify us.
No part of this document may be reproduced in any form or by any means, electronic or
mechanical, including photocopying, without express written permission of Schneider Electric.
All pertinent state, regional, and local safety regulations must be observed when installing and
using this product. For reasons of safety and to help ensure compliance with documented system
data, only the manufacturer should perform repairs to components.
When devices are used for applications with technical safety requirements, the relevant
instructions must be followed.
Failure to use Schneider Electric software or approved software with our hardware products may
result in injury, harm, or improper operating results.
Failure to observe this information can result in injury or equipment damage.
© 2014 Schneider Electric. All rights reserved.
2 EIO0000000551 04/2014
Table of Contents
Safety Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
About the Book. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Chapter 1 Data Logging. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Introduction to Data Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Configuring the Data Log. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Managing Data Log Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Additional Data Log File Information . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Adding LogRecord and Dump Function Blocks. . . . . . . . . . . . . . . . . . 19
Building a Wide WSTRING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Appendices ......................................... 21
Appendix A Function and Function Block Representation . . . . . . 23
Differences Between a Function and a Function Block . . . . . . . . . . . . 24
How to Use a Function or a Function Block in IL Language . . . . . . . . 25
How to Use a Function or a Function Block in ST Language . . . . . . . 28
Glossary ......................................... 31
Index ......................................... 33
EIO0000000551 04/2014 3
4 EIO0000000551 04/2014
Safety Information
Important Information
NOTICE
Read these instructions carefully, and look at the equipment to become familiar with the device
before trying to install, operate, or maintain it. The following special messages may appear
throughout this documentation or on the equipment to warn of potential hazards or to call attention
to information that clarifies or simplifies a procedure.
EIO0000000551 04/2014 5
PLEASE NOTE
Electrical equipment should be installed, operated, serviced, and maintained only by qualified
personnel. No responsibility is assumed by Schneider Electric for any consequences arising out of
the use of this material.
A qualified person is one who has skills and knowledge related to the construction and operation
of electrical equipment and its installation, and has received safety training to recognize and avoid
the hazards involved.
6 EIO0000000551 04/2014
About the Book
At a Glance
Document Scope
This guide explains the data logging functionality for controllers that support file management
operations.
Validity Note
This document has been updated with the release of SoMachine V4.0.
WARNING
LOSS OF CONTROL
The designer of any control scheme must consider the potential failure modes of control paths
and, for certain critical control functions, provide a means to achieve a safe state during and
after a path failure. Examples of critical control functions are emergency stop and overtravel
stop, power outage and restart.
Separate or redundant control paths must be provided for critical control functions.
System control paths may include communication links. Consideration must be given to the
implications of unanticipated transmission delays or failures of the link.
Observe all accident prevention regulations and local safety guidelines.1
Each implementation of this equipment must be individually and thoroughly tested for proper
operation before being placed into service.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
1
For additional information, refer to NEMA ICS 1.1 (latest edition), "Safety Guidelines for the
Application, Installation, and Maintenance of Solid State Control" and to NEMA ICS 7.1 (latest
edition), "Safety Standards for Construction and Guide for Selection, Installation and Operation of
Adjustable-Speed Drive Systems" or their equivalent governing your particular location.
EIO0000000551 04/2014 7
8 EIO0000000551 04/2014
SoMachine
Data Logging
EIO0000000551 04/2014
Chapter 1
Data Logging
Data Logging
Introduction
This document explains the data logging functionality for controllers that support file management
operations.
A data log is a text file of user-defined strings that contain application data information for a process
or machine. The data log file is stored on the controller. You can upload the file and open it with a
standard text editor. The information includes embedded variable values and their associated text.
Time and date stamping are additional options.
EIO0000000551 04/2014 9
Data Logging
Overview
You can monitor and analyze application data by examining the data log file (.log).
The figure shows an application that includes the 2 function blocks, LogRecord and Dump. The
LogRecord function block writes data to the buffer, which empties into the data log file (.log)
located into the controller’s memory. The buffer dumping is automatic when 80% full or it can be
forced by the Dump function. As a standard FTP client, a PC can access this data log file when the
controller acts as an FTP server. It is also possible to upload the file with SoMachine or by the
controller’s web server.
NOTE: Only controllers with file management functionality can support data logging. Refer to your
controller’s programming manual to see if it supports file management. The software itself does not
evaluate your controller for compatibility with data logging activities.
10 EIO0000000551 04/2014
Data Logging
Implementation Procedure
You must first declare and configure the data log files in your application before starting to write
your program.
EIO0000000551 04/2014 11
Data Logging
Step Action
1 In the Tools tree, select the Application node, click the green plus sign and select Add other
objects → DataLogManager....
Result: The Add Data Log Manager dialog box appears.
2 In the Add Data Log Manager dialog box, click Add.
Result: A DataLogManager node appears below the Application node.
3 Select the DataLogManager node, click the green plus sign, and select DataLog....
Result: The Add DataLog dialog box appears.
4 In the Data Logging File Name text box, enter a name for your data log file, and click Add.
Result: The data log file with the given name appears below the DataLogManager node, and
the configuration screen opens in the editor view in the middle of the SoMachine Logic Builder
screen.
Note: The data log file name cannot be changed later.
5 Set the data log file parameters (see page 12).
6 Repeat steps 3 to 5 to create additional data log files.
Configuration Screen
This configuration screen appears after you add a data log file to your configuration:
12 EIO0000000551 04/2014
Data Logging
Configuration Parameters
Parameter Description
Add Date These options print the respective date or time for each record. For example, an instance
associated with 10 June 2009 at 2:30 p.m. could be represented as 10/06/2009 or
Add Time
06/10/2009 or 20090610 ... at 14:30 or 02:30:00 pm, etc.
Max number of entries This option sets the maximum number of records contained in the data log file. Valid
values are from 10 to 65536. (The default is 10000.)
Mode Circular When the Max number of entries is reached, new records
(default) overwrite old records. The first line of the data log file can be used to
get the actual position of the last record as well as the rank of other
records. The following cases are based on a file with a 10-record
maximum:
Case 1: Entries in File: 8; Last Entry: 8
Meaning: The number of entries in the file equals the value of
Last Entry. The records are ranked from N° 1 (the oldest) to N° 8
(the most recent).
Case 2: Entries in File: 10; Last Entry: 5
Meaning: The number of entries in the file is greater than the value
of Last Entry. The file is full and a new record replaces the oldest
one in the file. The 10 records are ranked in this order (oldest to
newest): 6, 7, 8, 9, 10, 1, 2, 3, 4, 5
Stop when full When the Max number of entries is reached, a new record
attempt returns a detected error message.
Internal Buffer Size Configure the size of the RAM buffer that stores the added records. Valid values are
from 1 to the value configured in Max number of entries. (The default is 10.)
Max characters per entry Set the maximum length of each entry. Valid values are from 10 to 255. (The default
(optimization) is 64.)
The maximum length includes separators and optional date and time. Additional spaces
are added at the end of the line to accommodate the number of defined characters.
Separator between date, Define the character to be inserted between different fields in the data log. An additional
time and record separator is added after the record.
NOTE: For each configured data log file, there is a LogRecord function block instance with the same name as this
data log file that handles all internal data and allows data logging management.
EIO0000000551 04/2014 13
Data Logging
Introduction
One function block, LogRecord, is provided for writing text string entries to the data log file. This
function block stores the input string in an internal buffer. When this buffer reaches 80 % of
capacity, it is moved to the real file on the controller. You can force this save mechanism by using
the Dump function block.
When power is removed, you may lose the data in the internal buffer or increase the cycle time
until the buffer is emptied.
NOTICE
LOSS OF DATA
Do not remove power to the controller until all internal buffer information has been moved to
the actual file system.
If the data being recorded is important to your application, configure your internal buffer size
to 1.
Failure to follow these instructions can result in equipment damage.
Input Parameters
14 EIO0000000551 04/2014
Data Logging
Output Parameters
The LogRecord function block includes an instance that corresponds to each configured data log
file. You do not need to explicitly declare an instance of the function block because the instance is
declared automatically. Add the function block to your POU and specify the appropriate data log
file instance with input help (see Adding LogRecord (see page 19)).
EIO0000000551 04/2014 15
Data Logging
Parameters
Refer to Adding a Dump Method (see page 19) for the Dump method implementation.
16 EIO0000000551 04/2014
Data Logging
In the case of either an explicit (Dump) or automatic (80 %) save, the data log file closes after each
record (or record group) in case there is a subsequent external power failure.
EIO0000000551 04/2014 17
Data Logging
< Data Log File name > .DumpInProgress BOOL TRUE when the buffered records are
being saved in the data log file
Recommendation
The LogRecord function block needs much more than 15 interval cycles after its activation (with
xExecute) to save a record in the logfile. Therefore, it is fort recommended to use this function
block within a FAST task:
18 EIO0000000551 04/2014
Data Logging
Overview
Follow these steps to add the LogRecord function block and Dump method to your project.
Adding LogRecord
Add the LogRecord function block to your project:
EIO0000000551 04/2014 19
Data Logging
Overview
The wsRecord input of the LogRecord function block is of the type WSTRING (wide string). To
build the log string, you must first add the Standard64 library to your application and use wide
string functions.
Example
This figure shows the creation of a sample WSTRING that includes a variable value:
20 EIO0000000551 04/2014
SoMachine
EIO0000000551 04/2014
Appendices
EIO0000000551 04/2014 21
22 EIO0000000551 04/2014
SoMachine
Function and Function Block Representation
EIO0000000551 04/2014
Appendix A
Function and Function Block Representation
Overview
Each function can be represented in the following languages:
IL: Instruction List
ST: Structured Text
LD: Ladder Diagram
FBD: Function Block Diagram
CFC: Continuous Function Chart
This chapter provides functions and function blocks representation examples and explains how to
use them for IL and ST languages.
EIO0000000551 04/2014 23
Function and Function Block Representation
Function
A function:
is a POU (Program Organization Unit) that returns one immediate result.
is directly called with its name (not through an instance).
has no persistent state from one call to the other.
can be used as an operand in other expressions.
Function Block
A function block:
is a POU (Program Organization Unit) that returns one or more outputs.
needs to be called by an instance (function block copy with dedicated name and variables).
each instance has a persistent state (outputs and internal variables) from one call to the other
from a function block or a program.
Examples: timers, counters
In the example, Timer_ON is an instance of the function block TON:
24 EIO0000000551 04/2014
Function and Function Block Representation
General Information
This part explains how to implement a function and a function block in IL language.
Functions IsFirstMastCycle and SetRTCDrift and Function Block TON are used as
examples to show implementations.
Step Action
1 Open or create a new POU in Instruction List language.
NOTE: The procedure to create a POU is not detailed here. For more information refer to Adding,
Declaring an Calling POUs.
2 Create the variables that the function requires.
3 If the function has 1 or more inputs, start loading the first input using LD instruction.
4 Insert a new line below and:
type the name of the function in the operator column (left field), or
use the Input Assistant to select the function (select Insert Box in the context menu).
5 If the function has more than 1 input and when Input Assistant is used, the necessary number of lines
is automatically created with ??? in the fields on the right. Replace the ??? with the appropriate
value or variable that corresponds to the order of inputs.
6 Insert a new line to store the result of the function into the appropriate variable: type ST instruction
in the operator column (left field) and the variable name in the field on the right.
To illustrate the procedure, consider the Functions IsFirstMastCycle (without input parameter)
and SetRTCDrift (with input parameters) graphically presented below:
EIO0000000551 04/2014 25
Function and Function Block Representation
IL example of a function
with input parameters:
SetRTCDrift
Step Action
1 Open or create a new POU in Instruction List language.
NOTE: The procedure to create a POU is not detailed here. For more information refer to Adding,
Declaring an Calling POUs.
2 Create the variables that the function block requires, including the instance name.
3 Function Blocks are called using a CAL instruction:
Use the Input Assistant to select the FB (right-click and select Insert Box in the context menu).
Automatically, the CAL instruction and the necessary I/O are created.
4 In the CAL right-side field, replace ??? with the instance name.
5 Replace other ??? with an appropriate variable or immediate value.
26 EIO0000000551 04/2014
Function and Function Block Representation
To illustrate the procedure, consider this example with the TON Function Block graphically
presented below:
In IL language, the function block name is used directly in the operator column:
EIO0000000551 04/2014 27
Function and Function Block Representation
General Information
This part explains how to implement a Function and a Function Block in ST language.
Function SetRTCDrift and Function Block TON are used as examples to show implementations.
Step Action
1 Open or create a new POU in Structured Text language.
NOTE: The procedure to create a POU is not detailed here. For more information refer to Adding,
Declaring and Calling POUs .
2 Create the variables that the function requires.
3 Use the general syntax in the POU ST Editor for the ST language of a function. The general
syntax is:
FunctionResult:= FunctionName(VarInput1, VarInput2,.. VarInputx);
To illustrate the procedure, consider the function SetRTCDrift graphically presented below:
28 EIO0000000551 04/2014
Function and Function Block Representation
Step Action
1 Open or create a new POU in Structured Text language.
NOTE: The procedure to create a POU is not detailed here. For more information on
adding, declaring and calling POUs, refer to the related documentation.
2 Create the input and output variables and the instance required for the function block:
Input variables are the input parameters required by the function block
Output variables receive the value returned by the function block
3 Use the general syntax in the POU ST Editor for the ST language of a Function
Block. The general syntax is:
FunctionBlock_InstanceName(Input1:=VarInput1,
Input2:=VarInput2,... Ouput1=>VarOutput1,
Ouput2=>VarOutput2,...);
To illustrate the procedure, consider this example with the TON function block graphically
presented below:
EIO0000000551 04/2014 29
Function and Function Block Representation
30 EIO0000000551 04/2014
SoMachine
Glossary
EIO0000000551 04/2014
Glossary
B
byte
A type that is encoded in an 8-bit format, ranging from 16#00 to 16#FF in hexadecimal
representation.
C
CFC
(continuous function chart) A graphical programming language (an extension of the IEC 61131-3
standard) based on the function block diagram language that works like a flowchart. However, no
networks are used and free positioning of graphic elements is possible, which allows feedback
loops. For each block, the inputs are on the left and the outputs on the right. You can link the block
outputs to the inputs of other blocks to create complex expressions.
F
FB
(function block) A convenient programming mechanism that consolidates a group of programming
instructions to perform a specific and normalized action, such as speed control, interval control, or
counting. A function block may comprise configuration data, a set of internal or external operating
parameters and usually 1 or more data inputs and outputs.
FBD
(function block diagram) One of the 5 languages for logic or control supported by the standard IEC
61131-3 for control systems. Function block diagram is a graphically oriented programming
language. It works with a list of networks where each network contains a graphical structure of
boxes and connection lines representing either a logical or arithmetic expression, the call of a
function block, a jump, or a return instruction.
I
IL
(instruction list) A program written in the language that is composed of a series of text-based
instructions executed sequentially by the controller. Each instruction includes a line number, an
instruction code, and an operand (refer to IEC 61131-3).
INT
(integer) A whole number encoded in 16 bits.
EIO0000000551 04/2014 31
Glossary
L
LD
(ladder diagram) A graphical representation of the instructions of a controller program with symbols
for contacts, coils, and blocks in a series of rungs executed sequentially by a controller (refer to
IEC 61131-3).
P
POU
(program organization unit) A variable declaration in source code and a corresponding instruction
set. POUs facilitate the modular re-use of software programs, functions, and function blocks. Once
declared, POUs are available to one another.
S
ST
(structured text) A language that includes complex statements and nested instructions (such as
iteration loops, conditional executions, or functions). ST is compliant with IEC 61131-3.
V
variable
A memory unit that is addressed and modified by a program.
32 EIO0000000551 04/2014
SoMachine
Index
EIO0000000551 04/2014
Index
D O
data logging, 9 Output Parameter Type
Dump ERROR, 15, 16
Function Block, 16
DumpInProgress
Variables, 18 T
Type
FILE_STATUS, 18
E
ERROR
Output Parameter Type, 15, 16 V
Variables
DumpInProgress, 18
F FileStatus, 18
FILE_STATUS NumberOfBufferedRecords, 18
Type, 18 NumberOfRecords, 18
FileStatus
Variables, 18
Function Block
Dump, 16
LogRecord, 14
functions
differences between a function and a
function block, 24
how to use a function or a function block
in IL language, 25
how to use a function or a function block
in ST language, 28
L
LogRecord
Function Block, 14
N
NumberOfBufferedRecords
Variables, 18
NumberOfRecords
Variables, 18
EIO0000000551 04/2014 33
Index
34 EIO0000000551 04/2014