DCS Function Block Programming Explained: 6 Essential Blocks Engineers Often Overlook

Share:
DCS & Automation Systems
DCS Function Block Programming Explained

A DCS doesn't run on lines of code the way a PC application does.

It runs on small, reusable pieces called function blocks, wired together like an electrical circuit made of software.

AI, AO, PID Explained Cascade Control Logic IEC 61131-3 Standard

DCS function block programming builds control strategies from small, standardized blocks like AI, AO, and PID, wired together to move a signal from field transmitter to final control element.

Ask a control systems engineer to explain how a DCS actually controls a process, and function blocks are where the answer starts. Every reading, calculation, and output in the system passes through one.

DCS function block programming

This is fundamentally different from a general purpose program written line by line. A function block is a self contained algorithm with defined inputs, outputs, and parameters, and engineers wire these blocks together visually rather than typing procedural code.

That graphical approach is formally defined under IEC 61131-3, the international standard covering programmable controller languages. Function Block Diagram, or FBD, is one of five languages the standard recognizes, alongside Ladder Logic, Structured Text, Instruction List, and Sequential Function Chart.

Advertisement
Advertisement

The 6 Essential DCS Function Blocks

Nearly every control strategy in a DCS is built from combinations of these six block types.

1

AI (Analog Input)

Reads a single measurement, such as 4 to 20 mA or a HART digital value, and converts it to engineering units.

2

AO (Analog Output)

Drives a final control element, converting a calculated value into a 4 to 20 mA signal to a valve or drive.

3

DI (Discrete Input)

Reads a single on/off status, like a switch, limit sensor, or interlock permissive.

4

DO (Discrete Output)

Drives a single on/off device, such as a motor starter, solenoid, or alarm horn.

5

PID (Proportional-Integral-Derivative)

Compares a process variable to a setpoint and calculates the corrective output every scan cycle.

6

Calculation and Logic Blocks

Perform math, comparisons, timers, and Boolean logic, often feeding safety interlocks and permissives.

Anatomy of a Function Block

Every function block, regardless of type, shares the same basic structure inside the engineering database.

Understanding these four pieces makes any vendor's configuration screen easier to read, whether it's DeltaV, CENTUM VP, or an Allen-Bradley PLC running FBD.

Definition name: the algorithm type, like AI, PID, or AND
Tag name: the unique instance name an engineer assigns, like FIC-101
Parameters: configurable inputs, outputs, alarms, and tuning constants
Execution index: the order this block runs in, relative to others in the module

Two blocks of the exact same type can behave completely differently once their parameters and tag names are set. The definition gives the algorithm, but the tag name and parameters give it a job.

Why block instances, not block types, define a control strategy
Advertisement
Advertisement

How a Signal Flows Through a Simple Control Loop

The classic example is a single PID loop controlling flow through a control valve.

AI

Reads flow transmitter, scales to engineering units

PID

Compares flow to setpoint, calculates output

AO

Converts output to 4-20 mA, drives the valve

The AO block also sends a signal back to the PID block, called back calculation. If the final control valve can't fully reach the commanded position, this feedback prevents the PID's integral term from winding up uselessly.

Cascade Control: Two PID Blocks Working Together

Not every loop is this simple. Cascade control links a primary PID block's output directly into a secondary PID block's setpoint.

A classic example pairs a slow level loop with a fast flow loop feeding it. The level controller's output becomes the flow controller's setpoint, letting the fast inner loop reject disturbances the outer loop alone would miss.

This structure is described in detail in ControlGuru's cascade control architecture guide, and a worked DCS example appears in this step by step cascade loop diagram walkthrough.

IEC 61131-3 Programming Languages Compared

FBD is only one of five standardized languages a DCS or PLC engineer might use.

🔌

Function Block Diagram (FBD)

Graphical blocks wired together, the dominant language for continuous process control in a function block diagram system.

Continuous, analog control
📋

Sequential Function Chart (SFC)

Steps and transitions describing a sequence, standard for batch process control and startup procedures.

Batch and sequencing

The AI Block: Where Real World Data Enters the System

The AI block is where a DCS meets the physical process. It has to do more than pass a number through.

