Skip to main content

A variable name has exactly one job: let anyone move from the program to the cabinet and back without asking a single question.

Picture it. The motor will not start. You open the program and read the coil: xContactor_Cmd_K1. You go to the schematic, page 10, and find -K1. You measure the voltage across terminals A1 and A2. Three steps, no guesswork.

Call that same variable Motor or Out1 and the path breaks at step two. This article lays out the naming convention we use on our Micro850 training station with a PowerFlex 525 drive, and the reasoning behind each part of it. It applies to Connected Components Workbench, but the thinking transfers to any platform.

Variable table in Connected Components Workbench with aliases following the naming convention
Variable table in Connected Components Workbench with aliases following the naming convention

The anatomy of a name

Every name has four parts, always in the same order:

x   Contactor   _   Cmd   _   K1
│       │           │         │
│       │           │         └── tag from the schematic
│       │           └──────────── signal role
│       └──────────────────────── object
└──────────────────────────────── data type

Read it from the right: on the schematic it is K1, this is a command, it drives a contactor, and it is a BOOL.

Part 1: the type prefix

One lowercase letter, so you never have to open the variable table to check what you are holding.

PrefixData typeExample
xBOOLxPushButton_Start_S1
iINTiPotentiometer_Value_R1
uiUINTuiPotentiometer_Setpoint_R1
diDINTdiCounter_Parts_Total
udiUDINTudiTotal_Cycles
rREALrMotor_Speed_Actual
wWORDwStatus_VFD_T10
sSTRINGsRecipe_Name_Active
tTIMEtDelay_Start_Ramp

Only x may go into a contact or a coil. Every other prefix is a warning that you are looking at a value, not a bit.

Part 2: the object

What the thing physically is, not what it does: PushButton, Selector, EStop, LimitSwitch, Contactor, Motor, MotorProtection, VFD, Potentiometer, SafetyRelay, Lamp.

Part 3: the signal role

What this particular signal carries. Four roles come back constantly:

RoleMeaningDirection
Cmda command from the controller, what we wantoutput
Statean internal state held by the programmemory
OKconfirmation that a condition is metinput
Readythe device is able to runinput

Part 4: the tag from the schematic

The last part is exactly the marker used on the drawing, without the hyphen: S1, K1, Q1, T10, R1.

The hyphen on the schematic (-S1) follows IEC 81346 and marks a product, that is a physical item. We drop it in the variable name only because Connected Components Workbench does not accept a hyphen in an identifier.

The device letter itself is not a free choice – IEC 81346-2 fixes it:

LetterClassExample on our station
Aassembly, module-A1 Micro850 controller
Fprotection-F1, -F2, -F10
Gpower supply-GB1
Krelay, contactor-K0, -K1, -K2, -K3
Mmotor-M1, -M2, -M3
Qpower circuit switching-Q1 motor protection switch
Rresistance-R1 10 kOhm potentiometer
Scontrol device-S1 to -S7
Tconverter-T10 PowerFlex 525 drive
Xterminal, connector-X1, -X4, -X5

Capitals and underscores

These two questions come up more than any other.

Capital letters

  • the type prefix stays lowercase: x, i, ui, di, udi, r, w, s, t
  • every other part opens with a capital
  • inside one part the words run together, each with a capital: PushButton, MotorProtection, RunFwdCmd
  • never ALL CAPS, never all lowercase

Underscores

  • one underscore between parts, never inside a part
  • xPushButton_Start_S1 has three parts: object, role, tag
  • xPush_Button_Start_S1 is wrong, it splits the object in two
  • xpushbuttonstartS1 is wrong, there are no parts at all

One exception: _IO_EM_DI_00 is Rockwell’s own system name, with a leading underscore and all capitals. CCW does not let you change it, and there is no reason to – your own name goes in the Alias column next to it.

Terminal numbers already tell you the contact type

The comment on a variable reads -S1 13/14 (NO). That numbering follows EN 50005 and IEC 60947-5-1, and it is two digits:

  • first digit – the number of the contact block inside the device
  • second digit – the function: 1 and 2 form a break contact (NC), 3 and 4 form a make contact (NO)
TerminalsTypeTypical devices
13/14NOstart button, reset button, auxiliary contact
11/12NCstop button, e-stop, safety limit switches
21/22NCe-stop, second channel

So the terminals alone are enough. The (NO) or (NC) note in the comment is a courtesy, not the source of truth.

The convention applied: a worked I/O map

This is what it looks like on a real station.

Digital inputs

ChannelDescriptionDeviceContactVariable
I-00Start-S113/14 NOxPushButton_Start_S1
I-01Stop-S211/12 NCxPushButton_Stop_S2
I-02Auto / manual-S311/12, 14xSelector_AutoManual_S3
I-03Reset-S513/14 NOxPushButton_Reset_S5
I-04Drive ready-T10xVFD_Ready_T10
I-05Motor protection-Q113/14 NOxMotorProtection_OK_Q1
I-06Safety OK-CR30xSafety_OK_CR30
Schematic CB-M850-001, page 8: -S1, -S2, -S3, -Q1 and the Safety OK signal wired to inputs I-00 to I-06 - exactly the tags that end the variable names
Schematic CB-M850-001, page 8: -S1, -S2, -S3, -Q1 and the Safety OK signal wired to inputs I-00 to I-06 – exactly the tags that end the variable names

Digital outputs

