Bulk Actions · Module

Duplication

Upload one or more L5X routines. Define variants with find-and-replace rules. PLCflow generates one new file per (routine × variant), with every reference correctly substituted.

Pro Updated May 11, 2026 5 min read
N files × M variants
Output count
Per-variant rules
Each variant gets its own replacements
Regex or literal
Two matching modes per rule
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 Upload · One or more .L5X files.
  2. 2 Variants · Add variants, each with a name + replacement rules.
  3. 3 Process · PLCflow generates one output per (file × variant).
  4. 4 Import · Download the ZIP. Import variants into Studio 5000.

Overview

Duplication clones uploaded L5X routines across N variants, with per-variant find-and-replace rules. For every input file × every variant, the rules run in order and produce one output file. Sixteen output routines from four uploads × four variants, twelve from two uploads × six variants, and so on.

Common scenarios: producing Line 2 through Line 12 from a Line 1 master with different tag prefixes, cloning a master phase routine for every batch reactor in a plant, or copying an existing zone’s logic into a new zone with the appropriate name changes.

The page has an upload section, a variants editor, and a process action. Output appears as a downloadable ZIP plus a file preview.

Before you start. You need one or more .L5X files containing the routines you want to clone. The page accepts a multi-file upload, so drag in everything at once. Pro tier and above.

Step 1. Upload the L5X files

Drop one or more .L5X files into the upload zone (or click to browse; the file picker accepts multiple selections). The list of uploaded files appears as monospace chips below the dropzone.

A Load Saved panel sits on the right. Saved configurations capture the variants and rules (not the L5X content) so you can apply the same set of replacements to a new file later. Click any saved card to load it, then upload the L5X to process.

The Clear button drops the uploaded files; Add Variant stays available so you can build up the variants before uploading too.

Step 2. Define variants and replacement rules

A variant is one set of substitutions. Each variant has:

  • Variant name. Internal label (Variant 1, Line_2, Zone_B, etc.).
  • New routine name (optional). Renames the routine inside the output L5X. Only effective on single-routine L5X exports; project-level files show a warning that the rename has no effect.
  • Replacement rules. A list of find-and-replace pairs that transform the routine’s text.

Each rule has three fields:

FieldWhat it does
FindThe text or regex pattern to find
Replace WithWhat to substitute in
RegexYes or No. No matches the find string literally; Yes interprets it as a regular expression

Rules apply in order, top to bottom, against the running output. Rule 2 sees the result of Rule 1.

A typical variant for “Line 2 copied from Line 1” might have:

example replacement rules
Find: Line_1     →  Replace: Line_2      (regex: No)
Find: L1_        →  Replace: L2_         (regex: No)
Find: Phase_01   →  Replace: Phase_02    (regex: No)

For pattern matching, regex helps. To rename every Pump_1xx tag to Pump_2xx:

Find: Pump_1(\d+)    →  Replace: Pump_2$1    (regex: Yes)

Order rules to avoid double-substitution. Rules see the previous rule’s output. Replacing Line_1Line_2 and then _2_3 will turn Line_1 into Line_3 (not Line_2). Read the pipeline as a sequence, not as parallel rules.

Worked example

Given a master routine for Line 1 with tags like Line_1.Conveyor and Pump_101.Run, cloned for Line 2 with tags like Line_2.Conveyor and Pump_201.Run:

Variant: Line_2
Variant name:      Line_2
New routine name:  Line_2_MainPhase
Rules:
  Find: Line_1     →  Replace: Line_2     (regex: No)
  Find: Pump_1     →  Replace: Pump_2     (regex: Yes, find as \bPump_1\b, or rely on rule order)

PLCflow runs the rules in order against the master and produces an output L5X named after the variant. Inside the rungs:

Before (master) → After (Line_2 variant)
XIC(Line_1.Conveyor.Run)OTE(Line_1.Conveyor.Cmd);   →   XIC(Line_2.Conveyor.Run)OTE(Line_2.Conveyor.Cmd);
XIC(Pump_101.Run)OTE(Pump_101.Cmd);                  →   XIC(Pump_201.Run)OTE(Pump_201.Cmd);
// Line_1 startup interlock                          →   // Line_2 startup interlock

