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
- Floating-Point Representation and Parameter Entry Limits
- Method 1: Utilizing APL Mul02 for High-Precision Scaling
- Method 2: Channel Driver Scaling in Pcs7AnIn
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
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:
REAL (IEEE 754)1.15e-2)DINT (Double Integer)AnaVal (APL Struct)Value: REAL + ST: BYTEIf 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:
- In the CFC block catalog, open PCS 7 AP Library -> Math -> Mul02 (FB1860).
- Place
Mul02in the same cyclic interrupt task as the analog sensor (e.g., OB35). - Connect the analog signal structure (e.g.,
Pcs7AnIn.PV_Out) to inputIn1. - In the parameter dialog for input
In2, type the constant:0.0115(or enter1.15e-2). Mul02automatically multiplies both inputs while propagating the Quality Code (ST):
$$Out.Value = In1.Value \cdot In2.Value$$
$$Out.ST = In1.ST$$- If the input signal carries bad quality (
16#00),Mul02ensures 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:
- Open properties of the
Pcs7AnInblock in CFC. - Locate the parameters
Scale.HighandScale.Low. - 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 - 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
- SIMATIC PCS 7 Advanced Process Library Manual (A5E33814036)
- SIMATIC PCS 7 Mathematical Blocks Function Manual (A5E33814038)
- SIMATIC S7-400 System and Standard Functions Manual (A5E00261404)
Related Articles
- Configuring APL TotalL Operating Modes: Integrator vs Summer in PCS 7
- Handling PROFIBUS DP WORD and 32-Bit BOOL Data as REAL in PCS 7 CFC
- Converting MATLAB Mathematical and State Logic into S7-SCL for PCS 7
Related Tags
- Mul02
- Analog Scaling
- Floating Point
- Pcs7AnIn
- Mathematical Blocks