It scales the raw signal, checks for out of range faults, and applies alarm limits before anything downstream ever sees the value.

Modern digital communication protocols let an AI block pull far more than just the process variable from a smart transmitter, including diagnostics and secondary variables.

The PID Block: The Workhorse of Process Control

Nothing in a DCS library gets used more than the PID block. It runs the proportional, integral, and derivative math that keeps a process variable at setpoint.

Modern PID blocks do far more than the textbook equation suggests. Emerson's own DeltaV PID function block white paper documents features like dynamic reset limiting and cascade aware tuning that go well beyond a simple formula.

Every PID block also carries a mode attribute, typically Manual, Auto, or Cascade. In Manual, the operator directly sets the output.

In Auto, the block calculates output from its own setpoint and process variable. In Cascade, its setpoint comes from another block upstream instead of an operator entry.

Switching cleanly between these modes without a sudden jump in output is called bumpless transfer, and it's one of the details that separates a well engineered DCS function block programming strategy from a rough one that upsets the process every time an operator changes modes.

Simplified PID Output (Position Form)
Output = Kp x Error + Ki x Integral(Error) + Kd x d(Error)/dt
Where Error = Setpoint - Process Variable
Kp = proportional gain, Ki = integral gain, Kd = derivative gain

A real DCS PID block also adds bias, output limits, and back calculation
for bumpless transfer between Manual, Auto, and Cascade modes.

Logic and Interlock Blocks

Not every block modulates a valve. Logic blocks like AND, OR, and comparators build the permissives and interlocks that keep equipment safe.

These sit right alongside process control blocks in the same function block diagram, though safety critical logic is more often handled by a dedicated safety system, as covered in this site's SIS safety lifecycle guide.

Function Block Types Compared

Here's a quick reference for where each block type typically lives and what it actually does.

Block TypeTypical LocationPrimary Function
AIController I/O card or field transmitterReads and scales a process measurement
AOController I/O card or valve positionerDrives a final control element
DI / DOController I/O cardReads or drives an on/off signal
PIDController (occasionally in field devices)Calculates a corrective control output
Logic/CalcControllerMath, comparisons, interlocks, sequencing

Where Function Block Programming Is Used

🏭

Refineries

Distillation column temperature and pressure control loops.

Power Generation

Boiler drum level and combustion control strategies.

💧

Water Treatment

Chemical dosing and clarifier level control loops.

🏷

Pharmaceutical Batch

Sequential recipe steps built from SFC and FBD together.

🚜

Oil and Gas Processing

Separator level and pressure cascade control.

🔥

Pulp and Paper

Consistency and flow control across the production line.

Troubleshooting a DCS Function Block Strategy

When a loop misbehaves, the fastest diagnosis usually starts right inside the function block itself, not the physical wiring.

Most DCS engineering tools let a technician step through a strategy online, watching live input and output values on every block in the chain.

A PID stuck in Manual mode, an AI reading a frozen value, or an AO clamped at a limit are all visible immediately this way, long before anyone needs to check a terminal strip in the field.

Getting comfortable reading these live values is one of the fastest ways to build real proficiency in DCS function block programming, since the block diagram itself becomes the troubleshooting map.

Module Scheduling and Execution Order

A DCS controller doesn't run all its function blocks at once. It scans through them in a defined order, over and over, many times per second.

Execution index controls that order within a module. If a calculation block reads a value from an AI block, the AI block has to execute first in the same scan, or the calculation reads stale data from the previous cycle.

Larger strategies get organized into control modules, treated as a single named entity even though they may contain a dozen or more linked blocks internally. This modularity is what makes strategies portable between similar equipment and easy to troubleshoot one piece at a time.

Execution speed also varies by block type. A fast AI block feeding a PID loop might scan every 250 milliseconds, while a slow calculation feeding an operator display might only need to update once every few seconds, and DCS engineers assign different execution rates accordingly to balance controller load.

Foundation Fieldbus: When Function Blocks Live in the Field

Not every function block has to run inside the DCS controller. Foundation Fieldbus pushes that same block concept out into smart field instruments themselves.

