Skip to main content

Memory Computation

Memory computation is used to maintain memory variables under the Memory device (virtual device inside the gateway). Memory variables do not directly connect to field devices and are usually used to store script calculation results, intermediate values in rule flow, internal status, statistics, or data that needs to be reused within the gateway.

First Look at Terms

TerminologyOn-site Understanding
Memory deviceA virtual device inside the gateway. It does not connect to a PLC, instrument, or serial port.
Memory variablesInternal gateway points, which can store calculation results, temporary status, statistics, or manually written values.
Read expressionA rule for calculating or reading a memory variable. When empty, the variable does not update automatically through calculation.
Write expressionA rule applied when a value is written. It can validate, convert, or link the value to another variable.
Execution intervalThe interval between periodic calculation or refreshing of memory variables. Too short a gap increases CPU pressure.
Value FilteringFilters outliers, jump values, or values that exceed the range to avoid false alarm triggers or forwarding.
Alarm suppressionWhen suppression conditions are met, the alarm is temporarily not triggered; it is commonly used to reduce invalid alarms during maintenance, shutdown, or interlock states.

Function Entry

After logging into GatewayRuntime Web, click the menu on the left "Develop Configuration → Memory Calculation."

Memory Calculation Page

Before you start

  • Decide whether each variable is updated by a manual write, a read expression, a script, or a rule flow. Avoid multiple sources overwriting one value.
  • Confirm the variable name, data type, unit, initial value, execution interval, and read/write permission.
  • If a script, rule, or forwarding group references the variable, keep its name stable after it goes live.
  • Review the execution interval before enabling many high-frequency calculations, so CPU usage remains controlled.

Page Structure

RegionDescription
Filter AreaFilter memory variables by variable name, read expression, and state.
Operation AreaDisplays the total data count, providing refresh, new variable, column settings, variable import, variable export, and export everything.
Variable TableDisplays variable runtime values and configuration summaries under the Memory device.
Batch Operation BarDisplays after checking variables, allowing batch editing or batch deletion.
Pagination barSwitch pages and the number of rows displayed per page.

Variable List

ColumnDescription
Variable NameMemory Variable Name. Naming should be stable and avoid frequent modifications after being referenced by scripts, rules, or forwarded configurations.
DescriptionExplanation of variable usage.
Current ValueThe current value of the variable.
Original valueOriginal value before conversion or formatting.
Data TypeData type configured by variable.
Runtime Data TypeData type corresponding to the current runtime.
Read ExpressionsExpressions used to calculate or read variable values.
Online statusDisplays whether the variable is currently normal.
Collection timeThe time when the variable value was last updated.
Change timeThe time when the variable value last changed.
Error messageError details when calculation or update fails.
OperationsView details, write, edit, copy, or delete variables.

Add and Edit Variables

After clicking "Add Variable," the variable configuration popup will open on the page. Variables created on memory calculation pages belong to memory devices by default, without needing to select channels or collection devices.

Configuration ItemDescription
Variable NameRequired. It is recommended to use English, numbers, and underlines to facilitate script and rule references.
Assigned devicefixed to Memory device.
UnitEngineering unit for variable values.
Enableto control whether variables participate in running.
DescriptionExplanation of variable usage.
Read and write permissionsControl whether variables allow read, write, or read/write access.
Execution intervalThe interval used for periodic calculation or refresh.
Read expression parametersSelect or fill in memory variables to calculate the expression parameters used.
Write expression parametersFill in when you need to handle the write value.
Remarks fieldcan be used for business expansion, grouping, encoding, or external system mapping.
Alarm ConfigurationConfigure alarm text, alarm level, alarm code, suppression expression, and alarm delay.
Value FilteringConfigure minimum, maximum, maximum amplitude, maximum percentage change, and maximum number of consecutive cycles.

After configuration, choose “Save” to keep editing in the popup, or choose “OK” to save and close it.

Minimum usable configuration

  1. Click “Add Variable”, enter a unique name, select the data type, and leave “Enable” on.
  2. For manual values, allow writing. For periodic calculation, select a read expression and set the execution interval.
  3. Click “OK”, return to the list, and refresh.
  4. Use “Write” to enter a safe test value, or wait for one execution interval and check the calculated result.

Save, enable, and verify

CheckPass standard
Save resultThe variable appears in the list with the expected name, data type, and enabled state.
Runtime resultThe current value updates from the write or expression, collection time continues to change, and the error message is empty.
Write resultThe page reports success, and the current value plus any rule or script result using it is as expected.
Downstream useAfter adding the variable to a rule or forwarding group, the downstream log or receiver shows the expected value.

Saving a variable is not enough when it is disabled, its expression is not running, or a downstream target receives no value.

Common Operations

OperationsDescription
RefreshReload the list of memory variables.
Column SettingsSelect Table Display Columns; column preferences are saved separately without affecting the collection configuration page.
DetailsOpen the variable details drawer to view basic information, alarm information, value filtering, historical data, and historical alarms.
WriteManually write variable values. Before writing, confirm that the variable read/write permissions allow writing.
EditChange the configuration settings.
CopyCopy existing variables by quantity, suitable for creating memory variables with similar names and configurations.
Batch EditAfter checking variables, batch modify some configurations.
Batch DeleteBatch delete variables after checking the box. Before deletion, ensure that scripts, rules, and forwarding configurations no longer reference these variables.
Import variablesImport memory variables from Excel files. The import result will display failure lines and error messages.
Export variablesExport memory variables within the current filter range.
Export allExport all memory variables.

Usage Recommendations

ScenariosRecommendations
Rule Intermediate ValuesUse memory variables to store states that need to be reused across processes or nodes.
Script Calculation ValuesPut complex computational logic into the script, and memory variables read the script results.
Data forwarding auxiliary fieldsWhen internal statistics need to be forwarded externally, memory variables can be included in the data forwarding scope.
Manual Write DebuggingDuring debugging, memory variables can be manually written, but the production environment should control write permissions.
Batch CreationFirst, create a template variable, then use copy or Excel import to batch generate.

Usage Precautions

ScenariosRecommendations
Name ChangeBefore modifying variable names, first check whether scripts, rule flows, data forwarding, and external calls reference the name.
Read expressions are nullVariables do not update according to computational logic and can only rely on writing or other process assignments.
Write failureCheck read/write permissions, data types, and value formats.
State AnomaliesCheck the error message columns and check whether the read expression, script compilation status, and dependencies are normal.
Delete variablesExport backups before deleting and confirm that the rule flow and forwarding targets are no longer referenced.

Fault Handling

PhenomenonHandling Recommendations
List No VariablesClear filter conditions and refresh; Double-check whether the variable has been created under the Memory device.
Current value does not updateCheck whether the variable is enabled, whether the reading expression is correct, and whether the execution interval is reasonable.
Import failureOpen the import result pop-up window and correct the Excel template based on the failed row.
Alarms do not triggerCheck alarm configuration, suppression expressions, alarm delay, and value filtering configuration.
Data forwarding does not include this variableCheck in the data forwarding group whether the variable range includes the Memory device or the variable.