ChannelDescriptionDeviceVariable
O-00Motor start-K1 A1/A2xContactor_Cmd_K1
O-01Start button LED-S1_HxPushButtonLamp_Start_S1
O-04Drive stop-T10xVFD_StopCmd_T10
O-05Drive run forward-T10xVFD_RunFwdCmd_T10
O-06Drive run reverse-T10xVFD_RunRevCmd_T10
Schematic CB-M850-001, page 10: contactor -K1 (A1/A2) on O-00 and the -S1_H, -S2_H, -S3_H lamps on O-01 to O-03
Schematic CB-M850-001, page 10: contactor -K1 (A1/A2) on O-00 and the -S1_H, -S2_H, -S3_H lamps on O-01 to O-03

Analog

ChannelDescriptionDeviceVariable
_IO_P1_AI_00Potentiometer 0-10 V-R1uiPotentiometer_Setpoint_R1
_IO_P2_AO_00Drive speed reference 0-10 V-T10uiVFD_SpeedRef_T10

Analog channels are UINT in CCW, not BOOL. That is exactly why the prefix is ui and never x.

Safety devices are not in the variable table

On this station the e-stop -S4 and the safety limit switches -S6 and -S7 do not reach the Micro850 at all. They are wired into a configurable safety relay, and the controller receives a single combined Safety OK signal on I-06.

Schematic CB-M850-001, page 15: e-stop -S4, reset -S5 and limit switches -S6/-S7 go to the safety relay, not to the Micro850 inputs
Schematic CB-M850-001, page 15: e-stop -S4, reset -S5 and limit switches -S6/-S7 go to the safety relay, not to the Micro850 inputs

Worth saying out loud when you teach this. A student looks for the e-stop in the variable table, does not find it, and assumes something is missing. Nothing is missing – the safety function lives outside the program logic on purpose.

Command, confirmation, state

Three different things that beginners collapse into one:

VariableWhat it actually says
xContactor_Cmd_K1the controller asks for the contactor to pull in
xMotorProtection_OK_Q1the protection confirms it is healthy
xMotor_1_AlarmStatethe program remembers that an alarm occurred

A command is not proof of execution. The coil xContactor_Cmd_K1 can be TRUE while the motor stands still: a burnt contactor coil, welded contacts, a broken wire. That is why on real machines the auxiliary contact is read back and compared against the command, and a mismatch is raised as an alarm. Wire K1 back to a spare input and that variable would be called xContactor_Fb_K1, from feedback.

Six rules

1. Never encode NO or NC in the name. Wrong: xPushButton_Stop_NC_S2. Rewire the button to a different contact block and the name starts lying.

Online monitoring: the stop contact green from an NC button, the start contact blue
Online monitoring: the stop contact green from an NC button, the start contact blue

The screenshot above is the reason. xPushButton_Stop_S2 comes from an NC contact in the panel, yet in the rung it sits as a normally open contact – which is why it shows green while nobody is pressing it. Two different facts, neither of which belongs in the name. The contact type goes in the comment and on the schematic.

2. Never put the address in the name. xStart_DI00 looks helpful until someone moves the button to another channel. Then the name lies. The address lives in the Name column, and only there.

3. Leave reserves empty. Unused channels get an alias the day something is wired to them, not before.

4. One device, one tag. If the drawing says -S1, the program says _S1. No _S01, no _PB1, no variants.

5. Always name in English. English is the common language of automation – documentation, forums and support all run on it. Use English unless the customer’s own standard says otherwise.

6. The underscore separates parts, not words. xPushButton_Start_S1, not xPush_Button_Start_S1.

Checklist before you start programming

  • every channel in use has an alias
  • every alias ends with the schematic tag
  • every comment reads -Xn terminals (type)
  • reserve channels are still empty
  • no alias contains an address
  • no alias contains NO or NC
  • the prefix matches the data type

Frequently asked questions (FAQ)

Why put the data type in the variable name at all?

Because it tells you instantly whether a variable may go into a contact or a coil. Only a BOOL (x) may. Seeing uiVFD_SpeedRef_T10 in a rung is an immediate signal that something is wrong.

Why not write NO or NC in the name?

Because the contact type is a property of the wiring, not of the signal. Move the wire to another contact block and the name becomes false. The comment and the schematic carry that information.

Should variable names be in English even on a local project?

Yes, unless the customer has their own standard. Documentation, support and forums all run in English, and mixed-language tables are painful to maintain.

What if the schematic has no tag for a device?

Then the schematic needs fixing first. The whole convention rests on one tag pointing at exactly one device – if a tag is duplicated or missing, settle it on the drawing before you name anything in the program.

Summary

A good variable name is not decoration, it is a link between the program and the cabinet. Four parts – type, object, role, schematic tag – are enough to make that link hold: xContactor_Cmd_K1 tells you what it is, what it does and where to find it with a multimeter.

To see this convention in action on a real rung, read our walkthrough of normally open contacts and coils in ladder logic, and take a look at the ControlByte PLC Trainer that all these examples come from. If you want a structured path through PLC programming, see our premium PLC programming course in LAD/FBD.

Author

Matt Kurantowicz, MSc

Author Matt Kurantowicz, MSc

Automation Engineer and PLC Programmer CEO & Co-Founder at ControlByte "I am helping beginners enter the world of industrial automation, PLCs, and industrial AI."

More posts by Matt Kurantowicz, MSc