Scaling Analog Signals with Precision Floating-Point Multipliers in PCS 7 CFC

Scaling Analog Signals with Precision Floating-Point Multipliers in PCS 7 CFC

In SIMATIC PCS 7 V8.1, multiplying an analog process value by a fine fractional constant such as 0.0115 is natively supported using the Advanced Process Library (APL) mathematical block Mul02 (FB1860) or scaling the raw input directly within the channel driver Pcs7AnIn (FB1869). While elementary legacy mathematical blocks or input formatting masks in older libraries may restrict direct parameter entry to two decimal places (rejecting 0.0115 while accepting 0.01), standard APL blocks utilize IEEE 754 single-precision floating-point numbers (REAL), accommodating numbers down to $\pm 1.175 \times 10^{-38}$. Alternatively, the multiplication can be executed algebraically by multiplying by an integer factor (115) and dividing by an integer divisor (10,000).

Table of Contents

Mathematical Scaling in PCS 7: Legacy vs APL Blocks

In industrial process control, analog sensor readings frequently require scaling by fractional physical constants—such as converting raw flow measurements to specific gravities, calculating caloric energy values, or applying calibration correction factors (e.g., multiplying by 0.0115).

Engineers occasionally encounter a frustrating obstacle when configuring elementary mathematical blocks: typing 0.01 is accepted, but entering 0.0115 produces an input error dialog or snaps back to a truncated decimal. This occurs because certain legacy elementary library blocks (or custom blocks with restrictive formatting attributes like S7_edit := 'para') impose formatting restrictions on parameter fields in the CFC graphical interface.

Floating-Point Representation and Parameter Entry Limits

Understanding the internal numeric formats utilized in SIMATIC controllers clarifies mathematical precision:

Data TypeBit WidthNumerical RangePrecisionCFC Parameter RepresentationREAL (IEEE 754)32-bit Float$\pm 1.175495 \times 10^{-38}$ to $\pm 3.402823 \times 10^{38}$6 to 7 decimal digitsAccepts exponential notation (e.g., 1.15e-2)DINT (Double Integer)32-bit Signed-2,147,483,648 to +2,147,483,647Exact integerUsed for integer factor scaling ($x \cdot 115 / 10000$)AnaVal (APL Struct)40-bit CompoundValue: REAL + ST: BYTE6 to 7 decimal digitsStandard APL interconnected structure

If a specific CFC input field rejects decimal entry 0.0115 due to display formatting constraints, the value can frequently be entered in scientific notation: 1.15e-2.

Method 1: Utilizing APL Mul02 for High-Precision Scaling

The recommended, guardrail-compliant approach in PCS 7 APL is to deploy the standard mathematical multiplier:

  1. In the CFC block catalog, open PCS 7 AP Library -> Math -> Mul02 (FB1860).
  2. Place Mul02 in the same cyclic interrupt task as the analog sensor (e.g., OB35).
  3. Connect the analog signal structure (e.g., Pcs7AnIn.PV_Out) to input In1.
  4. In the parameter dialog for input In2, type the constant: 0.0115 (or enter 1.15e-2).
  5. Mul02 automatically multiplies both inputs while propagating the Quality Code (ST):
    $$Out.Value = In1.Value \cdot In2.Value$$
    $$Out.ST = In1.ST$$
  6. If the input signal carries bad quality (16#00), Mul02 ensures the output status reflects the fault downstream.

Method 2: Channel Driver Scaling in Pcs7AnIn

If the factor 0.0115 represents a fixed transmitter calibration slope, the scaling can be integrated directly into the input channel driver Pcs7AnIn (FB1869) without inserting additional math blocks:

  1. Open properties of the Pcs7AnIn block in CFC.
  2. Locate the parameters Scale.High and Scale.Low.
  3. Adjust the high scale limit proportionally. For example, if a 0–100% signal must be scaled by 0.0115, set:
    - Scale.Low = 0.0
    - Scale.High = 1.15
  4. The channel driver's internal floating-point conversion algorithm scales the raw analog-to-digital counts across the adjusted range directly, saving CPU execution cycles.

Verification

To verify mathematical scaling accuracy in CFC:
1. In CFC Editor, switch to online watch mode.
2. Inject a known test value into the analog input (e.g., force In1.Value = 1000.0).
3. Verify that Mul02.Out.Value outputs exactly 11.5 ($1000.0 \times 0.0115$).
4. Inject a test value of 100.0; confirm that the output displays 1.15.
5. Verify that signal status ST of Out reflects 16#80 (Good).

Limitations and Operational Precautions

Avoid performing chained multiplications and divisions with mixed integers and floats without explicit type conversion. In S7-400 CPUs, integer division truncates fractional remainders (e.g., $115 / 10000 = 0$ in integer math). Always ensure mathematical operations utilize REAL data types or explicit conversion blocks (DI_R) to prevent truncation to zero.

Engineer FAQ

Why did CFC reject 0.0115 while accepting 0.01?

Certain legacy or custom block parameter definitions enforce an edit mask limiting inputs to two decimal places. Entering scientific notation (1.15e-2) or switching to APL Mul02 resolves the restriction.

Can I use the S7-SCL language to create custom scaling math?

Yes. S7-SCL natively supports IEEE 754 32-bit REAL and 64-bit LREAL mathematics without graphical parameter formatting limits.

What block handles multiplication of up to 4 inputs in APL?

The APL block Mul04 (FB1861) accepts up to four floating-point inputs, multiplying them simultaneously.

Technical References

Related Articles

Related Tags

  • Mul02
  • Analog Scaling
  • Floating Point
  • Pcs7AnIn
  • Mathematical Blocks
6 respuestas