In a fieldbus loop, the AI block naturally lives in the transmitter, since only the transmitter can measure the process. The AO block lives in the valve positioner, since only the valve can act on the process.

The PID block, interestingly, can live in either device. This flexibility is explained in detail in this Foundation Fieldbus function block logic guide, which walks through exactly how AI, PID, and AO blocks link together without a separate controller in the loop at all.

This distributed intelligence is part of where the "distributed" in DCS actually comes from historically, even though most modern systems still centralize the bulk of their control execution in redundant controllers rather than the field devices themselves.

Redundancy in Function Block Execution

Critical loops can't afford to lose control just because one input card fails. Many DCS platforms support dual redundant I/O specifically for this reason.

A special selector block reads from two physically separate input modules simultaneously, and automatically switches to the healthy one if a fault develops on either channel. Yokogawa's CENTUM VP documentation describes this exact mechanism for its dual redundant analog input configuration.

The PID block downstream never needs to know a failover happened. It keeps reading a single, continuous process variable regardless of which physical card is actually supplying the data underneath it.

Advertisement
Advertisement

Do's and Don'ts of Function Block Configuration

✓ Do

  • Use clear, consistent tag naming across every module
  • Wire back calculation signals to prevent integral windup
  • Document execution order for interdependent blocks
  • Reuse vendor tested library blocks instead of custom logic

✗ Don't

  • Leave alarm limits at default values without process review
  • Mix safety interlocks into basic process control modules
  • Ignore execution index when blocks depend on each other's output
  • Skip bumpless transfer testing between Manual and Auto modes
Advertisement
Advertisement

Live PID Output Preview Calculator

Enter a setpoint, process variable, and proportional gain to see the proportional term's contribution to controller output.

🧮 PID Proportional Output Calculator
-
Error (SP - PV)
-
Proportional Output

Reference Materials on DCS Function Block Programming

PDF
Key Features of the DeltaV PID Function Block
Emerson white paper: advanced PID functionality beyond the basic algorithm
PDF
Common Process Loop Algorithms Using the PIDE Instruction
Rockwell Automation white paper: cascade, ratio, and adaptive gain in FBD

FAQs on DCS Function Block Programming

What is a function block in a DCS?
It's a self contained algorithm, like AI, AO, or PID, with defined inputs, outputs, and parameters, that engineers wire together graphically to build a control strategy instead of writing procedural code.
What programming languages does IEC 61131-3 define?
Five languages: Function Block Diagram, Ladder Logic, Structured Text, Instruction List, and Sequential Function Chart, each suited to different types of control logic.
Why does the AO block send a signal back to the PID block?
This back calculation signal tells the PID block whether the final control element actually reached its commanded position, preventing the integral term from winding up if the valve or drive can't respond.
What is cascade control in function block terms?
It's when one PID block's calculated output feeds directly into a second PID block's setpoint, letting a fast inner loop handle disturbances a slower outer loop alone would miss.
Does execution order matter for function blocks?
Yes. Each block has an execution index, and blocks that depend on another block's output must be scheduled to run after it within the same scan cycle, or the control strategy will use stale data.
Is FBD the same across every DCS vendor?
The concept follows IEC 61131-3 across vendors like Emerson DeltaV, Yokogawa CENTUM VP, and ABB, but block libraries, naming conventions, and specific parameters differ from one system to another.

External References

What we learn today

  • DCS function block programming builds control strategies from standardized blocks like AI, AO, DI, DO, PID, and logic blocks, wired together instead of coded line by line.
  • Every block shares the same anatomy: a definition name, a unique tag name, configurable parameters, and an execution index.
  • A simple loop flows AI to PID to AO, with a back calculation signal returning from AO to PID to prevent integral windup.
  • Cascade control links a primary PID block's output into a secondary PID block's setpoint, letting a fast inner loop handle disturbances.
  • FBD is one of five IEC 61131-3 languages, and while the concept is standardized, block libraries differ from vendor to vendor.
"I hope you like above blog. There is no cost associated in sharing the article in your social media. Thanks for reading!! Happy Learning!!"

Leave a Reply

Your email address will not be published. Required fields are marked *