Process Command Source (PCMDSRC)
This information applies to the CompactLogix 5380P and ControlLogix 5580P controllers.
The Process Command Source (PCMDSRC) instruction selects the command source for a device.
The instruction includes these command sources:
- Hand
- Out-of-Service
- Maintenance
- Override
- External
- Program locked
- Program
- Operator locked
- Operator
Available Languages
Ladder Diagram
Function Block Diagram
Structured Text
PCMDSRC (PCMDSRC tag);
Operands
IMPORTANT:
Unexpected operation may occur if:
- Output tag operands are overwritten.
- Members of a structure operand are overwritten.
- Except when specified, structure operands are shared by multiple instructions.
There are data conversion rules for mixing numeric data types within an instruction. See Data conversions.
Configuration Operands
Operand | Type | Format | Description |
---|---|---|---|
PlantPAx Control | P_COMMAND_SOURCE | tag | Data structure required for proper operation of the instruction. |
P_COMMAND_SOURCE Structure
Input Members | Data Type | Description |
---|---|---|
EnableIn | BOOL | Enable input. Ladder Diagram: Corresponds to the rung condition. Default is true. |
Inp_OwnerCmd | DINT | Owner device command: 0 = None, Inp_OwnerCmd.10 = Operator Lock, Inp_OwnerCmd.11 = Operator Unlock, Inp_OwnerCmd.12 = Program Lock, Inp_OwnerCmd.13 = Program Unlock, Inp_OwnerCmd.14 = Acquire Maintenance, Inp_OwnerCmd.15 = Release Maintenance, Inp_OwnerCmd.16 = Acquire External, Inp_OwnerCmd.17 = Release External, Inp_OwnerCmd.29 = Echo. Default is 0. |
Inp_InitializeReq | BOOL | 1 = Request to initialize the instruction. The instruction is normally initialized in instruction first run. Use this request when re-initialization is needed. The instruction clears this operand automatically. Default is true. |
Inp_Hand | BOOL | 1 = Acquire Hand (typically permanently set to local), 0 = Release Hand. Default is false. |
Inp_Ovrd | BOOL | 1 = Acquire Override (higher priority program logic), 0 = Release Override. Default is false. |
Inp_ExtInh | BOOL | 1 = Inhibit External acquisition, 0 = Allow External acquisition. Default is true. |
Cfg_HasOper | BOOL | 1 = Operator (unlocked) exists, can be selected. Default is true. |
Cfg_HasOperLocked | BOOL | 1 = Operator Locked exists, can be selected. Default is true. |
Cfg_HasProg | BOOL | 1 = Program (unlocked) exists, can be selected. Default is true. |
Cfg_HasProgLocked | BOOL | 1 = Program Locked exists, can be selected. Default is true. |
Cfg_HasExt | BOOL | 1 = External exists, can be selected. Default is false. |
Cfg_HasMaint | BOOL | 1 = Maintenance exists, can be selected. Default is true. |
Cfg_HasMaintOoS | BOOL | 1 = Maintenance Out of Service exists, can be selected. Default is true. |
Cfg_OvrdOverLock | BOOL | 1 = Override supersedes Program/Operator Lock, 0 = Do not override Lock. Default is true. |
Cfg_ExtOverLock | BOOL | 1 = External supersedes Program/Operator Lock, 0 = Do not override Lock. Default is false. |
Cfg_ProgPwrUp | BOOL | 1 = Power up to Program, 0 = Power up to Operator. Default is false. |
Cfg_ProgNormal | BOOL | Normal Source: 1 = Program if no requests, 0 = Operator if no requests. Default is false. |
Cfg_PCmdPriority | BOOL | Command priority. 1 = Program commands win, 0 = Operator commands win. Default is false. |
Cfg_PCmdProgAsLevel | BOOL | 1 = PCmd_Prog used as a Level. Default is false. |
Cfg_PCmdLockAsLevel | BOOL | 1 = PCmd_Lock used as a Level (1=Lock, 0=Unlock). Default is false. |
Cfg_ExtAcqAsLevel | BOOL | 1 = XCmd_Acq used as Level (1 = Acquire, 0 = Release). Default is false. |
PCmd_Oper | BOOL | Program command to select Operator (Program to Operator). The instruction clears this operand automatically. Default is false. |
PCmd_Prog | BOOL | Program command to select Program (Operator to Program). The instruction clears this operand automatically. Default is false. |
PCmd_Lock | BOOL | Program command to lock Program (disallow Operator). The instruction clears this parameter automatically if Cfg_PCmdLockAsLevel = 0. Default is false. |
PCmd_Unlock | BOOL | Program command to unlock Program (allow Operator to acquire). The instruction clears this operand automatically. Default is false. |
PCmd_Normal | BOOL | Program command to select Normal (Operator or Program). The instruction clears this operand automatically. Default is false. |
MCmd_OoS | BOOL | Maintenance command to select Out of Service. The instruction clears this operand automatically. Default is false. |
MCmd_IS | BOOL | Maintenance command to select In Service. The instruction clears this operand automatically. Default is false. |
MCmd_Acq | BOOL | Maintenance command to acquire ownership (Operator/Program/External/Override to Maintenance). The instruction clears this operand automatically. Default is false. |
MCmd_Rel | BOOL | Maintenance command to release ownership (Maintenance to Operator/Program/External/Override). The instruction clears this operand automatically. Default is false. |
XCmd_Acq | BOOL | External command to acquire ownership (Operator/Program/Override/Maintenance to External). The instruction clears this operand automatically if Cfg_ExtAcqAsLevel = 0. Default is false. |
XCmd_Rel | BOOL | External command to release ownership if Cfg_ExtAcqAsLevel = 0 (External to Operator/Program/Override/Maintenance). The instruction clears this operand automatically. Default is false. |
OCmd_Oper | BOOL | Operator command to select Operator (Program to Operator). The instruction clears this operand automatically. Default is false. |
OCmd_Prog | BOOL | Operator command to select Program (Operator to Program). The instruction clears this operand automatically. Default is false. |
OCmd_Lock | BOOL | Operator command to lock Operator (disallow Program). The instruction clears this operand automatically. Default is false. |
OCmd_Unlock | BOOL | Operator command to unlock / release (allow Program to acquire) ownership. The instruction clears this operand automatically. Default is false. |
OCmd_Normal | BOOL | Operator command to select Normal (Operator or Program). The instruction clears this operand automatically. Default is false. |
Output Members | Data Type | Description |
---|---|---|
EnableOut | BOOL | Enable output. This output state always reflects EnableIn input state. |
Sts_Initialized | BOOL | 1 = Instruction is initialized. Use Inp_InitializeReq to reinitialize. |
Sts_eSrc | INT | The current command source is shown with status bits: Sts_eSrc.0: Lock, Sts_eSrc.1: Normal, Sts_eSrc.2: Hand, Sts_eSrc.3: Maintenance, Sts_eSrc.4: Override, Sts_eSrc.5: Program, Sts_eSrc.6: Operator, Sts_eSrc.7: Out of Service, Sts_eSrc.8: External. |
Sts_bSrc | INT | Active selection bitmap (for HMI totem pole with command source request selection) Sts_bSrc.0: Hand, Sts_bSrc.1: Programmed Out of Service (rung false), Sts_bSrc.2: Maintenance Out of Service, Sts_bSrc.3: Maintenance, Sts_bSrc.4: Override, Sts_bSrc.5: External, Sts_bSrc.6: Program locked, Sts_bSrc.7: Program, Sts_bSrc.8: Operator locked, Sts_bSrc.9: Operator. |
Sts_Hand | BOOL | 1 = Hand is selected (supersedes OoS, Maintenance, Override, External, Program, Operator). |
Sts_OoS | BOOL | 1 = Out of Service is selected (supersedes Maintenance, Override, External, Program, Operator). |
Sts_Maint | BOOL | 1 = Maintenance is selected (supersedes Override, External, Program, Operator). |
Sts_Ovrd | BOOL | 1 = Override is selected (supersedes External, Program, Operator). |
Sts_Ext | BOOL | 1 = External is selected (supersedes Program, Operator). |
Sts_Prog | BOOL | 1 = Program is selected. |
Sts_ProgLocked | BOOL | 1 = Program is selected and Locked. |
Sts_Oper | BOOL | 1 = Operator is selected. |
Sts_OperLocked | BOOL | 1 = Operator is selected and Locked. |
Sts_ProgOperSel | BOOL | Program/Operator selection (latch) state: 1 = Program, 0=Operator. |
Sts_ProgOperLock | BOOL | Program/Operator lock (latch) state, 1 = Locked, 0=Unlocked. |
Sts_Normal | BOOL | 1 = Selection equals the Normal (Program or Operator). |
Sts_ExtReqInh | BOOL | 1 = External request inhibited, cannot get to External from current state. |
Sts_ProgReqInh | BOOL | 1 = Program request inhibited, cannot get to Program from current state. |
Sts_MAcqRcvd | BOOL | 1 = Maintenance Acquire command received this scan. |
MRdy_OoS | BOOL | 1 = Ready for MCmd_OoS, enable HMI button. |
MRdy_IS | BOOL | 1 = Ready for MCmd_IS, enable HMI button. |
MRdy_Acq | BOOL | 1 = Ready for MCmd_Acq, enable HMI button. |
MRdy_Rel | BOOL | 1 = Ready for MCmd_Rel, enable HMI button. |
XRdy_Acq | BOOL | 1 = Ready for XCmd_Acq, enable HMI button. |
XRdy_Rel | BOOL | 1 = Ready for XCmd_Rel, enable HMI button. |
ORdy_Oper | BOOL | 1 = Ready for OCmd_Oper, enable HMI button. |
ORdy_Prog | BOOL | 1 = Ready for OCmd_Prog, enable HMI button. |
ORdy_Lock | BOOL | 1 = Ready for OCmd_Lock, enable HMI button. |
ORdy_Unlock | BOOL | 1 = Ready for OCmd_Unlock, enable HMI button. |
ORdy_Normal | BOOL | 1 = Ready for OCmd_Normal, enable HMI button. |
Out_OwnerSts | DINT | Status of command source, owner command handshake and ready status: 0 = None, .10 = Operator Lock, .11 = Operator Unlock, .12 = Program Lock, .13 = Program Unlock, .14 = Acquire Maintenance, .15 = Release Maintenance, .16 = Acquire External, .17 = Release External, .18 = Has Maintenance, .19 = External Override Lock, .20 = Has External, .21 = Has Operator, .22 = Has Operator Locked, .23 = Has Program, .24 = Has Program Locked, .29 = Echo, .30 = Not Ready |
Operation
The instruction uses these command sources. The command sources are prioritized in order from highest to lowest in this table.
Command Source | Description |
---|---|
Hand | Hardwired logic or other logic outside the instruction controls the device. The instruction tracks the state of the device for bumpless transfer back to one of the other command sources. (Highest priority command source) |
Out-of-Service | The instruction is disabled and has no owner. |
Maintenance | Maintenance controls the device and supersedes Operator, Program, External and Override control. Operator commands and settings from the HMI are accepted. |
Override | Priority logic controls the device and supersedes Operator, Program and External control. Override Input (Inp_Ovrd) is accepted. |
External | External logic (e.g. field pilot control or upstream SCADA) controls the device. External commands (XCmd_) are accepted. |
Program locked | Program logic controls the device. Program commands (PCmd_) are accepted. Operator cannot take control from the Program. Override cannot take control from the Program unless Cfg_OvrdOverLock = 1. |
Program | Program logic controls the device. Program commands (PCmd_) are accepted. |
Operator locked | The Operator controls the device. Operator commands (OCmd_) from the HMI are accepted. Program cannot take control from Operator. Override cannot take control from Operator unless Cfg_OvrdOverLock = 1. |
Operator | The Operator controls the device. Operator commands (OCmd_) from the HMI are accepted. (Lowest priority command source) |
The instruction enables or disablesthese operations:
- Maintenance Out-of-Service exists
- Maintenance exists
- External exists
- Program (unlocked) exists
- Program locked exists
- Operator (unlocked) exists
- Operator locked exists
- PCmd_Lock used as a Level (1 = Lock, 0 = Unlock)
The instruction checks for invalid configurations of control and forces the nearest valid configuration.
The core control model arbitrates the source of the commands and parameters that the receiving function accepts. The core control model determines if the source is:
- A programmatic entity which resides entirely within the processing environment, or
- An external interface entity which issues commands and parameters external and asynchronously to the processing environment.
Locking a command source prevents the other command source from acquiring privilege.
Core command source model
The core control model consists of these command sources:
- Oper
- OperLocked
- Prog
- ProgLocked
The control model defaults to this configuration. Other command sources may be present in the model but act as overriding command sources, acting independent of the base Operator/Program state machine.
Enabling command sources as configuration
The individual command sources may be enabled or disabled by the user. The default configuration uses the entire base model; upon power-up of the processing environment the command source will be the designated default. Some combinations of enabled command sources are disallowed as they are either unnecessary or could create unintended changes.
Prog Power Up
Configuration allows the user to specify whether Operator or Program is the power-up default.
Prog Priority
Configuration allows the user to specify whether Operator or Program commands take priority when simultaneously asserted.
Automatic reset of commands
All commands are treated as one-shot-latched. This means that all commands are automatically cleared when the instruction executes and processes them.
Changing Destination States
Under certain configurations the destination command source for some commands may change. This is in keeping with the intent of the command. For example, if the Prog is disabled, the destination of the OCmd_Prog command is directed to the ProgLocked state instead of the Prog state. This maintains the intent of the OCmd_Prog command: the operator entity wishes to place the function in control of the program. If the command was eliminated there would be no way to accomplish this. This is only done in configurations where it would cause no conflict or race condition, but serves to preserve as much user functionality as is practical.
Higher Priority Command Sources
These Higher priority command sources operate independently within the model:
- External
- Override
- Maintenance
- Out-of-Service
- In-Service
- Hand
Initialization
The instruction is normally initialized in the instruction first run. Re-initialization can be requested any time by setting Inp_InitializeReq = 1. For proper initialization, when adding the instruction while performing an online edit of the code, make sure that Inp_InitializeReq = 1 (default value).
Monitor the PCMDSRC Instruction
Use the operator faceplate from the PlantPAx library of Process objects for monitoring.
Affects Math Status Flags
No.
Major/Minor Faults
None specific to this instruction. See Index Through Arrays for array-indexing faults.
Execution
Ladder Diagram
Condition/State | Action Taken |
---|---|
Prescan | Rung-condition-out clears to false. Sts_eSrc is set to 0. Sts_bSrc is set to 0. |
Instruction first run | All commands that are automatically cleared on each execution are cleared and ignored. The Program/Operator selection is set based on the configuration (Cfg_ProgPwrUp). The Program or Operator lock selection is set to unlocked. The Maintenance acquired/released state is not modified and persists through a controller powerup or PROG-to-RUN transition. |
Rung-condition-in is false | The instruction is put Out of Service if Inp_Hand=0. The output is de-energized. Command source selection processing proceeds except that Program and Operators commands are ignored and cleared and all ownership status bits (Sts_Maint, Sts_Ovrd, Sts_Ext, Sts_Prog and Sts_Oper) are cleared to 0. When rung-condition-in becomes true, the Program/Operator selection is set based on the configuration (Cfg_ProgPwrUp). |
Rung-condition-in is true | Set rung-condition-out to rung-condition-in. The instruction executes. |
Postscan | Rung-condition-out is cleared to false. |
Function Block Diagram
Condition/State | Action Taken |
---|---|
Prescan | EnableOut is cleared to false. Sts_eSrc is set to 0. Sts_bSrc is set to 0. |
Instruction first run | All commands that are automatically cleared on each execution are cleared and ignored. The Program/Operator selection is set based on the configuration (Cfg_ProgPwrUp). The Program or Operator lock selection is set to unlocked. The Maintenance acquired/released state is not modified and persists through a controller powerup or PROG-to-RUN transition. |
Instruction first scan | See Instruction first run in the Function Block Diagram table. |
EnableIn is false | EnableOut is cleared to false. The instruction is put Out of Service if Inp_Hand=0. The output is de-energized. Command source selection processing proceeds except that Program and Operators commands are ignored and cleared and all ownership status bits (Sts_Maint, Sts_Ovrd, Sts_Ext, Sts_Prog and Sts_Oper) are cleared to 0. When rung-condition-in becomes true, the Program/Operator selection is set based on the configuration (Cfg_ProgPwrUp). |
EnableIn is true | EnableOut is set to true. The instruction executes. |
Postscan | EnableIn and EnableOut bits are cleared to false. |
Structured Text
In Structured Text, EnableIn is always true during normal scan. Therefore, if the instruction is in the control path activated by the logic it will execute.
Condition/State | Action Taken |
---|---|
Prescan | See Prescan in the Ladder Diagram table. |
Instruction first run | See Instruction first run in the Ladder Diagram table. |
EnableIn is true | See Rung-condition-in is true in the Ladder Diagram table. |
Postscan | EnableIn and EnableOut bits are cleared to false. |
Provide Feedback