Code Generation · Module

Alarm Code

Define alarm conditions in a table. Get a Studio 5000 routine bundling the ALARM_UDT, alarm tags, and detection logic into one importable L5X.

Free tier Updated May 11, 2026 6 min read
6
Comparison types supported
~2 min
From spreadsheet to L5X
CSV
Import your alarms
L5X
Self-contained routine output
The 2-minute path

These four steps produce an L5X ready for Studio 5000 import. The full guide below covers every option in detail.

  1. 1 Add alarms · Upload a file, load a saved configuration, or add rows by hand.
  2. 2 Configure · Pick the comparison type, enable condition, and delay.
  3. 3 Generate · Get a self-contained routine L5X plus the ALARM_UDT.
  4. 4 Import · Into Studio 5000 and verify your new logic.

Overview

Alarm Code generates Studio 5000 alarm logic from a table of definitions. Each alarm gets a detection rung wired to its target, its comparison reference (for threshold types), and an optional enable condition. The output is a self-contained routine L5X with alarm tags, the ALARM_UDT, and ladder logic in one importable file.

It pairs with I/O Code. I/O Code generates the device-level fault signals; Alarm Code is for the comparison-driven alarms layered on top: high/low setpoints, deviation flags, conditional enables.

Before you start. A populated Tag Database lets you pull existing alarms in instead of typing them. A populated UDT Library lets you pick a custom alarm UDT in place of the built-in ALARM_UDT. Neither is required.

Comparison types

Each alarm has a type that determines the detection instruction:

TypeWhat it doesUse for
TAGMonitors a boolean tag directlyEquipment fault flags, e-stop active, comms-loss
GRTGreater than (target > reference)Hi / Hi-Hi process alarms
GEQGreater than or equal (target ≥ reference)Inclusive high-side checks
LESLess than (target < reference)Lo / Lo-Lo process alarms
LEQLess than or equal (target ≤ reference)Inclusive low-side checks
EQUEqual (target = reference)Specific mode or state matches

TAG only needs target. The five comparison types need both target (the value being monitored) and reference (the threshold, a literal like 85.0 or a tag name like SP_TT_101_Hi). The reference field is disabled in the UI when type is TAG.

Step 1. Add your alarms

Open Alarm Code from the dashboard. The empty page offers three ways in, mirroring I/O Code:

  • File Upload. Drop in a .xlsx, .xls, or .csv matching the downloadable template.
  • Load Saved. Pick a previously saved configuration, or select the Default Set under Load Saved on the right side of the shell to load a sample set of alarms into the editor.
  • Add Row. Type alarms directly into the table.

Once at least one row is on the table, Import from DB pulls alarms from your Tag Database (the ALARM category).

Columns on each row

ColumnRequiredNotes
Alarm NameYesThe PLC tag base name for the alarm
TypeYesOne of TAG, GRT, GEQ, LES, LEQ, EQU
TargetYesTag being monitored. For TAG type this is the boolean itself
ReferenceComparison types onlyThreshold, literal or tag. Disabled when type is TAG
DescriptionNoUsed in tag descriptions
UDTNoCustom alarm UDT from your library. Defaults to ALARM_UDT
Delay TimerNoTimer tag for delayed activation (empty = immediate)
EnabledNoAlways or TAG. Defaults to Always
Enable RefWhen Enabled = TAGBoolean tag that gates the alarm
Enable DelayNoDelay before the enable condition takes effect

Two enable modes are supported today: Always (alarm is live as soon as the controller is running) and TAG (alarm is live only when the boolean in Enable Ref is true). The Enable Ref column is disabled when Enabled is Always.

Step 2. Configure

Tune each row in the table:

  • For comparison types, set both Target and Reference. Reference can be a numeric literal or a tag name.
  • For TAG-enabled alarms, set Enable Ref to the gating boolean.
  • Delay Timer controls how long the detection condition must remain true before the alarm latches, useful for filtering noisy signals. Leave it blank for immediate latching.

The default ALARM_UDT has Active and Enabled BIT members (plus a hidden backing SINT) and is the fallback for every alarm row. It is a system component, available on every tier.

Bringing your own alarm UDT

