Resolving FC Number Conflicts When Adding Integer Math Blocks (ADD_I) in SIMATIC PCS 7 CFC

Resolving FC Number Conflicts When Adding Integer Math Blocks (ADD_I) in SIMATIC PCS 7 CFC

To resolve block number conflicts when inserting elementary integer math blocks like ADD_I (FC80) into a PCS 7 CFC chart, copy the ADD_I block from the CFC Library into the offline S7 Program's Blocks folder in SIMATIC Manager. When prompted with the block number collision dialog, assign a free FC number (such as FC580). Update the Symbol Table with the new FC number under the symbol ADD_I. Then in the CFC Editor, execute 'Options > Block Types', import the renamed FC from the offline block folder into the Chart folder, and place it into your charts. Alternatively, convert the integer to REAL using IntToReal, perform addition via standard APL Add04, and convert back using RealToInt.

Table of Contents

Executive Summary

In SIMATIC PCS 7 continuous function chart engineering, automation engineers regularly require basic integer arithmetic, such as incrementing step counters, tracking recipe cycle passes, or calculating operational batch offsets. The CFC Library provides elementary integer math functions under ELEMENTA\MATH_INT, including ADD_I (16-bit integer addition) and ADD_DI (32-bit double integer addition). However, ADD_I is assigned by default to FC80. In many legacy projects, third-party driver packages, or specialized libraries (such as SEA, Modbus, or custom communication blocks), FC80 is already assigned to another function (e.g. TONR). Attempting to drag ADD_I into CFC triggers a compile or insertion error: 'Block FC80 already exists'. Resolving this issue cleanly requires understanding how PCS 7 manages block numbers, symbol tables, and chart folder type pools.

Root Cause: FC Number Space Collisions in S7 Block Containers

In SIMATIC STEP 7 and PCS 7, the controller memory model reserves FC numbers (FC0 through FC65535, depending on CPU architecture). When a block is inserted into a CFC chart:

  • The CFC editor checks whether a block with the same FC number already exists in the CPU offline Blocks container.
  • If the existing block has a different symbolic name or interface (e.g. TONR occupying FC80), the editor halts insertion to prevent catastrophic overwriting of active program logic.
  • In standard PCS 7 libraries, block numbers FC60 to FC99 were historically utilized by early elementary math functions, making collisions frequent when third-party libraries are present.

The CFC Elementary Math Library Architecture

The CFC elementary library (CFC Library [Current]) contains raw machine blocks organized by mathematical family:

  • MATH_INT: ADD_I (FC80), SUB_I (FC81), MUL_I (FC82), DIV_I (FC83), MOD_I (FC84).
  • MATH_DI: ADD_DI (FC85), SUB_DI (FC86), MUL_DI (FC87), DIV_DI (FC88), MOD_DI (FC89).
    These elementary blocks execute in a fraction of a microsecond because they represent direct MC7 processor opcodes without the substantial status processing, alarm overhead, or faceplate structures found in APL blocks.

Comparing FC Renumbering vs Native APL REAL Math Strategies

The following table compares architectural methods for performing integer math in PCS 7 CFC:

Engineering MethodImplementation MechanismCPU OverheadBlock Number ImpactRecommended Use CaseRenumbered ADD_I (FC)Assign new FC (e.g. FC580) in Symbol TableExtremely low (single MC7 op)Consumes 1 user FC numberHigh-frequency integer counters and loops.APL Add04 + ConvertersIntToReal -> Add04 -> RealToIntModerate (REAL conversion)Zero (uses standard APL FBs)General plant logic where FC renumbering is restricted.Custom SCL BlockCompile SCL function: OUT := IN1 + IN2;Extremely lowConsumes 1 user FC/FB numberComplex custom math with saturation and clamp checks.SFC Step CalculationAssign calculation directly in SFC step actionVery lowZero additional blocksState-dependent sequence step incrementing.

Step-by-Step Procedure to Renumber and Import ADD_I (FC80)

Method 1: Renumbering ADD_I into the Project Block Folder

  1. Open SIMATIC Manager.
  2. Open the CFC standard library (File > Open > Libraries > CFC Library).
  3. In the CFC Library, navigate to Blocks > MATH_INT and select ADD_I (FC80).
  4. Copy ADD_I (Ctrl + C).
  5. In your multiproject, open the target CPU's S7 Program > Blocks folder.
  6. Paste ADD_I (Ctrl + V). SIMATIC Manager displays a collision warning prompt: 'FC80 already exists. Do you want to rename it?'
  7. Click Yes, and enter an unused FC number (e.g. FC580).
  8. Open the CPU's Symbols table. Locate the row for FC580, enter Symbol ADD_I, and save the symbol table.
  9. Open any CFC chart in the project. Select Options > Block Types.
  10. In the left pane (Block folder offline), select ADD_I (FC580) and click -> to move it to the Chart folder.
  11. In the CFC catalog, expand the Blocks tab (not the Library tab). Drag ADD_I directly into your chart.

Method 2: Using Native APL Signal Converters (Zero Collision Risk)

  1. Open the CFC chart.
  2. From the APL library, insert block IntToReal (converts INT input to REAL).
  3. Insert block Add04 (APL 4-input REAL addition block).
  4. Connect IntToReal.Out to Add04.In1, and set Add04.In2 to 1.0.
  5. Insert block RealToInt and connect Add04.Out to RealToInt.In.
  6. Use RealToInt.Out as your incremented integer variable.

Verification

To verify proper function of the renumbered or converted integer addition:

  1. CFC Compilation: Execute Chart > Compile > Changes Only. Confirm that compilation finishes with 0 errors and 0 warnings.
  2. Online Delta Download: Perform a delta download to the AS controller or S7-PLCSIM.
  3. Online Monitoring: Switch CFC to Test Mode. Toggle the increment trigger or monitor the addition in real time to verify that OUT = IN1 + IN2 without numeric truncation.

Limitations and Operational Precautions

  • Integer Overflow Risks: Standard 16-bit integers (INT) overflow at +32767. If incrementing continuously, implement clamping or utilize double integer blocks (ADD_DI) with limits (-2,147,483,648 to +2,147,483,647).
  • Master Data Library Consistency: When renumbering blocks in a multiproject, always copy the renumbered block into the Master Data Library (MDL) to ensure clean synchronization across all AS controllers.
  • Library Updates: Running 'Update Block Types' from the standard CFC library can inadvertently overwrite your renumbered block if the source catalog points back to the unmodified library.

Engineer FAQ

Can I use ADD_I to add a negative integer for subtraction?

Yes, connecting a negative integer (e.g. -1) to IN2 performs subtraction natively.

Why did CFC not let me drag ADD_I from the CFC Library tab directly?

Dragging directly from the standard library attempts to use the fixed default number FC80. Renumbered blocks must be placed from the 'Blocks' tab.

Does ADD_I support quality code / bad status propagation?

No. Elementary CFC math blocks operate strictly on raw integer values; quality codes must be handled via APL channel drivers or logic flags.

Technical References

Related Articles

Related Tags

  • https://industrialautomation.net/search?query=simatic-pcs7
  • https://industrialautomation.net/search?query=cfc-editor
  • https://industrialautomation.net/search?query=block-types
  • https://industrialautomation.net/search?query=step7
6 respuestas