# Calculating the Size of Data to Save

You can check the size of each piece of data that is stored in backup memory (SRAM) or external storage from the system settings editing screen.

For calculating the size of each data, see the following.

- Alarm
- Data Logging
- Operation Log
- Variable Values (Retentive Variables)

Note: The save destination for variable values (retentive variables) is limited to backup memory (SRAM).

## Alarm

(Unit: Bytes)

Header (3072) + ActiveAlarms + AlarmLog + SystemErrors (2048)

- ActiveAlarms = (Total number of alarms in all Alarm Groups × ([Alarm Behavior]*1 + Total size of all variables in all Alarm Groups*2) / 1024 )*3 × 1024
- AlarmLog = ([Max Record]*4 × (31 + Largest variable size*5) / 1024)*3 × 1024

*1 65 when [Optional ACK] is selected as the [Alarm Behavior], 73 when [Mandatory ACK] is selected.

*2 The variable size depends on the data type. Refer to the Variable Sizes table below.

*3 Round up decimal points.

*4 The value of the [Max Record] property of [All Alarms].

*5 This is the size of the largest data type among the variables. For information on the size of variable data types, refer to the Variable Sizes table below. When the alarm setting is disabled, the largest variable size is 0.

Variable Sizes

Data Type | Size (Bytes)
BOOL | 1
BYTE | 3
WORD | 5
DWORD | 10
LWORD | 20
SINT | 4
USINT | 3
INT | 6
UINT | 5
DINT | 11
UDINT | 10
LINT | 20
ULINT | 20
REAL | 20
LREAL | 20

## Data Logging

When Logging is disabled, the data size is 0.

(Unit: Bytes)

Header + LoggingGroups + StartLogs + LoggingState (1024)

- Header = ((H_LoggingGroups + H_LoggingGroup_Views + H_LoggingGroup_Startlog + H_Logging_state) / 1024) *1 × 1024 + HeaderEmptySpace
  - H_LoggingGroups = Total size of all Logging Groups
    Logging Group = 172 + 42 × Number of variables in Logging Group
  - H_LoggingGroup_Views = Total size of all LoggingGroup_View
    LoggingGroup_View = 213 + 33 × Number of variables in Logging Group
  - H_LoggingGroup_Startlog = 176 × Number of Logging Groups
  - H_Logging_state = 144
  - HeaderEmptySpace = 1024 if ((H_LoggingGroups + H_LoggingGroup_Views + H_LoggingGroup_Startlog + H_Logging_state) / 1024) is 2 or more; otherwise, 0.
- LoggingGroups = Total size of Logging Groups
  If (26 + Sum of (variable size*2 + 1) for each variable) is 512 or less:
  Logging Group = ([Max Record] *3 / (1024 / (26 + Sum of (variable size*2 + 1) for each variable))*4)*1 × 1024 + LoggingGroupEmptySpace
  Otherwise:
  Logging Group = ((26 + Sum of (variable size*2 + 1) for each variable) / 1024)*1 × [Max Record] *3 × 1024 + LoggingGroupEmptySpace
  - LoggingGroupEmptySpace = 1024 if (((26 + Sum of (variable size*2 + 1) for each variable) × [Max Record] *3) / 1024) is 2 or more; otherwise, 0.
- StartLogs = Sum of LoggingGroup_Startlogs:
  LoggingGroup_Startlog = (24 × [Max Record] *3 /1024)*1 × 1024 + StartlogEmptySpace
  - StartlogEmptySpace = 1024 if ((24 × [Max Record]*3) / 1024)*1 is 2 or more; otherwise, 0.

*1 Round up decimal points.

*2 The variable size depends on the data type. Refer to the Variable Sizes table below.

*3 The value of the [Max Record] property of [Logging Group].

*4 Round down decimal point.

Variable Sizes

Data Type | Size (Bytes)
BOOL | 1
BYTE | 2
WORD | 3
DWORD | 10
LWORD | 20
SINT | 1
USINT | 2
INT | 2
UINT | 3
DINT | 4
UDINT | 10
LINT | 20
ULINT | 20
REAL | 20
LREAL | 20
STRING | [Number of Bytes] + 1
WSTRING | [Number of Bytes] + 1
TIME | 4
TIME_OF_DAY | 4
DATE | 4
DATE_AND_TIME | 4

## Operation Log

When Operation Log is disabled, the data size is 0.

(Unit: Bytes)

Header (1024) + ((478 × [Max Record*1] / 1024)*2 × 1024) + EmptySpace

- EmptySpace = 1024 if (478 × [Max Record*1] / 1024) is 2 or more; otherwise, 0.

*1 The value of the [Maximum Number of Records] property of [Operation Log].

*2 Round up decimal point.

## Variable Values (Retentive Variables)

When the [Retentive] property with a variable is disabled, the data size is 0.

(Unit: Bytes)

Header (1024) + ((RetentiveVariables / 1024)*1 × 1024) + EmptySpace

- RetentiveVariables = Total size of variables with the [Retentive] property enabled
  Retentive Variable = Header (7) + ID (2) + Variable size*2
- EmptySpace = 1024 if (Retentive Variables / 1024) is 2 or more; otherwise, 0.

*1 Round up decimal points.

*2 The variable size depends on the data type. Refer to the Variable Sizes table below.

Variable Sizes

Data Type | Size (Bytes)
BOOL | 1
BYTE | 3
WORD | 5
DWORD | 10
LWORD | 20
SINT | 4
USINT | 3
INT | 6
UINT | 5
DINT | 11
UDINT | 10
LINT | 21
ULINT | 20
REAL | 20
LREAL | 20
STRING | [Number of Bytes] x 2 + 2
TIME | 11
TIME_OF_DAY | 10
DATE | 10
DATE_AND_TIME | 10