TwinCAT Variable Naming Guide
Use PascalCase for all public-facing symbols (e.g., I/O, HMI mappings, FB names, methods, properties).
Use _camelCase for local/internal variables that are not mapped to I/O or HMI.
Keep physical I/O and HMI commands/status clearly separated.
Avoid using global variable lists (GVLs) or internal variables for HMI mapping.
Declare in VAR_INPUT / VAR_OUTPUT sections of MAIN or in dedicated function blocks .
Use PascalCase nouns or noun phrases .
Examples:
StartButton
SystemPressure
PumpMotorCurrent
Declare in VAR_INPUT / VAR_OUTPUT of MAIN or FBs.
Use PascalCase nouns or noun phrases .
To help differentiate from Physical I/O:
Commands: Always use the Command suffix (e.g., StartCommand, StopCommand)
Statuses / Feedback: Use suffixes such as Status, Feedback, or Text as appropriate.
Prefix with fb, followed by PascalCase name:
fbSumpPump
fbBurnerControl
Use PascalCase with a Verb or Verb–Noun pattern:
UpdateSetpoint
Reset
StartPump
StopPump
Use PascalCase nouns or noun phrases :
TargetTemperature
PumpRunHours
AlarmText
Use PascalCase , nouns or noun phrases (e.g., StartButton, SetpointLevel, RecipeNumber). Use Command or Cmd suffix for commands (e.g., StartCommand).
Use PascalCase , nouns or noun phrases (e.g., PumpStatus, LevelFeedback, AlarmText). Use Status, Feedback, or Text suffixes where applicable.
Use a leading underscore and camelCase :
_lastSetpoint
_alarmState
_previousPumpSpeed
Avoid exposing internal variables directly to HMI.
Keep physical IO → FB → HMI mapping clear and traceable.
- Public I/O & HMI: PascalCase
- FB instances: fbPascalCase
- Methods: VerbNoun PascalCase
- Locals: _camelCase
- Commands: Always use `Command` suffix
- Status/Feedback/Text suffixes for clarity