If you point an alarm at a custom UDT from your library, the generator resolves the alarm-active and alarm-enabled member names from the UDT schema, so renaming Active → e.g. IsActive in your custom UDT is allowed as long as the structural roles are intact.

Custom UDT uploads require Pro or higher. Free-tier accounts can use the built-in ALARM_UDT but can’t upload their own alarm structures. Upgrade to Pro to wire alarms to your shop’s existing alarm UDT.

Saving and reloading your configurations

Save stores the current rows under a name and version. Load pulls a saved configuration back in. Saved Configs include every row’s parameters. Save to DB pushes the current rows into the Tag Database under the ALARM category.

Step 3. Generate

Click Generate Code. After the run completes you get the same three panels as I/O Code:

  • File Preview with a per-file Copy button.
  • Generated Files card listing each file with per-file download + a Download ZIP button.
  • Required Components card with ALARM_UDT.L5X available as a standalone download. The ALARM_UDT is already bundled inside the routine L5X. This file is here only if you want to import the UDT independently for reuse across other routines.

What’s in the bundle

FilePurpose
alarm_routine_<date>_<time>.L5XSelf-contained routine: alarm tags, ALARM_UDT definition, ladder detection logic
alarm_tags.csvAlarm tag definitions in CSV, useful for HMI tag imports
alarm_logic.txtThe detection ladder logic in plain text

The L5X is what you import. The .txt is there if you want to paste the detection logic into an existing routine, or read what was generated before committing.

The standalone ALARM_UDT.L5X is offered separately because it is a Data Type, useful if you want to import it once into a project and reference it from routines you build outside PLCflow.

Step 4. Import

In your Studio 5000 project:

  1. Right-click the program you want the alarm routine in, then Import then Import Routine, and select the alarm_routine_*.L5X. The bundled ALARM_UDT resolves automatically.
  2. Set the routine name in the import dialog, confirm any tag-collision behavior, and click OK.
  3. Schedule the routine. The detection ladder typically runs every scan from your MainRoutine via JSR.
  4. Review the imported rungs before deployment.

This is not safety logic. PLCflow-generated alarms are for operator awareness, not safety functions. Safety conditions belong in GuardLogix with safety-rated hardware and SIL / PL verification per IEC 61508 / ISO 13849.

Common pitfalls

  • Comparison alarm missing a reference. GRT, GEQ, LES, LEQ, EQU all need both target and reference. If you leave reference blank, validation rejects the row.
  • Reference points at a tag that does not exist. PLCflow does not check that the referenced tag is present in your Studio 5000 project. Generation succeeds but Studio 5000 fails verification on import.
  • Custom alarm UDT missing the required structural members. The generator reads your UDT to resolve which member to drive for “alarm active” and “alarm enabled.” If those roles can’t be resolved, generation fails. Match the ALARM_UDT structure as a baseline.
  • Same alarm name in multiple rows. Names must be unique within a generation run. Validation flags duplicates before generation.

FAQ

Does it work with FactoryTalk Alarms & Events?

The generated alarm tags expose an active bit that FTAE can bind to. PLCflow does not generate FTAE configuration files. Wire FTAE up to the alarm tags in Studio 5000 after the import.

Can I add a deviation-style alarm?

Not as a first-class type today. The supported list is TAG, GRT, GEQ, LES, LEQ, EQU. For a deviation, create a calculated tag (PV - SP) and add a GRT alarm with that calculated tag as target and the allowable deviation as reference.

Can I save my work and come back to it later?

Use Save to store the current rows as a named configuration. Saved configurations reappear under Load Saved on the empty page and behind the Load button once rows are on the table.

What about Enabled = TIMER?

Only Always and TAG are supported today. For a startup grace period, gate the alarm with a TON output in your MainRoutine and point Enable Ref at the TON’s DN bit.

  • I/O Code. Generates the device-level fault inputs that this module can reference as TAG-type alarms.
  • Tag Database. Holds the alarm tag catalog. Import-from-DB pulls existing alarm definitions into a generation run.
  • Code Analyzer. Run on the alarm routine before importing. Catches missing references and structural issues that are easier to fix in the office.
What's next

Related modules

Was this helpful?

Honest feedback. We read all of it.

Try Alarm Code on real data

Free tier, no credit card. Bring a real spreadsheet, see what comes out.