Problem Description
When compiling a SIMATIC PCS 7 project in the CFC (Continuous Function Chart) editor, the compiler aborts with the following error message in the log window:
E: Necessary files are missing for block CH_AI.
Please note that you have to install exactly the same version
of the library as the one this block was imported from.
The error is generated by the CFC compiler when it cannot resolve a block instance back to a block type that exists in the project's Master Data Library (the S7 program / Charts container that holds imported block types). In the field-reported case the program was originally authored on an engineering station running PCS 7 V7.1 SP2 and was subsequently opened and recompiled on an engineering station running PCS 7 V7.1 SP3. The project itself reports that the local copy of the CH_AI block is "the same version", but the linker still fails.
The diagnostic surface for this error class always includes:
- CFC compile log line beginning with
E:(error) followed by the affected FDB / block instance name. - The S7 program folder structure losing the registration of the block in
<S7Program>\Blocksor in the type/source registration list. - PCS 7 Library version visible under Start > SIMATIC > PCS 7 > PCS 7 Library showing different service pack / update levels on the two workstations.
Affected Products and Versions
| Component | Confirmed Version | Notes |
|---|---|---|
| SIMATIC PCS 7 | V7.1 SP2 | Original authoring station |
| SIMATIC PCS 7 | V7.1 SP3 | Target / recompile station |
| PCS 7 Library | V7.1 + SP2 | Required to match block source |
| PCS 7 Library | V7.1 + SP2 + Upd1 | Higher update available on SP3 station; not interchangeable |
| Block | CH_AI (Channel Analog Input) | Standard PCS 7 driver block, part of PCS 7 APL / driver library |
| Engineering Tool | CFC V7.1 SP2 / SP3 | Compiler version is tied to installed PCS 7 DVD |
Although the symptom is reported on V7.1, the same fault class is observed on every PCS 7 release from V6.1 through V9.1 whenever the engineering station's installed PCS 7 Library does not exactly match the library level that produced the block type inside the project. See the Siemens Industry Online Support entry list for PCS 7 library / missing files for cross-release confirmation.
Root Cause Analysis
The PCS 7 block model relies on a strict type-instance relationship managed by the S7 / CFC toolchain:
- Block types (FB / FC source plus interface description) live in the PCS 7 Library shipped on the installation DVD and updated via Hotfix packages.
- When a block is dropped into a CFC chart, the type is registered into the project's Master Data Library / S7 Program container and the chart stores an instance reference (block number, interface time stamp, library version stamp).
- The CFC compiler validates every instance against the type registry before generating STL or the download. If the type registry cannot find a block type whose time stamp, family, and version stamp match the instance reference, it raises the "Necessary files are missing" error.
The decisive detail in this case: the project was opened on an engineering station whose installed PCS 7 Library level (V7.1 + SP2 + Upd1) was one update higher than the level used to author the project (V7.1 + SP2). The block binaries on disk are binary-incompatible at the FB interface time stamp level even when the human-readable version label appears identical, which is why the engineering tool reports "the same version" while the linker disagrees.
Symptoms and Error Variants
| Symptom | Tool / Window | Likely Cause |
|---|---|---|
E: Necessary files are missing for block CH_AI |
CFC Compile Log | Type not in project master data library |
W: Block type FBxxx not found in S7 program |
CFC Compile Log | Block number conflict after library swap |
| Type catalog shows block greyed out | CFC Editor > Library tab | Library version installed is lower than chart's expected version |
S7 Program: cannot generate system data |
NetPro / HW Config | Incomplete S7 program after partial library update |
Charts compile but AS download fails with FB not found on target
|
Download dialog | Block type uploaded but interface time stamp newer than CPU firmware supports |
Operator station shows red IO fault on AI channel after download |
WinCC / Operator Station | CH_AI instance parameters point to new block revision but driver wiring preserved old revision |
Other driver blocks that share the same library family and therefore produce the same error class include CH_AO, CH_DI, CH_DO, MOT_SPEED, MOT_SPD, CTRL_PID, CTRL_S, VFD, VALVE_ANA, VALVE_DIG, COUNT, and DOSE. Whenever the error text names a block whose name begins with CH_ or belongs to the PCS 7 APL driver set, treat the diagnosis as library-mismatch until proven otherwise.
PCS 7 Library Architecture (Background)
Understanding the layout prevents recurrence. The PCS 7 Library is delivered on the installation DVD and updated through the Siemens Hotfix / Update mechanism. Three independent concepts must remain consistent:
| Layer | Location | Owner | Updated by |
|---|---|---|---|
| Library DVD content | Programs\Siemens\Automation\PCS7\Library |
Siemens | Re-installation / Hotfix |
| Project Master Data Library |
<Project>\S7 Program\Blocks plus type catalog entries in CFC |
Project engineer | CFC > Options > Block Types |
| Block instance in chart | Embedded in CFC chart DBs | Project engineer | Implicit — driven by type catalog |
Because the project master data library is populated by the engineer through the CFC type catalog, a project that is opened on a station whose installed Library level differs will not be auto-corrected. The two layers will continue to disagree every time the project is compiled, until the engineer either (a) brings the installed Library down to the project's level, or (b) re-imports the higher-level block into the project master data library and updates all instances.
Pre-Upgrade Checklist
Before touching the project, verify the following on both engineering stations:
-
PCS 7 DVD / installation version: open SIMATIC Manager > Help > About and read the exact build string. Expected formats include
PCS 7 V7.1 + SP2 (K7.1.2.x)andPCS 7 V7.1 + SP3 (K7.1.3.x). -
PCS 7 Library version: open Start > SIMATIC > PCS 7 > PCS 7 Library and note the library level, e.g.
V7.1 + SP2orV7.1 + SP2 + Upd1. Document both stations. -
Block instance version stamps: open the affected CFC chart, select the
CH_AIinstance, and read the comment / type info. The PCS 7 driver blocks annotate the version (for exampleCH_AI V7.1 SP2 Upd1) on the block header. -
S7 program folder integrity: in the component view, expand the S7 program and confirm the
Blocksfolder is present and not flagged with the red "missing type" icon. -
Project backup: archive the project using SIMATIC Manager > File > Archive before any modification. A backup of the S7 program only is not sufficient; the CFC source files (
*.f7s) are required for a clean restore.
Resolution — Step-by-Step
The fix has two phases. Phase A aligns the engineering stations to the same Library level. Phase B refreshes the project master data library and block instances.
Phase A — Align Library Versions
- On the target station (the one running PCS 7 V7.1 SP3), uninstall the higher Library level
V7.1 + SP2 + Upd1if it is not required by other open projects, then install the lower Library levelV7.1 + SP2from the original PCS 7 V7.1 SP2 DVD. The installer adds the Library toPrograms\Siemens\Automation\PCS7\Library. Reference: PCS 7 V7.1 product information. - Alternatively, keep the higher Library level on the SP3 station and adopt it as the new project standard — then proceed to Phase B to push the higher revision into every affected project.
- Document the chosen Library level. From this point forward the team must agree on a single Library baseline; mixed levels across engineering stations are the root cause of this entire error class.
Phase B — Refresh Block Types in the Project
- Open the project in SIMATIC Manager on the chosen baseline station.
- Open the CFC Editor for the affected S7 program (Charts folder > right-click > Open).
- From the menu choose Options > Block Types. The dialog opens with the left-hand pane showing block types installed on the local station and the right-hand pane showing block types currently in the project master data library.
- Locate
CH_AIin the left pane (use the Find box if the catalog is long). Select it. - Click the "→" button (or Add to project) to push the selected block type from the installed Library into the project master data library.
- If a confirmation dialog appears asking whether to overwrite existing types, answer Yes. The CFC tool will reconcile the FB time stamps.
- Repeat for every other block flagged in the compile log (typically the complete
CH_family:CH_AI,CH_AO,CH_DI,CH_DO). - Close the Block Types dialog.
- From the menu choose Options > Chart Check ("Check consistency"). Confirm that the
Necessary files are missingerror no longer appears. - From the menu choose Chart > Compile > Charts. Monitor the log until all charts show
0 errors, 0 warnings.
Phase B Alternative — Update Block in Place
If only a single chart is affected and the engineer prefers an in-place fix:
- Open the chart.
- Select the
CH_AIinstance. - Right-click and choose Block > Update Block Type.
- If the installed Library offers a newer revision of
CH_AI, the tool will prompt to either keep or replace the existing instance. Choose Replace with new version if the I/O wiring has already been migrated; otherwise review the parameter delta manually.
Verification
| Check | How | Pass Criterion |
|---|---|---|
| Compile log | CFC > Chart > Compile > Charts | No E: Necessary files are missing lines |
| Chart consistency | CFC > Options > Chart Check | Status bar reports OK
|
| Block number assignment | SIMATIC Manager > S7 Program > Blocks > right-click > Object Properties | FB number matches Library default (e.g. CH_AI → FB1869 in PCS 7 V7.1) |
| AS download dry-run | CFC > PLC > Download > Consistency check only | No missing-type messages |
| Operator station | WinCC OS picture with the channel | No IO fault / channel-quality bad after download |
| Cross-station reproducibility | Open the project on the second engineering station and recompile | Same result (0 errors) |
Library Installation Locations and File Layout
For a self-check before calling Siemens Support, confirm the Library files physically exist where the CFC tool expects them:
C:\Program Files\Siemens\Automation\PCS7\Library\V7.1\SP2\Driver\CH_AI\CH_AI.f7s
C:\Program Files\Siemens\Automation\PCS7\Library\V7.1\SP2\Driver\CH_AI\CH_AI.scl
C:\Program Files\Siemens\Automation\PCS7\Library\V7.1\SP2\Driver\CH_AI\CH_AI.bmp
C:\Program Files\Siemens\Automation\PCS7\Library\V7.1\SP2\Driver\CH_AI\CH_AI.ico
The .f7s file is the CFC source, the .scl file is the SCL source that compiles into the FB, and the .bmp / .ico files are the faceplate / type-catalog icons. The error "Necessary files are missing" can be triggered by any of these three layers being absent. Reference: PCS 7 V8.2 — PCS 7 Library documentation and the equivalent V7.1 release notes inside the Siemens Industry Online Support portal.
Block Number Allocation for Driver Blocks
The PCS 7 driver block family uses fixed FB numbers that are guaranteed by the Library installer. When a project is opened on a station whose Library is incomplete, the FB numbers visible in the chart may "fall back" to placeholder numbers, which is another symptom of the same root cause:
| Block | Function | Default FB (PCS 7 V7.1) | Family |
|---|---|---|---|
| CH_AI | Channel Analog Input | FB1869 | Driver |
| CH_AO | Channel Analog Output | FB1870 | Driver |
| CH_DI | Channel Digital Input | FB1867 | Driver |
| CH_DO | Channel Digital Output | FB1868 | Driver |
| MOT_SPEED | Motor speed-controlled | FB1650 (range) | Driver |
| CTRL_PID | PID controller | FB1869 family | Control |
| VALVE_ANA | Analog valve | FB180x range | Driver |
| COUNT | Counter channel | FB184x range | Driver |
Preventive Measures
- Standardize one Library baseline per plant. Document the Library level (e.g. "PCS 7 Library V7.1 + SP2 + Upd1") in the project quality plan and re-install it on every new engineering station.
- Apply Hotfixes uniformly. When Siemens releases a Hotfix for the PCS 7 Library, schedule its rollout across all engineering stations in the same maintenance window.
-
Track Library version in the project header. Add a custom project property
LibraryBaseline = V7.1+SP2+Upd1and enforce its presence through a project housekeeping script. - Use SIMATIC Version Cross Manager (VXM) to detect Library drift between engineering stations. Reference: SIMATIC Version Cross Manager overview.
- Archive the Library CD image in a read-only repository so future rebuilds can reproduce the exact Library baseline.
-
Run a Chart Check at every project handover (FAT, SAT, hot-fix application). Treat any
E: Necessary files are missingline as a release blocker.
Troubleshooting Matrix
| Observed Symptom | Primary Check | Secondary Check | Fix |
|---|---|---|---|
E: Necessary files are missing for block CH_AI |
CFC > Options > Block Types — is CH_AI on the project side? | Installed Library version on station | Add CH_AI to project master data library |
| Same error appears after Phase B | Other driver blocks (CH_AO, CH_DI, CH_DO) also missing? | Driver sub-library installed? | Install full PCS 7 Library Driver subset |
| Block re-imported but warning remains | FB time stamp conflict | Chart instance pins to older time stamp | Update Block in place (right-click > Block > Update) |
| Compile passes on one station, fails on another | Compare Library versions across both stations | Library Hotfix parity | Re-align Library baselines |
Chart compiles but AS download fails with FB not found
|
S7 program > Blocks > FBs folder | CPU firmware compatibility | Update CPU firmware to a version that supports the FB time stamp |
| OS shows channel quality BAD after download | Driver wiring tab in CH_AI instance | Hardware configuration slot assignment | Re-link slot / channel and re-download |
Related Errors and Cross-References
-
E: Block type FBxxxx not registered in S7 program— same root cause; fix through Phase B. -
E: Incompatible interface time stamp at block ...— requires Block > Update Block Type. -
W: Block family CH_AI_xx not found in installed library— Library subset was not installed; install Driver sub-library. -
E: SFC / SFB not found during compilation— CPU firmware does not provide the system block; update firmware or remove the SFC instance.
For authoritative guidance see the Siemens Industry Online Support portal entry for PCS 7 (entry ID 109739932 for V9.0, 109751826 for V8.2, 66807294 for V7.1) and the in-product help under CFC Editor > Options > Block Types.
What does the error "Necessary files are missing for block CH_AI" mean in PCS 7?
The CFC compiler cannot find the type definition of CH_AI (Channel Analog Input) in the project master data library. The most common cause is a version mismatch between the PCS 7 Library installed on the engineering station and the library level that was used to insert the block into the project. For example, authoring on PCS 7 V7.1 SP2 with Library V7.1+SP2 and compiling on a station with Library V7.1+SP2+Upd1 produces this error even though the human-readable version label looks identical.
How do I update block types in a PCS 7 project?
Open the CFC Editor, choose Options > Block Types, select the missing block (e.g. CH_AI) in the left-hand installed-library pane, click the right-arrow to push it into the project master data library, confirm the overwrite prompt, then run Options > Chart Check and Chart > Compile > Charts. For per-instance revision changes, right-click the block in the chart and choose Block > Update Block Type.
Can I keep a higher Library level on my engineering station and still compile older projects?
Yes, but only if you also push the higher-level type into the project master data library through Options > Block Types. The project will then compile against the higher revision, which may change parameter semantics on driver blocks such as CH_AI. If the I/O wiring must remain byte-for-byte identical, downgrade the station's Library to match the project's original level instead.
Will re-importing the block change the FB number?
If the Library level matches the one already in the project, the FB number remains stable (for example CH_AI → FB1869 in PCS 7 V7.1). If you upgrade to a later Library release, the driver family may be renumbered, which causes HW Config wiring to break. Always document FB numbers before and after a Library upgrade and re-wire affected signals in HW Config.
How can I prevent this error in a multi-engineer team?
Standardize on a single PCS 7 Library baseline across every engineering station, document it in the project quality plan, store the Library DVD image read-only, apply Hotfixes uniformly, and add a Chart Check to the project handover procedure. The Siemens SIMATIC Version Cross Manager can be used to detect Library drift between engineering stations.