Alarms Engine (Reference) manages the execution, evaluation, and lifecycle of all alarm conditions within the FrameworX runtime environment. The Alarms Engine orchestrates:
The Alarms Engine orchestrates:
Understanding the engine helps when:
Each alarm item follows this state progression:
csharp
// State transition events
OnActive() // Normal → Active
OnAcknowledge() // Active → Acknowledged
OnNormalize() // Active → Normalized
OnReturn() // Any → NormalThe engine evaluates alarms in cycles:
Thread pool size: Min(CPU cores * 2, Active alarm count / 100)
For each scan cycle:
IF (EvaluateCondition(TagValue, Limit))
AND (NOT InDeadband())
AND (EnableCondition == True)
AND (Group.Enabled == True)
THEN
TriggerAlarm()Special handling for RateOfChange:
CurrentRate = (CurrentValue - PreviousValue) / TimeDelta
IF (CurrentRate >= Limit)
TriggerAlarm()Sampling: Every 100ms for RateOfChange conditions
Deviation = ABS(TagValue - Setpoint)
IF (Deviation > Limit + SetpointDeadband)
TriggerAlarm()Prevents re-triggering within time window:
Hysteresis to prevent chattering:
Both time AND value must be satisfied:
CanRetrigger = (TimeSinceLastAlarm > TimeDeadband)
AND (ValueChange > ValueDeadband)Asynchronous database writes:
sql
AlarmEvents (
EventID BIGINT PRIMARY KEY,
Timestamp DATETIME,
TagName VARCHAR(255),
AlarmGroup VARCHAR(100),
AlarmArea VARCHAR(255),
EventType INT,
Value FLOAT,
Limit FLOAT,
Message TEXT,
UserName VARCHAR(100),
AckTime DATETIME
)Available from FrameworX 10.1.5c. When an Alarm Logging Database uses Store and Forward, the number of rows replayed per synchronization cycle is configurable server-side in TServer.json (in the FrameworX\MachineSettings folder), under the appSettings object. Two independent Alarm keys control it:
Key | Default | Drives |
|---|---|---|
| 100 | Recovery pass (KeepLocalCopy = off) — drains the local cache after the remote database reconnects. |
| 1000 | Replay pass (KeepLocalCopy = on) — replays flagged rows while preserving the local copy. |
Both validate to the range [50, 50000]; out-of-range or missing values fall back to the legacy default. For the full procedure, the JSON example, and the equivalent Historian key, see Configuring Store and Forward Batch Sizes (Historian Engine Reference).
Note: this is distinct from the alarm-event Write Queue batch above, which governs how alarm events are flushed to the logging database during normal operation.
Redundancy: Store and Forward and database redundancy replication of alarm history are mutually exclusive, so choose one of the two. The Designer blocks the combination in Alarms > Global Settings, and if a solution has both, the runtime turns Store and Forward off at startup and logs the reason.
Available from FrameworX 10.1.5e. Alarm history queries load their result set into runtime memory before returning it. On a large alarm database, or when the logging database responds slowly, a single wide query can hold millions of rows at once and drive the runtime process memory up sharply. An optional server-side ceiling bounds how many rows any one alarm history query may load.
The ceiling is configured in TServer.json (in the FrameworX\MachineSettings folder), under the appSettings object:
Key | Default | Range | Drives |
|---|---|---|---|
| 100000 | 64000 to 5000000 | Maximum number of alarm history rows a single query may load into runtime memory. Applies to every alarm history request served by the runtime: AlarmViewer history views, TrendChart and DrillingChart annotation requests, and scripts that query alarm history. |
The key is optional. When it is absent the default of 100000 applies, so existing installations need no action and no TServer.json edit. A value outside the valid range is ignored: the runtime logs a Warning in the TraceWindow and keeps the default. The minimum of 64000 exists because TrendChart and DrillingChart request exactly 64000 rows of alarm history for their annotations, and a lower ceiling would degrade trend annotations.
Exceeding the ceiling is not an error. The query succeeds and returns the newest rows up to the ceiling. The runtime logs a Warning naming the requested row count, the applied ceiling and this configuration key, at most once every 60 seconds so that repeated polling does not flood the TraceWindow.
Note for display engineers: an AlarmViewer or an alarm report whose MaxLines property is configured above the ceiling now shows at most the ceiling, the newest rows, without an error banner. Sites that genuinely need to export more rows in a single view should raise HistoryQueryMaxRows deliberately.
The setting is machine-wide and applies to every solution running on the machine. Each solution runs its own TServer process, and all of them read the same TServer.json configuration file.
TServer.json in the FrameworX\MachineSettings folder.appSettings object, add or locate the Alarm section and set the value.{
"appSettings": {
"Alarm": {
"HistoryQueryMaxRows": 100000
}
}
}Raise the ceiling only when a site has a genuine need to return more rows in one query, and size it against the memory available to the runtime server. Lowering it reduces peak memory per query at the cost of showing fewer history rows in a single view.
High-priority alarms bypass queue:
Priority >= 900: Immediate dispatch
Priority 500-899: High priority queue
Priority 100-499: Normal queue
Priority < 100: Low priority queueLazy Evaluation:
Batch Processing:
Access via configuration file:
xml
<AlarmEngine>
<ThreadPoolSize>16</ThreadPoolSize>
<EvaluationInterval>100</EvaluationInterval>
<DatabaseBatchSize>100</DatabaseBatchSize>
<QueueSize>10000</QueueSize>
<CacheSize>1000</CacheSize>
<UseParallelEvaluation>true</UseParallelEvaluation>
</AlarmEngine>Monitor engine performance:
csharp
var metrics = @Alarm.Engine.Metrics;
int evaluationsPerSec = metrics.EvaluationRate;
int queueDepth = metrics.QueueDepth;
double avgEvalTime = metrics.AverageEvaluationTime;
int activeThreads = metrics.ActiveThreadCount;High CPU Usage:
Database Lag:
Memory Growth:
Missed Alarms: