Bulk Engineering for DCS/PLC Automation
The Problem
Typical mid-size plant: 200-500 motors, 100-300 valves, 500-2000 analog loops, 200-1000 discrete I/O. Manual configuration: 15-60 min/instance. Bulk engineering reduces months to days.
General Pipeline
[Instrument Index / Motor List / Valve List] (Excel/CSV input)
|
v
[Engineering Database] (SQLite / structured data)
|
v
[Template Library] + [Configuration Rules]
|
v
[Code Generator] (Python + Jinja2 / string replacement)
|
v
[DCS/PLC Project Files] (PRT, XML, FHX, etc.)
|
v
[Validation] (cross-reference check, naming, completeness)
|
v
[Import to DCS Engineering Tool]
Input Documents
| Document |
Contains |
Used For |
| Instrument Index (I/O List) |
Every tag, type, range, units, alarms, P&ID ref |
Tag creation, scaling, alarms |
| Motor List |
Motors with power, starter type, protections, interlocks |
Motor block generation |
| Valve List |
Valves with type, fail position, actuator |
Valve block generation |
| Control Narrative |
Control logic descriptions per unit |
Logic implementation |
| Cause & Effect Matrix |
Safety/interlock logic in tabular form |
Interlock logic generation |
Output Artifacts
- Controller programs (function block instances + logic + parameters)
- I/O assignments (channel-to-tag mapping)
- HMI/operator displays (graphics, faceplates, navigation)
- Alarm configuration (priorities, limits, deadbands)
- Historian tags (trend definitions, storage rates)
- OPC server configuration
ABB Freelance Bulk Engineering (Primary Target)
Method 1: PRT File Templating (Recommended)
- Create a "golden" template PRT for each type (motor, valve, analog, etc.)
- Export as .prt file
- Programmatically for each new instance:
- Read template with UTF-16 encoding
- Replace all identifiers (node name, MSR name, EAM signals, descriptions)
- Update parameters
- Set checksum to
0000000000
- Write output .prt file
- Import each .prt into target project in Freelance Engineering Workplace
Template Replacement Map (Motor)
| Element |
Template |
Replace With |
| Node name |
11301CLWW1A1 |
{area}{equip}{num} |
| MSR primary |
11301.CLWW.1A1 |
{area}.{prefix}.{num} |
| MSR short |
11301.CW.1A1 |
{area}.{short}.{num} |
| Graph ref |
g11301CLWW1A1 |
g{area}{equip}{num} |
| Description |
PHO RCK EXTR CNVR-1 |
{description} |
| EAM signals |
XA1/XA2/XB1/XL/XS1/XS2 + node |
Same prefixes + new node |
Method 2: CSV Full Project Manipulation
Parse full project CSV, add new sections, re-import. More powerful but higher risk.
Method 3: DMF Display Templating
- Create template display in DigiVis
- Export as .DMF
- For each new display:
- Replace TXL text entries (tag names, descriptions, units)
- Replace ODB variable bindings (DIGI addresses)
- Update display navigation references
Key Challenges
- UTF-16 encoding: Must read/write correctly
- Internal cross-references: EAM, MSR, LAD:PARA_REF must be consistent
- Checksum: Set to 0, Freelance recalculates
- Unique naming: No duplicates allowed
- Area mapping: Tags must map to correct area codes
Siemens TIA Portal Bulk Engineering
TIA Openness API (.NET)
using Siemens.Engineering;
using Siemens.Engineering.SW;
TiaPortal tia = new TiaPortal(TiaPortalMode.WithUserInterface);
Project project = tia.Projects.Open(new FileInfo(@"Project.ap17"));
PlcSoftware sw = device.GetService<PlcSoftware>();
sw.BlockGroup.Blocks.Import(new FileInfo(@"MotorFB.xml"), ImportOptions.Override);
PlcTagTable table = sw.TagTableGroup.TagTables.Create("Motors");
SiVArc (HMI Auto-Generation)
Rules-based: define rules like "For every MotL FB, create faceplate." Reads PLC structure, auto-generates WinCC displays.
Emerson DeltaV Bulk Engineering
Class-Based Configuration (Most Powerful)
Define module template (class) -> instantiate many -> template changes propagate to all instances.
FHX File Generation
MODULE TEMPLATE "MT_MOTOR_1SPD" /
MODULE_CLASS = DEVICE /
{
FUNCTION_BLOCK "DC-1" / DEFINITION = "DC" /
{ ATTRIBUTE MODE_BLK.TARGET = AUTO ; ... }
}
Text-based, parseable, generatable with Python.
Recommended Technology Stack
| Component |
Technology |
Purpose |
| Language |
Python 3.10+ |
Core automation |
| Excel I/O |
openpyxl, pandas |
Read input spreadsheets |
| Templates |
Jinja2 / string.Template |
Generate output files |
| Database |
SQLite |
Engineering database |
| File I/O |
codecs (UTF-16) |
Read/write Freelance files |
| XML |
lxml |
PLCopen XML, SimaticML |
| Validation |
pydantic |
Data validation |
| GUI (opt) |
Streamlit / PyQt6 |
User interface |
| VCS |
Git |
Version control |
Python Template Approach
import codecs
import re
import pandas as pd
# Read motor list
motors = pd.read_excel('motor_list.xlsx')
# Read template
with codecs.open('MOT_template.prt', 'r', 'utf-16') as f:
template = f.read()
# Generate for each motor
for _, motor in motors.iterrows():
output = template
output = output.replace('11301CLWW1A1', motor['node_name'])
output = output.replace('11301.CLWW.1A1', motor['msr_name'])
output = output.replace('PHO RCK EXTR CNVR-1', motor['description'])
# ... more replacements
# Reset checksum
output = re.sub(r'\[CHECKSUM\];.*', '[CHECKSUM];0000000000', output)
with codecs.open(f"{motor['node_name']}.prt", 'w', 'utf-16-le') as f:
f.write('\ufeff' + output)
NAMUR NE 148 Requirements
The NAMUR standard for automation engineering tools mandates:
- Single data source - one instrument defined once, used everywhere
- Template-based engineering - define once, instantiate many
- Bulk operations - create/modify/delete in mass
- Consistency checking - validate cross-references
- Import/export - Excel and P&ID tool integration
- Version management - track changes
- Multi-user - concurrent engineering
- Target independence - generate for multiple DCS targets
Third-Party Tools
| Tool |
Vendor |
Description |
| SmartPlant Instrumentation |
AVEVA |
Central instrument DB, generates DCS configs for all vendors |
| COMOS |
Siemens |
P&ID to PLC code, TIA Portal integration |
| Engineering Base |
AUCOTEC |
Object-oriented, multi-DCS output |
| Unity App Generator |
Schneider |
Excel-based Modicon PLC generation |
| Ignition |
Inductive Automation |
Database-driven SCADA/HMI with Python scripting |
Asset-Centric vs Signal-Centric
Signal-Centric (Traditional): Start from I/O signals. AI_Card1_Ch3 -> create tag -> configure. Matches hardware but disconnected from equipment.
Asset-Centric (Modern): Start from physical equipment. Pump P-101A includes motor, flow, pressure, vibration, protection. Easier to template. Aligned with ISA-88/95.
| Approach |
ABB Freelance |
Siemens PCS 7 |
Emerson DeltaV |
| Support |
Moderate (MSR hierarchy) |
Moderate (plant hierarchy) |
Strong (class-based) |
1---2name: bulk-engineering3description: Bulk engineering approaches, tools, and implementation strategies for mass-generating PLC/DCS control logic, HMI displays, and I/O configurations from engineering databases. Use when planning or implementing automation of DCS engineering workflows.4user-invocable: false5metadata:6 source: https://skillmd.com/skills/claude-dev-suite/bulk-engineering7---89# Bulk Engineering for DCS/PLC Automation1011## The Problem1213Typical mid-size plant: 200-500 motors, 100-300 valves, 500-2000 analog loops, 200-1000 discrete I/O. Manual configuration: 15-60 min/instance. Bulk engineering reduces months to days.1415## General Pipeline1617```18[Instrument Index / Motor List / Valve List] (Excel/CSV input)19 |20 v21[Engineering Database] (SQLite / structured data)22 |23 v24[Template Library] + [Configuration Rules]25 |26 v27[Code Generator] (Python + Jinja2 / string replacement)28 |29 v30[DCS/PLC Project Files] (PRT, XML, FHX, etc.)31 |32 v33[Validation] (cross-reference check, naming, completeness)34 |35 v36[Import to DCS Engineering Tool]37```3839## Input Documents4041| Document | Contains | Used For |42|----------|---------|---------|43| Instrument Index (I/O List) | Every tag, type, range, units, alarms, P&ID ref | Tag creation, scaling, alarms |44| Motor List | Motors with power, starter type, protections, interlocks | Motor block generation |45| Valve List | Valves with type, fail position, actuator | Valve block generation |46| Control Narrative | Control logic descriptions per unit | Logic implementation |47| Cause & Effect Matrix | Safety/interlock logic in tabular form | Interlock logic generation |4849## Output Artifacts50511. Controller programs (function block instances + logic + parameters)522. I/O assignments (channel-to-tag mapping)533. HMI/operator displays (graphics, faceplates, navigation)544. Alarm configuration (priorities, limits, deadbands)555. Historian tags (trend definitions, storage rates)566. OPC server configuration5758---5960## ABB Freelance Bulk Engineering (Primary Target)6162### Method 1: PRT File Templating (Recommended)63641. Create a "golden" template PRT for each type (motor, valve, analog, etc.)652. Export as .prt file663. Programmatically for each new instance:67 - Read template with UTF-16 encoding68 - Replace all identifiers (node name, MSR name, EAM signals, descriptions)69 - Update parameters70 - Set checksum to `0000000000`71 - Write output .prt file724. Import each .prt into target project in Freelance Engineering Workplace7374### Template Replacement Map (Motor)7576| Element | Template | Replace With |77|---------|----------|-------------|78| Node name | `11301CLWW1A1` | `{area}{equip}{num}` |79| MSR primary | `11301.CLWW.1A1` | `{area}.{prefix}.{num}` |80| MSR short | `11301.CW.1A1` | `{area}.{short}.{num}` |81| Graph ref | `g11301CLWW1A1` | `g{area}{equip}{num}` |82| Description | `PHO RCK EXTR CNVR-1` | `{description}` |83| EAM signals | `XA1/XA2/XB1/XL/XS1/XS2` + node | Same prefixes + new node |8485### Method 2: CSV Full Project Manipulation8687Parse full project CSV, add new sections, re-import. More powerful but higher risk.8889### Method 3: DMF Display Templating90911. Create template display in DigiVis922. Export as .DMF933. For each new display:94 - Replace TXL text entries (tag names, descriptions, units)95 - Replace ODB variable bindings (DIGI addresses)96 - Update display navigation references9798### Key Challenges991001. **UTF-16 encoding**: Must read/write correctly1012. **Internal cross-references**: EAM, MSR, LAD:PARA_REF must be consistent1023. **Checksum**: Set to 0, Freelance recalculates1034. **Unique naming**: No duplicates allowed1045. **Area mapping**: Tags must map to correct area codes105106---107108## Siemens TIA Portal Bulk Engineering109110### TIA Openness API (.NET)111112```csharp113using Siemens.Engineering;114using Siemens.Engineering.SW;115116TiaPortal tia = new TiaPortal(TiaPortalMode.WithUserInterface);117Project project = tia.Projects.Open(new FileInfo(@"Project.ap17"));118PlcSoftware sw = device.GetService<PlcSoftware>();119sw.BlockGroup.Blocks.Import(new FileInfo(@"MotorFB.xml"), ImportOptions.Override);120PlcTagTable table = sw.TagTableGroup.TagTables.Create("Motors");121```122123### SiVArc (HMI Auto-Generation)124125Rules-based: define rules like "For every MotL FB, create faceplate." Reads PLC structure, auto-generates WinCC displays.126127---128129## Emerson DeltaV Bulk Engineering130131### Class-Based Configuration (Most Powerful)132133Define module template (class) -> instantiate many -> template changes propagate to all instances.134135### FHX File Generation136137```138MODULE TEMPLATE "MT_MOTOR_1SPD" /139 MODULE_CLASS = DEVICE /140{141 FUNCTION_BLOCK "DC-1" / DEFINITION = "DC" /142 { ATTRIBUTE MODE_BLK.TARGET = AUTO ; ... }143}144```145146Text-based, parseable, generatable with Python.147148---149150## Recommended Technology Stack151152| Component | Technology | Purpose |153|-----------|-----------|---------|154| Language | Python 3.10+ | Core automation |155| Excel I/O | openpyxl, pandas | Read input spreadsheets |156| Templates | Jinja2 / string.Template | Generate output files |157| Database | SQLite | Engineering database |158| File I/O | codecs (UTF-16) | Read/write Freelance files |159| XML | lxml | PLCopen XML, SimaticML |160| Validation | pydantic | Data validation |161| GUI (opt) | Streamlit / PyQt6 | User interface |162| VCS | Git | Version control |163164## Python Template Approach165166```python167import codecs168import re169import pandas as pd170171# Read motor list172motors = pd.read_excel('motor_list.xlsx')173174# Read template175with codecs.open('MOT_template.prt', 'r', 'utf-16') as f:176 template = f.read()177178# Generate for each motor179for _, motor in motors.iterrows():180 output = template181 output = output.replace('11301CLWW1A1', motor['node_name'])182 output = output.replace('11301.CLWW.1A1', motor['msr_name'])183 output = output.replace('PHO RCK EXTR CNVR-1', motor['description'])184 # ... more replacements185186 # Reset checksum187 output = re.sub(r'\[CHECKSUM\];.*', '[CHECKSUM];0000000000', output)188189 with codecs.open(f"{motor['node_name']}.prt", 'w', 'utf-16-le') as f:190 f.write('\ufeff' + output)191```192193---194195## NAMUR NE 148 Requirements196197The NAMUR standard for automation engineering tools mandates:1981991. **Single data source** - one instrument defined once, used everywhere2002. **Template-based engineering** - define once, instantiate many2013. **Bulk operations** - create/modify/delete in mass2024. **Consistency checking** - validate cross-references2035. **Import/export** - Excel and P&ID tool integration2046. **Version management** - track changes2057. **Multi-user** - concurrent engineering2068. **Target independence** - generate for multiple DCS targets207208---209210## Third-Party Tools211212| Tool | Vendor | Description |213|------|--------|-------------|214| SmartPlant Instrumentation | AVEVA | Central instrument DB, generates DCS configs for all vendors |215| COMOS | Siemens | P&ID to PLC code, TIA Portal integration |216| Engineering Base | AUCOTEC | Object-oriented, multi-DCS output |217| Unity App Generator | Schneider | Excel-based Modicon PLC generation |218| Ignition | Inductive Automation | Database-driven SCADA/HMI with Python scripting |219220---221222## Asset-Centric vs Signal-Centric223224**Signal-Centric (Traditional):** Start from I/O signals. AI_Card1_Ch3 -> create tag -> configure. Matches hardware but disconnected from equipment.225226**Asset-Centric (Modern):** Start from physical equipment. Pump P-101A includes motor, flow, pressure, vibration, protection. Easier to template. Aligned with ISA-88/95.227228| Approach | ABB Freelance | Siemens PCS 7 | Emerson DeltaV |229|----------|--------------|---------------|----------------|230| Support | Moderate (MSR hierarchy) | Moderate (plant hierarchy) | Strong (class-based) |