Note how the regex \bPump_1\b (or a literal Pump_1 rule ordered before Pump_10-style overlaps) keeps Pump_101 working: the literal Pump_1 match plus the trailing 01 becomes Pump_2 plus 01 = Pump_201.

Three more variants with rules Line_3/Pump_3, Line_4/Pump_4, etc. would produce three more output L5X files alongside Line_2’s, all from the same master upload.

Adding and removing variants

Add Variant appends a new block at the bottom. The trash icon in each variant header removes it (only available when more than one variant exists). The Save and Load buttons in the section header persist the entire variants set so you can reuse it across projects.

Step 3. Process

Click Process Files. The action card at the bottom of the variants section shows the running total (N files × M variants = K outputs) so you can verify the count before committing.

PLCflow runs every variant’s rules against every uploaded file and emits one output L5X per combination. The console streams progress; the output panel appears after the run.

Output

  • Output Download. A card per output L5X, plus a Download ZIP for all of them at once.
  • File Preview. First 200 lines of the first output file, for spot-checking that the substitutions look right.

If a variant has no rules and no new routine name, it’s skipped (the active variant count in the action card reflects this).

Step 4. Import the variants into Studio 5000

For each downloaded variant L5X:

  1. Right-click the program you want the variant to live in.
  2. Click Import then Import Routine.
  3. Select the variant L5X.
  4. Set the routine name if Studio 5000 prompts. If you set a New routine name in the variant editor, that’s the suggested name.
  5. Click OK.
  6. Review the imported routine before deployment. Open at least one variant in Studio 5000 and confirm tag references substituted as expected. Run Code Analyzer on the variants before commissioning.

Common pitfalls

  • Substring over-match on literal rules. A literal find of Pump_1 matches Pump_1, Pump_10, Pump_11, etc. Either switch the rule to regex with word boundaries (\bPump_1\b with regex Yes), or order rules so the longest match runs first.
  • Rules chain in unexpected ways. Rule outputs feed the next rule. Replacing Line_1 with Line_2, then _2 with _3, turns Line_1 into Line_3. Trace each rule against the running output, not the original master.
  • Forgetting a rule for the routine name. The New routine name field only renames the routine’s Name attribute on a single-routine L5X. Tag references inside the rungs still hold the old name unless you add a replacement rule that catches them.
  • Saved configuration applied to a different L5X. Saved configs hold the variants and rules, not the L5X. If you load a config and then upload an L5X with different tag conventions, the rules may not match what you expect. Preview the first output before downloading the rest.
  • Project-level L5X with New routine name set. The page warns when the L5X contains multiple routines: routine rename has no effect at the file level. To rename multiple routines, use distinct rules or use Precision Replace.

FAQ

How many variants can one run handle?

A few dozen is comfortable. The UI scales to that range fine. The total outputs grow as files × variants, so a 5-file upload with 20 variants is 100 outputs. Manageable, but plan for the ZIP size.

Can I duplicate AOI definitions or UDTs?

Not directly. Duplication operates on routine content. For UDT rename / restructure across a program, use Precision Replace.

What's the difference between literal and regex rules?

Literal does a verbatim text match. Regex treats the find pattern as a regular expression, so special characters like ., *, +, \d, and capture groups have regex meaning. For simple Pump_1Pump_2, literal works. For Pump_1xxPump_2xx where xx is any number, you need regex with a capture group (Pump_1(\d+)Pump_2$1).

Does Duplication preserve comments and descriptions?

Yes. Substitution applies to comment text and descriptions the same way it applies to rung content. If your source comment says “Line 1 conveyor”, the variant comment says “Line 2 conveyor” after the rule applies.

Can I preview before processing?

The action card shows the expected output count before you click Process. Inline diffs aren’t shown, but File Preview appears immediately after processing. The first output file is shown so you can sanity-check before downloading the rest. If something looks wrong, adjust the rules and re-process; the input files stay loaded.

  • Precision Replace. For finer-grained, structure-aware substitutions across an entire L5X program, not just routine cloning.
  • I/O Code. The generated logic from I/O Code is often the master that gets duplicated across lines.
What's next

Related modules

Was this helpful?

Honest feedback. We read all of it.

Try Duplication on real data

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